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 | (function ($) { | 1 | (function ($) { |
| 2 | 2 | ||
| 3 | - $.fn.passwordRulesValidator = function (aOptions) { | 3 | + $.fn.passwordRulesValidator = function (aOptions, callbackFn) { |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | // Define default's parameters | 6 | // Define default's parameters |
| @@ -47,6 +47,22 @@ | @@ -47,6 +47,22 @@ | ||
| 47 | 'onLoad': undefined | 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 | * @param {object} oRegex | 67 | * @param {object} oRegex |
| 52 | * @param {string} sVal | 68 | * @param {string} sVal |
| @@ -57,8 +73,10 @@ | @@ -57,8 +73,10 @@ | ||
| 57 | { | 73 | { |
| 58 | if (oRegex.test(sVal)) { | 74 | if (oRegex.test(sVal)) { |
| 59 | $('#' + sIdContainer + ' li.' + sName).removeClass('ko ' + aParameters.koClass).addClass('ok ' + aParameters.okClass); | 75 | $('#' + sIdContainer + ' li.' + sName).removeClass('ko ' + aParameters.koClass).addClass('ok ' + aParameters.okClass); |
| 76 | + _ruleErrorMap[sName] = true; | ||
| 60 | } else { | 77 | } else { |
| 61 | $('#' + sIdContainer + ' li.' + sName).removeClass('ok ' +aParameters.okClass).addClass('ko ' +aParameters.koClass); | 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,18 +130,22 @@ | ||
| 112 | 130 | ||
| 113 | // Execute checkRules on load | 131 | // Execute checkRules on load |
| 114 | checkRules(aParameters, $(this).val(), sIdContainer); | 132 | checkRules(aParameters, $(this).val(), sIdContainer); |
| 133 | + _callbackFn(); | ||
| 115 | 134 | ||
| 116 | // Execute checkRules fonction | 135 | // Execute checkRules fonction |
| 117 | $(this).keyup(function () { | 136 | $(this).keyup(function () { |
| 118 | checkRules(aParameters, $(this).val(), sIdContainer); | 137 | checkRules(aParameters, $(this).val(), sIdContainer); |
| 138 | + _callbackFn(); | ||
| 119 | }); | 139 | }); |
| 120 | 140 | ||
| 121 | $(this).on('paste', function () { | 141 | $(this).on('paste', function () { |
| 122 | checkRules(aParameters, $(this).val(), sIdContainer); | 142 | checkRules(aParameters, $(this).val(), sIdContainer); |
| 143 | + _callbackFn(); | ||
| 123 | }); | 144 | }); |
| 124 | 145 | ||
| 125 | $(this).change(function () { | 146 | $(this).change(function () { |
| 126 | checkRules(aParameters, $(this).val(), sIdContainer); | 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,7 +419,7 @@ | ||
| 419 | <!-- tipso JS --> | 419 | <!-- tipso JS --> |
| 420 | <script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> | 420 | <script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> |
| 421 | <!-- passwordRulesHelper插件 --> | 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 | <script data-exclude=1> | 424 | <script data-exclude=1> |
| 425 | //初始打开的片段地址 | 425 | //初始打开的片段地址 |
src/main/resources/static/pages/permission/user/changePWD.html
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | <div class="portlet light portlet-fit portlet-form bordered"> | 4 | <div class="portlet light portlet-fit portlet-form bordered"> |
| 5 | <div class="portlet-body"> | 5 | <div class="portlet-body"> |
| 6 | <form class="form-horizontal" id="changePWDForm"> | 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 | <label class="control-label col-md-4">原始密码: | 8 | <label class="control-label col-md-4">原始密码: |
| 9 | </label> | 9 | </label> |
| 10 | <div class="col-md-6"> | 10 | <div class="col-md-6"> |
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | <input type="password" class="form-control" name="oldPWD" /> </div> | 13 | <input type="password" class="form-control" name="oldPWD" /> </div> |
| 14 | </div> | 14 | </div> |
| 15 | </div> | 15 | </div> |
| 16 | - <div class="form-group"> | 16 | + <div class="form-group" style="margin-top: 10px; margin-bottom: 0px;"> |
| 17 | <label class="control-label col-md-4">输入新密码: | 17 | <label class="control-label col-md-4">输入新密码: |
| 18 | </label> | 18 | </label> |
| 19 | <div class="col-md-6"> | 19 | <div class="col-md-6"> |
| @@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
| 22 | <input type="password" class="form-control" name="newPWD" id="newPWD" /> </div> | 22 | <input type="password" class="form-control" name="newPWD" id="newPWD" /> </div> |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | - <div class="form-group"> | 25 | + <div class="form-group" style="margin-bottom: 5px;"> |
| 26 | <label class="control-label col-md-4">确认新密码: | 26 | <label class="control-label col-md-4">确认新密码: |
| 27 | </label> | 27 | </label> |
| 28 | <div class="col-md-6"> | 28 | <div class="col-md-6"> |
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | <input type="password" class="form-control" name="cnewPWD" /> </div> | 31 | <input type="password" class="form-control" name="cnewPWD" /> </div> |
| 32 | </div> | 32 | </div> |
| 33 | </div> | 33 | </div> |
| 34 | - <div class="form-actions"> | 34 | + <div class="form-actions" style="padding: 5px;"> |
| 35 | <div class="row"> | 35 | <div class="row"> |
| 36 | <div class="col-md-offset-5 col-md-7"> | 36 | <div class="col-md-offset-5 col-md-7"> |
| 37 | <button type="button" id="confirm" class="btn green">确定</button> | 37 | <button type="button" id="confirm" class="btn green">确定</button> |
| @@ -82,6 +82,9 @@ $(function(){ | @@ -82,6 +82,9 @@ $(function(){ | ||
| 82 | 'enable': true | 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 |