Commit 2ec167e1 authored by linwenqing's avatar linwenqing

fix:手机号授权

parent 51608cb8
...@@ -117,12 +117,16 @@ export default { ...@@ -117,12 +117,16 @@ export default {
}, },
}, },
onLoad() { onLoad() {
uni.showLoading({
title: '加载中',
})
getApp().trackPage('我的信息') getApp().trackPage('我的信息')
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
}) })
this.$u.api.getUserInfo().then((res) => { this.$u.api.getUserInfo().then((res) => {
uni.hideLoading()
if (res) { if (res) {
res.isCertify = res.isCertify =
res && res.identityNumber && res.identityNumber.length > 5 res && res.identityNumber && res.identityNumber.length > 5
...@@ -157,6 +161,7 @@ export default { ...@@ -157,6 +161,7 @@ export default {
}) })
return return
} else if (e.detail.encryptedData && e.detail.iv) { } else if (e.detail.encryptedData && e.detail.iv) {
this.inGetPhone()
//允许授权-解析-更新手机号 //允许授权-解析-更新手机号
params = { params = {
encryptedData: e.detail.encryptedData, encryptedData: e.detail.encryptedData,
...@@ -205,6 +210,19 @@ export default { ...@@ -205,6 +210,19 @@ export default {
}, },
}) })
}, },
inGetPhone() {
uni.showLoading({
title: '授权中...',
})
},
inUpload() {
if (uni.getSystemInfoSync().platform === 'android') {
return
}
uni.showLoading({
title: '上传中...',
})
},
refleshCode() { refleshCode() {
let that = this let that = this
uni.login({ uni.login({
...@@ -222,6 +240,7 @@ export default { ...@@ -222,6 +240,7 @@ 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,
...@@ -240,6 +259,7 @@ export default { ...@@ -240,6 +259,7 @@ export default {
}) })
}, },
changeHead() { changeHead() {
this.inUpload()
//更换头像 //更换头像
upload.getPhoto(2, this.qiToken).then((res) => { upload.getPhoto(2, this.qiToken).then((res) => {
this.student.avatarPath = process.uniEnv.qn_asset_url + res.key this.student.avatarPath = process.uniEnv.qn_asset_url + res.key
...@@ -252,10 +272,14 @@ export default { ...@@ -252,10 +272,14 @@ export default {
...params, ...params,
} }
getApp().track('changeAvatar', trackParams) getApp().track('changeAvatar', trackParams)
this.$u.api.updateUserInfo(params) this.inUpload()
this.$u.api.updateUserInfo(params).then(() => {
uni.hideLoading()
})
}) })
}, },
changeCertPhoto() { changeCertPhoto() {
this.inUpload()
//更换证件头像 //更换证件头像
upload.getPhoto(2, this.qiToken).then((res) => { upload.getPhoto(2, this.qiToken).then((res) => {
this.student.certificatePhotoPath = this.student.certificatePhotoPath =
...@@ -269,7 +293,10 @@ export default { ...@@ -269,7 +293,10 @@ export default {
...params, ...params,
} }
getApp().track('changeCertPhoto', trackParams) getApp().track('changeCertPhoto', trackParams)
this.$u.api.updateUserInfo(params) this.inUpload()
this.$u.api.updateUserInfo(params).then(() => {
uni.hideLoading()
})
}) })
}, },
userRefuseTip() { userRefuseTip() {
......
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