|
@@ -97,7 +97,8 @@ const state = {
|
|
|
editDataSort: 0,//当前正在编辑的数据位置
|
|
|
editComponentSort: 0,//当前正在编辑的组件id
|
|
|
editComponentType: 0,//当前正在编辑的组件类型
|
|
|
- editComponentSize: 0,//当前组件展示的条数
|
|
|
+ editComponentSize: 0,//当前组件文字新闻数量
|
|
|
+ editComponentSizeImg:0,//当前组件图片新闻数量
|
|
|
editComponentStyle: 0,//当前编辑的组件样式
|
|
|
editWebsiteCategory: [],//当前网站全部关联导航
|
|
|
webSiteData: {
|
|
@@ -127,7 +128,8 @@ const state = {
|
|
|
//5.组件回显数据 start------------------------------------------------------------>
|
|
|
componentViewData: {
|
|
|
pid_arr: [],//导航池
|
|
|
- pageSize: "",//展示条数
|
|
|
+ pageSize: "",//展示文字新闻条数
|
|
|
+ pageSizeImg: "",//展示图片新闻条数
|
|
|
adName: "",//广告名称
|
|
|
titleName: "",//标题名称
|
|
|
}
|
|
@@ -169,6 +171,7 @@ const mutations = {
|
|
|
state.editComponentSort = data.sort;
|
|
|
state.editComponentType = data.type;
|
|
|
state.editComponentSize = data.size;
|
|
|
+ state.editComponentSizeImg = data.sizeImg;
|
|
|
},
|
|
|
//关闭编辑组件弹出框
|
|
|
closeEditWindowStatus(state) {
|
|
@@ -201,78 +204,55 @@ const mutations = {
|
|
|
if (state.pageStatus == 1) {
|
|
|
//找到要修改的板块
|
|
|
const targetModuleIndex = state.pageData.index.findIndex(module => module.i === data.id);
|
|
|
- //判断组件类型 1=普通新闻 2=tabs新闻选项卡 3=广告 4=友情链接 6=静态组件 7=文本 8=评论
|
|
|
+ //判断组件类型 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.pageSize = state.editComponentSize;
|
|
|
+ state.componentViewData.pageSizeImg = state.editComponentSizeImg;
|
|
|
}
|
|
|
- //2=tabs新闻选项卡
|
|
|
+ //2=设置广告名称
|
|
|
if (state.editComponentType == 2) {
|
|
|
- state.componentViewData.pid_arr = state.pageData.index[targetModuleIndex].content.componentList[data.sort].componentData.category_id;
|
|
|
- state.componentViewData.pageSize = state.editComponentSize;
|
|
|
- }
|
|
|
- //3=广告名称
|
|
|
- if (state.editComponentType == 3) {
|
|
|
state.componentViewData.adName = state.pageData.index[targetModuleIndex].content.componentList[data.sort].componentData.text;
|
|
|
}
|
|
|
- //7=标题
|
|
|
- if (state.editComponentType == 7) {
|
|
|
- state.componentViewData.titleName = state.pageData.index[targetModuleIndex].content.componentList[data.sort].componentData.text;
|
|
|
- }
|
|
|
}
|
|
|
//pageStatus==2 分类页
|
|
|
- if (state.pageStatus == 2) { }
|
|
|
+ if (state.pageStatus == 2) {}
|
|
|
//pageStatus==3 列表页
|
|
|
if (state.pageStatus == 3) {
|
|
|
const targetModuleIndex = state.pageData.list.findIndex(module => module.i === data.id);
|
|
|
- //判断组件类型 1=普通新闻 2=tabs新闻选项卡 3=广告 4=友情链接 6=静态组件 7=文本 8=评论
|
|
|
+ //判断组件类型 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.pageSize = state.editComponentSize;
|
|
|
+ state.componentViewData.pageSizeImg = state.editComponentSizeImg;
|
|
|
}
|
|
|
- //2=tabs新闻选项卡
|
|
|
+ //2=设置广告名称
|
|
|
if (state.editComponentType == 2) {
|
|
|
- state.componentViewData.pid_arr = state.pageData.list[targetModuleIndex].content.componentList[data.sort].componentData.category_id;
|
|
|
- state.componentViewData.pageSize = state.editComponentSize;
|
|
|
- }
|
|
|
- //3=广告名称
|
|
|
- if (state.editComponentType == 3) {
|
|
|
state.componentViewData.adName = state.pageData.list[targetModuleIndex].content.componentList[data.sort].componentData.text;
|
|
|
}
|
|
|
- //7=标题
|
|
|
- if (state.editComponentType == 7) {
|
|
|
- state.componentViewData.titleName = state.pageData.list[targetModuleIndex].content.componentList[data.sort].componentData.text;
|
|
|
- }
|
|
|
}
|
|
|
//pageStatus==4 详情页
|
|
|
if (state.pageStatus == 4) {
|
|
|
-
|
|
|
const targetModuleIndex = state.pageData.article.findIndex(module => module.i === data.id);
|
|
|
- //判断组件类型 1=普通新闻 2=tabs新闻选项卡 3=广告 4=友情链接 6=静态组件 7=文本 8=评论
|
|
|
+ //判断组件类型 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.pageSize = state.editComponentSize;
|
|
|
}
|
|
|
- //2=tabs新闻选项卡
|
|
|
+ //2=设置广告名称
|
|
|
if (state.editComponentType == 2) {
|
|
|
- state.componentViewData.pid_arr = state.pageData.article[targetModuleIndex].content.componentList[data.sort].componentData.category_id;
|
|
|
- state.componentViewData.pageSize = state.editComponentSize;
|
|
|
- }
|
|
|
- //3=广告名称
|
|
|
- if (state.editComponentType == 3) {
|
|
|
state.componentViewData.adName = state.pageData.article[targetModuleIndex].content.componentList[data.sort].componentData.text;
|
|
|
}
|
|
|
- //7=标题
|
|
|
- if (state.editComponentType == 7) {
|
|
|
- state.componentViewData.titleName = state.pageData.article[targetModuleIndex].content.componentList[data.sort].componentData.text;
|
|
|
- }
|
|
|
}
|
|
|
//pageStatus==5 搜索页
|
|
|
- if (state.pageStatus == 5) { }
|
|
|
- //pageStatus==6 自定义列表页
|
|
|
- if (state.pageStatus == 6) { }
|
|
|
- //pageStatus==7 自定义详情页
|
|
|
- if (state.pageStatus == 7) { }
|
|
|
+ if (state.pageStatus == 5) {}
|
|
|
+ //pageStatus==6 底部列表页
|
|
|
+ if (state.pageStatus == 6) {}
|
|
|
+ //pageStatus==7 底部详情页
|
|
|
+ if (state.pageStatus == 7) {}
|
|
|
},
|
|
|
//生成一个随机的广告id
|
|
|
getRandomAdid(state) {
|
|
@@ -318,7 +298,7 @@ const mutations = {
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.index.length;
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 3) {
|
|
|
+ if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
this.commit("template/getRandomAdid")
|
|
|
//添加板块id
|
|
|
state.pageData.index.push({
|
|
@@ -367,7 +347,7 @@ const mutations = {
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.index.length;
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 3) {
|
|
|
+ if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
this.commit("template/getRandomAdid")
|
|
|
//添加板块id
|
|
|
state.pageData.index.push({
|
|
@@ -434,7 +414,7 @@ const mutations = {
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.list.length;
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 3) {
|
|
|
+ if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
this.commit("template/getRandomAdid")
|
|
|
//添加板块id
|
|
|
state.pageData.list.push({
|
|
@@ -480,7 +460,7 @@ const mutations = {
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.list.length;
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 3) {
|
|
|
+ if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
this.commit("template/getRandomAdid")
|
|
|
//添加板块id
|
|
|
state.pageData.list.push({
|
|
@@ -531,7 +511,7 @@ const mutations = {
|
|
|
return;
|
|
|
} else {
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 3) {
|
|
|
+ if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
//生成一个随机的ad_id给广告模块
|
|
|
this.commit("template/getRandomAdid");
|
|
|
console.log("添加广告模块!id为:" + state.ad_id)
|
|
@@ -551,7 +531,7 @@ const mutations = {
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.article.length;
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 3) {
|
|
|
+ if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
this.commit("template/getRandomAdid")
|
|
|
//添加板块id
|
|
|
state.pageData.article.push({
|
|
@@ -597,7 +577,7 @@ const mutations = {
|
|
|
//设置数据在构建json中的位置
|
|
|
let dataSort = state.pageData.article.length;
|
|
|
//判断添加的是否为广告模块 如果是 添加一个ad_id
|
|
|
- if (data.jsonData.componentList[0].component_type == 3) {
|
|
|
+ if (data.jsonData.componentList[0].component_type == 2) {
|
|
|
this.commit("template/getRandomAdid")
|
|
|
//添加板块id
|
|
|
state.pageData.article.push({
|
|
@@ -654,19 +634,43 @@ const mutations = {
|
|
|
if (state.pageStatus == 1) {
|
|
|
//开始复制 start------------------------------------------------------------>
|
|
|
//必须通过重新查找id的方式来删除
|
|
|
- const indexToRemove = state.pageData.index.findIndex(item => item.i === data.i);
|
|
|
- if (indexToRemove !== -1) {
|
|
|
- state.pageData.index.splice(indexToRemove, 1);
|
|
|
- Message.success('模块已删除!');
|
|
|
- console.log('模块已删除,当前的页面构建数据为:', state.pageData.index);
|
|
|
- } else {
|
|
|
- Message.warning('未找到要删除的模块!');
|
|
|
- }
|
|
|
+ // const indexToRemove = state.pageData.index.findIndex(item => item.i === data.i);
|
|
|
+ // if (indexToRemove !== -1) {
|
|
|
+ // state.pageData.index.splice(indexToRemove, 1);
|
|
|
+ // Message.success('模块已删除!');
|
|
|
+ // console.log('模块已删除,当前的页面构建数据为:', state.pageData.index);
|
|
|
+ // } else {
|
|
|
+ // Message.warning('未找到要删除的模块!');
|
|
|
+ // }
|
|
|
//开始复制 end------------------------------------------------------------>
|
|
|
// base 0.0.2 如果使用splice方法删除sort,当你就剩下最后一个的时候,会出现找不到那个元素的问题
|
|
|
// state.pageData.index.splice(data.dataSort,1);
|
|
|
// Message.success('模块已删除!');
|
|
|
// console.log(state.pageData.index);
|
|
|
+ // 深拷贝整个数组
|
|
|
+ try {
|
|
|
+ // 1. 先找到要删除的模块
|
|
|
+ const indexToRemove = state.pageData.index.findIndex(item => item.i === data.i);
|
|
|
+ if (indexToRemove === -1) {
|
|
|
+ Message.warning('未找到要删除的模块!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 2. 创建新的数组,不包含要删除的模块
|
|
|
+ const newModules = state.pageData.index.filter(item => item.i !== data.i);
|
|
|
+ // 3. 重新计算所有模块的 dataSort
|
|
|
+ newModules.forEach((module, index) => {
|
|
|
+ module.dataSort = index;
|
|
|
+ });
|
|
|
+ // 4. 使用 Vue.set 更新整个数组
|
|
|
+ Vue.set(state.pageData, 'index', newModules);
|
|
|
+ // 5. 强制更新 gridKey 以触发视图重新渲染
|
|
|
+ state.gridKey += 1;
|
|
|
+ Message.success('模块已删除!');
|
|
|
+ console.log('模块已删除,当前的页面构建数据为:', state.pageData.index);
|
|
|
+ } catch (error) {
|
|
|
+ console.error('删除模块时发生错误:', error);
|
|
|
+ Message.error('删除模块时发生错误,请重试!');
|
|
|
+ }
|
|
|
}
|
|
|
//pageStatus==2 分类页
|
|
|
if (state.pageStatus == 2) { }
|
|
@@ -674,13 +678,36 @@ const mutations = {
|
|
|
if (state.pageStatus == 3) {
|
|
|
//开始复制 start------------------------------------------------------------>
|
|
|
//必须通过重新查找id的方式来删除
|
|
|
- const indexToRemove = state.pageData.list.findIndex(item => item.i === data.i);
|
|
|
- if (indexToRemove !== -1) {
|
|
|
- state.pageData.list.splice(indexToRemove, 1);
|
|
|
+ // const indexToRemove = state.pageData.list.findIndex(item => item.i === data.i);
|
|
|
+ // if (indexToRemove !== -1) {
|
|
|
+ // state.pageData.list.splice(indexToRemove, 1);
|
|
|
+ // Message.success('模块已删除!');
|
|
|
+ // console.log('模块已删除,当前的页面构建数据为:', state.pageData.list);
|
|
|
+ // } else {
|
|
|
+ // Message.warning('未找到要删除的模块!');
|
|
|
+ // }
|
|
|
+ try {
|
|
|
+ // 1. 先找到要删除的模块
|
|
|
+ const indexToRemove = state.pageData.list.findIndex(item => item.i === data.i);
|
|
|
+ if (indexToRemove === -1) {
|
|
|
+ Message.warning('未找到要删除的模块!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 2. 创建新的数组,不包含要删除的模块
|
|
|
+ const newModules = state.pageData.list.filter(item => item.i !== data.i);
|
|
|
+ // 3. 重新计算所有模块的 dataSort
|
|
|
+ newModules.forEach((module, index) => {
|
|
|
+ module.dataSort = index;
|
|
|
+ });
|
|
|
+ // 4. 使用 Vue.set 更新整个数组
|
|
|
+ Vue.set(state.pageData, 'list', newModules);
|
|
|
+ // 5. 强制更新 gridKey 以触发视图重新渲染
|
|
|
+ state.gridKey += 1;
|
|
|
Message.success('模块已删除!');
|
|
|
console.log('模块已删除,当前的页面构建数据为:', state.pageData.list);
|
|
|
- } else {
|
|
|
- Message.warning('未找到要删除的模块!');
|
|
|
+ } catch (error) {
|
|
|
+ console.error('删除模块时发生错误:', error);
|
|
|
+ Message.error('删除模块时发生错误,请重试!');
|
|
|
}
|
|
|
//开始复制 end------------------------------------------------------------>
|
|
|
}
|
|
@@ -688,15 +715,38 @@ const mutations = {
|
|
|
if (state.pageStatus == 4) {
|
|
|
//开始复制 start------------------------------------------------------------>
|
|
|
//必须通过重新查找id的方式来删除
|
|
|
- const indexToRemove = state.pageData.article.findIndex(item => item.i === data.i);
|
|
|
- if (indexToRemove !== -1) {
|
|
|
- state.pageData.article.splice(indexToRemove, 1);
|
|
|
+ // const indexToRemove = state.pageData.article.findIndex(item => item.i === data.i);
|
|
|
+ // if (indexToRemove !== -1) {
|
|
|
+ // state.pageData.article.splice(indexToRemove, 1);
|
|
|
+ // Message.success('模块已删除!');
|
|
|
+ // console.log('模块已删除,当前的页面构建数据为:', state.pageData.article);
|
|
|
+ // } else {
|
|
|
+ // Message.warning('未找到要删除的模块!');
|
|
|
+ // }
|
|
|
+ //开始复制 end------------------------------------------------------------>
|
|
|
+ try {
|
|
|
+ // 1. 先找到要删除的模块
|
|
|
+ const indexToRemove = state.pageData.article.findIndex(item => item.i === data.i);
|
|
|
+ if (indexToRemove === -1) {
|
|
|
+ Message.warning('未找到要删除的模块!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 2. 创建新的数组,不包含要删除的模块
|
|
|
+ const newModules = state.pageData.article.filter(item => item.i !== data.i);
|
|
|
+ // 3. 重新计算所有模块的 dataSort
|
|
|
+ newModules.forEach((module, index) => {
|
|
|
+ module.dataSort = index;
|
|
|
+ });
|
|
|
+ // 4. 使用 Vue.set 更新整个数组
|
|
|
+ Vue.set(state.pageData, 'list', newModules);
|
|
|
+ // 5. 强制更新 gridKey 以触发视图重新渲染
|
|
|
+ state.gridKey += 1;
|
|
|
Message.success('模块已删除!');
|
|
|
console.log('模块已删除,当前的页面构建数据为:', state.pageData.article);
|
|
|
- } else {
|
|
|
- Message.warning('未找到要删除的模块!');
|
|
|
+ } catch (error) {
|
|
|
+ console.error('删除模块时发生错误:', error);
|
|
|
+ Message.error('删除模块时发生错误,请重试!');
|
|
|
}
|
|
|
- //开始复制 end------------------------------------------------------------>
|
|
|
}
|
|
|
//pageStatus==5 搜索页
|
|
|
if (state.pageStatus == 5) { }
|
|
@@ -789,69 +839,45 @@ const mutations = {
|
|
|
console.log("要修改的模块id为:") //找到要修改的板块
|
|
|
console.log(data.sort) //找到要修改的板块
|
|
|
console.log(targetModuleIndex) //找到要修改的板块
|
|
|
- //console.log(targetModuleIndex) //找到要修改的板块
|
|
|
- //state.pageData.index[targetModuleIndex].content.componentList[data.sort] //当前编辑的组件
|
|
|
- //data.data.pid_arr //导航池
|
|
|
- //state.editComponentSize //展示条数
|
|
|
|
|
|
- //判断数据的类型 1=普通新闻 2=tabs新闻选项卡 3=广告 4=友情链接 6=静态组件 7=文本 8=评论
|
|
|
- //1=普通新闻
|
|
|
+ //组件类型 1=新闻 2=广告
|
|
|
+
|
|
|
//注意,vue有一个bug就是,当你修改复杂对象的时候,如果对象的内部是数组
|
|
|
//vue可能无法检测到变化,而当你修改无法被检测变化的数据时,就会把所有数据都修改成相同的值
|
|
|
//解决办法是通过vue的set方法将整个对象,即你的数组外层那个对象进行深拷贝,然后修改完再替换回去
|
|
|
+
|
|
|
+ //1=新闻
|
|
|
if (state.editComponentType == 1) {
|
|
|
// 获取当前模块数据并进行深拷贝
|
|
|
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.pageSize = state.editComponentSize; // 设置 pageSize
|
|
|
+ module.content.componentList[data.sort].componentData.textSize = state.editComponentSize; // 设置 pageSize
|
|
|
+ module.content.componentList[data.sort].componentData.imgSize = state.editComponentSizeImg; // 设置 pageSize
|
|
|
+
|
|
|
// 使用Vue.set来强制视图更新
|
|
|
Vue.set(state.pageData.index, targetModuleIndex, module); // 替换为深拷贝的模块
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.index);
|
|
|
}
|
|
|
- //2=tabs新闻选项卡
|
|
|
+ //2=广告
|
|
|
if (state.editComponentType == 2) {
|
|
|
- // 获取当前模块数据并进行深拷贝
|
|
|
- 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.pageSize = state.editComponentSize; // 设置 pageSize
|
|
|
- // 使用Vue.set来强制视图更新
|
|
|
- Vue.set(state.pageData.index, targetModuleIndex, module); // 替换为深拷贝的模块
|
|
|
- console.log("当前的板块数据为:");
|
|
|
- console.log(state.pageData.index);
|
|
|
- }
|
|
|
- //3=广告
|
|
|
- if (state.editComponentType == 3) {
|
|
|
- ;
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.index[targetModuleIndex]));
|
|
|
module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
Vue.set(state.pageData.index, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.index);
|
|
|
}
|
|
|
- //4=友情链接
|
|
|
- //if(state.editComponentType == 4){}
|
|
|
- //6=静态组件
|
|
|
- //if(state.editComponentType == 6){}
|
|
|
- //7=文本
|
|
|
- if (state.editComponentType == 7) {
|
|
|
- let module = JSON.parse(JSON.stringify(state.pageData.index[targetModuleIndex]));
|
|
|
- module.content.componentList[data.sort].componentData.text = data.data.titleName;
|
|
|
- Vue.set(state.pageData.index, targetModuleIndex, module);
|
|
|
- console.log("当前的板块数据为:");
|
|
|
- console.log(state.pageData.index);
|
|
|
- }
|
|
|
- //8=评论
|
|
|
- //if(state.editComponentType == 8){}
|
|
|
//开始复制 end------------------------------------------------------------>
|
|
|
}
|
|
|
- //pageStatus==2 分类页
|
|
|
- if (state.pageStatus == 2) { }
|
|
|
+
|
|
|
+ //pageStatus==2 频道页
|
|
|
+ if (state.pageStatus == 2) {}
|
|
|
+
|
|
|
//pageStatus==3 列表页
|
|
|
if (state.pageStatus == 3) {
|
|
|
//开始复制 start------------------------------------------------------------>
|
|
|
+ //1=新闻
|
|
|
const targetModuleIndex = state.pageData.list.findIndex(module => module.i === data.id);
|
|
|
console.log("要修改的模块id为:") //找到要修改的板块
|
|
|
console.log(data.sort) //找到要修改的板块
|
|
@@ -861,43 +887,26 @@ 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.pageSize = state.editComponentSize; // 设置 pageSize
|
|
|
+ module.content.componentList[data.sort].componentData.textSize = state.editComponentSize; // 设置 pageSize
|
|
|
+ module.content.componentList[data.sort].componentData.imgSize = state.editComponentSizeImg; // 设置 pageSize
|
|
|
+
|
|
|
// 使用Vue.set来强制视图更新
|
|
|
Vue.set(state.pageData.list, targetModuleIndex, module); // 替换为深拷贝的模块
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.list);
|
|
|
}
|
|
|
- //2=tabs新闻选项卡
|
|
|
+ //2=广告
|
|
|
if (state.editComponentType == 2) {
|
|
|
- // 获取当前模块数据并进行深拷贝
|
|
|
- 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.pageSize = state.editComponentSize; // 设置 pageSize
|
|
|
- // 使用Vue.set来强制视图更新
|
|
|
- Vue.set(state.pageData.list, targetModuleIndex, module); // 替换为深拷贝的模块
|
|
|
- console.log("当前的板块数据为:");
|
|
|
- console.log(state.pageData.list);
|
|
|
- }
|
|
|
- //3=广告
|
|
|
- if (state.editComponentType == 3) {
|
|
|
- ;
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.list[targetModuleIndex]));
|
|
|
module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
Vue.set(state.pageData.list, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.list);
|
|
|
}
|
|
|
- //7=文本
|
|
|
- if (state.editComponentType == 7) {
|
|
|
- let module = JSON.parse(JSON.stringify(state.pageData.list[targetModuleIndex]));
|
|
|
- module.content.componentList[data.sort].componentData.text = data.data.titleName;
|
|
|
- Vue.set(state.pageData.list, targetModuleIndex, module);
|
|
|
- console.log("当前的板块数据为:");
|
|
|
- console.log(state.pageData.list);
|
|
|
- }
|
|
|
//开始复制 end------------------------------------------------------------>
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//pageStatus==4 详情页
|
|
|
if (state.pageStatus == 4) {
|
|
|
//开始复制 start------------------------------------------------------------>
|
|
@@ -910,49 +919,30 @@ 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.pageSize = state.editComponentSize; // 设置 pageSize
|
|
|
+ module.content.componentList[data.sort].componentData.textSize = state.editComponentSize; // 设置 pageSize
|
|
|
+ module.content.componentList[data.sort].componentData.imgSize = state.editComponentSizeImg; // 设置 pageSize
|
|
|
+
|
|
|
// 使用Vue.set来强制视图更新
|
|
|
Vue.set(state.pageData.article, targetModuleIndex, module); // 替换为深拷贝的模块
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.article);
|
|
|
}
|
|
|
- //2=tabs新闻选项卡
|
|
|
+ //2=广告
|
|
|
if (state.editComponentType == 2) {
|
|
|
- // 获取当前模块数据并进行深拷贝
|
|
|
- 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.pageSize = state.editComponentSize; // 设置 pageSize
|
|
|
- // 使用Vue.set来强制视图更新
|
|
|
- Vue.set(state.pageData.article, targetModuleIndex, module); // 替换为深拷贝的模块
|
|
|
- console.log("当前的板块数据为:");
|
|
|
- console.log(state.pageData.article);
|
|
|
- }
|
|
|
- //3=广告
|
|
|
- if (state.editComponentType == 3) {
|
|
|
- ;
|
|
|
let module = JSON.parse(JSON.stringify(state.pageData.article[targetModuleIndex]));
|
|
|
module.content.componentList[data.sort].componentData.text = data.data.adName;
|
|
|
Vue.set(state.pageData.article, targetModuleIndex, module);
|
|
|
console.log("当前的板块数据为:");
|
|
|
console.log(state.pageData.article);
|
|
|
}
|
|
|
- //7=文本
|
|
|
- if (state.editComponentType == 7) {
|
|
|
- let module = JSON.parse(JSON.stringify(state.pageData.article[targetModuleIndex]));
|
|
|
- module.content.componentList[data.sort].componentData.text = data.data.titleName;
|
|
|
- Vue.set(state.pageData.article, targetModuleIndex, module);
|
|
|
- console.log("当前的板块数据为:");
|
|
|
- console.log(state.pageData.article);
|
|
|
- }
|
|
|
//开始复制 end------------------------------------------------------------>
|
|
|
}
|
|
|
//pageStatus==5 搜索页
|
|
|
- if (state.pageStatus == 5) { }
|
|
|
- //pageStatus==6 自定义列表页
|
|
|
- if (state.pageStatus == 6) { }
|
|
|
- //pageStatus==7 自定义详情页
|
|
|
- if (state.pageStatus == 7) { }
|
|
|
+ if (state.pageStatus == 5) {}
|
|
|
+ //pageStatus==6 底部列表页
|
|
|
+ if (state.pageStatus == 6) {}
|
|
|
+ //pageStatus==7 底部详情页
|
|
|
+ if (state.pageStatus == 7) {}
|
|
|
},
|
|
|
//通过按钮移动板块 (暂时停用)
|
|
|
moveModule(state, data) {
|