<template>
	<view class="video-list">
		<u-navbar :title="config.store_title" title-color="#fff" :background="{background:'#1F7EFF'}" :border-bottom="false" :isBack="false">
			<view class="u-flex nav-left" slot="left">
				<u-icon name="map-fill" size="34" color="#fff"></u-icon>
				<text class="text">{{defaultcity.city || '定位中'}}</text>
			</view>
		</u-navbar>
		<view class="video1 u-flex u-row-between u-flex-wrap">
			<view class="video-item" v-for="(item,index) in list" :key="index" @click="toinfo(item)">
				<view class="image-box">
					<image :src="item.logo" class="image" mode="aspectFill"></image>
					<image src="../../static/images/video.png" class="play" mode=""></image>
					<!-- <text class="text">03.25</text> -->
				</view>
				<view class="video-name u-line-1">
					{{item.title}}
				</view>
				<view class="time">
					{{item.create_at}}
				</view>
			</view>
		</view>
		<gf-tabbar></gf-tabbar>
	</view>

</template>

<script>
	import { mapState } from "vuex"
	export default {
		data() {
			return {
				page:1,
				list:[]
			}
		},
		onLoad() {
			
		},
		onShow() {
			uni.setNavigationBarTitle({
				title: this.config.store_title
			})
			this.page = 1
			this.list = []
			this.getlist()
		},
		onReachBottom() {
			if (this.list.length % 20 == 0) {
				this.page++
				this.getlist()
			}
		},
		computed: {
			...mapState(['config', 'defaultcity'])
		},
		methods: {
			toinfo(item){
				uni.navigateTo({
					url:"./info?mp4=" + encodeURIComponent(item.video)
				})
			},
			getlist(){
				this.$u.post('/api/Index/video_list',{
					page:this.page,
					page_num:20,
					city_id:this.defaultcity.city_id
				}).then(res => {
					this.list = this.list.concat(res.data)
				})
			}
		}
	}

</script>

<style lang="scss">
	.video-list {
		.nav-left {
			padding: 0 20rpx;

			.text {
				font-size: 32rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				margin-left: 5rpx;
			}
		}

		.video1 {
			padding: 24rpx;

			.video-item {
				width: 340rpx;
				margin-bottom: 18rpx;

				.video-name {
					font-size: 20rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
					margin: 14rpx 0;
					// height: 56rpx;
				}

				.time {
					font-size: 20rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
				}

				.image-box {
					width: 340rpx;
					height: 272rpx;
					position: relative;

					.play {
						width: 64rpx;
						height: 64rpx;
						position: absolute;
						top: 50%;
						left: 50%;
						transform: translate(-50%, -50%);
					}

					.image {
						width: 340rpx;
						height: 272rpx;
						background-color: rgba(0,0,0,0.1);
						border-radius: 10rpx;
					}

					.text {
						position: absolute;
						z-index: 10;
						right: 10rpx;
						bottom: 10rpx;
						font-size: 20rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #FFFFFF;
					}
				}
			}
		}
	}

</style>
