signature.plugs.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. (function (root , kinggrid , Signature , $) {
  2. 'use strict';
  3. var isIE8 = false;
  4. if(root['JSON']){
  5. isIE8 = '{"x":"中"}' !== root['JSON'].stringify({x:'中'});
  6. }
  7. var Utils = kinggrid.Utils;
  8. var options = Signature.options;
  9. Utils.extend(Signature.options.template,{
  10. modifyPwdBtl:'<div id="kg-dialog-modify" class="kg-dialog kg-dialog-password ">'+
  11. '<div class="kg-form">'+
  12. '<div class="form-item clearfix">'+
  13. '<label class="kg-sm kg-sm-3 kg-label"><%this.keysn?"密钥序列号":"用户编号"%>:</label>'+
  14. '<div class="kg-sm kg-sm-7">'+
  15. '<p class="kg-form-static"> <%this.keysn||this.usercode%></p>'+
  16. '</div>'+
  17. '</div>'+
  18. '<div class="form-item clearfix" style="padding-bottom:7px" >'+
  19. '<label class="kg-sm kg-sm-3 kg-label">密码:</label>'+
  20. '<div class="kg-sm kg-sm-7">'+
  21. ' <input type="password" name="oldPwd" id="oldPwd" class="form-control">'+
  22. '</div>'+
  23. '</div>'+
  24. '<div class="form-item clearfix" style="padding-bottom:7px" >'+
  25. '<label class="kg-sm kg-sm-3 kg-label">新密码:</label>'+
  26. '<div class="kg-sm kg-sm-7">'+
  27. ' <input type="password" name="newPwd" id="newPwd" class="form-control">'+
  28. '</div>'+
  29. '</div>'+
  30. '<div class="form-item clearfix" style="padding-bottom:7px" >'+
  31. '<label class="kg-sm kg-sm-3 kg-label">重新输入:</label>'+
  32. '<div class="kg-sm kg-sm-7">'+
  33. ' <input type="password" name="rNewPwd" id="rNewPwd" class="form-control">'+
  34. '</div>'+
  35. ' </div>'+
  36. '</div>'+
  37. '</div>'
  38. });
  39. var plus = kingPlus();
  40. var template = template;
  41. Utils.extend(Signature.prototype , {
  42. modifyPwdUrl:'/key/modifyPwd',
  43. modifyPwd:function(params){
  44. var that = this;
  45. var config = {
  46. titile:'修改密码',
  47. target:{keysn:that.keysn,usercode:that.usercode},
  48. onOk:function(){
  49. var d = this;
  50. var oldPwd = d.find('#oldPwd').val();
  51. var newPwd = d.find('#newPwd').val()||'';
  52. var rNewPwd = d.find('#rNewPwd').val()||'';
  53. if(newPwd.length<6){
  54. plus.alert("新密码不能少于6位!");
  55. return false ;
  56. }
  57. if(newPwd!=rNewPwd){
  58. plus.alert("两次输入的新密码不一致!");
  59. return false;
  60. }
  61. var psparam = {
  62. keysn:that.keysn,
  63. oldPwd:oldPwd,
  64. newPwd:newPwd,
  65. usercode:that.usercode
  66. }
  67. var successCall = params.successCall , errorCall = params.errorCall;
  68. var assist = kinggrid.surry(that.serverUrl);
  69. assist.request(that.modifyPwdUrl ,psparam)
  70. .ret(function(data){
  71. if(data.result==true){
  72. d.close();
  73. plus.alert("密码修改成功!");
  74. }else{
  75. plus.alert(data.errmsg);
  76. }
  77. successCall.call(that , data);
  78. }).fail(function(cont , err){
  79. plus.alert(err);
  80. errorCall.call(that , err);
  81. });
  82. return false ;
  83. },
  84. onCancel:function(){return ;}
  85. }
  86. return that.showDialog('modifyPwdBtl',config);
  87. }
  88. });
  89. })(this , kinggrid ,Signature, jQuery);