补充微信登录和注册申请重提

This commit is contained in:
2026-09-07 12:11:20 +08:00
parent b4af2d6ab1
commit a26252c020
7 changed files with 60 additions and 2 deletions
+19 -2
View File
@@ -481,7 +481,24 @@ Page({
wx.navigateTo({ url: '/pages/register/index' })
},
wechatLogin() {
wx.showToast({ title: '请先使用账号登录', icon: 'none' })
async wechatLogin() {
try {
const loginResult = await new Promise((resolve, reject) => {
wx.login({ success: resolve, fail: reject })
})
const result = await authApi.wechatAutoLogin(loginResult.code)
if (result.status === 'NEED_MANUAL_LOGIN') {
wx.showToast({ title: '新账号请先完成手机号注册和身份审核', icon: 'none', duration: 2500 })
setTimeout(() => this.goRegister(), 900)
return
}
if (result.status !== 'SUCCESS' || !result.accessToken) {
throw new Error(result.message || '微信登录暂不可用')
}
getApp().setSession(result)
wx.reLaunch({ url: '/pages/planning/index' })
} catch (error) {
wx.showToast({ title: error.message || '微信快捷登录失败', icon: 'none' })
}
}
})