Commit 7c84a95f by Sweet Zhang

解决菜单一直存在的问题

parent 266913ac
<template> <template>
<div id="app" class="min-h-screen bg-gray-50 text-gray-800 flex flex-col"> <div id="app" class="min-h-screen bg-gray-50 text-gray-800 flex flex-col">
<!-- 登录页面 -->
<LoginPage v-if="route.path === '/login'" @login="handleLogin" />
<!-- 主应用布局 --> <!-- 主应用布局 -->
<div class="flex flex-1 h-screen"> <div v-else class="flex flex-1 h-screen">
<!-- 侧边导航 --> <!-- 侧边导航 -->
<Sidebar <Sidebar
:current-page="currentPage" :current-page="currentPage"
...@@ -49,6 +52,7 @@ ...@@ -49,6 +52,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, watch } from 'vue' import { ref, onMounted, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import LoginPage from './views/LoginPage.vue'
import Sidebar from './views/Sidebar.vue' import Sidebar from './views/Sidebar.vue'
import MobileSidebar from './views/MobileSidebar.vue' import MobileSidebar from './views/MobileSidebar.vue'
import { pageTitles } from '@/utils/menuConfig' import { pageTitles } from '@/utils/menuConfig'
...@@ -76,6 +80,18 @@ const toggleSidebar = () => { ...@@ -76,6 +80,18 @@ const toggleSidebar = () => {
sidebarCollapsed.value = !sidebarCollapsed.value sidebarCollapsed.value = !sidebarCollapsed.value
} }
// 登录处理
const handleLogin = () => {
// 检查是否有重定向路径
const redirectPath = localStorage.getItem('redirectPath')
if (redirectPath) {
router.push(redirectPath)
localStorage.removeItem('redirectPath')
} else {
router.push('/compose')
}
}
// 退出登录处理 // 退出登录处理
const handleLogout = () => { const handleLogout = () => {
// 清除本地存储的token // 清除本地存储的token
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment