import{O as e,f as a,o as l,c as s,w as t,a as r,u as o,h as u,t as i,m as c,ac as d,C as n,D as f,g as m,d as p}from"./index-3714412c.js";import{_}from"./uv-navbar.31c484ad.js";import{o as y,r as b,u as v}from"./useRouter.f44141c1.js";import{_ as k}from"./uv-icon.c593f91d.js";import{_ as h}from"./uv-image.7b0e6bd2.js";import{_ as j,a as w}from"./uv-list.9317e3cc.js";import{_ as g}from"./uv-upload.a36286c2.js";import{_ as C}from"./uv-input.5c267c8c.js";import{_ as x}from"./uv-button.14a976f7.js";import{_ as I}from"./uv-datetime-picker.7692a9fb.js";import{_ as D}from"./layout.99605750.js";import{u as B,b as F,d as R}from"./store.13d2fa29.js";import{u as U}from"./useGlobalProperties.a8c016ad.js";import{_ as V}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uv-status-bar.b515a02d.js";import"./uv-transition.4f5b62a8.js";import"./uv-badge.e9560e1c.js";import"./uv-loading-icon.8ba359c8.js";import"./uv-popup.e5d0df45.js";import"./uv-picker.98c08d87.js";import"./api.966d6934.js";const A=V({__name:"userInfo",setup(V){const A=B(),{user:L}=e(A),P=a(null),{$timeFormat:$}=U(),{goBack:z}=v(),E=()=>{A.logout()};y((e=>{A.getUserInfo()}));const G=async e=>{const a=await d(e.file.url);let l=new File([a],"",{type:a.type}),s=new FormData;s.append("avatarFile",l),n({title:"上传中"}),F(s).then((()=>{f(),A.getUserInfo()}))},J=()=>{A.user.nickname&&(n({title:"更新中"}),R({nickname:A.user.nickname,birthday:A.user.birthday}).then((()=>{f(),A.getUserInfo()})))},K=()=>{P.value.open()},M=e=>{A.user.birthday=$(e.value,"yyyy-mm-dd"),J()};return(e,a)=>{const d=b(m("uv-navbar"),_),n=p,f=b(m("uv-icon"),k),y=b(m("uv-image"),h),v=b(m("uv-list-item"),j),B=b(m("uv-list"),w),F=b(m("uv-upload"),g),R=b(m("uv-input"),C),U=b(m("uv-button"),x),V=b(m("uv-datetime-picker"),I),$=b(m("layout"),D);return l(),s($,null,{default:t((()=>[r(d,{fixed:!1,title:"账号设置","left-arrow":"",onLeftClick:o(z)},null,8,["onLeftClick"]),o(L)?(l(),s(n,{key:0},{default:t((()=>[r(n,{class:"y-list"},{default:t((()=>[r(F,{useBeforeRead:!0,onAfterRead:G},{default:t((()=>[r(n,{class:"upload-warp"},{default:t((()=>[r(B,{border:""},{default:t((()=>[r(v,{border:"","show-arrow":""},{default:t((()=>[r(n,{class:"y-list-content avatar flex flex-jc__sb"},{default:t((()=>[r(n,{class:"y-list-label"},{default:t((()=>[u("头像")])),_:1}),r(n,{class:"y-list-avatar"},{default:t((()=>[r(y,{class:"img",src:o(A).user.avatar,width:"90rpx",height:"90rpx",shape:"circle"},{error:t((()=>[r(f,{name:"photo"})])),_:1},8,["src"])])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1}),r(n,{class:"y-list"},{default:t((()=>[r(B,{border:""},{default:t((()=>[r(v,{border:"",clickable:"",onClick:a[0]||(a[0]=()=>{})},{default:t((()=>[r(n,{class:"y-list-content"},{default:t((()=>[r(n,{class:"y-list-label"},{default:t((()=>[u("ID")])),_:1}),r(n,{class:"y-list-select-placeholder"},{default:t((()=>[u(i(o(A).user.id),1)])),_:1})])),_:1})])),_:1}),r(v,{border:"",clickable:"","show-arrow":"",onClick:a[2]||(a[2]=()=>{})},{default:t((()=>[r(n,{class:"y-list-content"},{default:t((()=>[r(n,{class:"y-list-label"},{default:t((()=>[u("昵称")])),_:1}),r(n,{class:"y-list-select-placeholder"},{default:t((()=>[r(R,{placeholder:"请输入内容",border:"none",modelValue:o(A).user.nickname,"onUpdate:modelValue":a[1]||(a[1]=e=>o(A).user.nickname=e),onBlur:J,inputAlign:"right"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),r(v,{border:"",clickable:"","show-arrow":"",onClick:a[3]||(a[3]=()=>{})},{default:t((()=>[r(n,{class:"y-list-content"},{default:t((()=>[r(n,{class:"y-list-label"},{default:t((()=>[u("性别")])),_:1}),r(n,{class:"y-list-select-placeholder"},{default:t((()=>[u(i(o(A).user.nickname),1)])),_:1})])),_:1})])),_:1}),r(v,{border:"",clickable:"","show-arrow":"",onClick:K},{default:t((()=>[r(n,{class:"y-list-content"},{default:t((()=>[r(n,{class:"y-list-label"},{default:t((()=>[u("出生日期")])),_:1}),r(n,{class:"y-list-select-placeholder"},{default:t((()=>[u(i(o(A).user.birthday),1)])),_:1})])),_:1})])),_:1})])),_:1})])),_:1}),r(n,{class:"y-list"},{default:t((()=>[r(B,{border:""},{default:t((()=>[r(v,{border:"",clickable:"","show-arrow":"",onClick:a[4]||(a[4]=()=>{})},{default:t((()=>[r(n,{class:"y-list-content"},{default:t((()=>[r(n,{class:"y-list-label"},{default:t((()=>[u("手机号")])),_:1}),r(n,{class:"y-list-select-placeholder"},{default:t((()=>[u(i(o(A).user.mobile)+" ",1)])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})):c("",!0),r(n,{class:"form-buttons"},{default:t((()=>[r(U,{round:"",block:"",type:"primary",onClick:E},{default:t((()=>[u(" 退出登录 ")])),_:1})])),_:1}),r(V,{ref_key:"datetimePickerRef",ref:P,mode:"date",minDate:"1900",onConfirm:M},null,512)])),_:1})}}},[["__scopeId","data-v-e8f1248e"]]);export{A as default};
