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/Messages-pR9E7fXn.js

2 lines
12 KiB

9 months ago
import{d as J,c as F,r as me,e as a,f as i,k as n,w as t,bk as o,j as h,y as R,A as p,x as g,Z as d,q,l as ge,h as H,u as se,F as ne,H as v,b as fe}from"./@vue-CQsYufSu.js";import{u as te}from"./vuex-DNAxYlmG.js";import{u as ve,b as ke}from"./vue-router-zwGLnBy5.js";import{K as ye,P as he,Q as we,R as be,u as $e,f as Ce,_ as L,S as Ie,T as Me}from"./index-v3l9hw1O.js";import{K as x,k as Se,N as qe,O as ze,Q as ee,U as Oe,r as T,s as Re,t as Ae,X as A,Y as Fe,Z as B,_ as V,R as D}from"./@vicons-C3A8jsfr.js";import{F as Te,j as m,o as Ne,M as Pe,l as Ue,e as ae,P as oe,T as We,O as je,U as Be,a as Ve,G as De,Q as He,J as Qe,k as Ke,H as Ze}from"./naive-ui-DNcWoFGl.js";import{_ as Ee}from"./whisper-DFhobfFF.js";import{_ as Ge}from"./main-nav.vue_vue_type_style_index_0_lang-DmAlkpQJ.js";import{W as Je}from"./v3-infinite-loading-DK6TzcZc.js";import"./axios-Bo0ATomq.js";import"./moment-BqTRGcJI.js";/* empty css */import"./seemly-B7f2tHrf.js";import"./vueuc-CbQ6ZCvR.js";import"./evtd-CI_DDEu_.js";import"./@css-render-CQdyXCYJ.js";import"./vooks-BQzJqMzq.js";import"./vdirs-DL8EOfHr.js";import"./@juggle-C8OzoCMD.js";import"./css-render-Ct37b3-v.js";import"./@emotion-WldOFDRm.js";import"./lodash-es-i05dkx59.js";import"./treemate-HRdUPn5m.js";import"./async-validator-DKvM95Vc.js";import"./date-fns-x7VUUoCw.js";const Le={class:"sender-wrap"},Xe={key:0,class:"nickname"},Ye={key:0,class:"username"},xe={key:1,class:"nickname"},es={key:0,class:"username"},ss={key:2,class:"nickname"},ns={class:"timestamp"},ts={class:"timestamp-txt"},as={key:0,class:"brief-content"},os={key:1,class:"whisper-content-wrap"},ls={key:2,class:"requesting-friend-wrap"},rs={key:2,class:"status-info"},is={key:3,class:"status-info"},us="https://assets.paopao.info/public/avatar/default/admin.png",cs=J({__name:"message-item",props:{message:{}},emits:["send-whisper","reload"],setup(Q,{emit:w}){const N=ve(),c=te(),f=Te(),u=Q,b=e=>()=>H(m,null,{default:()=>H(e)}),$=F(()=>{let e=u.message.type==4&&u.message.sender_user_id==c.state.userInfo.id?u.message.receiver_user:u.message.sender_user,s=[{label:"私信 @"+e.username,key:"whisper",icon:b(T)}];return c.state.userInfo.id!=e.id&&(e.is_following?s.push({label:"取消关注 @"+e.username,key:"unfollow",icon:b(Re)}):s.push({label:"关注 @"+e.username,key:"follow",icon:b(Ae)})),s}),_=w,k=e=>{let s=e.type==4&&e.sender_user_id==c.state.userInfo.id?e.receiver_user:e.sender_user;f.success({title:"提示",content:"确定"+(s.is_following?"取消关注 @":"关注 @")+s.username+" 吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{s.is_following?$e({user_id:s.id}).then(y=>{window.$message.success("操作成功"),s.is_following=!1,setTimeout(()=>{_("reload")},50)}).catch(y=>{}):Ce({user_id:s.id}).then(y=>{window.$message.success("关注成功"),s.is_following=!0,setTimeout(()=>{_("reload")},50)}).catch(y=>{})}})},z=e=>{switch(e){case"whisper":const s=u.message;if(s.type!=99){let y=s.type==4&&s.sender_user_id==c.state.userInfo.id?s.receiver_user:s.sender_user;_("send-whisper",y)}break;case"follow":case"unfollow":k(u.message);break}},C=F(()=>u.message.type!==4||u.message.sender_user_id!==c.state.userInfo.id),P=F(()=>u.message.type==4&&u.message.receiver_user_id==c.state.userInfo.id),O=F(()=>u.message.type==4&&u.message.sender_user_id==c.state.userInfo.id),r=e=>{S(e),(e.type===1||e.type===2||e.type===3)&&(e.post&&e.post.id>0?N.push({name:"post",query:{id:e.post_id}}):window.$message.error("该动态已被删除"))},K=e=>{S(e),he({user_id:e.sender_user_id}).then(s=>{e.reply_id=2,window.$message.success("已同意添加好友")}).catch(s=>{console.log(s)})},U=e=>{S(e),we({user_id:e.sender_user_id}).then(s=>{e.reply_id=3,window.$message.success("已拒绝添加好友")}).catch(s=>{console.log(s)})},S=e=>{u.message.receiver_user_id==c.state.userInfo.id&&e.is_read===0&&be({id:e.id}).then(s=>{e.is_read=1}).catch(s=>{console.log(s)})};return(e,s)=>{const y=Ne,W=me("router-link"),I=Pe,Z=Ue,l=ae,j=oe,E=We,G=je;return a(),i("div",{class:ge(["message-item",{unread:C.value&&e.message.is_read===0}]),onClick:s[5