Merge pull request 'fix : 修复tinymce编辑器的图片上传loading提示' (#883) from dj into master
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/883
This commit is contained in:
@@ -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()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user