Browse Source

预约流程对接

master
unknown 10 months ago
parent
commit
1fbd8da844
  1. 1
      components/nodata/nodata.vue
  2. 2
      config/request.js
  3. 26
      pages/carEntry/examineAppointment/comp/pickDate.vue
  4. 39
      pages/carEntry/simulateAppointment/comp/pickDate.vue
  5. 2
      pages/carEntry/simulateAppointment/comp/step2.vue
  6. 3
      pages/indexEntry/theory/theory.vue
  7. 2
      pages/mineEntry/myAppointment/myAppointment.vue
  8. 27
      pages/tabbar/index/index.vue
  9. 8
      pages/tabbar/learnCar/comp/subject1.vue
  10. 2
      pages/tabbar/learnCar/comp/subject2.vue
  11. 4
      pages/tabbar/learnCar/comp/subject3.vue
  12. 9
      store/modules/user.js

1
components/nodata/nodata.vue

@ -20,6 +20,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
padding-bottom: 40rpx;
} }
.img { .img {
width: 438rpx;height: 286rpx; width: 438rpx;height: 286rpx;

2
config/request.js

@ -48,7 +48,6 @@ module.exports = (vm) => {
// console.log(data) // console.log(data)
if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') { if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') {
await vm.$store.dispatch('refreshToken') await vm.$store.dispatch('refreshToken')
setTimeout(()=>{
let obj = response.config let obj = response.config
let method = obj.method.toLowerCase() let method = obj.method.toLowerCase()
if(method=='get') { if(method=='get') {
@ -56,7 +55,6 @@ module.exports = (vm) => {
}else{ }else{
return uni.$u.http[method](obj.url, obj.data ) return uni.$u.http[method](obj.url, obj.data )
} }
})
} }
if(data.code==401) { if(data.code==401) {
vm.$store.commit('goLogin') vm.$store.commit('goLogin')

26
pages/carEntry/examineAppointment/comp/pickDate.vue

@ -33,26 +33,14 @@
<view class="h2" v-if="timerArr.length">上午</view> <view class="h2" v-if="timerArr.length">上午</view>
<view class="time_box"> <view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}" > <view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}" >
<view class="flex" v-if="item.status==0">
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSum}} </view>
<view class="iconArrowBg" v-if="item.appointmentAlreadyCount">
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon>
</view>
</view>
<view class="lab" v-else>{{ statusTxt[item.status] }}</view>
<view class="lab">{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view> <view class="time">{{ item.classTime }}</view>
</view> </view>
</view> </view>
<view class="h2" v-if="timerArr2.length">下午</view> <view class="h2" v-if="timerArr2.length">下午</view>
<view class="time_box"> <view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}"> <view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}">
<view class="flex" v-if="item.status==0">
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSum}} </view>
<view class="iconArrowBg" v-if="item.appointmentAlreadyCount">
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon>
</view>
</view>
<view class="lab" v-else>{{ statusTxt[item.status] }}</view>
<view class="lab">{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view> <view class="time">{{ item.classTime }}</view>
</view> </view>
</view> </view>
@ -129,9 +117,12 @@
methods: { methods: {
// //
async examSimulationClassFn() { 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} 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) const {data: res} = await examSimulationClass(obj)
uni.hideLoading()
this.timerArr2 = res.afternoonSimulationClass this.timerArr2 = res.afternoonSimulationClass
this.timerArr = res.morningSimulationClass this.timerArr = res.morningSimulationClass
// //
@ -142,9 +133,6 @@
let date = this.chooseDay+' '+(item.classTime.split('-')[0]) let date = this.chooseDay+' '+(item.classTime.split('-')[0])
date = date.replace(/-/g,'/'); date = date.replace(/-/g,'/');
let timer2 = new Date(date).getTime(); let timer2 = new Date(date).getTime();
// console.log(timer)
// console.log(timer2)
// console.log(date)
if(timer>timer2) { if(timer>timer2) {
item.status = 2 item.status = 2
} }
@ -188,6 +176,8 @@
if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期') if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期')
this.currentDay = this.currentDay + num this.currentDay = this.currentDay + num
this.chooseDay = this.dateArr[this.currentDay][0].date this.chooseDay = this.dateArr[this.currentDay][0].date
this.FormData.courseIds = this.courseIds = ''
this.examSimulationClassFn()
}, },
chooseCourse(item) { chooseCourse(item) {
if(item.status!=0) return if(item.status!=0) return

39
pages/carEntry/simulateAppointment/comp/pickDate.vue

@ -33,26 +33,14 @@
<view class="h2" v-if="timerArr.length">上午</view> <view class="h2" v-if="timerArr.length">上午</view>
<view class="time_box"> <view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}" > <view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}" >
<view class="flex" v-if="item.status==0">
<view class="lab">{{ item.alreadyAppointmentCount ||0 }} <text>/</text> {{ item.appointmentSum}}</view>
<view class="iconArrowBg" v-if="item.alreadyAppointmentCount">
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon>
</view>
</view>
<view class="lab" v-else>{{ statusTxt[item.status] }}</view>
<view class="lab">{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view> <view class="time">{{ item.classTime }}</view>
</view> </view>
</view> </view>
<view class="h2" v-if="timerArr2.length">下午</view> <view class="h2" v-if="timerArr2.length">下午</view>
<view class="time_box"> <view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}"> <view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}">
<view class="flex" v-if="item.status==0">
<view class="lab">{{ item.alreadyAppointmentCount ||0 }} <text>/</text> {{ item.appointmentSum}} </view>
<view class="iconArrowBg" v-if="item.alreadyAppointmentCount">
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon>
</view>
</view>
<view class="lab" v-else>{{ statusTxt[item.status] }}</view>
<view class="lab">{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view> <view class="time">{{ item.classTime }}</view>
</view> </view>
</view> </view>
@ -92,7 +80,7 @@
chooseDay: '', chooseDay: '',
chooseMonth: '', chooseMonth: '',
timerArr: [], timerArr: [],
statusTxt: ['可预约', '已过期', '已约满', ], //0 2 3
statusTxt: ['可预约', '未开放', '已过期', '已约满', '已约过'], //0 1,2,3
timerArr2: [], timerArr2: [],
chooseTimerId: '', chooseTimerId: '',
endDate: null, endDate: null,
@ -129,13 +117,14 @@
methods: { methods: {
// //
async simulationClassFn() { 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} let obj = { "pointId": this.FormData.pointId, "trainType": this.FormData.trainType, "classDate":this.chooseDay, "studentId": this.FormData.studentId}
const {data: res} = await simulationClass(obj) const {data: res} = await simulationClass(obj)
this.timerArr2 = res.afternoonSimulationClass this.timerArr2 = res.afternoonSimulationClass
this.timerArr = res.morningSimulationClass this.timerArr = res.morningSimulationClass
console.log('this.timerArr')
console.log(this.timerArr)
uni.hideLoading()
// //
if(this.chooseDay==this.dateArr[0][0].date) { if(this.chooseDay==this.dateArr[0][0].date) {
let arr = [...this.timerArr,...this.timerArr2] let arr = [...this.timerArr,...this.timerArr2]
@ -144,9 +133,6 @@
let date = this.chooseDay+' '+(item.classTime.split('-')[0]) let date = this.chooseDay+' '+(item.classTime.split('-')[0])
date = date.replace(/-/g,'/'); date = date.replace(/-/g,'/');
let timer2 = new Date(date).getTime(); let timer2 = new Date(date).getTime();
// console.log(timer)
// console.log(timer2)
// console.log(date)
if(timer>timer2) { if(timer>timer2) {
item.status = 2 item.status = 2
} }
@ -156,12 +142,16 @@
// //
async initDate() { async initDate() {
this.startDate = this.$u.timeFormat(new Date()*1, 'yyyy-mm-dd'); 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.minDate = new Date()*1
this.dateArr = getDates(this.startDate, this.endDate); this.dateArr = getDates(this.startDate, this.endDate);
this.chooseDay = this.dateArr[0][0].date this.chooseDay = this.dateArr[0][0].date
console.log(this.dateArr)
console.log(this.startDate)
console.log(this.endDate)
this.simulationClassFn() this.simulationClassFn()
}, },
// //
@ -180,6 +170,7 @@
}, },
// //
chooseDate(item) { chooseDate(item) {
this.FormData.courseIds = []
this.chooseDay = item.date this.chooseDay = item.date
this.simulationClassFn() this.simulationClassFn()
console.log('*****') console.log('*****')
@ -190,6 +181,8 @@
if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期') if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期')
this.currentDay = this.currentDay + num this.currentDay = this.currentDay + num
this.chooseDay = this.dateArr[this.currentDay][0].date this.chooseDay = this.dateArr[this.currentDay][0].date
this.FormData.courseIds = []
this.simulationClassFn()
}, },
chooseCourse(item) { chooseCourse(item) {
if(item.status!=0) return if(item.status!=0) return

2
pages/carEntry/simulateAppointment/comp/step2.vue

@ -28,7 +28,7 @@
methods: { methods: {
changeStep(val) { changeStep(val) {
if(!this.FormData.courseIds) return this.$toast('请选择预约时间段')
if(!this.FormData.courseIds) return this.$u.toast('请选择预约时间段')
this.$emit('changeStep', val) this.$emit('changeStep', val)
}, },

3
pages/indexEntry/theory/theory.vue

@ -29,6 +29,9 @@
currentId: 2, currentId: 2,
} }
}, },
onLoad(options) {
if(options.type) this.currentId = options.type
},
methods: { methods: {
changeNav(item) { changeNav(item) {
this.currentId = item.id this.currentId = item.id

2
pages/mineEntry/myAppointment/myAppointment.vue

@ -62,7 +62,7 @@
{text: '已过期', id: 3}, {text: '已过期', id: 3},
], ],
// 012退39 // 012退39
currentTab: 3,
currentTab: 2,
currentNav: 0, currentNav: 0,
params: { "pageNo": 1, "pageSize": 10, "keyWord": "", "status": '0',studentId: '', keyWord: ''}, params: { "pageNo": 1, "pageSize": 10, "keyWord": "", "status": '0',studentId: '', keyWord: ''},
list: [], list: [],

27
pages/tabbar/index/index.vue

@ -252,12 +252,7 @@
swiperDotIndex: 0, swiperDotIndex: 0,
current: 1, current: 1,
mode: 'default', mode: 'default',
swiperInfo: [{
img: require('../../../static/images/index/ic_lilun.png'),
text: '2023年6月份江西省机动车驾驶培训机构考试合格率的通报',
date: '2023/08/09'
}
],
swiperInfo: [],
dotsStyles: { dotsStyles: {
backgroundColor: '#E8E9EC', backgroundColor: '#E8E9EC',
border: '1px #E8E9EC solid', border: '1px #E8E9EC solid',
@ -269,7 +264,7 @@
} }
}, },
async onLoad() { async onLoad() {
this.getarticleListFn()
// this.getarticleListFn()
// uni.getLocation({ // uni.getLocation({
// type: 'wgs84', // type: 'wgs84',
// success: function (res) { // success: function (res) {
@ -288,11 +283,12 @@
onShow() { onShow() {
this.$store.dispatch('getUserInfo') this.$store.dispatch('getUserInfo')
if(!this.swiperInfo.length) {
this.getarticleListFn()
}
}, },
computed: { computed: {
// joe() {
// return ''
// }
}, },
methods: { methods: {
entrySectionClick(item) { entrySectionClick(item) {
@ -305,8 +301,15 @@
const {data: res} = await getarticleList(this.params) const {data: res} = await getarticleList(this.params)
this.swiperInfo = res.list[0].articleManagementDO 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') // this.$store.dispatch('getUserInfo')
}, },
close() { close() {

8
pages/tabbar/learnCar/comp/subject1.vue

@ -6,7 +6,7 @@
<view class="card"> <view class="card">
<view class="flex-b"> <view class="flex-b">
<view class="lab">理论学习</view> <view class="lab">理论学习</view>
<view class="btn">去学习</view>
<view class="btn" @click="$goPage('/pages/indexEntry/theory/theory?type=2')">去学习</view>
</view> </view>
</view> </view>
<view class="card"> <view class="card">
@ -19,7 +19,7 @@
<view class="card mb0"> <view class="card mb0">
<view class="flex-b"> <view class="flex-b">
<view class="lab">安全警示教育在线视频学习</view> <view class="lab">安全警示教育在线视频学习</view>
<view class="btn">去学习</view>
<view class="btn" @click="$goPage('/pages/indexEntry/theory/theory?type=3')">去学习</view>
</view> </view>
</view> </view>
</view> </view>
@ -59,7 +59,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="card">
<!-- <view class="card">
<view class="flex-b"> <view class="flex-b">
<view class="lab">科目一学时已通过</view> <view class="lab">科目一学时已通过</view>
<view class="date">2023/07/24 03:12:20</view> <view class="date">2023/07/24 03:12:20</view>
@ -70,7 +70,7 @@
<view class="btn" @click="$goPage('/pages/carEntry/operaAppointment/operaAppointment?subject=2')">去预约</view> <view class="btn" @click="$goPage('/pages/carEntry/operaAppointment/operaAppointment?subject=2')">去预约</view>
</view> </view>
</view> </view>
</view>
</view> -->
</view> </view>
</view> </view>
</template> </template>

2
pages/tabbar/learnCar/comp/subject2.vue

@ -4,7 +4,7 @@
<view class="learnCon"> <view class="learnCon">
<view class="h1">学习内容</view> <view class="h1">学习内容</view>
<view class="card"> <view class="card">
<view class="flex-b">
<view class="flex-b"@click="$goPage('/pages/carEntry/operaAppointment/operaAppointment?subject=2')">
<view class="lab">实操训练</view> <view class="lab">实操训练</view>
<view class="btn">去预约</view> <view class="btn">去预约</view>
</view> </view>

4
pages/tabbar/learnCar/comp/subject3.vue

@ -6,7 +6,7 @@
<view class="card"> <view class="card">
<view class="flex-b"> <view class="flex-b">
<view class="lab">实操训练</view> <view class="lab">实操训练</view>
<view class="btn">去预约</view>
<view class="btn" @click="$goPage('/pages/carEntry/operaAppointment/operaAppointment?subject=3')">去预约</view>
</view> </view>
</view> </view>
<view class="card mb0"> <view class="card mb0">
@ -86,7 +86,7 @@
<view class="text">核销时间2023/08/16 14:00</view> <view class="text">核销时间2023/08/16 14:00</view>
</view> </view>
</view> </view>
<view class="cancel">取消预约</view>
<!-- <view class="cancel">取消预约</view> -->
</view> </view>
</view> </view>
</view> </view>

9
store/modules/user.js

@ -88,29 +88,30 @@ const user = {
}, },
// 刷新token // 刷新token
async refreshToken({state, commit}) { async refreshToken({state, commit}) {
return new Promise(async(resolve, reject)=>{
if(!state.apiOk) { if(!state.apiOk) {
return state.refreshTokenFn return state.refreshTokenFn
} }
commit('update_apiOk',false) commit('update_apiOk',false)
state.refreshTokenFn = null
const http = uni.$u.http const http = uni.$u.http
let config = { header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}, custom: { noToken: true } } let config = { header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}, custom: { noToken: true } }
let refreshToken = state.vuex_loginInfo.refreshToken let refreshToken = state.vuex_loginInfo.refreshToken
state.refreshTokenFn = await http.post('member/auth/refresh-token',{refreshToken}, config) state.refreshTokenFn = await http.post('member/auth/refresh-token',{refreshToken}, config)
if(state.refreshTokenFn.data||state.refreshTokenFn.data.accessToken) { if(state.refreshTokenFn.data||state.refreshTokenFn.data.accessToken) {
console.log('刷新token结果')
console.log(state.refreshTokenFn)
commit('update_apiOk',true) commit('update_apiOk',true)
commit('update_vuex_loginInfo',state.refreshTokenFn.data) commit('update_vuex_loginInfo',state.refreshTokenFn.data)
uni.$u.http.setConfig((config) => { uni.$u.http.setConfig((config) => {
config.header.Authorization = 'Bearer ' + state.refreshTokenFn.data.accessToken config.header.Authorization = 'Bearer ' + state.refreshTokenFn.data.accessToken
return config return config
}) })
resolve(state.refreshTokenFn)
}else { }else {
commit('update_apiOk',true) commit('update_apiOk',true)
commit('goLogin') commit('goLogin')
return false
reject('刷新token失败了')
} }
})
} }
} }
} }

Loading…
Cancel
Save