zhangchong 5 сар өмнө
parent
commit
a9220ff0df

+ 8 - 0
public/config.json

@@ -0,0 +1,8 @@
+{
+  "baseUrl": "http://110.188.24.28:50300",
+  "socketUrl": "http://110.188.24.28:50300/hubs/hotline",
+  "uploadUlr": "http://110.188.24.28:50120",
+  "dataShareUrl": "http://110.188.24.28:50105",
+  "voiceAssistantUrl": "http://118.121.59.30:19081",
+  "smartSocketUrl": "ws://118.121.59.30:19005"
+}

+ 4 - 3
src/utils/request.ts

@@ -2,6 +2,7 @@ import axios, { AxiosInstance, AxiosResponse, AxiosError, AxiosRequestConfig } f
 import { ElMessage, ElMessageBox, ElLoading, LoadingOptionsResolved } from 'element-plus';
 import { Session, Local, Cookie } from '@/utils/storage';
 import router from '@/router/index';
+import { baseUrl } from '/public/config.json';
 // 重复请求队列
 const pendingMap = new Map();
 // 全局loading
@@ -17,9 +18,9 @@ type customOptionsType = {
 	code_message_show?: boolean; // 是否开启code不为0时的信息提示, 默认为false
 };
 export default function myAxios(axiosConfig: any, customOptions?: customOptionsType, loadingOptions?: LoadingOptionsResolved) {
-	// 配置新建一个 axios 实例
+	// 配置新建一个 axios 实例 import.meta.env.VITE_API_URL
 	const service: AxiosInstance = axios.create({
-		baseURL: import.meta.env.VITE_API_URL,
+		baseURL: baseUrl,
 		timeout: 60000,
 		headers: { 'Content-Type': 'application/json' },
 	});
@@ -177,7 +178,7 @@ function httpErrorStatusHandle(error: any) {
 		ElMessage({
 			type: 'error',
 			message,
-			grouping:true
+			grouping: true,
 		});
 	}
 }