|
|
@@ -43,8 +43,8 @@
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :md="24" class="movie-list">
|
|
|
- <div>
|
|
|
- <el-col v-for="(image, index) in data.images" :key="image.thumbnailUrl" :md="6" :sm="12" :xs="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <div v-if="postType === 1">
|
|
|
+ <el-col v-for="(image, index) in dataList" :key="image.thumbnailUrl" :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 class="imgs">
|
|
|
<el-image
|
|
|
@@ -64,6 +64,33 @@
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
</div>
|
|
|
+ <div v-else-if="postType === 2">
|
|
|
+ <el-col v-for="(item,index) in dataList" :key="index" :md="6" :sm="8" :xs="12">
|
|
|
+ <div>
|
|
|
+ <video-card :video="item" />
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="mini"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ title="删除本收藏"
|
|
|
+ @click.stop="removeCollection(item)"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+ <el-col class="pagination">
|
|
|
+ <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"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
@@ -75,24 +102,29 @@
|
|
|
<script>
|
|
|
import PermissionDeniedCard from '@/components/card/PermissionDeniedCard'
|
|
|
import { followUser, getUserInfo, unfollowUser } from '@/api/user'
|
|
|
-import { getAlbum, getAlbumItems } from '@/api/image'
|
|
|
+import { getAlbumItems } from '@/api/image'
|
|
|
import { collectItem } from '@/api/collect'
|
|
|
+import VideoCard from '@/components/card/VideoCard'
|
|
|
|
|
|
export default {
|
|
|
name: 'ImagePage',
|
|
|
- components: { PermissionDeniedCard },
|
|
|
+ components: { PermissionDeniedCard, VideoCard },
|
|
|
data() {
|
|
|
return {
|
|
|
// 屏幕宽度, 为了控制分页条的大小
|
|
|
screenWidth: document.body.clientWidth,
|
|
|
currentPage: 1,
|
|
|
+ pageSize: 12,
|
|
|
+ totalSize: 0,
|
|
|
+ albumId: null,
|
|
|
+ data: null,
|
|
|
+ dataList: [],
|
|
|
+ postType: 0,
|
|
|
user: null,
|
|
|
followButton: {
|
|
|
icon: 'el-icon-plus',
|
|
|
text: '关注'
|
|
|
},
|
|
|
- data: null,
|
|
|
- dataList: [],
|
|
|
permissionDenied: false,
|
|
|
textObject: {
|
|
|
content: '相册',
|
|
|
@@ -101,37 +133,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- const albumId = this.$route.params.albumId
|
|
|
- getAlbumItems(1, albumId).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- const respData = resp.data
|
|
|
- document.title = '相册 - ' + respData.albumName
|
|
|
-
|
|
|
- this.data = respData
|
|
|
- this.userId = respData.userId
|
|
|
- getUserInfo(this.userId).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.user = resp.data
|
|
|
- } else {
|
|
|
- this.$notify.error({
|
|
|
- message: resp.msg,
|
|
|
- type: 'warning',
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (resp.code === 2) {
|
|
|
- this.$router.push('/404')
|
|
|
- } else {
|
|
|
- this.permissionDenied = true
|
|
|
- }
|
|
|
- }).catch(error => {
|
|
|
- this.$notify.error({
|
|
|
- message: error.message,
|
|
|
- type: 'error',
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
- })
|
|
|
+ this.albumId = this.$route.params.albumId
|
|
|
+ this.getAlbumItemsWrapper(this.currentPage, this.albumId)
|
|
|
},
|
|
|
mounted() {
|
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
|
@@ -143,6 +146,54 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleCurrentChange(pageNumber) {
|
|
|
+ this.currentPage = pageNumber
|
|
|
+ this.dataList = []
|
|
|
+ this.getAlbumItemsWrapper(this.currentPage, this.albumId)
|
|
|
+ // 回到顶部
|
|
|
+ scrollTo(0, 0)
|
|
|
+ },
|
|
|
+ getAlbumItemsWrapper(pageNumber, albumId) {
|
|
|
+ getAlbumItems(pageNumber, albumId).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ const respData = resp.data
|
|
|
+ document.title = '相册 - ' + respData.albumName
|
|
|
+
|
|
|
+ this.data = respData
|
|
|
+ this.postType = respData.postType
|
|
|
+ if (this.postType === 1) {
|
|
|
+ this.dataList = respData.images
|
|
|
+ } else if (this.postType === 2) {
|
|
|
+ this.totalSize = respData.pageList.totalSize
|
|
|
+ this.pageSize = respData.pageList.pageSize
|
|
|
+ this.dataList = respData.pageList.list
|
|
|
+ }
|
|
|
+
|
|
|
+ this.userId = respData.createBy
|
|
|
+ getUserInfo(this.userId).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.user = resp.data
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ message: resp.msg,
|
|
|
+ type: 'warning',
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (resp.code === 2) {
|
|
|
+ this.$router.push('/404')
|
|
|
+ } else {
|
|
|
+ this.permissionDenied = true
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$notify.error({
|
|
|
+ message: error.message,
|
|
|
+ type: 'error',
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
followUser(userId) {
|
|
|
if (this.followButton.text === '关注') {
|
|
|
followUser(userId).then(resp => {
|