baigl #46

Merged
baigl merged 21 commits from baigl into main 2024-11-21 10:38:10 +08:00
2 changed files with 92 additions and 45 deletions
Showing only changes of commit ab8fe885cb - Show all commits

View File

@ -95,6 +95,7 @@ import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesIt
import useUserStore from '@/store/modules/user'
const userStore = useUserStore().user
const route = useRoute();
const router = useRouter()
const { proxy } = getCurrentInstance()
const props = defineProps({
})
@ -205,7 +206,7 @@ const handleImportImg = (uploadFile) => {
console.log('uploadFile', uploadFile);
//
getBase64(uploadFile.raw).then(res => {
console.log('res-------', res);
// console.log('res-------', res);
// 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([buffer]));
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>

View File

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