|
|
<template> <view class="pageBgImg 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.name" @changeSubject="changeSubject" :dynamics="dynamics"></topInfo> <subject1 v-if="curObject.id==1"></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> </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: 2, }, dynamics: {}, subjectStatus: {} } }, onLoad() { // #ifdef MP-WEIXIN
// initEid();
// #endif
}, onShow() { this.getStudentSubject1StatusFn() this.getStudentProcessFn() }, methods: { // 切换科目
changeSubject(val) { console.log(val) this.curObject = val this.getStudentProcessFn() this.getStudentSubject1StatusFn() }, 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) }, 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 console.log(this.dynamics) } } } </script>
<style scoped lang="scss"> </style>
|