You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
940 B
Vue

<script>
import {
mapState,
mapActions
} from 'vuex';
export default {
globalData: {
latitude: '',
longitude: '',
version: '',
city:'',
cityCode:'',
isLogin: true,
},
onLaunch: function() {
this.checkToken();
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
methods:{
...mapActions([
'setUserInfo'
]),
checkToken(){
const tokenStartTime = uni.getStorageSync('tokenStartTime');
const userToken = uni.getStorageSync('userToken');
let date = new Date().getTime()
if(date - tokenStartTime >= 0 || !tokenStartTime || !userToken) {
console.log('token已过期');
uni.removeStorageSync('userToken')
uni.removeStorageSync('tokenStartTime')
}
}
},
}
</script>
<style lang="less">
@import "common/css/iconfont.css";
@import "common/css/common.less";
</style>