zhanghua
6 天以前 396b9a06392db5736eb5a7d485879174d73bb39a
src/permission.ts
@@ -12,7 +12,7 @@
import { fa } from 'element-plus/es/locale';
NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register', '/social-callback'];
const whiteList = ['/login', '/register', '/social-callback', '/rzt_login'];
router.beforeEach(async (to, from, next) => {
  NProgress.start();
@@ -22,7 +22,7 @@
    to.meta.title && useSettingsStore().setTitle(to.meta.title as string);
    /* has token*/
    if (to.path === '/login') {
    if (to.path === '/login' || to.path === '/rzt_login') {
      next({ path: '/' });
      NProgress.done();
    } else {
@@ -52,7 +52,7 @@
    }
  } else {
    // 没有token
    console.log("没有token");
    console.log('没有token');
    if (whiteList.indexOf(to.path) !== -1) {
      // 在免登录白名单,直接进入
      next();
@@ -67,14 +67,14 @@
  NProgress.done();
});
const judge = (token: string) => {
const judge = (token: string | null) => {
  if (token) {
    var data = JSON.parse(token)
    const data = JSON.parse(token);
    if (data != null) {
      if (data.expirse != null && new Date().getTime() - data.expirse < 60 * 60 * 1000) {
        return true
        return true;
      }
    }
  }
  return false
}
  return false;
};