PageSourceSearch

https://nickz.ai/assets/js/index-MBhMsecR.js

js nickz.ai collected 2026-10-05 14:21:05 UTC 4,698 bytes, 1 lines download raw bytes

1import{r as e,j as t}from"./vendor-react-DejgYtBM.js";import{f as a,B as r,m as s,y as l,E as d,J as i,K as n,M as c,o,j as h,i as y,G as x}from"./vendor-semi-D8d7bTtM.js";import{u as p,A as j,s as u,w as m}from"./index-BeIIFw6E.js";import"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";const{Title:g,Text:w,Paragraph:b}=a,f={0:{label:"待审核",color:"light-blue"},1:{label:"已通过",color:"green"},2:{label:"已拒绝",color:"red"}},k=()=>{const{t:a}=p(),[k,I]=e.useState([]),[_,v]=e.useState(!1),[A,C]=e.useState(!1),[S,N]=e.useState(!1),P=e.useRef(null),T=async()=>{v(!0);try{const e=await j.get("/api/app_code/");e.data.success?I(e.data.data||[]):u(e.data.message||"获取应用码失败")}catch(e){u("网络错误")}finally{v(!1)}};e.useEffect(()=>{T()},[]);const K=[{title:"应用名称",dataIndex:"name",key:"name",width:160},{title:"应用码",dataIndex:"code",key:"code",width:200,render:(e,a)=>1===a.status?t.jsx(w,{code:!0,copyable:!0,children:e}):t.jsx(w,{type:"tertiary",children:"审核通过后可见"})},{title:"项目链接",dataIndex:"project_link",key:"project_link",render:e=>e?t.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",style:{wordBreak:"break-all"},children:e}):t.jsx(w,{type:"tertiary",children:"-"})},{title:"状态",dataIndex:"status",key:"status",width:100,render:e=>{const a=f[e]||{label:"未知",color:"grey"};return t.jsx(y,{color:a.color,children:a.label})}},{title:"折扣率",dataIndex:"discount_rate",key:"discount_rate",width:100,render:(e,a)=>1===a.status?t.jsxs(y,{color:"cyan",children:[(100*e).toFixed(0),"% 优惠"]}):t.jsx(w,{type:"tertiary",children:"-"})},{title:"申请时间",dataIndex:"created_at",key:"created_at",width:180,render:e=>e?t.jsx(w,{type:"secondary",children:new Date(1e3*e).toLocaleString()}):"-"},{title:"操作",key:"action",width:80,render:(e,a)=>1!==a.status?t.jsx(x,{title:"确认删除此应用码申请?",onConfirm:()=>(async e=>{try{const t=await j.delete(`/api/app_code/${e}`);t.data.success?(m("删除成功"),T()):u(t.data.message||"删除失败")}catch(t){u("网络错误")}})(a.id),okText:"确认",cancelText:"取消",children:t.jsx(r,{type:"danger",size:"small",theme:"borderless",children:"删除"})}):null}];return t.jsxs("div",{className:"px-2 pb-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx(g,{heading:3,children:a("应用码")}),t.jsx(r,{theme:"solid",type:"primary",onClick:()=>C(!0),children:a("申请应用码")})]}),t.jsx(s,{className:"mb-4 !rounded-2xl",shadows:"always",bordered:!1,children:t.jsxs("div",{className:"space-y-1",children:[t.jsx(b,{type:"tertiary",children:"1. 提交应用码申请并填写您的项目信息,等待管理员审核。"}),t.jsxs(b,{type:"tertiary",children:["2. 审核通过后,在每次 API 请求的请求头中携带 ",t.jsx(w,{code:!0,children:"APP-Code: <您的应用码>"}),"。"]}),t.jsx(b,{type:"tertiary",children:"3. 应用码必须与当前使用的 API Key 属于同一账号,否则折扣不生效。"}),t.jsx(b,{type:"tertiary",children:"4. 折扣仅对审核通过的应用码有效,每个账号最多可申请 5 个应用码。"})]})}),t.jsx(s,{className:"!rounded-2xl",title:t.jsx(g,{heading:5,style:{margin:0},children:a("我的应用码")}),shadows:"always",bordered:!1,children:t.jsx(l,{columns:K,dataSource:k,rowKey:"id",style:{width:"100%"},pagination:!1,loading:_,empty:t.jsx(d,{image:t.jsx(n,{style:{width:150,height:150}}),darkModeImage:t.jsx(i,{style:{width:150,height:150}}),description:a("暂无应用码,点击右上角右上角「申请应用码」提交申请"),style:{padding:30}})})}),t.jsx(c,{title:a("申请应用码"),visible:A,onCancel:()=>{C(!1),P.current?.reset()},footer:t.jsxs(h,{children:[t.jsx(r,{onClick:()=>{C(!1),P.current?.reset()},children:a("取消")}),t.jsx(r,{type:"primary",loading:S,onClick:async()=>{let e;try{e=await P.current.validate()}catch{return}N(!0);try{const t=await j.post("/api/app_code/",e);t.data.success?(m(t.data.message||"申请已提交"),C(!1),P.current?.reset(),T()):u(t.data.message||"申请失败")}catch(t){u("网络错误")}finally{N(!1)}},children:a("提交申请")})]}),width:560,children:t.jsxs(o,{getFormApi:e=>P.current=e,layout:"vertical",children:[t.jsx(o.Input,{field:"name",label:a("应用名称"),placeholder:a("请输入您的应用/项目名称"),rules:[{required:!0,message:a("请填写应用名称")}]}),t.jsx(o.Input,{field:"project_link",label:a("项目链接(可选)"),placeholder:"https://github.com/your/project"}),t.jsx(o.TextArea,{field:"description",label:a("项目描述(可选)"),placeholder:a("简要描述您的项目用途和场景"),rows:4})]})})]})};export{k 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.