Compare commits
4 Commits
fd6a81c6ed
...
4b17e29866
Author | SHA1 | Date | |
---|---|---|---|
|
4b17e29866 | ||
|
369d8a54e8 | ||
|
7cdc0a8821 | ||
|
0f87075fd4 |
6
.idea/jsLibraryMappings.xml
Normal file
6
.idea/jsLibraryMappings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<file url="file://$PROJECT_DIR$" libraries="{jquery}" />
|
||||
</component>
|
||||
</project>
|
@ -4,6 +4,7 @@
|
||||
<option name="state">
|
||||
<map>
|
||||
<entry key="file://$PROJECT_DIR$/src/main/webapp/admin/device.jsp" value="file://$PROJECT_DIR$/src/main/webapp/admin" />
|
||||
<entry key="file://$PROJECT_DIR$/src/main/webapp/stu/updateScore.jsp" value="file://$PROJECT_DIR$/src/main/webapp/stu" />
|
||||
<entry key="file://$PROJECT_DIR$/src/main/webapp/student/register.jsp" value="file://$PROJECT_DIR$/src/main/webapp/student" />
|
||||
<entry key="file://$PROJECT_DIR$/src/main/webapp/worker/worker_center_index.jsp" value="file://$PROJECT_DIR$/src/main/webapp/worker" />
|
||||
</map>
|
||||
|
@ -0,0 +1,46 @@
|
||||
package cn.edu.cqwu.repair.controller.stu;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.OrderDao;
|
||||
import cn.edu.cqwu.repair.dao.StuDao;
|
||||
import cn.edu.cqwu.repair.entity.Order;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Controller
|
||||
public class StuCommentsController {
|
||||
StuDao stuDao;
|
||||
OrderDao orderDao;
|
||||
|
||||
@Autowired
|
||||
public StuCommentsController(StuDao stuDao,OrderDao orderDao) {
|
||||
this.stuDao = stuDao;
|
||||
this.orderDao = orderDao;
|
||||
}
|
||||
|
||||
@RequestMapping("/stu/comment")
|
||||
public String stuComment1(int id, Model model) {
|
||||
model.addAttribute("id", id);
|
||||
return "/stu/updateScore";
|
||||
}
|
||||
|
||||
@RequestMapping("/stu/comment.do")
|
||||
public String stuComment(int starRating, int id, HttpServletRequest request){
|
||||
Order byOrderId = orderDao.findByOrderId(id);
|
||||
byOrderId.setScore(starRating);
|
||||
int update = orderDao.update(byOrderId);
|
||||
if(update>0){
|
||||
request.setAttribute("stuCurrentMess","评价成功");
|
||||
return "/stu/current";
|
||||
}
|
||||
request.setAttribute("stuUpdateScoreMess","评价失败");
|
||||
|
||||
return "/stu/updateScore";
|
||||
}
|
||||
}
|
@ -17,5 +17,4 @@ public interface OrderDao {
|
||||
public Order findByOrderId(int orderId);
|
||||
|
||||
public ArrayList<Order> findHistoryList(int workerId);
|
||||
|
||||
}
|
||||
|
@ -66,9 +66,10 @@ public class OrderDaoImpl implements OrderDao {
|
||||
@Override
|
||||
public Order findByOrderId(int orderId){
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.select(ORDER.ALL_COLUMNS).where(ORDER.ORDER_ID.eq(orderId)).where(ORDER.ORDER_STATUS.eq(1));
|
||||
qw.select(ORDER.ALL_COLUMNS).where(ORDER.ORDER_ID.eq(orderId));
|
||||
return mapper.selectOneByQuery(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int statusModify(int orderId){
|
||||
Order order = findByOrderId(orderId);
|
||||
|
BIN
src/main/webapp/images/rating.png
Normal file
BIN
src/main/webapp/images/rating.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 690 B |
BIN
src/main/webapp/images/sx.png
Normal file
BIN
src/main/webapp/images/sx.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -79,6 +79,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<a href="${webroot}/stu/detail.do?id=${repairOrder.orderId}">详情</a>
|
||||
<a href="${webroot}/stu/comment?id=${repairOrder.orderId}">评价</a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
|
74
src/main/webapp/stu/updateScore.jsp
Normal file
74
src/main/webapp/stu/updateScore.jsp
Normal file
@ -0,0 +1,74 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>javascript星级评分</title>
|
||||
<style type="text/css">
|
||||
*{margin:0;padding:0;}
|
||||
.wrapper{height:20px;padding:5px;width:130px;margin:100px auto 10px;background-color: #6c757d}
|
||||
a{float:left;width:26px;height:20px;background:url(${webroot}/images/rating.png) 0 -20px no-repeat;}
|
||||
p{font:24px SimSun;width:130px;margin-left:auto;margin-right:auto;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/stu/comment.do?id=${id}" method="post">
|
||||
<div class="wrapper">
|
||||
<input type="hidden" name="rating" id="rating" value="0"> <!-- 用于存储评分值 -->
|
||||
<a href="javascript:;"></a>
|
||||
<a href="javascript:;"></a>
|
||||
<a href="javascript:;"></a>
|
||||
<a href="javascript:;"></a>
|
||||
<a href="javascript:;"></a>
|
||||
</div>
|
||||
<p></p>
|
||||
<input type="submit" value="提交评分">
|
||||
</form>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
||||
<script type="text/javascript">
|
||||
window.onload = function(){
|
||||
var star = document.getElementsByTagName('a');
|
||||
var oDiv = document.getElementsByTagName('div')[0];
|
||||
var temp = 0;
|
||||
for(var i = 0, len = star.length; i < len; i++){
|
||||
star[i].index = i;
|
||||
star[i].onmouseover = function(){
|
||||
clear();
|
||||
for(var j = 0; j < this.index + 1; j++){
|
||||
star[j].style.backgroundPosition = '0 0';
|
||||
}
|
||||
}
|
||||
star[i].onmouseout = function(){
|
||||
for(var j = 0; j < this.index + 1; j++){
|
||||
star[j].style.backgroundPosition = '0 -20px';
|
||||
}
|
||||
current(temp);
|
||||
}
|
||||
star[i].onclick = function(){
|
||||
temp = this.index + 1;
|
||||
document.getElementsByTagName('p')[0].innerHTML = temp + ' 颗星';
|
||||
current(temp);
|
||||
// 更新隐藏字段的值
|
||||
ratingInput.value = temp;
|
||||
}
|
||||
}
|
||||
//清除所有
|
||||
function clear(){
|
||||
for(var i = 0, len = star.length; i < len; i++){
|
||||
star[i].style.backgroundPosition = '0 -20px';
|
||||
}
|
||||
}
|
||||
//显示当前第几颗星
|
||||
function current(temp){
|
||||
for(var i = 0; i < temp; i++){
|
||||
star[i].style.backgroundPosition = '0 0';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user