2020-05-14 14:36:15 +08:00
|
|
|
<template>
|
|
|
|
<div :class="showMembers?'memberAnimate chat-box-members':'chat-box-members'">
|
|
|
|
<div class="chat-member-title">成员列表</div>
|
|
|
|
<div class="chat-member-list">
|
|
|
|
<div
|
|
|
|
v-for="member in memberList"
|
|
|
|
:key="member.id"
|
|
|
|
:class="member.online?'each-chat-member':'each-chat-member each-chat-member-outline'"
|
2020-05-14 15:48:25 +08:00
|
|
|
@click="createConversition(member)"
|
2020-05-14 14:36:15 +08:00
|
|
|
>{{ member.memberName }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
2020-05-14 15:48:25 +08:00
|
|
|
import {getSimulationMembersNew, getSimulationConversationIdNew} from '@/api/chat';
|
2020-05-14 14:36:15 +08:00
|
|
|
import ConstConfig from '@/scripts/ConstConfig';
|
|
|
|
import Cookies from 'js-cookie';
|
|
|
|
export default {
|
|
|
|
name: 'ChatMemberList',
|
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showMembers:false,
|
|
|
|
memberList:[]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.getSimulationMembers();
|
|
|
|
},
|
|
|
|
methods:{
|
2020-05-14 15:48:25 +08:00
|
|
|
createConversition(member) {
|
|
|
|
if (member.userId != this.$store.state.user.id && member.online) {
|
|
|
|
getSimulationConversationIdNew({ memberId: member.id }, this.group).then(resp => {
|
|
|
|
if (resp.data) {
|
|
|
|
const data = resp.data;
|
|
|
|
this.$emit('addCoversition', {data:data, headerTitle:member.memberName});
|
|
|
|
this.showMembers = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2020-05-14 14:36:15 +08:00
|
|
|
setMemberStatus(memberInfo) {
|
|
|
|
this.getSimulationMembers();
|
|
|
|
// memberInfo.forEach(member=>{
|
|
|
|
// if (this.coversitionList) {
|
|
|
|
// this.coversitionList.forEach(item=>{
|
|
|
|
// if (item.id == member.id) {
|
|
|
|
// item.online = member.online;
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
getSimulationMembers() {
|
|
|
|
getSimulationMembersNew(this.$route.query.group).then(resp => {
|
|
|
|
let lastData = JSON.stringify(resp.data);
|
|
|
|
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
|
|
|
|
roleTypeList.forEach(function(element) {
|
|
|
|
const rolename = element.value;
|
|
|
|
if (Cookies.get('user_lang') == 'en') {
|
|
|
|
lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel);
|
|
|
|
} else {
|
|
|
|
lastData = lastData.replace(new RegExp(rolename, 'g'), element.label);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
lastData = JSON.parse(lastData);
|
|
|
|
lastData.map(member=>{
|
|
|
|
const deviceName = member.deviceName ? '-' + member.deviceName : '';
|
|
|
|
const memberName = member.name ? '-' + member.name : '';
|
|
|
|
member.memberName = member.role + deviceName + memberName;
|
|
|
|
return member;
|
|
|
|
});
|
|
|
|
this.memberList = lastData;
|
|
|
|
});
|
|
|
|
},
|
2020-05-15 16:54:31 +08:00
|
|
|
getMember(memberId) {
|
|
|
|
return this.memberList.filter(member=>{
|
|
|
|
return member.id == memberId;
|
|
|
|
});
|
|
|
|
},
|
2020-05-14 14:36:15 +08:00
|
|
|
doShow() {
|
|
|
|
if (this.showMembers) {
|
|
|
|
this.showMembers = false;
|
|
|
|
} else {
|
|
|
|
this.showMembers = true;
|
|
|
|
this.getSimulationMembers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.memberAnimate{
|
|
|
|
transform: translateX(97%);
|
|
|
|
}
|
|
|
|
.chat-box-members{
|
|
|
|
position: absolute;
|
|
|
|
width: 140px;
|
|
|
|
right: 0;
|
|
|
|
height: 100%;
|
|
|
|
background: #fff;
|
|
|
|
border-right: 1px #dedede solid;
|
|
|
|
border-radius: 0px 5px 5px 0px;
|
|
|
|
z-index: 2;
|
|
|
|
transition: transform 1s;
|
|
|
|
padding: 12px 2px 10px 16px;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
.chat-member-title{
|
|
|
|
}
|
|
|
|
.chat-member-list{
|
|
|
|
margin-top: 13px;
|
|
|
|
font-size: 12px;
|
|
|
|
margin-left: 2px;
|
|
|
|
height: 350px;
|
|
|
|
overflow-y: auto;
|
|
|
|
}
|
|
|
|
.each-chat-member{
|
|
|
|
margin-bottom: 10px;
|
|
|
|
width: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.each-chat-member-outline{
|
|
|
|
color: #ccc;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 谷歌、safari、qq浏览器、360浏览器滚动条样式
|
|
|
|
// 定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸
|
|
|
|
.chat-member-list::-webkit-scrollbar {
|
|
|
|
width: 6px;
|
|
|
|
height: 6px;
|
|
|
|
// height: 110px;
|
|
|
|
background-color: #FFFFFF;
|
|
|
|
}
|
|
|
|
/*定义滚动条轨道 内阴影+圆角*/
|
|
|
|
.chat-member-list::-webkit-scrollbar-track {
|
|
|
|
// box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
|
|
|
border-radius: 10px;
|
|
|
|
background-color: #FFFFFF;;
|
|
|
|
}
|
|
|
|
/*定义滑块 内阴影+圆角*/
|
|
|
|
.chat-member-list::-webkit-scrollbar-thumb {
|
|
|
|
border-radius: 10px;
|
|
|
|
// box-shadow: inset 0 0 6px rgba(0,0,0,.3);
|
|
|
|
background-color: #cacaca;
|
|
|
|
}
|
|
|
|
/*滑块效果*/
|
|
|
|
.chat-member-list::-webkit-scrollbar-thumb:hover {
|
|
|
|
border-radius: 5px;
|
|
|
|
// box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
|
|
|
|
background: rgba(0,0,0,0.4);
|
|
|
|
}
|
|
|
|
/*IE滚动条颜色*/
|
|
|
|
html {
|
|
|
|
scrollbar-face-color:#bfbfbf;/*滚动条颜色*/
|
|
|
|
scrollbar-highlight-color:#000;
|
|
|
|
scrollbar-3dlight-color:#000;
|
|
|
|
scrollbar-darkshadow-color:#000;
|
|
|
|
scrollbar-Shadow-color:#adadad;/*滑块边色*/
|
|
|
|
scrollbar-arrow-color:rgba(0,0,0,0.4);/*箭头颜色*/
|
|
|
|
scrollbar-track-color:#eeeeee;/*背景颜色*/
|
|
|
|
}
|
|
|
|
</style>
|