From 90ed1f142d7f7f63cdeca141000a22cf466c5322 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 11 Jul 2023 17:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E4=BA=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/setting.js | 2 +- src/utils/editor.js | 38 +- src/views/match/add/set.vue | 474 ++++++++++--------- src/views/match/add/step3.vue | 590 +++++++++++++----------- src/views/shop/addProduct/index.vue | 4 +- src/views/system/manageLog - 副本.vue | 336 ++++++++++++++ 6 files changed, 937 insertions(+), 507 deletions(-) create mode 100644 src/views/system/manageLog - 副本.vue diff --git a/src/setting.js b/src/setting.js index a2f3080..c2c38d1 100644 --- a/src/setting.js +++ b/src/setting.js @@ -10,7 +10,7 @@ let host = `${location.origin}/` if (isDev) { jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统 host = 'http://121.37.12.51/' - // host = 'https://huorantech.cn/' + host = 'https://huorantech.cn/' // host = 'http://192.168.31.152:9000/'// 榕 // host = 'http://192.168.31.51:9000/'// 赓 } else if (isPro) { diff --git a/src/utils/editor.js b/src/utils/editor.js index f810084..07eae7c 100644 --- a/src/utils/editor.js +++ b/src/utils/editor.js @@ -315,10 +315,46 @@ export default { powerpaste_allow_local_images: true, powerpaste_word_import: 'clean', powerpaste_html_import: 'clean', + extraPlugins: 'uploadimage', + imageUploadUrl: Api.fileUploadNakadai, + init_instance_callback: function (editor) { + editor.on('paste', (evt) => { + // 监听粘贴事件 + // 实现图片粘贴上传 + const items = (evt.clipboardData || window.clipboardData).items + if (items[0].type.indexOf('image') !== -1) { + const file = items[0].getAsFile() + const form = new FormData() + form.append('file', file) + // 自定义上传图片的方法 + Axios({ + method: 'post', + url: Api.fileUploadNakadai, + data: form, + headers: { + 'Content-Type': 'multipart/form-data', + token: Util.local.get(Setting.tokenKey) + }, + }).then(({ data }) => { + // 使用指令,在当前鼠标标光的位置插入元素 + // img元素的src就是远程图片的链接地址 + editor.execCommand( + "mceReplaceContent", + true, + `` + ); + }).catch(res => {}) + // 阻止默认事件,防止粘贴的图片进入富文本编辑器中 + evt.preventDefault(); + } else { + console.log('粘贴的不是图片,不能上传') + } + }) + }, // 自定义上传 images_upload_handler: function (blobInfo, succFun, failFun) { const form = new FormData() - form.append('file', blobInfo.blob()), + form.append('file', blobInfo.blob()) Axios({ method: 'post', url: Api.fileUploadNakadai, diff --git a/src/views/match/add/set.vue b/src/views/match/add/set.vue index 4c79830..c3cf8ac 100644 --- a/src/views/match/add/set.vue +++ b/src/views/match/add/set.vue @@ -1,256 +1,278 @@ \ No newline at end of file diff --git a/src/views/match/add/step3.vue b/src/views/match/add/step3.vue index b2032e4..989d7bd 100644 --- a/src/views/match/add/step3.vue +++ b/src/views/match/add/step3.vue @@ -1,319 +1,355 @@ \ No newline at end of file diff --git a/src/views/shop/addProduct/index.vue b/src/views/shop/addProduct/index.vue index 006dbdd..b8f6331 100644 --- a/src/views/shop/addProduct/index.vue +++ b/src/views/shop/addProduct/index.vue @@ -37,8 +37,8 @@ - - + diff --git a/src/views/system/manageLog - 副本.vue b/src/views/system/manageLog - 副本.vue new file mode 100644 index 0000000..6282b69 --- /dev/null +++ b/src/views/system/manageLog - 副本.vue @@ -0,0 +1,336 @@ + + + + \ No newline at end of file