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