Compare commits

...

4 Commits

Author SHA1 Message Date
wobeitaoleshigexuruo
4b17e29866 score 2024-06-06 22:34:21 +08:00
wobeitaoleshigexuruo
369d8a54e8 Merge remote-tracking branch 'origin/master' 2024-06-06 21:46:00 +08:00
wobeitaoleshigexuruo
7cdc0a8821 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/main/webapp/stu/current.jsp
2024-06-06 20:15:18 +08:00
wobeitaoleshigexuruo
0f87075fd4 stu upload 2024-06-06 18:14:28 +08:00
9 changed files with 130 additions and 2 deletions

View 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>

View File

@ -4,6 +4,7 @@
<option name="state"> <option name="state">
<map> <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/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/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" /> <entry key="file://$PROJECT_DIR$/src/main/webapp/worker/worker_center_index.jsp" value="file://$PROJECT_DIR$/src/main/webapp/worker" />
</map> </map>

View File

@ -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";
}
}

View File

@ -17,5 +17,4 @@ public interface OrderDao {
public Order findByOrderId(int orderId); public Order findByOrderId(int orderId);
public ArrayList<Order> findHistoryList(int workerId); public ArrayList<Order> findHistoryList(int workerId);
} }

View File

@ -66,9 +66,10 @@ public class OrderDaoImpl implements OrderDao {
@Override @Override
public Order findByOrderId(int orderId){ public Order findByOrderId(int orderId){
QueryWrapper qw = new QueryWrapper(); 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); return mapper.selectOneByQuery(qw);
} }
@Override @Override
public int statusModify(int orderId){ public int statusModify(int orderId){
Order order = findByOrderId(orderId); Order order = findByOrderId(orderId);

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -79,6 +79,7 @@
</td> </td>
<td> <td>
<a href="${webroot}/stu/detail.do?id=${repairOrder.orderId}">详情</a> <a href="${webroot}/stu/detail.do?id=${repairOrder.orderId}">详情</a>
<a href="${webroot}/stu/comment?id=${repairOrder.orderId}">评价</a>
</td> </td>
</tr> </tr>
</c:forEach> </c:forEach>

View 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>