|
|
|
@ -168,6 +168,7 @@ import nextTick from 'dai-js/tools/nextTick' |
|
|
|
import getRandomString from 'dai-js/tools/getRandomString' |
|
|
|
import cloneDeep from 'lodash/cloneDeep' |
|
|
|
|
|
|
|
// 处理获得mock测试接口地址 |
|
|
|
const getMockFilterUrl = (url) => { |
|
|
|
const usedMockTest = false |
|
|
|
const mockBaseUrl = 'https://nei.netease.com/api/apimock/30f0251f1b7dc90a8c38e3c634ef2a8b/api' |
|
|
|
@ -178,12 +179,13 @@ const getMockFilterUrl = (url) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 当前是否是开发环境 |
|
|
|
const envIsDev = process.env.VUE_APP_NODE_ENV === 'dev' |
|
|
|
|
|
|
|
export default { |
|
|
|
mixins: [mixinViewModule], |
|
|
|
data () { |
|
|
|
const cptTypeListTestdata = !envIsDev ? [] : [ |
|
|
|
const cptTypeListTestdata = [ |
|
|
|
// 通用组件 |
|
|
|
{ |
|
|
|
functionId: '0', |
|
|
|
@ -193,8 +195,43 @@ export default { |
|
|
|
componentList: [ |
|
|
|
{ |
|
|
|
componentId: '7', |
|
|
|
componentName: '新闻列表', |
|
|
|
componentFrontId: 'resi-functionList-hall-hotSubjectList', |
|
|
|
componentName: '最新议题', |
|
|
|
componentFrontId: 'resi-functionList-hall-latestIssueList', |
|
|
|
region: 'functionList', |
|
|
|
configuration: { |
|
|
|
// bgc: '#fff' |
|
|
|
}, |
|
|
|
demoData: { |
|
|
|
list: [ |
|
|
|
{ |
|
|
|
avatar: '', |
|
|
|
title: '最新议题的标题。最新议题的标题。最新议题的标题。最新议题的标题。', |
|
|
|
content: '最新议题的内容,最新议题的内容,最新议题的内容。', |
|
|
|
author: '山东路45号-刘女士', |
|
|
|
date: '2020-01-02' |
|
|
|
}, |
|
|
|
{ |
|
|
|
avatar: '', |
|
|
|
title: '最新议题的标题。', |
|
|
|
content: '最新议题的内容,最新议题的内容,最新议题的内容。', |
|
|
|
author: '山东路45号-刘女士', |
|
|
|
date: '2020-01-02' |
|
|
|
}, |
|
|
|
{ |
|
|
|
avatar: '', |
|
|
|
title: '最新议题的标题。', |
|
|
|
content: '最新议题的内容,最新议题的内容,最新议题的内容。', |
|
|
|
author: '山东路45号-刘女士', |
|
|
|
date: '2020-01-02' |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
configurationDescription: '' |
|
|
|
}, |
|
|
|
{ |
|
|
|
componentId: '8', |
|
|
|
componentName: '党建声音', |
|
|
|
componentFrontId: 'resi-functionList-hall-partyVoiceList', |
|
|
|
region: 'functionList', |
|
|
|
configuration: { |
|
|
|
// bgc: '#fff' |
|
|
|
@ -203,25 +240,57 @@ export default { |
|
|
|
list: [ |
|
|
|
{ |
|
|
|
pic: '', |
|
|
|
title: '我是新闻标题,我是新闻标题,我是新闻标题,我是新闻标题,我是新闻标题', |
|
|
|
title: '新型冠状病毒检测重大突破!新型冠状病毒检测重大突破!!!', |
|
|
|
author: '大港路党支部', |
|
|
|
date: '2020-01-02' |
|
|
|
}, |
|
|
|
{ |
|
|
|
pic: '', |
|
|
|
title: '我是新闻标题', |
|
|
|
title: '新型冠状病毒检测重大突破!', |
|
|
|
author: '大港路党支部', |
|
|
|
date: '2020-01-02' |
|
|
|
}, |
|
|
|
{ |
|
|
|
pic: '', |
|
|
|
title: '我是新闻标题', |
|
|
|
title: '新型冠状病毒检测重大突破!', |
|
|
|
author: '大港路党支部', |
|
|
|
date: '2020-01-02' |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
configurationDescription: '' |
|
|
|
}, |
|
|
|
{ |
|
|
|
componentId: '9', |
|
|
|
componentName: '结案项目', |
|
|
|
componentFrontId: 'resi-functionList-hall-closedProjectList', |
|
|
|
region: 'functionList', |
|
|
|
configuration: { |
|
|
|
// bgc: '#fff' |
|
|
|
}, |
|
|
|
demoData: { |
|
|
|
list: [ |
|
|
|
{ |
|
|
|
title: '结案项目的标题。', |
|
|
|
content: '结案项目的内容,结案项目的内容,结案项目的内容。', |
|
|
|
author: '党支部-卫生部门', |
|
|
|
date: '2020-01-02' |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '结案项目的标题。', |
|
|
|
content: '结案项目的内容,结案项目的内容,结案项目的内容。', |
|
|
|
author: '党支部-卫生部门', |
|
|
|
date: '2020-01-02' |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '结案项目的标题。', |
|
|
|
content: '结案项目的内容,结案项目的内容,结案项目的内容。', |
|
|
|
author: '党支部-卫生部门', |
|
|
|
date: '2020-01-02' |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
configurationDescription: '' |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
@ -355,13 +424,13 @@ export default { |
|
|
|
getDataListIsPage: false |
|
|
|
}, |
|
|
|
|
|
|
|
dataList: [ |
|
|
|
dataList: !envIsDev ? [] : [ |
|
|
|
{ |
|
|
|
customerName: '青岛李沧区党委', |
|
|
|
customerName: '测试1', |
|
|
|
customerId: '1' |
|
|
|
}, |
|
|
|
{ |
|
|
|
customerName: '青岛市北区党委', |
|
|
|
customerName: '测试2', |
|
|
|
customerId: '2' |
|
|
|
} |
|
|
|
], |
|
|
|
@ -379,7 +448,7 @@ export default { |
|
|
|
isInPreview: false, |
|
|
|
|
|
|
|
// 可用列表 |
|
|
|
cptTypeList: cptTypeListTestdata, |
|
|
|
cptTypeList: !envIsDev ? [] : cptTypeListTestdata, |
|
|
|
// 当前应用组件列表 |
|
|
|
cptList: [ |
|
|
|
// { |
|
|
|
@ -493,7 +562,8 @@ export default { |
|
|
|
this.cptTypeList = list |
|
|
|
console.log('可用组件列表', list) |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -518,7 +588,8 @@ export default { |
|
|
|
this.lastSavedCptList = cloneDeep(this.cptList) |
|
|
|
console.log('用户储存组件列表', list) |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -548,7 +619,8 @@ export default { |
|
|
|
this.lastSavedCptList = cloneDeep(this.cptList) |
|
|
|
return this.$message.success('保存成功') |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -585,27 +657,17 @@ export default { |
|
|
|
this.lastSavedCptList = cloneDeep(this.cptList) |
|
|
|
return this.$message.success('发布成功') |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 判断组件所属区域类别 |
|
|
|
checkCptRegion (item) { |
|
|
|
const { region } = item |
|
|
|
// const { componentFrontId } = item |
|
|
|
// const fun = name => name === componentFrontId |
|
|
|
// if (['resi-titleList-home-gridNameTitle'].findIndex(fun) !== -1) { |
|
|
|
// return 'top' |
|
|
|
// } else if (['resi-topList-voice-hotNewsSwiper'].findIndex(fun) !== -1) { |
|
|
|
// return 'ban' |
|
|
|
// } else if (['resi-functionList-extend-moreFunctionIcons', 'resi-functionList-group-recommendGroupSlider', 'resi-functionList-hall-hotSubjectList'].findIndex(fun) !== -1) { |
|
|
|
// return 'cnt' |
|
|
|
// } else if (['resi-floatingList-mine-newMessageButton'].findIndex(fun) !== -1) { |
|
|
|
// return 'fixed' |
|
|
|
// } else { |
|
|
|
// return 'none' |
|
|
|
// } |
|
|
|
if (region === 'titleList') { |
|
|
|
return 'top' |
|
|
|
} else if (region === 'topList') { |
|
|
|
@ -623,7 +685,6 @@ export default { |
|
|
|
const { componentFrontId } = item |
|
|
|
const reuseList = this.cptTypeList[0].componentList.map(v => v.componentFrontId) |
|
|
|
const fun = name => name === componentFrontId |
|
|
|
// return ['resi-functionList-hall-hotSubjectList'].findIndex(fun) !== -1 |
|
|
|
return reuseList.findIndex(fun) !== -1 |
|
|
|
}, |
|
|
|
// 根据所属区域简称得到名字 |
|
|
|
@ -645,23 +706,23 @@ export default { |
|
|
|
if (this.topCptList.length > 0) { |
|
|
|
this.$message('标题区已有组件,请删除后再添加') |
|
|
|
} else { |
|
|
|
this.addCpt(item, tempOnlyId, 1) |
|
|
|
this.addCpt(item, tempOnlyId) |
|
|
|
} |
|
|
|
} else if (regionType === 'ban') { |
|
|
|
if (this.banCptList.length > 0) { |
|
|
|
this.$message('置顶区已有组件,请删除后再添加') |
|
|
|
} else { |
|
|
|
this.addCpt(item, tempOnlyId, 2) |
|
|
|
this.addCpt(item, tempOnlyId) |
|
|
|
} |
|
|
|
} else if (regionType === 'fixed') { |
|
|
|
if (this.fixedCptList.length > 0) { |
|
|
|
this.$message('浮窗区已有组件,请删除后再添加') |
|
|
|
} else { |
|
|
|
this.addCpt(item, tempOnlyId, 3) |
|
|
|
this.addCpt(item, tempOnlyId) |
|
|
|
} |
|
|
|
} else if (regionType === 'cnt') { |
|
|
|
this.cntCptListResort() |
|
|
|
this.addCpt(item, tempOnlyId, 4, (this.cntCptList.length + 1) * 10) |
|
|
|
this.addCpt(item, tempOnlyId, (this.cntCptList.length + 1) * 10) |
|
|
|
} else { |
|
|
|
return false |
|
|
|
} |
|
|
|
@ -674,11 +735,10 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 添加组件到实例 |
|
|
|
addCpt (item, tempOnlyId, region, displayOrder = 0) { |
|
|
|
addCpt (item, tempOnlyId, displayOrder = 0) { |
|
|
|
console.log('添加组件到实例') |
|
|
|
let trueItem = cloneDeep(item) |
|
|
|
trueItem.tempOnlyId = tempOnlyId |
|
|
|
trueItem.localRegion = region |
|
|
|
trueItem.displayOrder = displayOrder |
|
|
|
this.cptList.push(trueItem) |
|
|
|
}, |
|
|
|
|