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