<template>
	<view>
		<view class="top_color"></view>
		<view class="content">
			<view class="title">{{name}}</view>
			<view class="game_box">
				<image :src="picture" mode="aspectFill"></image>

				<view class="tip">
					<view class="left">
						<view class="icon">
							<image src="./icon/icon.png" mode=""></image>
						</view>
						<view class="text">我的最快纪录</view>
					</view>
					<view class="right">{{completion_time}} 秒</view>
				</view>
			</view>
		</view>

		<view class="btn_box">
			<view class="left">
				<view class="btn btn_1" @click="go_detail()"></view>
				<view class="btn btn_2" @click="again_btn()"></view>
			</view>
			<view class="right" @click="go_personal_rank()">
				<view class="btn">{{rank}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "",
				picture:"",
				name:"",
				completion_time:"",
				page_id:"",
				mine_code:"",
				
				// 排名
				rank:""
			};
		},
		onLoad(option) {
			uni.setNavigationBarTitle({
				title: option.title
			})
			
			this.name = option.name
			this.picture = option.picture
			this.title = option.title
			this.picture_id = option.picture_id
			
			this.$api.jigsawPuzzle_getPictureDetail({
				picture_id: this.picture_id,
				staff_num: uni.getStorageSync('user').staff_num
			}).then((res)=>{
				console.log(res.data.data)
				this.mine_code = res.data.data.mine_code
				this.completion_time = res.data.data.completion_time
				this.page_id = res.data.data.page_id
				
				this.rank = res.data.data.rank
			})
			
		},
		methods: {
			go_personal_rank() {
				uni.navigateTo({
					url: "../personal_rank/personal_rank?title="+this.name+"&picture_id="+this.picture_id
				})
			},
			// 再来一次
			again_btn() {
				uni.redirectTo({
					url: "../game_play/game_play?title="+this.title+"&picture_id="+this.picture_id+"&name="+this.name+"&picture="+this.picture,
				})
			},
			// 查看详情 关联二维码
			go_detail(){
				uni.navigateTo({
					url:"../../../../../index/record/record?pageId="+this.page_id+"&mine_code="+this.mine_code
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F3F8F7;
	}

	.top_color {
		z-index: 1;
		width: 750rpx;
		height: 100rpx;
		background-color: #009fe8;

		position: fixed;
		top: 1;
		left: 0;
	}

	.content {
		position: relative;
		top: 20rpx;
		z-index: 2;
		width: 750rpx;
		background-color: #FFFFFF;
		border-radius: 50rpx;

		padding-bottom: 40rpx;

		.title {
			text-align: center;
			font-size: 36rpx;
			font-weight: 700;
			height: 100rpx;
			line-height: 100rpx;
		}

		.game_box {
			box-sizing: border-box;
			padding: 0 35rpx;

			image {
				width: 680rpx;
				height: 680rpx;
			}

			.tip {
				margin-top: 20rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.left {
					display: flex;
					align-items: center;

					.icon {
						margin-right: 10rpx;

						image {
							width: 28rpx;
							height: 28rpx;
						}
					}

					.text {
						color: #4F4F4F;
						font-size: 26rpx;
					}
				}

				.right {
					font-size: 28rpx;
				}
			}
		}
	}

	.btn_box {
		margin-top: 30rpx;
		box-sizing: border-box;
		padding: 35rpx;

		height: 260rpx;
		display: flex;
		justify-content: space-between;

		.left {
			.btn {
				width: 400rpx;
				height: 125rpx;

				background-size: cover;
				background-repeat: no-repeat;
			}

			.btn_1 {
				margin-bottom: 8rpx;
				background-image: url(./icon/detail.png);
			}

			.btn_2 {
				background-image: url(./icon/again.png);
			}
		}

		.right {
			position: relative;
			width: 260rpx;
			height: 258rpx;

			background-image: url(./icon/rank.png);
			background-size: cover;
			background-repeat: no-repeat;
			
			.btn{
				position: absolute;
				top: 90rpx;
				left: 60rpx;
				font-size: 62rpx;
				color: #FFFFFF;
			}
		}
	}
</style>
