|
@@ -2,24 +2,27 @@
|
|
|
<view class="content">
|
|
|
<view class="top-box">
|
|
|
<van-row>
|
|
|
- <van-col span="18">
|
|
|
+ <van-col span="24">
|
|
|
<view class="timingBox">
|
|
|
<view class="classHourStatistics">
|
|
|
+ <view class="unbind" v-if="unbindFlag">
|
|
|
+ <text>未绑定身份证\n前往我的页面绑定</text>
|
|
|
+ </view>
|
|
|
<view class="timing-item">
|
|
|
<text>科一学时</text>
|
|
|
- <text class="timing-time">12/23</text>
|
|
|
+ <text class="timing-time">{{infoData.km1+0}}/{{info[0].ration+0}}</text>
|
|
|
</view>
|
|
|
<view class="timing-item">
|
|
|
<text>科二学时</text>
|
|
|
- <text class="timing-time">12/123</text>
|
|
|
+ <text class="timing-time">{{infoData.km2+0}}/{{info[1].ration+info[2].ration}}</text>
|
|
|
</view>
|
|
|
<view class="timing-item">
|
|
|
<text>科三学时</text>
|
|
|
- <text class="timing-time">12/80</text>
|
|
|
+ <text class="timing-time">{{infoData.km3+0}}/{{info[3].ration+info[4].ration}}</text>
|
|
|
</view>
|
|
|
<view class="timing-item">
|
|
|
<text>科四学时</text>
|
|
|
- <text class="timing-time">12/20</text>
|
|
|
+ <text class="timing-time">{{infoData.km4+0}}/{{info[5].ration+0}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="jsbox">
|
|
@@ -28,25 +31,26 @@
|
|
|
<text>我要计时</text>
|
|
|
</view>
|
|
|
<view :class="['js',{dh:dhfalg}]">
|
|
|
- <button class="jsbtn" @click='timeBtn'>{{timeTitle}}</button>
|
|
|
+ <van-button :loading='btnLoading' :loading-text='loadingText' custom-class="jsbtn" @click='timeBtn'>{{timeTitle}}</van-button>
|
|
|
<text class="timeText">{{timeText}}</text>
|
|
|
</view>
|
|
|
- <text class="ts">注:退出本小程序即停止计时</text>
|
|
|
+ <text class="ts">注:退出即停止计时,不满60s不计入学时</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</van-col>
|
|
|
- <van-col span="6">
|
|
|
+ <!-- <van-col span="6">
|
|
|
<square icon='/static/imgs/包过保证icon.png' title='包过保证' @tap='go()' />
|
|
|
<square icon='/static/imgs/模拟考试icon.png' title='模拟考试' @tap="go('/pages/question/mockExam')" />
|
|
|
- </van-col>
|
|
|
+ </van-col> -->
|
|
|
</van-row>
|
|
|
|
|
|
<van-row>
|
|
|
<van-col span="6">
|
|
|
- <square icon='/static/imgs/图标练习icon.png' title='图标练习' @tap='go()' />
|
|
|
+ <!-- <square icon='/static/imgs/图标练习icon.png' title='图标练习' @tap='go()' /> -->
|
|
|
+ <square icon='/static/imgs/模拟考试icon.png' title='模拟考试' @tap="go('/pages/question/mockExam')" />
|
|
|
</van-col>
|
|
|
<van-col span="6">
|
|
|
- <square icon='/static/imgs/顺序测试icon.png' title='顺序测试' @tap="go('/pages/question/sequential')"/>
|
|
|
+ <square icon='/static/imgs/顺序测试icon.png' title='顺序测试' @tap="go('/pages/question/sequential')" />
|
|
|
</van-col>
|
|
|
<van-col span="6">
|
|
|
<square icon='/static/imgs/随机测试icon.png' title='随机测试' @tap="go('/pages/question/random')" />
|
|
@@ -71,7 +75,7 @@
|
|
|
<text class="video-box-tit">考点视频</text>
|
|
|
<button class="video-box-btn" @tap='go()'>去观看</button>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
<video class="myVideo" id="myVideo2" src="http://image.jppt.com.cn/zzjs/2021-03-18/media/1616051225707.mp4"
|
|
|
object-fit='fill' controls @play='videoPlay2'></video>
|
|
|
<view class="tit-box">
|
|
@@ -122,6 +126,14 @@
|
|
|
|
|
|
<script>
|
|
|
import square from '@/components/square/index.vue'
|
|
|
+ import {
|
|
|
+ addTime,
|
|
|
+ getTime,
|
|
|
+ getTimeInfo
|
|
|
+ } from '@/api/studytime.js'
|
|
|
+ import {
|
|
|
+ getInfo
|
|
|
+ } from '@/api/login.js'
|
|
|
export default {
|
|
|
components: {
|
|
|
square
|
|
@@ -130,18 +142,37 @@
|
|
|
return {
|
|
|
dhfalg: false,
|
|
|
timeText: "00:00:00",
|
|
|
- timeTitle: '开始计时',
|
|
|
+ timeTitle: '开始',
|
|
|
+ info: [],
|
|
|
+ infoData: {},
|
|
|
+ unbindFlag: false,
|
|
|
timeStatus: 0,
|
|
|
- timeFn: this.timeStart()
|
|
|
+ timeFn: this.timeStart(),
|
|
|
+ btnLoading: false,
|
|
|
+ loadingText: ''
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- if (uni.getStorageSync('time')) {
|
|
|
- this.timeText = new Date(uni.getStorageSync('time')).toJSON().slice(11, -5)
|
|
|
- this.timeTitle = '恢复计时'
|
|
|
- }
|
|
|
+ this.initInfo()
|
|
|
},
|
|
|
methods: {
|
|
|
+ async initInfo() {
|
|
|
+ if (uni.getStorageSync('time')) {
|
|
|
+ this.timeText = new Date(uni.getStorageSync('time')).toJSON().slice(11, -5)
|
|
|
+ this.timeTitle = '继续'
|
|
|
+ }
|
|
|
+ let studentInfo = await getInfo()
|
|
|
+ if (studentInfo.data.student.gzptUserId) {
|
|
|
+ let info = await getTimeInfo()
|
|
|
+ this.info = info.rows
|
|
|
+ let infoData = await getTime()
|
|
|
+ this.infoData = infoData.rows[0]
|
|
|
+ } else {
|
|
|
+ //未绑定身份证
|
|
|
+ this.unbindFlag = true
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
videoPlay(e) {
|
|
|
uni.createVideoContext('myVideo2', this).pause();
|
|
|
},
|
|
@@ -149,21 +180,60 @@
|
|
|
uni.createVideoContext('myVideo', this).pause();
|
|
|
},
|
|
|
go(url) {
|
|
|
- uni.navigateTo({url});
|
|
|
+ uni.navigateTo({
|
|
|
+ url
|
|
|
+ });
|
|
|
},
|
|
|
timeBtn(e) {
|
|
|
let timeObj = this.timeFn();
|
|
|
console.log(timeObj)
|
|
|
if (timeObj.timeStatus == 1) {
|
|
|
this.dhfalg = true;
|
|
|
- console.log('开始计时', e)
|
|
|
- this.timeTitle = '点击上传学时'
|
|
|
+ this.loadingText = '计时中'
|
|
|
+ this.btnLoading = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.btnLoading = false;
|
|
|
+ this.timeTitle = '上传学时'
|
|
|
+ }, 1000)
|
|
|
}
|
|
|
if (timeObj.timeStatus == 2) {
|
|
|
this.dhfalg = false;
|
|
|
- console.log('上传学时')
|
|
|
- this.timeText = "上传成功"
|
|
|
- this.timeTitle = '开始计时'
|
|
|
+ this.loadingText = '上传中'
|
|
|
+ this.btnLoading = true;
|
|
|
+ try {
|
|
|
+ let sysInfo = uni.getStorageSync('sysInfo')
|
|
|
+ addTime({
|
|
|
+ beginTime: new Date(timeObj.start).toISOString().slice(0, -5).replace('T', ' '),
|
|
|
+ endTime: new Date(timeObj.end).toISOString().slice(0, -5).replace('T', ' '),
|
|
|
+ isSubmit: 6,
|
|
|
+ pxkm: this.infoData.km1 >= this.info[5].ration ? 4 : 1,
|
|
|
+ classid: '小程序',
|
|
|
+ reason: `小程序&${sysInfo.platform}&${sysInfo.model}`,
|
|
|
+ source: 1,
|
|
|
+ trainType: `小程序`,
|
|
|
+ trainTime: ~~(timeObj.time / 60 / 1000)
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.btnLoading = false;
|
|
|
+ this.timeText = "上传成功"
|
|
|
+ uni.removeStorageSync('timeStart')
|
|
|
+ uni.removeStorageSync('time')
|
|
|
+ this.timeTitle = '开始'
|
|
|
+ } else {
|
|
|
+ this.btnLoading = false;
|
|
|
+ console.log('上传学时异常!!')
|
|
|
+ this.timeTitle = '恢复'
|
|
|
+ }
|
|
|
+ }, err => {
|
|
|
+ this.btnLoading = false;
|
|
|
+ console.log('上传学时异常!!')
|
|
|
+ this.timeTitle = '恢复'
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ this.btnLoading = false;
|
|
|
+ this.timeTitle = '恢复'
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
timeStart() {
|
|
@@ -190,22 +260,23 @@
|
|
|
this.timeText = new Date(time).toJSON().slice(11, -5)
|
|
|
}, 100)
|
|
|
return {
|
|
|
- start,
|
|
|
+ start: uni.getStorageSync('timeStart'),
|
|
|
time,
|
|
|
timeStatus
|
|
|
}
|
|
|
}
|
|
|
if (timeStatus >= 2) {
|
|
|
timeStatus = 0;
|
|
|
- clearInterval(timerID);
|
|
|
- uni.removeStorageSync('timeStart')
|
|
|
- uni.removeStorageSync('time')
|
|
|
- return {
|
|
|
- start,
|
|
|
+ let timeObj = {
|
|
|
+ start: uni.getStorageSync('timeStart'),
|
|
|
end: new Date().getTime(),
|
|
|
- time,
|
|
|
+ time: uni.getStorageSync('time'),
|
|
|
timeStatus: 2
|
|
|
}
|
|
|
+ clearInterval(timerID);
|
|
|
+ // uni.removeStorageSync('timeStart')
|
|
|
+ // uni.removeStorageSync('time')
|
|
|
+ return timeObj
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -214,7 +285,7 @@
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
+<style lang="scss">
|
|
|
.dh {
|
|
|
position: relative;
|
|
|
|
|
@@ -306,8 +377,7 @@
|
|
|
.item-box {
|
|
|
background-color: #fff;
|
|
|
border-radius: 10rpx;
|
|
|
- margin: 30rpx;
|
|
|
-
|
|
|
+ margin: 10rpx 30rpx;
|
|
|
|
|
|
.item-titBox {
|
|
|
display: flex;
|
|
@@ -346,6 +416,7 @@
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
padding: 10rpx 0 26rpx;
|
|
|
+
|
|
|
.video-box-tit {
|
|
|
height: 31rpx;
|
|
|
font-size: 20rpx;
|
|
@@ -377,7 +448,22 @@
|
|
|
|
|
|
|
|
|
.top-box {
|
|
|
- margin: 20rpx;
|
|
|
+ margin: 10rpx 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .unbind {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ background-color: rgba(35, 34, 33, 0.2);
|
|
|
+ z-index: 10;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ text-align: center;
|
|
|
+ color: red;
|
|
|
}
|
|
|
|
|
|
.timingBox {
|
|
@@ -388,29 +474,29 @@
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: space-between;
|
|
|
- padding: 5%;
|
|
|
+ padding: 2% 5%;
|
|
|
box-sizing: border-box;
|
|
|
-
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
.classHourStatistics {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
|
|
|
.timing-item {
|
|
|
height: 80rpx;
|
|
|
- // box-shadow: -2rpx -2rpx 5rpx #5a5a5a;
|
|
|
+ // box-shadow: -2rpx 2rpx 5rpx #5a5a5a;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
font-size: .8rem;
|
|
|
- padding: 15rpx 5rpx;
|
|
|
+ padding: 25rpx 15rpx;
|
|
|
border-radius: 10rpx;
|
|
|
|
|
|
.timing-time {
|
|
|
font-size: .8rem;
|
|
|
- background-color: #fff;
|
|
|
border-radius: 10rpx;
|
|
|
- // box-shadow: -2px -2px 5px #5a5a5a;
|
|
|
}
|
|
|
}
|
|
|
}
|