Commit d8a2b061 by zhousil

有头像时样式

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