2020-06-19 17:37:45 +08:00
|
|
|
<template>
|
2020-06-20 00:36:35 +08:00
|
|
|
<el-row class="wrapper">
|
|
|
|
<el-col :xs="24" :sm="24" :xl="24" style="margin: 0 auto;">
|
2020-06-22 17:13:42 +08:00
|
|
|
<el-col v-for="article in articles.articles" :key="article.idArticle" style="padding-bottom: 1rem;">
|
2020-06-20 00:36:35 +08:00
|
|
|
<el-card>
|
|
|
|
<div class="card-body d-flex flex-column">
|
2020-12-18 14:13:03 +08:00
|
|
|
<el-link rel="nofollow" @click="onRouter('article',article.articleLink)" :underline="false"
|
|
|
|
style="margin-bottom: .5rem;">
|
|
|
|
<h4>
|
|
|
|
<span v-if="isPerfect(article.articlePerfect)" style="color: gold;" title="优选">
|
|
|
|
<font-awesome-icon :icon="['fas', 'medal']"></font-awesome-icon>
|
|
|
|
</span>
|
2021-05-20 22:02:49 +08:00
|
|
|
<span v-html="article.articleTitle"></span>
|
2020-12-18 14:13:03 +08:00
|
|
|
</h4>
|
2020-06-20 00:36:35 +08:00
|
|
|
</el-link>
|
|
|
|
<el-tag
|
|
|
|
style="margin-left: 0.5rem;"
|
|
|
|
v-for="tag in article.tags"
|
|
|
|
:key="tag.idTag"
|
|
|
|
size="mini"
|
|
|
|
effect="plain">
|
2020-10-24 23:38:46 +08:00
|
|
|
# {{ tag.tagTitle }}
|
2020-06-20 00:36:35 +08:00
|
|
|
</el-tag>
|
2021-05-20 22:02:49 +08:00
|
|
|
<div class="text-muted article-summary-md" v-html="article.articlePreviewContent"></div>
|
2020-06-20 00:36:35 +08:00
|
|
|
<el-row class="pt-5">
|
|
|
|
<el-col :xs="3" :sm="1" :xl="1" class="mr-3">
|
2020-08-02 00:25:44 +08:00
|
|
|
<el-avatar v-if="article.articleAuthorAvatarUrl" size="medium"
|
|
|
|
:src="article.articleAuthorAvatarUrl"></el-avatar>
|
|
|
|
<el-avatar v-else size="medium"
|
2020-08-02 23:55:08 +08:00
|
|
|
src="https://static.rymcu.com/article/1578475481946.png"></el-avatar>
|
2020-06-20 00:36:35 +08:00
|
|
|
</el-col>
|
2020-08-04 21:50:59 +08:00
|
|
|
<el-col :xs="16" :sm="16" :xl="16">
|
2020-06-20 00:36:35 +08:00
|
|
|
<div>
|
2021-03-26 10:44:54 +08:00
|
|
|
<el-link rel="nofollow" @click="onRouter('user', article.articleAuthor.userAccount)" :underline="false"
|
2020-12-18 14:13:03 +08:00
|
|
|
class="text-default">
|
2020-08-02 00:25:44 +08:00
|
|
|
{{ article.articleAuthorName }}
|
|
|
|
</el-link>
|
2020-06-20 00:36:35 +08:00
|
|
|
<small class="d-block text-muted">{{ article.timeAgo }}</small>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
<el-col class="text-right">
|
2020-12-18 14:13:03 +08:00
|
|
|
<el-link rel="nofollow" :underline="false" title="总浏览数"><i class="el-icon-s-data"></i><span
|
|
|
|
style="color: red;">{{ article.articleViewCount }}</span>
|
2020-08-02 00:25:44 +08:00
|
|
|
</el-link>
|
2020-06-20 00:36:35 +08:00
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
</el-col>
|
|
|
|
<el-col>
|
|
|
|
<div class="vertical-container text-center">
|
2020-10-20 22:28:21 +08:00
|
|
|
<el-pagination :hide-on-single-page="true" v-model="articles.pagination"
|
2020-06-20 00:36:35 +08:00
|
|
|
layout="prev, pager, next"
|
2020-10-18 17:53:44 +08:00
|
|
|
:page-size="articles.pagination.pageSize"
|
2020-06-22 17:13:42 +08:00
|
|
|
:current-page="articles.pagination.currentPage"
|
|
|
|
:total="articles.pagination.total"
|
2020-10-20 22:28:21 +08:00
|
|
|
prev-text="上一页"
|
|
|
|
next-text="下一页"
|
2020-06-20 00:36:35 +08:00
|
|
|
@current-change="currentChange">
|
|
|
|
</el-pagination>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
2020-06-19 17:37:45 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-12-18 14:13:03 +08:00
|
|
|
export default {
|
|
|
|
name: "ArticleList",
|
|
|
|
props: {
|
|
|
|
articles: {
|
|
|
|
type: Object
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
currentChange(page) {
|
|
|
|
this.$emit('currentChange', page);
|
2020-06-20 00:36:35 +08:00
|
|
|
},
|
2020-12-18 14:13:03 +08:00
|
|
|
onRouter(name, data) {
|
|
|
|
if ("article" === name) {
|
|
|
|
this.$router.push({
|
|
|
|
path: data
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.$router.push(
|
|
|
|
{
|
|
|
|
path: '/user/' + data
|
|
|
|
}
|
|
|
|
)
|
2020-06-20 00:36:35 +08:00
|
|
|
}
|
2020-12-18 14:13:03 +08:00
|
|
|
},
|
|
|
|
isPerfect(articlePerfect) {
|
|
|
|
return articlePerfect === '1';
|
2020-06-19 17:37:45 +08:00
|
|
|
}
|
2020-06-22 17:13:42 +08:00
|
|
|
}
|
2020-12-18 14:13:03 +08:00
|
|
|
}
|
2020-06-19 17:37:45 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|