Commit f9d816ec authored by linwenqing's avatar linwenqing

fix:授权手机

parent 1b04b30b
...@@ -27,9 +27,8 @@ ...@@ -27,9 +27,8 @@
</button> </button>
</view> </view>
<view @click.capture="getCode" v-else> <view @click.capture="getCode" v-else>
<button class="loginBtn" :class="{disable:isClickGetPhone}" <button class="loginBtn" open-type="getPhoneNumber"
open-type="getPhoneNumber" throttle-time="1000" throttle-time="1000" @getphonenumber="signupLogin">
@getphonenumber="signupLogin" :disabled="isClickGetPhone">
<text class="u-font-32 white">{{ bindTitle }}</text> <text class="u-font-32 white">{{ bindTitle }}</text>
</button> </button>
</view> </view>
...@@ -51,7 +50,6 @@ export default { ...@@ -51,7 +50,6 @@ export default {
bindPhone: '绑定手机', bindPhone: '绑定手机',
bindTips: '首次登录的用户需绑定手机才可接单', bindTips: '首次登录的用户需绑定手机才可接单',
code: '', code: '',
isClickGetPhone: false,
} }
}, },
computed: { computed: {
...@@ -76,8 +74,6 @@ export default { ...@@ -76,8 +74,6 @@ export default {
return process.uniEnv.qn_base_url + src return process.uniEnv.qn_base_url + src
}, },
async getCode() { async getCode() {
this.isClickGetPhone = true
this.inGetAuth()
login.appLogin().then(res => { login.appLogin().then(res => {
this.code = res.code this.code = res.code
}) })
...@@ -104,6 +100,7 @@ export default { ...@@ -104,6 +100,7 @@ export default {
} }
}, },
fail: function (res) { fail: function (res) {
uni.hideLoading()
uni.showModal({ uni.showModal({
title: '授权失败', title: '授权失败',
content: '请允许获取用户信息的授权', content: '请允许获取用户信息的授权',
...@@ -112,6 +109,7 @@ export default { ...@@ -112,6 +109,7 @@ export default {
} }
}) })
} else { } else {
uni.hideLoading()
// 可能由于账号配置,或者其他原因导致无法调起微信用户授权 // 可能由于账号配置,或者其他原因导致无法调起微信用户授权
uni.showModal({ uni.showModal({
title: '授权失败', title: '授权失败',
...@@ -152,7 +150,6 @@ export default { ...@@ -152,7 +150,6 @@ export default {
}); });
}, },
signupLogin(e) { signupLogin(e) {
this.inGetAuth()
var that = this var that = this
if(e && e.detail) { if(e && e.detail) {
if(e.detail.errMsg.indexOf('user deny') > -1) { if(e.detail.errMsg.indexOf('user deny') > -1) {
...@@ -169,6 +166,7 @@ export default { ...@@ -169,6 +166,7 @@ export default {
iv: e.detail.iv, iv: e.detail.iv,
} }
if (that.code) { if (that.code) {
that.inGetAuth()
uni.checkSession({ uni.checkSession({
success () { success () {
//session_key 未过期,并且在本生命周期一直有效 //session_key 未过期,并且在本生命周期一直有效
...@@ -176,7 +174,6 @@ export default { ...@@ -176,7 +174,6 @@ export default {
that.inGetAuth() that.inGetAuth()
login.signup(params).then(res => { login.signup(params).then(res => {
that.inGetAuth() that.inGetAuth()
that.isClickGetPhone = false
if (res) { if (res) {
login.setUserData(res.data, that) login.setUserData(res.data, that)
app.track('signup_login', {mobile: res.data.mobile}); app.track('signup_login', {mobile: res.data.mobile});
...@@ -194,7 +191,6 @@ export default { ...@@ -194,7 +191,6 @@ export default {
that.setLoginStatus(false) that.setLoginStatus(false)
} }
}).catch(res => { }).catch(res => {
that.isClickGetPhone = false
uni.hideLoading() uni.hideLoading()
that.setLoginStatus(false) that.setLoginStatus(false)
}) })
...@@ -208,6 +204,7 @@ export default { ...@@ -208,6 +204,7 @@ export default {
that.toLogin(params) that.toLogin(params)
} }
} else { } else {
uni.hideLoading()
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
showCancel: false, showCancel: false,
...@@ -215,6 +212,7 @@ export default { ...@@ -215,6 +212,7 @@ export default {
}); });
} }
} else { } else {
uni.hideLoading()
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
showCancel: false, showCancel: false,
......
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