feat: 添加直播间跳转功能,优化观众页面数据展示

This commit is contained in:
2026-03-07 20:12:22 +07:00
parent 537d598906
commit fa5849fb6f
4 changed files with 137 additions and 101 deletions

View File

@@ -288,6 +288,7 @@
/** 点击跳转直播间 */ /** 点击跳转直播间 */
const onLive = () => { const onLive = () => {
// #ifdef APP-PLUS // #ifdef APP-PLUS
uni.$liveID = goodsData.value.id
navigateTo('/pages/audience/index', { navigateTo('/pages/audience/index', {
liveID: goodsData.value.id liveID: goodsData.value.id
}) })

View File

@@ -59,11 +59,11 @@
/> />
</view> </view>
<view class="participant-count"> <view class="participant-count">
<text v-if="topNUmber" class="count-text"> <text v-if="Number(topNUmber) > 0" class="count-text">
{{ Number(topNUmber) > 100 ? '99+' : topNUmber }} {{ Number(topNUmber) > 100 ? '99+' : topNUmber }}1
</text> </text>
<text v-else class="count-text"> <text v-else class="count-text">
{{ audienceList.length }} {{ audienceNumber }}
</text> </text>
</view> </view>
</view> </view>
@@ -268,6 +268,7 @@
addLiveSeatEventListener, addLiveSeatEventListener,
removeLiveSeatEventListener removeLiveSeatEventListener
} = useLiveSeatState(uni?.$liveID) } = useLiveSeatState(uni?.$liveID)
console.log("uniliveID",uni?.$liveID)
const { audienceList } = useLiveAudienceState(uni?.$liveID) const { audienceList } = useLiveAudienceState(uni?.$liveID)
const { disconnect, connected, cancelApplication } = useCoGuestState( const { disconnect, connected, cancelApplication } = useCoGuestState(
uni?.$liveID uni?.$liveID
@@ -346,6 +347,7 @@
const coGuestSheetItems = ref(['取消连麦申请']) const coGuestSheetItems = ref(['取消连麦申请'])
const coGuestSheetTitle = ref('') const coGuestSheetTitle = ref('')
const topNUmber = ref('') const topNUmber = ref('')
const audienceNumber = computed(()=>audienceList.value.length)
// 监听座位变化:当自身不在 seatList 时,将本地连麦状态重置为 IDLE // 监听座位变化:当自身不在 seatList 时,将本地连麦状态重置为 IDLE
watch( watch(

View File

@@ -6,6 +6,7 @@
import { formatNumberWithWan } from '../../utils' import { formatNumberWithWan } from '../../utils'
import { getUserPayPwd } from '@/api/my-index' import { getUserPayPwd } from '@/api/my-index'
import { useUserStore } from '../../stores/user' import { useUserStore } from '../../stores/user'
import { ref } from 'vue'
const bottomList = [ const bottomList = [
{ {
@@ -51,7 +52,7 @@
} }
] ]
const { getIntegral } = useUserStore() const { getIntegral, refreshUserInfo } = useUserStore()
const { showDialog } = useUI() const { showDialog } = useUI()
const { userInfo, integralData } = useAuthUser() const { userInfo, integralData } = useAuthUser()
@@ -72,6 +73,12 @@
} }
} }
const paging = ref(null)
const onRefresh = async () => {
await refreshUserInfo()
paging.value.complete()
}
onLoad(() => { onLoad(() => {
// 获取用户信息 // 获取用户信息
console.log(userInfo.value, '===获取用户信息') console.log(userInfo.value, '===获取用户信息')
@@ -82,6 +89,12 @@
</script> </script>
<template> <template>
<z-paging
ref="paging"
:paging-style="{ 'background-color': '#f9f9f9' }"
refresher-only
@onRefresh="onRefresh"
>
<view class="my-index"> <view class="my-index">
<view <view
class="top-info" class="top-info"
@@ -158,6 +171,7 @@
</view> </view>
</view> </view>
</view> </view>
</z-paging>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -54,9 +54,21 @@
onShow(() => { onShow(() => {
getData() getData()
}) })
const paging = ref(null)
const onRefresh = async () => {
await getData()
paging.value.complete()
}
</script> </script>
<template> <template>
<z-paging
ref="paging"
:paging-style="{ 'background-color': '#f9f9f9' }"
refresher-only
@onRefresh="onRefresh"
>
<view class="wallet"> <view class="wallet">
<!-- 顶部样式 --> <!-- 顶部样式 -->
<view class="top-card"> <view class="top-card">
@@ -66,7 +78,9 @@
</view> </view>
<view class="right-box"> <view class="right-box">
<button <button
@click="showDialog('提示', '联系客服或者联系上级分享人', false)" @click="
showDialog('提示', '联系客服或者联系上级分享人', false)
"
> >
充值 充值
</button> </button>
@@ -96,6 +110,7 @@
</view> </view>
</view> </view>
</view> </view>
</z-paging>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -113,7 +128,9 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
position: relative; position: relative;
font-family: PingFang SC, PingFang SC; font-family:
PingFang SC,
PingFang SC;
font-style: normal; font-style: normal;
text-transform: none; text-transform: none;
&::after { &::after {
@@ -152,7 +169,9 @@
height: 64rpx; height: 64rpx;
line-height: 64rpx; line-height: 64rpx;
border-radius: 100rpx 100rpx 100rpx 100rpx; border-radius: 100rpx 100rpx 100rpx 100rpx;
font-family: PingFang SC, PingFang SC; font-family:
PingFang SC,
PingFang SC;
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
color: #ffffff; color: #ffffff;