1 line
7.1 KiB
JavaScript
1 line
7.1 KiB
JavaScript
(this["webpackJsonpbeancount-web"]=this["webpackJsonpbeancount-web"]||[]).push([[5],{104:function(e,t,n){},105:function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),o=n(24),c=n.n(o),i=(n(94),n(41)),s=n(42),l=n(44),h=n(43),u=n(28),d=(n(95),n(46)),b="\u6211\u7684\u8d26\u672c",j="https://github.com/BaoXuebin/beancount-gs",m="https://www.yuque.com/chuyi-ble7p/beancount-gs",g="https://github.com/BaoXuebin/beancount-gs/issues",f="https://github.com/BaoXuebin/beancount-gs/blob/main/License",p=n(62),x=(n(99),n(3)),O=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),o=0;o<r;o++)a[o]=arguments[o];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(p.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")||b;return Object(x.jsx)("div",{className:"".concat(e,"-theme"),children:Object(x.jsxs)("div",{className:"wrapper",children:[Object(x.jsx)("header",{children:Object(x.jsx)("nav",{className:"navbar",children:Object(x.jsxs)("div",{className:"container",children:[Object(x.jsx)("div",{className:"navbar-header header-logo",to:"/",children:Object(x.jsx)(u.b,{to:"/",children:t})}),Object(x.jsxs)("div",{className:"menu navbar-right",children:[Object(x.jsx)(u.b,{to:"/account",children:"\u8d26\u6237"}),Object(x.jsx)(u.b,{to:"/stats",children:"\u7edf\u8ba1"}),Object(x.jsx)("a",{onClick:this.handleOut,children:"\u9000\u51fa"}),Object(x.jsx)("a",{href:j,children:Object(x.jsx)("img",{src:"https://img.shields.io/github/stars/BaoXuebin/beancount-gs?style=social"})})]})]})})}),Object(x.jsx)("div",{className:"main",children:Object(x.jsx)("div",{className:"main-wrap",children:this.props.children})}),Object(x.jsx)("footer",{className:"footer",children:Object(x.jsxs)("div",{className:"copyright",children:["\xa9 ",(new Date).getFullYear(),"\xa0\xa0",Object(x.jsx)("a",{href:"https://github.com/BaoXuebin/beancount-gs/releases/tag/".concat(this.state.version),target:"_blank",children:this.state.version}),"\xa0\xa0",Object(x.jsx)("a",{href:f,target:"_blank",children:"MIT"}),"\xa0\xa0",Object(x.jsx)("a",{href:m,target:"_blank",children:"\u4f7f\u7528\u6587\u6863"}),"\xa0\xa0",Object(x.jsx)("a",{href:g,target:"_blank",children:"\u53cd\u9988BUG"}),"\xa0\xa0"]})})]})})}}]),n}(r.Component);O.contextType=d.a;var v=O,w=n(23),y=n.n(w),N=n(7),k=(n(104),function(){return Object(x.jsx)("div",{style:{width:"100%"},className:"lds-rolling",children:Object(x.jsx)("div",{})})}),P=y()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(2),n.e(4),n.e(11)]).then(n.bind(null,485))},loading:k}),I=y()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(2),n.e(8)]).then(n.bind(null,484))},loading:k}),S=y()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(2),n.e(9)]).then(n.bind(null,483))},loading:k}),B=y()({loader:function(){return n.e(15).then(n.bind(null,479))},loading:k}),T=y()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(2),n.e(13)]).then(n.bind(null,489))},loading:k}),C=y()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(7),n.e(17)]).then(n.bind(null,480))},loading:k}),X=y()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(2),n.e(12),n.e(18)]).then(n.bind(null,481))},loading:k}),_=y()({loader:function(){return Promise.all([n.e(0),n.e(1),n.e(3),n.e(4),n.e(14)]).then(n.bind(null,486))},loading:k}),A=y()({loader:function(){return Promise.all([n.e(0),n.e(4),n.e(16)]).then(n.bind(null,482))},loading:k}),E=function(){return Object(x.jsx)(a.a.Fragment,{children:Object(x.jsxs)(N.c,{children:[Object(x.jsx)(N.a,{exact:!0,path:"/",component:I}),Object(x.jsx)(N.a,{exact:!0,path:"/init",component:X}),Object(x.jsx)(N.a,{exact:!0,path:"/ledger",component:P}),Object(x.jsx)(N.a,{exact:!0,path:"/account",component:S}),Object(x.jsx)(N.a,{exact:!0,path:"/about",component:B}),Object(x.jsx)(N.a,{exact:!0,path:"/edit",component:C}),Object(x.jsx)(N.a,{exact:!0,path:"/stats",component:T}),Object(x.jsx)(N.a,{exact:!0,path:"/import",component:_}),Object(x.jsx)(N.a,{exact:!0,path:"/setting",component:A}),Object(x.jsx)(N.a,{component:I})]})})},J=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),o=0;o<r;o++)a[o]=arguments[o];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(x.jsx)("div",{className:"App",children:Object(x.jsx)(d.a.Provider,{value:{theme:this.state.theme,toggleTheme:this.toggleTheme},children:Object(x.jsx)(u.a,{children:Object(x.jsx)(v,{children:Object(x.jsx)(E,{})})})})})}}]),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}$/));c.a.render(Object(x.jsx)(a.a.StrictMode,{children:Object(x.jsx)(J,{})}),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()})).catch((function(e){console.error(e.message)}))},46:function(e,t,n){"use strict";var r=n(0),a=n.n(r).a.createContext({theme:"light",toggleTheme:function(){}});t.a=a},62:function(e,t,n){"use strict";n.d(t,"c",(function(){return c})),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(22),a=(n(72),n(84)),o=n.n(a),c=function(e){var t=e.split(":");return t&&t.length>=1?e.split(":")[0]:""},i=function(e){return e.split(":").join("_")},s=function(e){var t=e.split(":");return t&&t.length>=2?e.split(":")[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,c=t.body,i=t.hintError,s={"Content-Type":"application/json",ledgerId:window.localStorage.getItem("ledgerId")};return new Promise((function(t,l){o()(e,{method:n,headers:Object.assign({},s,a),body:JSON.stringify(c)}).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)}))}))}},94:function(e,t,n){},95:function(e,t,n){},99:function(e,t,n){}},[[105,6,10]]]); |