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-9c8b9e7b.js

2 lines
24 KiB

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