import{_ as a,s as e,c as s,d as r,e as l,f as o,h as t,i as d,w as m,j as u,o as i,k as n,l as c,q as p,x as f}from"./index-VNZyFo9C.js";import{_ as h,a as w,b as g}from"./uni-forms.BIGT0xz3.js";import"./uni-icons.CmIcu7af.js";const F=a({data:()=>({dataForm:{userName:"",nickName:"",password:"",corfirmPassword:""},rules:{userName:{rules:[{required:!0,errorMessage:"请输入用户名"}]},nickName:{rules:[{required:!0,errorMessage:"请输入昵称"}]},password:{rules:[{required:!0,errorMessage:"请输入密码"}]},corfirmPassword:{rules:[{required:!0,errorMessage:"请输入确认密码"},{validateFunction:(a,e,s,r)=>(console.log("validateFunction"),s.password!=e&&r("两次密码输入不一致"),!0)}]}}}),methods:{submit(){this.$http({url:"/register",data:this.dataForm,method:"POST"}).then((()=>{e({title:"注册成功,您已成为盒子IM的用户",icon:"none"}),this.login()}))},login(){const a={terminal:this.$enums.TERMINAL_TYPE.APP,userName:this.dataForm.userName,password:this.dataForm.password};this.$http({url:"/login",data:a,method:"POST"}).then((e=>{console.log("登录成功,自动跳转到聊天页面..."),s("userName",a.userName),s("password",a.password),s("loginInfo",e),r().init(),l({url:"/pages/chat/chat"})}))}}},[["render",function(a,e,s,r,l,F){const N=u,V=o(t("uni-easyinput"),h),_=o(t("uni-forms-item"),w),b=p,P=o(t("uni-forms"),g),k=f;return i(),d(N,{class:"register"},{default:m((()=>[n(N,{class:"title"},{default:m((()=>[c("欢迎注册")])),_:1}),n(P,{class:"form",modelValue:l.dataForm,rules:l.rules,"validate-trigger":"bind","label-width":"80px"},{default:m((()=>[n(_,{name:"userName",label:"用户名"},{default:m((()=>[n(V,{type:"text",modelValue:l.dataForm.userName,"onUpdate:modelValue":e[0]||(e[0]=a=>l.dataForm.userName=a),placeholder:"用户名"},null,8,["modelValue"])])),_:1}),n(_,{name:"nickName",label:"昵称"},{default:m((()=>[n(V,{type:"text",modelValue:l.dataForm.nickName,"onUpdate:modelValue":e[1]||(e[1]=a=>l.dataForm.nickName=a),placeholder:"昵称"},null,8,["modelValue"])])),_:1}),n(_,{name:"password",label:"密码"},{default:m((()=>[n(V,{type:"password",modelValue:l.dataForm.password,"onUpdate:modelValue":e[2]||(e[2]=a=>l.dataForm.password=a),placeholder:"密码"},null,8,["modelValue"])])),_:1}),n(_,{name:"corfirmPassword",label:"确认密码"},{default:m((()=>[n(V,{type:"password",modelValue:l.dataForm.corfirmPassword,"onUpdate:modelValue":e[3]||(e[3]=a=>l.dataForm.corfirmPassword=a),placeholder:"确认密码"},null,8,["modelValue"])])),_:1}),n(b,{class:"btn-submit",onClick:F.submit,type:"warn"},{default:m((()=>[c("注册并登陆")])),_:1},8,["onClick"])])),_:1},8,["modelValue","rules"]),n(k,{class:"nav-login",url:"/pages/login/login"},{default:m((()=>[c(" 返回登陆页面 ")])),_:1})])),_:1})}],["__scopeId","data-v-0bba87cf"]]);export{F as default};
