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