{"size": 9165, "ext": "js", "max_stars_repo_path": "piece-web/dist/m/_next/static/13wC8z4AypVnByZJe3lso/pages/m/personal/setting/phone.js", "max_stars_repo_name": "BitFay/piece", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "piece-web/dist/m/_next/static/13wC8z4AypVnByZJe3lso/pages/m/personal/setting/phone.js", "max_issues_repo_name": "BitFay/piece", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "piece-web/dist/m/_next/static/13wC8z4AypVnByZJe3lso/pages/m/personal/setting/phone.js", "max_forks_repo_name": "BitFay/piece", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 9165.0, "max_line_length": 9165, "alphanum_fraction": 0.6764866339}
(window.webpackJsonp=window.webpackJsonp||[]).push([[49],{B80x:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/m/personal/setting/phone",function(){return n("aCVm")}])},YTlh:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return i}));var r=n("0NzB"),o=n("XwMy"),a=function(e){var t=e.phoneType,n=e.bind,a=e.mobileNo,i=e.email,c=e.country,u=e.setLoading,l=e.setError;return new Promise((function(e){var s={businessType:t?n?"ChangeMobileNo":"BindMobileNo":n?"UpdateEmail":"BindEmail",mfaType:t?"Sms":"Email",email:i,mobileNo:a,country:c};Object(r.postJson)({path:o.b+"/mfaSendCode",data:s}).then((function(t){u(!1),0===t.status?(e(!0),l("")):(e(!1),l(t.message))}))}))},i=function(e){var t=e.phoneType,n=e.bind,a=e.mobileNo,i=e.email,c=e.country,u=e.code,l=e.requestId,s=e.setLoading,d=e.setError;return new Promise((function(e){var p={code:u,email:i,mobileNo:a,mobilCountry:c,requestId:l};Object(r.postJson)({path:o.b+(t?n?"/changeMobileNo":"/bindMobileNo":n?"/changeEmail":"/bindEmail"),data:p}).then((function(t){s(!1),0===t.status?e(!0):(e(!1),d(t.message))}))}))}},aCVm:function(e,t,n){"use strict";n.r(t);var r=n("q1tI"),o=n.n(r),a=n("jmmT"),i=n("o0o1"),c=n.n(i),u=n("HaE+"),l=n("rePB"),s=n("ODXe"),d=n("R/WZ"),p=n("LXXt"),f=n("HV/x"),b=n("iRFQ"),h=n("Z3vd"),m=n("iuhU"),g=n("iae6"),y=n("nOHt"),v=n("YTlh"),O=n("UA+C"),x=n("ofer"),j=n("ZiQX"),w=o.a.createElement;function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){Object(l.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var k=Object(d.a)((function(e){return{root:{width:"100%",minHeight:"calc(100vh - 40px)",display:"flex",flexDirection:"column"},content:{flex:1,padding:e.spacing(0,2)},title:{fontWeight:500,fontSize:"1.5rem",color:p.a[900],padding:e.spacing(5,0,4,.5)},pwTop:{margin:e.spacing(3.5,0,0,0)},grey:{color:p.a[400]},loginTop:{margin:e.spacing(6,0,0,0)},login:{height:e.spacing(6),borderRadius:e.spacing(3.5),fontWeight:500,fontSize:"0.875rem"},toast:{position:"absolute",bottom:0,left:0,width:"100%"}}})),E=function(){var e,t=k({}),n=Object(y.useRouter)(),r=n.query,a=r.requestId,i=r.bind,l=void 0===i?"false":i,d=!1;l&&(d=JSON.parse(l));var p=o.a.useState(!1),T=Object(s.a)(p,2),E=T[0],N=T[1],P=o.a.useState(""),C=Object(s.a)(P,2),S=C[0],I=C[1],D=o.a.useState({phone:"",country:"CN",code:"",errPhoneText:"",errCodeText:"",check:!1}),B=Object(s.a)(D,2),R=B[0],M=B[1],X=function(){var e=Object(u.a)(c.a.mark((function e(){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I(""),N(!1),R.phone){e.next=5;break}return M(F(F({},R),{},{errPhoneText:"\u8bf7\u8f93\u5165\u624b\u673a\u53f7"})),e.abrupt("return");case 5:if(R.code){e.next=8;break}return M(F(F({},R),{},{errCodeText:"\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801"})),e.abrupt("return");case 8:return e.next=10,Object(v.b)({phoneType:!0,bind:d,mobileNo:R.phone,email:"",country:R.country,code:R.code,requestId:a,setLoading:N,setError:I});case 10:e.sent&&(M(F(F({},R),{},{check:!0})),setTimeout((function(){n.back()}),2e3));case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),z=function(){var e=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(R.phone){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Object(v.a)({phoneType:!0,bind:d,mobileNo:R.phone,email:"",country:R.country,setLoading:N,setError:I});case 4:e.sent&&t();case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return w("div",{className:t.root},w("div",{className:t.content},R.check?w(j.a,{elevation:6,variant:"filled",severity:"success",className:t.toast},"\u624b\u673a\u4fee\u6539/\u7ed1\u5b9a\u6210\u529f"):null,w("div",{className:t.title},"\u4fee\u6539/\u7ed1\u5b9a\u624b\u673a\u53f7"),w("div",null,w(f.a,{onSelect:function(e){M(F(F({},R),{},{country:e})),I("")},defaultCountry:R.country,onPhone:function(e,t){return t?"CN"===R.country&&11!==e.length?(M(F(F({},R),{},{phone:""})),void I("")):"HK"===R.country&&e.length>8?(M(F(F({},R),{},{phone:""})),void I("")):(M(F(F({},R),{},{phone:e,errPhoneText:""})),void I("")):(M(F(F({},R),{},{phone:""})),void I(""))},defaultPhone:"",label:"\u8bf7\u8f93\u5165\u624b\u673a\u53f7",emptyErrorText:"\u8bf7\u9009\u62e9\u8054\u7cfb\u65b9\u5f0f",longErrorText:"\u8f93\u5165\u7684\u4fe1\u606f\u8fc7\u957f\uff0c\u8bf7\u68c0\u67e5\u540e\u91cd\u65b0\u8f93\u5165",enterErrorText:"\u624b\u673a\u53f7\u7801\u8f93\u5165\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165",language:/^[a-zA-Z]+$/.test("\u8bf7\u8f93\u5165\u624b\u673a\u53f7")?"en":"zh",showErrorText:R.errPhoneText})),w("div",{className:t.pwTop},w(b.a,{start:!1,onClick:z,helpText:R.errCodeText,onChange:function(e){return M(F(F({},R),{},{code:e,errCodeText:""}))},codeStyle:(null===(e=R.phone)||void 0===e?void 0:e.length)?null:t.grey})),S.length>0?w("div",{className:t.pwTop},w(O.a,{des:S,callback:function(){return I("")}})):null,w("div",{className:t.loginTop},w(h.a,{disabled:E,className:Object(m.a)(t.login),fullWidth:!0,onClick:X,color:"primary",variant:"contained"},w(x.a,{style:{position:"absolute"}},"\u786e\u8ba4"),E&&w("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",position:"absolute"}},w(g.a,{size:28}))))))},N=o.a.createElement;t.default=function(){return N(a.a,{header:!0,back:!0},N(E,null))}},iRFQ:function(e,t,n){"use strict";var r=n("rePB"),o=n("ODXe"),a=n("Ff2n"),i=n("q1tI"),c=n.n(i),u=n("iuhU"),l=n("R/WZ"),s=n("ZBNC"),d=n("ADg1"),p=n("+tNc"),f=n("7SZd"),b=n("Z3vd"),h=n("dl/7"),m=n("LXXt"),g=c.a.createElement;function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){Object(r.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var O=Object(l.a)((function(e){return Object(s.a)({root:{width:"100%",display:"flex",flexDirection:"row"},textField:{"& .MuiOutlinedInput-adornedEnd":{paddingRight:0},"& .MuiButton-text":{padding:"15px 6px",width:"100%"},"& .MuiFilledInput-underline:before":{content:"none"},"& .MuiFilledInput-underline:after":{content:"none"},"& .MuiFilledInput-root":{backgroundColor:"#FFFFFF",border:"1px solid #E0E0E0",borderRadius:4}},adornment:{height:40,padding:"6px 9px",borderRadius:"28px",fontSize:"0.875rem",position:"relative",display:"flex",justifyContent:"center","&:hover":{backgroundColor:"#263BE0"}},err:{fontSize:"0.75rem",color:h.a[400]},btn:{borderTopLeftRadius:0,borderBottomLeftRadius:0},main:{color:"#0060FF","&:hover":{color:"#FFFFFF"},cursor:"pointer"},grey:{color:m.a[400],"&:hover":{color:m.a[400]}},adron:{"&:hover":{backgroundColor:"#FFFFFF"}}})}));t.a=function(e){var t=e.label,n=void 0===t?"\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801":t,r=e.actionText,l=void 0===r?"\u83b7\u53d6\u9a8c\u8bc1\u7801":r,s=e.onClick,h=e.onChange,m=void 0===h?function(){return{}}:h,y=e.start,x=void 0!==y&&y,j=e.startFuc,w=e.helpText,T=void 0===w?"":w,F=Object(a.a)(e,["label","actionText","onClick","onChange","start","startFuc","helpText"]),k=O(),E=Object(i.useRef)(null),N=c.a.useState("60s"),P=Object(o.a)(N,2),C=P[0],S=P[1],I=c.a.useState({click:!1,next:!1,err:""}),D=Object(o.a)(I,2),B=D[0],R=D[1];c.a.useEffect((function(){x&&j&&j().then((function(e){e&&R(v(v({},B),{},{click:!0,err:""}))}))}),[x]),c.a.useEffect((function(){if(B.click){var e=60,t=setInterval((function(){e<=1?(S("1s"),clearInterval(t),R(v(v({},B),{},{click:!1,next:!0,err:""})),S("60s")):(e--,S(e+"s"))}),1e3);return E.current=t,function(){return clearInterval(E.current)}}}),[B.click]),c.a.useEffect((function(){R(v(v({},B),{},{err:T}))}),[T]);var M=function(){B.click||R(v(v({},B),{},{click:!0,err:""}))};return g(d.a,{className:k.root},g(p.a,{error:""!==B.err,label:n,fullWidth:!0,className:k.textField,InputProps:{endAdornment:g(f.a,{disableTypography:!0,position:"end",style:{width:100},className:Object(u.a)(k.adornment,B.click?k.adron:null,F.adornStyle),onClick:function(e){s&&!B.click&&s(M)}},g(b.a,{className:Object(u.a)(k.btn,k.main,B.click?k.grey:null,F.codeStyle)},B.click?C:B.next?"\u91cd\u65b0\u53d1\u9001":l))},onChange:function(e){/[\u4E00-\u9FA5\uF900-\uFA2D]/.test(e.target.value)||(R(v(v({},B),{},{err:""})),m(e.target.value))},onBlur:F.onBlur,onFocus:F.onFocus,helperText:B.err,variant:"filled"}))}}},[["B80x",0,2,1,3,4,5,6,7,16,15]]]);