20200601-zlp-1

完善评分评价
This commit is contained in:
paidaxing444 2020-06-01 15:05:20 +08:00
parent ca14b6f89e
commit aa7779ef6d
8 changed files with 264 additions and 66 deletions

View File

@ -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) { export function addFeedback(data) {
return request({ return request({

View File

@ -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) { export function addScore(data) {
return request({ return request({

View File

@ -72,16 +72,26 @@ export default {
noEventsMessage: "暂无日程" noEventsMessage: "暂无日程"
} }
}, },
// header: {
// left: "prev,next today",
// center: "title",
// right: "dayGridMonth,timeGridWeek,timeGridDay listWeek"
// },
// buttonText: {
// today: "",
// month: "",
// week: "",
// day: "",
// list: ""
// },
header: { header: {
left: "prev,next today", left: "prev,next today",
center: "title", center: "title",
right: "dayGridMonth,timeGridWeek,timeGridDay listWeek" right: "dayGridMonth, listWeek"
}, },
buttonText: { buttonText: {
today: "今天", today: "今天",
month: "月", month: "月",
week: "周",
day: "日",
list: "周列表" list: "周列表"
}, },
calendarPlugins: [ calendarPlugins: [

View File

@ -13,13 +13,44 @@
</el-col> </el-col>
<el-col :xs="24" :sm="12" style="padding: 10px;"> <el-col :xs="24" :sm="12" style="padding: 10px;">
<el-card> <el-card>
内容介绍 <div slot="header" class="clearfix">
<br />标题{{title}} <span>内容介绍</span>
<br />讲师{{lecturername}} </div>
<br />简介{{information}} <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<br />评分 <div class="text item">
<el-rate v-model="value"></el-rate>留言 <el-form-item label="标题">{{title}}</el-form-item>
<el-input type="textarea" placeholder="请输入内容" /> </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-card>
</el-col> </el-col>
</el-row> </el-row>
@ -28,31 +59,64 @@
<script> <script>
import { getVideo } from "@/api/benyi_train/video"; import { getVideo } from "@/api/benyi_train/video";
import { getScoreByVideo, addScore } from "@/api/benyi_train/score";
import { addFeedback } from "@/api/benyi_train/feedback";
export default { export default {
name: "detail", name: "detail",
data() { data() {
return { return {
title: "", title: "",
dis: false,
lecturername: "", lecturername: "",
lecturerid: null,
information: "", information: "",
// //
playerOptions: {}, playerOptions: {},
value: null // value: null,
// content: "",
//
form: {},
//
rules: {
score: [
{ required: true, message: "请为讲师打个分数吧", trigger: "click" }
],
content: [
{ required: true, message: "意见或建议不能为空", trigger: "blur" }
]
}
}; };
}, },
created() { created() {
const id = this.$route.params && this.$route.params.id; const id = this.$route.params && this.$route.params.id;
//console.log(id); //console.log(id);
this.getVideoById(id); this.getVideoById(id);
this.getScore(id);
//this.value = 5;
//this.dis=true;
}, },
methods: { 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) { getVideoById(id) {
getVideo(id).then(response => { getVideo(id).then(response => {
this.title=response.data.title; this.title = response.data.title;
this.lecturername=response.data.lecturername; this.lecturername = response.data.lecturername;
this.information=response.data.information; this.lecturerid = response.data.lecturer;
this.information = response.data.information;
//console.log(response.data); //console.log(response.data);
this.playerOptions = { this.playerOptions = {
autoplay: true, autoplay: true,
@ -63,7 +127,6 @@ export default {
sources: [ sources: [
{ {
type: response.data.filetype, type: response.data.filetype,
// mp4
src: "https://files.benyiedu.com/" + response.data.videourl src: "https://files.benyiedu.com/" + response.data.videourl
} }
], ],
@ -77,6 +140,37 @@ 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;
}
});
} }
} }
}; };

View File

@ -1,6 +1,9 @@
package com.ruoyi.project.benyi.service.impl; package com.ruoyi.project.benyi.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -68,14 +71,35 @@ public class ByTrainVideoFeedbackController extends BaseController
return AjaxResult.success(byTrainVideoFeedbackService.selectByTrainVideoFeedbackById(id)); 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) @Log(title = "培训视频评价反馈", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ByTrainVideoFeedback byTrainVideoFeedback) public AjaxResult add(@RequestBody ByTrainVideoFeedback byTrainVideoFeedback)
{ {
byTrainVideoFeedback.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byTrainVideoFeedback.setCreatetime(new Date());
return toAjax(byTrainVideoFeedbackService.insertByTrainVideoFeedback(byTrainVideoFeedback)); return toAjax(byTrainVideoFeedbackService.insertByTrainVideoFeedback(byTrainVideoFeedback));
} }

View File

@ -1,6 +1,11 @@
package com.ruoyi.project.benyi.controller; package com.ruoyi.project.benyi.controller;
import java.util.Date;
import java.util.List; 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.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -28,18 +33,18 @@ import com.ruoyi.framework.web.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("/benyi/score") @RequestMapping("/benyi/score")
public class ByTrainVideoScoreController extends BaseController public class ByTrainVideoScoreController extends BaseController {
{
@Autowired @Autowired
private IByTrainVideoScoreService byTrainVideoScoreService; private IByTrainVideoScoreService byTrainVideoScoreService;
@Autowired
private IByTrainVideoFeedbackService byTrainVideoFeedbackService;
/** /**
* 查询培训视频评分列表 * 查询培训视频评分列表
*/ */
@PreAuthorize("@ss.hasPermi('benyi:score:list')") @PreAuthorize("@ss.hasPermi('benyi:score:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ByTrainVideoScore byTrainVideoScore) public TableDataInfo list(ByTrainVideoScore byTrainVideoScore) {
{
startPage(); startPage();
List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore); List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore);
return getDataTable(list); return getDataTable(list);
@ -51,8 +56,7 @@ public class ByTrainVideoScoreController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:score:export')") @PreAuthorize("@ss.hasPermi('benyi:score:export')")
@Log(title = "培训视频评分", businessType = BusinessType.EXPORT) @Log(title = "培训视频评分", businessType = BusinessType.EXPORT)
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(ByTrainVideoScore byTrainVideoScore) public AjaxResult export(ByTrainVideoScore byTrainVideoScore) {
{
List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore); List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore);
ExcelUtil<ByTrainVideoScore> util = new ExcelUtil<ByTrainVideoScore>(ByTrainVideoScore.class); ExcelUtil<ByTrainVideoScore> util = new ExcelUtil<ByTrainVideoScore>(ByTrainVideoScore.class);
return util.exportExcel(list, "score"); return util.exportExcel(list, "score");
@ -63,19 +67,48 @@ public class ByTrainVideoScoreController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('benyi:score:query')") @PreAuthorize("@ss.hasPermi('benyi:score:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id) {
{
return AjaxResult.success(byTrainVideoScoreService.selectByTrainVideoScoreById(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) @Log(title = "培训视频评分", businessType = BusinessType.INSERT)
@PostMapping @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)); return toAjax(byTrainVideoScoreService.insertByTrainVideoScore(byTrainVideoScore));
} }
@ -85,8 +118,7 @@ public class ByTrainVideoScoreController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:score:edit')") @PreAuthorize("@ss.hasPermi('benyi:score:edit')")
@Log(title = "培训视频评分", businessType = BusinessType.UPDATE) @Log(title = "培训视频评分", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ByTrainVideoScore byTrainVideoScore) public AjaxResult edit(@RequestBody ByTrainVideoScore byTrainVideoScore) {
{
return toAjax(byTrainVideoScoreService.updateByTrainVideoScore(byTrainVideoScore)); return toAjax(byTrainVideoScoreService.updateByTrainVideoScore(byTrainVideoScore));
} }
@ -96,8 +128,7 @@ public class ByTrainVideoScoreController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:score:remove')") @PreAuthorize("@ss.hasPermi('benyi:score:remove')")
@Log(title = "培训视频评分", businessType = BusinessType.DELETE) @Log(title = "培训视频评分", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids) {
{
return toAjax(byTrainVideoScoreService.deleteByTrainVideoScoreByIds(ids)); return toAjax(byTrainVideoScoreService.deleteByTrainVideoScoreByIds(ids));
} }
} }

View File

@ -14,22 +14,35 @@ import java.util.Date;
* @author tsbz * @author tsbz
* @date 2020-06-01 * @date 2020-06-01
*/ */
public class ByTrainVideoFeedback extends BaseEntity public class ByTrainVideoFeedback extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 编号 */ /**
* 编号
*/
private Long id; private Long id;
/** 视频id */ /**
* 视频id
*/
@Excel(name = "视频id") @Excel(name = "视频id")
private Long videoid; private Long videoid;
/** 反馈意见建议 */ /**
* 讲师id
*/
@Excel(name = "讲师id")
private Long lecturerid;
/**
* 反馈意见建议
*/
@Excel(name = "反馈意见建议") @Excel(name = "反馈意见建议")
private String content; private String content;
/** 创建人 */ /**
* 创建人
*/
@Excel(name = "创建人") @Excel(name = "创建人")
private Long createuserid; private Long createuserid;
@ -40,42 +53,46 @@ public class ByTrainVideoFeedback extends BaseEntity
private Date createtime; private Date createtime;
public void setId(Long id) public void setId(Long id) {
{
this.id = id; this.id = id;
} }
public Long getId() public Long getId() {
{
return id; return id;
} }
public void setVideoid(Long videoid)
{ public void setVideoid(Long videoid) {
this.videoid = videoid; this.videoid = videoid;
} }
public Long getVideoid() public Long getVideoid() {
{
return videoid; 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; this.content = content;
} }
public String getContent() public String getContent() {
{
return content; return content;
} }
public void setCreateuserid(Long createuserid)
{ public void setCreateuserid(Long createuserid) {
this.createuserid = createuserid; this.createuserid = createuserid;
} }
public Long getCreateuserid() public Long getCreateuserid() {
{
return createuserid; return createuserid;
} }
public void setCreatetime(Date createtime) { public void setCreatetime(Date createtime) {
this.createtime = createtime; this.createtime = createtime;
} }
@ -86,9 +103,10 @@ public class ByTrainVideoFeedback extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("videoid", getVideoid()) .append("videoid", getVideoid())
.append("lecturerid", getLecturerid())
.append("content", getContent()) .append("content", getContent())
.append("createuserid", getCreateuserid()) .append("createuserid", getCreateuserid())
.append("createtime", getCreatetime()) .append("createtime", getCreatetime())

View File

@ -7,19 +7,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ByTrainVideoFeedback" id="ByTrainVideoFeedbackResult"> <resultMap type="ByTrainVideoFeedback" id="ByTrainVideoFeedbackResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="videoid" column="videoid" /> <result property="videoid" column="videoid" />
<result property="lecturerid" column="lecturerid" />
<result property="content" column="content" /> <result property="content" column="content" />
<result property="createuserid" column="createuserid" /> <result property="createuserid" column="createuserid" />
<result property="createtime" column="createtime" /> <result property="createtime" column="createtime" />
</resultMap> </resultMap>
<sql id="selectByTrainVideoFeedbackVo"> <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> </sql>
<select id="selectByTrainVideoFeedbackList" parameterType="ByTrainVideoFeedback" resultMap="ByTrainVideoFeedbackResult"> <select id="selectByTrainVideoFeedbackList" parameterType="ByTrainVideoFeedback" resultMap="ByTrainVideoFeedbackResult">
<include refid="selectByTrainVideoFeedbackVo"/> <include refid="selectByTrainVideoFeedbackVo"/>
<where> <where>
<if test="videoid != null "> and videoid = #{videoid}</if> <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="content != null and content != ''"> and content = #{content}</if>
<if test="createuserid != null "> and createuserid = #{createuserid}</if> <if test="createuserid != null "> and createuserid = #{createuserid}</if>
<if test="createtime != null "> and createtime = #{createtime}</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=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if> <if test="id != null ">id,</if>
<if test="videoid != null ">videoid,</if> <if test="videoid != null ">videoid,</if>
<if test="lecturerid != null ">lecturerid,</if>
<if test="content != null and content != ''">content,</if> <if test="content != null and content != ''">content,</if>
<if test="createuserid != null ">createuserid,</if> <if test="createuserid != null ">createuserid,</if>
<if test="createtime != null ">createtime,</if> <if test="createtime != null ">createtime,</if>
@ -43,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if> <if test="id != null ">#{id},</if>
<if test="videoid != null ">#{videoid},</if> <if test="videoid != null ">#{videoid},</if>
<if test="lecturerid != null ">#{lecturerid},</if>
<if test="content != null and content != ''">#{content},</if> <if test="content != null and content != ''">#{content},</if>
<if test="createuserid != null ">#{createuserid},</if> <if test="createuserid != null ">#{createuserid},</if>
<if test="createtime != null ">#{createtime},</if> <if test="createtime != null ">#{createtime},</if>
@ -53,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update by_train_video_feedback update by_train_video_feedback
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="videoid != null ">videoid = #{videoid},</if> <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="content != null and content != ''">content = #{content},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if> <if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="createtime != null ">createtime = #{createtime},</if> <if test="createtime != null ">createtime = #{createtime},</if>