Commit fe844c9d authored by linwenqing's avatar linwenqing

fix:授权手机号

parent 74880ce6
...@@ -149,6 +149,7 @@ export default { ...@@ -149,6 +149,7 @@ 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) {
uni.hideLoading()
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '用户拒绝授权', title: '用户拒绝授权',
type: 'warning', type: 'warning',
...@@ -162,6 +163,7 @@ export default { ...@@ -162,6 +163,7 @@ export default {
iv: e.detail.iv, iv: e.detail.iv,
} }
} else { } else {
uni.hideLoading()
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '用户取消授权', title: '用户取消授权',
type: 'warning', type: 'warning',
...@@ -170,6 +172,7 @@ export default { ...@@ -170,6 +172,7 @@ export default {
return return
} }
} else { } else {
uni.hideLoading()
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '授权失败,请重新授权', title: '授权失败,请重新授权',
type: 'warning', type: 'warning',
...@@ -202,8 +205,14 @@ export default { ...@@ -202,8 +205,14 @@ export default {
}, },
}) })
}, },
inGetPhone() {
uni.showLoading({
title: '授权中...',
})
},
refleshCode() { refleshCode() {
let that = this let that = this
this.inGetPhone()
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: (code_res) => { success: (code_res) => {
...@@ -219,11 +228,13 @@ export default { ...@@ -219,11 +228,13 @@ export default {
.loginWechatAuth(params) .loginWechatAuth(params)
.then((res) => { .then((res) => {
this.student.phoneNumber = res.phoneNumber this.student.phoneNumber = res.phoneNumber
this.inGetPhone()
this.$u.api this.$u.api
.updateUserInfo({ .updateUserInfo({
phoneNumber: res.phoneNumber, phoneNumber: res.phoneNumber,
}) })
.then((ret) => { .then((ret) => {
uni.hideLoading()
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '绑定成功!', title: '绑定成功!',
type: 'success', type: 'success',
......
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