gdpaoup
This commit is contained in:
34
App.vue
34
App.vue
@@ -4,9 +4,9 @@
|
||||
globalData: {
|
||||
im: {}
|
||||
},
|
||||
computed: {
|
||||
...mapState(["hasLogin"])
|
||||
},
|
||||
computed: {
|
||||
...mapState(["hasLogin"])
|
||||
},
|
||||
onLaunch() {
|
||||
getApp().globalData.im = this.imService
|
||||
// 缓存token
|
||||
@@ -16,23 +16,23 @@
|
||||
this.loginIn(res.data);
|
||||
}
|
||||
})
|
||||
// 刷新token
|
||||
if (this.hasLogin) {
|
||||
this.refreshToken_function();
|
||||
}
|
||||
// 刷新token
|
||||
if (this.hasLogin) {
|
||||
this.refreshToken_function();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['loginIn']),
|
||||
// 刷新token
|
||||
refreshToken_function(){
|
||||
this.$u.api.refreshToken({}).then((res) => {
|
||||
// console.log(res);
|
||||
if (res.errCode == 0) {
|
||||
let token = res.data.token;
|
||||
uni.setStorageSync('token', token);//存储toke值
|
||||
}
|
||||
})
|
||||
},
|
||||
// 刷新token
|
||||
refreshToken_function(){
|
||||
this.$u.api.refreshToken({}).then((res) => {
|
||||
// console.log(res);
|
||||
if (res.errCode == 0) {
|
||||
let token = res.data.token;
|
||||
uni.setStorageSync('token', token);//存储toke值
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user