nvue直播间需要调整分享样式
This commit is contained in:
@@ -301,16 +301,18 @@
|
||||
import Activity from './components/activity.nvue'
|
||||
import { LIVE_BUSINESS } from '@/constants/live-keys'
|
||||
|
||||
|
||||
const liveID = ref(uni.$liveID)
|
||||
const dom = uni.requireNativePlugin('dom')
|
||||
const { loginUserInfo } = useLoginState()
|
||||
uni.$liveID = `live_${uni.$userID}`
|
||||
// uni.$liveID = `live_${uni.$userID}`
|
||||
uni.$localGuestStatus = 'IDLE'
|
||||
const {
|
||||
setVoiceEarMonitorEnable,
|
||||
setVoiceEarMonitorVolume,
|
||||
setAudioChangerType,
|
||||
setAudioReverbType
|
||||
} = useAudioEffectState(uni.$liveID)
|
||||
} = useAudioEffectState(liveID.value)
|
||||
const {
|
||||
setSmoothLevel,
|
||||
setWhitenessLevel,
|
||||
@@ -318,7 +320,7 @@
|
||||
whitenessLevel,
|
||||
ruddyLevel,
|
||||
smoothLevel
|
||||
} = useBaseBeautyState(uni.$liveID)
|
||||
} = useBaseBeautyState(liveID.value)
|
||||
const {
|
||||
addCoHostListener,
|
||||
removeCoHostListener,
|
||||
@@ -327,7 +329,7 @@
|
||||
exitHostConnection,
|
||||
coHostStatus,
|
||||
invitees
|
||||
} = useCoHostState(uni?.$liveID)
|
||||
} = useCoHostState(liveID.value)
|
||||
const {
|
||||
joinLive,
|
||||
createLive,
|
||||
@@ -339,10 +341,10 @@
|
||||
callExperimentalAPI
|
||||
} = useLiveListState()
|
||||
const { applicants, rejectApplication, connected } = useCoGuestState(
|
||||
uni?.$liveID
|
||||
liveID.value
|
||||
)
|
||||
const { messageList, sendTextMessage, sendCustomMessage } =
|
||||
useBarrageState(uni?.$liveID)
|
||||
useBarrageState(liveID.value)
|
||||
const {
|
||||
openLocalCamera,
|
||||
openLocalMicrophone,
|
||||
@@ -350,13 +352,13 @@
|
||||
switchCamera,
|
||||
closeLocalMicrophone,
|
||||
closeLocalCamera
|
||||
} = useDeviceState(uni?.$liveID)
|
||||
const { audienceList } = useLiveAudienceState(uni?.$liveID)
|
||||
const { seatList, canvas, lockSeat } = useLiveSeatState(uni?.$liveID)
|
||||
} = useDeviceState(liveID.value)
|
||||
const { audienceList } = useLiveAudienceState(liveID.value)
|
||||
const { seatList, canvas, lockSeat } = useLiveSeatState(liveID.value)
|
||||
const { addGiftListener, removeGiftListener } = useGiftState(
|
||||
uni?.$liveID
|
||||
liveID.value
|
||||
)
|
||||
const { summaryData } = useLiveSummaryState(uni.$liveID)
|
||||
|
||||
const defaultCoverURL =
|
||||
'https://liteav-test-1252463788.cos.ap-guangzhou.myqcloud.com/voice_room/voice_room_cover1.png'
|
||||
const defaultAvatarURL =
|
||||
@@ -390,7 +392,6 @@
|
||||
const isStartLive = ref(false)
|
||||
// 通过点击 message 信息选中的观众
|
||||
const selectedAudience = ref({})
|
||||
const liveID = ref(uni?.$liveID)
|
||||
const isLargeSizeGiftPlayer = ref(false)
|
||||
const giftInfo = ref({})
|
||||
|
||||
@@ -412,7 +413,7 @@
|
||||
const barrageListRef = ref()
|
||||
const giftPlayerRef = ref()
|
||||
const { showGift, onGiftFinished } = giftService({
|
||||
roomId: uni?.$liveID,
|
||||
roomId: liveID.value,
|
||||
giftPlayerRef
|
||||
})
|
||||
const isShowAnchorInfo = ref(true)
|
||||
@@ -436,8 +437,6 @@
|
||||
if (newUserId) {
|
||||
// 如果当前标题是默认值或者为空,则更新为新的用户名
|
||||
currentUserID.value = newUserId
|
||||
uni.$liveID = `live_${currentUserID.value}`
|
||||
liveID.value = uni.$liveID
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
@@ -499,7 +498,7 @@
|
||||
const handleModalConfirm = () => {
|
||||
if (currentModalUserInfo.value) {
|
||||
acceptHostConnection({
|
||||
liveID: uni?.$liveID,
|
||||
liveID: liveID.value,
|
||||
fromHostLiveID: currentModalUserInfo.value.liveID
|
||||
})
|
||||
}
|
||||
@@ -510,7 +509,7 @@
|
||||
const handleModalCancel = () => {
|
||||
if (currentModalUserInfo.value) {
|
||||
rejectHostConnection({
|
||||
liveID: uni?.$liveID,
|
||||
liveID: liveID.value,
|
||||
fromHostLiveID: currentModalUserInfo.value.liveID
|
||||
})
|
||||
}
|
||||
@@ -524,7 +523,7 @@
|
||||
if (!isShowCoGuestPanelAvatar.value) {
|
||||
applicants.value.forEach(applicant => {
|
||||
rejectApplication({
|
||||
liveID: uni?.$liveID,
|
||||
liveID: liveID.value,
|
||||
userID: applicant.userID
|
||||
})
|
||||
})
|
||||
@@ -555,7 +554,7 @@
|
||||
} else {
|
||||
applicants.value.forEach(applicant => {
|
||||
rejectApplication({
|
||||
liveID: uni?.$liveID,
|
||||
liveID: liveID.value,
|
||||
userID: applicant.userID
|
||||
})
|
||||
})
|
||||
@@ -597,6 +596,8 @@
|
||||
const creatorType = ref('')
|
||||
// 页面加载
|
||||
onLoad(options => {
|
||||
// uni.$liveID = options.roomId
|
||||
liveID.value = options.roomId
|
||||
creatorType.value = options?.creatorType
|
||||
groupId.value = decodeURIComponent(options?.groupId)
|
||||
// 禁用右滑返回(仅 iOS 有效)
|
||||
@@ -607,9 +608,7 @@
|
||||
currentPage.$page.style.disableSwipeBack = true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
uni.setKeepScreenOn({
|
||||
keepScreenOn: true
|
||||
})
|
||||
@@ -626,49 +625,53 @@
|
||||
}
|
||||
})
|
||||
addCoHostListener(
|
||||
uni.$liveID,
|
||||
liveID.value,
|
||||
'onCoHostRequestAccepted',
|
||||
handleCoHostRequestAccepted
|
||||
)
|
||||
addCoHostListener(
|
||||
uni.$liveID,
|
||||
liveID.value,
|
||||
'onCoHostRequestRejected',
|
||||
handleCoHostRequestRejected
|
||||
)
|
||||
addCoHostListener(
|
||||
uni.$liveID,
|
||||
liveID.value,
|
||||
'onCoHostRequestTimeout',
|
||||
handleCoHostRequestTimeout
|
||||
)
|
||||
addCoHostListener(
|
||||
uni.$liveID,
|
||||
liveID.value,
|
||||
'onCoHostRequestReceived',
|
||||
handleCoHostRequestReceived
|
||||
)
|
||||
addGiftListener(uni.$liveID, 'onReceiveGift', handleReceiveGift)
|
||||
addGiftListener(liveID.value, 'onReceiveGift', handleReceiveGift)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
})
|
||||
onUnmounted(() => {
|
||||
removeCoHostListener(
|
||||
uni.$liveID,
|
||||
liveID.value,
|
||||
'onCoHostRequestAccepted',
|
||||
handleCoHostRequestAccepted
|
||||
)
|
||||
removeCoHostListener(
|
||||
uni.$liveID,
|
||||
liveID.value,
|
||||
'onCoHostRequestRejected',
|
||||
handleCoHostRequestRejected
|
||||
)
|
||||
removeCoHostListener(
|
||||
uni.$liveID,
|
||||
liveID.value,
|
||||
'onCoHostRequestTimeout',
|
||||
handleCoHostRequestTimeout
|
||||
)
|
||||
removeCoHostListener(
|
||||
uni.$liveID,
|
||||
liveID.value,
|
||||
'onCoHostRequestReceived',
|
||||
handleCoHostRequestReceived
|
||||
)
|
||||
removeGiftListener(uni.$liveID, 'onReceiveGift', handleReceiveGift)
|
||||
removeGiftListener(liveID.value, 'onReceiveGift', handleReceiveGift)
|
||||
})
|
||||
|
||||
const handleCoHostRequestAccepted = {
|
||||
@@ -727,7 +730,7 @@
|
||||
const res = JSON.parse(event)
|
||||
if (connected.value.length > 1 || applicants.value.length > 0) {
|
||||
rejectHostConnection({
|
||||
liveID: uni?.$liveID,
|
||||
liveID: liveID.value,
|
||||
fromHostLiveID: res.inviter.liveID
|
||||
})
|
||||
return
|
||||
@@ -789,11 +792,13 @@
|
||||
isShowEndSheet.value = true
|
||||
}
|
||||
|
||||
|
||||
const { summaryData } = useLiveSummaryState(liveID.value)
|
||||
const onEndSheetSelect = (res: { tapIndex: number }) => {
|
||||
const index = res.tapIndex
|
||||
if (coHostStatus.value === 'CONNECTED' && index === 0) {
|
||||
exitHostConnection({
|
||||
liveID: uni?.$liveID
|
||||
liveID: liveID.value
|
||||
})
|
||||
endSheetItems.value = ['关闭直播间']
|
||||
endSheetTitle.value = ''
|
||||
@@ -806,7 +811,7 @@
|
||||
clearAudioEffectSet()
|
||||
clearBeautyPanelSet()
|
||||
uni.$summaryData = summaryData.value
|
||||
console.warn(` 退出直播===直播间人数`, audienceCount.value)
|
||||
console.warn(` 退出直播===`, summaryData.value)
|
||||
imDataEndLive(roomDataId.value, audienceCount.value).then(() => {
|
||||
uni.redirectTo({ url: '/pages/liveend/index' })
|
||||
})
|
||||
@@ -830,27 +835,25 @@
|
||||
|
||||
const roomDataId = ref('')
|
||||
const startLive = async () => {
|
||||
console.log(uni.$liveID, '点击开始直播')
|
||||
|
||||
console.log(uni.$liveID,'=====', liveID.value,'点击开始直播')
|
||||
try {
|
||||
const data = {
|
||||
coverUrl: coverURL.value,
|
||||
roomName: liveTitle.value,
|
||||
groupId: groupId.value
|
||||
groupId: groupId.value,
|
||||
roomId: liveID.value
|
||||
}
|
||||
const roomData = await imAddLive(data)
|
||||
const roomId = roomData.data.roomId
|
||||
uni.$liveID = roomId
|
||||
liveID.value = roomId
|
||||
const res = await imDataStartLive(roomId)
|
||||
console.log('========11111111', roomData)
|
||||
console.log('========22222222', res)
|
||||
roomDataId.value = roomId
|
||||
roomDataId.value = liveID.value
|
||||
const params = {
|
||||
cursor: '', // 首次拉起传空(不能是null),然后根据回调数据的cursor确认是否拉完
|
||||
count: 20 // 分页拉取的个数
|
||||
}
|
||||
joinLive({ liveID: roomId })
|
||||
joinLive({ liveID: roomId })
|
||||
fetchLiveList(params)
|
||||
openLocalCamera({ isFront: isFrontCamera.value })
|
||||
openLocalMicrophone()
|
||||
@@ -862,7 +865,7 @@
|
||||
// ======================原本代码
|
||||
// createLive({
|
||||
// liveInfo: {
|
||||
// liveID: uni?.$liveID,
|
||||
// liveID: liveID.value,
|
||||
// liveName: liveTitle.value,
|
||||
// coverURL: coverURL.value,
|
||||
// isSeatEnabled: true,
|
||||
|
||||
Reference in New Issue
Block a user