diff --git a/src/permission.js b/src/permission.js index cbe99cd26..45d906e97 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,7 +7,7 @@ import 'nprogress/nprogress.css'; import { setToken, getToken, removeToken, getSessionStorage } from '@/utils/auth'; import localStore from 'storejs'; -const whiteList = ['/login', '/design/login', '/gzzbxy/relay', '/authorization', '/AUSline', '/AUStool']; // 不重定向白名单 +const whiteList = ['/login', '/design/login', '/gzzbxy/relay', '/authorization', '/AUSline', '/AUStool', '/demo']; // 不重定向白名单 for (const val in loginInfo) { if (loginInfo[val].loginPath && !whiteList.includes(loginInfo[val].loginPath)) { @@ -67,15 +67,15 @@ router.beforeEach((to, from, next) => { document.title = loginInfo[project || 'login'].browserTitle || loginInfo[project || 'login'].title; NProgress.start(); const loginPath = getRouteInfo(to); - const token = to.query.token + const token = to.query.token; - if (/demoTraining/.test(to.path) && token) { - const header = { group: to.query.group, 'X-Token': token }; - setToken(token); - store.commit('SET_TOKEN', token) - store.commit('SUBSCRIBE', { header, type: '' }); - next(); - } else if (getToken()) { + if (/demoTraining/.test(to.path) && token) { + const header = { group: to.query.group, 'X-Token': token }; + setToken(token); + store.commit('SET_TOKEN', token); + store.commit('SUBSCRIBE', { header, type: '' }); + next(); + } else if (getToken()) { if (to.path === loginPath) { // 登录页面不拦截 next(); diff --git a/src/views/demo/index.vue b/src/views/demo/index.vue index d387508d3..da4bccc16 100644 --- a/src/views/demo/index.vue +++ b/src/views/demo/index.vue @@ -3,6 +3,8 @@
教学系统
+
登录
+
{{ nickName }}
@@ -26,21 +28,67 @@
+ + + + + + + + + + + + + + + + + + +
{{ tipsMsg }}
+ + + {{ $t('login.login') }} + + +
+