UI彻底重做: 全新设计语言, 纯手工精调
设计系统: - CSS变量体系: 暖纸底色(#F9F7F4), 6级灰阶, 5级阴影 - 字体节奏: clamp响应式字号, -0.02em字间距 - 间距韵律: 4-128px 8级递进 首页: - 96px大留白英雄区, clamp(36px,5vw,56px)巨型标题 - 200px暗色封面卡片(#2C2824) - LIVE红点脉动标签, 待开播黑底白字徽章 - hover抬升2px + 阴影, 淡棕描边高亮 管理页: - stat卡片: 1px边框+3px彩色顶线 - 表格卡片化: borderRadius 12, 统一白底+边框 - 表单/设置: 统一圆角8px, 大内边距36px 播放页: - #1A1814暗底, 毛玻璃顶栏 - 视频圆角12px + boxShadow景深 - document.title动态标题 登录页: 56px内边距, 品牌居中, 返回链接
This commit is contained in:
1 parent
f0b8c2d64f
commit
2685ebdd47
11 files changed
+486
-553
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Card, Select, Switch, Form, Input, Button, Typography, message } from 'antd'
|
||||
import { Select, Switch, Form, Input, Button, Typography, message } from 'antd'
|
||||
import api from '../../api/client'
|
||||
import { useBrand } from '../../brand/BrandContext'
|
||||
|
||||
@@ -14,12 +14,10 @@ const strategies = [
|
||||
|
||||
export default function SettingsPage() {
|
||||
const { brand, refresh } = useBrand()
|
||||
|
||||
const [strategy, setStrategy] = useState('subnet')
|
||||
const [multicastEnabled, setMulticastEnabled] = useState(true)
|
||||
const [multicastAvailable, setMulticastAvailable] = useState(false)
|
||||
const [saving, setSaving] = useState(false)
|
||||
|
||||
const [brandName, setBrandName] = useState(brand.brand_name)
|
||||
const [brandTagline, setBrandTagline] = useState(brand.brand_tagline)
|
||||
const [brandLogoUrl, setBrandLogoUrl] = useState(brand.brand_logo_url)
|
||||
@@ -29,54 +27,37 @@ export default function SettingsPage() {
|
||||
useEffect(() => { setBrandName(brand.brand_name); setBrandTagline(brand.brand_tagline); setBrandLogoUrl(brand.brand_logo_url) }, [brand])
|
||||
|
||||
async function loadSettings() {
|
||||
try {
|
||||
const { data } = await api.get('/nodes/strategy')
|
||||
setStrategy(data.strategy)
|
||||
setMulticastEnabled(data.multicast_enabled)
|
||||
setMulticastAvailable(data.multicast_available)
|
||||
} catch { /* */ }
|
||||
try { const { data } = await api.get('/nodes/strategy'); setStrategy(data.strategy); setMulticastEnabled(data.multicast_enabled); setMulticastAvailable(data.multicast_available) } catch { /* */ }
|
||||
}
|
||||
|
||||
async function saveStrategy(val: string) {
|
||||
setSaving(true)
|
||||
try {
|
||||
await api.put('/nodes/strategy', { strategy: val, multicast_enabled: multicastEnabled })
|
||||
setStrategy(val)
|
||||
message.success('策略已更新')
|
||||
} catch { message.error('更新失败') }
|
||||
try { await api.put('/nodes/strategy', { strategy: val, multicast_enabled: multicastEnabled }); setStrategy(val); message.success('策略已更新') }
|
||||
catch { message.error('更新失败') }
|
||||
setSaving(false)
|
||||
}
|
||||
|
||||
async function toggleMulticast(val: boolean) {
|
||||
setMulticastEnabled(val)
|
||||
try {
|
||||
await api.put('/nodes/strategy', { strategy, multicast_enabled: val })
|
||||
message.success('组播设置已更新')
|
||||
} catch { message.error('更新失败') }
|
||||
try { await api.put('/nodes/strategy', { strategy, multicast_enabled: val }); message.success('已更新') } catch { message.error('更新失败') }
|
||||
}
|
||||
|
||||
async function saveBrand() {
|
||||
setBrandSaving(true)
|
||||
try {
|
||||
await api.put('/settings/brand', {
|
||||
brand_name: brandName,
|
||||
brand_tagline: brandTagline,
|
||||
brand_logo_url: brandLogoUrl,
|
||||
})
|
||||
await refresh()
|
||||
message.success('品牌设置已保存')
|
||||
} catch { message.error('保存失败') }
|
||||
try { await api.put('/settings/brand', { brand_name: brandName, brand_tagline: brandTagline, brand_logo_url: brandLogoUrl }); await refresh(); message.success('品牌设置已保存') }
|
||||
catch { message.error('保存失败') }
|
||||
setBrandSaving(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ maxWidth: 720 }}>
|
||||
<Title level={3} style={{ marginBottom: 24 }}>系统设置</Title>
|
||||
<div style={{ marginBottom: 32 }}>
|
||||
<Title level={2} style={{ margin: '0 0 4px', fontWeight: 600, fontSize: 28 }}>系统设置</Title>
|
||||
<Text style={{ color: '#949088' }}>配置负载均衡策略与品牌信息</Text>
|
||||
</div>
|
||||
|
||||
<Card title="负载均衡" style={{ marginBottom: 24, borderRadius: 10 }}>
|
||||
<div style={{ background: '#fff', borderRadius: 12, border: '1px solid #EBE5DB', padding: 32, marginBottom: 24 }}>
|
||||
<Title level={4} style={{ margin: '0 0 24px', fontWeight: 600 }}>负载均衡</Title>
|
||||
<Form layout="vertical">
|
||||
<Form.Item label="均衡策略" help="子网优先:根据客户端IP所属子网自动选择最近节点">
|
||||
<Select value={strategy} onChange={saveStrategy} options={strategies} loading={saving} style={{ width: 280 }} />
|
||||
<Form.Item label="均衡策略" help="根据客户端 IP 所属子网自动选择最近的边缘节点">
|
||||
<Select value={strategy} onChange={saveStrategy} options={strategies} loading={saving} style={{ width: 280, borderRadius: 8 }} />
|
||||
</Form.Item>
|
||||
<Form.Item label="组播">
|
||||
<Switch checked={multicastEnabled} onChange={toggleMulticast} />
|
||||
@@ -85,29 +66,28 @@ export default function SettingsPage() {
|
||||
</Text>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<Card title="品牌设置" style={{ borderRadius: 10 }}>
|
||||
<div style={{ background: '#fff', borderRadius: 12, border: '1px solid #EBE5DB', padding: 32 }}>
|
||||
<Title level={4} style={{ margin: '0 0 24px', fontWeight: 600 }}>品牌设置</Title>
|
||||
<Form layout="vertical">
|
||||
<Form.Item label="平台名称">
|
||||
<Input value={brandName} onChange={e => setBrandName(e.target.value)} placeholder="StreamCore" size="large" />
|
||||
<Input value={brandName} onChange={e => setBrandName(e.target.value)} size="large" style={{ borderRadius: 8 }} />
|
||||
</Form.Item>
|
||||
<Form.Item label="标语">
|
||||
<Input value={brandTagline} onChange={e => setBrandTagline(e.target.value)} placeholder="企业级直播平台" size="large" />
|
||||
<Input value={brandTagline} onChange={e => setBrandTagline(e.target.value)} size="large" style={{ borderRadius: 8 }} />
|
||||
</Form.Item>
|
||||
<Form.Item label="Logo 图片地址">
|
||||
<Input value={brandLogoUrl} onChange={e => setBrandLogoUrl(e.target.value)} placeholder="https://..." />
|
||||
<Input value={brandLogoUrl} onChange={e => setBrandLogoUrl(e.target.value)} style={{ borderRadius: 8 }} placeholder="https://..." />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" loading={brandSaving} onClick={saveBrand} size="large">
|
||||
<Button type="primary" loading={brandSaving} onClick={saveBrand} size="large" style={{ borderRadius: 8 }}>
|
||||
保存品牌设置
|
||||
</Button>
|
||||
<Text type="secondary" style={{ marginLeft: 12, fontSize: 13 }}>
|
||||
保存后全站立即生效
|
||||
</Text>
|
||||
<Text type="secondary" style={{ marginLeft: 12, fontSize: 13 }}>保存后全站立即生效</Text>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user