Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.idea/workspace.xml
wushaodong 3 years ago
parent
commit
01c3f5d635
3 changed files with 25 additions and 9 deletions
  1. 2 2
      h_exam/exam_list.html
  2. 1 1
      js/components.js
  3. 22 6
      js/exam_list.js

+ 2 - 2
h_exam/exam_list.html

@@ -64,7 +64,7 @@
   <!-- @小屏幕 下拉菜单 -->
   <div id="nav-sm" class="nav-sm-noheight">
     <div class="my-province">
-      <span>全国</span><i class="glyphicon glyphicon-chevron-down"></i>
+      <span>省份</span><i class="glyphicon glyphicon-chevron-down"></i>
       <div data-province="true">
         <i class="glyphicon glyphicon-play icon-play"></i>
       </div>
@@ -158,4 +158,4 @@
   </div>
 </body>
 
-</html>
+</html>

File diff suppressed because it is too large
+ 1 - 1
js/components.js


+ 22 - 6
js/exam_list.js

@@ -9,7 +9,17 @@ $(function () {
     my_nav_lis.removeClass("active");
     $(my_nav_lis[id]).addClass("active");
   }
-  let grade = $(my_nav_lis[id]).data("id"), lock = false, currentPage = 3, totalPage = 3, type = $(my_nav_lis[id]), zlock = "数据加载中...";
+  let grade = $(my_nav_lis[id]).data("id"), lock = false, type = $(my_nav_lis[id]), zlock = "数据加载中...",
+    // 加载的数据
+    area = params["area"] || '';
+  if (!area) {
+    var currentPage = 3, totalPage = 3;
+  } else {
+    $(".my-list").empty();
+    var currentPage = 1, totalPage = 1;
+    $(".my-loading").show();
+    data({ currentPage, area, grade }).then(res => { totalPage = res.totalPage; currentPage++; type.data("totalPage", res.totalPage); type.data("currentPage", currentPage); lock = res.lock; $(".my-loading").hide(); })
+  }
   my_nav.click(function (e) {
     $(".my-loading").hide();
     if (e.target.className == "my-nav") return false;
@@ -21,21 +31,27 @@ $(function () {
     i ? $(".my-loading").show() : '';
     z_lock = i || zlock;
     $(".my-loading").html(z_lock).hide();
-    currentPage = type.data("currentPage") || 3;
-    totalPage = type.data("totalPage") || 3;
     grade = type.data("id");
     lock = type.data("lock") || false;
+    if (!area) {
+      currentPage = type.data("currentPage") || 3;
+      totalPage = type.data("totalPage") || 3;
+    } else {
+      currentPage = type.data("currentPage") || 1;
+      totalPage = type.data("totalPage") || 1;
+      $(".my-loading").show();
+      data({ currentPage, area, grade }).then(res => { totalPage = res.totalPage; currentPage++; type.data("totalPage", res.totalPage); type.data("currentPage", currentPage); lock = res.lock; $(".my-loading").hide(); })
+    }
     $(this).find(".active").removeClass("active");
     type.addClass("active");
     $(".ke>.active").removeClass("active");
     $($(".ke>.my-list")[active]).addClass("active");
+
   })
 
   // 加载数据
   // 显示区高度
-  let ch = document.documentElement.clientHeight || document.body.clientHeight,
-    // 加载的数据
-    area = params["area"] || '';
+  let ch = document.documentElement.clientHeight || document.body.clientHeight;
   $(window).scroll(function () {
     if (lock) return false;
     // 滑动区高度

Some files were not shown because too many files changed in this diff