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