更新代码
This commit is contained in:
parent
9020637078
commit
743c73044e
@ -424,22 +424,9 @@
|
||||
console.error('上传出错', file, err, res)
|
||||
},
|
||||
customInsert(res, insertFn) {
|
||||
// res 即服务端的返回结果
|
||||
if (res.code === 0 && res.data) {
|
||||
// 处理URL格式
|
||||
let imageUrl = res.url || res.data;
|
||||
// 确保URL以http开头
|
||||
if (!imageUrl.startsWith('http')) {
|
||||
// 移除开头的斜杠,避免重复
|
||||
imageUrl = imageUrl.replace(/^\//, '');
|
||||
imageUrl = '{$config["admin_domain"]}/' + imageUrl;
|
||||
}
|
||||
|
||||
if (imageUrl) {
|
||||
insertFn(imageUrl);
|
||||
} else {
|
||||
layer.msg('图片地址无效', { icon: 2 });
|
||||
}
|
||||
// 只使用返回的url字段
|
||||
if (res.code === 0 && res.url) {
|
||||
insertFn(res.url);
|
||||
} else {
|
||||
layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 });
|
||||
}
|
||||
|
||||
@ -442,22 +442,9 @@
|
||||
console.error('上传出错', file, err, res)
|
||||
},
|
||||
customInsert(res, insertFn) {
|
||||
// res 即服务端的返回结果
|
||||
if (res.code === 0 && res.data) {
|
||||
// 处理URL格式
|
||||
let imageUrl = res.url || res.data;
|
||||
// 确保URL以http开头
|
||||
if (!imageUrl.startsWith('http')) {
|
||||
// 移除开头的斜杠,避免重复
|
||||
imageUrl = imageUrl.replace(/^\//, '');
|
||||
imageUrl = '{$config["admin_domain"]}/' + imageUrl;
|
||||
}
|
||||
|
||||
if (imageUrl) {
|
||||
insertFn(imageUrl);
|
||||
} else {
|
||||
layer.msg('图片地址无效', { icon: 2 });
|
||||
}
|
||||
// 只使用返回的url字段
|
||||
if (res.code === 0 && res.url) {
|
||||
insertFn(res.url);
|
||||
} else {
|
||||
layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 });
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user