Signed-off-by: Chenx221 <chenx221@yandex.com>
This commit is contained in:
Chenx221 2023-06-12 20:58:35 +08:00
parent 3fdf17eb7e
commit 11443413a1
10 changed files with 131 additions and 18 deletions

View File

@ -54,8 +54,6 @@
<li>
<hr class="dropdown-divider" />
</li>
<li><a class="dropdown-item" href="course/all">课程查看</a></li>
<li><a class="dropdown-item" href="course/infomodv2">课程管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
</ul>
</li>
@ -75,8 +73,8 @@
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="#">课程信息管理</a></li>
<li><a class="dropdown-item" href="#">课程安排管理</a></li>
<li><a class="dropdown-item" href="course/all">课程查看</a></li>
<li><a class="dropdown-item" href="course/infomodv2">课程管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">

View File

@ -203,7 +203,7 @@
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText2" class="form-control"
name="scoreid"/>
name="studentid"/>
<label class="form-label" for="typeText2">学号</label>
</div>
</div>
@ -241,7 +241,8 @@
<output id="score_min_value"></output>
</label>
<div class="range">
<input type="range" class="form-range" id="customRange1" name="min" value="0" min="0" max="100"/>
<input type="range" class="form-range" id="customRange1" name="min"
value="0" min="0" max="100" disabled/>
</div>
</div>
<div class="col-12">
@ -249,10 +250,20 @@
<output id="score_max_value"></output>
</label>
<div class="range">
<input type="range" class="form-range" id="customRange2" name="max" value="100" min="0" max="100"/>
<input type="range" class="form-range" id="customRange2" name="max"
value="100" min="0" max="100" disabled/>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="range_enabler" name="range_enabler" />
<label class="form-check-label" for="range_enabler">设定成绩范围</label>
</div>
</div>
</div>
<div class="row mb-2 mt-4">
<div class="col-lg-6 text-center">
<button type="submit" class="btn btn-primary">查询
@ -440,7 +451,7 @@
</c:if>
});
</script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/range-limit.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/multi_function_v1.js"></script>
</body>
</html>

View File

@ -10,3 +10,16 @@ input_max.addEventListener("input", (event) => {
value_max.textContent = event.target.value
input_min.setAttribute("max", event.target.value)
})
const range_enabler = document.querySelector("#range_enabler")
range_enabler.addEventListener("click", (event) => {
//if range_enabler is checked, then enable the range
//if range_enabler is unchecked, then disable the range
if (range_enabler.checked) {
input_min.disabled = false
input_max.disabled = false
} else {
input_min.disabled = true
input_max.disabled = true
}
})

View File

