Sfoglia il codice sorgente

修改bug

修改bug
dangyunlong 3 settimane fa
parent
commit
4f44f86318
2 ha cambiato i file con 19 aggiunte e 6 eliminazioni
  1. 0 3
      src/store/modules/template.js
  2. 19 3
      src/views/template/public/checkWindow.vue

+ 0 - 3
src/store/modules/template.js

@@ -1037,8 +1037,6 @@ const mutations = {
             state.pageDataStatus[pageName].adPrice = noAdPrice;
             
         });
-        
-        
         // 全局广告特殊处理(只处理一次) 全局广告是算到首页里面的
         if(router.currentRoute.query.style=="1"||router.currentRoute.query.style=="2"||router.currentRoute.query.style=="3"||router.currentRoute.query.style=="4"||router.currentRoute.query.style=="9"){
             if(state.webSiteData.ad.top.name == ""){
@@ -1048,7 +1046,6 @@ const mutations = {
                 state.pageDataStatus.index.adPrice++;
             }
         }
-        
     },
     //清理画布内容
     clearWebsiteTemplate(state,data){

+ 19 - 3
src/views/template/public/checkWindow.vue

@@ -328,8 +328,23 @@ export default {
                 adPlaceList:[]
             }
             console.log(this.$store.state.template.webSiteData)
-            //第一步:获得全局的顶部广告
-            data.adPlaceList.push(this.$store.state.template.webSiteData.ad.top);
+
+            //判断当前的皮肤是否需要提交顶部广告
+            if(this.$store.state.template.webSiteData.style.styleId == 5 ||
+                this.$store.state.template.webSiteData.style.styleId == 6 ||
+                this.$store.state.template.webSiteData.style.styleId == 7 ||
+                this.$store.state.template.webSiteData.style.styleId == 8){
+
+                console.log("广告列表不能为空,提交一个空的顶部广告防止报错")
+                this.$store.state.template.webSiteData.ad.top.name = "顶部广告占位";
+                this.$store.state.template.webSiteData.ad.top.introduce = "顶部广告占位";
+                this.$store.state.template.webSiteData.ad.top.price = 0;
+                data.adPlaceList.push(this.$store.state.template.webSiteData.ad.top);
+            }else{
+                //需要提交顶部广告
+                data.adPlaceList.push(this.$store.state.template.webSiteData.ad.top);
+            }
+            
             //第二步:遍历每一个页面的广告位
             const adTypes = ['index', 'class', 'list', 'article', 'search', 'aloneList', 'aloneArticle'];
             adTypes.forEach(type => {
@@ -359,7 +374,8 @@ export default {
                     //第三步:保存网站
                     let data = JSON.stringify(this.$store.state.template.webSiteData);
                     this.$store.dispatch('template/saveWebsiteTemplate',{
-                        website_id:this.$route.query.website_id,
+                        website_id:parseFloat(this.$route.query.website_id),
+                        template_id:parseFloat(this.$route.query.style),
                         template_data:data,
                         canvas_data:canvasData
                     }).then(res=>{