feat(emergency): 急救宣教推送改为后端推 article 卡片

前端不再通过 postMessage 推送自定义消息,改由后端 push/send
接口直接推送 businessID=article 的自定义消息到 IM 会话。iweb
端新增 article 卡片渲染分支(左缩略图 + 右标题摘要横向布局,
max-width 280px),并加消息接收调试日志。

同时切换开发环境后台地址到 10.10.10.228:19996。
This commit is contained in:
wanghao
2026-07-07 17:40:50 +08:00
parent 48eaec6393
commit 5d7df50e25
12 changed files with 26503 additions and 41 deletions
@@ -94,6 +94,15 @@
</div>
</div>
</template>
<template v-else-if="isCustom.businessID === constant.typeArticle">
<div class="article-card">
<img v-if="isCustom?.messageImageUrl" :src="isCustom?.messageImageUrl" class="article-cover" />
<div class="article-info">
<div class="article-title">{{ isCustom?.title }}</div>
<div v-if="isCustom?.content" class="article-content">{{ isCustom?.content }}</div>
</div>
</div>
</template>
<template v-else-if="isCustom.businessID === constant.typeBusinessCard">
<div style="cursor: pointer; min-width: 180px">
<div class="business-type">
@@ -372,6 +381,56 @@
}
}
.article-card {
display: flex;
align-items: center;
gap: 8px;
max-width: 280px;
padding: 8px;
border-radius: 8px;
background: #f7f7f7;
border: 1px solid #ececec;
.article-cover {
width: 60px;
height: 60px;
border-radius: 6px;
flex-shrink: 0;
object-fit: cover;
}
.article-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 4px;
}
.article-title {
font-size: 14px;
font-weight: 500;
color: #333;
line-height: 1.3;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.article-content {
font-size: 12px;
color: #7d7d7d;
line-height: 1.3;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
}
.img-list {
img {
width: 100px;
@@ -115,6 +115,14 @@ export default class TUIChatServer extends IComponentServer {
}
private handleMessageReceived(event: any) {
// 调试日志:打印收到的所有消息,看后端推送的是什么格式
console.log('[IM 收到消息]', event?.data?.map((m: any) => ({
type: m?.type,
text: m?.payload?.text,
data: m?.payload?.data,
description: m?.payload?.description,
extension: m?.payload?.extension,
})));
event?.data?.forEach((message: Message) => {
if (message?.conversationID === this?.store?.conversation?.conversationID) {
this.currentStore.messageList = [...this.currentStore.messageList, message];
@@ -31,6 +31,7 @@ const constant: any = {
typeIphone: 'iphone',
typeMini: 'miniprogram',
typeSystem: 'system',
typeArticle: 'article',
typeBusinessCard: 'business_card',
typeArchives: 'archives',
typeMedicalExaminationReport: 'medical_examination_report',