Files
zyt/server/public/admin/assets/MessageBubble-BQdk_ccg.js
T
2026-05-16 16:08:54 +08:00

2 lines
5.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{q as G,T as S,v as A,d as O,i as Q}from"./element-plus-DFTWCWyi.js";import{O as q,P as D,Q as H,G as J}from"./@element-plus/icons-vue-HOEUG8sr.js";import{t as K,_ as L}from"./index-BOT-n-x_.js";import{f as P,ak as a,I as o,a as r,aN as c,O as d,J as i,G as g,H as x,F as U,A as u}from"./@vue/runtime-core-C6bnekPw.js";import{o as B,Q as n}from"./@vue/shared-mAAVTE9n.js";import{y as p}from"./@vue/reactivity-DiY1c2vO.js";import"./@vue/runtime-dom-DDAG46FW.js";import"./lodash-D3kF6u-c.js";import"./lodash-es-C2A-Pj28.js";import"./@popperjs/core-C5az9QE8.js";import"./dayjs-DG77mNTn.js";import"./@ctrl/tinycolor-BuyEbX8F.js";import"./async-validator-CFA_igpM.js";import"./normalize-wheel-es-BQoi3Ox2.js";import"./jspdf-BsthCvR5.js";import"./@babel/runtime-BanGtE2-.js";import"./fflate-_ayOYiT1.js";import"./vue-router-QlpZ4wdW.js";import"./pinia-B8cvXbiZ.js";import"./axios-C80V62Fs.js";import"./@vueuse/core-1S4fJlii.js";import"./@vueuse/shared-Cl3lVqjz.js";import"./css-color-function-DI01JAaZ.js";import"./balanced-match-BdS7OldZ.js";import"./color-B2zxaWkI.js";import"./clone-DBZ6_OiU.js";import"./color-convert-OrFsTA_V.js";import"./color-name-Dju3oUBS.js";import"./color-string-pUQDDJII.js";import"./ms-CzQ2E3wO.js";import"./vue-clipboard3-DByT_rEQ.js";import"./clipboard-CHgxszqY.js";import"./echarts-CNLwa9wG.js";import"./tslib-BDyQ-Jie.js";import"./zrender-DRNXw7y3.js";import"./highlight.js-Bxt7hFFy.js";import"./@highlightjs/vue-plugin-C4onkBvW.js";const j={class:"msg-body"},R={class:"msg-meta"},W={class:"msg-sender"},X={class:"msg-time"},Y={key:0,class:"content-text"},Z={key:2,class:"content-pending"},ee=["src"],te={key:4,class:"content-pending"},se=["src"],ae={key:6,class:"content-pending"},ie={key:7,class:"content-file"},oe={class:"file-meta"},ne=["title"],le={class:"file-info"},me={key:8,class:"content-fallback"},re={class:"fallback-title"},ce={class:"fallback-desc"},ue=P({__name:"MessageBubble",props:{message:{}},setup(t){const l=t,w=u(()=>l.message.from_is_staff),m=u(()=>(l.message.media||[]).find(s=>s.status===1)??null),v=u(()=>{const e=l.message.from_profile;return e&&e.name||l.message.from_user}),z=u(()=>{const e=l.message.from_profile;return(e==null?void 0:e.avatar)||""}),F=u(()=>(v.value||"").slice(-2)||"?"),N=u(()=>{const e=l.message.msgtype;return e==="image"||e==="video"||e==="voice"?"bubble-media":e==="file"?"bubble-file":"bubble-text"}),C=u(()=>{switch(l.message.msgtype){case"link":return"[链接]";case"weapp":return"[小程序]";case"chatrecord":return"[聊天记录]";case"location":return"[位置]";case"card":return"[名片]";case"meeting":return"[会议]";case"docmsg":return"[文档]";case"mixed":return"[混合消息]";case"emotion":return"[表情]";default:return`[${l.message.msgtype}]`}});function E(e){return e?K(e*1e3,"mm-dd hh:MM"):""}function M(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(2)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`:""}function $(e){window.open(e,"_blank","noopener")}return(e,s)=>{var k,y,b,h;const I=G,_=S,T=A,f=O,V=Q;return a(),o("div",{class:B(["msg-bubble",{"is-staff":w.value}])},[r(I,{class:"msg-avatar",size:36,src:z.value},{default:c(()=>[d(n(F.value),1)]),_:1},8,["src"]),i("div",j,[i("div",R,[i("span",W,n(v.value),1),i("span",X,n(E(t.message.send_time)),1),t.message.action==="recall"?(a(),g(_,{key:0,size:"small",type:"info"},{default:c(()=>[...s[1]||(s[1]=[d(" 已撤回 ",-1)])]),_:1})):x("",!0)]),i("div",{class:B(["msg-content",N.value])},[t.message.msgtype==="text"||t.message.msgtype==="markdown"?(a(),o("div",Y,n(t.message.content),1)):t.message.msgtype==="image"&&((k=m.value)!=null&&k.file_url)?(a(),g(T,{key:1,src:m.value.file_url,"preview-src-list":[m.value.file_url],fit:"contain",class:"content-image","hide-on-click-modal":""},null,8,["src","preview-src-list"])):t.message.msgtype==="image"?(a(),o("div",Z,[r(f,null,{default:c(()=>[r(p(q))]),_:1}),s[2]||(s[2]=i("span",null,"图片下载中…",-1))])):t.message.msgtype==="video"&&((y=m.value)!=null&&y.file_url)?(a(),o("video",{key:3,src:m.value.file_url,controls:"",class:"content-video"},null,8,ee)):t.message.msgtype==="video"?(a(),o("div",te,[r(f,null,{default:c(()=>[r(p(D))]),_:1}),s[3]||(s[3]=i("span",null,"视频下载中…",-1))])):t.message.msgtype==="voice"&&((b=m.value)!=null&&b.file_url)?(a(),o("audio",{key:5,src:m.value.file_url,controls:"",class:"content-audio"},null,8,se)):t.message.msgtype==="voice"?(a(),o("div",ae,[r(f,null,{default:c(()=>[r(p(H))]),_:1}),i("span",null,"语音下载中…("+n(t.message.play_length)+"s",1)])):t.message.msgtype==="file"?(a(),o("div",ie,[r(f,{size:24},{default:c(()=>[r(p(J))]),_:1}),i("div",oe,[i("div",{class:"file-name",title:t.message.file_name},n(t.message.file_name||"未命名文件"),9,ne),i("div",le,[d(n(M(t.message.file_size))+" ",1),t.message.file_ext?(a(),o(U,{key:0},[d("· "+n(t.message.file_ext),1)],64)):x("",!0)])]),(h=m.value)!=null&&h.file_url?(a(),g(V,{key:0,size:"small",type:"primary",link:"",onClick:s[0]||(s[0]=de=>$(m.value.file_url))},{default:c(()=>[...s[4]||(s[4]=[d(" 下载 ",-1)])]),_:1})):(a(),g(_,{key:1,size:"small",type:"info"},{default:c(()=>[...s[5]||(s[5]=[d("下载中…",-1)])]),_:1}))])):(a(),o("div",me,[i("div",re,n(C.value),1),i("div",ce,n(t.message.content),1)]))],2)])],2)}}}),We=L(ue,[["__scopeId","data-v-b5ff1168"]]);export{We as default};