跨域处理5.6

main
shilei 6 months ago
parent 0582c89945
commit d962a5c5ab

@ -4,3 +4,5 @@ ENV = development
# 本地环境接口地址
# VITE_API_URL = http://localhost:5005
VITE_API_URL = http://192.168.2.13:5005
VITE_API_URL_TEST= http://192.168.2.21:5034
VITE_API_URL_ALLOCATION= http://192.168.2.:5034

@ -280,8 +280,10 @@ export const SysFaultinfomationApiFp = function(configuration?: Configuration) {
*/
async apiSysPosListGet(body?: faultinfomation, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultListSysPos>>> {
const localVarAxiosArgs = await SysFaultinfomationApiAxiosParamCreator(configuration).apiSysPosListGet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
const base_url_se = window.__env__.VITE_API_URL_ALLOCATION
return (axios: AxiosInstance = globalAxios, basePath: string = base_url_se) => {
// console.log(basePath,'basePath');
const axiosRequestArgs: AxiosRequestConfig = { ...localVarAxiosArgs.options, url: base_url_se + localVarAxiosArgs.url };
return axios.request(axiosRequestArgs);
};
},

@ -61,25 +61,14 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
open: JSON.parse(env.VITE_OPEN),
hmr: true,
proxy: {
// '^/[Uu]pload': {
// target: env.VITE_API_URL,
// changeOrigin: true,
// },
// },
'^/api/BaseStationInfo(.*)':{
target: 'http://192.168.2.15:5034', //
changeOrigin: true, // 改变源
},
'^/api/Disposition(.*)':{
target: 'http://192.168.2.21:5034', //
changeOrigin: true, // 改变源
},
'/api':{
target: 'http://192.168.2.13:5005', // 登录
changeOrigin: true, // 改变源
'^/[Uu]pload': {
target: env.VITE_API_URL,
changeOrigin: true,
},
// '/Disposition': {
// target: 'http://192.168.2.21:5034', // 登录
// changeOrigin: true, // 改变源
// },
},
},

Loading…
Cancel
Save