Переглянути джерело

app设置登录过期时间

娄底高职分支
yxq 11 місяці тому
джерело
коміт
8caff42549
2 змінених файлів з 28 додано та 8 видалено
  1. +14
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue
  2. +14
    -8
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/login.vue

+ 14
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue Переглянути файл

@@ -16,6 +16,20 @@
return;
});
}
// 判断登陆过期
if (!["/pages/login", "/pages/weixinLogin", "/pages/signup"].includes(pagePath)) {
this.$nextTick(() => {
let tokenExpireTime = this.GET_STORAGE('tokenExpireTime')
if(!tokenExpireTime||tokenExpireTime<new Date().valueOf()){
this.TOAST('登陆过期,请重新登录!')
setTimeout(()=>{
this.CLEAR_STORAGE()
this.NAV_TO("/pages/login");
},800)
return
}
});
}

// #endif



+ 14
- 8
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/login.vue Переглянути файл

@@ -282,7 +282,7 @@
user.miniProgram = true
}

if (baseinfo.Description == '学生') {
// if (baseinfo.Description == '学生') {
// 验证码验证
this.HIDE_LOADING()
this.resData = {
@@ -302,17 +302,23 @@
return
}
}, 1000);
if (baseinfo.Description == '学生') {
this.SET_STORAGE("tokenExpireTime", new Date().valueOf()+86400000*30)
}else{
this.SET_STORAGE("tokenExpireTime", new Date().valueOf()+86400000*7)
}

return
}
// }

this.SET_GLOBAL('token', token)
this.SET_GLOBAL('loginUser', user)
this.SET_STORAGE("logintime", user.logTime);
this.SET_STORAGE('token', token)
// this.SET_GLOBAL('token', token)
// this.SET_GLOBAL('loginUser', user)
// this.SET_STORAGE("logintime", user.logTime);
// this.SET_STORAGE('token', token)

this.HIDE_LOADING()
this.TAB_TO('/pages/home')
// this.HIDE_LOADING()
// this.TAB_TO('/pages/home')
},

// 验证用户输入


Завантаження…
Відмінити
Зберегти