Commit 74880ce6 authored by linwenqing's avatar linwenqing

fix:授权手机号:1、授权手机号一次以后再授权失败,2、安卓手机点设备返回键提示微信自带的英文提示

parent 42e8efbf
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</view> </view>
</u-cell-item> </u-cell-item>
<u-cell-item title="手机号"> <u-cell-item title="手机号">
<view slot="right-icon"> <view slot="right-icon" @click.capture="refleshCode">
<button <button
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getPhonenumber" @getphonenumber="getPhonenumber"
...@@ -118,7 +118,6 @@ export default { ...@@ -118,7 +118,6 @@ export default {
}, },
onLoad() { onLoad() {
getApp().trackPage('我的信息') getApp().trackPage('我的信息')
this.refleshCode()
this.$u.api.getQiNiuToken({ bucketName: 'wsy-exam' }).then((res) => { this.$u.api.getQiNiuToken({ bucketName: 'wsy-exam' }).then((res) => {
this.qiToken = res this.qiToken = res
getApp().globalData.qiNiuToken = res getApp().globalData.qiNiuToken = res
...@@ -150,7 +149,11 @@ export default { ...@@ -150,7 +149,11 @@ export default {
let params = {} let params = {}
if (e && e.detail) { if (e && e.detail) {
if (e.detail.errMsg.indexOf('user deny') > -1) { if (e.detail.errMsg.indexOf('user deny') > -1) {
//拒绝授权 this.$refs.uToast.show({
title: '用户拒绝授权',
type: 'warning',
duration: 2000,
})
return return
} else if (e.detail.encryptedData && e.detail.iv) { } else if (e.detail.encryptedData && e.detail.iv) {
//允许授权-解析-更新手机号 //允许授权-解析-更新手机号
...@@ -160,8 +163,8 @@ export default { ...@@ -160,8 +163,8 @@ export default {
} }
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: e.detail.errMsg, title: '用户取消授权',
type: 'error', type: 'warning',
duration: 2000, duration: 2000,
}) })
return return
...@@ -169,7 +172,7 @@ export default { ...@@ -169,7 +172,7 @@ export default {
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '授权失败,请重新授权', title: '授权失败,请重新授权',
type: 'error', type: 'warning',
duration: 2000, duration: 2000,
}) })
return return
...@@ -195,11 +198,7 @@ export default { ...@@ -195,11 +198,7 @@ export default {
}, },
fail() { fail() {
// session_key 已经失效,需要重新执行登录流程 // session_key 已经失效,需要重新执行登录流程
setTimeout(() => { that.toLogin()
uni.navigateTo({
url: 'pages/login/index',
})
}, 800)
}, },
}) })
}, },
...@@ -233,17 +232,7 @@ export default { ...@@ -233,17 +232,7 @@ export default {
}) })
}) })
.catch((err) => { .catch((err) => {
this.$refs.uToast.show({ this.toLogin()
title: '请登录后再绑定',
type: 'warning',
duration: 2000,
})
this.$u.route({
url: 'pages/login/index',
params: {
path: 'pages/mine/info',
},
})
}) })
}, },
changeHead() { changeHead() {
...@@ -279,6 +268,13 @@ export default { ...@@ -279,6 +268,13 @@ export default {
this.$u.api.updateUserInfo(params) this.$u.api.updateUserInfo(params)
}) })
}, },
userRefuseTip() {
this.$refs.uToast.show({
title: '用户拒绝授权',
type: 'warning',
duration: 2000,
})
},
toLogin() { toLogin() {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '登录信息已失效,请重新登录', title: '登录信息已失效,请重新登录',
...@@ -288,6 +284,9 @@ export default { ...@@ -288,6 +284,9 @@ export default {
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
url: 'pages/login/index', url: 'pages/login/index',
params: {
path: 'pages/mine/info',
},
}) })
}, 800) }, 800)
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment