<!-- 4.户型展示 高层 -->
<template>
	<view class="content">
		<div class="top">
			<swiper class="swiper" circular :interval="2000" :duration="500" :indicatorDots="true">
				<swiper-item>
					<div class="top-content-item top-content-one">
						<div></div>
						<div @click="show(1)"></div>
					</div>
				</swiper-item>
				<swiper-item>
					<div class="top-content-item top-content-two">
						<div></div>
						<div @click="show(2)"></div>
					</div>
				</swiper-item>
				<swiper-item>
					<div class="top-content-item top-content-three">
						<div></div>
						<div @click="show(3)"></div>
					</div>
				</swiper-item>
			</swiper>
		</div>
		<div class="bottom">
			<Menu :type="4" :child-type="41" />
		</div>
	</view>

	<div v-if="isOpen" class="dialog" @click="hide">
		<image :src="pic" />
	</div>
</template>

<script setup>
	import Menu from '../../components/Menu.vue'
	import {
		ref
	} from 'vue';

	const show = (index) => {
		switch (index) {
			case 1:
				pic.value = "/static/four111.jpg";
				break;
			case 2:
				pic.value = "/static/four112.jpg";
				break;
			case 3:
				pic.value = "/static/four113.jpg";
				break;
		}
		isOpen.value = true;
	}

	const hide = () => {
		isOpen.value = false;
	}

	const isOpen = ref(false);
	const pic = ref(null);
</script>

<style scoped>
	.content {
		display: flex;
		flex-direction: column;
		height: 100%;
	}

	.top {
		flex: 12;
	}

	.bottom {
		flex: 1;
		background-color: rgba(44 61, 43, 1);
	}

	.swiper {
		height: 100%;
		padding: 10rpx;
		box-sizing: border-box;
	}

	.top-content {
		display: flex;
		width: 100%;
		height: 100%;
	}

	.top-content-item {
		display: flex;
	}

	.top-content-item>div {
		flex: 1;
	}

	.top-content-one {
		height: 100%;
		background: url('~@/static/four11.jpg') no-repeat;
		background-size: 100% 100%;
	}

	.top-content-two {
		height: 100%;
		background: url('~@/static/four12.jpg') no-repeat;
		background-size: 100% 100%;
	}

	.top-content-three {
		height: 100%;
		background: url('~@/static/four13.jpg') no-repeat;
		background-size: 100% 100%;
	}

	.dialog {
		background-color: rgba(0, 0, 0, 0.5);
		width: 100%;
		height: 100%;
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.dialog>image {
		height: 90%;
		width: 45%;

	}
</style>