Przeglądaj źródła

初始化弹窗判断

wyq 4 lat temu
rodzic
commit
995f92588c
6 zmienionych plików z 225 dodań i 139 usunięć
  1. 57 3
      src/css/index.less
  2. 1 1
      src/html/index.html
  3. BIN
      src/images/icon-Warning.png
  4. 165 134
      src/js/index.js
  5. 1 0
      src/js/login.js
  6. 1 1
      src/js/utils.js

+ 57 - 3
src/css/index.less

@@ -3,6 +3,26 @@
 .container{
   height: 100%;
 }
+
+.tips{
+  width: 420px;
+  height: 24px;
+  position: relative;
+  background: #EDEEEF;
+  top: -27px;
+  text-align: left;
+  & img{
+    margin-left: 16px;
+    margin-right: 4px;
+  }
+  & span{
+    font-size: 12px;
+    font-weight: 400;
+    color: #999999;
+    line-height: 24px;
+    text-align: left;
+  }
+}
 .header{
   /*position: fixed;*/
   width: 100%;
@@ -414,6 +434,7 @@
   }
   //修改密码
   .modalAction {
+    position: relative;
     // padding: 20px;
     input {
       border: 1px solid #E2E5EF;
@@ -436,12 +457,45 @@
       color: #FF4D4F;
       display: inline-block;
       position: absolute;
-      left: 105px;
-      bottom: 6px;
+      top: 37px;
+      left: 107px;
+      text-align: left;
+      & img{
+        margin-right: 5px;
+      }
+      & b{
+        font-weight: 400;
+      }
+    }
+    .newword {
+      color: #FF4D4F;
+      display: inline-block;
+      top: -26px;
+      left: -36px;
+      text-align: left;
+      & img{
+        margin-right: 5px;
+      }
+      & b{
+        font-weight: 400;
+      }
+    }
+    .sureword{
+      color: #FF4D4F;
+      display: inline-block;
+      top: -26px;
+      left: -36px;
+      text-align: left;
+      & img{
+        margin-right: 5px;
+      }
+      & b{
+        font-weight: 400;
+      }
     }
     .waring {
       text-align: left;
-      i {
+      s {
         margin-left: 15px;
         color: #FF4D4F;
         position: relative;

+ 1 - 1
src/html/index.html

@@ -101,7 +101,7 @@
                   <div class="login fr">
                       <a class="setting" id="userName" href="javascript:void(0);">***</a>
                       <ul class="userAction">
-                          <li id="changeWord">修改密码</li>
+                          <li id="changeWord" onclick="audit()">修改密码</li>
                           <li><a class="login-out" href="./login.html">退出</a></li>
                       </ul>
                   </div>

BIN
src/images/icon-Warning.png


+ 165 - 134
src/js/index.js

@@ -3,86 +3,126 @@ const $ = require('jquery');
 require('jquery-templates');
 const md5 = require('js-md5');
 require("./modal.js")
-
-const {api} = require('./api.js')
-const {post,pageMap,delCookie,setCookie,getCookie,focusMenuItem,initScroll} = require('./utils.js');
-let userInfo={};
-let isPlacefile = getCookie('isPlacefile')||1
-
-$(function(){
+const Warning = require("./../images/icon-Warning.png")
+const { api } = require('./api.js')
+const { post, pageMap, delCookie, setCookie, getCookie, focusMenuItem, initScroll } = require('./utils.js');
+let userInfo = {};
+let isPlacefile = getCookie('isPlacefile') || 1
+let passwordComplexity = getCookie('passwordComplexity')
+$(function () {
   getOwnDept();
   setInterval(() => {
-      getTimeDetail()
+    getTimeDetail()
   }, 1000);
   //菜单展开收起
   sureChangeWord()
+  if (passwordComplexity) {
+    $.alerModal({
+      quiteBtn: true,
+      title: "修改密码",
+      type: "modal",
+      width: '450',
+      time: '1000',
+      sureText: '保存',
+      message: `
+      <p class="tips"><img class="Warning" src=${Warning} /><span>为确保账号安全,请及时修改初始密码</span></p>
+      <div class="modalAction">
+        <p><span>原密码:</span><input type="text" placeholder="请输入原密码" class="oldword" autocomplete="off"><p class="oldWaring"><img class="Warning" src=${Warning} /><b>请及时修改初始密码</b></p></p>
+        <p><span>新密码:</span><input type="text" placeholder="请输入新密码" class="newword" autocomplete="off"><p class="newword"><img class="Warning" src=${Warning} /><b>请及时修改初始密码</b></p></p>
+        <p><span>确认新密码:</span><input type="text" placeholder="请输入新密码" class="sureword" autocomplete="off"><p class="sureword"><img class="Warning" src=${Warning} /><b>请及时修改初始密码</b></p></p>
+      </div>
+    `});
+    let oldword = $(".oldword").val().trim()
+    let newword = $(".newword").val().trim()
+    let sureword = $(".sureword").val().trim()
+    if (!oldword && !newword && !sureword) {
+      $(".sureChange").css({ "border": "#E4E3E3", "background": "#E4E3E3" })
+    }
+    $(".oldword").blur(function () {
+      if ($(".oldword").val() && $(".newword").val() && $(".sureword").val()) {
+        $(".sureChange").css({ "border": "#00A1FF", "background": "#00A1FF" })
+      }
+    });
+    $(".newword").blur(function () {
+      if ($(".oldword").val() && $(".newword").val() && $(".sureword").val()) {
+        $(".sureChange").css({ "border": "#00A1FF", "background": "#00A1FF" })
+      }
+    });
+    $(".sureword").blur(function () {
+      if ($(".oldword").val() && $(".newword").val() && $(".sureword").val()) {
+        $(".sureChange").css({ "border": "#00A1FF", "background": "#00A1FF" })
+      }
+    });
+  }
   $(".main").css({
-    height:$(window).height()-52+'px'
+    height: $(window).height() - 52 + 'px'
   })
-  $(window).resize(function(){
+  $(window).resize(function () {
     $(".main").css({
-      height:$(window).height()-52+'px'
+      height: $(window).height() - 52 + 'px'
     })
   })
-  $("body").on('focus',".modalAction input",function(){
-    $(this).attr("type","password")
+  $("body").on('focus', ".modalAction input", function () {
+    $(this).attr("type", "password")
   })
-  $(window).click(function(e){
-    $(".userAction").css("display","none")
+  $(window).click(function (e) {
+    $(".userAction").css("display", "none")
   })
-  $("#changeWord").css("opacity",hasData('FUNC000002')?'1':'0.5').hover(function(){
-    $(this).css("color","#777777")
+  $("#changeWord").css("opacity", hasData('FUNC000002') ? '1' : '0.5').hover(function () {
+    $(this).css("color", "#777777")
   })
-  if(isPlacefile==0){
+  if (isPlacefile == 0) {
     $(this).find('i').html('切换病案质控')
     $('.subtitle').html('AI运行质控平台')
     getMenu()
-  }else if(isPlacefile==1){
+  } else if (isPlacefile == 1) {
     $(this).find('i').html('切换运行质控')
     $('.subtitle').html('AI病案质控平台')
     getMenu()
   }
-  $(".header .title .qiehuan").click(function(){
+  $(".header .title .qiehuan").click(function () {
     let txt = $(this).find('i').html()
-    if(txt == '切换运行质控'){
+    if (txt == '切换运行质控') {
       $(this).find('i').html('切换病案质控')
       $('.subtitle').html('AI运行质控平台')
-      setCookie("isPlacefile",0)
-    }else{
+      setCookie("isPlacefile", 0)
+    } else {
       $(this).find('i').html('切换运行质控')
       $('.subtitle').html('AI病案质控平台')
-      setCookie("isPlacefile",1)
+      setCookie("isPlacefile", 1)
     }
     $('#contentIframe').attr('src', $('#contentIframe').attr('src'));
     getMenu();
   })
-  $(".header .title .qiehuan").mouseenter(function(){
-    $(this).parent().find('img').attr('src',require('../images/qiehuan1.png'))
+  $(".header .title .qiehuan").mouseenter(function () {
+    $(this).parent().find('img').attr('src', require('../images/qiehuan1.png'))
   })
-  $(".header .title .qiehuan").mouseleave(function(){
-    $(this).parent().find('img').attr('src',require('../images/qiehuan2.png'))
+  $(".header .title .qiehuan").mouseleave(function () {
+    $(this).parent().find('img').attr('src', require('../images/qiehuan2.png'))
   })
 });
+
+
 //判断有无某一权限
-function hasData(data,list){
-  if(list&&list.length>0){
-    if(list.indexOf(data)>-1){//有权限
+function hasData(data, list) {
+  if (list && list.length > 0) {
+    if (list.indexOf(data) > -1) {//有权限
       return true
     }
     return false;
   }
-  let lis = JSON.parse(getCookie("codeLis"))||[]
-  if(lis.indexOf(data)>-1){//有权限
-      return true
+  let lis = JSON.parse(getCookie("codeLis")) || []
+  if (lis.indexOf(data) > -1) {//有权限
+    return true
   }
   return false;
 }
-function userActionHide(e){
-  $(".userAction").css("display","none")
+function userActionHide(e) {
+  $(".userAction").css("display", "none")
 }
 window.userActionHide = userActionHide
 
-function initMenu(data,userInfo){
+function initMenu(data, userInfo) {
   //菜单数据填充
   $(".menu ul").html("");
   $(".menu-mini ul").html("");
@@ -93,16 +133,16 @@ function initMenu(data,userInfo){
   //初始菜单选中
   const firstM = $(".menu .page").eq(0);
   firstM.addClass("active");
-  if(firstM.is(".YH-KZT")||firstM.is(".YH-KZTKS")){
-  // if($(".menu .page").eq(0).is(".YH-KZT")){
+  if (firstM.is(".YH-KZT") || firstM.is(".YH-KZTKS")) {
+    // if($(".menu .page").eq(0).is(".YH-KZT")){
     $(".container").addClass("console-cont");
-    $('.qiehuan').css("display","inline-block")
-  }else{
-    $('.qiehuan').css("display","none")
+    $('.qiehuan').css("display", "inline-block")
+  } else {
+    $('.qiehuan').css("display", "none")
   }
   //菜单收起展开
-  $(".menu .list-1").on("click",function(){
-    if($(this).is(".list-1-show")){
+  $(".menu .list-1").on("click", function () {
+    if ($(this).is(".list-1-show")) {
       $(this).removeClass("list-1-show")
       $(this).find("ul").slideToggle();
       // setTimeout(function(){
@@ -113,8 +153,8 @@ function initMenu(data,userInfo){
 
     $(".menu .list-1-show ul").slideUp();
     $(".menu .list-1").removeClass("list-1-show");
-    const ulShow =  $(this).find("ul").css("display")
-    if(ulShow == "none"){
+    const ulShow = $(this).find("ul").css("display")
+    if (ulShow == "none") {
       $(this).addClass("list-1-show")
     }
     $(this).find("ul").slideToggle();
@@ -122,45 +162,45 @@ function initMenu(data,userInfo){
     //   initScroll("menuList","Y",2)
     // },300)
   });
-//收起菜单
-$(".slide-hide").off("click").click(function(){
-    $(".menu,.copy-right").animate({"width":"60px"},function(){
+  //收起菜单
+  $(".slide-hide").off("click").click(function () {
+    $(".menu,.copy-right").animate({ "width": "60px" }, function () {
       $(this).hide();
       $(".menu-mini").show();
     });
-    $(".main").animate({"margin-left":"60px"});
+    $(".main").animate({ "margin-left": "60px" });
   });
   //展开菜单
-  $(".slide-show").off("click").click(function(){
+  $(".slide-show").off("click").click(function () {
     $(".menu-mini").hide();
-    $(".menu,.copy-right").show().animate({"width":"205px"},function(){
+    $(".menu,.copy-right").show().animate({ "width": "205px" }, function () {
     });
-    $(".main").animate({"margin-left":"205px"});
+    $(".main").animate({ "margin-left": "205px" });
   });
 
-  $(".menu .list-1 li").on("click",function(e){
+  $(".menu .list-1 li").on("click", function (e) {
     e.stopPropagation();
   });
   //右侧页面切换
-  $(".page").on("click",function(){
+  $(".page").on("click", function () {
     $(".menu .active,.menu-mini .active").removeClass('active');
-    const code=$(this).attr("code");
-    if(code === 'YH-KZT'||code === 'YH-KZTKS'){
+    const code = $(this).attr("code");
+    if (code === 'YH-KZT' || code === 'YH-KZTKS') {
       // if(code === 'YH-KZT'){
       $(".container").addClass("console-cont");
-      $('.qiehuan').css("display","inline-block")
-    }else{
-      $('.qiehuan').css("display","none")
+      $('.qiehuan').css("display", "inline-block")
+    } else {
+      $('.qiehuan').css("display", "none")
       $(".container").removeClass("console-cont");
     }
-    const mItems = $(".menu .page[code="+code+"],.menu-mini .page[code="+code+"]");
+    const mItems = $(".menu .page[code=" + code + "],.menu-mini .page[code=" + code + "]");
     mItems.addClass("active");
     mItems.parents(".list-1").addClass("active");
-    let url = './'+pageMap[code];
-    if(code === 'YH-BLZK-ZKPFGR'){
+    let url = './' + pageMap[code];
+    if (code === 'YH-BLZK-ZKPFGR') {
       url += `?doctorName=${userInfo.linkman}`
     }
-    $("#contentIframe").attr("src",url);
+    $("#contentIframe").attr("src", url);
     setTimeout(() => {
       bindMenu()
     }, 500);
@@ -170,125 +210,116 @@ $(".slide-hide").off("click").click(function(){
 }
 
 //获取科室列表
-function getOwnDept(){
+function getOwnDept() {
   // if(hasData('FUNC000058')){
-      setCookie("deptList",JSON.stringify([]))
-      post(api.getDept,{}).then((res)=>{
-          let data = res.data;
-          if(data.code == 0){
-              let result = data.data
-              setCookie("deptList",JSON.stringify(result))
-          }
-        })
+  setCookie("deptList", JSON.stringify([]))
+  post(api.getDept, {}).then((res) => {
+    let data = res.data;
+    if (data.code == 0) {
+      let result = data.data
+      setCookie("deptList", JSON.stringify(result))
+    }
+  })
   // }
 }
-function getMenu(){
+function getMenu() {
   // console.log(api.getMenu)
-  isPlacefile = getCookie('isPlacefile')||1
-  post(api.getMenu).then(function(res){
-    if(res.data.code==='0'){
+  isPlacefile = getCookie('isPlacefile') || 1
+  post(api.getMenu).then(function (res) {
+    if (res.data.code === '0') {
       const data = res.data.data;
-      for(let i = 0;i<data.menuWrappers.length;i++){
+      for (let i = 0; i < data.menuWrappers.length; i++) {
         data.menuWrappers[i].isPlacefile = isPlacefile
       }
-      initMenu(data.menuWrappers,data.userLoginDTO);
+      initMenu(data.menuWrappers, data.userLoginDTO);
       userInfo = data.userLoginDTO
-      setCookie("hospital",data.basHospitalInfoDTO.name)
-      setCookie("hospitalid",data.basHospitalInfoDTO.id)
+      setCookie("hospital", data.basHospitalInfoDTO.name)
+      setCookie("hospitalid", data.basHospitalInfoDTO.id)
       getAllCode(data.menuWrappers);
     }
   })
 };
-function getAllCode(data){
-  let lis = [],personCodeLis=[],deptCodeLis=[],trdObj={}
-  for(let i = 0;i < data.length;i++){
+function getAllCode(data) {
+  let lis = [], personCodeLis = [], deptCodeLis = [], trdObj = {}
+  for (let i = 0; i < data.length; i++) {
     let tmpSon = data[i]
     lis.push(tmpSon.code)
-    if(tmpSon.subMenuList.length > 0){//三层
-      for(let j = 0;j<tmpSon.subMenuList.length;j++){//第二层循环
+    if (tmpSon.subMenuList.length > 0) {//三层
+      for (let j = 0; j < tmpSon.subMenuList.length; j++) {//第二层循环
         let tmpGrandSon = tmpSon.subMenuList[j]
-        let sonLis=[]
+        let sonLis = []
         lis.push(tmpGrandSon.code)
-        for(let m = 0;m < tmpGrandSon.sysUserPermissionDTOList.length;m++){
+        for (let m = 0; m < tmpGrandSon.sysUserPermissionDTOList.length; m++) {
           let tmpData = tmpGrandSon.sysUserPermissionDTOList[m]
           lis.push(tmpData.code)
           sonLis.push(tmpData.code)
         }
         trdObj[tmpGrandSon.code] = sonLis
       }
-    }else{//两层
-      for(let n = 0;n < tmpSon.sysUserPermissionDTOList.length;n++){
+    } else {//两层
+      for (let n = 0; n < tmpSon.sysUserPermissionDTOList.length; n++) {
         let tmpData = tmpSon.sysUserPermissionDTOList[n]
         lis.push(tmpData.code)
       }
     }
   }
   // $("#contentIframe").attr("src",hasData('YH-KZT')?'console.html':hasData('YH-KZTKS')?'deptConsole.html':'console.html');
-  if(hasData('YH-KZT',lis)){
+  if (hasData('YH-KZT', lis)) {
     focusMenuItem("YH-KZT");
-  }else if(hasData('YH-KZTKS',lis)){
+  } else if (hasData('YH-KZTKS', lis)) {
     focusMenuItem("YH-KZTKS");
   }
-  setCookie("codeLis",JSON.stringify(lis))
-  setCookie("trdObj",JSON.stringify(trdObj))
+  setCookie("codeLis", JSON.stringify(lis))
+  setCookie("trdObj", JSON.stringify(trdObj))
 }
-function sureChangeWord(){
-  $(document).on('click','.sureChange',function(){
+function sureChangeWord() {
+  $(document).on('click', '.sureChange', function () {
     let oldword = $(".oldword").val().trim()
     let newword = $(".newword").val().trim()
     let sureword = $(".sureword").val().trim()
-    if(!oldword){
-      $(".modalAction .waring i").html('请输入原密码')
-      return
-    }else if(!newword){
-      $(".modalAction .waring i").html('请输入新密码')
-      return
-    }else if(!sureword){
-      $(".modalAction .waring i").html('请确认新密码')
-      return
-    }else if(newword != sureword){
+    if (newword != sureword) {
       $(".modalAction .waring i").html('两次密码不一致')
       return
     }
     $(".modalAction .waring i").html('')
-    changeWord(oldword,newword)
+    changeWord(oldword, newword)
   })
 }
-function changeWord(oldword,newword){
-  post(api.midifyPassword,{
+function changeWord(oldword, newword) {
+  post(api.midifyPassword, {
     "modifyPassword": md5(newword),
     "password": md5(oldword)
-  }).then(function(res){
+  }).then(function (res) {
     const data = res.data;
-    if(data.code==='0'){
-      setCookie('behosDateStart','')
-      setCookie('behosDateEnd','')
+    if (data.code === '0') {
+      setCookie('behosDateStart', '')
+      setCookie('behosDateEnd', '')
       window.location.href = './login.html'
-    }else{
+    } else {
       $(".oldWaring").html(data.msg)
       return
     }
   });
 }
 //用户信息下拉事件
-$(".login").click(function(e){
+$(".login").click(function (e) {
   e.stopPropagation()
   $(".userAction").slideToggle();
 })
 //点击修改密码
-$("#changeWord").click(function(e){
-  if(!hasData('FUNC000002')){
-      return
+$("#changeWord").click(function (e) {
+  if (!hasData('FUNC000002')) {
+    return
   }
   e.stopPropagation()
   const status = $(".modalAction").css("display")
   $.alerModal({
-    title:"修改密码",
-    type:"modal",
-    width:'450',
-    time:'1000',
-    sureText:'保存',
-    message:`
+    title: "修改密码",
+    type: "modal",
+    width: '450',
+    time: '1000',
+    sureText: '保存',
+    message: `
     <div class="modalAction">
       <p><span>原密码:</span><input type="text" placeholder="请输入原密码" class="oldword" autocomplete="off"><i class="oldWaring"></i></p>
       <p><span>新密码:</span><input type="text" placeholder="请输入新密码" class="newword" autocomplete="off"></p>
@@ -299,26 +330,26 @@ $("#changeWord").click(function(e){
   $(".userAction").hide();
 })
 //推出登录
-$(".login-out").click(function(){
+$(".login-out").click(function () {
   delCookie('accessToken')
-  setCookie('behosDateStart','')
-  setCookie('behosDateEnd','')
+  setCookie('behosDateStart', '')
+  setCookie('behosDateEnd', '')
 })
 
 //时间获取
-function getTimeDetail(){
+function getTimeDetail() {
   const d = new Date();
-  const days = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
+  const days = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
   let sec = d.getSeconds()
   let min = d.getMinutes()
   let hour = d.getHours()
-  let str = `${d.getFullYear()}年${d.getMonth()+1}月${d.getDate()}日 / ${days[d.getDay()]} / ${hour>9?hour:'0'+hour}:${min>9?min:'0'+min}:${sec>9?sec:'0'+sec}`
+  let str = `${d.getFullYear()}年${d.getMonth() + 1}月${d.getDate()}日 / ${days[d.getDay()]} / ${hour > 9 ? hour : '0' + hour}:${min > 9 ? min : '0' + min}:${sec > 9 ? sec : '0' + sec}`
   $(".dateDetail").html(str)
 }
 
 // 左侧菜单滚动到页面顶部
-function bindMenu(){
-  $("#contentIframe").contents().find('.partTitle a').eq(0).click(function(){
-    $(".menuList").scrollTop(0)
-  })
+function bindMenu() {
+  $("#contentIframe").contents().find('.partTitle a').eq(0).click(function () {
+    $(".menuList").scrollTop(0)
+  })
 }

+ 1 - 0
src/js/login.js

@@ -53,6 +53,7 @@ function sureLogin(){
     if(data.code == 0){
       setCookie('accessToken',data.data.accessToken)
       setCookie('isPlacefile',1)
+      setCookie('passwordComplexity', data.data.passwordComplexity)
       localStorage.setItem('accessToken',data.data.accessToken)
       $(".divModal").remove()
       $.alerModal({"message":"登录成功",type:"tip",time:'1000',win:true});

+ 1 - 1
src/js/utils.js

@@ -3,7 +3,7 @@ const $ = require('jquery');
 const axios = require('axios');
 var Utils = require('./rePromise');
 require('./scrollBar.js');
-const baseUrl = 'http://192.168.2.121:5858';
+const baseUrl = 'http://192.168.2.236:1488';
 //页面映射
 const pageMap = {
   'YH-KZT': 'console.html',