You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
jwl-applet/src/pages/questionBank/practiceExams.vue

105 lines
2.3 KiB

<template>
<view>
<!-- <u-navbar title="模拟考试" @rightClick="rightClick" :autoBack="true">
</u-navbar> -->
<j-navbar :isDefineBack="true" @toBack="toBack">{{title}}</j-navbar>
<Question ref="question" :tabsList="tabsList" v-model:isSubmit="isSubmit" :type="type" :isShowAll="isShowAll" :subject="subject" :navTitle="title" @changeTab="changeTab" />
</view>
</template>
<script>
import {
mapState,
mapActions
} from 'pinia' //引入映射函数
import useUserStore from '@/jtools/store/user'
import {
getTestQuestion
} from '@/jtools/api/question';
import storage from '@/jtools/storage';
import Question from './components/Question.vue';
export default {
components: {
Question
},
data() {
return {
type:'',
isShowAll:true,
title:"模拟考试",
subject:1,
isSubmit:false,
tabsList:[{
label:"模拟考试",
value:0
},{
label:"考前密卷",
value:1
}]
}
},
onLoad(op) {
if(op.title){
this.title=op.title
}
if(op.subject){
this.subject=op.subject
const param={}
if(op.isExam1){
param.isExam1=op.isExam1
}
getTestQuestion({
carTypeId: storage.get('carType') || '1001',
subject: this.subject,
...param
}).then(async (resp)=>{
if(resp.code==='0000'){
let arr=resp.data
if(this.title==='考前密卷'){
await this.searchUserVip()
const res = this.vipOnList.some(item => item.subjects == this.subject)
if (!res) {
arr = arr.slice(0, 3)
this.isShowAll = false
}
}
this.type='exam'
this.$refs.question.getQuestionList(JSON.stringify(arr))
}
})
}
},
computed: {
...mapState(useUserStore, ["vipOnList"])
},
methods: {
...mapActions(useUserStore, ['searchUserVip']),
toBack(){
this.$refs.question.submitPaper()
},
changeTab(val){
if(val==1){
uni.navigateTo({
url:"/pages/questionBank/practiceExams?subject="+this.subject+'&title=考前密卷&isExam1=1'
})
}
}
}
}
</script>
<style scoped>
::v-deep .u-count-down{
font-size: 28rpx;
color:#fff !important;
display: inline-block !important;
}
::v-deep .u-count-down__text{
font-size: 28rpx;
color:#fff !important;
}
::v-deep .balckColor .u-count-down__text{
font-size: 28rpx;
color:#333 !important;
}
</style>