fix: update redirect logic for chat user login in dingtalk and wecom QR code components

This commit is contained in:
wxg0103 2025-07-30 16:03:23 +08:00
parent 00a4b09c99
commit 87eb5a879b
2 changed files with 18 additions and 12 deletions

View File

@ -102,26 +102,27 @@ const initActive = async () => {
{
redirect_uri: redirectUri,
client_id: data.appKey,
scope: 'openid',
scope: 'openid corpid',
response_type: 'code',
state: 'fit2cloud-ding-chat-qr',
prompt: 'consent',
corpId: data.corp_id
},
(loginResult) => {
console.log(loginResult)
const authCode = loginResult.authCode
chatUser.dingCallback(authCode, accessToken).then(() => {
router.push({name: 'home'})
router.push({
name: 'chat',
params: {accessToken: accessToken},
query: route.query,
})
})
},
(errorMsg: string) => {
console.log(errorMsg)
MsgError(errorMsg)
}
)
} catch (error) {
console.error(error)
}
}

View File

@ -15,6 +15,7 @@ import { ref, nextTick, defineProps } from 'vue'
import {MsgError} from '@/utils/message'
import useStore from '@/stores'
import {getBrowserLang} from '@/locales'
const router = useRouter()
const route = useRoute()
const {
@ -58,7 +59,11 @@ const init = async () => {
async onLoginSuccess({code}: any) {
chatUser.wecomCallback(code, accessToken).then(() => {
setTimeout(() => {
router.push({ name: 'home' })
router.push({
name: 'chat',
params: {accessToken: accessToken},
query: route.query,
})
})
})
},