pull/24/head
脆皮鸭 1 year ago
parent 287f123ac7
commit bf05f771f7
  1. 253
      src/jtools/store/question.js
  2. 3
      src/pages.json
  3. 51
      src/pages/index/components/Subject1.vue
  4. 13
      src/pages/index/index.vue
  5. 17
      src/pages/questionBank/chapterExercise.vue
  6. 37
      src/pages/questionBank/components/Question.vue
  7. 17
      src/pages/questionBank/exclusiveExercise.vue
  8. 90
      src/pages/questionBank/practiceExams.vue
  9. 79
      src/pages/questionBank/questionBank.vue

@ -12,212 +12,205 @@ const question = defineStore({
id: 'question', id: 'question',
state: () => ({ state: () => ({
currentCartype: storage.get('carType') || '1001', currentCartype: storage.get('carType') || '1001',
orderQuestion_subject1:storage.get('question_subject1') || [], //科目一顺序做题 orderQuestion_subject1: storage.get('question_subject1') || [], //科目一顺序做题
orderQuestion_subject4:storage.get('question_subject4') ||[],//科目四顺序做题 orderQuestion_subject4: storage.get('question_subject4') || [], //科目四顺序做题
currentIndex_subject1:0,//科目一索引 顺序做题 currentIndex_subject1: 0, //科目一索引 顺序做题
currentIndex_subject4:0,//科目四索引 顺序做题 currentIndex_subject4: 0, //科目四索引 顺序做题
curSubject:storage.get('curSubject') || '1', curSubject: storage.get('curSubject') || '1',
loading_subject1:false, loading_subject1: false,
loading_subject4:false, loading_subject4: false,
version:storage.get('version') || '' version: storage.get('version') || ''
}), }),
actions: { actions: {
getAllQuestion(){ getAllQuestion() {
getVersion(this.currentCartype).then(resp=>{ getVersion(this.currentCartype).then(resp => {
if(resp.code==='0000'){ if (resp.code === '0000') {
if(this.version!=resp.data){ if (this.version != resp.data) {
this.version=resp.data this.version = resp.data
storage.set('version',resp.data) storage.set('version', resp.data)
this.getOrderQuestion_sub1(true) this.getOrderQuestion_sub1(true)
this.getOrderQuestion_sub4(true) this.getOrderQuestion_sub4(true)
}else{ } else {
this.getOrderQuestion_sub1() this.getOrderQuestion_sub1()
this.getOrderQuestion_sub4() this.getOrderQuestion_sub4()
}
} }
})
},
divideArray(array, numChunks) {
var chunkSize = Math.ceil(array.length / numChunks);
var dividedArray = [];
for (var i = 0; i < array.length; i += chunkSize) {
dividedArray.push(array.slice(i, i + chunkSize));
} }
}) return dividedArray;
},
divideArray(array, numChunks) {
var chunkSize = Math.ceil(array.length / numChunks);
var dividedArray = [];
for (var i = 0; i < array.length; i += chunkSize) {
dividedArray.push(array.slice(i, i + chunkSize));
}
return dividedArray;
}, },
//改变当前科目 //改变当前科目
changeSubject(val){ changeSubject(val) {
this.curSubject=val this.curSubject = val
storage.set('curSubject',val) storage.set('curSubject', val)
}, },
// 获取顺序做题科目1 // 获取顺序做题科目1
getOrderQuestion_sub1(isUpdate) { getOrderQuestion_sub1(isUpdate) {
if(isUpdate){ if (isUpdate) {
this.loading_subject1=true this.loading_subject1 = true
queryQuestion({ const that=this
carTypeId: this.currentCartype, uni.request({
subject: '1', url: 'https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E9%A2%98%E5%BA%93/%E5%B0%8F%E8%BD%A6%E7%A7%91%E7%9B%AE%E4%B8%80%E9%A2%98%E5%BA%93.json',
// questionIdList:[10982,10983,10985,10986] success(resp) {
}).then(res => { if (resp.data) {
if (res.code == '0000') { that.orderQuestion_subject1 = resp.data.data
this.loading_subject1=false const diveList = that.divideArray(that.orderQuestion_subject1, 5)
uni.showToast({ that.loading_subject1 = false
title:'题库加载完成!'
})
this.orderQuestion_subject1 = res.data
const diveList=this.divideArray(this.orderQuestion_subject1,5)
uni.setStorageSync('questionOneSub1', diveList[0]) uni.setStorageSync('questionOneSub1', diveList[0])
uni.setStorageSync('questionOneSub2', diveList[1]) uni.setStorageSync('questionOneSub2', diveList[1])
uni.setStorageSync('questionOneSub3', diveList[2]) uni.setStorageSync('questionOneSub3', diveList[2])
uni.setStorageSync('questionOneSub4', diveList[3]) uni.setStorageSync('questionOneSub4', diveList[3])
uni.setStorageSync('questionOneSub5', diveList[4]) uni.setStorageSync('questionOneSub5', diveList[4])
const falseList =storage.get('wrongList_subject1') || [] const falseList = storage.get('wrongList_subject1') || []
const trueList =storage.get('rightList_subject1')|| [] const trueList = storage.get('rightList_subject1') || []
const falseArr=[] const falseArr = []
const rightArr=[] const rightArr = []
this.orderQuestion_subject1.forEach(item=>{ that.orderQuestion_subject1.forEach(item => {
if(falseList.includes(item.questionId)){ if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId) falseArr.push(item.questionId)
} }
if(trueList.includes(item.questionId)){ if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId) rightArr.push(item.questionId)
} }
}) })
storage.set('wrongList_subject1',falseArr) storage.set('wrongList_subject1', falseArr)
storage.set('rightList_subject1',rightArr) storage.set('rightList_subject1', rightArr)
} }
}) }
}else{ })
} else {
const list1 = uni.getStorageSync('questionOneSub1') || [] const list1 = uni.getStorageSync('questionOneSub1') || []
const list2 = uni.getStorageSync('questionOneSub2') || [] const list2 = uni.getStorageSync('questionOneSub2') || []
const list3 = uni.getStorageSync('questionOneSub3') || [] const list3 = uni.getStorageSync('questionOneSub3') || []
const list4 = uni.getStorageSync('questionOneSub4') || [] const list4 = uni.getStorageSync('questionOneSub4') || []
const list5 = uni.getStorageSync('questionOneSub5') || [] const list5 = uni.getStorageSync('questionOneSub5') || []
this.orderQuestion_subject1=[...list1,...list2,...list3,...list4,...list5] this.orderQuestion_subject1 = [...list1, ...list2, ...list3, ...list4, ...list5]
if(this.orderQuestion_subject1&&this.orderQuestion_subject1.length){ if (this.orderQuestion_subject1 && this.orderQuestion_subject1.length) {
}else{ } else {
this.loading_subject1=true this.loading_subject1 = true
queryQuestion({ const that = this
carTypeId: this.currentCartype, uni.request({
subject: '1', url: 'https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E9%A2%98%E5%BA%93/%E5%B0%8F%E8%BD%A6%E7%A7%91%E7%9B%AE%E4%B8%80%E9%A2%98%E5%BA%93.json',
// questionIdList:[10982,10983,10985,10986] success(resp) {
}).then(res => { if (resp.data) {
if (res.code == '0000') { that.orderQuestion_subject1 = resp.data.data
this.loading_subject1=false const diveList = that.divideArray(that.orderQuestion_subject1, 5)
uni.showToast({ that.loading_subject1 = false
title:'题库加载完成!'
})
this.orderQuestion_subject1 = res.data
const diveList=this.divideArray(this.orderQuestion_subject1,5)
uni.setStorageSync('questionOneSub1', diveList[0]) uni.setStorageSync('questionOneSub1', diveList[0])
uni.setStorageSync('questionOneSub2', diveList[1]) uni.setStorageSync('questionOneSub2', diveList[1])
uni.setStorageSync('questionOneSub3', diveList[2]) uni.setStorageSync('questionOneSub3', diveList[2])
uni.setStorageSync('questionOneSub4', diveList[3]) uni.setStorageSync('questionOneSub4', diveList[3])
uni.setStorageSync('questionOneSub5', diveList[4]) uni.setStorageSync('questionOneSub5', diveList[4])
const falseList =storage.get('wrongList_subject1') || [] const falseList = storage.get('wrongList_subject1') || []
const trueList =storage.get('rightList_subject1')|| [] const trueList = storage.get('rightList_subject1') || []
const falseArr=[] const falseArr = []
const rightArr=[] const rightArr = []
this.orderQuestion_subject1.forEach(item=>{ that.orderQuestion_subject1.forEach(item => {
if(falseList.includes(item.questionId)){ if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId) falseArr.push(item.questionId)
} }
if(trueList.includes(item.questionId)){ if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId) rightArr.push(item.questionId)
} }
}) })
storage.set('wrongList_subject1',falseArr) storage.set('wrongList_subject1', falseArr)
storage.set('rightList_subject1',rightArr) storage.set('rightList_subject1', rightArr)
} }
}) }
})
} }
} }
}, },
// 获取顺序做题科目4 // 获取顺序做题科目4
getOrderQuestion_sub4(isUpdate) { getOrderQuestion_sub4(isUpdate) {
if(isUpdate){ if (isUpdate) {
this.loading_subject4=true this.loading_subject4 = true
queryQuestion({ const that = this
carTypeId: this.currentCartype, uni.request({
subject: '4', url: 'https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E9%A2%98%E5%BA%93/%E5%B0%8F%E8%BD%A6%E7%A7%91%E7%9B%AE%E5%9B%9B%E9%A2%98%E5%BA%93.json',
// questionIdList:[10982,10983,10985,10986] success(resp) {
}).then(res => { if (resp.data) {
if (res.code == '0000') { that.orderQuestion_subject4 = resp.data.data
this.loading_subject4=false const diveList = that.divideArray(that.orderQuestion_subject4, 5)
this.orderQuestion_subject4 = res.data that.loading_subject4 = false
const diveList=this.divideArray(this.orderQuestion_subject4,5)
uni.setStorageSync('questionFourSub1', diveList[0]) uni.setStorageSync('questionFourSub1', diveList[0])
uni.setStorageSync('questionFourSub2', diveList[1]) uni.setStorageSync('questionFourSub2', diveList[1])
uni.setStorageSync('questionFourSub3', diveList[2]) uni.setStorageSync('questionFourSub3', diveList[2])
uni.setStorageSync('questionFourSub4', diveList[3]) uni.setStorageSync('questionFourSub4', diveList[3])
uni.setStorageSync('questionFourSub5', diveList[4]) uni.setStorageSync('questionFourSub5', diveList[4])
const falseList =storage.get('wrongList_subject4') || [] const falseList = storage.get('wrongList_subject4') || []
const trueList =storage.get('rightList_subject4')|| [] const trueList = storage.get('rightList_subject4') || []
const falseArr=[] const falseArr = []
const rightArr=[] const rightArr = []
this.orderQuestion_subject4.forEach(item=>{ that.orderQuestion_subject4.forEach(item => {
if(falseList.includes(item.questionId)){ if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId) falseArr.push(item.questionId)
} }
if(trueList.includes(item.questionId)){ if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId) rightArr.push(item.questionId)
} }
}) })
storage.set('wrongList_subject4',falseArr) storage.set('wrongList_subject4', falseArr)
storage.set('rightList_subject4',rightArr) storage.set('rightList_subject4', rightArr)
} }
}) }
}else{ })
} else {
const list1 = uni.getStorageSync('questionFourSub1') || [] const list1 = uni.getStorageSync('questionFourSub1') || []
const list2 = uni.getStorageSync('questionFourSub2') || [] const list2 = uni.getStorageSync('questionFourSub2') || []
const list3 = uni.getStorageSync('questionFourSub3') || [] const list3 = uni.getStorageSync('questionFourSub3') || []
const list4 = uni.getStorageSync('questionFourSub4') || [] const list4 = uni.getStorageSync('questionFourSub4') || []
const list5 = uni.getStorageSync('questionFourSub5') || [] const list5 = uni.getStorageSync('questionFourSub5') || []
this.orderQuestion_subject4=[...list1,...list2,...list3,...list4,...list5] this.orderQuestion_subject4 = [...list1, ...list2, ...list3, ...list4, ...list5]
if(this.orderQuestion_subject4&&this.orderQuestion_subject4.length){ if (this.orderQuestion_subject4 && this.orderQuestion_subject4.length) {
}else{ } else {
this.loading_subject4=true this.loading_subject4 = true
queryQuestion({ const that = this
carTypeId: this.currentCartype, uni.request({
subject: '4', url: 'https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E9%A2%98%E5%BA%93/%E5%B0%8F%E8%BD%A6%E7%A7%91%E7%9B%AE%E5%9B%9B%E9%A2%98%E5%BA%93.json',
// questionIdList:[10982,10983,10985,10986] success(resp) {
}).then(res => { if (resp.data) {
if (res.code == '0000') { that.orderQuestion_subject4 = resp.data.data
this.loading_subject4=false const diveList = that.divideArray(that.orderQuestion_subject4, 5)
this.orderQuestion_subject4 = res.data that.loading_subject4 = false
const diveList=this.divideArray(this.orderQuestion_subject4,5)
uni.setStorageSync('questionFourSub1', diveList[0]) uni.setStorageSync('questionFourSub1', diveList[0])
uni.setStorageSync('questionFourSub2', diveList[1]) uni.setStorageSync('questionFourSub2', diveList[1])
uni.setStorageSync('questionFourSub3', diveList[2]) uni.setStorageSync('questionFourSub3', diveList[2])
uni.setStorageSync('questionFourSub4', diveList[3]) uni.setStorageSync('questionFourSub4', diveList[3])
uni.setStorageSync('questionFourSub5', diveList[4]) uni.setStorageSync('questionFourSub5', diveList[4])
const falseList =storage.get('wrongList_subject4') || [] const falseList = storage.get('wrongList_subject4') || []
const trueList =storage.get('rightList_subject4')|| [] const trueList = storage.get('rightList_subject4') || []
const falseArr=[] const falseArr = []
const rightArr=[] const rightArr = []
this.orderQuestion_subject4.forEach(item=>{ that.orderQuestion_subject4.forEach(item => {
if(falseList.includes(item.questionId)){ if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId) falseArr.push(item.questionId)
} }
if(trueList.includes(item.questionId)){ if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId) rightArr.push(item.questionId)
} }
}) })
storage.set('wrongList_subject4',falseArr) storage.set('wrongList_subject4', falseArr)
storage.set('rightList_subject4',rightArr) storage.set('rightList_subject4', rightArr)
} }
}) }
})
} }
} }
}, },
//获取索引 //获取索引
getCurrentIndex(index,val){ getCurrentIndex(index, val) {
this[`currentIndex_subject${val}`]=index this[`currentIndex_subject${val}`] = index
console.log(`currentIndex_subject${val}`,this[`currentIndex_subject${val}`]);
} }
} }
}); });

