|
|
@@ -1,77 +1,132 @@
|
|
|
<template>
|
|
|
- <div id="collection-list">
|
|
|
- <!--搜索结果面包屑-->
|
|
|
- <el-breadcrumb
|
|
|
- class="bread"
|
|
|
- separator-class="el-icon-arrow-right"
|
|
|
- >
|
|
|
- <el-breadcrumb-item>我的收藏:共 <span class="reslut">{{ totalSize }}</span> 条</el-breadcrumb-item>
|
|
|
- </el-breadcrumb>
|
|
|
-
|
|
|
- <el-row v-if="totalSize !== 0" class="movie-list">
|
|
|
- <el-col style="text-align: right">
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- size="mini"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="removeFavlist"
|
|
|
- >删除收藏夹</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col v-for="(item,index) in dataList" :key="index" :md="6" :sm="8" :xs="12" style="padding-right: 7px; padding-left: 7px">
|
|
|
- <div>
|
|
|
- <el-card :body-style="{ padding: '0px' }" class="card">
|
|
|
- <div class="imgs">
|
|
|
- <el-image
|
|
|
- lazy
|
|
|
- fit="cover"
|
|
|
- class="coverImg"
|
|
|
- :src="item.thumbnailUrl"
|
|
|
- @click="showImages(index)"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
+ <el-row class="movie-list">
|
|
|
+ <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <el-card class="box-card" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>编辑收藏夹 - <span style="color: blue">{{albumName}}</span></span>
|
|
|
+ <el-button style="float: right; padding: 10px" type="text" @click="onReturnAlbum">返回收藏夹</el-button>
|
|
|
</div>
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- size="mini"
|
|
|
- icon="el-icon-delete"
|
|
|
- title="删除本收藏"
|
|
|
- @click.stop="removeCollection(item)"
|
|
|
- />
|
|
|
- </el-col>
|
|
|
- <el-col class="pagination">
|
|
|
- <el-pagination
|
|
|
- background
|
|
|
- :small="screenWidth <= 768"
|
|
|
- hide-on-single-page
|
|
|
- layout="prev, pager, next"
|
|
|
- :page-size="pageSize"
|
|
|
- :current-page="currentPage"
|
|
|
- :total="totalSize"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- @prev-click="handleCurrentChange"
|
|
|
- @next-click="handleCurrentChange"
|
|
|
- />
|
|
|
- </el-col>
|
|
|
+ <div class="text item" />
|
|
|
+ </el-card>
|
|
|
</el-row>
|
|
|
- <el-row v-else class="not-result">
|
|
|
- <el-col :span="12" :offset="6">
|
|
|
- <img src="@/assets/img/icon/not-collection.png">
|
|
|
- <div>你还没有收藏任何东西呢</div>
|
|
|
+ <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <el-col :md="24">
|
|
|
+ <div>
|
|
|
+ <el-col
|
|
|
+ v-for="(item, index) in dataList"
|
|
|
+ :key="index"
|
|
|
+ :md="6"
|
|
|
+ :sm="12"
|
|
|
+ :xs="12"
|
|
|
+ style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px"
|
|
|
+ >
|
|
|
+ <el-card :body-style="{ padding: '0px' }" class="card">
|
|
|
+ <div v-if="postType === 1" class="imgs">
|
|
|
+ <el-image
|
|
|
+ lazy
|
|
|
+ fit="cover"
|
|
|
+ class="coverImg"
|
|
|
+ :src="item.coverUrl"
|
|
|
+ @click="showImages(index)"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div v-if="postType === 2" class="imgs" style="cursor: pointer" :title="item.title">
|
|
|
+ <router-link target="_blank" :to="`/video/${item.videoId}`">
|
|
|
+ <el-image
|
|
|
+ lazy
|
|
|
+ fit="cover"
|
|
|
+ class="coverImg"
|
|
|
+ :src="item.coverUrl"
|
|
|
+ />
|
|
|
+ <span style="position: absolute; top: 0; left: 60%; color:white"> {{ item.duration }} </span>
|
|
|
+ <span style="position: absolute; bottom: 0; left: 0; color:white">
|
|
|
+ <i v-if="item.horizontal" class="el-icon-monitor" />
|
|
|
+ <i v-else class="el-icon-mobile-phone" />
|
|
|
+ </span>
|
|
|
+ <span style="position: absolute; bottom: 0; left: 10%; color:white">
|
|
|
+ <i class="el-icon-video-play">{{ getVisited(item.view) }}</i>
|
|
|
+ </span>
|
|
|
+ <span style="position: absolute; bottom: 0; left: 40%; color:white">
|
|
|
+ <i class="el-icon-s-comment">{{ getVisited(item.comment) }}</i>
|
|
|
+ </span>
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 14px">
|
|
|
+ <router-link style="text-decoration-line: none" target="_blank" :to="`/video/${item.videoId}`">
|
|
|
+ <span style="left: 0;margin-bottom: 0px;color: black;">{{ item.title | ellipsis }}</span>
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 14px">
|
|
|
+ <span style="left: 0;margin-bottom: 0px;color: black;">
|
|
|
+ <router-link target="_blank" :to="`/user/${item.user.userId}`">
|
|
|
+ <i class="el-icon-user"> {{ item.user.screenName | ellipsisUsername }} </i></router-link> • {{ item.pubDateStr }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 14px;">
|
|
|
+ <el-tooltip class="item" effect="dark" content="删除图片" placement="top-end">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="danger"
|
|
|
+ class="el-icon-delete"
|
|
|
+ @click="onDeleteImage(image.imageFileId)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip class="item" effect="dark" content="设为封面" placement="top-end">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="warning"
|
|
|
+ class="el-icon-picture-outline"
|
|
|
+ @click="onSetCover(image.imageFileId)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ <el-pagination
|
|
|
+ :small="screenWidth <= 768"
|
|
|
+ hide-on-single-page
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :page-size="pageSize"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :total="totalSize"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ @prev-click="handleCurrentChange"
|
|
|
+ @next-click="handleCurrentChange"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- </div>
|
|
|
+ </el-row>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
deleteFavlist,
|
|
|
getFavlist,
|
|
|
- collectItem
|
|
|
+ collectItem, getAlbumItems
|
|
|
} from '@/api/collect'
|
|
|
+import { handleVisited } from '@/assets/js/utils'
|
|
|
|
|
|
export default {
|
|
|
name: 'FavlistImage',
|
|
|
+ filters: {
|
|
|
+ ellipsis(value) {
|
|
|
+ if (!value) return ''
|
|
|
+ const max = 20
|
|
|
+ if (value.length > max) {
|
|
|
+ return value.slice(0, max) + '...'
|
|
|
+ }
|
|
|
+ return value
|
|
|
+ },
|
|
|
+ ellipsisUsername(value) {
|
|
|
+ if (!value) return ''
|
|
|
+ const max = 10
|
|
|
+ if (value.length > max) {
|
|
|
+ return value.slice(0, max) + '...'
|
|
|
+ }
|
|
|
+ return value
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
// 屏幕宽度, 为了控制分页条的大小
|
|
|
@@ -81,30 +136,39 @@ export default {
|
|
|
totalSize: 0,
|
|
|
dataList: [],
|
|
|
favlistId: 1,
|
|
|
- contentType: 1001
|
|
|
+ contentType: 1001,
|
|
|
+ albumId: null,
|
|
|
+ albumName: null,
|
|
|
+ postType: null
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.getFavlistWrapper(this.favlistId, this.contentType, this.currentPage)
|
|
|
- document.title = '图片收藏夹'
|
|
|
+ document.title = '编辑收藏夹'
|
|
|
+ this.albumId = this.$route.params.albumId
|
|
|
+ this.getAlbumItemsWrapper()
|
|
|
},
|
|
|
methods: {
|
|
|
handleCurrentChange(pageNumber) {
|
|
|
this.currentPage = pageNumber
|
|
|
this.dataList = []
|
|
|
- this.getFavlistWrapper(this.favlistId, this.contentType, this.currentPage)
|
|
|
+ this.getAlbumItemsWrapper()
|
|
|
// 回到顶部
|
|
|
scrollTo(0, 0)
|
|
|
},
|
|
|
- getFavlistWrapper(favlistId, conentType, page) {
|
|
|
- getFavlist(favlistId, conentType, page).then(resp => {
|
|
|
+ getAlbumItemsWrapper() {
|
|
|
+ getAlbumItems(this.currentPage, this.albumId).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
const respData = resp.data
|
|
|
- this.dataList = respData.list
|
|
|
- this.totalSize = respData.totalSize
|
|
|
+ this.albumName = respData.albumName
|
|
|
+ this.postType = respData.postType
|
|
|
+ this.dataList = respData.pageList.list
|
|
|
+ this.totalSize = respData.pageList.totalSize
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ onReturnAlbum() {
|
|
|
+ this.$router.push('/post/fav/video')
|
|
|
+ },
|
|
|
showImages(index) {
|
|
|
const imageUrls = []
|
|
|
for (const i of this.dataList) {
|
|
|
@@ -121,6 +185,9 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ getVisited(visited) {
|
|
|
+ return handleVisited(visited)
|
|
|
+ },
|
|
|
// 移除收藏
|
|
|
removeCollection(item) {
|
|
|
this.$confirm('确认删除本收藏?', '提示', {
|
|
|
@@ -199,7 +266,7 @@ export default {
|
|
|
|
|
|
.coverImg {
|
|
|
width: 100%;
|
|
|
- height: 320px;
|
|
|
+ height: 130px;
|
|
|
display: block;
|
|
|
}
|
|
|
|