Commit 7e8a37ba by zhousil

客服默认头像

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