<template>
	<up-popup :show="showPopup" mode="center" round="20" @close="handleClose">
		<view class="album-popup">
			<view class="album-title">
				<view class="name">
					果树相册
					<view class="sub-name">无人机实时监测生长情况</view>
				</view>
				<image class="icon" :src="`${config.BASIC_IMG}img/treePage/drone-icon-popup.png`"></image>
			</view>
			<view class="album-cont">
				<view class="time-line">
					<view class="time-item" v-for="item in 6" :key="item">
						<text :style="{color:item==6?'#2199F8':'#DBDBDB'}">07/28</text>
						<view class="dot" :style="{background:item==6?'#2199F8':'#DBDBDB'}"></view>
						<text class="today" v-if="item==6">今</text>
					</view>
				</view>
				<view class="swiper-wrap">
					<swiper class="swiper">
						<swiper-item v-for="(item,index) in list1">
							<image class="img" :src="item"></image>
						</swiper-item>
					</swiper>
					<view class="arrow left">
						<up-icon name="arrow-left" bold color="#F0D09C" size="22"></up-icon>
					</view>
					<view class="arrow right">
						<up-icon name="arrow-right" bold color="#F0D09C" size="22"></up-icon>
					</view>
				</view>
			</view>
		</view>
	</up-popup>
</template>

<script setup>
	import config from "@/api/config.js"
	import {
		ref,
		watch
	} from "vue";

	const props = defineProps({
		show: {
			type: Boolean,
			defalut: false,
		},
	});
	
	const showPopup = ref(false);
	const handleClose = ()=>{
		showPopup.value = false
	}
	const list1 = ref([
		'https://cdn.uviewui.com/uview/album/1.jpg',
		'https://cdn.uviewui.com/uview/album/2.jpg',
		'https://cdn.uviewui.com/uview/album/3.jpg',
	]);
	
	watch(
		() => props.show,
		() => {
			showPopup.value = true;
		}
	);
</script>

<style lang="scss" scoped>
	.album-popup {
		width: 92vw;

		.album-title {
			padding: 30rpx 0 46rpx 30rpx;
			position: relative;
			background-image: linear-gradient(120deg, #79C4FF 13%, #FFFFFF 66%);
			border-radius: 40rpx 40rpx 0 0;
			line-height: 44rpx;

			.name {
				color: #004275;
				font-size: 48rpx;
				font-family: 'PangMenZhengDao';

				.sub-name {
					font-size: 24rpx;
				}
			}

			.icon {
				position: absolute;
				top: -100rpx;
				right: -26rpx;
				width: 364rpx;
				height: 300rpx;
			}
		}

		.album-cont {
			position: relative;
			z-index: 2;
			margin-top: -34rpx;
			padding: 32rpx 0 20rpx;
			background: #fff;
			border-radius: 40rpx;
			.time-line{
				margin-bottom: 16rpx;
				display: flex;
				.time-item{
					flex: 1;
					font-size: 24rpx;
					color: #DBDBDB;
					display: flex;
					flex-direction: column;
					align-items: center;
					position: relative;
					&::before{
						content: '';
						position: absolute;
						top: 44%;
						width: 100%;
						height: 2rpx;
						background: rgba(136, 136, 136, 0.1);
					}
					
					.dot{
						width: 14rpx;
						height: 14rpx;
						background: #DBDBDB;
						border-radius: 50%;
					}
					.today{
						color: #2199F8;
						margin-top: 8rpx;
					}
				}
			}
			.swiper-wrap{
				position: relative;
				padding: 0 20rpx;
				.swiper {
					width: 100%;
					height: 496rpx;
					
					.img{
						width: 100%;
						height: 100%;
						border-radius: 16rpx;
					}
				}
				.arrow{
					position: absolute;
					top: calc(50% - 40rpx);
					width: 80rpx;
					height: 80rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 50%;
					background: rgba(0, 0, 0, .6);
				}
				.left{
					left: 32rpx;
				}
				.right{
					right: 32rpx;
				}
			}
		}
	}
</style>