newreactbuild/p__Account.js

1 line
8.5 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[25],{"10oi":function(a,e,t){a.exports={wrap:"wrap___15YxZ",avatarWrap:"avatarWrap___1SK7M",avatar:"avatar___aE2NE",updateAvatarWrap:"updateAvatarWrap___1fuUU",img:"img___1hVau",updateAvatar:"updateAvatar___3eO7J",name:"name___3A4CD",role:"role___2fZYJ",title:"title___BMo5O",colorGary:"colorGary___1xzwA",colorGreen:"colorGreen___1cWMZ",colorRed:"colorRed___3vds7",item:"item___3kvAY",active:"active___2NtTm"}},"5sM0":function(a,e,t){a.exports={modal:"modal___2DX0z",avatarWrap:"avatarWrap___2lmFf",tip:"tip___220u_",previewWrap:"previewWrap___2BJLo",previewImg:"previewImg___29S6d",uploadButton:"uploadButton___30_6b"}},m3a9:function(a,e,t){"use strict";t.r(e);var n,c=t("WmNS"),o=t.n(c),i=t("9og8"),r=t("PpiC"),l=t("q1tI"),s=t.n(l),u=t("9kvl"),m=t("tJVT"),d=t("Ty5D"),p=t("m3rI"),v=(t("2qtc"),t("kLXV")),f=(t("T2oS"),t("W9HT")),g=(t("miYZ"),t("tsqr")),_=t("wyMu"),E=t.n(_),b=t("5sM0"),h=t.n(b),N=(t("YQfW"),function(a){var e=a.user,t=(a.account,a.globalSetting,a.loading),n=a.dispatch,c=a.visible,r=a.onClose,u=Object(l["useState"])(),d=Object(m["a"])(u,2),_=d[0],b=d[1],N=Object(l["useRef"])();Object(l["useEffect"])((function(){var a;c&&b("".concat(p["a"].IMG_SERVER,"/images/").concat(null===(a=e.userInfo)||void 0===a?void 0:a.image_url))}),[e.userInfo,c]);var w=function(a){var e,t;if(a.dataTransfer?t=a.dataTransfer.files:a.target&&(t=a.target.files),null===(e=t)||void 0===e?void 0:e.length){var n=t[0];if(/^image\/\w+/.test(n.type))if(n.size>2097152)g["b"].info("\u4ec5\u652f\u6301\u6587\u4ef6\u5927\u5c0f\u5c0f\u4e8e2M\u7684\u6587\u4ef6");else{var c=new FileReader;c.onload=function(){b(c.result)},c.readAsDataURL(t[0])}else g["b"].info("\u8bf7\u9009\u62e9\u4e00\u4e2a\u56fe\u7247\u683c\u5f0f\u7684\u6587\u4ef6")}},I=function(){var a=Object(i["a"])(o.a.mark((function a(){var t,c,i;return o.a.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return c=N.current.getCroppedCanvas().toDataURL("image/jpeg"),c||g["b"].info("\u8bf7\u5148\u4e0a\u4f20\u56fe\u7247"),a.next=4,n({type:"account/updateAvatar",payload:{image:c,login:null===(t=e.userInfo)||void 0===t?void 0:t.login}});case 4:i=a.sent,y(),0===i.status&&(g["b"].info("\u4fee\u6539\u5934\u50cf\u6210\u529f"),n({type:"user/getUserInfo"}));case 7:case"end":return a.stop()}}),a)})));return function(){return a.apply(this,arguments)}}(),y=function(){r()};return s.a.createElement(v["a"],{centered:!0,keyboard:!1,closable:!1,visible:c,title:"\u4e0a\u4f20\u5934\u50cf",width:550,forceRender:!0,confirmLoading:t["account/updateAvatar"],onOk:I,onCancel:y},s.a.createElement(f["a"],{spinning:!!t["account/updateAvatar"]},s.a.createElement("div",{className:h.a.modal},s.a.createElement("div",null,s.a.createElement("div",{className:h.a.avatarWrap},s.a.createElement(E.a,{style:{height:320,width:320},ref:N,src:_,guides:!1,aspectRatio:1,preview:"#updateAvatarImg"})),s.a.createElement("span",{className:h.a.tip},"\u4ec5\u652f\u6301JPG\u3001GIF\u3001PNG\uff0c\u4e14\u6587\u4ef6\u5c0f\u4e8e2M")),s.a.createElement("div",{className:h.a.previewWrap},s.a.createElement("div",null,s.a.createElement("div",{className:h.a.previewImg,id:"updateAvatarImg"}),s.a.createElement("div",{className:"".concat(h.a.tip," tc")},"\u5934\u50cf\u9884\u89c8")),s.a.createElement("label",{className:h.a.uploadButton,id:"uploadBtn",htmlFor:"inputImage"},s.a.createElement("input",{type:"file",className:"sr-only",id:"inputImage",name:"file",accept:"image/*",style:{display:"none"},onChange:w}),"\u70b9\u51fb\u4e0a\u4f20")))))}),w=Object(u["a"])((function(a){var e=a.user,t=a.account,n=a.loading,c=a.globalSetting;return{user:e,account:t,globalSetting:c,loading:n.effects}}))(N),I=t("10oi"),y=t.n(I);(function(a){a["Profile"]="profile",a["Certification"]="certification",a["Secure"]="secure",a["Group"]="teach-group",a["Binding"]="binding"})(n||(n={}));var S=function(a){var e,t,c,o,i,v,f,g,_=a.user,E=a.account,b=a.globalSetting,h=(a.loading,a.dispatch),N=(Object(r["a"])(a,["user","account","globalSetting","loading","dispatch"]),Object(l["useState"])()),I=Object(m["a"])(N,2),S=I[0],A=I[1],O=Object(d["l"])();Object(l["useEffect"])((function(){var a,e=null===(a=O.pathname.split("/"))||void 0===a?void 0:a[2];A(e)}),[O.pathname]);var j="".concat(p["a"].IMG_SERVER,"/images/").concat(null===(e=_.userInfo)||void 0===e?void 0:e.image_url);return s.a.createElement("section",{className:y.a.wrap},s.a.createElement("div",{className:y.a.avatarWrap},s.a.createElement("div",{className:y.a.avatar},s.a.createElement("div",{className:y.a.updateAvatarWrap},s.a.createElement("img",{className:y.a.img,src:j}),s.a.createElement("div",{className:y.a.updateAvatar,onClick:function(){h({type:"account/setActionTabs",payload:{key:"Account-UpdateAvatar"}})}},"\u4fee\u6539\u5934\u50cf"))),s.a.createElement("span",{className:y.a.name},null===(t=_.userInfo)||void 0===t?void 0:t.username),s.a.createElement("span",{className:y.a.role},null===(c=_.userInfo)||void 0===c?void 0:c.user_identity)),s.a.createElement("div",null,s.a.createElement("div",{className:y.a.title},"\u8d26\u53f7\u7ba1\u7406"),s.a.createElement("ul",{className:"pl0"},s.a.createElement("li",{className:"".concat(y.a.item," ").concat(S===n.Profile?y.a.active:""),onClick:function(){return u["c"].push("/account/".concat(n.Profile))}},s.a.createElement("span",null,s.a.createElement("i",{className:"iconfont icon-jibenxinxi font16 mr5 ".concat(y.a.colorGary)}),"\u57fa\u672c\u4fe1\u606f"),s.a.createElement("i",{className:"iconfont font16 mr25 ".concat((null===(o=E.basicInfo)||void 0===o?void 0:o.base_info_completed)?"".concat(y.a.colorGreen," icon-wancheng"):"".concat(y.a.colorRed," icon-tishi"))})),s.a.createElement("li",{className:"".concat(y.a.item," ").concat(S===n.Certification?y.a.active:""),onClick:function(){return u["c"].push("/account/".concat(n.Certification))}},s.a.createElement("span",null,s.a.createElement("i",{className:"iconfont icon-renzhengxinxi font16 mr5 ".concat(y.a.colorGary)}),"\u8ba4\u8bc1\u4fe1\u606f"),s.a.createElement("i",{className:"iconfont font16 mr25 ".concat("certified"===(null===(i=E.basicInfo)||void 0===i?void 0:i.professional_certification)&&"certified"===(null===(v=E.basicInfo)||void 0===v?void 0:v.authentication)?"".concat(y.a.colorGreen," icon-wancheng"):"".concat(y.a.colorRed," icon-tishi"))})),s.a.createElement("li",{className:"".concat(y.a.item," ").concat(S===n.Group?y.a.active:""),onClick:function(){return u["c"].push("/account/teach-group")}},s.a.createElement("span",null," ",s.a.createElement("i",{className:"iconfont icon-STEERINGCOMMITTEE font16 mr5 ".concat(y.a.colorGary)}),"\u6559\u7814\u56e2\u961f ")),s.a.createElement("li",{className:"".concat(y.a.item," ").concat(S===n.Secure?y.a.active:""),onClick:function(){return u["c"].push("/account/".concat(n.Secure))}},s.a.createElement("span",null,s.a.createElement("i",{className:"iconfont icon-anquanshezhi font16 mr5 ".concat(y.a.colorGary)}),"\u5b89\u5168\u8bbe\u7f6e")),!(null===b||void 0===b||null===(f=b.setting)||void 0===f?void 0:f.is_local)&&s.a.createElement("li",{className:"".concat(y.a.item," ").concat(S===n.Binding?y.a.active:""),onClick:function(){return u["c"].push("/account/".concat(n.Binding))}},s.a.createElement("span",null,s.a.createElement("i",{className:"iconfont icon-lianjie font16 mr5 ".concat(y.a.colorGary)}),"\u7ed1\u5b9a\u767b\u5f55\u8d26\u53f7")))),s.a.createElement(w,{visible:"Account-UpdateAvatar"===(null===(g=E.actionTabs)||void 0===g?void 0:g.key),onClose:function(){h({type:"account/setActionTabs"})}}))},A=Object(u["a"])((function(a){var e=a.user,t=a.account,n=a.loading,c=a.globalSetting;return{user:e,account:t,globalSetting:c,loading:n.models.index}}))(S),O=t("n6JY"),j=t.n(O),G=function(a){var e,t=a.user,n=(a.account,a.globalSetting,a.loading,a.dispatch),c=Object(r["a"])(a,["user","account","globalSetting","loading","dispatch"]);return Object(l["useEffect"])((function(){var a;(null===(a=t.userInfo)||void 0===a?void 0:a.login)&&Object(i["a"])(o.a.mark((function a(){var e,c;return o.a.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,n({type:"account/getBasicInfo",payload:{login:null===(e=t.userInfo)||void 0===e?void 0:e.login}});case 2:c=a.sent,(null===c||void 0===c?void 0:c.base_info_completed)||u["c"].push("/account/profile/edit");case 4:case"end":return a.stop()}}),a)})))()}),[null===(e=t.userInfo)||void 0===e?void 0:e.login]),s.a.createElement("section",{className:j.a.bg},s.a.createElement("div",{className:j.a.wrap},s.a.createElement(A,null),c.children))};e["default"]=Object(u["a"])((function(a){var e=a.user,t=a.account,n=a.loading,c=a.globalSetting;return{user:e,account:t,globalSetting:c,loading:n.models.index}}))(G)},n6JY:function(a,e,t){a.exports={bg:"bg___wq3H6",wrap:"wrap___13xuI"}}}]);