import{_ as Ne,a as Re}from"./post-item.vue_vue_type_style_index_0_lang-b0fbffc8.js";import{_ as Ve}from"./post-skeleton-d9166350.js";import{_ as je}from"./whisper-694050d3.js";import{_ as Ee}from"./main-nav.vue_vue_type_style_index_0_lang-57d1eaed.js";import{d as Ge,H as i,R as Je,c as Ke,b as Ye,E as Qe,r as Xe,f as u,k as o,w as r,q as g,Y as m,e as s,j as w,x as I,bf as c,A as H,y as me,F,u as T,h as fe}from"./@vue-a481fc63.js";import{u as Ze}from"./vuex-44de225f.js";import{b as ea}from"./vue-router-e5a2430e.js";import{L as aa,K as sa,e as N,h as ta,u as pe,f as he,M as la,_ as na}from"./index-2af3a836.js";import{W as oa}from"./whisper-add-friend-83d6a50f.js";import{W as ua}from"./v3-infinite-loading-2c58ec2f.js";import{k as ia,r as ra,G as ge,s as ca,t as va,J as _a,R as da}from"./@vicons-f0266f88.js";import{F as ma,G as fa,a as pa,j as we,o as ha,M as ga,e as wa,P as ka,k as ya,f as ba,g as Pa,J as Oa,H as Fa}from"./naive-ui-eecf2ec3.js";import"./content-845a2453.js";import"./paopao-video-player-2fe58954.js";import"./copy-to-clipboard-4ef7d3eb.js";import"./@babel-725317a4.js";import"./toggle-selection-93f4ad84.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-7c8d4b48.js";import"./@css-render-7124a1a5.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const Ta={key:0,class:"profile-baseinfo"},Ia={class:"avatar"},xa={class:"base-info"},Aa={class:"username"},$a={class:"userinfo"},za={class:"info-item"},Ua={class:"info-item"},qa={class:"userinfo"},Ca={class:"info-item"},Ma={class:"info-item"},Sa={class:"info-item"},Wa={key:0,class:"user-opts"},La={key:0,class:"skeleton-wrap"},Ba={key:1},Da={key:0,class:"empty-wrap"},Ha={key:1},Na={key:0},Ra={key:1},Va={key:2},ja={key:3},Ea={key:4},Ga={key:2},Ja={key:0},Ka={key:1},Ya={key:2},Qa={key:3},Xa={key:4},Za={class:"load-more-wrap"},es={class:"load-more-spinner"},as=Ge({__name:"User",setup(ss){const R=ma(),d=Ze(),$=ea(),ce="true".toLowerCase()==="true",f=i(!1),y=i(!1),a=Je({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,tweets_count:0,status:1}),h=i(!1),V=i(!1),G=i(!1),l=i([]),z=i([]),U=i([]),q=i([]),C=i([]),M=i([]),x=i($.query.s||""),n=i(+$.query.p||1),p=i("post"),J=i(+$.query.p||1),K=i(1),Y=i(1),Q=i(1),X=i(1),k=i(20),_=i(0),Z=i(0),ee=i(0),ae=i(0),se=i(0),te=i(0),b=e=>{a.id=e.id,a.username=e.username,a.nickname=e.nickname,a.avatar=e.avatar,V.value=!0},P=e=>{R.success({title:"提示",content:"确定"+(e.user.is_following?"取消关注":"关注")+"该用户吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e.user.is_following?pe({user_id:e.user.id}).then(v=>{window.$message.success("操作成功"),ve(e.user_id,!1)}).catch(v=>{}):he({user_id:e.user.id}).then(v=>{window.$message.success("关注成功"),ve(e.user_id,!0)}).catch(v=>{})}})};function ve(e,v){S(z,e,v),S(U,e,v),S(q,e,v),S(C,e,v),S(M,e,v)}function S(e,v,ie){if(e.value&&e.value.length>0)for(let E in e.value)e.value[E].user_id==v&&(e.value[E].user.is_following=ie)}const ke=()=>{y.value=!1,l.value=[],z.value=[],U.value=[],q.value=[],C.value=[],M.value=[],p.value="post",n.value=1,J.value=1,K.value=1,Y.value=1,Q.value=1,X.value=1,_.value=0,Z.value=0,ee.value=0,ae.value=0,se.value=0,te.value=0},ye=()=>{switch(p.value){case"post":j();break;case"comment":le();break;case"highlight":ne();break;case"media":oe();break;case"star":ue();break}},j=()=>{f.value=!0,N({username:x.value,style:"post",page:n.value,page_size:k.value}).then(e=>{f.value=!1,e.list.length===0&&(y.value=!0),n.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/k.value),z.value=l.value,Z.value=_.value}).catch(e=>{l.value=[],n.value>1&&n.value--,f.value=!1})},le=()=>{f.value=!0,N({username:x.value,style:"comment",page:n.value,page_size:k.value}).then(e=>{f.value=!1,e.list.length===0&&(y.value=!0),n.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/k.value),U.value=l.value,ee.value=_.value}).catch(e=>{l.value=[],n.value>1&&n.value--,f.value=!1})},ne=()=>{f.value=!0,N({username:x.value,style:"highlight",page:n.value,page_size:k.value}).then(e=>{f.value=!1,e.list.length===0&&(y.value=!0),n.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/k.value),q.value=l.value,ae.value=_.value}).catch(e=>{l.value=[],n.value>1&&n.value--,f.value=!1})},oe=()=>{f.value=!0,N({username:x.value,style:"media",page:n.value,page_size:k.value}).then(e=>{f.value=!1,e.list.length===0&&(y.value=!0),n.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/k.value),C.value=l.value,se.value=_.value}).catch(e=>{l.value=[],n.value>1&&n.value--,f.value=!1})},ue=()=>{f.value=!0,N({username:x.value,style:"star",page:n.value,page_size:k.value}).then(e=>{f.value=!1,e.list.length===0&&(y.value=!0),n.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/k.value),M.value=l.value,te.value=_.value}).catch(e=>{l.value=[],n.value>1&&n.value--,f.value=!1})},be=e=>{switch(p.value=e,p.value){case"post":l.value=z.value,n.value=J.value,_.value=Z.value,j();break;case"comment":l.value=U.value,n.value=K.value,_.value=ee.value,le();break;case"highlight":l.value=q.value,n.value=Y.value,_.value=ae.value,ne();break;case"media":l.value=C.value,n.value=Q.value,_.value=se.value,oe();break;case"star":l.value=M.value,n.value=X.value,_.value=te.value,ue();break}},W=()=>{h.value=!0,aa({username:x.value}).then(e=>{h.value=!1,a.id=e.id,a.avatar=e.avatar,a.username=e.username,a.nickname=e.nickname,a.is_admin=e.is_admin,a.is_friend=e.is_friend,a.created_on=e.created_on,a.is_following=e.is_following,a.follows=e.follows,a.followings=e.followings,a.status=e.status,e.tweets_count&&(a.tweets_count=e.tweets_count),ye()}).catch(e=>{h.value=!1,console.log(e)})},Pe=()=>{switch(p.value){case"post":J.value=n.value,j();break;case"comment":K.value=n.value,le();break;case"highlight":Y.value=n.value,ne();break;case"media":Q.value=n.value,oe();break;case"star":X.value=n.value,ue();break}},Oe=()=>{V.value=!0},Fe=()=>{G.value=!0},Te=()=>{V.value=!1},Ie=()=>{G.value=!1},A=e=>()=>fe(we,null,{default:()=>fe(e)}),xe=Ke(()=>{let e=[{label:"私信",key:"whisper",icon:A(ra)}];return d.state.userInfo.is_admin&&(a.status===1?e.push({label:"禁言",key:"banned",icon:A(ge)}):e.push({label:"解封",key:"deblocking",icon:A(ge)})),a.is_following?e.push({label:"取消关注",key:"unfollow",icon:A(ca)}):e.push({label:"关注",key:"follow",icon:A(va)}),ce&&(a.is_friend?e.push({label:"删除好友",key:"delete",icon:A(_a)}):e.push({label:"添加朋友",key:"requesting",icon:A(da)})),e}),Ae=e=>{switch(e){case"whisper":Oe();break;case"delete":$e();break;case"requesting":Fe();break;case"follow":case"unfollow":ze();break;case"banned":case"deblocking":Ue();break}},$e=()=>{R.warning({title:"删除好友",content:"将好友 “"+a.nickname+"” 删除,将同时删除 点赞/收藏 列表中关于该朋友的 “好友可见” 推文",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{h.value=!0,ta({user_id:a.id}).then(e=>{h.value=!1,a.is_friend=!1,j()}).catch(e=>{h.value=!1,console.log(e)})}})},ze=()=>{R.success({title:"提示",content:"确定"+(a.is_following?"取消关注":"关注")+"该用户吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{h.value=!0,a.is_following?pe({user_id:a.id}).then(e=>{h.value=!1,window.$message.success("取消关注成功"),W()}).catch(e=>{h.value=!1,console.log(e)}):he({user_id:a.id}).then(e=>{h.value=!1,window.$message.success("关注成功"),W()}).catch(e=>{h.value=!1,console.log(e)})}})},Ue=()=>{R.warning({title:"警告",content:"确定对该用户进行"+(a.status===1?"禁言":"解封")+"处理吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{h.value=!0,la({id:a.id,status:a.status===1?2:1}).then(e=>{h.value=!1,a.status===1?window.$message.success("禁言成功"):window.$message.success("解封成功"),W()}).catch(e=>{h.value=!1,console.log(e)})}})},qe=()=>{n.value<_.value||_.value==0?(y.value=!1,n.value++,Pe()):y.value=!0};return Ye(()=>{W()}),Qe(()=>({path:$.path,query:$.query}),(e,v)=>{v.path==="/u"&&e.path==="/u"&&(x.value=$.query.s||"",ke(),W())}),(e,v)=>{const ie=Ee,E=ha,re=ga,_e=Xe("router-link"),Ce=wa,Me=ka,Se=je,de=ya,L=ba,We=Pa,Le=Ve,Be=Oa,B=Ne,O=Fa,D=Re,De=fa,He=pa;return s(),u("div",null,[o(ie,{title:"用户详情"}),o(De,{class:"main-content-wrap profile-wrap",bordered:""},{default:r(()=>[o(de,{show:h.value},{default:r(()=>[a.id>0?(s(),u("div",Ta,[w("div",Ia,[o(E,{size:72,src:a.avatar},null,8,["src"])]),w("div",xa,[w("div",Aa,[w("strong",null,I(a.nickname),1),w("span",null," @"+I(a.username),1),ce&&c(d).state.userInfo.id>0&&c(d).state.userInfo.username!=a.username&&a.is_friend?(s(),g(re,{key:0,class:"top-tag",type:"info",size:"small",round:""},{default:r(()=>[H(" 好友 ")]),_:1})):m("",!0),c(d).state.userInfo.id>0&&c(d).state.userInfo.username!=a.username&&a.is_following?(s(),g(re,{key:1,class:"top-tag",type:"success",size:"small",round:""},{default:r(()=>[H(" 已关注 ")]),_:1})):m("",!0),a.is_admin?(s(),g(re,{key:2,class:"top-tag",type:"error",size:"small",round:""},{default:r(()=>[H(" 管理员 ")]),_:1})):m("",!0)]),w("div",$a,[w("span",za,"UID. "+I(a.id),1),w("span",Ua,I(c(sa)(a.created_on))+" 加入",1)]),w("div",qa,[w("span",Ca,[o(_e,{onClick:v[0]||(v[0]=me(()=>{},["stop"])),class:"following-link",to:{name:"following",query:{s:a.username,n:a.nickname,t:"follows"}}},{default:r(()=>[H(" 关注  "+I(a.follows),1)]),_:1},8,["to"])]),w("span",Ma,[o(_e,{onClick:v[1]||(v[1]=me(()=>{},["stop"])),class:"following-link",to:{name:"following",query:{s:a.username,n:a.nickname,t:"followings"}}},{default:r(()=>[H(" 粉丝  "+I(a.followings),1)]),_:1},8,["to"])]),w("span",Sa," 泡泡  "+I(a.tweets_count),1)])]),c(d).state.userInfo.id>0&&c(d).state.userInfo.username!=a.username?(s(),u("div",Wa,[o(Me,{placement:"bottom-end",trigger:"click",size:"small",options:xe.value,onSelect:Ae},{default:r(()=>[o(Ce,{quaternary:"",circle:""},{icon:r(()=>[o(c(we),null,{default:r(()=>[o(c(ia))]),_:1})]),_:1})]),_:1},8,["options"])])):m("",!0)])):m("",!0),o(Se,{show:V.value,user:a,onSuccess:Te},null,8,["show","user"]),o(oa,{show:G.value,user:a,onSuccess:Ie},null,8,["show","user"])]),_:1},8,["show"]),o(We,{class:"profile-tabs-wrap",type:"line",animated:"",value:p.value,"onUpdate:value":be},{default:r(()=>[o(L,{name:"post",tab:"泡泡"}),o(L,{name:"comment",tab:"评论"}),o(L,{name:"highlight",tab:"亮点"}),o(L,{name:"media",tab:"图文"}),o(L,{name:"star",tab:"喜欢"})]),_:1},8,["value"]),f.value&&l.value.length===0?(s(),u("div",La,[o(Le,{num:k.value},null,8,["num"])])):(s(),u("div",Ba,[l.value.length===0?(s(),u("div",Da,[o(Be,{size:"large",description:"暂无数据"})])):m("",!0),c(d).state.desktopModelShow?(s(),u("div",Ha,[p.value==="post"?(s(),u("div",Na,[(s(!0),u(F,null,T(z.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(B,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="comment"?(s(),u("div",Ra,[(s(!0),u(F,null,T(U.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(B,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="highlight"?(s(),u("div",Va,[(s(!0),u(F,null,T(q.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(B,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="media"?(s(),u("div",ja,[(s(!0),u(F,null,T(C.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(B,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="star"?(s(),u("div",Ea,[(s(!0),u(F,null,T(M.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(B,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0)])):(s(),u("div",Ga,[p.value==="post"?(s(),u("div",Ja,[(s(!0),u(F,null,T(z.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(D,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="comment"?(s(),u("div",Ka,[(s(!0),u(F,null,T(U.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(D,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="highlight"?(s(),u("div",Ya,[(s(!0),u(F,null,T(q.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(D,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="media"?(s(),u("div",Qa,[(s(!0),u(F,null,T(C.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(D,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="star"?(s(),u("div",Xa,[(s(!0),u(F,null,T(M.value,t=>(s(),g(O,{key:t.id},{default:r(()=>[o(D,{post:t,isOwner:c(d).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:b,onHandleFollowAction:P},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0)]))]))]),_:1}),_.value>0?(s(),g(He,{key:0,justify:"center"},{default:r(()=>[o(c(ua),{class:"load-more",slots:{complete:"没有更多泡泡了",error:"加载出错"},onInfinite:v[2]||(v[2]=t=>qe())},{spinner:r(()=>[w("div",Za,[y.value?m("",!0):(s(),g(de,{key:0,size:14})),w("span",es,I(y.value?"没有更多泡泡了":"加载更多"),1)])]),_:1})]),_:1})):m("",!0)])}}});const Ss=na(as,[["__scopeId","data-v-a3099af3"]]);export{Ss as default};