From ac67fa30f4edc5383fe22aafee6b8a0bc419b9e7 Mon Sep 17 00:00:00 2001 From: bobobobo <1055026847@qq.com> Date: Mon, 12 Jan 2026 22:21:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=86=E9=A2=91=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/nav-bar/nav-bar.vue | 2 + pages/anchor/index.nvue | 95 +++++++++++++++++++--------------- pages/audience/index.nvue | 5 +- 3 files changed, 60 insertions(+), 42 deletions(-) diff --git a/components/nav-bar/nav-bar.vue b/components/nav-bar/nav-bar.vue index 9893842..3f54b24 100644 --- a/components/nav-bar/nav-bar.vue +++ b/components/nav-bar/nav-bar.vue @@ -104,6 +104,7 @@ rpxToPxRatio.value = sysInfo.windowWidth / 750 }) + // 向外暴露方法 defineExpose({ updateScroll @@ -203,3 +204,4 @@ height: calc(var(--status-bar-height) + 44px); } + diff --git a/pages/anchor/index.nvue b/pages/anchor/index.nvue index ed96ff6..9dccb52 100644 --- a/pages/anchor/index.nvue +++ b/pages/anchor/index.nvue @@ -550,6 +550,8 @@ clearAudioEffectSet() clearBeautyPanelSet() uni.$summaryData = summaryData.value + console.warn(` 退出直播 imDataEndLive`); + endLive({ success: () => { console.warn(` 退出直播 imDataEndLive`); @@ -568,48 +570,59 @@ }; const startLive = async () => { - console.log('点击开始直播') - const data = { - coverUrl: coverURL.value, - roomName: liveTitle.value, - groupId: groupId.value - } - const res = await imAddLive(data) - const cbb = await imDataStartLive(res.data.roomId) - console.log(cbb) - return - createLive({ - liveInfo: { - liveID: uni?.$liveID, - liveName: liveTitle.value, - coverURL: coverURL.value, - isSeatEnabled: true, - seatMode: 'APPLY', - maxSeatCount: 0, - isPublicVisible: liveMode.value === '公开', - keepOwnerOnSeat: true, - seatLayoutTemplateID: templateLayout.value, - }, - success: () => { - const params = { - cursor: "", // 首次拉起传空(不能是null),然后根据回调数据的cursor确认是否拉完 - count: 20, // 分页拉取的个数 - }; - fetchLiveList(params); + // try { + // console.log('点击开始直播') + // const data = { + // coverUrl: coverURL.value, + // roomName: liveTitle.value, + // groupId: groupId.value + // } + // const roomData = await imAddLive(data) + // const res = await imDataStartLive(roomData.data.roomId) + // console.log(res) + // const params = { + // cursor: "", // 首次拉起传空(不能是null),然后根据回调数据的cursor确认是否拉完 + // count: 20, // 分页拉取的个数 + // }; + // fetchLiveList(params); + // openLocalCamera({ isFront: isFrontCamera.value }); + // openLocalMicrophone(); + // setLocalVideoMuteImage(); + // isStartLive.value = true; + // } catch (err) { + // console.log(err, '====22') + // } + + createLive({ + liveInfo: { + liveID: uni?.$liveID, + liveName: liveTitle.value, + coverURL: coverURL.value, + isSeatEnabled: true, + seatMode: 'APPLY', + maxSeatCount: 0, + isPublicVisible: liveMode.value === '公开', + keepOwnerOnSeat: true, + seatLayoutTemplateID: templateLayout.value, + }, + success: () => { + const params = { + cursor: "", // 首次拉起传空(不能是null),然后根据回调数据的cursor确认是否拉完 + count: 20, // 分页拉取的个数 + }; + fetchLiveList(params); - openLocalCamera({ isFront: isFrontCamera.value }); - openLocalMicrophone(); - setLocalVideoMuteImage(); - }, - fail: (errCode, errMsg) => { - console.log(errCode, '=====111====') - console.log(errMsg, '=====222====') - uni.showToast({ - title: '创建直播间失败', - }); - }, - }); - isStartLive.value = true; + openLocalCamera({ isFront: isFrontCamera.value }); + openLocalMicrophone(); + setLocalVideoMuteImage(); + }, + fail: (errCode, errMsg) => { + uni.showToast({ + title: '创建直播间失败', + }); + }, + }); + isStartLive.value = true; }; const ShowAnchorViewClickPanel = (userInfo) => { diff --git a/pages/audience/index.nvue b/pages/audience/index.nvue index 5e2ed04..0189417 100644 --- a/pages/audience/index.nvue +++ b/pages/audience/index.nvue @@ -94,6 +94,7 @@