From 3c1fc03e1fc9842846ce469355500c37f8d7c7a3 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Mon, 8 Apr 2024 10:43:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BagAuth/pages/login/login.vue | 65 ++++++++++++++++++-------------- BagAuth/pages/login/oldLogin.vue | 2 +- pages/tabbar/home/home.vue | 12 ++++-- utils/tool.js | 9 ++--- 4 files changed, 50 insertions(+), 38 deletions(-) diff --git a/BagAuth/pages/login/login.vue b/BagAuth/pages/login/login.vue index dd1545f..cfbb490 100644 --- a/BagAuth/pages/login/login.vue +++ b/BagAuth/pages/login/login.vue @@ -23,24 +23,23 @@ 加载中... - @@ -174,28 +173,36 @@ }) }, decryptPhoneNumber(e) { - if (!this.checked) { - uni.showToast({ - title: '请您阅读并同意协议', - icon: 'none' - }) - return - } - if (e.detail.errMsg === 'getPhoneNumber:ok') { - const data1 = { - ...e.detail, - sessionKey: this.sessionKey, - unionId: uni.getStorageSync('unionid'), - openId: uni.getStorageSync('openid'), + uni.getSetting({ + success: () => { + if (e.detail.errMsg === 'getPhoneNumber:ok') { + const data1 = { + ...e.detail, + sessionKey: this.sessionKey, + unionId: uni.getStorageSync('unionid'), + openId: uni.getStorageSync('openid'), + } + let url1 = 0 == this.TabCur ? 'bindLoginByPhonePersonal' : + 'bindLoginByPhoneCompany' + this.bindLoginByPhone(data1, url1) + } } - let url1 = 0 == this.TabCur ? 'bindLoginByPhonePersonal' : 'bindLoginByPhoneCompany' - this.bindLoginByPhone(data1, url1) - } else { - uni.showModal({ - title: '用户拒绝手机号的授权', - content: `请输入手机号码登录,如有疑问,请联系客服处理` - }) - } + }) + + // if (!this.checked) { + // uni.showToast({ + // title: '请您阅读并同意协议', + // icon: 'none' + // }) + // return + // } + + // else { + // uni.showModal({ + // title: '用户拒绝手机号的授权', + // content: `请输入手机号码登录,如有疑问,请联系客服处理` + // }) + // } }, bindLoginByPhone(data, url) { if (this.count < 1) { @@ -313,4 +320,4 @@ background-color: transparent; color: #555555; } - + \ No newline at end of file diff --git a/BagAuth/pages/login/oldLogin.vue b/BagAuth/pages/login/oldLogin.vue index 522656c..26b2d57 100644 --- a/BagAuth/pages/login/oldLogin.vue +++ b/BagAuth/pages/login/oldLogin.vue @@ -465,7 +465,7 @@ } else { this.userHandle = true uni.showModal({ - title: '用户拒绝了手机号的授权,并给你一个大耳巴子', + title: '用户拒绝了手机号的授权', content: `如有疑问,请联系客服处理` }) } diff --git a/pages/tabbar/home/home.vue b/pages/tabbar/home/home.vue index b26d652..126f809 100644 --- a/pages/tabbar/home/home.vue +++ b/pages/tabbar/home/home.vue @@ -318,12 +318,18 @@ success: (res) => { if (!res.authSetting['scope.userLocation']) { uni.showModal({ - title: '请您打开定位权限', - content: '用于获取您当前位置附近的油站', + title: '提示', + content: '您暂无授权定位权限,将无法显示附近油站', confirmText: '去设置', success: (resSec) => { if (resSec.confirm) { - uni.openSetting({}) + uni.openSetting({ + success:(resThird) => { + if (resThird.authSetting['scope.userLocation']) { + this.refreshLocation() + } + } + }) } } }) diff --git a/utils/tool.js b/utils/tool.js index abd5288..9f77e32 100644 --- a/utils/tool.js +++ b/utils/tool.js @@ -222,22 +222,21 @@ export default { success(res) { console.log(res.authSetting,'res.authSetting') if (!res.authSetting[ 'scope.userLocation']) { - console.log('用户没有授权用户没有授权用户没有授权用户没有授权') + // console.log('用户没有授权用户没有授权用户没有授权用户没有授权') // 用户没有授权 uni.showModal({ title: '提示', - content: '您暂无授权定位权限,将无法显示油站距离', + content: '您暂无授权定位权限,将无法显示附近油站', + confirmText: '去设置', success(res) { if (res.confirm) { wx.openSetting({ success(res) { if (res.authSetting['scope.userLocation']) { re() - // 授权成功,重新定位 } else { - // 没有允许定位权限 wx.showToast({ - title: '您拒绝了定位权限,将无法使用附近电站站功能', + title: '您拒绝了定位权限', icon: 'none' }); rj('拒绝了定位权限')