import{_ as z,b as B,I as R,r as f,d as i,o as _,g as w,k as e,f as r,i as u,t as V,l as o,m as v,e as I,j as K,h as N,n as T,X as M,p as S,q as $,Z}from"./index-BCGxeHXw.js";const j={class:"register"},D={class:"title"},F={class:"register-code"},H=["src"],L={key:0},X={key:1},A={style:{float:"right"}},G={class:"el-register-footer"},J={__name:"register",setup(O){const x="Zoumh 后台管理",b=M.footerContent,k=B(),{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;Z.alert("<font color='red'>恭喜你，您的账号 "+a+" 注册成功！</font>","系统提示",{dangerouslyUseHTMLString:!0,type:"success"}).then(()=>{k.push("/login")}).catch(()=>{})}).catch(()=>{c.value=!1,p&&h()}))})}function h(){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 h(),(l,t)=>{const a=i("svg-icon"),g=i("el-input"),d=i("el-form-item"),P=i("el-button"),E=i("router-link"),U=i("el-form");return _(),w("div",j,[e(U,{ref:"registerRef",model:o(s),rules:q,class:"register-form"},{default:r(()=>[u("h3",D,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)?(_(),I(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",F,[u("img",{src:o(y),onClick:h,class:"register-code-img"},null,8,H)])]),_:1})):K("",!0),e(d,{style:{width:"100%"}},{default:r(()=>[e(P,{loading:o(c),size:"large",type:"primary",style:{width:"100%"},onClick:N(m,["prevent"])},{default:r(()=>[o(c)?(_(),w("span",X,"注 册 中...")):(_(),w("span",L,"注 册"))]),_:1},8,["loading"]),u("div",A,[e(E,{class:"link-type",to:"/login"},{default:r(()=>[...t[4]||(t[4]=[T("使用已有账户登录",-1)])]),_:1})])]),_:1})]),_:1},8,["model"]),u("div",G,[u("span",null,V(o(b)),1)])])}}},Y=z(J,[["__scopeId","data-v-fe894776"]]);export{Y as default};
