import{_ as B,u as E,B as R,a as f,k as i,b as _,c as h,l as e,m as r,d as u,t as V,f as o,p as v,v as K,g as N,x as T,q as I,U as M,y as S,z as $,A}from"./index-B51TLSWN.js";const D={class:"register"},F={class:"title"},H={class:"register-code"},L=["src"],Z={key:0},j={key:1},G={style:{float:"right"}},J={class:"el-register-footer"},O={__name:"register",setup(Q){const x="Zoumh 后台管理",b=M.footerContent,k=E(),{proxy:C}=R(),s=f({username:"",password:"",confirmPassword:"",code:"",uuid:""}),q={username:[{required:!0,trigger:"blur",message:"请输入您的账号"},{min:2,max:20,message:"用户账号长度必须介于 2 和 20 之间",trigger:"blur"}],password:[{required:!0,trigger:"blur",message:"请输入您的密码"},{min:5,max:20,message:"用户密码长度必须介于 5 和 20 之间",trigger:"blur"},{pattern:/^[^<>"'|\\]+$/,message:`不能包含非法字符：< > " ' \\ |`,trigger:"blur"}],confirmPassword:[{required:!0,trigger:"blur",message:"请再次输入您的密码"},{required:!0,validator:(l,t,a)=>{s.value.password!==t?a(new Error("两次输入的密码不一致")):a()},trigger:"blur"}],code:[{required:!0,trigger:"change",message:"请输入验证码"}]},y=f(""),c=f(!1),p=f(!0);function m(){C.$refs.registerRef.validate(l=>{l&&(c.value=!0,$(s.value).then(t=>{const a=s.value.username;A.alert("<font color='red'>恭喜你，您的账号 "+a+" 注册成功！</font>","系统提示",{dangerouslyUseHTMLString:!0,type:"success"}).then(()=>{k.push("/login")}).catch(()=>{})}).catch(()=>{c.value=!1,p&&w()}))})}function w(){S().then(l=>{p.value=l.captchaEnabled===void 0?!0:l.captchaEnabled,p.value&&(y.value="data:image/gif;base64,"+l.img,s.value.uuid=l.uuid)})}return w(),(l,t)=>{const a=i("svg-icon"),g=i("el-input"),d=i("el-form-item"),P=i("el-button"),U=i("router-link"),z=i("el-form");return _(),h("div",D,[e(z,{ref:"registerRef",model:o(s),rules:q,class:"register-form"},{default:r(()=>[u("h3",F,V(o(x)),1),e(d,{prop:"username"},{default:r(()=>[e(g,{modelValue:o(s).username,"onUpdate:modelValue":t[0]||(t[0]=n=>o(s).username=n),type:"text",size:"large","auto-complete":"off",placeholder:"账号"},{prefix:r(()=>[e(a,{"icon-class":"user",class:"el-input__icon input-icon"})]),_:1},8,["modelValue"])]),_:1}),e(d,{prop:"password"},{default:r(()=>[e(g,{modelValue:o(s).password,"onUpdate:modelValue":t[1]||(t[1]=n=>o(s).password=n),type:"password",size:"large","auto-complete":"off",placeholder:"密码",onKeyup:v(m,["enter"])},{prefix:r(()=>[e(a,{"icon-class":"password",class:"el-input__icon input-icon"})]),_:1},8,["modelValue"])]),_:1}),e(d,{prop:"confirmPassword"},{default:r(()=>[e(g,{modelValue:o(s).confirmPassword,"onUpdate:modelValue":t[2]||(t[2]=n=>o(s).confirmPassword=n),type:"password",size:"large","auto-complete":"off",placeholder:"确认密码",onKeyup:v(m,["enter"])},{prefix:r(()=>[e(a,{"icon-class":"password",class:"el-input__icon input-icon"})]),_:1},8,["modelValue"])]),_:1}),o(p)?(_(),K(d,{key:0,prop:"code"},{default:r(()=>[e(g,{size:"large",modelValue:o(s).code,"onUpdate:modelValue":t[3]||(t[3]=n=>o(s).code=n),"auto-complete":"off",placeholder:"验证码",style:{width:"63%"},onKeyup:v(m,["enter"])},{prefix:r(()=>[e(a,{"icon-class":"validCode",class:"el-input__icon input-icon"})]),_:1},8,["modelValue"]),u("div",H,[u("img",{src:o(y),onClick:w,class:"register-code-img"},null,8,L)])]),_:1})):N("",!0),e(d,{style:{width:"100%"}},{default:r(()=>[e(P,{loading:o(c),size:"large",type:"primary",style:{width:"100%"},onClick:T(m,["prevent"])},{default:r(()=>[o(c)?(_(),h("span",j,"注 册 中...")):(_(),h("span",Z,"注 册"))]),_:1},8,["loading"]),u("div",G,[e(U,{class:"link-type",to:"/login"},{default:r(()=>[...t[4]||(t[4]=[I("使用已有账户登录",-1)])]),_:1})])]),_:1})]),_:1},8,["model"]),u("div",J,[u("span",null,V(o(b)),1)])])}}},Y=B(O,[["__scopeId","data-v-fe894776"]]);export{Y as default};
