Commit 088c8bca by 尹烁恒

提交

parent 02b214b7
......@@ -96,7 +96,7 @@ export default {
success(res) {
that._jscode = res.code
wx.setStorageSync('hasLogin', true)
resolve()
resolve(res.code)
},
fail() {
console.log('login fail')
......@@ -124,10 +124,11 @@ export default {
console.log(e)
if (e.target.errMsg === 'getUserInfo:ok') {
if (wx.getStorageSync('hasLogin')) {
this.getUserInfo(e.target)
const code = await this.login()
this.getUserInfo(e.target, code)
} else {
await this.login()
this.getUserInfo(e.target)
const code = await this.login()
this.getUserInfo(e.target, code)
}
} else {
wx.showModal({
......@@ -137,11 +138,15 @@ export default {
})
}
},
async getUserInfo(res) {
async getUserInfo(res, code = '') {
console.log(code, 'userinfo code')
if (!code) {
code = this._jscode
}
fly.post('auth_login', {
encrypted_data: res.encryptedData,
iv: res.iv,
js_code: this._jscode
js_code: code
})
.then(res => {
console.log(res.data.token, 'token')
......@@ -150,8 +155,9 @@ export default {
this.handleSubmit()
})
.catch(async res => {
await this.login()
this.getUserInfo(res)
const code = await this.login()
console.log('code is 11111', code)
this.getUserInfo(res, code)
})
},
getConfig() {
......@@ -230,7 +236,7 @@ export default {
const contentType = res.header['content-type']
store.commit('setImage', 'data:' + contentType + ';base64,' + base64)
wx.hideLoading()
wx.redirectTo({
wx.navigateTo({
url: `/pages/logs/main`
})
} else {
......
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