fix: 修改配置文件形式
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getConfigJson, getPermission } from '@/utils/api'
|
||||
import { getPermission } from '@/utils/api'
|
||||
import { loadGeoData } from '@/utils/tools'
|
||||
import axios from 'axios'
|
||||
import { storageKey } from '@/utils/constants'
|
||||
@@ -18,8 +18,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
loadGeoData()
|
||||
// 加载baseUrl
|
||||
if (!axios.defaults.baseURL) {
|
||||
const config = await getConfigJson()
|
||||
axios.defaults.baseURL = config.baseUrl
|
||||
axios.defaults.baseURL = BASE_CONFIG.baseUrl
|
||||
}
|
||||
if (localStorage.getItem(storageKey.token)) {
|
||||
// 加载i18n
|
||||
|
||||
@@ -194,15 +194,6 @@ export async function getData (url, params = {}, isQueryList) {
|
||||
return await request
|
||||
}
|
||||
|
||||
export async function getConfigJson () {
|
||||
const request = new Promise(resolve => {
|
||||
get(`${process.env.BASE_URL}config.json?Timestamp=${new Date().getTime()}`).then(config => {
|
||||
resolve(config)
|
||||
})
|
||||
})
|
||||
return await request
|
||||
}
|
||||
|
||||
export async function getPermission () {
|
||||
const request = new Promise(resolve => {
|
||||
post(api.permission, { token: localStorage.getItem(storageKey.token) }).then(response => {
|
||||
|
||||
Reference in New Issue
Block a user