beancount-gs/public/static/js/11.06b99fdc.chunk.js

1 line
13 KiB
JavaScript
Raw Normal View History

2021-09-24 08:11:41 +00:00
(this["webpackJsonpbeancount-web"]=this["webpackJsonpbeancount-web"]||[]).push([[11],{131:function(t,e,r){},285:function(t,e,r){"use strict";r.r(e);var n=r(11),o=r(12),i=r(14),s=r(13),a=r(281),u=r(282),c=r(288),h=r(64),f=r.n(h),d=r(0),l=r(60),p=r(15),y=r(56),b=(r(131),r(1)),m=function(t){Object(i.a)(r,t);var e=Object(s.a)(r);function r(){var t;Object(n.a)(this,r);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))).theme=t.context.theme,t.ledgerId=window.localStorage.getItem("ledgerId"),t.state={loading:!1,Assets:0,Income:0,Expenses:0,Liabilities:0},t.queryStatsTotalAmount=function(){t.setState({loading:!0}),f()("/api/auth/stats/total",{headers:{ledgerId:t.ledgerId}}).then((function(t){return t.json()})).then((function(e){if(200===e.code){var r=e.data,n=r.Income,o=r.Expenses,i=r.Liabilities,s=r.Assets;t.setState({Assets:s,Income:n,Expenses:o,Liabilities:i})}})).catch(console.error).finally((function(){t.setState({loading:!1})}))},t}return Object(o.a)(r,[{key:"componentDidMount",value:function(){this.queryStatsTotalAmount()}},{key:"render",value:function(){this.context.theme!==this.theme&&(this.theme=this.context.theme);var t=this.state.loading;return Object(b.jsxs)("div",{className:"assets-stats-page",style:{textAlign:"center"},children:[Object(b.jsx)("h1",{children:"\u8d44\u4ea7\u7edf\u8ba1"}),Object(b.jsx)("div",{children:Object(b.jsx)(a.a,{gutter:16,children:Object(b.jsx)(u.a,{span:24,children:Object(b.jsx)(c.a,{style:{cursor:"pointer"},title:"".concat(l.a.Assets,"\u7d2f\u8ba1"),value:this.state.Assets||0,loading:t,suffix:"CNY"})})})})]})}}]),r}(d.Component);m.contextType=p.a,e.default=Object(y.a)(m)},56:function(t,e,r){"use strict";var n=r(68),o=r(11),i=r(12),s=r(14),a=r(13),u=r(0),c=r(1);e.a=function(t){return function(e){Object(s.a)(u,e);var r=Object(a.a)(u);function u(){return Object(o.a)(this,u),r.apply(this,arguments)}return Object(i.a)(u,[{key:"render",value:function(){return Object(c.jsx)(t,Object(n.a)({},this.props))}}]),u}(u.Component)}},60:function(t,e,r){"use strict";r.d(e,"c",(function(){return s})),r.d(e,"e",(function(){return a})),r.d(e,"d",(function(){return u})),r.d(e,"a",(function(){return c})),r.d(e,"b",(function(){return f}));var n=r(278),o=r(64),i=r.n(o),s=function(t){var e=t.split(":");return e&&e.length>=1?t.split(":")[0]:""},a=function(t){var e=t.split(":");return e&&2===e.length?t.split(":")[1]:e&&e.length>=3?t.split(":")[e.length-2]:""},u=function(t){var e=t.split(":");return e&&e.length>=2?t.split(":")[e.length-1]:""},c={Income:"\u6536\u5165",Expenses:"\u652f\u51fa",Liabilities:"\u8d1f\u503a",Assets:"\u8d44\u4ea7"},h=function(t){return t},f=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.method,o=e.headers,s=e.body,a={"Content-Type":"application/json",ledgerId:window.localStorage.getItem("ledgerId")};return new Promise((function(e,u){i()(t,{method:r,headers:Object.assign({},a,o),body:JSON.stringify(s)}).then(h).then((function(t){return t.json()})).then((function(t){var r=t.code;200===r?e(t.data):200!==r&&(400===r?n.b.error("\u8bf7\u6c42\u53c2\u6570\u9519\u8bef"):1001===r?n.b.error("\u8d26\u76ee\u4e0d\u5e73\u8861"):1003===r?n.b.error("\u65e0\u6548\u8d26\u6237"):1005===r?n.b.error("\u65e0\u6548\u547d\u4ee4"):1006===r?n.b.error("\u5bc6\u7801\u9519\u8bef"):1010===r?window.location.href="/#/ledger":n.b.error("\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u5237\u65b0\u9875\u9762\u91cd\u8bd5"),u(t))})).catch((function(t){n.b.error("\u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u5237\u65b0\u9875\u9762\u91cd\u8bd5"),u(t)}))}))}},64:function(t,e,r){r(87),t.exports=self.fetch.bind(self)},87:function(t,e,r){"use strict";r.r(e),r.d(e,"Headers",(function(){return p})),r.d(e,"Request",(function(){return A})),r.d(e,"Response",(function(){return O})),r.d(e,"DOMException",(function(){return E})),r.d(e,"fetch",(function(){return _}));var n="undefined"!==typeof globalThis&&globalThis||"undefined"!==typeof self&&self||"undefined"!==typeof n&&n,o="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,s="FileReader"in n&&"Blob"in n&&fu