|
|
<template> <view class="pageBgImg"> <view class="pad"> <view class="status_bar"></view> <view class="" style="height: 100rpx;"></view> <!-- <u-button @click="requestSingleFreshLocationFn">单次定位</u-button> --> <!-- <u-button @click="getInitFaceVerifyFn">人脸核身</u-button> --> <topInfo :carType="curObject" @changeSubject="changeSubject" :dynamics="subjectStatus.studentClassHourVO"></topInfo> <view class="" v-if="token"> <subject1 v-if="curObject.id==1" :subjectStatus="subjectStatus"></subject1> <subject2 v-if="curObject.id==2" :subjectStatus="subjectStatus"></subject2> <subject3 v-if="curObject.id==3" :subjectStatus="subjectStatus"></subject3> <subject4 v-if="curObject.id==4" :subjectStatus="subjectStatus"></subject4> </view> </view> </view> </template>
<script> import topInfo from './comp/topInfo.vue' import subject1 from './comp/subject1.vue' import subject2 from './comp/subject2.vue' import subject3 from './comp/subject3.vue' import subject4 from './comp/subject4.vue' import { getStudentSubject1Status, getStudentSubject2Status, getStudentSubject3Status, getStudentSubject4Status, getStudentProcess } from '@/config/api.js' export default { components: { topInfo, subject1, subject2,subject3,subject4 }, data() { return { curObject: { name: '科目一', id: 1, }, dynamics: {}, subjectStatus: { studentClassHourVO: {} }, token: '' } }, onPullDownRefresh() { this.init() }, onLoad() { this.trainProcess() }, onShow() { this.init() // this.getStudentProcessFn()
}, methods: { async trainProcess() { await this.$store.dispatch('getUserInfo') // 培训进度(0:科目一培训中,1:完成科目一培训,3:完成科目二培训,5:完成科目三培训,7:完成科目二、科目三培训)
let trainProcess = {} switch(this.vuex_userInfo.trainProcess) { case 1: trainProcess = {name: '科目二', id: 2} break; case 3: trainProcess = {name: '科目三', id: 3} break; case 5: trainProcess = {name: '科目四', id: 4} break; case 7: trainProcess = {name: '科目四', id: 4} break; default: trainProcess = {name: '科目一', id: 1} } console.log('trainProcess是几啊') console.log(trainProcess) console.log(this.vuex_userInfo.trainProcess) this.changeSubject(trainProcess) }, init() { this.token = this.$store.state.user.vuex_loginInfo.accessToken if(!this.token) return this.$u.toast('请先登录') this.getStudentSubject1StatusFn() }, // 切换科目
changeSubject(val) { if(this.curObject==val) return this.curObject = val this.init() }, async requestSingleFreshLocationFn() { await this.$store.dispatch('getCity') }, async getStudentSubject1StatusFn() { let arrFn = [getStudentSubject1Status, getStudentSubject2Status, getStudentSubject3Status, getStudentSubject4Status] const {data: res} = await arrFn[this.curObject.id-1]({studentId: this.studentId}) this.subjectStatus = res console.log(res) // console.log(this.subjectStatus.studentClassHourVO)
}, // async getStudentProcessFn() {
// const {data: res} = await getStudentProcess({studentId: this.studentId})
// let obj = {
// ValidTtime: res.subjectOneValidTtime,
// TotalTime: res.subjectOneTotalTime
// }
// if(this.curObject.id==2) {
// obj.ValidTtime = res.subjectTwoValidTtime
// obj.TotalTime = res.subjectTwoTotalTime
// }else if(this.curObject.id==3) {
// obj.ValidTtime = res.subjectThreeValidTtime
// obj.TotalTime = res.subjectThreeTotalTime
// }else if(this.curObject.id==4) {
// obj.ValidTtime = res.subjectFourValidTtime
// obj.TotalTime = res.subjectFourTotalTime
// }
// this.dynamics = obj
// }
} } </script>
<style scoped lang="scss"> </style>
|