import{_ as Q}from"./whisper-a090f673.js";import{d as N,c as O,r as X,e as c,f,k as n,w as a,j as _,y as ee,A as S,x as g,q as $,Y as F,bf as w,h as U,H as i,b as oe,F as C,u as ne}from"./@vue-a481fc63.js";import{K as te,u as se,f as ae,_ as D,Y as le,Z as ce}from"./index-e04968a0.js";import{k as ie,r as _e,s as ue,t as re}from"./@vicons-f0266f88.js";import{F as pe,j as B,o as me,M as de,e as fe,P as ve,O as ge,G as we,a as he,f as ke,g as ye,J as be,k as $e,H as Fe}from"./naive-ui-eecf2ec3.js";import{_ as ze}from"./post-skeleton-4a65c483.js";import{_ as Te}from"./main-nav.vue_vue_type_style_index_0_lang-8791d5c4.js";import{W as qe}from"./v3-infinite-loading-2c58ec2f.js";import{b as xe}from"./vue-router-e5a2430e.js";import"./vuex-44de225f.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-7c8d4b48.js";import"./evtd-b614532e.js";import"./@css-render-7124a1a5.js";import"./vooks-6d99783e.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 Ie={class:"follow-item"},Me={class:"nickname-wrap"},Pe={class:"username-wrap"},Se={class:"user-info"},Ue={class:"info-item"},Ce={class:"info-item"},Be={class:"item-header-extra"},Ne=N({__name:"follow-item",props:{contact:{}},emits:["send-whisper"],setup(I,{emit:d}){const o=I,u=pe(),t=e=>()=>U(B,null,{default:()=>U(e)}),z=()=>{u.success({title:"提示",content:"确定"+(o.contact.is_following?"取消关注 @":"关注 @")+o.contact.username+" 吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{o.contact.is_following?se({user_id:o.contact.user_id}).then(e=>{window.$message.success("取消关注成功"),o.contact.is_following=!1}).catch(e=>{console.log(e)}):ae({user_id:o.contact.user_id}).then(e=>{window.$message.success("关注成功"),o.contact.is_following=!0}).catch(e=>{console.log(e)})}})},h=O(()=>{let e=[{label:"私信 @"+o.contact.username,key:"whisper",icon:t(_e)}];return o.contact.is_following?e.push({label:"取消关注 @"+o.contact.username,key:"unfollow",icon:t(ue)}):e.push({label:"关注 @"+o.contact.username,key:"follow",icon:t(re)}),e}),p=e=>{switch(e){case"follow":case"unfollow":z();break;case"whisper":const l={id:o.contact.user_id,avatar:o.contact.avatar,username:o.contact.username,nickname:o.contact.nickname,is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1};d("send-whisper",l);break}};return(e,l)=>{const m=me,v=X("router-link"),k=de,y=fe,T=ve,q=ge;return c(),f("div",Ie,[n(q,{"content-indented":""},{avatar:a(()=>[n(m,{size:54,src:e.contact.avatar},null,8,["src"])]),header:a(()=>[_("span",Me,[n(v,{onClick:l[0]||(l[0]=ee(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{s:e.contact.username}}},{default:a(()=>[S(g(e.contact.nickname),1)]),_:1},8,["to"])]),_("span",Pe," @"+g(e.contact.username),1),e.contact.is_following?(c(),$(k,{key:0,class:"top-tag",type:"success",size:"small",round:""},{default:a(()=>[S(" 已关注 ")]),_:1})):F("",!0),_("div",Se,[_("span",Ue," UID. "+g(e.contact.user_id),1),_("span",Ce,g(w(te)(e.contact.created_on))+" 加入 ",1)])]),"header-extra":a(()=>[_("div",Be,[n(T,{placement:"bottom-end",trigger:"click",size:"small",options:h.value,onSelect:p},{default:a(()=>[n(y,{quaternary:"",circle:""},{icon:a(()=>[n(w(B),null,{default:a(()=>[n(w(ie))]),_:1})]),_:1})]),_:1},8,["options"])])]),_:1})])}}});const Oe=D(Ne,[["__scopeId","data-v-5dd79903"]]),De={key:0,class:"skeleton-wrap"},Ve={key:1},We={key:0,class:"empty-wrap"},je={class:"load-more-wrap"},He={class:"load-more-spinner"},Ae=N({__name:"Following",setup(I){const d=xe(),o=i(!1),u=i(!1),t=i([]),z=d.query.n||"粉丝详情",h=d.query.s||"",p=i(d.query.t||"follows"),e=i(+d.query.p||1),l=i(20),m=i(0),v=i(!1),k=i({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1}),y=O(()=>p.value=="follows"?"没有更多关注了":"没有更多粉丝了"),T=r=>{k.value=r,v.value=!0},q=()=>{v.value=!1},V=()=>{e.value{p.value=r,x()},x=()=>{p.value==="follows"?j(h):p.value==="followings"&&H(h)},j=(r,b=!1)=>{t.value.length===0&&(o.value=!0),le({username:r,page:e.value,page_size:l.value}).then(s=>{o.value=!1,s.list.length===0&&(u.value=!0),e.value>1?t.value=t.value.concat(s.list):(t.value=s.list,b&&setTimeout(()=>{window.scrollTo(0,99999)},50)),m.value=Math.ceil(s.pager.total_rows/l.value)}).catch(s=>{o.value=!1,e.value>1&&e.value--})},H=(r,b=!1)=>{t.value.length===0&&(o.value=!0),ce({username:r,page:e.value,page_size:l.value}).then(s=>{o.value=!1,s.list.length===0&&(u.value=!0),e.value>1?t.value=t.value.concat(s.list):(t.value=s.list,b&&setTimeout(()=>{window.scrollTo(0,99999)},50)),m.value=Math.ceil(s.pager.total_rows/l.value)}).catch(s=>{o.value=!1,e.value>1&&e.value--})};return oe(()=>{x()}),(r,b)=>{const s=Te,M=ke,A=ye,R=ze,Y=be,E=Oe,G=Fe,J=Q,K=we,L=$e,Z=he;return c(),f(C,null,[_("div",null,[n(s,{title:w(z),back:!0},null,8,["title"]),n(K,{class:"main-content-wrap",bordered:""},{default:a(()=>[n(A,{type:"line",animated:"","default-value":p.value,"onUpdate:value":W},{default:a(()=>[n(M,{name:"follows",tab:"正在关注"}),n(M,{name:"followings",tab:"我的粉丝"})]),_:1},8,["default-value"]),o.value&&t.value.length===0?(c(),f("div",De,[n(R,{num:l.value},null,8,["num"])])):(c(),f("div",Ve,[t.value.length===0?(c(),f("div",We,[n(Y,{size:"large",description:"暂无数据"})])):F("",!0),(c(!0),f(C,null,ne(t.value,P=>(c(),$(G,{key:P.user_id},{default:a(()=>[n(E,{contact:P,onSendWhisper:T},null,8,["contact"])]),_:2},1024))),128))])),n(J,{show:v.value,user:k.value,onSuccess:q},null,8,["show","user"])]),_:1})]),m.value>0?(c(),$(Z,{key:0,justify:"center"},{default:a(()=>[n(w(qe),{class:"load-more",slots:{complete:y.value,error:"加载出错"},onInfinite:V},{spinner:a(()=>[_("div",je,[u.value?F("",!0):(c(),$(L,{key:0,size:14})),_("span",He,g(u.value?y.value:"加载更多"),1)])]),_:1},8,["slots"])]),_:1})):F("",!0)],64)}}});const go=D(Ae,[["__scopeId","data-v-598cf32e"]]);export{go as default};