配置文件

This commit is contained in:
John
2024-05-20 00:13:22 +08:00
parent 28a70dc261
commit 956e402ad3
5 changed files with 10010 additions and 5399 deletions

15355
package-lock.json generated

File diff suppressed because it is too large Load Diff

6
src/config/000000.ts Normal file
View 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
View 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'
// }
// }

View File

@@ -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,

View File

@@ -38,7 +38,8 @@ export default defineConfig({
port: 9528,
proxy: {
'/api': {
target: ' http://dk.qiqizl.com',
target: 'http://124.222.254.188/',
// target: ' http://dk.qiqizl.com',
// target: 'http://localhost:8082',
changeOrigin: true,
ws: true,