bug
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="my">
|
||||
<div class="user">
|
||||
<div class="user" @click="toSetting">
|
||||
<image src="https://jisheng-xiaochengxu.oss-cn-hangzhou.aliyuncs.com/admin/5bad9165-fa6e-4c81-894d-2beae426260b.png" />
|
||||
<div class="right" v-if="isLogin">
|
||||
<h2>张三</h2>
|
||||
@@ -63,48 +63,28 @@
|
||||
onLoad () {
|
||||
console.log(this.user)
|
||||
console.log(this.token)
|
||||
if (this.token) {
|
||||
this.getUserInfo()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions(['autoLogin', 'getUserInfo', 'getToken', 'getCode']),
|
||||
...mapActions(['autoLogin', 'getUserInfo']),
|
||||
|
||||
login () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
uni.login({
|
||||
success: function (res) {
|
||||
if (res.code) {
|
||||
resolve(res)
|
||||
} else {
|
||||
reject(res)
|
||||
}
|
||||
},
|
||||
fail: function () {
|
||||
reject(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
toSetting () {
|
||||
if (!this.token) {
|
||||
this.autoLogin()
|
||||
} else {
|
||||
this.$linkTo('./UserInfo')
|
||||
}
|
||||
},
|
||||
|
||||
toLogin () {
|
||||
wx.getUserProfile({
|
||||
desc: '用于完善会员资料',
|
||||
lang: 'zh_CN',
|
||||
success: data => {
|
||||
this.$loading()
|
||||
this.getCode().then(res => {
|
||||
this.getToken({
|
||||
...data.userInfo,
|
||||
code: res
|
||||
}).then(e => {
|
||||
console.log(e)
|
||||
|
||||
this.$hideLoading()
|
||||
}).catch(() => {
|
||||
this.$hideLoading()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
if (!this.token) {
|
||||
this.autoLogin()
|
||||
} else {
|
||||
this.getUserInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user