From 89569d01c47a6fe9252395bd89d5c9511845a636 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 9 Apr 2026 18:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/login.vue | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/pages/login/login.vue b/pages/login/login.vue index 056ae7f..e7ff4b3 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -22,19 +22,38 @@ export default { data() { return { - + openidReady: false } }, onShareAppMessage() {}, onLoad() { - //this.login(); + var that = this; + util.getOpenidInfo(function() { + that.openidReady = true; + }, true); }, onReady() {}, onHide() {}, methods: { + getStoredOpenid: function() { + var user = uni.getStorageSync('userInfo_token') || {}; + return user.openid || (user.user_info ? user.user_info.openid : ''); + }, _getPhoneNumber: function(o) { - null != o.detail.iv ? this.getPhone(o) : util.alert('为了更好的为您服务,请允许访问您的手机号码'); + var that = this; + if (null == o.detail.iv) { + util.alert('为了更好的为您服务,请允许访问您的手机号码'); + return; + } + if (that.openidReady && that.getStoredOpenid()) { + that.getPhone(o); + return; + } + util.getOpenidInfo(function() { + that.openidReady = true; + that.getPhone(o); + }, true); @@ -88,11 +107,13 @@ getPhone: function(t) { var that = this; var code = t.detail.code; + var openid = this.getStoredOpenid(); console.log("code", code); util.request({ api: 'customer/mobile', data: { - code: code + code: code, + openid: openid }, method: 'POST', utilSuccess: function(e) {