Commit 4d27df41 authored by zhangjianqian's avatar zhangjianqian

过期判断

parent 460f791c
...@@ -254,7 +254,12 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService ...@@ -254,7 +254,12 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
@Override @Override
public TTrainUserCourse getUserCourse(Long userCourseId){ public TTrainUserCourse getUserCourse(Long userCourseId){
return tTrainUserCourseMapper.selectTTrainUserCourseById(userCourseId); TTrainUserCourse userCourse = tTrainUserCourseMapper.selectTTrainUserCourseById(userCourseId);
TTrainCourse v = tTrainCourseMapper.selectTTrainCourseById(userCourse.getCourseId());
if(v.getTestEndTime()!=null&&v.getTestEndTime().getTime()<new Date().getTime()){
userCourse.setState(3);
}
return userCourse;
} }
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<div class="top-title"> <div class="top-title">
<div class="item allone"> <div class="item allone">
<div class="text">{{ state != 2 ? "学习课程" : "查看课程" }}</div> <div class="text">{{ state != 2 ? "学习课程" : "查看课程" }}</div>
<div class="gotime">{{minute}}:{{calculation(second)}}/{{parseInt(lessonData.duration/60)}}:{{calculation(lessonData.duration%60)}}</div> <div v-if="userlessonData.state!=3" class="gotime">{{minute}}:{{calculation(second)}}/{{parseInt(lessonData.duration/60)}}:{{calculation(lessonData.duration%60)}}</div>
<div v-if="userlessonData.state==3" style="background: red" class="gotime"> 已过期 </div>
</div> </div>
<div class="bt flex fz14 border-bottom"> <div class="bt flex fz14 border-bottom">
...@@ -190,12 +191,14 @@ export default { ...@@ -190,12 +191,14 @@ export default {
getUserLessonById({"userCourseId":userCourseId}).then((res) => { getUserLessonById({"userCourseId":userCourseId}).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.userlessonData = res.data; this.userlessonData = res.data;
console.log(this.userlessonData);
this.second = this.userlessonData.finishDuration%60; this.second = this.userlessonData.finishDuration%60;
this.minute = parseInt( this.userlessonData.finishDuration/60); this.minute = parseInt( this.userlessonData.finishDuration/60);
if(this.userlessonData.state!=3){
this.dingshi = setInterval(this.goTime,1000); this.dingshi = setInterval(this.goTime,1000);
} }
}
}); });
}, },
goTime(){ goTime(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment