Commit 3d47c0d0 by 杨铁龙
parents 6bdbdede 087b2b2b
Showing with 17 additions and 0 deletions
import { MessageType } from "@/customer-service/model";
import { CardMessage } from '@/customer-service/model/card';
const mapping = new Map<MessageType, string>([
[MessageType.Image, '图片'],
......@@ -29,6 +30,12 @@ export function parserMessage(type: MessageType, rawMsg: string) {
if (type === MessageType.Notify) {
return rawMsg;
}
if (type === MessageType.Card) {
const p = JSON.parse(rawMsg) as CardMessage;
if (p && p.title) {
return p.title || '通知';
}
}
const t = mapping.get(type)
if (t) {
return `[${t}]`;
......
export interface CardMessage {
title: string;
date: string;
desc?: string;
desc1?: string;
desc2?: string;
values?: { key: string; value: string }[];
params?: any;
path?: string;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment