|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[27182],{23087:function(e,t,n){n.d(t,{Z:function(){return x}});var r=n(7557),s=n.n(r),a=n(41498),i=n.n(a),o=n(79800),u=n.n(o),c=n(82242),l=n.n(c),d=n(59301),f=n(99267),m=n(40001),p=n(49198),y=n(83287),v=n(37712),h={moveX:0,verify:0},g=function(e){return e[e.SET_MOVEX=0]="SET_MOVEX",e[e.VERIFY=1]="VERIFY",e}(g||{});function w(e,t){switch(t.type){case g.SET_MOVEX:return l()(l()({},e),{},{moveX:t.payload});case g.VERIFY:return l()(l()({},e),t.payload);default:throw new Error}}var x=function(e){var t=e.value,n=e.onChange,r=e.onValidate,a=(0,d.useReducer)(w,h),o=u()(a,2),c=o[0],l=o[1],x=c.moveX,j=c.verify,E=(0,d.useRef)(),V=(0,d.useRef)(),M=(0,d.useRef)(),Z=(0,d.useRef)(),_=(0,d.useMemo)((function(){if(V.current)return V.current.getBoundingClientRect()}),[V.current]);function b(){j||(Z.current=!0,E.current.style.transition="",M.current.style.transition="")}return(0,d.useEffect)((function(){if(_){var e=function(){var e=i()(s()().mark((function e(t){var i;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Z.current){e.next=15;break}if(i=t.pageX-u,d&&(i=t.changedTouches[0].pageX-u),i<0&&(i=0),!(i>=c)){e.next=14;break}return Z.current=!1,i=c,e.next=9,r();case 9:a=e.sent,l({type:g.VERIFY,payload:{moveX:i,verify:a}}),n(a),e.next=15;break;case 14:l({type:g.SET_MOVEX,payload:i});case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t=function(){Z.current=!1,0===a&&(E.current.style.transition="left .5s ease",M.current.style.transition="width .5s ease",l({type:g.VERIFY,payload:{moveX:0}}))},a=0,o=_.width,u=_.left,c=o-48,d=!(0,y.b9)();return d?(window.addEventListener("touchmove",e),window.addEventListener("touchend",t)):(window.addEventListener("mousemove",e),window.addEventListener("mouseup",t)),function(){d?(window.removeEventListener("touchmove",e),window.removeEventListener("touchend",t)):(window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t))}}}),[_,y.b9]),(0,d.useEffect)((function(){l({type:g.VERIFY,payload:{verify:t,moveX:t?(null==_?void 0:_.width)-48:0}})}),[t]),(0,v.jsxs)("div",{ref:V,className:"unlock-wrapper",children:[(0,v.jsx)("div",{ref:M,className:1===j?"unlock-error-bg":"unlock-bg",style:{width:x}}),(0,v.jsx)("div",{className:"unlock-text",children:j?1===j?"验证失败":"验证通过":"拖动滑块至右侧验证"}),(0,v.jsx)("div",{ref:E,onTouchStart:b,onMouseDown:b,style:{left:x},className:"unlock-handler",children:j?1===j?(0,v.jsx)(f.Z,{}):(0,v.jsx)(m.Z,{}):(0,v.jsx)(p.Z,{})})]})}},81677:function(e,t,n){n.d(t,{Ol:function(){return s},c0:function(){return o},o1:function(){return a},z2:function(){return i}});var r=n(94171);function s(e){return(0,r.U2)("accounts/valid_email_and_phone.json",e)}function a(e){return(0,r.U2)("accounts/get_verification_code.json",e)}function i(e){return(0,r.v_)("accounts/register.json",e)}function o(e){return(0,r.v_)("accounts/reset_password.json",e)}},88047:function(e,t,n){n.r(t),n.d(t,{default:function(){return _}});var r=n(82242),s=n.n(r),a=n(7557),i=n.n(a),o=n(41498),u=n.n(o),c=n(59301),l=n(79800),d=n.n(l),f=n(78241),m=n(10249),p=n(3113),y=n(23087),v=n(83287),h=n(49389),g=n(37712),w={height:40},x=/(\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b)|([1][3,4,5,6,7,8,9][0-9]{9})/i,j={timer:0,verifyCodeMessage:"",verifyNameMessage:""},E=function(e){return e[e.setTimer=0]="setTimer",e[e.setVerifyCodeMessage=1]="setVerifyCodeMessage",e[e.setVerifyNameMessage=2]="setVerifyNameMessage",e}(E||{});function V(e,t){switch(t.type){case E.setTimer:return s()(s()({},e),{},{timer:t.payload});case E.setVerifyCodeMessage:return s()(s()({},e),{},{verifyCodeMessage:t.payload});case E.setVerifyNameMessage:return s()(s()({},e),{},{verifyNameMessage:t.payload});default:throw new Error}}var M=function(e){var t=e.validateName,n=e.getCode,r=e.callback,s=e.style,a=void 0===s?{}:s,o=(0,h.useLocation)(),l=f.Z.useForm(),M=d()(l,1)[0],Z=(0,c.useReducer)(V,j),_=d()(Z,2),b=_[0],k=_[1],C=b.verifyCodeMessage,I=b.verifyNameMessage,N=b.timer,T=(0,c.useState)("/rucaptcha"),F=d()(T,2);F[0],F[1];function R(){return(R=u()(i()().mark((function e(t){var n,s,a,u,c,l,d,f;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.login,s=t.new_password,a=t.code,u=t.new_password_confirmation,e.next=3,r({login:n,new_password_confirmation:u,new_password:s,code:a});case 3:c=e.sent,l=c.message,c.status>0?(f=null===(d=o.query)||void 0===d?void 0:d.from)&&f.indexOf("login")<0?h.history.replace(f):h.history.replace("/"):k({type:E.setVerifyCodeMessage,payload:l});case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(){return(O=u()(i()().mark((function e(){var n,r,s,a,o;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=M.getFieldValue("login"),!x.test(n)){e.next=10;break}return e.next=4,t({login:n,type:2});case 4:return r=e.sent,s=r.status,a=r.message,(o=s>0)||k({type:E.setVerifyNameMessage,payload:a}),e.abrupt("return",o);case 10:return e.abrupt("return",!1);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return(0,c.useEffect)((function(){N>0&&setTimeout((function(){k({type:E.setTimer,payload:N-1})}),1e3)}),[N]),(0,g.jsxs)(f.Z,{layout:"vertical",form:M,style:a,initialValues:{autologin:!0,protool:!0},onFinish:function(e){return R.apply(this,arguments)},children:[(0,g.jsx)(f.Z.Item,{name:"login",extra:I?(0,g.jsx)("span",{className:"error",children:I}):null,rules:[{required:!0,message:"请输入有效的手机号/邮箱"},{pattern:x,message:"手机号或者邮箱格式有误"}],children:(0,g.jsx)(m.Z,{style:w,size:"large",placeholder:"请输入有效的手机号/邮箱号",onChange:function(){M.setFieldsValue({verify:!1}),k({type:E.setVerifyNameMessage,payload:""})}})}),(0,g.jsx)(f.Z.Item,{name:"verify",rules:[{validator:function(e,t){return t?Promise.resolve():Promise.reject("请拖动滑块验证")}}],children:(0,g.jsx)(y.Z,{onValidate:function(){return O.apply(this,arguments)}})}),(0,g.jsx)(f.Z.Item,{extra:C?(0,g.jsx)("span",{className:"error",children:C}):null,children:(0,g.jsxs)("div",{className:"flex-container",children:[(0,g.jsx)(f.Z.Item,{name:"code",noStyle:!0,rules:[{required:!0,message:"请输入验证码"}],children:(0,g.jsx)(m.Z,{style:{width:"calc(100% - 100px)",height:40,marginRight:6},placeholder:"请输入验证码",size:"large"})}),(0,g.jsxs)(p.ZP,{size:"large",type:"primary",style:w,onClick:function(){var e=M.getFieldValue("verify"),t=M.getFieldValue("login");if(e){k({type:E.setVerifyCodeMessage,payload:""});var r=n({login:t,type:2,smscode:(0,v.M)(t)}),s=r.status,a=r.message;s<0&&k({type:E.setVerifyCodeMessage,payload:a}),k({type:E.setTimer,payload:60})}else M.validateFields(["verify"])},disabled:N>0,children:[" ",0===N?"获取验证码":"重新发送".concat(N,"s")]})]})}),(0,g.jsx)(f.Z.Item,{name:"new_password",rules:[{required:!0,message:"请输入密码"},{validator:function(e,t,n){t?t.indexOf(" ")>-1?n("新密码不能包含空格,请重新输入"):t.length<8||t.length>16?n("新密码长度应在8-16位之间"):/(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*()_+={}\[\]|:;"<>,.?/\\-]).{8,16}$/.test(t)?n():n("新密码必须包含字母(大小写)、数字和特殊字符"):n("请输入8-16位字符的新密码,区分大小写!")}}],children:(0,g.jsx)(m.Z.Password,{style:w,size:"large",placeholder:"输入8~16位密码,区分大小写",visibilityToggle:!1})}),(0,g.jsx)(f.Z.Item,{name:"new_password_confirmation",rules:[{required:!0,message:"请再次输入新密码"},function(e){var t=e.getFieldValue;return{validator:function(e,n){return n&&t("new_password")!==n?Promise.reject("两次密码不一致"):Promise.resolve()}}}],children:(0,g.jsx)(m.Z.Password,{style:w,size:"large",placeholder:"再次输入新密码",visibilityToggle:!1})}),(0,g.jsx)(f.Z.Item,{children:(0,g.jsxs)(p.ZP,{size:"large",type:"primary",htmlType:"submit",block:!0,style:w,children:[" ","完成"," "]})}),(0,g.jsx)(f.Z.Item,{children:(0,g.jsx)(h.Link,{to:"/user/login",children:"返回登录"})})]})},Z=n(81677),_=function(){var e,t={getCode:Z.o1,callback:(e=u()(i()().mark((function e(t){var n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,Z.c0)(t);case 2:return n=e.sent,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)}),validateName:Z.Ol};return(0,g.jsx)(M,s()({},t))}},8378:function(e,t){t.Z=e=>({[e.componentCls]:{[`${e.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${e.motionDurationMid} ${e.motionEaseInOut},\n opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}},[`${e.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${e.motionDurationMid} ${e.motionEaseInOut},\n opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}}})}}]); |