diff --git a/pages/plugins/live/pull/components/live-content/live-content.vue b/pages/plugins/live/pull/components/live-content/live-content.vue index 18bf8b29..f7b02f38 100644 --- a/pages/plugins/live/pull/components/live-content/live-content.vue +++ b/pages/plugins/live/pull/components/live-content/live-content.vue @@ -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, diff --git a/pages/plugins/live/pull/mixins/mixins.js b/pages/plugins/live/pull/mixins/mixins.js index b68025a5..ee7774a0 100644 --- a/pages/plugins/live/pull/mixins/mixins.js +++ b/pages/plugins/live/pull/mixins/mixins.js @@ -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(); + } + }); } } } \ No newline at end of file diff --git a/pages/plugins/live/pull/pull.nvue b/pages/plugins/live/pull/pull.nvue index c966c177..482ae6ad 100644 --- a/pages/plugins/live/pull/pull.nvue +++ b/pages/plugins/live/pull/pull.nvue @@ -2,11 +2,11 @@ - +