wyq преди 3 години
родител
ревизия
3e83914251
променени са 3 файла, в които са добавени 29 реда и са изтрити 7 реда
  1. 2 0
      src/html/login.html
  2. 22 6
      src/js/login.js
  3. 5 1
      src/js/utils.js

+ 2 - 0
src/html/login.html

@@ -8,7 +8,9 @@
   <title>登录页</title>
 </head>
 <body>
+  <div id="mainBox"></div>
   <div class="login clearfix">
+    
     <!--<div class="logoTop">
       <img src="../images/lantone.png" alt="">
       <span></span>

+ 22 - 6
src/js/login.js

@@ -5,10 +5,11 @@ require("./modal.js")
 
 const { api } = require('./api.js')
 
-const { post, setCookie, delCookie, getUrlArgObject } = require('../js/utils.js');
+const { post, setCookie, delCookie, getUrlArgObject, toast } = require('../js/utils.js');
 const md5 = require('js-md5');
 const hideLogo = getUrlArgObject("hideLg");
 const otherLogo = getUrlArgObject("adLg");
+let type
 $(function () {
   getHospitalMark()
   if (hideLogo || otherLogo) {
@@ -23,11 +24,13 @@ $(function () {
   
   
 });
+
 function getHospitalMark() {
   post(api.getHospitalMark).then((res) => {
     const data = res.data;
     if (data.code == 0) {
-      if (data.data == 0) {
+      type = data.data
+      if (data.data == 1) {
         str = '<div class="bg2"></div>'
         str += '<div class="login-info">'
         str += '<div class="info-perPub">'
@@ -85,11 +88,19 @@ function sureLogin() {
   localStorage.removeItem('accessToken')
   let username = $("#username").val().trim();
   let password = $("#password").val().trim();
-  if (!username) {
-    $(".login .waring").css('visibility', 'visible').html('请输入用户名')
+  if (!username) { 
+    if(type == 1){
+      toast("请输入用户名!");
+    }else{
+      $(".login .waring").css('visibility', 'visible').html('请输入用户名')
+    }
     return
   } else if (!password) {
-    $(".login .waring").css('visibility', 'visible').html('请输入密码')
+    if (type == 1) {
+      toast("请输入密码!");
+    } else {
+      $(".login .waring").css('visibility', 'visible').html('请输入密码')
+    }
     return
   }
   $.alerModal({ type: "loading" });
@@ -114,7 +125,12 @@ function sureLogin() {
       }, 600);
     } else {
       $(".divModal").remove()
-      $(".login .waring").css('visibility', 'visible').html(data.msg)
+      if (type == 1) {
+        toast(data.msg);
+      } else {
+        $(".login .waring").css('visibility', 'visible').html(data.msg)
+      }
+      
     }
   }).catch(() => {
     $(".divModal").remove()

+ 5 - 1
src/js/utils.js

@@ -560,6 +560,9 @@ function getLogoParam() {
     const hideLogoPm = hideLogo ? '&hideLg=1' : '';
     return otherLogoPm+hideLogoPm;
 }
+function toast(msg) {
+  return $.alerModal({ "message": msg, type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
+}
 const explainTitle = {
   科室编码: 'deptId',
   科室: 'deptName',
@@ -612,5 +615,6 @@ module.exports = {
   listenScroll,
   explainTitle,
   getScoreTabList,
-  getLogoParam
+  getLogoParam,
+  toast
 };