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