Browse Source

Merge remote-tracking branch 'origin/scale0414' into testNew

zhouna 4 năm trước cách đây
mục cha
commit
26ca476330

+ 58 - 1
src/css/common.less

@@ -46,4 +46,61 @@
 }
 .ql-align-center {
   text-align: center;
-}
+}
+
+.warning-box {
+  display: none;
+  position: fixed;
+  width: 100%;
+  height: 100%;
+  top: 0;
+  left: 0;
+  .bg {
+    width: 100%;
+    height: 100%;
+    background: #000;
+    opacity: .3;
+    z-index: 999;
+  }
+  .inner-box {
+    width: 400px;
+    background: #fff;
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    margin: -90px 0 0 -200px;
+    color: #333;
+    border-radius: 4px;
+  }
+  .title {
+    border-bottom: 1px #EBEBEB solid;
+    height: 40px;
+    line-height: 40px;
+    span {
+      margin-left: 20px;
+    }
+    i {
+      margin-left: 322px;
+      font-size: 16px;
+      cursor: pointer;
+    }
+  }
+  .content {
+    padding: 30px 20px;
+    img {
+      width: 20px;
+      height: 20px;
+      vertical-align: middle;
+      margin-right: 10px;
+    }
+  }
+  button {
+    width: 60px;
+    height: 34px;
+    background: @staticMainColor;
+    color: #fff;
+    text-align: center;
+    border-radius: 3px;
+    margin: 0 0 20px 322px;
+  }
+}

+ 0 - 61
src/css/searchStaticList.less

@@ -290,64 +290,3 @@
     }
     
 }
-
-.warning-box {
-  display: none;
-  position: fixed;
-  width: 100%;
-  height: 100%;
-  top: 0;
-  left: 0;
-  .bg {
-    width: 100%;
-    height: 100%;
-    background: #000;
-    opacity: .3;
-    z-index: 999;
-  }
-  .inner-box {
-    width: 400px;
-    background: #fff;
-    position: absolute;
-    top: 50%;
-    left: 50%;
-    margin: -90px 0 0 -200px;
-    color: #333;
-    border-radius: 4px;
-  }
-  .title {
-    border-bottom: 1px #EBEBEB solid;
-    height: 40px;
-    line-height: 40px;
-    span {
-      margin-left: 20px;
-    }
-    i {
-      margin-left: 322px;
-      font-size: 16px;
-      cursor: pointer;
-    }
-  }
-  .content {
-    padding: 30px 20px;
-    img {
-      width: 20px;
-      height: 20px;
-      vertical-align: middle;
-      margin-right: 10px;
-    }
-  }
-  button {
-    width: 60px;
-    height: 34px;
-    background: @staticMainColor;
-    color: #fff;
-    text-align: center;
-    border-radius: 3px;
-    margin: 0 0 20px 322px;
-  }
-}
-
-
-
-

+ 15 - 0
src/html/homeStatic.html

@@ -37,6 +37,21 @@
       <img src="../images/staticBg.png" alt="">
     </div>
   </div>
+    <div class="warning-box">
+      <div class="bg"></div>
+      <div class="inner-box">
+        <div class="title">
+          <span>提示</span>
+          <i class="close">×</i>
+        </div>
+        <div class="content">
+          <img src="../images/warn.png" alt=""><span></span>
+        </div>
+        <div class="btn">
+          <button class="confirm">确定</button>
+        </div>
+      </div>
+    </div>
 </body>
 </html>
 

+ 13 - 1
src/js/homeStatic.js

@@ -1,7 +1,8 @@
 require('./../css/homeStatic.less');
 
 const $ = require("jquery");
-const {post,config} = require('./promise.js');
+const {post, config,} = require('./promise.js');
+const {toggleWarnBox} = require('./util.js');
 let searchType = 0;
 require('./../images/staticBgS.png').replace(/^undefined/g, '')
 require('./../images/staticLogo.png').replace(/^undefined/g, '')
@@ -29,6 +30,11 @@ function renderTab(data){
 function goSearchList(){
   $(".searchBtn").click(function(){
     let vals = $('.searchStr').val()
+      if (!vals) {
+          $(".staticResult .loading").hide();
+          toggleWarnBox('检索词不能为空!');
+          return;
+      }
     window.location.href = './searchStaticList.html?type='+searchType+'&inputStr='+vals
   })
 }
@@ -48,3 +54,9 @@ function getAllTypes(){
     }
   })
 }
+
+$(function () {
+    $(".warning-box .confirm,.warning-box .close").click(function () {
+        toggleWarnBox();
+    })
+});

+ 9 - 12
src/js/searchStaticList.js

@@ -2,6 +2,7 @@ require('./../css/searchStaticList.less');
 
 const $ = require("jquery");
 const { post,config,getUrlArgObject,openNewWin } = require('./promise.js');
+const {toggleWarnBox} = require('./util.js');
 
 let searchType = 0, inputStr = '', curPage = 1, size = 10, totalPage = 1;
 searchType = getUrlArgObject('type') || 0
@@ -115,6 +116,10 @@ function renderList(tabList){
         `
     }
     $(".resultItemWrap").html(str);
+    /*setTimeout(function(){console.log($(".resultItemWrap").scrollTop())
+        $(".staticListWrap").scrollTop(10);
+    },1000)*/
+
     $('.resultItem').click(function(){
         let name = $(this).attr('data-name')
         let type = $(this).attr('data-type')
@@ -134,14 +139,6 @@ function initData(){
     }
 }
 
-function toggleWarnBox(text) {
-    if (text) {
-        $(".warning-box .content span").text(text);
-        $(".warning-box").show();
-    } else {
-        $(".warning-box").hide();
-    }
-}
 // 分页
 function renderPagination(totalPage,activePage,totalNum){
     let str = `<span class="totalSum">共${totalNum}条</span>
@@ -191,7 +188,7 @@ function renderPagination(totalPage,activePage,totalNum){
     $('.pagination').html(str)
     $('.page' + activePage).addClass('activePage')
     $(".pageNum").on("click", function(e){
-        console.log($(this)[0])
+        //console.log($(this)[0])
         const activePageNow = Number($(this).attr('data-page'))
         curPage = activePageNow
         getTabData()
@@ -217,8 +214,8 @@ function renderPagination(totalPage,activePage,totalNum){
     })
     $('.goNum input').change(function(){
         const n = $(this).val()
-        if (totalPage < n) {
-            toggleWarnBox("输入页数不能大于最大页数");
+        if (totalPage < n || n < 1) {
+            toggleWarnBox("请输入1-" + totalPage + "范围内的整数");
             return;
         }
         curPage = n;
@@ -230,5 +227,5 @@ $(function () {
     $(".warning-box .confirm,.warning-box .close").click(function () {
         toggleWarnBox();
     })
-})();
+});
 

+ 11 - 1
src/js/util.js

@@ -47,8 +47,18 @@ const transConf = function(arr) {
         labsAndPacMode
     }
 }
+const $ = require("jquery");
 
+function toggleWarnBox(text) {
+    if (text) {
+        $(".warning-box .content span").text(text);
+        $(".warning-box").show();
+    } else {
+        $(".warning-box").hide();
+    }
+}
 
 module.exports = {
-    transConf
+    transConf,
+    toggleWarnBox
 }