jubs пре 2 месеци
родитељ
комит
af11e08251

+ 8 - 1
ruoyi-ui-vue2/src/api/common/MessageChat.js

@@ -23,11 +23,18 @@ export function readChatMessage(data){
     data: data
   })
 
-}export function getChatRoomByQuery(data){
+}
+export function getChatRoomByQuery(data){
   return request({
     url: '/common/messageChat/getChatRoomByQuery',
     method: 'get',
     params: data
   })
 }
+export function getUnReadTotal(){
+  return request({
+    url: '/common/messageChat/getUnreadTotal',
+    method: 'get',
+  })
+}
 

+ 6 - 2
ruoyi-ui-vue2/src/components/FloatingComponent/index.vue

@@ -162,7 +162,7 @@ import Row from "../CustomElement/layout/Row.vue";
 import Col from "../CustomElement/layout/Col.vue";
 import CustomForm from "../CustomElement/CustomForm/CustomForm.vue";
 import CustomInput from "../CustomElement/CustomForm/items/CustomInput.vue";
-import {getChatRoomByQuery, readChatMessage, tosendInputMessage} from "@/api/common/MessageChat";
+import {getChatRoomByQuery, getUnReadTotal, readChatMessage, tosendInputMessage} from "@/api/common/MessageChat";
 import ChatInput from "../CustomElement/ChatInput.vue";
 import {getPageMessageChatContent} from "@/api/common/MessageChatContent";
 import {judgeIsBeforeNow, parseTime} from "@/utils/dateUtils";
@@ -296,7 +296,7 @@ export default {
     },
 
     queryChatRoom() {
-      getChatRoomByQuery(this.queryParams).then(res => {
+      getChatRoomByQuery(this.queryParams).then(async res => {
         if (200 === res.code) {
           this.chatRooms = res.data;
           this.activeChatRoom = this.chatRooms.find(item => item.active === '0') || this.chatRooms[0];
@@ -306,6 +306,8 @@ export default {
           if (res.data && res.data.length === 0) {
             this.messageList = [];
           }
+          let ress = await getUnReadTotal();
+          this.totalQty = ress.data;
         }
       })
 
@@ -371,6 +373,8 @@ export default {
       tosendInputMessage(row).then(async res => {
         if (res && res.code === 200) {
           this.$set(this.sendMessageInfo, 'messageContent', '')
+          let unreadRes = await readChatMessage(this.activeChatRoom);
+          this.totalQty = unreadRes.data;
           await this.handleQueryContentList(this.activeChatRoom);
         }
       }).finally(() => {