修改页面显示处理

master
于肖磊 2025-12-01 09:48:34 +08:00
parent 2c237c8cc2
commit d6ab964712
4 changed files with 35 additions and 6 deletions

View File

@ -279,7 +279,7 @@
handler(new_value) {
if (new_value.data != null) {
//
this.live_data = new_value.data;
this.live_data = new_value;
}
},
immediate: true,

View File

@ -1,10 +1,12 @@
const app = getApp();
import { isEmpty } from '@/common/js/common/common.js';
export default {
data() {
return {
windowWidth: 0,
windowHeight: 0,
is_live_ended: false
is_live_ended: false,
live_config: {},
}
},
onLoad(params) {
@ -33,6 +35,33 @@ export default {
},
live_back() {
app.globalData.page_back_prev_event();
},
init() {
uni.showLoading({
title: '加载中...',
mask: true
});
uni.request({
url: app.globalData.get_request_url('index,room,live'),
method: 'POST',
data: {},
dataType: 'json',
success: (res) => {
is_loading.value = false;
uni.hideLoading();
const new_data = res.data;
// 获取直播间信息
this.live_config = new_data.data || {};
// 如果不存在拉流地址则认为直播已结束,避免因为报错导致的页面异常
if (isEmpty(new_data.data.pull_flv_url)) {
this.is_live_ended = true;
}
},
fail: (err) => {
is_loading.value = false;
uni.hideLoading();
}
});
}
}
}

View File

@ -2,11 +2,11 @@
<view :class="theme_view + ' flex-row pr'" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
<view class="flex-1 pr">
<view class="live-bg" :style="'z-index:1;width:' + windowWidth + 'px;height:' + windowHeight + 'px;'"></view>
<live-video src="http://live-pull-all.shopxo.vip/68f764013572f9240ca7ce6c/shopxo122.m3u8" @ended="ended"></live-video>
<live-video :src="live_config?.pull_flv_url || ''" @ended="ended"></live-video>
</view>
<view class="live-content" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
<template v-if="!is_live_ended">
<live-content @live-back="live_back"></live-content>
<live-content :live-config="live_config" @live-back="live_back"></live-content>
</template>
<template v-else>
<view class="live-ended flex-row align-c jc-c" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">

View File

@ -1,11 +1,11 @@
<template>
<view :class="theme_view + ' live-bg'">
<view class="w h">
<live-video src="http://live-pull-all.shopxo.vip/68f764013572f9240ca7ce6c/shopxo122.m3u8" @ended="ended"></live-video>
<live-video :src="live_config?.pull_flv_url || ''" @ended="ended"></live-video>
</view>
<view class="live-content">
<template v-if="!is_live_ended">
<live-content @live-back="live_back"></live-content>
<live-content :live-config="live_config" @live-back="live_back"></live-content>
</template>
<template v-else>
<view class="live-ended flex-row align-c jc-c">