weizong song 2 weeks ago
parent 3ccced9c01
commit 9d39f58d25

@ -6,6 +6,11 @@
// #endif // #endif
export default { export default {
data() {
return {
h5LoginInFlight: false
}
},
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
// //
@ -153,6 +158,11 @@
// H5 // H5
wxH5AuthLogin() { wxH5AuthLogin() {
if (this.h5LoginInFlight) {
console.log('[App] 登录流程进行中,跳过重复调用')
return
}
// //
const isWeixinBrowser = /MicroMessenger/i.test(navigator.userAgent) const isWeixinBrowser = /MicroMessenger/i.test(navigator.userAgent)
if (!isWeixinBrowser) { if (!isWeixinBrowser) {
@ -202,6 +212,8 @@
console.log('[App] 提取到的 code:', code) console.log('[App] 提取到的 code:', code)
if (code) { if (code) {
this.h5LoginInFlight = true
// URL code // URL code
try { try {
const url = new URL(link) const url = new URL(link)
@ -238,6 +250,9 @@
fail: (err) => { fail: (err) => {
console.error('[App] 获取 token 失败:', err) console.error('[App] 获取 token 失败:', err)
uni.showToast({ title: '网络错误,请重试', icon: 'none' }) uni.showToast({ title: '网络错误,请重试', icon: 'none' })
},
complete: () => {
this.h5LoginInFlight = false
} }
}) })
} else { } else {

Loading…
Cancel
Save