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