diff --git a/app/admin/view/resources/add.php b/app/admin/view/resources/add.php index 45f05fa..09b8b5d 100644 --- a/app/admin/view/resources/add.php +++ b/app/admin/view/resources/add.php @@ -426,8 +426,15 @@ customInsert(res, insertFn) { // res 即服务端的返回结果 if (res.code === 0 && res.data) { - // 使用完整的URL - const imageUrl = res.url || res.data; + // 处理URL格式 + let imageUrl = res.url || res.data; + // 确保URL以http开头 + if (!imageUrl.startsWith('http')) { + imageUrl = '{$config["admin_domain"]}' + imageUrl; + } + // 移除多余的域名部分 + imageUrl = imageUrl.replace('{$config["admin_domain"]}/{$config["admin_domain"]}', '{$config["admin_domain"]}'); + if (imageUrl) { insertFn(imageUrl); } else { diff --git a/app/admin/view/resources/edit.php b/app/admin/view/resources/edit.php index 474406d..674f783 100644 --- a/app/admin/view/resources/edit.php +++ b/app/admin/view/resources/edit.php @@ -444,8 +444,15 @@ customInsert(res, insertFn) { // res 即服务端的返回结果 if (res.code === 0 && res.data) { - // 使用完整的URL - const imageUrl = res.url || res.data; + // 处理URL格式 + let imageUrl = res.url || res.data; + // 确保URL以http开头 + if (!imageUrl.startsWith('http')) { + imageUrl = '{$config["admin_domain"]}' + imageUrl; + } + // 移除多余的域名部分 + imageUrl = imageUrl.replace('{$config["admin_domain"]}/{$config["admin_domain"]}', '{$config["admin_domain"]}'); + if (imageUrl) { insertFn(imageUrl); } else {