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

2 lines
7.7 KiB

import{d as D,c as N,r as J,e as t,f as r,k as s,w as a,bf as o,j as f,y as C,A as _,x as m,q as I,Y as i,l as K,h as H,u as T,F as U,H as v,b as Y}from"./@vue-a481fc63.js";import{u as G}from"./vuex-44de225f.js";import{u as X,b as Z}from"./vue-router-e5a2430e.js";import{E as x,M as ee,N as se,O as ne,_ as E,P as te}from"./index-5faa66a7.js";import{J as L,i as ae,K as oe,N as re,O as Q,Q as ie,p as le}from"./@vicons-7a4ef312.js";import{j as d,o as ue,M as _e,l as pe,e as ce,O as de,S as me,L as ge,U as ve,F as fe,Q as ye,I as ke,G as he}from"./naive-ui-d8de3dda.js";import{_ as we}from"./whisper-d959da10.js";import{_ as $e}from"./main-nav.vue_vue_type_style_index_0_lang-0888b762.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./evtd-b614532e.js";import"./@css-render-7124a1a5.js";import"./vooks-6d99783e.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";const be={class:"sender-wrap"},Ce={key:0,class:"nickname"},Ie={class:"username"},Me={key:1,class:"nickname"},Se={class:"username"},ze={key:2,class:"nickname"},Oe={class:"timestamp"},Fe={class:"timestamp-txt"},Ne={key:0,class:"brief-content"},qe={key:1,class:"whisper-content-wrap"},Re={key:2,class:"requesting-friend-wrap"},Ae={key:2,class:"status-info"},Pe={key:3,class:"status-info"},We="https://assets.paopao.info/public/avatar/default/admin.png",je=D({__name:"message-item",props:{message:{}},emits:["send-whisper"],setup(q,{emit:y}){const p=q,c=X(),l=G(),k=e=>()=>H(d,null,{default:()=>H(e)}),h=N(()=>[{label:"私信",key:"whisper",icon:k(le)}]),w=e=>{switch(e){case"whisper":const n=p.message;if(n.type!=99){let $=n.type==4&&n.sender_user_id==l.state.userInfo.id?n.receiver_user:n.sender_user;y("send-whisper",$)}break}},g=N(()=>p.message.type!==4||p.message.sender_user_id!==l.state.userInfo.id),M=N(()=>p.message.type==4&&p.message.receiver_user_id==l.state.userInfo.id),S=N(()=>p.message.type==4&&p.message.sender_user_id==l.state.userInfo.id),R=e=>{u(e),(e.type===1||e.type===2||e.type===3)&&(e.post&&e.post.id>0?c.push({name:"post",query:{id:e.post_id}}):window.$message.error("该动态已被删除"))},z=e=>{u(e),ee({user_id:e.sender_user_id}).then(n=>{e.reply_id=2,window.$message.success("已同意添加好友")}).catch(n=>{console.log(n)})},A=e=>{u(e),se({user_id:e.sender_user_id}).then(n=>{e.reply_id=3,window.$message.success("已拒绝添加好友")}).catch(n=>{console.log(n)})},u=e=>{p.message.receiver_user_id==l.state.userInfo.id&&e.is_read===0&&ne({id:e.id}).then(n=>{e.is_read=1}).catch(n=>{console.log(n)})};return(e,n)=>{const $=ue,O=J("router-link"),b=_e,P=pe,W=ce,j=de,B=me,F=ge;return t(),r("div",{class:K(["message-item",{unread:g.value&&e.message.is_read===0}]),onClick:n[5]||(n[5]=V=>u(e.message))},[s(F,{"content-indented":""},{avatar:a(()=>[s($,{round:"",size:30,src:e.message.type==4&&e.message.sender_user_id==o(l).state.userInfo.id?e.message.receiver_user.avatar:e.message.sender_user.id>0?e.message.sender_user.avatar:We},null,8,["src"])]),header:a(()=>[f("div",be,[e.message.type!=4&&e.message.sender_user.id>0||M.value?(t(),r("span",Ce,[s(O,{onClick:n[0]||(n[0]=C(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{s:e.message.sender_user.username}}},{default:a(()=>[_(m(e.message.sender_user.nickname),1)]),_:1},8,["to"]),f("span",Ie," @"+m(e.message.sender_user.username),1)])):S.value?(t(),r("span",Me,[s(O,{onClick:n[1]||(n[1]=C(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{s:e.message.receiver_user.username}}},{default:a(()=>[_(m(e.message.receiver_user.nickname),1)]),_:1},8,["to"]),f("span",Se," @"+m(e.message.receiver_user.username),1)])):(t(),r("span",ze," 系统 ")),e.message.type==4?(t(),I(b,{key:3,class:"top-tag",type:"success",size:"small",round:""},{default:a(()=>[_(" 私信 ")]),_:1})):i("",!0),S.value?(t(),I(b,{key:4,class:"