会话代码调整

This commit is contained in:
joylink_cuiweidong 2020-09-25 17:33:18 +08:00
parent bc10b0cbb2
commit 2c27c5a62c
2 changed files with 106 additions and 9 deletions

View File

@ -409,17 +409,19 @@ export default {
this.conversitionStateMap = {};
},
'$store.state.socket.acceptConversionInvite':function(val) {
this.treeData.forEach(data => {
data.children && data.children.forEach(item => {
if (val.memberId == item.id && val.memberId != this.myMemberId) {
if (item.active) {
item.loading = false;
} else {
item.active = true;
if (this.conversitionId == val.id) {
this.treeData.forEach(data => {
data.children && data.children.forEach(item => {
if (val.memberId == item.id && val.memberId != this.myMemberId) {
if (item.active) {
item.loading = false;
} else {
item.active = true;
}
}
}
});
});
});
}
}
},
mounted() {

View File

@ -0,0 +1,95 @@
<template>
<div v-show="dialogVisible" class="chatTooltipAll">
<div class="chatTooltip">
<div class="chatTooltipHeader">
{{ inviteUserName }} 邀请您加入会话
</div>
<div class="chatTooltipBootom">
<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>
</div>
</div>
</template>
<script>
import {acceptConversitionInvite} from '@/api/chat';
export default {
name:'ChatTooltip',
props: {
group: {
type: String,
required: true
},
inviteUserName:{
type: String,
required: true
},
conversitionId:{
type: String,
required: true
}
},
data() {
return {
dialogVisible:false,
loading:false
};
},
// {"conversationId":"22e10b17-7a6c-4b1b-8724-f87fb2053b76","from":{"id":"17","userId":"75","name":"",
// "role":"STATION_SUPERVISOR","deviceType":"STATION","deviceCode":"Station32955","deviceName":"","online":true,"robot":false}
methods:{
doShow() {
this.loading = false;
this.dialogVisible = true;
},
doCreate() {
this.loading = true;
acceptConversitionInvite(this.group, this.conversitionId).then(res=>{
this.loading = false;
this.dialogVisible = false;
this.$emit('acceptUser', res.data.creatorId);
}).catch(error=>{
this.$messageBox('接受邀请失败: ' + error.message);
});
},
doClose() {
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
.chatTooltip{
position: absolute;
width: 290px;
left: 23%;
top: 42%;
z-index: 5;
background: #fff;
padding: 15px;
box-shadow: #969090 0px 0px 10px;
border-radius: 4px;
line-height: 20px;
transform: translateY(-50%);
}
.chatTooltipHeader{
margin-top:10px;
font-size:14px;
}
.chatTooltipBootom{
margin-top:10px;
text-align: center;
margin-bottom:10px;
}
.chatTooltipAll{
position:absolute;
width:100%;
height:100%;
left:0;
top:0;
z-index: 10;
}
</style>