Files
Mycontent/.next/static/chunks/0807431966d358fd.js
2025-12-29 14:01:37 +08:00

1 line
13 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,23750,e=>{"use strict";var t=e.i(43476),a=e.i(47163);function s({className:e,type:s,...l}){return(0,t.jsx)("input",{type:s,"data-slot":"input",className:(0,a.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...l})}e.s(["Input",()=>s])},62031,e=>{"use strict";let t=(0,e.i(75254).default)("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);e.s(["Share2",()=>t],62031)},92270,e=>{"use strict";let t=(0,e.i(75254).default)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);e.s(["LogOut",()=>t],92270)},10980,e=>{"use strict";let t=(0,e.i(75254).default)("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);e.s(["BookOpen",()=>t],10980)},43432,e=>{"use strict";let t=(0,e.i(75254).default)("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);e.s(["Phone",()=>t],43432)},44331,30699,e=>{"use strict";var t=e.i(43476),a=e.i(71645),s=e.i(37727),l=e.i(43432),r=e.i(84614);let i=(0,e.i(75254).default)("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);e.s(["Gift",()=>i],30699);var n=e.i(67881),d=e.i(23750),c=e.i(4421);function x({isOpen:e,onClose:x,defaultTab:o="login"}){let[p,h]=(0,a.useState)(o),[m,u]=(0,a.useState)(""),[b,g]=(0,a.useState)(""),[j,y]=(0,a.useState)(""),[v,f]=(0,a.useState)(""),[N,w]=(0,a.useState)(""),[k,C]=(0,a.useState)(!1),{login:S,register:B}=(0,c.useStore)(),M=()=>{11!==m.length?w("请输入正确的手机号"):(C(!0),w(""),alert("验证码已发送,测试验证码: 123456"))},O=async()=>{w(""),await S(m,b)?x():w("验证码错误或用户不存在,请先注册")},L=async()=>{(w(""),j.trim())?await B(m,j,v||void 0)?x():w("该手机号已注册"):w("请输入昵称")};return e?(0,t.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:x}),(0,t.jsxs)("div",{className:"relative w-full max-w-md bg-[#0f2137] rounded-2xl border border-gray-700/50 overflow-hidden",children:[(0,t.jsx)("button",{onClick:x,className:"absolute top-4 right-4 p-2 text-gray-400 hover:text-white transition-colors",children:(0,t.jsx)(s.X,{className:"w-5 h-5"})}),(0,t.jsxs)("div",{className:"flex border-b border-gray-700/50",children:[(0,t.jsx)("button",{onClick:()=>h("login"),className:`flex-1 py-4 text-center transition-colors ${"login"===p?"text-white border-b-2 border-[#38bdac]":"text-gray-400 hover:text-white"}`,children:"登录"}),(0,t.jsx)("button",{onClick:()=>h("register"),className:`flex-1 py-4 text-center transition-colors ${"register"===p?"text-white border-b-2 border-[#38bdac]":"text-gray-400 hover:text-white"}`,children:"注册"})]}),(0,t.jsx)("div",{className:"p-6",children:"login"===p?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-400 text-sm mb-2",children:"手机号"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(l.Phone,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),(0,t.jsx)(d.Input,{type:"tel",value:m,onChange:e=>u(e.target.value),placeholder:"请输入手机号",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",maxLength:11})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-400 text-sm mb-2",children:"验证码"}),(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(d.Input,{type:"text",value:b,onChange:e=>g(e.target.value),placeholder:"请输入验证码",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",maxLength:6}),(0,t.jsx)(n.Button,{type:"button",variant:"outline",onClick:M,disabled:k,className:"whitespace-nowrap border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:k?"已发送":"获取验证码"})]})]}),N&&(0,t.jsx)("p",{className:"text-red-400 text-sm",children:N}),(0,t.jsx)(n.Button,{onClick:O,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5",children:"登录"})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-400 text-sm mb-2",children:"手机号"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(l.Phone,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),(0,t.jsx)(d.Input,{type:"tel",value:m,onChange:e=>u(e.target.value),placeholder:"请输入手机号",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",maxLength:11})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-400 text-sm mb-2",children:"昵称"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(r.User,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),(0,t.jsx)(d.Input,{type:"text",value:j,onChange:e=>y(e.target.value),placeholder:"请输入昵称",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-400 text-sm mb-2",children:"验证码"}),(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(d.Input,{type:"text",value:b,onChange:e=>g(e.target.value),placeholder:"请输入验证码",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",maxLength:6}),(0,t.jsx)(n.Button,{type:"button",variant:"outline",onClick:M,disabled:k,className:"whitespace-nowrap border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:k?"已发送":"获取验证码"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-400 text-sm mb-2",children:"邀请码 (选填)"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(i,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),(0,t.jsx)(d.Input,{type:"text",value:v,onChange:e=>f(e.target.value),placeholder:"填写邀请码可获得优惠",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500"})]})]}),N&&(0,t.jsx)("p",{className:"text-red-400 text-sm",children:N}),(0,t.jsx)(n.Button,{onClick:L,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5",children:"注册"})]})})]})]}):null}e.s(["AuthModal",()=>x],44331)},63059,e=>{"use strict";let t=(0,e.i(75254).default)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],63059)},50965,e=>{"use strict";let t=(0,e.i(75254).default)("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);e.s(["ShoppingBag",()=>t],50965)},48313,e=>{"use strict";var t=e.i(43476),a=e.i(71645),s=e.i(22016),l=e.i(84614),r=e.i(50965),i=e.i(62031),n=e.i(92270),d=e.i(63059),c=e.i(10980),x=e.i(4421),o=e.i(44331),p=e.i(98400);function h(){let{user:e,isLoggedIn:h,logout:m}=(0,x.useStore)(),[u,b]=(0,a.useState)(!1),[g,j]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{j(!0)},[]),!g)return(0,t.jsx)("div",{className:"min-h-screen bg-app-bg flex items-center justify-center",children:(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-app-brand"})});if(!h)return(0,t.jsxs)("main",{className:"min-h-screen bg-app-bg text-app-text pb-20 flex flex-col items-center justify-center",children:[(0,t.jsx)("div",{className:"p-4 w-full",children:(0,t.jsxs)("div",{className:"max-w-xs mx-auto text-center",children:[(0,t.jsx)("div",{className:"w-14 h-14 mx-auto mb-3 rounded-full bg-app-card flex items-center justify-center",children:(0,t.jsx)(l.User,{className:"w-7 h-7 text-app-text-muted"})}),(0,t.jsx)("h2",{className:"text-base font-semibold mb-1",children:"登录后查看更多"}),(0,t.jsx)("p",{className:"text-app-text-muted text-xs mb-4",children:"查看购买记录、分销收益"}),(0,t.jsx)("button",{onClick:()=>b(!0),className:"bg-app-brand hover:bg-app-brand-hover text-white px-6 py-2.5 rounded-full font-medium text-sm",children:"立即登录"})]})}),(0,t.jsx)(o.AuthModal,{isOpen:u,onClose:()=>b(!1)})]});let y=(0,p.getFullBookPrice)();return(0,t.jsxs)("main",{className:"min-h-screen bg-app-bg text-app-text pb-20",children:[(0,t.jsx)("div",{className:"bg-gradient-to-b from-app-card to-app-bg p-4 pt-8",children:(0,t.jsxs)("div",{className:"max-w-xs mx-auto",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("div",{className:"w-11 h-11 rounded-full bg-app-brand/20 flex items-center justify-center",children:(0,t.jsx)(l.User,{className:"w-5 h-5 text-app-brand"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-sm font-semibold",children:e?.nickname||"用户"}),(0,t.jsx)("p",{className:"text-app-text-muted text-xs",children:e?.phone})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,t.jsxs)("div",{className:"bg-app-card/60 rounded-lg p-2.5 text-center",children:[(0,t.jsx)("p",{className:"text-base font-bold text-app-brand",children:e?.hasFullBook?"全部":e?.purchasedSections.length||0}),(0,t.jsx)("p",{className:"text-app-text-muted text-xs",children:"已购章节"})]}),(0,t.jsxs)("div",{className:"bg-app-card/60 rounded-lg p-2.5 text-center",children:[(0,t.jsxs)("p",{className:"text-base font-bold text-app-brand",children:["¥",(e?.earnings||0).toFixed(1)]}),(0,t.jsx)("p",{className:"text-app-text-muted text-xs",children:"累计收益"})]})]})]})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)("div",{className:"max-w-xs mx-auto space-y-2",children:[!e?.hasFullBook&&(0,t.jsx)(s.default,{href:"/chapters",className:"block",children:(0,t.jsx)("div",{className:"bg-gradient-to-r from-app-brand/20 to-app-card rounded-lg p-3 border border-app-brand/30",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.BookOpen,{className:"w-4 h-4 text-app-brand"}),(0,t.jsx)("span",{className:"text-app-text text-sm",children:"购买整本书"})]}),(0,t.jsxs)("span",{className:"text-app-brand font-bold text-sm",children:["¥",y]})]})})}),(0,t.jsxs)("div",{className:"bg-app-card/60 rounded-lg overflow-hidden",children:[(0,t.jsxs)(s.default,{href:"/my/purchases",className:"flex items-center justify-between p-3 border-b border-app-border",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.ShoppingBag,{className:"w-4 h-4 text-app-text-muted"}),(0,t.jsx)("span",{className:"text-sm",children:"我的购买"})]}),(0,t.jsx)(d.ChevronRight,{className:"w-4 h-4 text-app-text-muted"})]}),(0,t.jsxs)(s.default,{href:"/my/referral",className:"flex items-center justify-between p-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Share2,{className:"w-4 h-4 text-app-text-muted"}),(0,t.jsx)("span",{className:"text-sm",children:"分销收益"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)("span",{className:"text-app-brand text-xs",children:["¥",(e?.earnings||0).toFixed(1)]}),(0,t.jsx)(d.ChevronRight,{className:"w-4 h-4 text-app-text-muted"})]})]})]}),(0,t.jsx)("div",{className:"bg-app-card/60 rounded-lg p-3",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-app-text-muted text-xs",children:"我的邀请码"}),(0,t.jsx)("code",{className:"text-app-brand font-mono text-sm",children:e?.referralCode})]}),(0,t.jsx)("button",{onClick:()=>navigator.clipboard.writeText(e?.referralCode||""),className:"text-app-text-muted text-xs hover:text-app-text px-2 py-1 rounded bg-app-card",children:"复制"})]})}),(0,t.jsxs)("button",{onClick:m,className:"w-full flex items-center justify-center gap-2 p-2.5 text-app-text-muted hover:text-red-400 transition-colors text-sm",children:[(0,t.jsx)(n.LogOut,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"退出登录"})]})]})})]})}e.s(["default",()=>h])}]);