修复代码
This commit is contained in:
parent
984f839cd8
commit
e89e0fa83d
@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user