2019-11-08 09:13:38 +08:00
|
|
|
<template>
|
|
|
|
<div class="member">
|
|
|
|
<div class="member__head">
|
|
|
|
<div class="member__head--title"> 成员列表</div>
|
|
|
|
<div class="member__head--notes"> {{ members.length }}/{{ room.totalNum }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="member__container">
|
|
|
|
<el-input v-model="filterText" :placeholder="this.$t('global.enterNameToFilter')" clearable />
|
|
|
|
<el-scrollbar class="member__container--list" wrap-class="scrollbar-wrapper" :style="{height: treeHeight+'px'}">
|
|
|
|
<el-tree
|
|
|
|
ref="tree"
|
|
|
|
:data="filterMembers"
|
|
|
|
:filter-node-method="handleFilterNode"
|
|
|
|
:lazy="false"
|
|
|
|
:props="defaultProps"
|
|
|
|
@node-contextmenu="handleShowContextMenu"
|
|
|
|
>
|
|
|
|
<span slot-scope="{ node, data }">
|
|
|
|
<span v-if="node.data.inRoom" style="color: green;">{{ data.nickName }}</span>
|
|
|
|
<span v-else style="color: #ccc;">{{ data.nickName }}</span>
|
|
|
|
</span>
|
|
|
|
</el-tree>
|
|
|
|
</el-scrollbar>
|
|
|
|
</div>
|
2019-11-08 18:15:52 +08:00
|
|
|
<content-menu ref="menu" :click-user-id="clickUserId" />
|
2019-11-08 09:13:38 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { DeviceMenu } from '@/scripts/ConstDic';
|
2019-11-08 18:15:52 +08:00
|
|
|
import ContentMenu from './content-menu';
|
2019-11-08 09:13:38 +08:00
|
|
|
|
|
|
|
export default {
|
2019-11-08 18:15:52 +08:00
|
|
|
components: {
|
|
|
|
ContentMenu
|
|
|
|
},
|
2019-11-08 09:13:38 +08:00
|
|
|
props: {
|
|
|
|
room: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
members: {
|
|
|
|
type: Array,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
height: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2019-11-08 18:15:52 +08:00
|
|
|
filterText: '',
|
|
|
|
clickUserId: ''
|
2019-11-08 09:13:38 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
defaultProps() {
|
|
|
|
return { label: 'nickName' };
|
|
|
|
},
|
|
|
|
treeHeight() {
|
2019-11-18 17:11:40 +08:00
|
|
|
return this.height - 64;
|
2019-11-08 09:13:38 +08:00
|
|
|
},
|
|
|
|
filterMembers() {
|
|
|
|
return this.members.filter(e =>{ return e.nickName.includes(this.filterText); });
|
2019-11-08 18:15:52 +08:00
|
|
|
},
|
|
|
|
userId() {
|
|
|
|
return this.$store.state.user ? this.$store.state.user.id : '';
|
2019-11-08 09:13:38 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleFilterNode(value, data) {
|
|
|
|
if (!value) return true;
|
|
|
|
return data.name.indexOf(value) !== -1;
|
|
|
|
},
|
|
|
|
handleShowContextMenu(e, obj, node, vueElem) {
|
|
|
|
e.preventDefault();
|
2019-11-08 18:15:52 +08:00
|
|
|
const position = {
|
2019-11-08 09:13:38 +08:00
|
|
|
x: e.clientX,
|
|
|
|
y: e.clientY
|
|
|
|
};
|
2019-11-08 18:15:52 +08:00
|
|
|
|
2019-11-08 09:13:38 +08:00
|
|
|
if (this.userId == this.room.creatorId) {
|
2019-11-08 18:15:52 +08:00
|
|
|
this.clickUserId = `${obj.id || ''}`;
|
|
|
|
this.$store.dispatch('menuOperation/setPopMenu', { position, menu: DeviceMenu.JointRoom });
|
2019-11-08 09:13:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.member {
|
|
|
|
background: #f0f0f0;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
|
|
|
&__head {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
padding: 0 10px;
|
|
|
|
border-bottom: 1px solid #ccc;
|
|
|
|
|
|
|
|
&--title {
|
2019-11-18 17:11:40 +08:00
|
|
|
padding:10px 0px;
|
2019-11-08 09:13:38 +08:00
|
|
|
font-size: 16px;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
&--notes {
|
|
|
|
font-size: 16px;
|
2019-11-18 17:11:40 +08:00
|
|
|
padding:10px 0px;
|
2019-11-08 09:13:38 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: flex-end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&__container {
|
|
|
|
flex-grow: 1;
|
|
|
|
&--list {
|
|
|
|
background: #fff;
|
|
|
|
height: auto;
|
|
|
|
min-height: calc(100%-200px);
|
|
|
|
max-height: calc(100%-200px);
|
2019-11-18 17:11:40 +08:00
|
|
|
border-bottom: 1px #ccc solid;
|
2019-11-08 09:13:38 +08:00
|
|
|
|
|
|
|
&::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|