import{k as N}from"./user-CSuRCHjC.js";import{p as y,a as b,O as C,j as u,b as U,q,w as t,l as o,f as a,m as s}from"./index-D0Tcm3GV.js";const j={__name:"userInfo",props:{user:{type:Object}},setup(_){const i=_,{proxy:p}=y(),l=b({}),V=b({nickName:[{required:!0,message:"用户昵称不能为空",trigger:"blur"}],email:[{required:!0,message:"邮箱地址不能为空",trigger:"blur"},{type:"email",message:"请输入正确的邮箱地址",trigger:["blur","change"]}],phonenumber:[{required:!0,message:"手机号码不能为空",trigger:"blur"},{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"请输入正确的手机号码",trigger:"blur"}]});function x(){p.$refs.userRef.validate(n=>{n&&N(l.value).then(()=>{p.$modal.msgSuccess("修改成功"),i.user.phonenumber=l.value.phonenumber,i.user.email=l.value.email})})}function c(){p.$tab.closePage()}return C(()=>i.user,n=>{n&&(l.value={nickName:n.nickName,phonenumber:n.phonenumber,email:n.email,sex:n.sex})},{immediate:!0}),(n,e)=>{const d=u("el-input"),m=u("el-form-item"),f=u("el-radio"),k=u("el-radio-group"),g=u("el-button"),v=u("el-form");return U(),q(v,{ref:"userRef",model:a(l),rules:a(V),"label-width":"80px"},{default:t(()=>[o(m,{label:"用户昵称",prop:"nickName"},{default:t(()=>[o(d,{modelValue:a(l).nickName,"onUpdate:modelValue":e[0]||(e[0]=r=>a(l).nickName=r),maxlength:"30"},null,8,["modelValue"])]),_:1}),o(m,{label:"手机号码",prop:"phonenumber"},{default:t(()=>[o(d,{modelValue:a(l).phonenumber,"onUpdate:modelValue":e[1]||(e[1]=r=>a(l).phonenumber=r),maxlength:"11"},null,8,["modelValue"])]),_:1}),o(m,{label:"邮箱",prop:"email"},{default:t(()=>[o(d,{modelValue:a(l).email,"onUpdate:modelValue":e[2]||(e[2]=r=>a(l).email=r),maxlength:"50"},null,8,["modelValue"])]),_:1}),o(m,{label:"性别"},{default:t(()=>[o(k,{modelValue:a(l).sex,"onUpdate:modelValue":e[3]||(e[3]=r=>a(l).sex=r)},{default:t(()=>[o(f,{value:"0"},{default:t(()=>[...e[4]||(e[4]=[s("男",-1)])]),_:1}),o(f,{value:"1"},{default:t(()=>[...e[5]||(e[5]=[s("女",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(m,null,{default:t(()=>[o(g,{type:"primary",onClick:x},{default:t(()=>[...e[6]||(e[6]=[s("保存",-1)])]),_:1}),o(g,{type:"danger",onClick:c},{default:t(()=>[...e[7]||(e[7]=[s("关闭",-1)])]),_:1})]),_:1})]),_:1},8,["model","rules"])}}};export{j as default};
