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

106 lines
2.3 KiB

2 years ago
<template>
<view>
2 years ago
<!-- <u-navbar title="模拟考试" @rightClick="rightClick" :autoBack="true">
</u-navbar> -->
2 years ago
<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" />
2 years ago
</view>
</template>
<script>
2 years ago
import {
mapState,
mapActions
} from 'pinia' //引入映射函数
import useUserStore from '@/jtools/store/user'
2 years ago
import {
2 years ago
getTestQuestion
} from '@/jtools/api/question';
import storage from '@/jtools/storage';
2 years ago
import Question from './components/Question.vue';
2 years ago
export default {
2 years ago
components: {
Question
},
2 years ago
data() {
return {
2 years ago
type:'',
isShowAll:true,
title:"模拟考试",
2 years ago
subject:1,
2 years ago
isSubmit:false,
2 years ago
tabsList:[{
label:"模拟考试",
value:0
},{
label:"考前密卷",
value:1
}]
2 years ago
}
},
2 years ago
onLoad(op) {
2 years ago
if(op.title){
this.title=op.title
}
2 years ago
if(op.subject){
this.subject=op.subject
2 years ago
const param={}
if(op.isExam1){
param.isExam1=op.isExam1
}
2 years ago
getTestQuestion({
carTypeId: storage.get('carType') || '1001',
2 years ago
subject: this.subject,
...param
}).then(async (resp)=>{
2 years ago
if(resp.code==='0000'){
2 years ago
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))
2 years ago
}
})
}
2 years ago
},
computed: {
2 years ago
...mapState(useUserStore, ["vipOnList"])
2 years ago
},
2 years ago
methods: {
2 years ago
...mapActions(useUserStore, ['searchUserVip']),
2 years ago
toBack(){
this.$refs.question.submitPaper()
2 years ago
},
changeTab(val){
if(val==1){
uni.navigateTo({
url:"/pages/questionBank/practiceExams?subject="+this.subject+'&title=考前密卷&isExam1=1'
})
}
2 years ago
}
2 years ago
}
}
</script>
2 years ago
<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;
}
2 years ago
::v-deep .balckColor .u-count-down__text{
font-size: 28rpx;
color:#333 !important;
}
2 years ago
</style>