<template>
	<view class="all-circle">
		<view class="circle-up">
			<view @click="clickCircle(`up`)" class="solveclick">
				<image :class="upmenuIndex==0?`circle-img-target` :`circle-img`"
					:src="upmenuIndex==0?`/static/index/keyimg/key1.png`: `/static/index/keyimg/key1-1.png`" />
				<view class="circle-font">
					睡眠
				</view>
			</view>
		</view>
		<view class="circle-leftup">
			<view @click="clickCircle(`leftup`)" class="solveclick">
				<image :class="upmenuIndex==0?`circle-img-target` :`circle-img`"
					:src="upmenuIndex==0?`/static/index/keyimg/key1.png`: `/static/index/keyimg/key5-1.png`" />
				<view class="circle-font">
					饮食
				</view>
			</view>
		</view>
		<view class="circle-rightup">
			<view @click="clickCircle(`rightup`)" class="solveclick">
				<image :class="upmenuIndex==0?`circle-img-target` :`circle-img`"
					:src="upmenuIndex==0?`/static/index/keyimg/key1.png`: `/static/index/keyimg/key4-1.png`" />
				<view class="circle-font">
					清洁
				</view>
			</view>
		</view>
		<view class="circle-leftbottom">
			<view @click="clickCircle(`leftbottom`)" class="solveclick">
				<image :class="upmenuIndex==0?`circle-img-target` :`circle-img`"
					:src="upmenuIndex==0?`/static/index/keyimg/key1.png`: `/static/index/keyimg/key3-1.png`" />
				<view class="circle-font">
					排泄
				</view>
			</view>
		</view>
		<view class="circle-rightbottom">
			<view @click="clickCircle(`rightbottom`)" class="solveclick">
				<image :class="upmenuIndex==0?`circle-img-target` :`circle-img`"
					:src="upmenuIndex==0?`/static/index/keyimg/key1.png`: `/static/index/keyimg/key2-2.png`" />
				<view class="circle-font">
					日常
				</view>
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
	import {
		ref
	} from 'vue'
	const emit = defineEmits(['getDownListIndex']);
	const upmenuIndex = ref(-1)
	const isClick = ref(true);
	const clickCircle = (type : string) => {
		if (isClick.value) {
			switch (type) {
				case 'up':
					isClick.value = false;
					setTimeout(() => {
						upmenuIndex.value = -1;
						isClick.value = true;
						emit('getDownListIndex', 3)
					}, 0)
					break;
				case 'leftup':
					isClick.value = false;
					setTimeout(() => {
						upmenuIndex.value = -1;
						isClick.value = true;
						emit('getDownListIndex', 2)
					}, 0)
					break;
				case "rightup":
					isClick.value = false;
					setTimeout(() => {
						upmenuIndex.value = -1;
						isClick.value = true;
						emit('getDownListIndex', 1)
					}, 0)
					break;
				case "leftbottom":
					isClick.value = false;
					setTimeout(() => {
						upmenuIndex.value = -1;
						isClick.value = true;
						emit('getDownListIndex', 4)
					}, 0)
					break;
				case "rightbottom":
					isClick.value = false;
					setTimeout(() => {
						upmenuIndex.value = -1;
						isClick.value = true;
						emit('getDownListIndex', 0)
					}, 0)
					break;
			}
		}
	}
</script>

<style scoped lang="less">
	.all-circle {
		position: absolute;
		bottom: 300rpx;
		right: 80rpx;
		width: 330rpx;
		height: 330rpx;
		background-color: rgba(110, 149, 217, 0.1);
		border-radius: 50%;
		z-index: 999;
		display: flex;
		border: 1rpx solid #d5d5d5;

		.circle-up {
			position: absolute;
			width: 155rpx;
			height: 155rpx;
			top: -60rpx;
			left: 89rpx;
			border-radius: 50%;
			border: 4rpx solid rgba(110, 149, 217, 0.2);
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.circle-leftup {
			position: absolute;
			width: 155rpx;
			height: 155rpx;
			left: -60rpx;
			top: 40rpx;
			border-radius: 50%;
			border: 4rpx solid rgba(110, 149, 217, 0.2);
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.circle-rightup {
			position: absolute;
			width: 155rpx;
			height: 155rpx;
			right: -60rpx;
			top: 40rpx;
			border-radius: 50%;
			border: 4rpx solid rgba(110, 149, 217, 0.2);
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.circle-leftbottom {
			position: absolute;
			width: 155rpx;
			height: 155rpx;
			left: 0rpx;
			bottom: -30rpx;
			border-radius: 50%;
			border: 4rpx solid rgba(110, 149, 217, 0.2);
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.circle-rightbottom {
			position: absolute;
			width: 155rpx;
			height: 155rpx;
			right: 0rpx;
			bottom: -30rpx;
			border-radius: 50%;
			border: 4rpx solid rgba(110, 149, 217, 0.2);
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.circle-up-target {
			position: absolute;
			width: 170rpx;
			height: 170rpx;
			top: -60rpx;
			left: 89rpx;
			border-radius: 50%;
			border: 4rpx solid rgba(110, 149, 217, 0.2);
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}

	.circle-img {
		width: 130rpx;
		height: 130rpx;
	}

	.circle-img-target {
		width: 140rpx;
		height: 140rpx;
	}

	.circle-font {
		position: absolute;
		bottom: 25rpx;
		left: 45rpx;
		color: #fff;
	}

	.solveclick {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>