[试题上传] - 兼容优化菁优网题型

This commit is contained in:
“zouyf” 2024-12-19 15:51:06 +08:00
parent 2bdac6e2ea
commit c8729a7008
10 changed files with 888 additions and 109 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -136,3 +136,17 @@ export function getJYPath(url,config) {
params: config.params params: config.params
}) })
} }
/**
* @desc: 百度识图转发
* @return: {*}
* @param {*} data
*/
export function getOcrContent(data) {
return request({
url: '/ocr/exam',
method: 'post',
data: data
})
}

View File

@ -184,7 +184,7 @@ const renderContent = (h, { node, data, store }) => {
'span', 'span',
{ {
style: { style: {
color: data.bookId==''||data.bookId=='0' ? '#758CAE' : 'black', color: data.bookId==''||data.bookId=='0' ? '#A5B3CA' : 'black',
}, },
}, },
node.label node.label

View File

@ -299,21 +299,28 @@ export const processList = (row, aloneOption=false) => {
if(!aloneOption && j%2== 0){ if(!aloneOption && j%2== 0){
tmp += '</div>'; tmp += '</div>';
} }
row[i].workdescFormat = tmp row[i].workdescFormat = tmp;
// 处理[答案显示] - 转换ABCD // 处理[答案显示] - 转换ABCD
let arr2Char = workAnswerArr let arr2Char = workAnswerArr
.map((item) => { .map((item) => {
return String.fromCharCode(65 + Number(item)) return String.fromCharCode(65 + Number(item))
}) })
.join('') .join('');
row[i].workanswerFormat = arr2Char row[i].workanswerFormat = arr2Char;
} else if (row[i].worktype == '填空题') { } else if (row[i].worktype == '填空题') {
// 处理[选项显示] - 填空题中无选项, 故置空 // 处理[选项显示] - 填空题中无选项, 故置空
row[i].workdescFormat = '' row[i].workdescFormat = '';
// 处理[答案显示] - 逗号连接 // 处理[答案显示] - 逗号连接
row[i].workanswerFormat = workAnswerArr.join('、')
// 当[答案显示]为 [<div] 开头时,不再需逗号连接(一般为自主上传, 当前答案每个自带div标签)
let linkChar = '、';
if (workAnswerArr.length != 0 && workAnswerArr[0].indexOf('<div') == 0) {
linkChar = '';
}
row[i].workanswerFormat = workAnswerArr.join(linkChar);
} else if (row[i].worktype == '判断题') { } else if (row[i].worktype == '判断题') {
// 处理[选项显示] - 判断题中无选项, 故置空 // 处理[选项显示] - 判断题中无选项, 故置空
row[i].workdescFormat = '' row[i].workdescFormat = ''

View File

@ -127,7 +127,7 @@ const courseObj = reactive({
const activeAptTab = ref("人工录入"); const activeAptTab = ref("人工录入");
// false - api true - json // false - api true - json
const OCR_WORK_TEST = false; const OCR_WORK_TEST = true;
// [] // []
const cropOption = reactive({ const cropOption = reactive({
img: '', // url , base64, blob img: '', // url , base64, blob

View File

@ -2,7 +2,8 @@ import { ElMessageBox, ElMessage } from "element-plus";
import qs from "qs"; import qs from "qs";
import axios from 'axios' import axios from 'axios'
import request from '@/utils/request' import request from '@/utils/request'
import { pyOCRAPI } from "@/api/education/entpcoursework"; import { pyOCRAPI, getOcrContent } from "@/api/education/entpcoursework";
import useClassTaskStore from '@/store/modules/classTask'
const EXAM_JUDGED_DICTIONARY = ["正确", "对", "√", "T", "错误", "错", "×", "F"]; const EXAM_JUDGED_DICTIONARY = ["正确", "对", "√", "T", "错误", "错", "×", "F"];
@ -17,13 +18,10 @@ const baidubceConfig = {
'client_secret': 'oWb0M0YWMmZPMQIhIUkJX99ddr7h61qf', 'client_secret': 'oWb0M0YWMmZPMQIhIUkJX99ddr7h61qf',
}; };
export function getOcrContent(data) {
return request({ const {
url: '/ocr/exam', entpCourseWorkTypeList
method: 'post', } = useClassTaskStore();
data: data
})
}
/** /**
@ -45,7 +43,7 @@ export const ocrImg2ItemByManualUpl = async (isLocalTest = false, imgBase64 = ''
if (isLocalTest) { if (isLocalTest) {
// 临时本地测试json格式跟百度ocr一致 // 临时本地测试json格式跟百度ocr一致
const response = await fetch('/cropImgTest/single.json'); const response = await fetch('/cropImgTest/single2.json');
const resOcr = await response.json(); const resOcr = await response.json();
ocrJson = resOcr.results; ocrJson = resOcr.results;
// 识别内容拼接 // 识别内容拼接
@ -115,7 +113,6 @@ export const ocrImg2ItemByManualUpl = async (isLocalTest = false, imgBase64 = ''
examItem.params.push(obj); examItem.params.push(obj);
}); });
return examItem; return examItem;
} }
else if (examType.includes('单选题') || examType.includes('多选题')) { else if (examType.includes('单选题') || examType.includes('多选题')) {
/** 单选题/多选题 - 选项 */ /** 单选题/多选题 - 选项 */
@ -150,10 +147,10 @@ export const ocrImg2ItemByManualUpl = async (isLocalTest = false, imgBase64 = ''
} }
else if (curItem === 'workanswer') { else if (curItem === 'workanswer') {
// 该类型下只做[主观题]和[复合题]的处理 // 该类型下只做[主观题]和[复合题]的处理
if (examType.includes('主观题')) { ocrTxt = ocrTxt.replace(/<br \/>/g, '');
ocrTxt = ocrTxt.replace(/<br \/>/g, ''); examItem = ocrTxt;
examItem = ocrTxt; } else {
} examItem = ocrTxt;
} }
// 返回转换格式后的识别内容 // 返回转换格式后的识别内容
@ -174,7 +171,7 @@ export const ocrImg2ExamByManualUpl = async (isLocalTest = false, imgBase64 = ''
if (isLocalTest) { if (isLocalTest) {
// 临时本地测试json格式跟百度ocr一致 // 临时本地测试json格式跟百度ocr一致
const response = await fetch('/cropImgTest/single.json'); const response = await fetch('/cropImgTest/single1.json');
const resOcr = await response.json(); const resOcr = await response.json();
ocrJson = resOcr.results; ocrJson = resOcr.results;
// 识别内容拼接 // 识别内容拼接
@ -234,12 +231,14 @@ const ocrImg2Json = async (urlBase64) => {
ElMessage.error("未检测到截图图片, 请截取图片后再识别"); ElMessage.error("未检测到截图图片, 请截取图片后再识别");
return null; return null;
} }
let base64Code = urlBase64.split(",")[1]; let base64Code = urlBase64.split(",")[1];
const resOcr = await getOcrContent({ base64Code: base64Code }); const resOcr = await getOcrContent({ base64Code: base64Code });
if (resOcr.code !== 200) { if (resOcr.code !== 200) {
ElMessage.error("图片识别错误"); ElMessage.error("图片识别错误");
return null; return null;
} }
// const resToken = await bdyAPI_getToken(); // const resToken = await bdyAPI_getToken();
// if (resToken.status !== 200) { // if (resToken.status !== 200) {
// ElMessage.error("百度智能云用户标识有误"); // ElMessage.error("百度智能云用户标识有误");
@ -394,8 +393,8 @@ const assembleExam = (eachSub) => {
} }
// 第一部分[题干-选项] 处理 // 第一部分[题干-选项] 处理
titleAndWorkDesc = tmpList[0]; titleAndWorkDesc = tmpList[0];
// 将4个以上连续的下划线统一替换为5个 // 将3个以上连续的下划线统一替换为5个
titleAndWorkDesc = titleAndWorkDesc.replace(/_{4,}/g, '_____'); titleAndWorkDesc = titleAndWorkDesc.replace(/_{3,}/g, '_____');
// 第二部分[分析-答案] 处理 // 第二部分[分析-答案] 处理
let answerAndAnswer = {}; let answerAndAnswer = {};
@ -456,32 +455,35 @@ const assembleExam = (eachSub) => {
} }
} }
let tmpExam = null; // 目前暂屏蔽无[复合题], 故所有都算基础题
if (answer === '') { let tmpExam = processExamSingle(titleAndWorkDesc, answer);
/**
* 基础题型 - [单选题] [多选题] [填空题] [判断题] [主观题] // let tmpExam = null;
*/ // if (answer === '') {
tmpExam = processExamSingle(titleAndWorkDesc, answer); // /**
} // * 基础题型 - [单选题] [多选题] [填空题] [判断题] [主观题]
else { // */
// 匹配是否存在 1. 1 (1)的存在, 题目与答案都存在则说明题型为复合题(嵌套题) // tmpExam = processExamSingle(titleAndWorkDesc, answer);
regex = /^(\d+[..。]|\(\d+\)|\d+)/; // }
let answerFind = regex.test(answer); // else {
regex = /(\d+[..。]|\(\d+\)|\d+)/; // // 匹配是否存在 1. 1 (1)的存在, 题目与答案都存在则说明题型为复合题(嵌套题)
let titleFind = regex.test(titleAndWorkDesc); // regex = /^(\d+[..。]|\(\d+\)|\d+)/;
if (titleFind && answerFind) { // let answerFind = regex.test(answer);
/** // regex = /(\d+[..。]|\(\d+\)|\d+)/;
* [复合题] - 处理逻辑 // let titleFind = regex.test(titleAndWorkDesc);
*/ // if (titleFind && answerFind) {
tmpExam = processExamMulti(titleAndWorkDesc, answer); // /**
} // * [复合题] - 处理逻辑
else { // */
/** // tmpExam = processExamMulti(titleAndWorkDesc, answer);
* 基础题型 - [单选题] [多选题] [填空题] [判断题] [主观题] // }
*/ // else {
tmpExam = processExamSingle(titleAndWorkDesc, answer); // /**
} // * 基础题型 - [单选题] [多选题] [填空题] [判断题] [主观题]
} // */
// tmpExam = processExamSingle(titleAndWorkDesc, answer);
// }
// }
if (tmpExam) { 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.workType = "主观题";
examSingle.title = titleAndWorkDesc;
// [选项] - 格式化 --- 主观题无选项 // // [题干]-格式化
//examSingle.arrWorkDesc = []; // examSingle.title = titleAndWorkDesc;
// // [选项] - 格式化 --- 主观题无选项
// //examSingle.arrWorkDesc = [];
// [题目答案] - 处理 --- ['qweasd123'] // [题目答案] - 处理 --- ['qweasd123']
if (answer !== '') { if (answer !== '') {

View File

@ -8,7 +8,7 @@
<el-form ref="questFormRef" :model="questForm" :rules="MainRules" label-width="80px"> <el-form ref="questFormRef" :model="questForm" :rules="MainRules" label-width="80px">
<el-form-item label="题型" prop="worktype"> <el-form-item label="题型" prop="worktype">
<el-select v-model="questForm.worktype" placeholder="请选择题型" style="width:20%" :disabled="questForm.id==0?false:true"> <el-select v-model="questForm.worktype" placeholder="请选择题型" style="width:20%" :disabled="questForm.id==0?false:true">
<el-option v-for="item in fromOptions.type" :key="item.value" :label="item.label" :value="item.label"></el-option> <el-option v-for="item in fromOptions.type" :key="item.value" :label="item.label" :value="item.label" :disabled="item.label=='不限'"></el-option>
</el-select> </el-select>
<el-tag v-if="questForm.worktype=='填空题'" type="danger" style=" margin-left: 10px ">温馨提示填空题题目的填空位置下划线请连续输入3-10个 _ <el-tag v-if="questForm.worktype=='填空题'" type="danger" style=" margin-left: 10px ">温馨提示填空题题目的填空位置下划线请连续输入3-10个 _
符号eg今天___好日子</el-tag> 符号eg今天___好日子</el-tag>
@ -103,7 +103,7 @@
</div> </div>
<!-- 多选题 --> <!-- 多选题 -->
<div v-if="questForm.worktype=='多选题'" class="questForm-item-cover"> <div v-else-if="questForm.worktype=='多选题'" class="questForm-item-cover">
<div v-for="(item,index) in questForm.list" :key='index'> <div v-for="(item,index) in questForm.list" :key='index'>
<el-form-item <el-form-item
:label=Options(1,index) :label=Options(1,index)
@ -134,7 +134,7 @@
</div> </div>
<!-- 填空题 --> <!-- 填空题 -->
<div v-if="questForm.worktype=='填空题'" class="questForm-item-cover"> <div v-else-if="questForm.worktype=='填空题'" class="questForm-item-cover">
<div v-for="(item,index) in questForm.list" :key='index'> <div v-for="(item,index) in questForm.list" :key='index'>
<el-form-item :label=Options(3,index) :prop="`list.${index}.text`" <el-form-item :label=Options(3,index) :prop="`list.${index}.text`"
:rules="{required: true, message: '填空选项不能为空', trigger: 'blur'}"> :rules="{required: true, message: '填空选项不能为空', trigger: 'blur'}">
@ -157,7 +157,7 @@
</div> </div>
<!-- 判断题 --> <!-- 判断题 -->
<div v-if="questForm.worktype=='判断题'" class="questForm-item-cover"> <div v-else-if="questForm.worktype=='判断题'" class="questForm-item-cover">
<div v-for="(item,index) in questForm.list" :key='index'> <div v-for="(item,index) in questForm.list" :key='index'>
<el-form-item <el-form-item
v-if="index==0" v-if="index==0"
@ -176,7 +176,7 @@
</div> </div>
<!-- 主观题 --> <!-- 主观题 -->
<div v-if="questForm.worktype.indexOf('主观题') != -1" class="questForm-item-cover"> <div v-else-if="questForm.worktype.indexOf('主观题') != -1" class="questForm-item-cover">
<el-form-item label="答案"> <el-form-item label="答案">
<Tinymce v-model="questForm.workanswer" :upFileParams="{ <Tinymce v-model="questForm.workanswer" :upFileParams="{
lessionId: lessionid, lessionId: lessionid,
@ -239,7 +239,7 @@
<!-- 复合题 --> <!-- 复合题 -->
<div v-if="questForm.worktype=='复合题'" class="questForm-item-cover"> <div v-else-if="questForm.worktype=='复合题'" class="questForm-item-cover">
<el-form-item label="单项题型" :prop="worktype"> <el-form-item label="单项题型" :prop="worktype">
<el-select v-model="questForm.mulList.worktype" placeholder="请选择题型" style="width:20%"> <el-select v-model="questForm.mulList.worktype" placeholder="请选择题型" style="width:20%">
<!-- <el-option key="1" label="单选题" value="单选题"></el-option> --> <!-- <el-option key="1" label="单选题" value="单选题"></el-option> -->
@ -350,6 +350,19 @@
</div> </div>
</div> </div>
<!-- 非统一标准名称的解答题 -->
<div v-else class="questForm-item-cover">
<el-form-item label="答案">
<Tinymce v-model="questForm.workanswer" :upFileParams="{
lessionId: lessionid,
fileAlias: '单题上传',
}" />
</el-form-item>
<div class="item-cropper-btn">
<el-button v-show="isCropper" circle @click="cropperFormItem('workanswer')"><el-icon><Search /></el-icon></el-button>
</div>
</div>
<!-- 答案分析 --> <!-- 答案分析 -->
<div class="questForm-item-cover"> <div class="questForm-item-cover">
<el-form-item label="答案分析" prop="method"> <el-form-item label="答案分析" prop="method">
@ -623,8 +636,9 @@ onMounted(() => {
// //
if (entpCourseWorkTypeList.length>0) { if (entpCourseWorkTypeList.length>0) {
const flagDict = ['单选题', '多选题', '判断题', '填空题']; //const flagDict = ['', '', '', ''];
fromOptions.type = entpCourseWorkTypeList.filter(item => flagDict.includes(item.label)); //fromOptions.type = entpCourseWorkTypeList.filter(item => flagDict.includes(item.label));
fromOptions.type = entpCourseWorkTypeList
} }
if (entpCourseWorkGroupList.length>0) { if (entpCourseWorkGroupList.length>0) {
fromOptions.flag = entpCourseWorkGroupList; fromOptions.flag = entpCourseWorkGroupList;
@ -748,8 +762,8 @@ const resetForm = () =>{
const updateForm= async(item, submitIndex=0, submitType=1) =>{ const updateForm= async(item, submitIndex=0, submitType=1) =>{
console.log(item,'item'); console.log(item,'item');
// []1 // []1
if (!item.hasOwnProperty('stutus')) { if (!item.hasOwnProperty('status')) {
item.stutus = '1'; item.status = '1';
} }
// [], // [],
if (!item.hasOwnProperty('evalnodeid')) { if (!item.hasOwnProperty('evalnodeid')) {
@ -765,7 +779,6 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{
// 线线() // 线线()
item.title = item.title.replace(/<!--BA--><div class="quizPutTag" contenteditable="true">(?:&nbsp;)?<\/div><!--EA-->/g, '_____'); item.title = item.title.replace(/<!--BA--><div class="quizPutTag" contenteditable="true">(?:&nbsp;)?<\/div><!--EA-->/g, '_____');
if(item.worktype == '复合题') { if(item.worktype == '复合题') {
// [] // []
newList = [{text:""}]; newList = [{text:""}];
@ -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.replace(/\(\)/g, '');
item.worktype = `${item.worktype}(主观题)`; //item.worktype = `${item.worktype}()`;
// //
// //
if(isJson(item.workanswer)){ 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; lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId;
console.log('lessionid', lessionid.value); 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 res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 });
const id = res.rows[0]?.id; const id = res.rows[0]?.id;
if (id) { if (id) {
@ -1083,6 +1098,7 @@ const updateForm= async(item, submitIndex=0, submitType=1) =>{
// status = 1, // status = 1,
// } // }
// emit('update-exam-single', updateStatus); // emit('update-exam-single', updateStatus);
console.log('updateFormone->', questForm)
}; };
const updateFormone=(item, submitIndex, submitType, formdataitem)=>{ const updateFormone=(item, submitIndex, submitType, formdataitem)=>{
@ -1437,14 +1453,9 @@ const submitForm=(formName) =>{
//param.workdesc = questForm.list.map(item => item.text).join('#&'); //param.workdesc = questForm.list.map(item => item.text).join('#&');
param.workdesc = JSON.stringify(questForm.list.map(item => item.text)); 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 === '复合题') { if(questForm.worktype === '复合题') {
// []
let workdesc = []; let workdesc = [];
let answer = []; let answer = [];
// 1.: (, 使form.title) // 1.: (, 使form.title)
@ -1501,9 +1512,33 @@ const submitForm=(formName) =>{
param.workdesc = JSON.stringify(workdesc); param.workdesc = JSON.stringify(workdesc);
param.workanswer = JSON.stringify(answer); 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);
}
// [] "<div></div>#&<div></div>".replace(/<[^>]*>/g, "")
else if(questForm.worktype === '填空题'){
//
//param.workanswer = questForm.list.map(item => item.text).join('#&').replace(/<[^>]*>/g, "");
// [] ([] [][()], ) //
if(questForm.worktype.indexOf('主观题') !== -1) { param.workdesc = '';
param.workanswer = JSON.stringify(questForm.list.map(item => item.text));
}
// []
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 = ''; // param.workdesc = ''; //
// workanswer // workanswer
@ -1533,27 +1568,16 @@ const submitForm=(formName) =>{
// param.workdesc = ''; // // param.workdesc = ''; //
// param.workanswer = JSON.stringify(answer).replace(/<[^>]*>/g, ""); // param.workanswer = JSON.stringify(answer).replace(/<[^>]*>/g, "");
} }
else {
// [] "<div></div>#&<div></div>".replace(/<[^>]*>/g, "") // (), [], ocr
if(questForm.worktype === '填空题'){ param.workdesc = ''; //
// // workanswer
//param.workanswer = questForm.list.map(item => item.text).join('#&').replace(/<[^>]*>/g, ""); if (questForm.workanswer && questForm.workanswer != '') {
param.workanswer = JSON.stringify([questForm.workanswer]);
// }
param.workdesc = '';
param.workanswer = JSON.stringify(questForm.list.map(item => item.text));
} }
// []
if(questForm.worktype === '判断题'){
//
//param.workanswer = questForm.list.map(item => item.text).join('#&').replace(/<[^>]*>/g, "");
//
param.workdesc = '';
param.workanswer = JSON.stringify(questForm.checkAnswer);
}
// , (3) // , (3)
if (questForm.submitType === 3) { if (questForm.submitType === 3) {
@ -1715,18 +1739,21 @@ const formatKnowledgePoint = (list) => {
return 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,'课程选择') console.log(props.bookobj,'课程选择')
// props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId // 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. 语文/英语: 获取学科下的所有知识点(该学科对应无章节与知识点绑定, 故只获取全知识点) * 1. 语文/英语: 获取学科下的所有知识点(该学科对应无章节与知识点绑定, 故只获取全知识点)
* 2. 其他: 获取当前章节下的所有知识点 * 2. 其他: 获取当前章节下的所有知识点
*/ */
let id = props.bookobj.levelSecondId; let id = lessionid.value;
if( props.bookobj.node.edustage == '高中' && (props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语') ){ if( props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语'){
id = props.bookobj.node.rootid; id = props.bookobj.node.rootid;
const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 }); const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 });
id = res.rows[0]?.id; id = res.rows[0]?.id;

View File

@ -58,10 +58,10 @@ import { useGetSubject } from '@/hooks/useGetSubject'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import { debounce } from 'lodash' import { debounce } from 'lodash'
import useUserStore from '@/store/modules/user' // import useUserStore from '@/store/modules/user'
import useClassTaskStore from '@/store/modules/classTask' // import useClassTaskStore from '@/store/modules/classTask'
const userStore = useUserStore() // const userStore = useUserStore()
const classTaskStore = useClassTaskStore(); // const classTaskStore = useClassTaskStore();
const router = useRouter() const router = useRouter()
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
@ -217,7 +217,7 @@ onMounted(async ()=>{
chartInstance = echarts.init(chartDom.value) chartInstance = echarts.init(chartDom.value)
// //
await classTaskStore.initJYInfo(userStore.user); //await classTaskStore.initJYInfo(userStore.user);
const option = { const option = {

View File

@ -98,10 +98,13 @@ import progressDialog from '@/views/teachingDesign/container/progress-dialog.vue
import msgUtils from "@/plugins/modal"; import msgUtils from "@/plugins/modal";
import * as commUtils from "@/utils/comm"; import * as commUtils from "@/utils/comm";
import * as Api_server from "@/api/apiService"; // import * as Api_server from "@/api/apiService"; //
import useClassTaskStore from '@/store/modules/classTask'
const router = useRouter() const router = useRouter()
const userStore = useUserStore().user // const userStore = useUserStore().user //
const currentNode = ref({}) const currentNode = ref({})
const refs = ref([]); const refs = ref([]);
const classTaskStore = useClassTaskStore();
const collectRef = (key) => { const collectRef = (key) => {
return (el) => { return (el) => {
@ -513,7 +516,9 @@ const changeClass = async (type, row, other) => {
} }
// //
onMounted(() => { onMounted(async () => {
//
await classTaskStore.initJYInfo(userStore);
}) })
</script> </script>