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

2 lines
30 KiB

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