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/Home-7cea53ff.js

2 lines
22 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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