فهرست منبع

云阅卷评卷员可以自行修改密码

nikang 7 سال پیش
والد
کامیت
d1b3107ce5

+ 13 - 7
stmms-web/src/main/webapp/static/mark-new/css/style.css

@@ -1135,16 +1135,22 @@ i,em {
 	overflow: hidden;
 }
 .wrong {
-	font-size: 12px;
-	color: #f00;
-	line-height: 30px;
+    font-size: 18px;
+    color: #f00;
+    line-height: 30px;
+}
+.message-popover .popover-cont .username,.password,.password2 {
+    font-size: 12px;
+    color: #f00;
+    line-height: 30px;
     padding-left: 20px;
 }
-
 a.button.all-zero-button {
 	margin-right: 20px;
 }
-
+.message-popover .popover-cont .username-input,.password-input,.password2-input{
+    width: 200px;
+}
 .message-popover .text-userInfo {
     margin: 0px 0 15px 0;
     width: 50px;
@@ -1152,11 +1158,11 @@ a.button.all-zero-button {
     margin-right: 20px;
 }
 
-.passWord-input{
+.password-input,.password2-input{
     margin-left: 20px;
 }
 
-.userName-input{
+.username-input{
     margin-left: 12px;
 }
 

+ 54 - 31
stmms-web/src/main/webapp/static/mark-new/js/modules/change-name.js

@@ -12,9 +12,11 @@ function ChangeName(option) {
     this.userName = option.markControl.container.header.find('#mark-user-name');
 
     this.popover = getDom(this.popover_dom, this.markControl);
-    this.popover.userNameInput = this.popover.find('input.userName-input');
-    this.popover.passWordInput = this.popover.find('input.passWord-input');
-    this.popover.userNameMessage = this.popover.find('i.userName');
+    this.popover.userNameInput = this.popover.find('input.username-input');
+    this.popover.passwordInput = this.popover.find('input.password-input');
+    this.popover.password2Input = this.popover.find('input.password2-input');
+    this.popover.userNameMessage = this.popover.find('i.username');
+    this.popover.password2Message = this.popover.find('i.password2');
     this.popover.submitButton = this.popover.find('a.btn');
     this.popover.cancelButton = this.popover.find('p.image-close');
     this.popover.appendTo(this.markControl.container);
@@ -28,29 +30,47 @@ function ChangeName(option) {
         self.toggle(false);
     });
     this.popover.submitButton.click(function() {
-        var nameText = self.popover.userNameInput.val();
-            nameText = nameText.replace(/(^\s*)|(\s*$)/g, "");
-        var pwText = self.popover.passWordInput.val();
-            pwText = pwText.replace(/(^\s*)|(\s*$)/g, "");
-        if (nameText.length == 0) {
-            self.popover.userNameMessage.html('姓名不能为空');
-        } else if (nameText.length > 8) {
-            self.popover.userNameMessage.html('长度不能超过8个字');
-        } else {
-            $.post(self.url, {
-                name: nameText,
-                password:pwText
-            }, function(result) {
-                if (result.success == true) {
-                    self.userName.html(result.name);
-                    self.toggle(false);
-                } else {
-                    self.popover.userNameMessage.html('修改失败,请稍后重试');
-                }
-            }).error(function() {
-                self.popover.userNameMessage.html('网络通信错误,请稍后重试');
-            });
-        }
+              var logout = false;
+              var nameText = self.popover.userNameInput.val();
+                  nameText = nameText.replace(/(^\s*)|(\s*$)/g, "");
+              var pwText = self.popover.passwordInput.val();
+                  pwText = pwText.replace(/(^\s*)|(\s*$)/g, "");
+              var pw2Text = self.popover.password2Input.val();
+                  pw2Text = pw2Text.replace(/(^\s*)|(\s*$)/g, "");
+              if (nameText.length == 0) {
+                  self.popover.userNameMessage.html('姓名不能为空');
+                  return false;
+              } else if (nameText.length > 8) {
+                  self.popover.userNameMessage.html('长度不能超过8个字');
+                  return false;
+              }
+              if(pwText.length > 0 || pw2Text.length > 0) {
+                  logout = true;
+                  if (!pw2Text) {
+                    self.popover.password2Message.html('请再次输入您的密码');
+                    return false;
+                  }
+                  if (pwText != pw2Text) {
+                    self.popover.password2Message.html('两次密码请保持一致');
+                    return false;
+                  }
+              }
+                $.post(self.url, {
+                    name: nameText,
+                    password:pwText
+                }, function(result) {
+                    if (result.success == true) {
+                        self.userName.html(result.name);
+                        self.toggle(false);
+                        if(logout){//修改密码后请重新登陆
+                          window.location.href = '/mark/logout';
+                        }
+                    } else {
+                        self.popover.userNameMessage.html('修改失败,请稍后重试');
+                    }
+                }).error(function() {
+                    self.popover.userNameMessage.html('网络通信错误,请稍后重试');
+                });
     });
 }
 
@@ -58,8 +78,9 @@ ChangeName.prototype.toggle = function(enable) {
     if (enable == true) {
         this.enable = true;
         this.popover.userNameInput.val('');
-        this.popover.passWordInput.val('');
+        this.popover.passwordInput.val('');
         this.popover.userNameMessage.html('');
+        this.popover.password2Message.html('');
         this.popover.show();
         this.context.listenKeyboard = false;
     } else {
@@ -71,9 +92,11 @@ ChangeName.prototype.toggle = function(enable) {
 
 ChangeName.prototype.popover_dom = '<div class="message-popover" style="display:none"><div class="popover-header">\
 <p class="title">修改个人信息</p><p class="image-close"><img src="{staticServer}/mark-new/images/images-close.png" /></p></div>\
-<div class="popover-cont"><span style="color: red;">*</span><input type="text" class="userName-input" placeholder="请输入您的姓名" />\
-<i class="wrong userName"></i></div>\
-<div class="popover-cont"><input type="text" class="passWord-input" placeholder="请输入新的密码" />\
- <i class="wrong passWord"></i></div>\
+<div class="popover-cont"><span style="color: red;">*</span><input type="text" class="username-input" placeholder="请输入您的姓名" />\
+<i class="wrong username"></i></div>\
+<div class="popover-cont"><input type="password" class="password-input" placeholder="请输入新的密码" />\
+ <i class="wrong password"></i></div>\
+ <div class="popover-cont"><input type="password" class="password2-input" placeholder="请再次输入您的密码" /> \
+ <i class="wrong password2"></i></div>\
 <a href="#" class="btn btn-small btn-info text-userInfo">确定</a>\
 </div>';

+ 20 - 12
stmms-web/src/main/webapp/static/mark-track/css/style.css

@@ -1176,22 +1176,30 @@ i,em {
 }
 
 .wrong {
-	font-size: 12px;
-	color: #f00;
-	line-height: 30px;
-	padding-left: 20px;
+    font-size: 18px;
+    color: #f00;
+    line-height: 30px;
+}
+.message-popover .popover-cont .username,.password,.password2 {
+    font-size: 12px;
+    color: #f00;
+    line-height: 30px;
+    padding-left: 20px;
+}
+.message-popover .popover-cont .username-input,.password-input,.password2-input{
+    width: 200px;
 }
 .message-popover .text-userInfo {
-	margin: 0px 0 15px 0;
-	width: 50px;
-	float: right;
-	margin-right: 20px;
+    margin: 0px 0 15px 0;
+    width: 50px;
+    float: right;
+    margin-right: 20px;
 }
 
-.passWord-input{
-	margin-left: 20px;
+.password-input,.password2-input{
+    margin-left: 20px;
 }
 
-.userName-input{
-	margin-left: 12px;
+.username-input{
+    margin-left: 12px;
 }

+ 82 - 59
stmms-web/src/main/webapp/static/mark-track/js/modules/change-name.js

@@ -1,79 +1,102 @@
 //评卷状态模块
 var change_name = function(option, success) {
-    var object = new ChangeName(option);
-    success();
-    return object;
+  var object = new ChangeName(option);
+  success();
+  return object;
 }
 
 function ChangeName(option) {
-    this.markControl = option.markControl;
-    this.url = option.url;
-    this.context = option.markControl.context;
-    this.userName = option.markControl.container.header.find('#mark-user-name');
+  this.markControl = option.markControl;
+  this.url = option.url;
+  this.context = option.markControl.context;
+  this.userName = option.markControl.container.header.find('#mark-user-name');
 
-    this.popover = getDom(this.popover_dom, this.markControl);
-    this.popover.userNameInput = this.popover.find('input.userName-input');
-    this.popover.passWordInput = this.popover.find('input.passWord-input');
-    this.popover.userNameMessage = this.popover.find('i.userName');
-    this.popover.submitButton = this.popover.find('a.btn');
-    this.popover.cancelButton = this.popover.find('p.image-close');
-    this.popover.appendTo(this.markControl.container);
+  this.popover = getDom(this.popover_dom, this.markControl);
+  this.popover.userNameInput = this.popover.find('input.username-input');
+  this.popover.passwordInput = this.popover.find('input.password-input');
+  this.popover.password2Input = this.popover.find('input.password2-input');
+  this.popover.userNameMessage = this.popover.find('i.username');
+  this.popover.password2Message = this.popover.find('i.password2');
+  this.popover.submitButton = this.popover.find('a.btn');
+  this.popover.cancelButton = this.popover.find('p.image-close');
+  this.popover.appendTo(this.markControl.container);
 
-    var self = this;
+  var self = this;
 
-    this.markControl.container.header.find('a.useinfo').click(function() {
-        self.toggle(true);
-    });
-    this.popover.cancelButton.click(function() {
+  this.markControl.container.header.find('a.useinfo').click(function() {
+    self.toggle(true);
+  });
+  this.popover.cancelButton.click(function() {
+    self.toggle(false);
+  });
+  this.popover.submitButton.click(function() {
+    var logout = false;
+    var nameText = self.popover.userNameInput.val();
+    nameText = nameText.replace(/(^\s*)|(\s*$)/g, "");
+    var pwText = self.popover.passwordInput.val();
+    pwText = pwText.replace(/(^\s*)|(\s*$)/g, "");
+    var pw2Text = self.popover.password2Input.val();
+    pw2Text = pw2Text.replace(/(^\s*)|(\s*$)/g, "");
+    if (nameText.length == 0) {
+      self.popover.userNameMessage.html('姓名不能为空');
+      return false;
+    } else if (nameText.length > 8) {
+      self.popover.userNameMessage.html('长度不能超过8个字');
+      return false;
+    }
+    if(pwText.length > 0 || pw2Text.length > 0) {
+      logout = true;
+      if (!pw2Text) {
+        self.popover.password2Message.html('请再次输入您的密码');
+        return false;
+      }
+      if (pwText != pw2Text) {
+        self.popover.password2Message.html('两次密码请保持一致');
+        return false;
+      }
+    }
+    $.post(self.url, {
+      name: nameText,
+      password:pwText
+    }, function(result) {
+      if (result.success == true) {
+        self.userName.html(result.name);
         self.toggle(false);
-    });
-    this.popover.submitButton.click(function() {
-          var nameText = self.popover.userNameInput.val();
-          nameText = nameText.replace(/(^\s*)|(\s*$)/g, "");
-          var pwText = self.popover.passWordInput.val();
-          pwText = pwText.replace(/(^\s*)|(\s*$)/g, "");
-        if (nameText.length == 0) {
-            self.popover.userNameMessage.html('姓名不能为空');
-        } else if (nameText.length > 8) {
-            self.popover.userNameMessage.html('长度不能超过8个字');
-        } else {
-            $.post(self.url, {
-              name: nameText,
-              password:pwText
-            }, function(result) {
-                if (result.success == true) {
-                    self.userName.html(result.name);
-                    self.toggle(false);
-                } else {
-                    self.popover.userNameMessage.html('修改失败,请稍后重试');
-                }
-            }).error(function() {
-                self.popover.userNameMessage.html('网络通信错误,请稍后重试');
-            });
+        if(logout){//修改密码后请重新登陆
+          window.location.href = '/mark/logout';
         }
+      } else {
+        self.popover.userNameMessage.html('修改失败,请稍后重试');
+      }
+    }).error(function() {
+      self.popover.userNameMessage.html('网络通信错误,请稍后重试');
     });
+  });
 }
 
 ChangeName.prototype.toggle = function(enable) {
-    if (enable == true) {
-        this.enable = true;
-        this.popover.userNameInput.val('');
-        this.popover.passWordInput.val('');
-        this.popover.userNameMessage.html('');
-        this.popover.show();
-        this.context.listenKeyboard = false;
-    } else {
-        this.enable = false;
-        this.popover.hide();
-        this.context.listenKeyboard = true;
-    }
+  if (enable == true) {
+    this.enable = true;
+    this.popover.userNameInput.val('');
+    this.popover.passwordInput.val('');
+    this.popover.userNameMessage.html('');
+    this.popover.password2Message.html('');
+    this.popover.show();
+    this.context.listenKeyboard = false;
+  } else {
+    this.enable = false;
+    this.popover.hide();
+    this.context.listenKeyboard = true;
+  }
 }
 
 ChangeName.prototype.popover_dom = '<div class="message-popover" style="display:none"><div class="popover-header">\
 <p class="title">修改个人信息</p><p class="image-close"><img src="{staticServer}/mark-new/images/images-close.png" /></p></div>\
-<div class="popover-cont"><span style="color: red;">*</span><input type="text" class="userName-input" placeholder="请输入您的姓名" />\
-<i class="wrong userName"></i></div>\
-<div class="popover-cont"><input type="text" class="passWord-input" placeholder="请输入新的密码" />\
- <i class="wrong passWord"></i></div>\
+<div class="popover-cont"><span style="color: red;">*</span><input type="text" class="username-input" placeholder="请输入您的姓名" />\
+<i class="wrong username"></i></div>\
+<div class="popover-cont"><input type="password" class="password-input" placeholder="请输入新的密码" />\
+ <i class="wrong password"></i></div>\
+ <div class="popover-cont"><input type="password" class="password2-input" placeholder="请再次输入您的密码" /> \
+ <i class="wrong password2"></i></div>\
 <a href="#" class="btn btn-small btn-info text-userInfo">确定</a>\
 </div>';