feat: 添加存储配置管理功能

- 添加存储配置管理页面(列表、创建、编辑)
- 支持本地存储、S3、WebDAV、FTP、SFTP 等存储类型
- 添加存储配置测试连接功能
- 本地存储自动初始化且禁止删除
- 修复 Switch 组件状态显示问题
- 添加更新存储配置时的 status 字段支持
This commit is contained in:
2026-05-02 17:48:58 +08:00
parent ea8ffb6c74
commit 9b82fbef4e
35 changed files with 5425 additions and 21 deletions
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { Boxes, Code, DollarSign, FileLock, Gauge, GitBranch, Hash, Key, Megaphone, MessageSquare, Network, Plug, ScrollText, Shield, Users, Variable } from 'lucide-vue-next'
import { onMounted, reactive } from 'vue'
import { Boxes, Code, CreditCard, DollarSign, FileLock, Gauge, GitBranch, HardDrive, Hash, Key, Mail, Megaphone, MessageSquare, Network, Plug, ScrollText, Settings, Shield, Users, Variable } from 'lucide-vue-next'
import { onMounted, onUnmounted, reactive } from 'vue'
import NavTeam from '@/components/app-sidebar/nav-team.vue'
import TeamSwitcher from '@/components/app-sidebar/team-switcher.vue'
@@ -13,6 +13,49 @@ const user = reactive({
role: 'admin',
})
const siteSettings = reactive({
name: '管理后台',
logo: '',
})
const teams = reactive([
{
name: '管理后台',
logo: Code,
plan: 'Admin',
},
])
function loadSystemSettings() {
const storedSettings = localStorage.getItem('systemSettings')
if (storedSettings) {
try {
const parsed = JSON.parse(storedSettings)
if (parsed.site_name) {
siteSettings.name = parsed.site_name
teams[0].name = parsed.site_name
}
if (parsed.site_logo) {
siteSettings.logo = parsed.site_logo
}
}
catch (e) {
console.error('Failed to parse systemSettings from localStorage', e)
}
}
}
function handleSettingsChange(event: CustomEvent) {
const settings = event.detail
if (settings.site_name) {
siteSettings.name = settings.site_name
teams[0].name = settings.site_name
}
if (settings.site_logo) {
siteSettings.logo = settings.site_logo
}
}
onMounted(() => {
const storedUser = localStorage.getItem('user')
if (storedUser) {
@@ -27,15 +70,14 @@ onMounted(() => {
console.error('Failed to parse user from localStorage', e)
}
}
loadSystemSettings()
window.addEventListener('system-settings-changed', handleSettingsChange as EventListener)
})
const teams = [
{
name: '管理后台',
logo: Code,
plan: 'Admin',
},
]
onUnmounted(() => {
window.removeEventListener('system-settings-changed', handleSettingsChange as EventListener)
})
const navMain = [
{
@@ -133,6 +175,31 @@ const navMain = [
},
],
},
{
title: '系统管理',
items: [
{
title: '系统设置',
url: '/admin/system-settings',
icon: Settings,
},
{
title: '支付渠道',
url: '/admin/payment-channels',
icon: CreditCard,
},
{
title: '邮箱配置',
url: '/admin/email-settings',
icon: Mail,
},
{
title: '存储管理',
url: '/admin/storage-configs',
icon: HardDrive,
},
],
},
]
</script>