修复代码

This commit is contained in:
云泽网 2025-05-21 01:03:24 +08:00
parent 984f839cd8
commit e89e0fa83d
2 changed files with 13 additions and 8 deletions

View File

@ -426,10 +426,15 @@
customInsert(res, insertFn) {
// res 即服务端的返回结果
if (res.code === 0 && res.data) {
// 直接使用res.data作为图片地址
insertFn(res.data);
// 使用完整的URL
const imageUrl = res.url || res.data;
if (imageUrl) {
insertFn(imageUrl);
} else {
layer.msg('图片地址无效', { icon: 2 });
}
} else {
layer.msg('图片上传失败', { icon: 2 });
layer.msg('图片上传失败' + (res.msg || '未知错误'), { icon: 2 });
}
}
}

View File

@ -444,15 +444,15 @@
customInsert(res, insertFn) {
// res 即服务端的返回结果
if (res.code === 0 && res.data) {
// 从res.data中获取src字段
const url = String(res.data.src || '');
if (url) {
insertFn(url);
// 使用完整的URL
const imageUrl = res.url || res.data;
if (imageUrl) {
insertFn(imageUrl);
} else {
layer.msg('图片地址无效', { icon: 2 });
}
} else {
layer.msg('图片上传失败', { icon: 2 });
layer.msg('图片上传失败' + (res.msg || '未知错误'), { icon: 2 });
}
}
}