|
|
@@ -1,75 +1,29 @@
|
|
|
<template>
|
|
|
- <div v-if="!permissionDenied">
|
|
|
- <el-row class="movie-list">
|
|
|
- <el-col :md="24">
|
|
|
- <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">
|
|
|
- <router-link target="_blank" :to="`/user/${user.userId}/image`">
|
|
|
- <span>{{ user.screenName }}的相册</span>
|
|
|
- </router-link>
|
|
|
- <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>
|
|
|
- <br>
|
|
|
- <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, index) in data.images" :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
|
|
|
- lazy
|
|
|
- fit="cover"
|
|
|
- class="coverImg"
|
|
|
- :src="image.thumbnailUrl"
|
|
|
- @click="showImages(index)"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div style="padding: 14px;">
|
|
|
+ <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">
|
|
|
+ <el-card :body-style="{ padding: '0px' }" class="card">
|
|
|
+ <div class="imgs">
|
|
|
+ <el-image
|
|
|
+ lazy
|
|
|
+ fit="cover"
|
|
|
+ class="coverImg"
|
|
|
+ :src="image.thumbnailUrl"
|
|
|
+ @click="showImages(index)"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div style="padding: 14px;">
|
|
|
<span>
|
|
|
<i v-if="image.collected" class="el-icon-star-on" @click="collectItem(image)" />
|
|
|
<i v-else class="el-icon-star-off" @click="collectItem(image)" />
|
|
|
</span>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- <div v-else>
|
|
|
- <permission-denied-card :text-object="textObject" />
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
@@ -79,59 +33,19 @@ import { getAlbum } from '@/api/image'
|
|
|
import { collectItem } from '@/api/collect'
|
|
|
|
|
|
export default {
|
|
|
- name: 'FileImage',
|
|
|
+ name: 'Share',
|
|
|
components: { PermissionDeniedCard },
|
|
|
data() {
|
|
|
return {
|
|
|
// 屏幕宽度, 为了控制分页条的大小
|
|
|
screenWidth: document.body.clientWidth,
|
|
|
- currentPage: 1,
|
|
|
- user: null,
|
|
|
- followButton: {
|
|
|
- icon: 'el-icon-plus',
|
|
|
- text: '关注'
|
|
|
+ data: {
|
|
|
+ images: []
|
|
|
},
|
|
|
- data: null,
|
|
|
- dataList: [],
|
|
|
- permissionDenied: false,
|
|
|
- textObject: {
|
|
|
- content: '相册',
|
|
|
- route: '/image'
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- const albumId = this.$route.params.albumId
|
|
|
- getAlbum(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
|
|
|
- })
|
|
|
- })
|
|
|
+ document.title = '我的图片'
|
|
|
},
|
|
|
mounted() {
|
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
|
@@ -143,72 +57,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- followUser(userId) {
|
|
|
- if (this.followButton.text === '关注') {
|
|
|
- followUser(userId).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.followButton.text = '已关注'
|
|
|
- this.followButton.icon = 'el-icon-check'
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- unfollowUser(userId).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.followButton.text = '关注'
|
|
|
- this.followButton.icon = 'el-icon-plus'
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- sendMessage(userId) {
|
|
|
- console.log('发送消息')
|
|
|
- },
|
|
|
- showImages(index) {
|
|
|
- const imageUrls = []
|
|
|
- for (const i of this.data.images) {
|
|
|
- imageUrls.push(i.originalUrl)
|
|
|
- }
|
|
|
-
|
|
|
- this.$viewerApi({
|
|
|
- images: imageUrls,
|
|
|
- options: {
|
|
|
- initialViewIndex: index,
|
|
|
- movable: true,
|
|
|
- fullscreen: false,
|
|
|
- keyboard: true
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- collectItem(image) {
|
|
|
- const jsonData = {}
|
|
|
- jsonData.contentType = 1001
|
|
|
- jsonData.contentId = image.imageFileId
|
|
|
- if (image.collected) {
|
|
|
- jsonData.collected = false
|
|
|
- collectItem(jsonData).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.$notify({
|
|
|
- title: '取消收藏图片',
|
|
|
- type: 'info',
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
- image.collected = false
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- jsonData.collected = true
|
|
|
- collectItem(jsonData).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.$notify({
|
|
|
- title: '图片已收藏',
|
|
|
- type: 'info',
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
- image.collected = true
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</script>
|