<template>
	<view class="center">
		<view class="box" v-for="(item,index) in gameList " >
			<!-- <view class="box-title">
				{{item.name}}
			</view> -->
			<view class="game-box" @click="goGame(item.id,index)">
				<image :src="'../../static/img/game0'+(index%5+1)+'.png'" mode=""></image>
				<view class="game-box-content">{{item.add_time}}
					<view class="game-box-content1">
						{{item.end_time}}
					</view>
				</view>
			</view>
		</view>
		<!-- 	<view class="game-box" @click="goGame(1)">
			<image src="../../static/img/game02.png" mode=""></image>
			<view class="game-box-content" style="color: #BA4FBC;">开打时间
				<view class="game-box-content1" style="background-color: #BA4FBC;">
					每天10:00
				</view>
			</view>
		</view>
		<view class="game-box" @click="goGame(2)">
			<image src="../../static/img/game03.png" mode=""></image>
			<view class="game-box-content" style="color: #E88B2D;">开打时间
				<view class="game-box-content1" style="background-color: #E88B2D;">
					每天10:00
				</view>
			</view>
		</view>
		<view class="game-box" @click="goGame(3)">
			<image src="../../static/img/game04.png" mode=""></image>
			<view class="game-box-content" style="color: #FF6E3E;">开打时间
				<view class="game-box-content1" style="background-color: #FF6E3E;">
					每天10:00
				</view>
			</view>
		</view>
		<view class="game-box" @click="goGame(4)">
			<image src="../../static/img/game05.png" mode=""></image>
			<view class="game-box-content" style="color:#21BB9F;">开打时间
				<view class="game-box-content1" style="background-color: #21BB9F;">
					每天10:00
				</view>
			</view>
		</view> -->
		<!-- <view class="kong">
			<u-empty mode="data" text="敬请期待"></u-empty>
		</view> -->
		<!-- <u-tabbar activeColor="#EE0979" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar> -->
	</view>
</template>

<script>
	import {
		getGame
	} from '@/api/game.js'
	import {
		tabbar
	} from '@/utils/tabbar.js';
	export default {
		data() {
			return {
			
				tabbar: tabbar,
				current: 2,
				add_time: '', //开始事件
				end_time: '', //结束时间
				gameList: '', //游戏列表
			};
		},
		onShow() {
			getGame().then(res => {
				console.log(res, 'res');
				this.gameList = res.data.data
			})
		},
		methods: {
			goGame(e,index) {
				console.log(e, '点击跳转');
				uni.navigateTo({
					url: './gameDetail?id=' + e+'&index='+index
				})
			}
		},
	};
</script>

<style lang="scss">
	.center {
		width: 750rpx;
		padding: 0;
		margin: 20rpx;
	}
	.box-title{
		display: flex;
		font-size: 28rpx;
		font-weight: 500;
	}
	.game-box {
		position: relative;
		// margin: 10rpx;
		width: 690rpx;
		height: 280rpx;

		image {
			width: 100%;
			height: 100%;

		}
	}


	.game-box-content {
		top: 200rpx;
		left: 60rpx;
		line-height: 40rpx;
		position: absolute;
		font-size: 24rpx;
		font-weight: 500;
		color: #8F6AFD;
		padding-left: 10rpx;
		width: 500rpx;
		height: 40rpx;
		background: #FFFFFF;
		border-radius: 27rpx;
		align-items: center;

		.game-box-content1 {
			align-items: center;
			position: absolute;
			right: 0;
			top: 0;
			line-height: 40rpx;
			text-align: center;
			width: 270rpx;
			height: 40rpx;
			background: #754AF0;
			border-radius: 27rpx;
			font-size: 24rpx;
			font-weight: 500;
			color: #FFFFFF;
		}
	}

	// .kong {
	// 	height: 100vh;
	// 	width: 750rpx;
	// }
</style>
