This commit is contained in:
fan 2023-05-22 17:16:53 +08:00
commit 1501a75ad3
3 changed files with 27 additions and 7 deletions

View File

@ -1,8 +1,8 @@
<template> <template>
<div> <div>
<div class="alarm-button"> <div>
<el-button type="warning" icon="el-icon-message-solid" circle @click="showAlarm" /> <!-- <el-button type="warning" icon="el-icon-message-solid" circle @click="showAlarm" />
<div v-if="alarmDetailMessageList.length>0" class="alarm-counter">{{ alarmDetailMessageList.length }}</div> <div v-if="alarmDetailMessageList.length>0" class="alarm-counter">{{ alarmDetailMessageList.length }}</div> -->
<audio ref="audio" /> <audio ref="audio" />
</div> </div>
<!-- <el-dialog <!-- <el-dialog

View File

@ -56,7 +56,7 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<chat-content :id="id" :group-name="activeGroupName" :private-chat-id="privateChatId" :message-list="activeMessageList" /> <chat-content v-if="id || privateChatId" :id="id" :group-name="activeGroupName" :private-chat-id="privateChatId" :message-list="activeMessageList" />
</div> </div>
</div> </div>
<div v-show="tabActive==1" class="contentBox"> <div v-show="tabActive==1" class="contentBox">
@ -129,6 +129,13 @@ export default {
memberData() { memberData() {
return this.$store.state.training.memberData; return this.$store.state.training.memberData;
}, },
totalUnread() {
let n = 0;
this.groupList.forEach(item => {
n += this.getBadge(item.messageList);
});
return n;
},
chatList() { chatList() {
const list = JSON.parse(JSON.stringify(this.groupList)); const list = JSON.parse(JSON.stringify(this.groupList));
this.noIdChatList.forEach(item => { this.noIdChatList.forEach(item => {
@ -168,7 +175,10 @@ export default {
'$store.state.socket.simulationReset': function (val) { // 仿 '$store.state.socket.simulationReset': function (val) { // 仿
if (val) { if (val) {
this.id = 0; this.id = 0;
this.privateChatId = '';
this.$store.dispatch('socket/resetConversationGroup'); this.$store.dispatch('socket/resetConversationGroup');
this.groupList = [];
this.noIdChatList = [];
} }
}, },
'$store.state.socket.conversationGroup.MESSAGE': function(val) { '$store.state.socket.conversationGroup.MESSAGE': function(val) {
@ -191,6 +201,7 @@ export default {
} }
if (val.id) { if (val.id) {
this.groupList.push({...val, messageList: [], imageUrl: ''}); this.groupList.push({...val, messageList: [], imageUrl: ''});
this.removeNoIdItem();
} }
}, },
'$store.state.socket.conversationGroup.UPDATE_NAME': function(val) { '$store.state.socket.conversationGroup.UPDATE_NAME': function(val) {
@ -228,6 +239,9 @@ export default {
this.groupList.splice(index, 1); this.groupList.splice(index, 1);
} }
}, },
totalUnread() {
this.$emit('setTotalUnread', this.totalUnread);
},
myMemberId() { myMemberId() {
this.getGroupList(); this.getGroupList();
}, },
@ -350,7 +364,7 @@ export default {
}, },
sendPrivateMsg(item) { sendPrivateMsg(item) {
this.privateChatId = item.id; this.privateChatId = item.id;
const findIndex = this.groupList.findIndex(ii => { const findIndex = this.chatList.findIndex(ii => {
return ii.type == 'PRIVATE_CHAT' && ii.memberList.find(m => { return ii.type == 'PRIVATE_CHAT' && ii.memberList.find(m => {
return m.memberId == item.id; return m.memberId == item.id;
}); });

View File

@ -1,9 +1,11 @@
<template> <template>
<div v-quickMenuDrag class="voice-chat-box"> <div v-quickMenuDrag class="voice-chat-box">
<div v-if="chatBoxMin" :id="sideButtonDom.domId" @click="clickBtn"> <div v-if="chatBoxMin" :id="sideButtonDom.domId" @click="clickBtn">
<el-button circle style="color: #0C161A;" icon="el-icon-mic" /> <el-badge :value="totalUnreadNum" :hidden="!totalUnreadNum" :max="99">
<el-button circle style="color: #0C161A;" icon="el-icon-mic" />
</el-badge>
</div> </div>
<chatDialog ref="chatDialog" /> <chatDialog ref="chatDialog" @setTotalUnread="setTotalUnread" />
</div> </div>
</template> </template>
@ -18,6 +20,7 @@ export default {
}, },
data() { data() {
return { return {
totalUnreadNum: 0
}; };
}, },
computed:{ computed:{
@ -33,6 +36,9 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
setTotalUnread(val) {
this.totalUnreadNum = val;
},
clickBtn() { clickBtn() {
const operate = { const operate = {
operation: this.sideButtonDom.operation, operation: this.sideButtonDom.operation,