﻿<template>
  <div class="min-h-screen flex items-center justify-center bg-gray-50">
    <div class="text-center">
      <div class="animate-spin rounded-full h-32 w-32 border-b-2 border-blue-600 mx-auto"></div>
      <p class="mt-4 text-gray-600">{{ redirectMessage }}</p>
    </div>
  </div>
</template>

<script setup>
// 设置页面元数据
definePageMeta({
  layout: false
})

// 页面标题
useHead({
  title: '翻译管理系统'
})

// 响应式数据
const redirectMessage = ref('正在检查登录状态...')

// 智能跳转逻辑
onMounted(() => {
  if (process.client) {
    // 检查本地存储的登录状态
    const isAuthenticated = localStorage.getItem('isAuthenticated')
    const adminUser = localStorage.getItem('adminUser')
    
    if (isAuthenticated === 'true' && adminUser) {
      // 已登录，跳转到仪表板
      redirectMessage.value = '已登录，正在跳转到仪表板...'
      console.log('用户已登录，跳转到仪表板')
      navigateTo('/dashboard', { replace: true })
    } else {
      // 未登录，跳转到登录页
      redirectMessage.value = '未登录，正在跳转到登录页...'
      console.log('用户未登录，跳转到登录页')
      navigateTo('/login', { replace: true })
    }
  }
})
</script>

