|
|
|
@ -11,26 +11,66 @@ const question = defineStore({ |
|
|
|
|
id: 'question', |
|
|
|
|
state: () => ({ |
|
|
|
|
currentCartype: storage.get('carType') || '1001', |
|
|
|
|
orderQuestion: [], //顺序做题
|
|
|
|
|
orderQuestion_subject1: [], //科目一顺序做题
|
|
|
|
|
orderQuestion_subject4:[],//科目二顺序做题
|
|
|
|
|
currentIndex_subject1:0,//科目一索引 顺序做题
|
|
|
|
|
currentIndex_subject4:0,//科目四索引 顺序做题
|
|
|
|
|
curSubject:storage.get('curSubject') || '1' |
|
|
|
|
}), |
|
|
|
|
|
|
|
|
|
actions: { |
|
|
|
|
// 获取顺序做题
|
|
|
|
|
getOrderQuestion(val) { |
|
|
|
|
//改变当前科目
|
|
|
|
|
changeSubject(val){ |
|
|
|
|
this.curSubject=val |
|
|
|
|
storage.set('curSubject',val) |
|
|
|
|
}, |
|
|
|
|
// 获取顺序做题科目1
|
|
|
|
|
getOrderQuestion_sub1() { |
|
|
|
|
this.curSubject='1' |
|
|
|
|
storage.set('curSubject','1') |
|
|
|
|
if(!this.orderQuestion_subject1.length){ |
|
|
|
|
queryQuestion({ |
|
|
|
|
carTypeId: this.currentCartype, |
|
|
|
|
subject: '1', |
|
|
|
|
// questionIdList:[10982,10983,10985,10986]
|
|
|
|
|
}).then(res => { |
|
|
|
|
if (res.code == '0000') { |
|
|
|
|
this.orderQuestion_subject1 = res.data |
|
|
|
|
const falseList =storage.get('wrongList_subject1') || [] |
|
|
|
|
const trueList =storage.get('rightList_subject1')|| [] |
|
|
|
|
const falseArr=[] |
|
|
|
|
const rightArr=[] |
|
|
|
|
this.orderQuestion_subject1.forEach(item=>{ |
|
|
|
|
if(falseList.includes(item.questionId)){ |
|
|
|
|
falseArr.push(item.questionId) |
|
|
|
|
} |
|
|
|
|
if(trueList.includes(item.questionId)){ |
|
|
|
|
rightArr.push(item.questionId) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
storage.set('wrongList_subject1',falseArr) |
|
|
|
|
storage.set('rightList_subject1',rightArr) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取顺序做题科目4
|
|
|
|
|
getOrderQuestion_sub4() { |
|
|
|
|
this.curSubject='4' |
|
|
|
|
storage.set('curSubject','4') |
|
|
|
|
if(!this.orderQuestion_subject4.length){ |
|
|
|
|
queryQuestion({ |
|
|
|
|
carTypeId: this.currentCartype, |
|
|
|
|
subject: val, |
|
|
|
|
subject: '4', |
|
|
|
|
// questionIdList:[10982,10983,10985,10986]
|
|
|
|
|
}).then(res => { |
|
|
|
|
if (res.code == '0000') { |
|
|
|
|
this.orderQuestion = res.data |
|
|
|
|
const falseList =storage.get(`wrongList_subject${val}`) || [] |
|
|
|
|
const trueList =storage.get(`rightList_subject${val}`) || [] |
|
|
|
|
this.orderQuestion_subject4 = res.data |
|
|
|
|
const falseList =storage.get('wrongList_subject4') || [] |
|
|
|
|
const trueList =storage.get('rightList_subject4')|| [] |
|
|
|
|
const falseArr=[] |
|
|
|
|
const rightArr=[] |
|
|
|
|
this.orderQuestion.forEach(item=>{ |
|
|
|
|
this.orderQuestion_subject4.forEach(item=>{ |
|
|
|
|
if(falseList.includes(item.questionId)){ |
|
|
|
|
falseArr.push(item.questionId) |
|
|
|
|
} |
|
|
|
@ -38,12 +78,11 @@ const question = defineStore({ |
|
|
|
|
rightArr.push(item.questionId) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
console.log('falseArr',falseArr); |
|
|
|
|
storage.set(`wrongList_subject${val}`,falseArr) |
|
|
|
|
storage.set(`rightList_subject${val}`,rightArr) |
|
|
|
|
console.log(storage.get(`wrongList_subject${val}`)); |
|
|
|
|
storage.set('wrongList_subject4',falseArr) |
|
|
|
|
storage.set('rightList_subject4',rightArr) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//获取索引
|
|
|
|
|
getCurrentIndex(index,val){ |
|
|
|
|