1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,69638,e=>{"use strict";let t=(0,e.i(75254).default)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);e.s(["CheckCircle",()=>t],69638)},78583,e=>{"use strict";let t=(0,e.i(75254).default)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",()=>t],78583)},16715,e=>{"use strict";let t=(0,e.i(75254).default)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",()=>t],16715)},93813,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(98400),r=e.i(78583),l=e.i(75254);let i=(0,l.default)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),d=(0,l.default)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var n=e.i(69638);let c=(0,l.default)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),o=(0,l.default)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var u=e.i(16715);function m(){let[e,l]=(0,s.useState)(!1),[m,h]=(0,s.useState)(null),[x,p]=(0,s.useState)(0),[f,g]=(0,s.useState)(null),[j,b]=(0,s.useState)([]),[y,N]=(0,s.useState)(null),[v,w]=(0,s.useState)(!1),k=(0,s.useRef)(null),C=(0,s.useMemo)(()=>(function(){let e=[{path:"/",title:"首页",subtitle:"应用主入口",caption:"首页是用户进入应用的第一个页面,展示书籍封面、简介、目录预览和购买入口。用户可以快速了解内容概要并进行购买决策。",group:"核心页面",order:1},{path:"/chapters",title:"目录页",subtitle:"章节浏览与导航",caption:"目录页展示全书的完整章节结构,用户可以浏览各篇、各章内容,查看已解锁和待解锁章节,并快速跳转到阅读页面。",group:"核心页面",order:2},{path:"/about",title:"关于页面",subtitle:"作者与产品介绍",caption:"关于页面展示作者信息、产品理念、运营数据等,帮助用户建立对内容的信任和理解。",group:"核心页面",order:3},{path:"/my",title:"个人中心",subtitle:"用户账户入口",caption:"个人中心聚合用户的账户信息、购买记录、分销收益等功能入口,是用户管理个人信息的核心页面。",group:"用户中心",order:4},{path:"/my/purchases",title:"我的购买",subtitle:"已购内容管理",caption:"展示用户已购买的所有章节,包括购买时间、解锁进度,用户可快速跳转到已购内容继续阅读。",group:"用户中心",order:5},{path:"/my/settings",title:"账户设置",subtitle:"个人信息配置",caption:"用户可在此页面管理个人基础信息、通知偏好、隐私设置等账户相关配置。",group:"用户中心",order:6},{path:"/my/referral",title:"分销中心",subtitle:"邀请与收益管理",caption:"分销中心展示用户的专属邀请链接、邀请人数统计、收益明细,支持一键分享到朋友圈或Soul派对。",group:"用户中心",order:7},{path:"/admin/login",title:"后台登录",subtitle:"管理员入口",caption:"管理后台的登录页面,管理员通过账号密码验证后进入管理系统。",group:"管理后台",order:8},{path:"/admin",title:"后台管理",subtitle:"系统配置中心",caption:"管理后台的核心页面,包含数据概览、内容管理、用户管理、支付配置、二维码管理、系统设置等功能模块。",group:"管理后台",order:9},{path:"/docs",title:"开发文档",subtitle:"技术与配置说明",caption:"面向开发者和运营人员的技术文档,包含支付接口配置说明、分销规则详解、提现流程等内容。",group:"运营支持",order:10}],t=function(){let e=[];for(let t of(e.push({id:a.specialSections.preface.id,title:a.specialSections.preface.title,group:"阅读页面"}),a.bookData)){let s=t.chapters[0],a=s?.sections?.[0];a&&e.push({id:a.id,title:`${t.number} ${t.title}|${a.title}`,group:"阅读页面"})}for(let t of["9.11","9.10","9.9"]){let s=a.bookData.flatMap(e=>e.chapters).flatMap(e=>e.sections).find(e=>e.id===t);s&&e.push({id:s.id,title:s.title,group:"阅读页面"})}let t=new Set;return e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0))}();for(let s=0;s<t.length;s++){let a=t[s];e.push({path:`/read/${encodeURIComponent(a.id)}`,title:a.title,subtitle:"章节阅读",caption:"阅读页面展示章节的完整内容,未购买用户可预览部分内容,付费墙引导购买解锁全文。",group:a.group,waitForSelector:"main",order:100+s})}return e.sort((e,t)=>(e.order||999)-(t.order||999))})(),[]),M=(0,s.useMemo)(()=>{let e={};for(let t of C)e[t.group]||(e[t.group]=[]),e[t.group].push(t);return e},[C]);(0,s.useEffect)(()=>{b(C.map(e=>({page:e,status:"pending"})))},[C]);let S=async()=>{h(null),l(!0),p(0),g(null),b(C.map(e=>({page:e,status:"loading"})));try{let e=0,t=setInterval(()=>{e+=2;let t=Math.floor(e/100*C.length),s=C[Math.min(t,C.length-1)];s&&g(s.title),p(Math.min(e,90)),b(e=>e.map((e,s)=>({...e,status:s<t?"success":s===t?"loading":"pending"})))},800),s=new URLSearchParams(window.location.search).get("token")||"",a=await fetch(`/api/documentation/generate${s?`?token=${s}`:""}`,{method:"POST",headers:{"Content-Type":"application/json",...s?{"x-documentation-token":s}:{}}});if(clearInterval(t),!a.ok){let e=await a.text().catch(()=>""),t=`生成失败(${a.status})`;try{t=JSON.parse(e).error||t}catch{e&&(t=e)}throw Error(t)}p(100),g("完成"),b(C.map(e=>({page:e,status:"success"})));let r=await a.blob(),l=URL.createObjectURL(r),i=document.createElement("a");i.href=l,i.download=`应用功能文档_${new Date().toISOString().slice(0,10)}.docx`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(l)}catch(e){h(e instanceof Error?e.message:String(e)),b(e=>e.map(e=>({...e,status:"error"})))}finally{l(!1)}},R=(0,s.useCallback)(e=>{N(e),w(!0)},[]);return(0,t.jsxs)("main",{className:"min-h-screen bg-background text-foreground p-4 pb-24",children:[(0,t.jsxs)("div",{className:"max-w-md mx-auto space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,t.jsx)(r.FileText,{className:"w-6 h-6 text-teal-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-lg font-semibold",children:"文档生成器"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"自动截图并导出专业文档"})]})]}),(0,t.jsxs)("div",{className:"bg-card border border-border rounded-xl p-4 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"页面总数"}),(0,t.jsxs)("span",{className:"font-medium text-teal-400",children:[C.length," 个"]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"分组数量"}),(0,t.jsxs)("span",{className:"font-medium",children:[Object.keys(M).length," 组"]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"输出格式"}),(0,t.jsx)("span",{className:"font-medium",children:"Word (.docx)"})]})]}),e&&(0,t.jsxs)("div",{className:"bg-card border border-border rounded-xl p-4 space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"生成进度"}),(0,t.jsxs)("span",{className:"font-medium text-teal-400",children:[Math.round(x),"%"]})]}),(0,t.jsx)("div",{className:"w-full h-2 bg-muted rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-gradient-to-r from-teal-500 to-cyan-400 transition-all duration-300",style:{width:`${x}%`}})}),f&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground truncate",children:["正在处理: ",f]})]}),m&&(0,t.jsxs)("div",{className:"bg-destructive/10 border border-destructive/30 text-destructive rounded-xl p-3 text-sm",children:[(0,t.jsx)("p",{className:"font-medium mb-1",children:"生成失败"}),(0,t.jsx)("p",{className:"text-xs opacity-80",children:m}),(0,t.jsx)("p",{className:"text-xs mt-2 opacity-60",children:"提示: 如需授权,请在URL中添加 ?token=your_token"})]}),(0,t.jsx)("button",{type:"button",onClick:S,disabled:e,className:"w-full bg-gradient-to-r from-teal-500 to-cyan-500 text-white rounded-xl py-3.5 font-medium disabled:opacity-60 flex items-center justify-center gap-2 shadow-lg shadow-teal-500/20",children:e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d,{className:"w-5 h-5 animate-spin"}),(0,t.jsx)("span",{children:"正在生成文档..."})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{className:"w-5 h-5"}),(0,t.jsx)("span",{children:"一键生成 Word 文档"})]})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("h2",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)("span",{children:"文档目录预览"}),(0,t.jsxs)("span",{className:"text-xs opacity-60",children:["(",C.length,"个页面)"]})]}),Object.entries(M).map(([e,s])=>(0,t.jsxs)("div",{className:"bg-card border border-border rounded-xl overflow-hidden",children:[(0,t.jsx)("div",{className:"px-3 py-2 bg-muted/50 border-b border-border",children:(0,t.jsx)("h3",{className:"text-sm font-medium text-teal-400",children:e})}),(0,t.jsx)("div",{className:"divide-y divide-border",children:s.map((e,s)=>{let a=j.find(t=>t.page.path===e.path);return(0,t.jsxs)("div",{className:"px-3 py-2.5 flex items-center gap-3 hover:bg-muted/30 transition-colors",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground w-5",children:s+1}),a&&(e=>{switch(e){case"pending":return(0,t.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-600"});case"loading":return(0,t.jsx)(d,{className:"w-4 h-4 animate-spin text-teal-400"});case"success":return(0,t.jsx)(n.CheckCircle,{className:"w-4 h-4 text-green-500"});case"error":return(0,t.jsx)(c,{className:"w-4 h-4 text-red-500"})}})(a.status),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate",children:e.title}),e.subtitle&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.subtitle})]}),(0,t.jsx)("button",{type:"button",onClick:()=>R(e.path),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors",title:"预览页面",children:(0,t.jsx)(o,{className:"w-4 h-4"})})]},e.path)})})]},e))]}),(0,t.jsxs)("div",{className:"bg-card border border-border rounded-xl p-4 space-y-3",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:"文档包含内容"}),(0,t.jsxs)("ul",{className:"text-xs text-muted-foreground space-y-2",children:[(0,t.jsxs)("li",{className:"flex items-start gap-2",children:[(0,t.jsx)(n.CheckCircle,{className:"w-4 h-4 text-green-500 flex-shrink-0 mt-0.5"}),(0,t.jsx)("span",{children:"自动生成的目录结构"})]}),(0,t.jsxs)("li",{className:"flex items-start gap-2",children:[(0,t.jsx)(n.CheckCircle,{className:"w-4 h-4 text-green-500 flex-shrink-0 mt-0.5"}),(0,t.jsx)("span",{children:"所有页面的真实截图(iPhone 14 Pro Max尺寸)"})]}),(0,t.jsxs)("li",{className:"flex items-start gap-2",children:[(0,t.jsx)(n.CheckCircle,{className:"w-4 h-4 text-green-500 flex-shrink-0 mt-0.5"}),(0,t.jsx)("span",{children:"每个页面的功能说明与路径"})]}),(0,t.jsxs)("li",{className:"flex items-start gap-2",children:[(0,t.jsx)(n.CheckCircle,{className:"w-4 h-4 text-green-500 flex-shrink-0 mt-0.5"}),(0,t.jsx)("span",{children:"按功能模块分组整理"})]})]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:"生成过程需要30-60秒,请耐心等待"})]}),v&&y&&(0,t.jsx)("div",{className:"fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-4",children:(0,t.jsxs)("div",{className:"bg-card rounded-2xl w-full max-w-md overflow-hidden border border-border",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,t.jsx)("h3",{className:"font-medium text-sm",children:"页面预览"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>k.current?.contentWindow?.location.reload(),className:"p-1.5 text-muted-foreground hover:text-foreground rounded-lg",children:(0,t.jsx)(u.RefreshCw,{className:"w-4 h-4"})}),(0,t.jsx)("button",{type:"button",onClick:()=>w(!1),className:"p-1.5 text-muted-foreground hover:text-foreground rounded-lg",children:(0,t.jsx)(c,{className:"w-4 h-4"})})]})]}),(0,t.jsx)("div",{className:"w-full aspect-[430/932] bg-white",children:(0,t.jsx)("iframe",{ref:k,src:y,className:"w-full h-full",title:"Page Preview"})})]})})]})}e.s(["default",()=>m],93813)}]); |