登录页面增加组织选择

This commit is contained in:
Yuan 2022-09-30 17:51:38 +08:00
parent be0a8cc9da
commit b2acf8dc27
3 changed files with 1039 additions and 902 deletions

View File

@ -93,3 +93,23 @@ export function getLoginInfo(token) {
} }
}); });
} }
/**
* 获取用户所属组织列表
*/
export function getOrgList() {
return request({
url: '/api/org/list',
method: 'get'
})
}
/**
* 登入组织
*/
export function selectOrgnization(orgId) {
return request({
url: `/api/org/signIn/${orgId}`,
method: 'put'
})
}

View File

@ -25,11 +25,11 @@ export function handlerUrl(data) {
// const data = null; // const data = null;
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.233/rtss-server'; BASE_API = 'http://192.168.3.233/rtss-server';
// BASE_API = 'http://114.116.51.125/jlcloud'; // BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://192.168.3.90:9100'; // 周寅 // BASE_API = 'http://192.168.3.90:9100'; // 周寅
// BASE_API = 'http://192.168.3.94:9000'; // 旭强 // BASE_API = 'http://192.168.3.94:9000'; // 旭强
BASE_API = 'http://192.168.3.15:9000'; // 张赛 // BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬 // BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏 // BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -8,8 +8,11 @@
:element-loading-text="loadingText" :element-loading-text="loadingText"
element-loading-background="rgba(0, 0, 0, 0)" element-loading-background="rgba(0, 0, 0, 0)"
> >
<div v-if="loginTitle && !syncLogin" :class="project.endsWith('heb')||project.endsWith('ntyl')?'text-box':'left-logo-box'"> <div
<img class="logo" :src="logoImg" :style="{width: logoWidth}"> v-if="loginTitle && !syncLogin"
:class="project.endsWith('heb') || project.endsWith('ntyl') ? 'text-box' : 'left-logo-box'"
>
<img class="logo" :src="logoImg" :style="{ width: logoWidth }" />
<span>{{ loginTitle === '空串' ? '' : loginTitle }}</span> <span>{{ loginTitle === '空串' ? '' : loginTitle }}</span>
</div> </div>
<div v-if="!syncLogin" class="language_box"> <div v-if="!syncLogin" class="language_box">
@ -19,7 +22,7 @@
</div> </div>
<div v-if="!syncLogin" class="content-box" :style="noQrcodeList.includes(project) ? 'width: 450px;' : ''"> <div v-if="!syncLogin" class="content-box" :style="noQrcodeList.includes(project) ? 'width: 450px;' : ''">
<div v-if="isProject && !syncLogin" class="text-box" :style="{ top: titleDistance }"> <div v-if="isProject && !syncLogin" class="text-box" :style="{ top: titleDistance }">
<img v-if="!loginTitle" class="logo" :src="logoImg" :style="{width: titleImgWidth}"> <img v-if="!loginTitle" class="logo" :src="logoImg" :style="{ width: titleImgWidth }" />
<span>{{ title }}</span> <span>{{ title }}</span>
</div> </div>
<div v-if="!noQrcodeList.includes(project)" class="qrcode-main"> <div v-if="!noQrcodeList.includes(project)" class="qrcode-main">
@ -39,22 +42,42 @@
</div> </div>
<div class="tip-info"> <div class="tip-info">
<fieldset> <fieldset>
<legend>{{ $t('login.recommendedConfiguration') }}</legend> <legend>
<span>{{ $t('login.browser') }} {{ $t('login.recommendedConfiguration') }}
<a href="https://www.google.cn/chrome/" target="_blank" style="text-decoration: underline;">{{ $t('login.googleChrome') }}</a> </legend>
<span
>{{ $t('login.browser') }}
<a href="https://www.google.cn/chrome/" target="_blank" style="text-decoration: underline;">{{
$t('login.googleChrome')
}}</a>
</span> </span>
<br> <br />
<span>{{ $t('login.screenResolution') + '1920*1080' }}</span> <span>{{ $t('login.screenResolution') + '1920*1080' }}</span>
</fieldset> </fieldset>
</div> </div>
</div> </div>
<el-form ref="loginForm" v-loading="loading" class="login-form" :model="loginForm" :rules="loginRules" label-position="left"> <el-form
<div v-if="!isProject&&!project.endsWith('heb')" class="title_box">{{ $t('login.welcomeTo') + title }}</div> ref="loginForm"
v-loading="loading"
class="login-form"
:model="loginForm"
:rules="loginRules"
label-position="left"
>
<div v-if="!isProject && !project.endsWith('heb')" class="title_box">
{{ $t('login.welcomeTo') + title }}
</div>
<el-form-item prop="username" class="item_form_box"> <el-form-item prop="username" class="item_form_box">
<span class="svg-container svg-container_login"> <span class="svg-container svg-container_login">
<svg-icon icon-class="user" /> <svg-icon icon-class="user" />
</span> </span>
<el-input v-model="loginForm.username" name="username" type="text" :placeholder="this.$t('login.mobilePhoneNumberOrEmail')" @keyup.enter.native="goToNext" /> <el-input
v-model="loginForm.username"
name="username"
type="text"
:placeholder="this.$t('login.mobilePhoneNumberOrEmail')"
@keyup.enter.native="goToNext"
/>
</el-form-item> </el-form-item>
<el-form-item prop="password" class="item_form_box item_form_password"> <el-form-item prop="password" class="item_form_box item_form_password">
<span class="svg-container"> <span class="svg-container">
@ -88,12 +111,18 @@
class="popover_box" class="popover_box"
> >
<div> <div>
<img :src="QCode" alt="" style="width: 100px; height: 100px; display: block; margin:0 auto;"> <img :src="QCode" alt="" style="width: 100px; height: 100px; display: block; margin:0 auto;" />
<div style="margin-top: 10px; word-break: break-word;text-align: center;">{{ $t('login.perfectInformation') }}</div> <div style="margin-top: 10px; word-break: break-word;text-align: center;">
{{ $t('login.perfectInformation') }}
</div>
</div>
<div slot="reference">
{{ $t('login.unableToLogin') }}
</div> </div>
<div slot="reference">{{ $t('login.unableToLogin') }}</div>
</el-popover> </el-popover>
<div v-if="registerCodeList.includes(project)" class="popover_box active" @click="registerUser">注册账号</div> <div v-if="registerCodeList.includes(project)" class="popover_box active" @click="registerUser">
注册账号
</div>
</div> </div>
<el-form-item> <el-form-item>
<el-button type="primary" style="width:100%;" @click.native.prevent="handleLogin"> <el-button type="primary" style="width:100%;" @click.native.prevent="handleLogin">
@ -101,7 +130,9 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
<div style="display: inline-block;width: 100%;"> <div style="display: inline-block;width: 100%;">
<div class="popover_box active" style="bottom: 50px;" @click="forgetPassword">忘记密码</div> <div class="popover_box active" style="bottom: 50px;" @click="forgetPassword">
忘记密码
</div>
</div> </div>
</el-form> </el-form>
</div> </div>
@ -112,13 +143,18 @@
<div v-if="project.endsWith('xadt')" style="position: absolute; bottom: 10px;right: 20px; font-size: 14px;"> <div v-if="project.endsWith('xadt')" style="position: absolute; bottom: 10px;right: 20px; font-size: 14px;">
<span>本产品由西安地铁李乐工作室与北京玖琏科技有限公司联合开发</span> <span>本产品由西安地铁李乐工作室与北京玖琏科技有限公司联合开发</span>
</div> </div>
<div v-if="project === 'drts'" style="position: absolute; bottom: 50px; font-size: 20px;right: 20px;color:#3D3D3D;width: 370px;"> <div
v-if="project === 'drts'"
style="position: absolute; bottom: 50px; font-size: 20px;right: 20px;color:#3D3D3D;width: 370px;"
>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<img :src="wchatImg" width="80" height="80"> <img :src="wchatImg" width="80" height="80" />
</el-col> </el-col>
<el-col :span="18" style="text-align: left"> <el-col :span="18" style="text-align: left">
<div style="margin-top: 10px">服务电话13910989830</div> <div style="margin-top: 10px">
服务电话13910989830
</div>
<!--<div style="margin-top: 10px">截止日期2020年12月31日</div>--> <!--<div style="margin-top: 10px">截止日期2020年12月31日</div>-->
</el-col> </el-col>
</el-row> </el-row>
@ -132,54 +168,66 @@
</div> </div>
<register ref="register" /> <register ref="register" />
<forget-password ref="forgetPassword" /> <forget-password ref="forgetPassword" />
<OrgSelect ref="orgSelect" />
</div> </div>
</template> </template>
<script> <script>
import QCode from '@/assets/erCode.jpg'; import QCode from '@/assets/erCode.jpg'
import { setSessionStorage, removeSessionStorage } from '@/utils/auth'; import { setSessionStorage, removeSessionStorage } from '@/utils/auth'
import Cookies from 'js-cookie'; import Cookies from 'js-cookie'
import md5 from 'js-md5'; import md5 from 'js-md5'
import QrcodeVue from 'qrcode.vue'; import QrcodeVue from 'qrcode.vue'
import { getLoginWmurl, checkLoginStatus, getLoginInfo } from '@/api/login'; import { getLoginWmurl, checkLoginStatus, getLoginInfo, getOrgList, selectOrgnization } from '@/api/login'
import { LoginParams } from '@/utils/login'; import { LoginParams } from '@/utils/login'
import bgImg from '@/assets/bg1.jpg'; import bgImg from '@/assets/bg1.jpg'
import bgIbpImg from '@/assets/bg_ibp.png'; import bgIbpImg from '@/assets/bg_ibp.png'
import bgIscsImg from '@/assets/bg_iscs.jpg'; import bgIscsImg from '@/assets/bg_iscs.jpg'
import bgCctvImg from '@/assets/bg_cctv.jpg'; import bgCctvImg from '@/assets/bg_cctv.jpg'
import bgLswImg from '@/assets/bg_lsw.jpg'; import bgLswImg from '@/assets/bg_lsw.jpg'
import bgPsdImg from '@/assets/bg_psd.png'; import bgPsdImg from '@/assets/bg_psd.png'
import HandRight from '@/assets/hand-o-right.png'; import HandRight from '@/assets/hand-o-right.png'
import wchat from '@/assets/wchat.png'; import wchat from '@/assets/wchat.png'
import { UrlConfig } from '@/scripts/ConstDic'; import { UrlConfig } from '@/scripts/ConstDic'
import { loginInfo, ProjectIcon, ProjectLoginStyleList, VersionBaseNoShow, MainBodyNoShow, NoQrcodeList, localPackageProject, RegisterCodeList, RealCctvList} from '@/scripts/ProjectConfig'; import {
import { removeToken, getToken } from '@/utils/auth'; loginInfo,
import LangStorage from '@/utils/lang'; ProjectIcon,
import FloatPart from './floatPart'; ProjectLoginStyleList,
import { getSimulationInfoNew } from '@/api/simulation'; VersionBaseNoShow,
import { getSimulationInfoByGroup } from '@/api/rtSimulation'; MainBodyNoShow,
import { getSessionStorage } from '@/utils/auth'; NoQrcodeList,
import Register from './register'; localPackageProject,
import ForgetPassword from './forgetPassword'; RegisterCodeList,
RealCctvList
} from '@/scripts/ProjectConfig'
import { removeToken, getToken } from '@/utils/auth'
import LangStorage from '@/utils/lang'
import FloatPart from './floatPart'
import { getSimulationInfoNew } from '@/api/simulation'
import { getSimulationInfoByGroup } from '@/api/rtSimulation'
import { getSessionStorage } from '@/utils/auth'
import Register from './register'
import ForgetPassword from './forgetPassword'
import OrgSelect from './orgSelect'
export default { export default {
name: 'Login', name: 'Login',
components: { QrcodeVue, FloatPart, Register, ForgetPassword }, components: { QrcodeVue, FloatPart, Register, ForgetPassword, OrgSelect },
data() { data() {
const validateName = (rule, value, callback) => { const validateName = (rule, value, callback) => {
if (value) { if (value) {
callback(); callback()
} else { } else {
callback(new Error('请输入用户名')); callback(new Error('请输入用户名'))
}
} }
};
const validatePass = (rule, value, callback) => { const validatePass = (rule, value, callback) => {
if (value.length < 5) { if (value.length < 5) {
callback(new Error(this.$t('login.passwordHint'))); callback(new Error(this.$t('login.passwordHint')))
} else { } else {
callback(); callback()
}
} }
};
return { return {
QCode: QCode, QCode: QCode,
loading111: true, loading111: true,
@ -218,48 +266,48 @@ export default {
wchatImg: wchat, wchatImg: wchat,
handRight: HandRight, handRight: HandRight,
registerCodeList: RegisterCodeList registerCodeList: RegisterCodeList
}; }
}, },
computed: { computed: {
project() { project() {
const project = this.$route.query.project; const project = this.$route.query.project
const split = this.$route.path.split('/')[1]; const split = this.$route.path.split('/')[1]
if (process.env.VUE_APP_PRO && process.env.VUE_APP_PRO !== 'local-test') { if (process.env.VUE_APP_PRO && process.env.VUE_APP_PRO !== 'local-test') {
return localPackageProject[process.env.VUE_APP_PRO + split]; return localPackageProject[process.env.VUE_APP_PRO + split]
} else if (split == 'design') { } else if (split == 'design') {
return project ? split + project : split; return project ? split + project : split
} else if (split == 'login') { } else if (split == 'login') {
return project || 'login'; return project || 'login'
} else { } else {
return split; return split
} }
}, },
loginTitle() { loginTitle() {
return loginInfo[this.project].loginTitle; return loginInfo[this.project].loginTitle
}, },
title() { title() {
return loginInfo[this.project].title; return loginInfo[this.project].title
}, },
logoWidth() { logoWidth() {
return loginInfo[this.project].logoWidth; return loginInfo[this.project].logoWidth
}, },
isProject() { isProject() {
const projectName = this.project; const projectName = this.project
return ProjectLoginStyleList.includes(projectName); return ProjectLoginStyleList.includes(projectName)
}, },
titleDistance() { titleDistance() {
return loginInfo[this.project].titleDistance || '-60px'; return loginInfo[this.project].titleDistance || '-60px'
}, },
titleImgWidth() { titleImgWidth() {
return loginInfo[this.project].titleImgWidth || '80px'; return loginInfo[this.project].titleImgWidth || '80px'
}, },
logoImg() { logoImg() {
const projectName = this.project; const projectName = this.project
return ProjectIcon[projectName]; return ProjectIcon[projectName]
}, },
bgImg() { bgImg() {
const bgImgAll = process.env.VUE_APP_PRO === 'local' || this.$route.query.project == 'heb' ? '' : bgImg; const bgImgAll = process.env.VUE_APP_PRO === 'local' || this.$route.query.project == 'heb' ? '' : bgImg
const synchronousLogin = ['VR_IBP', 'LSW', 'CCTV', 'ISCS_LW', 'ISCS_CW', 'VR_PSD', 'SANDBOX', 'ILW', 'PIS_STAND', 'PIS_TRAIN']; const synchronousLogin = ['VR_IBP', 'LSW', 'CCTV', 'ISCS_LW', 'ISCS_CW', 'VR_PSD', 'SANDBOX', 'ILW', 'PIS_STAND', 'PIS_TRAIN']
const imgMap = { const imgMap = {
ISCS_LW: bgIscsImg, ISCS_LW: bgIscsImg,
ISCS_CW: bgIscsImg, ISCS_CW: bgIscsImg,
@ -269,12 +317,12 @@ export default {
LSW: bgLswImg, LSW: bgLswImg,
SANDBOX: bgLswImg, SANDBOX: bgLswImg,
ILW: bgLswImg ILW: bgLswImg
}; }
return synchronousLogin.includes(this.$route.query.type) ? imgMap[this.$route.query.type] : bgImgAll; return synchronousLogin.includes(this.$route.query.type) ? imgMap[this.$route.query.type] : bgImgAll
}, },
syncLogin() { syncLogin() {
const synchronousLogin = ['VR_IBP', 'LSW', 'CCTV', 'ISCS_LW', 'ISCS_CW', 'VR_PSD', 'SANDBOX', 'ILW', 'PIS_STAND', 'PIS_TRAIN']; const synchronousLogin = ['VR_IBP', 'LSW', 'CCTV', 'ISCS_LW', 'ISCS_CW', 'VR_PSD', 'SANDBOX', 'ILW', 'PIS_STAND', 'PIS_TRAIN']
return this.$route.query.type ? synchronousLogin.includes(this.$route.query.type) : false; return this.$route.query.type ? synchronousLogin.includes(this.$route.query.type) : false
}, },
loadingText() { loadingText() {
const textMap = { const textMap = {
@ -287,184 +335,230 @@ export default {
ILW: '检测教员机登录中', ILW: '检测教员机登录中',
PIS_TRAIN: '检测教员机登录中', PIS_TRAIN: '检测教员机登录中',
PIS_STAND: '检测教员机登录中' PIS_STAND: '检测教员机登录中'
}; }
return this.$route.query.type ? textMap[this.$route.query.type] : ''; return this.$route.query.type ? textMap[this.$route.query.type] : ''
} }
}, },
created() { created() {
if (!loginInfo[this.project]) { if (!loginInfo[this.project]) {
this.$messageBox('无效的登录路径,请查证路径后重试!'); this.$messageBox('无效的登录路径,请查证路径后重试!')
return; return
} }
document.querySelector("link[rel*='icon']").href = loginInfo[this.project].linkIcon || ProjectIcon[this.project]; document.querySelector("link[rel*='icon']").href = loginInfo[this.project].linkIcon || ProjectIcon[this.project]
removeSessionStorage('projectDevice'); removeSessionStorage('projectDevice')
this.computedAttribute(); this.computedAttribute()
if (Cookies.get(this.cookiesName) && Cookies.get(this.cookiesToken)) { if (Cookies.get(this.cookiesName) && Cookies.get(this.cookiesToken)) {
const model = {'username': Cookies.get(this.cookiesName), 'password': Cookies.get(this.cookiesToken), 'project':loginInfo[this.project].loginParam}; const model = {
model.type = this.modelType; username: Cookies.get(this.cookiesName),
this.$store.dispatch('Login', model).then(() => { password: Cookies.get(this.cookiesToken),
this.$store.dispatch('SetAccount', model.username); project: loginInfo[this.project].loginParam
this.handleLoginSucessRoute();
}).catch(error => {
if (error.code === '30001') {
this.tipsMsg = this.$t('login.accountOrPasswordIsIncorrect');
} else if (error.code == '10001') {
this.tipsMsg = '教员机尚未登录,请稍后重试!';
} else if (error.code == '10013' || error.code == '10014') {
this.tipsMsg = '该账号权限不足!';
} else {
this.tipsMsg = error.message;
} }
this.loading = false; model.type = this.modelType
setTimeout(() => { this.tipsMsg = ''; }, 5000); this.$store
}); .dispatch('Login', model)
.then(() => {
this.$store.dispatch('SetAccount', model.username)
// this.handleLoginSucessRoute();
this.checkOrgnizationInfo()
})
.catch(error => {
if (error.code === '30001') {
this.tipsMsg = this.$t('login.accountOrPasswordIsIncorrect')
} else if (error.code == '10001') {
this.tipsMsg = '教员机尚未登录,请稍后重试!'
} else if (error.code == '10013' || error.code == '10014') {
this.tipsMsg = '该账号权限不足!'
} else {
this.tipsMsg = error.message
}
this.loading = false
setTimeout(() => {
this.tipsMsg = ''
}, 5000)
})
} }
}, },
mounted() { mounted() {
document.title = loginInfo[this.project].browserTitle || loginInfo[this.project].title; document.title = loginInfo[this.project].browserTitle || loginInfo[this.project].title
if (this.syncLogin || !this.noQrcodeList.includes(this.project)) { if (this.syncLogin || !this.noQrcodeList.includes(this.project)) {
this.loginRefresh(); this.loginRefresh()
} }
}, },
beforeDestroy() { beforeDestroy() {
this.countdown && clearInterval(this.countdown); this.countdown && clearInterval(this.countdown)
}, },
methods: { methods: {
computedAttribute() { computedAttribute() {
if (this.project.startsWith('design')) { if (this.project.startsWith('design')) {
this.cookiesName = 'UserDesignName'; this.cookiesName = 'UserDesignName'
this.cookiesToken = 'UserDesignToken'; this.cookiesToken = 'UserDesignToken'
this.modelType = 'design'; this.modelType = 'design'
this.loginClient = 'Design'; this.loginClient = 'Design'
this.path = UrlConfig.design.prefix; this.path = UrlConfig.design.prefix
} }
const nowLang = LangStorage.getLang('zh'); const nowLang = LangStorage.getLang('zh')
if (nowLang === 'zh') { if (nowLang === 'zh') {
this.lang = 'en'; this.lang = 'en'
this.language = 'English'; this.language = 'English'
} }
removeToken(); removeToken()
setSessionStorage('project', this.project); setSessionStorage('project', this.project)
}, },
clearTimer(timer) { clearTimer(timer) {
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer)
timer = null; timer = null
} }
}, },
loginRefresh() { loginRefresh() {
// this.loadingCode = true; // this.loadingCode = true;
const self = this; const self = this
const params = LoginParams[this.loginClient]; const params = LoginParams[this.loginClient]
params.project = loginInfo[this.project].loginParam; params.project = loginInfo[this.project].loginParam
if (this.$route.query.projectDevice) { if (this.$route.query.projectDevice) {
params.deviceCode = this.$route.query.projectDevice; params.deviceCode = this.$route.query.projectDevice
} }
getLoginWmurl(params).then(response => { getLoginWmurl(params)
this.sessionId = response.data.sessionId; .then(response => {
this.loginUrl = response.data.url; this.sessionId = response.data.sessionId
this.loadingCode = false; this.loginUrl = response.data.url
this.checkLoginStatus(); this.loadingCode = false
}).catch(() => { this.checkLoginStatus()
})
.catch(() => {
if (this.syncLogin) { if (this.syncLogin) {
setTimeout(() => { setTimeout(() => {
self.loginRefresh(); self.loginRefresh()
}, 3000); }, 3000)
} else { } else {
this.loadingCode = false; this.loadingCode = false
this.$messageBox(this.$t('login.getLoginQrCode')); this.$messageBox(this.$t('login.getLoginQrCode'))
} }
}); })
}, },
checkLoginStatus() { checkLoginStatus() {
const self = this; const self = this
// //
if (this && this._isDestroyed) { if (this && this._isDestroyed) {
return; return
} }
// //
// //
this.clearTimer(this.checkLogin); this.clearTimer(this.checkLogin)
this.checkLogin = setTimeout(() => { this.checkLogin = setTimeout(() => {
checkLoginStatus(self.sessionId).then(response => { checkLoginStatus(self.sessionId)
.then(response => {
// //
self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token, type: this.modelType }).then(() => { self.$store
.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token, type: this.modelType })
.then(() => {
// //
self.clearTimer(self.checkLogin); self.clearTimer(self.checkLogin)
this.handleLoginSucessRoute(); // this.handleLoginSucessRoute();
}); this.checkOrgnizationInfo()
}).catch(error => { })
})
.catch(error => {
if ((error.data && error.data.status === 'EXPIRE') || error.code != 200) { if ((error.data && error.data.status === 'EXPIRE') || error.code != 200) {
if (this.syncLogin) { if (this.syncLogin) {
self.loginRefresh(); self.loginRefresh()
} else { } else {
this.loadingCode = true; this.loadingCode = true
this.loginUrl = ''; this.loginUrl = ''
} }
} else { } else {
self.checkLoginStatus(); self.checkLoginStatus()
} }
}); })
}, 3000); }, 3000)
}, },
showPwd() { showPwd() {
if (this.pwdType === 'password') { if (this.pwdType === 'password') {
this.pwdDisplay = false; this.pwdDisplay = false
this.pwdType = ''; this.pwdType = ''
} else { } else {
this.pwdType = 'password'; this.pwdType = 'password'
this.pwdDisplay = true; this.pwdDisplay = true
} }
}, },
goToNext() { goToNext() {
if (this.loginForm.username.length < 5) { if (this.loginForm.username.length < 5) {
return; return
} else { } else {
this.$refs['password'].focus(); this.$refs['password'].focus()
} }
}, },
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
const model = Object.assign({}, this.loginForm); const model = Object.assign({}, this.loginForm)
model.password = md5(model.password); model.password = md5(model.password)
model.type = this.modelType; model.type = this.modelType
model.project = loginInfo[this.project].loginParam; model.project = loginInfo[this.project].loginParam
model.deviceCode = this.$route.query.projectDevice; model.deviceCode = this.$route.query.projectDevice
model.teacherLogin = this.teacherLogin; model.teacherLogin = this.teacherLogin
this.loading = true; this.loading = true
if (this.isAutoLogin) { if (this.isAutoLogin) {
Cookies.set(this.cookiesName, model.username, { expires: 2}); Cookies.set(this.cookiesName, model.username, { expires: 2 })
Cookies.set(this.cookiesToken, model.password, { expires: 2}); Cookies.set(this.cookiesToken, model.password, { expires: 2 })
} }
this.$store.dispatch('Login', model).then(() => { this.$store
this.$store.dispatch('SetAccount', model.username); .dispatch('Login', model)
this.handleLoginSucessRoute(); .then(() => {
}).catch(error => { // this.$store.dispatch('SetAccount', model.username);
// this.handleLoginSucessRoute();
this.checkOrgnizationInfo()
})
.catch(error => {
if (error.code == '40003') { if (error.code == '40003') {
this.tipsMsg = this.$t('login.accountOrPasswordIsIncorrect'); this.tipsMsg = this.$t('login.accountOrPasswordIsIncorrect')
} else if (error.code == '10001') { } else if (error.code == '10001') {
this.tipsMsg = '教员机尚未登录,请稍后重试!'; this.tipsMsg = '教员机尚未登录,请稍后重试!'
} else if (error.code == '10013' || error.code == '10014') { } else if (error.code == '10013' || error.code == '10014') {
this.tipsMsg = '该账号权限不足'; this.tipsMsg = '该账号权限不足'
} else { } else {
this.tipsMsg = error.message; this.tipsMsg = error.message
} }
this.loading = false; this.loading = false
setTimeout(() => { this.tipsMsg = ''; }, 5000); setTimeout(() => {
}); this.tipsMsg = ''
}, 5000)
})
} else { } else {
console.log('error submit!!'); console.log('error submit!!')
return false; return false
} }
}); })
},
checkOrgnizationInfo() {
getOrgList().then(resp => {
const orgList = resp.data
let orgId = ''
if (orgList.length < 2) {
if (orgList.length === 1) {
orgId = orgList[0].orgId
selectOrgnization(orgId)
}
this.handleLoginSucessRoute()
} else {
this.showOrgSelect(orgList).then(this.handleLoginSucessRoute())
}
})
},
showOrgSelect(orgList) {
this.$refs.orgSelect.doShow(orgList)
return new Promise(() => {
this.$refs.orgSelect.$once('select', orgId => {
selectOrgnization(orgId)
})
})
}, },
handleLoginSucessRoute() { handleLoginSucessRoute() {
// //
this.loading = this.project === 'drts' || this.project === 'hlsdrts' || false; this.loading = this.project === 'drts' || this.project === 'hlsdrts' || false
this.tipsMsg = ''; this.tipsMsg = ''
removeSessionStorage('againEnter'); removeSessionStorage('againEnter')
if (this.$route.query.projectDevice) { if (this.$route.query.projectDevice) {
getLoginInfo(getToken()).then(res => { getLoginInfo(getToken()).then(res => {
getSimulationInfoNew(res.data.group).then(resp => { getSimulationInfoNew(res.data.group).then(resp => {
@ -474,43 +568,59 @@ export default {
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type type: this.$route.query.type
}; }
setSessionStorage('projectDevice', JSON.stringify(res.data.deviceVO)); setSessionStorage('projectDevice', JSON.stringify(res.data.deviceVO))
if (this.$route.query.type == 'LSW') { if (this.$route.query.type == 'LSW') {
const config = JSON.parse(res.data.deviceVO.config); const config = JSON.parse(res.data.deviceVO.config)
if (config.quadrant == '99') { if (config.quadrant == '99') {
this.$router.push({ path: `/displayBigScreen/${resp.data.map.id}`, query: {...query, prdType:resp.data.prodType} }); this.$router.push({
path: `/displayBigScreen/${resp.data.map.id}`,
query: { ...query, prdType: resp.data.prodType }
})
} else { } else {
this.$router.push({ path: `/bigSplitScreen/${resp.data.map.id}`, query: {...query, prdType:resp.data.prodType} }); this.$router.push({
path: `/bigSplitScreen/${resp.data.map.id}`,
query: { ...query, prdType: resp.data.prodType }
})
} }
} else if (this.$route.query.type === 'ISCS_LW' || this.$route.query.type === 'ISCS_CW') { } else if (this.$route.query.type === 'ISCS_LW' || this.$route.query.type === 'ISCS_CW') {
const config = JSON.parse(res.data.deviceVO.config); const config = JSON.parse(res.data.deviceVO.config)
if (config.picture === 'paMain') { if (config.picture === 'paMain') {
// displayIscs/system/stationConfig/paMain?stationName=&stationId=Station25166&group=20-120-196-193&mapId=196&lineCode=02 // displayIscs/system/stationConfig/paMain?stationName=&stationId=Station25166&group=20-120-196-193&mapId=196&lineCode=02
this.$router.push({ path: `displayIscs/system/stationConfig/paMain`, query: { this.$router.push({
path: `displayIscs/system/stationConfig/paMain`,
query: {
stationId: config.stationCode, stationId: config.stationCode,
group: res.data.group, group: res.data.group,
mapId: resp.data.map.id, mapId: resp.data.map.id,
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type type: this.$route.query.type
} }); }
})
} else if (config.picture === 'pidsMain') { } else if (config.picture === 'pidsMain') {
this.$router.push({ path: `displayIscs/system/stationConfig/pidsMain`, query: { this.$router.push({
path: `displayIscs/system/stationConfig/pidsMain`,
query: {
stationId: config.stationCode, stationId: config.stationCode,
group: res.data.group, group: res.data.group,
mapId: resp.data.map.id, mapId: resp.data.map.id,
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type type: this.$route.query.type
} }); }
})
} else { } else {
this.$router.push({ path: `/displayIscs/system`, query: { this.$router.push({
path: `/displayIscs/system`,
query: {
group: res.data.group, group: res.data.group,
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
mapId: resp.data.map.id, mapId: resp.data.map.id,
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type} }); type: this.$route.query.type
}
})
} }
} else if (this.$route.query.type == 'CCTV') { } else if (this.$route.query.type == 'CCTV') {
if (RealCctvList.includes(this.project)) { if (RealCctvList.includes(this.project)) {
@ -523,19 +633,24 @@ export default {
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type type: this.$route.query.type
} }
}); })
} else { } else {
this.$router.push({ path: `/jlmap3d/passengerflow`, query:{ this.$router.push({
path: `/jlmap3d/passengerflow`,
query: {
mapid: resp.data.map.id, mapid: resp.data.map.id,
group: res.data.group, group: res.data.group,
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
project: getSessionStorage('project'), project: getSessionStorage('project'),
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type type: this.$route.query.type
} }); }
})
} }
} else if (this.$route.query.type === 'SCHEDULING') { } else if (this.$route.query.type === 'SCHEDULING') {
this.$router.push({ path: `/displayNew/demon`, query: { this.$router.push({
path: `/displayNew/demon`,
query: {
group: res.data.group, group: res.data.group,
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
mapId: resp.data.map.id, mapId: resp.data.map.id,
@ -544,9 +659,12 @@ export default {
try: '0', try: '0',
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type type: this.$route.query.type
}}); }
})
} else if (this.$route.query.type === 'DEPOT') { } else if (this.$route.query.type === 'DEPOT') {
this.$router.push({ path: `/displayNew/demon`, query: { this.$router.push({
path: `/displayNew/demon`,
query: {
group: res.data.group, group: res.data.group,
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
mapId: resp.data.map.id, mapId: resp.data.map.id,
@ -555,12 +673,13 @@ export default {
try: '0', try: '0',
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type type: this.$route.query.type
}}); }
})
} else if (this.$route.query.type === 'VR_PSD') { } else if (this.$route.query.type === 'VR_PSD') {
if (res.data.deviceVO && res.data.deviceVO.config) { if (res.data.deviceVO && res.data.deviceVO.config) {
query.psdCode = JSON.parse(res.data.deviceVO.config).psdCode; query.psdCode = JSON.parse(res.data.deviceVO.config).psdCode
} }
this.$router.push({ path: `/jointTrainingNew`, query: query }); this.$router.push({ path: `/jointTrainingNew`, query: query })
} else if (this.$route.query.type === 'SANDBOX') { } else if (this.$route.query.type === 'SANDBOX') {
const sandboxQuery = { const sandboxQuery = {
mapid: query.mapId, mapid: query.mapId,
@ -569,23 +688,25 @@ export default {
token: getToken(), token: getToken(),
projectDevice: this.$route.query.projectDevice, projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type type: this.$route.query.type
};
this.$router.push({ path: `/jlmap3d/sandbox`, query: sandboxQuery });
} else if (this.$route.query.type === 'ILW') {
this.$router.push({ path: `/jointTrainingNew`, query: query });
} else if (this.$route.query.type === 'PIS_STAND' || this.$route.query.type === 'PIS_TRAIN') {
const config = JSON.parse(res.data.deviceVO.config);
this.$router.push({ path: `/pis`, query: {...query, ...config}});
} else {
this.$router.push({ path: `/jointTrainingNew`, query: query });
} }
}); this.$router.push({ path: `/jlmap3d/sandbox`, query: sandboxQuery })
}); } else if (this.$route.query.type === 'ILW') {
this.$router.push({ path: `/jointTrainingNew`, query: query })
} else if (this.$route.query.type === 'PIS_STAND' || this.$route.query.type === 'PIS_TRAIN') {
const config = JSON.parse(res.data.deviceVO.config)
this.$router.push({ path: `/pis`, query: { ...query, ...config } })
} else {
this.$router.push({ path: `/jointTrainingNew`, query: query })
}
})
})
} else if (this.project === 'drts' || this.project === 'hlsdrts' || this.project === 'bjd' || this.project === 'wjls') { } else if (this.project === 'drts' || this.project === 'hlsdrts' || this.project === 'bjd' || this.project === 'wjls') {
getLoginInfo(getToken()).then(res => { getLoginInfo(getToken()).then(res => {
if (this.project === 'wjls') { if (this.project === 'wjls') {
getSimulationInfoByGroup(res.data.group).then(resp => { getSimulationInfoByGroup(res.data.group).then(resp => {
this.$router.push({ path: `/displayCity/demon`, query: { this.$router.push({
path: `/displayCity/demon`,
query: {
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
group: res.data.group, group: res.data.group,
prdType: resp.data.prodType, prdType: resp.data.prodType,
@ -594,13 +715,16 @@ export default {
try: '0', try: '0',
newApi: true, newApi: true,
project: this.project project: this.project
}}); }
this.loading = false; })
}); this.loading = false
})
} else { } else {
getSimulationInfoNew(res.data.group).then(resp => { getSimulationInfoNew(res.data.group).then(resp => {
if (this.project === 'drts' || this.project === 'hlsdrts') { if (this.project === 'drts' || this.project === 'hlsdrts') {
this.$router.push({ path: `/displayNew/demon`, query: { this.$router.push({
path: `/displayNew/demon`,
query: {
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
group: res.data.group, group: res.data.group,
prdType: resp.data.prodType, prdType: resp.data.prodType,
@ -608,58 +732,51 @@ export default {
goodsId: '', goodsId: '',
try: '0', try: '0',
project: this.project project: this.project
}}); }
})
} else { } else {
this.$store.dispatch('app/transitionAnimations'); this.$store.dispatch('app/transitionAnimations')
this.$router.push({ path: `/practiceDisplay`, query: { this.$router.push({
path: `/practiceDisplay`,
query: {
lineCode: resp.data.map.lineCode, lineCode: resp.data.map.lineCode,
group: res.data.group, group: res.data.group,
prdType: resp.data.prodType, prdType: resp.data.prodType,
mapId: resp.data.map.id, mapId: resp.data.map.id,
project: this.project project: this.project
}});
} }
this.loading = false; })
});
} }
}); this.loading = false
})
}
})
} else if (this.project === 'zzwwtest') { } else if (this.project === 'zzwwtest') {
this.$router.push({ path: '/jlmap3d/zzwwtest', query: {lessonId:'35'} }); this.$router.push({ path: '/jlmap3d/zzwwtest', query: { lessonId: '35' } })
} else if (this.project === 'xzexam') { } else if (this.project === 'xzexam') {
this.$router.push({ path: '/jlmap3d/xzexam', query: {} }); this.$router.push({ path: '/jlmap3d/xzexam', query: {} })
} else if (this.project === 'richorlesson3d') { } else if (this.project === 'richorlesson3d') {
this.$router.push({ path: '/jlmap3d/lesson3dselect', query: {} }); this.$router.push({ path: '/jlmap3d/lesson3dselect', query: {} })
} else { } else {
if (this.teacherLogin) { if (this.teacherLogin) {
this.$router.push({ path: '/info/organization/classManage?enter=teacher' }); this.$router.push({ path: '/info/organization/classManage?enter=teacher' })
} else { } else {
this.$router.push({ path: this.path }); this.$router.push({ path: this.path })
} }
} }
}, },
handleLanguage() { handleLanguage() {
this.$i18n.locale = this.lang; this.$i18n.locale = this.lang
LangStorage.setLang(this.lang); LangStorage.setLang(this.lang)
}, },
// goCompetitionRules(val) {
// if (val === '1') {
// window.open('https://mp.weixin.qq.com/s?__biz=MzI3NzMwODY3OQ==&mid=2247506304&idx=1&sn=77708ca228404cee2b28e131cdfb9735&chksm=eb6aade8dc1d24fe6eb9f1334aadda239f47dafc79de7d522e0f3f00e2d3ba1dd213dda6764c&xtrack=1&scene=90&subscene=93&sessionid=1598522875&clicktime=1598523062&enterid=1598523062&ascene=56&devicetype=android-29&version=3.0.27.2701&nettype=WIFI&abtest_cookie=AAACAA%3D%3D&lang=zh_CN&exportkey=AQZ2cTPSob%2B5kBDiWnKw0Js%3D&pass_ticket=12Xyhe%2BbZsC9Vuzfs0iYUUn0i%2Br5JlZiOGCxWoExuthBhnIrpkmUyjVRi6bjyA1I&wx_header=1&platform=win', '_blank');
// } else if (val === '2') {
// window.open('https://mp.weixin.qq.com/s?__biz=MzI3NzMwODY3OQ==&mid=2247506789&idx=1&sn=5b5c1e6e0ca7dc54a935f57cee4eb1a2&chksm=eb6aaf0ddc1d261ba2ba7b9bed810b12b3317d45b1a484095d13b3d7e075b091d92fc7b9afb8&mpshare=1&scene=1&srcid=0910Yd3PVFs0WjWZyumLN9Jo&sharer_sharetime=1599740490862&sharer_shareid=98d62529ea7e8d0f6fb2281f854f3ea1&version=3.0.30.2006&platform=win&rd2werd=1#wechat_redirect', '_blank');
// } else if (val === '3') {
// window.open('http://metroskills.camet.org.cn', '_blank');
// } else if (val === '4') {
// window.open('https://mp.weixin.qq.com/s?__biz=MzI3NzMwODY3OQ==&mid=2247510328&idx=1&sn=b9ba74efd9688513ae8c28f297268bd5&chksm=eb6add50dc1d54460f6a965a6b96fb7adb5205327dba5f7b57ec963ee87e1e2694e7b230fd65&xtrack=1&scene=90&subscene=93&sessionid=1607077432&clicktime=1607077443&enterid=1607077443&ascene=56&devicetype=android-29&version=3.0.36.2008&nettype=ctnet&abtest_cookie=AAACAA%3D%3D&lang=zh_CN&exportkey=AX5YNBACCv37GORQdECX6PA%3D&pass_ticket=hZngvACKkOr5GKVNY2vl3nM0vWwylSDF51O5A12K38n8Sok%2FWQv2S8OMQD2sYBA1&wx_header=1&platform=win');
// }
// },
registerUser() { registerUser() {
this.$refs.register.doShow(); this.$refs.register.doShow()
}, },
forgetPassword() { forgetPassword() {
this.$refs.forgetPassword.doShow(); this.$refs.forgetPassword.doShow()
}
} }
} }
};
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
@ -668,14 +785,14 @@ export default {
.drts_title { .drts_title {
position: absolute; position: absolute;
top: 10%; top: 10%;
color:#F00; color: #f00;
text-align: center; text-align: center;
} }
.drts_explain { .drts_explain {
position: absolute; position: absolute;
text-align: center; text-align: center;
font-size: 32px; font-size: 32px;
color:#F00; color: #f00;
} }
@media screen and (max-width: 960px) { @media screen and (max-width: 960px) {
.drts_title { .drts_title {
@ -728,7 +845,7 @@ export default {
} }
} }
.login-container { .login-container {
background: #E4EAEA; background: #e4eaea;
.el-form-item { .el-form-item {
background: #fff !important; background: #fff !important;
border: 1px solid rgba(0, 0, 0, 0.1) !important; border: 1px solid rgba(0, 0, 0, 0.1) !important;
@ -764,7 +881,7 @@ export default {
} }
.tip-message { .tip-message {
color: #F56C61; color: #f56c61;
padding: 5px; padding: 5px;
font-size: 12px; font-size: 12px;
height: 23px; height: 23px;
@ -802,27 +919,27 @@ export default {
font-size: 14px; font-size: 14px;
} }
.active:hover { .active:hover {
color: #409EFF; color: #409eff;
} }
.countdown_box { .countdown_box {
display: inline-block; display: inline-block;
width: 35px; width: 35px;
margin-right: 5px; margin-right: 5px;
background: #000; background: #000;
color: #F00; color: #f00;
text-align: center; text-align: center;
border-radius: 5px; border-radius: 5px;
} }
.news-box { .news-box {
color: #409EFF; color: #409eff;
width: 100%; width: 100%;
border-bottom: dashed 1px #409EFF; border-bottom: dashed 1px #409eff;
font-size: 14px; font-size: 14px;
line-height: 30px; line-height: 30px;
height: 30px; height: 30px;
} }
.news-box:hover { .news-box:hover {
color: #3943CB; color: #3943cb;
} }
.login-container { .login-container {
position: fixed; position: fixed;