feat: PURO AI landing + auth + docs redesign #1
@@ -36,15 +36,6 @@ const routes: RouteRecordRaw[] = [
|
|||||||
title: 'Home'
|
title: 'Home'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/landing-preview',
|
|
||||||
name: 'LandingPreview',
|
|
||||||
component: () => import('@/views/landing/LandingView.vue'),
|
|
||||||
meta: {
|
|
||||||
requiresAuth: false,
|
|
||||||
title: 'PURO AI'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
@@ -133,7 +124,13 @@ const routes: RouteRecordRaw[] = [
|
|||||||
// ==================== User Routes ====================
|
// ==================== User Routes ====================
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
redirect: '/home'
|
name: 'Landing',
|
||||||
|
component: () => import('@/views/landing/LandingView.vue'),
|
||||||
|
meta: {
|
||||||
|
requiresAuth: false,
|
||||||
|
title: 'PURO AI — 你的 AI 订阅,已经付过钱了',
|
||||||
|
redirectIfAuth: '/dashboard'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/dashboard',
|
path: '/dashboard',
|
||||||
@@ -542,6 +539,13 @@ router.beforeEach((to, _from, next) => {
|
|||||||
authInitialized = true
|
authInitialized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auth-aware redirect for public pages that should bounce authenticated users elsewhere
|
||||||
|
// (e.g., Landing / at `/` redirects to /dashboard if user is logged in)
|
||||||
|
const redirectIfAuth = to.meta.redirectIfAuth
|
||||||
|
if (redirectIfAuth && authStore.isAuthenticated) {
|
||||||
|
return next(redirectIfAuth)
|
||||||
|
}
|
||||||
|
|
||||||
// Set page title
|
// Set page title
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
// For custom pages, use menu item label as document title
|
// For custom pages, use menu item label as document title
|
||||||
|
|||||||
6
frontend/src/router/meta.d.ts
vendored
6
frontend/src/router/meta.d.ts
vendored
@@ -7,6 +7,12 @@ import 'vue-router'
|
|||||||
|
|
||||||
declare module 'vue-router' {
|
declare module 'vue-router' {
|
||||||
interface RouteMeta {
|
interface RouteMeta {
|
||||||
|
/**
|
||||||
|
* If set, authenticated users visiting this route are redirected to this path.
|
||||||
|
* Used for public pages (e.g., Landing `/`) that should bounce logged-in users to the app.
|
||||||
|
*/
|
||||||
|
redirectIfAuth?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this route requires authentication
|
* Whether this route requires authentication
|
||||||
* @default true
|
* @default true
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<!-- NAV -->
|
<!-- NAV -->
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<div class="container nav-inner">
|
<div class="container nav-inner">
|
||||||
<a href="/" class="brand">
|
<router-link to="/" class="brand">
|
||||||
<span class="hex">⬢</span>
|
<span class="hex">⬢</span>
|
||||||
<span>PURO AI</span>
|
<span>PURO AI</span>
|
||||||
</a>
|
</router-link>
|
||||||
<div class="nav-links">
|
<div class="nav-links">
|
||||||
<a href="#features">产品</a>
|
<a href="#features">产品</a>
|
||||||
<a href="/docs">文档</a>
|
<a href="/docs">文档</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user