From 4e77e01f068e8ea2ec914698aa55fcf369afc919 Mon Sep 17 00:00:00 2001 From: qingyiay <2386314947@qq.com> Date: 星期一, 15 五月 2023 11:17:25 +0800 Subject: [PATCH] 司机首页修改 --- pages/login/login.vue | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/pages/login/login.vue b/pages/login/login.vue index 944adea..c362e72 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -61,6 +61,7 @@ uni.login({ success: res => { if (res.code) { + uni.setStorageSync('code', res.code); this.apiLogin(res.code); } else { uni.showToast({ @@ -80,21 +81,20 @@ uni.showLoading({ title: '鍔犺浇涓�...' }); - wx.request({ - url: `https://api.weixin.qq.com/sns/jscode2session?appid=wx4a62fc1684c429a9&secret=ee90afe376cdcec2fdd947c0a4db961a&js_code=${code}&grant_type=authorization_code`, - success(res) { - uni.setStorageSync('openid', res.data.openid); - uni.showToast({ - title: '鎴愬姛鑾峰彇娴嬭瘯openid', - icon: 'none' - }); - } - }); + // wx.request({ + // url: `https://api.weixin.qq.com/sns/jscode2session?appid=wx4a62fc1684c429a9&secret=ee90afe376cdcec2fdd947c0a4db961a&js_code=${code}&grant_type=authorization_code`, + // success(res) { + // uni.setStorageSync('openid', res.data.openid); + // uni.showToast({ + // title: '鎴愬姛鑾峰彇娴嬭瘯openid', + // icon: 'none' + // }); + // } + // }); this.$nextTick(() => { - apiLoginWx({ code: uni.getStorageSync('openid') }).then(res => { - uni.hideLoading(); + apiLoginWx({ code: code }).then(res => { if (res.code != 1) { - this.$u.toast('鎭枩鎮紝鐧诲綍鎴愬姛锛�'); + this.$u.toast('鐧诲綍鎴愬姛'); // 鐧婚檰鎴愬姛锛屽瓨鍌ㄧ浉鍏充俊鎭� setToken(res.access_token); setRefreshToken(res.refresh_token); @@ -104,6 +104,7 @@ this.setUserTabbar(res.data.type); uni.setStorageSync('roleType', res.data.type); setCustomerId(res.data.customerid); + uni.hideLoading(); //璺宠浆椤甸潰 this.$nextTick(() => { redirectHome(); @@ -119,7 +120,7 @@ }, bindWxConfirm() { uni.navigateTo({ - url: `/pages/login/wxLogin?code=${uni.getStorageSync('openid')}` + url: `/pages/login/wxLogin?code=${uni.getStorageSync('code')}` }); this.bindWxModelShow = false; }, -- Gitblit v1.9.1