From d46ecfe86af027783c45855b5c415af73c2f854d Mon Sep 17 00:00:00 2001 From: tianyi <13521030702@163.com> Date: Mon, 23 Mar 2026 15:44:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package2/login/login.vue | 79 +++++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/package2/login/login.vue b/package2/login/login.vue index 64e2393..90cae90 100644 --- a/package2/login/login.vue +++ b/package2/login/login.vue @@ -52,18 +52,25 @@ - - - - - {{wayValue == 1?'选择登录物流':'选择登录店铺'}} - - - {{wayValue==1?item.companyName:item.shopName}} - + + + + {{wayValue == 1?'选择登录物流':'选择登录店铺'}} - - + + {{wayValue==1?item.companyName:item.shopName}} + + + + + + + + 获取手机号,为您提供更便捷的使用体验 + + + + @@ -171,6 +178,40 @@ } }).catch((res) => {}) }, + getPhoneNumber (e) { + console.log(e) + if (e.detail.code) { + // 将 code 发送给后端 + this.tui.request("/social/wechat/getPhone", "POST", { + code: e.detail.code + }, false, true).then((res) => { + if (res.code == 200) { + // 授权成功后的处理逻辑 + this.tui.toast('获取手机号成功'+res.result); + + // 如果后端返回了 phone,将其存入缓存,方便以后使用 + if (res.result) { + uni.setStorageSync('mobile', res.result); + } + } else { + this.tui.toast(res.message || '获取失败'); + } + }).catch((err) => { + console.log("请求异常: ", err); + this.tui.toast('请求获取手机号失败'); + }); + } else { + // 用户拒绝授权 + console.log('用户取消授权', e.detail.errMsg); + this.tui.toast('您取消了手机号授权'); + } + setTimeout(() => { + uni.reLaunch({ + url: '/pages/index/index' + }) + }, 200) + this.tui.toast('登录成功', 2000, true) + }, sectionChange(index) { this.wayValue = index; if(index == '2'){ @@ -297,12 +338,16 @@ uni.setStorageSync('unionid',res.result.user.unionid) uni.setStorageSync('miniProgramOpenid',res.result.user.miniProgramOpenid) uni.setStorageSync('officialAccountOpenid',res.result.user.officialAccountOpenid) - setTimeout(() => { - uni.reLaunch({ - url: '/pages/index/index' - }) - }, 200) - this.tui.toast('登录成功', 2000, true) + if(res.result.user.mobile == null){ + that.$refs.mobilePopup.open('bottom') + }else{ + setTimeout(() => { + uni.reLaunch({ + url: '/pages/index/index' + }) + }, 200) + that.tui.toast('登录成功', 2000, true) + } } else { that.tui.toast(res.message) }