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