@ -2,11 +2,14 @@ package cyou.chenx221.controller;
import cyou.chenx221.helper.UsernameHelper;
import cyou.chenx221.pojo.Course;
import cyou.chenx221.pojo.Score;
import cyou.chenx221.pojo.Student;
import cyou.chenx221.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -23,7 +26,7 @@ public class ScoreController {
}
@GetMapping("/all")
public String getAllScore(Model model){
public String getAllScore(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
@ -46,4 +49,43 @@ public class ScoreController {
return "scoreopv2";
}
// @PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")//学生信息查询带条件
// public String getQueryCourses(@RequestParam(value = "name", defaultValue = "null", required = false) String name,//学生姓名
// @RequestParam(value = "coursename", defaultValue = "null", required = false) String course_name,//课程名
// @RequestParam(value = "scoreid", defaultValue = "-1", required = false) int score_id,//成绩ID
// @RequestParam(value = "studentid", defaultValue = "-1", required = false) int student_id,//学号
// @RequestParam(value = "courseid", defaultValue = "-1", required = false) int course_id,//课程ID
// @RequestParam(value = "min", required = false) int min,//最低分
// @RequestParam(value = "max", required = false) int max,//最高分
// @RequestParam(value = "range_enabler", defaultValue = "false", required = false) boolean range_enabler,//是否启用分数范围
// Model model) {
//
// //username helper start
// String username = new UsernameHelper().getCurrentUsername();
// if (username != null) {
// model.addAttribute("username", username);
// }
// //username helper end
//
// if (name.equals("null")) {
// name = null;
// }
// if (course_name.equals("null")) {
// course_name = null;
// }
// if (score_id == -1 && student_id == -1 && course_id == -1 && !range_enabler) {
// model.addAttribute("errorMessage", "查询条件不可全为空");
// return "redirect:/score/infomodv2";
// }
// List<Score> scores;
// Score score;
//
// score = new Score((score_id == -1? null:score_id), ((student_id==-1&&name==null)==null?null:(new Student(student_id,name))), null, null, min, max);
// course = new Course((id == -1 ? null : id), name, description);
//// System.out.println("id:" + id + " name:" + name + " description:" + description);
// courses = courseService.getQueryCourses(course);
// model.addAttribute("courses", courses);
// return "courseQueryResult";
// }
}

View File

@ -5,6 +5,8 @@ public class Score {
private Student student; //
private Course course; //
private Integer score; //成绩
private Integer min; //最小成绩
private Integer max; //最大成绩
public Score(Integer scoreID, Integer score) {
ScoreID = scoreID;
@ -21,6 +23,31 @@ public class Score {
this.score = score;
}
public Score(Integer scoreID, Student student, Course course, Integer score, Integer min, Integer max) {
ScoreID = scoreID;
this.student = student;
this.course = course;
this.score = score;
this.min = min;
this.max = max;
}
public Integer getMin() {
return min;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getMax() {
return max;
}
public void setMax(Integer max) {
this.max = max;
}
public Integer getScoreID() {
return ScoreID;
}

View File

@ -54,8 +54,6 @@
<li>
<hr class="dropdown-divider" />
</li>
<li><a class="dropdown-item" href="course/all">课程查看</a></li>
<li><a class="dropdown-item" href="course/infomodv2">课程管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
</ul>
</li>
@ -75,8 +73,8 @@
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="#">课程信息管理</a></li>
<li><a class="dropdown-item" href="#">课程安排管理</a></li>
<li><a class="dropdown-item" href="course/all">课程查看</a></li>
<li><a class="dropdown-item" href="course/infomodv2">课程管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">

View File

@ -203,7 +203,7 @@
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText2" class="form-control"
name="scoreid"/>
name="studentid"/>
<label class="form-label" for="typeText2">学号</label>
</div>
</div>
@ -241,7 +241,8 @@
<output id="score_min_value"></output>
</label>
<div class="range">
<input type="range" class="form-range" id="customRange1" name="min" value="0" min="0" max="100"/>
<input type="range" class="form-range" id="customRange1" name="min"
value="0" min="0" max="100" disabled/>
</div>
</div>
<div class="col-12">
@ -249,10 +250,20 @@
<output id="score_max_value"></output>
</label>
<div class="range">
<input type="range" class="form-range" id="customRange2" name="max" value="100" min="0" max="100"/>
<input type="range" class="form-range" id="customRange2" name="max"
value="100" min="0" max="100" disabled/>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="range_enabler" name="range_enabler" />
<label class="form-check-label" for="range_enabler">设定成绩范围</label>
</div>
</div>
</div>
<div class="row mb-2 mt-4">
<div class="col-lg-6 text-center">
<button type="submit" class="btn btn-primary">查询
@ -440,7 +451,7 @@
</c:if>
});
</script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/range-limit.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/multi_function_v1.js"></script>
</body>
</html>

View File

@ -9,4 +9,17 @@ input_min.addEventListener("input", (event) => {
input_max.addEventListener("input", (event) => {
value_max.textContent = event.target.value
input_min.setAttribute("max", event.target.value)
})
})
const range_enabler = document.querySelector("#range_enabler")
range_enabler.addEventListener("click", (event) => {
//if range_enabler is checked, then enable the range
//if range_enabler is unchecked, then disable the range
if (range_enabler.checked) {
input_min.disabled = false
input_max.disabled = false
} else {
input_min.disabled = true
input_max.disabled = true
}
})