diff --git a/src/renderer/index.html b/src/renderer/index.html index 1de810c..32958a9 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -8,7 +8,7 @@ http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:" /> --> - + diff --git a/src/renderer/src/api/file/img.js b/src/renderer/src/api/file/img.js new file mode 100644 index 0000000..6d833e9 --- /dev/null +++ b/src/renderer/src/api/file/img.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +// 新增图片存eos +export function saveUploadFile(data) { + return request({ + url: '/education/uploadfile/saveUploadFile', + method: 'post', + headers: { + 'Content-Type': 'multipart/form-data' + }, + data: data + }) +} + +// 新增批量图片存eos +export function saveUploadFiles(data) { + return request({ + url: '/education/uploadfile/saveUploadFiles', + method: 'post', + headers: { + 'Content-Type': 'multipart/form-data' + }, + data: data + }) +} + +// 修改basecomment +export function updateUploadFile(data) { + return request({ + url: '/education/uploadfile', + method: 'put', + data: data + }) +} + +// 删除basecomment +export function delUploadFile(id) { + return request({ + url: '/education/uploadfile/' + id, + method: 'delete' + }) +} \ No newline at end of file diff --git a/src/renderer/src/assets/images/borderstyle.png b/src/renderer/src/assets/images/borderstyle.png new file mode 100644 index 0000000..3ac9a18 Binary files /dev/null and b/src/renderer/src/assets/images/borderstyle.png differ diff --git a/src/renderer/src/assets/images/borderwidth.png b/src/renderer/src/assets/images/borderwidth.png new file mode 100644 index 0000000..e071630 Binary files /dev/null and b/src/renderer/src/assets/images/borderwidth.png differ diff --git a/src/renderer/src/assets/images/mouse-pointer.png b/src/renderer/src/assets/images/mouse-pointer.png new file mode 100644 index 0000000..6098aae Binary files /dev/null and b/src/renderer/src/assets/images/mouse-pointer.png differ diff --git a/src/renderer/src/components/tinymce/tinymce.vue b/src/renderer/src/components/tinymce/tinymce.vue index 30b84ca..4c74536 100644 --- a/src/renderer/src/components/tinymce/tinymce.vue +++ b/src/renderer/src/components/tinymce/tinymce.vue @@ -46,7 +46,8 @@ import "tinymce/plugins/anchor"; //锚点 import { ref, reactive, defineProps, defineEmits, nextTick, onMounted, computed, watch } from 'vue' import { getStaticUrl } from '@/utils/tool' -//import { listUploadfile, getUploadFile, delUploadFile, addUploadFile, saveUploadFile } from "@/api/comm/uploadfile"; +import useUserStore from '@/store/modules/user' +import { saveUploadFile } from "@/api/file/img"; const emits = defineEmits(["update:modelValue", "setHtml"]); //这里我选择将数据定义在props里面,方便在不同的页面也可以配置出不同的编辑器,当然也可以直接在组件中直接定义 @@ -107,6 +108,8 @@ const props = defineProps({ default: () => ({ userId: 0, fileAlias: '单题上传' }), }, }); + +const userStore = useUserStore().user; const pasteImgName = ref(''); const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传的图片服务器地址 @@ -212,29 +215,31 @@ const init = reactive({ // 插入/编辑图片(普通) - 因此处上传可传图片和文件故仅参考, 实际以[images_upload_handler]这个为准 file_picker_callback: function(callback, value, meta) { + return; + //文件分类 - let filetype='.pdf, .txt, .zip, .rar, .7z, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .mp3, .mp4'; - let upURL = '/common/upload'; - //为不同插件指定文件类型及后端地址 - switch(meta.filetype){ - case 'image': - filetype='.jpg, .jpeg, .png, .gif'; - //upURL='upimg.php'; - break; - case 'media': - filetype='.mp3, .mp4'; - //upURL='upfile.php'; - break; - case 'file': - default: - } + // let filetype='.pdf, .txt, .zip, .rar, .7z, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .mp3, .mp4'; + // let upURL = '/common/upload'; + // //为不同插件指定文件类型及后端地址 + // switch(meta.filetype){ + // case 'image': + // filetype='.jpg, .jpeg, .png, .gif'; + // //upURL='upimg.php'; + // break; + // case 'media': + // filetype='.mp3, .mp4'; + // //upURL='upfile.php'; + // break; + // case 'file': + // default: + // } - // 模拟出一个input用于添加本地文件 - let input = document.createElement('input'); - input.setAttribute('type', 'file'); - input.setAttribute('accept', filetype); + // // 模拟出一个input用于添加本地文件 + // let input = document.createElement('input'); + // input.setAttribute('type', 'file'); + // input.setAttribute('accept', filetype); - // 暂时屏蔽 + // // 暂时屏蔽 // input.onchange = function() { // const file = this.files[0]; // const formData = new FormData(); @@ -250,7 +255,7 @@ const init = reactive({ // }); // }; - input.click(); + // input.click(); }, // 插入/编辑图片(上传) @@ -278,22 +283,25 @@ const init = reactive({ formData.append("entpcourseid", 0); formData.append("filetype", "image"); formData.append("suffix", "image"); - formData.append("status", '0'); - if(props.upFileParams?.hasOwnProperty('deptId')){ - formData.append("entpid", props.upFileParams.deptId); + formData.append("status", '1'); + if(userStore.deptId && userStore.deptId != null){ + formData.append("entpid", userStore.deptId); } - if(props.upFileParams?.hasOwnProperty('userId')){ - formData.append("userid", props.upFileParams.userId); + if(userStore.userId && userStore.userId != null){ + formData.append("userid", userStore.userId); } - if(props.upFileParams?.hasOwnProperty('edudegree')){ - let edudegree = props.upFileParams.edudegree.toString(); + if(userStore.edudegree && userStore.edudegree != null){ + let edudegree = userStore.edudegree.toString(); if(edudegree != '' && edudegree.indexOf('年级') == -1){ edudegree += '年级'; } formData.append("edudegree", edudegree); } - if(props.upFileParams?.hasOwnProperty('edusubject')){ - formData.append("edusubject", props.upFileParams.edusubject); + if(userStore.edusubject && userStore.edusubject != null){ + formData.append("edusubject", userStore.edusubject); + } + if(userStore.edustage && userStore.edustage != null){ + formData.append("edustage", userStore.edustage); } if(props.upFileParams?.hasOwnProperty('lessionId')){ formData.append("evalid", props.upFileParams.lessionId); @@ -301,19 +309,22 @@ const init = reactive({ if(props.upFileParams?.hasOwnProperty('fileAlias')){ formData.append("filegroup", props.upFileParams.fileAlias); } + loading.value = true; + console.log('formData->', formData); // 暂时屏蔽 - // saveUploadFile(formData) - // .then((res) => { - // loading.value = false; - // return resolve(res.fileurl); - // }) - // .catch((err) => { - // loading.value = false; - // return reject('err:' + err); - // }); + saveUploadFile(formData) + .then((res) => { + console.log('res->', res); + loading.value = false; + return resolve(res.fileurl); + }) + .catch((err) => { + loading.value = false; + return reject('err:' + err); + }); } ), diff --git a/src/renderer/src/components/whiteboard/whiteboard.vue b/src/renderer/src/components/whiteboard/whiteboard.vue index 53fb108..0ec6a25 100644 --- a/src/renderer/src/components/whiteboard/whiteboard.vue +++ b/src/renderer/src/components/whiteboard/whiteboard.vue @@ -1,5 +1,5 @@ @@ -122,7 +123,7 @@
-