200 lines
5.4 KiB
Vue
200 lines
5.4 KiB
Vue
<template>
|
|
<div v-show="dialogVisible" class="chat-create-group">
|
|
<div class="create-group-header">
|
|
<div class="create-group-title">添加会话对象</div>
|
|
<div class="create-group-close">
|
|
<i class="el-icon-close" @click="dialogVisible=false" />
|
|
</div>
|
|
</div>
|
|
<div class="create-group-content">
|
|
<div class="chat-member-list">
|
|
<el-checkbox-group v-model="checkList">
|
|
<el-checkbox
|
|
v-for="member in memberList"
|
|
:key="member.id"
|
|
class="each-chat-member"
|
|
:label="member"
|
|
:disabled="member.disabled"
|
|
>{{ member.memberName }}</el-checkbox>
|
|
</el-checkbox-group>
|
|
</div>
|
|
<div class="currentSelectList">
|
|
<div
|
|
v-for="member in checkList"
|
|
:key="member.id"
|
|
class="eachSelect"
|
|
>
|
|
{{ member.memberName }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="create-group-bottom">
|
|
<el-button :loading="loading" size="small" type="primary" @click="doCreate">创建会话</el-button>
|
|
<el-button size="small" @click="doClose">取消</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import {startConversition} from '@/api/chat';
|
|
export default {
|
|
name:'ChatCreateGroup',
|
|
props: {
|
|
group: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
memberList:{
|
|
type: Array,
|
|
required: true
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
dialogVisible:false,
|
|
loading:false,
|
|
checkList:[]
|
|
};
|
|
},
|
|
computed:{
|
|
userId() {
|
|
return parseInt(this.$store.state.user.id);
|
|
}
|
|
},
|
|
methods:{
|
|
doShow() {
|
|
this.dialogVisible = true;
|
|
},
|
|
doCreate() {
|
|
if (this.checkList.length > 0) {
|
|
this.loading = true;
|
|
const checkList = this.checkList.map(function(check) { return check.id; });
|
|
startConversition(this.group, checkList).then(resp => {
|
|
if (resp.data) {
|
|
const data = resp.data;
|
|
this.loading = false;
|
|
this.$emit('addCoversition', {data:data, headerTitle:resp.data.name});
|
|
this.dialogVisible = false;
|
|
this.checkList = [];
|
|
}
|
|
}).catch(error=>{
|
|
this.$messageBox('创建会话失败: ' + error.message);
|
|
this.loading = false;
|
|
this.dialogVisible = false;
|
|
this.checkList = [];
|
|
});
|
|
}
|
|
|
|
},
|
|
doClose() {
|
|
this.checkList = [];
|
|
this.dialogVisible = false;
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.chat-create-group{
|
|
position: absolute;
|
|
width: 70%;
|
|
height: 300px;
|
|
border: 1px #dedede solid;
|
|
left: 26%;
|
|
top: 8%;
|
|
z-index: 7;
|
|
border-radius: 8px;
|
|
box-shadow: #b5aeae 0 0 10px;
|
|
background: #fff;
|
|
}
|
|
.create-group-header{
|
|
padding-left: 10px;
|
|
padding-top: 6px;
|
|
font-size: 14px;
|
|
border-bottom: 1px #dedede solid;
|
|
padding-bottom: 6px;
|
|
}
|
|
.create-group-title{
|
|
display: inline-block;
|
|
}
|
|
.create-group-close{
|
|
float: right;
|
|
display: inline-block;
|
|
margin-right: 5px;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
}
|
|
.chat-member-list{
|
|
width: 54%;
|
|
height: 216px;
|
|
overflow-y: auto;
|
|
padding: 5px 10px;
|
|
font-size: 14px;
|
|
overflow-x: hidden;
|
|
border-right: 1px #ccc solid;
|
|
display:inline-block;
|
|
}
|
|
.create-group-content{
|
|
width: 100%;
|
|
height: 220px;
|
|
padding-bottom: 10px;
|
|
border-bottom: 1px #dedede solid;
|
|
}
|
|
.create-group-bottom{
|
|
text-align: center;
|
|
margin-top:8px;
|
|
}
|
|
.each-chat-member{
|
|
display:block;
|
|
margin-top:5px;
|
|
}
|
|
.currentSelectList{
|
|
display: inline-block;
|
|
width: 44%;
|
|
font-size: 14px;
|
|
vertical-align: top;
|
|
padding: 5px 10px;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
height: 216px;
|
|
}
|
|
.eachSelect{
|
|
display:block;
|
|
margin-top:5px;
|
|
}
|
|
// 谷歌、safari、qq浏览器、360浏览器滚动条样式
|
|
// 定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸
|
|
.chat-member-list::-webkit-scrollbar,.currentSelectList::-webkit-scrollbar {
|
|
width: 6px;
|
|
height: 6px;
|
|
// height: 110px;
|
|
background-color: #FFFFFF;
|
|
}
|
|
/*定义滚动条轨道 内阴影+圆角*/
|
|
.chat-member-list::-webkit-scrollbar-track,.currentSelectList::-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,.currentSelectList::-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,.currentSelectList::-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>
|