Files
accountbook/frontend/.next/static/chunks/pages/login-f50164aa2a6805b4.js
T

1 line
7.4 KiB
JavaScript
Raw Normal View History

2026-03-12 11:24:10 +08:00
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[459],{6429:function(n,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/login",function(){return t(1632)}])},6248:function(n,e,t){"use strict";t.d(e,{Z:function(){return o}});var a=t(5893),r=t(7294),c=t(1163),i=t(9415);let s=[{href:"/",label:"首页",icon:"home"},{href:"/stats",label:"统计",icon:"chart"},{href:"/recurring",label:"周期",icon:"repeat"},{href:"/categories",label:"分类",icon:"tags"}];function o(n){let{title:e,subtitle:t,actions:o,headerContent:u,children:l,contentClassName:d="",hideNav:h=!1,compactHeader:p=!1}=n,f=(0,c.useRouter)(),m=(0,r.useMemo)(()=>{let n=s.find(n=>n.href===f.pathname);return(null==n?void 0:n.href)||null},[f.pathname]),y=u||(e?(0,a.jsxs)("div",{className:"app-header__text",children:[(0,a.jsx)("h1",{children:e}),t?(0,a.jsx)("p",{children:t}):null]}):null),g=["app-header",p?"app-header--compact":"",y?"app-header--with-content":"app-header--actions-only",o?"app-header--with-actions":""].filter(Boolean).join(" ");return(0,a.jsxs)("div",{className:"app-shell".concat(h?" app-shell--standalone":""),children:[(0,a.jsx)("header",{className:g,children:(0,a.jsxs)("div",{className:"app-shell__container app-header__inner",children:[y?(0,a.jsx)("div",{className:"app-header__main",children:y}):(0,a.jsx)("div",{className:"app-header__spacer","aria-hidden":"true"}),o?(0,a.jsx)("div",{className:"app-header__actions",children:o}):null]})}),(0,a.jsx)("main",{className:"app-content ".concat(d).trim(),children:(0,a.jsx)("div",{className:"app-shell__container app-content__inner",children:l})}),h?null:(0,a.jsx)("nav",{className:"bottom-nav","aria-label":"主导航",children:(0,a.jsx)("div",{className:"app-shell__container bottom-nav__inner",children:s.map(n=>{let e=m===n.href;return(0,a.jsxs)("button",{type:"button",className:"bottom-nav__item".concat(e?" is-active":""),onClick:()=>f.push(n.href),"aria-current":e?"page":void 0,children:[(0,a.jsx)(i.J,{name:n.icon,size:20}),(0,a.jsx)("span",{children:n.label})]},n.href)})})})]})}},610:function(n,e,t){"use strict";async function a(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=await fetch("".concat("").concat(n),{...e,headers:{"Content-Type":"application/json",...function(){let n=localStorage.getItem("token");return n?{Authorization:"Bearer ".concat(n)}:{}}(),...e.headers}}),a=await t.json();if(!t.ok)throw Error(a.error||"请求失败");return a}async function r(n,e){let t=await a("/api/auth/login",{method:"POST",body:JSON.stringify({username:n,password:e})});return localStorage.setItem("token",t.token),t}async function c(n,e){let t=await a("/api/auth/register",{method:"POST",body:JSON.stringify({username:n,password:e})});return localStorage.setItem("token",t.token),t}function i(){localStorage.removeItem("token")}function s(){return!!localStorage.getItem("token")}async function o(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all",t="/api/records?month=".concat(n);return"all"!==e&&(t+="&type=".concat(e)),a(t)}async function u(n){return a("/api/stats?month=".concat(n))}async function l(n){return a("/api/records",{method:"POST",body:JSON.stringify(n)})}async function d(n,e){return a("/api/records/".concat(n),{method:"PUT",body:JSON.stringify(e)})}async function h(n){return a("/api/records/".concat(n),{method:"DELETE"})}async function p(n){return a("/api/records/search?q=".concat(encodeURIComponent(n)))}async function f(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"month",e=arguments.length>1?arguments[1]:void 0,t="/api/stats/trend?period=".concat(n);return e&&(t+="&month=".concat(e)),a(t)}async function m(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all",t="/api/stats/category?type=".concat(e);return n&&(t+="&month=".concat(n)),a(t)}async function y(){return a("/api/recurring")}async function g(n){return a("/api/recurring",{method:"POST",body:JSON.stringify(n)})}async function x(n,e){return a("/api/recurring/".concat(n),{method:"PUT",body:JSON.stringify(e)})}async function j(n){return a("/api/recurring/".concat(n),{method:"DE