|
@@ -3,7 +3,7 @@ import { getSiteInfo, getSiteCategory, getFooterCategoryList} from '@/api/cms'
|
|
|
//自助建站的接口 用于添加基本信息
|
|
|
import {
|
|
|
getWebsiteintel, addWebsiteTemplateintel, getAdminSiteInfo, upWebsiteTemplateintel, getAllTemplateClass, getWebsiteTemplateList, addWebsiteTemplateclassintel,
|
|
|
- getWebsiteTemplateclassintel, addWebsiteTemplate, getWebsiteTemplateInfo, getWebsiteTemplateData, getAdminWebsiteFootAll
|
|
|
+ getWebsiteTemplateclassintel, addWebsiteTemplate, getWebsiteTemplateInfo, getWebsiteTemplateData, getAdminWebsiteFootAll, addTwinAdPlace
|
|
|
} from '@/api/template'
|
|
|
|
|
|
import { Message,MessageBox } from 'element-ui'; //注意在这里引入是非常不符合规范的
|
|
@@ -27,7 +27,8 @@ const state = {
|
|
|
index:{
|
|
|
sector:0,//当前板块数量,为0表示一个都没有,最少需要1个模块才能保存
|
|
|
cid:0,//缺少的导航池id 为0表示没有缺少
|
|
|
- ad:0//缺少的广告名称,为0表示没有缺少
|
|
|
+ ad:0,//缺少的广告名称,为0表示没有缺少
|
|
|
+ adPrice:0//缺少的广告价格,为0表示没有缺少
|
|
|
}
|
|
|
},
|
|
|
//0.全局配置 end------------------------------------------------------------>
|
|
@@ -130,13 +131,15 @@ const state = {
|
|
|
//4.广告位
|
|
|
ad: {
|
|
|
top:{
|
|
|
- "width": 830,
|
|
|
- "height": 110,
|
|
|
- "name": "",
|
|
|
- "website_id": "",
|
|
|
- "thumb": "https://img.bjzxtw.org.cn/pre/image/png/20250530/1748588901281358.png",
|
|
|
- "typeid": 2,
|
|
|
- "ad_tag": ""
|
|
|
+ "width": 830,//宽度
|
|
|
+ "height": 110,//高度
|
|
|
+ "name": "",//广告名称
|
|
|
+ "price": 0,//价格
|
|
|
+ "introduce":"",//介绍
|
|
|
+ "website_id": "",//网站id
|
|
|
+ "thumb": "https://img.bjzxtw.org.cn/pre/image/png/20250530/1748588901281358.png",//示例图 - 默认值
|
|
|
+ "typeid": 2,//广告类型 - 2 图片
|
|
|
+ "ad_tag": ""//广告标识 - 网站标识 + 页面名称 + sort
|
|
|
},
|
|
|
index: [],
|
|
|
class: [],
|
|
@@ -157,6 +160,7 @@ const state = {
|
|
|
pageSizeImg: "",//展示图片新闻条数
|
|
|
adName: "",//广告名称
|
|
|
titleName: "",//标题名称
|
|
|
+ windowKey:0,//级联选择器的key
|
|
|
}
|
|
|
//5.组件回显数据 start------------------------------------------------------------>
|
|
|
}
|
|
@@ -202,6 +206,10 @@ const mutations = {
|
|
|
state.editComponentSize = data.size;
|
|
|
state.editComponentSizeImg = data.sizeImg;
|
|
|
},
|
|
|
+ //增加级联选择器key
|
|
|
+ addWindowKey(state) {
|
|
|
+ state.componentViewData.windowKey++;
|
|
|
+ },
|
|
|
//关闭编辑组件弹出框
|
|
|
closeEditWindowStatus(state) {
|
|
|
state.editWindowStatus = false;
|
|
@@ -236,7 +244,7 @@ const mutations = {
|
|
|
//判断组件类型 1=新闻 2=广告
|
|
|
//1=新闻 需要设置导航id
|
|
|
if (state.editComponentType == 1) {
|
|
|
- state.componentViewData.pid_arr = state.pageData.index[targetModuleIndex].content.componentList[data.sort].componentData.category_id;
|
|
|
+ state.componentViewData.pid_arr = state.pageData.index[targetModuleIndex].content.componentList[data.sort].componentData.category_arr;
|
|
|
state.componentViewData.pageSize = state.editComponentSize;
|
|
|
state.componentViewData.pageSizeImg = state.editComponentSizeImg;
|
|
|
}
|
|
@@ -254,7 +262,7 @@ const mutations = {
|
|
|
//判断组件类型 1=新闻 2=广告
|
|
|
//1=新闻 需要设置导航id
|
|
|
if (state.editComponentType == 1) {
|
|
|
- state.componentViewData.pid_arr = state.pageData.list[targetModuleIndex].content.componentList[data.sort].componentData.category_id;
|
|
|
+ state.componentViewData.pid_arr = state.pageData.list[targetModuleIndex].content.componentList[data.sort].componentData.category_arr;
|
|
|
state.componentViewData.pageSize = state.editComponentSize;
|
|
|
state.componentViewData.pageSizeImg = state.editComponentSizeImg;
|
|
|
}
|
|
@@ -269,7 +277,7 @@ const mutations = {
|
|
|
//判断组件类型 1=新闻 2=广告
|
|
|
//1=新闻 需要设置导航id
|
|
|
if (state.editComponentType == 1) {
|
|
|
- state.componentViewData.pid_arr = state.pageData.article[targetModuleIndex].content.componentList[data.sort].componentData.category_id;
|
|
|
+ state.componentViewData.pid_arr = state.pageData.article[targetModuleIndex].content.componentList[data.sort].componentData.category_arr;
|
|
|
state.componentViewData.pageSize = state.editComponentSize;
|
|
|
}
|
|
|
//2=设置广告名称
|
|
@@ -754,6 +762,8 @@ const mutations = {
|
|
|
//保存全局广告的数据
|
|
|
saveAdData(state, data) {
|
|
|
state.webSiteData.ad.top.name = data.data.name;
|
|
|
+ state.webSiteData.ad.top.introduce = data.data.introduce;
|
|
|
+ state.webSiteData.ad.top.price = data.data.price;
|
|
|
},
|
|
|
//保存组件设置的数据
|
|
|
saveComponentData(state, data) {
|
|
@@ -778,7 +788,8 @@ const mutations = {
|
|
|
// 获取当前模块数据并进行深拷贝
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.index[targetModuleIndex])); // 深拷贝整个模块
|
|
|
// 更新 category_id 和 pageSize
|
|
|
- module.content.componentList[data.sort].componentData.category_id = data.data.pid_arr; // 设置 category_id
|
|
|
+ module.content.componentList[data.sort].componentData.category_id = data.data.pid_id; // 设置 category_id
|
|
|
+ module.content.componentList[data.sort].componentData.category_arr = data.data.pid_arr; // 设置 category_arr 用于显示
|
|
|
module.content.componentList[data.sort].componentData.name = data.data.name; //设置导航池名字
|
|
|
module.content.componentList[data.sort].componentData.textSize = state.editComponentSize; // 设置 pageSize
|
|
|
module.content.componentList[data.sort].componentData.imgSize = state.editComponentSizeImg; // 设置 pageSize
|
|
@@ -793,6 +804,8 @@ const mutations = {
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.index[targetModuleIndex]));
|
|
|
//module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
module.content.ad.name = data.data.adName;
|
|
|
+ module.content.ad.introduce = data.data.adName;
|
|
|
+ module.content.ad.price = data.data.price;
|
|
|
Vue.set(state.pageData.index, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.index);
|
|
@@ -818,7 +831,8 @@ const mutations = {
|
|
|
// 获取当前模块数据并进行深拷贝
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.list[targetModuleIndex])); // 深拷贝整个模块
|
|
|
// 更新 category_id 和 pageSize
|
|
|
- module.content.componentList[data.sort].componentData.category_id = data.data.pid_arr; // 设置 category_id
|
|
|
+ module.content.componentList[data.sort].componentData.category_id = data.data.pid_id; // 设置 category_id
|
|
|
+ module.content.componentList[data.sort].componentData.category_arr = data.data.pid_arr; // 设置 category_arr 用于显示
|
|
|
module.content.componentList[data.sort].componentData.name = data.data.name; //设置导航池名字
|
|
|
module.content.componentList[data.sort].componentData.textSize = state.editComponentSize; // 设置 pageSize
|
|
|
module.content.componentList[data.sort].componentData.imgSize = state.editComponentSizeImg; // 设置 pageSize
|
|
@@ -833,6 +847,8 @@ const mutations = {
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.list[targetModuleIndex]));
|
|
|
//module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
module.content.ad.name = data.data.adName;
|
|
|
+ module.content.ad.introduce = data.data.adName;
|
|
|
+ module.content.ad.price = data.data.price;
|
|
|
Vue.set(state.pageData.list, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.list);
|
|
@@ -854,6 +870,7 @@ const mutations = {
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.article[targetModuleIndex])); // 深拷贝整个模块
|
|
|
// 更新 category_id 和 pageSize
|
|
|
module.content.componentList[data.sort].componentData.category_id = data.data.pid_arr; // 设置 category_id
|
|
|
+ module.content.componentList[data.sort].componentData.category_arr = data.data.pid_arr; // 设置 category_arr 用于显示
|
|
|
module.content.componentList[data.sort].componentData.name = data.data.name; //设置导航池名字
|
|
|
module.content.componentList[data.sort].componentData.textSize = state.editComponentSize; // 设置 pageSize
|
|
|
module.content.componentList[data.sort].componentData.imgSize = state.editComponentSizeImg; // 设置 pageSize
|
|
@@ -868,6 +885,8 @@ const mutations = {
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.article[targetModuleIndex]));
|
|
|
//module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
module.content.ad.name = data.data.adName;
|
|
|
+ module.content.ad.introduce = data.data.adName;
|
|
|
+ module.content.ad.price = data.data.price;
|
|
|
Vue.set(state.pageData.article, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.article);
|
|
@@ -1279,7 +1298,15 @@ const mutations = {
|
|
|
clonedData.data[index].content.ad.ad_tag = ad_tag;
|
|
|
state.webSiteData.ad[data.type].push(clonedData.data[index].content.ad);
|
|
|
}
|
|
|
+ // for(let item of clonedData.data[index].content.componentList){
|
|
|
+ // if(item.componentData.category_id!=undefined){
|
|
|
+ // console.log("--------------------------------")
|
|
|
+ // console.log(item);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//设置全局的广告位名称
|
|
|
state.webSiteData.ad.top.website_id = state.editWebsiteId;
|
|
|
state.webSiteData.ad.top.ad_tag = `${state.adKey}_top`
|
|
@@ -1340,7 +1367,9 @@ const mutations = {
|
|
|
for(let i in data.data.index[index].content.componentList){
|
|
|
//console.log(data.data.index[index].content.componentList[i].componentData.category_id)
|
|
|
if(data.data.index[index].content.componentList[i].componentData.category_id!=undefined){
|
|
|
- noCid++;
|
|
|
+ if(data.data.index[index].content.componentList[i].componentData.category_id==""){
|
|
|
+ noCid++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1355,8 +1384,27 @@ const mutations = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //全局广告特殊处理
|
|
|
+ if(state.webSiteData.ad.top.name==""){
|
|
|
+ noAd++;
|
|
|
+ }
|
|
|
//console.log(noAd)
|
|
|
state.pageDataStatus.index.ad = noAd;
|
|
|
+
|
|
|
+ //获得首页没有设置广告价格的组件数量
|
|
|
+ let noAdPrice = 0;
|
|
|
+ for(let index in data.data.index){
|
|
|
+ if(data.data.index[index].content.ad!=undefined){
|
|
|
+ if(data.data.index[index].content.ad.price==0){
|
|
|
+ noAdPrice++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //全局广告特殊处理
|
|
|
+ if(state.webSiteData.ad.top.price==0){
|
|
|
+ noAdPrice++;
|
|
|
+ }
|
|
|
+ state.pageDataStatus.index.adPrice = noAdPrice;
|
|
|
},
|
|
|
//随机生成模板
|
|
|
randomTemplate(state) {
|
|
@@ -1401,63 +1449,6 @@ const mutations = {
|
|
|
// pageStatus == 7 自定义详情页
|
|
|
if (state.pageStatus == 7) { }
|
|
|
},
|
|
|
- //提交数据之前执行完整度检查
|
|
|
- IntegrityCheck(state) {
|
|
|
- //先设置为true看能否通过判断
|
|
|
- state.canSubmit = true;
|
|
|
- //先判断当前有哪几个板块可用
|
|
|
- //state.canSubmit == false 不可以提交
|
|
|
- //state.canSubmit == true 可以提交
|
|
|
- //首页
|
|
|
- if (state.showPage.index == true) {
|
|
|
- if (state.template.index == []) {
|
|
|
- state.canSubmit = false;
|
|
|
- }
|
|
|
- }
|
|
|
- //分类页
|
|
|
- if (state.showPage.class == true) {
|
|
|
- if (state.template.class == []) {
|
|
|
- state.canSubmit = false;
|
|
|
- }
|
|
|
- }
|
|
|
- //列表页
|
|
|
- if (state.showPage.list == true) {
|
|
|
- if (state.template.list == []) {
|
|
|
- state.canSubmit = false;
|
|
|
- }
|
|
|
- }
|
|
|
- //详情页
|
|
|
- if (state.showPage.article == true) {
|
|
|
- if (state.template.article == []) {
|
|
|
- state.canSubmit = false;
|
|
|
- }
|
|
|
- }
|
|
|
- //搜索页
|
|
|
- if (state.showPage.search == true) {
|
|
|
- if (state.template.search == []) {
|
|
|
- state.canSubmit = false;
|
|
|
- }
|
|
|
- }
|
|
|
- //自定义列表页
|
|
|
- if (state.showPage.aloneList == true) {
|
|
|
- if (state.template.aloneList == []) {
|
|
|
- state.canSubmit = false;
|
|
|
- }
|
|
|
- }
|
|
|
- //自定义详情页
|
|
|
- if (state.showPage.aloneArticle == true) {
|
|
|
- if (state.template.aloneArticle == []) {
|
|
|
- state.canSubmit = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //最后判断一下是否可以提交
|
|
|
- if (state.canSubmit == ture) {
|
|
|
-
|
|
|
- } else {
|
|
|
- Message.error('您还有未构建的页面,请检查!');
|
|
|
- }
|
|
|
- },
|
|
|
//1.配置模块 end------------------------------------------------------------>
|
|
|
|
|
|
//2.获取站点信息 start------------------------------------------------------------>
|
|
@@ -1692,6 +1683,16 @@ const actions = {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ //2.13 批量创建广告位
|
|
|
+ addTwinAdPlace({ commit }, data) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ addTwinAdPlace(data).then(response => {
|
|
|
+ resolve(response)
|
|
|
+ }).catch(error => {
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
//2.构建网站json end------------------------------------------------------------>
|
|
|
}
|
|
|
|