Commit 7e8a37ba by zhousil

客服默认头像

parent 69456916
......@@ -35,11 +35,11 @@
/>
<avatar
v-if="
avatar && !isQuestionAnswerMessage && !isWithdrawMessage
!isQuestionAnswerMessage && !isWithdrawMessage
"
:src="
chatRole === 'admin' || chatRole === 'customer-service'
? require('../imgs/default-host-avatar.svg')
? defaultAvatar
: avatar
"
shape="circle"
......@@ -302,6 +302,10 @@
return "";
}
private get defaultAvatar() {
return xim.getAvatar();
}
private get chatRole() {
if (this.chatMembers) {
const t = this.chatMembers.find((i) => i.eid === this.data.eid);
......
......@@ -66,6 +66,8 @@ export interface ChatOption {
eventHub?: Vue;
message?: ChatMessageController;
avatar?: string;
}
export interface ChatMessageController {
......
......@@ -26,6 +26,7 @@ class Chat implements ChatMessageController {
private connectedActions: (() => void)[] = [];
private connected = false;
private messageController: ChatMessageController | null = null;
private defaultAvatar = "";
public onReady(action: () => void) {
if (this.connected) {
......@@ -53,6 +54,8 @@ class Chat implements ChatMessageController {
this.eventHub = option.eventHub || null;
option.message && (this.messageController = option.message);
option.avatar !== undefined &&
(this.defaultAvatar = option.avatar);
await this.setupIndexDb();
this.token = async () => option.sdk().global.jwtToken;
......@@ -189,6 +192,10 @@ class Chat implements ChatMessageController {
public info(msg: string) {
this.messageController && this.messageController.info(msg);
}
public getAvatar(){
return this.defaultAvatar;
}
}
export default new Chat();
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