weizong song 6 months ago
parent 3ccced9c01
commit 9d39f58d25

@ -6,6 +6,11 @@
// #endif
export default {
data() {
return {
h5LoginInFlight: false
}
},
onLaunch: function() {
console.log('App Launch')
// 判断环境
@ -153,6 +158,11 @@
// 微信公众号H5授权登录
wxH5AuthLogin() {
if (this.h5LoginInFlight) {
console.log('[App] 登录流程进行中,跳过重复调用')
return
}
// 判断是否在微信客户端中打开
const isWeixinBrowser = /MicroMessenger/i.test(navigator.userAgent)
if (!isWeixinBrowser) {
@ -202,6 +212,8 @@
console.log('[App] 提取到的 code:', code)
if (code) {
this.h5LoginInFlight = true
// 清理 URL 中的 code 参数,避免重复登录
try {
const url = new URL(link)
@ -238,6 +250,9 @@
fail: (err) => {
console.error('[App] 获取 token 失败:', err)
uni.showToast({ title: '网络错误,请重试', icon: 'none' })
},
complete: () => {
this.h5LoginInFlight = false
}
})
} else {

Loading…
Cancel
Save