|
|
import{W as Ue}from"./whisper-add-friend-7ede77e9.js";import{_ as Be}from"./whisper-9b4eeceb.js";import{_ as Ee,a as Ve}from"./post-item.vue_vue_type_style_index_0_lang-c2092e3d.js";import{_ as xe}from"./post-skeleton-8434d30b.js";import{d as Ce,H as l,c as we,b as Ie,e as p,f as y,bf as A,j as b,k as a,w as i,q as x,Y as k,y as ke,A as S,x as se,F as ye,u as Ae,R as Fe,E as Ne}from"./@vue-a481fc63.js";import{u as ze}from"./vuex-44de225f.js";import{l as be}from"./lodash-e0b37ac3.js";import{g as Re,a as qe,c as Ge,b as Oe,d as Pe,e as Se,u as Ye,f as Le,h as Me,_ as We}from"./index-daff1b26.js";import{p as Ke}from"./content-64a02a2f.js";import{V,P as Q}from"./IEnum-5453a777.js";import{I as je,V as Qe,A as He,d as Ze,E as Je}from"./@vicons-c265fba6.js";import{o as De,v as Xe,j as $e,e as et,w as tt,x as st,y as at,z as nt,A as ot,B as lt,C as it,a as Te,D as rt,E as ut,F as ct,G as pt,H as dt,l as vt,I as mt,J as _t,k as ft}from"./naive-ui-defd0b2d.js";import{_ as gt}from"./main-nav.vue_vue_type_style_index_0_lang-93352cc4.js";import{b as ht,u as wt}from"./vue-router-e5a2430e.js";import{W as yt}from"./v3-infinite-loading-2c58ec2f.js";import{S as At}from"./@opentiny-d73a2d67.js";import"./copy-to-clipboard-4ef7d3eb.js";import"./@babel-725317a4.js";import"./toggle-selection-93f4ad84.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.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"./paopao-video-player-2fe58954.js";import"./vue-1e3b54ec.js";import"./xss-a5544f63.js";import"./cssfilter-af71ba68.js";const kt=H=>{const R=new FileReader,C=r=>["application/zip","application/x-zip","application/octet-stream","application/x-zip-compressed"].includes(r),I=()=>{const r=new Uint8Array(R.result).subarray(0,4);let T="";for(let m=0;m<r.length;m++)T+=r[m].toString(16);switch(T){case"504b0304":case"504b0506":case"504b0708":return C("application/zip");case"504b030414":return C("application/x-zip-compressed");case"504b0508":return C("application/x-zip");case"504b5370":return C("application/octet-stream");default:return!1}};return new Promise((r,T)=>{R.onloadend=()=>{const m=H.type;r(m===""||m==="application/octet-stream"?I():C(m))},R.readAsArrayBuffer(H.slice(0,4))})},bt={key:0,class:"compose-wrap"},Ct={class:"compose-line"},It={class:"compose-user"},zt={class:"compose-line compose-options"},Dt={class:"attachment"},Tt={class:"submit-wrap"},Ut={class:"attachment-list-wrap"},Bt={key:0,class:"attachment-price-wrap"},Et=b("span",null," 附件价格¥",-1),Vt={key:0,class:"eye-wrap"},xt={key:1,class:"link-wrap"},Ft={key:1,class:"compose-wrap"},Nt=b("div",{class:"login-wrap"},[b("span",{class:"login-banner"}," 登录后,精彩更多")],-1),Rt={key:0,class:"login-only-wrap"},qt={key:1,class:"login-wrap"},Gt=Ce({__name:"compose",emits:["post-success"],setup(H,{emit:R}){const C=ze(),I=l([]),r=l(!1),T=l(!1),m=l(!1),F=l(!1),U=l(""),z=l([]),q=l(),Y=l(0),d=l("public/image"),_=l([]),D=l([]),G=l([]),N=l([]),f=l(V.PUBLIC),g=l(V.PUBLIC),O="true".toLowerCase()==="true",B=+"400",L=l("true".toLowerCase()==="true"),W=l("true".toLowerCase()==="true"),Z=l("true".toLowerCase()==="true"),J=l("false".toLowerCase()==="true"),ae=l("true".toLowerCase()==="true"),ne="/v1/attachment",oe=we(()=>"Bearer "+localStorage.getItem("PAOPAO_TOKEN")),le=we(()=>{let e=[{value:V.PUBLIC,label:"公开"},{value:V.PRIVATE,label:"私密"},{value:V.Following,label:"关注可见"}];return O&&e.push({value:V.FRIEND,label:"好友可见"}),e}),X=()=>{m.value=!m.value,m.value&&F.value&&(F.value=!1)},$=()=>{F.value=!F.value,F.value&&m.value&&(m.value=!1)},ee=be.debounce(e=>{Re({k:e}).then(t=>{let s=[];t.suggest.map(o=>{s.push({label:o,value:o})}),I.value=s,r.value=!1}).catch(t=>{r.value=!1})},200),ie=be.debounce(e=>{qe({k:e}).then(t=>{let s=[];t.suggest.map(o=>{s.push({label:o,value:o})}),I.value=s,r.value=!1}).catch(t=>{r.value=!1})},200),M=(e,t)=>{r.value||(r.value=!0,t==="@"?ee(e):ie(e))},re=e=>{e.length>B?U.value=e.substring(0,B):U.value=e},P=e=>{d.value=e},E=e=>{for(let c=0;c<e.length;c++){var t=e[c].name,s=t.split(".").slice(0,-1).join("."),o=t.split(".").pop();s.length>30&&(e[c].name=s.substring(0,18)+"..."+s.substring(s.length-9)+"."+o)}_.value=e},te=async e=>{var t,s,o,c,v;return d.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((t=e.file.file)==null?void 0:t.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):d.value==="image"&&((s=e.file.file)==null?void 0:s.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):d.value==="public/video"&&!["video/mp4","video/quicktime"].includes((o=e.file.file)==null?void 0:o.type)?(window.$message.warning("视频仅允许 mp4/mov 格式"),!1):d.value==="public/video"&&((c=e.file.file)==null?void 0:c.size)>104857600?(window.$message.warning("视频大小不能超过100MB"),!1):d.value==="attachment"&&!await kt(e.file.file)?(window.$message.warning("附件仅允许 zip 格式"),!1):d.value==="attachment"&&((v=e.file.file)==null?void 0:v.size)>104857600?(window.$message.warning("附件大小不能超过100MB"),!1):!0},ue=({file:e,event:t})=>{var s;try{let o=JSON.parse((s=t.target)==null?void 0:s.response);o.code===0&&(d.value==="public/image"&&D.value.push({id:e.id,content:o.data.content}),d.value==="public/video"&&G.value.push({id:e.id,content:o.data.content}),d.value==="attachment"&&N.value.push({id:e.id,content:o.data.content}))}catch{window.$message.error("上传失败")}},K=({file:e,event:t})=>{var s;try{let o=JSON.parse((s=t.target)==null?void 0:s.response);if(o.code!==0){let c=o.msg||"上传失败";o.details&&o.details.length>0&&o.details.map(v=>{c+=":"+v}),window.$message.error(c)}}catch{window.$message.error("上传失败")}},ce=({file:e})=>{let t=D.value.findIndex(s=>s.id===e.id);t>-1&&D.value.splice(t,1),t=G.value.findIndex(s=>s.id===e.id),t>-1&&G.value.splice(t,1),t=N.value.findIndex(s=>s.id===e.id),t>-1&&N.value.splice(t,1)},n=()=>{if(U.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{tags:e,users:t}=Ke(U.value);const s=[];let o=100;s.push({content:U.value,type:Q.TEXT,sort:o}),D.value.map(c=>{o++,s.push({content:c.content,type:Q.IMAGEURL,sort:o})}),G.value.map(c=>{o++,s.push({content:c.content,type:Q.VIDEOURL,sort:o})}),N.value.map(c=>{o++,s.push({content:c.content,type:Q.ATTACHMENT,sort:o})}),z.value.length>0&&z.value.map(c=>{o++,s.push({content:c,type:Q.LINKURL,sort:o})}),T.value=!0,Ge({contents:s,tags:Array.from(new Set(e)),users:Array.from(new Set(t)),attachment_price:+Y.value*100,visibility:f.value}).then(c=>{var v;window.$message.success("发布成功"),T.value=!1,R("post-success",c),m.value=!1,F.value=!1,(v=q.value)==null||v.clear(),_.value=[],U.value="",z.value=[],D.value=[],G.value=[],N.value=[],f.value=g.value}).catch(c=>{T.value=!1})},u=e=>{C.commit("triggerAuth",!0),C.commit("triggerAuthKey",e)};return Ie(()=>{const e="friend".toLowerCase();O&&e==="friend"?g.value=V.FRIEND:e==="following"?g.value=V.Following:e==="public"?g.value=V.PUBLIC:g.value=V.PRIVATE,f.value=g.value}),(e,t)=>{const s=De,o=Xe,c=$e,v=et,j=tt,pe=st,de=at,ve=nt,me=ot,_e=lt,fe=it,ge=Te,he=rt,w=ut;return p(),y("div",null,[A(C).state.userInfo.id>0?(p(),y("div",bt,[b("div",Ct,[b("div",It,[a(s,{round:"",size:30,src:A(C).state.userInfo.avatar},null,8,["src"])]),a(o,{type:"textarea",size:"large",autosize:"",bordered:!1,loading:r.value,value:U.value,prefix:["@","#"],options:I.value,onSearch:M,"onUpdate:value":re,placeholder:"说说您的新鲜事..."},null,8,["loading","value","options"])]),a(_e,{ref_key:"uploadRef",ref:q,abstract:"","list-type":"image",multiple:!0,max:9,action:ne,headers:{Authorization:oe.value},data:{type:d.value},"file-list":_.value,onBeforeUpload:te,onFinish:ue,onError:K,onRemove:ce,"onUpdate:fileList":E},{default:i(()=>[b("div",zt,[b("div",Dt,[a(j,{abstract:""},{default:i(({handleClick:h})=>[a(v,{disabled:_.value.length>0&&d.value==="public/video"||_.value.length===9,onClick:()=>{P("public/image"),h()},quaternary:"",circle:"",type:"primary"},{icon:i(()=>[a(c,{size:"20",color:"var(--primary-color)"},{default:i(()=>[a(A(je))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),W.value?(p(),x(j,{key:0,abstract:""},{default:i(({handleClick:h})=>[a(v,{disabled:_.value.length>0&&d.value!=="public/video"||_.value.length===9,onClick:()=>{P("public/video"),h()},quaternary:"",circle:"",type:"primary"},{icon:i(()=>[a(c,{size:"20",color:"var(--primary-color)"},{default:i(()=>[a(A(Qe))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):k("",!0),Z.value?(p(),x(j,{key:1,abstract:""},{default:i(({handleClick:h})=>[a(v,{disabled:_.value.length>0&&d.value==="public/video"||_.value.length===9,onClick:()=>{P("attachment"),h()},quaternary:"",circle:"",type:"primary"},{icon:i(()=>[a(c,{size:"20",color:"var(--primary-color)"},{default:i(()=>[a(A(He))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):k("",!0),a(v,{quaternary:"",circle:"",type:"primary",onClick:ke(X,["stop"])},{icon:i(()=>[a(c,{size:"20",color:"var(--primary-color)"},{default:i(()=>[a(A(Ze))]),_:1})]),_:1},8,["onClick"]),ae.value?(p(),x(v,{key:2,quaternary:"",circle:"",type:"primary",onClick:ke($,["stop"])},{icon:i(()=>[a(c,{size:"20",color:"var(--primary-color)"},{default:i(()=>[a(A(Je))]),_:1})]),_:1},8,["onClick"])):k("",!0)]),b("div",Tt,[a(de,{trigger:"hover",placement:"bottom"},{trigger:i(()=>[a(pe,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:U.value.length/A(B)*100},null,8,["percentage"])]),default:i(()=>[S(" "+se(U.value.length)+" / "+se(A(B)),1)]),_:1}),a(v,{loading:T.value,onClick:n,type:"primary",secondary:"",round:""},{default:i(()=>[S(" 发布 ")]),_:1},8,["loading"])])]),b("div",Ut,[a(ve),N.value.length>0?(p(),y("div",Bt,[J.value?(p(),x(me,{key:0,value:Y.value,"onUpdate:value":t[0]||(t[0]=h=>Y.value=h),min:0,max:1e5,placeholder:"请输入附件价格,0为免费附件"},{prefix:i(()=>[Et]),_:1},8,["value"])):k("",!0)])):k("",!0)])]),_:1},8,["headers","data","file-list"]),F.value?(p(),y("div",Vt,[a(he,{value:f.value,"onUpdate:value":t[1]||(t[1]=h=>f.value=h),name:"radiogroup"},{default:i(()=>[a(ge,null,{default:i(()=>[(p(!0),y(ye,null,Ae(le.value,h=>(p(),x(fe,{key:h.value,value:h.value,label:h.label},null,8,["value","label"]))),128))]),_:1})]),_:1},8,["value"])])):k("",!0),m.value?(p(),y("div",xt,[a(w,{value:z.value,"onUpdate:value":t[2]||(t[2]=h=>z.value=h),placeholder:"请输入以http(s)://开头的链接",min:0,max:3},{"create-button-default":i(()=>[S(" 创建链接 ")]),_:1},8,["value"])])):k("",!0)])):(p(),y("div",Ft,[Nt,L.value?k("",!0):(p(),y("div",Rt,[a(v,{strong:"",secondary:"",round:"",type:"primary",onClick:t[3]||(t[3]=h=>u("signin"))},{default:i(()=>[S(" 登录 ")]),_:1})])),L.value?(p(),y("div",qt,[a(v,{strong:"",secondary:"",round:"",type:"primary",onClick:t[4]||(t[4]=h=>u("signin"))},{default:i(()=>[S(" 登录 ")]),_:1}),a(v,{strong:"",secondary:"",round:"",type:"info",onClick:t[5]||(t[5]=h=>u("signup"))},{default:i(()=>[S(" 注册 ")]),_:1})])):k("",!0)]))])}}});const Ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA1lSURBVHgB7Z17cFTVHcd/59y7uze7ISSCqBBIeGmFIGilrVJUwBcw0jKgnc6Ijsr0D8eO1qrt+Kio9fEHRR1n7ExH8IEzdmgZWluxPnhYijJCkZQAtoSQmARaHk2A3WSzu/ec/n6XJpLdu5u9u/eVx2dmJ/u4m909v3N+v/P7nhcDn7JunVSm3xiv0kLabCnERGBQLoGNlQDnM5D0dzQDUOlavJ/C+0cA2BF8rR6fasMn2xnnhzri8U++Ua61MMZS4EMY+AQppXo4lpqjKHyOkHIWfrVrwE4k+wCYrFU433zsJGy7cgzrAB/gqQHq6mSwdCIsk1LchLV4cXeNdgUJbwHjG2NReK9mFIuCR3higINnuqaqqvpTKWGZq4VuguG+JLymBPiacUG2E1zGNQOsWCH5nY/ot+IHPoS+/ErwIRg/doGivFAdYuvBJVwxQEMstYgz9iLWtgnQD2AM6oDzFW4YwlEDNES7LuNcWe3XGt838lPGlMerS9gWcAhHDHDwpCxTNLEKa9I9MADAQloZjfKnnAjWthvgUDQ5D7t6b6C7qYQBBLklBvyBqhK2CWyEg01QkG2I6Y9zzj8eaIVPYI+tRkjxcWOn/hj9VrAJW1rA4TZZDiH9ffx334FBAGbVn8k4WzC+grVDkRRtSezTT5EhsWewFD6BWftVEBTbG7vkpVAkRbWAxjPJOVLhG/GuBoOTOAd+Q1WY/Q0KpOAW0ByXC4TCP4TBW/iEpoPY8lVcLoICKagF0AfqQvwRhugBldeF1RrbaPFt1g3QcDo5G1S+2WsNx28YmhLjN4wvYVutvM+SASjgqor6dxjcbicXcabwK1DCOJDvG/KOAdTVVLn6Oxgq/FxoIORG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99mIKn7DvKMMgHXEySE7Tw35+e0KZf7kfjjIk6EzF6rAyazBkzJThvom/1Y7CJ2zXDJs65TxdiJdQRR1Qp26gy2lBbefOvo4ksYrt08NI/+iI8atIhoUBAg4nrtY726faXfiEo6o5KqlzpNR/iR/j6VkEhYJDs7sCUrk72+kXduDKsEVjh1wipFjRX9wSDsceYpw9UKWxP4PDuDJDtTrM1k+IKNMYcDqbwLdjzfTdUE74wRsl7GI3Cp/wZOCOtsk3dmqXxnCn1we/JLEU3kZ5ZWVViLmez3g6cko7tkdK9YVoiAWYQyxz8fvQksA/4Kd90HFIWVtTwzzb2sU3O2q0tspwYjjMBi5wCFROZ4zdCPZ9P+zIyG1Msu2Yq2wZH1G30Pos8AG+3dKENrdujMcr0UNda+wuCFAuGFTggNAkCYw2mboIvp5WQzv6HMV3NePzx7GgmwVAO63DTUByW62mNd1mLEb0H/8DkOAXi0+nceAAAAAASUVORK5CYII=",Pt="/assets/discover-tweets-ab101944.jpeg",St="/assets/following-tweets-e36b4410.jpeg",Yt={class:"slide-bar-item"},Lt={class:"slide-bar-item-title slide-bar-user-link"},Mt={key:1,class:"skeleton-wrap"},Wt={key:0,class:"empty-wrap"},Kt={key:1},jt={key:2},Qt={class:"load-more-wrap"},Ht={class:"load-more-spinner"},Zt=Ce({__name:"Home",setup(H){const R="true".toLowerCase()==="true",C="true".toLowerCase()==="true",I=ze(),r=ht(),T=wt(),m=ct(),F=l(9),U=l(8),z=l([{title:"最新动态",style:1,username:"",avatar:Ot,show:!0},{title:"热门推荐",style:2,username:"",avatar:Pt,show:!1},{title:"正在关注",style:3,username:"",avatar:St,show:!1},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0}]),q=Fe({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!1,is_following:!1,created_on:0,follows:0,followings:0,status:1}),Y=l(null),d=l("泡泡广场"),_=l(!1),D=l(!1),G=l(1),N=l(""),f=l([]),g=l(1),O=l(20),B=l(0),L=l(!1),W=l(!1),Z=l({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1}),J=n=>{Z.value=n,L.value=!0},ae=()=>{L.value=!1},ne=()=>{W.value=!0},oe=n=>{m.warning({title:"删除好友",content:"将好友 “"+n.user.nickname+"” 删除,将同时删除 点赞/收藏 列表中关于该朋友的 “好友可见” 推文",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{Me({user_id:q.id}).then(u=>{window.$message.success("操作成功"),n.user.is_friend=!1}).catch(u=>{})}})},le=()=>{W.value=!1,Y.value=null},X=n=>{Y.value=n,q.id=n.user.id,q.username=n.user.username,q.nickname=n.user.nickname,n.user.is_friend?oe(n):ne()},$=n=>{m.success({title:"提示",content:"确定"+(n.user.is_following?"取消关注":"关注")+"该用户吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{n.user.is_following?Ye({user_id:n.user.id}).then(u=>{window.$message.success("操作成功"),n.user.is_following=!1}).catch(u=>{}):Le({user_id:n.user.id}).then(u=>{window.$message.success("关注成功"),n.user.is_following=!0}).catch(u=>{})}})},ee=()=>{d.value="泡泡广场",r.query&&r.query.q&&(r.query.t&&r.query.t==="tag"?d.value="#"+decodeURIComponent(r.query.q):d.value="搜索: "+decodeURIComponent(r.query.q))},ie=we(()=>R&&C&&I.state.desktopModelShow&&I.state.userInfo.id>0),M=()=>{_.value=!1,D.value=!1,f.value=[],g.value=1,B.value=0},re=(n,u)=>{switch(M(),G.value=n.style,r.query.q&&(r.query.q=null,ee()),n.style){case 1:E("newest");break;case 2:E("hots");break;case 3:r.query.q=null,E("following");break;case 21:N.value=n.username,te();break}z.value[u].show=!1},P=()=>{z.value=z.value.slice(0,3),!(!R||!C||I.state.userInfo.id===0)&&Oe({page:1,page_size:50}).then(n=>{var u=0;const e=n.list||[];let t=[];for(;u<e.length;u++){let s=e[u];t.push({title:s.nickname,style:21,username:s.username,avatar:s.avatar,show:!1})}t.length>0&&(z.value=z.value.concat(t))}).catch(n=>{console.log(n)})},E=n=>{_.value=!0,Pe({query:r.query.q?decodeURIComponent(r.query.q):null,type:r.query.t,style:n,page:g.value,page_size:O.value}).then(u=>{_.value=!1,u.list.length===0&&(D.value=!0),g.value>1?f.value=f.value.concat(u.list):(f.value=u.list,window.scrollTo(0,0)),B.value=Math.ceil(u.pager.total_rows/O.value)}).catch(u=>{_.value=!1,g.value>1&&g.value--})},te=()=>{_.value=!0,Se({username:N.value,style:"post",page:g.value,page_size:O.value}).then(n=>{_.value=!1,n.list.length===0&&(D.value=!0),g.value>1?f.value=f.value.concat(n.list):(f.value=n.list||[],window.scrollTo(0,0)),B.value=Math.ceil(n.pager.total_rows/O.value)}).catch(n=>{f.value=[],g.value>1&&g.value--,_.value=!1})},ue=n=>{T.push({name:"post",query:{id:n.id}})},K=()=>{switch(G.value){case 1:E("newest");break;case 2:E("hots");break;case 3:E("following");break;case 21:r.query.q?E("search"):te();break}},ce=()=>{g.value<B.value||B.value==0?(D.value=!1,g.value++,K()):D.value=!0};return Ie(()=>{M(),P(),E("newest")}),Ne(()=>({path:r.path,query:r.query,refresh:I.state.refresh}),(n,u)=>{if(ee(),n.refresh!==u.refresh){M(),setTimeout(()=>{P(),K()},0);return}u.path!=="/post"&&n.path==="/"&&(M(),setTimeout(()=>{P(),K()},0))}),(n,u)=>{const e=gt,t=Gt,s=dt,o=De,c=vt,v=mt,j=xe,pe=_t,de=Ee,ve=Ve,me=Be,_e=Ue,fe=pt,ge=ft,he=Te;return p(),y("div",null,[a(e,{title:d.value},null,8,["title"]),a(fe,{class:"main-content-wrap",bordered:""},{default:i(()=>[a(s,null,{default:i(()=>[a(t,{onPostSuccess:ue})]),_:1}),ie.value?(p(),x(s,{key:0},{default:i(()=>[a(A(At),{modelValue:z.value,"onUpdate:modelValue":u[0]||(u[0]=w=>z.value=w),"wheel-blocks":U.value,"init-blocks":F.value,onClick:re,tag:"div","sub-tag":"div"},{default:i(w=>[b("div",Yt,[a(c,{value:"1",offset:[-4,48],dot:"",show:w.slotData.show},{default:i(()=>[a(o,{round:"",size:48,src:w.slotData.avatar,class:"slide-bar-item-avatar"},null,8,["src"])]),_:2},1032,["show"]),b("div",Lt,[a(v,{"line-clamp":2},{default:i(()=>[S(se(w.slotData.title),1)]),_:2},1024)])])]),_:1},8,["modelValue","wheel-blocks","init-blocks"])]),_:1})):k("",!0),_.value&&f.value.length===0?(p(),y("div",Mt,[a(j,{num:O.value},null,8,["num"])])):k("",!0),b("div",null,[f.value.length===0?(p(),y("div",Wt,[a(pe,{size:"large",description:"暂无数据"})])):k("",!0),A(I).state.desktopModelShow?(p(),y("div",Kt,[(p(!0),y(ye,null,Ae(f.value,w=>(p(),x(s,{key:w.id},{default:i(()=>[a(de,{post:w,isOwner:A(I).state.userInfo.id==w.user_id,addFollowAction:!0,onSendWhisper:J,onHandleFollowAction:$,onHandleFriendAction:X},null,8,["post","isOwner"])]),_:2},1024))),128))])):(p(),y("div",jt,[(p(!0),y(ye,null,Ae(f.value,w=>(p(),x(s,{key:w.id},{default:i(()=>[a(ve,{post:w,isOwner:A(I).state.userInfo.id==w.user_id,addFollowAction:!0,onSendWhisper:J,onHandleFollowAction:$,onHandleFriendAction:X},null,8,["post","isOwner"])]),_:2},1024))),128))]))]),a(me,{show:L.value,user:Z.value,onSuccess:ae},null,8,["show","user"]),a(_e,{show:W.value,user:q,onSuccess:le},null,8,["show","user"])]),_:1}),B.value>0?(p(),x(he,{key:0,justify:"center"},{default:i(()=>[a(A(yt),{class:"load-more",slots:{complete:"没有更多泡泡了",error:"加载出错"},onInfinite:u[1]||(u[1]=w=>ce())},{spinner:i(()=>[b("div",Qt,[D.value?k("",!0):(p(),x(ge,{key:0,size:14})),b("span",Ht,se(D.value?"没有更多泡泡了":"加载更多"),1)])]),_:1})]),_:1})):k("",!0)])}}});const Rs=We(Zt,[["__scopeId","data-v-c53a3615"]]);export{Rs as default};
|