<template>
	<view class="signed_tips_overlay" v-if="visible" @click="handleClose">
		<!-- 背景容器，右下角镂空透明圆角矩形 -->
		<view class="background_container"></view>
		
		<view class="signed_tips_container">
			<!-- <text class="tips_title">签到成功！</text> -->
            <image class="tips_title" :src="$baseUrl + `integral/1023/signedTitle.png`" mode="aspectFit" />
			<text class="points_text">获得{{ points }}积分</text>
		</view>
        <view class="signedbg_icon_container">
			<image class="signedbg_icon" :class="{ 'signedbg_icon_animating': isAnimating }" :src="$baseUrl + `integral/1023/jifenIcon1.png`" mode="aspectFit" />
		</view>
	</view>
</template>

<script setup>
import { defineProps, defineEmits, ref, watch } from 'vue';

// Props 定义
const props = defineProps({
	visible: {
		type: Boolean,
		default: false
	},
	points: {
		type: Number,
		default: 0
	}
});

// Emits 定义
const emit = defineEmits(['close']);

// 是否正在播放动画
const isAnimating = ref(false);

// 关闭弹窗 - 点击时播放动画，动画结束后关闭
const handleClose = () => {
	// 如果正在播放动画，则不重复触发
	if (isAnimating.value) return;
	
	// 开始播放动画
	isAnimating.value = true;
	
	// 动画播放完毕后（1.5秒）关闭弹窗
	setTimeout(() => {
		isAnimating.value = false;
		emit('close');
	}, 1500);
};
</script>

<style lang="less" scoped>
@import '@/components/qiandao/SignedTips.less';
</style>
