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