|
@@ -8,10 +8,11 @@ const state = {
|
|
|
editWebsiteId: "",//当前编辑网站的id
|
|
|
stepStatus: true,//是否显示现在进行到哪一步:true=显示 false=不显示
|
|
|
//0.全局配置 end------------------------------------------------------------>
|
|
|
- //1.页面数据 start------------------------------------------------------------>
|
|
|
+
|
|
|
+ //1.画布数据 start------------------------------------------------------------>
|
|
|
pageStatus:1,//当前编辑哪个页面 1=首页 2=分类页 3=列表页 4=详情页 5=搜索页 6=自定义列表页 7=自定义详情页
|
|
|
menuType:1, //当前菜单显示板块还是组件 1=板块 2=组件
|
|
|
- pageData: { //准备提交到后台的数据
|
|
|
+ pageData: { //自助建站拖拽板块的数据,注意,这里并不是提交到后台的数据
|
|
|
index:[
|
|
|
|
|
|
],//首页
|
|
@@ -29,7 +30,8 @@ const state = {
|
|
|
// // { i: "0", x: 0, y: 0, w: 12, h: 2, content:""},
|
|
|
// // { i: "1", x: 0, y: 0, w: 12, h: 2, content:""},
|
|
|
// ],
|
|
|
- //1.页面数据 end------------------------------------------------------------>
|
|
|
+ //1.画布数据 end------------------------------------------------------------>
|
|
|
+
|
|
|
//2.站点数据 start------------------------------------------------------------>
|
|
|
webSiteInfo:"",//网站信息
|
|
|
webSiteMenu:"",//网站包含的导航池
|
|
@@ -40,6 +42,51 @@ const state = {
|
|
|
},
|
|
|
departmentList:"",//职能部门
|
|
|
//2.站点数据 end------------------------------------------------------------>
|
|
|
+
|
|
|
+ //3.网站数据 start------------------------------------------------------------>
|
|
|
+ webData:{
|
|
|
+ websiteId:"",//网站id
|
|
|
+ index:[
|
|
|
+ {
|
|
|
+ sectorName:"header",//板块名称
|
|
|
+ sectorId:"1",//板块id
|
|
|
+ sort:1,//排序 //1,2和最后一个是固定的 header,menu,footer
|
|
|
+ componentList:[
|
|
|
+ {
|
|
|
+ component_name:"mainTitle",//组件名称
|
|
|
+ sort:1,//排序
|
|
|
+ category_id:1,//导航池id
|
|
|
+ pageSize:1,//请求多少条
|
|
|
+ listType:[//希望返回什么样的数据
|
|
|
+ "title",//标题
|
|
|
+ "created_time",//发布时间
|
|
|
+ "author",//作者
|
|
|
+ "imgUrl",//缩略图图片
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sectorName:"menuSector",
|
|
|
+ sectorId:"2",
|
|
|
+ sort:2,
|
|
|
+ componentList:[]
|
|
|
+ },
|
|
|
+ { //最多只能添加13个模块,也就是说第1,2,13个是固定的
|
|
|
+ sectorName:"footerSector",
|
|
|
+ sectorId:"13",
|
|
|
+ sort:13,
|
|
|
+ componentList:[]
|
|
|
+ }
|
|
|
+ ],//首页
|
|
|
+ class:[],//分类页
|
|
|
+ list:[],//列表页
|
|
|
+ article:[],//详情页
|
|
|
+ search:[],//搜索页
|
|
|
+ aloneList:[],//自定义列表页
|
|
|
+ aloneArticle:[],//自定义详情页
|
|
|
+ }
|
|
|
+ //3.网站数据 end------------------------------------------------------------>
|
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
@@ -63,19 +110,26 @@ const mutations = {
|
|
|
//1.配置模块 start------------------------------------------------------------>
|
|
|
//添加首页板块
|
|
|
addIndexModule(state,data){
|
|
|
- //data.type 组件名称 data.h 模块高度
|
|
|
- // 计算当前布局的最大 y 值
|
|
|
- const maxY = Math.max(...state.pageData.index.map(item => item.y), 0);
|
|
|
- state.pageData.index.push({
|
|
|
- i: state.pageData.index.length,
|
|
|
- x: 0,
|
|
|
- y: maxY + 1,
|
|
|
- w: 12,
|
|
|
- h: data.h,
|
|
|
- type: data.type,
|
|
|
- content:""
|
|
|
- });
|
|
|
- console.log(state.pageData.index);
|
|
|
+ //判断当前一共有多少个模块最多能添加10个
|
|
|
+ if(state.pageData.index.length >= 10){
|
|
|
+ Message.error('最多只能添加10个模块!');
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ //data.type 组件名称 data.h 模块高度
|
|
|
+ // 计算当前布局的最大 y 值
|
|
|
+ const maxY = Math.max(...state.pageData.index.map(item => item.y), 0);
|
|
|
+ state.pageData.index.push({
|
|
|
+ i: state.pageData.index.length,
|
|
|
+ x: 0,
|
|
|
+ y: maxY + 1,
|
|
|
+ w: 12,
|
|
|
+ h: data.h,
|
|
|
+ type: data.type,
|
|
|
+ content:""
|
|
|
+ });
|
|
|
+ console.log(state.pageData.index);
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
//删除首页板块
|
|
|
deleteIndexModule(state,data){
|