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