提交 83fd1d9b authored 作者: 王鹏飞's avatar 王鹏飞

chore: 修改登录页面的地址

上级 0aca6d0c
......@@ -13,6 +13,7 @@ export default [
logoStyle: 'height:64px;',
headerStyle: 'background:#fff;',
favicon: 'https://webapp-pub.ezijing.com/project_online/fdc/favico.svg',
hosts: ['fd-admin', 'fd-admin2', 'fdc-admin', 'fdc-admin2']
hosts: ['fd-admin', 'fd-admin2', 'fdc-admin', 'fdc-admin2'],
loginUrl: 'https://fdc.ezijing.com/home/index?index=2'
}
]
......@@ -55,7 +55,7 @@ export default {
methods: {
logout() {
this.$store.dispatch('logout').then(() => {
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(window.location.href)}`
window.location.href = `${this.$store.getters.loginUrl}&rd=${encodeURIComponent(window.location.href)}`
})
}
}
......
......@@ -13,6 +13,11 @@ const store = new Vuex.Store({
appConfig: {},
appConfigList
},
getters: {
loginUrl(state) {
return state.appConfig?.loginUrl || `${import.meta.env.VITE_LOGIN_URL}?`
}
},
mutations: {
setUser(state, user) {
state.user = user
......@@ -83,7 +88,7 @@ const store = new Vuex.Store({
localAppConfig = null
}
}
const appConfig = found || localAppConfig || appConfigList[0]
const appConfig = found || localAppConfig || appConfigList[1]
commit('setAppConfig', appConfig)
}
}
......
......@@ -64,7 +64,7 @@ httpRequest.interceptors.response.use(
}
// 未登录
if (status === 403) {
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(window.location.href)}`
window.location.href = `${store.getters.loginUrl}&rd=${encodeURIComponent(window.location.href)}`
} else {
Message.error(message || error.response.data)
}
......
......@@ -27,7 +27,7 @@ export default async function (to, from, next) {
}
const isLogin = store.state.user.id || (await store.dispatch('checkLogin'))
if (!isLogin) {
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(window.location.href)}`
window.location.href = `${store.getters.loginUrl}&rd=${encodeURIComponent(window.location.href)}`
return
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论