fix: update redirect logic for chat user login in dingtalk and wecom QR code components
This commit is contained in:
parent
00a4b09c99
commit
87eb5a879b
@ -102,26 +102,27 @@ const initActive = async () => {
|
|||||||
{
|
{
|
||||||
redirect_uri: redirectUri,
|
redirect_uri: redirectUri,
|
||||||
client_id: data.appKey,
|
client_id: data.appKey,
|
||||||
scope: 'openid',
|
scope: 'openid corpid',
|
||||||
response_type: 'code',
|
response_type: 'code',
|
||||||
state: 'fit2cloud-ding-chat-qr',
|
state: 'fit2cloud-ding-chat-qr',
|
||||||
prompt: 'consent',
|
prompt: 'consent',
|
||||||
corpId: data.corp_id
|
corpId: data.corp_id
|
||||||
},
|
},
|
||||||
(loginResult) => {
|
(loginResult) => {
|
||||||
console.log(loginResult)
|
|
||||||
const authCode = loginResult.authCode
|
const authCode = loginResult.authCode
|
||||||
chatUser.dingCallback(authCode, accessToken).then(() => {
|
chatUser.dingCallback(authCode, accessToken).then(() => {
|
||||||
router.push({name: 'home'})
|
router.push({
|
||||||
|
name: 'chat',
|
||||||
|
params: {accessToken: accessToken},
|
||||||
|
query: route.query,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
(errorMsg: string) => {
|
(errorMsg: string) => {
|
||||||
console.log(errorMsg)
|
|
||||||
MsgError(errorMsg)
|
MsgError(errorMsg)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,18 +11,19 @@ import {
|
|||||||
WWLoginRedirectType,
|
WWLoginRedirectType,
|
||||||
WWLoginType
|
WWLoginType
|
||||||
} from '@wecom/jssdk'
|
} from '@wecom/jssdk'
|
||||||
import { ref, nextTick, defineProps } from 'vue'
|
import {ref, nextTick, defineProps} from 'vue'
|
||||||
import { MsgError } from '@/utils/message'
|
import {MsgError} from '@/utils/message'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { getBrowserLang } from '@/locales'
|
import {getBrowserLang} from '@/locales'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: {accessToken},
|
params: {accessToken},
|
||||||
} = route as any
|
} = route as any
|
||||||
const wwLogin = ref({})
|
const wwLogin = ref({})
|
||||||
const obj = ref<any>({ isWeComLogin: false })
|
const obj = ref<any>({isWeComLogin: false})
|
||||||
const { chatUser } = useStore()
|
const {chatUser} = useStore()
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
config: {
|
config: {
|
||||||
@ -55,10 +56,14 @@ const init = async () => {
|
|||||||
panel_size: WWLoginPanelSizeType.small
|
panel_size: WWLoginPanelSizeType.small
|
||||||
},
|
},
|
||||||
onCheckWeComLogin: obj.value,
|
onCheckWeComLogin: obj.value,
|
||||||
async onLoginSuccess({ code }: any) {
|
async onLoginSuccess({code}: any) {
|
||||||
chatUser.wecomCallback(code, accessToken).then(() => {
|
chatUser.wecomCallback(code, accessToken).then(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
router.push({ name: 'home' })
|
router.push({
|
||||||
|
name: 'chat',
|
||||||
|
params: {accessToken: accessToken},
|
||||||
|
query: route.query,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user