refactor(biji): 调整数据库连接路径并优化图片上传逻辑
- 修改数据库连接路径,将 mydatabase.db 从 C:\it\houtaigunli\biji\ 移到 C:\KAIFA\2\ - 优化图片上传逻辑: - 修改错误处理条件,从 promise.code !==200 改为 promise.url == null - 调整 URL 获取方式,从 promise.data.url 改为 promise.url
This commit is contained in:
@@ -590,11 +590,11 @@ const editNote = async (file) => {
|
|||||||
// 图片上传
|
// 图片上传
|
||||||
const handleImageUpload=async (files) => {
|
const handleImageUpload=async (files) => {
|
||||||
const promise = await uploadImage(files[0]);
|
const promise = await uploadImage(files[0]);
|
||||||
if (promise.code !== 200) {
|
if (promise.url == null) {
|
||||||
ElMessage.error(promise.msg);
|
ElMessage.error(promise.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const url = promise.data.url;
|
const url = promise.url;
|
||||||
// 从环境变量获取 baseURL,并与后端返回的 URL 路径拼接
|
// 从环境变量获取 baseURL,并与后端返回的 URL 路径拼接
|
||||||
const fullUrl = `${import.meta.env.VITE_API_BASE_URL}${url}`;
|
const fullUrl = `${import.meta.env.VITE_API_BASE_URL}${url}`;
|
||||||
imageUrls.value.push(fullUrl);
|
imageUrls.value.push(fullUrl);
|
||||||
|
|||||||
BIN
mydatabase.db
BIN
mydatabase.db
Binary file not shown.
Reference in New Issue
Block a user