邪性 3 years ago
parent
commit
6a28b2e36f
3 changed files with 81 additions and 24 deletions
  1. 34 0
      css/exam_detail_img.css
  2. 17 10
      h_exam/exam_detail_d_img.html
  3. 30 14
      js/exam_detail_img.js

+ 34 - 0
css/exam_detail_img.css

@@ -317,3 +317,37 @@
   border-radius: 10px;
   box-sizing: border-box;
 }
+/* 二维码下载 */
+.body .exam-code {
+  margin: 20px 0;
+}
+.body .exam-code::before {
+  content: "更多参考答案,请下载大联考app;或者微信扫描,打开“大联考APP”小程序进行查看。";
+  text-align: center;
+  display: block;
+  color: #777;
+  padding-bottom: 10px;
+}
+.body .exam-code ul {
+  margin: 0;
+  padding: 0;
+  display: flex;
+  justify-content: space-around;
+  align-items: center;
+  list-style: none;
+}
+.body .exam-code ul li ul {
+  display: block;
+  max-width: 200px;
+  max-height: 200px;
+  min-width: 100px;
+  min-height: 100px;
+  box-sizing: border-box;
+  padding: 20px;
+}
+.body .exam-code ul li ul li {
+  text-align: center;
+}
+.body .exam-code ul li ul li img {
+  width: 100%;
+}

+ 17 - 10
h_exam/exam_detail_d_img.html

@@ -73,15 +73,22 @@
             <p class="edi-line" id="edi-answer">参考答案<br></p>
             <p><br></p>
             <div class="showimglist answer-img">
-              <p class="exam-img">
-                <img src="../imgs/app_dowload.png" alt="大联考">
-                大联考APP下载
-              </p>
-              <p class="exam-img">
-                <img src="../imgs/wx_code.jpg" alt="大联考">
-                "大联考APP"小程序
-              </p>
-
+              <div class="exam-code">
+                <ul>
+                  <li>
+                    <ul>
+                      <li><img src="../imgs/app_dowload.png" alt="大联考"></li>
+                      <li>大联考APP下载</li>
+                    </ul>
+                  </li>
+                  <li>
+                    <ul>
+                      <li><img src="../imgs/wx_code.jpg" alt="大联考"></li>
+                      <li>"大联考APP"小程序</li>
+                    </ul>
+                  </li>
+                </ul>
+              </div>
             </div>
           </div>
           <!-- 相关文章 -->
@@ -150,4 +157,4 @@
   </div>
 </body>
 
-</html>
+</html>

+ 30 - 14
js/exam_detail_img.js

@@ -8,20 +8,36 @@ $(function () {
   let my_nav = $(".my-nav"), top = my_nav.offset().top;
   $(".my-nav").click(function (e) {
     if (e.target.className == "my-nav") return false;
-    let active = Array.prototype.slice.call($(this).find("li")).indexOf(e.target);
-    if (active == globaldata.active) return false;
-    globaldata.active = active;
-    $(this).find(".active").removeClass("active");
-    $(e.target).addClass("active");
-    // 获取跳转锚点到顶部的距离
-    let title = $("#title").offset().top;
-    let edi_answer = $("#edi-answer").offset().top;
-    let interactive = $("#interactive").offset().top;
-    let lis = $(this).find("li");
-    let i = Array.prototype.slice.call(lis).indexOf($(e.target)[0]);
-    // 储存锚点
-    let maos = [title, edi_answer, interactive];
-    $(window).scrollTop(maos[i]);
+    let active = Array.prototype.slice.call($(this).find("li")).indexOf(e.target), id = null;
+    // if (active == globaldata.active) return false;
+    // globaldata.active = active;
+    // 模板之间跳转逻辑
+    if (e.target == $(this).find("li.active")[0]) return false;
+    console.log(active)
+    switch (active) {
+      case 0:
+        id = lxd.parseUrl(window.location.href).pathname.match(/(?<=\/h_exam\/d_).*?(?=.html)/);
+        window.open(`/h_exam/s_${id}.html`);
+        break;
+      case 1:
+        id = lxd.parseUrl(window.location.href).pathname.match(/(?<=\/h_exam\/s_).*?(?=.html)/);
+        window.open(`/h_exam/d_${id}.html`);
+        break;
+      default:
+        break;
+    }
+    // 模板内部跳转逻辑
+    // $(this).find(".active").removeClass("active");
+    // $(e.target).addClass("active");
+    // // 获取跳转锚点到顶部的距离
+    // let title = $("#title").offset().top;
+    // let edi_answer = $("#edi-answer").offset().top;
+    // let interactive = $("#interactive").offset().top;
+    // let lis = $(this).find("li");
+    // let i = Array.prototype.slice.call(lis).indexOf($(e.target)[0]);
+    // // 储存锚点
+    // let maos = [title, edi_answer, interactive];
+    // $(window).scrollTop(maos[i]);
   })
   $(window).scroll(
     function () {