diff --git a/src/renderer/public/cropImgTest/single1.json b/src/renderer/public/cropImgTest/single1.json new file mode 100644 index 0000000..e8bd920 --- /dev/null +++ b/src/renderer/public/cropImgTest/single1.json @@ -0,0 +1,540 @@ +{ + "img_direction": 0, + "results": [ + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 96, + "height": 33, + "width": 943, + "top": 15 + }, + "word": "11.(2023广东卷,2)党的二十大审议通过了《中国共产党章程(修正案)》,把党的十九大以", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 48, + "height": 33, + "width": 991, + "top": 58 + }, + "word": "来习近平新时代中国特色社会主义思想新发展写入党章,以更好反映以习近平同志为核心的", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 48, + "height": 32, + "width": 741, + "top": 101 + }, + "word": "党中央推进党的理论创新、实践创新、制度创新成果。这一修改()", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 95, + "height": 32, + "width": 720, + "top": 144 + }, + "word": "①全面具体地总结了党的十八大以来党和国家各项事业的伟大成就", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 836, + "height": 32, + "width": 203, + "top": 145 + }, + "word": "②为更好坚持和发", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 46, + "height": 33, + "width": 994, + "top": 187 + }, + "word": "展中国特色社会主义提供了制度保障和法律依据③更加彰显习近平新时代中国特色社会主", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 50, + "height": 32, + "width": 325, + "top": 229 + }, + "word": "义思想的真理力量和实践伟力", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 395, + "height": 33, + "width": 644, + "top": 229 + }, + "word": "④适应形势和任务的发展变化,有利于更好发挥党章的规范", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 50, + "height": 32, + "width": 128, + "top": 272 + }, + "word": "和指导作用", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 96, + "height": 32, + "width": 88, + "top": 315 + }, + "word": "A.①②", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 326, + "height": 32, + "width": 87, + "top": 314 + }, + "word": "B.①④", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 555, + "height": 31, + "width": 84, + "top": 316 + }, + "word": "C.②③", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 779, + "height": 32, + "width": 88, + "top": 317 + }, + "word": "D.③④", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 94, + "height": 33, + "width": 942, + "top": 358 + }, + "word": "【试题立意】本题以党的二十大对党章修改为背景,考查对习近平新时代中国特色社会主", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 51, + "height": 33, + "width": 871, + "top": 401 + }, + "word": "义思想的理解,引导学生认同习近平新时代中国特色社会主义思想,坚定理论自信。", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 95, + "height": 33, + "width": 942, + "top": 443 + }, + "word": "【能力解读】本题主要考查了对党的二十大审议通过了《中国共产党章程(修正案)》的关键", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 52, + "height": 33, + "width": 821, + "top": 487 + }, + "word": "信息的获取与加工能力,以及对其所体现道理的辨识与判断、推理与论证能力。", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 272, + "height": 27, + "width": 181, + "top": 542 + }, + "word": "筛选加工关键信息", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 795, + "height": 27, + "width": 113, + "top": 542 + }, + "word": "辨识与判断", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 63, + "height": 29, + "width": 602, + "top": 586 + }, + "word": "党的二十大与时俱进,审议通过了《中国共产党章程(修正案)》 ,使", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 681, + "height": 28, + "width": 343, + "top": 586 + }, + "word": "适应形势和任务的发展变化,有利于", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 62, + "height": 28, + "width": 196, + "top": 625 + }, + "word": "之随着时代丰富发展", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 680, + "height": 29, + "width": 297, + "top": 624 + }, + "word": "更好发挥党章的规范和指导作用", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 59, + "height": 28, + "width": 606, + "top": 674 + }, + "word": "《中国共产党章程(修正案)》把党的十九大以来习近平新时代中国", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 681, + "height": 30, + "width": 344, + "top": 692 + }, + "word": "更加彰显习近平新时代中国特色社会", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 61, + "height": 29, + "width": 602, + "top": 713 + }, + "word": "特色社会主义思想新发展写入党章,以更好反映以习近平同志为", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 682, + "height": 29, + "width": 295, + "top": 731 + }, + "word": "主义思想的真理力量和实践伟力", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 61, + "height": 29, + "width": 541, + "top": 751 + }, + "word": "核心的党中央推进党的理论创新、实践创新、制度创新成果", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 95, + "height": 31, + "width": 135, + "top": 808 + }, + "word": "【误项排除】", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 60, + "height": 26, + "width": 49, + "top": 863 + }, + "word": "选项", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 522, + "height": 27, + "width": 114, + "top": 863 + }, + "word": "排除的原因", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 122, + "height": 29, + "width": 902, + "top": 906 + }, + "word": "材料强调的是把党的十九大以来习近平新时代中国特色社会主义思想新发展写入党章,不涉及总", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 68, + "height": 27, + "width": 31, + "top": 927 + }, + "word": "①", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 124, + "height": 29, + "width": 594, + "top": 945 + }, + "word": "结党的十八大以来党和国家各项事业的伟大成就,①不符合题意", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 122, + "height": 28, + "width": 902, + "top": 992 + }, + "word": "《中国共产党章程(修正案)》是管党治党的总章程、总规矩,是中国共产党最根本的党内法规,不能", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 70, + "height": 26, + "width": 29, + "top": 1012 + }, + "word": "②", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 124, + "height": 28, + "width": 699, + "top": 1030 + }, + "word": "为更好坚持和发展中国特色社会主义提供制度保障和法律依据,②说法错误", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 97, + "height": 30, + "width": 108, + "top": 1085 + }, + "word": "【答案】D", + "line_probability": {} + } + } + ], + "layouts_num": 0, + "results_num": 38, + "log_id": 1869631874868290300 +} \ No newline at end of file diff --git a/src/renderer/public/cropImgTest/single2.json b/src/renderer/public/cropImgTest/single2.json new file mode 100644 index 0000000..180f7c5 --- /dev/null +++ b/src/renderer/public/cropImgTest/single2.json @@ -0,0 +1,176 @@ +{ + "img_direction": 0, + "results": [ + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 14, + "height": 58, + "width": 727, + "top": 2 + }, + "word": "(四川成都锦江区校级自主招生)九年级1班在课外活动时,", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 14, + "height": 54, + "width": 730, + "top": 51 + }, + "word": "甲、乙、丙三位同学进行乒乓球练习,为确定哪两位同学先打", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 11, + "height": 51, + "width": 731, + "top": 101 + }, + "word": "球,甲、乙、丙三位同学用“手心、手背”游戏(游戏时,“手心向", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 11, + "height": 47, + "width": 731, + "top": 151 + }, + "word": "上”简称手心;“手背向上”简称手背)来决定.游戏规则是:每", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 10, + "height": 42, + "width": 731, + "top": 201 + }, + "word": "人每次同时随机伸出一只手,出手心或手背.若出现“两同一", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 10, + "height": 40, + "width": 729, + "top": 249 + }, + "word": "异”(即两手心、一手背或两手背、一手心)的情况,则同出手心", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 9, + "height": 38, + "width": 729, + "top": 297 + }, + "word": "或手背的两个人先打球,另一人做裁判;否则继续进行,直到", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 11, + "height": 32, + "width": 255, + "top": 348 + }, + "word": "出现“两同一异”为止.", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 10, + "height": 34, + "width": 726, + "top": 393 + }, + "word": "(1)请你列出甲、乙、丙三位同学运用“手心、手背”游戏,出手", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 7, + "height": 37, + "width": 723, + "top": 439 + }, + "word": "一次出现的所有等可能情况(用A表示手心,用B表示手背);", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 8, + "height": 36, + "width": 724, + "top": 485 + }, + "word": "(2)求甲、乙、丙三位同学运用“手心、手背”游戏,出手一次出", + "line_probability": {} + } + }, + { + "chars": [], + "words_type": "print", + "words": { + "words_location": { + "left": 6, + "height": 34, + "width": 257, + "top": 529 + }, + "word": "现“两同一异”的概率.", + "line_probability": {} + } + } + ], + "layouts_num": 0, + "results_num": 12, + "log_id": 1869573563121265400 +} \ No newline at end of file diff --git a/src/renderer/src/api/education/entpCourseWork.js b/src/renderer/src/api/education/entpCourseWork.js index 25f61e2..f243df1 100644 --- a/src/renderer/src/api/education/entpCourseWork.js +++ b/src/renderer/src/api/education/entpCourseWork.js @@ -135,4 +135,18 @@ export function getJYPath(url,config) { method: config.method||"get", params: config.params }) +} + + +/** + * @desc: 百度识图转发 + * @return: {*} + * @param {*} data + */ +export function getOcrContent(data) { + return request({ + url: '/ocr/exam', + method: 'post', + data: data + }) } \ No newline at end of file diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue index 0151f5b..c57f831 100644 --- a/src/renderer/src/components/choose-textbook/index.vue +++ b/src/renderer/src/components/choose-textbook/index.vue @@ -184,7 +184,7 @@ const renderContent = (h, { node, data, store }) => { 'span', { style: { - color: data.bookId==''||data.bookId=='0' ? '#758CAE' : 'black', + color: data.bookId==''||data.bookId=='0' ? '#A5B3CA' : 'black', }, }, node.label diff --git a/src/renderer/src/hooks/useProcessList.js b/src/renderer/src/hooks/useProcessList.js index bb2b0c3..c9f1e07 100644 --- a/src/renderer/src/hooks/useProcessList.js +++ b/src/renderer/src/hooks/useProcessList.js @@ -299,21 +299,28 @@ export const processList = (row, aloneOption=false) => { if(!aloneOption && j%2== 0){ tmp += ''; } - row[i].workdescFormat = tmp + row[i].workdescFormat = tmp; // 处理[答案显示] - 转换ABCD let arr2Char = workAnswerArr .map((item) => { return String.fromCharCode(65 + Number(item)) }) - .join('') - row[i].workanswerFormat = arr2Char + .join(''); + row[i].workanswerFormat = arr2Char; } else if (row[i].worktype == '填空题') { // 处理[选项显示] - 填空题中无选项, 故置空 - row[i].workdescFormat = '' + row[i].workdescFormat = ''; // 处理[答案显示] - 逗号连接 - row[i].workanswerFormat = workAnswerArr.join('、') + + // 当[答案显示]为 [/g, ''); - examItem = ocrTxt; - } + ocrTxt = ocrTxt.replace(/
/g, ''); + examItem = ocrTxt; + } else { + examItem = ocrTxt; } // 返回转换格式后的识别内容 @@ -174,7 +171,7 @@ export const ocrImg2ExamByManualUpl = async (isLocalTest = false, imgBase64 = '' if (isLocalTest) { // 临时本地测试(json格式跟百度ocr一致) - const response = await fetch('/cropImgTest/single.json'); + const response = await fetch('/cropImgTest/single1.json'); const resOcr = await response.json(); ocrJson = resOcr.results; // 识别内容拼接 @@ -234,12 +231,14 @@ const ocrImg2Json = async (urlBase64) => { ElMessage.error("未检测到截图图片, 请截取图片后再识别"); return null; } + let base64Code = urlBase64.split(",")[1]; const resOcr = await getOcrContent({ base64Code: base64Code }); if (resOcr.code !== 200) { ElMessage.error("图片识别错误"); return null; } + // const resToken = await bdyAPI_getToken(); // if (resToken.status !== 200) { // ElMessage.error("百度智能云用户标识有误"); @@ -394,8 +393,8 @@ const assembleExam = (eachSub) => { } // 第一部分[题干-选项] 处理 titleAndWorkDesc = tmpList[0]; - // 将4个以上连续的下划线统一替换为5个 - titleAndWorkDesc = titleAndWorkDesc.replace(/_{4,}/g, '_____'); + // 将3个以上连续的下划线统一替换为5个 + titleAndWorkDesc = titleAndWorkDesc.replace(/_{3,}/g, '_____'); // 第二部分[分析-答案] 处理 let answerAndAnswer = {}; @@ -456,32 +455,35 @@ const assembleExam = (eachSub) => { } } - let tmpExam = null; - if (answer === '') { - /** - * 基础题型 - [单选题] [多选题] [填空题] [判断题] [主观题] - */ - tmpExam = processExamSingle(titleAndWorkDesc, answer); - } - else { - // 匹配是否存在 1. (1) (1)的存在, 题目与答案都存在则说明题型为复合题(嵌套题) - regex = /^(\d+[..。]|\(\d+\)|(\d+))/; - let answerFind = regex.test(answer); - regex = /(\d+[..。]|\(\d+\)|(\d+))/; - let titleFind = regex.test(titleAndWorkDesc); - if (titleFind && answerFind) { - /** - * [复合题] - 处理逻辑 - */ - tmpExam = processExamMulti(titleAndWorkDesc, answer); - } - else { - /** - * 基础题型 - [单选题] [多选题] [填空题] [判断题] [主观题] - */ - tmpExam = processExamSingle(titleAndWorkDesc, answer); - } - } + // 目前暂屏蔽无[复合题], 故所有都算基础题 + let tmpExam = processExamSingle(titleAndWorkDesc, answer); + + // let tmpExam = null; + // if (answer === '') { + // /** + // * 基础题型 - [单选题] [多选题] [填空题] [判断题] [主观题] + // */ + // tmpExam = processExamSingle(titleAndWorkDesc, answer); + // } + // else { + // // 匹配是否存在 1. (1) (1)的存在, 题目与答案都存在则说明题型为复合题(嵌套题) + // regex = /^(\d+[..。]|\(\d+\)|(\d+))/; + // let answerFind = regex.test(answer); + // regex = /(\d+[..。]|\(\d+\)|(\d+))/; + // let titleFind = regex.test(titleAndWorkDesc); + // if (titleFind && answerFind) { + // /** + // * [复合题] - 处理逻辑 + // */ + // tmpExam = processExamMulti(titleAndWorkDesc, answer); + // } + // else { + // /** + // * 基础题型 - [单选题] [多选题] [填空题] [判断题] [主观题] + // */ + // tmpExam = processExamSingle(titleAndWorkDesc, answer); + // } + // } if (tmpExam) { // 错误信息 @@ -607,13 +609,21 @@ const processExamSingle = function (titleAndWorkDesc, answer) { * 主观题 */ // [题型] - 格式化 - examSingle.workType = "主观题"; + const flagDict = ['单选题', '多选题', '判断题', '填空题']; + const another = entpCourseWorkTypeList.filter(item => !flagDict.includes(item.label)); + if (another.length > 0) { + examSingle.workType = another[another.length-1].label; + // [题干]-格式化 + examSingle.title = titleAndWorkDesc; + } - // [题干]-格式化 - examSingle.title = titleAndWorkDesc; + // examSingle.workType = "主观题"; - // [选项] - 格式化 --- 主观题无选项 - //examSingle.arrWorkDesc = []; + // // [题干]-格式化 + // examSingle.title = titleAndWorkDesc; + + // // [选项] - 格式化 --- 主观题无选项 + // //examSingle.arrWorkDesc = []; // [题目答案] - 处理 --- ['qweasd123'] if (answer !== '') { diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue index 73d05c7..7342773 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue @@ -8,7 +8,7 @@ - + 温馨提示:填空题题目的填空位置,下划线请连续输入3-10个 _ 符号。eg:今天___好日子。 @@ -103,7 +103,7 @@ -
+
-
+
@@ -157,7 +157,7 @@
-
+
-
+
+
@@ -350,6 +350,19 @@
+ +
+ + + +
+ +
+
+
@@ -623,8 +636,9 @@ onMounted(() => { // 更新第三方题型、题源 if (entpCourseWorkTypeList.length>0) { - const flagDict = ['单选题', '多选题', '判断题', '填空题']; - fromOptions.type = entpCourseWorkTypeList.filter(item => flagDict.includes(item.label)); + //const flagDict = ['单选题', '多选题', '判断题', '填空题']; + //fromOptions.type = entpCourseWorkTypeList.filter(item => flagDict.includes(item.label)); + fromOptions.type = entpCourseWorkTypeList } if (entpCourseWorkGroupList.length>0) { fromOptions.flag = entpCourseWorkGroupList; @@ -748,8 +762,8 @@ const resetForm = () =>{ const updateForm= async(item, submitIndex=0, submitType=1) =>{ console.log(item,'item'); // 当不存在[状态],默认为1 - if (!item.hasOwnProperty('stutus')) { - item.stutus = '1'; + if (!item.hasOwnProperty('status')) { + item.status = '1'; } // 当不存在[知识点], 默认为空 if (!item.hasOwnProperty('evalnodeid')) { @@ -764,7 +778,6 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{ // 将菁优网的填空下划线标签转为下划线(上传时需再重新替换回来) item.title = item.title.replace(/
(?: )?<\/div>/g, '_____'); - if(item.worktype == '复合题') { // 同步更新[基础题]的初始结构 @@ -902,11 +915,14 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{ }], }, ]; - newList = []; + + // 默认显示一个空选项 + newList = [{text:""}]; + // 兼容题型[主观题] - item.worktype = item.worktype.replace(/\(主观题\)/g, ''); - item.worktype = `${item.worktype}(主观题)`; + //item.worktype = item.worktype.replace(/\(主观题\)/g, ''); + //item.worktype = `${item.worktype}(主观题)`; // 无选项 // 选项答案处理下 if(isJson(item.workanswer)){ @@ -1008,9 +1024,8 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{ lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId; console.log('lessionid', lessionid.value); - // 拿到当前章节下得所有知识点 - if( props.bookobj.node.edustage == '高中' && (props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语') ){ + if( props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语' ){ const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 }); const id = res.rows[0]?.id; if (id) { @@ -1083,6 +1098,7 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{ // status = 1, // } // emit('update-exam-single', updateStatus); + console.log('updateFormone->', questForm) }; const updateFormone=(item, submitIndex, submitType, formdataitem)=>{ @@ -1437,14 +1453,9 @@ const submitForm=(formName) =>{ //param.workdesc = questForm.list.map(item => item.text).join('#&'); param.workdesc = JSON.stringify(questForm.list.map(item => item.text)); - // 针对[单选题]和[多选题]重新格式化信息 - if (questForm.worktype === '单选题' || questForm.worktype === '多选题') { - //param.workanswer = questForm.checkAnswer.map(item => item).join('#&'); - param.workanswer = JSON.stringify(questForm.checkAnswer); - } - - // 针对[复合题]重新格式化信息 + // 重新格式化信息 if(questForm.worktype === '复合题') { + // 针对[复合题]重新格式化信息 let workdesc = []; let answer = []; // 1.题目: 背景材料(不再需要处理, 直接使用form.title) @@ -1501,9 +1512,33 @@ const submitForm=(formName) =>{ param.workdesc = JSON.stringify(workdesc); param.workanswer = JSON.stringify(answer); } + else if (questForm.worktype === '单选题' || questForm.worktype === '多选题') { + // 针对[单选题]和[多选题]重新格式化信息 + //param.workanswer = questForm.checkAnswer.map(item => item).join('#&'); + param.workanswer = JSON.stringify(questForm.checkAnswer); + } + // 针对[填空题]重新格式化信息 "
什么
#&
什么哟
".replace(/<[^>]*>/g, "") + else if(questForm.worktype === '填空题'){ + //填空答案: 这里填入选项的值(填空值) + //param.workanswer = questForm.list.map(item => item.text).join('#&').replace(/<[^>]*>/g, ""); + + // 填空选项为空,避免后面多次判断,这里只根据正确答案来分析 + param.workdesc = ''; + param.workanswer = JSON.stringify(questForm.list.map(item => item.text)); + + } - // 针对[主观题]重新格式化信息 ([单题上传]时默认为主观题。 [单题纠错]时会在原题型后面增加标识[(主观题)], 故此处更改为判断是否存在 ) - if(questForm.worktype.indexOf('主观题') !== -1) { + // 针对[判断题]重新格式化信息 + else if(questForm.worktype === '判断题'){ + //判断题答案: 这里填入选项的值(判断值) + //param.workanswer = questForm.list.map(item => item.text).join('#&').replace(/<[^>]*>/g, ""); + + // 填空选项为空,避免后面多次判断,这里只根据正确答案来分析 + param.workdesc = ''; + param.workanswer = JSON.stringify(questForm.checkAnswer); + } + else if(questForm.worktype.indexOf('主观题') !== -1) { + // warn: 针对[主观题]重新格式化信息 ([单题上传]时默认为主观题。 [单题纠错]时会在原题型后面增加标识[(主观题)], 故此处更改为判断是否存在 ) // 主观题:只有答案跟题目,答案还不是唯一的,一个具体参考答案类似 param.workdesc = ''; // 主观题选项为空 // 主观题 答案直接用的 workanswer 存的时候用数组 @@ -1533,27 +1568,16 @@ const submitForm=(formName) =>{ // param.workdesc = ''; // 填空选项为空,避免后面多次判断,这里只根据正确答案来分析 // param.workanswer = JSON.stringify(answer).replace(/<[^>]*>/g, ""); } - - // 针对[填空题]重新格式化信息 "
什么
#&
什么哟
".replace(/<[^>]*>/g, "") - if(questForm.worktype === '填空题'){ - //填空答案: 这里填入选项的值(填空值) - //param.workanswer = questForm.list.map(item => item.text).join('#&').replace(/<[^>]*>/g, ""); - - // 填空选项为空,避免后面多次判断,这里只根据正确答案来分析 - param.workdesc = ''; - param.workanswer = JSON.stringify(questForm.list.map(item => item.text)); - + else { + // 非统一标准解答题(主观题), 统一以[主观题]的格式来处理, 主要用于兼容ocr识别解答题及菁优网第三方非同一解答题 + param.workdesc = ''; // 主观题选项为空 + // 主观题 答案直接用的 workanswer 存的时候用数组 + if (questForm.workanswer && questForm.workanswer != '') { + param.workanswer = JSON.stringify([questForm.workanswer]); + } } - // 针对[判断题]重新格式化信息 - if(questForm.worktype === '判断题'){ - //判断题答案: 这里填入选项的值(判断值) - //param.workanswer = questForm.list.map(item => item.text).join('#&').replace(/<[^>]*>/g, ""); - - // 填空选项为空,避免后面多次判断,这里只根据正确答案来分析 - param.workdesc = ''; - param.workanswer = JSON.stringify(questForm.checkAnswer); - } + // 针对不同上传方式, 需要做不同的状态处理(目前只用处理3的情况) if (questForm.submitType === 3) { @@ -1715,18 +1739,21 @@ const formatKnowledgePoint = (list) => { return list; }; -watch(() => props.bookobj.levelSecondId, async (newVal, oldVal) => { +watch([ + () => props.bookobj.levelFirstId, + () => props.bookobj.levelSecondId +], async([newLevelSecondId, newLevelFirstId], [oldLevelSecondId, oldLevelFirstId]) => { console.log(props.bookobj,'课程选择') // props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId - lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId; + lessionid.value = props.bookobj.levelSecondId!='' ? props.bookobj.levelSecondId : props.bookobj.levelFirstId; /** * 格式化知识点: 分两种情况 * 1. 语文/英语: 获取学科下的所有知识点(该学科对应无章节与知识点绑定, 故只获取全知识点) * 2. 其他: 获取当前章节下的所有知识点 */ - let id = props.bookobj.levelSecondId; - if( props.bookobj.node.edustage == '高中' && (props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语') ){ + let id = lessionid.value; + if( props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语'){ id = props.bookobj.node.rootid; const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 }); id = res.rows[0]?.id; diff --git a/src/renderer/src/views/desktop/index.vue b/src/renderer/src/views/desktop/index.vue index cf6351d..b0d989f 100644 --- a/src/renderer/src/views/desktop/index.vue +++ b/src/renderer/src/views/desktop/index.vue @@ -58,10 +58,10 @@ import { useGetSubject } from '@/hooks/useGetSubject' import { sessionStore } from '@/utils/store' import { debounce } from 'lodash' -import useUserStore from '@/store/modules/user' -import useClassTaskStore from '@/store/modules/classTask' -const userStore = useUserStore() -const classTaskStore = useClassTaskStore(); +// import useUserStore from '@/store/modules/user' +// import useClassTaskStore from '@/store/modules/classTask' +// const userStore = useUserStore() +// const classTaskStore = useClassTaskStore(); const router = useRouter() const { ipcRenderer } = window.electron || {} @@ -217,7 +217,7 @@ onMounted(async ()=>{ chartInstance = echarts.init(chartDom.value) // 更新第三方题型题类 - await classTaskStore.initJYInfo(userStore.user); + //await classTaskStore.initJYInfo(userStore.user); const option = { diff --git a/src/renderer/src/views/model/index.vue b/src/renderer/src/views/model/index.vue index 90e469c..14de242 100644 --- a/src/renderer/src/views/model/index.vue +++ b/src/renderer/src/views/model/index.vue @@ -98,10 +98,13 @@ import progressDialog from '@/views/teachingDesign/container/progress-dialog.vue import msgUtils from "@/plugins/modal"; import * as commUtils from "@/utils/comm"; import * as Api_server from "@/api/apiService"; // 学科名字文生图 +import useClassTaskStore from '@/store/modules/classTask' + const router = useRouter() const userStore = useUserStore().user // 用户信息 const currentNode = ref({}) const refs = ref([]); +const classTaskStore = useClassTaskStore(); const collectRef = (key) => { return (el) => { @@ -513,7 +516,9 @@ const changeClass = async (type, row, other) => { } // 页面加载 -onMounted(() => { +onMounted(async () => { + // 更新第三方题型题类 + await classTaskStore.initJYInfo(userStore); })