- {paragraph} -
- ) - ))} -{mode === "login" ? "登录" : "注册"}
++ {mode === "login" ? "登录后查看购买记录和收益" : "注册后开始阅读真实商业故事"} +
+ +{error}
} + + {/* 提交按钮 */} + + + {/* 切换模式 */} +diff --git a/app/login/page.tsx b/app/login/page.tsx new file mode 100644 index 00000000..08e33836 --- /dev/null +++ b/app/login/page.tsx @@ -0,0 +1,153 @@ +"use client" + +import { useState } from "react" +import { useRouter } from "next/navigation" +import { useStore } from "@/lib/store" +import { ChevronLeft, Phone, User, Hash } from "lucide-react" + +export default function LoginPage() { + const router = useRouter() + const { login, register, adminLogin } = useStore() + const [mode, setMode] = useState<"login" | "register">("login") + const [phone, setPhone] = useState("") + const [code, setCode] = useState("") + const [nickname, setNickname] = useState("") + const [referralCode, setReferralCode] = useState("") + const [error, setError] = useState("") + const [loading, setLoading] = useState(false) + + const handleSubmit = async () => { + setError("") + setLoading(true) + + try { + // 管理员登录 + if (phone.toLowerCase() === "admin") { + if (adminLogin(phone, code)) { + router.push("/admin") + return + } else { + setError("管理员密码错误") + return + } + } + + if (mode === "login") { + const success = await login(phone, code) + if (success) { + router.push("/") + } else { + setError("验证码错误或用户不存在") + } + } else { + if (!nickname.trim()) { + setError("请输入昵称") + return + } + const success = await register(phone, nickname, referralCode || undefined) + if (success) { + router.push("/") + } else { + setError("该手机号已注册") + } + } + } finally { + setLoading(false) + } + } + + return ( +
+ {mode === "login" ? "登录后查看购买记录和收益" : "注册后开始阅读真实商业故事"} +
+ +{error}
} + + {/* 提交按钮 */} + + + {/* 切换模式 */} +来自Soul派对房的真实商业故事
+登录后可查看购买记录、阅读进度和收益
+ +邀请好友购买,获得90%佣金
+{partTitle}
- {chapterTitle && ( -{chapterTitle}
- )} -{partTitle}
} + {chapterTitle &&{chapterTitle}
}- {paragraph} -
- ) - ))} -每天早上6-9点,卡若在Soul派对房分享真实案例
-+ {paragraph} +
+ ), + )} ++
{paragraph}
- ) - ))} -- {isLoggedIn ? "购买本节或整本书以阅读完整内容" : "登录后购买即可阅读完整内容"} +
+ 已阅读50%,{isLoggedIn ? "购买后继续阅读" : "登录并购买后继续阅读"}
- {section.unlockAfterDays && ( -- 分享本书,他人购买你可获得 {distributorShare}%返利 -
-每天早上6-9点,卡若在Soul派对房免费分享
-分享给好友购买,你可获得90%佣金
来自Soul派对房的真实商业故事
-¥{fullBookPrice}
-整本价格
-{totalSections}
-商业案例
-{part.subtitle}
-查看购买记录、阅读进度、分销收益
- -{user?.phone}
-{user?.hasFullBook ? "全部" : purchasedCount}
-共 {totalSections} 章
-¥{earnings.toFixed(1)}
-分销所得
-- {user?.hasFullBook ? "已拥有全书" : `还差 ${totalSections - purchasedCount} 章解锁全部内容`} -
-我的邀请码
-{user?.referralCode}
- 分享给好友,他人购买你可获得 90% 返利
-{matchProgress}%
-正在匹配...
- > - ) : matchResult ? ( - <> -匹配度
-{matchResult.reason}
- > - ) : ( - <> -寻找合作伙伴
-智能匹配商业故事
- > - )} -{matchResult.section.id}
-{matchResult.section.title}
-基于你的阅读偏好,智能推荐适合你的商业故事
-- {paragraph} -
- ), - )} -您已阅读30%,解锁后可阅读完整内容
- -- 分享给好友,他人购买你可获得 90% 返利 -
-