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

2 lines
26 KiB

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