Compare commits
2 Commits
d25f2521a6
...
cbf2c29bb4
Author | SHA1 | Date |
---|---|---|
白了个白 | cbf2c29bb4 | |
“zouyf” | 2511a6cc32 |
|
@ -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'
|
||||
})
|
||||
}
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
),
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
|
||||
|
|
|
@ -67,18 +67,13 @@
|
|||
<div class="questForm-item-cover">
|
||||
<el-form-item :label="questForm.worktype == '复合题' ? '背景材料' : questForm.worktype == '主观题' ? '背景资料' : '题目'" prop="title">
|
||||
<Tinymce v-model="questForm.title" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}"
|
||||
/>
|
||||
</el-form-item>
|
||||
<div class="item-cropper-btn">
|
||||
<!-- <el-button v-show="isCropper" circle icon="Search" @click="cropperFormItem('title')"></el-button> -->
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('title')">识别</el-button>
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('title')"><el-icon><Search /></el-icon></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -88,10 +83,6 @@
|
|||
<el-form-item :label=Options(1,index) :prop="`list.${index}.text`"
|
||||
:rules="{required: true, message: '选项不能为空', trigger: 'blur'}">
|
||||
<Tinymce v-model="item.text" :minHeight="150" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}" />
|
||||
|
@ -107,8 +98,7 @@
|
|||
</el-form-item>
|
||||
</div>
|
||||
<div class="item-cropper-btn">
|
||||
<!-- <el-button v-show="isCropper" circle icon="Search" @click="cropperFormItem('workdesc')"></el-button> -->
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('workdesc')">识别</el-button>
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('workdesc')"><el-icon><Search /></el-icon></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -124,10 +114,6 @@
|
|||
v-model="item.text"
|
||||
:minHeight="150"
|
||||
:upFileParams = "{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}" />
|
||||
|
@ -143,8 +129,7 @@
|
|||
</el-form-item>
|
||||
</div>
|
||||
<div class="item-cropper-btn">
|
||||
<!-- <el-button v-show="isCropper" circle icon="Search" @click="cropperFormItem('workdesc')"></el-button> -->
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('workdesc')">识别</el-button>
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('workdesc')"><el-icon><Search /></el-icon></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -154,10 +139,6 @@
|
|||
<el-form-item :label=Options(3,index) :prop="`list.${index}.text`"
|
||||
:rules="{required: true, message: '填空选项不能为空', trigger: 'blur'}">
|
||||
<Tinymce v-model="item.text" :minHeight="150" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}" />
|
||||
|
@ -172,8 +153,7 @@
|
|||
</el-form-item>
|
||||
</div>
|
||||
<div class="item-cropper-btn">
|
||||
<!-- <el-button v-show="isCropper" circle icon="Search" @click="cropperFormItem('workdesc')"></el-button> -->
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('workdesc')">识别</el-button>
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('workdesc')"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -200,17 +180,12 @@
|
|||
<div v-if="questForm.worktype.indexOf('主观题') != -1" class="questForm-item-cover">
|
||||
<el-form-item label="答案">
|
||||
<Tinymce v-model="questForm.workanswer" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}" />
|
||||
</el-form-item>
|
||||
<div class="item-cropper-btn">
|
||||
<!-- <el-button v-show="isCropper" circle icon="Search" @click="cropperFormItem('workanswer')"></el-button> -->
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('workanswer')">识别</el-button>
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('workanswer')"><el-icon><Search /></el-icon></el-button>
|
||||
</div>
|
||||
|
||||
<!-- subjList -->
|
||||
|
@ -287,10 +262,6 @@
|
|||
<el-form-item :label="`${item.type}目${index+1}.`" :prop="`mulList.params.${index}.title`" :rules="{
|
||||
required: true, message: '题目不能为空', trigger: 'blur'}" :key='index'>
|
||||
<Tinymce v-model="item.title" :minHeight="150" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}"
|
||||
|
@ -302,10 +273,6 @@
|
|||
<el-form-item :label=Options(1,indexOp) :prop="`mulList.params.${index}.options.${indexOp}.text`"
|
||||
:rules="{ required: true, message: '单题不能为空', trigger: 'blur' }" :key='indexOp'>
|
||||
<Tinymce v-model="itemOp.text" :minHeight="150" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}"
|
||||
|
@ -326,10 +293,6 @@
|
|||
<el-form-item :label=Options(3,indexOp) :prop="`mulList.params.${index}.options.${indexOp}.text`"
|
||||
:rules="{required: true, message: '填空选项不能为空', trigger: 'blur'}">
|
||||
<Tinymce v-model="itemOp.text" :minHeight="150" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}"
|
||||
|
@ -350,10 +313,6 @@
|
|||
<el-form-item :label=Options(1,indexOp) :prop="`mulList.params.${index}.options.${indexOp}.text`"
|
||||
:rules="{required: true, message: '多选不能为空', trigger: 'blur'}">
|
||||
<Tinymce v-model="itemOp.text" :minHeight="150" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}"
|
||||
|
@ -384,10 +343,6 @@
|
|||
<div v-if="item.type == '主观题'">
|
||||
<el-form-item :label=Options(6,indexOp) :prop="`mulList.params.${index}.options.${indexOp}.text`">
|
||||
<Tinymce v-model="itemOp.text" :upFileParams="{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}" />
|
||||
|
@ -403,17 +358,12 @@
|
|||
<Tinymce
|
||||
v-model="questForm.method"
|
||||
:upFileParams = "{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}" />
|
||||
</el-form-item>
|
||||
<div class="item-cropper-btn">
|
||||
<!-- <el-button v-show="isCropper" circle icon="Search" @click="cropperFormItem('method')"></el-button> -->
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('method')">识别</el-button>
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('method')"><el-icon><Search /></el-icon></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -422,17 +372,12 @@
|
|||
<el-form-item label="答案解答" prop="analyse">
|
||||
<Tinymce v-model="questForm.analyse"
|
||||
:upFileParams = "{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}" />
|
||||
</el-form-item>
|
||||
<div class="item-cropper-btn">
|
||||
<!-- <el-button v-show="isCropper" circle icon="Search" @click="cropperFormItem('analyse')"></el-button> -->
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('analyse')">识别</el-button>
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('analyse')"><el-icon><Search /></el-icon></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -441,17 +386,12 @@
|
|||
<el-form-item label="答案点评" prop="discuss">
|
||||
<Tinymce v-model="questForm.discuss"
|
||||
:upFileParams = "{
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
}" />
|
||||
</el-form-item>
|
||||
<div class="item-cropper-btn">
|
||||
<!-- <el-button v-show="isCropper" circle icon="Search" @click="cropperFormItem('discuss')"></el-button> -->
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('discuss')">识别</el-button>
|
||||
<el-button v-show="isCropper" circle @click="cropperFormItem('discuss')"><el-icon><Search /></el-icon></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -465,6 +405,7 @@
|
|||
</template>
|
||||
<script setup>
|
||||
import { ElMessage, ElNotification } from 'element-plus'
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
|
||||
import { getBindlist } from '@/api/education/knowledgePoint'
|
||||
|
@ -658,10 +599,6 @@ const loading = ref(false);
|
|||
onMounted(() => {
|
||||
lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId; // 获取课程id
|
||||
upFileParams.value = {
|
||||
deptId: userStore.deptId,
|
||||
userId: userStore.userId,
|
||||
edudegree: userStore.edudegree,
|
||||
edusubject: userStore.edusubject,
|
||||
lessionId: lessionid,
|
||||
fileAlias: '单题上传',
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-button @click="handleQueryParamFromEntpCourseWork(1)"><el-icon><Search /></el-icon> 查找</el-button>
|
||||
<el-button @click="handleQueryParamFromEntpCourseWork(1)"><el-icon><Search /></el-icon>查找</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 习题表格 -->
|
||||
|
@ -102,6 +102,8 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
|
||||
import {listEntpcoursework, listEntpcourseworkNew, getEntpcoursework} from '@/api/education/entpCourseWork'
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
<div>
|
||||
<div class="form-item-cover">
|
||||
<el-form-item label="答案点评" prop="discuss">
|
||||
<tinymce v-model="discuss"/>
|
||||
<tinymce
|
||||
v-model="discuss"
|
||||
:upFileParams="{
|
||||
lessionId: 123456,
|
||||
fileAlias: '单题上传',
|
||||
}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue