成都工业学院第三方登录调整

This commit is contained in:
joylink_fanyuhong 2024-05-07 15:46:29 +08:00
parent 91a8410dc2
commit b1baeaabcd
4 changed files with 117 additions and 1 deletions

View File

@ -323,3 +323,11 @@ export function isExistEmail(params) {
}); });
} }
// 成工院第三方登录
export function cgyThirdLogin(data) {
return request({
url: '/api/login/cgy/third',
method: 'post',
data
});
}

View File

@ -8,7 +8,7 @@ import { getFrontProjectConfigByLogin} from '@/api/projectConfig';
import localStore from 'storejs'; import localStore from 'storejs';
import { handlerUrl } from '@/utils/baseUrl'; import { handlerUrl } from '@/utils/baseUrl';
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', '/cgyLogin']; // 不重定向白名单
// 登录路径判断获取 // 登录路径判断获取
function getRouteInfo(to) { function getRouteInfo(to) {

View File

@ -220,6 +220,7 @@ const UserRulesManage = () => import('@/views/userRulesManage/index');
const AuthorityTransfer = () => import('@/views/authorityTransfer/index'); const AuthorityTransfer = () => import('@/views/authorityTransfer/index');
const CreateDistribute = () => import('@/views/authorityTransfer/create/index'); const CreateDistribute = () => import('@/views/authorityTransfer/create/index');
const ThirdJumpSim = () => import('@/views/newMap/display/thirdJump'); const ThirdJumpSim = () => import('@/views/newMap/display/thirdJump');
const CgyLogin = () => import('@/views/thirdLogin/cgyLogin');
const TmsPage = () => import('@/views/jlmap3d/drive/sceneview/tmsPage'); const TmsPage = () => import('@/views/jlmap3d/drive/sceneview/tmsPage');
const ContestSubjectManage = () => import('@/views/contestDataManage/contestSubjectManage/ContestSubjectManage'); const ContestSubjectManage = () => import('@/views/contestDataManage/contestSubjectManage/ContestSubjectManage');
@ -430,6 +431,11 @@ export const constantRoutes = [
component: ThirdJumpSim, component: ThirdJumpSim,
hidden: true hidden: true
}, },
{
path: '/cgyLogin',
component: CgyLogin,
hidden: true
},
{ {
path: '/404', path: '/404',
component: Errpr404, component: Errpr404,

View File

@ -0,0 +1,102 @@
<template>
<div class="thirdLoginContainer">
<div class="thirdLoginMessage">
{{ message }}
</div>
</div>
</template>
<script>
import { cgyThirdLogin } from '@/api/management/user';
import { setToken } from '@/utils/auth';
import { createSimulation } from '@/api/simulation';
import { launchFullscreen } from '@/utils/screen';
export default {
name:'CgyLogin',
data() {
return {
message:''
};
},
computed: {
project() {
const project = this.$route.query.project;
return project || 'login';
}
},
mounted() {
const appId = this.$route.query.appId;
const sessionId = this.$route.query.sessionId;
const timeStamp = this.$route.query.timeStamp;
const account = this.$route.query.account;
const name = this.$route.query.account;
const parentAccount = this.$route.query.parentAccount;
const functionId = this.$route.query.functionId;
if (appId && account && name) {
const data = {
appId,
sessionId,
timeStamp,
account,
name,
parentAccount,
functionId
};
this.message = '正在登陆中......';
cgyThirdLogin(data).then(resp=> {
const token = resp.data;
const header = { group: '', 'X-Token': token };
setToken(token);
this.$store.dispatch('setToken', token);
this.$store.dispatch('subscribe', {header, type:'class'});
this.enterSimulation();
}).catch(() => {
this.message = '参数有误,请检查';
});
} else {
this.message = '参数有误,请检查';
}
},
methods:{
enterSimulation() {
const query = {
third: true
};
if (this.$route.query.type === 'loc') {
query.lineCode = '02';
query.mapId = '124';
query.simType = 'METRO';
query.project = 'cgy';
} else if (this.$route.query.type === 'datie') {
query.lineCode = '16';
query.mapId = '157';
query.simType = 'RAILWAY';
query.project = 'cgy';
} else if (this.$route.query.type === 'drts') {
query.lineCode = '13';
query.mapId = '78';
query.simType = 'METRO';
query.project = 'cgy';
}
createSimulation(this.$route.query.systemId).then(resp => {
query.group = resp.data;
this.$router.replace({ path: `/display/demon`, query: query });
launchFullscreen();
}).catch(error=>{
if (error.code == 10003) {
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
} else {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
}
this.disabled = false;
});
}
}
};
</script>
<style lang="scss" scoped>
.thirdLoginMessage{
padding: 20px;
font-size: 20px;
}
</style>