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/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/views/classTask/newClassTaskAssign/myQuestion/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue
index 4661abe..1c1ff42 100644
--- a/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue
+++ b/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue
@@ -1,5 +1,5 @@
-