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

2 lines
8.7 KiB

import{d as U,c as N,r as K,e as t,f as r,k as n,w as o,bf as a,j as w,y as O,A as _,x as g,q as S,Y as u,l as X,h as H,u as E,F as G,H as y,b as Z}from"./@vue-a481fc63.js";import{u as J}from"./vuex-44de225f.js";import{u as x,b as ee}from"./vue-router-e5a2430e.js";import{I as se,N as ne,O as te,P as oe,u as ae,f as re,_ as j,Q as ie}from"./index-daff1b26.js";import{N as V,k as le,O as ue,Q as _e,R as Q,U as pe,r as ce,s as de,t as me}from"./@vicons-c265fba6.js";import{F as ge,j as m,o as fe,M as ve,l as ye,e as ke,P as he,T as we,O as $e,U as be,G as Ce,R as Ie,J as Me,H as Oe}from"./naive-ui-defd0b2d.js";import{_ as Se}from"./whisper-9b4eeceb.js";import{_ as ze}from"./main-nav.vue_vue_type_style_index_0_lang-93352cc4.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 Re={class:"sender-wrap"},Fe={key:0,class:"nickname"},Ne={class:"username"},qe={key:1,class:"nickname"},Pe={class:"username"},Te={key:2,class:"nickname"},Ae={class:"timestamp"},We={class:"timestamp-txt"},Be={key:0,class:"brief-content"},Ue={key:1,class:"whisper-content-wrap"},je={key:2,class:"requesting-friend-wrap"},De={key:2,class:"status-info"},He={key:3,class:"status-info"},Ve="https://assets.paopao.info/public/avatar/default/admin.png",Qe=U({__name:"message-item",props:{message:{}},emits:["send-whisper","reload"],setup(q,{emit:f}){const i=q,c=x(),l=J(),$=ge(),v=e=>()=>H(m,null,{default:()=>H(e)}),b=N(()=>{let e=[{label:"私信",key:"whisper",icon:v(ce)}],s=i.message.type==4&&i.message.sender_user_id==l.state.userInfo.id?i.message.receiver_user:i.message.sender_user;return l.state.userInfo.id!=s.id&&(s.is_following?e.push({label:"取消关注",key:"unfollow",icon:v(de)}):e.push({label:"关注",key:"follow",icon:v(me)})),e}),C=e=>{let s=e.type==4&&e.sender_user_id==l.state.userInfo.id?e.receiver_user:e.sender_user;$.success({title:"提示",content:"确定"+(s.is_following?"取消关注":"关注")+"该用户吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{s.is_following?ae({user_id:s.id}).then(d=>{window.$message.success("操作成功"),s.is_following=!1,setTimeout(()=>{f("reload")},50)}).catch(d=>{}):re({user_id:s.id}).then(d=>{window.$message.success("关注成功"),s.is_following=!0,setTimeout(()=>{f("reload")},50)}).catch(d=>{})}})},z=e=>{switch(e){case"whisper":const s=i.message;if(s.type!=99){let d=s.type==4&&s.sender_user_id==l.state.userInfo.id?s.receiver_user:s.sender_user;f("send-whisper",d)}break;case"follow":case"unfollow":C(i.message);break}},I=N(()=>i.message.type!==4||i.message.sender_user_id!==l.state.userInfo.id),P=N(()=>i.message.type==4&&i.message.receiver_user_id==l.state.userInfo.id),k=N(()=>i.message.type==4&&i.message.sender_user_id==l.state.userInfo.id),T=e=>{h(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("该动态已被删除"))},p=e=>{h(e),ne({user_id:e.sender_user_id}).then(s=>{e.reply_id=2,window.$message.success("已同意添加好友")}).catch(s=>{console.log(s)})},D=e=>{h(e),te({user_id:e.sender_user_id}).then(s=>{e.reply_id=3,window.$message.success("已拒绝添加好友")}).catch(s=>{console.log(s)})},h=e=>{i.message.receiver_user_id==l.state.userInfo.id&&e.is_read===0&&oe({id:e.id}).then(s=>{e.is_read=1}).catch(s=>{console.log(s)})};return(e,s)=>{const d=fe,R=K("router-link"),M=ve,A=ye,W=ke,F=he,L=we,Y=$e;return t(),r("div",{class:X(["message-item",{unread:I.value&&e.message.is_read===0}]),onClick:s[5]||(s[5]=B=>h(e.message))},[n(Y,{"content-indented":""},{avatar:o(()=>[n(d,{round:"",size:30,src:e.message.type==4&&e.message.sender_user_id==a(l).state.userInfo.id?e.message.receive