diff --git a/app/admin/layout.tsx b/app/admin/layout.tsx index 9deeda1e..a9b9501e 100644 --- a/app/admin/layout.tsx +++ b/app/admin/layout.tsx @@ -4,7 +4,7 @@ import type React from "react" import Link from "next/link" import { usePathname } from "next/navigation" -import { LayoutDashboard, FileText, Users, CreditCard, QrCode, Settings, LogOut, Wallet } from "lucide-react" +import { LayoutDashboard, FileText, Users, CreditCard, QrCode, Settings, LogOut, Wallet, Globe } from "lucide-react" import { useStore } from "@/lib/store" import { useRouter } from "next/navigation" import { useEffect } from "react" @@ -22,6 +22,7 @@ export default function AdminLayout({ children }: { children: React.ReactNode }) const menuItems = [ { icon: LayoutDashboard, label: "数据概览", href: "/admin" }, + { icon: Globe, label: "网站配置", href: "/admin/site" }, { icon: FileText, label: "内容管理", href: "/admin/content" }, { icon: Users, label: "用户管理", href: "/admin/users" }, { icon: CreditCard, label: "支付配置", href: "/admin/payment" }, diff --git a/app/admin/site/loading.tsx b/app/admin/site/loading.tsx new file mode 100644 index 00000000..69cf23db --- /dev/null +++ b/app/admin/site/loading.tsx @@ -0,0 +1,14 @@ +export default function Loading() { + return ( +
+
+
+
+
+
+
+
+
+
+ ) +} diff --git a/app/admin/site/page.tsx b/app/admin/site/page.tsx new file mode 100644 index 00000000..d1d71804 --- /dev/null +++ b/app/admin/site/page.tsx @@ -0,0 +1,367 @@ +"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 { useStore } from "@/lib/store" +import { Save, Globe, Menu, FileText, Palette } from "lucide-react" + +export default function SiteConfigPage() { + const { settings, updateSettings } = useStore() + const [localSettings, setLocalSettings] = useState({ + siteConfig: settings.siteConfig || { + siteName: "卡若日记", + siteTitle: "一场SOUL的创业实验场", + siteDescription: "来自Soul派对房的真实商业故事", + logo: "/logo.png", + favicon: "/favicon.ico", + primaryColor: "#00CED1", + }, + menuConfig: settings.menuConfig || { + home: { enabled: true, label: "首页" }, + chapters: { enabled: true, label: "目录" }, + match: { enabled: true, label: "匹配" }, + my: { enabled: true, label: "我的" }, + }, + pageConfig: settings.pageConfig || { + homeTitle: "一场SOUL的创业实验场", + homeSubtitle: "来自Soul派对房的真实商业故事", + chaptersTitle: "我要看", + matchTitle: "语音匹配", + myTitle: "我的", + aboutTitle: "关于作者", + }, + }) + const [saved, setSaved] = useState(false) + + useEffect(() => { + if (settings.siteConfig) { + setLocalSettings({ + siteConfig: settings.siteConfig, + menuConfig: settings.menuConfig, + pageConfig: settings.pageConfig, + }) + } + }, [settings]) + + const handleSave = () => { + updateSettings(localSettings) + setSaved(true) + setTimeout(() => setSaved(false), 2000) + } + + return ( +
+
+
+

网站配置

+

配置网站名称、图标、菜单和页面标题

+
+ +
+ +
+ {/* 网站基础信息 */} + + + + + 网站基础信息 + + 配置网站名称、标题和描述 + + +
+
+ + + setLocalSettings((prev) => ({ + ...prev, + siteConfig: { ...prev.siteConfig, siteName: e.target.value }, + })) + } + /> +
+
+ + + setLocalSettings((prev) => ({ + ...prev, + siteConfig: { ...prev.siteConfig, siteTitle: e.target.value }, + })) + } + /> +
+
+
+ + + setLocalSettings((prev) => ({ + ...prev, + siteConfig: { ...prev.siteConfig, siteDescription: e.target.value }, + })) + } + /> +
+
+
+ + + setLocalSettings((prev) => ({ + ...prev, + siteConfig: { ...prev.siteConfig, logo: e.target.value }, + })) + } + /> +
+
+ + + setLocalSettings((prev) => ({ + ...prev, + siteConfig: { ...prev.siteConfig, favicon: e.target.value }, + })) + } + /> +
+
+
+
+ + {/* 主题颜色 */} + + + + + 主题颜色 + + 配置网站主题色 + + +
+
+ +
+ + setLocalSettings((prev) => ({ + ...prev, + siteConfig: { ...prev.siteConfig, primaryColor: e.target.value }, + })) + } + /> + + setLocalSettings((prev) => ({ + ...prev, + siteConfig: { ...prev.siteConfig, primaryColor: e.target.value }, + })) + } + /> +
+
+
+ 预览 +
+
+
+
+ + {/* 菜单配置 */} + + + + + 底部菜单配置 + + 控制底部导航栏菜单的显示和名称 + + + {Object.entries(localSettings.menuConfig).map(([key, config]) => ( +
+
+ + setLocalSettings((prev) => ({ + ...prev, + menuConfig: { + ...prev.menuConfig, + [key]: { ...config, enabled: checked }, + }, + })) + } + /> + {key} + + setLocalSettings((prev) => ({ + ...prev, + menuConfig: { + ...prev.menuConfig, + [key]: { ...config, label: e.target.value }, + }, + })) + } + /> +
+ + {config.enabled ? "显示" : "隐藏"} + +
+ ))} +
+ + + {/* 页面标题配置 */} + + + + + 页面标题配置 + + 配置各个页面的标题和副标题 + + +
+
+ + + setLocalSettings((prev) => ({ + ...prev, + pageConfig: { ...prev.pageConfig, homeTitle: e.target.value }, + })) + } + /> +
+
+ + + setLocalSettings((prev) => ({ + ...prev, + pageConfig: { ...prev.pageConfig, homeSubtitle: e.target.value }, + })) + } + /> +
+
+
+
+ + + setLocalSettings((prev) => ({ + ...prev, + pageConfig: { ...prev.pageConfig, chaptersTitle: e.target.value }, + })) + } + /> +
+
+ + + setLocalSettings((prev) => ({ + ...prev, + pageConfig: { ...prev.pageConfig, matchTitle: e.target.value }, + })) + } + /> +
+
+
+
+ + + setLocalSettings((prev) => ({ + ...prev, + pageConfig: { ...prev.pageConfig, myTitle: e.target.value }, + })) + } + /> +
+
+ + + setLocalSettings((prev) => ({ + ...prev, + pageConfig: { ...prev.pageConfig, aboutTitle: e.target.value }, + })) + } + /> +
+
+
+
+
+
+ ) +} diff --git a/app/my/page.tsx b/app/my/page.tsx index c59eed27..fdef4dc3 100644 --- a/app/my/page.tsx +++ b/app/my/page.tsx @@ -2,11 +2,21 @@ import { useState, useEffect } from "react" import { useRouter } from "next/navigation" -import { User, ChevronRight, Copy, Check, Home, List, Sparkles, Clock } from "lucide-react" +import { User, ChevronRight, Copy, Check, Home, List, TrendingUp, Gift, Star, Info } from "lucide-react" import { useStore } from "@/lib/store" import { AuthModal } from "@/components/modules/auth/auth-modal" import { getFullBookPrice, getTotalSectionCount } from "@/lib/book-data" +function PlanetIcon({ className }: { className?: string }) { + return ( + + + + + + ) +} + export default function MyPage() { const router = useRouter() const { user, isLoggedIn, logout, getAllPurchases, settings } = useStore() @@ -60,10 +70,10 @@ export default function MyPage() { 目录 - {/* 匹配按钮 - 更大更突出 */} + {/* 匹配按钮 - 小星球图标 */} @@ -84,81 +94,62 @@ export default function MyPage() {

我的

-
+ {/* 用户卡片 - 突出个性化 */} +
-
- +
+
-
- -

ID: ---

+

解锁专属权益

+
+
+ VIP
-
-
+ {/* 个性化数据 */} +
+

0

-

已读章节

+

已读

-
+

0

-

阅读时长(分)

+

收藏

-
+

0

书签

- {/* 关于作者入口 */} -
-
-
- {authorInfo.name.charAt(0)} -
-
-

{authorInfo.name}

-

{authorInfo.description}

-
- - - 每日 {authorInfo.liveTime} - - {authorInfo.platform} -
-
- -
-
- - {/* 分销中心 */} -
+ {/* 收益中心 - 突出收益 */} +
- 💰 - 分销中心 +
+ +
+ 收益中心
- 佣金比例: 90% + 90%分成
-
-

累计收益

+
+

累计收益

¥0.00

-
+
-

可提现

+

可提现

¥0.00

-

已提现

+

已提现

¥0.00

@@ -167,9 +158,10 @@ export default function MyPage() {
-
+
-

0

+

0

推荐人数

-

0

+

0

成交订单

-

90%

+

90%

佣金率

@@ -198,7 +190,7 @@ export default function MyPage() {

我的邀请码

-

- - -

+

- - -

+ {/* 关于作者 - 小图标入口 */} +
@@ -250,79 +255,63 @@ export default function MyPage() {

我的

-
+ {/* 用户卡片 - 突出个性化 */} +
-
- +
+ {user?.nickname?.charAt(0) || "U"}
-
-

{user?.nickname || "用户"}

+
+

{user?.nickname || "用户"}

ID: {user?.id?.slice(-8) || "---"}

+
+ + + VIP + +
-
-
+ {/* 个性化数据 */} +
+

{purchasedCount}

-

已读章节

+

已读

-
+

{readingMinutes}

-

阅读时长(分)

+

时长(分)

-
+

{bookmarks}

书签

- {/* 关于作者入口 */} -
-
-
- {authorInfo.name.charAt(0)} -
-
-

{authorInfo.name}

-

{authorInfo.description}

-
- - - 每日 {authorInfo.liveTime} - - {authorInfo.platform} -
-
- -
-
- - {/* 分销中心 */} -
+ {/* 收益中心 - 突出收益 */} +
- 💰 - 分销中心 +
+ +
+ 收益中心
- 佣金比例: 90% + 90%分成
-
-

累计收益

+
+

累计收益

¥{(user?.earnings || 0).toFixed(2)}

-
+
-

可提现

+

可提现

¥{(user?.pendingEarnings || 0).toFixed(2)}

-

已提现

+

已提现

¥{(user?.withdrawnEarnings || 0).toFixed(2)}

@@ -331,9 +320,10 @@ export default function MyPage() {
-
+
-

{user?.referralCount || 0}

+

{user?.referralCount || 0}

推荐人数

-

{completedOrders}

+

{completedOrders}

成交订单

-

90%

+

90%

佣金率

@@ -362,7 +352,7 @@ export default function MyPage() {

我的邀请码

-

{user?.referralCode || "---"}

+

{user?.referralCode || "---"}

+ {/* 关于作者 - 小图标入口 */} +
diff --git a/lib/store.ts b/lib/store.ts index 3d634a58..833ea46c 100644 --- a/lib/store.ts +++ b/lib/store.ts @@ -112,6 +112,31 @@ export interface FeishuSyncConfig { syncInterval: number // 分钟 } +export interface SiteConfig { + siteName: string + siteTitle: string + siteDescription: string + logo: string + favicon: string + primaryColor: string +} + +export interface MenuConfig { + home: { enabled: boolean; label: string } + chapters: { enabled: boolean; label: string } + match: { enabled: boolean; label: string } + my: { enabled: boolean; label: string } +} + +export interface PageConfig { + homeTitle: string + homeSubtitle: string + chaptersTitle: string + matchTitle: string + myTitle: string + aboutTitle: string +} + export interface Settings { distributorShare: number authorShare: number @@ -128,6 +153,9 @@ export interface Settings { liveTime: string platform: string } + siteConfig: SiteConfig + menuConfig: MenuConfig + pageConfig: PageConfig } interface StoreState { @@ -171,7 +199,7 @@ const initialSettings: Settings = { partnerId: "2088511801157159", securityKey: "lz6ey1h3kl9zqkgtjz3avb5gk37wzbrp", mobilePayEnabled: true, - paymentInterface: "official_instant", // 支付宝官方即时到账接口 + paymentInterface: "official_instant", }, wechat: { enabled: true, @@ -184,7 +212,7 @@ const initialSettings: Settings = { mpVerifyCode: "SP8AfZJyAvprRORT", merchantId: "1318592501", apiKey: "wx3e31b068be59ddc131b068be59ddc2", - groupQrCode: "", // 微信群二维码链接,管理员配置 + groupQrCode: "", }, usdt: { enabled: true, @@ -234,6 +262,28 @@ const initialSettings: Settings = { liveTime: "06:00-09:00", platform: "Soul派对房", }, + siteConfig: { + siteName: "卡若日记", + siteTitle: "一场SOUL的创业实验场", + siteDescription: "来自Soul派对房的真实商业故事", + logo: "/logo.png", + favicon: "/favicon.ico", + primaryColor: "#00CED1", + }, + menuConfig: { + home: { enabled: true, label: "首页" }, + chapters: { enabled: true, label: "目录" }, + match: { enabled: true, label: "匹配" }, + my: { enabled: true, label: "我的" }, + }, + pageConfig: { + homeTitle: "一场SOUL的创业实验场", + homeSubtitle: "来自Soul派对房的真实商业故事", + chaptersTitle: "我要看", + matchTitle: "语音匹配", + myTitle: "我的", + aboutTitle: "关于作者", + }, } export const useStore = create()( @@ -649,6 +699,9 @@ export const useStore = create()( const newSettings: Partial = { paymentMethods: mergedPaymentMethods, authorInfo: { ...settings.authorInfo, ...data.authorInfo }, + siteConfig: { ...settings.siteConfig, ...data.siteConfig }, + menuConfig: { ...settings.menuConfig, ...data.menuConfig }, + pageConfig: { ...settings.pageConfig, ...data.pageConfig }, } set({ settings: { ...settings, ...newSettings } })