Merge remote-tracking branch 'origin/test'
This commit is contained in:
commit
ed1c4c0e53
43
src/App.vue
43
src/App.vue
@ -22,8 +22,8 @@
|
||||
|
||||
<script>
|
||||
import { getToken, getUserIdKey } from '@/utils/auth';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { loginInfo, ProjectIcon } from '@/scripts/ProjectConfig';
|
||||
import { getSessionStorage, setSessionStorage } from '@/utils/auth';
|
||||
import { loginInfo } from '@/scripts/ProjectConfig';
|
||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||
import LoadingImg from '@/assets/loading.gif';
|
||||
import AppLoading from '@/assets/appLoading.png';
|
||||
@ -32,6 +32,8 @@ import Favicon from '@/assets/icon/favicon.png';
|
||||
import DeomonList from '@/views/demonstration/deomonList/index';
|
||||
import Qcode from '@/layout/components/Qcode.vue';
|
||||
import {removeToken} from './utils/auth';
|
||||
import { getFrontProjectConfigByLogin} from '@/api/projectConfig';
|
||||
import { handlerUrl } from '@/utils/baseUrl';
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
@ -47,8 +49,8 @@ export default {
|
||||
loadingImg: LoadingImg,
|
||||
appLoading: AppLoading,
|
||||
loading: false,
|
||||
project: '',
|
||||
jlFavicon: Favicon
|
||||
jlFavicon: Favicon,
|
||||
project: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -65,7 +67,7 @@ export default {
|
||||
callback: action => {
|
||||
removeToken();
|
||||
this.$store.dispatch('exit').then(resp => {
|
||||
this.$router.push({path: loginInfo[getSessionStorage('project')].loginPath});
|
||||
this.$router.push({path: loginInfo[this.$store.state.projectConfig.markKey].loginPath});
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -83,18 +85,17 @@ export default {
|
||||
if (val.path == '/display/demon' && val.query.client == 'diagramEdit') { // 运行图编制
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.project = getSessionStorage('project');
|
||||
const linkIcon = loginInfo[this.project] ? loginInfo[this.project].linkIcon : (ProjectIcon[this.project] || '');
|
||||
if (this.project && linkIcon) {
|
||||
document.querySelector("link[rel*='icon']").href = linkIcon;
|
||||
if (this.$route.query.project || this.$route.path === '/login' || this.$route.path === '/') {
|
||||
setSessionStorage('project', this.$route.query.project || 'login');
|
||||
}
|
||||
this.project = getSessionStorage('project');
|
||||
if (this.project !== this.$store.state.projectConfig.markKey) {
|
||||
this.initFrontProjectConfig();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.prohibitSystemContextMenu();
|
||||
|
||||
window.addEventListener('beforeunload', async e => {
|
||||
if (!this.$route.query.noPreLogout) {
|
||||
await this.$store.dispatch('preLogout');
|
||||
@ -117,6 +118,22 @@ export default {
|
||||
this.$store.dispatch('subscribe_un', {});
|
||||
},
|
||||
methods: {
|
||||
initFrontProjectConfig() {
|
||||
getFrontProjectConfigByLogin(this.project).then(resp => {
|
||||
const urlData = handlerUrl();
|
||||
const { baseApiUrl, baseSite, ossUrl, loginProLogo, browserTitle} = resp.data.viewSetting;
|
||||
this.$store.dispatch('setBaseUrl', baseApiUrl || urlData.BASE_API);
|
||||
this.$store.dispatch('setBaseSite', baseSite || urlData.BASE_SITE);
|
||||
this.$store.dispatch('setOssUrl', ossUrl || urlData.OSS_URL);
|
||||
this.$store.dispatch('projectConfig/setMarkKey', resp.data.markKey);
|
||||
this.$store.dispatch('projectConfig/setProjectCode', resp.data.project);
|
||||
this.$store.dispatch('projectConfig/setViewSetting', resp.data.viewSetting);
|
||||
document.title = browserTitle;
|
||||
if (loginProLogo) {
|
||||
document.querySelector("link[rel*='icon']").href = (ossUrl || urlData.OSS_URL) + '/logo/' + loginProLogo;
|
||||
}
|
||||
}).catch(e => this.$message.error('获取配置数据失败!'));
|
||||
},
|
||||
quickEntry() {
|
||||
this.$refs.deomonList.doShow();
|
||||
},
|
||||
|
@ -146,7 +146,7 @@ export default {
|
||||
return getSessionStorage('project') === 'cgy';
|
||||
},
|
||||
helpShow() {
|
||||
return this.$store.state.projectConfig.helpShow;
|
||||
return this.$store.state.projectConfig.viewSetting.helpShow;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -2,34 +2,40 @@
|
||||
<template>
|
||||
<div class="avatar-container" style="margin-left:40px;">
|
||||
<img class="logo" :src="logoImg" :style="{width: navigationLogoWidth}" @click="goToMain">
|
||||
<div class="titleInner" :style="{marginLeft: navigationMarginLeft}" @click="goToMain">{{ systemTitle }}</div>
|
||||
<div class="titleInner" :style="{marginLeft: navigationMarginLeft}" @click="goToMain">{{ homeTitle }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import { getSessionStorage } from '@/utils/auth';
|
||||
// import { loginInfo, ProjectIcon } from '@/scripts/ProjectConfig';
|
||||
import {mapGetters} from 'vuex';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
logoImg: '',
|
||||
systemTitle: '',
|
||||
navigationLogoWidth: '',
|
||||
navigationMarginLeft: ''
|
||||
navigationMarginLeft: '10px'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('projectConfig', [
|
||||
'homeTitle',
|
||||
'loginProLogo',
|
||||
'homeProLogoWidth'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
'$store.state.projectConfig.viewSetting': function(val) {
|
||||
this.setValue();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// const project = getSessionStorage('project');
|
||||
// this.systemTitle = loginInfo[project].homeTitle || loginInfo[project].title;
|
||||
// this.logoImg = loginInfo[project].titleIcon || ProjectIcon[project];
|
||||
// this.navigationLogoWidth = loginInfo[project].navigationLogoWidth;
|
||||
// this.navigationMarginLeft = loginInfo[project].navigationMarginLeft;
|
||||
this.systemTitle = this.$store.state.projectConfig.homeTitle;
|
||||
this.logoImg = this.$store.state.projectConfig.loginProLogo;
|
||||
this.navigationLogoWidth = this.$store.state.projectConfig.homeProLogoWidth + 'px';
|
||||
this.navigationMarginLeft = '10px';
|
||||
this.setValue();
|
||||
},
|
||||
methods: {
|
||||
setValue() {
|
||||
this.logoImg = this.$store.state.user.ossUrl + '/logo/' + this.loginProLogo;
|
||||
this.navigationLogoWidth = this.homeProLogoWidth + 'px';
|
||||
},
|
||||
goToMain() {
|
||||
}
|
||||
}
|
||||
|
@ -5,18 +5,13 @@ import NProgress from 'nprogress';
|
||||
import 'nprogress/nprogress.css';
|
||||
import { setToken, getToken, getSessionStorage, setSessionStorage } from '@/utils/auth';
|
||||
import localStore from 'storejs';
|
||||
import { handlerUrl } from '@/utils/baseUrl';
|
||||
import { getFrontProjectConfigByLogin} from '@/api/projectConfig';
|
||||
|
||||
const whiteList = ['/login', '/design/login', '/loginNew', '/gzzbxy/relay', '/authorization', '/AUSline', '/AUStool', '/demo', '/thirdLogin']; // 不重定向白名单
|
||||
let frontConfigMark = '';
|
||||
|
||||
// 登录路径判断获取
|
||||
function getRouteInfo(to, markKey) {
|
||||
function getRouteInfo(to) {
|
||||
let loginPath = '';
|
||||
// // const current_session = getSessionStorage('project');
|
||||
// const localLogin = process.env.VUE_APP_PRO == 'local' || process.env.VUE_APP_PRO == 'ntyl';
|
||||
// loginPath = loginInfo[current_session] && !localLogin ? loginInfo[current_session].loginPath : whiteList[0];
|
||||
const markKey = store.state.projectConfig.markKey;
|
||||
loginPath = markKey == 'login' ? '/login' : '/login?project=' + markKey;
|
||||
if (to.query.projectDevice && to.query.type && loginPath.includes('?')) {
|
||||
loginPath = `${loginPath}&projectDevice=${to.query.projectDevice}&type=${to.query.type}`;
|
||||
@ -56,53 +51,22 @@ function handleRoute(to, next, loginPath) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function subscribe() {
|
||||
const token = getToken();
|
||||
const path = window.location.pathname;
|
||||
if (token && path != '/404' && !path.endsWith('login')) {
|
||||
const header = { group: '', 'X-Token': token };
|
||||
store.dispatch('subscribe', {header, type: getSessionStorage('project')});
|
||||
}
|
||||
}
|
||||
// function subscribe() {
|
||||
// const token = getToken();
|
||||
// const path = window.location.pathname;
|
||||
// if (token && path != '/404' && !path.endsWith('login')) {
|
||||
// const header = { group: '', 'X-Token': token };
|
||||
// store.dispatch('subscribe', {header, type: getSessionStorage('project')});
|
||||
// }
|
||||
// }
|
||||
router.beforeEach( async (to, from, next) => {
|
||||
// 判断第三方登陆
|
||||
if (to.query.thirdJump) {
|
||||
setToken(to.query.key);
|
||||
setSessionStorage('project', to.query.project);
|
||||
}
|
||||
let project;
|
||||
// 登陆页面
|
||||
if (to.path.includes('login')) {
|
||||
project = to.query.project || 'login';
|
||||
} else if (to.path.includes('thirdLogin')) {
|
||||
// 第三方登陆页面
|
||||
project = to.query.project;
|
||||
} else {
|
||||
// 登陆成功页面
|
||||
project = getSessionStorage('project') || 'login';
|
||||
}
|
||||
if (frontConfigMark !== project && to.path !== '/authorization') {
|
||||
const response = await getFrontProjectConfigByLogin(project);
|
||||
const {browserTitle, loginProLogo, baseApiUrl, baseSite, caseShow, helpShow, ossUrl, homeTitle, homeProLogoWidth} = response.data.viewSetting;
|
||||
if (!store.state.user.baseUrl && project) {
|
||||
const urlData = handlerUrl();
|
||||
store.dispatch('setBaseUrl', baseApiUrl || urlData.BASE_API);
|
||||
store.dispatch('setBaseSite', baseSite || urlData.BASE_SITE);
|
||||
store.dispatch('setOssUrl', ossUrl || urlData.OSS_URL);
|
||||
subscribe();
|
||||
}
|
||||
frontConfigMark = response.data.markKey;
|
||||
document.title = browserTitle;
|
||||
const url = loginProLogo ? store.state.user.ossUrl + '/logo/' + loginProLogo : '';
|
||||
document.querySelector("link[rel*='icon']").href = url;
|
||||
store.commit('setCaseShow', caseShow);
|
||||
store.commit('setHelpShow', helpShow);
|
||||
store.dispatch('setHomeProLogoWidth', homeProLogoWidth);
|
||||
store.dispatch('setLoginProLogo', url);
|
||||
store.dispatch('setHomeTitle', homeTitle);
|
||||
NProgress.start();
|
||||
}
|
||||
const loginPath = getRouteInfo(to, frontConfigMark);
|
||||
NProgress.start();
|
||||
const loginPath = getRouteInfo(to);
|
||||
const token = to.query.token;
|
||||
if (/demoTraining/.test(to.path) && token) {
|
||||
const header = { group: to.query.group, 'X-Token': token };
|
||||
|
@ -97,7 +97,7 @@ const permission = {
|
||||
route.hidden = true;
|
||||
}
|
||||
if (route.path == '/case') { // 案例菜单是否显示
|
||||
route.hidden = !rootState.projectConfig.caseShow;
|
||||
route.hidden = !store.state.projectConfig.viewSetting.caseShow;
|
||||
}
|
||||
});
|
||||
commit('SET_ROUTERS', accessedRouters);
|
||||
|
@ -1,45 +1,67 @@
|
||||
const user = {
|
||||
const projectConfig = {
|
||||
namespaced: true,
|
||||
state: {
|
||||
homeProLogoWidth:0,
|
||||
loginProLogo:'',
|
||||
homeTitle:'',
|
||||
caseShow: true,
|
||||
helpShow: true
|
||||
markKey: '',
|
||||
projectCode: '',
|
||||
viewSetting: {}
|
||||
},
|
||||
getters: {
|
||||
homeTitle: (state) => {
|
||||
return state.viewSetting.homeTitle;
|
||||
},
|
||||
showBackPic: (state) => {
|
||||
return state.viewSetting.showBackPic;
|
||||
},
|
||||
loginProtitle: (state) => {
|
||||
return state.viewSetting.loginProtitle;
|
||||
},
|
||||
loginProLogoWidth: (state) => {
|
||||
return state.viewSetting.loginProLogoWidth;
|
||||
},
|
||||
homeProLogoWidth: (state) => {
|
||||
return state.viewSetting.homeProLogoWidth;
|
||||
},
|
||||
loginOrgTitle: (state) => {
|
||||
return state.viewSetting.loginOrgTitle;
|
||||
},
|
||||
loginProLogo: (state) => {
|
||||
return state.viewSetting.loginProLogo;
|
||||
},
|
||||
aboutSystem: (state) => {
|
||||
return state.viewSetting.aboutSystem;
|
||||
},
|
||||
baseDevelopment: (state) => {
|
||||
return state.viewSetting.baseDevelopment;
|
||||
},
|
||||
localProject: (state) => {
|
||||
return state.viewSetting.localProject;
|
||||
},
|
||||
browserTitle: (state) => {
|
||||
return state.viewSetting.browserTitle;
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
setHomeProLogoWidth: (state, homeProLogoWidth) => {
|
||||
state.homeProLogoWidth = homeProLogoWidth;
|
||||
setMarkKey: (state, markKey) => {
|
||||
state.markKey = markKey;
|
||||
},
|
||||
setLoginProLogo: (state, loginProLogo) => {
|
||||
state.loginProLogo = loginProLogo;
|
||||
setProjectCode: (state, projectCode) => {
|
||||
state.projectCode = projectCode;
|
||||
},
|
||||
setHomeTitle: (state, homeTitle) => {
|
||||
state.homeTitle = homeTitle;
|
||||
},
|
||||
setCaseShow: (state, caseShow) => {
|
||||
state.caseShow = caseShow;
|
||||
},
|
||||
setHelpShow: (state, helpShow) => {
|
||||
state.helpShow = helpShow;
|
||||
setViewSetting: (state, viewSetting) => {
|
||||
state.viewSetting = viewSetting;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setHomeProLogoWidth({ commit }, homeProLogoWidth) {
|
||||
commit('setHomeProLogoWidth', homeProLogoWidth);
|
||||
setMarkKey({ commit }, markKey) {
|
||||
commit('setMarkKey', markKey);
|
||||
},
|
||||
setLoginProLogo({ commit }, loginProLogo) {
|
||||
commit('setLoginProLogo', loginProLogo);
|
||||
setProjectCode({ commit }, projectCode) {
|
||||
commit('setProjectCode', projectCode);
|
||||
},
|
||||
setHomeTitle({ commit }, homeTitle) {
|
||||
commit('setHomeTitle', homeTitle);
|
||||
},
|
||||
setCaseShow({ commit }, caseShow) {
|
||||
commit('setCaseShow', caseShow);
|
||||
},
|
||||
setHelpShow({ commit }, helpShow) {
|
||||
commit('setHelpShow', helpShow);
|
||||
setViewSetting({ commit }, viewSetting) {
|
||||
commit('setViewSetting', viewSetting);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default user;
|
||||
export default projectConfig;
|
||||
|
@ -11,7 +11,7 @@
|
||||
<span>{{ loadingText }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else v-show="loadedConfig" class="login-container" :style="{ 'background-image': showBackPic?'url(' + bgImg + ')':'none' }">
|
||||
<div v-else class="login-container" :style="{ 'background-image': showBackPic?'url(' + bgImg + ')':'none' }">
|
||||
<!-- 中英文切换 -->
|
||||
<div class="language_box">
|
||||
<el-tooltip effect="dark" :content="this.$t('login.clickSwitchLanguage')" placement="bottom-end">
|
||||
@ -20,15 +20,13 @@
|
||||
</div>
|
||||
<!-- logo和名称 -->
|
||||
<div class="left-logo-box">
|
||||
<img class="logo" :src="loginProLogo" :style="{ width: loginProLogoWidth+'px'}">
|
||||
<img class="logo" :src="loginProLogo ? $store.state.user.ossUrl + '/logo/' + loginProLogo:''" :style="{ width: loginProLogoWidth+'px'}">
|
||||
<span>{{ loginOrgTitle }}</span>
|
||||
</div>
|
||||
<div class="content-box">
|
||||
<div class="text-box">{{ loginProtitle }}</div>
|
||||
<!-- 微信登陆 -->
|
||||
<!-- <wechat-login v-if="wechatLogin" ref="wechatLogin" :project="backProject" :sync-login="syncLogin" /> -->
|
||||
<!-- 默认登陆 -->
|
||||
<normal-login ref="normalLogin" :project="backProject" :local-project="localProject" @forgetPassword="forgetPassword" @showOrgList="showOrgList" @registerUser="registerUser" />
|
||||
<normal-login ref="normalLogin" :local-project="localProject" @forgetPassword="forgetPassword" @showOrgList="showOrgList" @registerUser="registerUser" />
|
||||
</div>
|
||||
<!-- 基于系统开发 -->
|
||||
<base-development v-if="baseDevelopment" ref="baseDevelopment" />
|
||||
@ -40,17 +38,14 @@
|
||||
<!-- 忘记密码 -->
|
||||
<forget-password ref="forgetPassword" />
|
||||
<!-- 注册用户 -->
|
||||
<register-user ref="registerUser" :project="backProject" />
|
||||
<register-user ref="registerUser" />
|
||||
<!-- 选择组织 -->
|
||||
<OrgSelect ref="orgSelect" @select="selectOrgnization" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { setSessionStorage } from '@/utils/auth';
|
||||
import bgImg from '@/assets/bg1.jpg';
|
||||
import LangStorage from '@/utils/lang';
|
||||
import { getFrontProjectConfigByLogin} from '@/api/projectConfig';
|
||||
// import WechatLogin from './wechatLogin';
|
||||
import NormalLogin from './normalLogin';
|
||||
import BaseDevelopment from './baseDevelopment';
|
||||
import ForgetPassword from './forgetPassword';
|
||||
@ -66,27 +61,14 @@ import { getToken} from '@/utils/auth';
|
||||
import { assignUsersPlayRoles } from '@/api/jointSimulation';
|
||||
import { getBackProjectConfigByCode } from '@/api/projectConfig';
|
||||
import { getGroupByMapAndFunction, getSimulationInfoNew } from '@/api/simulation';
|
||||
import {mapGetters} from 'vuex';
|
||||
export default {
|
||||
name:'LoginNew',
|
||||
// components: { Register },
|
||||
// export const RegisterCodeList = ['cgy', 'designcgy'];
|
||||
// WechatLogin,
|
||||
components: { NormalLogin, BaseDevelopment, ForgetPassword, OrgSelect, RegisterUser },
|
||||
data() {
|
||||
return {
|
||||
backProject:'',
|
||||
language: '中文',
|
||||
lang: 'zh',
|
||||
loginProtitle:'',
|
||||
localProject:false,
|
||||
loadedConfig:false,
|
||||
showBackPic:true,
|
||||
// wechatLogin:true,
|
||||
loginProLogoWidth:0,
|
||||
baseDevelopment:false, // 是否显示基于系统开发
|
||||
loginOrgTitle:'',
|
||||
loginProLogo:'',
|
||||
aboutSystem:'',
|
||||
loadingText:'',
|
||||
deviceImg:'',
|
||||
checkLogin: null,
|
||||
@ -94,6 +76,17 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('projectConfig', [
|
||||
'showBackPic',
|
||||
'loginProtitle',
|
||||
'loginProLogoWidth',
|
||||
'loginOrgTitle',
|
||||
'loginProLogo',
|
||||
'aboutSystem',
|
||||
'baseDevelopment',
|
||||
'localProject',
|
||||
'browserTitle'
|
||||
]),
|
||||
project() {
|
||||
return this.$route.query.project || 'login';
|
||||
},
|
||||
@ -114,42 +107,9 @@ export default {
|
||||
this.lang = 'en';
|
||||
this.language = 'English';
|
||||
}
|
||||
getFrontProjectConfigByLogin(this.project).then(response => {
|
||||
if (response.data) {
|
||||
this.backProject = response.data.project;
|
||||
// loginProLogoHeight
|
||||
// wechatLogin,
|
||||
const {showBackPic, aboutSystem, baseDevelopment, browserTitle, homeTitle, caseShow,
|
||||
loginProtitle, loginProLogoWidth, loginOrgTitle, localProject, homeProLogoWidth, loginProLogo} = response.data.viewSetting;
|
||||
this.showBackPic = showBackPic;
|
||||
// this.wechatLogin = wechatLogin;
|
||||
this.loginProtitle = loginProtitle;
|
||||
this.loginProLogoWidth = loginProLogoWidth;
|
||||
// this.homeProLogoWidth = homeProLogoWidth;
|
||||
this.loginOrgTitle = loginOrgTitle;
|
||||
this.loginProLogo = loginProLogo ? this.$store.state.user.ossUrl + '/logo/' + loginProLogo : '';
|
||||
this.aboutSystem = aboutSystem;
|
||||
this.baseDevelopment = baseDevelopment;
|
||||
this.localProject = localProject;
|
||||
document.title = browserTitle;
|
||||
document.querySelector("link[rel*='icon']").href = this.loginProLogo;
|
||||
this.$store.dispatch('setHomeProLogoWidth', homeProLogoWidth);
|
||||
this.$store.dispatch('setLoginProLogo', this.loginProLogo);
|
||||
this.$store.dispatch('setHomeTitle', homeTitle);
|
||||
this.$store.dispatch('setCaseShow', caseShow);
|
||||
this.loadedConfig = true;
|
||||
// helpShow
|
||||
// 登录页 是否显示联系方式 loginContectInformation false
|
||||
setSessionStorage('project', this.project);
|
||||
if (this.syncLogin) {
|
||||
this.deviceRelatedLogin();
|
||||
// } else if (getToken()) {
|
||||
// this.$refs.normalLogin.handleLoginSucessRoute(this.backProject);
|
||||
}
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$messageBox('无效的登录路径,请查证路径后重试!');
|
||||
});
|
||||
if (this.syncLogin) {
|
||||
this.deviceRelatedLogin();
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
handleLanguage() {
|
||||
|
@ -39,7 +39,7 @@
|
||||
<div class="tip-message">{{ tipsMsg }}</div>
|
||||
<div style="display: inline-block;width: 100%;margin-bottom: 10px;">
|
||||
<div style="display:inline-block">
|
||||
<el-checkbox v-model="isAutoLogin">{{ $t('login.autoLogin') }}</el-checkbox>
|
||||
<!-- <el-checkbox v-model="isAutoLogin">{{ $t('login.autoLogin') }}</el-checkbox>-->
|
||||
<!-- <el-checkbox v-if="project === 'cgy'" v-model="teacherLogin">教师登录</el-checkbox> -->
|
||||
</div>
|
||||
<!-- <el-popover
|
||||
@ -80,7 +80,6 @@
|
||||
import QCode from '@/assets/erCode.jpg';
|
||||
import md5 from 'js-md5';
|
||||
import Cookies from 'js-cookie';
|
||||
// getLoginWmurl, checkLoginStatus,
|
||||
import { getOrgList, selectOrgnization, getLoginInfo } from '@/api/login';
|
||||
import { createSimulation, getSimulationInfoNew, getGroupByMapAndFunction } from '@/api/simulation';
|
||||
import { getBackProjectConfigByCode } from '@/api/projectConfig';
|
||||
@ -89,12 +88,6 @@ import { getToken} from '@/utils/auth';
|
||||
export default {
|
||||
name:'NormalLogin',
|
||||
props: {
|
||||
project: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
localProject:{
|
||||
type: Boolean,
|
||||
default: () => {
|
||||
@ -143,20 +136,23 @@ export default {
|
||||
},
|
||||
projectDevice() {
|
||||
return this.$route.query.projectDevice;
|
||||
},
|
||||
projectCode() {
|
||||
return this.$store.state.projectConfig.projectCode;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'project': function(val) {
|
||||
if (Cookies.get(this.cookiesName) && Cookies.get(this.cookiesToken)) {
|
||||
const model = {
|
||||
username: Cookies.get(this.cookiesName),
|
||||
password: Cookies.get(this.cookiesToken),
|
||||
project: this.project
|
||||
};
|
||||
model.type = 'class';
|
||||
this.loginAction(model);
|
||||
}
|
||||
}
|
||||
// 'project': function(val) { // 老的自动登录逻辑
|
||||
// if (Cookies.get(this.cookiesName) && Cookies.get(this.cookiesToken)) {
|
||||
// const model = {
|
||||
// username: Cookies.get(this.cookiesName),
|
||||
// password: Cookies.get(this.cookiesToken),
|
||||
// project: this.project
|
||||
// };
|
||||
// model.type = 'class';
|
||||
// this.loginAction(model);
|
||||
// }
|
||||
// }
|
||||
},
|
||||
methods:{
|
||||
// 密码显隐
|
||||
@ -203,9 +199,18 @@ export default {
|
||||
if (orgList.length < 2) {
|
||||
if (orgList.length === 1) {
|
||||
orgId = orgList[0].orgId;
|
||||
selectOrgnization(orgId);
|
||||
selectOrgnization(orgId).then(() => { // 先登入组织,再跳转路由(跳转路由会获取用户信息,可能拿不到组织信息)
|
||||
this.handleLoginSucessRoute();
|
||||
}).catch(err => {
|
||||
this.loading = false;
|
||||
this.tipsMsg = `登入组织失败!,${err.message}`;
|
||||
setTimeout(() => {
|
||||
this.tipsMsg = '';
|
||||
}, 5000);
|
||||
});
|
||||
} else {
|
||||
this.handleLoginSucessRoute();
|
||||
}
|
||||
this.handleLoginSucessRoute();
|
||||
} else {
|
||||
this.$emit('showOrgList', orgList);
|
||||
}
|
||||
@ -216,12 +221,20 @@ export default {
|
||||
},
|
||||
// 选择组织
|
||||
selectOrg(orgId) {
|
||||
this.handleLoginSucessRoute();
|
||||
selectOrgnization(orgId);
|
||||
// this.handleLoginSucessRoute();
|
||||
// selectOrgnization(orgId);
|
||||
selectOrgnization(orgId).then(() => { // 先登入组织,再跳转路由(跳转路由会获取用户信息,可能拿不到组织信息)
|
||||
this.handleLoginSucessRoute();
|
||||
}).catch(err => {
|
||||
this.loading = false;
|
||||
this.tipsMsg = `登入组织失败!,${err.message}`;
|
||||
setTimeout(() => {
|
||||
this.tipsMsg = '';
|
||||
}, 5000);
|
||||
});
|
||||
},
|
||||
// 跳转路由
|
||||
handleLoginSucessRoute(project) {
|
||||
this.loading = false;
|
||||
handleLoginSucessRoute() {
|
||||
this.tipsMsg = '';
|
||||
let path = '';
|
||||
if (this.projectDevice) {
|
||||
@ -229,15 +242,16 @@ export default {
|
||||
projectDevice:this.$route.query.projectDevice,
|
||||
type: this.$route.query.type
|
||||
};
|
||||
this.judgeOtherPage(params, project);
|
||||
this.judgeOtherPage(params);
|
||||
} else {
|
||||
this.loading = false;
|
||||
path = '/simulation/simulationIndex';
|
||||
this.$router.push({ path: path });
|
||||
}
|
||||
},
|
||||
judgeOtherPage(params, project) {
|
||||
judgeOtherPage(params) {
|
||||
// itemMap: {DEFAULT_MEMBER: '1'}type: "METRO"
|
||||
getBackProjectConfigByCode(this.project || project).then(res=>{
|
||||
getBackProjectConfigByCode(this.projectCode).then(res=>{
|
||||
if (res.data) {
|
||||
const {mapId, functionId} = res.data;
|
||||
if (functionId && mapId) {
|
||||
@ -246,6 +260,7 @@ export default {
|
||||
const group = resp.data;
|
||||
this.assignUser(group, mapId);
|
||||
}).catch(error=>{
|
||||
this.loading = false;
|
||||
if (error.code == 10003) {
|
||||
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
@ -263,15 +278,18 @@ export default {
|
||||
const group = resp.data;
|
||||
this.assignUser(group, mapId);
|
||||
}).catch(res=>{
|
||||
this.loading = false;
|
||||
this.$store.dispatch('LogOut');
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.$message.error('请先配置项目信息');
|
||||
this.$store.dispatch('LogOut');
|
||||
}
|
||||
}
|
||||
}).catch(res=>{
|
||||
this.loading = false;
|
||||
this.$message.error('获取项目信息失败');
|
||||
this.$store.dispatch('LogOut');
|
||||
});
|
||||
@ -287,10 +305,12 @@ export default {
|
||||
assignUsersPlayRoles(params, group).then(() => {
|
||||
this.enterSimulation(group, mapId, config);
|
||||
}).catch(res=>{
|
||||
this.loading = false;
|
||||
this.$message.error('切换角色失败');
|
||||
this.$store.dispatch('LogOut');
|
||||
});
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.$message.error('请先配置设备相关信息');
|
||||
this.$store.dispatch('LogOut');
|
||||
}
|
||||
@ -298,6 +318,7 @@ export default {
|
||||
this.enterSimulation(group, mapId);
|
||||
}
|
||||
}).catch(res=>{
|
||||
this.loading = false;
|
||||
this.$message.error('获取用户信息失败');
|
||||
this.$store.dispatch('LogOut');
|
||||
});
|
||||
@ -305,13 +326,14 @@ export default {
|
||||
},
|
||||
enterSimulation(group, mapId, config) {
|
||||
getSimulationInfoNew(group).then(response=>{
|
||||
this.loading = false;
|
||||
const paramVO = response.data.paramVO;
|
||||
const query = {
|
||||
lineCode: response.data.map.lineCode,
|
||||
group: group,
|
||||
mapId: mapId,
|
||||
simType:paramVO.type,
|
||||
project: this.project,
|
||||
project: this.projectCode,
|
||||
projectDevice:this.$route.query.projectDevice,
|
||||
singleClient:true
|
||||
};
|
||||
@ -321,6 +343,7 @@ export default {
|
||||
}
|
||||
this.$router.push({ path: `/display/demon`, query: query });
|
||||
}).catch(res=>{
|
||||
this.loading = false;
|
||||
this.$message.error('进入仿真失败');
|
||||
this.$store.dispatch('LogOut');
|
||||
});
|
||||
@ -332,7 +355,7 @@ export default {
|
||||
const model = Object.assign({}, this.loginForm);
|
||||
model.password = md5(model.password);
|
||||
model.type = 'class';
|
||||
model.project = this.project;
|
||||
model.project = this.projectCode;
|
||||
if (this.$route.query.projectDevice) {
|
||||
model.deviceCode = this.$route.query.projectDevice;
|
||||
}
|
||||
|
@ -87,14 +87,6 @@ export default {
|
||||
components:{
|
||||
Vcode
|
||||
},
|
||||
props: {
|
||||
project: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var validateEmail = (rule, value, callback) => {
|
||||
const regu = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
|
||||
@ -315,7 +307,7 @@ export default {
|
||||
nickname: this.form.nickname,
|
||||
verificationCode:this.form.verificationCode,
|
||||
password: md5(this.form.password),
|
||||
source:this.project
|
||||
source:this.$store.state.projectConfig.projectCode
|
||||
};
|
||||
if (this.form.type == 'mobile') {
|
||||
data.mobile = this.form.mobile;
|
||||
|
@ -133,6 +133,8 @@ export default {
|
||||
console.log(uploadData);
|
||||
console.log(resp);
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err.message);
|
||||
});
|
||||
},
|
||||
turnback() {
|
||||
|
@ -9,7 +9,7 @@
|
||||
import { LoginParams } from '@/utils/login';
|
||||
import { thirdCountLogin } from '@/api/management/user';
|
||||
import md5 from 'js-md5';
|
||||
import { setToken, getToken, setSessionStorage, getSessionStorage } from '@/utils/auth';
|
||||
import { setToken, getToken, getSessionStorage } from '@/utils/auth';
|
||||
// , ProjectLoginStyleList, VersionBaseNoShow, MainBodyNoShow, NoQrcodeList, localPackageProject, RegisterCodeList
|
||||
import { loginInfo, ProjectIcon } from '@/scripts/ProjectConfig';
|
||||
|
||||
@ -27,7 +27,6 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
setSessionStorage('project', this.project);
|
||||
const project = getSessionStorage('project');
|
||||
if (project) {
|
||||
document.querySelector("link[rel*='icon']").href = loginInfo[project].linkIcon || ProjectIcon[project];
|
||||
|
@ -18,7 +18,7 @@
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card v-else :key="system.id" :body-style="{ padding: '0px' }" class="box-card">
|
||||
<div class="bg-img-box" @click="enterSimulation(system)">
|
||||
<div class="bg-img-box" style="background: #fff;" @click="enterSimulation(system)">
|
||||
<div class="card-box-title">{{ system.name }}</div>
|
||||
<div class="content-box">{{ system.desc }}</div>
|
||||
</div>
|
||||
@ -421,7 +421,6 @@ export default {
|
||||
.bg-img-box {
|
||||
padding: 10px;
|
||||
height: 220px;
|
||||
background-color: #fff;
|
||||
background-size: 100% 100%;
|
||||
background-repeat:no-repeat;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user