Commit da704ed1 authored by zhangjianqian's avatar zhangjianqian

课程名称展示问题,考试直接开始

parent d2e10728
......@@ -35,4 +35,9 @@ public class UserCourseVo {
private String dataKind;
private Integer personnelType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date testStartTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date testEndTime;
}
......@@ -155,6 +155,14 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
@Override
public List<UserCourseVo> userCourseList(Long userId,Integer type){
List<UserCourseVo> list = tTrainCourseMapper.userCourseList(userId,type,1);
for (UserCourseVo v :list){
if(v.getTestEndTime()!=null&&v.getTestEndTime().getTime()<new Date().getTime()){
v.setState(3);
}
if(v.getTestStartTime()!=null&&v.getTestStartTime().getTime()>new Date().getTime()){
v.setState(4);
}
}
return list;
}
......
......@@ -158,7 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<select id="userCourseList" resultType="com.zehong.system.domain.vo.UserCourseVo">
SELECT uc.user_course_id AS userCourseId,uc.state ,uc.examination_time AS examinationTime,
uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,
uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,c.test_start_time as testStartTime,c.test_end_time as testEndTime,
c.`course_name` AS courseName, c.`topic_num` AS topicNum,c.`release_time` AS releaseTime,c.data_kind as dataKind,c.personnel_type as personnelType,
p.`plan_name` AS courseType,c.course_id as courseId,c.qualified_num as qualifiedNum
FROM t_train_user_course uc
......
......@@ -78,7 +78,7 @@ export default {
},
computed: {
afterList() {
return this.list.filter((item) => item.state > 1);
return this.list.filter((item) => item.state == 2);
},
},
created() {
......
......@@ -77,7 +77,7 @@ export default {
},
computed: {
beforeList() {
return this.list.filter((item) => item.state < 2);
return this.list.filter((item) => item.state != 2);
},
},
created() {
......
......@@ -16,8 +16,8 @@
</div>
<div class="time">发布时间:{{ itemData.createTime }}</div>
<div class="bottom flex">
<div @click="click" class="btn" :class="{ again: yesOrNo }">
{{ yesOrNo ? "重新考试" : "开始学习" }}
<div v-if="!itemData.state===4 || !(itemData.state===3 && itemData.dataKind==='1')" @click="click" class="btn" :class="{ again: yesOrNo }">
{{ yesOrNo }}
</div>
</div>
<div
......@@ -25,16 +25,29 @@
:class="{
no: itemData.state === 1,
yes: itemData.state === 2,
ygq:itemData.state === 3,
wks:itemData.state === 4,
}"
>
{{ state[itemData.state] }}
</div>
<AnswerLesson
v-if="answerOpen"
:courseId="itemData.courseId"
:userCourseId="itemData.userCourseId"
:visible.sync="answerOpen"
@jj="jj"
/>
</div>
</template>
<script>
import AnswerLesson from "./AnswerLesson";
export default {
name: "",
components: {
AnswerLesson,
},
props: {
itemData: {
type: Object,
......@@ -50,14 +63,52 @@ export default {
},
computed: {
yesOrNo() {
return this.itemData.state == 1 || this.itemData.state == 2;
console.log(this.itemData)
if(this.itemData.dataKind==="0"){
if( this.itemData.state === 0){
return '开始学习'
}else if(this.itemData.state === 1){
return '重新考试'
}else if(this.itemData.state === 2){
return '重新考试'
}else if(this.itemData.state === 3){
return '开始学习'
}else if(this.itemData.state === 4){
return '还未开始'
}
}else{
if( this.itemData.state === 0){
return '开始考试'
}else if(this.itemData.state === 1){
return '重新考试'
}else if(this.itemData.state === 2){
return '重新考试'
}else if(this.itemData.state === 3){
return '开始学习'
}else if(this.itemData.state === 4){
return '还未开始'
}
}
},
},
data() {
return {};
return {
answerOpen:false
};
},
methods: {
jj(e) {
if (e.answer >= e.qualifiedNum) {
this.fenshu = Math.floor((e.answer / e.topicNum) * 100);
this.state = 2;
}
},
click() {
if(this.itemData.dataKind==='1'){
this.answerOpen = true;
return;
}
const { courseId, userCourseId, state, examinationResult, topicNum } =
this.itemData;
// if (!this.yesOrNo) {
......@@ -73,6 +124,7 @@ export default {
path: "myLessons/CheckLesson",
query: { courseId, userCourseId, state, fenshu },
});
// } else {
// this.$emit("examination", { courseId, userCourseId });
// }
......@@ -161,6 +213,12 @@ export default {
&.yes {
background: #3cc426 !important;
}
&.ygq {
background: red !important;
}
&.wks {
background: yellow !important;
}
}
}
</style>
......@@ -41,7 +41,8 @@ export default {
"0":'未完成',
"1":'未通过',
"2":"已完成",
"3":"已过期"
"3":"已过期",
"4":"未开始"
},
};
},
......
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