|
|
@@ -1,37 +1,34 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <el-row class="movie-list">
|
|
|
- <el-col :md="12">
|
|
|
+ <el-row class="movie-list">
|
|
|
+ <el-col :md="18">
|
|
|
+ <el-scrollbar style="width: 100%; height: 80vh;">
|
|
|
<el-row v-for="(item, index) in dataList" :key="index" class="movie-list">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
- <span style="left: 0;margin-bottom: 0px;color: black;">{{ item.publishAt }}</span>
|
|
|
+ <span style="left: 0;margin-bottom: 0px;color: black;">
|
|
|
+ <router-link style="text-decoration-line: none" target="_blank" :to="`/blog/post/${item.articleId}`">
|
|
|
+ {{ item.title }}
|
|
|
+ </router-link>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
<div class="text item">
|
|
|
<el-row>
|
|
|
- <el-col :md="4">
|
|
|
- <router-link target="_blank" :to="`/blog/post/${item.articleId}`">
|
|
|
- <el-image
|
|
|
- lazy
|
|
|
- fit="cover"
|
|
|
- :src="item.coverUrl"
|
|
|
- class="coverImg"
|
|
|
- />
|
|
|
- </router-link>
|
|
|
+ <span v-html="item.summary" />
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col style="padding: 1px" :md="2" :sm="6" :xs="6">
|
|
|
+ <span style="left: 0;margin-bottom: 0px;color: black;">
|
|
|
+ <router-link style="text-decoration-line: none" target="_blank" :to="`/blog/category/post?name=${item.category}`">
|
|
|
+ <el-tag type="warning">
|
|
|
+ {{ item.category }}
|
|
|
+ </el-tag>
|
|
|
+ </router-link>
|
|
|
+ </span>
|
|
|
</el-col>
|
|
|
- <el-col :md="20">
|
|
|
- <router-link style="text-decoration-line: none" target="_blank" :to="`/blog/post/${item.articleId}`">
|
|
|
- <el-row>
|
|
|
- <div style="padding: 14px">
|
|
|
- <span style="left: 0;margin-bottom: 0px;color: black;">{{ item.title | ellipsis }}</span>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- </router-link>
|
|
|
- <el-row>
|
|
|
- <div style="padding: 14px">
|
|
|
- <span style="left: 0;margin-bottom: 0px;color: black;">{{ item.excerpt }}</span>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
+ <el-col style="padding: 1px" :md="6" :sm="16" :xs="16">
|
|
|
+ <span class="el-icon-watch" style="left: 0;margin-bottom: 0px;color: black;">
|
|
|
+ {{ item.publishAt }}
|
|
|
+ </span>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
@@ -48,46 +45,30 @@
|
|
|
@prev-click="handleCurrentChange"
|
|
|
@next-click="handleCurrentChange"
|
|
|
/>
|
|
|
- </el-col>
|
|
|
- <el-col :md="6">
|
|
|
- <el-row class="movie-list">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <el-row>
|
|
|
- <span>热门</span>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- <div class="text item">
|
|
|
- <el-row />
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
+ </el-scrollbar>
|
|
|
+ </el-col>
|
|
|
+ <el-col :md="6">
|
|
|
+ <el-row class="movie-list">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <el-row>
|
|
|
+ <span>热门</span>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ <div class="text item">
|
|
|
+ <el-row />
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </el-row>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {getPostList } from '@/api/blog'
|
|
|
+import { getPostList } from '@/api/blog'
|
|
|
|
|
|
export default {
|
|
|
- name: 'ArticleIndex',
|
|
|
- metaInfo: {
|
|
|
- meta: [
|
|
|
- { name: 'referrer', content: 'no-referrer' }
|
|
|
- ]
|
|
|
- },
|
|
|
- filters: {
|
|
|
- ellipsis(value) {
|
|
|
- if (!value) return ''
|
|
|
- const max = 50
|
|
|
- if (value.length > max) {
|
|
|
- return value.slice(0, max) + '...'
|
|
|
- }
|
|
|
- return value
|
|
|
- }
|
|
|
- },
|
|
|
- components: {},
|
|
|
+ name: 'Article',
|
|
|
data() {
|
|
|
return {
|
|
|
queryInfo: {
|
|
|
@@ -109,7 +90,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
document.title = 'MyBlog'
|
|
|
- this.getArticlesWrapper(this.currentPage)
|
|
|
+ this.getData()
|
|
|
},
|
|
|
mounted() {
|
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
|
@@ -128,12 +109,12 @@ export default {
|
|
|
query: this.queryInfo
|
|
|
})
|
|
|
this.currentPage = currentPage
|
|
|
- this.getArticlesWrapper(this.currentPage)
|
|
|
+ this.getData(this.currentPage)
|
|
|
// 回到顶部
|
|
|
scrollTo(0, 0)
|
|
|
},
|
|
|
- getArticlesWrapper(page) {
|
|
|
- getPostList(page).then(resp => {
|
|
|
+ getData() {
|
|
|
+ getPostList(this.queryInfo).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
const respData = resp.data
|
|
|
this.dataList = respData.list
|
|
|
@@ -155,21 +136,12 @@ export default {
|
|
|
.movie-list {
|
|
|
padding: 5px;
|
|
|
}
|
|
|
- .coverImg {
|
|
|
- height: 120px !important;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
.movie-list {
|
|
|
padding: 5px;
|
|
|
}
|
|
|
|
|
|
-.coverImg {
|
|
|
- width: 100%;
|
|
|
- height: 120px;
|
|
|
- display: block;
|
|
|
-}
|
|
|
-
|
|
|
.clearfix:before,
|
|
|
.clearfix:after {
|
|
|
display: table;
|