Commit f79818b1 by panjiangyi

优化显示消息发送者名字的逻辑

parent a925c4a9
......@@ -218,7 +218,7 @@ export default class ChatList extends Vue {
wantedChatRoom.business_data.model_name,
wantedChatRoom.business_data.obj_id
);
this.saveChatId({
await this.saveChatId({
chatId: wantedChatRoom.chat_id,
v: info.uniplat_version,
uniplatId: info.uniplatId,
......
......@@ -135,7 +135,6 @@ import { Filters } from "../mixin/filter";
import * as dto from "../model";
import { isAccessibleUrl } from "../service/tools";
import { replaceText2Link } from "../utils";
import { getUserInfo } from "../utils/user-info";
import chat from "./../xim";
import {
......@@ -269,9 +268,8 @@ export default class Message extends Mixins(Filters) {
this.getUserName(this.data.eid);
}
private async getUserName(eid: string) {
const data = await getUserInfo(eid);
this.senderName = data.name;
private getUserName(eid: string) {
this.senderName = this.chatMembers.find(member => member.eid === eid)?.name ?? "";
}
private get avatar() {
......
......@@ -27,7 +27,7 @@ export interface Chat {
unread_msg_count: number;
}
export type TokenStringGetter = () => Promise<string>
export type TokenStringGetter = () => Promise<string>;
export interface ChatOption {
/**
......@@ -50,7 +50,7 @@ export interface ChatServiceLogger {
export type ChatListRequestList = {
list: Chat[];
total: number;
}
};
export interface Message {
at_id: string;
......@@ -74,7 +74,7 @@ export interface Message {
url: string;
}
export type MessageRequestResult = readonly Message[]
export type MessageRequestResult = readonly Message[];
export interface CreateChatByServicemanRequestResult {
id: number;
......@@ -118,32 +118,34 @@ export interface CreateChatByServicemanRequestResult {
export type ChatMemberExtraInfo = {
name?: string;
phone?: string;
}
};
export interface ChatMember {
at_all: boolean;
at_me: boolean;
chat_id: number;
create_time: number;
dnd: number;
id: number;
org_id: string;
uid: string;
oid: string;
eid: string;
chat_id: number;
type: number;
join_msg_id: number;
exit_msg_id: number;
id: number;
is_act: boolean;
is_exited: boolean;
is_remove: boolean;
is_top: boolean;
join_msg_id: number;
dnd: number;
label: string;
nickname: string;
oid: string;
org_id: string;
type: number;
uid: string;
unread_msg_count: number;
nickname: string;
at_me: boolean;
at_all: boolean;
is_act: boolean;
create_time: number;
update_time: number;
name: string;
phone: string;
}
export type ChatMembers = readonly ChatMember[]
export type ChatMembers = readonly ChatMember[];
export interface ServiceMan {
id: number;
......@@ -165,7 +167,7 @@ export interface ServiceMan {
status: number;
}
export type AllServiceMan = ServiceMan[]
export type AllServiceMan = ServiceMan[];
export interface OneWhoReadMessage {
create_time: number;
......
......@@ -365,7 +365,6 @@ export default {
state[ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID];
if (uniplatId == null) return;
try {
console.log("fuck send", params);
const data = await model()
.action("sendMsg")
.updateInitialParams({
......
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