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