"use client" import { useState, useEffect } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Label } from "@/components/ui/label" import { Input } from "@/components/ui/input" import { Button } from "@/components/ui/button" import { Switch } from "@/components/ui/switch" import { Slider } from "@/components/ui/slider" import { Textarea } from "@/components/ui/textarea" import { useStore } from "@/lib/store" import { Save, Settings, Users, DollarSign, UserCircle, Calendar, MapPin, BookOpen } from "lucide-react" export default function SettingsPage() { const { settings, updateSettings } = useStore() const [localSettings, setLocalSettings] = useState({ sectionPrice: settings.sectionPrice, baseBookPrice: settings.baseBookPrice, distributorShare: settings.distributorShare, authorInfo: { ...settings.authorInfo, startDate: settings.authorInfo?.startDate || "2025年10月15日", bio: settings.authorInfo?.bio || "连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事", }, }) const [isSaving, setIsSaving] = useState(false) useEffect(() => { setLocalSettings({ sectionPrice: settings.sectionPrice, baseBookPrice: settings.baseBookPrice, distributorShare: settings.distributorShare, authorInfo: { ...settings.authorInfo, startDate: settings.authorInfo?.startDate || "2025年10月15日", bio: settings.authorInfo?.bio || "连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事", }, }) }, [settings]) const handleSave = async () => { setIsSaving(true) try { updateSettings(localSettings) // 同时保存到数据库 await fetch('/api/db/settings', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(localSettings) }) alert("设置已保存!") } catch (error) { console.error('Save settings error:', error) alert("保存失败") } finally { setIsSaving(false) } } return (

系统设置

配置全站基础参数与开关

{/* 作者信息 - 重点增强 */} 关于作者 配置作者信息,将在"关于作者"页面显示
setLocalSettings((prev) => ({ ...prev, authorInfo: { ...prev.authorInfo, name: e.target.value }, })) } />
setLocalSettings((prev) => ({ ...prev, authorInfo: { ...prev.authorInfo, startDate: e.target.value }, })) } />
setLocalSettings((prev) => ({ ...prev, authorInfo: { ...prev.authorInfo, liveTime: e.target.value }, })) } />
setLocalSettings((prev) => ({ ...prev, authorInfo: { ...prev.authorInfo, platform: e.target.value }, })) } />
setLocalSettings((prev) => ({ ...prev, authorInfo: { ...prev.authorInfo, description: e.target.value }, })) } />