import{_ as e,a7 as s,z as n,b as t,as as a,d as i,e as r,f as o,w as d,i as h,o as u,h as f,j as l,t as m,a0 as I,a2 as c,l as p,m as g}from"./index-DJSXJc-t.js";import{_ as k}from"./next-watermark.CHjVBRjm.js";import{_ as S}from"./head-image.9WS3IGZs.js";import{_}from"./uni-icons.DkVTAsiu.js";const F=e({data:()=>({userInfo:{}}),methods:{onShowFullImage(){let e=this.userInfo.headImage;e&&s({urls:[e]})},onSendMessage(){let e={type:"PRIVATE",targetId:this.userInfo.id,showName:this.userInfo.nickName,headImage:this.userInfo.headImage};this.chatStore.openChat(e);let s=this.chatStore.findChatIdx(e);n({url:"/pages/chat/chat-box?chatIdx="+s})},onAddFriend(){this.$http({url:"/friend/add?friendId="+this.userInfo.id,method:"POST"}).then((e=>{let s={id:this.userInfo.id,nickName:this.userInfo.nickName,headImage:this.userInfo.headImageThumb,online:this.userInfo.online};this.friendStore.addFriend(s),t({title:"对方已成为您的好友",icon:"none"})}))},onDelFriend(){a({title:"确认删除",content:`确认删除 '${this.userInfo.nickName}',并删除聊天记录吗?`,success:e=>{e.cancel||this.$http({url:`/friend/delete/${this.userInfo.id}`,method:"delete"}).then((e=>{this.friendStore.removeFriend(this.userInfo.id),this.chatStore.removePrivateChat(this.userInfo.id),t({title:`与 '${this.userInfo.nickName}'的好友关系已解除`,icon:"none"})}))}})},updateFriendInfo(){let e=JSON.parse(JSON.stringify(this.friendInfo));e.headImage=this.userInfo.headImageThumb,e.nickName=this.userInfo.nickName,this.$http({url:"/friend/update",method:"PUT",data:e}).then((()=>{this.friendStore.updateFriend(e),this.chatStore.updateChatFromFriend(this.userInfo)}))},loadUserInfo(e){this.$http({url:"/user/find/"+e,method:"GET"}).then((e=>{this.userInfo=e,!this.isFriend||this.userInfo.headImageThumb==this.friendInfo.headImage&&this.userInfo.nickName==this.friendInfo.nickName||this.updateFriendInfo()}))}},computed:{isFriend(){return!!this.friendInfo},friendInfo(){return this.friendStore.friends.find((e=>e.id==this.userInfo.id))}},onLoad(e){this.loadUserInfo(e.id)}},[["render",function(e,s,n,t,a,F){const N=i(r("next-watermark"),k),b=h,x=i(r("head-image"),S),y=p,w=i(r("uni-icons"),_),C=g;return u(),o(b,{class:"page user-info"},{default:d((()=>[f(b,null,{default:d((()=>[f(N,{watermark:String(e.userStore.watermark)},null,8,["watermark"])])),_:1}),f(b,{class:"content"},{default:d((()=>[f(x,{name:a.userInfo.nickName,url:a.userInfo.headImageThumb,size:160,onClick:s[0]||(s[0]=e=>F.onShowFullImage())},null,8,["name","url"]),f(b,{class:"info-item"},{default:d((()=>[f(b,{class:"info-primary"},{default:d((()=>[f(y,{class:"info-username"},{default:d((()=>[l(m(a.userInfo.userName),1)])),_:1}),I(f(w,{class:"sex-boy",type:"person-filled",size:"20",color:"darkblue"},null,512),[[c,0==a.userInfo.sex]]),I(f(w,{class:"sex-girl",type:"person-filled",size:"20",color:"darkred"},null,512),[[c,1==a.userInfo.sex]])])),_:1}),f(y,null,{default:d((()=>[l(" 昵称 ："+m(a.userInfo.nickName),1)])),_:1}),f(y,null,{default:d((()=>[l(" 签名 ："+m(a.userInfo.signature),1)])),_:1})])),_:1})])),_:1}),f(b,{class:"line"}),f(b,{class:"btn-group"},{default:d((()=>[I(f(C,{class:"btn",type:"primary",onClick:s[1]||(s[1]=e=>F.onSendMessage())},{default:d((()=>[l("发消息")])),_:1},512),[[c,F.isFriend]]),I(f(C,{class:"btn",type:"primary",onClick:s[2]||(s[2]=e=>F.onAddFriend())},{default:d((()=>[l("加为好友")])),_:1},512),[[c,!F.isFriend]])])),_:1})])),_:1})}],["__scopeId","data-v-eb1eb83d"]]);export{F as default};
