<template>
	<view>
		<view class="content">
			<view class="title">
				<view class="label label_1">排名</view>
				<view class="label label_2">姓名</view>
				<view class="label label_3">完成数</view>
				<view class="label label_4">总用时</view>
			</view>
			<scroll-view scroll-y @scrolltolower="scrolltolower">
				<view class="list">
					<view class="item" v-for="(item,index) in list" :key="index">
						<view class="label label_1">
							<view class="index" v-if="index == 0" style="background-color: #FFCE30;">
								{{index+1}}
							</view>
							<view class="index" v-else-if="index == 1" style="background-color: #BABABA;">
								{{index+1}}
							</view>
							<view class="index" v-else-if="index == 2" style="background-color: #CF892E;">
								{{index+1}}
							</view>
							<view class="index" v-else>
								{{index+1}}
							</view>
						</view>
						<view class="label label_2">
							<view class="img">
								<image :src="item.sign" mode="aspectFill"></image>
							</view>
							<view class="name">{{item.name}}</view>
						</view>
						<view class="label label_3">
							<view class="num">{{item.num}}</view>
						</view>
						<view class="label label_4">
							<view class="time">{{Math.floor(item.completion_time/60)}}分钟{{item.completion_time%60}}秒</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			};
		},
		onLoad(option) {
			console.log(option)
			this.get_jigsawPuzzle_getRankingById(option.id)
		},
		methods:{
			scrolltolower(){
				console.log('++')
			},
			get_jigsawPuzzle_getRankingById(id){
				this.$api.jigsawPuzzle_getRankingById({
					special_id:id
				}).then((res)=>{
					console.log(res.data.data)
					
					this.list = res.data.data
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		box-sizing: border-box;
		padding: 25rpx;

		background-color: #009FE8;
	}

	.content {
		width: 700rpx;
		// height: 100vh;
		height: calc(100vh - 140rpx);
		background-image: url(./icon/bg.png);
		background-size: 100% 100%;
		background-repeat: no-repeat;
	}
	
	.title{
		width: 700rpx;
		box-sizing: border-box;
		padding: 50rpx 25rpx 25rpx;
		
		display: flex;
		justify-content: space-between;
		.label{
			color: #CBA164;
			font-size: 28rpx;
			text-align: center;
			font-weight: 700;
		}
		.label_1{
			width: 70rpx;
		}
		.label_2{
			width: 200rpx;
		}
		.label_3{
			width: 90rpx;
		}
		.label_4{
			width: 190rpx;
		}
	}
	
	.list{
		height: calc(100vh - 320rpx);
		
		width: 700rpx;
		box-sizing: border-box;
		padding: 0 25rpx;
		
		.item{
			margin-bottom: 10rpx;
			width: 650rpx;
			height: 100rpx;
			
			background-image: url(./icon/item.png);
			background-size: 100% 100%;
			background-repeat: no-repeat;
			
			display: flex;
			justify-content: space-between;
			align-items: center;
			
			text-align: center;
			font-size: 28rpx;
			color: #3A230A;
			.label_1{
				padding-left: 15rpx;
				width: 70rpx;
				color: #FFFFFF;
				font-weight: 700;
				
				.index{
					width:55rpx;
					height:55rpx;
					line-height:55rpx;
					border-radius: 50%;
				}
			}
			.label_2{
				width: 190rpx;
				display: flex;
				align-items: center;
				.img{
					margin-right: 15rpx;
					image{
						border: 4rpx solid #FFFFFF;
						width: 60rpx;
						height: 60rpx;
						display: block;
						border-radius: 50%;
					}
				}
				.name{
					overflow:hidden;
					text-overflow:ellipsis;
					white-space:nowrap;
					
					font-size: 36rpx;
					font-weight: 700;
					color: #FFFFFF;
					text-shadow: 0rpx 4rpx 0rpx #3A230A;
				}
			}
			.label_3{
				width: 90rpx;
			}
			.label_4{
				width: 190rpx;
			}
		}
	}
</style>
