You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/web/dist/assets/Following-L77nlPwG.js

2 lines
6.2 KiB

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