diff --git a/ruoyi-ui/src/api/benyi_train/feedback.js b/ruoyi-ui/src/api/benyi_train/feedback.js index 520b9102b..940d32cc5 100644 --- a/ruoyi-ui/src/api/benyi_train/feedback.js +++ b/ruoyi-ui/src/api/benyi_train/feedback.js @@ -17,6 +17,14 @@ export function getFeedback(id) { }) } +// // 查询培训视频评价反馈详细 +// export function getFeedbackByVideo(vid) { +// return request({ +// url: '/benyi/feedback/video/' + vid, +// method: 'get' +// }) +// } + // 新增培训视频评价反馈 export function addFeedback(data) { return request({ diff --git a/ruoyi-ui/src/api/benyi_train/score.js b/ruoyi-ui/src/api/benyi_train/score.js index 8d17c561a..4446c9300 100644 --- a/ruoyi-ui/src/api/benyi_train/score.js +++ b/ruoyi-ui/src/api/benyi_train/score.js @@ -17,6 +17,14 @@ export function getScore(id) { }) } +// 查询培训视频评分详细 +export function getScoreByVideo(vid) { + return request({ + url: '/benyi/score/video/' + vid, + method: 'get' + }) +} + // 新增培训视频评分 export function addScore(data) { return request({ diff --git a/ruoyi-ui/src/views/benyi/calendarshow/index.vue b/ruoyi-ui/src/views/benyi/calendarshow/index.vue index 894f94e7b..8e447d4c6 100644 --- a/ruoyi-ui/src/views/benyi/calendarshow/index.vue +++ b/ruoyi-ui/src/views/benyi/calendarshow/index.vue @@ -72,16 +72,26 @@ export default { noEventsMessage: "暂无日程" } }, - header: { + // header: { + // left: "prev,next today", + // center: "title", + // right: "dayGridMonth,timeGridWeek,timeGridDay listWeek" + // }, + // buttonText: { + // today: "今天", + // month: "月", + // week: "周", + // day: "日", + // list: "周列表" + // }, + header: { left: "prev,next today", center: "title", - right: "dayGridMonth,timeGridWeek,timeGridDay listWeek" + right: "dayGridMonth, listWeek" }, buttonText: { today: "今天", month: "月", - week: "周", - day: "日", list: "周列表" }, calendarPlugins: [ diff --git a/ruoyi-ui/src/views/benyi_train/video_study/detail.vue b/ruoyi-ui/src/views/benyi_train/video_study/detail.vue index bfca0e221..e0d50a26c 100644 --- a/ruoyi-ui/src/views/benyi_train/video_study/detail.vue +++ b/ruoyi-ui/src/views/benyi_train/video_study/detail.vue @@ -13,13 +13,44 @@ </el-col> <el-col :xs="24" :sm="12" style="padding: 10px;"> <el-card> - 内容介绍 - <br />标题:{{title}} - <br />讲师:{{lecturername}} - <br />简介:{{information}} - <br />评分: - <el-rate v-model="value"></el-rate>留言: - <el-input type="textarea" placeholder="请输入内容" /> + <div slot="header" class="clearfix"> + <span>内容介绍</span> + </div> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <div class="text item"> + <el-form-item label="标题">{{title}}</el-form-item> + </div> + <div class="text item"> + <el-form-item label="讲师">{{lecturername}}</el-form-item> + </div> + <div class="text item"> + <el-form-item label="简介">{{information}}</el-form-item> + </div> + <div class="text item"> + <el-form-item label="评分" prop="score"> + <el-rate v-model="form.score" :disabled="dis" :show-score="dis"></el-rate> + <el-input v-model="form.videoid" v-if="false" /> + <el-input v-model="form.lecturerid" v-if="false" /> + </el-form-item> + </div> + <div class="text item"> + <el-form-item label="意见建议" prop="content"> + <el-input + type="textarea" + v-model="form.content" + :disabled="dis" + maxlength="500" + placeholder="请您对视频内容和讲师作出评价,并告诉我们你喜欢或不喜欢的理由,以便使我们改进对您的服务品质。谢谢您的支持!" + /> + </el-form-item> + </div> + </el-form> + <el-button + type="primary" + :disabled="dis" + @click="submitForm" + v-hasPermi="['benyi:feedback_score:add']" + >提交</el-button> </el-card> </el-col> </el-row> @@ -28,31 +59,64 @@ <script> import { getVideo } from "@/api/benyi_train/video"; +import { getScoreByVideo, addScore } from "@/api/benyi_train/score"; +import { addFeedback } from "@/api/benyi_train/feedback"; export default { name: "detail", data() { return { title: "", + dis: false, lecturername: "", + lecturerid: null, information: "", //视频播放参数 playerOptions: {}, - value: null + // value: null, + // content: "", + // 表单参数 + form: {}, + // 表单校验 + rules: { + score: [ + { required: true, message: "请为讲师打个分数吧", trigger: "click" } + ], + content: [ + { required: true, message: "意见或建议不能为空", trigger: "blur" } + ] + } }; }, created() { const id = this.$route.params && this.$route.params.id; //console.log(id); this.getVideoById(id); + this.getScore(id); + //this.value = 5; + //this.dis=true; }, methods: { + //查询分数和评价 + getScore(id) { + getScoreByVideo(id).then(res => { + //console.log(res.data == undefined); + if (res.msg == null) { + this.dis = false; + } else { + this.dis = true; + this.form.score = res.score; + this.form.content = res.content; + } + }); + }, /** 查询培训列表 */ getVideoById(id) { getVideo(id).then(response => { - this.title=response.data.title; - this.lecturername=response.data.lecturername; - this.information=response.data.information; + this.title = response.data.title; + this.lecturername = response.data.lecturername; + this.lecturerid = response.data.lecturer; + this.information = response.data.information; //console.log(response.data); this.playerOptions = { autoplay: true, @@ -63,7 +127,6 @@ export default { sources: [ { type: response.data.filetype, - // mp4 src: "https://files.benyiedu.com/" + response.data.videourl } ], @@ -77,7 +140,38 @@ export default { } }; }); + }, + /** 提交按钮 */ + submitForm: function() { + this.dis=true; + const id = this.$route.params && this.$route.params.id; + if (this.form.score == 0) { + this.form.score = null; + } + this.form.lecturerid = this.lecturerid; + this.form.videoid = id; + this.$refs["form"].validate(valid => { + if (valid) { + addScore(this.form).then(response => { + if (response.code === 200) { + addFeedback(this.form).then(response => { + if (response.code === 200) { + this.msgSuccess("感谢您的反馈,谢谢!"); + this.getScore(id); + } else { + this.msgError(response.msg); + } + }); + } else { + this.msgError(response.msg); + this.dis=false; + } + }); + }else{ + this.dis=false; + } + }); } } }; -</script> \ No newline at end of file +</script> diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoFeedbackController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoFeedbackController.java index 30137dc97..e4690880e 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoFeedbackController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoFeedbackController.java @@ -1,6 +1,9 @@ package com.ruoyi.project.benyi.service.impl; +import java.util.Date; import java.util.List; + +import com.ruoyi.common.utils.SecurityUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -68,14 +71,35 @@ public class ByTrainVideoFeedbackController extends BaseController return AjaxResult.success(byTrainVideoFeedbackService.selectByTrainVideoFeedbackById(id)); } +// /** +// * 获取培训视频评价反馈详细信息 +// */ +// @PreAuthorize("@ss.hasPermi('benyi:feedback:query')"+ "||@ss.hasPermi('benyi:video:query')") +// @GetMapping(value = "/video/{vid}") +// public AjaxResult getInfoByVideo(@PathVariable("vid") Long vid) +// { +// +// ByTrainVideoFeedback byTrainVideoFeedback=new ByTrainVideoFeedback(); +// byTrainVideoFeedback.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); +// byTrainVideoFeedback.setVideoid(vid); +// List<ByTrainVideoFeedback> list=byTrainVideoFeedbackService.selectByTrainVideoFeedbackList(byTrainVideoFeedback); +// if(list!=null&&list.size()>0){ +// return AjaxResult.success(list.get(0)); +// }else{ +// return AjaxResult.success(null); +// } +// } + /** * 新增培训视频评价反馈 */ - @PreAuthorize("@ss.hasPermi('benyi:feedback:add')") + @PreAuthorize("@ss.hasPermi('benyi:feedback_score:add')") @Log(title = "培训视频评价反馈", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ByTrainVideoFeedback byTrainVideoFeedback) { + byTrainVideoFeedback.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + byTrainVideoFeedback.setCreatetime(new Date()); return toAjax(byTrainVideoFeedbackService.insertByTrainVideoFeedback(byTrainVideoFeedback)); } diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoScoreController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoScoreController.java index dcc1c89e8..64a819a64 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoScoreController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoScoreController.java @@ -1,6 +1,11 @@ package com.ruoyi.project.benyi.controller; +import java.util.Date; import java.util.List; + +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.project.benyi.domain.ByTrainVideoFeedback; +import com.ruoyi.project.benyi.service.IByTrainVideoFeedbackService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -22,24 +27,24 @@ import com.ruoyi.framework.web.page.TableDataInfo; /** * 培训视频评分Controller - * + * * @author tsbz * @date 2020-06-01 */ @RestController @RequestMapping("/benyi/score") -public class ByTrainVideoScoreController extends BaseController -{ +public class ByTrainVideoScoreController extends BaseController { @Autowired private IByTrainVideoScoreService byTrainVideoScoreService; + @Autowired + private IByTrainVideoFeedbackService byTrainVideoFeedbackService; /** * 查询培训视频评分列表 */ @PreAuthorize("@ss.hasPermi('benyi:score:list')") @GetMapping("/list") - public TableDataInfo list(ByTrainVideoScore byTrainVideoScore) - { + public TableDataInfo list(ByTrainVideoScore byTrainVideoScore) { startPage(); List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore); return getDataTable(list); @@ -51,8 +56,7 @@ public class ByTrainVideoScoreController extends BaseController @PreAuthorize("@ss.hasPermi('benyi:score:export')") @Log(title = "培训视频评分", businessType = BusinessType.EXPORT) @GetMapping("/export") - public AjaxResult export(ByTrainVideoScore byTrainVideoScore) - { + public AjaxResult export(ByTrainVideoScore byTrainVideoScore) { List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore); ExcelUtil<ByTrainVideoScore> util = new ExcelUtil<ByTrainVideoScore>(ByTrainVideoScore.class); return util.exportExcel(list, "score"); @@ -63,19 +67,48 @@ public class ByTrainVideoScoreController extends BaseController */ @PreAuthorize("@ss.hasPermi('benyi:score:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(byTrainVideoScoreService.selectByTrainVideoScoreById(id)); } + /** + * 获取培训视频评分详细信息 + */ + @PreAuthorize("@ss.hasPermi('benyi:score:query')" + "||@ss.hasPermi('benyi:video:query')") + @GetMapping(value = "/video/{vid}") + public AjaxResult ByVideo(@PathVariable("vid") Long vid) { + AjaxResult ajax = AjaxResult.success(); + ByTrainVideoScore byTrainVideoScore = new ByTrainVideoScore(); + byTrainVideoScore.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + byTrainVideoScore.setVideoid(vid); + List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore); + if (list != null && list.size() > 0) { + ajax.put("score", list.get(0).getScore()); + } else { + return AjaxResult.success(null); + } + ByTrainVideoFeedback byTrainVideoFeedback = new ByTrainVideoFeedback(); + byTrainVideoFeedback.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + byTrainVideoFeedback.setVideoid(vid); + List<ByTrainVideoFeedback> list2 = byTrainVideoFeedbackService.selectByTrainVideoFeedbackList(byTrainVideoFeedback); + if (list2 != null && list2.size() > 0) { + ajax.put("content", list2.get(0).getContent()); + } else { + return AjaxResult.success(null); + } + + return ajax; + } + /** * 新增培训视频评分 */ - @PreAuthorize("@ss.hasPermi('benyi:score:add')") + @PreAuthorize("@ss.hasPermi('benyi:feedback_score:add')") @Log(title = "培训视频评分", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ByTrainVideoScore byTrainVideoScore) - { + public AjaxResult add(@RequestBody ByTrainVideoScore byTrainVideoScore) { + byTrainVideoScore.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + byTrainVideoScore.setCreatetime(new Date()); return toAjax(byTrainVideoScoreService.insertByTrainVideoScore(byTrainVideoScore)); } @@ -85,8 +118,7 @@ public class ByTrainVideoScoreController extends BaseController @PreAuthorize("@ss.hasPermi('benyi:score:edit')") @Log(title = "培训视频评分", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody ByTrainVideoScore byTrainVideoScore) - { + public AjaxResult edit(@RequestBody ByTrainVideoScore byTrainVideoScore) { return toAjax(byTrainVideoScoreService.updateByTrainVideoScore(byTrainVideoScore)); } @@ -95,9 +127,8 @@ public class ByTrainVideoScoreController extends BaseController */ @PreAuthorize("@ss.hasPermi('benyi:score:remove')") @Log(title = "培训视频评分", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(byTrainVideoScoreService.deleteByTrainVideoScoreByIds(ids)); } } diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoFeedback.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoFeedback.java index b30eebaef..32c3b5fa7 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoFeedback.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoFeedback.java @@ -10,26 +10,39 @@ import java.util.Date; /** * 培训视频评价反馈对象 by_train_video_feedback - * + * * @author tsbz * @date 2020-06-01 */ -public class ByTrainVideoFeedback extends BaseEntity -{ +public class ByTrainVideoFeedback extends BaseEntity { private static final long serialVersionUID = 1L; - /** 编号 */ + /** + * 编号 + */ private Long id; - /** 视频id */ + /** + * 视频id + */ @Excel(name = "视频id") private Long videoid; - /** 反馈意见建议 */ + /** + * 讲师id + */ + @Excel(name = "讲师id") + private Long lecturerid; + + /** + * 反馈意见建议 + */ @Excel(name = "反馈意见建议") private String content; - /** 创建人 */ + /** + * 创建人 + */ @Excel(name = "创建人") private Long createuserid; @@ -40,42 +53,46 @@ public class ByTrainVideoFeedback extends BaseEntity private Date createtime; - public void setId(Long id) - { + public void setId(Long id) { this.id = id; } - public Long getId() - { + public Long getId() { return id; } - public void setVideoid(Long videoid) - { + + public void setVideoid(Long videoid) { this.videoid = videoid; } - public Long getVideoid() - { + public Long getVideoid() { return videoid; } - public void setContent(String content) - { + + public void setLecturerid(Long lecturerid) { + this.lecturerid = lecturerid; + } + + public Long getLecturerid() { + return lecturerid; + } + + public void setContent(String content) { this.content = content; } - public String getContent() - { + public String getContent() { return content; } - public void setCreateuserid(Long createuserid) - { + + public void setCreateuserid(Long createuserid) { this.createuserid = createuserid; } - public Long getCreateuserid() - { + public Long getCreateuserid() { return createuserid; } + public void setCreatetime(Date createtime) { this.createtime = createtime; } @@ -86,12 +103,13 @@ public class ByTrainVideoFeedback extends BaseEntity @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("videoid", getVideoid()) - .append("content", getContent()) - .append("createuserid", getCreateuserid()) - .append("createtime", getCreatetime()) - .toString(); + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("videoid", getVideoid()) + .append("lecturerid", getLecturerid()) + .append("content", getContent()) + .append("createuserid", getCreateuserid()) + .append("createtime", getCreatetime()) + .toString(); } } diff --git a/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoFeedbackMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoFeedbackMapper.xml index 70ddc308d..918e3f8c2 100644 --- a/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoFeedbackMapper.xml +++ b/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoFeedbackMapper.xml @@ -7,19 +7,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <resultMap type="ByTrainVideoFeedback" id="ByTrainVideoFeedbackResult"> <result property="id" column="id" /> <result property="videoid" column="videoid" /> + <result property="lecturerid" column="lecturerid" /> <result property="content" column="content" /> <result property="createuserid" column="createuserid" /> <result property="createtime" column="createtime" /> </resultMap> <sql id="selectByTrainVideoFeedbackVo"> - select id, videoid, content, createuserid, createtime from by_train_video_feedback + select id, videoid, lecturerid, content, createuserid, createtime from by_train_video_feedback </sql> <select id="selectByTrainVideoFeedbackList" parameterType="ByTrainVideoFeedback" resultMap="ByTrainVideoFeedbackResult"> <include refid="selectByTrainVideoFeedbackVo"/> <where> <if test="videoid != null "> and videoid = #{videoid}</if> + <if test="lecturerid != null "> and lecturerid = #{lecturerid}</if> <if test="content != null and content != ''"> and content = #{content}</if> <if test="createuserid != null "> and createuserid = #{createuserid}</if> <if test="createtime != null "> and createtime = #{createtime}</if> @@ -36,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null ">id,</if> <if test="videoid != null ">videoid,</if> + <if test="lecturerid != null ">lecturerid,</if> <if test="content != null and content != ''">content,</if> <if test="createuserid != null ">createuserid,</if> <if test="createtime != null ">createtime,</if> @@ -43,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null ">#{id},</if> <if test="videoid != null ">#{videoid},</if> + <if test="lecturerid != null ">#{lecturerid},</if> <if test="content != null and content != ''">#{content},</if> <if test="createuserid != null ">#{createuserid},</if> <if test="createtime != null ">#{createtime},</if> @@ -53,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update by_train_video_feedback <trim prefix="SET" suffixOverrides=","> <if test="videoid != null ">videoid = #{videoid},</if> + <if test="lecturerid != null ">lecturerid = #{lecturerid},</if> <if test="content != null and content != ''">content = #{content},</if> <if test="createuserid != null ">createuserid = #{createuserid},</if> <if test="createtime != null ">createtime = #{createtime},</if>