|
|
webpackJsonp([20],{4219:function(e,n,t){"use strict";var a=t(0),c=t.n(a),s=(t(5),t(4220)),o=function(e,n,t){return n&&r(e.prototype,n),t&&r(e,t),e};function r(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function i(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}var l=(function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}(p,a.Component),o(p,[{key:"render",value:function(){var e=this.props,n=e.basicInfo,t=(e.current_user,window.location.pathname),a=-1!=t.indexOf("profile")||"/account"==t,o=-1!=t.indexOf("certification"),r=-1!=t.indexOf("secure"),i=-1!=t.indexOf("binding");return c.a.createElement("div",{className:"accountNav fl"},c.a.createElement("style",null,"\n .accountInfo { \n text-align: center;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n .accountInfo .name {\n color: #05101A;\n font-size: 24px;\n height: 36px;\n }\n .accountInfo .role {\n color: #666666;\n font-size: 14px;\n }\n .accountManagement .title {\n color: #05101A;\n font-size: 18px;\n font-weight: 400;\n padding: 10px 28px;\n margin-top: 6px;\n }\n .accountManagement .navItem {\n font-size: 16px;\n padding: 6px 0px;\n padding-left: 30px;\n border-left: 2px solid #fff;\n cursor: pointer;\n color:#4D4D4D;\n }\n .accountManagement .navItem i{\n margin-top: -4px;\n display: inline-block;\n margin-right: 7px;\n }\n .accountManagement .navItem i.status{\n margin-top: 1px;\n margin-right: 24px;\n }\n .accountManagement .navItem.active { \n border-left: 2px solid #4CACFF;\n background: #E6F3FF;\n }\n .accountManagement .navItem.active i:first-child{\n color:#4CACFF!important;\n }\n\n .color-green-light{\n color: #45E660!important;\n }\n "),n&&n.id&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"accountInfo"},c.a.createElement(s.a,Object.assign({src:n.avatar_url},this.props)),c.a.createElement("span",{className:"name"},n.name||""),c.a.createElement("span",{className:"role"},n.technical_title)),c.a.createElement("div",{className:"accountManagement"},c.a.createElement("div",{className:"title"},"账号管理"),c.a.createElement("ul",null,c.a.createElement("li",{className:"navItem "+(a?"active":""),onClick:this.toBasic},c.a.createElement("i",{className:"iconfont icon-jibenxinxi color-grey-9 font-16"}),"基本信息",1==n.base_info_completed?c.a.createElement("i",{className:"status fr iconfont icon-wancheng color-green-light font-16"}):c.a.createElement("i",{className:"status fr iconfont icon-tishi color-red font-16"})),c.a.createElement("li",{className:"navItem "+(o?"active":""),onClick:this.toCertification},c.a.createElement("i",{className:"iconfont icon-renzhengxinxi color-grey-9 font-16"}),"认证信息","certified"==n.professional_certification&&"certified"==n.authentication?c.a.createElement("i",{className:"status fr iconfont icon-wancheng color-green-light font-16"}):c.a.createElement("i",{className:"status fr iconfont icon-tishi color-red font-16"})),c.a.createElement("li",{className:"navItem "+(r?"active":""),onClick:this.toSecure},c.a.createElement("i",{className:"iconfont icon-anquanshezhi color-grey-9 font-16"}),"安全设置"),this.props.user&&!0===this.props.user.main_site?c.a.createElement("li",{className:"navItem "+(i?"active":""),onClick:this.isBinding},c.a.createElement("i",{className:"iconfont icon-lianjie color-grey-9 font-16"}),"绑定登录账号"):""))))}}]),p);function p(){var e,n,t;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,p);for(var a=arguments.length,o=Array(a),r=0;r<a;r++)o[r]=arguments[r];return(n=t=i(this,(e=p.__proto__||Object.getPrototypeOf(p)).call.apply(e,[this].concat(o)))).toBasic=function(){t.props.history.push("/account/profile")},t.toCertification=function(){t.props.history.push("/account/certification")},t.toSecure=function(){t.props.history.push("/account/secure")},t.isBinding=function(){t.props.history.push("/account/binding")},i(t,n)}n.a=l},4220:function(e,n,t){"use strict";var a=t(0),o=t.n(a),r=t(5),i=t(4221),c=function(e,n,t){return n&&s(e.prototype,n),t&&s(e,t),e};function s(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function l(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}var p=(function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}(u,a.Component),c(u,[{key:"render",value:function(){var e=Object(r.M)("images/"+this.props.src);return o.a.createElement("div",{className:"headphoto mt14"},o.a.createElement(i.a,Object.assign({},this.props,{ref:"picModal",imageSrc:e,userLogin:this.props.current_user?this.props.current_user.login:""})),o.a.createElement("style",null,"\n /*\n .headphoto {\n text-align: center;\n background: #FFFFff;\n width: 115px;\n height: 115px;\n padding: 3px;\n border-radius: 50%;\n position: relative;\n float: left;\n margin-top: 19px;\n box-sizing: border-box;\n }\n .headphoto img {\n width: 109px;\n border-radius: 50%;\n height: 109px;\n }\n .headphoto-black {\n display: none;\n cursor: pointer;\n position: absolute;\n top: 3px;\n left: 3px;\n width: 109px;\n height: 109px;\n text-align: center;\n line-height: 112px;\n border-radius: 50%;\n background-color: rgba(0,0,0,0.3);\n color: #fff;\n } */\n .headphoto:hover .headphoto-black {\n display: block;\n }\n "),o.a.createElement("img",{alt:"头像",id:"user_avatar_show",nhname:"avatar_image",src:""+e}),o.a.createElement("p",{className:"headphoto-black",onClick:this.editImg},"修改头像"))}}]),u);function u(){var e,n,t;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,u);for(var a=arguments.length,o=Array(a),r=0;r<a;r++)o[r]=arguments[r];return(n=t=l(this,(e=u.__proto__||Object.getPrototypeOf(u)).call.apply(e,[this].concat(o)))).editImg=function(){t.refs.picModal.setVisible(!0)},l(t,n)}n.a=p},4221:function(e,n,t){"use strict";var a=t(0),o=t.n(a),r=t(12),i=t.n(r),c=t(308),s=t(5),l=function(e,n,t){return n&&p(e.prototype,n),t&&p(e,t),e};function p(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var u="changeHeaderPic",f=(function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}(d,a.Component),l(d,[{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var e=this,n=(this.state.course_lists,this.props),t=(n.moduleName,n.current_user),a=t?Object(s.Q)()+"/images/"+t.image_url:"";return o.a.createElement(c.a,Object.assign({ref:"modalWrapper",title:"上传头像"},this.props,{onOk:this.onOk,okText:"保存",width:552,className:"changeHeaderModal",loading:this.state.uploading,onCancel:function(){return e.setState({uploading:!1})}}),o.a.createElement("style",null,"\n #changeHeader_imagePreview {\n overflow: hidden;\n background-color: #fff;\n border-radius: 50%;\n text-align: center;\n width: 120px;\n height: 120px;\n /* border: 1px solid #eee; */\n }\n .previewWrap {\n flex-direction: column;\n justify-content: space-between;\n height: 320px;\n align-items: center;\n margin-left: 36px;\n }\n .changeHeaderModal .tip {\n color: #9B9B9B;\n margin-top: 4px;\n }\n .changeHeaderModal .cropperWrap .tip {\n display: inline-block;\n }\n .previewWrap .tip {\n text-align: center;\n margin-top: 4px;\n }\n #uploadBtn {\n color: #4CACFF;\n border: 1px solid #4CACFF;\n padding: 2px 18px;\n cursor: pointer;\n }\n "),o.a.createElement("div",{className:"df"},o.a.createElement("div",{className:"cropperWrap"},o.a.createElement(s.h,{imageSrc:"",initPreviewUrl:a,ref:"cropper",imageId:u,previewId:"changeHeader_imagePreview",width:320,height:320}),o.a.createElement("span",{className:"tip"},"仅支持JPG、GIF、PNG,且文件小于2M")),o.a.createElement("div",{className:"df previewWrap",style:{flexDirection:"column"}},o.a.createElement("div",null,o.a.createElement("div",{id:"changeHeader_imagePreview"},a&&o.a.createElement("img",{src:a})),o.a.createElement("div",{className:"tip"},"头像预览")),o.a.createElement("label",{id:"uploadBtn",for:"inputImage"},o.a.createElement("input",{type:"file",class:"sr-only",id:"inputImage",name:"file",accept:"image/*"}),"点击上传"))))}}]),d);function d(e){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,d);var a=function(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,e));return a.init=function(){var o=document.getElementById("inputImage"),r=a;o.onchange=function(){var n,e=this.files;if(e&&e.length)if(n=e[0],/^image\/\w+/.test(n.type)){if(2097152<n.size)return void(this.props.showNotification&&this.props.showNotification("仅支持文件大小小于2M的文件"));n.type,n.name;var t=document.getElementById(u),a=new FileReader;a.readAsBinaryString(n),a.onload=function(){var e=btoa(a.result);console.log(),t.src="data:"+n.type+";base64,"+e,r.fileUploaded=!0,r.refs.cropper.renew(t),o.value=null},a.onerror=function(){console.log("there are some problems")}}else this.props.showNotification&&this.props.showNotification("请选择一个图片格式的文件")}},a.setVisible=function(e){a.refs.modalWrapper.setVisible(e),e&&(a.fileUploaded=!1,setTimeout(function(){a.init()},500))},a.onSendOk=function(){},a.onOk=function(){1!=a.state.uploading&&(1==a.fileUploaded?(console.log((new Date).getTime()),a.setState({uploading:!0},function(){window.setTimeout(function(){console.log((new Date).getTime()),a._onOk()},10)})):a.props.showNotification("请先上传图片"))},a._onOk=function(){var e=document.getElementById("changeHeader_imagePreview");window.html2canvas(e).then(function(e){var n=e.toDataURL("image/jpeg");console.log(n);var t="/users/accounts/"+a.props.userLogin+"/avatar.json";i.a.put(t,{image:n}).then(function(e){0==e.data.status&&(-1!=a.props.current_user.image_url.indexOf("avatars/User/b")||-1!=a.props.current_user.image_url.indexOf("avatars/User/g")?window.setTimeout(function(){a.doAfterUpdated()},1e3):a.doAfterUpdated(),a.setState({uploading:!1}))}).catch(function(e){this.setState({uploading:!1}),console.log(e)})})},a.doAfterUpdated=function(){a.props.fetchUser(),a.props.showNotification&&a.props.showNotification("修改头像成功"),a.setVisible(!1)},a.state={uploading:!1},a}n.a=f},783:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a=t(0),o=t.n(a),r=t(45),i=t(323),c=t(316),s=t(317),l=t.n(s),p=t(314),u=t(5),f=t(4219),d=t(12),m=t.n(d),h=function(e,n,t){return n&&g(e.prototype,n),t&&g(e,t),e};function g(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var b=l()({loader:function(){return t.e(45).then(t.bind(null,2333))},loading:c.a}),v=l()({loader:function(){return t.e(45).then(t.bind(null,1805))},loading:c.a}),y=l()({loader:function(){return t.e(71).then(t.bind(null,4222))},loading:c.a}),x=l()({loader:function(){return t.e(113).then(t.bind(null,4223))},loading:c.a}),w=l()({loader:function(){return t.e(114).then(t.bind(null,4224))},loading:c.a}),E=(function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}(_,a.Component),h(_,[{key:"render",value:function(){var n=this,t={basicInfo:this.state.basicInfo,getBasicInfo:this.getBasicInfo};return o.a.createElement("div",{className:"newMain clearfix"},o.a.createElement("div",{className:"educontent df pt20"},o.a.createElement("style",null,"\n .accountPage {\n display: flex;\n }\n .basicFormWrap{\n flex:1;\n width: 0;\n }\n\n /* 左侧 */\n .accountNav {\n width: 290px;\n box-shadow: 0px 4px 9px 0px rgba(11,62,120,0.21);\n border-radius: 2px;\n padding-top: 8px;\n padding-bottom: 30px;\n margin-bottom:30px;\n margin-right:20px;\n height: 460px;\n }\n "),o.a.createElement(f.a,Object.assign({},this.props,t)),o.a.createElement("div",{className:"basicFormWrap"},o.a.createElement(r.e,this.props,o.a.createElement(r.d,{path:"/account/profile/edit",render:function(e){return o.a.createElement(v,Object.assign({},n.props,e,n.state,t))}}),o.a.createElement(r.d,{path:"/account/profile",render:function(e){return o.a.createElement(b,Object.assign({},n.props,e,n.state,t))}}),o.a.createElement(r.d,{path:"/account/certification",render:function(e){return o.a.createElement(y,Object.assign({},n.props,e,n.state,t))}}),o.a.createElement(r.d,{path:"/account/secure",render:function(e){return o.a.createElement(x,Object.assign({},n.props,e,n.state,t))}}),o.a.createElement(r.d,{path:"/account/binding",render:function(e){return o.a.createElement(w,Object.assign({},n.props,e,n.state,t))}}),o.a.createElement(r.d,{exact:!0,path:"/account",render:function(e){return o.a.createElement(b,Object.assign({getBasicInfo:function(){return n.getBasicInfo()}},n.props,e,n.state,t))}})))))}}]),_);function _(e){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,_);var t=function(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,e));return t.componentDidUpdate=function(e){t.props.current_user&&t.props.current_user!=e.current_user&&t.getBasicInfo(t.props.current_user.login)},t.componentDidMount=function(){t.props.current_user&&t.getBasicInfo(t.props.current_user.login)},t.getBasicInfo=function(e){var n="/users/accounts/"+(e||t.props.current_user.login)+".json";m.a.get(n).then(function(e){e.data&&(e.data&&0==e.data.base_info_completed&&t.props.history.push("/account/profile/edit"),t.setState({basicInfo:Object.assign({},Object.assign({},e.data),{avatar_url:""+e.data.avatar_url,gender:null==e.data.gender||null==e.data.gender?0:e.data.gender})}))}).catch(function(e){console.log(e)})},t.state={basicInfo:{}},t}n.default=Object(i.a)()(Object(u.w)()(Object(p.a)(E)))}}); |