四端上传

This commit is contained in:
tianmo committed 2026-09-29 15:25:40 +08:00
1 parent 25bbb5f9c8
commit c6e2cb4d5b
276 files changed
+17812 -3

No files matched your search

@@ -0,0 +1 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[520],{1513:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var r=n(1333),s=n(4705),a=n(8166),o=n(8312),l=n(1910),i=n(2787);function d(){let e=(0,a.useRouter)(),[t,n]=(0,s.useState)(""),[d,c]=(0,s.useState)(""),[u,m]=(0,s.useState)("login"),[h,g]=(0,s.useState)(""),[x,b]=(0,s.useState)(""),[f,p]=(0,s.useState)(!1);return(0,r.jsx)("main",{className:"flex min-h-screen items-center justify-center p-4",children:(0,r.jsxs)("div",{className:"w-full max-w-sm",children:[(0,r.jsxs)("div",{className:"mb-6 text-center",children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-gray-900",children:"叶雷讲数学"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"管理后台"})]}),(0,r.jsxs)(i.Zp,{children:[(0,r.jsx)(i.$T,{message:h}),x&&(0,r.jsx)(i.$T,{message:x,kind:"success"}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-sm text-gray-600",children:"账号"}),(0,r.jsx)(i.pd,{value:t,onChange:n,placeholder:"管理员账号"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-sm text-gray-600",children:"密码"}),(0,r.jsx)(i.pd,{value:d,onChange:c,placeholder:"密码",type:"password"})]}),(0,r.jsx)(i.$n,{onClick:()=>{if(g(""),b(""),!t||!d)return void g("请输入账号与密码");p(!0),("login"===u?o.F.login(t,d):o.F.bootstrap(t,d)).then(t=>{if("bootstrap"===u){b(t.created?"管理员已创建,请切换到登录。":"系统已存在管理员,无法重复创建。"),m("login");return}(0,l.WG)(t.accessToken),e.replace("/")}).catch(e=>g(e.message)).finally(()=>p(!1))},disabled:f,children:f?"处理中…":"login"===u?"登录":"创建管理员"})]}),(0,r.jsx)("button",{onClick:()=>{m("login"===u?"bootstrap":"login"),g(""),b("")},className:"mt-4 text-xs text-blue-600 hover:underline",children:"login"===u?"首次部署?创建管理员账号":"返回登录"})]})]})})}},1910:(e,t,n)=>{"use strict";n.d(t,{L:()=>o,M3:()=>l,WG:()=>a,gf:()=>s});let r="yelay_admin_token";function s(){var e;return null!=(e=window.localStorage.getItem(r))?e:""}function a(e){window.localStorage.setItem(r,e)}function o(){window.localStorage.removeItem(r)}function l(){return""!==s()}},2787:(e,t,n)=>{"use strict";n.d(t,{$T:()=>c,$n:()=>s,Sv:()=>u,TM:()=>o,Zp:()=>i,aF:()=>d,l6:()=>l,pd:()=>a});var r=n(1333);function s(e){let{children:t,onClick:n,variant:s="primary",disabled:a,type:o="button"}=e;return(0,r.jsx)("button",{type:o,onClick:n,disabled:a,className:"rounded-md px-3 py-1.5 text-sm font-medium transition disabled:cursor-not-allowed disabled:opacity-50 ".concat({primary:"bg-blue-600 text-white hover:bg-blue-700",ghost:"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50",danger:"bg-red-600 text-white hover:bg-red-700"}[s]),children:t})}function a(e){let{value:t,onChange:n,placeholder:s,type:a="text"}=e;return(0,r.jsx)("input",{type:a,value:t,placeholder:s,onChange:e=>n(e.target.value),className:"w-full rounded-md border border-gray-300 px-3 py-1.5 text-sm outline-none focus:border-blue-500"})}function o(e){let{value:t,onChange:n}=e;return(0,r.jsx)("textarea",{value:t,rows:6,onChange:e=>n(e.target.value),className:"w-full rounded-md border border-gray-300 px-3 py-1.5 font-mono text-xs outline-none focus:border-blue-500"})}function l(e){let{value:t,onChange:n,options:s}=e;return(0,r.jsx)("select",{value:t,onChange:e=>n(e.target.value),className:"w-full rounded-md border border-gray-300 px-3 py-1.5 text-sm outline-none focus:border-blue-500",children:s.map(e=>(0,r.jsx)("option",{value:String(e.value),children:e.label},e.value))})}function i(e){let{title:t,children:n,action:s}=e;return(0,r.jsxs)("section",{className:"rounded-lg border border-gray-200 bg-white p-5 shadow-sm",children:[(t||s)&&(0,r.jsxs)("header",{className:"mb-4 flex items-center justify-between",children:[t&&(0,r.jsx)("h2",{className:"text-base font-semibold text-gray-900",children:t}),s]}),n]})}function d(e){let{open:t,title:n,onClose:s,children:a,footer:o}=e;return t?(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:(0,r.jsxs)("div",{className:"max-h-[85vh] w-full max-w-2xl overflow-auto rounded-lg bg-white shadow-xl",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between border-b border-gray-200 px-5 py-3",children:[(0,r.jsx)("h3",{className:"text-base font-semibold",children:n}),(0,r.jsx)("button",{onClick:s,className:"text-gray-400 hover:text-gray-600","aria-label":"关闭",children:"✕"})]}),(0,r.jsx)("div",{className:"px-5 py-4",children:a}),o&&(0,r.jsx)("footer",{className:"flex justify-end gap-2 border-t border-gray-200 px-5 py-3",children:o})]})}):null}function c(e){let{message:t,kind:n="error"}=e;return t?(0,r.jsx)("div",{className:"mb-3 rounded-md border px-3 py-2 text-sm ".concat("error"===n?"bg-red-50 text-red-700 border-red-200":"bg-green-50 text-green-700 border-green-200"),children:t}):null}fLine truncated