|
@@ -1,5 +1,5 @@
|
|
|
//cms中的接口 获取网站基本信息,网站导航,网站底部导航,网站行政区划,行政职能
|
|
|
-import { getSiteInfo, getSiteCategory, getFooterCategoryList, selectWebsiteArea, selectWebsiteDepartment } from '@/api/cms'
|
|
|
+import { getSiteInfo, getSiteCategory, getFooterCategoryList} from '@/api/cms'
|
|
|
//自助建站的接口 用于添加基本信息
|
|
|
import {
|
|
|
getWebsiteintel, addWebsiteTemplateintel, getAdminSiteInfo, upWebsiteTemplateintel, getAllTemplateClass, getWebsiteTemplateList, addWebsiteTemplateclassintel,
|
|
@@ -20,6 +20,7 @@ import randomIndex2 from '@/utils/templateJson/index/style1/2.js';
|
|
|
const state = {
|
|
|
//0.全局配置 start------------------------------------------------------------>
|
|
|
editWebsiteId: "",//当前编辑网站的id
|
|
|
+ adKey: "",//当前编辑网站的缩写
|
|
|
editWebsiteClass: "",//当前编辑网站的风格
|
|
|
stepStatus: true,//是否显示现在进行到哪一步:true=显示 false=不显示
|
|
|
//0.全局配置 end------------------------------------------------------------>
|
|
@@ -30,7 +31,7 @@ const state = {
|
|
|
previewStatus: false,//是否预览
|
|
|
gridKey: 0,//使用gridKey来强制更新视图
|
|
|
loading: false,//是否显示加载中
|
|
|
- ad_id: "",//生成储存的广告id
|
|
|
+ ad_id: "",//生成储存的广告标识
|
|
|
showPage: { //哪些页面可以被展示
|
|
|
index: true,
|
|
|
class: true,
|
|
@@ -41,9 +42,7 @@ const state = {
|
|
|
aloneArticle: true
|
|
|
},
|
|
|
pageData: { //自助建站拖拽板块的数据,注意,这里并不是提交到后台的数据
|
|
|
- index: [
|
|
|
-
|
|
|
- ],//首页
|
|
|
+ index: [],//首页
|
|
|
class: [],//分类页
|
|
|
list: [],//列表页
|
|
|
article: [],//详情页
|
|
@@ -119,7 +118,17 @@ const state = {
|
|
|
article: [],//详情页
|
|
|
search: [],//搜索页
|
|
|
aloneList: [],//自定义列表页
|
|
|
- aloneArticle: [],//自定义详情页
|
|
|
+ aloneArticle: []//自定义详情页
|
|
|
+ },
|
|
|
+ //4.广告位
|
|
|
+ ad: {
|
|
|
+ index: [],
|
|
|
+ class: [],
|
|
|
+ list: [],
|
|
|
+ article: [],
|
|
|
+ search: [],
|
|
|
+ aloneList: [],
|
|
|
+ aloneArticle: []
|
|
|
}
|
|
|
},
|
|
|
canSubmit: false,//当前数据是否可以被提交
|
|
@@ -142,6 +151,10 @@ const mutations = {
|
|
|
setEditWebsiteId(state, id) {
|
|
|
state.editWebsiteId = id;
|
|
|
},
|
|
|
+ //设置网站缩写
|
|
|
+ setAdKey(state, key) {
|
|
|
+ state.adKey = key;
|
|
|
+ },
|
|
|
//设置网站的风格
|
|
|
setClassNumber(state, id) {
|
|
|
state.editWebsiteClass = id;
|
|
@@ -213,7 +226,8 @@ const mutations = {
|
|
|
}
|
|
|
//2=设置广告名称
|
|
|
if (state.editComponentType == 2) {
|
|
|
- state.componentViewData.adName = state.pageData.index[targetModuleIndex].content.componentList[data.sort].componentData.text;
|
|
|
+ //state.componentViewData.adName = state.pageData.index[targetModuleIndex].content.componentList[data.sort].componentData.text;
|
|
|
+ state.componentViewData.adName = state.pageData.index[targetModuleIndex].content.ad.name;
|
|
|
}
|
|
|
}
|
|
|
//pageStatus==2 分类页
|
|
@@ -254,19 +268,21 @@ const mutations = {
|
|
|
//pageStatus==7 底部详情页
|
|
|
if (state.pageStatus == 7) {}
|
|
|
},
|
|
|
- //生成一个随机的广告id
|
|
|
- getRandomAdid(state) {
|
|
|
- //网站id
|
|
|
- const websiteId = state.editWebsiteId;
|
|
|
- // 生成 3 个随机字母 (a-z)
|
|
|
- const randomLettersOne = Math.random().toString(36).substring(2, 5); // 生成随机字母并去除前面的 "0."
|
|
|
- // 获取当前时间戳(毫秒级)
|
|
|
- const timestamp = Date.now();
|
|
|
- // 生成 5 个随机字母 (a-z)
|
|
|
- const randomLettersTwo = Math.random().toString(36).substring(2, 7); // 生成随机字母并去除前面的 "0."
|
|
|
- // 拼接时间戳和随机字母生成唯一 ID
|
|
|
- const ad_id = `${websiteId}${randomLettersOne}${timestamp}${randomLettersTwo}`;
|
|
|
- state.ad_id = ad_id;
|
|
|
+ //生成广告id
|
|
|
+ getAdkey(state,sort) {
|
|
|
+
|
|
|
+ },
|
|
|
+ //清空广告位
|
|
|
+ clearAd(state) {
|
|
|
+ state.webSiteData.ad = {
|
|
|
+ index: [],
|
|
|
+ class: [],
|
|
|
+ list: [],
|
|
|
+ article: [],
|
|
|
+ search: [],
|
|
|
+ aloneList: [],
|
|
|
+ aloneArticle: []
|
|
|
+ }
|
|
|
},
|
|
|
//0.全局配置 start------------------------------------------------------------>
|
|
|
//1.配置模块 start------------------------------------------------------------>
|
|
@@ -298,36 +314,18 @@ const mutations = {
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.index.length;
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
- this.commit("template/getRandomAdid")
|
|
|
- //添加板块id
|
|
|
- state.pageData.index.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- adid: state.ad_id,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- } else {
|
|
|
- state.pageData.index.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- }
|
|
|
+ state.pageData.index.push({
|
|
|
+ //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
+ i: id,
|
|
|
+ x: 0,
|
|
|
+ y: maxY + 1,
|
|
|
+ w: 12,
|
|
|
+ h: data.h,
|
|
|
+ type: data.type,
|
|
|
+ //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
+ content: data.jsonData,
|
|
|
+ dataSort: dataSort,
|
|
|
+ });
|
|
|
console.log("当前添加模块的dataSort为:" + dataSort);
|
|
|
//当前的页面构建数据
|
|
|
console.log(state.pageData.index);
|
|
@@ -347,36 +345,18 @@ const mutations = {
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.index.length;
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
- this.commit("template/getRandomAdid")
|
|
|
- //添加板块id
|
|
|
- state.pageData.index.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: data.y,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- adid: state.ad_id,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- } else {
|
|
|
- state.pageData.index.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: data.y,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- }
|
|
|
+ state.pageData.index.push({
|
|
|
+ //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
+ i: id,
|
|
|
+ x: 0,
|
|
|
+ y: data.y,
|
|
|
+ w: 12,
|
|
|
+ h: data.h,
|
|
|
+ type: data.type,
|
|
|
+ //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
+ content: data.jsonData,
|
|
|
+ dataSort: dataSort,
|
|
|
+ });
|
|
|
console.log("当前添加模块的dataSort为:" + dataSort);
|
|
|
//当前的页面构建数据
|
|
|
console.log(state.pageData.index);
|
|
@@ -413,37 +393,18 @@ const mutations = {
|
|
|
console.log(data);
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.list.length;
|
|
|
- //判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
- this.commit("template/getRandomAdid")
|
|
|
- //添加板块id
|
|
|
- state.pageData.list.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- adid: state.ad_id,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- } else {
|
|
|
- state.pageData.list.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- }
|
|
|
+ state.pageData.list.push({
|
|
|
+ //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
+ i: id,
|
|
|
+ x: 0,
|
|
|
+ y: maxY + 1,
|
|
|
+ w: 12,
|
|
|
+ h: data.h,
|
|
|
+ type: data.type,
|
|
|
+ //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
+ content: data.jsonData,
|
|
|
+ dataSort: dataSort,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
//drag=拖拽
|
|
@@ -459,37 +420,18 @@ const mutations = {
|
|
|
console.log(data);
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.list.length;
|
|
|
- //判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
- this.commit("template/getRandomAdid")
|
|
|
- //添加板块id
|
|
|
- state.pageData.list.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- adid: state.ad_id,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- } else {
|
|
|
- state.pageData.list.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- }
|
|
|
+ state.pageData.list.push({
|
|
|
+ //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
+ i: id,
|
|
|
+ x: 0,
|
|
|
+ y: maxY + 1,
|
|
|
+ w: 12,
|
|
|
+ h: data.h,
|
|
|
+ type: data.type,
|
|
|
+ //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
+ content: data.jsonData,
|
|
|
+ dataSort: dataSort,
|
|
|
+ });
|
|
|
console.log("当前添加模块的dataSort为:" + dataSort);
|
|
|
//当前的页面构建数据
|
|
|
console.log(state.pageData.list);
|
|
@@ -510,14 +452,6 @@ const mutations = {
|
|
|
Message.error('最多只能添加10个模块!');
|
|
|
return;
|
|
|
} else {
|
|
|
- //判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
- //生成一个随机的ad_id给广告模块
|
|
|
- this.commit("template/getRandomAdid");
|
|
|
- console.log("添加广告模块!id为:" + state.ad_id)
|
|
|
- data.jsonData.componentList[0].componentData.ad_id = state.ad_id;
|
|
|
- }
|
|
|
-
|
|
|
//判断是拖拽的还是点击添加进来的 click=点击
|
|
|
if (data.source == "click") {
|
|
|
console.log("通过点击添加一个板块");
|
|
@@ -530,37 +464,18 @@ const mutations = {
|
|
|
console.log(data);
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.article.length;
|
|
|
- //判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
- this.commit("template/getRandomAdid")
|
|
|
- //添加板块id
|
|
|
- state.pageData.article.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- adid: state.ad_id,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- } else {
|
|
|
- state.pageData.article.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- }
|
|
|
+ state.pageData.article.push({
|
|
|
+ //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
+ i: id,
|
|
|
+ x: 0,
|
|
|
+ y: maxY + 1,
|
|
|
+ w: 12,
|
|
|
+ h: data.h,
|
|
|
+ type: data.type,
|
|
|
+ //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
+ content: data.jsonData,
|
|
|
+ dataSort: dataSort,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
//drag=拖拽
|
|
@@ -576,37 +491,18 @@ const mutations = {
|
|
|
console.log(data);
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.article.length;
|
|
|
- //判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
- this.commit("template/getRandomAdid")
|
|
|
- //添加板块id
|
|
|
- state.pageData.article.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- adid: state.ad_id,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- } else {
|
|
|
- state.pageData.article.push({
|
|
|
- //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
- i: id,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
- content: data.jsonData,
|
|
|
- dataSort: dataSort,
|
|
|
- });
|
|
|
- }
|
|
|
+ state.pageData.article.push({
|
|
|
+ //i: state.pageData.index.length, //base 0.0.1 此方法会导致重复的id出现
|
|
|
+ i: id,
|
|
|
+ x: 0,
|
|
|
+ y: maxY + 1,
|
|
|
+ w: 12,
|
|
|
+ h: data.h,
|
|
|
+ type: data.type,
|
|
|
+ //sectorData:data.jsonData //base 0.0.1 此问题导致深层数据无法被视图渲染
|
|
|
+ content: data.jsonData,
|
|
|
+ dataSort: dataSort,
|
|
|
+ });
|
|
|
console.log("当前添加模块的dataSort为:" + dataSort);
|
|
|
//当前的页面构建数据
|
|
|
console.log(state.pageData.article);
|
|
@@ -864,10 +760,14 @@ const mutations = {
|
|
|
//2=广告
|
|
|
if (state.editComponentType == 2) {
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.index[targetModuleIndex]));
|
|
|
- module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
+ //module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
+ module.content.ad.name = data.data.adName;
|
|
|
Vue.set(state.pageData.index, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.index);
|
|
|
+ //设置用于回显的广告名,否则会导致回显的广告名和实际的广告名不一致
|
|
|
+ //因为广告名没有默认值,这会导致watch监听不到,所以这里需要手动设置
|
|
|
+ state.componentViewData.adName = data.data.adName;
|
|
|
}
|
|
|
//开始复制 end------------------------------------------------------------>
|
|
|
}
|
|
@@ -900,10 +800,12 @@ const mutations = {
|
|
|
//2=广告
|
|
|
if (state.editComponentType == 2) {
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.list[targetModuleIndex]));
|
|
|
- module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
+ //module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
+ module.content.ad.name = data.data.adName;
|
|
|
Vue.set(state.pageData.list, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.list);
|
|
|
+ state.componentViewData.adName = data.data.adName;
|
|
|
}
|
|
|
//开始复制 end------------------------------------------------------------>
|
|
|
}
|
|
@@ -933,10 +835,12 @@ const mutations = {
|
|
|
//2=广告
|
|
|
if (state.editComponentType == 2) {
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.article[targetModuleIndex]));
|
|
|
- module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
+ //module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
+ module.content.ad.name = data.data.adName;
|
|
|
Vue.set(state.pageData.article, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.article);
|
|
|
+ state.componentViewData.adName = data.data.adName;
|
|
|
}
|
|
|
//开始复制 end------------------------------------------------------------>
|
|
|
}
|
|
@@ -1317,17 +1221,32 @@ const mutations = {
|
|
|
},
|
|
|
//格式化模板信息
|
|
|
formatTemplateInfo(state, data) {
|
|
|
+ //1.处理广告位
|
|
|
+ //先把广告位的数据清空,再重新获取
|
|
|
+ //this.commit('template/clearAd');
|
|
|
// 深拷贝数据,避免直接修改原数据
|
|
|
let clonedData = JSON.parse(JSON.stringify(data));
|
|
|
- // 把ad_id传进去
|
|
|
- for (let item of clonedData.data) {
|
|
|
- if (item.adid) {
|
|
|
- item.content.componentList[0].componentData.ad_id = item.adid;
|
|
|
- }
|
|
|
- }
|
|
|
// 按照 clonedData.data.y 的大小排序
|
|
|
clonedData.data.sort((a, b) => a.y - b.y);
|
|
|
- //console.log(clonedData, clonedData);
|
|
|
+ // 取出每个通栏中的广告,并保存到state.webSiteData.ad中
|
|
|
+ for (let index in clonedData.data) {
|
|
|
+ if(clonedData.data[index].content.ad){
|
|
|
+ let pageName = "";
|
|
|
+ if(state.pageStatus==1){pageName = "index";}
|
|
|
+ if(state.pageStatus==2){pageName = "category";}
|
|
|
+ if(state.pageStatus==3){pageName = "list";}
|
|
|
+ if(state.pageStatus==4){pageName = "detail";}
|
|
|
+ if(state.pageStatus==5){pageName = "search";}
|
|
|
+ if(state.pageStatus==6){pageName = "page";}
|
|
|
+ if(state.pageStatus==7){pageName = "page";}
|
|
|
+ let ad_index = Number(index)+1;
|
|
|
+ let ad_tag = `${state.adKey}_${pageName}_${ad_index}`;
|
|
|
+ clonedData.data[index].content.ad.website_id = state.editWebsiteId;
|
|
|
+ clonedData.data[index].content.ad.ad_tag = ad_tag;
|
|
|
+ state.webSiteData.ad[data.type].push(clonedData.data[index].content.ad);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let websiteData = [];
|
|
|
// 获取板块的 sort
|
|
|
for (let index = 0; index < clonedData.data.length; index++) {
|
|
@@ -1356,6 +1275,8 @@ const mutations = {
|
|
|
//临时展示保存的数据 后期移除
|
|
|
state.editWebsiteTemplateJsonWindow = true;
|
|
|
//调用mutations中的方法无需使用$store
|
|
|
+ //每次格式化之前先清理广告位数据
|
|
|
+ this.commit('template/clearAd');
|
|
|
//格式化index的信息
|
|
|
this.commit('template/formatTemplateInfo', { data: state.pageData.index, type: "index" });
|
|
|
//格式化list的信息
|
|
@@ -1576,28 +1497,6 @@ const actions = {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- //1.4 获取行政区划
|
|
|
- selectWebsiteArea({ commit }, data) {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- selectWebsiteArea(data).then(response => {
|
|
|
- commit('setArea', response.data);
|
|
|
- resolve(response)
|
|
|
- }).catch(error => {
|
|
|
- reject(error)
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- //1.5 获取所有职能部门
|
|
|
- selectWebsiteDepartment({ commit }, data) {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- selectWebsiteDepartment(data).then(response => {
|
|
|
- commit('setDepartment', response.data);
|
|
|
- resolve(response)
|
|
|
- }).catch(error => {
|
|
|
- reject(error)
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
//1.显示画板组件数据 end------------------------------------------------------------>
|
|
|
|
|
|
//2.构建网站json start------------------------------------------------------------>
|
|
@@ -1626,6 +1525,7 @@ const actions = {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
getAdminSiteInfo(data).then(response => {
|
|
|
commit('setWebsiteInfo', response.data);
|
|
|
+ commit('setAdKey', response.data.ad_key);
|
|
|
resolve(response)
|
|
|
}).catch(error => {
|
|
|
reject(error)
|