1 line
2.4 KiB
JavaScript
1 line
2.4 KiB
JavaScript
|
|
(this["webpackJsonpbeancount-web"]=this["webpackJsonpbeancount-web"]||[]).push([[17],{560:function(e,t,n){"use strict";n.r(t);var r=n(11),a=n(12),c=n(14),i=n(13),o=n(558),s=n(568),l=n(570),d=n(331),h=n(0),u=n.n(h),b=n(15),j=n(64),p=n(1),f={required:"${label} \u4e0d\u80fd\u4e3a\u7a7a\uff01"},m=function(e){Object(c.a)(n,e);var t=Object(i.a)(n);function n(){var e;Object(r.a)(this,n);for(var a=arguments.length,c=new Array(a),i=0;i<a;i++)c[i]=arguments[i];return(e=t.call.apply(t,[this].concat(c))).theme=e.context.theme,e.formRef=u.a.createRef(),e.state={loading:!1},e.handleCreateLedger=function(t){e.setState({loading:!0}),fetch("/api/ledger",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((function(e){return e.json()})).then((function(t){200===t.code?(window.localStorage.setItem("ledgerId",t.data),e.props.history.replace("/")):1010===t.code?o.b.error("\u65e0\u6548\u8d26\u6237"):1006===t.code&&o.b.error("\u5bc6\u7801\u9519\u8bef")})).catch((function(e){o.b.error("\u8bf7\u6c42\u5931\u8d25"),console.error(e)})).finally((function(){e.setState({loading:!1})}))},e}return Object(a.a)(n,[{key:"render",value:function(){return this.context.theme!==this.theme&&(this.theme=this.context.theme),Object(p.jsx)("div",{className:"ledger-page",children:Object(p.jsx)("div",{children:Object(p.jsxs)(s.a,{name:"add-account-form",size:"middle",ref:this.formRef,onFinish:this.handleCreateLedger,validateMessages:f,children:[Object(p.jsx)(s.a.Item,{name:"mail",label:"\u90ae\u7bb1",rules:[{required:!0}],children:Object(p.jsx)(l.a,{placeholder:"\u4f5c\u4e3a\u8d26\u672c\u7684\u552f\u4e00\u6807\u8bc6\uff0c\u4e00\u4e2a\u90ae\u7bb1\u53ea\u5141\u8bb8\u521b\u5efa\u4e00\u4e2a\u8d26\u672c"})}),Object(p.jsx)(s.a.Item,{name:"secret",label:"\u5bc6\u7801",rules:[{required:!0}],children:Object(p.jsx)(l.a,{type:"password",placeholder:"\u8d26\u672c\u5bc6\u7801"})}),Object(p.jsx)(s.a.Item,{children:Object(p.jsx)(d.a,{type:"primary",htmlType:"submit",children:"\u8f93\u5165\u90ae\u7bb1\uff0c\u521b\u5efa/\u8fdb\u5165\u4e2a\u4eba\u8d26\u672c"})})]})})})}}]),n}(h.Component);m.contextType=b.a,t.default=Object(j.a)(m)},64:function(e,t,n){"use strict";var r=n(86),a=n(11),c=n(12),i=n(14),o=n(13),s=n(0),l=n(1);t.a=function(e){return function(t){Object(i.a)(s,t);var n=Object(o.a)(s);function s(){return Object(a.a)(this,s),n.apply(this,arguments)}return Object(c.a)(s,[{key:"render",value:function(){return Object(l.jsx)(e,Object(r.a)({},this.props))}}]),s}(s.Component)}}}]);
|