<template>
	<view class="container">
		<view class="prizes" >
			<image class="title" :src="$fileUrl() + '/first/title.png'" mode="widthFix"></image>
			<view class="prizesList" v-for="(item, index) in prizeList">
				<image class="bk" :src="$fileUrl() + '/first/bk2.png'" mode="scaleToFill"></image>
				<view class="prizesTitle">
					{{ $selectDictLabel(rewardType, item.type) }}
				</view>
				<view class="prizesImgOne" v-if="item.type == 22">
					<view class="image" v-for="(item2, index2) in item.prizeList">
						<image :class="item2.leftNum == 0 ? '' : ''" :src="item2.icon" mode="heightFix"></image>
					</view>
				</view>
				<view class="prizesImg" v-else>
					<view class="image" v-for="(item2, index2) in item.prizeList">
						<image :class="item2.leftNum == 0 ? '' : ''" :src="item2.icon" mode="heightFix"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		rewardType,
	} from "@/utils/commonConfig.js"
	import {
		prizeListApi,
	} from "@/api/drawCard.js"
	export default {
		data() {
			return {
				rewardType: rewardType,
				params: {
					raffleId: null
				},
				prizeList: [],
			}
		},
		onLoad(query) {
			if (query.raffleId) {
				this.params.raffleId = query.raffleId
				this.getPrizeList()
			}
		},
		onShow() {
			
		},
		methods: {
			getPrizeList() {
				prizeListApi(this.params).then(res => {
					console.log(res, '奖池预览')
					this.prizeList = res.data
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.container {
		background: #9EC8F9;
		padding-top: 15px;
		overflow: auto;
	}
	.prizes {
		.title {
			width: 103px;
			margin: 0 auto;
		}
	
		.prizesList {
			margin: 20px;
			position: relative;
			overflow: hidden;
			// z-index: 5;
			
			.bk {
				width: 100%;
				height: 100%;
				position: absolute;
				top: 0;
			}
			.prizesTitle {
				position: relative;
				height: 30px;
				line-height: 30px;
				width: 100%;
				margin-left: 1px;
				margin-top: 15px;
				padding-left: 15px;
				color: #fff;
				font-weight: 800;
				background: linear-gradient(90deg, rgba(89,166,255,0.8) 0%, rgba(158,200,249,0) 100%);
			}
			.prizesImg {
				position: relative;
				display: grid;
				grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
				margin: 15px;
				white-space: wrap;
				text-align: center;
				// overflow: auto;
				
				.image {
					text-align: center;
					
					image {
						display: inline-block;
						width: 20vw;
						height: 20vw;
						// border-radius: 10px;
						margin: 0 5px;
					}
				}
				
			}
			.prizesImgOne {
				position: relative;
				display: flex;
				justify-content: center;
				margin: 15px;
				
				.image {
					text-align: center;
					
					image {
						display: inline-block;
						width: 45vw;
						height: 45vw;
						border-radius: 10px;
						margin: 0 5px;
					}
				}
			}
		}
	}
</style>