refactor(web): 重构前端界面组件和导航结构
All checks were successful
Build Multi-Platform Binaries / build-frontend (push) Successful in 40s
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Successful in 1m24s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Successful in 1m27s
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Successful in 1m27s
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Successful in 1m49s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Successful in 1m15s
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Successful in 1m39s
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Successful in 1m45s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Successful in 2m2s
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Successful in 1m13s
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Successful in 1m46s
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Successful in 1m20s

- 替换 naive-ui 导航组件为自定义玻璃态设计组件
- 引入 GlassModal、GlassSwitch、GlassTag 等自定义组件
- 更新 App.vue 中的布局结构和样式设计
- 重构客户端视图中的表单验证逻辑
- 移除 tabs 组件改用侧边栏导航菜单
- 添加内联日志面板组件
- 优化响应式布局和移动端适配
- 更新图标组件引用方式
- 简化表单验证实现方式
- 添加插件下拉菜单功能
- 优化客户端管理界面UI
- 更新依赖注入声明文件
- 重构用户菜单交互逻辑
- 移除路由跳转相关代码优化性能
This commit is contained in:
Flik
2026-01-22 17:37:26 +08:00
parent 4500f48d4c
commit 67c41cde5c
13 changed files with 2025 additions and 786 deletions

View File

@@ -0,0 +1,129 @@
import { ref, createApp, h } from 'vue'
interface DialogOptions {
title: string
content: string
positiveText?: string
negativeText?: string
onPositiveClick?: () => void | Promise<void>
onNegativeClick?: () => void
}
const dialogVisible = ref(false)
const dialogOptions = ref<DialogOptions | null>(null)
const DialogComponent = {
setup() {
const handlePositive = async () => {
if (dialogOptions.value?.onPositiveClick) {
await dialogOptions.value.onPositiveClick()
}
dialogVisible.value = false
}
const handleNegative = () => {
dialogOptions.value?.onNegativeClick?.()
dialogVisible.value = false
}
return () => {
if (!dialogVisible.value || !dialogOptions.value) return null
return h('div', { class: 'dialog-overlay', onClick: handleNegative },
h('div', { class: 'dialog-container', onClick: (e: Event) => e.stopPropagation() }, [
h('h3', { class: 'dialog-title' }, dialogOptions.value.title),
h('p', { class: 'dialog-content' }, dialogOptions.value.content),
h('div', { class: 'dialog-footer' }, [
h('button', { class: 'dialog-btn', onClick: handleNegative },
dialogOptions.value.negativeText || '取消'),
h('button', { class: 'dialog-btn primary', onClick: handlePositive },
dialogOptions.value.positiveText || '确定')
])
])
)
}
}
}
let containerMounted = false
function ensureContainer() {
if (containerMounted) return
const container = document.createElement('div')
container.id = 'dialog-root'
document.body.appendChild(container)
const app = createApp(DialogComponent)
app.mount(container)
containerMounted = true
// Add styles
const style = document.createElement('style')
style.textContent = `
.dialog-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 9998;
}
.dialog-container {
background: rgba(30, 27, 75, 0.95);
backdrop-filter: blur(20px);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.12);
padding: 24px;
max-width: 400px;
width: 90%;
}
.dialog-title {
margin: 0 0 12px 0;
font-size: 18px;
font-weight: 600;
color: white;
}
.dialog-content {
margin: 0 0 20px 0;
color: rgba(255, 255, 255, 0.7);
font-size: 14px;
line-height: 1.6;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
}
.dialog-btn {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 8px;
padding: 8px 16px;
color: white;
font-size: 14px;
cursor: pointer;
transition: all 0.2s;
}
.dialog-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
.dialog-btn.primary {
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
border: none;
}
`
document.head.appendChild(style)
}
export function useConfirm() {
return {
warning: (options: DialogOptions) => {
ensureContainer()
dialogOptions.value = options
dialogVisible.value = true
}
}
}

View File

@@ -0,0 +1,101 @@
import { ref, createApp, h } from 'vue'
interface ToastOptions {
message: string
type: 'success' | 'error' | 'warning' | 'info'
duration?: number
}
const toasts = ref<Array<ToastOptions & { id: number }>>([])
let toastId = 0
const ToastContainer = {
setup() {
return () => h('div', { class: 'toast-container' },
toasts.value.map(toast =>
h('div', {
key: toast.id,
class: ['toast-item', toast.type]
}, toast.message)
)
)
}
}
let containerMounted = false
function ensureContainer() {
if (containerMounted) return
const container = document.createElement('div')
container.id = 'toast-root'
document.body.appendChild(container)
const app = createApp(ToastContainer)
app.mount(container)
containerMounted = true
// Add styles
const style = document.createElement('style')
style.textContent = `
.toast-container {
position: fixed;
top: 20px;
right: 20px;
z-index: 9999;
display: flex;
flex-direction: column;
gap: 8px;
}
.toast-item {
padding: 12px 20px;
border-radius: 8px;
font-size: 14px;
color: white;
backdrop-filter: blur(20px);
animation: toast-in 0.3s ease;
max-width: 350px;
}
.toast-item.success {
background: rgba(52, 211, 153, 0.9);
}
.toast-item.error {
background: rgba(239, 68, 68, 0.9);
}
.toast-item.warning {
background: rgba(251, 191, 36, 0.9);
color: #1e1b4b;
}
.toast-item.info {
background: rgba(96, 165, 250, 0.9);
}
@keyframes toast-in {
from { opacity: 0; transform: translateX(20px); }
to { opacity: 1; transform: translateX(0); }
}
`
document.head.appendChild(style)
}
function showToast(options: ToastOptions) {
ensureContainer()
const id = ++toastId
toasts.value.push({ ...options, id })
setTimeout(() => {
const index = toasts.value.findIndex(t => t.id === id)
if (index > -1) {
toasts.value.splice(index, 1)
}
}, options.duration || 3000)
}
export function useToast() {
return {
success: (message: string) => showToast({ message, type: 'success' }),
error: (message: string) => showToast({ message, type: 'error' }),
warning: (message: string) => showToast({ message, type: 'warning' }),
info: (message: string) => showToast({ message, type: 'info' })
}
}