From f7d9d64673954d7ceaf6145924e1ede35603f10f Mon Sep 17 00:00:00 2001 From: yangsanTT <812952667@qq.com> Date: Tue, 1 Jun 2021 21:10:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=BE=AE=E4=BF=A1=E5=86=85?= =?UTF-8?q?=E7=BD=AE=E6=B5=8F=E8=A7=88=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/register.vue | 21 ++++++++++++++++++--- pages/tabBar/home/home.vue | 13 ------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pages/login/register.vue b/pages/login/register.vue index 0060a2c..892615a 100644 --- a/pages/login/register.vue +++ b/pages/login/register.vue @@ -145,9 +145,15 @@ key: "token", data: res.return_data.uniqueCode }) - location.href = - 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect' - + if (this.isWeiXinLogin()) { + //微信内核支付 + location.href ='https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect' + }else{ + uni.reLaunch({ + url: '/pages/tabBar/home/home' + }) + } + } else { uni.showToast({ title: res.return_msg, @@ -184,6 +190,15 @@ } }, + //微信内核浏览器 + isWeiXinLogin() { + var ua = navigator.userAgent.toLowerCase(); + if (ua.search(/MicroMessenger/i) > -1) { + return true; + } else { + return false; + } + }, //微信登录 openWx() { location.href = diff --git a/pages/tabBar/home/home.vue b/pages/tabBar/home/home.vue index f87a715..b9cde28 100644 --- a/pages/tabBar/home/home.vue +++ b/pages/tabBar/home/home.vue @@ -185,10 +185,6 @@ // #endif }, onLoad() { - if (this.isWeiXinLogin()) { - //微信内核支付 - } - // 1.wx获取登录用户code // #ifdef MP uni.login({ @@ -286,15 +282,6 @@ }); }, - //微信内核浏览器 - isWeiXinLogin() { - var ua = navigator.userAgent.toLowerCase(); - if (ua.search(/MicroMessenger/i) > -1) { - return true; - } else { - return false; - } - }, //获取H5用户信息 getH5UserInfo(item) { let params = {