You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/web/dist/assets/Post-abdce3fa.js

58 lines
28 KiB

import{c as me,a as _e,f as L,e as E,d as j,u as ve,x as ie,am as Ae,y as H,A as Pe,h as O,ab as ee,n as qe,J as ke,q as Le,t as we,L as be,K as Q,B as Ve,N as De,an as Ee,ao as He,b as xe,ap as Fe,r as k,p as Ke,aq as Je,ar as We,as as Ge,at as Qe,w as $e,W as c,Y as g,Z as h,au as Ye,a7 as C,a4 as s,a5 as i,a9 as z,av as Ze,_ as Xe,al as te,$ as le,aw as fe,aa as S,a6 as B,a3 as e,ax as et,af as ce,ak as ze,ay as tt,ac as ne,a8 as Y,az as st,ae as he,a0 as ot,a2 as ge,aA as nt,ag as at,aB as Ie,aC as Re,aD as it,aE as lt,aF as ct,aG as rt,aH as ut,aI as pt,aJ as dt,aK as _t,aL as mt,aM as vt,aN as ft,ah as Te,S as ht,aO as gt,aP as yt,ai as kt,aQ as wt,aR as bt,aS as xt}from"./index-c17d3913.js";import{_ as $t}from"./InputGroup-97df1a51.js";import{f as ae}from"./formatTime-09781e30.js";import{p as ye,_ as Se,H as Ct,C as Pt,B as zt,a as It,b as Rt,c as Tt}from"./content-c9c72716.js";import{_ as Be}from"./Thing-2157b754.js";import{_ as St}from"./post-skeleton-40e81755.js";import{l as Bt,I as Ot,_ as Ut,V as X}from"./IEnum-2acc8be7.js";import{_ as Nt,a as jt,b as Mt,c as At}from"./Upload-f8f7ade2.js";import{M as qt}from"./MoreHorizFilled-6e21ff10.js";import{_ as Lt}from"./main-nav.vue_vue_type_style_index_0_lang-d6b3b6a4.js";import{_ as Vt}from"./List-28c5febd.js";import{a as Dt,_ as Et}from"./Skeleton-ca436747.js";const Ht=me("divider",`
position: relative;
display: flex;
width: 100%;
box-sizing: border-box;
font-size: 16px;
color: var(--n-text-color);
transition:
color .3s var(--n-bezier),
background-color .3s var(--n-bezier);
`,[_e("vertical",`
margin-top: 24px;
margin-bottom: 24px;
`,[_e("no-title",`
display: flex;
align-items: center;
`)]),L("title",`
display: flex;
align-items: center;
margin-left: 12px;
margin-right: 12px;
white-space: nowrap;
font-weight: var(--n-font-weight);
`),E("title-position-left",[L("line",[E("left",{width:"28px"})])]),E("title-position-right",[L("line",[E("right",{width:"28px"})])]),E("dashed",[L("line",`
background-color: #0000;
height: 0px;
width: 100%;
border-style: dashed;
border-width: 1px 0 0;
`)]),E("vertical",`
display: inline-block;
height: 1em;
margin: 0 8px;
vertical-align: middle;
width: 1px;
`),L("line",`
border: none;
transition: background-color .3s var(--n-bezier), border-color .3s var(--n-bezier);
height: 1px;
width: 100%;
margin: 0;
`),_e("dashed",[L("line",{backgroundColor:"var(--n-color)"})]),E("dashed",[L("line",{borderColor:"var(--n-color)"})]),E("vertical",{backgroundColor:"var(--n-color)"})]),Ft=Object.assign(Object.assign({},ie.props),{titlePlacement:{type:String,default:"center"},dashed:Boolean,vertical:Boolean}),Kt=j({name:"Divider",props:Ft,setup(r){const{mergedClsPrefixRef:m,inlineThemeDisabled:n}=ve(r),l=ie("Divider","-divider",Ht,Ae,r,m),y=H(()=>{const{common:{cubicBezierEaseInOut:u},self:{color:v,textColor:a,fontWeight:x}}=l.value;return{"--n-bezier":u,"--n-color":v,"--n-text-color":a,"--n-font-weight":x}}),_=n?Pe("divider",void 0,y,r):void 0;return{mergedClsPrefix:m,cssVars:n?void 0:y,themeClass:_==null?void 0:_.themeClass,onRender:_==null?void 0:_.onRender}},render(){var r;const{$slots:m,titlePlacement:n,vertical:l,dashed:y,cssVars:_,mergedClsPrefix:u}=this;return(r=this.onRender)===null||r===void 0||r.call(this),O("div",{role:"separator",class:[`${u}-divider`,this.themeClass,{[`${u}-divider--vertical`]:l,[`${u}-divider--no-title`]:!m.default,[`${u}-divider--dashed`]:y,[`${u}-divider--title-position-${n}`]:m.default&&n}],style:_},l?null:O("div",{class:`${u}-divider__line ${u}-divider__line--left`}),!l&&m.default?O(ee,null,O("div",{class:`${u}-divider__title`},this.$slots),O("div",{class:`${u}-divider__line ${u}-divider__line--right`})):null)}}),Oe=qe("n-popconfirm"),Ue={positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0}},Ce=He(Ue),Jt=j({name:"NPopconfirmPanel",props:Ue,setup(r){const{localeRef:m}=ke("Popconfirm"),{inlineThemeDisabled:n}=ve(),{mergedClsPrefixRef:l,mergedThemeRef:y,props:_}=Le(Oe),u=H(()=>{const{common:{cubicBezierEaseInOut:a},self:{fontSize:x,iconSize:f,iconColor:p}}=y.value;return{"--n-bezier":a,"--n-font-size":x,"--n-icon-size":f,"--n-icon-color":p}}),v=n?Pe("popconfirm-panel",void 0,u,_):void 0;return Object.assign(Object.assign({},ke("Popconfirm")),{mergedClsPrefix:l,cssVars:n?void 0:u,localizedPositiveText:H(()=>r.positiveText||m.value.positiveText),localizedNegativeText:H(()=>r.negativeText||m.value.negativeText),positiveButtonProps:we(_,"positiveButtonProps"),negativeButtonProps:we(_,"negativeButtonProps"),handlePositiveClick(a){r.onPositiveClick(a)},handleNegativeClick(a){r.onNegativeClick(a)},themeClass:v==null?void 0:v.themeClass,onRender:v==null?void 0:v.onRender})},render(){var r;const{mergedClsPrefix:m,showIcon:n,$slots:l}=this,y=be(l.action,()=>this.negativeText===null&&this.positiveText===null?[]:[this.negativeText!==null&&O(Q,Object.assign({size:"small",onClick:this.handleNegativeClick},this.negativeButtonProps),{default:()=>this.localizedNegativeText}),this.positiveText!==null&&O(Q,Object.assign({size:"small",type:"primary",onClick:this.handlePositiveClick},this.positiveButtonProps),{default:()=>this.localizedPositiveText})]);return(r=this.onRender)===null||r===void 0||r.call(this),O("div",{class:[`${m}-popconfirm__panel`,this.themeClass],style:this.cssVars},Ve(l.default,_=>n||_?O("div",{class:`${m}-popconfirm__body`},n?O("div",{class:`${m}-popconfirm__icon`},be(l.icon,()=>[O(De,{clsPrefix:m},{default:()=>O(Ee,null)})])):null,_):null),y?O("div",{class:[`${m}-popconfirm__action`]},y):null)}}),Wt=me("popconfirm",[L("body",`
font-size: var(--n-font-size);
display: flex;
align-items: center;
flex-wrap: nowrap;
position: relative;
`,[L("icon",`
display: flex;
font-size: var(--n-icon-size);
color: var(--n-icon-color);
transition: color .3s var(--n-bezier);
margin: 0 8px 0 0;
`)]),L("action",`
display: flex;
justify-content: flex-end;
`,[xe("&:not(:first-child)","margin-top: 8px"),me("button",[xe("&:not(:last-child)","margin-right: 8px;")])])]),Gt=Object.assign(Object.assign(Object.assign({},ie.props),Qe),{positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},trigger:{type:String,default:"click"},positiveButtonProps:Object,negativeButtonProps:Object,onPositiveClick:Function,onNegativeClick:Function}),Ne=j({name:"Popconfirm",props:Gt,__popover__:!0,setup(r){const{mergedClsPrefixRef:m}=ve(),n=ie("Popconfirm","-popconfirm",Wt,Fe,r,m),l=k(null);function y(v){const{onPositiveClick:a,"onUpdate:show":x}=r;Promise.resolve(a?a(v):!0).then(f=>{var p;f!==!1&&((p=l.value)===null||p===void 0||p.setShow(!1),x&&$e(x,!1))})}function _(v){const{onNegativeClick:a,"onUpdate:show":x}=r;Promise.resolve(a?a(v):!0).then(f=>{var p;f!==!1&&((p=l.value)===null||p===void 0||p.setShow(!1),x&&$e(x,!1))})}return Ke(Oe,{mergedThemeRef:n,mergedClsPrefixRef:m,props:r}),Object.assign(Object.assign({},{setShow(v){var a;(a=l.value)===null||a===void 0||a.setShow(v)},syncPosition(){var v;(v=l.value)===null||v===void 0||v.syncPosition()}}),{mergedTheme:n,popoverInstRef:l,handlePositiveClick:y,handleNegativeClick:_})},render(){const{$slots:r,$props:m,mergedTheme:n}=this;return O(Ge,We(m,Ce,{theme:n.peers.Popover,themeOverrides:n.peerOverrides.Popover,internalExtraClass:["popconfirm"],ref:"popoverInstRef"}),{trigger:r.activator||r.trigger,default:()=>{const l=Je(m,Ce);return O(Jt,Object.assign(Object.assign({},l),{onPositiveClick:this.handlePositiveClick,onNegativeClick:this.handleNegativeClick}),r)}})}}),Qt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Yt=h("path",{d:"M400 480a16 16 0 0 1-10.63-4L256 357.41L122.63 476A16 16 0 0 1 96 464V96a64.07 64.07 0 0 1 64-64h192a64.07 64.07 0 0 1 64 64v368a16 16 0 0 1-16 16z",fill:"currentColor"},null,-1),Zt=[Yt],Xt=j({name:"Bookmark",render:function(m,n){return c(),g("svg",Qt,Zt)}}),es={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ts=h("path",{d:"M256 448a32 32 0 0 1-18-5.57c-78.59-53.35-112.62-89.93-131.39-112.8c-40-48.75-59.15-98.8-58.61-153C48.63 114.52 98.46 64 159.08 64c44.08 0 74.61 24.83 92.39 45.51a6 6 0 0 0 9.06 0C278.31 88.81 308.84 64 352.92 64c60.62 0 110.45 50.52 111.08 112.64c.54 54.21-18.63 104.26-58.61 153c-18.77 22.87-52.8 59.45-131.39 112.8a32 32 0 0 1-18 5.56z",fill:"currentColor"},null,-1),ss=[ts],os=j({name:"Heart",render:function(m,n){return c(),g("svg",es,ss)}}),ns={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},as=Ye('<g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7h16"></path><path d="M10 11v6"></path><path d="M14 11v6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12"></path><path d="M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"></path></g>',1),is=[as],je=j({name:"Trash",render:function(m,n){return c(),g("svg",ns,is)}}),ls={class:"reply-compose-wrap"},cs={class:"reply-switch"},rs={key:0,class:"reply-input-wrap"},us=j({__name:"compose-reply",props:{commentId:{default:0},atUserid:{default:0},atUsername:{default:""}},emits:["reload","reset"],setup(r,{expose:m,emit:n}){const l=r,y=k(),_=k(!1),u=k(""),v=k(!1),a=f=>{_.value=f,f?setTimeout(()=>{var p;(p=y.value)==null||p.focus()},10):(v.value=!1,u.value="",n("reset"))},x=()=>{v.value=!0,Ze({comment_id:l.commentId,at_user_id:l.atUserid,content:u.value}).then(f=>{a(!1),window.$message.success("评论成功"),n("reload")}).catch(f=>{v.value=!1})};return m({switchReply:a}),(f,p)=>{const P=Xe,o=Q,I=$t;return c(),g("div",ls,[h("div",cs,[_.value?C("",!0):(c(),g("span",{key:0,class:"show",onClick:p[0]||(p[0]=$=>a(!0))}," 回复 ")),_.value?(c(),g("span",{key:1,class:"hide",onClick:p[1]||(p[1]=$=>a(!1))}," 取消 ")):C("",!0)]),_.value?(c(),g("div",rs,[s(I,null,{default:i(()=>[s(P,{ref_key:"inputInstRef",ref:y,size:"small",placeholder:l.atUsername?"@"+l.atUsername:"请输入回复内容..",maxlength:"100",value:u.value,"onUpdate:value":p[2]||(p[2]=$=>u.value=$),"show-count":"",clearable:""},null,8,["placeholder","value"]),s(o,{type:"primary",size:"small",ghost:"",loading:v.value,onClick:x},{default:i(()=>[z(" 回复 ")]),_:1},8,["loading"])]),_:1})])):C("",!0)])}}});const ps=te(us,[["__scopeId","data-v-e5019121"]]),ds={class:"reply-item"},_s={class:"header-wrap"},ms={class:"username"},vs={class:"reply-name"},fs={class:"timestamp"},hs={class:"base-wrap"},gs={class:"content"},ys={key:0,class:"reply-switch"},ks=j({__name:"reply-item",props:{reply:null},emits:["focusReply","reload"],setup(r,{emit:m}){const n=r,l=le(),y=()=>{m("focusReply",n.reply)},_=()=>{et({id:n.reply.id}).then(u=>{window.$message.success("删除成功"),setTimeout(()=>{m("reload")},50)}).catch(u=>{console.log(u)})};return(u,v)=>{const a=fe("router-link"),x=ce,f=Q,p=Ne;return c(),g("div",ds,[h("div",_s,[h("div",ms,[s(a,{class:"user-link",to:{name:"user",query:{username:n.reply.user.username}}},{default:i(()=>[z(S(n.reply.user.username),1)]),_:1},8,["to"]),h("span",vs,S(n.reply.at_user_id>0?"回复":":"),1),n.reply.at_user_id>0?(c(),B(a,{key:0,class:"user-link",to:{name:"user",query:{username:n.reply.at_user.username}}},{default:i(()=>[z(S(n.reply.at_user.username),1)]),_:1},8,["to"])):C("",!0)]),h("div",fs,[z(S(n.reply.ip_loc?n.reply.ip_loc+" · ":n.reply.ip_loc)+" "+S(e(ae)(n.reply.created_on))+" ",1),e(l).state.userInfo.is_admin||e(l).state.userInfo.id===n.reply.user.id?(c(),B(p,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:_},{trigger:i(()=>[s(f,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:i(()=>[s(x,null,{default:i(()=>[s(e(je))]),_:1})]),_:1})]),default:i(()=>[z(" 是否确认删除? ")]),_:1})):C("",!0)])]),h("div",hs,[h("div",gs,S(n.reply.content),1),e(l).state.userInfo.id>0?(c(),g("div",ys,[h("span",{class:"show",onClick:y}," 回复 ")])):C("",!0)])])}}});const ws=te(ks,[["__scopeId","data-v-25221b2c"]]),bs={class:"comment-item"},xs={class:"nickname-wrap"},$s={class:"username-wrap"},Cs={class:"opt-wrap"},Ps={class:"timestamp"},zs=["innerHTML"],Is={class:"reply-wrap"},Rs=j({__name:"comment-item",props:{comment:null},emits:["reload"],setup(r,{emit:m}){const n=r,l=le(),y=ze(),_=k(0),u=k(""),v=k(),a=H(()=>{let I=Object.assign({texts:[],imgs:[]},n.comment);return I.contents.map($=>{(+$.type==1||+$.type==2)&&I.texts.push($),+$.type==3&&I.imgs.push($)}),I}),x=(I,$)=>{let U=I.target;if(U.dataset.detail){const N=U.dataset.detail.split(":");N.length===2&&(l.commit("refresh"),N[0]==="tag"?window.$message.warning("评论内的无效话题"):y.push({name:"user",query:{username:N[1]}}))}},f=I=>{var $,U;_.value=I.user_id,u.value=(($=I.user)==null?void 0:$.username)||"",(U=v.value)==null||U.switchReply(!0)},p=()=>{m("reload")},P=()=>{_.value=0,u.value=""},o=()=>{st({id:a.value.id}).then(I=>{window.$message.success("删除成功"),setTimeout(()=>{p()},50)}).catch(I=>{})};return(I,$)=>{const U=he,N=fe("router-link"),D=ce,F=Q,K=Ne,J=Se,W=ws,G=ps,t=Be;return c(),g("div",bs,[s(t,{"content-indented":""},tt({avatar:i(()=>[s(U,{round:"",size:30,src:e(a).user.avatar},null,8,["src"])]),header:i(()=>[h("span",xs,[s(N,{onClick:$[0]||($[0]=Y(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e(a).user.username}}},{default:i(()=>[z(S(e(a).user.nickname),1)]),_:1},8,["to"])]),h("span",$s," @"+S(e(a).user.username),1)]),"header-extra":i(()=>[h("div",Cs,[h("span",Ps,S(e(a).ip_loc?e(a).ip_loc+" · ":e(a).ip_loc)+" "+S(e(ae)(e(a).created_on)),1),e(l).state.userInfo.is_admin||e(l).state.userInfo.id===e(a).user.id?(c(),B(K,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:o},{trigger:i(()=>[s(F,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:i(()=>[s(D,null,{default:i(()=>[s(e(je))]),_:1})]),_:1})]),default:i(()=>[z(" 是否确认删除? ")]),_:1})):C("",!0)])]),footer:i(()=>[e(a).imgs.length>0?(c(),B(J,{key:0,imgs:e(a).imgs},null,8,["imgs"])):C("",!0),h("div",Is,[(c(!0),g(ee,null,ne(e(a).replies,d=>(c(),B(W,{key:d.id,reply:d,onFocusReply:f,onReload:p},null,8,["reply"]))),128))]),e(l).state.userInfo.id>0?(c(),B(G,{key:1,ref_key:"replyComposeRef",ref:v,"comment-id":e(a).id,"at-userid":_.value,"at-username":u.value,onReload:p,onReset:P},null,8,["comment-id","at-userid","at-username"])):C("",!0)]),_:2},[e(a).texts.length>0?{name:"description",fn:i(()=>[(c(!0),g(ee,null,ne(e(a).texts,d=>(c(),g("span",{key:d.id,class:"comment-text",onClick:$[1]||($[1]=Y(A=>x(A,e(a).id),["stop"])),innerHTML:e(ye)(d.content).content},null,8,zs))),128))]),key:"0"}:void 0]),1024)])}}});const Ts=te(Rs,[["__scopeId","data-v-d4d44282"]]),Ss=r=>(Ie("data-v-f617ba05"),r=r(),Re(),r),Bs={key:0,class:"compose-wrap"},Os={class:"compose-line"},Us={class:"compose-user"},Ns={class:"compose-line compose-options"},js={class:"attachment"},Ms={class:"submit-wrap"},As={class:"attachment-list-wrap"},qs={key:1,class:"compose-wrap"},Ls=Ss(()=>h("div",{class:"login-wrap"},[h("span",{class:"login-banner"}," 登录后,精彩更多")],-1)),Vs={class:"login-wrap"},Ds=j({__name:"compose-comment",props:{lock:{default:0},postId:{default:0}},emits:["post-success"],setup(r,{emit:m}){const n=r,l=le(),y=k([]),_=k(!1),u=k(!1),v=k(!1),a=k(""),x=k(),f=k("public/image"),p=k([]),P=k([]),o="/v1/attachment",I=k(),$=Bt.debounce(w=>{ot({k:w}).then(b=>{let R=[];b.suggest.map(T=>{R.push({label:T,value:T})}),y.value=R,u.value=!1}).catch(b=>{u.value=!1})},200),U=(w,b)=>{u.value||(u.value=!0,b==="@"&&$(w))},N=w=>{w.length>200||(a.value=w)},D=w=>{f.value=w},F=w=>{p.value=w},K=async w=>{var b,R;return f.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((b=w.file.file)==null?void 0:b.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):f.value==="image"&&((R=w.file.file)==null?void 0:R.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):!0},J=({file:w,event:b})=>{var R;try{let T=JSON.parse((R=b.target)==null?void 0:R.response);T.code===0&&f.value==="public/image"&&P.value.push({id:w.id,content:T.data.content})}catch{window.$message.error("上传失败")}},W=({file:w,event:b})=>{var R;try{let T=JSON.parse((R=b.target)==null?void 0:R.response);if(T.code!==0){let V=T.msg||"上传失败";T.details&&T.details.length>0&&T.details.map(q=>{V+=":"+q}),window.$message.error(V)}}catch{window.$message.error("上传失败")}},G=({file:w})=>{let b=P.value.findIndex(R=>R.id===w.id);b>-1&&P.value.splice(b,1)},t=()=>{_.value=!0},d=()=>{var w;_.value=!1,(w=x.value)==null||w.clear(),p.value=[],a.value="",P.value=[]},A=()=>{if(a.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{users:w}=ye(a.value);const b=[];let R=100;b.push({content:a.value,type:2,sort:R}),P.value.map(T=>{R++,b.push({content:T.content,type:3,sort:R})}),v.value=!0,nt({contents:b,post_id:n.postId,users:Array.from(new Set(w))}).then(T=>{window.$message.success("发布成功"),v.value=!1,m("post-success"),d()}).catch(T=>{v.value=!1})},se=w=>{l.commit("triggerAuth",!0),l.commit("triggerAuthKey",w)};return ge(()=>{I.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(w,b)=>{const R=he,T=Ut,V=ce,q=Q,re=Nt,ue=jt,pe=at,oe=Mt,de=At;return c(),g("div",null,[e(l).state.userInfo.id>0?(c(),g("div",Bs,[h("div",Os,[h("div",Us,[s(R,{round:"",size:30,src:e(l).state.userInfo.avatar},null,8,["src"])]),s(T,{type:"textarea",size:"large",autosize:"",bordered:!1,options:y.value,prefix:["@"],loading:u.value,value:a.value,disabled:n.lock===1,"onUpdate:value":N,onSearch:U,onFocus:t,placeholder:n.lock===1?"泡泡已被锁定,回复功能已关闭":"快来评论两句吧..."},null,8,["options","loading","value","disabled","placeholder"])]),_.value?(c(),B(de,{key:0,ref_key:"uploadRef",ref:x,abstract:"","list-type":"image",multiple:!0,max:9,action:o,headers:{Authorization:I.value},data:{type:f.value},onBeforeUpload:K,onFinish:J,onError:W,onRemove:G,"onUpdate:fileList":F},{default:i(()=>[h("div",Ns,[h("div",js,[s(re,{abstract:""},{default:i(({handleClick:Z})=>[s(q,{disabled:p.value.length>0&&f.value==="public/video"||p.value.length===9,onClick:()=>{D("public/image"),Z()},quaternary:"",circle:"",type:"primary"},{icon:i(()=>[s(V,{size:"20",color:"var(--primary-color)"},{default:i(()=>[s(e(Ot))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),s(pe,{trigger:"hover",placement:"bottom"},{trigger:i(()=>[s(ue,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:a.value.length/200*100},null,8,["percentage"])]),default:i(()=>[z(" "+S(a.value.length)+" / 200 ",1)]),_:1})]),h("div",Ms,[s(q,{quaternary:"",round:"",type:"tertiary",class:"cancel-btn",size:"small",onClick:d},{default:i(()=>[z(" 取消 ")]),_:1}),s(q,{loading:v.value,onClick:A,type:"primary",secondary:"",size:"small",round:""},{default:i(()=>[z(" 发布 ")]),_:1},8,["loading"])])]),h("div",As,[s(oe)])]),_:1},8,["headers","data"])):C("",!0)])):(c(),g("div",qs,[Ls,h("div",Vs,[s(q,{strong:"",secondary:"",round:"",type:"primary",onClick:b[0]||(b[0]=Z=>se("signin"))},{default:i(()=>[z(" 登录 ")]),_:1}),s(q,{strong:"",secondary:"",round:"",type:"info",onClick:b[1]||(b[1]=Z=>se("signup"))},{default:i(()=>[z(" 注册 ")]),_:1})])]))])}}});const Es=te(Ds,[["__scopeId","data-v-f617ba05"]]),Hs={class:"username-wrap"},Fs={key:0,class:"options"},Ks={key:0},Js=["innerHTML"],Ws={class:"timestamp"},Gs={key:0},Qs={key:1},Ys={class:"opts-wrap"},Zs=["onClick"],Xs={class:"opt-item"},eo=["onClick"],to=j({__name:"post-detail",props:{post:null},emits:["reload"],setup(r,{emit:m}){const n=r,l=le(),y=ze(),_=k(!1),u=k(!1),v=k(!1),a=k(!1),x=k(!1),f=k(!1),p=k(!1),P=k(X.PUBLIC),o=H({get:()=>{let t=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},n.post);return t.contents.map(d=>{(+d.type==1||+d.type==2)&&t.texts.push(d),+d.type==3&&t.imgs.push(d),+d.type==4&&t.videos.push(d),+d.type==6&&t.links.push(d),+d.type==7&&t.attachments.push(d),+d.type==8&&t.charge_attachments.push(d)}),t},set:t=>{n.post.upvote_count=t.upvote_count,n.post.comment_count=t.comment_count,n.post.collection_count=t.collection_count}}),I=H(()=>{let t=[{label:"删除",key:"delete"}];return o.value.is_lock===0?t.push({label:"锁定",key:"lock"}):t.push({label:"解锁",key:"unlock"}),l.state.userInfo.is_admin&&(o.value.is_top===0?t.push({label:"置顶",key:"stick"}):t.push({label:"取消置顶",key:"unstick"})),o.value.visibility===X.PUBLIC?t.push({label:"公开",key:"vpublic",children:[{label:"私密",key:"vprivate"},{label:"好友可见",key:"vfriend"}]}):o.value.visibility===X.PRIVATE?t.push({label:"私密",key:"vprivate",children:[{label:"公开",key:"vpublic"},{label:"好友可见",key:"vfriend"}]}):t.push({label:"好友可见",key:"vfriend",children:[{label:"公开",key:"vpublic"},{label:"私密",key:"vprivate"}]}),t}),$=t=>{y.push({name:"post",query:{id:t}})},U=(t,d)=>{if(t.target.dataset.detail){const A=t.target.dataset.detail.split(":");if(A.length===2){l.commit("refresh"),A[0]==="tag"?y.push({name:"home",query:{q:A[1],t:"tag"}}):y.push({name:"user",query:{username:A[1]}});return}}$(d)},N=t=>{switch(t){case"delete":v.value=!0;break;case"lock":case"unlock":a.value=!0;break;case"stick":case"unstick":x.value=!0;break;case"vpublic":P.value=0,f.value=!0;break;case"vprivate":P.value=1,f.value=!0;break;case"vfriend":P.value=2,f.value=!0;break}},D=()=>{ct({id:o.value.id}).then(t=>{window.$message.success("删除成功"),y.replace("/"),setTimeout(()=>{l.commit("refresh")},50)}).catch(t=>{p.value=!1})},F=()=>{rt({id:o.value.id}).then(t=>{m("reload"),t.lock_status===1?window.$message.success("锁定成功"):window.$message.success("解锁成功")}).catch(t=>{p.value=!1})},K=()=>{ut({id:o.value.id}).then(t=>{m("reload"),t.top_status===1?window.$message.success("置顶成功"):window.$message.success("取消置顶成功")}).catch(t=>{p.value=!1})},J=()=>{pt({id:o.value.id,visibility:P.value}).then(t=>{m("reload"),window.$message.success("修改可见性成功")}).catch(t=>{p.value=!1})},W=()=>{dt({id:o.value.id}).then(t=>{_.value=t.status,t.status?o.value={...o.value,upvote_count:o.value.upvote_count+1}:o.value={...o.value,upvote_count:o.value.upvote_count-1}}).catch(t=>{console.log(t)})},G=()=>{_t({id:o.value.id}).then(t=>{u.value=t.status,t.status?o.value={...o.value,collection_count:o.value.collection_count+1}:o.value={...o.value,collection_count:o.value.collection_count-1}}).catch(t=>{console.log(t)})};return ge(()=>{l.state.userInfo.id>0&&(it({id:o.value.id}).then(t=>{_.value=t.status}).catch(t=>{console.log(t)}),lt({id:o.value.id}).then(t=>{u.value=t.status}).catch(t=>{console.log(t)}))}),(t,d)=>{const A=he,se=fe("router-link"),w=mt,b=ce,R=Q,T=vt,V=ft,q=It,re=Se,ue=Rt,pe=Tt,oe=Kt,de=Te,Z=Be;return c(),g("div",{class:"detail-item",onClick:d[6]||(d[6]=M=>$(e(o).id))},[s(Z,null,{avatar:i(()=>[s(A,{round:"",size:30,src:e(o).user.avatar},null,8,["src"])]),header:i(()=>[s(se,{onClick:d[0]||(d[0]=Y(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e(o).user.username}}},{default:i(()=>[z(S(e(o).user.nickname),1)]),_:1},8,["to"]),h("span",Hs," @"+S(e(o).user.username),1),e(o).is_top?(c(),B(w,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:i(()=>[z(" 置顶 ")]),_:1})):C("",!0),e(o).visibility==e(X).PRIVATE?(c(),B(w,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:i(()=>[z(" 私密 ")]),_:1})):C("",!0),e(o).visibility==e(X).FRIEND?(c(),B(w,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:i(()=>[z(" 好友可见 ")]),_:1})):C("",!0)]),"header-extra":i(()=>[e(l).state.userInfo.is_admin||e(l).state.userInfo.id===e(o).user.id?(c(),g("div",Fs,[s(T,{placement:"bottom-end",trigger:"click",size:"small",options:e(I),onSelect:N},{default:i(()=>[s(R,{quaternary:"",circle:""},{icon:i(()=>[s(b,null,{default:i(()=>[s(e(qt))]),_:1})]),_:1})]),_:1},8,["options"])])):C("",!0),s(V,{show:v.value,"onUpdate:show":d[1]||(d[1]=M=>v.value=M),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定删除该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:D},null,8,["show"]),s(V,{show:a.value,"onUpdate:show":d[2]||(d[2]=M=>a.value=M),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(e(o).is_lock?"解锁":"锁定")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:F},null,8,["show","content"]),s(V,{show:x.value,"onUpdate:show":d[3]||(d[3]=M=>x.value=M),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(e(o).is_top?"取消置顶":"置顶")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:K},null,8,["show","content"]),s(V,{show:f.value,"onUpdate:show":d[4]||(d[4]=M=>f.value=M),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定将该泡泡动态可见度修改为"+(P.value==0?"公开":P.value==1?"私密":"好友可见")+"吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:J},null,8,["show","content"])]),footer:i(()=>[s(q,{attachments:e(o).attachments},null,8,["attachments"]),s(q,{attachments:e(o).charge_attachments,price:e(o).attachment_price},null,8,["attachments","price"]),s(re,{imgs:e(o).imgs},null,8,["imgs"]),s(ue,{videos:e(o).videos,full:!0},null,8,["videos"]),s(pe,{links:e(o).links},null,8,["links"]),h("div",Ws,[z(" 发布于 "+S(e(ae)(e(o).created_on))+" ",1),e(o).ip_loc?(c(),g("span",Gs,[s(oe,{vertical:""}),z(" "+S(e(o).ip_loc),1)])):C("",!0),e(o).created_on!=e(o).latest_replied_on?(c(),g("span",Qs,[s(oe,{vertical:""}),z(" 最后回复 "+S(e(ae)(e(o).latest_replied_on)),1)])):C("",!0)])]),action:i(()=>[h("div",Ys,[s(de,{justify:"space-between"},{default:i(()=>[h("div",{class:"opt-item hover",onClick:Y(W,["stop"])},[s(b,{size:"20",class:"opt-item-icon"},{default:i(()=>[_.value?C("",!0):(c(),B(e(Ct),{key:0})),_.value?(c(),B(e(os),{key:1,color:"red"})):C("",!0)]),_:1}),z(" "+S(e(o).upvote_count),1)],8,Zs),h("div",Xs,[s(b,{size:"20",class:"opt-item-icon"},{default:i(()=>[s(e(Pt))]),_:1}),z(" "+S(e(o).comment_count),1)]),h("div",{class:"opt-item hover",onClick:Y(G,["stop"])},[s(b,{size:"20",class:"opt-item-icon"},{default:i(()=>[u.value?C("",!0):(c(),B(e(zt),{key:0})),u.value?(c(),B(e(Xt),{key:1,color:"#ff7600"})):C("",!0)]),_:1}),z(" "+S(e(o).collection_count),1)],8,eo)]),_:1})])]),default:i(()=>[e(o).texts.length>0?(c(),g("div",Ks,[(c(!0),g(ee,null,ne(e(o).texts,M=>(c(),g("span",{key:M.id,class:"post-text",onClick:d[5]||(d[5]=Y(Me=>U(Me,e(o).id),["stop"])),innerHTML:e(ye)(M.content).content},null,8,Js))),128))])):C("",!0)]),_:1})])}}});const so=r=>(Ie("data-v-9f8ff949"),r=r(),Re(),r),oo={key:0,class:"detail-wrap"},no={key:1,class:"empty-wrap"},ao={key:0,class:"comment-opts-wrap"},io=so(()=>h("div",{class:"comment-title-item"},[h("span",{"comment-title-item":""},"评论")],-1)),lo={class:"comment-opt-item"},co={key:2},ro={key:0,class:"skeleton-wrap"},uo={key:1},po={key:0,class:"empty-wrap"},_o=j({__name:"Post",setup(r){const m=kt(),n=k({}),l=k(!1),y=k(!1),_=k([]),u=H(()=>+m.query.id),v=k("default"),a=p=>{v.value=p,f()},x=()=>{n.value={id:0},l.value=!0,gt({id:u.value}).then(p=>{l.value=!1,n.value=p,f()}).catch(p=>{l.value=!1})},f=(p=!1)=>{_.value.length===0&&(y.value=!0),yt({id:n.value.id,sort_strategy:v.value}).then(P=>{_.value=P.list,y.value=!1,p&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(P=>{y.value=!1})};return ge(()=>{x()}),ht(u,()=>{u.value>0&&m.name==="post"&&x()}),(p,P)=>{const o=Lt,I=to,$=Dt,U=wt,N=Et,D=bt,F=xt,K=Te,J=Es,W=St,G=Ts,t=Vt;return c(),g("div",null,[s(o,{title:"泡泡详情",back:!0}),s(t,{class:"main-content-wrap",bordered:""},{default:i(()=>[s(N,null,{default:i(()=>[s(U,{show:l.value},{default:i(()=>[n.value.id>1?(c(),g("div",oo,[s(I,{post:n.value,onReload:x},null,8,["post"])])):(c(),g("div",no,[s($,{size:"large",description:"暂无数据"})]))]),_:1},8,["show"])]),_:1}),n.value.id>0?(c(),g("div",ao,[s(K,{justify:"space-between"},{default:i(()=>[io,h("div",lo,[s(F,{type:"bar",size:"small",animated:"","onUpdate:value":a},{default:i(()=>[s(D,{name:"default",tab:"默认"}),s(D,{name:"newest",tab:"最新"})]),_:1})])]),_:1})])):C("",!0),n.value.id>0?(c(),B(N,{key:1},{default:i(()=>[s(J,{lock:n.value.is_lock,"post-id":n.value.id,onPostSuccess:P[0]||(P[0]=d=>f(!0))},null,8,["lock","post-id"])]),_:1})):C("",!0),n.value.id>0?(c(),g("div",co,[y.value?(c(),g("div",ro,[s(W,{num:5})])):(c(),g("div",uo,[_.value.length===0?(c(),g("div",po,[s($,{size:"large",description:"暂无评论,快来抢沙发"})])):C("",!0),(c(!0),g(ee,null,ne(_.value,d=>(c(),B(N,{key:d.id},{default:i(()=>[s(G,{comment:d,onReload:f},null,8,["comment"])]),_:2},1024))),128))]))])):C("",!0)]),_:1})])}}});const Po=te(_o,[["__scopeId","data-v-9f8ff949"]]);export{Po as default};