import{_ as a,b as e,s,g as r,a as o,d as l,e as t,f as d,w as m,i as u,o as i,h as n,j as p,m as c,q as f}from"./index-BUJl2M8y.js";import{_ as h,a as g,b as w}from"./uni-forms.CxX8jbN-.js";import"./uni-icons.BYzTc4bD.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(),o({url:"/pages/chat/chat"})}))}}},[["render",function(a,e,s,r,o,F){const N=u,b=l(t("uni-easyinput"),h),V=l(t("uni-forms-item"),g),_=c,P=l(t("uni-forms"),w),k=f;return i(),d(N,{class:"register"},{default:m((()=>[n(N,{class:"title"},{default:m((()=>[p("欢迎注册")])),_:1}),n(P,{class:"form",modelValue:o.dataForm,rules:o.rules,"validate-trigger":"bind","label-width":"80px"},{default:m((()=>[n(V,{name:"userName",label:"用户名"},{default:m((()=>[n(b,{type:"text",modelValue:o.dataForm.userName,"onUpdate:modelValue":e[0]||(e[0]=a=>o.dataForm.userName=a),placeholder:"用户名"},null,8,["modelValue"])])),_:1}),n(V,{name:"nickName",label:"昵称"},{default:m((()=>[n(b,{type:"text",modelValue:o.dataForm.nickName,"onUpdate:modelValue":e[1]||(e[1]=a=>o.dataForm.nickName=a),placeholder:"昵称"},null,8,["modelValue"])])),_:1}),n(V,{name:"password",label:"密码"},{default:m((()=>[n(b,{type:"password",modelValue:o.dataForm.password,"onUpdate:modelValue":e[2]||(e[2]=a=>o.dataForm.password=a),placeholder:"密码"},null,8,["modelValue"])])),_:1}),n(V,{name:"corfirmPassword",label:"确认密码"},{default:m((()=>[n(b,{type:"password",modelValue:o.dataForm.corfirmPassword,"onUpdate:modelValue":e[3]||(e[3]=a=>o.dataForm.corfirmPassword=a),placeholder:"确认密码"},null,8,["modelValue"])])),_:1}),n(_,{class:"btn-submit",onClick:F.submit,type:"warn"},{default:m((()=>[p("注册并登陆")])),_:1},8,["onClick"])])),_:1},8,["modelValue","rules"]),n(k,{class:"nav-login",url:"/pages/login/login"},{default:m((()=>[p(" 返回登陆页面 ")])),_:1})])),_:1})}],["__scopeId","data-v-0bba87cf"]]);export{F as default};
