1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[845],{8208:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/recurring",function(){return t(5190)}])},6248:function(e,n,t){"use strict";t.d(n,{Z:function(){return o}});var a=t(5893),i=t(7294),c=t(1163),s=t(9415);let r=[{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:l,children:u,contentClassName:d="",hideNav:m=!1,compactHeader:h=!1}=e,p=(0,c.useRouter)(),y=(0,i.useMemo)(()=>{let e=r.find(e=>e.href===p.pathname);return(null==e?void 0:e.href)||null},[p.pathname]),b=l||(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),f=["app-header",h?"app-header--compact":"",b?"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:f,children:(0,a.jsxs)("div",{className:"app-shell__container app-header__inner",children:[b?(0,a.jsx)("div",{className:"app-header__main",children:b}):(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:u})}),m?null:(0,a.jsx)("nav",{className:"bottom-nav","aria-label":"主导航",children:(0,a.jsx)("div",{className:"app-shell__container bottom-nav__inner",children:r.map(e=>{let n=y===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 i(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 c(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 r(){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 l(e){return a("/api/stats?month=".concat(e))}async function u(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 y(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 b(){return a("/api/recurring")}async function f(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 g(e){return a("/api/recurring/".concat(e),{method
|