LiveDetailPageLogic.ets 1.33 KB
import { ContentDetailDTO } from 'wdBean/Index'


/**
 *   直播信息对象逻辑加工处理的工具类
 */
export class LiveDetailPageLogic {
  // 直播状态
  liveState: string = ''
  // 横屏或竖屏  general-竖屏,news-横屏
  liveLandscape: string = ''
  // 直播样式 0-正常模式,1-隐藏直播 2-隐藏大家聊
  liveStyle: number = -1
  // 预告片图片/视频url
  imgUrl: string = ''



  /**
   * 直播详情页面,展示的直播信息对象
   */
  contentDetailData: ContentDetailDTO = new ContentDetailDTO

  /**
   *  横屏直播
   * @returns true:横屏直播;false:竖屏直播
   */
  isLangScapeScreenVideo(): boolean {

    return this.liveState === 'wait' || this.liveLandscape === 'news'
  }


  /**
   * 竖屏直播
   * @returns
   */
  isVerticalScreenVideo(): boolean {

    return this.liveLandscape === 'general'
  }


  /**
   *  解析背景图片资源
   */
  resolvingRoomBackgroundImgUrl() {

    if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&
      this.contentDetailData.liveInfo.previewUrl.length > 0) {
      this.imgUrl = this.contentDetailData.liveInfo.previewUrl
    } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) {
      this.imgUrl = this.contentDetailData.fullColumnImgUrls[0].url
    }
  }
}