diff --git a/src/App.vue b/src/App.vue index 44cd0fd..44caa81 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,11 +4,7 @@ import useQuestionStore from '@/jtools/store/question' //引入store export default { onLaunch: function () { useUserStore().queryVipList() - if(useQuestionStore().curSubject=='1'){ - useQuestionStore().getOrderQuestion_sub1() - }else if(useQuestionStore().curSubject=='4'){ - useQuestionStore().getOrderQuestion_sub4() - } + useQuestionStore().getAllQuestion() if(useUserStore().isLogin) { useUserStore().getUserInfo() useUserStore().searchUserVip() diff --git a/src/jtools/api/question.js b/src/jtools/api/question.js index 0c97c80..b7c824a 100644 --- a/src/jtools/api/question.js +++ b/src/jtools/api/question.js @@ -71,3 +71,33 @@ export function querySpecialNum(data) { noToken:true }); } + + +//获取题库版本 +export function getVersion(carTypeId) { + return request({ + url: '/driver-api/tdQuestionVersion/currentVersion?carTypeId='+carTypeId, + method: 'GET', + noToken:true + }); +} + +//获取题目ID +export function queryQuestionId(data) { + return request({ + url: '/driver-api/tdQuestion/queryQuestionId', + method: 'POST', + data, + noToken:true + }); +} + +//获取模拟考试ID +export function getTestQuestionId(data) { + return request({ + url: '/driver-api/tdQuestion/getTestQuestionId', + method: 'POST', + data, + noToken:true + }); +} diff --git a/src/jtools/request/index.js b/src/jtools/request/index.js index 538b1fa..bc48f9f 100644 --- a/src/jtools/request/index.js +++ b/src/jtools/request/index.js @@ -32,7 +32,7 @@ function service(options = {}) { useUserStore().logout() //请求成功 resolved(res.data); - } else if(res.data.code != '0000') { + } else if(res.data.code != '0000'&&res.data.code !='4001') { uni.showToast({ title: res?.data?.message || '访问出错', icon: 'none' diff --git a/src/jtools/store/question.js b/src/jtools/store/question.js index fb7bb1b..b799c3e 100644 --- a/src/jtools/store/question.js +++ b/src/jtools/store/question.js @@ -3,7 +3,8 @@ import { } from 'pinia'; import http from '@/jtools/request/index'; import { - queryQuestion + queryQuestion, + getVersion } from '@/jtools/api/question'; import storage from '@/jtools/storage'; @@ -11,82 +12,212 @@ const question = defineStore({ id: 'question', state: () => ({ currentCartype: storage.get('carType') || '1001', - orderQuestion_subject1: [], //科目一顺序做题 - orderQuestion_subject4:[],//科目二顺序做题 + orderQuestion_subject1:storage.get('question_subject1') || [], //科目一顺序做题 + orderQuestion_subject4:storage.get('question_subject4') ||[],//科目四顺序做题 currentIndex_subject1:0,//科目一索引 顺序做题 currentIndex_subject4:0,//科目四索引 顺序做题 - curSubject:storage.get('curSubject') || '1' + curSubject:storage.get('curSubject') || '1', + loading_subject1:false, + loading_subject4:false, + version:storage.get('version') || '' }), actions: { + getAllQuestion(){ + getVersion(this.currentCartype).then(resp=>{ + if(resp.code==='0000'){ + if(this.version!=resp.data){ + this.version=resp.data + storage.set('version',resp.data) + this.getOrderQuestion_sub1(true) + this.getOrderQuestion_sub4(true) + }else{ + this.getOrderQuestion_sub1() + 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; + }, + //改变当前科目 changeSubject(val){ this.curSubject=val storage.set('curSubject',val) }, // 获取顺序做题科目1 - getOrderQuestion_sub1() { - this.curSubject='1' - storage.set('curSubject','1') - if(!this.orderQuestion_subject1.length){ - queryQuestion({ - carTypeId: this.currentCartype, - subject: '1', - // questionIdList:[10982,10983,10985,10986] - }).then(res => { - if (res.code == '0000') { - this.orderQuestion_subject1 = res.data - const falseList =storage.get('wrongList_subject1') || [] - const trueList =storage.get('rightList_subject1')|| [] - const falseArr=[] - const rightArr=[] - this.orderQuestion_subject1.forEach(item=>{ - if(falseList.includes(item.questionId)){ - falseArr.push(item.questionId) - } - if(trueList.includes(item.questionId)){ - rightArr.push(item.questionId) + 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) + uni.setStorageSync('questionOneSub1', diveList[0]) + uni.setStorageSync('questionOneSub2', diveList[1]) + uni.setStorageSync('questionOneSub3', diveList[2]) + uni.setStorageSync('questionOneSub4', diveList[3]) + uni.setStorageSync('questionOneSub5', diveList[4]) + const falseList =storage.get('wrongList_subject1') || [] + const trueList =storage.get('rightList_subject1')|| [] + const falseArr=[] + const rightArr=[] + this.orderQuestion_subject1.forEach(item=>{ + if(falseList.includes(item.questionId)){ + falseArr.push(item.questionId) + } + if(trueList.includes(item.questionId)){ + rightArr.push(item.questionId) + } + }) + storage.set('wrongList_subject1',falseArr) + storage.set('rightList_subject1',rightArr) + } + }) + }else{ + const list1 = uni.getStorageSync('questionOneSub1') || [] + const list2 = uni.getStorageSync('questionOneSub2') || [] + const list3 = uni.getStorageSync('questionOneSub3') || [] + const list4 = uni.getStorageSync('questionOneSub4') || [] + const list5 = uni.getStorageSync('questionOneSub5') || [] + this.orderQuestion_subject1=[...list1,...list2,...list3,...list4,...list5] + if(this.orderQuestion_subject1&&this.orderQuestion_subject1.length){ + + }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) + uni.setStorageSync('questionOneSub1', diveList[0]) + uni.setStorageSync('questionOneSub2', diveList[1]) + uni.setStorageSync('questionOneSub3', diveList[2]) + uni.setStorageSync('questionOneSub4', diveList[3]) + uni.setStorageSync('questionOneSub5', diveList[4]) + const falseList =storage.get('wrongList_subject1') || [] + const trueList =storage.get('rightList_subject1')|| [] + const falseArr=[] + const rightArr=[] + this.orderQuestion_subject1.forEach(item=>{ + if(falseList.includes(item.questionId)){ + falseArr.push(item.questionId) + } + if(trueList.includes(item.questionId)){ + rightArr.push(item.questionId) + } + }) + storage.set('wrongList_subject1',falseArr) + storage.set('rightList_subject1',rightArr) } }) - storage.set('wrongList_subject1',falseArr) - storage.set('rightList_subject1',rightArr) - } - }) + } } }, // 获取顺序做题科目4 - getOrderQuestion_sub4() { - this.curSubject='4' - storage.set('curSubject','4') - if(!this.orderQuestion_subject4.length){ - queryQuestion({ - carTypeId: this.currentCartype, - subject: '4', - // questionIdList:[10982,10983,10985,10986] - }).then(res => { - if (res.code == '0000') { - this.orderQuestion_subject4 = res.data - const falseList =storage.get('wrongList_subject4') || [] - const trueList =storage.get('rightList_subject4')|| [] - const falseArr=[] - const rightArr=[] - this.orderQuestion_subject4.forEach(item=>{ - if(falseList.includes(item.questionId)){ - falseArr.push(item.questionId) - } - if(trueList.includes(item.questionId)){ - rightArr.push(item.questionId) + 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) + uni.setStorageSync('questionFourSub1', diveList[0]) + uni.setStorageSync('questionFourSub2', diveList[1]) + uni.setStorageSync('questionFourSub3', diveList[2]) + uni.setStorageSync('questionFourSub4', diveList[3]) + uni.setStorageSync('questionFourSub5', diveList[4]) + const falseList =storage.get('wrongList_subject4') || [] + const trueList =storage.get('rightList_subject4')|| [] + const falseArr=[] + const rightArr=[] + this.orderQuestion_subject4.forEach(item=>{ + if(falseList.includes(item.questionId)){ + falseArr.push(item.questionId) + } + if(trueList.includes(item.questionId)){ + rightArr.push(item.questionId) + } + }) + storage.set('wrongList_subject4',falseArr) + storage.set('rightList_subject4',rightArr) + } + }) + }else{ + const list1 = uni.getStorageSync('questionFourSub1') || [] + const list2 = uni.getStorageSync('questionFourSub2') || [] + const list3 = uni.getStorageSync('questionFourSub3') || [] + const list4 = uni.getStorageSync('questionFourSub4') || [] + const list5 = uni.getStorageSync('questionFourSub5') || [] + this.orderQuestion_subject4=[...list1,...list2,...list3,...list4,...list5] + if(this.orderQuestion_subject4&&this.orderQuestion_subject4.length){ + + }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) + uni.setStorageSync('questionFourSub1', diveList[0]) + uni.setStorageSync('questionFourSub2', diveList[1]) + uni.setStorageSync('questionFourSub3', diveList[2]) + uni.setStorageSync('questionFourSub4', diveList[3]) + uni.setStorageSync('questionFourSub5', diveList[4]) + const falseList =storage.get('wrongList_subject4') || [] + const trueList =storage.get('rightList_subject4')|| [] + const falseArr=[] + const rightArr=[] + this.orderQuestion_subject4.forEach(item=>{ + if(falseList.includes(item.questionId)){ + falseArr.push(item.questionId) + } + if(trueList.includes(item.questionId)){ + rightArr.push(item.questionId) + } + }) + storage.set('wrongList_subject4',falseArr) + storage.set('rightList_subject4',rightArr) } }) - storage.set('wrongList_subject4',falseArr) - storage.set('rightList_subject4',rightArr) - } - }) + } } }, //获取索引 getCurrentIndex(index,val){ this[`currentIndex_subject${val}`]=index + console.log(`currentIndex_subject${val}`,this[`currentIndex_subject${val}`]); } } }); diff --git a/src/pages.json b/src/pages.json index 447ce32..04270e8 100644 --- a/src/pages.json +++ b/src/pages.json @@ -86,7 +86,7 @@ { "path": "pages/me/tijian", "style": { - "navigationBarTitleText": "我的体检", + "navigationBarTitleText": "上传证件照", "enablePullDownRefresh": false } }, @@ -151,6 +151,13 @@ "navigationBarTitleText": "上传证件照", "enablePullDownRefresh": false } + }, + { + "path": "pages/index/secretPapers", + "style": { + "navigationBarTitleText": "考前密卷", + "enablePullDownRefresh": false + } } ], @@ -162,7 +169,7 @@ }, "tabBar": { "borderStyle": "white", - "selectedColor": "#333333", + "selectedColor": "#05C341", "backgroundColor": "#FFFFFF", "color": "#999999", "list": [{ diff --git a/src/pages/index/components/Subject1.vue b/src/pages/index/components/Subject1.vue index aeccebc..99c523e 100644 --- a/src/pages/index/components/Subject1.vue +++ b/src/pages/index/components/Subject1.vue @@ -1,28 +1,33 @@ + \ No newline at end of file diff --git a/src/pages/index/components/Subject2.vue b/src/pages/index/components/Subject2.vue index 0dfcaf4..718ffda 100644 --- a/src/pages/index/components/Subject2.vue +++ b/src/pages/index/components/Subject2.vue @@ -12,10 +12,10 @@ 科{{subject=='2'?'二':'三'}}考试项目讲解 - + @@ -49,8 +49,8 @@ - - + + @@ -105,7 +105,7 @@ async toVipVideo(){ if (this.token) { await this.searchUserVip() - const res = this.vipOnList.some(item => item.subjects == this.subject) + const res = this.vipOnList.some(item => item.subjects.includes(this.subject)) if (!res) { uni.navigateTo({ url:"/pages/index/videoVip?subject="+this.subject @@ -132,7 +132,6 @@ queryProjectList({ "carTypeId": storage.get('carType') || '1001', "subject": String(this.subject), - "driveType": this.diverTypeList[this.diverTypeIndex].configItemCode, "type": "2" }).then(resp => { if (resp.code === '0000') { @@ -183,7 +182,7 @@ getVideoList() { queryProjectList({ "carTypeId": storage.get('carType') || '1001', - "driveType": this.diverTypeList[this.diverTypeIndex].configItemCode, + "driveType": '2', "subject": String(this.subject), "type": "1" }).then(resp => { @@ -301,4 +300,4 @@ -webkit-backface-visibility: hidden; -webkit-transform: translate3d(0, 0, 0); } - \ No newline at end of file + diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 0f88e09..4b54566 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -1,21 +1,26 @@ + \ No newline at end of file diff --git a/src/pages/index/secretPapers.vue b/src/pages/index/secretPapers.vue new file mode 100644 index 0000000..5341043 --- /dev/null +++ b/src/pages/index/secretPapers.vue @@ -0,0 +1,139 @@ + + + + + \ No newline at end of file diff --git a/src/pages/index/trueTest.vue b/src/pages/index/trueTest.vue index 6cd3aed..79680ec 100644 --- a/src/pages/index/trueTest.vue +++ b/src/pages/index/trueTest.vue @@ -91,6 +91,11 @@ diff --git a/src/pages/me/tijian.vue b/src/pages/me/tijian.vue index 2bfe482..bcbeb2f 100644 --- a/src/pages/me/tijian.vue +++ b/src/pages/me/tijian.vue @@ -1,42 +1,222 @@ + .upload-img { + width: 165rpx; + height: 165rpx; + border: 1px dashed #c4c4c4; + display: flex; + justify-content: center; + align-items: center; + } + + .fontColor { + color: #383838; + font-weight: 400; + } + + ::v-deep .u-textarea__count { + background-color: #f9faf9 !important; + } + + ::v-deep .u-upload__button>.u-icon>.u-icon__icon { + font-size: 90rpx !important; + } + + ::v-deep .u-button--square { + border-radius: 40rpx !important; + } + ::v-deep .u-button--primary{ + background-color: #05C341 !important; + border-color: #05C341 !important; + } + \ No newline at end of file diff --git a/src/pages/me/uploadPic.vue b/src/pages/me/uploadPic.vue index b90bfd2..8de9c9e 100644 --- a/src/pages/me/uploadPic.vue +++ b/src/pages/me/uploadPic.vue @@ -5,21 +5,21 @@ - + 点击 + - 第二步 核实后再提交 diff --git a/src/pages/me/vip.vue b/src/pages/me/vip.vue index 1b6050f..816943b 100644 --- a/src/pages/me/vip.vue +++ b/src/pages/me/vip.vue @@ -12,8 +12,8 @@ - - + + @@ -44,7 +44,7 @@ - + 3步轻松学{{ getKmTitle(item.subjects) }} @@ -165,8 +165,8 @@ export default { return '开通vip助您快速拿证' } }, - vipHasOpened(item) { - return !!this.vipOnList.find(it => it.memberId == item.memberId) + vipHasOpened(item) {; + return !!this.vipOnList.some(it => it.subjects.includes(item.subjects) ) }, // 去精选500题 item=> 当前科目vip信息 to500(item) { @@ -261,6 +261,7 @@ export default { left: 10px; display: flex; align-items: center; + z-index: 1; } .corner { @@ -277,6 +278,7 @@ export default { justify-content: center; font-size: 12px; color: #fff; + z-index: 1; } .renew { @@ -292,6 +294,7 @@ export default { border-radius: 26rpx; font-size: 12px; color: #F6E99F; + z-index: 1; } .buy { @@ -308,6 +311,7 @@ export default { border-radius: 30rpx; font-size: 14px; color: #F6E99F; + z-index: 1; } .study { diff --git a/src/pages/questionBank/baseOperate.vue b/src/pages/questionBank/baseOperate.vue index 000b6e5..b30b8dc 100644 --- a/src/pages/questionBank/baseOperate.vue +++ b/src/pages/questionBank/baseOperate.vue @@ -1,17 +1,17 @@ @@ -12,9 +13,11 @@ mapState, mapActions } from 'pinia' //引入映射函数 + import useQuestionStore from '@/jtools/store/question' //引入store import useUserStore from '@/jtools/store/user' import { - getTestQuestion + getTestQuestion, + queryQuestionId } from '@/jtools/api/question'; import storage from '@/jtools/storage'; import Question from './components/Question.vue'; @@ -24,63 +27,105 @@ }, data() { return { - type:'', - isShowAll:true, - title:"模拟考试", - subject:1, - isSubmit:false, - tabsList:[{ - label:"模拟考试", - value:0 - },{ - label:"考前密卷", - value:1 + type: '', + collectList: storage.get(`collectList_subject${this.subject}`) || [], + questionArr:[], + isShowAll: true, + title: "模拟考试", + subject: 1, + isSubmit: false, + tabsList: [{ + label: "模拟考试", + value: 0 + }, { + label: "考前秘卷", + value: 1 }] } }, onLoad(op) { - if(op.title){ - this.title=op.title + if (op.title) { + this.title = op.title } - if(op.subject){ - this.subject=op.subject - const param={} - if(op.isExam1){ - param.isExam1=op.isExam1 + if (op.subject) { + this.subject = op.subject + const param = {} + if (op.isExam1) { + param.isExam1 = op.isExam1 } - getTestQuestion({ - carTypeId: storage.get('carType') || '1001', - subject: this.subject, - ...param - }).then(async (resp)=>{ - if(resp.code==='0000'){ - 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)) + 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)) + } + 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) } }, computed: { - ...mapState(useUserStore, ["vipOnList"]) + ...mapState(useUserStore, ["vipOnList","token"]), + ...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数,取出tagslist }, methods: { ...mapActions(useUserStore, ['searchUserVip']), - toBack(){ + toBack() { this.$refs.question.submitPaper() }, - changeTab(val){ - if(val==1){ - uni.navigateTo({ - url:"/pages/questionBank/practiceExams?subject="+this.subject+'&title=考前密卷&isExam1=1' + 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() + } }) } } @@ -89,17 +134,19 @@ + \ No newline at end of file diff --git a/src/pages/questionBank/practiceResult.vue b/src/pages/questionBank/practiceResult.vue index 91322f4..bad9958 100644 --- a/src/pages/questionBank/practiceResult.vue +++ b/src/pages/questionBank/practiceResult.vue @@ -88,11 +88,18 @@ this.subject=op.subject this.allRightList=storage.get(`rightList_subject${this.subject}`) || [] this.allWrongList=storage.get(`wrongList_subject${this.subject}`) || [] - this.percent=(((this.allRightList.length+this.wrongList.length) / this.orderQuestion.length)*100).toFixed(0) + this.percent=(((this.allRightList.length+this.wrongList.length) / this[`orderQuestion_subject${this.subject}`].length)*100).toFixed(0) } }, + onUnload() { + //#ifdef MP-WEIXIN + uni.reLaunch({ + url:"/pages/index/index" + }) + //#endif + }, computed: { - ...mapState(useQuestionStore, ["orderQuestion_subject1","orderQuestion_subject1"]), //映射函数,取出tagslist + ...mapState(useQuestionStore, ["orderQuestion_subject1","orderQuestion_subject4"]), //映射函数,取出tagslist getNotDoNum(){ return this[`orderQuestion_subject${this.subject}`].length-(this.allRightList.length+this.allWrongList.length) } diff --git a/src/pages/questionBank/questionBank.vue b/src/pages/questionBank/questionBank.vue index 9c0c3a8..b367be7 100644 --- a/src/pages/questionBank/questionBank.vue +++ b/src/pages/questionBank/questionBank.vue @@ -1,10 +1,11 @@ @@ -17,7 +18,8 @@ import useUserStore from '@/jtools/store/user' import Question from './components/Question.vue'; import { - queryQuestion + queryQuestion, + queryQuestionId } from '@/jtools/api/question'; import storage from '@/jtools/storage'; export default { @@ -26,6 +28,9 @@ }, data() { return { + loadTxt:'加载中...', + collectList: storage.get(`collectList_subject${this.subject}`) || [], + loading:false, isShowAll: true, needVip: false, subject: 1, @@ -41,94 +46,89 @@ } }, async onLoad(op) { + this.loading=true if (op.needVip) { this.needVip = op.needVip } - if(op.subject){ - this.subject=op.subject + if (op.subject) { + this.subject = op.subject } if (op && op.navTitle) { this.navTitle = op.navTitle - const param = {} + let arr=[] + let param={} + if(op.needVip){ + this.isShowAll = !Boolean(op.needVip=='true') + } if (this.navTitle === '顺序答题') { - if(this.subject=='1'){ - this.questionArr = [...this.orderQuestion_subject1] - }else if(this.subject=='4'){ - this.questionArr = [...this.orderQuestion_subject4] - } - this.$refs.question.getQuestionList(JSON.stringify(this.questionArr)) - } else { - if (this.navTitle === '错题本') { - param.questionIdList = storage.get(`wrongList_subject${this.subject}`) || [] - } else if (this.navTitle === '收藏夹') { - param.questionIdList = storage.get(`collectList_subject${this.subject}`) || [] - } - if (op.questionList) { - param.questionIdList = JSON.parse(op.questionList) - } - if (op.chapter) { - param.chapter = op.chapter - } - if (op.examKey) { - param.examKey = op.examKey - } - if(op.isError&&op.isError=='1'){ - param.isError=Number(op.isError) - } - if(op.isNew&&op.isNew=='1'){ - param.isNew=Number(op.isNew) - } - if(op.type){ - param.type=op.type - } - if(op.isImage){ - param.isImage=op.isImage + 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 } - param.subject=this.subject - param.carTypeId=storage.get('carType') || '1001' - queryQuestion(param).then(async (res) => { - if (res.code == '0000') { - this.questionArr = res.data - if (this.needVip === 'true') { - if (this.token) { - await this.searchUserVip() - const res = this.vipOnList.some(item => item.subjects == this.subject) - if (!res) { - this.questionArr = this.questionArr.slice(0, 3) - this.isShowAll = false - } - } else { - uni.redirectTo({ - url: '/pages/login/login' - }); - } - } - this.$refs.question.getQuestionList(JSON.stringify(this.questionArr)) - } + 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.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)) } }, computed: { - ...mapState(useQuestionStore, ["orderQuestion_subject1","orderQuestion_subject4"]), //映射函数,取出tagslist - ...mapState(useUserStore, ["vipOnList", "token"]) + ...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4","version"]), //映射函数,取出tagslist + ...mapState(useUserStore, ["vipOnList", "token"]), }, methods: { ...mapActions(useUserStore, ['searchUserVip']), + ...mapActions(useQuestionStore, ['getAllQuestion']), changeTab(val) { if (val == 1) { let list = JSON.parse(JSON.stringify(this.questionArr)) list = list.map(item => { return { ...item, - clickAnswer: item.trueAnswer + clickAnswer: item.trueAnswer, + isChoose: true, } }) this.$refs.question.isShowBest(true) - this.$refs.question.getQuestionList(JSON.stringify(list)) + this.$refs.question.getQuestionList(JSON.stringify(list),this.navTitle) } else { this.$refs.question.isShowBest(false) this.$refs.question.getQuestionList() diff --git a/src/pages/questionBank/videoDetail.vue b/src/pages/questionBank/videoDetail.vue index 171ab0e..c6ba947 100644 --- a/src/pages/questionBank/videoDetail.vue +++ b/src/pages/questionBank/videoDetail.vue @@ -25,11 +25,9 @@ - - - + - {{item.videoTime}} @@ -48,10 +46,10 @@ 收起 - - - + + {{item.videoTime}} @@ -266,4 +264,10 @@ display: inline-block; margin-right: 15px; } + .hide { + backface-visibility: hidden; + transform: translate3d(0, 0, 0); + -webkit-backface-visibility: hidden; + -webkit-transform: translate3d(0, 0, 0); + } \ No newline at end of file diff --git a/src/pages/questionBank/wrongQuestion.vue b/src/pages/questionBank/wrongQuestion.vue index 65fe126..a52ebaf 100644 --- a/src/pages/questionBank/wrongQuestion.vue +++ b/src/pages/questionBank/wrongQuestion.vue @@ -5,23 +5,22 @@ - + {{title}} - + {{tIndex==0?'错题':'收藏'}}情况 - + {{tIndex==0?wrongList.length:collectList.length}} - + @@ -47,41 +46,28 @@ --> - + - - - - 科{{subject==1?'一':'四'}}精品视频课 - 全部10节课 > - - - - - - - - - - - + {{tIndex==0?'错题':'收藏题'}}分类 - - + + + {{item.categoryName}} {{item.num}} @@ -92,6 +78,11 @@