import{_ as ye}from"./whisper-473502c7.js";import{_ as be,a as Ie}from"./post-item.vue_vue_type_style_index_0_lang-bce56e3e.js";import{_ as Pe}from"./post-skeleton-df8e8b0e.js";import{_ as Oe}from"./main-nav.vue_vue_type_style_index_0_lang-ebb6720b.js";import{d as Te,H as i,b as Ae,E as Fe,r as xe,f as u,k as r,bf as n,q as h,w as v,Y as m,e as a,j as f,x as O,A as R,y as ue,F as b,u as I}from"./@vue-a481fc63.js";import{u as Me}from"./vuex-44de225f.js";import{b as ze}from"./vue-router-e5a2430e.js";import{e as L,K as qe,u as $e,f as Ce,_ as Se}from"./index-3489d7cc.js";import{p as G}from"./count-e2caa1c1.js";import{W as Le}from"./v3-infinite-loading-2c58ec2f.js";import{F as Ne,G as Ue,a as Be,o as De,M as He,f as Ve,g as We,J as je,k as Ee,H as Re}from"./naive-ui-eecf2ec3.js";import"./content-23ae3d74.js";import"./@vicons-f0266f88.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 Ge={class:"profile-baseinfo"},Je={class:"avatar"},Ke={class:"base-info"},Qe={class:"username"},Ye={class:"userinfo"},Xe={class:"info-item"},Ze={class:"info-item"},et={class:"userinfo"},tt={class:"info-item"},at={class:"info-item"},st={class:"info-item"},lt={key:0,class:"skeleton-wrap"},ot={key:1},nt={key:0,class:"empty-wrap"},ut={key:1},it={key:0},rt={key:1},ct={key:2},_t={key:3},vt={key:4},dt={key:2},mt={key:0},ft={key:1},pt={key:2},ht={key:3},gt={key:4},wt={class:"load-more-wrap"},kt={class:"load-more-spinner"},yt=Te({__name:"Profile",setup(bt){const o=Me(),T=ze(),ie=Ne(),d=i(!1),P=i(!1),l=i([]),A=i([]),F=i([]),x=i([]),M=i([]),z=i([]),p=i("post"),J=i(+T.query.p||1),K=i(1),Q=i(1),Y=i(1),X=i(1),s=i(+T.query.p||1),g=i(20),_=i(0),Z=i(0),ee=i(0),te=i(0),ae=i(0),se=i(0),U=i(!1),le=i({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1}),w=e=>{le.value=e,U.value=!0},re=()=>{U.value=!1},k=e=>{ie.success({title:"提示",content:"确定"+(e.user.is_following?"取消关注":"关注")+"该用户吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e.user.is_following?$e({user_id:e.user.id}).then(c=>{window.$message.success("操作成功"),oe(e.user_id,!1)}).catch(c=>{}):Ce({user_id:e.user.id}).then(c=>{window.$message.success("关注成功"),oe(e.user_id,!0)}).catch(c=>{})}})};function oe(e,c){q(A.value,e,c),q(F.value,e,c),q(x.value,e,c),q(M.value,e,c),q(z.value,e,c)}function q(e,c,E){if(e&&e.length>0)for(let N in e)e[N].user_id==c&&(e[N].user.is_following=E)}const B=()=>{switch(p.value){case"post":D();break;case"comment":H();break;case"highlight":V();break;case"media":W();break;case"star":j();break}},D=()=>{d.value=!0,L({username:o.state.userInfo.username,style:"post",page:s.value,page_size:g.value}).then(e=>{d.value=!1,e.list.length===0&&(P.value=!0),s.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/g.value),A.value=l.value,Z.value=_.value}).catch(e=>{l.value=[],s.value>1&&s.value--,d.value=!1})},H=()=>{d.value=!0,L({username:o.state.userInfo.username,style:"comment",page:s.value,page_size:g.value}).then(e=>{d.value=!1,e.list.length===0&&(P.value=!0),s.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/g.value),F.value=l.value,ee.value=_.value}).catch(e=>{l.value=[],s.value>1&&s.value--,d.value=!1})},V=()=>{d.value=!0,L({username:o.state.userInfo.username,style:"highlight",page:s.value,page_size:g.value}).then(e=>{d.value=!1,e.list.length===0&&(P.value=!0),s.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/g.value),x.value=l.value,te.value=_.value}).catch(e=>{l.value=[],s.value>1&&s.value--,d.value=!1})},W=()=>{d.value=!0,L({username:o.state.userInfo.username,style:"media",page:s.value,page_size:g.value}).then(e=>{d.value=!1,e.list.length===0&&(P.value=!0),s.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/g.value),M.value=l.value,ae.value=_.value}).catch(e=>{l.value=[],s.value>1&&s.value--,d.value=!1})},j=()=>{d.value=!0,L({username:o.state.userInfo.username,style:"star",page:s.value,page_size:g.value}).then(e=>{d.value=!1,e.list.length===0&&(P.value=!0),s.value>1?l.value=l.value.concat(e.list):(l.value=e.list||[],window.scrollTo(0,0)),_.value=Math.ceil(e.pager.total_rows/g.value),z.value=l.value,se.value=_.value}).catch(e=>{l.value=[],s.value>1&&s.value--,d.value=!1})},ce=e=>{switch(p.value=e,p.value){case"post":l.value=A.value,s.value=J.value,_.value=Z.value,D();break;case"comment":l.value=F.value,s.value=K.value,_.value=ee.value,H();break;case"highlight":l.value=x.value,s.value=Q.value,_.value=te.value,V();break;case"media":l.value=M.value,s.value=Y.value,_.value=ae.value,W();break;case"star":l.value=z.value,s.value=X.value,_.value=se.value,j();break}},_e=()=>{switch(p.value){case"post":J.value=s.value,D();break;case"comment":K.value=s.value,H();break;case"highlight":Q.value=s.value,V();break;case"media":Y.value=s.value,W();break;case"star":X.value=s.value,j();break}},ve=()=>{s.value<_.value||_.value==0?(P.value=!1,s.value++,_e()):P.value=!0};return Ae(()=>{B()}),Fe(()=>({path:T.path,query:T.query,refresh:o.state.refresh}),(e,c)=>{if(e.refresh!==c.refresh){s.value=+T.query.p||1,setTimeout(()=>{B()},0);return}c.path!=="/post"&&e.path==="/profile"&&(s.value=+T.query.p||1,setTimeout(()=>{B()},0))}),(e,c)=>{const E=Oe,N=De,de=He,ne=xe("router-link"),$=Ve,me=We,fe=Pe,pe=je,C=be,y=Re,S=Ie,he=ye,ge=Ue,we=Ee,ke=Be;return a(),u("div",null,[r(E,{title:"主页"}),n(o).state.userInfo.id>0?(a(),h(ge,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:v(()=>[f("div",Ge,[f("div",Je,[r(N,{size:72,src:n(o).state.userInfo.avatar},null,8,["src"])]),f("div",Ke,[f("div",Qe,[f("strong",null,O(n(o).state.userInfo.nickname),1),f("span",null," @"+O(n(o).state.userInfo.username),1),n(o).state.userInfo.is_admin?(a(),h(de,{key:0,class:"top-tag",type:"error",size:"small",round:""},{default:v(()=>[R(" 管理员 ")]),_:1})):m("",!0)]),f("div",Ye,[f("span",Xe,"UID. "+O(n(o).state.userInfo.id),1),f("span",Ze,O(n(qe)(n(o).state.userInfo.created_on))+" 加入",1)]),f("div",et,[f("span",tt,[r(ne,{onClick:c[0]||(c[0]=ue(()=>{},["stop"])),class:"following-link",to:{name:"following",query:{s:n(o).state.userInfo.username,n:n(o).state.userInfo.nickname,t:"follows"}}},{default:v(()=>[R(" 关注  "+O(n(G)(n(o).state.userInfo.follows)),1)]),_:1},8,["to"])]),f("span",at,[r(ne,{onClick:c[1]||(c[1]=ue(()=>{},["stop"])),class:"following-link",to:{name:"following",query:{s:n(o).state.userInfo.username,n:n(o).state.userInfo.nickname,t:"followings"}}},{default:v(()=>[R(" 粉丝  "+O(n(G)(n(o).state.userInfo.followings)),1)]),_:1},8,["to"])]),f("span",st," 泡泡  "+O(n(G)(n(o).state.userInfo.tweets_count)),1)])])]),r(me,{class:"profile-tabs-wrap",type:"line",animated:"","onUpdate:value":ce},{default:v(()=>[r($,{name:"post",tab:"泡泡"}),r($,{name:"comment",tab:"评论"}),r($,{name:"highlight",tab:"亮点"}),r($,{name:"media",tab:"图文"}),r($,{name:"star",tab:"喜欢"})]),_:1}),d.value&&l.value.length===0?(a(),u("div",lt,[r(fe,{num:g.value},null,8,["num"])])):(a(),u("div",ot,[l.value.length===0?(a(),u("div",nt,[r(pe,{size:"large",description:"暂无数据"})])):m("",!0),n(o).state.desktopModelShow?(a(),u("div",ut,[p.value==="post"?(a(),u("div",it,[(a(!0),u(b,null,I(A.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(C,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="comment"?(a(),u("div",rt,[(a(!0),u(b,null,I(F.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(C,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="highlight"?(a(),u("div",ct,[(a(!0),u(b,null,I(x.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(C,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="media"?(a(),u("div",_t,[(a(!0),u(b,null,I(M.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(C,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="star"?(a(),u("div",vt,[(a(!0),u(b,null,I(z.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(C,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0)])):(a(),u("div",dt,[p.value==="post"?(a(),u("div",mt,[(a(!0),u(b,null,I(A.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(S,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="comment"?(a(),u("div",ft,[(a(!0),u(b,null,I(F.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(S,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="highlight"?(a(),u("div",pt,[(a(!0),u(b,null,I(x.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(S,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="media"?(a(),u("div",ht,[(a(!0),u(b,null,I(M.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(S,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0),p.value==="star"?(a(),u("div",gt,[(a(!0),u(b,null,I(z.value,t=>(a(),h(y,{key:t.id},{default:v(()=>[r(S,{post:t,isOwner:n(o).state.userInfo.id==t.user_id,addFollowAction:!0,onSendWhisper:w,onHandleFollowAction:k},null,8,["post","isOwner"])]),_:2},1024))),128))])):m("",!0)]))])),r(he,{show:U.value,user:le.value,onSuccess:re},null,8,["show","user"])]),_:1})):m("",!0),_.value>0?(a(),h(ke,{key:1,justify:"center"},{default:v(()=>[r(n(Le),{class:"load-more",slots:{complete:"没有更多泡泡了",error:"加载出错"},onInfinite:c[2]||(c[2]=t=>ve())},{spinner:v(()=>[f("div",wt,[P.value?m("",!0):(a(),h(we,{key:0,size:14})),f("span",kt,O(P.value?"没有更多泡泡了":"加载更多"),1)])]),_:1})]),_:1})):m("",!0)])}}});const aa=Se(yt,[["__scopeId","data-v-50f96858"]]);export{aa as default};