This commit is contained in:
白了个白 2024-11-21 10:36:00 +08:00
parent 853fb871ef
commit ab8fe885cb
2 changed files with 92 additions and 45 deletions

View File

@ -95,6 +95,7 @@ import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesIt
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const userStore = useUserStore().user const userStore = useUserStore().user
const route = useRoute(); const route = useRoute();
const router = useRouter()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const props = defineProps({ const props = defineProps({
}) })
@ -205,7 +206,7 @@ const handleImportImg = (uploadFile) => {
console.log('uploadFile', uploadFile); console.log('uploadFile', uploadFile);
// //
getBase64(uploadFile.raw).then(res => { getBase64(uploadFile.raw).then(res => {
console.log('res-------', res); // console.log('res-------', res);
// Electron 使 URL.createObjectURL // Electron 使 URL.createObjectURL
@ -222,7 +223,7 @@ const handleImportImg = (uploadFile) => {
// cropOption.img = URL.createObjectURL(new Blob([fs.readFileSync(filePath)])); // cropOption.img = URL.createObjectURL(new Blob([fs.readFileSync(filePath)]));
// cropOption.img = URL.createObjectURL(new Blob([buffer])); // cropOption.img = URL.createObjectURL(new Blob([buffer]));
cropOption.img = res; cropOption.img = res;
console.log(cropOption.img); // console.log(cropOption.img);
@ -283,7 +284,50 @@ const identifyOverallImg =()=>{
}) })
}); });
}; };
/** 单题上传/纠错 抛上来的识别单项内容 */
const cropperExamFormItem=(examType, curItem)=>{
if (cropOption.img == null || cropOption.img == '') {
ElMessage({
message: '识别区域中无图片, 禁止识别',
type: 'error',
});
return;
}
let formValue = null;
proxy.$refs.cropper.getCropData(async (imgBase64) => {
formValue = await ocrImg2ItemByManualUpl(OCR_WORK_TEST, imgBase64, examType, curItem);
if (formValue == null) {
return;
}
nextTick( () => {
// []
let key = curItem;
if (examType === '复合题' && curItem=='workdesc') {
key = 'mulList';
}
else if (curItem=='workdesc') {
key = 'list';
}
proxy.$refs.refquesItem.cropperFormItemCallBack(key, formValue);
})
});
}
//
const onCancelExamSingleCallback=()=>{
//
//
// this.dlgImportSingle.open = false;
};
/** 单题上传/纠错 完成后的回调 */
const onSubmitExamSingleCallback =(callback) =>{
if (callback.submitType !== 1) {
console.log('999-999');
return;
}
//
router.back()
};
</script> </script>

View File

