wkw 1 сар өмнө
parent
commit
25b97730c1
1 өөрчлөгдсөн 14 нэмэгдсэн , 2 устгасан
  1. 14 2
      src/views/im/index.vue

+ 14 - 2
src/views/im/index.vue

@@ -84,7 +84,7 @@
 
 <script setup>
 import { useWalletStore } from "@/stores/modules/walletStore";
-import { userList } from "@/api/path/im.api";
+import { userList,friendRequest } from "@/api/path/im.api";
 import { ref } from 'vue'
 import { useRouter } from 'vue-router'
 import Discover from './components/Discover/Discover.vue'
@@ -119,7 +119,7 @@ const unread = computed(() =>{
   // let dataInfo =  wsStore.messages.filter(item =>{
   //   return item.messageType == MESSAGE_APPLY_FRIEND
   // })
-  return firendDic.length>0
+  return firendDic && firendDic.length>0
 })
 
 const getuserList = async (refresh=false) => {
@@ -198,12 +198,24 @@ const goToPage = (url) => {
 const goSearch = () => {
   router.push('chatSearch')
 }
+// 获取好友申请接口
+// const getfriendRequest = async () => {
+//   let firendDic = systemStore.FirendList;
+//   console.log(firendDic)
+//   if(firendDic && firendDic.length > 0) return;
+//   const res = await friendRequest({ uuid: walletStore.account, status: 1,state:1 });
+//   systemStore.FirendList = res.data || [];
+// }
 onMounted(()=>{
   getuserList();
+  // getfriendRequest();
   eventBus.$off('newMessage')
   eventBus.$on('newMessage', (payload) => {
     if(payload.messageType == MESSAGE_APPLY_FRIEND){
       let firendDic = systemStore.FirendList;
+      // if(firendDic.indexOf(payload.to) < 0){
+      //   firendDic.push(payload.to)
+      // }
       if(!firendDic.some(val=> val.to === payload.to)){
         firendDic.push(payload)
       }