From 155d3b4b0eb286f11010c0e213b1cf52f57d0f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=BF=94=E5=AE=87-=E6=97=85=E7=AE=A1=E5=AE=B6?= <153298343@qq.com> Date: Tue, 6 Sep 2022 08:51:24 +0800 Subject: [PATCH] up --- components/wechat-auth/wechat-auth.vue | 78 +++++++++++++++++ .../pages/shopDetail/shopDetail.vue | 86 +++++++++++++++++-- 2 files changed, 156 insertions(+), 8 deletions(-) create mode 100644 components/wechat-auth/wechat-auth.vue diff --git a/components/wechat-auth/wechat-auth.vue b/components/wechat-auth/wechat-auth.vue new file mode 100644 index 0000000..0b077aa --- /dev/null +++ b/components/wechat-auth/wechat-auth.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/packages/packageBuy/pages/shopDetail/shopDetail.vue b/packages/packageBuy/pages/shopDetail/shopDetail.vue index 46a0ce8..75eaa5f 100644 --- a/packages/packageBuy/pages/shopDetail/shopDetail.vue +++ b/packages/packageBuy/pages/shopDetail/shopDetail.vue @@ -138,7 +138,7 @@ {{arrRegion[rindex]}} - @@ -194,6 +194,21 @@ + 跳过>> + + + + + + + 为了更好的提供服务请授权您的微信昵称 + + + + + @@ -216,6 +231,7 @@ }) return { id: "", + showPass: false, info: {}, dataList: [], form: { @@ -256,6 +272,7 @@ poster: "", showUser: false, showPhone: false, + } }, onShareAppMessage() { @@ -267,20 +284,26 @@ } }, onShow() { + var that = this; weixin.getOpenidInfo(info => { - that.user_info = info.user_info; that.openid = that.user_info.openid; that.form.member_name = that.user_info.name || that.user_info.wechat_nickname; that.form.phone = that.user_info.phone; - }, true); + if (weixin.isNull(info.user_info.wechat_nickname) || weixin.isNull(info.user_info.avatar)) { + that.showUser = true; + } else { + that.form.member_name = info.user_info.wechat_nickname; + } + + that.loadInfo(); + that.loadPage(); + }, true); - this.loadInfo(); - this.loadPage(); }, onLoad(options) { var that = this; @@ -307,6 +330,45 @@ }, methods: { + toPassGetPhone() { + this.showPhone = false; + this.showPop = true; + }, + touserInfoClose() { + this.showUser = false; + }, + getUserProfile() { + var that = this; + weixin.getUserProfile((res) => { + console.log(res) + weixin.request({ + api: '/api/member/update-wechat-info', + method: 'POST', + data: { + nickname: res.nickName, + avatar: res.avatarUrl + }, + utilSuccess: function(r) { + console.log(r) + if (r.status == 1) { + weixin.getOpenidInfo(openidInfo => { + that.user_info.wechat_nickname = openidInfo.user_info + .wechat_nickname; + that.user_info.avatar = openidInfo.user_info.avatar; + }, true) + that.showUser = false; + } else { + uni.showToast({ + title: r.data.msg, + duration: 2000, + icon: 'none' + }) + } + } + + }) + }) + }, getPhoneNumber(e) { let that = this; if (e.detail.iv) { @@ -324,6 +386,7 @@ }, success: (r) => { if (r.data.status == 1) { + that.showPass = false; weixin.getOpenidInfo(openidInfo => { uni.setStorageSync("userInfo", openidInfo) that.form.phone = openidInfo.user_info.phone; @@ -334,9 +397,10 @@ duration: 2000, icon: 'none' }) - } - - that.showPhone = false; + that.showPass = true; + } + + that.showPhone = false; that.showPop = true; } }) @@ -758,6 +822,12 @@ border: none } + .userBoxBottomPass { + font-size: 28rpx; + text-align: center; + padding: 20rpx 0rpx; + } + .payBtn { width: 90%; height: 100rpx;