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-a4b26d35.js

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