(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{1273:function(e,t,a){"use strict";a.r(t);a(37);var n=a(11),s=a.n(n),i=a(4),c=a(7),l=a(5),o=a(8),u=a(9),r=a(0),m=a.n(r),d=(a(264),a(21)),h=a(3),p=a(25),v=a(26),f=a(24),b=a(64),E=function(e){function t(e){var a;return Object(i.a)(this,t),(a=Object(l.a)(this,Object(o.a)(t).call(this,e))).toEditName=function(e){a.setState({isShow:!0,value:e})},a.cancle=function(){a.setState({isShow:!1})},a.handleChange=function(e){a.setState({value:e.target.value})},a.outLogin=function(){a.props.logout(),s.a.info("\u5df2\u9000\u51fa",2,null,!1),a.props.history.push("/my")},a.submit=function(){if(a.state.value.length>12)s.a.info("\u4e0d\u8d85\u8fc712\u4e2a\u5b57\u7b26",2);else if(0===a.state.value.length)s.a.info("\u8bf7\u8f93\u5165\u6635\u79f0",2);else{var e={user_name:a.state.value};h.d.post("".concat(API.home,"/m/user_info/update"),e).then(function(e){200===e.data.code?(a.setState({isShow:!1}),a.props.updateUser({data:{username:a.state.value}}),s.a.info("\u4fee\u6539\u6210\u529f",2)):4008===e.data.code?a.setState({isShow:!1}):s.a.info(e.data.msg,2)})}},a.state={isShow:!1,value:""},a}return Object(u.a)(t,e),Object(c.a)(t,[{key:"render",value:function(){var e=this.props.user,t=e&&e.data&&e.data.username,a=e&&e.data&&e.data.avatar;return m.a.createElement("div",{className:"edit-name"},m.a.createElement(p.e,{title:"\u8d26\u53f7",arrow:!0,cart:!1}),m.a.createElement("div",{className:"my-mess"},m.a.createElement("img",{src:a,alt:""}),m.a.createElement("span",{className:"name"},t),m.a.createElement("span",{onClick:this.toEditName.bind(this,t),className:"edit"},"\u7f16\u8f91")),m.a.createElement("div",{className:"out-login",onClick:this.outLogin},"\u9000\u51fa\u767b\u5f55"),this.state.isShow&&m.a.createElement("div",{className:"edit-mbc"},m.a.createElement("div",{className:"edit-content"},m.a.createElement("div",{className:"edit-title"},"\u4fee\u6539\u6635\u79f0"),m.a.createElement("input",{type:"text",placeholder:"\u8bf7\u8f93\u5165\u6635\u79f0\uff08\u4e0d\u8d85\u8fc712\u4e2a\u5b57\u7b26\uff09",value:this.state.value,onChange:this.handleChange.bind(this)}),m.a.createElement("div",{className:"edit-btn"},m.a.createElement("button",{className:"cancle",onClick:this.cancle},"\u53d6\u6d88"),m.a.createElement("button",{className:"submit",onClick:this.submit},"\u786e\u8ba4")))))}}]),t}(r.PureComponent);t.default=Object(f.d)(Object(d.b)(function(e){return{user:e.user}},{logout:v.e,updateUser:v.j}),b.a)(E)}}]);
//# sourceMappingURL=MyEdit.7a287fd0.chunk.js.map