|
@@ -1,16 +1,23 @@
|
|
|
import axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios'
|
|
|
import { tansParams } from './common.ts'
|
|
|
// 创建axios实例
|
|
|
+console.log(import.meta.env)
|
|
|
+var url = "https://gateWay.usky.cn/"
|
|
|
+if (typeof window !== 'undefined'){
|
|
|
+ if(window.location.host.indexOf("localhost") > -1 || window.location.host.indexOf("172.16.120.165") >-1){
|
|
|
+ url = "http://172.16.120.165:13200/"
|
|
|
+ }
|
|
|
+ if(window.location.host.indexOf("usky.cn") > -1){
|
|
|
+ url = "https://gateWay.usky.cn/"
|
|
|
+ }
|
|
|
+}
|
|
|
const service: any = axios.create({
|
|
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
|
|
- baseURL: import.meta.env.PROD ? 'http://gateWay.usky.cn/' : "http://172.16.120.165:13200/",
|
|
|
- // baseURL: import.meta.env.PROD ? 'http://gateWay.usky.cn/' : "http://172.16.120.165:13200/",
|
|
|
- // baseURL: import.meta.env.PROD ? 'http://172.16.120.165:13200/' : "http://localhost:5173",
|
|
|
+ baseURL: url,
|
|
|
// 超时
|
|
|
timeout: 300000
|
|
|
})
|
|
|
|
|
|
-
|
|
|
// request拦截器
|
|
|
service.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
|
|
// 是否需要防止数据重复提交
|