Browse Source

实操

master
unknown 10 months ago
parent
commit
b5264ffd6c
  1. 4
      components/nodata/nodata.vue
  2. 5
      config/api.js
  3. 38
      config/request.js
  4. 2
      config/utils.js
  5. 17
      pages/carEntry/operaAppointment/comp/coachInfo.vue
  6. 35
      pages/carEntry/operaAppointment/comp/pickDate.vue
  7. 25
      pages/carEntry/operaAppointment/comp/step1.vue
  8. 12
      pages/carEntry/operaAppointment/comp/step2.vue
  9. 53
      pages/carEntry/operaAppointment/operaAppointment.vue
  10. 2
      pages/tabbar/index/index.vue
  11. 165
      pages/tabbar/learnCar/index - 副本.vue
  12. 17
      store/modules/user.js

4
components/nodata/nodata.vue

@ -4,7 +4,9 @@
<image src="https://jiangxijiakao-1.oss-cn-hangzhou.aliyuncs.com/complain/2023-10-09/1696832739095-nodata.png" mode=""></image>
</view>
<view class="text">
<text solt>暂无数据</text>
<slot>
<text>暂无数据</text>
</slot>
</view>
</view>
</template>

5
config/api.js

@ -112,8 +112,6 @@ export const simulationPage = (params) => http.get('business/booking/simulation-
export const simulationDetail = (params) => http.get('business/booking/simulation-record/get', {params})
// 7取消模拟预约
export const cancelSimulationDevice = (params) => http.put('business/booking/simulation-record/cancelSimulation?id='+ params.id,)
// 1新增实操预约记录
export const masterCreate = (data) => http.post('business/booking/master/create', data)
// 1获得考场
export const examSitePage = (params) => http.get('business/exam-site/list', {params})
// 2获得车辆
@ -130,6 +128,9 @@ export const examSimulationGet = (params) => http.get('business/exam-simulation-
export const cancelSimulation = (data) => http.put(`business/exam-simulation-record/cancelSimulation?id=${data.id}`)
// 1获得实操预约排课
export const scheduleClass = (params) => http.get('business/booking/schedule-class/get', {params})
// 2,创建预约记录
export const masterCreate = (data) => http.post('business/booking/master/create', data)

38
config/request.js

@ -16,7 +16,8 @@ module.exports = (vm) => {
config.baseURL = H5_API+ WX_API + prefix; /* 根域名 */
console.log(config.baseURL)
// config.header['content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
config.header['tenant-id'] = vm.$store.state.user.vuex_userInfo.tenantId || 1
config.header['tenant-id'] = '1704459882232553474'
// config.header['tenant-id'] = vm.$store.state.user.vuex_userInfo.tenantId || '1704459882232553474'
return config
})
@ -35,23 +36,33 @@ module.exports = (vm) => {
if(noToken&&config.header.Authorization) {
delete config.header.Authorization
}
console.log(config)
return config
}, config => { // 可使用async await 做异步操作
return Promise.reject(config)
})
// 响应拦截
uni.$u.http.interceptors.response.use((response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
uni.$u.http.interceptors.response.use(async (response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
const data = response.data
console.log(response.config)
console.log('请求结果')
console.log(data)
if(data.code==406) {
// vm.$store.dispatch('refreshToken')
uni.$u.toast('登录过期,请重新登录')
setTimeout(()=>{
vm.$store.commit('goLogin')
},1500)
return false
if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') {
await vm.$store.dispatch('refreshToken')
// uni.$u.toast('登录过期,请重新登录')
// setTimeout(()=>{
// vm.$store.commit('goLogin')
// },1500)
// console.log(response.config)
let obj = response.config
if(obj.method=='GET') {
return uni.$u.http.get(obj.url, {params: obj.params})
}else if(obj.method=='PUT'){
return uni.$u.http.put(obj.url, obj.data )
}else if(obj.method=='POST'){
return uni.$u.http.post(obj.url, obj.data )
}
}
if(data.code==401) {
vm.$store.commit('goLogin')
@ -73,14 +84,7 @@ module.exports = (vm) => {
return new Promise(() => { })
}
}
// 如果不需要token就把header里的token删除,并且不需要去刷新token
let noToken = response.config.custom?.noToken
console.log(response.config.url)
if(!noToken&&response.config.url!=='member/auth/logout') {
checkToken(vm)
}else {
vm.$store.commit('update_apiOk', true)
}
return data === undefined ? {} : data
}, (response) => {
// 对响应错误做点什么 (statusCode !== 200)

2
config/utils.js

@ -135,3 +135,5 @@ export function uploadImgApi(filePath, imgName) {
})
})
}

