From 6827ecaa767b23e4be620ef8e128fd76778f4d66 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 6 Jan 2026 15:25:14 +0800 Subject: [PATCH] perf: Optimization of DingTalk Client Embedding --- frontend/src/components/layout/Person.vue | 9 +++++-- .../src/views/login/xpack/PlatformClient.ts | 25 ++++++++----------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/layout/Person.vue b/frontend/src/components/layout/Person.vue index 75b6a657..160ffa4e 100644 --- a/frontend/src/components/layout/Person.vue +++ b/frontend/src/components/layout/Person.vue @@ -34,6 +34,11 @@ const account = computed(() => userStore.getAccount) const currentLanguage = computed(() => userStore.getLanguage) const isAdmin = computed(() => userStore.isAdmin) const isLocalUser = computed(() => !userStore.getOrigin) + +const platFlag = computed(() => { + const platformInfo = userStore.getPlatformInfo + return platformInfo?.flag || 0 +}) const dialogVisible = ref(false) const apikeyDialogVisible = ref(false) const aboutRef = ref() @@ -125,7 +130,7 @@ const logout = async () => {
{{ $t('common.system_manage') }}
-
+
@@ -177,7 +182,7 @@ const logout = async () => {
{{ $t('common.help') }}
-
+
diff --git a/frontend/src/views/login/xpack/PlatformClient.ts b/frontend/src/views/login/xpack/PlatformClient.ts index 856be249..ea2b5f73 100644 --- a/frontend/src/views/login/xpack/PlatformClient.ts +++ b/frontend/src/views/login/xpack/PlatformClient.ts @@ -75,27 +75,24 @@ export const loadClient = (category: LoginCategory) => { } const dingtalkClientRequest = async (id: string | null) => { - const dd = window['dd'] - if (dd?.requestAuthCode) { + if (!id) { const clientInfoRes = await queryClientInfo(7) - const corpId = id || clientInfoRes['corpid'] - const client_id = clientInfoRes['client_id'] - dd.requestAuthCode({ - corpId: corpId, - clientId: client_id, - onSuccess: function (result: any) { - ElMessage.success(JSON.stringify(result)) - const code = result.code + id = clientInfoRes['corpid'] + } + const dd = window['dd'] + dd.ready(function () { + dd.runtime.permission.requestAuthCode({ + corpId: id, + onSuccess: function (info: any) { + const code = info.code const state = `fit2cloud-dingtalk-client` toUrl(`?code=${code}&state=${state}`) }, onFail: function (err: any) { - console.error(err) + ElMessage.error(err) }, }) - } else { - ElMessage.error('not success') - } + }) } const larkClientRequest = async () => {