景徳镇旅游微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

207 lines
3.9 KiB

<template>
<scroll-view
scroll-y="true"
:style="{height: height}"
@scrolltolower="loadMoreData">
<view class="videoList">
<view class="video-item"
v-for="(item, index) in spotListWord"
v-if="index < queryParams.pageSize"
:key="index"
>
<view class="image" @click="showVideo(item, index)">
<image :src="item.spotImage && item.spotImage.split(',')[0]" mode="aspectFill">
</image>
</view>
<view class="bottom">
<view class="headImage">
{{ item.spotName }}
</view>
</view>
</view>
</view>
<view class="loadMoreData"
v-if="queryParams.pageSize <= spotListWord.length"
@click="loadMoreData">
了解更多
</view>
</scroll-view>
</template>
<script>
import { mapState } from 'vuex'
export default {
props : {
height : {
default : 'auto'
},
roleId : {
}
},
data() {
return {
queryParams: {
pageNo: 1,
pageSize: 4,
},
total : 0,
list : [],
}
},
computed : {
...mapState(['spotList']),
spotListWord(){
return this.spotList.filter(n => n.categoryId == 0)
},
},
methods: {
showVideo(item, current){
// this.$utils.hanldePreview
// uni.previewMedia({
// current : item.videoContent
// })
this.$utils.navigateTo(`/pages_order/service/articleDetail?id=${item.id}&type=Inheritance`)
return
let sources = []
this.list.forEach(n => {
sources.push({
url : n.travelVideo.videoContent,
type : 'video'
})
})
wx.previewMedia({
sources, // 需要预览的资源列表
current, // 当前显示的资源序号
// url: url // 当前预览资源的url链接
})
},
queryVideoList(){
if(this.roleId){
this.queryParams.roleInfoId = this.roleId
}
if(uni.getStorageSync('token')){
this.queryParams.token = uni.getStorageSync('token')
}
// this.$api('queryVedioById', this.queryParams, res => {
// if(res.code == 200){
// this.list = res.result
// // this.total = res.result.total
// }
// })
},
loadMoreData(){
if(this.queryParams.pageSize <= this.spotListWord.length){
this.queryParams.pageSize += 10
this.queryVideoList()
}
},
addThumpup(videoId){
this.$api('addThumpup', {
videoId
}, res => {
if(res.code == 200){
this.queryVideoList()
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
}
}
</script>
<style scoped lang="scss">
.videoList {
display: flex;
flex-wrap: wrap;
margin-right: 20rpx;
.video-item {
position: relative;
width: calc(50% - 20rpx);
margin-left: 20rpx;
margin-top: 10rpx;
.image {
position: relative;
width: 100%;
overflow: hidden;
image {
width: 100%;
height: 210rpx;
border-radius: 30rpx;
}
.icon {
position: absolute;
right: 30rpx;
top: 30rpx;
width: 60rpx;
height: 60rpx;
background-color: #ffffffaa;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
}
.bottom {
font-size: 28rpx;
display: flex;
justify-content: space-between;
width: calc(100% - 40rpx);
padding: 15rpx;
font-weight: 900;
align-items: center;
.headImage {
display: flex;
align-items: center;
image {
width: 50rpx;
height: 50rpx;
border-radius: 50%;
margin-right: 6rpx;
}
}
.like {
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
font-size: 22rpx;
}
}
}
.showVideo{
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 1000%;
video{
// width: 100%;
// height: 100%;
}
}
}
.loadMoreData{
color: $uni-color;
text-align: center;
padding: 10rpx 0 40rpx 0;
}
</style>