<template>
	<div class="profile-info">
		<div class="avatar-wrapper">
			<a-avatar :size="100" :src="userInfo.avatar" @click="handleAvatarClick">
				{{ userInfo.nickname?.charAt(0) }}
			</a-avatar>
		</div>
		<div class="user-name">
			{{ userInfo.nickname || userInfo.username }}
		</div>
		<a-tag :color="userInfo.status === 1 ? 'green' : 'red'">
			{{ userInfo.status === 1 ? '正常' : '禁用' }}
		</a-tag>
	</div>
</template>

<script setup>
const props = defineProps({
	userInfo: {
		type: Object,
		default: () => ({}),
	},
})

const emit = defineEmits(['avatar-click'])

const handleAvatarClick = () => {
	emit('avatar-click')
}
</script>

<style scoped lang="scss">
.profile-info {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 20px 0;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-radius: 8px;
	margin-bottom: 16px;
	color: #fff;

	.avatar-wrapper {
		margin-bottom: 12px;
		cursor: pointer;

		.ant-avatar {
			border: 3px solid rgba(255, 255, 255, 0.3);
			background: rgba(255, 255, 255, 0.2);
			font-size: 40px;
			font-weight: bold;
			color: #fff;
			transition: all 0.3s;

			&:hover {
				border-color: rgba(255, 255, 255, 0.6);
				transform: scale(1.05);
			}
		}
	}

	.user-name {
		font-size: 18px;
		font-weight: 600;
		margin-bottom: 8px;
	}

	.ant-tag {
		margin: 0;
		background: rgba(255, 255, 255, 0.2);
		border: 1px solid rgba(255, 255, 255, 0.3);
		color: #fff;
	}
}
</style>