@ -8,7 +8,8 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "金武联驾考" "navigationStyle": "custom",
"enablePullDownRefresh": false
} }
}, },
{ {

@ -161,11 +161,18 @@
subject: this.subject, subject: this.subject,
}).then(async (resp) => { }).then(async (resp) => {
if (resp.code === '0000') { if (resp.code === '0000') {
const arr = resp.data if(resp.data&&resp.data.length){
const listJson = JSON.stringify(arr) const arr = resp.data
uni.navigateTo({ const listJson = JSON.stringify(arr)
url: "/pages/index/trueTest?subject="+ this.subject + "&questionIdList=" + listJson uni.navigateTo({
}) url: "/pages/index/trueTest?subject="+ this.subject + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
} else if (resp.code === '4001') { } else if (resp.code === '4001') {
uni.showToast({ uni.showToast({
title: '当前题库非最新版,请更新~', title: '当前题库非最新版,请更新~',
@ -219,22 +226,36 @@
await this.searchUserVip() await this.searchUserVip()
const result = this.vipOnList.some(item => item.subjects.includes(this.subject)) const result = this.vipOnList.some(item => item.subjects.includes(this.subject))
if (result) { if (result) {
const listJson = JSON.stringify(resp.data) if(resp.data&&resp.data.length){
uni.navigateTo({ const listJson = JSON.stringify(resp.data)
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + uni.navigateTo({
"&needVip=" + result + "&questionIdList=" + listJson url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject +
}) "&needVip=" + !result + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
} else { } else {
if (resp.data && resp.data.length > 3) { if (resp.data && resp.data.length > 3) {
const arr = resp.data.slice(0, 3) const arr = resp.data.slice(0, 3)
} else { } else {
const arr = resp.data const arr = resp.data
} }
const listJson = JSON.stringify(arr) if(arr&&arr.length){
uni.navigateTo({ const listJson = JSON.stringify(arr)
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + uni.navigateTo({
"&needVip=" + result + "&questionIdList=" + listJson url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject +
}) "&needVip=" + !result + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
} }
} else { } else {
uni.redirectTo({ uni.redirectTo({

@ -1,7 +1,13 @@
<template> <template>
<view> <view>
<u-loading-page :loading="getLoading" loading-text="题库更新中..."></u-loading-page> <view v-if="getLoading" class="wp100 relative" style="height: 100vh;">
<image class="wp100" mode="widthFix" src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E8%80%83%E8%AF%95%E6%8F%90%E9%86%92_20230906135037.png"></image>
<view class="wp100 flex ai-c jc-c" style="position: absolute;bottom: 0;left: 0;padding-bottom: 124rpx;">
<image style="width: 452rpx;" src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E9%87%91%E6%AD%A6%E8%81%94_20230831123333.png" mode="widthFix"></image>
</view>
</view>
<view v-if="!getLoading"> <view v-if="!getLoading">
<j-navbar :isBack="false">金武联驾考</j-navbar>
<u-sticky bgColor="#fff"> <u-sticky bgColor="#fff">
<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>
@ -57,6 +63,11 @@
computed: { computed: {
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1","curSubject"]), //tagslist ...mapState(useQuestionStore, ["loading_subject4", "loading_subject1","curSubject"]), //tagslist
getLoading() { getLoading() {
if(this.loading_subject4 && this.loading_subject1){
uni.hideTabBar();
}else{
uni.showTabBar()
}
return this.loading_subject4 && this.loading_subject1 return this.loading_subject4 && this.loading_subject1
} }
}, },

@ -49,11 +49,18 @@
...param, ...param,
}).then(async (resp) => { }).then(async (resp) => {
if (resp.code === '0000') { if (resp.code === '0000') {
const arr = resp.data if(resp.data&&resp.data.length){
const listJson = JSON.stringify(arr) const arr = resp.data
uni.navigateTo({ const listJson = JSON.stringify(arr)
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson uni.navigateTo({
}) url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
}else if (resp.code === '4001') { }else if (resp.code === '4001') {
uni.showToast({ uni.showToast({
title: '当前题库非最新版,请更新~', title: '当前题库非最新版,请更新~',

@ -8,9 +8,9 @@
</view> </view>
</view> </view>
<swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false" <swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false"
:disable-programmatic-animation="true" @change="onChange" @animationfinish="onAnimationfinish" @change="onChange" @animationfinish="onAnimationfinish"
@touchend="touchEnd"> @touchend="touchEnd">
<swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesIndex"> <swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesIndex.questionId">
<scroll-view scroll-y="true" class="swiper-scroll"> <scroll-view scroll-y="true" class="swiper-scroll">
<view> <view>
<view class="m14lr"> <view class="m14lr">
@ -18,7 +18,7 @@
<text class="fs18" style="line-height: 42rpx;vertical-align: middle;">{{quesItem.question}}</text> <text class="fs18" style="line-height: 42rpx;vertical-align: middle;">{{quesItem.question}}</text>
</view> </view>
<view class="p14" v-if="quesItem.imageUrl"> <view class="p14" v-if="quesItem.imageUrl">
<image style="width: 100%;" mode="widthFix" :src="quesItem.imageUrl"></image> <image v-show="quesItem.imageUrl" style="width: 100%;height: auto;" mode="widthFix" :lazy-load="true" @load="onoff='1'" :src="quesItem.imageUrl"></image>
</view> </view>
<template v-if="quesItem.type!='3'"> <template v-if="quesItem.type!='3'">
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList" :key="item.op" <view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList" :key="item.op"
@ -99,10 +99,10 @@
</view> </view>
</view> </view>
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect"> <view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
<u-icon name="star-fill" v-if="questionList[topicIndex].isCollect" color="rgb(249,236,141)" <u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
size="24"></u-icon> color="rgb(249,236,141)" size="24"></u-icon>
<u-icon name="star" v-else size="24"></u-icon> <u-icon name="star" v-else size="24"></u-icon>
<text class="cor-666">{{questionList[topicIndex].isCollect?'已收藏':'收藏'}}</text> <text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text>
</view> </view>
<view class="text-center"> <view class="text-center">
<view style="color: #00B74F;">{{rightList.length}}</view> <view style="color: #00B74F;">{{rightList.length}}</view>
@ -191,10 +191,10 @@
</view> </view>
</view> </view>
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect"> <view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
<u-icon name="star-fill" v-if="questionList[topicIndex].isCollect" color="rgb(249,236,141)" <u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
size="24"></u-icon> color="rgb(249,236,141)" size="24"></u-icon>
<u-icon name="star" v-else size="24"></u-icon> <u-icon name="star" v-else size="24"></u-icon>
<text class="cor-666">{{questionList[topicIndex].isCollect?'已收藏':'收藏'}}</text> <text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text>
</view> </view>
<view class="text-center"> <view class="text-center">
<view style="color: #00B74F;">{{rightList.length}}</view> <view style="color: #00B74F;">{{rightList.length}}</view>
@ -212,7 +212,7 @@
</view> </view>
</view> </view>
<view class="flex ai-c jc-fs p14" style="flex-wrap: wrap;max-height: 400px;overflow-y: scroll;"> <view class="flex ai-c jc-fs p14" style="flex-wrap: wrap;max-height: 400px;overflow-y: scroll;">
<view v-for="(item,index) of questionList" :key="index" style="width:20%;" class="flex ai-c jc-c" <view v-for="(item,index) of questionList" :key="item.questionId" style="width:20%;" class="flex ai-c jc-c"
@tap="chooseQueston(index)"> @tap="chooseQueston(index)">
<view class="tCircle mb10" :class="{ <view class="tCircle mb10" :class="{
'active':index == topicIndex, 'active':index == topicIndex,
@ -298,6 +298,7 @@
}, },
data() { data() {
return { return {
onoff:'0',
navTitle: '', navTitle: '',
originArray: '', originArray: '',
showBestAnswer: false, showBestAnswer: false,
@ -355,13 +356,8 @@
const arr = JSON.parse(val) const arr = JSON.parse(val)
let arr1 = [] let arr1 = []
arr.forEach(item => { arr.forEach(item => {
let isCollect = false
if (this.collectList.includes(item.questionId)) {
isCollect = true
}
arr1.push({ arr1.push({
isChoose: false, isChoose: false,
isCollect: isCollect,
...item ...item
}) })
}) })
@ -534,12 +530,9 @@
}) })
}, },
toCollect() { toCollect() {
if (this.questionList[this.topicIndex].isCollect) { if (this.collectList.includes(this.questionList[this.topicIndex].questionId)) {
if (this.collectList.includes(this.questionList[this.topicIndex].questionId)) { const idx = this.collectList.indexOf(this.questionList[this.topicIndex].questionId)
const idx = this.collectList.indexOf(this.questionList[this.topicIndex].questionId) this.collectList.splice(idx, 1)
this.collectList.splice(idx, 1)
}
this.questionList[this.topicIndex].isCollect = false
uni.showToast({ uni.showToast({
title: "取消收藏", title: "取消收藏",
icon: 'none' icon: 'none'
@ -593,6 +586,7 @@
// //
onChange(e) { onChange(e) {
// this.onoff='0'
// //
if (e.detail.source != "touch") return; if (e.detail.source != "touch") return;
@ -742,6 +736,7 @@
} else { } else {
this.questionList = JSON.parse(this.originArray) this.questionList = JSON.parse(this.originArray)
} }
console.log(this.questionList);
if (this.navTitle === '顺序答题') { if (this.navTitle === '顺序答题') {
this.pickerTopic(this[`currentIndex_subject${this.subject}`]) this.pickerTopic(this[`currentIndex_subject${this.subject}`])
} else { } else {

@ -218,11 +218,18 @@
...param, ...param,
}).then(async (resp) => { }).then(async (resp) => {
if (resp.code === '0000') { if (resp.code === '0000') {
const arr = resp.data if(resp.data&&resp.data.length){
const listJson = JSON.stringify(arr) const arr = resp.data
uni.navigateTo({ const listJson = JSON.stringify(arr)
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson uni.navigateTo({
}) url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
}else if (resp.code === '4001') { }else if (resp.code === '4001') {
uni.showToast({ uni.showToast({
title: '当前题库非最新版,请更新~', title: '当前题库非最新版,请更新~',

@ -29,7 +29,7 @@
return { return {
type: '', type: '',
collectList: storage.get(`collectList_subject${this.subject}`) || [], collectList: storage.get(`collectList_subject${this.subject}`) || [],
questionArr:[], questionArr: [],
isShowAll: true, isShowAll: true,
title: "模拟考试", title: "模拟考试",
subject: 1, subject: 1,
@ -53,31 +53,30 @@
if (op.isExam1) { if (op.isExam1) {
param.isExam1 = op.isExam1 param.isExam1 = op.isExam1
} }
if(op.needVip){ if (op.needVip) {
this.isShowAll = op.needVip this.isShowAll = op.needVip
}
let arr=[]
if(op.questionIdList){
const idList=JSON.parse(op.questionIdList)
arr = this[`orderQuestion_subject${this.subject}`].filter(qItem=>idList.includes(qItem.questionId))
} }
let arr = []
arr = [...this[`orderQuestion_subject${this.subject}`]]
let questionObj = {}
arr.forEach(item => { arr.forEach(item => {
let isCollect = false item.isChoose = false
if (this.collectList.includes(item.questionId)) { questionObj[item.questionId] = item
isCollect = true
}
this.questionArr.push({
isChoose: false,
isCollect: isCollect,
...item
})
}) })
if (op.questionIdList) {
const idList = JSON.parse(op.questionIdList)
if (idList && idList.length > 0) {
idList.forEach(item => {
this.questionArr.push(questionObj[item])
})
}
}
this.type = 'exam' this.type = 'exam'
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr),this.title) this.$refs.question.getQuestionList(JSON.stringify(this.questionArr), this.title)
} }
}, },
computed: { computed: {
...mapState(useUserStore, ["vipOnList","token"]), ...mapState(useUserStore, ["vipOnList", "token"]),
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //tagslist ...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //tagslist
}, },
methods: { methods: {
@ -85,48 +84,19 @@
toBack() { toBack() {
this.$refs.question.submitPaper() this.$refs.question.submitPaper()
}, },
changeTab(val) { async changeTab(val) {
if (val == 1) { if (val == 1) {
const param=this.subject=='1'?{isExam1: '1'}:{isExam2: '1'} await this.searchUserVip()
queryQuestionId({ const result = this.vipOnList.some(item => item.subjects.includes(this.subject))
versionId: this.version, if (result) {
carTypeId: storage.get('carType') || '1001', uni.navigateTo({
subject: this.subject, url: "/pages/index/secretPapers?subject=" + this.subject
...param })
}).then(async (resp) => { } else {
if (resp.code === '0000') { uni.navigateTo({
if (this.token) { url: "/pages/index/videoVip?subject=" + this.subject
await this.searchUserVip() })
const result = this.vipOnList.some(item => item.subjects.includes(this.subject)) }
if (result) {
const listJson = JSON.stringify(resp.data)
uni.navigateTo({
url: "/pages/questionBank/practiceExams?title=考前密卷" + "&subject=" + this.subject + "&questionIdList=" + listJson
})
} else {
if (resp.data && resp.data.length > 3) {
const arr = resp.data.slice(0, 3)
} else {
const arr = resp.data
}
const listJson = JSON.stringify(arr)
uni.navigateTo({
url: "/pages/questionBank/practiceExams?title=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson+"&needVip="+result
})
}
} else {
uni.redirectTo({
url: '/pages/login/login'
});
}
} else if (resp.code === '4001') {
uni.showToast({
title: '当前题库非最新版,请更新~',
icon: 'none'
})
this.getAllQuestion()
}
})
} }
} }
} }

@ -28,9 +28,9 @@
}, },
data() { data() {
return { return {
loadTxt:'加载中...', loadTxt: '加载中...',
collectList: storage.get(`collectList_subject${this.subject}`) || [], collectList: storage.get(`collectList_subject${this.subject}`) || [],
loading:false, loading: false,
isShowAll: true, isShowAll: true,
needVip: false, needVip: false,
subject: 1, subject: 1,
@ -46,7 +46,7 @@
} }
}, },
async onLoad(op) { async onLoad(op) {
this.loading=true this.loading = true
if (op.needVip) { if (op.needVip) {
this.needVip = op.needVip this.needVip = op.needVip
} }
@ -55,63 +55,34 @@
} }
if (op && op.navTitle) { if (op && op.navTitle) {
this.navTitle = op.navTitle this.navTitle = op.navTitle
let arr=[] let arr = []
let param={} let param = {}
if(op.needVip){ if (op.needVip) {
this.isShowAll = !Boolean(op.needVip=='true') this.isShowAll = !Boolean(op.needVip == 'true')
}
if (this.navTitle === '顺序答题') {
if (this.subject == '1') {
arr = [...this.orderQuestion_subject1]
} else if (this.subject == '4') {
arr = [...this.orderQuestion_subject4]
}
} else if(op.questionIdList){
const idList=JSON.parse(op.questionIdList)
arr = this[`orderQuestion_subject${this.subject}`].filter(qItem=>idList.includes(qItem.questionId))
}else{
if(op.isVip){
param.isVip=op.isVip
}
const resp=await queryQuestionId({
subject:this.subject,
carTypeId:storage.get('carType') || '1001',
versionId:this.version,
...params
})
let list=[]
if(resp.code==='0000'){
await this.searchUserVip()
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
if (!res) {
list=resp.data.slice(0,3)
}else{
list=resp.data
}
}
if(op.needVip){
this.isShowAll = op.needVip
}
arr=this[`orderQuestion_subject${this.subject}`].filter(qItem=>list.includes(qItem.questionId))
} }
arr = [...this[`orderQuestion_subject${this.subject}`]]
let questionObj={}
arr.forEach(item => { arr.forEach(item => {
let isCollect = false item.isChoose=false
if (this.collectList.includes(item.questionId)) { questionObj[item.questionId]=item
isCollect = true
}
this.questionArr.push({
isChoose: false,
isCollect: isCollect,
...item
})
}) })
this.loading=false if(op.navTitle==='顺序答题'){
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr),this.navTitle) this.questionArr=arr
}else if (op.questionIdList) {
const idList = JSON.parse(op.questionIdList)
if(idList&&idList.length>0){
idList.forEach(item=>{
this.questionArr.push(questionObj[item])
})
}
}
this.loading = false
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr), this.navTitle)
this.$refs.question.getOriginArr(JSON.stringify(this.questionArr)) this.$refs.question.getOriginArr(JSON.stringify(this.questionArr))
} }
}, },
computed: { computed: {
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4","version"]), //tagslist ...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //tagslist
...mapState(useUserStore, ["vipOnList", "token"]), ...mapState(useUserStore, ["vipOnList", "token"]),
}, },
methods: { methods: {
@ -128,7 +99,7 @@
} }
}) })
this.$refs.question.isShowBest(true) this.$refs.question.isShowBest(true)
this.$refs.question.getQuestionList(JSON.stringify(list),this.navTitle) this.$refs.question.getQuestionList(JSON.stringify(list), this.navTitle)
} else { } else {
this.$refs.question.isShowBest(false) this.$refs.question.isShowBest(false)
this.$refs.question.getQuestionList() this.$refs.question.getQuestionList()

Loading…
Cancel
Save