mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 09:17:06 +08:00
perf: Optimization of DingTalk Client Embedding
This commit is contained in:
committed by
fit2cloud-chenyw
parent
c78fc5d88b
commit
3b3d6b2af4
@@ -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 () => {
|
||||
</el-icon>
|
||||
<div class="datasource-name">{{ $t('common.system_manage') }}</div>
|
||||
</div>
|
||||
<div v-if="isLocalUser" class="popover-item" @click="openPwd">
|
||||
<div v-if="isLocalUser && !platFlag" class="popover-item" @click="openPwd">
|
||||
<el-icon size="16">
|
||||
<icon_key_outlined></icon_key_outlined>
|
||||
</el-icon>
|
||||
@@ -177,7 +182,7 @@ const logout = async () => {
|
||||
<div class="datasource-name">{{ $t('common.help') }}</div>
|
||||
</div>
|
||||
<div style="height: 4px; width: 100%"></div>
|
||||
<div class="popover-item mr4" @click="logout">
|
||||
<div v-if="platFlag <= 5" class="popover-item mr4" @click="logout">
|
||||
<el-icon size="16">
|
||||
<icon_logout_outlined></icon_logout_outlined>
|
||||
</el-icon>
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user