1
0
Эх сурвалжийг харах

管理端支持重置评卷员密码的功能

nikang 7 жил өмнө
parent
commit
13be8746a8

+ 16 - 0
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/parameter/ExamMarkerController.java

@@ -424,4 +424,20 @@ public class ExamMarkerController extends BaseParameterController {
         }
         return obj;
     }
+
+    @RequestMapping(value = "/reSetPassword", method = RequestMethod.POST)
+    @ResponseBody
+    public JSONObject reSetPassword(@RequestParam Integer id,@RequestParam String password) {
+        Marker marker = markerService.findById(id);
+        JSONObject obj = new JSONObject();
+        if (marker != null) {
+            marker.setPassword(password);
+            marker = markerService.save(marker);
+            obj.accumulate("success", true);
+        } else {
+            obj.accumulate("success", false);
+            obj.accumulate("message", "该评卷员不存在");
+        }
+        return obj;
+    }
 }

+ 63 - 7
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/param/markerList.jsp

@@ -7,7 +7,7 @@
 	<%@include file="/WEB-INF/views/include/head.jsp" %>
 	<style type="text/css">
         .sort{color:#0663A2;cursor:pointer;}
-        .taskWindow{
+        .taskWindow,.reSetPasswordWin{
             width: 400px;
             min-height: 150px;
             background: #fff;
@@ -18,14 +18,15 @@
             top: 50%;
             margin: -150px 0 0 -200px;
             text-align: center;
+            z-index: 99999;
         }
-        .taskWindow .task-header{
+        .task-header,.password-header{
             width: 100%;
             height: 46px;
             background: #5d6d7d;
             color: #fff;
         }
-        .taskWindow .task-content{
+        .task-content,.password-content{
             font-size: 18px;
             color: #005277;
             text-align: left;
@@ -47,7 +48,7 @@
             padding: 13px 0 0 13px;
             float: left;
         }
-        .task-count{
+        .task-count,.password-value{
             width: 150px;
         }
         .btn-info{
@@ -55,15 +56,27 @@
             margin-left: 320px;
             margin-bottom: 20px;
         }
-        .wrong{
+        .wrong,.passwordWrong{
             font-size: 12px;
             color: #f00;
             line-height: 30px;
             padding-left: 20px;
         }
+        #cover{
+            position: fixed;
+            z-index:9999;
+            top:0px;
+            left:0px;
+            display: none;
+            width: 100%;
+            height: 100%;
+            opacity: 0.5;
+            background: #000 none repeat scroll 0% 0%;
+        }
     </style>
 </head>
 <body>
+<div style="display: block;" id="cover"></div>
 	<ul class="nav nav-tabs">
 		<li class="active"><a href="${ctx}/admin/exam-param/marker">评卷员列表</a></li>
 		<li><a href="${ctx}/admin/exam-param/marker/batch-create">批量创建</a></li>
@@ -129,6 +142,7 @@
 					<a href="javascript:void(0)" class="toggle-button" data-id="${marker.id}" data-value="true">启用</a>
 					</c:if>
                     <a href="javascript:void(0)" class="task-button" data-id="${marker.id}" onclick="showTaskWin('${marker.id}');">设置评卷数</a>
+                    <a href="javascript:void(0)" class="reSetPassword-button" data-id="${marker.id}" onclick="reSetPassword('${marker.id}');">重置密码</a>
 				</td>
 			</tr>
 		</c:forEach>
@@ -137,11 +151,21 @@
     <div class="taskWindow" style="display:none"><div class="task-header">
         <p class="title">设置任务数</p><p class="image-close"><img src="${ctxStatic}/mark-new/images/images-close.png" /></p></div>
         <div class="task-content"><input type="text" class="task-count" placeholder="请输入任务数"/><i class="wrong"></i></div>
-        <a href="#" class="btn btn-small btn-info">确定</a>
+        <a href="#" class="btn btn-small btn-info task-btn">确定</a>
+    </div>
+
+    <div class="reSetPasswordWin" style="display:none"><div class="password-header">
+        <p class="title">重置密码</p><p class="image-close password-close"><img src="${ctxStatic}/mark-new/images/images-close.png" /></p></div>
+        <div class="password-content"><input type="text" class="password-value" placeholder="请输入新的密码"/><i class="passwordWrong"></i></div>
+        <a href="#" class="btn btn-small btn-info password-btn">确定</a>
     </div>
 	<div class="pagination">${query}</div>
 <script type="text/javascript">
     var markerId ;
+    $(document).ready(function () {
+      $('#cover').hide();
+    });
+
 $("#btnExport").click(function(){
 	top.$.jBox.confirm("确认要导出评卷员数据吗?","系统提示",function(v,h,f){
 		if(v=="ok"){
@@ -184,12 +208,26 @@ function showTaskWin(obj){
   $('.wrong').html('');
   $('.task-count').val('');
   $('.taskWindow').show();
+  $('#cover').show();
+  markerId = obj;
+}
+function reSetPassword(obj){
+  $('.passwordWrong').html('');
+  $('.password-value').val('');
+  $('.reSetPasswordWin').show();
+  $('#cover').show();
   markerId = obj;
 }
 $('.image-close').click(function () {
   $('.taskWindow').hide();
+  $('#cover').hide();
+});
+$('.password-close').click(function () {
+  $('.reSetPasswordWin').hide();
+  $('#cover').hide();
 });
-$('.btn-info').click(function () {
+
+$('.task-btn').click(function () {
   var taskCount = $('.task-count').val();
   var wrongMessage = $('.wrong');
        taskCount = taskCount.replace(/(^\s*)|(\s*$)/g, "");
@@ -211,6 +249,24 @@ $('.btn-info').click(function () {
     $('.taskWindow').hide();
   });
 });
+    $('.password-btn').click(function () {
+      var password = $('.password-value').val();
+      var wrongMessage = $('.passwordWrong');
+      password = password.replace(/(^\s*)|(\s*$)/g, "");
+      if(password.length == 0){
+        wrongMessage.html('密码不能为空!');
+        return false;
+      }
+      $.post('${ctx}/admin/exam-param/marker/reSetPassword', {id: markerId,password:password}, function(result){
+        if(result.success==true){
+          $("#searchForm").submit();
+        }else{
+          alert(result.message);
+        }
+        $('.reSetPasswordWin').hide();
+      });
+    });
+
 function page(n,s){
 	$("#pageNumber").val(n);
 	$("#pageSize").val(s);