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-3acd73c5.js

2 lines
6.1 KiB

import{_ as Q}from"./whisper-29f2b0aa.js";import{d as N,c as O,r as X,e as c,f as d,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{u as te,b as se}from"./vue-router-e5a2430e.js";import{K as ae,u as le,f as ce,_ as D,Y as ie,Z as _e}from"./index-15a0e03b.js";import{k as ue,r as re,s as pe,t as me}from"./@vicons-f0266f88.js";import{F as fe,j as B,o as de,M as ve,e as ge,P as we,O as he,G as ke,a as ye,f as be,g as $e,J as Fe,k as ze,H as Te}from"./naive-ui-eecf2ec3.js";import{_ as qe}from"./post-skeleton-a15059e0.js";import{_ as xe}from"./main-nav.vue_vue_type_style_index_0_lang-a20a8596.js";import{W as Ie}from"./v3-infinite-loading-2c58ec2f.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 Me={class:"follow-item"},Pe={class:"nickname-wrap"},Se={class:"username-wrap"},Ue={class:"user-info"},Ce={class:"info-item"},Be={class:"info-item"},Ne={class:"item-header-extra"},Oe=N({__name:"follow-item",props:{contact:{}},emits:["send-whisper"],setup(I,{emit:f}){const o=I,u=fe();te();const t=e=>()=>U(B,null,{default:()=>U(e)}),z=()=>{u.success({title:"提示",content:"确定"+(o.contact.is_following?"取消关注":"关注")+"该用户吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{o.contact.is_following?le({user_id:o.contact.user_id}).then(e=>{window.$message.success("取消关注成功"),o.contact.is_following=!1}).catch(e=>{console.log(e)}):ce({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:"私信",key:"whisper",icon:t(re)}];return o.contact.is_following?e.push({label:"取消关注",key:"unfollow",icon:t(pe)}):e.push({label:"关注",key:"follow",icon:t(me)}),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};f("send-whisper",l);break}};return(e,l)=>{const m=de,v=X("router-link"),k=ve,y=ge,T=we,q=he;return c(),d("div",Me,[n(q,{"content-indented":""},{avatar:a(()=>[n(m,{size:54,src:e.contact.avatar},null,8,["src"])]),header:a(()=>[_("span",Pe,[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",Se," @"+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",Ue,[_("span",Ce," UID. "+g(e.contact.user_id),1),_("span",Be,g(w(ae)(e.contact.created_on))+" 加入 ",1)])]),"header-extra":a(()=>[_("div",Ne,[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(ue))]),_:1})]),_:1})]),_:1},8,["options"])])]),_:1})])}}});const De=D(Oe,[["__scopeId","data-v-1fb7364a"]]),Ve={key:0,class:"skeleton-wrap"},We={key:1},je={key:0,class:"empty-wrap"},He={class:"load-more-wrap"},Re={class:"load-more-spinner"},Ae=N({__name:"Following",setup(I){const f=se(),o=i(!1),u=i(!1),t=i([]),z=f.query.n||"粉丝详情",h=f.query.s||"",p=i(f.query.t||"follows"),e=i(+f.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<m.value||m.value==0?(u.value=!1,e.value++,x()):u.value=!0},W=r=>{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),ie({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),_e({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=xe,M=be,R=$e,A=qe,Y=Fe,E=De,G=Te,J=Q,K=ke,L=ze,Z=ye;return c(),d(C,null,[_("div",null,[n(s,{title:w(z),back:!0},null,8,["title"]),n(K,{class:"main-content-wrap",bordered:""},{default:a(()=>[n(R,{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(),d("div",Ve,[n(A,{num:l.value},null,8,["num"])])):(c(),d("div",We,[t.value.length===0?(c(),d("div",je,[n(Y,{size:"large",description:"暂无数据"})])):F("",!0),(c(!0),d(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(Ie),{class:"load-more",slots:{complete:y.value,error:"加载出错"},onInfinite:V},{spinner:a(()=>[_("div",He,[u.value?F("",!0):(c(),$(L,{key:0,size:14})),_("span",Re,g(u.value?y.value:"加载更多"),1)])]),_:1},8,["slots"])]),_:1})):F("",!0)],64)}}});const wo=D(Ae,[["__scopeId","data-v-598cf32e"]]);export{wo as default};