Commit 61762daf authored by lijin's avatar lijin

modified

parent aeff5d36
......@@ -83,18 +83,35 @@ export default {
// 检查授权回调
checkAuthCallback() {
const urlParams = new URLSearchParams(window.location.search)
const code = urlParams.get('code')
const error = urlParams.get('error')
const state = urlParams.get('state')
if (code) {
// 授权成功
this.authStatus = 'success'
const authStatus = urlParams.get('authStatus')
const errorMessage = urlParams.get('errorMessage')
// 直接从URL参数获取状态
if (authStatus) {
this.authStatus = authStatus
// 如果有错误消息,设置错误消息
if (errorMessage) {
this.errorMessage = decodeURIComponent(errorMessage)
}
// 清理URL参数
this.cleanUrl()
} else if (error) {
// 授权失败
this.showError('用户拒绝授权或授权过程中出现错误')
} else {
// 兼容原有的code/error参数检查(可选)
const code = urlParams.get('code')
const error = urlParams.get('error')
if (code) {
// 授权成功
this.authStatus = 'success'
this.cleanUrl()
} else if (error) {
// 授权失败
this.authStatus = 'error'
this.errorMessage = '用户拒绝授权或授权过程中出现错误'
this.cleanUrl()
}
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment