<template>
    <view :class="theme_view + ' flex-row pr'" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
        <view class="flex-1 pr live-bg" @click="handle_click" @touchend="handle_touch_end" :data-ignore="false">
            <component-live-video v-if="!is_live_ended" ref="liveVideo" :propSrc="live_video_src || 'https://live-pull-all.shopxo.vip/68f764013572f9240ca7ce6c/shopxo.m3u8'" @loadedmetadata="loadedmetadata" @ended="ended"></component-live-video>
            <!-- 简化版点赞效果组件 -->
            <component-full-screen-like-effect ref="fullScreenLikeEffect" :propCustomImages="like_show_imgs" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'"></component-full-screen-like-effect>
        </view>
        <template v-if="!is_loading">
            <!-- 主播暂时离开的提示信息-->
            <view v-if="live_be_right_back_error" class="live-pause flex-row align-c jc-c" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
                <view class="flex-1 flex-col align-c jc-c">
                    <u-icon propName="smallbell" propSize="100rpx" propColor="#fff"></u-icon>
                    <text class="pointer-events-auto text-size mb-5 cr-white">主播暂时离开</text>
                    <text class="pointer-events-auto text-size-sm cr-white">休息片刻，更多精彩马上到来</text>
                </view>
            </view>
            <!-- 主体内容显示 -->
            <view class="live-content" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
                <component-live-content ref="liveContent" :propWindowWidth="windowWidth" :propWindowHeight="windowHeight" :propLiveData="live_data" :propLiveConfig="live_config" :propLiveShowImgs="like_show_imgs" @liveBack="live_back" @handleDoubleClick="handle_double_click" @handleTouchEnd="handle_touch_end" @liveStatus="socket_live_status"></component-live-content>
            </view>
            <!-- 直播间结束的显示 -->
            <view v-if="is_live_ended" class="live-ended flex-row align-c jc-c" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
                <view class="flex-col align-c">
                    <text class="live-ended-text cr-f">直播已结束</text>
                    <button plain size="mini" class="mt-10 live-ended-button" @tap="live_back">
                        <text class="cr-f pa-5">退出直播间</text>
                    </button>
                </view>
            </view>
        </template>
    </view>
</template>
<script>
    import componentLiveVideo from './components/video/video.vue';
    import componentLiveContent from './components/live-content/live-content.vue';
    // 引入点赞效果组件
    import componentFullScreenLikeEffect from './components/full-screen-like-effect/full-screen-like-effect.vue';
    // 引入混入公共逻辑，避免nvue和vue使用同一套逻辑出现问题
    import mixins from './mixins/mixins.js';
    const app = getApp();
    export default {
        components: {
            componentLiveVideo,
            componentLiveContent,
            componentFullScreenLikeEffect
        },
        mixins: [mixins],
        data() {
            return {
                theme_view: app.globalData.get_theme_value_view(),
            }
        }
    }
</script>
<style lang="scss" scoped>
    .live-bg {
        background-image: linear-gradient(to bottom,#ba623c,#14766a);
    }
    .live-pause {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 9;
        background-image: linear-gradient(to bottom, #330066, #000000);
    }
    .live-content {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 9;
        width: 100%;
        height: 100%;
        background: transparent;
    }
    .live-ended {
        // 添加渐变背景色
        background-image: linear-gradient(to bottom,#AD18F9,#05DFC7);
        position: absolute;
        top: 0;
        left: 0;
        z-index: 10;
        width: 100%;
        height: 100%;
        .live-ended-text {
            color:#fff;
            font-size:16px;
        }
    }
    .live-ended-button {
        border-radius: 6px;
        border-color: #fff;
    }
</style>