|
|
@@ -1,79 +1,109 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <!--电影列表,与推荐列表-->
|
|
|
- <el-row id="movie-list">
|
|
|
- <!--电影列表-->
|
|
|
+ <el-row class="movie-list">
|
|
|
<el-col :md="24">
|
|
|
- <el-col v-for="(video, index) in videoList" :key="index" :md="6" :sm="12" :xs="12">
|
|
|
- <el-col style="padding-right: 7px; padding-left: 7px">
|
|
|
- <div style="cursor: pointer" :title="video.title">
|
|
|
- <el-card :body-style="{ padding: '0px' }" class="card">
|
|
|
- <router-link target="_blank" :to="`/image/${video.videoId}`">
|
|
|
- <div class="imgs">
|
|
|
- <el-image
|
|
|
- lazy
|
|
|
- fit="cover"
|
|
|
- :src="video.coverUrl"
|
|
|
- class="coverImg"
|
|
|
- />
|
|
|
- <span style="position: absolute; bottom: 0; left: 0; color:red">
|
|
|
- <i v-if="video.viewCount === 0" class="el-icon-mobile-phone" />
|
|
|
- <i v-else class="el-icon-monitor" />
|
|
|
- </span>
|
|
|
- <span style="position: absolute; bottom: 0; left: 10%; color:red">
|
|
|
- <i class="el-icon-video-play">{{ video.viewCount }}</i>
|
|
|
- </span>
|
|
|
- <span style="position: absolute; bottom: 0; left: 30%; color:red">
|
|
|
- <i class="el-icon-s-comment">{{ video.commentCount }}</i>
|
|
|
- </span>
|
|
|
- <span style="position: absolute; bottom: 0; right: 0; color:red"> {{ video.duration }} </span>
|
|
|
- </div>
|
|
|
- </router-link>
|
|
|
- <div style="padding: 14px">
|
|
|
- <router-link target="_blank" :to="`/video/${video.videoId}`">
|
|
|
- <span style="left: 0;margin-bottom: 0px;color: black;">{{ video.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/${video.userId}`"><i class="el-icon-user"> {{ video.username }} </i></router-link> · {{ video.pubDate }}
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </div>
|
|
|
+ <el-card :if="!user" :body-style="{ padding: '0px' }" class="card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <el-row>
|
|
|
+ <el-col :md="1">
|
|
|
+ <el-avatar>
|
|
|
+ <el-image :src="user.avatarUrl"/>
|
|
|
+ </el-avatar>
|
|
|
+ </el-col>
|
|
|
+ <el-col :md="23">
|
|
|
+ <span>{{ user.screenName }}</span>
|
|
|
+ <span v-html="' '" />
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="mini"
|
|
|
+ :icon="followButton.icon"
|
|
|
+ @click="followUser(user.userId)"
|
|
|
+ >
|
|
|
+ <span>{{followButton.text}}</span>
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="mini"
|
|
|
+ icon="el-icon-message"
|
|
|
+ @click="sendMessage(user.userId)"
|
|
|
+ >
|
|
|
+ <span>发消息</span>
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <span>{{data.albumName}}</span>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :md="24" class="movie-list">
|
|
|
+ <div>
|
|
|
+ <el-col v-for="image in data.imageUrls" :key="image.thumbnailUrl" :md="6" :sm="12" :xs="12">
|
|
|
+ <el-card :body-style="{ padding: '0px' }" class="card">
|
|
|
+ <div class="imgs">
|
|
|
+ <el-image
|
|
|
+ lazy
|
|
|
+ fit="cover"
|
|
|
+ class="coverImg"
|
|
|
+ :src="image.thumbnailUrl"
|
|
|
+ @click="showImages(data.imageUrls)">
|
|
|
+ </el-image>
|
|
|
+ <span style="position: absolute; bottom: 0; left: 0; color:white">
|
|
|
+ <i v-if="true" class="el-icon-monitor" />
|
|
|
+ <i v-else class="el-icon-mobile-phone" />
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 14px;">
|
|
|
+ <span>
|
|
|
+ <i class="el-icon-collection-tag"/>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
</el-col>
|
|
|
- </el-col>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import ImageCard from 'components/card/ImageCard'
|
|
|
-import { videoRecommend } from '@/api/video'
|
|
|
+import { getUserAlbums, getUserAlbum } from "@/api/image";
|
|
|
+import {followUser, getUserInfo, unfollowUser} from "@/api/user";
|
|
|
|
|
|
export default {
|
|
|
- name: 'Image',
|
|
|
- components: { ImageCard },
|
|
|
+ name: 'ImagePage',
|
|
|
data() {
|
|
|
return {
|
|
|
// 屏幕宽度, 为了控制分页条的大小
|
|
|
screenWidth: document.body.clientWidth,
|
|
|
currentPage: 1,
|
|
|
- videoList: []
|
|
|
+ user: null,
|
|
|
+ data: null,
|
|
|
+ followButton: {
|
|
|
+ icon: 'el-icon-plus',
|
|
|
+ text: '关注'
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.currentPage = 1
|
|
|
- videoRecommend(this.currentPage).then(res => {
|
|
|
+ this.userId = 12973
|
|
|
+ getUserInfo(this.userId).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
- const resData = res.data
|
|
|
- this.videoList = resData.list
|
|
|
+ this.user = res.data
|
|
|
+
|
|
|
+ const albumId = this.$route.params.albumId
|
|
|
+ getUserAlbum(albumId).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.data = res.data
|
|
|
+
|
|
|
+ document.title = '相册'
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- // console.log(this.$store.state.videos);
|
|
|
- // 当页面挂载时,页码变为1
|
|
|
- this.$store.commit('updatePage', 1)
|
|
|
},
|
|
|
mounted() {
|
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
|
@@ -85,19 +115,50 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- handleCurrentChange(currentPage) {
|
|
|
- this.currentPage = currentPage
|
|
|
- this.$store.commit('updatePage', currentPage)
|
|
|
- this.$store.dispatch('getPageBean')
|
|
|
- // 回到顶部
|
|
|
- scrollTo(0, 0)
|
|
|
- }
|
|
|
+ showImages(imageUrls) {
|
|
|
+ const imgs = []
|
|
|
+ for (const i of imageUrls) {
|
|
|
+ imgs.push(i.originalUrl)
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$viewerApi({
|
|
|
+ images: imgs,
|
|
|
+ options: {
|
|
|
+ movable: true,
|
|
|
+ fullscreen: false,
|
|
|
+ keyboard: true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showImage() {
|
|
|
+ this.$viewerApi()
|
|
|
+ },
|
|
|
+ followUser(userId) {
|
|
|
+ if (this.followButton.text === '关注') {
|
|
|
+ followUser(userId).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.followButton.text = '已关注'
|
|
|
+ this.followButton.icon = 'el-icon-check'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ unfollowUser(userId).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.followButton.text = '关注'
|
|
|
+ this.followButton.icon = 'el-icon-plus'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sendMessage(userId) {
|
|
|
+ console.log('发送消息')
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-#movie-list {
|
|
|
+.movie-list {
|
|
|
padding-top: 15px;
|
|
|
padding-left: 6%;
|
|
|
padding-right: 6%;
|
|
|
@@ -110,60 +171,12 @@ export default {
|
|
|
|
|
|
/*处于手机屏幕时*/
|
|
|
@media screen and (max-width: 768px){
|
|
|
- #movie-list {
|
|
|
+ .movie-list {
|
|
|
padding-top: 8px;
|
|
|
padding-left: 0.5%;
|
|
|
padding-right: 0.5%;
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-.time {
|
|
|
- font-size: 15px;
|
|
|
- color: #999;
|
|
|
-}
|
|
|
|
|
|
-.bottom {
|
|
|
- margin-top: 13px;
|
|
|
- line-height: 12px;
|
|
|
-}
|
|
|
-
|
|
|
-.tit {
|
|
|
- font-weight: 700;
|
|
|
- font-size: 18px;
|
|
|
-
|
|
|
- height: 50px;
|
|
|
- overflow: hidden;
|
|
|
- text-overflow: ellipsis;
|
|
|
- display: -webkit-box;
|
|
|
- -webkit-line-clamp: 2; /*行数*/
|
|
|
- -webkit-box-orient: vertical;
|
|
|
-}
|
|
|
-
|
|
|
-.num {
|
|
|
- position: relative;
|
|
|
- font-size: 15px;
|
|
|
- padding-top: 9px;
|
|
|
-}
|
|
|
-
|
|
|
-/*处于手机屏幕时*/
|
|
|
-@media screen and (max-width: 768px) {
|
|
|
- .tit {
|
|
|
- font-weight: 600;
|
|
|
- font-size: 12px;
|
|
|
- height: 32px;
|
|
|
- }
|
|
|
- .time {
|
|
|
- font-size: 10px;
|
|
|
- color: #999;
|
|
|
- }
|
|
|
- .num {
|
|
|
- font-size: 9px;
|
|
|
- padding-top: 3px;
|
|
|
- }
|
|
|
- .bottom {
|
|
|
- margin-top: 2px;
|
|
|
- line-height: 7px;
|
|
|
- }
|
|
|
.coverImg {
|
|
|
height: 120px !important;
|
|
|
}
|
|
|
@@ -175,34 +188,12 @@ export default {
|
|
|
display: block;
|
|
|
}
|
|
|
|
|
|
-.clearfix:before,
|
|
|
-.clearfix:after {
|
|
|
- display: table;
|
|
|
- content: "";
|
|
|
-}
|
|
|
-
|
|
|
-.clearfix:after {
|
|
|
- clear: both;
|
|
|
-}
|
|
|
-
|
|
|
.card {
|
|
|
margin-bottom: 20px;
|
|
|
transition: all 0.6s; /*所有属性变化在0.6秒内执行动画*/
|
|
|
}
|
|
|
|
|
|
-/*.card:hover {
|
|
|
- !*鼠标放上之后元素变成1.06倍大小*!
|
|
|
- transform: scale(1.06);
|
|
|
-}*/
|
|
|
.imgs {
|
|
|
position: relative;
|
|
|
}
|
|
|
-.play-icon {
|
|
|
- position: absolute;
|
|
|
- /*top: -15px;*/
|
|
|
- right: 2%;
|
|
|
- bottom: 5px;
|
|
|
- z-index: 7;
|
|
|
- width: 40px;
|
|
|
-}
|
|
|
</style>
|