feat: 添加结束活动和直播记录详情功能,优化直播页面跳转
This commit is contained in:
@@ -150,6 +150,14 @@ export const confirmLiveActivity = data => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 结束活动 */
|
||||||
|
export const endLiveActivity = activityId => {
|
||||||
|
return http({
|
||||||
|
url: `/api/service/imLiveActivity/end/${activityId}`,
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/** 查询活动参与状态 */
|
/** 查询活动参与状态 */
|
||||||
export const getLiveActivityRecord = id => {
|
export const getLiveActivityRecord = id => {
|
||||||
return http({
|
return http({
|
||||||
@@ -175,6 +183,14 @@ export const getLiveRecordDetail = id => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 直播记录详情 */
|
||||||
|
export const getLIveRecordDetailByRoomId = roomId => {
|
||||||
|
return http({
|
||||||
|
url: `/api/service/imLiveRoom/room/${roomId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/** 生成直播ID */
|
/** 生成直播ID */
|
||||||
export const getLiveId = () => {
|
export const getLiveId = () => {
|
||||||
return http({
|
return http({
|
||||||
|
|||||||
@@ -290,6 +290,7 @@
|
|||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
color: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,8 @@
|
|||||||
imAddLive,
|
imAddLive,
|
||||||
imDataStartLive,
|
imDataStartLive,
|
||||||
getLiveActivityDetail,
|
getLiveActivityDetail,
|
||||||
imDataEndLive
|
imDataEndLive,
|
||||||
|
endLiveActivity
|
||||||
} from '@/api/tui-kit'
|
} from '@/api/tui-kit'
|
||||||
import BeforeLivePanel from '../../components/BeforeLivePanel.nvue'
|
import BeforeLivePanel from '../../components/BeforeLivePanel.nvue'
|
||||||
import LiveStatusInfoCard from '@/uni_modules/tuikit-atomic-x/components/LiveStatusInfoCard.nvue'
|
import LiveStatusInfoCard from '@/uni_modules/tuikit-atomic-x/components/LiveStatusInfoCard.nvue'
|
||||||
@@ -723,13 +724,25 @@
|
|||||||
// 添加活动
|
// 添加活动
|
||||||
const userAddActivity = () => {
|
const userAddActivity = () => {
|
||||||
getLiveActivityDetail(roomDataId.value).then(res => {
|
getLiveActivityDetail(roomDataId.value).then(res => {
|
||||||
|
console.log("活动数据=======",res.data)
|
||||||
if (res?.data && res.data.status === 1) {
|
if (res?.data && res.data.status === 1) {
|
||||||
// status: 0-未开始 1-进行中 2-已结束 3-已取消
|
// status: 0-未开始 1-进行中 2-已结束 3-已取消
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: `提示`,
|
title: `提示`,
|
||||||
content: '您有一个活动正在进行中,请勿重复添加活动',
|
content: '您有一个活动正在进行中,是否提前结束?',
|
||||||
showCancel: false,
|
|
||||||
confirmText: '确定'
|
confirmText: '确定'
|
||||||
|
}).then(()=>{
|
||||||
|
endLiveActivity(res.data.activityId).then(res=>{
|
||||||
|
uni.showToast({
|
||||||
|
title: '结束成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}).catch(()=>{
|
||||||
|
uni.showToast({
|
||||||
|
title: '结束失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
isShowActivity.value = true
|
isShowActivity.value = true
|
||||||
|
|||||||
@@ -216,7 +216,8 @@
|
|||||||
import {
|
import {
|
||||||
imDataEndLive,
|
imDataEndLive,
|
||||||
getLiveActivityDetail,
|
getLiveActivityDetail,
|
||||||
getLiveActivityRecord
|
getLiveActivityRecord,
|
||||||
|
getLIveRecordDetailByRoomId
|
||||||
} from '@/api/tui-kit'
|
} from '@/api/tui-kit'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import {
|
import {
|
||||||
@@ -413,6 +414,10 @@
|
|||||||
onLoad(options => {
|
onLoad(options => {
|
||||||
console.warn('Live page onLoad = ', options)
|
console.warn('Live page onLoad = ', options)
|
||||||
liveID.value = options?.liveID
|
liveID.value = options?.liveID
|
||||||
|
getLIveRecordDetailByRoomId(liveID.value).then(res=>{
|
||||||
|
console.log('初始化虚拟人数===========', res.data.virtualViewers)
|
||||||
|
topNUmber.value = res.data.virtualViewers
|
||||||
|
})
|
||||||
getLiveActivityDetail(liveID.value).then(res => {
|
getLiveActivityDetail(liveID.value).then(res => {
|
||||||
if (res?.data && res.data.status === 1) {
|
if (res?.data && res.data.status === 1) {
|
||||||
// status: 0-未开始 1-进行中 2-已结束 3-已取消
|
// status: 0-未开始 1-进行中 2-已结束 3-已取消
|
||||||
@@ -738,7 +743,7 @@
|
|||||||
disconnect({
|
disconnect({
|
||||||
liveID: uni?.$liveID
|
liveID: uni?.$liveID
|
||||||
})
|
})
|
||||||
exitSheetItems.value = ['退2出直播间']
|
exitSheetItems.value = ['退出直播间']
|
||||||
exitSheetTitle.value = ''
|
exitSheetTitle.value = ''
|
||||||
uni.$localGuestStatus = 'IDLE'
|
uni.$localGuestStatus = 'IDLE'
|
||||||
return
|
return
|
||||||
@@ -751,18 +756,19 @@
|
|||||||
leaveLive({
|
leaveLive({
|
||||||
success: () => {
|
success: () => {
|
||||||
uni.$liveID = ''
|
uni.$liveID = ''
|
||||||
uni.redirectTo({
|
uni.navigateBack()
|
||||||
url: `/pages/discover/livelist/index`,
|
// uni.redirectTo({
|
||||||
delta: 1,
|
// url: `/pages/discover/livelist/list`,
|
||||||
animationType: 'pop-out',
|
// delta: 1,
|
||||||
animationDuration: 300,
|
// animationType: 'pop-out',
|
||||||
success: () => {
|
// animationDuration: 300,
|
||||||
console.log('返回成功')
|
// success: () => {
|
||||||
},
|
// console.log('返回成功')
|
||||||
fail: err => {
|
// },
|
||||||
console.error('返回失败', err)
|
// fail: err => {
|
||||||
}
|
// console.error('返回失败', err)
|
||||||
})
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
import { useAuthUser } from '../../../composables/useAuthUser'
|
import { useAuthUser } from '../../../composables/useAuthUser'
|
||||||
import {
|
import {
|
||||||
getLiveActivityDetail,
|
getLiveActivityDetail,
|
||||||
getLiveActivityRecord
|
getLiveActivityRecord,
|
||||||
|
getLIveRecordDetailByRoomId
|
||||||
} from '../../../api/tui-kit'
|
} from '../../../api/tui-kit'
|
||||||
import { LIVE_BUSINESS } from '@/constants/live-keys'
|
import { LIVE_BUSINESS } from '@/constants/live-keys'
|
||||||
|
|
||||||
@@ -71,6 +72,7 @@
|
|||||||
/** 是否显示活动按钮 */
|
/** 是否显示活动按钮 */
|
||||||
const isShowActivity = ref(false)
|
const isShowActivity = ref(false)
|
||||||
const shareDialog = ref(false)
|
const shareDialog = ref(false)
|
||||||
|
const topNUmber = ref('')
|
||||||
|
|
||||||
const audienceListTitle = computed(
|
const audienceListTitle = computed(
|
||||||
() => `在线人数 (${audienceList.value.length})`
|
() => `在线人数 (${audienceList.value.length})`
|
||||||
@@ -137,6 +139,10 @@
|
|||||||
currentLive.value?.liveOwner.userId
|
currentLive.value?.liveOwner.userId
|
||||||
liveOwnerAvatar.value = currentLive.value?.liveOwner.avatarUrl
|
liveOwnerAvatar.value = currentLive.value?.liveOwner.avatarUrl
|
||||||
}
|
}
|
||||||
|
getLIveRecordDetailByRoomId(e.liveId).then(res => {
|
||||||
|
console.log('初始化虚拟人数===========', res.data.virtualViewers)
|
||||||
|
topNUmber.value = res.data.virtualViewers
|
||||||
|
})
|
||||||
const res = await getLiveActivityDetail(liveId)
|
const res = await getLiveActivityDetail(liveId)
|
||||||
// status: 0-未开始 1-进行中 2-已结束 3-已取消
|
// status: 0-未开始 1-进行中 2-已结束 3-已取消
|
||||||
console.log('活动数据============= ', currentLive.value)
|
console.log('活动数据============= ', currentLive.value)
|
||||||
@@ -249,7 +255,10 @@
|
|||||||
:src="item.avatarUrl"
|
:src="item.avatarUrl"
|
||||||
:size="24"
|
:size="24"
|
||||||
/>
|
/>
|
||||||
<div class="audience-count">
|
<div v-if="topNUmber" class="audience-count">
|
||||||
|
{{ Number(topNUmber) > 100 ? '99+' : topNUmber }}
|
||||||
|
</div>
|
||||||
|
<div v-else class="audience-count">
|
||||||
<span>{{ audienceList.length }}</span>
|
<span>{{ audienceList.length }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,12 +20,13 @@
|
|||||||
const onGo = item => {
|
const onGo = item => {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
uni.$liveID = item.roomId
|
uni.$liveID = item.roomId
|
||||||
navigateTo('/pages/audience/index', { liveID: item.roomId })
|
navigateTo('/pages/audience/index', { liveID: item.roomId,id: item.id })
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
navigateTo('/pages/discover/livelist/h5-live-player', {
|
navigateTo('/pages/discover/livelist/h5-live-player', {
|
||||||
liveId: item.roomId
|
liveId: item.roomId,
|
||||||
|
id: item.id
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
|
|
||||||
const handleToLive = () => {
|
const handleToLive = () => {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/discover/livelist/index',
|
url: '/pages/discover/livelist/list',
|
||||||
success() {
|
success() {
|
||||||
console.log('跳转成功');
|
console.log('跳转成功');
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user