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-omlMwWgU.js

2 lines
12 KiB

import{d as K,c as F,r as me,e as a,f as i,k as n,w as t,bf as o,y as R,t as g,A as p,Z as d,v as z,j as h,l as ge,h as H,x as se,F as ne,H as v,b as fe}from"./@vue-73x4sYJ2.js";import{u as te}from"./vuex-6eozxOS7.js";import{u as ve,b as ke}from"./vue-router-22lN-LLO.js";import{J as ye,O as he,P as we,Q as be,u as $e,f as Ce,_ as L,R as Ie,S as Me}from"./index-Lx4Mi1rj.js";import{K as x,k as Se,N as ze,O as qe,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-UfsZxvNZ.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 Je,H as Ze}from"./naive-ui-qF3urcFV.js";import{_ as Ee}from"./whisper-nUbeLD5N.js";import{_ as Ge}from"./main-nav.vue_vue_type_style_index_0_lang--76-h8Yy.js";import{W as Ke}from"./v3-infinite-loading-yUDJG3gQ.js";import"./axios-QLjAsgXu.js";import"./moment-TH1CLKMj.js";/* empty css */import"./seemly-tZbmuCcS.js";import"./vueuc-oXvKre1p.js";import"./evtd-9ZCiDXyn.js";import"./@css-render-RY9kiobo.js";import"./vooks-574GUng3.js";import"./vdirs-gz97tqc5.js";import"./@juggle--NVrOerG.js";import"./css-render-Jaty3dru.js";import"./@emotion-vV6BesBt.js";import"./lodash-es-KEIJqYRD.js";import"./treemate-hmrDCADh.js";import"./async-validator-BHjhHa7C.js";import"./date-fns-E8ESfRGG.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=K({__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=>{})}})},q=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("该动态已被删除"))},J=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}]),onClic