Files
zyt/TUICallKit-Vue3/TUIKit/components/MessageInput/AttachmentPicker/VoiceCallPicker.vue
T
2026-03-11 09:49:47 +08:00

43 lines
1.3 KiB
Vue

<template>
<div class="panel-box">
<div class="panel-item" @click="handleCall">
<image class="panel-icon" :src="CallVoiceIcon"></image>
</div>
<text class="panel-text">语音通话</text>
</div>
</template>
<script lang="ts" setup>
import { useConversationListState } from '../../../states/ConversationListState';
import { removeC2C } from '../../../utils'
import CallVoiceIcon from '../../../assets/chat/call-voice.svg'
import { TUIBridge } from '../../../TUIBridge';
import { EVENT } from '../../../constants/event';
const emit = defineEmits(['closePanel', 'showUserPicker']);
const { activeConversation } = useConversationListState();
const handleCall = () => {
emit('closePanel');
if (activeConversation.value?.type === 'GROUP') {
// 群聊:触发显示用户选择器事件
emit('showUserPicker', { type: 1 });
} else {
// 单聊:直接呼叫
const userID = removeC2C(activeConversation.value.conversationID);
TUIBridge.notifyEvent({
eventName: EVENT.ON_CALLS,
params: {
userIDList: [userID],
type: 1,
},
});
}
};
</script>
<style lang="scss" scoped>
@import './AttachmentPicker.module.scss';
</style>