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

@ -56,18 +56,14 @@ const question = defineStore({
getOrderQuestion_sub1(isUpdate) {
if (isUpdate) {
this.loading_subject1 = true
queryQuestion({
carTypeId: this.currentCartype,
subject: '1',
// questionIdList:[10982,10983,10985,10986]
}).then(res => {
if (res.code == '0000') {
this.loading_subject1=false
uni.showToast({
title:'题库加载完成!'
})
this.orderQuestion_subject1 = res.data
const diveList=this.divideArray(this.orderQuestion_subject1,5)
const that=this
uni.request({
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',
success(resp) {
if (resp.data) {
that.orderQuestion_subject1 = resp.data.data
const diveList = that.divideArray(that.orderQuestion_subject1, 5)
that.loading_subject1 = false
uni.setStorageSync('questionOneSub1', diveList[0])
uni.setStorageSync('questionOneSub2', diveList[1])
uni.setStorageSync('questionOneSub3', diveList[2])
@ -77,7 +73,7 @@ const question = defineStore({
const trueList = storage.get('rightList_subject1') || []
const falseArr = []
const rightArr = []
this.orderQuestion_subject1.forEach(item=>{
that.orderQuestion_subject1.forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId)
}
@ -88,6 +84,7 @@ const question = defineStore({
storage.set('wrongList_subject1', falseArr)
storage.set('rightList_subject1', rightArr)
}
}
})
} else {
const list1 = uni.getStorageSync('questionOneSub1') || []
@ -100,18 +97,14 @@ const question = defineStore({
} else {
this.loading_subject1 = true
queryQuestion({
carTypeId: this.currentCartype,
subject: '1',
// questionIdList:[10982,10983,10985,10986]
}).then(res => {
if (res.code == '0000') {
this.loading_subject1=false
uni.showToast({
title:'题库加载完成!'
})
this.orderQuestion_subject1 = res.data
const diveList=this.divideArray(this.orderQuestion_subject1,5)
const that = this
uni.request({
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',
success(resp) {
if (resp.data) {
that.orderQuestion_subject1 = resp.data.data
const diveList = that.divideArray(that.orderQuestion_subject1, 5)
that.loading_subject1 = false
uni.setStorageSync('questionOneSub1', diveList[0])
uni.setStorageSync('questionOneSub2', diveList[1])
uni.setStorageSync('questionOneSub3', diveList[2])
@ -121,7 +114,7 @@ const question = defineStore({
const trueList = storage.get('rightList_subject1') || []
const falseArr = []
const rightArr = []
this.orderQuestion_subject1.forEach(item=>{
that.orderQuestion_subject1.forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId)
}
@ -132,6 +125,7 @@ const question = defineStore({
storage.set('wrongList_subject1', falseArr)
storage.set('rightList_subject1', rightArr)
}
}
})
}
}
@ -140,15 +134,14 @@ const question = defineStore({
getOrderQuestion_sub4(isUpdate) {
if (isUpdate) {
this.loading_subject4 = true
queryQuestion({
carTypeId: this.currentCartype,
subject: '4',
// questionIdList:[10982,10983,10985,10986]
}).then(res => {
if (res.code == '0000') {
this.loading_subject4=false
this.orderQuestion_subject4 = res.data
const diveList=this.divideArray(this.orderQuestion_subject4,5)
const that = this
uni.request({
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',
success(resp) {
if (resp.data) {
that.orderQuestion_subject4 = resp.data.data
const diveList = that.divideArray(that.orderQuestion_subject4, 5)
that.loading_subject4 = false
uni.setStorageSync('questionFourSub1', diveList[0])
uni.setStorageSync('questionFourSub2', diveList[1])
uni.setStorageSync('questionFourSub3', diveList[2])
@ -158,7 +151,7 @@ const question = defineStore({
const trueList = storage.get('rightList_subject4') || []
const falseArr = []
const rightArr = []
this.orderQuestion_subject4.forEach(item=>{
that.orderQuestion_subject4.forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId)
}
@ -169,6 +162,7 @@ const question = defineStore({
storage.set('wrongList_subject4', falseArr)
storage.set('rightList_subject4', rightArr)
}
}
})
} else {
const list1 = uni.getStorageSync('questionFourSub1') || []
@ -181,15 +175,14 @@ const question = defineStore({
} else {
this.loading_subject4 = true
queryQuestion({
carTypeId: this.currentCartype,
subject: '4',
// questionIdList:[10982,10983,10985,10986]
}).then(res => {
if (res.code == '0000') {
this.loading_subject4=false
this.orderQuestion_subject4 = res.data
const diveList=this.divideArray(this.orderQuestion_subject4,5)
const that = this
uni.request({
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',
success(resp) {
if (resp.data) {
that.orderQuestion_subject4 = resp.data.data
const diveList = that.divideArray(that.orderQuestion_subject4, 5)
that.loading_subject4 = false
uni.setStorageSync('questionFourSub1', diveList[0])
uni.setStorageSync('questionFourSub2', diveList[1])
uni.setStorageSync('questionFourSub3', diveList[2])
@ -199,7 +192,7 @@ const question = defineStore({
const trueList = storage.get('rightList_subject4') || []
const falseArr = []
const rightArr = []
this.orderQuestion_subject4.forEach(item=>{
that.orderQuestion_subject4.forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId)
}
@ -210,6 +203,7 @@ const question = defineStore({
storage.set('wrongList_subject4', falseArr)
storage.set('rightList_subject4', rightArr)
}
}
})
}
}
@ -217,7 +211,6 @@ const question = defineStore({
//获取索引
getCurrentIndex(index, val) {
this[`currentIndex_subject${val}`] = index
console.log(`currentIndex_subject${val}`,this[`currentIndex_subject${val}`]);
}
}
});

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

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

@ -1,7 +1,13 @@
<template>
<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">
<j-navbar :isBack="false">金武联驾考</j-navbar>
<u-sticky bgColor="#fff">
<u-tabs :list="categoryList" :current="curTab" :scrollable="false" @change="changeCategory"></u-tabs>
</u-sticky>
@ -57,6 +63,11 @@
computed: {
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1","curSubject"]), //tagslist
getLoading() {
if(this.loading_subject4 && this.loading_subject1){
uni.hideTabBar();
}else{
uni.showTabBar()
}
return this.loading_subject4 && this.loading_subject1
}
},

@ -49,11 +49,18 @@
...param,
}).then(async (resp) => {
if (resp.code === '0000') {
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'
})
}
}else if (resp.code === '4001') {
uni.showToast({
title: '当前题库非最新版,请更新~',

@ -8,9 +8,9 @@
</view>
</view>
<swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false"
:disable-programmatic-animation="true" @change="onChange" @animationfinish="onAnimationfinish"
@change="onChange" @animationfinish="onAnimationfinish"
@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">
<view>
<view class="m14lr">
@ -18,7 +18,7 @@
<text class="fs18" style="line-height: 42rpx;vertical-align: middle;">{{quesItem.question}}</text>
</view>
<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>
<template v-if="quesItem.type!='3'">
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList" :key="item.op"
@ -99,10 +99,10 @@
</view>
</view>
<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)"
size="24"></u-icon>
<u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
color="rgb(249,236,141)" 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 class="text-center">
<view style="color: #00B74F;">{{rightList.length}}</view>
@ -191,10 +191,10 @@
</view>
</view>
<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)"
size="24"></u-icon>
<u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
color="rgb(249,236,141)" 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 class="text-center">
<view style="color: #00B74F;">{{rightList.length}}</view>
@ -212,7 +212,7 @@
</view>
</view>
<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)">
<view class="tCircle mb10" :class="{
'active':index == topicIndex,
@ -298,6 +298,7 @@
},
data() {
return {
onoff:'0',
navTitle: '',
originArray: '',
showBestAnswer: false,
@ -355,13 +356,8 @@
const arr = JSON.parse(val)
let arr1 = []
arr.forEach(item => {
let isCollect = false
if (this.collectList.includes(item.questionId)) {
isCollect = true
}
arr1.push({
isChoose: false,
isCollect: isCollect,
...item
})
})
@ -534,12 +530,9 @@
})
},
toCollect() {
if (this.questionList[this.topicIndex].isCollect) {
if (this.collectList.includes(this.questionList[this.topicIndex].questionId)) {
const idx = this.collectList.indexOf(this.questionList[this.topicIndex].questionId)
this.collectList.splice(idx, 1)
}
this.questionList[this.topicIndex].isCollect = false
uni.showToast({
title: "取消收藏",
icon: 'none'
@ -593,6 +586,7 @@
//
onChange(e) {
// this.onoff='0'
//
if (e.detail.source != "touch") return;
@ -742,6 +736,7 @@
} else {
this.questionList = JSON.parse(this.originArray)
}
console.log(this.questionList);
if (this.navTitle === '顺序答题') {
this.pickerTopic(this[`currentIndex_subject${this.subject}`])
} else {

@ -218,11 +218,18 @@
...param,
}).then(async (resp) => {
if (resp.code === '0000') {
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'
})
}
}else if (resp.code === '4001') {
uni.showToast({
title: '当前题库非最新版,请更新~',

@ -57,21 +57,20 @@
this.isShowAll = op.needVip
}
let arr = []
arr = [...this[`orderQuestion_subject${this.subject}`]]
let questionObj = {}
arr.forEach(item => {
item.isChoose = false
questionObj[item.questionId] = item
})
if (op.questionIdList) {
const idList = JSON.parse(op.questionIdList)
arr = this[`orderQuestion_subject${this.subject}`].filter(qItem=>idList.includes(qItem.questionId))
if (idList && idList.length > 0) {
idList.forEach(item => {
this.questionArr.push(questionObj[item])
})
}
arr.forEach(item => {
let isCollect = false
if (this.collectList.includes(item.questionId)) {
isCollect = true
}
this.questionArr.push({
isChoose: false,
isCollect: isCollect,
...item
})
})
this.type = 'exam'
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr), this.title)
}
@ -85,48 +84,19 @@
toBack() {
this.$refs.question.submitPaper()
},
changeTab(val) {
async changeTab(val) {
if (val == 1) {
const param=this.subject=='1'?{isExam1: '1'}:{isExam2: '1'}
queryQuestionId({
versionId: this.version,
carTypeId: storage.get('carType') || '1001',
subject: this.subject,
...param
}).then(async (resp) => {
if (resp.code === '0000') {
if (this.token) {
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
url: "/pages/index/secretPapers?subject=" + this.subject
})
} 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'
url: "/pages/index/videoVip?subject=" + this.subject
})
this.getAllQuestion()
}
})
}
}
}

@ -60,51 +60,22 @@
if (op.needVip) {
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]
}
arr = [...this[`orderQuestion_subject${this.subject}`]]
let questionObj={}
arr.forEach(item => {
item.isChoose=false
questionObj[item.questionId]=item
})
if(op.navTitle==='顺序答题'){
this.questionArr=arr
}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
if(idList&&idList.length>0){
idList.forEach(item=>{
this.questionArr.push(questionObj[item])
})
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.forEach(item => {
let isCollect = false
if (this.collectList.includes(item.questionId)) {
isCollect = true
}
this.questionArr.push({
isChoose: false,
isCollect: isCollect,
...item
})
})
this.loading = false
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr), this.navTitle)
this.$refs.question.getOriginArr(JSON.stringify(this.questionArr))

Loading…
Cancel
Save