暂存
This commit is contained in:
@@ -559,37 +559,120 @@ async function startMeeting() {
|
||||
const res = await workcaseChatAPI.getActiveMeeting(roomId.value)
|
||||
if (res.success && res.data) {
|
||||
// 已有活跃会议,直接加入
|
||||
const meetingUrl = res.data.iframeUrl
|
||||
const meetingPageUrl = res.data.iframeUrl
|
||||
const meetingId = res.data.meetingId
|
||||
const meetingName = res.data.meetingName || '视频会议'
|
||||
uni.navigateTo({
|
||||
url: `/pages/meeting/Meeting?meetingUrl=${encodeURIComponent(meetingUrl)}&meetingId=${meetingId}&meetingName=${encodeURIComponent(meetingName)}`,
|
||||
fail: (err) => {
|
||||
console.error('[chatRoom] 跳转会议页面失败:', err)
|
||||
uni.showToast({ title: '打开会议失败', icon: 'none' })
|
||||
|
||||
// 构建完整的会议URL(包含域名和workcase路径)
|
||||
const protocol = window.location.protocol
|
||||
const host = window.location.host
|
||||
const fullPath = meetingPageUrl.startsWith('/workcase')
|
||||
? meetingPageUrl
|
||||
: '/workcase' + meetingPageUrl
|
||||
// 附加roomId参数,用于离开会议后返回聊天室
|
||||
const fullMeetingUrl = `${protocol}//${host}${fullPath}&roomId=${roomId.value}`
|
||||
|
||||
// 小程序环境:显示提示,引导用户复制链接在浏览器打开
|
||||
uni.showModal({
|
||||
title: '视频会议',
|
||||
content: '微信小程序暂不支持视频会议,请复制链接在浏览器中打开',
|
||||
confirmText: '复制链接',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.setClipboardData({
|
||||
data: fullMeetingUrl,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '链接已复制,请在浏览器中打开',
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('[chatRoom] 无活跃会议,跳转创建页面')
|
||||
console.log('[chatRoom] 无活跃会议')
|
||||
}
|
||||
|
||||
// 没有活跃会议,跳转到创建会议页面
|
||||
uni.navigateTo({
|
||||
url: `/pages/meeting/MeetingCreate?roomId=${roomId.value}&workcaseId=${workcaseId.value || ''}`,
|
||||
fail: (err) => {
|
||||
console.error('[chatRoom] 跳转创建会议页面失败:', err)
|
||||
uni.showToast({ title: '打开创建会议页面失败', icon: 'none' })
|
||||
// 没有活跃会议,创建新会议
|
||||
try {
|
||||
const createRes = await workcaseChatAPI.createMeeting({
|
||||
roomId: roomId.value,
|
||||
meetingName: roomName.value || '视频会议'
|
||||
})
|
||||
|
||||
if (createRes.success && createRes.data) {
|
||||
const meetingId = createRes.data.meetingId
|
||||
|
||||
// 开始会议
|
||||
await workcaseChatAPI.startMeeting(meetingId)
|
||||
|
||||
// 加入会议获取会议页面URL
|
||||
const joinRes = await workcaseChatAPI.joinMeeting(meetingId)
|
||||
if (joinRes.success && joinRes.data && joinRes.data.iframeUrl) {
|
||||
const meetingPageUrl = joinRes.data.iframeUrl
|
||||
|
||||
// 构建完整的会议URL(包含域名和workcase路径)
|
||||
const protocol = window.location.protocol
|
||||
const host = window.location.host
|
||||
const fullPath = meetingPageUrl.startsWith('/workcase')
|
||||
? meetingPageUrl
|
||||
: '/workcase' + meetingPageUrl
|
||||
// 附加roomId参数,用于离开会议后返回聊天室
|
||||
const fullMeetingUrl = `${protocol}//${host}${fullPath}&roomId=${roomId.value}`
|
||||
|
||||
// 小程序环境:显示提示,引导用户复制链接在浏览器打开
|
||||
uni.showModal({
|
||||
title: '会议已创建',
|
||||
content: '微信小程序暂不支持视频会议,请复制链接在浏览器中打开',
|
||||
confirmText: '复制链接',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.setClipboardData({
|
||||
data: fullMeetingUrl,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '链接已复制,请在浏览器中打开',
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '获取会议链接失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: createRes.message || '创建会议失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('[chatRoom] 创建会议失败:', error)
|
||||
uni.showToast({
|
||||
title: '创建会议失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 加入会议(从MeetingCard点击加入)
|
||||
async function handleJoinMeeting(meetingId: string) {
|
||||
console.log('[handleJoinMeeting] 开始加入会议, meetingId:', meetingId)
|
||||
try {
|
||||
// 调用加入会议接口获取iframe URL
|
||||
// 调用加入会议接口获取会议页面URL
|
||||
const joinRes = await workcaseChatAPI.joinMeeting(meetingId)
|
||||
console.log('[handleJoinMeeting] API响应:', JSON.stringify(joinRes))
|
||||
|
||||
@@ -598,18 +681,48 @@ async function handleJoinMeeting(meetingId: string) {
|
||||
const meetingData = joinRes.data
|
||||
|
||||
if (isSuccess && meetingData && meetingData.iframeUrl) {
|
||||
const meetingUrl = meetingData.iframeUrl
|
||||
const meetingPageUrl = meetingData.iframeUrl
|
||||
const meetingName = meetingData.meetingName || '视频会议'
|
||||
console.log('[handleJoinMeeting] 获取到会议URL:', meetingUrl, '会议名称:', meetingName)
|
||||
// 跳转到会议页面
|
||||
uni.navigateTo({
|
||||
url: `/pages/meeting/Meeting?meetingUrl=${encodeURIComponent(meetingUrl)}&meetingId=${meetingId}&meetingName=${encodeURIComponent(meetingName)}`,
|
||||
success: () => {
|
||||
console.log('[handleJoinMeeting] 跳转成功')
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('[handleJoinMeeting] 跳转会议页面失败:', err)
|
||||
uni.showToast({ title: '打开会议失败', icon: 'none' })
|
||||
console.log('[handleJoinMeeting] 获取到会议页面URL:', meetingPageUrl, '会议名称:', meetingName)
|
||||
|
||||
// 构建完整的会议URL(包含域名和workcase路径)
|
||||
const protocol = window.location.protocol
|
||||
const host = window.location.host
|
||||
// 如果meetingPageUrl不包含/workcase,需要加上
|
||||
const fullPath = meetingPageUrl.startsWith('/workcase')
|
||||
? meetingPageUrl
|
||||
: '/workcase' + meetingPageUrl
|
||||
// 附加roomId参数,用于离开会议后返回聊天室
|
||||
const fullMeetingUrl = `${protocol}//${host}${fullPath}&roomId=${roomId.value}`
|
||||
|
||||
console.log('[handleJoinMeeting] 完整会议URL:', fullMeetingUrl)
|
||||
|
||||
// 小程序环境:显示提示,引导用户复制链接在浏览器打开
|
||||
uni.showModal({
|
||||
title: '视频会议',
|
||||
content: '微信小程序暂不支持视频会议,请复制链接在浏览器中打开',
|
||||
confirmText: '复制链接',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 复制链接到剪贴板
|
||||
uni.setClipboardData({
|
||||
data: fullMeetingUrl,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '链接已复制,请在浏览器中打开',
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '复制失败,请手动复制',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user