Files
urbanLifeline/urbanLifelineWeb/packages/workcase_wechat/pages/meeting/Meeting.uvue
2025-12-26 10:37:52 +08:00

118 lines
3.4 KiB
Plaintext

<template>
<view class="meeting-page">
<!-- 自定义导航栏 -->
<view class="meeting-nav" :style="{ paddingTop: statusBarHeight + 'px', height: navBarHeight + 'px' }">
<view class="nav-back" @tap="confirmExit">
<text class="back-icon">←</text>
</view>
<text class="nav-title">视频会议</text>
<view class="nav-right" @tap="endMeeting">
<text class="end-btn">结束会议</text>
</view>
</view>
<!-- Web-view加载Jitsi Meet -->
<web-view
:src="meetingUrl"
:webview-styles="webviewStyles"
@message="handleWebViewMessage"
@error="handleWebViewError"
></web-view>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { workcaseChatAPI } from '@/api/workcase'
const statusBarHeight = ref(44)
const navBarHeight = ref(88)
const meetingUrl = ref('')
const meetingId = ref('')
const webviewStyles = ref({
progress: {
color: '#667eea'
}
})
onMounted(() => {
// 获取状态栏高度
const windowInfo = uni.getWindowInfo()
statusBarHeight.value = windowInfo.statusBarHeight || 44
navBarHeight.value = statusBarHeight.value + 44
// 获取页面参数
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1] as any
if (currentPage && currentPage.options) {
meetingUrl.value = decodeURIComponent(currentPage.options.meetingUrl || '')
meetingId.value = currentPage.options.meetingId || ''
}
console.log('[MeetingView] 会议页面加载:', {
meetingId: meetingId.value,
meetingUrl: meetingUrl.value
})
})
// 确认退出
function confirmExit() {
uni.showModal({
title: '提示',
content: '确定要退出会议吗?',
success: (res) => {
if (res.confirm) {
uni.navigateBack()
}
}
})
}
// 结束会议
async function endMeeting() {
if (!meetingId.value) {
uni.navigateBack()
return
}
uni.showModal({
title: '提示',
content: '确定要结束会议吗?这将关闭所有参与者的会议。',
success: async (res) => {
if (res.confirm) {
try {
uni.showLoading({ title: '结束会议中...' })
await workcaseChatAPI.endVideoMeeting(meetingId.value)
uni.hideLoading()
uni.showToast({ title: '会议已结束', icon: 'success' })
setTimeout(() => uni.navigateBack(), 1500)
} catch (e) {
uni.hideLoading()
console.error('[MeetingView] 结束会议失败:', e)
uni.showToast({ title: '结束会议失败', icon: 'none' })
uni.navigateBack()
}
}
}
})
}
// 处理webview消息
function handleWebViewMessage(e: any) {
console.log('[MeetingView] webview消息:', e)
// 可以在这里处理Jitsi Meet发送的消息
// 例如:会议结束、参与者加入/离开等事件
}
// 处理webview错误
function handleWebViewError(e: any) {
console.error('[MeetingView] webview错误:', e)
uni.showToast({ title: '会议加载失败', icon: 'none' })
}
</script>
<style lang="scss" scoped>
@import url("./Meeting.scss")
</style>