提交
This commit is contained in:
@@ -49,11 +49,18 @@
|
||||
...param,
|
||||
}).then(async (resp) => {
|
||||
if (resp.code === '0000') {
|
||||
const arr = resp.data
|
||||
const listJson = JSON.stringify(arr)
|
||||
uni.navigateTo({
|
||||
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson
|
||||
})
|
||||
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
|
||||
if (this.collectList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||
const idx = this.collectList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||
this.collectList.splice(idx, 1)
|
||||
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') {
|
||||
const arr = resp.data
|
||||
const listJson = JSON.stringify(arr)
|
||||
uni.navigateTo({
|
||||
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson
|
||||
})
|
||||
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: '当前题库非最新版,请更新~',
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
return {
|
||||
type: '',
|
||||
collectList: storage.get(`collectList_subject${this.subject}`) || [],
|
||||
questionArr:[],
|
||||
questionArr: [],
|
||||
isShowAll: true,
|
||||
title: "模拟考试",
|
||||
subject: 1,
|
||||
@@ -53,31 +53,30 @@
|
||||
if (op.isExam1) {
|
||||
param.isExam1 = op.isExam1
|
||||
}
|
||||
if(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))
|
||||
if (op.needVip) {
|
||||
this.isShowAll = op.needVip
|
||||
}
|
||||
let arr = []
|
||||
arr = [...this[`orderQuestion_subject${this.subject}`]]
|
||||
let questionObj = {}
|
||||
arr.forEach(item => {
|
||||
let isCollect = false
|
||||
if (this.collectList.includes(item.questionId)) {
|
||||
isCollect = true
|
||||
}
|
||||
this.questionArr.push({
|
||||
isChoose: false,
|
||||
isCollect: isCollect,
|
||||
...item
|
||||
})
|
||||
item.isChoose = false
|
||||
questionObj[item.questionId] = 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.$refs.question.getQuestionList(JSON.stringify(this.questionArr),this.title)
|
||||
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr), this.title)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useUserStore, ["vipOnList","token"]),
|
||||
...mapState(useUserStore, ["vipOnList", "token"]),
|
||||
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数,取出tagslist
|
||||
},
|
||||
methods: {
|
||||
@@ -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
|
||||
})
|
||||
} 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()
|
||||
}
|
||||
})
|
||||
await this.searchUserVip()
|
||||
const result = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||
if (result) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/index/secretPapers?subject=" + this.subject
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pages/index/videoVip?subject=" + this.subject
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loadTxt:'加载中...',
|
||||
loadTxt: '加载中...',
|
||||
collectList: storage.get(`collectList_subject${this.subject}`) || [],
|
||||
loading:false,
|
||||
loading: false,
|
||||
isShowAll: true,
|
||||
needVip: false,
|
||||
subject: 1,
|
||||
@@ -46,7 +46,7 @@
|
||||
}
|
||||
},
|
||||
async onLoad(op) {
|
||||
this.loading=true
|
||||
this.loading = true
|
||||
if (op.needVip) {
|
||||
this.needVip = op.needVip
|
||||
}
|
||||
@@ -55,63 +55,34 @@
|
||||
}
|
||||
if (op && op.navTitle) {
|
||||
this.navTitle = op.navTitle
|
||||
let arr=[]
|
||||
let param={}
|
||||
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]
|
||||
}
|
||||
} 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))
|
||||
let arr = []
|
||||
let param = {}
|
||||
if (op.needVip) {
|
||||
this.isShowAll = !Boolean(op.needVip == 'true')
|
||||
}
|
||||
arr = [...this[`orderQuestion_subject${this.subject}`]]
|
||||
let questionObj={}
|
||||
arr.forEach(item => {
|
||||
let isCollect = false
|
||||
if (this.collectList.includes(item.questionId)) {
|
||||
isCollect = true
|
||||
}
|
||||
this.questionArr.push({
|
||||
isChoose: false,
|
||||
isCollect: isCollect,
|
||||
...item
|
||||
})
|
||||
item.isChoose=false
|
||||
questionObj[item.questionId]=item
|
||||
})
|
||||
this.loading=false
|
||||
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr),this.navTitle)
|
||||
if(op.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))
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4","version"]), //映射函数,取出tagslist
|
||||
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数,取出tagslist
|
||||
...mapState(useUserStore, ["vipOnList", "token"]),
|
||||
},
|
||||
methods: {
|
||||
@@ -128,7 +99,7 @@
|
||||
}
|
||||
})
|
||||
this.$refs.question.isShowBest(true)
|
||||
this.$refs.question.getQuestionList(JSON.stringify(list),this.navTitle)
|
||||
this.$refs.question.getQuestionList(JSON.stringify(list), this.navTitle)
|
||||
} else {
|
||||
this.$refs.question.isShowBest(false)
|
||||
this.$refs.question.getQuestionList()
|
||||
|
||||
Reference in New Issue
Block a user