瀏覽代碼

空状态显示

zhouna 4 年之前
父節點
當前提交
97699522e9
共有 2 個文件被更改,包括 41 次插入23 次删除
  1. 13 0
      src/css/informationOut.less
  2. 28 23
      src/js/informationOut.js

+ 13 - 0
src/css/informationOut.less

@@ -290,4 +290,17 @@
   white-space: nowrap;/*强制在一行显示*/
   text-overflow:ellipsis;/*设置超出内容显示...*/
   overflow: hidden;/*一定不能少 超出的内容进行隐藏*/
+}
+.empty{
+  text-align: center;
+  margin-top: 32vh;
+  img{
+    width: 140px;
+    height: 75px;
+  }
+  p{
+    margin-top: 10px;
+    font-size: 15px;
+    color: #aaa;
+  }
 }

+ 28 - 23
src/js/informationOut.js

@@ -40,33 +40,38 @@ function getInfomation() {
   // }
 
   post(config.getStaticKnowledgeForHIS, param).then((res) => {
-    const data = res.data.data
-    var str = '';
-    var anchors = '';
-    if (!data||data.length==0) {
-      $("h1").html("暂时没有数据");
-      $(".anchors").css("display", "none");
-      return;
-    }
-    showLis=data
-    for(let i = 0;i < showLis.length;i++){
-      let tmp = showLis[i]
-      str+=`<li data-idx="${i}" title="${tmp.name}">${tmp.name}</li>`
+    if(res.data.code==='0'){
+      const data = res.data.data
+      var str = '';
+      var anchors = '';
+      if (!data||data.length===0) {
+        showEmpty();
+        return;
+      }
+      showLis=data
+      for(let i = 0;i < showLis.length;i++){
+        let tmp = showLis[i]
+        str+=`<li data-idx="${i}" title="${tmp.name}">${tmp.name}</li>`
+      }
+      $(".showWhich ul").html(str)
+      $(".showWhichSelect").html(showLis[0].name).attr("title",showLis[0].name)
+      showName = data[0].name
+      document.title = showName
+      showInfoSelect()
+      showInfo(data[0])
+      $('.content img').bind('contextmenu', function(){
+        return false
+      })
+    }else{
+      showEmpty();
     }
-    $(".showWhich ul").html(str)
-    $(".showWhichSelect").html(showLis[0].name).attr("title",showLis[0].name)
-    showName = data[0].name
-    document.title = showName
-    showInfoSelect()
-    showInfo(data[0])
-    $('.content img').bind('contextmenu', function(){
-      return false
-    })
-   
   })
 }
 getInfomation();
-
+function showEmpty(){
+  const str=`<div class="empty"><img src="../images/empty3.png" alt=""><p>暂无静态知识</p></div>`;
+  $(".tabBox").html(str).css("border-bottom","none");
+}
 function showInfo(data){
   var detailList = data.details
   var staticKnowList = detailList['静态知识']