diff --git a/components/nodata/nodata.vue b/components/nodata/nodata.vue index 4a6c766..1c3c6e9 100644 --- a/components/nodata/nodata.vue +++ b/components/nodata/nodata.vue @@ -20,6 +20,7 @@ align-items: center; justify-content: center; flex-direction: column; + padding-bottom: 40rpx; } .img { width: 438rpx;height: 286rpx; diff --git a/config/request.js b/config/request.js index 7605741..dab7f40 100644 --- a/config/request.js +++ b/config/request.js @@ -48,15 +48,13 @@ module.exports = (vm) => { // console.log(data) if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') { await vm.$store.dispatch('refreshToken') - setTimeout(()=>{ - let obj = response.config - let method = obj.method.toLowerCase() - if(method=='get') { - return uni.$u.http[method](obj.url, {params: obj.params}) - }else{ - return uni.$u.http[method](obj.url, obj.data ) - } - }) + let obj = response.config + let method = obj.method.toLowerCase() + if(method=='get') { + return uni.$u.http[method](obj.url, {params: obj.params}) + }else{ + return uni.$u.http[method](obj.url, obj.data ) + } } if(data.code==401) { vm.$store.commit('goLogin') diff --git a/pages/carEntry/examineAppointment/comp/pickDate.vue b/pages/carEntry/examineAppointment/comp/pickDate.vue index 59a5108..ccb16eb 100644 --- a/pages/carEntry/examineAppointment/comp/pickDate.vue +++ b/pages/carEntry/examineAppointment/comp/pickDate.vue @@ -33,26 +33,14 @@ 上午 - - {{ item.appointmentAlreadyCount ||0 }} / {{ item.appointmentSum}} - - - - - {{ statusTxt[item.status] }} + {{ statusTxt[item.status] }} {{ item.classTime }} 下午 - - {{ item.appointmentAlreadyCount ||0 }} / {{ item.appointmentSum}} - - - - - {{ statusTxt[item.status] }} + {{ statusTxt[item.status] }} {{ item.classTime }} @@ -129,9 +117,12 @@ methods: { // 获得排课 async examSimulationClassFn() { + uni.showLoading({ + title: '正在加载...' + }) let obj = { "examSiteId": this.FormData.examSiteId, "examCarId": this.FormData.carId, "trainType": this.FormData.trainType, "subject": this.FormData.subject, "classDate": this.chooseDay} const {data: res} = await examSimulationClass(obj) - + uni.hideLoading() this.timerArr2 = res.afternoonSimulationClass this.timerArr = res.morningSimulationClass // 如果是今天的日期检查有没有过期 @@ -142,9 +133,6 @@ let date = this.chooseDay+' '+(item.classTime.split('-')[0]) date = date.replace(/-/g,'/'); let timer2 = new Date(date).getTime(); - // console.log(timer) - // console.log(timer2) - // console.log(date) if(timer>timer2) { item.status = 2 } @@ -188,6 +176,8 @@ if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期') this.currentDay = this.currentDay + num this.chooseDay = this.dateArr[this.currentDay][0].date + this.FormData.courseIds = this.courseIds = '' + this.examSimulationClassFn() }, chooseCourse(item) { if(item.status!=0) return diff --git a/pages/carEntry/simulateAppointment/comp/pickDate.vue b/pages/carEntry/simulateAppointment/comp/pickDate.vue index 07be56b..ba3cb98 100644 --- a/pages/carEntry/simulateAppointment/comp/pickDate.vue +++ b/pages/carEntry/simulateAppointment/comp/pickDate.vue @@ -33,26 +33,14 @@ 上午 - - {{ item.alreadyAppointmentCount ||0 }} / {{ item.appointmentSum}} - - - - - {{ statusTxt[item.status] }} + {{ statusTxt[item.status] }} {{ item.classTime }} 下午 - - {{ item.alreadyAppointmentCount ||0 }} / {{ item.appointmentSum}} - - - - - {{ statusTxt[item.status] }} + {{ statusTxt[item.status] }} {{ item.classTime }} @@ -92,7 +80,7 @@ chooseDay: '', chooseMonth: '', timerArr: [], - statusTxt: ['可预约', '已过期', '已约满', ], //状态0、正常 2、已过期 3、已约满 + statusTxt: ['可预约', '未开放', '已过期', '已约满', '已约过'], //状态0、未过期 1、无排课,2、已过期,3已约满 timerArr2: [], chooseTimerId: '', endDate: null, @@ -129,13 +117,14 @@ methods: { // 获得排课 async simulationClassFn() { - // let id = this.vuex_userInfo.id + uni.showLoading({ + title: '正在加载...' + }) let obj = { "pointId": this.FormData.pointId, "trainType": this.FormData.trainType, "classDate":this.chooseDay, "studentId": this.FormData.studentId} const {data: res} = await simulationClass(obj) this.timerArr2 = res.afternoonSimulationClass this.timerArr = res.morningSimulationClass - console.log('this.timerArr') - console.log(this.timerArr) + uni.hideLoading() // 如果是今天的日期检查有没有过期 if(this.chooseDay==this.dateArr[0][0].date) { let arr = [...this.timerArr,...this.timerArr2] @@ -144,9 +133,6 @@ let date = this.chooseDay+' '+(item.classTime.split('-')[0]) date = date.replace(/-/g,'/'); let timer2 = new Date(date).getTime(); - // console.log(timer) - // console.log(timer2) - // console.log(date) if(timer>timer2) { item.status = 2 } @@ -156,12 +142,16 @@ // 初始化日期 async initDate() { this.startDate = this.$u.timeFormat(new Date()*1, 'yyyy-mm-dd'); - this.maxDate = this.endDate = new Date('2023-11-30')*1 + let startArr = this.startDate.split('-') + startArr[1] = startArr[1]*1+1 + let startStr = startArr.join('-') + this.maxDate = this.endDate = new Date(startStr)*1 this.minDate = new Date()*1 this.dateArr = getDates(this.startDate, this.endDate); this.chooseDay = this.dateArr[0][0].date - console.log(this.dateArr) + console.log(this.startDate) + console.log(this.endDate) this.simulationClassFn() }, // 点击月份 @@ -180,6 +170,7 @@ }, // 选择日期 chooseDate(item) { + this.FormData.courseIds = [] this.chooseDay = item.date this.simulationClassFn() console.log('*****') @@ -190,6 +181,8 @@ if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期') this.currentDay = this.currentDay + num this.chooseDay = this.dateArr[this.currentDay][0].date + this.FormData.courseIds = [] + this.simulationClassFn() }, chooseCourse(item) { if(item.status!=0) return diff --git a/pages/carEntry/simulateAppointment/comp/step2.vue b/pages/carEntry/simulateAppointment/comp/step2.vue index 2fc2cdc..e5a1e83 100644 --- a/pages/carEntry/simulateAppointment/comp/step2.vue +++ b/pages/carEntry/simulateAppointment/comp/step2.vue @@ -28,7 +28,7 @@ methods: { changeStep(val) { - if(!this.FormData.courseIds) return this.$toast('请选择预约时间段') + if(!this.FormData.courseIds) return this.$u.toast('请选择预约时间段') this.$emit('changeStep', val) }, diff --git a/pages/indexEntry/theory/theory.vue b/pages/indexEntry/theory/theory.vue index cf45e6c..1f0dcfc 100644 --- a/pages/indexEntry/theory/theory.vue +++ b/pages/indexEntry/theory/theory.vue @@ -29,6 +29,9 @@ currentId: 2, } }, + onLoad(options) { + if(options.type) this.currentId = options.type + }, methods: { changeNav(item) { this.currentId = item.id diff --git a/pages/mineEntry/myAppointment/myAppointment.vue b/pages/mineEntry/myAppointment/myAppointment.vue index d64a056..802c73b 100644 --- a/pages/mineEntry/myAppointment/myAppointment.vue +++ b/pages/mineEntry/myAppointment/myAppointment.vue @@ -62,7 +62,7 @@ {text: '已过期', id: 3}, ], // 0:未签到,1:已签到,2:已签退,3:旷课,9:已取消 - currentTab: 3, + currentTab: 2, currentNav: 0, params: { "pageNo": 1, "pageSize": 10, "keyWord": "", "status": '0',studentId: '', keyWord: ''}, list: [], diff --git a/pages/tabbar/index/index.vue b/pages/tabbar/index/index.vue index cd1a2ee..1f7eea2 100644 --- a/pages/tabbar/index/index.vue +++ b/pages/tabbar/index/index.vue @@ -252,12 +252,7 @@ swiperDotIndex: 0, current: 1, mode: 'default', - swiperInfo: [{ - img: require('../../../static/images/index/ic_lilun.png'), - text: '2023年6月份江西省机动车驾驶培训机构考试合格率的通报', - date: '2023/08/09' - } - ], + swiperInfo: [], dotsStyles: { backgroundColor: '#E8E9EC', border: '1px #E8E9EC solid', @@ -269,7 +264,7 @@ } }, async onLoad() { - this.getarticleListFn() + // this.getarticleListFn() // uni.getLocation({ // type: 'wgs84', // success: function (res) { @@ -288,11 +283,12 @@ onShow() { this.$store.dispatch('getUserInfo') + if(!this.swiperInfo.length) { + this.getarticleListFn() + } }, computed: { - // joe() { - // return '我的名字' - // } + }, methods: { entrySectionClick(item) { @@ -305,8 +301,15 @@ const {data: res} = await getarticleList(this.params) this.swiperInfo = res.list[0].articleManagementDO }, - refereshFn() { - this.$store.dispatch('refreshToken') + async refereshFn() { + const res = await this.$store.dispatch('refreshToken') + console.log(res) + uni.$u.http.setConfig((config) => { + config.header.Authorization = 'Bearer ' + this.$store.state.user.vuex_loginInfo.accessToken + console.log(111) + return config + }) + console.log(222) // this.$store.dispatch('getUserInfo') }, close() { diff --git a/pages/tabbar/learnCar/comp/subject1.vue b/pages/tabbar/learnCar/comp/subject1.vue index e1fd628..d479fe1 100644 --- a/pages/tabbar/learnCar/comp/subject1.vue +++ b/pages/tabbar/learnCar/comp/subject1.vue @@ -6,7 +6,7 @@ 理论学习 - 去学习 + 去学习 @@ -19,7 +19,7 @@ 安全警示教育在线视频学习 - 去学习 + 去学习 @@ -59,7 +59,7 @@ - + diff --git a/pages/tabbar/learnCar/comp/subject2.vue b/pages/tabbar/learnCar/comp/subject2.vue index ed91c5f..7a46061 100644 --- a/pages/tabbar/learnCar/comp/subject2.vue +++ b/pages/tabbar/learnCar/comp/subject2.vue @@ -4,7 +4,7 @@ 学习内容 - + 实操训练 去预约 diff --git a/pages/tabbar/learnCar/comp/subject3.vue b/pages/tabbar/learnCar/comp/subject3.vue index 5e0e80b..e8bb41b 100644 --- a/pages/tabbar/learnCar/comp/subject3.vue +++ b/pages/tabbar/learnCar/comp/subject3.vue @@ -6,7 +6,7 @@ 实操训练 - 去预约 + 去预约 @@ -86,7 +86,7 @@ 核销时间:2023/08/16 14:00 - 取消预约 + diff --git a/store/modules/user.js b/store/modules/user.js index f3f2ad8..b940828 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -88,29 +88,30 @@ const user = { }, // 刷新token async refreshToken({state, commit}) { - if(!state.apiOk) { - return state.refreshTokenFn - } - commit('update_apiOk',false) - const http = uni.$u.http - let config = { header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}, custom: { noToken: true } } - let refreshToken = state.vuex_loginInfo.refreshToken - state.refreshTokenFn = await http.post('member/auth/refresh-token',{refreshToken}, config) - if(state.refreshTokenFn.data||state.refreshTokenFn.data.accessToken) { - console.log('刷新token结果') - console.log(state.refreshTokenFn) - commit('update_apiOk',true) - commit('update_vuex_loginInfo',state.refreshTokenFn.data) - uni.$u.http.setConfig((config) => { - config.header.Authorization = 'Bearer ' + state.refreshTokenFn.data.accessToken - return config - }) - }else { - commit('update_apiOk',true) - commit('goLogin') - return false - } - + return new Promise(async(resolve, reject)=>{ + if(!state.apiOk) { + return state.refreshTokenFn + } + commit('update_apiOk',false) + state.refreshTokenFn = null + const http = uni.$u.http + let config = { header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}, custom: { noToken: true } } + let refreshToken = state.vuex_loginInfo.refreshToken + state.refreshTokenFn = await http.post('member/auth/refresh-token',{refreshToken}, config) + if(state.refreshTokenFn.data||state.refreshTokenFn.data.accessToken) { + commit('update_apiOk',true) + commit('update_vuex_loginInfo',state.refreshTokenFn.data) + uni.$u.http.setConfig((config) => { + config.header.Authorization = 'Bearer ' + state.refreshTokenFn.data.accessToken + return config + }) + resolve(state.refreshTokenFn) + }else { + commit('update_apiOk',true) + commit('goLogin') + reject('刷新token失败了') + } + }) } } }