17
pages/carEntry/operaAppointment/comp/coachInfo.vue

@ -2,12 +2,13 @@
<view class="coachInfo">
<view class="card">
<view class="avatar">
<image src="@/static/images/logo.png" mode=""></image>
<image :src="FormData.photoPath" mode="" @error="handleImageError()"></image>
</view>
<view class="rightTxt">
<view class="name_row">
<view class="name">张三三</view>
<view class="tag">未绑定</view>
<view class="name">{{ FormData.coachName }}</view>
<view class="tag active" v-if="vuex_userInfo.coachId==FormData.coachId">已绑定</view>
<view class="tag" v-else>未绑定</view>
</view>
<moreRight text="预约其它教练课程"/>
</view>
@ -16,6 +17,15 @@
</template>
<script>
export default {
props: ['FormData'],
methods: {
handleImageError() {
console.log('图片加载失败')
this.FormData.photoPath = require('@/static/images/index/avatar.png')
}
}
}
</script>
<style lang="scss" scoped>
@ -31,6 +41,7 @@
height: 98rpx;
border-radius: 50%;
overflow: hidden;
background-color: #F2F2F2;
}
.rightTxt {

35
pages/carEntry/operaAppointment/comp/pickDate.vue

@ -33,26 +33,26 @@
<view class="h2" v-if="timerArr.length">上午</view>
<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="flex" v-if="item.status==0">
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSum}} </view>
<!-- <view class="flex" v-if="item.status==0">
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSumCount}} </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> -->
<view class="lab" >{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view>
</view>
</view>
<view class="h2" v-if="timerArr2.length">下午</view>
<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="flex" v-if="item.status==0">
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSum}} </view>
<!-- <view class="flex" v-if="item.status==0">
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSumCount}} </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> -->
<view class="lab" >{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view>
</view>
</view>
@ -127,11 +127,10 @@
methods: {
//
async scheduleClassFn() {
let obj = { "coachId": this.vuex_userInfo.coachId, "trainType": this.FormData.trainType, "subject": this.FormData.subject, "classDate": this.chooseDay, "studentId": this.userId}
let obj = { "coachId": this.FormData.coachId, "trainType": this.FormData.trainType, "subject": this.FormData.subject, "classDate": this.chooseDay, "studentId": this.FormData.studentId}
const {data: res} = await scheduleClass(obj)
return
this.timerArr2 = res.afternoonSimulationClass
this.timerArr = res.morningSimulationClass
this.timerArr2 = res.afternoonScheduleClass
this.timerArr = res.morningScheduleClass
//
if(this.chooseDay==this.dateArr[0][0].date) {
let arr = [...this.timerArr,...this.timerArr2]
@ -140,14 +139,12 @@
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
}
})
}
console.log(this.timerArr)
},
//
async initDate() {
@ -192,8 +189,12 @@
this.FormData.courseIds = this.courseIds = item.id
this.FormData.classDate = item.classDate
this.FormData.classTime = item.classTime
console.log(item)
this.FormData.carNumber = item.carNumber
this.FormData.siteName = item.siteName
this.FormData.siteAddress = item.siteAddress
this.FormData.latitude = item.latitude
this.FormData.longitude = item.longitude
this.FormData.photoPath = item.photoPath
},
}
}

25
pages/carEntry/operaAppointment/comp/step1.vue

