Commit 46fe7575 authored by LiZongLin's avatar LiZongLin

登录bug

parent 92cee925
......@@ -187,31 +187,35 @@
icon: 'none'
})
},
getWXUserCode() {
return new Promise((resolve,reject)=>{
if(!this.token){
resolve();
return
}
console.log(this.token);
console.log("获取登录信息")
new
uni.login({
provider: 'weixin',
success: res => {
console.log("uni.login res", res.code)
let code = res.code
getToken(code, this.token).then(res => {
console.log(res);
this.updateToken(res.data.token)
this.updateUserInfo(res.data.user)
})
}
})
resolve();
})
},
//登录判断
login() {
// if (!this.token) {
this.getActivityList()
this.getExerciseList()
// } else {
// this.getExerciseListHaveToken()
// this.getActivityListHaveToken()
// }
},
// getExerciseListHaveToken() {
// listExerciseHaveToken().then(res => {
// this.exerciseList = [...this.exerciseList, ...res.data] || []
// }).catch(err => {
// })
// },
// getActivityListHaveToken() {
// listActivityStartHaveToken().then(res => {
// this.activityList = [...this.activityList, ...res.data] || []
// }).catch(err => {
// })
// },
getActivityList() {
listActivityStart().then(res => {
this.activityList = [...this.activityList, ...res.data] || []
......@@ -269,8 +273,12 @@
}
},
onLoad() {
this.login()
this.marginHight = uni.getStorageSync('menuInfo').statusBarHeight + 9 + 'px'
},
onShow() {
this.getWXUserCode().then(()=>{
this.login()
})
}
}
</script>
......
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