|
|
|
@ -1,16 +1,9 @@ |
|
|
|
|
<template> |
|
|
|
|
<!-- 设置链接 --> |
|
|
|
|
<div> |
|
|
|
|
<el-dialog title="设置链接地址" |
|
|
|
|
:visible.sync="visible" |
|
|
|
|
width="500px" |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
:before-close="close"> |
|
|
|
|
<el-form :model="data" |
|
|
|
|
class="model" |
|
|
|
|
label-width="120px"> |
|
|
|
|
<el-form-item prop="connectionType" |
|
|
|
|
label="连接类型"> |
|
|
|
|
<el-dialog title="设置链接地址" :visible.sync="visible" width="500px" :close-on-click-modal="false" :before-close="close"> |
|
|
|
|
<el-form :model="data" class="model" label-width="120px"> |
|
|
|
|
<el-form-item prop="connectionType" label="连接类型"> |
|
|
|
|
<el-radio-group v-model="data.connectionType"> |
|
|
|
|
<!-- <el-radio :label="0">无</el-radio> --> |
|
|
|
|
<el-radio :label="1">站内链接</el-radio> |
|
|
|
@ -20,71 +13,45 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
<template v-if="data.connectionType === 1"> |
|
|
|
|
<el-form-item label="栏目"> |
|
|
|
|
<el-cascader ref="column" |
|
|
|
|
v-model="data.columnId" |
|
|
|
|
:options="columns" |
|
|
|
|
:props="columnProps" |
|
|
|
|
<el-cascader ref="column" v-model="data.columnId" :options="columns" :props="columnProps" |
|
|
|
|
@change="columnChange"></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="文章"> |
|
|
|
|
<el-select v-model="data.articleId"> |
|
|
|
|
<el-option v-for="item in articles" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.title" |
|
|
|
|
:value="item.id"> |
|
|
|
|
<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="data.connectionType === 2" |
|
|
|
|
prop="linkAddress" |
|
|
|
|
label="站外链接"> |
|
|
|
|
<el-input placeholder="请输入站外链接" |
|
|
|
|
v-model.trim="data.linkAddress" |
|
|
|
|
clearable></el-input> |
|
|
|
|
<el-form-item v-show="data.connectionType === 2" prop="linkAddress" label="站外链接"> |
|
|
|
|
<el-input placeholder="请输入站外链接" v-model.trim="data.linkAddress" clearable></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<template v-if="data.connectionType === 3"> |
|
|
|
|
<el-form-item prop="site" |
|
|
|
|
label="站点选择"> |
|
|
|
|
<el-select v-model="data.site" |
|
|
|
|
@change="getOtherColumn"> |
|
|
|
|
<el-option v-for="item in sites" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.siteName" |
|
|
|
|
:value="item.id"> |
|
|
|
|
<el-form-item prop="site" label="站点选择"> |
|
|
|
|
<el-select v-model="data.site" @change="getOtherColumn"> |
|
|
|
|
<el-option v-for="item in sites" :key="item.id" :label="item.siteName" :value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="栏目"> |
|
|
|
|
<el-cascader ref="otherColumn" |
|
|
|
|
v-model="data.otherColumnId" |
|
|
|
|
:options="otherColumns" |
|
|
|
|
:props="columnProps" |
|
|
|
|
<el-cascader ref="otherColumn" v-model="data.otherColumnId" :options="otherColumns" :props="columnProps" |
|
|
|
|
@change="columnChange"></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="文章"> |
|
|
|
|
<el-select v-model="data.otherArticleId"> |
|
|
|
|
<el-option v-for="item in articles" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.title" |
|
|
|
|
:value="item.id"> |
|
|
|
|
<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 prop="isOpen" |
|
|
|
|
label="新窗口打开"> |
|
|
|
|
<el-switch v-model="data.isOpen" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0"> |
|
|
|
|
<el-form-item prop="isOpen" label="新窗口打开"> |
|
|
|
|
<el-switch v-model="data.isOpen" :active-value="1" :inactive-value="0"> |
|
|
|
|
</el-switch> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" |
|
|
|
|
class="dialog-footer"> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="$emit('update:visible', false)">取消</el-button> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="linkSubmit">确定</el-button> |
|
|
|
|
<el-button type="primary" @click="linkSubmit">确定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
@ -133,8 +100,6 @@ export default { |
|
|
|
|
// 栏目列表 |
|
|
|
|
getList () { |
|
|
|
|
this.$post(this.api.listWithTree, { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
siteId: this.site.id, |
|
|
|
|
columnName: '', |
|
|
|
|
templateId: '', |
|
|
|
@ -154,13 +119,16 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 栏目选择回调 |
|
|
|
|
columnChange () { |
|
|
|
|
this.data.articleId = '' |
|
|
|
|
this.data[this.data.connectionType === 1 ? 'articleId' : 'otherArticleId'] = '' |
|
|
|
|
this.getArticle() |
|
|
|
|
}, |
|
|
|
|
// 文章列表 |
|
|
|
|
getArticle () { |
|
|
|
|
// 站内链接/其他站点链接 |
|
|
|
|
const id = this.data.connectionType === 1 ? this.data.columnId[this.data.columnId.length - 1] : this.data.otherColumnId[this.data.otherColumnId.length - 1] |
|
|
|
|
const isIn = this.data.connectionType === 1 // 站内 |
|
|
|
|
const id = isIn ? this.data.columnId[this.data.columnId.length - 1] : this.data.otherColumnId[this.data.otherColumnId.length - 1] |
|
|
|
|
const e = this[isIn ? 'columns' : 'otherColumns'].find(e => e.id === id) |
|
|
|
|
e && this.$set(this.data, 'isProduct', e.templateId === 12 || e.listStyleId === 73 ? 1 : 0) |
|
|
|
|
id && this.$post(this.api.queryArticle, { |
|
|
|
|
siteId: this.data.connectionType === 1 ? this.site.id : this.data.site, |
|
|
|
|
columnIds: [id], |
|
|
|
@ -185,8 +153,6 @@ export default { |
|
|
|
|
// 获取指定站点的栏目列表 |
|
|
|
|
getOtherColumn () { |
|
|
|
|
this.data.site && this.$post(this.api.listWithTree, { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
siteId: this.data.site, |
|
|
|
|
columnName: '', |
|
|
|
|
templateId: '', |
|
|
|
@ -206,5 +172,4 @@ export default { |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
</style> |
|
|
|
|
<style lang="scss" scoped></style> |