|
@@ -2,15 +2,30 @@ import {getSiteInfo,getSiteCategory,selectWebsiteDepartment,selectWebsiteArea,ge
|
|
|
selectWebsiteArticleInfo} from '@/api/cms'
|
|
|
|
|
|
const state = {
|
|
|
- editWebsiteId: "",//创建网站的id
|
|
|
- stepStatus: true,//true显示步骤 false不显示
|
|
|
- menuType: "sector", //sector板块 component组件
|
|
|
- layout: [
|
|
|
- // i = id
|
|
|
- // w = 最大宽度是12
|
|
|
- // { i: "0", x: 0, y: 0, w: 12, h: 2, content:""},
|
|
|
- // { i: "1", x: 0, y: 0, w: 12, h: 2, content:""},
|
|
|
- ],
|
|
|
+ //0.全局配置 start------------------------------------------------------------>
|
|
|
+ editWebsiteId: "",//当前编辑网站的id
|
|
|
+ stepStatus: true,//是否显示现在进行到哪一步:true=显示 false=不显示
|
|
|
+ //0.全局配置 end------------------------------------------------------------>
|
|
|
+ //1.页面数据 start------------------------------------------------------------>
|
|
|
+ pageStatus:1,//当前编辑哪个页面 1=首页 2=分类页 3=列表页 4=详情页 5=搜索页 6=自定义列表页 7=自定义详情页
|
|
|
+ menuType:1, //当前菜单显示板块还是组件 1=板块 2=组件
|
|
|
+ pageData: { //准备提交到后台的数据
|
|
|
+ index:[],//首页
|
|
|
+ class:[],//分类页
|
|
|
+ list:[],//列表页
|
|
|
+ article:[],//详情页
|
|
|
+ search:[],//搜索页
|
|
|
+ aloneList:[],//自定义列表页
|
|
|
+ aloneArticle:[],//自定义详情页
|
|
|
+ },
|
|
|
+ // layout: [
|
|
|
+ // // i = id
|
|
|
+ // // w = 最大宽度是12
|
|
|
+ // // { i: "0", x: 0, y: 0, w: 12, h: 2, content:""},
|
|
|
+ // // { i: "1", x: 0, y: 0, w: 12, h: 2, content:""},
|
|
|
+ // ],
|
|
|
+ //1.页面数据 end------------------------------------------------------------>
|
|
|
+ //2.站点数据 start------------------------------------------------------------>
|
|
|
webSiteInfo:"",//网站信息
|
|
|
webSiteMenu:"",//网站包含的导航池
|
|
|
area:{//地区
|
|
@@ -19,6 +34,7 @@ const state = {
|
|
|
county:[]//县区
|
|
|
},
|
|
|
departmentList:"",//职能部门
|
|
|
+ //2.站点数据 end------------------------------------------------------------>
|
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
@@ -35,15 +51,18 @@ const mutations = {
|
|
|
hiddenStepStatus(state){
|
|
|
state.stepStatus = false;
|
|
|
},
|
|
|
+ setPageStatus(state,num){
|
|
|
+ state.pageStatus = num;
|
|
|
+ },
|
|
|
//0.全局配置 start------------------------------------------------------------>
|
|
|
//1.配置模块 start------------------------------------------------------------>
|
|
|
- //添加模块
|
|
|
- addModule(state,data) {
|
|
|
+ //添加首页板块
|
|
|
+ addIndexModule(state,data){
|
|
|
//data.type 组件名称 data.h 模块高度
|
|
|
// 计算当前布局的最大 y 值
|
|
|
- const maxY = Math.max(...state.layout.map(item => item.y), 0);
|
|
|
- state.layout.push({
|
|
|
- i: state.layout.length,
|
|
|
+ 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,
|
|
@@ -52,15 +71,44 @@ const mutations = {
|
|
|
content:""
|
|
|
});
|
|
|
},
|
|
|
- //删除模块
|
|
|
- deleteModule(item) {
|
|
|
- //找到对应的模块删除掉
|
|
|
- for(let i = 0; i < state.layout.length; i++) {
|
|
|
- if(state.layout[i].i == item.i) {
|
|
|
- state.layout.splice(i, 1);
|
|
|
+ //删除首页板块
|
|
|
+ deleteIndexModule(state,data){
|
|
|
+ for(let i = 0; i < state.pageData.index.length; i++) {
|
|
|
+ if(state.pageData.index[i].i == data.i) {
|
|
|
+ state.pageData.index.splice(i, 1);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ //修改首页板块高度
|
|
|
+ setIndexModuleHeight(state,data){
|
|
|
+ console.log(data);
|
|
|
+ state.pageData.index[data.i].h = data.h;
|
|
|
+ console.log(state.pageData.index[data.i]);
|
|
|
+ },
|
|
|
+ //添加模块
|
|
|
+ // addModule(state,data) {
|
|
|
+ // //data.type 组件名称 data.h 模块高度
|
|
|
+ // // 计算当前布局的最大 y 值
|
|
|
+ // const maxY = Math.max(...state.layout.map(item => item.y), 0);
|
|
|
+ // state.layout.push({
|
|
|
+ // i: state.layout.length,
|
|
|
+ // x: 0,
|
|
|
+ // y: maxY + 1,
|
|
|
+ // w: 12,
|
|
|
+ // h: data.h,
|
|
|
+ // type: data.type,
|
|
|
+ // content:""
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ //删除模块
|
|
|
+ // deleteModule(item) {
|
|
|
+ // //找到对应的模块删除掉
|
|
|
+ // for(let i = 0; i < state.layout.length; i++) {
|
|
|
+ // if(state.layout[i].i == item.i) {
|
|
|
+ // state.layout.splice(i, 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
//1.配置模块 end------------------------------------------------------------>
|
|
|
//2.获取站点信息 start------------------------------------------------------------>
|
|
|
//获取站点详情
|
|
@@ -90,16 +138,11 @@ const mutations = {
|
|
|
setDepartmentList(state,data){
|
|
|
state.departmentList = data;
|
|
|
},
|
|
|
- //修改模块高度
|
|
|
- setModuleHeight(state,data){
|
|
|
- console.log(data);
|
|
|
- state.layout[data.i].h = data.h;
|
|
|
- console.log(state.layout[data.i]);
|
|
|
- },
|
|
|
//2.获取站点信息 end------------------------------------------------------------>
|
|
|
}
|
|
|
|
|
|
const actions = {
|
|
|
+ //1.站点数据 start------------------------------------------------------------>
|
|
|
//获取网站基本信息
|
|
|
getSiteInfo({commit},data){
|
|
|
return new Promise((resolve, reject) => {
|
|
@@ -164,6 +207,7 @@ const actions = {
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
+ //1.站点数据 end------------------------------------------------------------>
|
|
|
}
|
|
|
|
|
|
export default {
|