配置文件
This commit is contained in:
11253
package-lock.json
generated
11253
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
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 { useUserStoreWidthOut } from '@/store/modules/user';
|
||||||
import {domainStoreWidthOut} from "@/store/modules/domain";
|
import {domainStoreWidthOut} from "@/store/modules/domain";
|
||||||
|
import { getConfig } from '@/config';
|
||||||
|
|
||||||
const urlPrefix = '';
|
const urlPrefix = '';
|
||||||
|
const tenantConfig = getConfig();
|
||||||
|
|
||||||
// import router from '@/router';
|
// import router from '@/router';
|
||||||
// import { storage } from '@/utils/Storage';
|
// import { storage } from '@/utils/Storage';
|
||||||
@@ -198,6 +200,7 @@ const transform: AxiosTransform = {
|
|||||||
const token = userStore.getToken;
|
const token = userStore.getToken;
|
||||||
headers.TYPE = 'TBS'
|
headers.TYPE = 'TBS'
|
||||||
headers.channelId = 'MP'
|
headers.channelId = 'MP'
|
||||||
|
headers['Tenant-ID'] = tenantConfig.tenantId
|
||||||
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
|
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
|
||||||
// jwt token
|
// jwt token
|
||||||
headers.Authorization = options.authenticationScheme
|
headers.Authorization = options.authenticationScheme
|
||||||
@@ -278,8 +281,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
|
|||||||
// 消息提示类型
|
// 消息提示类型
|
||||||
errorMessageMode: 'none',
|
errorMessageMode: 'none',
|
||||||
// 接口地址
|
// 接口地址
|
||||||
// apiUrl: 'https://fhusdbs.vbg2c.top',
|
apiUrl: tenantConfig.apiUrl,
|
||||||
apiUrl: '',
|
|
||||||
// apiUrl: '',
|
// apiUrl: '',
|
||||||
// 接口拼接地址
|
// 接口拼接地址
|
||||||
urlPrefix: urlPrefix,
|
urlPrefix: urlPrefix,
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ export default defineConfig({
|
|||||||
port: 9528,
|
port: 9528,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: ' http://dk.qiqizl.com',
|
target: 'http://124.222.254.188/',
|
||||||
|
// target: ' http://dk.qiqizl.com',
|
||||||
// target: 'http://localhost:8082',
|
// target: 'http://localhost:8082',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
ws: true,
|
ws: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user