Commit 5f22f886af27011d85cc8b90ec503961e8c124d7
Merge branch 'jiading' of http://192.168.168.201:8888/panzhaov5/bsth_control.git into jiading
Showing
3 changed files
with
31 additions
and
6 deletions
src/main/resources/static/assets/plugins/passwordRulesHelper/passwordRulesHelper.js
| 1 | 1 | (function ($) { |
| 2 | 2 | |
| 3 | - $.fn.passwordRulesValidator = function (aOptions) { | |
| 3 | + $.fn.passwordRulesValidator = function (aOptions, callbackFn) { | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | // Define default's parameters |
| ... | ... | @@ -47,6 +47,22 @@ |
| 47 | 47 | 'onLoad': undefined |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | + var _ruleErrorMap = { | |
| 51 | + }; | |
| 52 | + function _callbackFn() { | |
| 53 | + var isOk = false; | |
| 54 | + $.each(_ruleErrorMap, function(k, v) { | |
| 55 | + if (v) { | |
| 56 | + isOk = true; | |
| 57 | + } else { | |
| 58 | + isOk = false; | |
| 59 | + return false; | |
| 60 | + } | |
| 61 | + }); | |
| 62 | + // console.log(_ruleErrorMap); | |
| 63 | + callbackFn(isOk); | |
| 64 | + } | |
| 65 | + | |
| 50 | 66 | /** |
| 51 | 67 | * @param {object} oRegex |
| 52 | 68 | * @param {string} sVal |
| ... | ... | @@ -57,8 +73,10 @@ |
| 57 | 73 | { |
| 58 | 74 | if (oRegex.test(sVal)) { |
| 59 | 75 | $('#' + sIdContainer + ' li.' + sName).removeClass('ko ' + aParameters.koClass).addClass('ok ' + aParameters.okClass); |
| 76 | + _ruleErrorMap[sName] = true; | |
| 60 | 77 | } else { |
| 61 | 78 | $('#' + sIdContainer + ' li.' + sName).removeClass('ok ' +aParameters.okClass).addClass('ko ' +aParameters.koClass); |
| 79 | + _ruleErrorMap[sName] = false; | |
| 62 | 80 | } |
| 63 | 81 | } |
| 64 | 82 | |
| ... | ... | @@ -112,18 +130,22 @@ |
| 112 | 130 | |
| 113 | 131 | // Execute checkRules on load |
| 114 | 132 | checkRules(aParameters, $(this).val(), sIdContainer); |
| 133 | + _callbackFn(); | |
| 115 | 134 | |
| 116 | 135 | // Execute checkRules fonction |
| 117 | 136 | $(this).keyup(function () { |
| 118 | 137 | checkRules(aParameters, $(this).val(), sIdContainer); |
| 138 | + _callbackFn(); | |
| 119 | 139 | }); |
| 120 | 140 | |
| 121 | 141 | $(this).on('paste', function () { |
| 122 | 142 | checkRules(aParameters, $(this).val(), sIdContainer); |
| 143 | + _callbackFn(); | |
| 123 | 144 | }); |
| 124 | 145 | |
| 125 | 146 | $(this).change(function () { |
| 126 | 147 | checkRules(aParameters, $(this).val(), sIdContainer); |
| 148 | + _callbackFn(); | |
| 127 | 149 | }); |
| 128 | 150 | }); |
| 129 | 151 | }; | ... | ... |
src/main/resources/static/index.html
| ... | ... | @@ -419,7 +419,7 @@ |
| 419 | 419 | <!-- tipso JS --> |
| 420 | 420 | <script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> |
| 421 | 421 | <!-- passwordRulesHelper插件 --> |
| 422 | -<script src="/assets/plugins/passwordRulesHelper/passwordRulesHelper.min.js"></script> | |
| 422 | +<script src="/assets/plugins/passwordRulesHelper/passwordRulesHelper.js" data-exclude=1></script> | |
| 423 | 423 | |
| 424 | 424 | <script data-exclude=1> |
| 425 | 425 | //初始打开的片段地址 | ... | ... |
src/main/resources/static/pages/permission/user/changePWD.html
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <div class="portlet light portlet-fit portlet-form bordered"> |
| 5 | 5 | <div class="portlet-body"> |
| 6 | 6 | <form class="form-horizontal" id="changePWDForm"> |
| 7 | - <div class="form-group" style="margin-top: 60px"> | |
| 7 | + <div class="form-group" style="margin-top: 10px; margin-bottom: 0px;"> | |
| 8 | 8 | <label class="control-label col-md-4">原始密码: |
| 9 | 9 | </label> |
| 10 | 10 | <div class="col-md-6"> |
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | <input type="password" class="form-control" name="oldPWD" /> </div> |
| 14 | 14 | </div> |
| 15 | 15 | </div> |
| 16 | - <div class="form-group"> | |
| 16 | + <div class="form-group" style="margin-top: 10px; margin-bottom: 0px;"> | |
| 17 | 17 | <label class="control-label col-md-4">输入新密码: |
| 18 | 18 | </label> |
| 19 | 19 | <div class="col-md-6"> |
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | <input type="password" class="form-control" name="newPWD" id="newPWD" /> </div> |
| 23 | 23 | </div> |
| 24 | 24 | </div> |
| 25 | - <div class="form-group"> | |
| 25 | + <div class="form-group" style="margin-bottom: 5px;"> | |
| 26 | 26 | <label class="control-label col-md-4">确认新密码: |
| 27 | 27 | </label> |
| 28 | 28 | <div class="col-md-6"> |
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | <input type="password" class="form-control" name="cnewPWD" /> </div> |
| 32 | 32 | </div> |
| 33 | 33 | </div> |
| 34 | - <div class="form-actions"> | |
| 34 | + <div class="form-actions" style="padding: 5px;"> | |
| 35 | 35 | <div class="row"> |
| 36 | 36 | <div class="col-md-offset-5 col-md-7"> |
| 37 | 37 | <button type="button" id="confirm" class="btn green">确定</button> |
| ... | ... | @@ -82,6 +82,9 @@ $(function(){ |
| 82 | 82 | 'enable': true |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | + }, function(flag) { | |
| 86 | + // console.log(flag); | |
| 87 | + $("#confirm").attr("disabled", !flag); | |
| 85 | 88 | }); |
| 86 | 89 | |
| 87 | 90 | ... | ... |