2020-09-08 07:59:55 +08:00
|
|
|
<template>
|
2021-02-23 16:36:52 +08:00
|
|
|
<el-row style="margin-top: 20px;">
|
2020-09-08 07:59:55 +08:00
|
|
|
<el-col>
|
|
|
|
<el-col style="margin-bottom: 1rem;">
|
|
|
|
<el-breadcrumb separator-class="el-icon-arrow-right">
|
|
|
|
<el-breadcrumb-item :to="{ path: '/admin' }">首页</el-breadcrumb-item>
|
|
|
|
<el-breadcrumb-item :to="{ path: '/admin/topics' }">专题管理</el-breadcrumb-item>
|
|
|
|
<el-breadcrumb-item :to="{ path: '/admin/topic/' + topic.topicUri }">{{ topic.topicTitle }}</el-breadcrumb-item>
|
|
|
|
<el-breadcrumb-item>关联标签</el-breadcrumb-item>
|
|
|
|
</el-breadcrumb>
|
|
|
|
</el-col>
|
|
|
|
<el-col>
|
|
|
|
<el-input placeholder="请输入标签名" v-model="tagTitle">
|
|
|
|
<el-button @click="getTags()" slot="append" icon="el-icon-search"></el-button>
|
|
|
|
</el-input>
|
|
|
|
</el-col>
|
2022-08-27 16:05:43 +08:00
|
|
|
<el-col v-for="tag in tags.list" :key="tag.idTag">
|
2020-09-08 07:59:55 +08:00
|
|
|
<el-card style="margin: .5rem;">
|
|
|
|
<el-col :span="1">
|
|
|
|
<el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="20">
|
|
|
|
<el-col>
|
|
|
|
<span class="tag-title">{{ tag.tagTitle }}</span>
|
|
|
|
</el-col>
|
|
|
|
<el-col>
|
|
|
|
<span class="text-muted" v-if="tag.tagArticleCount">{{ tag.tagArticleCount }} 引用</span>
|
|
|
|
<span class="text-muted" v-else> <span style="color: #F56C6C;">0</span> 引用</span>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="3" class="text-right">
|
2020-09-28 00:37:14 +08:00
|
|
|
<el-button size="small" @click="bindTopicTag(tag.idTag)" plain>关联</el-button>
|
2020-09-08 07:59:55 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col style="margin-bottom: .8rem">{{ tag.tagDescription }}</el-col>
|
|
|
|
</el-card>
|
|
|
|
</el-col>
|
|
|
|
<el-col>
|
|
|
|
<div class="vertical-container text-center">
|
2022-07-25 06:45:33 +08:00
|
|
|
<el-pagination :hide-on-single-page="true"
|
2020-09-08 07:59:55 +08:00
|
|
|
layout="prev, pager, next"
|
2022-08-27 16:05:43 +08:00
|
|
|
:current-page="tags.pageNum"
|
|
|
|
:total="tags.total"
|
2020-09-08 07:59:55 +08:00
|
|
|
@current-change="currentChange">
|
|
|
|
</el-pagination>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {mapState} from 'vuex';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "adminTopicBindTag",
|
|
|
|
fetch({store, params, error}) {
|
|
|
|
let _ts = this;
|
|
|
|
return Promise.all([
|
|
|
|
store.dispatch('topic/fetchUnBindTags', {
|
|
|
|
idTopic: params.topic_id
|
|
|
|
})
|
|
|
|
])
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
topic: state => state.topic.detail.data,
|
2022-08-27 16:05:43 +08:00
|
|
|
tags: state => state.topic.tags.data
|
2020-09-08 07:59:55 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
tagTitle: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
currentChange(page) {
|
|
|
|
let _ts = this;
|
|
|
|
this.$store.dispatch('topic/fetchUnBindTags', {
|
|
|
|
page: page,
|
|
|
|
idTopic: _ts.topic.idTopic,
|
|
|
|
tagTitle: _ts.tagTitle
|
|
|
|
})
|
|
|
|
},
|
|
|
|
bindTopicTag(idTag) {
|
|
|
|
let _ts = this;
|
|
|
|
this.$confirm('确定关联吗?', '提示', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
_ts.$axios.$post('/api/admin/topic/bind-topic-tag', {
|
|
|
|
idTag: idTag,
|
|
|
|
idTopic: _ts.topic.idTopic
|
|
|
|
}).then(function (res) {
|
2022-08-27 16:05:43 +08:00
|
|
|
if (res) {
|
|
|
|
_ts.currentChange(_ts.tags.pageNum);
|
2020-09-08 07:59:55 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}).catch(() => {
|
2022-08-27 16:05:43 +08:00
|
|
|
_ts.currentChange(_ts.tags.pageNum);
|
2020-09-08 07:59:55 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
getTags() {
|
2022-08-27 16:05:43 +08:00
|
|
|
this.currentChange(this.tags.pageNum);
|
2020-09-08 07:59:55 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
let _ts = this;
|
|
|
|
if (!_ts.topic.idTopic) {
|
|
|
|
_ts.$axios.$get('/api/admin/topic/detail/' + _ts.$route.params.topic_id).then(function (res) {
|
|
|
|
_ts.$store.commit('topic/updateDetailData', res)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|