Commit d2e10728 authored by zhangjianqian's avatar zhangjianqian

培训设置开始结束时间,培训时长,打开培训时,记录培训时长,定期保存培训时长

parent 22b00c4a
......@@ -91,6 +91,15 @@ public class TTrainCourseController extends BaseController
{
return AjaxResult.success(tTrainCourseService.selectTTrainCourseById(courseId));
}
/**
* 获取培训课程详细信息
*/
@ApiOperation("用户课程详情")
@GetMapping(value = "/userCourse")
public AjaxResult getUserCourse(Long userCourseId)
{
return AjaxResult.success(tTrainCourseService.getUserCourse(userCourseId));
}
/**
* 获取培训课程详细信息
......@@ -123,6 +132,16 @@ public class TTrainCourseController extends BaseController
{
return toAjax(tTrainCourseService.updateTTrainCourse(tTrainCourse));
}
/**
* 修改用户课程
*/
@ApiOperation("修改用户课程")
@Log(title = "修改用户课程", businessType = BusinessType.UPDATE)
@PutMapping("/editUserCourse")
public AjaxResult editUserCourse(@RequestBody TTrainUserCourse tTrainUserCourse)
{
return toAjax(tTrainCourseService.updateTTrainUserCourse(tTrainUserCourse));
}
/**
* 删除培训课程
......
......@@ -89,6 +89,16 @@ public class TTrainCourse extends BaseEntity
private Integer personnelType;
private Integer duration;
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public String getPlanName() {
return planName;
}
......
......@@ -54,6 +54,25 @@ public class TTrainUserCourse extends BaseEntity
private Integer personnelType;
private Integer finishDuration;
private Integer trainState;
public Integer getFinishDuration() {
return finishDuration;
}
public void setFinishDuration(Integer finishDuration) {
this.finishDuration = finishDuration;
}
public Integer getTrainState() {
return trainState;
}
public void setTrainState(Integer trainState) {
this.trainState = trainState;
}
public Integer getPersonnelType() {
return personnelType;
}
......
......@@ -54,6 +54,7 @@ public interface ITTrainCourseService
* @return 结果
*/
public int updateTTrainCourse(TTrainCourse tTrainCourse);
public int updateTTrainUserCourse(TTrainUserCourse tTrainUserCourse);
/**
* 批量删除培训课程
......@@ -71,6 +72,9 @@ public interface ITTrainCourseService
*/
public int deleteTTrainCourseById(Long courseId);
public TTrainUserCourse getUserCourse(Long userCourseId);
/**
* 用户id
* @param userId
......
......@@ -89,6 +89,9 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
@Override
public Long insertTTrainCourse(TTrainCourse tTrainCourse)
{
if(tTrainCourse.getDuration()!=null){//分钟转化秒
tTrainCourse.setDuration(tTrainCourse.getDuration()*60);
}
if(tTrainCourse.getCourseType()!=null){
TTrainPlan p = tTrainPlanMapper.selectTTrainPlanById(tTrainCourse.getCourseType());
if(p!=null){
......@@ -109,8 +112,17 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
@Override
public int updateTTrainCourse(TTrainCourse tTrainCourse)
{
if(tTrainCourse.getDuration()!=null){//分钟转化秒
tTrainCourse.setDuration(tTrainCourse.getDuration()*60);
}
return tTrainCourseMapper.updateTTrainCourse(tTrainCourse);
}
@Override
public int updateTTrainUserCourse(TTrainUserCourse tTrainUserCourse)
{
return tTrainUserCourseMapper.updateTTrainUserCourse(tTrainUserCourse);
}
/**
* 批量删除培训课程
......@@ -231,4 +243,11 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
public List<TTrainUserCourse> testPersonDetailByCourseId(Long courseId){
return tTrainUserCourseMapper.testPersonDetailByCourseId(courseId);
}
@Override
public TTrainUserCourse getUserCourse(Long userCourseId){
return tTrainUserCourseMapper.selectTTrainUserCourseById(userCourseId);
}
}
......@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="testStartTime" column="test_start_time" />
<result property="testEndTime" column="test_end_time" />
<result property="testPersons" column="test_persons" />
<result property="duration" column="duration" />
</resultMap>
<resultMap id="StatisticsTrainCourseResult" type="StatisticsTrainCourse">
......@@ -38,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTTrainCourseVo">
select course_id, course_name, course_type, course_conent, status,personnel_type, release_time, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, data_kind, test_start_time, test_end_time, test_persons from t_train_course
select course_id, course_name, course_type, course_conent, status,personnel_type, release_time, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, data_kind, test_start_time, test_end_time, test_persons,duration from t_train_course
</sql>
<select id="selectTTrainCourseList" parameterType="TTrainCourse" resultMap="TTrainCourseResult">
......@@ -88,6 +89,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="testStartTime != null">test_start_time,</if>
<if test="testEndTime != null">test_end_time,</if>
<if test="testPersons != null">test_persons,</if>
<if test="duration != null">duration,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="courseName != null">#{courseName},</if>
......@@ -107,6 +110,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="testStartTime != null">#{testStartTime},</if>
<if test="testEndTime != null">#{testEndTime},</if>
<if test="testPersons != null">#{testPersons},</if>
<if test="duration != null">#{duration},</if>
</trim>
</insert>
......@@ -130,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="testStartTime != null">test_start_time = #{testStartTime},</if>
<if test="testEndTime != null">test_end_time = #{testEndTime},</if>
<if test="testPersons != null">test_persons = #{testPersons},</if>
<if test="duration != null">duration = #{duration},</if>
</trim>
where course_id = #{courseId}
</update>
......
......@@ -16,10 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createUser" column="create_user" />
<result property="staffName" column="staff_name"/>
<result property="deptName" column="dept_name"/>
<result property="finishDuration" column="finish_duration"/>
<result property="trainState" column="train_state"/>
</resultMap>
<sql id="selectTTrainUserCourseVo">
select user_course_id, user_id, course_id, state, examination_time, personnel_type,examination_result, create_time, create_user from t_train_user_course
select user_course_id, user_id, course_id, state, examination_time, personnel_type,examination_result, create_time, create_user,finish_duration,train_state from t_train_user_course
</sql>
<select id="selectTTrainUserCourseList" parameterType="TTrainUserCourse" resultMap="TTrainUserCourseResult">
......@@ -50,6 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="examinationResult != null">examination_result,</if>
<if test="createTime != null">create_time,</if>
<if test="createUser != null">create_user,</if>
<if test="finishDuration != null">finish_duration,</if>
<if test="trainState != null">train_state,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
......@@ -60,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="examinationResult != null">#{examinationResult},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUser != null">#{createUser},</if>
<if test="finishDuration != null">#{finishDuration},</if>
<if test="trainState != null">#{trainState},</if>
</trim>
</insert>
......@@ -74,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="examinationResult != null">examination_result = #{examinationResult},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUser != null">create_user = #{createUser},</if>
<if test="finishDuration != null">finish_duration = #{finishDuration},</if>
<if test="trainState != null">train_state = #{trainState},</if>
</trim>
where user_course_id = #{userCourseId}
</update>
......
......@@ -34,6 +34,14 @@ export function getLessonById(id) {
method: 'get',
})
}
//用户课程状态
export function getUserLessonById(query) {
return request({
url: 'system/course/userCourse',
method: 'get',
params: query
})
}
// 添加课程
export function addLessons(data) {
return request({
......@@ -50,7 +58,14 @@ export function changeLesson(data) {
data:data
})
}
// // 修改用户课程
export function changeUserLesson(data) {
return request({
url: '/system/course/editUserCourse',
method: 'put',
data:data
})
}
// 发布课程
export function issue(query) {
return request({
......
......@@ -17,9 +17,28 @@
>
<div class="top flex">
<el-form-item label="课程标题" prop="courseName">
<el-input style="width: 500px" v-model="form.courseName"></el-input>
<el-input style="width: 400px" v-model="form.courseName"></el-input>
</el-form-item>
<!--<el-form-item label="培训计划" prop="courseType">-->
<!--<el-select-->
<!--v-model="form.courseType"-->
<!--placeholder="请选择培训计划"-->
<!--clearable-->
<!--size="small"-->
<!--&gt;-->
<!--<el-option-->
<!--v-for="course in courseOptions"-->
<!--:key="course.planId"-->
<!--:label="course.planName"-->
<!--:value="course.planId"-->
<!--/>-->
<!--</el-select>-->
<!--</el-form-item>-->
</div>
<div class="flex">
<el-form-item label="培训计划" prop="courseType">
<el-select
v-model="form.courseType"
......@@ -35,8 +54,31 @@
/>
</el-select>
</el-form-item>
<el-form-item label="培训时长" prop="duration" style="margin-left: 55px">
<el-input style="width: 220px" placeholder="分钟" type="number" v-model="form.duration"></el-input>
</el-form-item>
</div>
<div class="flex">
<el-form-item label="开始时间" prop="testStartTime">
<el-date-picker
style="margin-right: 50px"
v-model="form.testStartTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间"
default-time="00:00:00"
/>
</el-form-item>
<el-form-item label="结束时间" prop="testEndTime">
<el-date-picker
v-model="form.testEndTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间"
default-time="00:00:00"
/>
</el-form-item>
</div>
<!-- </div> -->
<el-form-item label="课程内容" prop="courseConent">
<Editor v-model="form.courseConent" :min-height="192" />
......@@ -109,7 +151,7 @@ export default {
readOnly: false,
rules: {
courseName: [
{ required: true, trigger: "blur", message: "课程名称不能为空" },
{ required: true, trigger: "blur", message: "课程标题不能为空" },
],
courseType: [
{ required: true, trigger: "change", message: "课程类型不能为空" },
......@@ -121,6 +163,15 @@ export default {
enclosure: [
{ required: true, trigger: "blur", message: "附件不能为空" },
],
duration: [
{ required: true, trigger: "blur", message: "培训时长不能为空" },
],
testStartTime: [
{ required: true, trigger: "blur", message: "开始时间不能为空" },
],
testEndTime: [
{ required: true, trigger: "blur", message: "结束时间不能为空" },
],
},
};
},
......
......@@ -9,8 +9,9 @@
<template>
<div class="check-lession flex">
<div class="top-title">
<div class="item">
<div class="item allone">
<div class="text">{{ state != 2 ? "学习课程" : "查看课程" }}</div>
<div class="gotime">{{minute}}:{{calculation(second)}}/{{parseInt(lessonData.duration/60)}}:{{calculation(lessonData.duration%60)}}</div>
</div>
<div class="bt flex fz14 border-bottom">
......@@ -86,7 +87,7 @@
</div>
<div class="btn-wrapper flex">
<el-button @click="againQuesstion" type="primary">{{
<el-button v-if="this.finish" @click="againQuesstion" type="primary">{{
state == 2 || state == 1 ? "重新考试" : "开始考试"
}}</el-button>
<el-button @click="$router.back()" type="primary" plain>取消</el-button>
......@@ -103,7 +104,7 @@
</template>
<script>
import { getLessonById } from "@/api/educationPlanExam/lessonsProgram";
import { getLessonById,getUserLessonById ,changeUserLesson} from "@/api/educationPlanExam/lessonsProgram";
import { getPlanList } from "@/api/educationPlanExam/trainingProgram";
import AnswerLesson from "../components/AnswerLesson";
......@@ -114,12 +115,17 @@ export default {
},
data() {
return {
finish:false,
minute:0,
second:0,
playerOptions: {
aspectRatio: "16:9",
},
dingshi:null,
// 课程类型
courseOptions: [],
lessonData: {},
userlessonData:{},
// 课程id
courseId: 0,
// 用户学习id
......@@ -135,6 +141,11 @@ export default {
this.getPlanList();
this.getLessonById();
},
destroyed(){
console.log('销毁');
this.updateUserCourse();
clearInterval(this.dingshi);
},
methods: {
getPlanList() {
getPlanList().then((res) => {
......@@ -162,9 +173,50 @@ export default {
getLessonById(courseId).then((res) => {
if (res.code == 200) {
this.lessonData = res.data;
console.log(this.lessonData);
this.changeVideo(this.lessonData.video);
}
});
getUserLessonById({"userCourseId":userCourseId}).then((res) => {
if (res.code == 200) {
this.userlessonData = res.data;
console.log(this.userlessonData);
this.second = this.userlessonData.finishDuration%60;
this.minute = parseInt( this.userlessonData.finishDuration/60);
this.dingshi = setInterval(this.goTime,1000);
}
});
},
goTime(){
if(this.userlessonData.finishDuration>=this.lessonData.duration){
console.log("结束");
clearInterval(this.dingshi);
this.userlessonData.trainState=1;
this.userlessonData.finishDuration = this.lessonData.duration;
this.updateUserCourse();
}else {
this.userlessonData.finishDuration = this.userlessonData.finishDuration+1;
//console.log(this.userlessonData.finishDuration);
this.second = this.userlessonData.finishDuration%60;
this.minute = parseInt( this.userlessonData.finishDuration/60);
if(this.userlessonData.finishDuration%60==0){
this.updateUserCourse();
}
}
},
updateUserCourse(){
changeUserLesson(this.userlessonData).then(response => {
if(this.userlessonData.finishDuration == this.lessonData.duration){
this.finish = true;
}
})
},
calculation(num){
if(num<10){
num = "0"+num;
}
return num;
},
changeVideo(src) {
this.playerOptions = {
......@@ -287,4 +339,18 @@ export default {
}
}
}
.allone{
display:flex;
flex-direction:row;
justify-content:flex-start;
}
.gotime{
background: #1c84c6;
width: 80px;
text-align: center;
line-height: 22px;
color: white;
margin-left: 40px;
border-radius: 10px;
}
</style>
......@@ -38,9 +38,10 @@ export default {
currentTabComponent: LearnBefore,
list:[],
state:{
"0":'未学习',
"0":'未完成',
"1":'未通过',
"2":"通过"
"2":"已完成",
"3":"已过期"
},
};
},
......
......@@ -19,17 +19,17 @@
<el-form-item label="计划名称" prop="bankName">
<el-input style="width: 500px" v-model="form.bankName"></el-input>
</el-form-item>
<el-form-item label="人员类型" prop="personnelType">
<el-select v-model="form.personnelType" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<!--<el-form-item label="人员类型" prop="personnelType">-->
<!--<el-select v-model="form.personnelType" placeholder="请选择">-->
<!--<el-option-->
<!--v-for="item in options"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"-->
<!--&gt;-->
<!--</el-option>-->
<!--</el-select>-->
<!--</el-form-item>-->
<!--<el-form-item label="开始时间" prop="releaseTime">-->
<!--<el-date-picker-->
<!--v-model="form.startTime"-->
......
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