Skip to content

Commit 0147a3e

Browse files
committed
refactor: 优化代码
1 parent 80415c9 commit 0147a3e

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

ui/src/views/application-overview/component/XPackDisplaySettingDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
v-model="dialogVisible"
66
:close-on-click-modal="false"
77
:close-on-press-escape="false"
8-
destroy-on-close
8+
:destroy-on-close="true"
99
align-center
1010
class="display-setting-dialog"
1111
>

ui/src/views/authentication/component/EditModal.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
template
22
<template>
3-
<el-drawer v-model="visible" size="60%" :append-to-body="true" destroy-on-close>
3+
<el-drawer v-model="visible" size="60%" :append-to-body="true" :destroy-on-close="true">
44
<template #header>
55
<div class="flex align-center" style="margin-left: -8px">
66
<h4>{{ currentPlatform.name + '设置' }}</h4>
@@ -112,11 +112,13 @@ const open = async (platform: Platform) => {
112112
113113
// 设置默认的 callback_url
114114
let defaultCallbackUrl = window.location.origin
115-
116-
// 根据平台设置特定的 callback_url
117115
switch (platform.key) {
118116
case 'wecom':
119117
case 'dingtalk':
118+
if (currentPlatform.config.agent_id) {
119+
currentPlatform.config.corp_id = currentPlatform.config.agent_id
120+
delete currentPlatform.config.agent_id
121+
}
120122
currentPlatform.config.callback_url = defaultCallbackUrl
121123
break
122124
case 'lark':

ui/src/views/authentication/component/SCAN.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ function createPlatform(key: string, name: string): Platform {
130130
}
131131
132132
const config = {
133+
...(key === 'dingtalk' ? { corp_id: '' } : {}),
133134
...(key === 'wecom' ? { corp_id: '', agent_id: '' } : { app_key: '' }),
134-
...(key === 'dingtalk' ? { agent_id: '' } : {}),
135135
app_secret: '',
136136
callback_url: ''
137137
}

ui/src/views/login/components/dingtalkQrCode.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useRouter } from 'vue-router'
1313
import { useScriptTag } from '@vueuse/core'
1414
import { defineProps, onMounted, ref } from 'vue'
1515
import useStore from '@/stores'
16+
import { MsgError } from '@/utils/message'
1617
1718
// 声明 DTFrameLogin 和 QRLogin 的类型
1819
declare global {
@@ -65,6 +66,7 @@ const props = defineProps<{
6566
config: {
6667
app_secret: string
6768
app_key: string
69+
agent_id?: string
6870
}
6971
}>()
7072
@@ -82,8 +84,10 @@ const initActive = async () => {
8284
8385
const data = {
8486
appKey: props.config.app_key,
85-
appSecret: props.config.app_secret
87+
appSecret: props.config.app_secret,
88+
agent_id: props.config.agent_id
8689
}
90+
console.log(props.config)
8791
8892
const redirectUri = encodeURIComponent(window.location.origin)
8993
@@ -99,7 +103,9 @@ const initActive = async () => {
99103
scope: 'openid',
100104
response_type: 'code',
101105
state: 'fit2cloud-ding-qr',
102-
prompt: 'consent'
106+
prompt: 'consent',
107+
exclusiveLogin: 'true',
108+
exclusiveCorpId: 'ding7fd29779c8cf3e0224f2f5cc6abecb85'
103109
},
104110
(loginResult) => {
105111
const authCode = loginResult.authCode
@@ -108,7 +114,7 @@ const initActive = async () => {
108114
})
109115
},
110116
(errorMsg: string) => {
111-
console.error(errorMsg)
117+
MsgError(errorMsg)
112118
}
113119
)
114120
} catch (error) {

0 commit comments

Comments
 (0)