|
|
|
@ -4,11 +4,11 @@ |
|
|
|
|
<u-tabs :list="categoryList" :current="curTab" :scrollable="false" @change="changeCategory"></u-tabs> |
|
|
|
|
</u-sticky> |
|
|
|
|
<view style="height: 100vh;background-color: rgb(245, 245, 245);"> |
|
|
|
|
<template v-if="tIndex===0 || tIndex===3"> |
|
|
|
|
<Subject1 :subject="tIndex+1" :rightList="rightList" :wrongList="wrongList" /> |
|
|
|
|
<template v-if="subject=='1' || subject=='4'"> |
|
|
|
|
<Subject1 :subject="subject" :rightList="rightList" :wrongList="wrongList" /> |
|
|
|
|
</template> |
|
|
|
|
<template v-else> |
|
|
|
|
<subject2 :subject="tIndex+1" ref="subjectRef" /> |
|
|
|
|
<subject2 :subject="subject" ref="subjectRef" /> |
|
|
|
|
</template> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -17,53 +17,66 @@ |
|
|
|
|
import { mapState,mapActions } from 'pinia' //引入映射函数 |
|
|
|
|
import useQuestionStore from '@/jtools/store/question' //引入store |
|
|
|
|
import storage from '@/jtools/storage'; |
|
|
|
|
import { |
|
|
|
|
querySysConfigList, |
|
|
|
|
} from '@/jtools/api/question'; |
|
|
|
|
import Subject1 from "./components/Subject1"; |
|
|
|
|
import Subject2 from "./components/Subject2"; |
|
|
|
|
export default { |
|
|
|
|
components: {Subject1,Subject2}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
subject:storage.get('curSubject') || '1', |
|
|
|
|
curTab:Number(storage.get('curSubject'))-1, |
|
|
|
|
tIndex:Number(storage.get('curSubject'))-1, |
|
|
|
|
searchValue:'', |
|
|
|
|
cityName:'', |
|
|
|
|
categoryList:[{ |
|
|
|
|
name:'科目1' |
|
|
|
|
},{ |
|
|
|
|
name:'科目2' |
|
|
|
|
},{ |
|
|
|
|
name:'科目3' |
|
|
|
|
},{ |
|
|
|
|
name:'科目4' |
|
|
|
|
}], |
|
|
|
|
rightList:storage.get(`rightList_subject${this.tIndex+1}`) || [], |
|
|
|
|
wrongList:storage.get(`wrongList_subject${this.tIndex+1}`) || [], |
|
|
|
|
categoryList:[], |
|
|
|
|
rightList:storage.get(`rightList_subject${this.subject}`) || [], |
|
|
|
|
wrongList:storage.get(`wrongList_subject${this.subject}`) || [], |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
onLoad(){ |
|
|
|
|
this.getSubjectConfig() |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
if(this.tIndex==0||this.tIndex==3){ |
|
|
|
|
this.rightList=storage.get(`rightList_subject${this.tIndex+1}`) || [] |
|
|
|
|
this.wrongList=storage.get(`wrongList_subject${this.tIndex+1}`) || [] |
|
|
|
|
if(this.subject=='1'||this.subject=='4'){ |
|
|
|
|
this.rightList=storage.get(`rightList_subject${this.subject}`) || [] |
|
|
|
|
this.wrongList=storage.get(`wrongList_subject${this.subject}`) || [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods:{ |
|
|
|
|
...mapActions(useQuestionStore,['getOrderQuestion_sub4','getOrderQuestion_sub1','changeSubject']), |
|
|
|
|
//获取科目配置 |
|
|
|
|
getSubjectConfig(){ |
|
|
|
|
const carTypeId=storage.get('carType') || '1001' |
|
|
|
|
querySysConfigList(carTypeId,'Subject').then(resp=>{ |
|
|
|
|
if(resp.code==='0000'){ |
|
|
|
|
this.categoryList=resp.data.map(item=>{ |
|
|
|
|
return{ |
|
|
|
|
...item, |
|
|
|
|
name:item.configItemName |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//切换科目 |
|
|
|
|
async changeCategory(val){ |
|
|
|
|
this.tIndex=val.index |
|
|
|
|
if(this.tIndex==0){ |
|
|
|
|
this.subject=val.configItemCode |
|
|
|
|
console.log(); |
|
|
|
|
if(this.subject=='1'){ |
|
|
|
|
await this.getOrderQuestion_sub1() |
|
|
|
|
}else if(this.tIndex==3){ |
|
|
|
|
}else if(this.subject=='4'){ |
|
|
|
|
await this.getOrderQuestion_sub4() |
|
|
|
|
}else{ |
|
|
|
|
this.changeSubject(val.index+1) |
|
|
|
|
this.changeSubject(this.subject) |
|
|
|
|
setTimeout(()=>{ |
|
|
|
|
this.$refs.subjectRef.getDiverType() |
|
|
|
|
},100) |
|
|
|
|
} |
|
|
|
|
if(this.tIndex==0||this.tIndex==3){ |
|
|
|
|
this.rightList=storage.get(`rightList_subject${this.tIndex+1}`) || [] |
|
|
|
|
this.wrongList=storage.get(`wrongList_subject${this.tIndex+1}`) || [] |
|
|
|
|
if(this.subject=='1'||this.subject=='4'){ |
|
|
|
|
this.rightList=storage.get(`rightList_subject${this.subject}`) || [] |
|
|
|
|
this.wrongList=storage.get(`wrongList_subject${this.subject}`) || [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|