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