openThirdLogin,评估弹窗

This commit is contained in:
liaoboping 2025-09-13 18:19:33 +08:00
parent 53a2594d08
commit 77615cddef
8 changed files with 49 additions and 9 deletions

2
public/index.html vendored
View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>App.ico">
<title>数字化试验训练系统</title>
<title>某仿真分析方法工具</title>
<style>.first-loading-wrp{display:flex;justify-content:center;align-items:center;flex-direction:column;min-height:420px;height:100%}.first-loading-wrp>h1{font-size:128px}.first-loading-wrp .loading-wrp{padding:98px;display:flex;justify-content:center;align-items:center}.dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:32px;width:32px;height:32px;box-sizing:border-box}.dot i{width:14px;height:14px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.dot i:nth-child(1){top:0;left:0}.dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style>
<script src="/jquery.min.js"></script>
<script src="https://files.worldwind.arc.nasa.gov/artifactory/web/0.9.0/worldwind.min.js"></script>

View File

@ -23,7 +23,7 @@ export default {
menu: {
locale: true
},
title: '数字化试验训练系统',
title: '某仿真分析方法工具',
pwa: false,
iconfontUrl: '',
production: process.env.NODE_ENV === 'production' && process.env.VUE_APP_PREVIEW !== 'true'

View File

@ -7,12 +7,13 @@ import NProgress from 'nprogress' // progress bar
import storage from 'store'
import router from './router'
import store from './store'
import openThirdLogin from './utils/openThirdLogin'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const allowList = ['thirdLogin', 'login', 'register', 'registerResult'] // no redirect allowList
const loginRoutePath = '/user/login'
const defaultRoutePath = '/simulationScene'
const defaultRoutePath = '/user/thirdLogin'
router.beforeEach((to, from, next) => {
NProgress.start() // start progress bar
@ -58,7 +59,11 @@ router.beforeEach((to, from, next) => {
})
// 失败时,获取用户信息失败时,调用登出,来清空历史保留信息
store.dispatch('Logout').then(() => {
if (process.env.NODE_ENV === 'production') {
openThirdLogin()
} else {
next({ path: loginRoutePath, query: { redirect: to.fullPath } })
}
})
})
} else {
@ -69,8 +74,12 @@ router.beforeEach((to, from, next) => {
if (allowList.includes(to.name)) {
// 在免登录名单,直接进入
next()
} else {
if (process.env.NODE_ENV === 'production') {
openThirdLogin()
} else {
next({ path: loginRoutePath, query: { redirect: to.fullPath } })
}
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
}
}

View File

@ -59,7 +59,7 @@ const user = {
}
if (result.roles && result.permissions.length > 0) {
const role = result.roles
role.permissions = result.permissions
role.permissions = result.permissions.filter(item => item)
role.permissions.map(per => {
if (per.actionEntitySet != null && per.actionEntitySet.length > 0) {
const action = per.actionEntitySet.map(action => { return action.action })

View File

@ -1,5 +1,5 @@
export default () => {
const redirectUri = window.location.origin + window.location.pathname
const redirectUri = window.location.origin + '/user/thirdLogin'
window.location.href =
window._CONFIG.thirdLoginUrl +
'?response_type=code&active_type=user&state=' +

View File

@ -5,6 +5,7 @@ import storage from 'store'
import notification from 'ant-design-vue/es/notification'
import { VueAxios } from './axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import openThirdLogin from './openThirdLogin'
// 创建 axios 实例
const request = axios.create({
@ -34,7 +35,11 @@ const errorHandler = (error) => {
if (token) {
store.dispatch('Logout').then(() => {
setTimeout(() => {
if (process.env.NODE_ENV === 'production') {
openThirdLogin()
} else {
window.location.reload()
}
}, 1500)
})
}

View File

@ -10,10 +10,23 @@ export default {
data() {
return {
src: window._CONFIG.evaluationSrc,
child: null,
}
},
created() {
this.$bus.$emit('set-instructor-system-title', '评估子系统')
this.child = window.open(
this.src,
'newwindow',
'height=' +
window.screen.height +
', width=' +
window.screen.width +
', top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no'
)
},
beforeDestroy() {
this.child && this.child.close()
},
}
</script>

View File

@ -1,6 +1,6 @@
<template>
<div class="evaluation-page">
<iframe :src="src" frameborder="0" style="width: 100%; height: 100%"></iframe>
<!-- <iframe :src="src" frameborder="0" style="width: 100%; height: 100%"></iframe> -->
</div>
</template>
@ -10,10 +10,23 @@ export default {
data() {
return {
src: window._CONFIG.evaluationSrc,
child: null,
}
},
created() {
this.$bus.$emit('set-trainer-system-title', '评估子系统')
this.child = window.open(
this.src,
'newwindow',
'height=' +
window.screen.height +
', width=' +
window.screen.width +
', top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no'
)
},
beforeDestroy() {
this.child && this.child.close()
},
}
</script>