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

2 lines
28 KiB

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