import store from '@/store/index.js'; //需要引入store // Text页面对考题列表questionList数据预处理 const unique = (arr) => { return Array.from(new Set(arr)); } export const ModifyQuesList = function(quesModules) { // store.state.questionList = [] let questionList = [] let queTypeArr = [] quesModules.forEach((item, index) => { let quesType = item.choicesType // 是否答题了 item.selectedFlag = false // 答题的结果 item.tempAnswer = "" // 题目是否做对 item.correctOrError = false queTypeArr.push(quesType) if (item.choicesType == 1 || item.choicesType == 3) { item.dualChooseArr = [] } item.options = item.examSubjectOptions if (item.choicesType == 0 || item.choicesType == 1 || item.choicesType == 3) { item.options.reverse() } questionList.push(item) }) store.state.queTypeArr = unique(queTypeArr) store.state.questionList = questionList }