Skip to content

Commit 3b3d6b2

Browse files
perf: Optimization of DingTalk Client Embedding
1 parent c78fc5d commit 3b3d6b2

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

frontend/src/components/layout/Person.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ const account = computed(() => userStore.getAccount)
3434
const currentLanguage = computed(() => userStore.getLanguage)
3535
const isAdmin = computed(() => userStore.isAdmin)
3636
const isLocalUser = computed(() => !userStore.getOrigin)
37+
38+
const platFlag = computed(() => {
39+
const platformInfo = userStore.getPlatformInfo
40+
return platformInfo?.flag || 0
41+
})
3742
const dialogVisible = ref(false)
3843
const apikeyDialogVisible = ref(false)
3944
const aboutRef = ref()
@@ -125,7 +130,7 @@ const logout = async () => {
125130
</el-icon>
126131
<div class="datasource-name">{{ $t('common.system_manage') }}</div>
127132
</div>
128-
<div v-if="isLocalUser" class="popover-item" @click="openPwd">
133+
<div v-if="isLocalUser && !platFlag" class="popover-item" @click="openPwd">
129134
<el-icon size="16">
130135
<icon_key_outlined></icon_key_outlined>
131136
</el-icon>
@@ -177,7 +182,7 @@ const logout = async () => {
177182
<div class="datasource-name">{{ $t('common.help') }}</div>
178183
</div>
179184
<div style="height: 4px; width: 100%"></div>
180-
<div class="popover-item mr4" @click="logout">
185+
<div v-if="platFlag <= 5" class="popover-item mr4" @click="logout">
181186
<el-icon size="16">
182187
<icon_logout_outlined></icon_logout_outlined>
183188
</el-icon>

frontend/src/views/login/xpack/PlatformClient.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,27 +75,24 @@ export const loadClient = (category: LoginCategory) => {
7575
}
7676

7777
const dingtalkClientRequest = async (id: string | null) => {
78-
const dd = window['dd']
79-
if (dd?.requestAuthCode) {
78+
if (!id) {
8079
const clientInfoRes = await queryClientInfo(7)
81-
const corpId = id || clientInfoRes['corpid']
82-
const client_id = clientInfoRes['client_id']
83-
dd.requestAuthCode({
84-
corpId: corpId,
85-
clientId: client_id,
86-
onSuccess: function (result: any) {
87-
ElMessage.success(JSON.stringify(result))
88-
const code = result.code
80+
id = clientInfoRes['corpid']
81+
}
82+
const dd = window['dd']
83+
dd.ready(function () {
84+
dd.runtime.permission.requestAuthCode({
85+
corpId: id,
86+
onSuccess: function (info: any) {
87+
const code = info.code
8988
const state = `fit2cloud-dingtalk-client`
9089
toUrl(`?code=${code}&state=${state}`)
9190
},
9291
onFail: function (err: any) {
93-
console.error(err)
92+
ElMessage.error(err)
9493
},
9594
})
96-
} else {
97-
ElMessage.error('not success')
98-
}
95+
})
9996
}
10097

10198
const larkClientRequest = async () => {

0 commit comments

Comments
 (0)