|
@@ -12,8 +12,9 @@ function ChangeName(option) {
|
|
|
this.userName = option.markControl.container.header.find('#mark-user-name');
|
|
|
|
|
|
this.popover = getDom(this.popover_dom, this.markControl);
|
|
|
- this.popover.input = this.popover.find('input.user-input');
|
|
|
- this.popover.message = this.popover.find('i.wrong');
|
|
|
+ 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);
|
|
@@ -27,23 +28,27 @@ function ChangeName(option) {
|
|
|
self.toggle(false);
|
|
|
});
|
|
|
this.popover.submitButton.click(function() {
|
|
|
- var text = self.popover.input.val();
|
|
|
- if (text.length == 0) {
|
|
|
- self.popover.message.html('姓名不能为空');
|
|
|
- } else if (text.length > 8) {
|
|
|
- self.popover.message.html('长度不能超过8个字');
|
|
|
+ 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: text
|
|
|
+ name: nameText,
|
|
|
+ password:pwText
|
|
|
}, function(result) {
|
|
|
if (result.success == true) {
|
|
|
self.userName.html(result.name);
|
|
|
self.toggle(false);
|
|
|
} else {
|
|
|
- self.popover.message.html('姓名修改失败,请稍后重试');
|
|
|
+ self.popover.userNameMessage.html('修改失败,请稍后重试');
|
|
|
}
|
|
|
}).error(function() {
|
|
|
- self.popover.message.html('网络通信错误,请稍后重试');
|
|
|
+ self.popover.userNameMessage.html('网络通信错误,请稍后重试');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -52,8 +57,9 @@ function ChangeName(option) {
|
|
|
ChangeName.prototype.toggle = function(enable) {
|
|
|
if (enable == true) {
|
|
|
this.enable = true;
|
|
|
- this.popover.input.val('');
|
|
|
- this.popover.message.html('');
|
|
|
+ this.popover.userNameInput.val('');
|
|
|
+ this.popover.passWordInput.val('');
|
|
|
+ this.popover.userNameMessage.html('');
|
|
|
this.popover.show();
|
|
|
this.context.listenKeyboard = false;
|
|
|
} else {
|
|
@@ -64,8 +70,10 @@ 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"><input type="text" class="user-input" placeholder="请输入您的姓名" />\
|
|
|
-<i class="wrong"></i></div>\
|
|
|
-<a href="#" class="btn btn-large btn-info text-c">确定</a>\
|
|
|
+<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>\
|
|
|
+<a href="#" class="btn btn-small btn-info text-userInfo">确定</a>\
|
|
|
</div>';
|