|
|
|
@ -18,7 +18,7 @@ |
|
|
|
|
</div> |
|
|
|
|
<ul v-if="form.templateStatus" class="styles"> |
|
|
|
|
<template v-for="(item, i) in detailStyle"> |
|
|
|
|
<li v-if="item.id !== column.detailStyle" :key="i" @click="form.articleTemplate = item.id"> |
|
|
|
|
<li v-if="item.id !== column.detailStyle" :key="i" @click="styleChange(item.id)"> |
|
|
|
|
<div class="review"> |
|
|
|
|
<img :class="{'is-link': item.id == 24}" :src="require('@/assets/images/style/' + item.id + '.png')" alt=""> |
|
|
|
|
</div> |
|
|
|
@ -321,14 +321,27 @@ |
|
|
|
|
<el-radio :label="3">其他站点链接</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item v-show="form.connectionType === 1" prop="connectionType" label="站内链接"> |
|
|
|
|
<template v-if="form.connectionType === 1"> |
|
|
|
|
<el-form-item label="站内链接"> |
|
|
|
|
<el-cascader |
|
|
|
|
v-model="links" |
|
|
|
|
:options="columns" |
|
|
|
|
:props="columnProps" |
|
|
|
|
clearable></el-cascader> |
|
|
|
|
clearable |
|
|
|
|
@change="getArticle"></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item v-show="form.connectionType === 2" prop="connectionType" label="站内链接"> |
|
|
|
|
<el-form-item label="文章"> |
|
|
|
|
<el-select v-model="article" clearable> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in articles" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.title" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<el-form-item v-show="form.connectionType === 2" prop="linkAddress" label="站外链接"> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入站外链接" |
|
|
|
|
v-model.trim="form.linkAddress" |
|
|
|
@ -351,9 +364,27 @@ |
|
|
|
|
v-model="otherLink" |
|
|
|
|
:options="otherColumns" |
|
|
|
|
:props="columnProps" |
|
|
|
|
clearable></el-cascader> |
|
|
|
|
clearable |
|
|
|
|
@change="getArticle"></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="文章"> |
|
|
|
|
<el-select v-model="otherArticle" clearable> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in otherArticles" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.title" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<el-form-item prop="isOpen" label="新窗口打开"> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="form.isOpen" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0"> |
|
|
|
|
</el-switch> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</el-form> |
|
|
|
|
<div class="btns"> |
|
|
|
@ -458,16 +489,20 @@ export default { |
|
|
|
|
}, |
|
|
|
|
nameRepeat: false, |
|
|
|
|
sites: [], |
|
|
|
|
otherColumns: [], |
|
|
|
|
otherLink: [], |
|
|
|
|
detailStyle: [], |
|
|
|
|
columns: [], |
|
|
|
|
articles: [], |
|
|
|
|
otherArticles: [], |
|
|
|
|
columnProps: { |
|
|
|
|
checkStrictly: true, |
|
|
|
|
value: 'id', |
|
|
|
|
label: 'columnName' |
|
|
|
|
}, |
|
|
|
|
links: [], |
|
|
|
|
article: '', |
|
|
|
|
otherColumns: [], |
|
|
|
|
otherLink: [], |
|
|
|
|
otherArticle: '', |
|
|
|
|
form: { |
|
|
|
|
siteId: this.$store.state.content.site.id, |
|
|
|
|
id: this.$route.query.id || '', |
|
|
|
@ -505,7 +540,8 @@ export default { |
|
|
|
|
connectionType : 1, |
|
|
|
|
linkAddress: '', |
|
|
|
|
siteSelection: 1, |
|
|
|
|
fileList: [] |
|
|
|
|
fileList: [], |
|
|
|
|
isOpen: 1 |
|
|
|
|
}, |
|
|
|
|
rules: { |
|
|
|
|
title: [ |
|
|
|
@ -668,6 +704,22 @@ export default { |
|
|
|
|
e.children.length ? this.getId(e.children, e.ids) : delete e.children |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 文章列表 |
|
|
|
|
getArticle() { |
|
|
|
|
// 站内链接/其他站点链接 |
|
|
|
|
const inner = this.form.connectionType === 1 |
|
|
|
|
const id = inner ? this.links[this.links.length - 1] : this.otherLink[this.otherLink.length - 1] |
|
|
|
|
this[inner ? 'article' : 'otherArticle'] = '' |
|
|
|
|
this.$post(this.api.queryArticle, { |
|
|
|
|
siteId: inner ? this.site.id : this.form.siteSelection, |
|
|
|
|
columnIds: [id], |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 1000, |
|
|
|
|
title: '' |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
this[inner ? 'articles' : 'otherArticles'] = data.records.filter(e => e.isRelease) // 只显示已发布的文章 |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
// 获取文章详情 |
|
|
|
|
getData() { |
|
|
|
|
this.$post(`${this.api.findArticle}?id=${this.form.id}`).then(({ data }) => { |
|
|
|
@ -681,14 +733,36 @@ export default { |
|
|
|
|
} |
|
|
|
|
// 链接回显 |
|
|
|
|
if (data.articleTemplate === 24 && data.connectionType !== 2 && data.linkAddress) { |
|
|
|
|
const links = data.linkAddress.split(',').map(e => +e) |
|
|
|
|
if (data.connectionType === 1) this.links = links |
|
|
|
|
if (data.connectionType === 3) this.otherLink = links |
|
|
|
|
data.linkAddress = '' |
|
|
|
|
const columnArticle = data.linkAddress.split('-') |
|
|
|
|
const column = columnArticle[0].split(',').map(e => +e) |
|
|
|
|
console.log("🚀 ~ file: index.vue:737 ~ this.$post ~ columnArticle", column) |
|
|
|
|
|
|
|
|
|
const article = columnArticle[1] || '' // 获取文章id(文章id是附在linkAddress最后面的-后面的数字) |
|
|
|
|
const { connectionType } = data |
|
|
|
|
// 获取文章 |
|
|
|
|
this.$post(this.api.queryArticle, { |
|
|
|
|
siteId: connectionType === 1 ? this.site.id : data.siteSelection, |
|
|
|
|
columnIds: [column[column.length - 1]], // 截取走最后面的文章id,最后一个id就是栏目id |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 1000, |
|
|
|
|
title: '' |
|
|
|
|
}).then(res => { |
|
|
|
|
this[connectionType === 1 ? 'articles' : 'otherArticles'] = res.data.records |
|
|
|
|
// 站内链接/其他站点链接 |
|
|
|
|
if (connectionType === 1) { |
|
|
|
|
this.links = column |
|
|
|
|
this.form.linkAddress = '' |
|
|
|
|
if (article) this.article = +article |
|
|
|
|
} else if (connectionType === 3) { |
|
|
|
|
this.otherLink = column |
|
|
|
|
this.form.linkAddress = '' |
|
|
|
|
if (article) this.otherArticle = +article |
|
|
|
|
} |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
} |
|
|
|
|
data.siteSelection && this.getOtherColumn() |
|
|
|
|
this.originalName = data.title |
|
|
|
|
this.form = data |
|
|
|
|
data.siteSelection && this.getOtherColumn() |
|
|
|
|
this.getColumn() |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
@ -701,17 +775,28 @@ export default { |
|
|
|
|
if (!form.templateStatus) { |
|
|
|
|
form.articleTemplate = (data.typeId === 1 || data.typeId === 4) ? data.detailStyleId : 23 |
|
|
|
|
} |
|
|
|
|
// 会议活动 |
|
|
|
|
if (form.articleTemplate === 25) { |
|
|
|
|
this.rules.titleImg[0].required = false |
|
|
|
|
this.rules.classificationId[0].required = true |
|
|
|
|
} |
|
|
|
|
this.handleRules() |
|
|
|
|
this.getClassification() |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.updateTime = 0 |
|
|
|
|
}) |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
// 处理表单验证 |
|
|
|
|
handleRules() { |
|
|
|
|
const { articleTemplate } = this.form |
|
|
|
|
// 会议活动 |
|
|
|
|
if (articleTemplate === 25) { |
|
|
|
|
this.rules.titleImg[0].required = false |
|
|
|
|
} else { |
|
|
|
|
this.rules.titleImg[0].required = true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 独立文章模板选择回调 |
|
|
|
|
styleChange(id) { |
|
|
|
|
this.form.articleTemplate = id |
|
|
|
|
this.handleRules() |
|
|
|
|
}, |
|
|
|
|
// 获取站点列表 |
|
|
|
|
getSite() { |
|
|
|
|
this.$post(this.api.site, { |
|
|
|
@ -723,7 +808,7 @@ export default { |
|
|
|
|
}).catch(e => {}) |
|
|
|
|
}, |
|
|
|
|
// 获取指定站点的栏目列表 |
|
|
|
|
getOtherColumn() { |
|
|
|
|
getOtherColumn(val) { |
|
|
|
|
this.$post(this.api.listWithTree, { |
|
|
|
|
siteId: this.form.siteSelection, |
|
|
|
|
columnName: '', |
|
|
|
@ -731,6 +816,11 @@ export default { |
|
|
|
|
typeId : '', |
|
|
|
|
isSort: 1 |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
if (val) { |
|
|
|
|
this.otherArticles = [] |
|
|
|
|
this.otherArticle = '' |
|
|
|
|
this.otherLink = '' |
|
|
|
|
} |
|
|
|
|
this.otherColumns = data |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
@ -998,9 +1088,9 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 附件删除 |
|
|
|
|
handleRemove(e, fileList) { |
|
|
|
|
e.id && this.$post(`${this.api.delContentFile}?id=${e.id}`).then(res => { |
|
|
|
|
e.id ? this.$post(`${this.api.delContentFile}?id=${e.id}`).then(res => { |
|
|
|
|
this.form.fileList = fileList |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) : (this.form.fileList = fileList) |
|
|
|
|
}, |
|
|
|
|
// banner上传成功 |
|
|
|
|
uploadSuccessBanner(res) { |
|
|
|
@ -1080,7 +1170,7 @@ export default { |
|
|
|
|
if (tId !== 25) { |
|
|
|
|
if (!form.releaseTime) return Util.errorMsg('请选择发布日期') |
|
|
|
|
} |
|
|
|
|
if (tId === 22 || tId === 23) { |
|
|
|
|
if (tId === 22 || tId === 23 || tId === 24) { |
|
|
|
|
if (!form.titleImg ) return Util.errorMsg('请上传封面') |
|
|
|
|
} |
|
|
|
|
if (tId === 25) { |
|
|
|
@ -1101,8 +1191,10 @@ export default { |
|
|
|
|
if (this.uploading) return Util.errorMsg('文件正在上传,请上传完成后再发布') |
|
|
|
|
if (form.connectionType === 1) { |
|
|
|
|
form.linkAddress = this.links.join() |
|
|
|
|
if (this.article) form.linkAddress += '-' + this.article |
|
|
|
|
} else if (form.connectionType === 3) { |
|
|
|
|
form.linkAddress = this.otherLink.join() |
|
|
|
|
if (this.otherArticle) form.linkAddress += '-' + this.otherArticle |
|
|
|
|
} |
|
|
|
|
const { columnId, bannerImg, fileList, titleImg } = form |
|
|
|
|
const fileId = [] |
|
|
|
|