From 9e871e40792c655ef6ce879d4017526709ab5827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=84=86=E7=9A=AE=E9=B8=AD?= <1003092440@qq.com> Date: Sun, 17 Sep 2023 13:18:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 5 +- .env.production | 4 +- src/jtools/api/index.js | 17 + src/jtools/api/question.js | 9 +- src/jtools/request/index.js | 2 +- src/jtools/store/question.js | 54 +- src/jtools/store/user.js | 9 + src/pages.json | 14 + src/pages/index/components/Subject1.vue | 38 +- src/pages/index/components/Subject2.vue | 53 +- src/pages/index/index.vue | 35 +- src/pages/index/testTip.vue | 83 +++ src/pages/index/videoVip.vue | 110 ++- src/pages/me/changeCarType.vue | 99 +++ src/pages/me/index.vue | 18 +- src/pages/me/info.vue | 36 +- src/pages/me/tijian.vue | 118 ++- src/pages/me/uploadPic.vue | 213 +++--- src/pages/me/vip.vue | 682 ++++++++++-------- .../questionBank/components/Question.vue | 38 +- src/pages/questionBank/videoDetail.vue | 51 +- src/static/image/index/vip_ksxj.png | Bin 0 -> 29903 bytes src/static/image/index/vip_trueRoom.png | Bin 0 -> 30869 bytes 23 files changed, 1084 insertions(+), 604 deletions(-) create mode 100644 src/pages/index/testTip.vue create mode 100644 src/pages/me/changeCarType.vue create mode 100644 src/static/image/index/vip_ksxj.png create mode 100644 src/static/image/index/vip_trueRoom.png diff --git a/.env.development b/.env.development index 7440985..22201b8 100644 --- a/.env.development +++ b/.env.development @@ -5,7 +5,6 @@ VITE_APP_TITLE = 金武联驾校 VITE_APP_ENV = 'development' # 金武联驾校/开发环境 -VITE_APP_BASE_API = 'https://jwl.ahduima.com/' - +VITE_APP_BASE_API = 'http://118.31.23.45:8888/' # -VITE_WEB_BASE_URL = 'https://jwl.ahduima.com' +VITE_WEB_BASE_URL = 'http://118.31.23.45:8888' \ No newline at end of file diff --git a/.env.production b/.env.production index a1f8f88..ea53d5b 100644 --- a/.env.production +++ b/.env.production @@ -5,7 +5,7 @@ VITE_APP_TITLE = 金武联驾校 VITE_APP_ENV = 'production' # 金武联驾校/开发环境 -VITE_APP_BASE_API = 'https://jwl.ahduima.com/' +VITE_APP_BASE_API = 'https://jwl.ahduima.com/' # -VITE_WEB_BASE_URL = 'https://jwl.ahduima.com' +VITE_WEB_BASE_URL = 'https://jwl.ahduima.com' diff --git a/src/jtools/api/index.js b/src/jtools/api/index.js index e9eab95..c01d695 100644 --- a/src/jtools/api/index.js +++ b/src/jtools/api/index.js @@ -7,4 +7,21 @@ export function getAliCompanyInfo(data) { data, noToken: true }); +} + +export function getCarTypeList(data) { + return request({ + url: 'driver-api/tdCar/list', + method: 'GET', + data, + noToken: true + }); +} + +export function addInfo(data) { + return request({ + url: 'chaoyuan-api/driver/addInfo', + method: 'POST', + data + }); } \ No newline at end of file diff --git a/src/jtools/api/question.js b/src/jtools/api/question.js index b7c824a..e6e39c8 100644 --- a/src/jtools/api/question.js +++ b/src/jtools/api/question.js @@ -50,7 +50,14 @@ export function querySysConfigList(carTypeId, configKey) { noToken: true }); } - +//获取配置 +export function querySysConfig(carTypeId, configKey) { + return request({ + url: 'driver-api/tdSysConfig/queryConfigByKey?configKey=' + configKey + '&carTypeId=' + carTypeId, + method: 'GET', + noToken: true + }); +} //获取项目列表 (考试项目和基础操作) export function queryProjectList(data) { return request({ diff --git a/src/jtools/request/index.js b/src/jtools/request/index.js index bc48f9f..25d87b1 100644 --- a/src/jtools/request/index.js +++ b/src/jtools/request/index.js @@ -29,7 +29,7 @@ function service(options = {}) { title: res?.data?.message || '请重新登录', icon: 'none' }); - useUserStore().logout() + useUserStore().logoutWithoutToken() //请求成功 resolved(res.data); } else if(res.data.code != '0000'&&res.data.code !='4001') { diff --git a/src/jtools/store/question.js b/src/jtools/store/question.js index 3a87900..c7775a2 100644 --- a/src/jtools/store/question.js +++ b/src/jtools/store/question.js @@ -4,7 +4,8 @@ import { import http from '@/jtools/request/index'; import { queryQuestion, - getVersion + getVersion, + querySysConfig } from '@/jtools/api/question'; import storage from '@/jtools/storage'; @@ -12,6 +13,7 @@ const question = defineStore({ id: 'question', state: () => ({ currentCartype: storage.get('carType') || '1001', + currentCarName: storage.get('carName') || '小车C1/C2/C3', orderQuestion_subject1: storage.get('question_subject1') || [], //科目一顺序做题 orderQuestion_subject4: storage.get('question_subject4') || [], //科目四顺序做题 currentIndex_subject1: 0, //科目一索引 顺序做题 @@ -23,18 +25,36 @@ const question = defineStore({ }), actions: { + resetStorage(){ + this.currentIndex_subject1=0 + this.currentIndex_subject4=0 + this.curSubject=0 + storage.remove('curSubject') + storage.remove('wrongList_subject1') + storage.remove('wrongList_subject4') + storage.remove('rightList_subject1') + storage.remove('rightList_subject4') + this.getAllQuestion() + }, getAllQuestion() { + this.currentCartype = storage.get('carType') || '1001' 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() - } + querySysConfig(this.currentCartype, 'QuestionBank').then(res => { + const urlList = JSON.parse(res.data.configJson) + const urlOne = urlList.find(item => item.subject == '1').url + const urlFour = urlList.find(item => item.subject == '4').url + if (this.version != resp.data) { + this.version = resp.data + storage.set('version', resp.data) + this.getOrderQuestion_sub1(true, urlOne) + this.getOrderQuestion_sub4(true, urlFour) + } else { + this.getOrderQuestion_sub1(false, urlOne) + this.getOrderQuestion_sub4(false, urlOne) + } + }) + } }) }, @@ -53,12 +73,12 @@ const question = defineStore({ storage.set('curSubject', val) }, // 获取顺序做题科目1 - getOrderQuestion_sub1(isUpdate) { + getOrderQuestion_sub1(isUpdate, url) { if (isUpdate) { this.loading_subject1 = true - const that=this + 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', + url: url, success(resp) { if (resp.data) { that.orderQuestion_subject1 = resp.data.data @@ -99,7 +119,7 @@ const question = defineStore({ 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', + url: url, success(resp) { if (resp.data) { that.orderQuestion_subject1 = resp.data.data @@ -131,12 +151,12 @@ const question = defineStore({ } }, // 获取顺序做题科目4 - getOrderQuestion_sub4(isUpdate) { + getOrderQuestion_sub4(isUpdate, url) { 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', + url: url, success(resp) { if (resp.data) { that.orderQuestion_subject4 = resp.data.data @@ -177,7 +197,7 @@ const question = defineStore({ 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', + url: url, success(resp) { if (resp.data) { that.orderQuestion_subject4 = resp.data.data diff --git a/src/jtools/store/user.js b/src/jtools/store/user.js index 47969f4..e52c605 100644 --- a/src/jtools/store/user.js +++ b/src/jtools/store/user.js @@ -43,6 +43,13 @@ const useUserStore = defineStore({ resolve(); }) }, + //过期登出 + logoutWithoutToken(force = false) { + return new Promise((resolve, reject) => { + this.resetUserData(); + resolve(); + }) + }, // 获取用户信息 getUserInfo() { getInfo().then(resp => { @@ -63,6 +70,7 @@ const useUserStore = defineStore({ }, // 查询当前用户的vip开通情况 async searchUserVip() { + this.currentCartype=storage.get('carType') || '1001' const resp=await queryVip({ carTypeId: this.currentCartype,memberId: null, subject:'' }) if(resp.code == '0000') { this.vipOnList = resp.data @@ -70,6 +78,7 @@ const useUserStore = defineStore({ }, // 查询所有的vip queryVipList() { + this.currentCartype= storage.get('carType') || '1001' getVipList({ carTypeId: this.currentCartype,memberId: null, subject:'' }).then(resp => { if(resp.code == '0000') { this.vipAllList = resp.data diff --git a/src/pages.json b/src/pages.json index f5251df..4aacc65 100644 --- a/src/pages.json +++ b/src/pages.json @@ -105,6 +105,13 @@ "enablePullDownRefresh": false } }, + { + "path": "pages/index/testTip", + "style": { + "navigationBarTitleText": "模拟考试", + "enablePullDownRefresh": false + } + }, { "path": "pages/login/login", "style": { @@ -159,6 +166,13 @@ "navigationBarTitleText": "考前密卷", "enablePullDownRefresh": false } + }, + { + "path": "pages/me/changeCarType", + "style": { + "navigationBarTitleText": "切换车型", + "enablePullDownRefresh": false + } } ], diff --git a/src/pages/index/components/Subject1.vue b/src/pages/index/components/Subject1.vue index d478e66..cb4fc2f 100644 --- a/src/pages/index/components/Subject1.vue +++ b/src/pages/index/components/Subject1.vue @@ -41,11 +41,11 @@ VIP课程 - + - 精简500题 + 精简{{titleNum}}题 @@ -78,11 +78,10 @@ - + @@ -97,7 +96,7 @@ - + --> @@ -110,6 +109,7 @@ import storage from '@/jtools/storage'; import useQuestionStore from '@/jtools/store/question' //引入store import { + querySysConfig, queryQuestionId, getTestQuestionId } from '@/jtools/api/question'; @@ -127,11 +127,12 @@ }, data() { return { + titleNum:500, allQuestionNum: 0, } }, mounted() { - + this.getTitle() }, computed: { ...mapState(useUserStore, ["vipOnList", "token"]), @@ -143,6 +144,15 @@ methods: { ...mapActions(useUserStore, ['searchUserVip']), ...mapActions(useQuestionStore, ['getOrderQuestion_sub1', 'getOrderQuestion_sub4', 'getAllQuestion']), + getTitle(){ + const carId=storage.get('carType') || '1001' + querySysConfig(carId,'SimplifyQuestionNum').then(resp=>{ + if(resp.code==='0000'){ + const list = JSON.parse(resp.data.configJson) + this.titleNum=list.find(item=>item.subject==this.subject).num + } + }) + }, async toTestRoom() { // uni.navigateTo({ // url:"/pages/index/trueTest" @@ -214,7 +224,7 @@ }) }, toAnswer(title, val) { - if (title == '精简500题') { + if (title == `精简${this.titleNum}题`) { queryQuestionId({ versionId: this.version, carTypeId: storage.get('carType') || '1001', @@ -225,6 +235,7 @@ if (this.token) { await this.searchUserVip() const result = this.vipOnList.some(item => item.subjects.includes(this.subject)) + let arr = [] if (result) { if(resp.data&&resp.data.length){ const listJson = JSON.stringify(resp.data) @@ -240,9 +251,9 @@ } } else { if (resp.data && resp.data.length > 3) { - const arr = resp.data.slice(0, 3) + arr = resp.data.slice(0, 3) } else { - const arr = resp.data + arr = resp.data } if(arr&&arr.length){ const listJson = JSON.stringify(arr) @@ -289,7 +300,7 @@ const arr = resp.data const listJson = JSON.stringify(arr) uni.navigateTo({ - url: "/pages/questionBank/practiceExams?title=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson + url: "/pages/index/testTip?subject=" + this.subject + "&questionIdList=" + listJson }) } else if (resp.code === '4001') { uni.showToast({ @@ -308,6 +319,7 @@ ...param }).then(async (resp) => { if (resp.code === '0000') { + let arr = [] if (this.token) { await this.searchUserVip() const result = this.vipOnList.some(item => item.subjects.includes(this.subject)) @@ -317,13 +329,13 @@ }) } else { if (resp.data && resp.data.length > 3) { - const arr = resp.data.slice(0, 3) + arr = resp.data.slice(0, 3) } else { - const arr = resp.data + arr = resp.data } const listJson = JSON.stringify(arr) uni.navigateTo({ - url: "/pages/questionBank/practiceExams?title=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson+"&needVip="+result + url: "/pages/index/videoVip?subject=" + this.subject }) } } else { diff --git a/src/pages/index/components/Subject2.vue b/src/pages/index/components/Subject2.vue index 718ffda..4ec9b0a 100644 --- a/src/pages/index/components/Subject2.vue +++ b/src/pages/index/components/Subject2.vue @@ -94,7 +94,7 @@ } }, async mounted() { - await this.getDiverType() + // await this.getDiverType() }, computed: { ...mapState(useUserStore, ["vipOnList", "token"]) @@ -134,9 +134,9 @@ "subject": String(this.subject), "type": "2" }).then(resp => { - if (resp.code === '0000') { + if (resp.code === '0000' && resp.data &&resp.data.length) { this.baseList = resp.data - this.videoList = resp.data[0] ? resp.data[0].videoList.slice(0, 5) : [] + this.videoList = resp.data[0] && resp.data[0].videoList? resp.data[0].videoList.slice(0, 5) : [] } }) }, @@ -148,20 +148,35 @@ const formatSecond = second > 59 ? 59 : second return `${hours > 0 ? `${hours}:` : ''}${minute < 10 ? '0' + minute : minute}:${formatSecond < 10 ? '0' + formatSecond : formatSecond}` }, - toVideo() { - let arr = JSON.parse(JSON.stringify(this.operateList)) - arr = arr.map(item => { - return { - ...item, - videoUrl: item.videoList[0]?.videoUrl, - videoTime: this.formateTime(item.videoList[0]?.videoTime) + async toVideo() { + if (this.token) { + await this.searchUserVip() + const res = this.vipOnList.some(item => item.subjects.includes(this.subject)) + if (!res) { + uni.navigateTo({ + url:"/pages/index/videoVip?subject="+this.subject + }) + }else{ + let arr = JSON.parse(JSON.stringify(this.operateList)) + arr = arr.map(item => { + return { + ...item, + videoUrl: item.videoList[0]?.videoUrl, + videoTime: this.formateTime(item.videoList[0]?.videoTime) + } + }) + let jsonString = JSON.stringify(arr) + console.log('arr',jsonString); + uni.navigateTo({ + url: "/pages/questionBank/videoDetail?videoList=" + jsonString + "&subject=" + this.subject + + "&projectId=" + this.projectId + "&type=1&driveType=2" + }) } - }) - let jsonString = JSON.stringify(arr) - uni.navigateTo({ - url: "/pages/questionBank/videoDetail?videoList=" + jsonString + "&subject=" + this.subject + - "&projectId=" + this.projectId + "&type=1" - }) + } else { + uni.redirectTo({ + url: '/pages/login/login' + }); + } }, toOperateDetail(val) { let arr = JSON.parse(JSON.stringify(this.baseList[0].videoList)) @@ -186,8 +201,10 @@ "subject": String(this.subject), "type": "1" }).then(resp => { - this.operateList = resp.data - this.projectId = this.operateList[0]?.projectId + if(resp.code==='0000'){ + this.operateList = resp.data + this.projectId = this.operateList[0]?.projectId + } }) }, getDiverType() { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index a0da109..647b361 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -11,7 +11,7 @@ - + @@ -41,6 +41,7 @@ }, data() { return { + show:false, subject: storage.get('curSubject') || '1', curTab: 0, searchValue: '', @@ -50,27 +51,39 @@ wrongList: storage.get(`wrongList_subject${this.subject}`) || [], }; }, - onLoad() { - this.curTab=Number(this.curSubject)-1 - this.getSubjectConfig() - }, onShow() { + this.show=true + this.getSubjectConfig() if (this.subject == '1' || this.subject == '4') { this.rightList = storage.get(`rightList_subject${this.subject}`) || [] this.wrongList = storage.get(`wrongList_subject${this.subject}`) || [] } + if(this.subject=='2'||this.subject=='3'){ + this.$refs.subjectRef.getDiverType() + } + }, + onHide(){ + this.show=false }, 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 } }, + watch:{ + getLoading(newVal){ + if(this.show){ + if(newVal){ + if(this.loading_subject4 && this.loading_subject1){ + uni.hideTabBar(); + } + }else{ + uni.showTabBar() + } + } + } + }, methods: { ...mapActions(useQuestionStore, ['getOrderQuestion_sub4', 'getOrderQuestion_sub1', 'changeSubject']), //获取科目配置 @@ -84,6 +97,8 @@ name: item.configItemName } }) + this.subject=storage.get('curSubject') || '1', + this.curTab=this.categoryList.findIndex(item=>item.configItemCode==this.subject) } }) }, diff --git a/src/pages/index/testTip.vue b/src/pages/index/testTip.vue new file mode 100644 index 0000000..c593206 --- /dev/null +++ b/src/pages/index/testTip.vue @@ -0,0 +1,83 @@ + + + + + \ No newline at end of file diff --git a/src/pages/index/videoVip.vue b/src/pages/index/videoVip.vue index a7f5078..b503a63 100644 --- a/src/pages/index/videoVip.vue +++ b/src/pages/index/videoVip.vue @@ -1,35 +1,69 @@ - + @@ -96,6 +96,7 @@ diff --git a/src/pages/me/tijian.vue b/src/pages/me/tijian.vue index bcbeb2f..bfb872b 100644 --- a/src/pages/me/tijian.vue +++ b/src/pages/me/tijian.vue @@ -24,11 +24,11 @@ 第二步 核实后再提交 - - + + - - + + @@ -42,6 +42,9 @@ diff --git a/src/pages/me/uploadPic.vue b/src/pages/me/uploadPic.vue index 8de9c9e..80415bd 100644 --- a/src/pages/me/uploadPic.vue +++ b/src/pages/me/uploadPic.vue @@ -5,36 +5,36 @@ - - - - - - - + + + + + + + 点击 - - + + 第二步 核实后再提交 - - + + - - + + - + @@ -42,6 +42,9 @@ @@ -214,4 +218,9 @@ ::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/vip.vue b/src/pages/me/vip.vue index 816943b..d487a42 100644 --- a/src/pages/me/vip.vue +++ b/src/pages/me/vip.vue @@ -1,345 +1,393 @@