nebula/components/common/portfolio/manager/bind/list.vue

72 lines
2.0 KiB
Vue
Raw Normal View History

2020-08-02 19:23:32 +08:00
<template>
<el-row>
2022-08-27 16:05:43 +08:00
<el-col v-for="article in articles.list" :key="article.idArticle" style="padding-top: 1rem;">
2020-08-02 19:23:32 +08:00
<el-card>
<div class="card-body d-flex flex-column">
<el-link rel="nofollow" :underline="false" style="margin-bottom: .5rem;">
2020-08-02 19:23:32 +08:00
<h4 v-html="article.articleTitle"></h4>
</el-link>
<div class="text-muted article-summary-md">{{ article.articlePreviewContent }}</div>
<el-col class="text-right" style="padding: 1rem;">
2020-09-28 00:37:14 +08:00
<el-button @click="bindArticle(article.idArticle)" :loading="loading" plain>添加至作品集</el-button>
2020-08-02 19:23:32 +08:00
</el-col>
</div>
</el-card>
</el-col>
<el-col>
2021-04-27 21:40:22 +08:00
<div class="vertical-container text-center" style="padding-top: 10px;">
2022-07-25 06:45:33 +08:00
<el-pagination :hide-on-single-page="true"
2020-08-02 19:23:32 +08:00
layout="prev, pager, next"
2022-08-27 16:05:43 +08:00
:current-page="articles.pageNum"
:total="articles.total"
2021-04-27 21:40:22 +08:00
prev-text="上一页"
next-text="下一页"
2020-08-02 19:23:32 +08:00
@current-change="currentChange">
</el-pagination>
</div>
</el-col>
</el-row>
</template>
<script>
export default {
name: "PortfolioManagerBind",
props: {
articles: {
type: Object
},
idPortfolio: {
type: Number
}
},
data() {
return {
loading: false
}
},
methods: {
bindArticle(idArticle) {
let _ts = this;
_ts.$set(_ts, 'loading', true);
_ts.$axios.$post('/api/portfolio/bind-article', {
idArticle: idArticle,
idPortfolio: _ts.idPortfolio
}).then(function (res) {
_ts.$set(_ts, 'loading', false);
if (res) {
2022-08-27 16:05:43 +08:00
_ts.$message('绑定成功!');
2020-08-02 19:23:32 +08:00
_ts.currentChange(1);
}
})
},
currentChange(page) {
this.$emit('currentChange', page);
}
}
}
</script>
<style scoped>
</style>