From 3c02691511c09ac4cf71c047ac23031b252197b2 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 6 Apr 2024 23:36:10 +0800 Subject: [PATCH] :bug: Bug fixes of friends and voice chat --- src/components/friends/FriendListItem.vue | 4 ++-- src/views/chat/page.vue | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/friends/FriendListItem.vue b/src/components/friends/FriendListItem.vue index be9a99c..f46dcc4 100644 --- a/src/components/friends/FriendListItem.vue +++ b/src/components/friends/FriendListItem.vue @@ -42,8 +42,8 @@ const props = defineProps<{ item: any }>() const emits = defineEmits(["approve", "decline"]) const canApprove = computed(() => { - return props.item.status !== 1 && - (props.item.status !== 0 && props.item.related_id !== id.userinfo.data?.id) + return props.item.status === 2 || + (props.item.status === 0 && props.item.related_id === id.userinfo.data?.id) }) const canDecline = computed(() => { return props.item.status !== 2 diff --git a/src/views/chat/page.vue b/src/views/chat/page.vue index ed43eaf..87106a8 100644 --- a/src/views/chat/page.vue +++ b/src/views/chat/page.vue @@ -21,7 +21,11 @@ @group:selected="(val) => val && mountJitsi()" > @@ -54,6 +58,7 @@ const chatList = ref() const { showErrorSnackbar } = useUI() const loading = ref(false) +const joining = ref(false) const pagination = reactive({ page: 1, pageSize: 10, total: 0 }) @@ -136,6 +141,10 @@ watch( () => channels.call, (val) => { if (!val) { + if (jitsiInstance) { + jitsiInstance.executeCommand("endConference") + jitsiInstance.executeCommand("hangup") + } unmountJitsi() } } @@ -145,16 +154,17 @@ let mounted = false let jitsiInstance: any async function mountJitsi() { + joining.value = true if (mounted) return false if (!channels.call) return const tk = await channels.exchangeCallToken() - console.log(tk) if (!tk) return const domain = tk.endpoint.replace("http://", "").replace("https://", "") const options = { roomName: channels.call.external_id, parentNode: document.querySelector("#call"), - jwt: tk.token + onload: () => joining.value = false, + jwt: tk.token, } // This class imported by the script tag in index.html // @ts-ignore