修复代码
This commit is contained in:
parent
984f839cd8
commit
e89e0fa83d
@ -426,10 +426,15 @@
|
|||||||
customInsert(res, insertFn) {
|
customInsert(res, insertFn) {
|
||||||
// res 即服务端的返回结果
|
// res 即服务端的返回结果
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
// 直接使用res.data作为图片地址
|
// 使用完整的URL
|
||||||
insertFn(res.data);
|
const imageUrl = res.url || res.data;
|
||||||
|
if (imageUrl) {
|
||||||
|
insertFn(imageUrl);
|
||||||
} else {
|
} else {
|
||||||
layer.msg('图片上传失败', { icon: 2 });
|
layer.msg('图片地址无效', { icon: 2 });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -444,15 +444,15 @@
|
|||||||
customInsert(res, insertFn) {
|
customInsert(res, insertFn) {
|
||||||
// res 即服务端的返回结果
|
// res 即服务端的返回结果
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
// 从res.data中获取src字段
|
// 使用完整的URL
|
||||||
const url = String(res.data.src || '');
|
const imageUrl = res.url || res.data;
|
||||||
if (url) {
|
if (imageUrl) {
|
||||||
insertFn(url);
|
insertFn(imageUrl);
|
||||||
} else {
|
} else {
|
||||||
layer.msg('图片地址无效', { icon: 2 });
|
layer.msg('图片地址无效', { icon: 2 });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
layer.msg('图片上传失败', { icon: 2 });
|
layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user