Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

p__user__login.742db7c5.async.js 9.2 KiB

1 ano atrás
1
  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[4053],{5966:function(z,U,e){"use strict";var V=e(28991),A=e(81253),X=e(85893),h=e(31649),p=["fieldProps","proFieldProps"],M=["fieldProps","proFieldProps"],Z="text",B=function(v){var N=v.fieldProps,u=v.proFieldProps,O=(0,A.Z)(v,p);return(0,X.jsx)(h.Z,(0,V.Z)({valueType:Z,fieldProps:N,filedConfig:{valueType:Z},proFieldProps:u},O))},_=function(v){var N=v.fieldProps,u=v.proFieldProps,O=(0,A.Z)(v,M);return(0,X.jsx)(h.Z,(0,V.Z)({valueType:"password",fieldProps:N,proFieldProps:u,filedConfig:{valueType:Z}},O))},E=B;E.Password=_,E.displayName="ProFormComponent",U.Z=E},42081:function(z){z.exports={container:"container___2XU-J",lang:"lang___3UZBu",content:"content___232he",top:"top___2e5qd",header:"header___1G_uO",logo:"logo___2RIUt",title:"title___3xYCK",desc:"desc___1GQtf",main:"main___oMoRI",icon:"icon___1dSHb",other:"other___3ljbI",register:"register___1vN_i",prefixIcon:"prefixIcon___57iuX"}},43674:function(z,U,e){"use strict";e.r(U),e.d(U,{default:function(){return Ze}});var V=e(18106),A=e(95562),X=e(34792),h=e(48086),p=e(39428),M=e(11849),Z=e(3182),B=e(2824),_=e(17462),E=e(76772),Y=e(89366),v=e(2603),N=e(80521),u=e(67294),O=e(57663),te=e(71577),Pe=e(47673),ne=e(4107),y=e(28991),G=e(55507),ee=e(92137),le=e(81253),w=e(28481),Fe=e(9715),ie=e(55843),a=e(85893),ue=e(64893),oe=["rules","name","phoneName","fieldProps","captchaTextRender","captchaProps"],de=u.forwardRef(function(d,F){var x=ie.Z.useFormInstance(),Q=(0,u.useState)(d.countDown||60),D=(0,w.Z)(Q,2),k=D[0],$=D[1],b=(0,u.useState)(!1),q=(0,w.Z)(b,2),S=q[0],j=q[1],C=(0,u.useState)(),H=(0,w.Z)(C,2),K=H[0],m=H[1],re=d.rules,c=d.name,L=d.phoneName,T=d.fieldProps,R=d.captchaTextRender,W=R===void 0?function(r,l){return r?"".concat(l," \u79D2\u540E\u91CD\u65B0\u83B7\u53D6"):"\u83B7\u53D6\u9A8C\u8BC1\u7801"}:R,g=d.captchaProps,i=(0,le.Z)(d,oe),n=function(){var r=(0,ee.Z)((0,G.Z)().mark(function l(t){return(0,G.Z)().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.prev=0,m(!0),f.next=4,i.onGetCaptcha(t);case 4:m(!1),j(!0),f.next=13;break;case 8:f.prev=8,f.t0=f.catch(0),j(!1),m(!1),console.log(f.t0);case 13:case"end":return f.stop()}},l,null,[[0,8]])}));return function(t){return r.apply(this,arguments)}}();return(0,u.useImperativeHandle)(F,function(){return{startTiming:function(){return j(!0)},endTiming:function(){return j(!1)}}}),(0,u.useEffect)(function(){var r=0,l=d.countDown;return S&&(r=window.setInterval(function(){$(function(t){return t<=1?(j(!1),clearInterval(r),l||60):t-1})},1e3)),function(){return clearInterval(r)}},[S]),(0,a.jsxs)("div",{style:(0,y.Z)((0,y.Z)({},T==null?void 0:T.style),{},{display:"flex",alignItems:"center"}),ref:F,children:[(0,a.jsx)(ne.Z,(0,y.Z)((0,y.Z)({},T),{},{style:{flex:1,transition:"width .3s",marginRight:8}})),(0,a.jsx)(te.Z,(0,y.Z)((0,y.Z)({style:{display:"block"},disabled:S,loading:K},g),{},{onClick:function(){var r=(0,ee.Z)((0,G.Z)().mark(function t(){var I;return(0,G.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,!L){s.next=9;break}return s.next=4,x.validateFields([L].flat(1));case 4:return I=x.getFieldValue([L].flat(1)),s.next=7,n(I);case 7:s.next=11;break;case 9:return s.next=11,n("");case 11:s.next=16;break;case 13:s.prev=13,s.t0=s.catch(0),console.log(s.t0);case 16:case"end":return s.stop()}},t,null,[[0,13]])}));function l(){return r.apply(this,arguments)}return l}(),children:W(S,k)}))]})}),ce=(0,ue.G)(de),fe=ce,ge=e(952),J=e(5966),P=e(48971),pe=e(73727),xe=e(92002),ae=e(64172),ve=e(42081),o=e.n(ve),se=function(F){var x=F.content;return(0,a.jsx)(E.Z,{style:{marginBottom:24},message:x,type:"error",showIcon:!0})},me=function(){var F=P.m8.location.query,x=F.redirect;window.location.href="/"},he=function(){var F=(0,u.useState)(!1),x=(0,B.Z)(F,2),Q=x[0],D=x[1],k=(0,u.useState)({}),$=(0,B.Z)(k,2),b=$[0],q=$[1],S=(0,u.useState)("account"),j=(0,B.Z)(S,2),C=j[0],H=j[1],K=(0,P.tT)("@@initialState"),m=K.initialState,re=K.setInitialState,c=(0,P.YB)(),L=function(){var g=(0,Z.Z)((0,p.Z)().mark(function i(){var n,r;return(0,p.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m==null||(n=m.fetchUserInfo)===null||n===void 0?void 0:n.call(m);case 2:r=t.sent,r&&re((0,M.Z)((0,M.Z)({},m),{},{currentUser:r}));case 4:case"end":return t.stop()}},i)}));return function(){return g.apply(this,arguments)}}(),T=function(){var g=(0,Z.Z)((0,p.Z)().mark(function i(n){var r,l,t,I;return(0,p.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return D(!0),s.prev=1,localStorage.clear(),s.next=5,ae.Z.Login((0,M.Z)((0,M.Z)({},n),{},{type:C}));case 5:if(r=s.sent,r.statusCode!==200){s.next=17;break}return localStorage.setItem("userid",r.data.userID),localStorage.setItem("token",r.data.token),l=c.formatMessage({id:"pages.login.success",defaultMessage:"\u767B\u5F55\u6210\u529F\uFF01"}),h.default.success(l),s.next=13,L();case 13:return me(),s.abrupt("return");case 17:r.succeeded?(t=c.formatMessage({id:"pages.login.accountLogin.tab",defaultMessage:"\u8D26\u53F7\u5BC6\u7801\u9519\u8BEF\uFF01"}),h.default.error(t)):h.default.error(r.errors);case 18:s.next=25;break;case 20:s.prev=20,s.t0=s.catch(1),console.log("fdsafds",s.t0),I=c.formatMessage({id:"pages.login.failure",defaultMessage:"\u767B\u5F55\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\uFF01"}),h.default.error(I);case 25:D(!1);case 26:case"end":return s.stop()}},i,null,[[1,20]])}));return function(n){return g.apply(this,arguments)}}(),R=b.status,W=b.type;return(0,a.jsx)("div",{className:o().container,children:(0,a.jsxs)("div",{className:o().content,children:[(0,a.jsx)("div",{className:o().top,children:(0,a.jsx)("div",{className:o().header,children:(0,a.jsxs)("div",{children:[(0,a.jsx)(pe.rU,{to:"/",children:(0,a.jsx)("div",{children:(0,a.jsx)("img",{alt:"logo",className:o().logo,src:"/logo.png"})})}),(0,a.jsx)("div",{className:o().desc,children:"\u667A\u6167\u9910\u996E\u89E3\u51B3\u65B9\u6848\u670D\u52A1\u5546"})]})})}),(0,a.jsxs)("div",{className:o().main,children:[(0,a.jsx)("div",{className:o().title,children:"\u8FDE\u9501\u7ECF\u8425\u5E73\u53F0"}),(0,a.jsxs)(ge.ZP,{initialValues:{autoLogin:!0},submitter:{searchConfig:{submitText:c.formatMessage({id:"pages.login.submit",defaultMessage:"\u767B\u5F55"})},render:function(i,n){return n.pop()},submitButtonProps:{loading:Q,size:"large",style:{width:"100%"}}},isKeyPressSubmit:!0,onFinish:function(){var g=(0,Z.Z)((0,p.Z)().mark(function i(n){return(0,p.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:T(n);case 1:case"end":return l.stop()}},i)}));return function(i){return g.apply(this,arguments)}}(),children:[(0,a.jsx)(A.Z,{activeKey:C,onChange:H}),R==="error"&&W==="account"&&(0,a.jsx)(se,{content:c.formatMessage({id:"pages.login.accountLogin.errorMessage",defaultMessage:"\u8D26\u6237\u6216\u5BC6\u7801\u9519\u8BEF\uFF08admin/ant.design)"})}),C==="account"&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(J.Z,{name:"Account",fieldProps:{size:"large",prefix:(0,a.jsx)(Y.Z,{className:o().prefixIcon})},placeholder:c.formatMessage({id:"pages.login.username.placeholder",defaultMessage:"\u7528\u6237\u540D: admin or user"}),rules:[{required:!0,message:(0,a.jsx)(P._H,{id:"pages.login.username.required",defaultMessage:"\u8BF7\u8F93\u5165\u7528\u6237\u540D!"})}]}),(0,a.jsx)(J.Z.Password,{name:"Password",fieldProps:{size:"large",prefix:(0,a.jsx)(v.Z,{className:o().prefixIcon})},placeholder:c.formatMessage({id:"pages.login.password.placeholder",defaultMessage:"\u5BC6\u7801: ant.design"}),rules:[{required:!0,message:(0,a.jsx)(P._H,{id:"pages.login.password.required",defaultMessage:"\u8BF7\u8F93\u5165\u5BC6\u7801\uFF01"})}]})]}),R==="error"&&W==="mobile"&&(0,a.jsx)(se,{content:"\u9A8C\u8BC1\u7801\u9519\u8BEF"}),C==="mobile"&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(J.Z,{fieldProps:{size:"large",prefix:(0,a.jsx)(N.Z,{className:o().prefixIcon})},name:"mobile",placeholder:c.formatMessage({id:"pages.login.phoneNumber.placeholder",defaultMessage:"\u624B\u673A\u53F7"}),rules:[{required:!0,message:(0,a.jsx)(P._H,{id:"pages.login.phoneNumber.required",defaultMessage:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7\uFF01"})},{pattern:/^1\d{10}$/,message:(0,a.jsx)(P._H,{id:"pages.login.phoneNumber.invalid",defaultMessage:"\u624B\u673A\u53F7\u683C\u5F0F\u9519\u8BEF\uFF01"})}]}),(0,a.jsx)(fe,{fieldProps:{size:"large",prefix:(0,a.jsx)(v.Z,{className:o().prefixIcon})},captchaProps:{size:"large"},placeholder:c.formatMessage({id:"pages.login.captcha.placeholder",defaultMessage:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801"}),captchaTextRender:function(i,n){return i?"".concat(n," ").concat(c.formatMessage({id:"pages.getCaptchaSecondText",defaultMessage:"\u83B7\u53D6\u9A8C\u8BC1\u7801"})):c.formatMessage({id:"pages.login.phoneLogin.getVerificationCode",defaultMessage:"\u83B7\u53D6\u9A8C\u8BC1\u7801"})},name:"captcha",rules:[{required:!0,message:(0,a.jsx)(P._H,{id:"pages.login.captcha.required",defaultMessage:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801\uFF01"})}],onGetCaptcha:function(){var g=(0,Z.Z)((0,p.Z)().mark(function i(n){var r;return(0,p.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ae.Z.getFakeCaptcha({phone:n});case 2:if(r=t.sent,r!==!1){t.next=5;break}return t.abrupt("return");case 5:h.default.success("\u83B7\u53D6\u9A8C\u8BC1\u7801\u6210\u529F\uFF01\u9A8C\u8BC1\u7801\u4E3A\uFF1A1234");case 6:case"end":return t.stop()}},i)}));return function(i){return g.apply(this,arguments)}}()})]})]})]})]})})},Ze=he}}]);