@ -1,20 +1,23 @@
<template>
<view class="step1">
<coachInfo @click.native="showStep2"/>
<coachInfo @click.native="showStep2" :FormData="FormData"/>
<view class="h1">预约时间</view>
<pickDate :FormData="FormData"/>
<view class="" v-if="FormData.carNumber">
<view class="h1">教练车</view>
<view class="card">
<view class="car">
<view class="carTag">赣A98299学</view>
<view class="carTag">{{FormData.carNumber}}</view>
</view>
</view>
</view>
<view class="" v-if="FormData.siteName">
<view class="h1">训练场地</view>
<view class="card" >
<view class="card" @click="$u.utils.openMap(FormData.latitude,FormData.longitude)">
<view class="site">
<view class="leftTxt">
<view class="adrs">某某场地</view>
<view class="adrsTxt">江西省江西市江西区尚坤丁兰国际1190</view>
<view class="adrs">{{FormData.siteName}}</view>
<view class="adrsTxt">{{FormData.siteAddress}}</view>
</view>
<view class="icon">
<image src="@/static/images/car/btn_daohang.png" mode=""></image>
@ -22,9 +25,11 @@
</view>
</view>
</view>
</view>
<view class="poz_btn">
<view class="btn_row" >
<view class="btnBg" @click="changeStep(2)">下一步</view>
<view class="btnBg" @click="openPopup">下一步</view>
</view>
</view>
</view>
@ -43,11 +48,11 @@
},
methods: {
changeStep(num) {
if(this.FormData.coachId) {
openPopup(num) {
if(!this.FormData.courseIds) {
return this.$u.toast('请选择排课日期')
}
this.$emit('changeStep', num)
this.$emit('openPopup', num)
},
showStep2() {
this.$emit('showStep2')

12
pages/carEntry/operaAppointment/comp/step2.vue

@ -31,7 +31,11 @@
pageNo: 1,
pageSize: 20,
schoolId: '',
name: ''
name: '',
teachType: '4',//124
employStatus: 0,
otherCoach: true
},
status: 'loading',
list: [],
@ -46,6 +50,11 @@
changeStep(val) {
this.$emit('changeStep', val)
},
addCoachPage() {
if(this.total>this.list.length) {
this.coachPageFn()
}
},
//
async coachPageFn() {
const {data:res} = await coachPage(this.params)
@ -67,6 +76,7 @@
chooseCoach(item) {
this.FormData.coachId = item.id
this.FormData.coachName = item.name
this.FormData.photoPath = item.photoPath
}
}
}

53
pages/carEntry/operaAppointment/operaAppointment.vue

@ -2,8 +2,8 @@
<view class="pageBgImg">
<topNavbar :title="title"></topNavbar>
<view class="pad" style="padding-bottom: 60rpx;">
<step1 v-if="currentStep==1" @changeStep="changeStep" :FormData="FormData" @showStep2="showStep2"></step1>
<step2 v-if="currentStep==2" @changeStep="changeStep" :FormData="FormData"></step2>
<step1 v-if="currentStep==1" @openPopup="openPopup" :FormData="FormData" @showStep2="showStep2"></step1>
<step2 v-if="currentStep==2" @changeStep="changeStep" :FormData="FormData" ref="step2Ref"></step2>
</view>
<u-popup :show="show" mode="center" :round="8">
@ -20,21 +20,20 @@
</view>
<view class="row">
<view class="lab">预约场地</view>
<view class="val">xxx场地</view>
<view class="val">{{FormData.siteName}}</view>
</view>
<view class="row">
<view class="lab">预约车辆</view>
<view class="val">02号车</view>
<view class="val">{{ FormData.carNumber }}</view>
</view>
<view class="row">
<view class="lab">预约时间</view>
<view class="val">2023/08/08 08:009:00</view>
<view class="val">{{ FormData.classDate}} {{FormData.classTime}}</view>
</view>
</view>
<view class="btn_row">
<view class="border btn" @click="show = false">返回修改</view>
<view class="btn">确认</view>
<view class="btn" @click="masterCreateFn">确认</view>
</view>
</view>
</u-popup>
@ -45,6 +44,7 @@
<script>
import step1 from './comp/step1'
import step2 from './comp/step2'
import { masterCreate } from '@/config/api.js'
export default {
components: { step1, step2,},
data() {
@ -57,10 +57,15 @@
classDate: '',
classTime: '',
licnum: '',
siteName: '',
trainType: 'C1',
coachId: ''
coachId: '',
coachName: '',
carNumber: '',//
siteName: '',//
siteAddress: '',//
photoPath: ''
},
show: false
}
},
@ -73,13 +78,43 @@
}
if(options.subject) this.FormData.subject = options.subject
this.FormData.trainType = this.vuex_userInfo.trainType
this.FormData.studentId = this.vuex_userInfo.id
this.FormData.coachId = this.vuex_userInfo.coachId
this.FormData.coachName = this.vuex_userInfo.coachName
},
onReachBottom() {
if(this.currentStep==2) {
this.$refs.step2Ref.addCoachPage()
}
},
methods: {
changeStep(num) {
this.currentStep = num
},
openPopup() {
this.show = true
},
showStep2() {
this.currentStep = 2
},
async masterCreateFn() {
this.show = false
let obj = {
"studentId": this.FormData.studentId,
"coachId": this.FormData.coachId,
"classDate": this.FormData.classDate,
"selectScheduleClass": [this.FormData.courseIds],
// classId: [this.FormData.courseIds]
}
const {data: res} = await masterCreate(obj)
if(res) {
this.$u.toast('预约成功')
setTimeout(()=>{
this.$goPage('/pages/mineEntry/myAppointment/myAppointment?currentTab=2')
},1500)
}
console.log(res)
}
}
}

2
pages/tabbar/index/index.vue

