main.0a416c46.chunk.js 4.7 KB

12
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{17:function(e,t,n){"use strict";var a=n(4);t.a=Object(a.a)()},18:function(e,t,n){"use strict";var a,r,o,i=n(24),c=n(5),s=n(6),u=n(14),l=(n(57),n(1)),p=n(17),m=(a=function(){function e(){Object(c.a)(this,e),Object(i.a)(this,"userId",r,this),Object(i.a)(this,"token",o,this)}return Object(s.a)(e,[{key:"login",value:function(e,t){sessionStorage.setItem("userId",this.userId=e),sessionStorage.setItem("token",this.token=t)}},{key:"logout",value:function(){sessionStorage.removeItem("userId"),this.userId=void 0,sessionStorage.removeItem("token"),this.token=void 0,p.a.push("/login")}}]),e}(),r=Object(u.a)(a.prototype,"userId",[l.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return sessionStorage.getItem("userId")}}),o=Object(u.a)(a.prototype,"token",[l.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return sessionStorage.getItem("token")}}),Object(u.a)(a.prototype,"login",[l.d],Object.getOwnPropertyDescriptor(a.prototype,"login"),a.prototype),Object(u.a)(a.prototype,"logout",[l.d],Object.getOwnPropertyDescriptor(a.prototype,"logout"),a.prototype),a);t.a=new m},41:function(e,t,n){e.exports=n(64)},48:function(e,t,n){},49:function(e,t,n){},64:function(e,t,n){"use strict";n.r(t);n(42);var a=n(37),r=n(0),o=n.n(r),i=n(7),c=n.n(i),s=(n(48),n(5)),u=n(6),l=n(10),p=n(9),m=n(11),h=n(65),d=n(32),f=(n(49),{"/login":"\u7528\u6237\u767b\u5f55","/information":"\u7528\u6237\u4fe1\u606f\u5f55\u5165","/admin":"\u7ba1\u7406\u5458\u4e2d\u5fc3","/admin/login":"\u7ba1\u7406\u5458\u767b\u5f55"}),b=function(e){function t(e){var n;return Object(s.a)(this,t),(n=Object(l.a)(this,Object(p.a)(t).call(this,e))).state={title:f[n.props.location.pathname]},e.history.listen(function(e){var t=e.pathname;n.setState({title:f[t]})}),n}return Object(m.a)(t,e),Object(u.a)(t,[{key:"render",value:function(){return o.a.createElement("nav",{className:"page-nav"},o.a.createElement("i",{className:"nav-logo"}),o.a.createElement("div",{className:"nav-title"},this.state.title))}}]),t}(r.Component),v=Object(h.d)(b),O=n(35),j=n(18);var g=function(e){var t=e.component,n=e.redirectPath,a=void 0===n?"/login":n,r=Object(O.a)(e,["component","redirectPath"]);return o.a.createElement(h.b,Object.assign({},r,{render:function(e){return j.a.userId&&j.a.token?o.a.createElement(t,e):o.a.createElement(h.a,{to:{pathname:a,state:{from:e.location}}})}}))},y=n(19),k=n.n(y),w=n(25);function E(e){return function(t){function n(e){var t;return Object(s.a)(this,n),(t=Object(l.a)(this,Object(p.a)(n).call(this,e))).state={component:null},t}return Object(m.a)(n,t),Object(u.a)(n,[{key:"componentDidMount",value:function(){var t=Object(w.a)(k.a.mark(function t(){var n,a;return k.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e();case 2:n=t.sent,a=n.default,this.setState({component:a});case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"render",value:function(){var e=this.state.component;return e?o.a.createElement(e,this.props):null}}]),n}(r.Component)}var I,S=E(function(){return Promise.all([n.e(0),n.e(1),n.e(8)]).then(n.bind(null,311))}),P=E(function(){return Promise.all([n.e(0),n.e(1),n.e(2),n.e(6),n.e(7)]).then(n.bind(null,310))}),x=E(function(){return Promise.all([n.e(0),n.e(2),n.e(9)]).then(n.bind(null,309))}),D=[{path:"/",exact:!0,render:function(e){return o.a.createElement(g,Object.assign({path:"/",component:P},e))}},{path:"/login",title:"\u7528\u6237\u767b\u5f55",render:function(e){return o.a.createElement(S,e)}},{path:"/user/information",title:"\u7528\u6237\u4fe1\u606f\u5f55\u5165",render:function(e){return o.a.createElement(g,Object.assign({path:"/user/information",component:P},e))}},{path:"/user/preview/:id",title:"\u7b80\u5386\u9884\u89c8",render:function(e){return o.a.createElement(x,e)}}],N=n(17),z=Object(d.a)(I=function(e){function t(){return Object(s.a)(this,t),Object(l.a)(this,Object(p.a)(t).apply(this,arguments))}return Object(m.a)(t,e),Object(u.a)(t,[{key:"render",value:function(){return o.a.createElement("div",{className:"App"},o.a.createElement(h.c,{history:N.a},o.a.createElement(v,null),D.map(function(e){return o.a.createElement(h.b,{key:e.path,exact:e.exact,path:e.path,render:e.render})})))}},{key:"componentDidMount",value:function(){}}]),t}(r.Component))||I;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}$/));var C=n(36),B=n.n(C),J=n(8),M=n.n(J);n(60);M.a.locale("zh-cn"),c.a.render(o.a.createElement(a.a,{locale:B.a},o.a.createElement(z,null)),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(function(e){e.unregister()})}},[[41,4,5]]]);
  2. //# sourceMappingURL=main.0a416c46.chunk.js.map