@ -71,7 +71,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" }"
/> />
@ -91,7 +91,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" /> }" />
</el-form-item> </el-form-item>
@ -126,7 +126,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" /> }" />
</el-form-item> </el-form-item>
@ -155,7 +155,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" /> }" />
</el-form-item> </el-form-item>
@ -200,7 +200,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" /> }" />
</el-form-item> </el-form-item>
@ -227,7 +227,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" }"
/> />
@ -241,7 +241,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" }"
/> />
@ -285,7 +285,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" }"
/> />
@ -300,7 +300,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" }"
/> />
@ -324,7 +324,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" }"
/> />
@ -348,7 +348,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" }"
/> />
@ -382,7 +382,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" /> }" />
</el-form-item> </el-form-item>
@ -400,7 +400,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" /> }" />
</el-form-item> </el-form-item>
@ -418,7 +418,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" /> }" />
</el-form-item> </el-form-item>
@ -436,7 +436,7 @@
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}" /> }" />
</el-form-item> </el-form-item>
@ -487,6 +487,7 @@ const props = defineProps({
default: false default: false
}, },
}) })
const lessionid = ref(""); // id
const upFileParams = ref({}); const upFileParams = ref({});
// //
const fromOptions = reactive({ const fromOptions = reactive({
@ -520,7 +521,7 @@ const initKonwPointFlagByUpdateForm = ref(true);
// [] // []
const curKnowledgePointList = ref([]); const curKnowledgePointList = ref([]);
// //
const questForm = reactive({ let questForm = reactive({
id: 0, id: 0,
title: '', title: '',
worktype: '单选题', worktype: '单选题',
@ -645,12 +646,13 @@ const localList = ref(['北京', '天津', '上海', '重庆', '河北', '山西
const loading = ref(false); const loading = ref(false);
onMounted(() => { onMounted(() => {
lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId; // id
upFileParams.value = { upFileParams.value = {
deptId: userStore.deptId, deptId: userStore.deptId,
userId: userStore.userId, userId: userStore.userId,
edudegree: userStore.edudegree, edudegree: userStore.edudegree,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
lessionId: props.activeLession.id, lessionId: lessionid,
fileAlias: '单题上传', fileAlias: '单题上传',
}; };
// //
@ -714,7 +716,7 @@ const checkBoxChangefh=(item, index, indexOp)=>{
console.log(questForm.mulList.params[index],'checkAnswer') console.log(questForm.mulList.params[index],'checkAnswer')
}; };
/** 表单重置 */ /** 表单重置 */
const reset = () =>{ const resetForm = () =>{
questForm = { questForm = {
id: 0, id: 0,
title: '', title: '',
@ -766,9 +768,7 @@ const reset = () =>{
}, },
], ],
}, },
}; };
proxy.resetForm("questFormRef");
}; };
/** /**
* @desc: 赋值表单 * @desc: 赋值表单
@ -1034,8 +1034,10 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{
// //
initKonwPointFlagByUpdateForm.value = false; initKonwPointFlagByUpdateForm.value = false;
lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId;
console.log('lessionid', lessionid.value);
// //
const res = await getBindlist({ eid: props.activeLession.id }) const res = await getBindlist({ eid: lessionid.value })
if (!res.data || res.data.length < 1) { if (!res.data || res.data.length < 1) {
ElMessage.warning('当前章节下未绑定知识点,暂不更新该试题知识点!'); ElMessage.warning('当前章节下未绑定知识点,暂不更新该试题知识点!');
curKnowledgePointList.value = []; curKnowledgePointList.value = [];
@ -1089,7 +1091,7 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{
params: newSubjListparams, params: newSubjListparams,
}, },
}; };
proxy.resetForm("questFormRef"); // proxy.resetForm("questFormRef");
// //
// const updateStatus = { // const updateStatus = {
@ -1584,26 +1586,26 @@ const submitForm=(formName) =>{
console.log('param', param); console.log('param', param);
// TODO // TODO
// if(questForm.id == 0){ if(questForm.id == 0){
// // //
// const res = await addEntpcoursework(param); const res = await addEntpcoursework(param);
// param.id = res; param.id = res;
// console.log("", res) console.log("单题上传", res)
// proxy.$modal.msgSuccess(""); proxy.$modal.msgSuccess("单题上传成功");
// }else{ }else{
// // //
// const res = updateEntpcoursework(param); const res = updateEntpcoursework(param);
// proxy.$modal.msgSuccess(""); proxy.$modal.msgSuccess("单题修改成功");
// } }
// (form, []param) // (form, []param)
// param.submitIndex = questForm.submitIndex; param.submitIndex = questForm.submitIndex;
// param.submitType = questForm.submitType; param.submitType = questForm.submitType;
// emit('submit-exam-single-callback', param); emit('submit-exam-single-callback', param);
// form // form
// proxy.reset(); resetForm();
// proxy.resetForm("questFormRef"); // proxy.resetForm("questFormRef");
} else { } else {
myMessageShow('失败', '单题上传参数有误', 'error'); myMessageShow('失败', '单题上传参数有误', 'error');
return; return;
@ -1693,7 +1695,7 @@ const myMessageShow=(title, msg, status)=>{
// initKonwPointFlagByUpdateForm.value = true; // initKonwPointFlagByUpdateForm.value = true;
// // 3. // // 3.
// getBindlist({ eid: props.activeLession.id }).then( res => { // getBindlist({ eid: lessionid }).then( res => {
// if (!res.data || res.data.length < 1) { // if (!res.data || res.data.length < 1) {
// ElMessage.warning(''); // ElMessage.warning('');
// curKnowledgePointList = []; // curKnowledgePointList = [];
@ -1710,10 +1712,11 @@ const myMessageShow=(title, msg, status)=>{
// deep: true // // deep: true //
// }, // },
// }, // },
// watch(() => props.bookobj.levelSecondId, (newVal, oldVal) => { watch(() => props.bookobj.levelSecondId, (newVal, oldVal) => {
// console.log(props.bookobj,'') console.log(props.bookobj,'课程选择')
// debounceQueryData(); // props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId
// }) lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId;
})
// () // ()