Commit d8a2b061 by zhousil

有头像时样式

parent 57e47740
Showing with 28 additions and 17 deletions
...@@ -9,16 +9,22 @@ ...@@ -9,16 +9,22 @@
> >
<div class="msg-content" :class="{ 'algin-left': !isMyMessage }"> <div class="msg-content" :class="{ 'algin-left': !isMyMessage }">
<div <div
class="msg-name no-selection d-flex align-items-center" class="msg-name no-selection"
:class="{ :class="{ 'algin-left': !isMyMessage }"
'flex-row-reverse justify-content-end': !isMyMessage,
}"
v-if="!isWithdrawMessage" v-if="!isWithdrawMessage"
> >
{{ userName }} {{ userName }}
<avatar v-if="avatar" :src="avatar" shape="circle" />
</div> </div>
<div
class="content-avatar d-flex align-items-start"
:class="{ 'justify-content-end': isMyMessage }"
>
<img
src="@/assets/default-host-avatar.svg"
style="width: 42px"
v-if="!avatar && messageComponent && showHostAvatar"
class="host-avatar"
/>
<component <component
:is="messageComponent" :is="messageComponent"
:user-name="userName" :user-name="userName"
...@@ -29,6 +35,8 @@ ...@@ -29,6 +35,8 @@
v-model="data" v-model="data"
@open="openFile" @open="openFile"
/> />
<avatar v-if="avatar" :src="avatar" shape="circle" />
</div>
</div> </div>
<i <i
...@@ -195,6 +203,7 @@ ...@@ -195,6 +203,7 @@
private readerListOffset = false; private readerListOffset = false;
private defaultMessageHandledStatus = dto.MessageHandled.Default; private defaultMessageHandledStatus = dto.MessageHandled.Default;
private showHostAvatar: boolean = false;
private get canWithdraw() { private get canWithdraw() {
if (this.backend && this.data) { if (this.backend && this.data) {
...@@ -261,6 +270,11 @@ ...@@ -261,6 +270,11 @@
if (this.isSendingMessage) { if (this.isSendingMessage) {
if (avatar && this.chatMyId) { if (avatar && this.chatMyId) {
if (Object.getOwnPropertyNames(avatar).length > 0) {
this.showHostAvatar = true;
} else {
this.showHostAvatar = false;
}
const user = avatar[this.chatMyId]; const user = avatar[this.chatMyId];
if (user && user.avatar) { if (user && user.avatar) {
return user.avatar; return user.avatar;
...@@ -269,6 +283,11 @@ ...@@ -269,6 +283,11 @@
} }
if (avatar && this.data) { if (avatar && this.data) {
if (Object.getOwnPropertyNames(avatar).length > 0) {
this.showHostAvatar = true;
} else {
this.showHostAvatar = false;
}
const value = avatar[this.data.eid]; const value = avatar[this.data.eid];
if (value && value.avatar) { if (value && value.avatar) {
return value.avatar; return value.avatar;
...@@ -430,24 +449,16 @@ ...@@ -430,24 +449,16 @@
} }
} }
.msg-name { .msg-name {
font-size: 14px; font-size: 14px;
color: #888; color: #888;
text-align: right; text-align: right;
margin-bottom: 3px; margin-bottom: 3px;
min-height: 16px; min-height: 16px;
&.algin-left {
.el-avatar { text-align: left;
margin-left: 10px;
}
&.flex-row-reverse {
.el-avatar {
margin-left: 0;
margin-right: 10px;
} }
} }
}
.msg-content { .msg-content {
text-align: right; text-align: right;
......
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