Browse Source

h5文章页适配https

baichun 6 năm trước cách đây
mục cha
commit
a77c3f7856

+ 4 - 2
2017多玩新版wap站/src/article.html

@@ -394,6 +394,7 @@
                     <div style="page-break-after: always;">
                         <span style="DISPLAY:none">&nbsp;</span>
                     </div>
+                    <a href="https://pc.duowan.com/1808/m_398889260720.html"></a>
                     <h2 class="sub-title">曹丕 CV:神奈延年</h2>
                     <p>  魏王‧曹操之子。天生背负着继承霸业之命运。</p>
                     <p>  具备统领次世代之才气,但受环境与理智影响,有时对他人发言冷酷或轻视他人。</p>
@@ -838,7 +839,7 @@
                         </a>
                     </li>
                     <li class="news-list__item img-text">
-                        <a href="">
+                        <a href="https://pc.duowan.com/1808/m_398889260720.html">
                             <img data-src="/data-src/img/news_cover.jpg" class="news-cover" />
                             <h3 class="news-title">
                                 另一款仙侠大作!《Project:T2》全新游戏设定图放出
@@ -847,7 +848,7 @@
                         </a>
                     </li>
                     <li class="news-list__item img-text ">
-                        <a href="">
+                        <a href="https://pc.duowan.com/1808/m_398889260720.html">
                             <img data-src="/data-src/img/news_cover.jpg" class="news-cover" />
                             <h3 class="news-title">
                                 2017年内发售 《黎明杀机》 2017年内发售 《黎明杀机》
@@ -885,6 +886,7 @@
             require('modules/article/article.js');
         </script>
         <link rel="import" href="modules/footer/footer.html?__inline">
+        <script src="lib/miniprogram.js"></script>
     </div>
     <!--文章分享区{-->
     <div class="fixed-share-wrap" id="fixedShareWrap">

+ 40 - 0
2017多玩新版wap站/src/lib/miniprogram.js

@@ -0,0 +1,40 @@
+/**
+ * 公用头部的js
+ */
+class miniprogram {
+    constructor() {
+        this.isMiniprogram = /(\?|\&)platform=wxminiprogram(&*|$)/.test(location.href)
+        this.init()
+    }
+    init() {
+        if(!this.isMiniprogram) return
+
+        this.initDom()
+            .initLink()
+    }
+
+    initDom(){
+        $(".da-like-block,.da-container,.dw-common-header,.dw-common-nav,.common-menu-crumbs,.dw-common-footer,.fixed-comment-bar").hide().remove()
+
+        return this
+    }
+
+    initLink(){
+        $("a").each((i,e)=>{
+            let $this = $(e)
+            let href = $this.attr("href")
+
+            if(!href) return
+            href = href.replace(/http:/,'https:')
+            let newHref = /\?/.test(href) ? `${href}&platform=wxminiprogram` : `${href}?platform=wxminiprogram`
+
+            $this.attr("href",newHref)
+        })
+
+        return this
+    }
+}
+
+$(() => {
+    new miniprogram
+})

+ 0 - 1
2017多玩新版wap站/src/modules/article/article.js

@@ -99,7 +99,6 @@ class DwArticle {
 
             this.$fixedShade.on('touchmove', prevent)
         } else {
-            $(".da-like-block,.da-container,.dw-common-header,.dw-common-nav,.common-menu-crumbs,.dw-common-footer").hide()
             $(".da-article-sy-wrapper,.rec-zt,.zt-table,.da-rank-wrapper,.about-news,.rec-videos,.to-dw-index,.common-comment,.rec-hot,.fixed-comment-bar,.comment-share").hide()
         }
     }