暂存
This commit is contained in:
@@ -57,7 +57,22 @@
|
||||
<text>{{item.title}}</text>
|
||||
</div>
|
||||
</view>
|
||||
</view></view>
|
||||
</view></view>
|
||||
<view class="" v-if="showCountDown" style="padding:0 10rpx;">
|
||||
<view class="flex_box flex_between align-items_box learnBox homeTestBox">
|
||||
<text>考试进行中</text>
|
||||
<view class="">
|
||||
<uni-countdown @timeup="timeup" :font-size="20" :show-day="false"
|
||||
:hour="timeDif.hour" :minute="timeDif.minutes" :second="timeDif.second"
|
||||
color="#fff" splitorColor="#fff" />
|
||||
</view>
|
||||
<view class="">
|
||||
<text class="small_btn retake border_radius_10"
|
||||
@click="continueTest(examId,classId)">继续考试</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- 正在学习 -->
|
||||
<view class="" style="padding:0 5px;" v-if="learnList.length > 0">
|
||||
<view class="learnBox" >
|
||||
@@ -339,11 +354,10 @@
|
||||
newsList: [], // 播报新闻列表
|
||||
weburl: '',
|
||||
classList : [],
|
||||
// webviewStyles: {
|
||||
// progress: true,
|
||||
// width: '100%',
|
||||
// height: '100vh'
|
||||
// }
|
||||
examId:undefined,
|
||||
timeDif: {},
|
||||
showCountDown: false,
|
||||
classId: undefined
|
||||
};
|
||||
},
|
||||
onPageScroll(e) {
|
||||
@@ -368,6 +382,34 @@
|
||||
if(this.classList.length > 6){
|
||||
this.classList = this.classList.slice(0,6)
|
||||
}
|
||||
// var paperData={}
|
||||
var paperEndTime = 0
|
||||
var severNowTime = -1
|
||||
// paperData = await this.getlocaltestInfo('paperEndTime')
|
||||
var historyPaper = await this.getingPaper()
|
||||
if(historyPaper){
|
||||
paperEndTime = this.hourUp(historyPaper.startTime,1) // 结束的时间戳
|
||||
this.examId = historyPaper.id
|
||||
this.classId = historyPaper.classId
|
||||
}else{
|
||||
this.classId = undefined
|
||||
this.examId = undefined
|
||||
paperEndTime = 0
|
||||
}
|
||||
console.log('this.examId////////////', paperEndTime);
|
||||
severNowTime = await this.getServerTime()
|
||||
// console.log('//////////////', paperEndTime, severNowTime);
|
||||
if (severNowTime > -1 && paperEndTime - severNowTime > 0) {
|
||||
var secondTimeDif = paperEndTime - severNowTime
|
||||
this.timeDif.hour = parseInt((secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
|
||||
this.timeDif.minutes = parseInt((secondTimeDif % (1000 * 60 * 60)) / (1000 * 60));
|
||||
this.timeDif.second = (secondTimeDif % (1000 * 60)) / 1000
|
||||
this.showCountDown = true
|
||||
console.log('时间符合吗?', this.showCountDown, secondTimeDif);
|
||||
} else {
|
||||
this.showCountDown = false
|
||||
}
|
||||
|
||||
},
|
||||
onTabItemTap() {
|
||||
|
||||
@@ -411,7 +453,83 @@
|
||||
//方法
|
||||
methods: {
|
||||
...mapMutations(['setUserInfo']),
|
||||
hourUp(start,e) {
|
||||
// 比现在多几个小时
|
||||
// var end = Date.now()
|
||||
var startTimeDate = new Date(start)
|
||||
var startTime = startTimeDate.getTime();
|
||||
var step = 1000 * 60 * 60 * e // 时间间隔
|
||||
var interval = startTime + step; //开始 + 时长 = 结束的毫秒数
|
||||
// var a = new Date(interval)
|
||||
console.log('aaaaaaaaaa结束时间的毫秒数,时间戳',interval);
|
||||
return interval
|
||||
},
|
||||
// 继续考试
|
||||
continueTest(id,classId) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/miniClass/continueTest?id=${id}&classId=${classId}`
|
||||
})
|
||||
},
|
||||
// 获取考试中的试卷
|
||||
async getingPaper(){
|
||||
var obj = undefined
|
||||
await $http.request({
|
||||
url: "common/classExam/examingPaper",
|
||||
method: "POST",
|
||||
data: {},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
console.log('考试中',res);
|
||||
if (res.code == 0 && res.classExamUser != null) {
|
||||
obj = res.classExamUser
|
||||
}
|
||||
}).catch(e => {
|
||||
});
|
||||
return obj
|
||||
|
||||
},
|
||||
// 获取本地试卷信息
|
||||
// getlocaltestInfo(keystr){
|
||||
// return new Promise((resolve, reject) => {
|
||||
// uni.getStorage({
|
||||
// key: keystr,
|
||||
// success: function(res) {
|
||||
// if (res.error) {
|
||||
// reject(res.data)
|
||||
// } else {
|
||||
// resolve(res.data)
|
||||
// console.log('/////getlocaltestInfo/////', res.data);
|
||||
// }
|
||||
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
// },
|
||||
// 获取服务器时间
|
||||
async getServerTime() {
|
||||
var time = 0
|
||||
await $http.request({
|
||||
url: "common/classExam/getServerTime",
|
||||
method: "POST",
|
||||
data: {},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
time = res.serverTime
|
||||
} else {
|
||||
time = -1
|
||||
}
|
||||
}).catch(e => {
|
||||
time = -1
|
||||
});
|
||||
return time
|
||||
},
|
||||
// 查询可加入的小班
|
||||
async getClassNoUser(){
|
||||
var _list = []
|
||||
@@ -564,6 +682,9 @@
|
||||
|
||||
});
|
||||
},
|
||||
timeup() {
|
||||
this.showCountDown = false
|
||||
},
|
||||
// 获取正在学习课程
|
||||
getLearnCourse() {
|
||||
this.$http
|
||||
@@ -1163,7 +1284,10 @@
|
||||
height: 80rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.homeTestBox{
|
||||
background-color:#ffaa00;
|
||||
color: #fff;
|
||||
}
|
||||
.children_cate {
|
||||
justify-content: space-evenly;
|
||||
padding: 0 10rpx;
|
||||
@@ -1602,4 +1726,8 @@
|
||||
width: 100%; height: 100%;
|
||||
}}
|
||||
}
|
||||
.retake {
|
||||
border: 1px solid #fff;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user