| | |
| | | import MG from "@/assets/js/middleGround/WebMiddleGroundApi"; |
| | | import getPublicImage from "@/assets/js/middleGround/tool"; |
| | | const getQuestionList = async (page, questionList,activeBook) => { |
| | | console.log('page',page); |
| | | const oldAnswerData = localStorage.getItem(activeBook.name + 'oldAnswerData') |
| | | let oldData = null |
| | | let oldList = [] |
| | | console.log("page", page); |
| | | const oldAnswerData = localStorage.getItem(activeBook.name + "oldAnswerData"); |
| | | let oldData = null; |
| | | let oldList = []; |
| | | if(oldAnswerData) { |
| | | oldData = JSON.parse(oldAnswerData) |
| | | oldData = JSON.parse(oldAnswerData); |
| | | } |
| | | if(oldData && oldData[page]) { |
| | | oldList = oldData[page] |
| | | oldList = oldData[page]; |
| | | } |
| | | let cardList = [ |
| | | { |
| | | catalogName: "单选题", |
| | | infoList: [] |
| | | infoList: [], |
| | | }, |
| | | { |
| | | catalogName: "判断题", |
| | | infoList: [] |
| | | infoList: [], |
| | | }, |
| | | { |
| | | catalogName: "多选题", |
| | | infoList: [] |
| | | infoList: [], |
| | | }, |
| | | { |
| | | catalogName: "填空题", |
| | | infoList: [] |
| | | infoList: [], |
| | | }, |
| | | { |
| | | catalogName: "简答题", |
| | | infoList: [] |
| | | } |
| | | infoList: [], |
| | | }, |
| | | ]; |
| | | let singleChoiceArr = []; // 单选 |
| | | let judgeArr = []; // 判断 |
| | | let shortArr = []; // 简答 |
| | | let multipleChoiceArr = []; // 多选 |
| | | let completionArr = []; // 填空 |
| | | // 11 |
| | | for (let qindex = 0; qindex < questionList.length; qindex++) { |
| | | const qitem = questionList[qindex]; |
| | | let query = { |
| | |
| | | Embedded_QuestionBank_StemStyle: [], |
| | | Embedded_QuestionBank_OptionStyle: [], |
| | | Embedded_QuestionBank_KnowledgePoint: [], |
| | | Embedded_QuestionBank_Difficulty: [] |
| | | } |
| | | Embedded_QuestionBank_Difficulty: [], |
| | | }, |
| | | }; |
| | | const res = await MG.store.getProductDetail(query); |
| | | if(!res.datas) return false |
| | | if (!res.datas) return false; |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | | let oldObj = {}; |
| | | if (oldList) { |
| | |
| | | isRight: null, // 是否正确 |
| | | isComplete: false, |
| | | isCollect: true, |
| | | isUnfold: "" |
| | | isUnfold: "", |
| | | }; |
| | | // 多选和填空答案肯为数组,要转换JSON格式 |
| | | if ( |
| | |
| | | if (item == "input") { |
| | | questionObj.stem[i] = { |
| | | num: index, |
| | | data: "input" |
| | | data: "input", |
| | | }; |
| | | questionObj.userAnswer[index] = ""; |
| | | index++; |
| | |
| | | } |
| | | }); |
| | | } |
| | | // 22 |
| | | cardList[0].infoList = singleChoiceArr; |
| | | cardList[1].infoList = judgeArr; |
| | | cardList[2].infoList = multipleChoiceArr; |