|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[60547],{69351:function(n,e,a){a.r(e),a.d(e,{default:function(){return Y}});var i=a(7557),t=a.n(i),c=a(41498),o=a.n(c),s=a(39647),l=a.n(s),r=a(59301),u=a(7880),d=a(79800),f=a.n(d),g=a(27065),p=a(8591),v=a(43418),_=a(71418),h=a(33555),m="modal___UiRZE",x="avatarWrap___ult2g",j="tip___VD4sc",y="previewWrap___DqV9j",b="previewImg___hrFoK",N="uploadButton___RgVQG",I=(a(11271),a(37712)),S=(0,u.connect)((function(n){var e=n.user,a=n.account,i=n.loading;return{user:e,account:a,globalSetting:n.globalSetting,loading:i.effects}}))((function(n){var e=n.user,a=(n.account,n.globalSetting,n.loading),i=n.dispatch,c=n.visible,s=n.onClose,l=(0,r.useState)(),u=f()(l,2),d=u[0],S=u[1],k=(0,r.useRef)();(0,r.useEffect)((function(){var n;c&&S("".concat(g.Z.IMG_SERVER,"/images/").concat(null===(n=e.userInfo)||void 0===n?void 0:n.image_url))}),[e.userInfo,c]);var w=function(){var n=o()(t()().mark((function n(){var a,c,o;return t()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return(c=k.current.getCroppedCanvas().toDataURL("image/jpeg"))||p.ZP.info("请先上传图片"),n.next=4,i({type:"account/updateAvatar",payload:{image:c,login:null===(a=e.userInfo)||void 0===a?void 0:a.login}});case 4:o=n.sent,A(),0===o.status&&(p.ZP.info("修改头像成功"),i({type:"user/getUserInfo"}));case 7:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}(),A=function(){s()};return(0,I.jsx)(v.Z,{centered:!0,keyboard:!1,closable:!1,open:c,title:"上传头像",width:550,forceRender:!0,confirmLoading:a["account/updateAvatar"],onOk:w,onCancel:A,children:(0,I.jsx)(_.Z,{spinning:!!a["account/updateAvatar"],children:(0,I.jsxs)("div",{className:m,children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:x,children:(0,I.jsx)(h.Z,{style:{height:320,width:320},ref:k,src:d,guides:!1,aspectRatio:1,preview:"#updateAvatarImg"})}),(0,I.jsx)("span",{className:j,children:"仅支持JPG、GIF、PNG,且文件小于10M"})]}),(0,I.jsxs)("div",{className:y,children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:b,id:"updateAvatarImg"}),(0,I.jsx)("div",{className:"".concat(j," tc"),children:"头像预览"})]}),(0,I.jsxs)("label",{className:N,id:"uploadBtn",htmlFor:"inputImage",children:[(0,I.jsx)("input",{type:"file",className:"sr-only",id:"inputImage",name:"file",accept:"image/*",style:{display:"none"},onChange:function(n){var e,a;if(n.dataTransfer?a=n.dataTransfer.files:n.target&&(a=n.target.files),null!==(e=a)&&void 0!==e&&e.length){var i=a[0];if(/^image\/\w+/.test(i.type))if(i.size>10485760)p.ZP.info("仅支持文件大小小于10M的文件");else{var t=new FileReader;t.onload=function(){S(t.result)},t.readAsDataURL(a[0])}else p.ZP.info("请选择一个图片格式的文件")}}}),"点击上传"]})]})]})})})})),k="wrap___jmmMV",w="avatarWrap___rSWxp",A="avatar___fcL4a",C="updateAvatarWrap___PvFWZ",R="img___HYjbH",G="updateAvatar___A4WCJ",Z="name___I27vY",P="role___S1bgR",T="title___lYk_h",E="colorGary___dTxWU",B="colorGreen___IMA6y",U="colorRed___I0jPR",W="item___daAx6",L="active___ZGd1H",M=["user","account","globalSetting","loading","dispatch"],V=function(n){return n.Profile="profile",n.Certification="certification",n.Secure="secure",n.Group="teach-group",n.Binding="binding",n.Results="Results",n}(V||{}),F=(0,u.connect)((function(n){var e=n.user,a=n.account,i=n.loading;return{user:e,account:a,globalSetting:n.globalSetting,loading:i.models.index}}))((function(n){var e,a,i,t,c,o,s,d,p,v,_,h=n.user,m=n.account,x=n.globalSetting,j=(n.loading,n.dispatch),y=(l()(n,M),(0,r.useState)()),b=f()(y,2),N=b[0],F=b[1],D=(0,u.useLocation)();(0,r.useEffect)((function(){var n,e=null===(n=D.pathname.split("/"))||void 0===n?void 0:n[2];F(e)}),[D.pathname]);var H="".concat(g.Z.IMG_SERVER,"/images/").concat(null===(e=h.userInfo)||void 0===e?void 0:e.image_url);return(0,I.jsxs)("section",{className:k,children:[(0,I.jsxs)("div",{className:w,children:[(0,I.jsx)("div",{className:A,children:(0,I.jsxs)("div",{className:C,onClick:function(){j({type:"account/setActionTabs",payload:{key:"Account-UpdateAvatar"}})},children:[(0,I.jsx)("img",{className:R,src:H}),(0,I.jsx)("div",{className:G,children:"修改头像"})]})}),(0,I.jsx)("span",{className:Z,title:null===(a=h.userInfo)||void 0===a?void 0:a.username,children:(null===(i=h.userInfo)||void 0===i||null===(i=i.username)||void 0===i?void 0:i.length)>6?(null===(t=h.userInfo)||void 0===t||null===(t=t.username)||void 0===t?void 0:t.substr(0,6))+"...":null===(c=h.userInfo)||void 0===c?void 0:c.username}),(0,I.jsx)("span",{className:P,children:null===(o=h.userInfo)||void 0===o?void 0:o.user_identity})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:T,children:"账号管理"}),(0,I.jsxs)("ul",{className:"pl0",children:[(0,I.jsxs)("li",{className:"".concat(W," ").concat(N===V.Profile?L:""),onClick:function(){return u.history.push("/account/".concat(V.Profile))},children:[(0,I.jsxs)("span",{children:[(0,I.jsx)("i",{className:"iconfont icon-jibenxinxi font16 mr5 ".concat(E)}),"基本信息"]}),(0,I.jsx)("i",{className:"iconfont font16 mr25 ".concat(null!==(s=m.basicInfo)&&void 0!==s&&s.base_info_completed?"".concat(B," icon-wancheng"):"".concat(U," icon-tishi"))})]}),(0,I.jsxs)("li",{className:"".concat(W," ").concat(N===V.Certification?L:""),onClick:function(){return u.history.push("/account/".concat(V.Certification))},children:[(0,I.jsxs)("span",{children:[(0,I.jsx)("i",{className:"iconfont icon-renzhengxinxi font16 mr5 ".concat(E)}),"认证信息"]}),(0,I.jsx)("i",{className:"iconfont font16 mr25 ".concat("certified"===(null===(d=m.basicInfo)||void 0===d?void 0:d.professional_certification)&&"certified"===(null===(p=m.basicInfo)||void 0===p?void 0:p.authentication)?"".concat(B," icon-wancheng"):"".concat(U," icon-tishi"))})]}),(0,I.jsx)("li",{className:"".concat(W," ").concat(N===V.Secure?L:""),onClick:function(){return u.history.push("/account/".concat(V.Secure))},children:(0,I.jsxs)("span",{children:[(0,I.jsx)("i",{className:"iconfont icon-anquanshezhi font16 mr5 ".concat(E)}),"安全设置"]})}),!(null!=x&&null!==(v=x.setting)&&void 0!==v&&v.is_local)&&(0,I.jsx)("li",{className:"".concat(W," ").concat(N===V.Binding?L:""),onClick:function(){return u.history.push("/account/".concat(V.Binding))},children:(0,I.jsxs)("span",{children:[(0,I.jsx)("i",{className:"iconfont icon-lianjie font16 mr5 ".concat(E)}),"绑定登录账号"]})})]})]}),(0,I.jsx)(S,{visible:"Account-UpdateAvatar"===(null===(_=m.actionTabs)||void 0===_?void 0:_.key),onClose:function(){j({type:"account/setActionTabs"})}})]})})),D="bg___lB_B_",H="wrap___GGUEr",z=["user","account","globalSetting","loading","dispatch"],Y=(0,u.connect)((function(n){var e=n.user,a=n.account,i=n.loading;return{user:e,account:a,globalSetting:n.globalSetting,loading:i.models.index}}))((function(n){var e,a=n.user,i=(n.account,n.globalSetting,n.loading,n.dispatch);l()(n,z),(0,u.useLocation)();return(0,r.useEffect)((function(){return i({type:"globalSetting/delayTipToggle",payload:!0}),function(){i({type:"globalSetting/delayTipToggle",payload:!1})}}),[]),(0,r.useEffect)((function(){var n;null!==(n=a.userInfo)&&void 0!==n&&n.login&&o()(t()().mark((function n(){var e,c;return t()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i({type:"account/getBasicInfo",payload:{login:null===(e=a.userInfo)||void 0===e?void 0:e.login}});case 2:null!=(c=n.sent)&&c.base_info_completed||("0"===localStorage.getItem("Noviceguide")||i({type:"shixunHomeworks/setActionTabs",payload:{key:"底部弹窗",type:3,text:(0,I.jsx)("div",{children:"请您完善一下平台的基本信息,包括:昵称、职业、学校/单位, 点击保存"})}}),u.history.push("/account/profile/edit"));case 4:case"end":return n.stop()}}),n)})))()}),[null===(e=a.userInfo)||void 0===e?void 0:e.login]),(0,I.jsx)("section",{className:D,children:(0,I.jsxs)("div",{className:H,children:[(0,I.jsx)(F,{}),(0,I.jsx)(u.Outlet,{})]})})}))}}]); |