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