Ver código fonte

feat:引到广告位,无数据时候不展示

zhangsiya 11 meses atrás
pai
commit
11b62a3e20

+ 6 - 0
src/web/staticres/js/guide-intro-dialog.js

@@ -22,6 +22,12 @@ function GuideIntroDialog () {
                     if (r.error_code === 0 && r.data && r.data["pc-guide"] && $.isArray(r.data[_this.ad]) && r.data["pc-guide"].length > 0) {
                         _this.$dialog.find('.content-iframe').attr('src', _this.iframeUrl)
                         _this.$dialog.modal('show')
+                        window.onload = function() {
+                          var list = r.data["pc-guide"]
+                          var iframeWindow = document.getElementById('guide-intro-image-iframe').contentWindow
+                          iframeWindow.guideContent.getActivityInfo(list) // 调用子页面的函数传递变量
+                        }
+                       _this.saveStorage()
                     }
                 }
             })

+ 19 - 0
src/web/staticres/public-pc/js/header-nav.js

@@ -386,3 +386,22 @@ function seoTdkUpdate (title, keywords, description) {
     }
   }
 }
+
+
+// 展示引导弹窗
+function showGuideDialog () {
+  var skipInit = location.href.indexOf('/notin/page') !== -1
+  if (!skipInit && typeof window.GuideIntroDialog === 'function') {
+    window.guideIntroDialog = new GuideIntroDialog()
+  }
+}
+
+$(function () {
+  var guideTimer = null
+  if(guideTimer) clearTimeout(guideTimer)
+  guideTimer = setTimeout(function () {
+    if(loginflag && location.href.indexOf('/page_workDesktop/') < 0) {
+      showGuideDialog()
+    }
+  }, 1000)
+})

+ 1 - 1
src/web/templates/common/guide-intro-dialog.html

@@ -2,7 +2,7 @@
 <!-- 引入此模板前,保证引入/common/pnc.html模板 -->
 <div class="modal fade guide-intro-dialog-mask" id="guide-intro-dialog-mask" data-backdrop="static">
   <div class="modal-dialog guide-intro-dialog is-show">
-    <iframe class="content-iframe" src="" frameborder="0"></iframe>
+    <iframe class="content-iframe" src="" frameborder="0" id="guide-intro-image-iframe"></iframe>
     <button class="skip-button">跳过</button>
     <div class="close-icon pointer">
       <img src="/images/pc/closeIcon2x.png" alt="关闭" />

+ 19 - 18
src/web/templates/frontRouter/pc/pure/sess/guide-intro-dialog-content.html

@@ -113,24 +113,25 @@
                 this.getActivityInfo()
             },
             methods: {
-                getActivityInfo: function () {
-                    var _this = this
-                    var codes = [this.ad]
-                    var params = {
-                        codes: codes
-                    }
-                    $.ajax({
-                        type: 'post',
-                        url: '/publicapply/free/getJyAdList',
-                        contentType: 'application/json',
-                        data: JSON.stringify(params),
-                        success: function (r) {
-                            if (r.error_code === 0 && r.data && $.isArray(r.data[_this.ad]) && r.data[_this.ad] && r.data[_this.ad].length > 0) {
-                                var adList = r.data[_this.ad]
-                                _this.imageList = adList
-                            }
-                        }
-                    })
+                getActivityInfo: function (list) {
+                  this.imageList = list
+                    // var _this = this
+                    // var codes = [this.ad]
+                    // var params = {
+                    //     codes: codes
+                    // }
+                    // $.ajax({
+                    //     type: 'post',
+                    //     url: '/publicapply/free/getJyAdList',
+                    //     contentType: 'application/json',
+                    //     data: JSON.stringify(params),
+                    //     success: function (r) {
+                    //         if (r.error_code === 0 && r.data && $.isArray(r.data[_this.ad]) && r.data[_this.ad] && r.data[_this.ad].length > 0) {
+                    //             var adList = r.data[_this.ad]
+                    //             _this.imageList = adList
+                    //         }
+                    //     }
+                    // })
                 }
             }
         })