refactor(frontend): 重构前端第二版

This commit is contained in:
sophie committed 2026-06-11 13:47:06 +08:00
1 parent 2631f78b00
commit 4b562cfa82
205 files changed
+15399 -12015

No files matched your search

@@ -0,0 +1,16 @@
<script setup lang="ts">
/**
* shared/layouts/AppHeaderTools.vue
* 顶栏工具区:主题与语言切换。
*/
import ThemeToggleButton from '@/shared/components/ThemeToggleButton.vue';
import LocaleToggleButton from '@/shared/components/LocaleToggleButton.vue';
</script>
<template>
<div class="flex items-center gap-2">
<ThemeToggleButton />
<LocaleToggleButton />
</div>
</template>
+68
View File
@@ -0,0 +1,68 @@
<script setup lang="ts">
/**
* shared/layouts/AppShell.vue
* 通用应用壳层布局。
*/
import { ref } from 'vue';
import { PanelLeftClose, PanelLeftOpen } from 'lucide-vue-next';
import AppHeaderTools from './AppHeaderTools.vue';
withDefaults(
defineProps<{
title?: string;
subtitle?: string;
collapsibleSidebar?: boolean;
}>(),
{
title: '',
subtitle: '',
collapsibleSidebar: true,
}
);
const sidebarCollapsed = ref(false);
</script>
<template>
<div class="page-shell flex min-h-screen flex-col">
<header class="app-header">
<div class="flex min-w-0 items-center gap-3">
<button
v-if="collapsibleSidebar"
type="button"
class="btn-icon-ds hidden md:inline-flex"
:aria-label="sidebarCollapsed ? 'Expand sidebar' : 'Collapse sidebar'"
@click="sidebarCollapsed = !sidebarCollapsed"
>
<PanelLeftOpen v-if="sidebarCollapsed" class="h-5 w-5" />
<PanelLeftClose v-else class="h-5 w-5" />
</button>
<div class="min-w-0">
<slot name="header-brand">
<div v-if="title" class="truncate text-sm font-bold text-primary">{{ title }}</div>
<div v-if="subtitle" class="truncate text-xs text-muted">{{ subtitle }}</div>
</slot>
</div>
</div>
<div class="flex items-center gap-3">
<slot name="header-actions" />
<AppHeaderTools />
</div>
</header>
<div class="flex min-h-0 flex-1">
<aside
v-if="$slots.sidebar"
class="app-sidebar hidden md:block transition-[width] duration-200"
:class="sidebarCollapsed ? 'app-sidebar--collapsed' : ''"
>
<slot name="sidebar" :collapsed="sidebarCollapsed" />
</aside>
<main class="min-w-0 flex-1 overflow-y-auto page-shell-mobile py-6">
<slot />
</main>
</div>
</div>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
/**
* shared/layouts/ChatShell.vue
* 对话页壳层:侧栏 + 主区,颜色走 L1 设计令牌。
*/
</script>
<template>
<div class="relative flex h-screen overflow-hidden bg-page text-secondary">
<slot name="overlay" />
<slot name="sidebar" />
<div class="relative z-10 flex h-full w-full flex-1 flex-col overflow-hidden bg-surface">
<slot />
</div>
</div>
</template>
@@ -0,0 +1,19 @@
<script setup lang="ts">
/**
* shared/layouts/MarketingShell.vue
* 营销/登录页壳层。
*/
/** L3 — 登录 / 营销页布局 */
</script>
<template>
<div class="page-shell min-h-screen">
<div v-if="$slots.tools" class="fixed top-4 right-4 z-50 flex items-center gap-2">
<slot name="tools" />
</div>
<main class="mx-auto max-w-7xl page-shell-mobile pb-12">
<slot />
</main>
</div>
</template>
@@ -0,0 +1,22 @@
<script setup lang="ts">
/**
* shared/layouts/MinimalShell.vue
* 极简壳层(重置密码等)。
*/
/** L3 — 单卡居中页(重置密码等) */
withDefaults(
defineProps<{
maxWidth?: string;
}>(),
{ maxWidth: '28rem' }
);
</script>
<template>
<div class="page-shell flex min-h-screen items-center justify-center p-4">
<div class="card w-full shadow-elevated p-8 md:p-10" :style="{ maxWidth }">
<slot />
</div>
</div>
</template>