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/exclusiveExercise.vue

309 lines
8.7 KiB

2 years ago
<template>
2 years ago
<view>
<u-loading-page :loading="getLoading" loading-text="题库更新中..."></u-loading-page>
<view class="p14" v-if="!getLoading">
<view class="flex jc-sb">
<view class="relative mr5" @tap="toIconSkill">
<image style="width: 336rpx;height: 152rpx;" src="../../static/image/practice/errorprone_bg.png">
</image>
<view style="position: absolute;left: 0;top: 0;" class="p10">
<view style="color: #04B13B;font-size: 18px;">图标技巧</view>
<text style="color: #04B13B;font-size: 14px;">快速记忆</text>
</view>
2 years ago
</view>
2 years ago
<view class="relative ml5" @tap="toChapterSkill">
<image style="width: 363rpx;height: 170rpx;" src="../../static/image/practice/chapter_bg.png"></image>
<view style="position: absolute;left: 0;top: 0;" class="p10">
<view style="color: #FF6E02;font-size: 18px;">章节练习</view>
2 years ago
<text style="color: #FF6E02;font-size: 14px;">{{chapterNum}}</text>
2 years ago
</view>
2 years ago
</view>
</view>
2 years ago
<view class="bc-fff pt14" style="border-radius: 20rpx;">
<u-grid :border="false" col="4">
<u-grid-item v-for="(listItem,listIndex) in list" :key="listIndex"
@click="toAnswer(listItem.title,listItem.isError,listItem.isNew)">
<view class="mb5" style="width: 84rpx;height: 84rpx;">
<image style="width: 84rpx;height:84rpx;" mode="heightFix" :src="listItem.image"></image>
</view>
<text class="grid-text fs14 cor-000">{{listItem.title}}</text>
<text class="grid-text mb10 fs12 cor-999">{{listItem.subTitle}}</text>
</u-grid-item>
</u-grid>
</view>
<view class="mt14 p14 bc-fff" style="border-radius: 20rpx;">
<text class="fs18 cor-000 fw600">常见考点</text>
<view class="flex ai-c wp100 mt10" style="flex-wrap: wrap;">
<view class="wp50 flex ai-c p15tb" style="border-bottom: 1rpx solid #DDDCDC;"
v-for="(item,index) of testCenterList" :key="index" @tap="toQuestionBank(item)">
<view class="dot_item">{{index+1}}</view>
<text class="ml5 topic_cont_text" style="width: calc(100% - 65rpx);">{{item.configItemName}}</text>
2 years ago
</view>
</view>
</view>
</view>
2 years ago
2 years ago
</view>
</template>
<script>
import errorIcon from "../../static/image/practice/error_icon.png"
import newRulesIcon from "../../static/image/practice/newRules_icon.png"
import neverWriteIcon from "../../static/image/practice/neverWrite_icon.png"
2 years ago
import danxuanIcon from "../../static/image/index/danxuan.png"
import panduanIcon from "../../static/image/index/panduan.png"
import tupianIcon from "../../static/image/index/tupian.png"
2 years ago
import {
querySysConfigList,
2 years ago
querySpecialNum,
queryQuestionId
2 years ago
} from '@/jtools/api/question';
2 years ago
import {
mapState,
mapActions
} from 'pinia' //引入映射函数
import useQuestionStore from '@/jtools/store/question' //引入store
2 years ago
import storage from '@/jtools/storage';
2 years ago
export default {
data() {
return {
2 years ago
chapterNum:0,
2 years ago
errorIcon,
newRulesIcon,
neverWriteIcon,
2 years ago
list: [{
title: '新规题',
subTitle: '392题',
isNew: 1,
isError: 0,
image: newRulesIcon
}, {
title: '易错题',
isNew: 0,
isError: 1,
subTitle: '392题',
image: errorIcon
}, {
title: '单选题',
subTitle: '392题',
isNew: 0,
isError: 0,
image: danxuanIcon
}, {
title: '判断题',
subTitle: '392题',
isNew: 0,
isError: 0,
image: panduanIcon
}, {
title: '图片题',
subTitle: '392题',
isNew: 0,
isError: 0,
image: tupianIcon
2 years ago
}],
2 years ago
testCenterList: [],
subject: '1'
2 years ago
}
},
2 years ago
onLoad(op) {
if (op.subject) {
this.subject = op.subject
2 years ago
}
2 years ago
this.getExamPoint()
2 years ago
this.getQuestionNum()
2 years ago
this.getChapterList()
2 years ago
},
2 years ago
computed: {
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1", "version"]), //映射函数,取出tagslist
getLoading() {
return this.loading_subject4 && this.loading_subject1
}
},
2 years ago
methods: {
2 years ago
...mapActions(useQuestionStore, ['getAllQuestion']),
2 years ago
getChapterList(){
const carTypeId=storage.get('carType') || '1001'
const key=this.subject=='1'?'ChapterOfSubjectOne':'ChapterOfSubjectFour'
querySysConfigList(carTypeId,'ChapterOfSubjectOne').then(resp=>{
if(resp.code==='0000'&&resp.data){
this.chapterNum=resp.data.length
}
})
},
2 years ago
getQuestionNum() {
2 years ago
querySpecialNum({
2 years ago
carTypeId: storage.get('carType') || '1001',
subject: this.subject
}).then(resp => {
if (resp.code === '0000') {
if (this.subject == '1') {
this.list = [{
title: '新规题',
subTitle: resp.data.newQuestionNum + '题',
isNew: 1,
isError: 0,
image: newRulesIcon,
}, {
title: '易错题',
isNew: 0,
isError: 1,
subTitle: resp.data.errorQuestionNum + '题',
image: errorIcon,
}, {
title: '单选题',
subTitle: resp.data.radioQuestionNum + '题',
isNew: 0,
isError: 0,
image: danxuanIcon,
}, {
title: '判断题',
subTitle: resp.data.judgeQuestionNum + '题',
isNew: 0,
isError: 0,
image: panduanIcon,
}, {
title: '图片题',
subTitle: resp.data.imageQuestionNum + '题',
isNew: 0,
isError: 0,
image: tupianIcon,
2 years ago
}]
2 years ago
} else {
this.list = [{
title: '新规题',
subTitle: resp.data.newQuestionNum + '题',
isNew: 1,
isError: 0,
image: newRulesIcon
}, {
title: '易错题',
isNew: 0,
isError: 1,
subTitle: resp.data.errorQuestionNum + '题',
image: errorIcon,
}, {
title: '单选题',
subTitle: resp.data.radioQuestionNum + '题',
isNew: 0,
isError: 0,
image: danxuanIcon,
}, {
title: '多选题',
subTitle: resp.data.multipleChoiceQuestionNum + '题',
isNew: 0,
isError: 0,
image: neverWriteIcon
}, {
title: '判断题',
subTitle: resp.data.judgeQuestionNum + '题',
isNew: 0,
isError: 0,
image: panduanIcon,
}, {
title: '图片题',
subTitle: resp.data.imageQuestionNum + '题',
isNew: 0,
isError: 0,
image: tupianIcon,
2 years ago
}]
}
2 years ago
2 years ago
}
})
},
2 years ago
getExamPoint() {
const carTypeId = storage.get('carType') || '1001'
const examKey = this.subject == '1' ? 'ExamKeysOfSubjectOne' : 'ExamKeysOfSubjectFour'
querySysConfigList(carTypeId, examKey).then(resp => {
if (resp.code === '0000') {
this.testCenterList = resp.data
2 years ago
}
})
},
2 years ago
getQuestion(param,title) {
queryQuestionId({
versionId: this.version,
carTypeId: storage.get('carType') || '1001',
subject: this.subject,
...param,
}).then(async (resp) => {
if (resp.code === '0000') {
2 years ago
if(resp.data&&resp.data.length){
const arr = resp.data
const listJson = JSON.stringify(arr)
uni.navigateTo({
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
2 years ago
}else if (resp.code === '4001') {
uni.showToast({
title: '当前题库非最新版,请更新~',
icon: 'none'
2 years ago
})
2 years ago
this.getAllQuestion()
2 years ago
}
2 years ago
})
},
toAnswer(title, isError, isNew) {
if (title == '单选题') {
this.getQuestion({type:'2'},title)
} else if (title == '多选题') {
this.getQuestion({type:'3'},title)
} else if (title == '判断题') {
this.getQuestion({type:'1'},title)
} else if (title == '图片题') {
this.getQuestion({isImage:'1'},title)
} else {
this.getQuestion({isNew:isNew,isError:isError},title)
2 years ago
}
2 years ago
},
toQuestionBank(val) {
this.getQuestion({examKey:val.configItemCode},val.configItemName)
},
toIconSkill() {
uni.navigateTo({
url: "/pages/index/iconSkill"
})
},
toChapterSkill() {
uni.navigateTo({
url: "/pages/questionBank/chapterExercise?subject="+this.subject
})
2 years ago
}
}
2 years ago
}
2 years ago
</script>
<style scoped>
2 years ago
.dot_item {
width: 40rpx;
height: 40rpx;
line-height: 41rpx;
color: #fff;
text-align: center;
background: #0BD032;
border-radius: 50%;
}
.topic_cont_text {
height: 45rpx;
2 years ago
overflow: hidden;
2 years ago
word-break: break-all;
/* break-all(允许在单词内换行。) */
text-overflow: ellipsis;
/* 超出部分省略号 */
display: -webkit-box;
/** 对象作为伸缩盒子模型显示 **/
-webkit-box-orient: vertical;
/** 设置或检索伸缩盒对象的子元素的排列方式 **/
-webkit-line-clamp: 1;
/** 显示的行数 **/
2 years ago
}
2 years ago
</style>