配置式,是否使用第三方登录,是否显示系统菜单

This commit is contained in:
liaoboping 2025-09-28 11:21:00 +08:00
parent 4aca5a138e
commit 04892007e9
5 changed files with 8 additions and 6 deletions

2
public/config.js vendored
View File

@ -3,6 +3,8 @@ window._CONFIG = {
ImageryProviderUrl: '/map/mapWX/{z}/{x}/{y}.jpg',
RoadProviderUrl: '',
TerrainProviderUrl: '/map/mapTerrain/',
showSystemMenu: false,
useThirdLogin: false,
thirdLoginUrl: 'http://127.0.0.1:8080/thirdLogin',
clientId: '0123456789',
evaluationSrc: 'http://192.168.0.53:8088/thirdLogin/thirdLoginPage?username=admin',

View File

@ -58,7 +58,7 @@ router.beforeEach((to, from, next) => {
})
// 失败时,获取用户信息失败时,调用登出,来清空历史保留信息
store.dispatch('Logout').then(() => {
if (process.env.NODE_ENV === 'production') {
if (window._CONFIG.useThirdLogin) {
openThirdLogin()
} else {
next({ path: loginRoutePath, query: { redirect: to.fullPath } })
@ -74,7 +74,7 @@ router.beforeEach((to, from, next) => {
// 在免登录名单,直接进入
next()
} else {
if (process.env.NODE_ENV === 'production') {
if (window._CONFIG.useThirdLogin) {
openThirdLogin()
} else {
next({ path: loginRoutePath, query: { redirect: to.fullPath } })

View File

@ -150,7 +150,7 @@ export const generatorDynamicRouter = (token) => {
// 后端数据, 根级树数组, 根级 PID
listToTree(data, childrenNav, '')
console.log('childrenNav', childrenNav)
if (process.env.NODE_ENV !== 'production') {
if (window._CONFIG.showSystemMenu) {
childrenNav.push(systemNav)
}
const routers = generator(childrenNav)

View File

@ -38,7 +38,7 @@ const errorHandler = (error) => {
if (token) {
store.dispatch('Logout').then(() => {
setTimeout(() => {
if (process.env.NODE_ENV === 'production') {
if (window._CONFIG.useThirdLogin) {
openThirdLogin()
} else {
window.location = '/user/login?redirect=' + window.location.pathname
@ -47,7 +47,7 @@ const errorHandler = (error) => {
})
} else {
setTimeout(() => {
if (process.env.NODE_ENV === 'production') {
if (window._CONFIG.useThirdLogin) {
openThirdLogin()
} else {
window.location = '/user/login?redirect=' + window.location.pathname

View File

@ -129,7 +129,7 @@ export default {
onCancel() {},
})
}
if (process.env.NODE_ENV === 'production') {
if (window._CONFIG.useThirdLogin) {
this.$store.dispatch('Logout').then(() => {
openThirdLogin()
})