update 进入登录页时验证缓存token是否有效
This commit is contained in:
@@ -39,3 +39,6 @@ export enum CacheTypeEnum {
|
||||
SESSION,
|
||||
LOCAL,
|
||||
}
|
||||
|
||||
// 退出时当前页面路径
|
||||
export const LOGOUT_CURRENT_PATH = 'LOGOUT_CURRENT_PATH';
|
||||
|
||||
+25
-1
@@ -1,9 +1,12 @@
|
||||
import { LOGOUT_CURRENT_PATH } from '/@/enum/cacheEnum.ts';
|
||||
|
||||
export enum PageEnum {
|
||||
// basic login path
|
||||
BASE_LOGIN = '/login', //西安登录页
|
||||
BASE_HOME = '/home', //西安首页
|
||||
BASE_LOGIN_YINCHUAN = '/screenLogin', //银川登录页
|
||||
YINCHUAN_HOME = '/yinChuanHome', //银川首页
|
||||
//other
|
||||
}
|
||||
|
||||
export function setBaseLogin(baseLogin) {
|
||||
@@ -16,7 +19,6 @@ export function getBaseLogin() {
|
||||
|
||||
//根据当前路径跳转登录页
|
||||
export function toLoginByNowPath(nowPath: string) {
|
||||
console.log('nowPath', nowPath);
|
||||
//西安的页面路径
|
||||
const xianPath = ['/home', '/secondScreen', '/'];
|
||||
//银川的页面路径
|
||||
@@ -27,3 +29,25 @@ export function toLoginByNowPath(nowPath: string) {
|
||||
return PageEnum.BASE_LOGIN_YINCHUAN;
|
||||
}
|
||||
}
|
||||
|
||||
//根据退出时的页面路径跳转首页
|
||||
export function toHomeByLogoutPath(nowPath: string) {
|
||||
//西安的页面路径
|
||||
const xianPath = ['/home', '/secondScreen', '/'];
|
||||
//银川的页面路径
|
||||
const yinchuanPath = ['/yinChuanHome'];
|
||||
if (xianPath.includes(nowPath)) {
|
||||
return PageEnum.BASE_HOME;
|
||||
} else if (yinchuanPath.includes(nowPath)) {
|
||||
return PageEnum.YINCHUAN_HOME;
|
||||
}
|
||||
}
|
||||
|
||||
//缓存退出时的页面路径
|
||||
export function setCurrentPath(nowPath) {
|
||||
localStorage.setItem(LOGOUT_CURRENT_PATH, nowPath);
|
||||
}
|
||||
|
||||
export function getCurrentPath() {
|
||||
return localStorage.getItem(LOGOUT_CURRENT_PATH);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user