mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: 优化代码
This commit is contained in:
parent
80415c9372
commit
0147a3efd0
|
|
@ -5,7 +5,7 @@
|
|||
v-model="dialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
destroy-on-close
|
||||
:destroy-on-close="true"
|
||||
align-center
|
||||
class="display-setting-dialog"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
template
|
||||
<template>
|
||||
<el-drawer v-model="visible" size="60%" :append-to-body="true" destroy-on-close>
|
||||
<el-drawer v-model="visible" size="60%" :append-to-body="true" :destroy-on-close="true">
|
||||
<template #header>
|
||||
<div class="flex align-center" style="margin-left: -8px">
|
||||
<h4>{{ currentPlatform.name + '设置' }}</h4>
|
||||
|
|
@ -112,11 +112,13 @@ const open = async (platform: Platform) => {
|
|||
|
||||
// 设置默认的 callback_url
|
||||
let defaultCallbackUrl = window.location.origin
|
||||
|
||||
// 根据平台设置特定的 callback_url
|
||||
switch (platform.key) {
|
||||
case 'wecom':
|
||||
case 'dingtalk':
|
||||
if (currentPlatform.config.agent_id) {
|
||||
currentPlatform.config.corp_id = currentPlatform.config.agent_id
|
||||
delete currentPlatform.config.agent_id
|
||||
}
|
||||
currentPlatform.config.callback_url = defaultCallbackUrl
|
||||
break
|
||||
case 'lark':
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ function createPlatform(key: string, name: string): Platform {
|
|||
}
|
||||
|
||||
const config = {
|
||||
...(key === 'dingtalk' ? { corp_id: '' } : {}),
|
||||
...(key === 'wecom' ? { corp_id: '', agent_id: '' } : { app_key: '' }),
|
||||
...(key === 'dingtalk' ? { agent_id: '' } : {}),
|
||||
app_secret: '',
|
||||
callback_url: ''
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import { useRouter } from 'vue-router'
|
|||
import { useScriptTag } from '@vueuse/core'
|
||||
import { defineProps, onMounted, ref } from 'vue'
|
||||
import useStore from '@/stores'
|
||||
import { MsgError } from '@/utils/message'
|
||||
|
||||
// 声明 DTFrameLogin 和 QRLogin 的类型
|
||||
declare global {
|
||||
|
|
@ -65,6 +66,7 @@ const props = defineProps<{
|
|||
config: {
|
||||
app_secret: string
|
||||
app_key: string
|
||||
agent_id?: string
|
||||
}
|
||||
}>()
|
||||
|
||||
|
|
@ -82,8 +84,10 @@ const initActive = async () => {
|
|||
|
||||
const data = {
|
||||
appKey: props.config.app_key,
|
||||
appSecret: props.config.app_secret
|
||||
appSecret: props.config.app_secret,
|
||||
agent_id: props.config.agent_id
|
||||
}
|
||||
console.log(props.config)
|
||||
|
||||
const redirectUri = encodeURIComponent(window.location.origin)
|
||||
|
||||
|
|
@ -99,7 +103,9 @@ const initActive = async () => {
|
|||
scope: 'openid',
|
||||
response_type: 'code',
|
||||
state: 'fit2cloud-ding-qr',
|
||||
prompt: 'consent'
|
||||
prompt: 'consent',
|
||||
exclusiveLogin: 'true',
|
||||
exclusiveCorpId: 'ding7fd29779c8cf3e0224f2f5cc6abecb85'
|
||||
},
|
||||
(loginResult) => {
|
||||
const authCode = loginResult.authCode
|
||||
|
|
@ -108,7 +114,7 @@ const initActive = async () => {
|
|||
})
|
||||
},
|
||||
(errorMsg: string) => {
|
||||
console.error(errorMsg)
|
||||
MsgError(errorMsg)
|
||||
}
|
||||
)
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue