feat:更新白板

This commit is contained in:
leilei
2025-11-11 18:01:59 +08:00
parent 6fbe53009c
commit ca93e91326
7 changed files with 430 additions and 145 deletions

View File

@@ -11,10 +11,27 @@ import router from '@/router';
import { useMeterStore } from '@/stores/modules/meter.js'
axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
// 动态获取 baseURL
const getBaseURL = () => {
// 开发环境使用配置的完整 URL
if (import.meta.env.DEV) {
return import.meta.env.VITE_APP_BASE_API;
}
// 生产环境使用相对路径
// 返回空字符串,让浏览器自动使用当前域名
return '';
// 或者如果后端 API 有固定路径前缀,可以这样设置:
// return '/api'; // 这样请求会变成 https://当前域名/api/xxx
};
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: import.meta.env.VITE_APP_BASE_API,
// baseURL: import.meta.env.VITE_APP_BASE_API,
baseURL: getBaseURL(),
// 超时
// timeout: 10000,
});