refactor(biji-qianduan): 使用环境变量配置 API基础 URL
- 移除硬编码的 IP 地址和端口号 - 从环境变量 VITE_API_BASE_URL 获取 API基础 URL - 更新图片上传成功后的 URL 拼接逻辑
This commit is contained in:
@@ -595,10 +595,10 @@ const handleImageUpload=async (files) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const url = promise.data.url;
|
const url = promise.data.url;
|
||||||
// 修正IP地址并正确拼接
|
// 从环境变量获取 baseURL,并与后端返回的 URL 路径拼接
|
||||||
const baseUrl = "http://127.0.0.1:8084";
|
const fullUrl = `${import.meta.env.VITE_API_BASE_URL}${url}`;
|
||||||
imageUrls.value.push(baseUrl + url);
|
imageUrls.value.push(fullUrl);
|
||||||
vditor.value.insertValue(`![${files[0].name}](${baseUrl + url})`);
|
vditor.value.insertValue(`![${files[0].name}](${fullUrl})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const debouncedSave = (value) => {
|
const debouncedSave = (value) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user