请求服务器域名调整
This commit is contained in:
parent
e3da721faf
commit
068e0df43c
27
src/App.vue
27
src/App.vue
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view />
|
||||
<router-view v-if="$store.state.user.baseUrl" />
|
||||
<deomon-topic ref="deomonTopic" />
|
||||
<img v-show="loading" :src="loadingImg" class="AppAll">
|
||||
</div>
|
||||
@ -15,6 +15,7 @@ import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||
import LoadingImg from '@/assets/loading.gif';
|
||||
import { openIndexedDB } from '@/utils/indexedDb';
|
||||
import { getBaseUrlByProject } from '@/api/projectServer';
|
||||
import { localPackageProject } from '@/scripts/ProjectConfig';
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
@ -63,11 +64,25 @@ export default {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const project = getSessionStorage('project');
|
||||
getBaseUrlByProject(ProjectCode[project]).then(resp => {
|
||||
this.$store.dispatch('setBaseUrl', resp.data.domainName);
|
||||
});
|
||||
async created() {
|
||||
let project = '';
|
||||
if (this.$route.query.project && this.$route.path.includes('login')) {
|
||||
project = this.$route.query.project;
|
||||
const split = this.$route.path.split('/')[1];
|
||||
if (process.env.VUE_APP_PRO) {
|
||||
project = localPackageProject[process.env.VUE_APP_PRO + split];
|
||||
} else if (split == 'design') {
|
||||
project = project ? split + project : split;
|
||||
} else if (split == 'login') {
|
||||
project = project || 'login';
|
||||
} else {
|
||||
project = split;
|
||||
}
|
||||
} else {
|
||||
project = getSessionStorage('project');
|
||||
}
|
||||
const resp = await getBaseUrlByProject(ProjectCode[project]);
|
||||
resp && resp.data && this.$store.dispatch('setBaseUrl', resp.data.domainName);
|
||||
if (project) {
|
||||
document.querySelector("link[rel*='icon']").href = loginInfo[project].linkIcon || ProjectIcon[project];
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ const service = axios.create({
|
||||
timeout: 600000 // 请求超时时间
|
||||
});
|
||||
|
||||
// request拦截器
|
||||
// request拦截器108
|
||||
service.interceptors.request.use(config => {
|
||||
if (getToken()) {
|
||||
config.headers['X-Token'] = getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
|
Loading…
Reference in New Issue
Block a user