视频连线
This commit is contained in:
@@ -164,6 +164,8 @@ const userStore = useUserStore()
|
||||
|
||||
const rawCode = ref('')
|
||||
const callId = ref('')
|
||||
const consultId = ref('')
|
||||
const miniProgramReturnUrl = ref('')
|
||||
const cloudLawApiBase = ref('')
|
||||
const cloudLawToken = ref('')
|
||||
const callMode = ref('video')
|
||||
@@ -410,6 +412,40 @@ const notifyCloudLawEnd = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const buildMiniProgramReturnUrl = () => {
|
||||
const configured = String(miniProgramReturnUrl.value || '').trim()
|
||||
if (configured) {
|
||||
try {
|
||||
return decodeURIComponent(configured)
|
||||
} catch (e) {
|
||||
return configured
|
||||
}
|
||||
}
|
||||
if (!consultId.value) return ''
|
||||
return `/pages_work/ai_consult/ai_consult?id=${encodeURIComponent(consultId.value)}&mode=detail&from=videoCall`
|
||||
}
|
||||
|
||||
const notifyMiniProgramCallEnded = () => {
|
||||
const payload = {
|
||||
type: 'cloudLawCallEnded',
|
||||
action: 'cloudLawCallEnded',
|
||||
callId: callId.value,
|
||||
consultId: consultId.value,
|
||||
returnUrl: buildMiniProgramReturnUrl()
|
||||
}
|
||||
try {
|
||||
const miniProgram = typeof window !== 'undefined' && window.wx && window.wx.miniProgram ? window.wx.miniProgram : null
|
||||
if (miniProgram && typeof miniProgram.postMessage === 'function') {
|
||||
miniProgram.postMessage({ data: payload })
|
||||
}
|
||||
if (miniProgram && typeof miniProgram.redirectTo === 'function' && payload.returnUrl) {
|
||||
miniProgram.redirectTo({ url: payload.returnUrl })
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[CloudLawVideoCall] notify mini program failed', e)
|
||||
}
|
||||
}
|
||||
|
||||
const pollCommandsOnce = async () => {
|
||||
if (!callId.value || !meetingStore.isInMeeting || leaving.value || ended.value || commandPolling) return
|
||||
commandPolling = true
|
||||
@@ -790,12 +826,15 @@ const hangup = async () => {
|
||||
} finally {
|
||||
ended.value = true
|
||||
leaving.value = false
|
||||
notifyMiniProgramCallEnded()
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(query => {
|
||||
rawCode.value = query?.code || query?.roomCode || ''
|
||||
callId.value = query?.callId || query?.call_id || ''
|
||||
consultId.value = query?.consultId || query?.consult_id || ''
|
||||
miniProgramReturnUrl.value = query?.miniProgramReturnUrl || query?.mini_program_return_url || ''
|
||||
cloudLawApiBase.value = query?.cloudLawApiBase || query?.cloud_law_api_base || ''
|
||||
cloudLawToken.value = query?.cloudLawToken || query?.cloud_law_token || ''
|
||||
const mode = String(query?.mode || query?.callType || query?.type || '').toLowerCase()
|
||||
|
||||
Reference in New Issue
Block a user