From 2d6e5aabbd92b557536bb3d959060606c86055d9 Mon Sep 17 00:00:00 2001 From: wolfcode Date: Wed, 16 Jul 2025 14:06:37 +0800 Subject: [PATCH] feat(easy-admin): add upload functionality for images and videos - Add uploadImage and uploadVideo configurations to the editor - Implement customInsert function for handling image and video uploads - Display error messages for failed uploads - Use layer.msg for showing upload success or failure messages --- public/static/plugs/easy-admin/easy-admin.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/public/static/plugs/easy-admin/easy-admin.js b/public/static/plugs/easy-admin/easy-admin.js index e937097..1e355d5 100644 --- a/public/static/plugs/easy-admin/easy-admin.js +++ b/public/static/plugs/easy-admin/easy-admin.js @@ -1668,6 +1668,7 @@ define(["jquery", "tableSelect", "miniTheme", "xmSelect", "lazyload"], function html: $(this).text(), config: { MENU_CONF: { + // 上传图片 uploadImage: { server: window.CONFIG.ADMIN_UPLOAD_URL, fieldName: 'file', @@ -1685,6 +1686,23 @@ define(["jquery", "tableSelect", "miniTheme", "xmSelect", "lazyload"], function let href = '' insertFn(url, alt, href) } + }, + // 上传视频 + uploadVideo: { + server: window.CONFIG.ADMIN_UPLOAD_URL, + fieldName: 'file', + meta: {editor: 'editor',}, + async customInsert(res, insertFn) { + let code = res.code || 0 + if (code != '1') { + layer.msg(res.msg || '上传失败', {icon: 2}); + return + } + let url = res.data?.url || '' + let alt = '' + let href = '' + insertFn(url, alt, href) + } } }, }