配置文件
This commit is contained in:
6
src/config/000000.ts
Normal file
6
src/config/000000.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Config } from '@/config/index';
|
||||
|
||||
export const config: Config = {
|
||||
tenantId: '000000',
|
||||
apiUrl: 'http://124.222.254.188:8889/'
|
||||
}
|
||||
39
src/config/index.ts
Normal file
39
src/config/index.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
export type Config = {
|
||||
tenantId: string;
|
||||
apiUrl: string;
|
||||
}
|
||||
|
||||
export const getConfig = (): Config => {
|
||||
return t_000000
|
||||
}
|
||||
|
||||
// 配置文件
|
||||
const t_000000: Config = {
|
||||
tenantId: '000000',
|
||||
apiUrl: 'http://124.222.254.188:8889/'
|
||||
}
|
||||
|
||||
|
||||
// export const getConfig = (tenantId: string): Config => {
|
||||
//
|
||||
// // TODO: 读取配置文件
|
||||
// const config = import(`${tenantId}.ts`)
|
||||
//
|
||||
// console.log('res ======222222222222=========> ')
|
||||
// console.log(config)
|
||||
// console.log(config)
|
||||
// if (!config) {
|
||||
//
|
||||
// }
|
||||
// config.then((res) => {
|
||||
//
|
||||
// console.log('res ======222222222222=========> ')
|
||||
// console.log(res)
|
||||
// console.log(res)
|
||||
// })
|
||||
//
|
||||
//
|
||||
// return {
|
||||
// tenantId: '000000'
|
||||
// }
|
||||
// }
|
||||
@@ -15,8 +15,10 @@ import { RequestOptions, Result, CreateAxiosOptions } from './types';
|
||||
|
||||
import { useUserStoreWidthOut } from '@/store/modules/user';
|
||||
import {domainStoreWidthOut} from "@/store/modules/domain";
|
||||
import { getConfig } from '@/config';
|
||||
|
||||
const urlPrefix = '';
|
||||
const tenantConfig = getConfig();
|
||||
|
||||
// import router from '@/router';
|
||||
// import { storage } from '@/utils/Storage';
|
||||
@@ -198,6 +200,7 @@ const transform: AxiosTransform = {
|
||||
const token = userStore.getToken;
|
||||
headers.TYPE = 'TBS'
|
||||
headers.channelId = 'MP'
|
||||
headers['Tenant-ID'] = tenantConfig.tenantId
|
||||
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
|
||||
// jwt token
|
||||
headers.Authorization = options.authenticationScheme
|
||||
@@ -278,8 +281,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
|
||||
// 消息提示类型
|
||||
errorMessageMode: 'none',
|
||||
// 接口地址
|
||||
// apiUrl: 'https://fhusdbs.vbg2c.top',
|
||||
apiUrl: '',
|
||||
apiUrl: tenantConfig.apiUrl,
|
||||
// apiUrl: '',
|
||||
// 接口拼接地址
|
||||
urlPrefix: urlPrefix,
|
||||
|
||||
Reference in New Issue
Block a user