@ -509,7 +509,7 @@
.imgBox {
width: 184rpx;
height: 148rpx;
background: linear-gradient(180deg, rgba(0, 122, 255, 0.5) 0%, #007AFF 100%);
// background: linear-gradient(180deg, rgba(0, 122, 255, 0.5) 0%, #007AFF 100%);
border-radius: 6rpx;
overflow: hidden;
}

165
pages/tabbar/learnCar/index - 副本.vue

@ -0,0 +1,165 @@
<template>
<view class="content pageBgImg">
<view style="width: 100%;height: 40rpx;"></view>
<view class="status_bar"></view>
<view class="title">江西驾考公共服务平台</view>
<view class="navCard">
<view class="nav_row">
<view class="nav " v-for="(item,index) in navData" :key="index" :class="{active: item.id==currentNav}" @click="changeNav(item.id)">{{ item.text }}</view>
</view>
<view class="time_row">
<view class="time_item">
<view class="lab">应完成学时</view>
<view class="num">100分钟</view>
</view>
<view class="time_item">
<view class="lab">已完成学时</view>
<view class="num">30分钟</view>
<view class="shareTime">*与科目一学时共享</view>
</view>
</view>
<view class="subject3" v-if="currentNav==3">
<view class="chain left">
<image src="@/static/images/index/chain.png" mode=""></image>
</view>
<view class="chain right">
<image src="@/static/images/index/chain.png" mode=""></image>
</view>
<view class="time_row ">
<view class="time_item">
<view class="lab">应完成里程</view>
<view class="num">50km</view>
</view>
<view class="time_item">
<view class="lab">已完成里程</view>
<view class="num">0km</view>
</view>
</view>
</view>
</view>
<subject0 v-show="currentNav==0"/>
<subject1 v-show="currentNav==1"/>
<subject2 v-show="currentNav==2"/>
<subject3 v-show="currentNav==3"/>
<subject4 v-show="currentNav==4"/>
</view>
</template>
<script>
import subject0 from './comp/subject0'
import subject1 from './comp/subject1'
import subject2 from './comp/subject2'
import subject3 from './comp/subject3'
import subject4 from './comp/subject4'
export default {
components: { subject0, subject1, subject2, subject3, subject4 },
data() {
return {
navData: [
{text: '模拟器', id: 0},
{text: '科目一', id: 1},
{text: '科目二', id: 2},
{text: '科目三', id: 3},
{text: '科目四', id: 4},
],
currentNav: 0
}
},
onLoad() {
},
onShow() {
// uni.hideTabBar();
},
methods: {
changeNav(id) {
this.currentNav = id
}
}
}
</script>
<style lang="scss" scoped>
.content {
width: 100vw;
min-height: 100vh;
// background: url('../../../static/images/bigImg/topbg.png') #F6F6F6 no-repeat;
background-size: 100% 362rpx;
padding: 0 32rpx 32rpx 32rpx;
.title {
font-size: 36rpx;
font-weight: 600;
color: #fff;
padding: 10rpx 0 48rpx 0rpx;
}
.navCard {
.nav_row {
display: flex;
justify-content: space-between;
.nav {
width: 19.4%;
height: 86rpx;
background: rgba(255,255,255,0.4);
border-radius: 8rpx 8rpx 0px 0px;
font-size: 28rpx;
color: #fff;
line-height: 86rpx;
text-align: center;
&.active {
background: #FFFFFF;
color: $themC;
}
}
}
.subject3 {
padding-top: 32rpx;
position: relative;
.chain {
width: 28rpx;
height: 100rpx;
position: absolute;
top: -34rpx;
&.left {
left: 60rpx;
}
&.right {
right: 60rpx !important;
}
}
}
.time_row {
display: flex;
height: 240rpx;
padding: 32rpx;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 0 0 8rpx 8rpx;
.time_item {
flex: 1;
text-align: center;
position: relative;
.lab {
font-size: 28rpx;
color: #333;
}
.num {
font-size: 40rpx;
font-weight: 600;
color: $themC;
margin-top: 20rpx;
}
.shareTime {
font-size: 20rpx;
color: $themC;
position: absolute;
bottom: -40rpx;
left: 0;
width: 100%;
}
}
}
}
}
</style>

17
store/modules/user.js

@ -88,19 +88,28 @@ 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
const res = 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) {
console.log('刷新token结果')
console.log(res)
console.log(state.refreshTokenFn)
commit('update_apiOk',true)
commit('update_vuex_loginInfo',res.data)
commit('update_vuex_loginInfo',state.refreshTokenFn.data)
uni.$u.http.setConfig((config) => {
config.header.Authorization = 'Bearer ' + res.data.accessToken
config.header.Authorization = 'Bearer ' + state.refreshTokenFn.data.accessToken
return config
})
}else {
commit('goLogin')
return false
}
}
}
}

Loading…
Cancel
Save