<template>
    <div class="placeholder-page">
        <div class="placeholder-card">
            <el-icon class="placeholder-icon" :size="80">
                <Tools />
            </el-icon>
            <h2 class="placeholder-title">{{ moduleTitle }}</h2>
            <p class="placeholder-desc">该模块正在建设中，敬请期待</p>
            <el-button type="primary" @click="goHome">返回首页</el-button>
        </div>
    </div>
</template>

<script setup lang="ts">
import { Tools } from '@element-plus/icons-vue'
import { computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { resolveModuleByPath, getModuleDefinition } from '@/enums/ModuleEnum'

const route = useRoute()
const router = useRouter()

const moduleTitle = computed(() => {
    const key = resolveModuleByPath(route.path)
    return getModuleDefinition(key)?.title ?? '该模块'
})

const goHome = () => {
    router.push('/home')
}
</script>

<style lang="scss" scoped>
.placeholder-page {
    height: 100%;
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fa;
}

.placeholder-card {
    text-align: center;
    padding: 60px 80px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);

    .placeholder-icon {
        color: #1e88e5;
        margin-bottom: 24px;
    }

    .placeholder-title {
        font-size: 24px;
        color: #333;
        margin: 0 0 12px;
    }

    .placeholder-desc {
        font-size: 14px;
        color: #909399;
        margin: 0 0 32px;
    }
}
</style>
