| | |
| | | import { activeBook } from "@/assets/js/config"; |
| | | import MG from "@/assets/js/middleGround/WebMiddleGroundApi"; |
| | | import getPublicImage from "@/assets/js/middleGround/tool"; |
| | | const getQuestionList = async (questionList) => { |
| | | const getQuestionList = async (oldList,questionList) => { |
| | | let cardList = [ |
| | | { |
| | | catalogName: "单选题", |
| | |
| | | }; |
| | | const res = await MG.store.getProductDetail(query); |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | | let oldObj = {} |
| | | if(oldList) { |
| | | oldObj = oldList.find(item => item.id == qitem) |
| | | } |
| | | const questionObj = { |
| | | number: index + 1, // 题号 |
| | | id: item.id, |
| | |
| | | difficulty: item.Embedded_QuestionBank_Difficulty |
| | | ? 4 - item.Embedded_QuestionBank_Difficulty |
| | | : 0, // 难度等级 |
| | | userAnswer: |
| | | userAnswer:oldObj ? oldObj.userAnswer : |
| | | item.Embedded_QuestionBank_QuestionType == "completion" || |
| | | item.Embedded_QuestionBank_QuestionType == "multipleChoice" |
| | | ? [] |
| | |
| | | } |
| | | }); |
| | | } |
| | | cardList[0].infoList = singleChoiceArr, |
| | | cardList[0].infoList = singleChoiceArr |
| | | cardList[1].infoList = judgeArr |
| | | cardList[2].infoList = multipleChoiceArr |
| | | cardList[3].infoList = completionArr |
| | |
| | | return cardList.filter(item=>item.infoList.length > 0); |
| | | }; |
| | | |
| | | const getQuestionData = async (chapterData) => { |
| | | const getQuestionData = async (chapter,chapterData) => { |
| | | const data = { ...chapterData }; |
| | | const oldAnswerData = localStorage.getItem('oldAnswerData') |
| | | const oldData = oldAnswerData ? JSON.parse(oldAnswerData) :{} |
| | | let oldChapterData |
| | | if(oldData) { |
| | | oldChapterData = oldData[chapter] |
| | | } |
| | | for (let key in chapterData) { |
| | | data[key] = await getQuestionList(chapterData[key]); |
| | | let oldList = [] |
| | | if(oldChapterData) { |
| | | oldList = oldChapterData[key] |
| | | } |
| | | data[key] = await getQuestionList(oldList,chapterData[key]); |
| | | } |
| | | return data; |
| | | }; |