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..3a87900 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,205 @@ const question = defineStore({ id: 'question', state: () => ({ currentCartype: storage.get('carType') || '1001', - orderQuestion_subject1: [], //科目一顺序做题 - orderQuestion_subject4:[],//科目二顺序做题 - currentIndex_subject1:0,//科目一索引 顺序做题 - currentIndex_subject4:0,//科目四索引 顺序做题 - curSubject:storage.get('curSubject') || '1' + orderQuestion_subject1: storage.get('question_subject1') || [], //科目一顺序做题 + orderQuestion_subject4: storage.get('question_subject4') || [], //科目四顺序做题 + currentIndex_subject1: 0, //科目一索引 顺序做题 + currentIndex_subject4: 0, //科目四索引 顺序做题 + 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) + 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) - } - }) - storage.set('wrongList_subject1',falseArr) - storage.set('rightList_subject1',rightArr) + getOrderQuestion_sub1(isUpdate) { + if (isUpdate) { + this.loading_subject1 = true + 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]) + 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 = [] + that.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 + 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]) + 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 = [] + that.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) + } + } + }) + } } }, // 获取顺序做题科目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) - } - }) - storage.set('wrongList_subject4',falseArr) - storage.set('rightList_subject4',rightArr) + getOrderQuestion_sub4(isUpdate) { + if (isUpdate) { + this.loading_subject4 = true + 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]) + 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 = [] + that.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 + 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]) + 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 = [] + that.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) + } + } + }) + } } }, //获取索引 - getCurrentIndex(index,val){ - this[`currentIndex_subject${val}`]=index + getCurrentIndex(index, val) { + this[`currentIndex_subject${val}`] = index } } }); diff --git a/src/pages.json b/src/pages.json index 417cfb7..f5251df 100644 --- a/src/pages.json +++ b/src/pages.json @@ -8,7 +8,8 @@ { "path": "pages/index/index", "style": { - "navigationBarTitleText": "金武联驾考" + "navigationStyle": "custom", + "enablePullDownRefresh": false } }, { @@ -86,7 +87,7 @@ { "path": "pages/me/tijian", "style": { - "navigationBarTitleText": "我的体检", + "navigationBarTitleText": "上传证件照", "enablePullDownRefresh": false } }, @@ -144,8 +145,21 @@ "navigationBarTitleText": "真实考场模拟", "enablePullDownRefresh": false } - - } + }, + { + "path": "pages/me/uploadPic", + "style": { + "navigationBarTitleText": "上传证件照", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/index/secretPapers", + "style": { + "navigationBarTitleText": "考前密卷", + "enablePullDownRefresh": false + } + } ], "globalStyle": { @@ -156,7 +170,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 d3f2976..d478e66 100644 --- a/src/pages/index/components/Subject1.vue +++ b/src/pages/index/components/Subject1.vue @@ -1,76 +1,78 @@ + \ No newline at end of file diff --git a/src/pages/index/components/Subject2.vue b/src/pages/index/components/Subject2.vue index b4cb490..718ffda 100644 --- a/src/pages/index/components/Subject2.vue +++ b/src/pages/index/components/Subject2.vue @@ -1,10 +1,10 @@ + \ 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 new file mode 100644 index 0000000..8de9c9e --- /dev/null +++ b/src/pages/me/uploadPic.vue @@ -0,0 +1,217 @@ + + + + + \ No newline at end of file diff --git a/src/pages/me/vip.vue b/src/pages/me/vip.vue index 2e49f7a..816943b 100644 --- a/src/pages/me/vip.vue +++ b/src/pages/me/vip.vue @@ -12,8 +12,8 @@ - - + + @@ -28,10 +28,10 @@ VIP已开通 - + {{ item.price }}元立即续费 - + 立即充值 @@ -44,7 +44,7 @@ - + 3步轻松学{{ getKmTitle(item.subjects) }} @@ -141,6 +141,11 @@ export default { } }, methods: { + chargeVip(item){ + uni.navigateTo({ + url:"/pages/index/videoVip?subject="+item.subjects + }) + }, onChange(e) { this.current = e.detail.current }, @@ -160,14 +165,17 @@ 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) { // 当前vip是否已开通 if (this.vipHasOpened(item)) { // 跳转 + uni.navigateTo({ + url:"/pages/questionBank/questionBank?navTitle=精简500题&subject="+item.subjects+"&needVip=true&isVip=1" + }) } else { uni.showToast({ title: `请先充值${this.getKmTitle(item.subjects)}vip`, @@ -180,6 +188,9 @@ export default { // 当前vip是否已开通 if (this.vipHasOpened(item)) { // 跳转 + uni.navigateTo({ + url: "/pages/index/trueTest?subject="+item.subjects + }) } else { uni.showToast({ title: `请先充值${this.getKmTitle(item.subjects)}vip`, @@ -192,6 +203,9 @@ export default { // 当前vip是否已开通 if (this.vipHasOpened(item)) { // 跳转 + uni.navigateTo({ + url:"/pages/questionBank/practiceExams?subject="+item.subjects+'&title=考前密卷&isExam1=1' + }) } else { uni.showToast({ title: `请先充值${this.getKmTitle(item.subjects)}vip`, @@ -204,6 +218,10 @@ export default { // 当前vip是否已开通 if (this.vipHasOpened(item)) { // 跳转 + uni.showToast({ + title:'敬请期待', + icon:'none' + }) } else { uni.showToast({ title: `请先充值${this.getKmTitle(item.subjects)}vip`, @@ -243,6 +261,7 @@ export default { left: 10px; display: flex; align-items: center; + z-index: 1; } .corner { @@ -259,6 +278,7 @@ export default { justify-content: center; font-size: 12px; color: #fff; + z-index: 1; } .renew { @@ -274,6 +294,7 @@ export default { border-radius: 26rpx; font-size: 12px; color: #F6E99F; + z-index: 1; } .buy { @@ -290,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 61342bb..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,64 +27,76 @@ }, 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 = [] + 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) + 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) } }, 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' - }) + async changeTab(val) { + if (val == 1) { + 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 + }) + } } } } @@ -89,17 +104,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..f769af2 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,60 @@ } }, 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 = {} - 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(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)) - } - }) + let arr = [] + let param = {} + if (op.needVip) { + this.isShowAll = !Boolean(op.needVip == 'true') } + 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) + 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"]), //映射函数,取出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 @@