diff --git a/src/components/QueryListPage/QueryListPage.vue b/src/components/QueryListPage/QueryListPage.vue
index c58086db5..5afe0bed5 100644
--- a/src/components/QueryListPage/QueryListPage.vue
+++ b/src/components/QueryListPage/QueryListPage.vue
@@ -126,7 +126,7 @@
-
+
{
+ return item.test(toRoutePath);
+ });
+}
+
const loginPage = whiteList[0];
const loginDesignPage = whiteList[1];
@@ -32,17 +40,9 @@ function getRouteInfo(to) {
if (/^\/designxty/.test(toRoutePath)) {
loginPath = loginDesignXtyPage;
clientId = LoginParams.Design.clientId;
- } else if (/^\/design/.test(toRoutePath) || /^\/scriptDisplay/.test(toRoutePath) || /^\/publish/.test(toRoutePath) || /^\/orderauthor/.test(toRoutePath) || /^\/system/.test(toRoutePath) || /^\/display\/record/.test(toRoutePath) || /^\/display\/manage/.test(toRoutePath) || /^\/apply/.test(toRoutePath)) {
+ } else if (isDesignPage(toRoutePath)) {
loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
clientId = LoginParams.Design.clientId;
- } else if (/^\/plan/.test(toRoutePath) || /^\/display\/plan/.test(toRoutePath)) {
- if (getSessionStorage('project').startsWith('design')) {
- loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
- clientId = LoginParams.Design.clientId;
- } else {
- loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage;
- clientId = null;
- }
} else if ( /^\/xty/.test(toRoutePath)) {
loginPath = loginXtyPage;
clientId = null;
diff --git a/src/router/index.js b/src/router/index.js
index 17449c3d7..3fa5b1490 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -134,7 +134,7 @@ export const userLesson = '012'; // 教学系统
export const userSimulation = '013'; // 仿真系统
export const userScreen = '014'; // 大屏系统
export const userPlan = '015'; // 计划系统
-export const userDesign = '016'; // 设计系统
+export const userTrainingPlatform = '016'; // 实训平台
// const isDev = process.env.NODE_ENV === 'development';
export const UrlConfig = {
@@ -288,7 +288,7 @@ export const asyncRouter = [
component: Layout,
redirect: '/design/home',
meta: {
- roles: [admin, user, userDesign]
+ roles: [admin, user]
},
children: [
{
@@ -376,7 +376,7 @@ export const asyncRouter = [
redirect: '/design/userlist/home',
component: Layout,
meta: {
- roles: [admin, user, userDesign]
+ roles: [admin, user]
},
children: [
{
@@ -453,7 +453,7 @@ export const asyncRouter = [
component: Layout,
hidden: true,
meta: {
- roles: [admin, userSimulation, user]
+ roles: [admin, userSimulation, user, userTrainingPlatform]
},
children: [
{
@@ -550,7 +550,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'router.pulishManage',
- roles: [admin, userDesign]
+ roles: [admin]
},
children: [
{ // 发布地图
@@ -629,7 +629,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'router.orderAuthorityManage',
- roles: [admin, userDesign]
+ roles: [admin]
},
children: [
{
@@ -721,7 +721,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'router.systemManage',
- roles: [admin, userDesign]
+ roles: [admin]
},
children: [
{
@@ -820,7 +820,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'router.releaseApplication',
- roles: [admin, userDesign]
+ roles: [admin]
},
children: [
{
diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index 951e1bbd0..b1f5b05e6 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -1,4 +1,4 @@
-import { asyncRouter, constantRoutes, user, userLesson, userExam, userSimulation, userScreen, userPlan, superAdmin, admin, userDesign } from '@/router';
+import { asyncRouter, constantRoutes, user, userLesson, userExam, userSimulation, userScreen, userPlan, superAdmin, admin, userTrainingPlatform } from '@/router';
import { PermissionType } from '@/utils/PermissionType';
import { UrlConfig } from '@/router/index';
import { getSessionStorage } from '@/utils/auth';
@@ -36,7 +36,7 @@ function hasPermission(roles, route, parentsRoles) {
roles = roles.filter(function (role) {
return route.meta.roles.indexOf(role) >= 0;
});
- return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userDesign) < 0;
+ return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) > 0;
}
} else if (parentsRoles) {
// 如果没有本级路由,有父级路由,则使用父级路由过滤
diff --git a/src/store/modules/trainingList.js b/src/store/modules/trainingList.js
index 743f19d5a..ce4ba205c 100644
--- a/src/store/modules/trainingList.js
+++ b/src/store/modules/trainingList.js
@@ -2,8 +2,8 @@ const trainingList = {
namespaced: true,
state: {
- index: 0, //当前选择实训索引
- trainingList: [], //实训初始列表
+ index: 0, // 当前选择实训索引
+ trainingList: [] // 实训初始列表
},
getters: {
trainingList: (state) => {
@@ -36,7 +36,7 @@ const trainingList = {
} else {
state.trainingList = [];
}
- },
+ }
},
actions: {
setIndex({ commit }, index) {
@@ -63,4 +63,4 @@ const trainingList = {
}
};
-export default trainingList;
\ No newline at end of file
+export default trainingList;
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index ff6acce73..56b41a044 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -53,6 +53,18 @@ const user = {
Cookies.remove('UserDesignToken');
Cookies.remove('UserName');
Cookies.remove('UserToken');
+ },
+ SUBSCRIBE: (state, {header, type}) => {
+ if (type == 'design') {
+ creatSubscribe(commonTopic, header);
+ } else {
+ creatSubscribe(perpetualTopic, header);
+ creatSubscribe(commonTopic, header);
+ }
+ },
+ SUBSCRIBE_UN: () => {
+ clearSubscribe(perpetualTopic);
+ clearSubscribe(commonTopic);
}
},
@@ -61,41 +73,32 @@ const user = {
Login({ commit }, userInfo) {
const username = userInfo.username.trim();
const password = userInfo.password.trim();
+ const type = userInfo.type;
return new Promise((resolve, reject) => {
- let params = null;
- let execFunc = null;
- if (userInfo.type == 'design') {
- params = Object.assign({ account: username, password }, LoginParams.Design);
- execFunc = (header) => {
- creatSubscribe(commonTopic, header);
- };
- } else {
- params = Object.assign({ account: username, password }, LoginParams.LianKeTang);
- execFunc = (header) => {
- creatSubscribe(perpetualTopic, header);
- creatSubscribe(commonTopic, header);
- };
- }
-
// 登录系统
+ const params = Object.assign({ account: username, password }, type == 'design' ? LoginParams.Design : LoginParams.LianKeTang);
login(params).then(resp => {
const token = resp.data;
- commit('SET_TOKEN', token);
+ const header = { group: '', 'X-Token': token };
setToken(token);
- execFunc({ group: '', 'X-Token': token });
+ commit('SET_TOKEN', token);
+ commit('SUBSCRIBE', {header, type});
resolve();
}).catch(error => { reject(error); });
});
},
// 扫码登陆设置
- QrLoginSetting({ dispatch, commit }, token) {
+ QrLoginSetting({ dispatch, commit }, tokeninfo) {
return new Promise((resolve, reject) => {
// 设置user域token值
- commit(token.key, token.value);
- const header = { group: '', 'X-Token': token.value };
- creatSubscribe(perpetualTopic, header);
- creatSubscribe(commonTopic, header);
+ const header = { group: '', 'X-Token': tokeninfo.value };
+ const mutAction = tokeninfo.key;
+ const mutParams = tokeninfo.value;
+ const type = tokeninfo.type;
+ setToken(tokeninfo.value);
+ commit(mutAction, mutParams);
+ commit('SUBSCRIBE', {header, type});
// 获取用户参数
dispatch('GetUserConfigInfo').then(response => {
resolve(response);
@@ -140,8 +143,7 @@ const user = {
},
// 前端登出
FedLogOut({ commit }) {
- clearSubscribe(perpetualTopic);
- clearSubscribe(commonTopic);
+ commit('SUBSCRIBE_UN');
commit('SET_TOKEN', '');
commit('SET_ID', '');
removeToken();
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 28650c9c3..6c2a6548f 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -100,7 +100,6 @@ import QrcodeVue from 'qrcode.vue';
import { getLoginWmurl, checkLoginStatus } from '@/api/login';
import { LoginParams } from '@/utils/login';
import bgImg from '@/assets/bg1.jpg';
-import { setToken } from '@/utils/auth';
import { loginInfo } from '@/scripts/ConstDic';
import { removeToken } from '@/utils/auth';
import LangStorage from '@/utils/lang';
@@ -238,14 +237,14 @@ export default {
if (this && this._isDestroyed) {
return;
}
+
// 清空已存在的定时器
// 设置定时器检测
this.clearTimer(this.checkLogin);
this.checkLogin = setTimeout(() => {
checkLoginStatus(self.sessionId).then(response => {
- setToken(response.data.token);
// 设置扫码登录
- self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token }).then(() => {
+ self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token, type: this.modelType }).then(() => {
// 清除定时器,设置路由
self.clearTimer(self.checkLogin);
this.handleLoginSucessRoute();