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/Post-3847dd98.js

2 lines
26 KiB

import{d as Q,r as u,a1 as de,o as n,c,a as v,L as t,$ as a,e as z,M as U,K as P,O as i,Y as e,a0 as V,n as ae,a6 as Ue,F as le,a2 as ie,j as me,U as ge,V as ye,w as Pe}from"./@vue-ca177dbe.js";import{u as ee}from"./vuex-d28e9067.js";import{f as ce}from"./formatTime-000dbebb.js";import{t as Re,d as Se,e as Le,_ as te,f as Ae,h as De,i as Me,j as Oe,g as qe,k as je,l as Be,m as Ee,n as Ne,o as Ve,s as He,v as Fe,p as Ye,q as Ke,r as Je,u as he}from"./index-e8d61d32.js";import{Y as ue,V as Z}from"./IEnum-a180d93e.js";import{T as ke,e as re,f as we,g as _e,h as be,I as Ge,i as Qe,j as We,k as Xe,l as Ze,m as et,n as tt,o as st}from"./@vicons-6d35273b.js";import{j as se,e as oe,J as $e,b as ot,K as nt,o as ve,L as Ce,v as at,w as lt,x as it,y as ct,z as ut,B as rt,M as _t,O as pt,i as dt,P as mt,a as xe,F as vt,I as ft,k as ht,H as gt,f as yt,g as kt}from"./naive-ui-2035804c.js";import{p as fe,_ as Ie,a as wt,b as bt,c as $t}from"./content-fb362960.js";import{u as Te,b as Ct}from"./vue-router-88cc84d1.js";import{_ as xt}from"./post-skeleton-fb7a0256.js";import{l as It}from"./lodash-94eb5868.js";import{a as Tt}from"./copy-to-clipboard-1dd3075d.js";import{_ as zt}from"./main-nav.vue_vue_type_style_index_0_lang-00f98810.js";import{K as Ut}from"./v3-infinite-loading-fcb59c38.js";import"./moment-b7869f98.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./evtd-b614532e.js";import"./@css-render-480a363d.js";import"./vooks-2c48c2b5.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"./nonesir-video-db921567.js";import"./toggle-selection-93f4ad84.js";const Pt={class:"reply-item"},Rt={class:"header-wrap"},St={class:"username"},Lt={class:"reply-name"},At={class:"timestamp"},Dt={class:"base-wrap"},Mt={class:"content"},Ot={class:"reply-switch"},qt={class:"time-item"},jt={class:"actions"},Bt={class:"upvote-count"},Et=["onClick"],Nt={class:"upvote-count"},Vt={key:2,class:"action-item"},Ht=["onClick"],Ft=Q({__name:"reply-item",props:{tweetId:null,reply:null},emits:["focusReply","reload"],setup(A,{emit:q}){const l=A,r=ee(),g=u(l.reply.is_thumbs_up==ue.YES),k=u(l.reply.is_thumbs_down==ue.YES),w=u(l.reply.thumbs_up_count),S=()=>{Re({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(y=>{g.value=!g.value,g.value?(w.value++,k.value=!1):w.value--}).catch(y=>{console.log(y)})},_=()=>{Se({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(y=>{k.value=!k.value,k.value&&g.value&&(w.value--,g.value=!1)}).catch(y=>{console.log(y)})},I=()=>{q("focusReply",l.reply)},f=()=>{Le({id:l.reply.id}).then(y=>{window.$message.success("删除成功"),setTimeout(()=>{q("reload")},50)}).catch(y=>{console.log(y)})};return(y,R)=>{const s=de("router-link"),h=se,b=oe,C=$e;return n(),c("div",Pt,[v("div",Rt,[v("div",St,[t(s,{class:"user-link",to:{name:"user",query:{username:l.reply.user.username}}},{default:a(()=>[z(U(l.reply.user.username),1)]),_:1},8,["to"]),v("span",Lt,U(l.reply.at_user_id>0?"回复":":"),1),l.reply.at_user_id>0?(n(),P(s,{key:0,class:"user-link",to:{name:"user",query:{username:l.reply.at_user.username}}},{default:a(()=>[z(U(l.reply.at_user.username),1)]),_:1},8,["to"])):i("",!0)]),v("div",At,[z(U(l.reply.ip_loc)+" ",1),e(r).state.userInfo.is_admin||e(r).state.userInfo.id===l.reply.user.id?(n(),P(C,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:f},{trigger:a(()=>[t(b,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:a(()=>[t(h,null,{default:a(()=>[t(e(ke))]),_:1})]),_:1})]),default:a(()=>[z(" 是否确认删除? ")]),_:1})):i("",!0)])]),v("div",Dt,[v("div",Mt,U(l.reply.content),1),v("div",Ot,[v("span",qt,U(e(ce)(l.reply.created_on)),1),v("div",jt,[e(r).state.userLogined?i("",!0):(n(),c("div",{key:0,class:"action-item",onClick:R[0]||(R[0]=V(()=>{},["stop"]))},[t(h,{size:"medium"},{default:a(()=>[t(e(re))]),_:1}),v("span",Bt,U(w.value),1)])),e(r).state.userLogined?(n(),c("div",{key:1,class:"action-item hover",onClick:V(S,["stop"])},[t(h,{size:"medium"},{default:a(()=>[g.value?i("",!0):(n(),P(e(re),{key:0})),g.value?(n(),P(e(we),{key:1,class:"show"})):i("",!0)]),_:1}),v("span",Nt,U(w.value),1)],8,Et)):i("",!0),e(r).state.userLogined?i("",!0):(n(),c("div",Vt,[t(h,{size:"medium"},{default:a(()=>[t(e(_e))]),_:1})])),e(r).state.userLogined?(n(),c("div",{key:3,class:"action-item hover",onClick:V(_,["stop"])},[t(h,{size:"medium"},{default:a(()=>[k.value?i("",!0):(n(),P(e(_e),{key:0})),k.value?(n(),P(e(be),{key:1,class:"show"})):i("",!0)]),_:1})],8,Ht)):i("",!0),e(r).state.userLogined?(n(),c("span",{key:4,class:"show opacity-item reply-btn",onClick:I}," 回复 ")):i("",!0)])])])])}}});const Yt=te(Ft,[["__scopeId","data-v-783f5693"]]),Kt={class:"reply-compose-wrap"},Jt={class:"reply-switch"},Gt={class:"time-item"},Qt={class:"actions"},Wt={key:0,class:"action-item"},Xt={class:"upvote-count"},Zt=["onClick"],es={class:"upvote-count"},ts={key:2,class:"action-item"},ss=["onClick"],os={key:0,class:"reply-input-wrap"},ns=Q({__name:"compose-reply",props:{comment:null,atUserid:{default:0},atUsername:{default:""}},emits:["reload","reset"],setup(A,{expose:q,emit:l}){const r=A,g=ee(),k=u(),w=u(!1),S=u(""),_=u(!1),I=u(r.comment.is_thumbs_up==ue.YES),f=u(r.comment.is_thumbs_down==ue.YES),y=u(r.comment.thumbs_up_count),R=()=>{Ae({tweet_id:r.comment.post_id,comment_id:r.comment.id}).then(C=>{I.value=!I.value,I.value?(y.value++,f.value=!1):y.value--}).catch(C=>{console.log(C)})},s=()=>{De({tweet_id:r.comment.post_id,comment_id:r.comment.id}).then(C=>{f.value=!f.value,f.value&&I.value&&(y.value--,I.value=!1)}).catch(C=>{console.log(C)})},h=C=>{w.value=C,C?setTimeout(()=>{var T;(T=k.value)==null||T.focus()},10):(_.value=!1,S.value="",l("reset"))},b=()=>{_.value=!0,Me({comment_id:r.comment.id,at_user_id:r.atUserid,content:S.value}).then(C=>{h(!1),window.$message.success("评论成功"),l("reload")}).catch(C=>{_.value=!1})};return q({switchReply:h}),(C,T)=>{const M=se,j=ot,Y=oe,E=nt;return n(),c("div",Kt,[v("div",Jt,[v("span",Gt,U(e(ce)(A.comment.created_on)),1),v("div",Qt,[e(g).state.userLogined?i("",!0):(n(),c("div",Wt,[t(M,{size:"medium"},{default:a(()=>[t(e(re))]),_:1}),v("span",Xt,U(y.value),1)])),e(g).state.userLogined?(n(),c("div",{key:1,class:"action-item hover",onClick:V(R,["stop"])},[t(M,{size:"medium"},{default:a(()=>[I.value?i("",!0):(n(),P(e(re),{key:0})),I.value?(n(),P(e(we),{key:1,class:"show"})):i("",!0)]),_:1}),v("span",es,U(y.value),1)],8,Zt)):i("",!0),e(g).state.userLogined?i("",!0):(n(),c("div",ts,[t(M,{size:"medium"},{default:a(()=>[t(e(_e))]),_:1})])),e(g).state.userLogined?(n(),c("div",{key:3,class:"action-item hover",onClick:V(s,["stop"])},[t(M,{size:"medium"},{default:a(()=>[f.value?i("",!0):(n(),P(e(_e),{key:0})),f.value?(n(),P(e(be),{key:1,class:"show"})):i("",!0)]),_:1})],8,ss)):i("",!0),e(g).state.userLogined&&!w.value?(n(),c("span",{key:4,class:"show reply-btn",onClick:T[0]||(T[0]=N=>h(!0))}," 回复 ")):i("",!0),e(g).state.userLogined&&w.value?(n(),c("span",{key:5,class:"hide reply-btn",onClick:T[1]||(T[1]=N=>h(!1))}," 取消 ")):i("",!0)])]),w.value?(n(),c("div",os,[t(E,null,{default:a(()=>[t(j,{ref_key:"inputInstRef",ref:k,size:"small",placeholder:r.atUsername?"@"+r.atUsername:"请输入回复内容..",maxlength:"100",value:S.value,"onUpdate:value":T[2]||(T[2]=N=>S.value=N),"show-count":"",clearable:""},null,8,["placeholder","value"]),t(Y,{type:"primary",size:"small",ghost:"",loading:_.value,onClick:b},{default:a(()=>[z(" 回复 ")]),_:1},8,["loading"])]),_:1})])):i("",!0)])}}});const as=te(ns,[["__scopeId","data-v-0f1721e2"]]),ls={class:"comment-item"},is={class:"nickname-wrap"},cs={class:"username-wrap"},us={class:"opt-wrap"},rs={class:"timestamp"},_s=["innerHTML"],ps={class:"reply-wrap"},ds=Q({__name:"comment-item",props:{comment:null},emits:["reload"],setup(A,{emit:q}){const l=A,r=ee(),g=Te(),k=u(0),w=u(""),S=u(),_=ae(()=>{let h=Object.assign({texts:[],imgs:[]},l.comment);return h.contents.map(b=>{(+b.type==1||+b.type==2)&&h.texts.push(b),+b.type==3&&h.imgs.push(b)}),h}),I=(h,b)=>{let C=h.target;if(C.dataset.detail){const T=C.dataset.detail.split(":");T.length===2&&(r.commit("refresh"),T[0]==="tag"?window.$message.warning("评论内的无效话题"):g.push({name:"user",query:{username:T[1]}}))}},f=h=>{var b,C;k.value=h.user_id,w.value=((b=h.user)==null?void 0:b.username)||"",(C=S.value)==null||C.switchReply(!0)},y=()=>{q("reload")},R=()=>{k.value=0,w.value=""},s=()=>{Oe({id:_.value.id}).then(h=>{window.$message.success("删除成功"),setTimeout(()=>{y()},50)}).catch(h=>{})};return(h,b)=>{const C=ve,T=de("router-link"),M=se,j=oe,Y=$e,E=Ie,N=as,L=Yt,D=Ce;return n(),c("div",ls,[t(D,{"content-indented":""},Ue({avatar:a(()=>[t(C,{round:"",size:30,src:e(_).user.avatar},null,8,["src"])]),header:a(()=>[v("span",is,[t(T,{onClick:b[0]||(b[0]=V(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e(_).user.username}}},{default:a(()=>[z(U(e(_).user.nickname),1)]),_:1},8,["to"])]),v("span",cs," @"+U(e(_).user.username),1)]),"header-extra":a(()=>[v("div",us,[v("span",rs,U(e(_).ip_loc),1),e(r).state.userInfo.is_admin||e(r).state.userInfo.id===e(_).user.id?(n(),P(Y,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:s},{trigger:a(()=>[t(j,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:a(()=>[t(M,null,{default:a(()=>[t(e(ke))]),_:1})]),_:1})]),default:a(()=>[z(" 是否确认删除? ")]),_:1})):i("",!0)])]),footer:a(()=>[e(_).imgs.length>0?(n(),P(E,{key:0,imgs:e(_).imgs},null,8,["imgs"])):i("",!0),t(N,{ref_key:"replyComposeRef",ref:S,comment:e(_),"at-userid":k.value,"at-username":w.value,onReload:y,onReset:R},null,8,["comment","at-userid","at-username"]),v("div",ps,[(n(!0),c(le,null,ie(e(_).replies,o=>(n(),P(L,{key:o.id,reply:o,"tweet-id":e(_).post_id,onFocusReply:f,onReload:y},null,8,["reply","tweet-id"]))),128))])]),_:2},[e(_).texts.length>0?{name:"description",fn:a(()=>[(n(!0),c(le,null,ie(e(_).texts,o=>(n(),c("span",{key:o.id,class:"comment-text",onClick:b[1]||(b[1]=V(p=>I(p,e(_).id),["stop"])),innerHTML:e(fe)(o.content).content},null,8,_s))),128))]),key:"0"}:void 0]),1024)])}}});const ms=te(ds,[["__scopeId","data-v-f206d4d8"]]),vs=A=>(ge("data-v-8d1782be"),A=A(),ye(),A),fs={key:0,class:"compose-wrap"},hs={class:"compose-line"},gs={class:"compose-user"},ys={class:"compose-line compose-options"},ks={class:"attachment"},ws={class:"submit-wrap"},bs={class:"attachment-list-wrap"},$s={key:1,class:"compose-wrap"},Cs=vs(()=>v("div",{class:"login-wrap"},[v("span",{class:"login-banner"}," 登录后,精彩更多")],-1)),xs={key:0,class:"login-only-wrap"},Is={key:1,class:"login-wrap"},Ts=Q({__name:"compose-comment",props:{lock:{default:0},postId:{default:0}},emits:["post-success"],setup(A,{emit:q}){const l=A,r=ee(),g=u([]),k=u(!1),w=u(!1),S=u(!1),_=u(""),I=u(),f=u("public/image"),y=u([]),R=u([]),s=u("true".toLowerCase()==="true"),h="/v1/attachment",b=u(),C=It.debounce(d=>{qe({k:d}).then(m=>{let $=[];m.suggest.map(x=>{$.push({label:x,value:x})}),g.value=$,w.value=!1}).catch(m=>{w.value=!1})},200),T=(d,m)=>{w.value||(w.value=!0,m==="@"&&C(d))},M=d=>{d.length>200||(_.value=d)},j=d=>{f.value=d},Y=d=>{for(let O=0;O<d.length;O++){var m=d[O].name,$=m.split(".").slice(0,-1).join("."),x=m.split(".").pop();$.length>30&&(d[O].name=$.substring(0,18)+"..."+$.substring($.length-9)+"."+x)}y.value=d},E=async d=>{var m,$;return f.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((m=d.file.file)==null?void 0:m.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):f.value==="image"&&(($=d.file.file)==null?void 0:$.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):!0},N=({file:d,event:m})=>{var $;try{let x=JSON.parse(($=m.target)==null?void 0:$.response);x.code===0&&f.value==="public/image"&&R.value.push({id:d.id,content:x.data.content})}catch{window.$message.error("上传失败")}},L=({file:d,event:m})=>{var $;try{let x=JSON.parse(($=m.target)==null?void 0:$.response);if(x.code!==0){let O=x.msg||"上传失败";x.details&&x.details.length>0&&x.details.map(B=>{O+=":"+B}),window.$message.error(O)}}catch{window.$message.error("上传失败")}},D=({file:d})=>{let m=R.value.findIndex($=>$.id===d.id);m>-1&&R.value.splice(m,1)},o=()=>{k.value=!0},p=()=>{var d;k.value=!1,(d=I.value)==null||d.clear(),y.value=[],_.value="",R.value=[]},H=()=>{if(_.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{users:d}=fe(_.value);const m=[];let $=100;m.push({content:_.value,type:2,sort:$}),R.value.map(x=>{$++,m.push({content:x.content,type:3,sort:$})}),S.value=!0,je({contents:m,post_id:l.postId,users:Array.from(new Set(d))}).then(x=>{window.$message.success("发布成功"),S.value=!1,q("post-success"),p()}).catch(x=>{S.value=!1})},K=d=>{r.commit("triggerAuth",!0),r.commit("triggerAuthKey",d)};return me(()=>{b.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(d,m)=>{const $=ve,x=at,O=se,B=oe,W=lt,X=it,J=ct,ne=ut,pe=rt;return n(),c("div",null,[e(r).state.userInfo.id>0?(n(),c("div",fs,[v("div",hs,[v("div",gs,[t($,{round:"",size:30,src:e(r).state.userInfo.avatar},null,8,["src"])]),t(x,{type:"textarea",size:"large",autosize:"",bordered:!1,options:g.value,prefix:["@"],loading:w.value,value:_.value,disabled:l.lock===1,"onUpdate:value":M,onSearch:T,onFocus:o,placeholder:l.lock===1?"泡泡已被锁定,回复功能已关闭":"快来评论两句吧..."},null,8,["options","loading","value","disabled","placeholder"])]),k.value?(n(),P(pe,{key:0,ref_key:"uploadRef",ref:I,abstract:"","list-type":"image",multiple:!0,max:9,action:h,headers:{Authorization:b.value},data:{type:f.value},"file-list":y.value,onBeforeUpload:E,onFinish:N,onError:L,onRemove:D,"onUpdate:fileList":Y},{default:a(()=>[v("div",ys,[v("div",ks,[t(W,{abstract:""},{default:a(({handleClick:G})=>[t(B,{disabled:y.value.length>0&&f.value==="public/video"||y.value.length===9,onClick:()=>{j("public/image"),G()},quaternary:"",circle:"",type:"primary"},{icon:a(()=>[t(O,{size:"20",color:"var(--primary-color)"},{default:a(()=>[t(e(Ge))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),t(J,{trigger:"hover",placement:"bottom"},{trigger:a(()=>[t(X,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:_.value.length/200*100},null,8,["percentage"])]),default:a(()=>[z(" "+U(_.value.length)+" / 200 ",1)]),_:1})]),v("div",ws,[t(B,{quaternary:"",round:"",type:"tertiary",class:"cancel-btn",size:"small",onClick:p},{default:a(()=>[z(" 取消 ")]),_:1}),t(B,{loading:S.value,onClick:H,type:"primary",secondary:"",size:"small",round:""},{default:a(()=>[z(" 发布 ")]),_:1},8,["loading"])])]),v("div",bs,[t(ne)])]),_:1},8,["headers","data","file-list"])):i("",!0)])):(n(),c("div",$s,[Cs,s.value?i("",!0):(n(),c("div",xs,[t(B,{strong:"",secondary:"",round:"",type:"primary",onClick:m[0]||(m[0]=G=>K("signin"))},{default:a(()=>[z(" 登录 ")]),_:1})])),s.value?(n(),c("div",Is,[t(B,{strong:"",secondary:"",round:"",type:"primary",onClick:m[1]||(m[1]=G=>K("signin"))},{default:a(()=>[z(" 登录 ")]),_:1}),t(B,{strong:"",secondary:"",round:"",type:"info",onClick:m[2]||(m[2]=G=>K("signup"))},{default:a(()=>[z(" 注册 ")]),_:1})])):i("",!0)]))])}}});const zs=te(Ts,[["__scopeId","data-v-8d1782be"]]),Us={class:"username-wrap"},Ps={key:0,class:"options"},Rs={key:0},Ss=["innerHTML"],Ls={class:"timestamp"},As={key:0},Ds={key:1},Ms={class:"opts-wrap"},Os=["onClick"],qs={class:"opt-item"},js=["onClick"],Bs=["onClick"],Es=Q({__name:"post-detail",props:{post:null},emits:["reload"],setup(A,{emit:q}){const l=A,r=ee(),g=Te(),k=u(!1),w=u(!1),S=u(!1),_=u(!1),I=u(!1),f=u(!1),y=u(!1),R=u(Z.PUBLIC),s=ae({get:()=>{let o=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},l.post);return o.contents.map(p=>{(+p.type==1||+p.type==2)&&o.texts.push(p),+p.type==3&&o.imgs.push(p),+p.type==4&&o.videos.push(p),+p.type==6&&o.links.push(p),+p.type==7&&o.attachments.push(p),+p.type==8&&o.charge_attachments.push(p)}),o},set:o=>{l.post.upvote_count=o.upvote_count,l.post.comment_count=o.comment_count,l.post.collection_count=o.collection_count}}),h=ae(()=>{let o=[{label:"删除",key:"delete"}];return s.value.is_lock===0?o.push({label:"锁定",key:"lock"}):o.push({label:"解锁",key:"unlock"}),r.state.userInfo.is_admin&&(s.value.is_top===0?o.push({label:"置顶",key:"stick"}):o.push({label:"取消置顶",key:"unstick"})),s.value.visibility===Z.PUBLIC?o.push({label:"公开",key:"vpublic",children:[{label:"私密",key:"vprivate"},{label:"好友可见",key:"vfriend"}]}):s.value.visibility===Z.PRIVATE?o.push({label:"私密",key:"vprivate",children:[{label:"公开",key:"vpublic"},{label:"好友可见",key:"vfriend"}]}):o.push({label:"好友可见",key:"vfriend",children:[{label:"公开",key:"vpublic"},{label:"私密",key:"vprivate"}]}),o}),b=o=>{g.push({name:"post",query:{id:o}})},C=(o,p)=>{if(o.target.dataset.detail){const H=o.target.dataset.detail.split(":");if(H.length===2){r.commit("refresh"),H[0]==="tag"?g.push({name:"home",query:{q:H[1],t:"tag"}}):g.push({name:"user",query:{username:H[1]}});return}}b(p)},T=o=>{switch(o){case"delete":S.value=!0;break;case"lock":case"unlock":_.value=!0;break;case"stick":case"unstick":I.value=!0;break;case"vpublic":R.value=0,f.value=!0;break;case"vprivate":R.value=1,f.value=!0;break;case"vfriend":R.value=2,f.value=!0;break}},M=()=>{Ne({id:s.value.id}).then(o=>{window.$message.success("删除成功"),g.replace("/"),setTimeout(()=>{r.commit("refresh")},50)}).catch(o=>{y.value=!1})},j=()=>{Ve({id:s.value.id}).then(o=>{q("reload"),o.lock_status===1?window.$message.success("锁定成功"):window.$message.success("解锁成功")}).catch(o=>{y.value=!1})},Y=()=>{He({id:s.value.id}).then(o=>{q("reload"),o.top_status===1?window.$message.success("置顶成功"):window.$message.success("取消置顶成功")}).catch(o=>{y.value=!1})},E=()=>{Fe({id:s.value.id,visibility:R.value}).then(o=>{q("reload"),window.$message.success("修改可见性成功")}).catch(o=>{y.value=!1})},N=()=>{Ye({id:s.value.id}).then(o=>{k.value=o.status,o.status?s.value={...s.value,upvote_count:s.value.upvote_count+1}:s.value={...s.value,upvote_count:s.value.upvote_count-1}}).catch(o=>{console.log(o)})},L=()=>{Ke({id:s.value.id}).then(o=>{w.value=o.status,o.status?s.value={...s.value,collection_count:s.value.collection_count+1}:s.value={...s.value,collection_count:s.value.collection_count-1}}).catch(o=>{console.log(o)})},D=()=>{Tt(`${window.location.origin}/#/post?id=${s.value.id}`),window.$message.success("链接已复制到剪贴板")};return me(()=>{r.state.userInfo.id>0&&(Be({id:s.value.id}).then(o=>{k.value=o.status}).catch(o=>{console.log(o)}),Ee({id:s.value.id}).then(o=>{w.value=o.status}).catch(o=>{console.log(o)}))}),(o,p)=>{const H=ve,K=de("router-link"),d=_t,m=se,$=oe,x=pt,O=dt,B=wt,W=Ie,X=bt,J=$t,ne=mt,pe=xe,G=Ce;return n(),c("div",{class:"detail-item",onClick:p[6]||(p[6]=F=>b(e(s).id))},[t(G,null,{avatar:a(()=>[t(H,{round:"",size:30,src:e(s).user.avatar},null,8,["src"])]),header:a(()=>[t(K,{onClick:p[0]||(p[0]=V(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e(s).user.username}}},{default:a(()=>[z(U(e(s).user.nickname),1)]),_:1},8,["to"]),v("span",Us," @"+U(e(s).user.username),1),e(s).is_top?(n(),P(d,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:a(()=>[z(" 置顶 ")]),_:1})):i("",!0),e(s).visibility==e(Z).PRIVATE?(n(),P(d,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:a(()=>[z(" 私密 ")]),_:1})):i("",!0),e(s).visibility==e(Z).FRIEND?(n(),P(d,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:a(()=>[z(" 好友可见 ")]),_:1})):i("",!0)]),"header-extra":a(()=>[e(r).state.userInfo.is_admin||e(r).state.userInfo.id===e(s).user.id?(n(),c("div",Ps,[t(x,{placement:"bottom-end",trigger:"click",size:"small",options:e(h),onSelect:T},{default:a(()=>[t($,{quaternary:"",circle:""},{icon:a(()=>[t(m,null,{default:a(()=>[t(e(Qe))]),_:1})]),_:1})]),_:1},8,["options"])])):i("",!0),t(O,{show:S.value,"onUpdate:show":p[1]||(p[1]=F=>S.value=F),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定删除该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:M},null,8,["show"]),t(O,{show:_.value,"onUpdate:show":p[2]||(p[2]=F=>_.value=F),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(e(s).is_lock?"解锁":"锁定")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:j},null,8,["show","content"]),t(O,{show:I.value,"onUpdate:show":p[3]||(p[3]=F=>I.value=F),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(e(s).is_top?"取消置顶":"置顶")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:Y},null,8,["show","content"]),t(O,{show:f.value,"onUpdate:show":p[4]||(p[4]=F=>f.value=F),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定将该泡泡动态可见度修改为"+(R.value==0?"公开":R.value==1?"私密":"好友可见")+"吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:E},null,8,["show","content"])]),footer:a(()=>[t(B,{attachments:e(s).attachments},null,8,["attachments"]),t(B,{attachments:e(s).charge_attachments,price:e(s).attachment_price},null,8,["attachments","price"]),t(W,{imgs:e(s).imgs},null,8,["imgs"]),t(X,{videos:e(s).videos,full:!0},null,8,["videos"]),t(J,{links:e(s).links},null,8,["links"]),v("div",Ls,[z(" 发布于 "+U(e(ce)(e(s).created_on))+" ",1),e(s).ip_loc?(n(),c("span",As,[t(ne,{vertical:""}),z(" "+U(e(s).ip_loc),1)])):i("",!0),!e(r).state.collapsedLeft&&e(s).created_on!=e(s).latest_replied_on?(n(),c("span",Ds,[t(ne,{vertical:""}),z(" 最后回复 "+U(e(ce)(e(s).latest_replied_on)),1)])):i("",!0)])]),action:a(()=>[v("div",Ms,[t(pe,{justify:"space-between"},{default:a(()=>[v("div",{class:"opt-item hover",onClick:V(N,["stop"])},[t(m,{size:"20",class:"opt-item-icon"},{default:a(()=>[k.value?i("",!0):(n(),P(e(We),{key:0})),k.value?(n(),P(e(Xe),{key:1,color:"red"})):i("",!0)]),_:1}),z(" "+U(e(s).upvote_count),1)],8,Os),v("div",qs,[t(m,{size:"20",class:"opt-item-icon"},{default:a(()=>[t(e(Ze))]),_:1}),z(" "+U(e(s).comment_count),1)]),v("div",{class:"opt-item hover",onClick:V(L,["stop"])},[t(m,{size:"20",class:"opt-item-icon"},{default:a(()=>[w.value?i("",!0):(n(),P(e(et),{key:0})),w.value?(n(),P(e(tt),{key:1,color:"#ff7600"})):i("",!0)]),_:1}),z(" "+U(e(s).collection_count),1)],8,js),v("div",{class:"opt-item hover",onClick:V(D,["stop"])},[t(m,{size:"20",class:"opt-item-icon"},{default:a(()=>[t(e(st))]),_:1}),z(" "+U(e(s).share_count),1)],8,Bs)]),_:1})])]),default:a(()=>[e(s).texts.length>0?(n(),c("div",Rs,[(n(!0),c(le,null,ie(e(s).texts,F=>(n(),c("span",{key:F.id,class:"post-text",onClick:p[5]||(p[5]=V(ze=>C(ze,e(s).id),["stop"])),innerHTML:e(fe)(F.content).content},null,8,Ss))),128))])):i("",!0)]),_:1})])}}});const Ns=A=>(ge("data-v-0d01659f"),A=A(),ye(),A),Vs={key:0,class:"detail-wrap"},Hs={key:1,class:"empty-wrap"},Fs={key:0,class:"comment-opts-wrap"},Ys=Ns(()=>v("span",{class:"comment-title-item"},"评论",-1)),Ks={key:2},Js={key:0,class:"skeleton-wrap"},Gs={key:1},Qs={key:0,class:"empty-wrap"},Ws={key:0,class:"load-more-spinner"},Xs={key:1,class:"load-more-spinner"},Zs={key:2,class:"load-more-spinner"},eo={key:3,class:"load-more-spinner"},to=Q({__name:"Post",setup(A){const q=Ct(),l=u({}),r=u(!1),g=u(!1),k=u([]),w=ae(()=>+q.query.id),S=u("default"),_=u(!0),I=20;let f={loading(){},loaded(){},complete(){},error(){}};const y=L=>{S.value=L,L==="default"&&(_.value=!0),E(f)},R=()=>{l.value={id:0},r.value=!0,Je({id:w.value}).then(L=>{r.value=!1,l.value=L,E(f)}).catch(L=>{r.value=!1})};let s=1;const h=u(!1),b=u([]),C=L=>{h.value||he({id:l.value.id,sort_strategy:"default",page:s,page_size:I}).then(D=>{L!==null&&(f=L),D.list.length<I?h.value=!0:s++,D.list.length>0&&(s===1?b.value=D.list:b.value.push(...D.list),k.value=b.value),f.loaded(),g.value=!1}).catch(D=>{g.value=!1,f.error()})};let T=1,M=u(!1);const j=u([]),Y=L=>{M.value||he({id:l.value.id,sort_strategy:"newest",page:T,page_size:I}).then(D=>{L!==null&&(f=L),D.list.length<I?M.value=!0:T++,D.list.length>0&&(T===1?j.value=D.list:j.value.push(...D.list),k.value=j.value),f.loaded(),g.value=!1}).catch(D=>{g.value=!1,f.error()})},E=L=>{w.value<1||(k.value.length===0&&(g.value=!0),S.value==="default"?(k.value=b.value,C(L)):(k.value=j.value,Y(L)),g.value=!1)},N=()=>{s=1,h.value=!1,b.value=[],T=1,M.value=!1,j.value=[],E(f)};return me(()=>{R()}),Pe(w,()=>{w.value>0&&q.name==="post"&&R()}),(L,D)=>{const o=zt,p=Es,H=ft,K=ht,d=gt,m=yt,$=kt,x=zs,O=xt,B=ms,W=xe,X=vt;return n(),c("div",null,[t(o,{title:"泡泡详情",back:!0}),t(X,{class:"main-content-wrap",bordered:""},{default:a(()=>[t(d,null,{default:a(()=>[t(K,{show:r.value},{default:a(()=>[l.value.id>1?(n(),c("div",Vs,[t(p,{post:l.value,onReload:R},null,8,["post"])])):(n(),c("div",Hs,[t(H,{size:"large",description:"暂无数据"})]))]),_:1},8,["show"])]),_:1}),l.value.id>0?(n(),c("div",Fs,[t($,{type:"bar","justify-content":"end",size:"small",animated:"","onUpdate:value":y},{prefix:a(()=>[Ys]),default:a(()=>[t(m,{name:"default",tab:"默认"}),t(m,{name:"newest",tab:"最新"})]),_:1})])):i("",!0),l.value.id>0?(n(),P(d,{key:1},{default:a(()=>[t(x,{lock:l.value.is_lock,"post-id":l.value.id,onPostSuccess:N},null,8,["lock","post-id"])]),_:1})):i("",!0),l.value.id>0?(n(),c("div",Ks,[g.value?(n(),c("div",Js,[t(O,{num:5})])):(n(),c("div",Gs,[k.value.length===0?(n(),c("div",Qs,[t(H,{size:"large",description:"暂无评论,快来抢沙发"})])):i("",!0),(n(!0),c(le,null,ie(k.value,J=>(n(),P(d,{key:J.id},{default:a(()=>[t(B,{comment:J,onReload:N},null,8,["comment"])]),_:2},1024))),128))]))])):i("",!0),k.value.length>=I?(n(),P(W,{key:3,justify:"center"},{default:a(()=>[t(e(Ut),{class:"load-more",slots:{complete:"没有更多数据了",error:"加载出错"},onInfinite:E},{spinner:a(()=>[_.value&&h.value?(n(),c("span",Ws)):i("",!0),!_.value&&e(M)?(n(),c("span",Xs)):i("",!0),_.value&&!h.value?(n(),c("span",Zs,"加载评论")):i("",!0),!_.value&&!e(M)?(n(),c("span",eo,"加载评论")):i("",!0)]),_:1})]),_:1})):i("",!0)]),_:1})])}}});const Do=te(to,[["__scopeId","data-v-0d01659f"]]);export{Do as default};