PageSourceSearch

https://wodeapp.cn/assets/DesktopCreditsPage-uW1ZK-So.js

js wodeapp.cn collected 2026-09-24 14:37:37 UTC 10,875 bytes, 1 lines download raw bytes

1import{r as a,j as e}from"./react-vendor-BxoUhqX6.js";const g="/mainserver/api/desktop-license";function _(s){return new URLSearchParams(window.location.search).get(s)}function U(){const s=_("licenseKey")||"",[R,p]=a.useState(null),[y,$]=a.useState([]),[j,S]=a.useState(!0),[d,v]=a.useState(null),[h,k]=a.useState(null),[c,l]=a.useState("idle"),[b,B]=a.useState("monthly"),[C,x]=a.useState(null),[m,w]=a.useState("alipay"),[z,P]=a.useState(""),W=[{id:"yougi_starter",name:"基础版",monthlyPrice:29.88,credits:500,discount:100},{id:"yougi_pro",name:"专业版",monthlyPrice:58.88,credits:2e3,discount:100,hot:!0},{id:"yougi_premium",name:"旗舰版",monthlyPrice:88.88,credits:5e3,discount:95}];a.useEffect(()=>{s&&(S(!0),Promise.all([fetch(`${g}/credits?licenseKey=${encodeURIComponent(s)}`).then(t=>t.json()),fetch(`${g}/packs`).then(t=>t.json())]).then(([t,n])=>{const o=t.credits;typeof o=="number"?p(o):o&&typeof o.credits=="number"&&p(o.credits),n.packs&&$(n.packs)}).catch(()=>{}).finally(()=>S(!1)))},[s]);const f=a.useCallback(async(t,n="alipay")=>{v(`${t}_${n}`),l("idle");try{const r=await(await fetch(`${g}/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({licenseKey:s,packId:t,payMethod:n})})).json();if(!r.success)throw new Error(r.error||"创建订单失败");if(r.data.codeUrl)x(r.data.codeUrl),w("wechat"),P(r.data.amount||""),k(r.data.outTradeNo),l("pending");else if(r.data.payUrl)x(r.data.payUrl),w("alipay"),P(r.data.amount||""),k(r.data.outTradeNo),l("pending");else throw new Error("获取支付链接失败")}catch(o){alert(o.message||"支付失败")}finally{v(null)}},[s]);a.useEffect(()=>{if(!h||c!=="pending")return;let t=!1;return(async()=>{for(let o=0;o<60&&!t&&(await new Promise(r=>setTimeout(r,3e3)),!t);o++)try{const u=await(await fetch(`${g}/order/${h}?licenseKey=${encodeURIComponent(s)}`)).json();if(u.success&&u.data.status==="paid"){l("success"),T();return}}catch{}!t&&c==="pending"&&l("fail")})(),()=>{t=!0}},[h,c,s]);const T=a.useCallback(async()=>{const n=(await fetch(`${g}/credits?licenseKey=${encodeURIComponent(s)}`).then(o=>o.json())).credits;typeof n=="number"?p(n):n&&typeof n.credits=="number"&&p(n.credits)},[s]);return s?e.jsxs("div",{style:i.container,children:[e.jsxs("div",{style:i.balanceCard,children:[e.jsxs("div",{children:[e.jsx("div",{style:i.balanceLabel,children:"当前积分余额"}),e.jsx("div",{style:i.balanceValue,children:j?"...":R?.toLocaleString()??"—"})]}),e.jsx("button",{onClick:T,style:i.refreshBtn,children:"↻ 刷新"})]}),c==="pending"&&e.jsx("div",{style:{...i.statusBanner,background:"rgba(59,130,246,0.12)",color:"#60a5fa"},children:"请在浏览器完成支付宝付款,支付成功后积分将自动到账..."}),c==="success"&&e.jsxs("div",{style:{...i.statusBanner,background:"rgba(34,197,94,0.12)",color:"#4ade80"},children:["充值成功!积分已到账",e.jsx("button",{onClick:()=>l("idle"),style:i.dismissBtn})]}),e.jsxs("div",{style:i.billingToggle,children:[e.jsx("button",{onClick:()=>B("monthly"),style:{...i.toggleBtn,...b==="monthly"?i.toggleActive:{}},children:"月付"}),e.jsxs("button",{onClick:()=>B("yearly"),style:{...i.toggleBtn,...b==="yearly"?i.toggleActive:{}},children:["年付",e.jsx("span",{style:i.toggleSave,children:"省 10%"})]})]}),e.jsx("div",{style:i.sectionTitle,children:"订阅套餐"}),e.jsx("div",{style:i.planGrid,children:W.map(t=>{const n=b==="yearly",o=+(t.monthlyPrice*10).toFixed(2),r=n?o:t.monthlyPrice,u=n?Math.round(o/12):t.monthlyPrice,A=t.discount<100;return e.jsxs("div",{style:{...i.planCard,...t.hot?i.planHot:{}},children:[t.hot&&e.jsx("div",{style:i.hotBadge,children:"推荐"}),e.jsx("div",{style:i.planName,children:t.name}),e.jsx("div",{style:i.planCredits,children:t.credits.toLocaleString()}),e.jsx("div",{style:i.planCreditsLabel,children:"积分 / 月"}),A&&e.jsxs("div",{style:i.discountBadge,children:["积分消耗 ",t.discount/10," 折"]}),e.jsxs("div",{style:i.planPrice,children:[e.jsx("span",{style:i.priceCurrency,children:"¥"}),r]}),e.jsx("div",{style:i.priceUnit,children:n?e.jsxs(e.Fragment,{children:["/ 年 ",e.jsxs("span",{style:i.pricePerMonth,children:["≈ ¥",u,"/月"]})]}):"/ 月"}),n&&e.jsxs("div",{style:i.savingTag,children:["比月付省 ¥",+(t.monthlyPrice*12-o).toFixed(2)]}),e.jsxs("div",{style:{display:"flex",gap:6,marginTop:4},children:[e.jsx("button",{onClick:()=>f(t.id,"alipay"),disabled:d!==null,style:{...i.buyBtn,flex:1,background:"#1677FF",opacity:d===`${t.id}_alipay`?.6:1},children:d===`${t.id}_alipay`?"...":"支付宝"}),e.jsx("button",{onClick:()=>f(t.id,"wechat"),disabled:d!==null,style:{...i.buyBtn,flex:1,background:"#07C160",opacity:d===`${t.id}_wechat`?.6:1},children:d===`${t.id}_wechat`?"...":"微信"})]})]},t.id)})}),y.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:i.sectionTitle,children:"单次充值"}),e.jsx("div",{style:i.packGrid,children:y.map(t=>e.jsxs("div",{style:i.packCard,children:[e.jsx("div",{style:i.packCredits,children:t.credits.toLocaleStr
1ing()}),e.jsx("div",{style:i.packCreditsLabel,children:"积分"}),e.jsxs("div",{style:i.packPrice,children:["¥",t.price]}),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("button",{onClick:()=>f(t.id,"alipay"),disabled:d!==null,style:{...i.buyBtnSecondary,flex:1,opacity:d===`${t.id}_alipay`?.6:1},children:d===`${t.id}_alipay`?"...":"支付宝"}),e.jsx("button",{onClick:()=>f(t.id,"wechat"),disabled:d!==null,style:{...i.buyBtnSecondary,flex:1,background:"rgba(7,193,96,0.15)",color:"#07C160",opacity:d===`${t.id}_wechat`?.6:1},children:d===`${t.id}_wechat`?"...":"微信"})]})]},t.id))})]}),j&&y.length===0&&e.jsx("div",{style:{textAlign:"center",color:"#94a3b8",marginTop:40},children:"加载中..."}),C&&e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"rgba(0,0,0,0.75)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{width:340,background:"#fff",borderRadius:16,padding:"28px 24px 20px",textAlign:"center",boxShadow:"0 20px 60px rgba(0,0,0,0.5)"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:"#1a1a2e",marginBottom:4},children:m==="wechat"?"微信扫码付款":"支付宝扫码付款"}),z&&e.jsxs("div",{style:{fontSize:28,fontWeight:800,color:m==="wechat"?"#07C160":"#1677ff",margin:"8px 0 12px"},children:["¥",z]}),e.jsx("div",{style:{display:"flex",justifyContent:"center",margin:"12px 0 16px"},children:e.jsx("img",{src:`https://api.qrserver.com/v1/create-qr-code/?size=220x220&data=${encodeURIComponent(C)}`,alt:"支付二维码",width:220,height:220,style:{borderRadius:8,border:"1px solid #e5e7eb"}})}),e.jsxs("div",{style:{fontSize:13,color:"#64748b",marginBottom:16},children:[m==="wechat"?"打开手机微信,扫一扫完成付款":"打开手机支付宝,扫一扫完成付款",e.jsx("br",{}),"支付成功后积分自动到账"]}),e.jsx("button",{onClick:()=>{x(null)},style:{border:"1px solid #e2e8f0",background:"#f8fafc",borderRadius:8,padding:"8px 32px",fontSize:14,color:"#64748b",cursor:"pointer"},children:"取消"})]})})]}):e.jsx("div",{style:i.container,children:e.jsx("p",{style:{textAlign:"center",color:"#94a3b8",marginTop:80},children:"缺少 licenseKey 参数"})})}const i={container:{minHeight:"100vh",background:"#0c0f1a",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',color:"#e2e8f0",padding:"24px 24px 48px"},balanceCard:{background:"linear-gradient(135deg, #1e293b, #1a2332)",borderRadius:16,padding:"24px 28px",marginBottom:24,display:"flex",alignItems:"center",justifyContent:"space-between",border:"1px solid rgba(255,255,255,0.06)"},balanceLabel:{fontSize:13,color:"#94a3b8",marginBottom:6},balanceValue:{fontSize:36,fontWeight:700,color:"#f1f5f9"},refreshBtn:{background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.08)",color:"#cbd5e1",fontSize:13,padding:"8px 18px",borderRadius:8,cursor:"pointer"},statusBanner:{borderRadius:12,padding:"14px 20px",marginBottom:20,fontSize:14,fontWeight:500,display:"flex",alignItems:"center",gap:12},dismissBtn:{background:"none",border:"none",color:"inherit",cursor:"pointer",marginLeft:"auto",opacity:.7,fontSize:16},billingToggle:{display:"flex",justifyContent:"center",gap:4,background:"rgba(255,255,255,0.04)",borderRadius:12,padding:4,width:"fit-content",margin:"0 auto 28px"},toggleBtn:{background:"transparent",border:"none",color:"#94a3b8",fontSize:14,fontWeight:600,padding:"8px 28px",borderRadius:10,cursor:"pointer",display:"flex",alignItems:"center",gap:6},toggleActive:{background:"#1B5E5A",color:"#fff"},toggleSave:{fontSize:11,fontWeight:700,color:"#fbbf24",background:"rgba(251,191,36,0.15)",padding:"2px 6px",borderRadius:6},sectionTitle:{fontSize:15,fontWeight:700,color:"#e2e8f0",marginBottom:16,marginTop:8},planGrid:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:16,marginBottom:36},planCard:{position:"relative",background:"#151c2c",borderRadius:16,padding:"28px 20px 20px",textAlign:"center",border:"1px solid rgba(255,255,255,0.06)"},planHot:{borderColor:"rgba(27,94,90,0.5)",background:"linear-gradient(135deg, #152d2b, #1a2332)",boxShadow:"0 0 24px rgba(27,94,90,0.15)"},hotBadge:{position:"absolute",top:-10,right:14,background:"#1B5E5A",color:"#fff",fontSize:11,fontWeight:700,padding:"3px 12px",borderRadius:10},discountBadge:{display:"inline-block",background:"rgba(251,191,36,0.12)",color:"#fbbf24",fontSize:11,fontWeight:600,padding:"3px 10px",borderRadius:8,marginBottom:12},planName:{fontSize:15,color:"#cbd5e1",marginBottom:16,fontWeight:700},planCredits:{fontSize:36,fontWeight:700,color:"#f1f5f9",lineHeight:1,marginBottom:4},planCreditsLabel:{fontSize:12,color:"#94a3b8",marginBottom:14},planPrice:{fontSize:28,fontWeight:700,color:"#f1f5f9",lineHeight:1},priceCurrency:{fontSize:16,fontWeight:500,verticalAlign:"top",marginRight:2},priceUnit:{fontSize:13,fontWeight:400,color:"#94a3b8",marginBottom:8},pricePerMonth:{color:"#64748b",fontSize:12},savingTag:{fontSize:12,color:"#4ade80",fontWeight:600,marginTop:4,marginBottom:8},buyBtn:{width:"100%",padding:"10px 0",borderRadius:10,border:"none",background:"rgba(255,255,255,0.08)",color:"#e2e8f0",fontSize:14,fontWeight:600,cursor:"pointer",marginTop:14},packGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:12,marginBottom:20},packCard:{background:"#151c2c",borderRadius:12,padding:"20px 16px",textAlign:"center",border:"1px solid rgba(255,255,255,0.06)"},packCredits:{fontSize:24,fontWeight:700,color:"#f1f5f9",lineHeight:1,marginBottom:4},packCreditsLabel:{fontSize:11,color:"#94a3b8",marginBottom:10},packPrice:{fontSize:20,fontWeight:700,color:"#f1f5f9",marginBottom:12}
1,buyBtnSecondary:{width:"100%",padding:"8px 0",borderRadius:8,border:"1px solid rgba(255,255,255,0.1)",background:"rgba(255,255,255,0.04)",color:"#cbd5e1",fontSize:13,fontWeight:600,cursor:"pointer"}};export{U as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.