| | |
| | | |
| | | <!-- 视频列表 --> |
| | | <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'works' && videoList.length > 0"> |
| | | <view class="video-container"> |
| | | <view |
| | | class="video-item" |
| | | v-for="(item, index) in videoList" |
| | | :key="item.id" |
| | | > |
| | | <image class="video-cover" @click="playAuthorVideo(index)" :src="item.coverUrl" mode="aspectFill"></image> |
| | | <image class="video-cover" @click="playAuthorVideo(index)" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image> |
| | | <view class="video-info"> |
| | | <view class="video-stats"> |
| | | <view class="stat"> |
| | | <uni-icons type="heart" size="16" color="#fff"></uni-icons> |
| | | <text>{{item.collectNum}}</text> |
| | | <view class="more-op"> |
| | | <view class="more-op" v-if="userInfo.self"> |
| | | <dropdown-menu |
| | | :options="item.options" |
| | | :data="{id: item.id, title: item.title}" |
| | | placement="top" |
| | | theme-color="#07C160" |
| | | @change="handleChange" |
| | | ></dropdown-menu> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | :key="item.id" |
| | | @click="playCollectVideo(index)" |
| | | > |
| | | <image class="video-cover" :src="item.coverUrl" mode="aspectFill"></image> |
| | | <image class="video-cover" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image> |
| | | <view class="video-info"> |
| | | <view class="video-stats"> |
| | | <view class="stat"> |
| | |
| | | <!-- <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image> --> |
| | | <text class="empty-text">还没有点赞作品哦~</text> |
| | | </view> |
| | | |
| | | <!-- 删除视频提醒框 --> |
| | | <uni-popup ref="delDialog" type="dialog"> |
| | | <uni-popup-dialog type="error" cancelText="取消" confirmText="删除" title="提醒" :content="`您正在删除:${opVideo.title}`" @confirm="deleteVideo" |
| | | @close="dialogClose"></uni-popup-dialog> |
| | | </uni-popup> |
| | | |
| | | <!-- 下架视频提醒框 --> |
| | | <uni-popup ref="downDialog" type="dialog"> |
| | | <uni-popup-dialog type="error" cancelText="取消" confirmText="下架" title="提醒" :content="`您正在下架:${opVideo.title}`" @confirm="downVideo" |
| | | @close="dialogClose"></uni-popup-dialog> |
| | | </uni-popup> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import DropdownMenu from '@/components/dropdown-menu.vue' |
| | | |
| | | import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage} from '@/api/user.js' |
| | | import {subscribe, unSubscribe} from '@/api/video.js' |
| | | import {subscribe, unSubscribe, delVideo, updateVideo, userDownVideo} from '@/api/video.js' |
| | | export default { |
| | | components: {DropdownMenu}, |
| | | data() { |
| | |
| | | { command: 2, label: '上海' }, |
| | | { command: 3, label: '广州' } |
| | | ], |
| | | opVideo: { // 正在操作的视频 |
| | | id: '', |
| | | title: '' |
| | | }, |
| | | currentTab: 'works', // works: 作品, likes: 喜欢 |
| | | authorId: '', |
| | | userInfo: { |
| | |
| | | this.getAuthorVideoPage(); |
| | | }, |
| | | methods: { |
| | | handleChange(value) { |
| | | dialogClose() { |
| | | this.opVideo = { |
| | | id: '', |
| | | title: '' |
| | | } |
| | | }, |
| | | // 下架视频 |
| | | downVideo() { |
| | | userDownVideo(this.opVideo.id).then(res => { |
| | | uni.showToast({ |
| | | title: '下架成功', |
| | | duration: 2000 |
| | | }); |
| | | // 刷新数据 |
| | | this.videoList = []; |
| | | this.videoQuery.pageNumber = 1; |
| | | this.getAuthorVideoPage(); |
| | | }) |
| | | }, |
| | | // 删除视频 |
| | | deleteVideo() { |
| | | delVideo(this.opVideo.id).then(res => { |
| | | uni.showToast({ |
| | | title: '删除成功', |
| | | duration: 2000 |
| | | }); |
| | | // 刷新数据 |
| | | this.videoList = []; |
| | | this.videoQuery.pageNumber = 1; |
| | | this.getAuthorVideoPage(); |
| | | }) |
| | | }, |
| | | // 触发视频操作 |
| | | handleChange(value, data) { |
| | | console.log('选中值:', value) |
| | | this.opVideo.id = data.id; |
| | | this.opVideo.title = data.title; |
| | | if (value === 'DELETE') { |
| | | this.$refs.delDialog.open() |
| | | } else if (value === 'DOWN') { |
| | | this.$refs.downDialog.open() |
| | | } else if (value === 'EDIT') { |
| | | // 跳转编辑视频页面 |
| | | uni.navigateTo({ |
| | | url: `/pages/video/video-edit?id=${this.opVideo.id}` |
| | | }); |
| | | } |
| | | }, |
| | | getPage() { |
| | | if(this.currentTab === 'works') { |
| | |
| | | }); |
| | | }, |
| | | // 播放收藏视频 |
| | | playAuthorVideo(index) { |
| | | playCollectVideo(index) { |
| | | const playInfo = { |
| | | videoList: this.collectVideoList, |
| | | nomore: this.nomoreCollectVideo, |
| | |
| | | } |
| | | |
| | | .video-list { |
| | | width: calc(100% - 20rpx); |
| | | width: 100%; |
| | | padding: 0 10rpx; |
| | | height: calc(100vh - 554rpx); |
| | | background-color: #fff; |
| | | } |
| | | |
| | | .video-container { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .video-item { |
| | | width: 50%; |
| | | padding: 10rpx; |
| | | box-sizing: border-box; |
| | | width: 49%; |
| | | margin-bottom: 20rpx; |
| | | position: relative; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | .video-info { |
| | | display: flex; |
| | | height: 60rpx; |
| | | align-items: center; |
| | | font-size: 24rpx; |
| | | width: 100%; |
| | | padding-right: 20rpx; |
| | | box-sizing: border-box; |
| | | position: absolute; |
| | | bottom: 20rpx; |
| | | bottom: 10rpx; |
| | | left: 0; |
| | | right: 0; |
| | | padding: 0 10rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .video-title { |
| | |
| | | } |
| | | } |
| | | |
| | | .video-container { |
| | | display: flex; |
| | | flex-wrap: wrap |
| | | } |
| | | </style> |