Bläddra i källkod

自助建站紧急修正:除首页外,其他页面广告位均创建失败

自助建站紧急修正:除首页外,其他页面广告位均创建失败
dangyunlong 16 timmar sedan
förälder
incheckning
ca04630908
1 ändrade filer med 42 tillägg och 11 borttagningar
  1. 42 11
      src/views/template/public/checkWindow.vue

+ 42 - 11
src/views/template/public/checkWindow.vue

@@ -306,18 +306,49 @@ export default {
             console.log(this.$store.state.template.webSiteData)
             //第一步:获得全局的顶部广告
             data.adPlaceList.push(this.$store.state.template.webSiteData.ad.top);
-            if(this.$store.state.template.webSiteData.ad.index.length>0){
-                for(let item of this.$store.state.template.webSiteData.ad.index){
-                    data.adPlaceList.push(item);
+            //第二步:遍历每一个页面的广告位
+            const adTypes = ['index', 'class', 'list', 'article', 'search', 'aloneList', 'aloneArticle'];
+            adTypes.forEach(type => {
+                const ads = this.$store.state.template.webSiteData.ad[type];
+                if (ads && ads.length > 0) {
+                    data.adPlaceList.push(...ads);
                 }
-            }
-            if(this.$store.state.template.webSiteData.ad.class.length>0){}
-            if(this.$store.state.template.webSiteData.ad.list.length>0){}
-            if(this.$store.state.template.webSiteData.ad.article.length>0){}
-            if(this.$store.state.template.webSiteData.ad.search.length>0){}
-            if(this.$store.state.template.webSiteData.ad.aloneList.length>0){}
-            if(this.$store.state.template.webSiteData.ad.aloneArticle.length>0){}
-
+            });
+            // if(this.$store.state.template.webSiteData.ad.index.length>0){
+            //     for(let item of this.$store.state.template.webSiteData.ad.index){
+            //         data.adPlaceList.push(item);
+            //     }
+            // }
+            // if(this.$store.state.template.webSiteData.ad.class.length>0){
+            //     for(let item of this.$store.state.template.webSiteData.ad.class){
+            //         data.adPlaceList.push(item);
+            //     }
+            // }
+            // if(this.$store.state.template.webSiteData.ad.list.length>0){
+            //     for(let item of this.$store.state.template.webSiteData.ad.list){
+            //         data.adPlaceList.push(item);
+            //     }
+            // }
+            // if(this.$store.state.template.webSiteData.ad.article.length>0){
+            //     for(let item of this.$store.state.template.webSiteData.ad.article){
+            //         data.adPlaceList.push(item);
+            //     }
+            // }
+            // if(this.$store.state.template.webSiteData.ad.search.length>0){
+            //     for(let item of this.$store.state.template.webSiteData.ad.search){
+            //         data.adPlaceList.push(item);
+            //     }
+            // }
+            // if(this.$store.state.template.webSiteData.ad.aloneList.length>0){
+            //     for(let item of this.$store.state.template.webSiteData.ad.aloneList){
+            //         data.adPlaceList.push(item);
+            //     }
+            // }
+            // if(this.$store.state.template.webSiteData.ad.aloneArticle.length>0){
+            //     for(let item of this.$store.state.template.webSiteData.ad.aloneArticle){
+            //         data.adPlaceList.push(item);
+            //     }
+            // }
             //获得画布上得内容,准备回显
             let allData = {
                 topAd:this.$store.state.template.webSiteData.ad.top,