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