🐛 Bug fixes of friends and voice chat
This commit is contained in:
		| @@ -42,8 +42,8 @@ const props = defineProps<{ item: any }>() | |||||||
| const emits = defineEmits(["approve", "decline"]) | const emits = defineEmits(["approve", "decline"]) | ||||||
|  |  | ||||||
| const canApprove = computed(() => { | const canApprove = computed(() => { | ||||||
|   return props.item.status !== 1 && |   return props.item.status === 2 || | ||||||
|     (props.item.status !== 0 && props.item.related_id !== id.userinfo.data?.id) |     (props.item.status === 0 && props.item.related_id === id.userinfo.data?.id) | ||||||
| }) | }) | ||||||
| const canDecline = computed(() => { | const canDecline = computed(() => { | ||||||
|   return props.item.status !== 2 |   return props.item.status !== 2 | ||||||
|   | |||||||
| @@ -21,7 +21,11 @@ | |||||||
|           @group:selected="(val) => val && mountJitsi()" |           @group:selected="(val) => val && mountJitsi()" | ||||||
|         > |         > | ||||||
|           <template #text> |           <template #text> | ||||||
|             <div class="call-container w-full h-[380px]"> |             <v-expand-transition> | ||||||
|  |               <v-progress-linear v-show="joining" indeterminate /> | ||||||
|  |             </v-expand-transition> | ||||||
|  |  | ||||||
|  |             <div class="call-container w-full h-[360px]"> | ||||||
|               <div id="call" class="h-full w-full" v-if="channels.call"></div> |               <div id="call" class="h-full w-full" v-if="channels.call"></div> | ||||||
|             </div> |             </div> | ||||||
|           </template> |           </template> | ||||||
| @@ -54,6 +58,7 @@ const chatList = ref<HTMLDivElement>() | |||||||
|  |  | ||||||
| const { showErrorSnackbar } = useUI() | const { showErrorSnackbar } = useUI() | ||||||
| const loading = ref(false) | const loading = ref(false) | ||||||
|  | const joining = ref(false) | ||||||
|  |  | ||||||
| const pagination = reactive({ page: 1, pageSize: 10, total: 0 }) | const pagination = reactive({ page: 1, pageSize: 10, total: 0 }) | ||||||
|  |  | ||||||
| @@ -136,6 +141,10 @@ watch( | |||||||
|   () => channels.call, |   () => channels.call, | ||||||
|   (val) => { |   (val) => { | ||||||
|     if (!val) { |     if (!val) { | ||||||
|  |       if (jitsiInstance) { | ||||||
|  |         jitsiInstance.executeCommand("endConference") | ||||||
|  |         jitsiInstance.executeCommand("hangup") | ||||||
|  |       } | ||||||
|       unmountJitsi() |       unmountJitsi() | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -145,16 +154,17 @@ let mounted = false | |||||||
| let jitsiInstance: any | let jitsiInstance: any | ||||||
|  |  | ||||||
| async function mountJitsi() { | async function mountJitsi() { | ||||||
|  |   joining.value = true | ||||||
|   if (mounted) return false |   if (mounted) return false | ||||||
|   if (!channels.call) return |   if (!channels.call) return | ||||||
|   const tk = await channels.exchangeCallToken() |   const tk = await channels.exchangeCallToken() | ||||||
|   console.log(tk) |  | ||||||
|   if (!tk) return |   if (!tk) return | ||||||
|   const domain = tk.endpoint.replace("http://", "").replace("https://", "") |   const domain = tk.endpoint.replace("http://", "").replace("https://", "") | ||||||
|   const options = { |   const options = { | ||||||
|     roomName: channels.call.external_id, |     roomName: channels.call.external_id, | ||||||
|     parentNode: document.querySelector("#call"), |     parentNode: document.querySelector("#call"), | ||||||
|     jwt: tk.token |     onload: () => joining.value = false, | ||||||
|  |     jwt: tk.token, | ||||||
|   } |   } | ||||||
|   // This class imported by the script tag in index.html |   // This class imported by the script tag in index.html | ||||||
|   // @ts-ignore |   // @ts-ignore | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user