Commit f79818b1 by panjiangyi

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

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