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-454aa5a8.js

2 lines
26 KiB

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