1 line
7.2 KiB
JavaScript
1 line
7.2 KiB
JavaScript
(this["webpackJsonpbeancount-web"]=this["webpackJsonpbeancount-web"]||[]).push([[5],{106:function(e,t,n){},109:function(e,t,n){},113:function(e,t,n){},118:function(e,t,n){},123:function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),c=n(25),o=n.n(c),i=(n(106),n(43)),s=n(44),l=n(46),h=n(45),u=n(24),d=n(96),b=n.n(d),j=n(62),m=n.n(j),g=(n(108),n(28)),p=(n(109),n(48)),f="\u6211\u7684\u8d26\u672c",x="https://github.com/BaoXuebin/beancount-gs",O="https://www.yuque.com/chuyi-ble7p/beancount-gs",v="https://github.com/BaoXuebin/beancount-gs/issues",w="https://github.com/BaoXuebin/beancount-gs/blob/main/License",y=n(67),N=(n(113),n(3)),k=function(e){Object(l.a)(n,e);var t=Object(h.a)(n);function n(){var e;Object(i.a)(this,n);for(var r=arguments.length,a=new Array(r),c=0;c<r;c++)a[c]=arguments[c];return(e=t.call.apply(t,[this].concat(a))).state={version:""},e.handleOut=function(){localStorage.clear(),window.location.href="/web/#/ledger"},e}return Object(s.a)(n,[{key:"componentDidMount",value:function(){var e=this;Object(y.b)("/api/version").then((function(t){localStorage.setItem("version",t),e.setState({version:t})}))}},{key:"render",value:function(){var e=this.context.theme,t=window.localStorage.getItem("ledgerTitle")||f;return Object(N.jsx)("div",{className:"".concat(e,"-theme page-wrapper"),children:Object(N.jsxs)("div",{className:"wrapper",children:[Object(N.jsx)("header",{children:Object(N.jsx)("nav",{className:"navbar",children:Object(N.jsxs)("div",{className:"container",children:[Object(N.jsx)("div",{className:"navbar-header header-logo",to:"/",children:Object(N.jsx)(g.b,{to:"/",children:t})}),Object(N.jsxs)("div",{className:"menu navbar-right",children:[Object(N.jsx)(g.b,{to:"/account",children:"\u8d26\u6237"}),Object(N.jsx)(g.b,{to:"/stats",children:"\u7edf\u8ba1"}),Object(N.jsx)("a",{onClick:this.handleOut,children:"\u9000\u51fa"}),Object(N.jsx)("a",{href:x,children:Object(N.jsx)("img",{src:"https://img.shields.io/github/stars/BaoXuebin/beancount-gs?style=social"})})]})]})})}),Object(N.jsx)("div",{className:"main",children:Object(N.jsx)("div",{className:"main-wrap",children:this.props.children})}),Object(N.jsx)("footer",{className:"footer",children:Object(N.jsxs)("div",{className:"copyright",children:["\xa9 ",(new Date).getFullYear(),"\xa0\xa0",Object(N.jsx)("a",{href:"https://github.com/BaoXuebin/beancount-gs/releases/tag/".concat(this.state.version),target:"_blank",children:this.state.version}),"\xa0\xa0",Object(N.jsx)("a",{href:w,target:"_blank",children:"MIT"}),"\xa0\xa0",Object(N.jsx)("a",{href:O,target:"_blank",children:"\u4f7f\u7528\u6587\u6863"}),"\xa0\xa0",Object(N.jsx)("a",{href:v,target:"_blank",children:"\u53cd\u9988BUG"}),"\xa0\xa0"]})})]})})}}]),n}(r.Component);k.contextType=p.a;var P=k,I=n(21),S=n.n(I),B=n(8),T=(n(118),function(){return Object(N.jsx)("div",{style:{width:"100%"},className:"lds-rolling",children:Object(N.jsx)("div",{})})}),C=S()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(2),n.e(4),n.e(14)]).then(n.bind(null,431))},loading:T}),X=S()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(2),n.e(9)]).then(n.bind(null,426))},loading:T}),_=S()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(2),n.e(10)]).then(n.bind(null,428))},loading:T}),A=S()({loader:function(){return n.e(15).then(n.bind(null,422))},loading:T}),E=S()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(2),n.e(11)]).then(n.bind(null,432))},loading:T}),J=S()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(7),n.e(17)]).then(n.bind(null,423))},loading:T}),M=S()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(2),n.e(13),n.e(18)]).then(n.bind(null,424))},loading:T}),D=S()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(4),n.e(12)]).then(n.bind(null,429))},loading:T}),F=S()({loader:function(){return Promise.all([n.e(0),n.e(4),n.e(16)]).then(n.bind(null,425))},loading:T}),L=function(){return Object(N.jsx)(a.a.Fragment,{children:Object(N.jsxs)(B.c,{children:[Object(N.jsx)(B.a,{exact:!0,path:"/",component:X}),Object(N.jsx)(B.a,{exact:!0,path:"/init",component:M}),Object(N.jsx)(B.a,{exact:!0,path:"/ledger",component:C}),Object(N.jsx)(B.a,{exact:!0,path:"/account",component:_}),Object(N.jsx)(B.a,{exact:!0,path:"/about",component:A}),Object(N.jsx)(B.a,{exact:!0,path:"/edit",component:J}),Object(N.jsx)(B.a,{exact:!0,path:"/stats",component:E}),Object(N.jsx)(B.a,{exact:!0,path:"/import",component:D}),Object(N.jsx)(B.a,{exact:!0,path:"/setting",component:F}),Object(N.jsx)(B.a,{component:X})]})})};m.a.locale("zh-cn");var W=function(e){Object(l.a)(n,e);var t=Object(h.a)(n);function n(){var e;Object(i.a)(this,n);for(var r=arguments.length,a=new Array(r),c=0;c<r;c++)a[c]=arguments[c];return(e=t.call.apply(t,[this].concat(a))).state={theme:localStorage.getItem("theme")||"light"},e.toggleTheme=function(t){e.setState({theme:t})},e}return Object(s.a)(n,[{key:"render",value:function(){return Object(N.jsx)("div",{className:"App",children:Object(N.jsx)(p.a.Provider,{value:{theme:this.state.theme,toggleTheme:this.toggleTheme},children:Object(N.jsx)(u.a,{locale:b.a,children:Object(N.jsx)(g.a,{children:Object(N.jsx)(P,{children:Object(N.jsx)(L,{})})})})})})}}]),n}(r.Component);Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));o.a.render(Object(N.jsx)(a.a.StrictMode,{children:Object(N.jsx)(W,{})}),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()})).catch((function(e){console.error(e.message)}))},48:function(e,t,n){"use strict";var r=n(0),a=n.n(r).a.createContext({theme:"light",toggleTheme:function(){}});t.a=a},67:function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"d",(function(){return i})),n.d(t,"e",(function(){return s})),n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return u}));var r=n(20),a=(n(74),n(92)),c=n.n(a),o=function(e){var t=e.split(":");return t&&t.length>=1?t[0]:""},i=function(e){return e.split(":").join("_")},s=function(e){var t=e.split(":");return t&&t.length>=2?t[t.length-1]:""},l={Income:"\u6536\u5165",Expenses:"\u652f\u51fa",Liabilities:"\u8d1f\u503a",Assets:"\u8d44\u4ea7"},h=function(e){return e},u=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method,a=t.headers,o=t.body,i=t.hintError,s={"Content-Type":"application/json",ledgerId:window.localStorage.getItem("ledgerId")};return new Promise((function(t,l){c()(e,{method:n,headers:Object.assign({},s,a),body:JSON.stringify(o)}).then(h).then((function(e){return e.json()})).then((function(e){if(i)t(e);else{var n=e.code;200===n?t(e.data):200!==n&&(400===n?r.b.error("\u8bf7\u6c42\u53c2\u6570\u9519\u8bef"):1001===n?r.b.error("\u8d26\u76ee\u4e0d\u5e73\u8861"):1003===n?r.b.error("\u65e0\u6548\u8d26\u6237"):1005===n?r.b.error("\u65e0\u6548\u547d\u4ee4"):1006===n?r.b.error("\u5bc6\u7801\u9519\u8bef"):1007===n?r.b.error("\u8d26\u6237\u5df2\u5b58\u5728"):1008===n?r.b.error("\u5bc6\u94a5\u4e0d\u5339\u914d"):1010===n||401===n?window.location.href="/web/#/ledger":r.b.error("\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u5237\u65b0\u9875\u9762\u91cd\u8bd5"),l(e))}})).catch((function(e){r.b.error("\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u5237\u65b0\u9875\u9762\u91cd\u8bd5"),l(e)}))}))}}},[[123,6,8]]]); |