Selaa lähdekoodia

修改密码bug修改

zhouna 4 vuotta sitten
vanhempi
commit
92a8fa4d92
3 muutettua tiedostoa jossa 40 lisäystä ja 17 poistoa
  1. 7 1
      src/css/index.less
  2. 32 15
      src/js/index.js
  3. 1 1
      src/js/qcScore.js

+ 7 - 1
src/css/index.less

@@ -1148,11 +1148,17 @@
   }
   p {position: relative;}
   p span {
-    width: 90px;
+    width: 94px;
     display: inline-block;
     text-align: right;
     color: #777;
   }
+  .label{
+    i{
+      margin-right: 3px;
+      color:#EE3232 ;
+    }
+  }
   & img{
     margin-right: 5px;
   }

+ 32 - 15
src/js/index.js

@@ -16,9 +16,9 @@ let passwordComplexity = getCookie('passwordComplexity')
 const modalDom = `
       <p class="tips"><img src=${WarningIcon} /><span>为确保账号安全,请及时修改初始密码</span></p>
       <div class="modalAction">
-        <p><span>原密码:</span><input type="text" placeholder="请输入原密码" class="oldword" id="oldWord" autocomplete="off"><img class="eye" src=${closeEye} /><p class="oldWaring warning"><img src=${warnIcon} /><b>请及时修改初始密码</b></p></p>
-        <p><span>新密码:</span><input type="text" disabled placeholder="请输入新密码" class="newword" id="newWord" autocomplete="off"><img class="eye" src=${closeEye} /><p class="newword warning"><img src=${warnIcon} /><b>请及时修改初始密码</b></p></p>
-        <p><span>确认新密码:</span><input type="text" disabled placeholder="请输入确认新密码" class="sureword" id="sureWord" autocomplete="off"><img class="eye" src=${closeEye} /><p class="sureword warning"><img src=${warnIcon} /><b>请及时修改初始密码</b></p></p>
+        <p><span class="label"><i>*</i>原密码:</span><input type="password" placeholder="请输入原密码" class="oldword" id="oldWord" autocomplete="off"><img class="eye" src=${closeEye} /><p class="oldWaring warning"><img src=${warnIcon} /><b>原密码错误</b></p></p>
+        <p><span class="label"><i>*</i>新密码:</span><input type="password" disabled placeholder="请输入新密码" class="newword" id="newWord" autocomplete="off"><img class="eye" src=${closeEye} /><p class="newword warning"><img src=${warnIcon} /><b>密码最多12位</b></p></p>
+        <p><span class="label"><i>*</i>确认新密码:</span><input type="password" disabled placeholder="请输入确认新密码" class="sureword" id="sureWord" autocomplete="off"><img class="eye" src=${closeEye} /><p class="sureword warning"><img src=${warnIcon} /><b>两次密码输入不一致</b></p></p>
       </div>
     `;
 const psdChecker = `<div class="psd-checkbox">
@@ -40,7 +40,7 @@ $(function () {
           quiteBtn: true,
           title: "修改密码",
           type: "modal",
-          width: '450',
+          width: '470',
           time: '1000',
           sureText: '保存',
           message: modalDom});
@@ -55,9 +55,6 @@ $(function () {
       height:$(window).height()-52+'px'
     })
   })
-  $("body").on('focus',".modalAction input",function(){
-    $(this).attr("type","password")
-  })
   $(window).click(function(e){
     $(".userAction").css("display","none")
   })
@@ -84,7 +81,7 @@ $(function () {
       $('.subtitle').html('AI病案质控平台')
       setCookie("isPlacefile",1)
     }
-    $('#contentIframe').attr('src', $('#contentIframe').attr('src'));console.log('$(function')
+    $('#contentIframe').attr('src', $('#contentIframe').attr('src'));
     getMenu();
   })
   $(".header .title .qiehuan").mouseenter(function(){
@@ -116,14 +113,27 @@ function bindModalEvent(){
   })
   $("#oldWord").off("input").on("input",function(){
     const text = $(this).val();
+    if($(".oldWaring.warning:visible").length){//有修改则隐藏报错
+        $(".oldWaring.warning").hide();
+        if(!$(".waring:visible").length){   //无报错则激活保存按钮
+            $(".alertModal .sureChange").addClass("active");
+        }
+    }
+      if(text.trim()===$("#newWord").val().trim()){
+          $(".newword b").text("原密码和新密码不能相同");
+          $(".newword").show();
+          return false
+      }else{
+          $(".newword.warning").hide();
+      }
       if(text.trim()){
           $("#newWord").attr("disabled",false);
       }
   })
   $("#newWord").off("input").on("input",function(){
       const text = $(this).val();
+      const checker = $(".alertModal .psd-checkbox");
       if(text.trim()){    //显示密码验证标签
-        const checker = $(".alertModal .psd-checkbox");
         if(checker.length){
             checker.show()
         }else{
@@ -133,18 +143,22 @@ function bindModalEvent(){
         let psdsOk=false;
         if(psdOk){
             $("#sureWord").attr("disabled",false);
-            psdsOk = verifyPsdPart($("#oldWord").val(),$("#newWord").val(),$("#sureWord").val());
         }
+        psdsOk = verifyPsdPart();
         if(psdsOk){
             //保存按钮启用
-            $(".sureChange .sureChange").addClass("active");
+            $(".alertModal .sureChange").addClass("active");
+        }else{
+            $(".alertModal .sureChange").removeClass("active");
         }
+      }else{
+          checker.hide()
       }
   })
     $("#sureWord").off("input").on("input",function(){
         const text = $(this).val();
-        if(text.trim()){    //显示密码验证标签
-            let psdsOk=verifyPsdPart($("#oldWord").val(),$("#newWord").val(),$("#sureWord").val());
+        if(text.trim()){
+            let psdsOk=verifyPsdPart();
             if(psdsOk){
                 //保存按钮启用
                 $(".alertModal .sureChange").addClass("active");
@@ -194,7 +208,10 @@ function verifyPsd(text){console.log(text)
   return false;
 }
 
-function verifyPsdPart(oldP,newP,confirmP){   //验证各密码关系规则
+function verifyPsdPart(){   //验证各密码关系规则
+  const oldP = $("#oldWord").val();
+  const newP = $("#newWord").val();
+  const confirmP = $("#sureWord").val()
   if(oldP.trim()===newP.trim()){
     $(".newword b").text("原密码和新密码不能相同");
       $(".newword").show();
@@ -205,7 +222,7 @@ function verifyPsdPart(oldP,newP,confirmP){   //验证各密码关系规则
       $(".sureword").show();
       return false
   }
-  $(".warning").hide();
+  $(".newword.warning,.sureword.warning").hide();
   return true;
 }
 

+ 1 - 1
src/js/qcScore.js

@@ -209,7 +209,7 @@ function changePay(){
 }
 //填充患者信息
 function initPatientInfo(data){
-  const obj=Object.assign({},data,{age:!global_age||global_age=="null"?"-":global_age,showCheckBtns,checkState:global_check,checkStateHome:global_check_home});
+  const obj=Object.assign({},data,{showCheckBtns,checkState:global_check,checkStateHome:global_check_home});
   
   $("#infoTmpl").tmpl(obj).appendTo("#patientInfo");
   /*$(".check").on("click", function(){