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-3167f2f0.js

2 lines
5.0 KiB

import{d as B,c as L,r as E,e as l,f as r,k as o,w as t,j as p,y as G,A as q,x as k,q as N,Y as z,bf as v,h as x,H as f,b as Q,F as C,u as W}from"./@vue-a481fc63.js";import{u as Y,b as J}from"./vue-router-e5a2430e.js";import{H as K,I as X,_ as S,R as Z,S as ee}from"./index-4afa107a.js";import{b as oe}from"./formatTime-4210fcd1.js";import{i as te,y as ne,z as se}from"./@vicons-9939c40b.js";import{T as ae,j as M,o as le,M as ce,e as _e,O as ie,L as ue,F as re,Q as pe,f as me,g as de,I as fe,G as ge}from"./naive-ui-d8de3dda.js";import{_ as ve}from"./post-skeleton-649e932a.js";import{_ as we}from"./main-nav.vue_vue_type_style_index_0_lang-088e2761.js";import{u as he}from"./vuex-44de225f.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-39372edb.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";import"./moment-2ab8298d.js";const ke={class:"follow-item"},ye={class:"nickname-wrap"},be={class:"username-wrap"},Fe={class:"user-info"},$e={class:"info-item"},ze={class:"info-item"},Te={class:"item-header-extra"},Ie=B({__name:"follow-item",props:{contact:{}},setup(T){const s=T,m=ae();Y();const n=e=>()=>x(M,null,{default:()=>x(e)}),c=()=>{m.success({title:"提示",content:"确定"+(s.contact.is_following?"取消关注":"关注")+"该用户吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{s.contact.is_following?K({user_id:s.contact.user_id}).then(e=>{window.$message.success("取消关注成功"),s.contact.is_following=!1}).catch(e=>{console.log(e)}):X({user_id:s.contact.user_id}).then(e=>{window.$message.success("关注成功"),s.contact.is_following=!0}).catch(e=>{console.log(e)})}})},y=e=>{switch(e){case"follow":case"unfollow":c();break}},w=L(()=>{let e=[];return s.contact.is_following?e.push({label:"取消关注",key:"unfollow",icon:n(ne)}):e.push({label:"关注",key:"follow",icon:n(se)}),e});return(e,i)=>{const u=le,d=E("router-link"),b=ce,F=_e,g=ie,$=ue;return l(),r("div",ke,[o($,{"content-indented":""},{avatar:t(()=>[o(u,{size:54,src:e.contact.avatar},null,8,["src"])]),header:t(()=>[p("span",ye,[o(d,{onClick:i[0]||(i[0]=G(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{s:e.contact.username}}},{default:t(()=>[q(k(e.contact.nickname),1)]),_:1},8,["to"])]),p("span",be," @"+k(e.contact.username),1),e.contact.is_following?(l(),N(b,{key:0,class:"top-tag",type:"success",size:"small",round:""},{default:t(()=>[q(" 已关注 ")]),_:1})):z("",!0),p("div",Fe,[p("span",$e," UID. "+k(e.contact.user_id),1),p("span",ze,k(v(oe)(e.contact.created_on))+" 加入 ",1)])]),"header-extra":t(()=>[p("div",Te,[o(g,{placement:"bottom-end",trigger:"click",size:"small",options:w.value,onSelect:y},{default:t(()=>[o(F,{quaternary:"",circle:""},{icon:t(()=>[o(v(M),null,{default:t(()=>[o(v(te))]),_:1})]),_:1})]),_:1},8,["options"])])]),_:1})])}}});const Ue=S(Ie,[["__scopeId","data-v-64f1874c"]]),qe={key:0,class:"skeleton-wrap"},xe={key:1},Ce={key:0,class:"empty-wrap"},Me={key:0,class:"pagination-wrap"},Be=B({__name:"Following",setup(T){const s=he(),m=J(),n=f(!1),c=f([]),y=m.query.n||"粉丝详情",w=m.query.s||"",e=f(m.query.t||"follows"),i=f(+m.query.p||1),u=f(20),d=f(0),b=_=>{i.value=_,g()},F=_=>{e.value=_,g()},g=()=>{e.value==="follows"?$(w):e.value==="followings"&&D(w)},$=(_,h=!1)=>{c.value.length===0&&(n.value=!0),Z({username:_,page:i.value,page_size:u.value}).then(a=>{n.value=!1,c.value=a.list||[],d.value=Math.ceil(a.pager.total_rows/u.value),h&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(a=>{n.value=!1})},D=(_,h=!1)=>{c.value.length===0&&(n.value=!0),ee({username:_,page:i.value,page_size:u.value}).then(a=>{n.value=!1,c.value=a.list||[],d.value=Math.ceil(a.pager.total_rows/u.value),h&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(a=>{n.value=!1})};return Q(()=>{g()}),(_,h)=>{const a=we,I=me,O=de,P=ve,R=fe,V=Ue,H=ge,j=re,A=pe;return l(),r(C,null,[p("div",null,[o(a,{title:v(y),back:!0},null,8,["title"]),o(j,{class:"main-content-wrap",bordered:""},{default:t(()=>[o(O,{type:"line",animated:"","default-value":e.value,"onUpdate:value":F},{default:t(()=>[o(I,{name:"follows",tab:"正在关注"}),o(I,{name:"followings",tab:"我的粉丝"})]),_:1},8,["default-value"]),n.value?(l(),r("div",qe,[o(P,{num:u.value},null,8,["num"])])):(l(),r("div",xe,[c.value.length===0?(l(),r("div",Ce,[o(R,{size:"large",description:"暂无数据"})])):z("",!0),(l(!0),r(C,null,W(c.value,U=>(l(),N(H,{key:U.user_id},{default:t(()=>[o(V,{contact:U},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),d.value>0?(l(),r("div",Me,[o(A,{page:i.value,"onUpdate:page":b,"page-slot":v(s).state.collapsedRight?5:8,"page-count":d.value},null,8,["page","page-slot","page-count"])])):z("",!0)],64)}}});const ao=S(Be,[["__scopeId","data-v-1f0f223d"]]);export{ao as default};