|
@@ -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)
|
|
|
}
|