|
|
@@ -1,17 +1,16 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-row v-if="totalSize !== 0" class="movie-list">
|
|
|
- <el-col :md="18">
|
|
|
- <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <el-row class="movie-list">
|
|
|
+ <el-col :md="12">
|
|
|
+ <el-row v-for="(item, index) in dataList" :key="index" class="movie-list">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
- <span>文章列表</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text" @click="refresh">刷新</el-button>
|
|
|
+ <span style="left: 0;margin-bottom: 0px;color: black;">{{ item.publishAt }}</span>
|
|
|
</div>
|
|
|
- <div class="text item" v-for="(item, index) in dataList" :key="index" :md="6" :sm="12" :xs="12">
|
|
|
+ <div class="text item">
|
|
|
<el-row>
|
|
|
<el-col :md="4">
|
|
|
- <router-link target="_blank" :to="`/article/${item.contentId}`">
|
|
|
+ <router-link target="_blank" :to="`/news/${item.contentId}`">
|
|
|
<el-image
|
|
|
lazy
|
|
|
fit="cover"
|
|
|
@@ -21,7 +20,7 @@
|
|
|
</router-link>
|
|
|
</el-col>
|
|
|
<el-col :md="20">
|
|
|
- <router-link style="text-decoration-line: none" target="_blank" :to="`/article/${item.contentId}`">
|
|
|
+ <router-link style="text-decoration-line: none" target="_blank" :to="`/news/${item.contentId}`">
|
|
|
<el-row>
|
|
|
<div style="padding: 14px">
|
|
|
<span style="left: 0;margin-bottom: 0px;color: black;">{{ item.title | ellipsis }}</span>
|
|
|
@@ -35,57 +34,40 @@
|
|
|
</el-row>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row>
|
|
|
- <div style="padding: 14px">
|
|
|
- <span style="left: 0;margin-bottom: 0px;color: black;">发布于: {{ item.publishAt }}</span>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- <el-divider />
|
|
|
</div>
|
|
|
- <el-col :span="18" class="pagination">
|
|
|
- <el-pagination
|
|
|
- :small="screenWidth <= 768"
|
|
|
- layout="prev, pager, next"
|
|
|
- :page-size="pageSize"
|
|
|
- :current-page="currentPage"
|
|
|
- :total="totalSize"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- />
|
|
|
- </el-col>
|
|
|
</el-card>
|
|
|
</el-row>
|
|
|
+ <el-row>
|
|
|
+ <div v-if="hasMore" style="display: flex; justify-content: center;">
|
|
|
+ <el-button link type="plain" icon="el-icon-bottom" @click="loadMore">
|
|
|
+ 加载更多
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
</el-col>
|
|
|
<el-col :md="6">
|
|
|
- <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <el-row class="movie-list">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
<el-row>
|
|
|
- <span>热门文章</span>
|
|
|
+ <span>热门</span>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<div class="text item">
|
|
|
- <el-row>
|
|
|
- </el-row>
|
|
|
+ <el-row />
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</el-row>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row v-else class="not-result">
|
|
|
- <el-col :span="12" :offset="6">
|
|
|
- <img src="@/assets/img/icon/not-result.png">
|
|
|
- <div>没有文章数据</div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// import {getArticles} from "@/api/article";
|
|
|
import { getNewsList } from '@/api/news'
|
|
|
|
|
|
export default {
|
|
|
- name: 'Article',
|
|
|
+ name: 'ArticleIndex',
|
|
|
metaInfo: {
|
|
|
meta: [
|
|
|
{ name: 'referrer', content: 'no-referrer' }
|
|
|
@@ -110,10 +92,11 @@ export default {
|
|
|
pageSize: 12,
|
|
|
totalSize: 0,
|
|
|
dataList: [],
|
|
|
+ hasMore: true
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- document.title = '文章主页'
|
|
|
+ document.title = 'News'
|
|
|
this.getArticlesWrapper(this.currentPage)
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -136,11 +119,17 @@ export default {
|
|
|
getNewsList(page).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
const respData = resp.data
|
|
|
- this.dataList = respData.list
|
|
|
- this.totalSize = respData.totalSize
|
|
|
+ this.hasMore = respData.hasNext
|
|
|
+ for (const item of respData.list) {
|
|
|
+ this.dataList.push(item)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ loadMore() {
|
|
|
+ this.currentPage = this.currentPage + 1
|
|
|
+ this.getArticlesWrapper(this.currentPage)
|
|
|
+ },
|
|
|
refresh() {
|
|
|
this.$message.info('暂未实现')
|
|
|
}
|
|
|
@@ -152,20 +141,15 @@ export default {
|
|
|
/*处于手机屏幕时*/
|
|
|
@media screen and (max-width: 768px) {
|
|
|
.movie-list {
|
|
|
- padding-top: 8px;
|
|
|
- padding-left: 0.5%;
|
|
|
- padding-right: 0.5%;
|
|
|
+ padding: 5px;
|
|
|
}
|
|
|
-
|
|
|
.coverImg {
|
|
|
height: 120px !important;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.movie-list {
|
|
|
- padding-top: 15px;
|
|
|
- padding-left: 6%;
|
|
|
- padding-right: 6%;
|
|
|
+ padding: 5px;
|
|
|
}
|
|
|
|
|
|
.coverImg {
|