You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
2.6 KiB

<template>
2 years ago
<div class="friend-item" :class="active ? 'active' : ''" @contextmenu.prevent="showRightMenu($event)">
<div class="friend-avatar">
2 years ago
<head-image :name="friend.nickName"
:url="friend.headImage"
:online="friend.online">
</head-image>
</div>
2 years ago
<div class="friend-info">
<div class="friend-name">{{ friend.nickName}}</div>
2 years ago
<div class="friend-online online">
<span v-show="friend.onlineWeb" class="el-icon-s-platform" title="电脑端在线"></span>
<span v-show="friend.onlineApp" class="el-icon-mobile-phone" title="移动端在线"></span>
</div>
</div>
2 years ago
<right-menu v-show="menu && rightMenu.show" :pos="rightMenu.pos" :items="rightMenu.items"
@close="rightMenu.show=false" @select="handleSelectMenu"></right-menu>
<slot></slot>
</div>
</template>
<script>
import HeadImage from '../common/HeadImage.vue';
2 years ago
import RightMenu from "../common/RightMenu.vue";
export default {
name: "frinedItem",
components: {
2 years ago
HeadImage,
RightMenu
},
data() {
2 years ago
return {
rightMenu: {
show: false,
pos: {
x: 0,
y: 0
},
items: [{
key: 'CHAT',
name: '发送消息',
icon: 'el-icon-chat-dot-round'
}, {
key: 'DELETE',
name: '删除好友',
icon: 'el-icon-delete'
}]
}
}
},
2 years ago
methods: {
showRightMenu(e) {
this.rightMenu.pos = {
x: e.x,
y: e.y
};
this.rightMenu.show = "true";
},
handleSelectMenu(item) {
this.$emit(item.key.toLowerCase(), this.msgInfo);
}
},
props: {
friend: {
type: Object
},
active: {
type: Boolean
},
index: {
type: Number
},
2 years ago
menu: {
type: Boolean,
default: true
}
2 years ago
},
mounted() {
console.log(this.menu)
}
2 years ago
}
</script>
<style scope lang="scss">
.friend-item {
height: 65px;
display: flex;
margin-bottom: 1px;
position: relative;
2 years ago
padding-left: 10px;
align-items: center;
padding-right: 5px;
background-color: #fafafa;
white-space: nowrap;
2 years ago
&:hover {
background-color: #eeeeee;
}
&.active {
background-color: #dddddd;
}
2 years ago
.friend-avatar {
display: flex;
justify-content: center;
align-items: center;
2 years ago
width: 50px;
height: 50px;
}
2 years ago
.friend-info {
flex: 1;
display: flex;
flex-direction: column;
2 years ago
padding-left: 10px;
text-align: left;
2 years ago
.friend-name {
2 years ago
font-size: 15px;
2 years ago
font-weight: 600;
line-height: 30px;
white-space: nowrap;
overflow: hidden;
}
2 years ago
.friend-online {
2 years ago
padding-right: 15px;
font-size: 16px;
font-weight: 600;
color: #2f6dce;
}
}
}
2 years ago
</style>