<template>
  <view class="launch-page flex flex-col items-center justify-center min-h-screen bg-background">
    <view class="w-20 h-20 bg-primary rounded-2xl flex items-center justify-center mb-6 shadow-lg">
      <text class="text-3xl font-bold text-white">清</text>
    </view>
    <text class="text-xl font-bold text-gray-800 mb-2">清道夫系统</text>
    <text class="text-sm text-gray-400">智能清洁管理平台</text>
  </view>
</template>

<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import { useAuthStore } from '@/stores'
import { delay } from '@/utils'

const authStore = useAuthStore()

onLoad(async () => {
  await delay(500)
  authStore.checkLogin()
  if (authStore.isLoggedIn && authStore.userRole) {
    uni.switchTab({ url: '/pages/home/home' })
  } else {
    uni.reLaunch({ url: '/pages/login/login' })
  }
})
</script>

<style scoped>
.launch-page {
  max-width: 430px;
  margin: 0 auto;
}
</style>
