perf: 群聊天点击头像进入个人对话

This commit is contained in:
kuaifan 2022-12-07 20:21:49 +08:00
parent 42031982a3
commit f4a7b8e2bb
4 changed files with 16 additions and 8 deletions

View File

@ -17,7 +17,7 @@
<Icon type="ios-chatbubbles" @click="openDialog"/> <Icon type="ios-chatbubbles" @click="openDialog"/>
</div> </div>
</div> </div>
<div class="avatar-wrapper"> <div class="avatar-wrapper" :class="{'avatar-pointer': clickOpenDialog}" @click="onClickOpen">
<div v-if="showIcon" :class="boxClass" :style="boxStyle"> <div v-if="showIcon" :class="boxClass" :style="boxStyle">
<em :style="spotStyle"></em> <em :style="spotStyle"></em>
<EAvatar v-if="showImg" ref="avatar" :class="{'avatar-default':isDefault}" :src="user.userimg" :size="avatarSize" :error="onError"> <EAvatar v-if="showImg" ref="avatar" :class="{'avatar-default':isDefault}" :src="user.userimg" :size="avatarSize" :error="onError">
@ -69,6 +69,10 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
clickOpenDialog: {
type: Boolean,
default: false
},
tooltipPlacement: { tooltipPlacement: {
type: String, type: String,
default: 'bottom' default: 'bottom'
@ -283,6 +287,12 @@
this.userResult(info); this.userResult(info);
}, },
onClickOpen() {
if (this.clickOpenDialog) {
this.openDialog()
}
},
openDialog() { openDialog() {
this.$store.dispatch("openDialogUserid", this.userid); this.$store.dispatch("openDialogUserid", this.userid);
}, },

View File

@ -22,12 +22,7 @@
</div> </div>
<template v-else> <template v-else>
<div class="dialog-avatar"> <div class="dialog-avatar">
<UserAvatar <UserAvatar :userid="source.userid" tooltip-disabled :click-open-dialog="dialogData.type == 'group'" :size="30"/>
:userid="source.userid"
:tooltipDisabled="source.userid == userId || dialogData.type != 'group'"
:show-icon-menu="dialogData.type == 'group'"
:open-delay="100"
:size="30"/>
</div> </div>
<DialogView <DialogView
:msg-data="source" :msg-data="source"

View File

@ -2,7 +2,7 @@
<div class="dialog-view" :class="viewClass" :data-id="msgData.id"> <div class="dialog-view" :class="viewClass" :data-id="msgData.id">
<!--昵称--> <!--昵称-->
<div v-if="dialogType === 'group'" class="dialog-username"> <div v-if="dialogType === 'group'" class="dialog-username">
<UserAvatar :userid="msgData.userid" :show-icon="false" :show-name="true" :tooltip-disabled="true"/> <UserAvatar :userid="msgData.userid" :show-icon="false" :show-name="true" click-open-dialog/>
</div> </div>
<div <div

View File

@ -74,6 +74,9 @@
white-space: nowrap; white-space: nowrap;
} }
} }
&.avatar-pointer {
cursor: pointer;
}
} }
.common-avatar-transfer { .common-avatar-transfer {
padding: 4px 2px; padding: 4px 2px;