From ea625f98f36cc7c79d2a4179ae61487fcb92cc35 Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Sat, 26 Oct 2024 21:15:58 +0800 Subject: [PATCH] =?UTF-8?q?fix=20:=20=E4=BF=AE=E5=A4=8Dtinymce=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E7=9A=84=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?loading=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Tinymce.vue | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/Tinymce.vue b/src/components/Tinymce.vue index f8c26d4..b62b204 100644 --- a/src/components/Tinymce.vue +++ b/src/components/Tinymce.vue @@ -8,7 +8,7 @@ import tinymce from 'tinymce' import Editor from "@tinymce/tinymce-vue"; import {defineProps} from "vue"; -import {ElMessage, ElNotification} from "element-plus"; +import {ElLoading, ElMessage, ElNotification} from "element-plus"; import {getToken} from '@/utils/auth' import axios from "axios"; @@ -121,6 +121,12 @@ const init = reactive({ // }), }, file_picker_callback: (callback, value, meta) => { + console.info("🚀 ~method:uploadFile -----") + let loading= ElLoading.service({ + lock: true, + text: '文件上传中...', + background: 'rgba(0, 0, 0, 0.7)', + }) // 使用案例http://tinymce.ax-z.cn/general/upload-images.php // meta.filetype //根据这个判断点击的是什么file image media let filetype; //限制文件的上传类型,需要什么就添加什么的后缀 @@ -158,6 +164,7 @@ const init = reactive({ message: res.code === 1000 ? '上传成功' : '上传失败', type: res.code === 1000 ? 'success' : 'error' }) + loading.close() const fileUrl = res.data.url; callback(fileUrl, { title: file.name }); }; @@ -187,6 +194,11 @@ watch(() => { emit("update:value", content.value); }); const uploadFile = (formData, url,success) => { + let loading= ElLoading.service({ + lock: true, + text: '图片上传中...', + background: 'rgba(0, 0, 0, 0.7)', + }) axios.post( import.meta.env.VITE_BASE_URL + url, formData, @@ -203,8 +215,10 @@ const uploadFile = (formData, url,success) => { let data = res.data if (data.code !== 1000) { ElMessage.error(data.msg) + loading.close() }else { success(data.data.url) + loading.close() } }) }