<template>
  <div class="login-page">
    <!-- 登录模态框组件 -->
    <LoginModal ref="loginModalRef" :close-on-click-overlay="false"/>
  </div>
</template>
<script setup>
import { useRouter, useRoute } from 'vue-router'
import LoginModal from '@/components/LoginModal.vue'
import { onMounted, ref } from 'vue'

const loginModalRef = ref(null)
const router = useRouter()
const route = useRoute()

onMounted(async () => {
  loginModalRef.value.showModal(() => {
    // 登录成功的回调函数
    const redirectPath = route.query.redirect || '/dashboard'
    router.push(redirectPath)
  })
})
</script>
