| | |
| | | import { activeBook } from "@/assets/js/config"; |
| | | import MG from "@/assets/js/middleGround/WebMiddleGroundApi"; |
| | | import getPublicImage from "@/assets/js/middleGround/tool"; |
| | | const getQuestionList = async (oldList, questionList) => { |
| | | const getQuestionList = async (page, questionList,activeBook) => { |
| | | console.log('page',page); |
| | | const oldAnswerData = localStorage.getItem(activeBook.name + 'oldAnswerData') |
| | | let oldData = null |
| | | let oldList = [] |
| | | if(oldAnswerData) { |
| | | oldData = JSON.parse(oldAnswerData) |
| | | } |
| | | if(oldData && oldData[page]) { |
| | | oldList = oldData[page] |
| | | } |
| | | let cardList = [ |
| | | { |
| | | catalogName: "单选题", |
| | |
| | | let shortArr = []; // 简答 |
| | | let multipleChoiceArr = []; // 多选 |
| | | let completionArr = []; // 填空 |
| | | console.log("active", activeBook); |
| | | for (let qindex = 0; qindex < questionList.length; qindex++) { |
| | | const qitem = questionList[qindex]; |
| | | let query = { |
| | | storeInfo: activeBook.storeRefcode, |
| | | path: "*", |
| | | cmsPath: activeBook.rootCmsItemId, |
| | | cmsType: "*", |
| | |
| | | } |
| | | }; |
| | | const res = await MG.store.getProductDetail(query); |
| | | if(!res.datas) return false |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | | let oldObj = {}; |
| | | if (oldList) { |
| | |
| | | return cardList.filter((item) => item.infoList.length > 0); |
| | | }; |
| | | |
| | | const getQuestionData = async (chapter, chapterData) => { |
| | | const getQuestionData = async (chapter, chapterData,activeBook) => { |
| | | const data = { ...chapterData }; |
| | | const oldAnswerData = localStorage.getItem("oldAnswerData"); |
| | | const oldData = oldAnswerData ? JSON.parse(oldAnswerData) : {}; |
| | |
| | | if (oldChapterData) { |
| | | oldList = oldChapterData[key]; |
| | | } |
| | | data[key] = await getQuestionList(oldList, chapterData[key]); |
| | | data[key] = await getQuestionList(oldList, chapterData[key],activeBook); |
| | | } |
| | | return data; |
| | | }; |
| | | |
| | | export default getQuestionData; |
| | | export default getQuestionList; |