Commit 70752c4d by Sixong.Zhu

消息适配

parent defd3bfd
...@@ -14,6 +14,7 @@ const mapping = new Map<MessageType, string>([ ...@@ -14,6 +14,7 @@ const mapping = new Map<MessageType, string>([
[MessageType.PayV1, '付款通知'], [MessageType.PayV1, '付款通知'],
[MessageType.Refund, '退款通知'], [MessageType.Refund, '退款通知'],
[MessageType.RefundV1, '退款通知'], [MessageType.RefundV1, '退款通知'],
[MessageType.Notify, '通知'],
]) ])
export function parserMessage(type: MessageType, rawMsg: string) { export function parserMessage(type: MessageType, rawMsg: string) {
......
<template>
<div class="msg-detail inline-text" v-html="notifyMessage"></div>
</template>
<script lang="ts">
import { Component } from "vue-property-decorator";
import BaseMessage from "./index";
@Component({ components: {} })
export default class Index extends BaseMessage {
private get notifyData() {
return this.messageBody.msg as {
text: string;
remark: string;
resultId: string;
};
}
private get notifyMessage() {
return this.notifyData
? this.notifyData.text ||
`${this.notifyData.remark}, 工单ID ${
this.notifyData.resultId || "无"
}`
: "[通知消息]";
}
}
</script>
<style lang="less" scoped>
.inline-text {
display: inline-block;
white-space: pre-wrap;
text-align: left;
/deep/ .highlight {
color: #e87005;
}
}
</style>
\ No newline at end of file
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
} }
private get title() { private get title() {
return this.payData.itemName; return this.payData.itemName || this.payData.totalName;
} }
private get amount() { private get amount() {
return +this.payData.amount; return +this.payData.amount || this.payData.totalMoney;
} }
private get status() { private get status() {
......
...@@ -165,6 +165,7 @@ ...@@ -165,6 +165,7 @@
import MyWelfareMessage from "./message-item/my-welfare-message.vue"; import MyWelfareMessage from "./message-item/my-welfare-message.vue";
import QuestionAnswerMessage from "./message-item/question-answer-message.vue"; import QuestionAnswerMessage from "./message-item/question-answer-message.vue";
import PayMessage from "./message-item/pay-message.vue"; import PayMessage from "./message-item/pay-message.vue";
import NotifyMessage from "./message-item/notify-message.vue";
import { ChatRole } from "@/customer-service/model"; import { ChatRole } from "@/customer-service/model";
import { getUserMapping } from "../utils/user-info"; import { getUserMapping } from "../utils/user-info";
import Xim from "@/customer-service/xim"; import Xim from "@/customer-service/xim";
...@@ -187,6 +188,8 @@ ...@@ -187,6 +188,8 @@
[dto.MessageType.PayV1, "pay-message"], [dto.MessageType.PayV1, "pay-message"],
[dto.MessageType.Refund, "pay-message"], [dto.MessageType.Refund, "pay-message"],
[dto.MessageType.RefundV1, "pay-message"], [dto.MessageType.RefundV1, "pay-message"],
[dto.MessageType.PayResult, "notify-message"],
[dto.MessageType.Notify, "notify-message"],
]); ]);
@Component({ @Component({
...@@ -204,6 +207,7 @@ ...@@ -204,6 +207,7 @@
QuestionAnswerMessage, QuestionAnswerMessage,
ActionMessage, ActionMessage,
PayMessage, PayMessage,
NotifyMessage
}, },
}) })
export default class Message extends Vue { export default class Message extends Vue {
......
...@@ -117,6 +117,7 @@ export const enum MessageType { ...@@ -117,6 +117,7 @@ export const enum MessageType {
MpNavigate = "mp-navigate", MpNavigate = "mp-navigate",
PayV1 = 'gpay', PayV1 = 'gpay',
Pay = "gpay2", Pay = "gpay2",
PayResult = "gresult",
RefundV1 = 'grefund', RefundV1 = 'grefund',
Refund = "grefund2", Refund = "grefund2",
Card = 'card' Card = 'card'
......
...@@ -11,30 +11,36 @@ export type UserMapping = { ...@@ -11,30 +11,36 @@ export type UserMapping = {
const userMapping: UserMapping = {}; const userMapping: UserMapping = {};
interface UserInfo {
avatar_url: string;
email: string;
id: string;
mobile: string;
realname: string;
uniplatId: string;
username: string;
}
export const getUserMapping = () => userMapping; export const getUserMapping = () => userMapping;
export async function getUserInfo(eid: string, sdk?: UniplatSdk) { export async function getUserInfo(eid: string, sdk?: UniplatSdk) {
if (userMapping[eid]) { if (userMapping[eid]) {
return userMapping[eid]; return userMapping[eid];
} }
if (!+eid) { if (!+eid || +eid < 0) {
return { name: '', phone: '', icon: '' }; return { name: "", phone: "", icon: "" };
} }
const info = await (sdk || Chat.getSdk()) const info = await (sdk || Chat.getSdk())
.domainService('passport', 'anonymous', `oidc.account/user_info?id=${eid}`) .domainService(
.request<any, any, { "passport",
avatar_url: string; "anonymous",
email: string; `oidc.account/user_info?id=${eid}`
id: string; )
mobile: string; .request<any, any, UserInfo>("get");
realname: string;
uniplatId: string;
username: string;
}>('get');
const data = { const data = {
name: info.username || info.realname || info.mobile || info.mobile, name: info.username || info.realname || info.mobile || info.mobile,
phone: info.mobile, phone: info.mobile,
icon: info.avatar_url icon: info.avatar_url,
}; };
userMapping[eid] = data; userMapping[eid] = data;
return data; return data;
......
...@@ -2,7 +2,7 @@ import { ...@@ -2,7 +2,7 @@ import {
MessageHandled, MessageHandled,
MessageType, MessageType,
PayMethod, PayMethod,
PayStatus PayStatus,
} from "@/customer-service/model"; } from "@/customer-service/model";
export interface Chat { export interface Chat {
...@@ -208,6 +208,15 @@ export interface PayMessageBody { ...@@ -208,6 +208,15 @@ export interface PayMessageBody {
itemName: string; itemName: string;
amount: string; amount: string;
paymentId: string; paymentId: string;
/**
* 对应v1版本itemName
*/
totalName?: string;
/**
* 对应v1版本amount
*/
totalMoney?: string;
} }
export interface CsUser { export interface CsUser {
......
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