<template>
	<view class="center">
		<view class="box" v-for="(item,index) in gameList ">

			<view class="game-box" @click="goGame(item.id,index)">
				<!-- <view class="box-title">
					超有趣的种植人参游戏
				</view> -->
				<view class="box-titlee">
					消耗积分{{item.lower_limit*1}}~{{item.upper_limit*1}}
				</view>

				<image :src="'../../static/img/index0'+(index%4+1)+'.png'" mode=""></image>
				<view class="game-box-content">{{item.name}}
					<view class="game-box-content1">
						每天{{item.add_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
				console.log(this.gameList, 'resssss');
				res.data.data.forEach(e => {
					// this.end_time = 
					var end = e.add_time.split(' ')
					e.add_time = end[1]

				})

			})
		},
		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;
	}

	.game-box {
		position: relative;
		// margin: 10rpx;
		width: 690rpx;
		height: 280rpx;

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

		}

		.box-title {
			position: absolute;
			z-index: 99;
			top: 40rpx;
			left: 60rpx;
			display: flex;
			font-size: 43rpx;
			font-family: zihun100hao-fangfangxianfengti;
			font-weight: 500;
			color: #29554E;
		}

		.box-titlee {
			position: absolute;
			z-index: 99;
			top: 110rpx;
			left: 200rpx;
			display: flex;
			color: #FFFFFF;
			border: 1rpx solid #f36062;
			background: #f36062;
			border-radius: 10rpx;
			padding: 0 10rpx;
			font-size: 32rpx;
			font-family: zihun100hao-fangfangxianfengti;
			font-weight: 500;
		}
	}


	.game-box-content {
		top: 180rpx;
		left: 60rpx;
		line-height: 55rpx;
		position: absolute;
		font-size: 32rpx;
		font-weight: 500;
		color: #28554E;
		padding-left: 20rpx;
		width: 380rpx;
		height: 55rpx;
		background: #FFFFFF;
		border-radius: 27rpx;
		align-items: center;

		.game-box-content1 {
			align-items: center;
			position: absolute;
			right: 0;
			top: 0;
			line-height: 55rpx;
			text-align: center;
			width: 220rpx;
			height: 55rpx;
			background: #29554E;
			border-radius: 27rpx;
			font-size: 32rpx;
			font-weight: 500;
			color: #FFFFFF;
		}
	}

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