<template>
	<view class="sub-base-container">
		<view class="gift-title">
			<view class="name">
				<view class="txt">守护等级规则</view>
				<text>积累能量升等级 获大礼</text>
			</view>
			<image class="icon" :src="`${config.BASIC_IMG}img/subTreePage/energy-icon.png`"></image>
		</view>
		<view class="gift-card energy-card">
			<view class="gift-name">已打卡 <text>2</text>/7 天</view>
			<div class="tips">
				<text>再连续签到5天，获得</text>
				<!-- <img src="@/assets/img/guard_tree/leaf-icon.png" alt="" /> -->
				<text class="score">+30</text>
			</div>
			<div class="check-wrap">
				<div :class="['check-day',{active:item.check}]" v-for="(item, index) in checkDay" :key="index">
					<view class="leaf">
						<image class="icon"
							:src="`${config.BASIC_IMG}img/subTreePage/${item.check?'white-leaf':'leaf-icon'}.png`" alt="">
						</image>
						<text>x20</text>
					</view>
					<div>第{{item.day}}天</div>
				</div>
			</div>
		</view>
		<view class="gift-card">
			<view class="card-title">守护等级划分</view>
			<view class="card-desc">守护等级共有5个等级，您的守护等级会根据您累计的能量值决定的，当您的能量值达到相应的要求即可升级并获得相对应礼物，不同等级的用户获得礼物不同。</view>
			<view class="card-table">
				<view class="table-item" v-for="(item,index) in tableList" :key="index">
					<view class="levle">{{item.level}}等级</view>
					<view>{{item.text}}</view>
					<view class="gift">{{item.gift}}</view>
				</view>
			</view>
		</view>
		<view class="gift-card">
			<view class="card-title">积累能量规则</view>
			<view class="card-desc">每日登录会积累相应的能量，连续登录天数越高能量值越高，每天可以通过做任务增加能量值，每日阳光可以获得 10 能量，分享转发可以获得 10 能量，送ta祝福可以获得 10
				能量，水果订购一次，可以获得 100 能量，但是需要扫描箱内溯源卡的二维码领取。</view>
		</view>
	</view>
</template>

<script setup>
	import config from "@/api/config.js"

	const checkDay = [{
			day: 1,
			check: true
		},
		{
			day: 2,
			check: false
		},
		{
			day: 3,
			check: false
		},
		{
			day: 4,
			check: false
		},
		{
			day: 5,
			check: false
		},
		{
			day: 6,
			check: false
		},
		{
			day: 7,
			check: false
		}
	]

	const tableList = [{
			level: '平民',
			text: '无要求',
			gift: '无礼品'
		},
		{
			level: '青铜',
			text: '达到300能量',
			gift: '一份曲奇'
		},
		{
			level: '白银',
			text: '达到600能量',
			gift: '一份精美水果'
		},
		{
			level: '赤金',
			text: '达到900能量',
			gift: '一份荔枝'
		},
		{
			level: '星勋',
			text: '达到1200能量',
			gift: '一份荔枝'
		}
	]
</script>

<style lang="scss" scoped>
	@import "@/static/style/mixin.scss";

	.sub-base-container {
		@include ossBg("subTreePage/gift-bg.png");
		padding: 12rpx 20rpx;

		.gift-title {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 14rpx;

			.name {
				color: rgba(0, 0, 0, 0.5);
				font-size: 28rpx;

				.txt {
					font-size: 60rpx;
					font-family: 'PangMenZhengDao';
					color: #000;
				}
			}

			.icon {
				width: 212rpx;
				height: 222rpx;
			}
		}

		.energy-card {
			margin-top: -10rpx;
			position: relative;
			z-index: 2;

			.gift-name {
				font-weight: 500;

				text {
					color: #F3B242;
				}
			}

			.tips {
				font-size: 24rpx;
				color: rgba(0, 0, 0, 0.4);

				.score {
					color: #D9AB14;
				}
			}

			.check-wrap {
				margin: 28rpx 0 20rpx 0;
				display: flex;

				.check-day {
					flex: 1;
					padding: 8px 0;
					font-size: 12px;
					color: #F3B242;
					background: rgba(185, 185, 185, 0.1);
					border-radius: 5px;
					text-align: center;

					&.active {
						background-image: linear-gradient(120deg, #FFD887, #ED9E1E);
						color: #fff;
					}

					.leaf {
						font-size: 20rpx;
						display: flex;
						justify-content: center;
						align-items: center;
						.icon{
							width: 32rpx;
							height: 28rpx;
							margin-bottom: 10rpx;
						}
					}
				}

				.check-day+.check-day {
					margin-left: 5px;
				}
			}
		}

		.gift-card {
			border-radius: 16rpx;
			background: #fff;
			padding: 20rpx;

			.card-title {
				font-weight: 500;
			}

			.card-desc {
				margin-top: 10rpx;
				line-height: 36rpx;
				font-size: 24rpx;
			}

			.card-table {
				margin-top: 20rpx;

				.table-item {
					display: flex;
					background: rgba(243, 193, 29, 0.07);

					.levle {
						background: rgba(243, 193, 29, 0.12);
					}

					.gift {
						color: #CC9D00;
					}

					view {
						flex: 1;
						padding: 30rpx 0;
						text-align: center;
						font-size: 28rpx;
					}
				}

				.table-item+.table-item {
					border-top: 2rpx solid rgba(0, 0, 0, 0.06);
				}
			}
		}

		.gift-card+.gift-card {
			margin-top: 20rpx;
		}
	}
</style>