ソースを参照

修改密码bug

zhouna 4 年 前
コミット
b65cef58ab
3 ファイル変更37 行追加16 行削除
  1. 7 1
      src/css/index.less
  2. 29 14
      src/js/index.js
  3. 1 1
      src/js/qcScore.js

+ 7 - 1
src/css/index.less

@@ -1118,11 +1118,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;
   }

+ 29 - 14
src/js/index.js

@@ -15,9 +15,9 @@ let passwordComplexity = getCookie('passwordComplexity')
 const modalDom = `
       <p class="tips"><img src=${WarningIcon} /><span>为确保账号安全,请及时修改初始密码</span></p>
       <div class="modalAction">
-        <p><span>原密码:</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>新密码:</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>确认新密码:</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>
+        <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});
@@ -61,11 +61,11 @@ $(function () {
     $(this).css("color", "#777777")
   })
   if (isPlacefile == 0) {
-    $(this).find('i').html('切换病案质控')
+    $('.qiehuan i').html('切换病案质控')
     $('.subtitle').html('AI运行质控平台')
     getMenu()
   } else if (isPlacefile == 1) {
-    $(this).find('i').html('切换运行质控')
+      $('.qiehuan i').html('切换运行质控')
     $('.subtitle').html('AI病案质控平台')
     getMenu()
   }
@@ -112,14 +112,21 @@ 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").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{
@@ -129,18 +136,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");
@@ -190,7 +201,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();
@@ -201,7 +215,7 @@ function verifyPsdPart(oldP,newP,confirmP){   //验证各密码关系规则
       $(".sureword").show();
       return false
   }
-  $(".warning").hide();
+  $(".newword.warning,.sureword.warning").hide();
   return true;
 }
 
@@ -398,6 +412,7 @@ function changeWord(oldword, newword) {
     } else {
       $(".oldWaring b").text(data.msg);
       $(".oldWaring").show();
+      $(".alertModal .sureChange").removeClass("active");
       return
     }
   });
@@ -418,7 +433,7 @@ $("#changeWord").click(function (e) {
     quiteBtn: true,
     title: "修改密码",
     type: "modal",
-    width: '450',
+    width: '470',
     time: '1000',
     sureText: '保存',
     message: modalDom});

+ 1 - 1
src/js/qcScore.js

@@ -202,7 +202,7 @@ function initPatientInfo(data){
   if(hasData("FUNC000014")){
     hasCheck = true
   }
-  const obj=Object.assign({},data,{age:!global_age||global_age=="null"?"-":global_age,hasCheck,checkState:global_check,checkStateHome:global_check_home});
+  const obj=Object.assign({},data,{hasCheck,checkState:global_check,checkStateHome:global_check_home});
   
   $("#infoTmpl").tmpl(obj).appendTo("#patientInfo");
   $(".check").on("click", function(){