Browse Source

Merge remote-tracking branch 'origin/securityCode1015' into test

zhouna 3 years ago
parent
commit
1590db28fe
1 changed files with 13 additions and 13 deletions
  1. 13 13
      src/js/login.js

+ 13 - 13
src/js/login.js

@@ -9,10 +9,10 @@ const { post, setCookie, delCookie, getUrlArgObject, toast } = require('../js/ut
 const md5 = require('js-md5');
 const hideLogo = getUrlArgObject("hideLg");
 const otherLogo = getUrlArgObject("adLg");
-let type
+let type;
+let is3His=false; //医院标记:湘雅三院1/通用0
 $(function () {
   getHospitalMark()
-  //getSecurityCode();
   if (hideLogo || otherLogo) {
     $(".copy-right").text("");
   }
@@ -56,7 +56,8 @@ function getHospitalMark() {
   const data = res.data;//{ code: 0, data: 0 }
   if (data.code == 0) {
     type = parseInt(data.data)
-    if (parseInt(data.data) == 1) {   //湘雅三院登录样式
+    is3His=type===1;
+    if (is3His) {   //湘雅三院登录样式
       str = '<div class="bg2">'
       str += '<div class="login-info">'
       str += '<div class="info-perPub">'
@@ -93,8 +94,8 @@ function getHospitalMark() {
       str += '</div></div>'
       str += '<p class="waring"></p><div class="sureLogin">登录</div></div><div class="copy-right">由杭州朗通信息技术有限公司提供技术支持</div></div>',
         $('.login').html(str)
+        getSecurityCode();
     }
-    getSecurityCode();
     $(".sureLogin").click(() => {
       sureLogin()
     })
@@ -130,27 +131,24 @@ function sureLogin() {
   $(".login .waring").html('')
   let username = $("#username").val().trim();
   let password = $("#password").val().trim();
-  const captcha = $("#code").val().trim();
+  let captcha = !is3His?$("#code").val().trim():undefined;
   if (!username) {
-    if (type == 1) {
+    if (is3His) {
       toast("请输入用户名!");
     } else {
       $(".login .waring").css('visibility', 'visible').html('请输入用户名')
     }
     return
   } else if (!password) {
-    if (type == 1) {
+    if (is3His) {
       toast("请输入密码!");
     } else {
       $(".login .waring").css('visibility', 'visible').html('请输入密码')
     }
     return
-  } else if (!captcha) {
-    if (type == 1) {
-      toast("请输入验证码!");
-    } else {
+  }
+  if (!is3His&&!captcha) {    //三院不用验证码
       $(".login .waring").css('visibility', 'visible').html('请输入验证码')
-    }
     return
   }
   $.alerModal({ type: "loading" });
@@ -175,7 +173,9 @@ function sureLogin() {
         window.location.href = 'index.html' + hideLgPm + otherLogoPm;
       }, 600);
     } else {
-        getSecurityCode();//登录失败切换验证码
+        if(!is3His){
+          getSecurityCode();
+        }//登录失败切换验证码
       $(".divModal").remove()
       if (type == 1) {
         toast(data.msg);