From e2b626f3dfa796eea027be2fb6f0b6b395c52420 Mon Sep 17 00:00:00 2001 From: yangsanTT <812952667@qq.com> Date: Tue, 1 Jun 2021 00:38:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8F=90=E4=BA=A4H5=20=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/register.vue | 9 +++++---- pages/order/confirmation.vue | 6 +++--- pages/pay/payment/payment.vue | 3 ++- pages/tabBar/home/home.vue | 26 +++++++++++++++++++++----- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/pages/login/register.vue b/pages/login/register.vue index fc71626..ec54a3c 100644 --- a/pages/login/register.vue +++ b/pages/login/register.vue @@ -18,7 +18,8 @@ - 立即注册 + 立即注册 + 绑定手机号 @@ -172,9 +173,9 @@ key: "token", data: res.return_data.uniqueCode }) - uni.reLaunch({ - url: '/pages/tabBar/home/home' - }); + uni.navigateBack({ + }) + } else { uni.showToast({ title: res.return_msg, diff --git a/pages/order/confirmation.vue b/pages/order/confirmation.vue index 132f96f..024a3de 100644 --- a/pages/order/confirmation.vue +++ b/pages/order/confirmation.vue @@ -148,8 +148,8 @@ - - + + @@ -205,11 +205,11 @@ }, onLoad(option) { this.couponId = option.id; - this.user = app.globalData.userInfo; this.getCouponById(); this.getUserNormalDiscountList(); }, onShow() { + this.user = app.globalData.userInfo; }, onHide() { diff --git a/pages/pay/payment/payment.vue b/pages/pay/payment/payment.vue index 94d65fd..76a9674 100644 --- a/pages/pay/payment/payment.vue +++ b/pages/pay/payment/payment.vue @@ -120,7 +120,8 @@ } orderToPay(params).then(res => { if (res.return_code == '000000') { - + + uni.pay uni.requestPayment({ "appId": res.return_data.appId, "nonceStr": res.return_data.nonceStr, diff --git a/pages/tabBar/home/home.vue b/pages/tabBar/home/home.vue index 5b5ba98..a697bfb 100644 --- a/pages/tabBar/home/home.vue +++ b/pages/tabBar/home/home.vue @@ -105,7 +105,7 @@ - + @@ -117,7 +117,7 @@ getH5UserInfo } from "../../../Utils/Api.js"; //您的api路径 let app = getApp(); - export default { + export default { data() { return { showHeader: true, @@ -174,12 +174,18 @@ // #ifdef H5 var arr1 = window.location.href; var arr2 = arr1.split('='); - if (!app.globalData.userInfo && arr2[1] !=undefined) { + console.log(arr2); + if (!app.globalData.userInfo && arr2[1] != undefined) { this.getH5UserInfo(arr2[1]); } // #endif }, onLoad() { + if (this.isWeiXinLogin()) { + //微信内核支付 + } + + // 1.wx获取登录用户code // #ifdef MP uni.login({ @@ -252,6 +258,15 @@ } }) }, + //微信内核浏览器 + isWeiXinLogin() { + var ua = navigator.userAgent.toLowerCase(); + if (ua.search(/MicroMessenger/i) > -1) { + return true; + } else { + return false; + } + }, //获取H5用户信息 getH5UserInfo(item) { let params = { @@ -263,7 +278,6 @@ .object .highUser; app.globalData.token = res.return_data.uniqueCode; - that.isShowAuth = false uni.setStorage({ key: "user", data: res.return_data @@ -274,7 +288,9 @@ key: "token", data: res.return_data.uniqueCode }) - + app.globalData.openId = res.return_data + .object + .highUser.openIdH5; } else { uni.showToast({ title: res.return_msg