fix:多平台兼容

This commit is contained in:
2026-03-16 11:52:27 +08:00
parent b3836b8bf2
commit a79cf10bd4
18 changed files with 358 additions and 295 deletions
+15 -15
View File
@@ -131,18 +131,18 @@
}
// 微信快捷登录入口(备用,目前主流程使用一键手机号登录)
const onWeChatLogin = async () => {
try {
await checkAgreement()
await wxLogin()
uni.showToast({ title: t('auth.loginSuccess'), icon: 'success' })
await navigateAfterLogin()
} catch (error) {
if (error.message !== t('auth.pleaseAgreeToTerms')) {
uni.showToast({ title: error.message || t('auth.loginFailed'), icon: 'none' })
}
}
}
// const onWeChatLogin = async () => {
// try {
// await checkAgreement()
// await wxLogin()
// uni.showToast({ title: t('auth.loginSuccess'), icon: 'success' })
// await navigateAfterLogin()
// } catch (error) {
// if (error.message !== t('auth.pleaseAgreeToTerms')) {
// uni.showToast({ title: error.message || t('auth.loginFailed'), icon: 'none' })
// }
// }
// }
// 支付宝快捷登录入口(支付宝小程序)
const onAlipayLogin = async () => {
@@ -165,12 +165,12 @@
uni.showToast({ title: t('auth.phoneCancelled'), icon: 'none' })
return
}
console.log(e);
try {
// 先完成微信登录(/app/user/quickLogin,后端建立/查询 WECHAT_MINI 用户)
await wxLogin()
await wxLogin(e.detail.code)
// 再用微信返回的临时 code 换取手机号(后端按文档更新 phone 字段)
await getUserPhoneNumber(e.detail.code)
// await getUserPhoneNumber(e.detail.code)
uni.showToast({ title: t('auth.loginSuccess'), icon: 'success' })
await navigateAfterLogin()
} catch (error) {