import { _ as f, c as _, d as g } from './icon_discount.202ead11.js'
import { _ as h, a as b } from './share-vip-tips.975e41da.js'
import { _ as v, a as w } from './wx_bg.5eddda0b.js'
import { C as x } from './index.9169d438.js'
import { S as d } from './index.2778830d.js'
import { U as I } from './index.fdb44d83.js'
import { C as j } from './index.e311a214.js'
import { b as n, s as m, p as l, r as y } from './index.9e4b607f.js'
import {
  d as D,
  g as i,
  D as T,
  a as o,
  B as C,
  j as $
} from './vendor.3506a68e.js'
import { s as S } from './share.622205d9.js'
import { q as p } from './index.339fc024.js'
import './index.f15b595a.js'
/* empty css              */ /* empty css               */ /* empty css               */ import './icon_teacher.cb128c00.js'
import './icon_timer2.5fb1750d.js'
import './icon-jiaozi.20e415ca.js'
const U = '_introduction_1vd6e_1',
  H = '_wxpopup_1vd6e_9'
var u = { 'live-detail': '_live-detail_1vd6e_1', introduction: U, wxpopup: H }
const N = e => {
  const s = `../images/${e}`
  return {
    '../images/icon-cert.png': f,
    '../images/icon_discount.png': _,
    '../images/icon_music.png': g,
    '../images/music-share-banner.png': h,
    '../images/share-banner.png': v,
    '../images/share-vip-tips.png': b,
    '../images/wx_bg.png': w
  }[s].default
}
var Q = D({
  name: 'LiveDetail',
  data() {
    const e = this.$route.query
    return {
      recomUserId: e.recomUserId,
      groupId: e.groupId,
      live: {},
      wxStatus: !1
    }
  },
  computed: {
    userInfo() {
      var a, c
      const e = this.live,
        s = e.planList || [],
        t = ((a = s[0]) == null ? void 0 : a.startTime) || new Date(),
        r = ((c = s[0]) == null ? void 0 : c.endTime) || new Date()
      return {
        headUrl: e.avatar,
        username: e.userName,
        id: e.teacherId,
        startTime:
          `${i(t).format('YYYY-MM-DD')} ${i(t).format('HH:mm')}~${i(r).format(
            'HH:mm'
          )}` || '',
        lessonPrice: e.coursePrice,
        buyNum: e.studentCount || 0,
        lessonNum: e.courseNum || 0,
        lessonDesc: e.courseIntroduce,
        lessonCoverUrl: e.backgroundPic || e.backgroundPicTemplate,
        lessonName: e.courseGroupName,
        auditVersion: 0
      }
    },
    courseInfo() {
      const e = []
      return (
        (this.live.planList || []).forEach(t => {
          const r = t.startTime || new Date(),
            a = t.endTime || new Date()
          e.push({
            courseTime: `${i(r).format('YYYY-MM-DD')} ${i(r).format(
              'HH:mm'
            )}~${i(a).format('HH:mm')}`,
            coursePlan: t.plan,
            roomUid: t.roomUid,
            liveState: t.liveState,
            id: t.courseId
          })
        }),
        e || []
      )
    }
  },
  created() {
    n().isApp
      ? m.platformType === 'STUDENT'
        ? n().ios
          ? window.location.replace(
              `${location.origin}/student/#/liveDetail??${p.stringify(
                this.$route.query
              )}`
            )
          : (l({
              api: 'openWebView',
              content: {
                url: `${location.origin}/student/#/liveDetail??${p.stringify(
                  this.$route.query
                )}`,
                orientation: 1,
                isHideTitle: !1
              }
            }),
            l({ api: 'back' }))
        : m.platformType === 'TEACHER' &&
          T.alert({
            title: '\u63D0\u793A',
            message:
              '\u8BF7\u4F7F\u7528\u9177\u4E50\u79C0\u5B66\u751F\u7AEF\u626B\u7801\u6253\u5F00',
            confirmButtonColor: '#01C1B5'
          }).then(() => {
            l({ api: 'back' })
          })
      : this.reCall()
  },
  async mounted() {
    try {
      const e = await y.post('/api-teacher/open/liveShareProfit', {
        data: { bizId: this.groupId, userId: this.recomUserId }
      })
      this.live = e.data.liveCourseGroup || {}
    } catch {}
  },
  methods: {
    locationReplace(e) {
      history.replaceState
        ? (history.replaceState(null, document.title, e),
          window.location.reload())
        : location.replace(e)
    },
    reCall() {
      const { origin: e } = location
      let s = e + '/student/#/liveDetail'
      const t = this.$route.query
      ;(s += `?recomUserId=${this.recomUserId}&groupId=${t.groupId}`), S(s, {})
    },
    onShare() {
      if (n().weixin) {
        this.wxStatus = !0
        return
      }
      this.reCall(),
        setTimeout(() => {
          window.location.href = location.origin + '/student/#/download'
        }, 3e3)
    }
  },
  render() {
    return o('div', { class: [u['live-detail'], 'mb12'] }, [
      o(I, { userInfo: this.userInfo, showBuy: !1 }, null),
      o(
        d,
        { border: !0 },
        {
          default: () => [
            o('p', { class: u.introduction }, [this.userInfo.lessonDesc])
          ]
        }
      ),
      o(
        d,
        { title: '\u8BFE\u7A0B\u5217\u8868', icon: 'courseList', border: !0 },
        { default: () => [o(x, { courseInfo: this.courseInfo }, null)] }
      ),
      o(
        j,
        { position: 'bottom' },
        {
          default: () => [
            o('div', { class: ['btnGroup'], style: { paddingTop: '12px' } }, [
              o(
                C,
                {
                  block: !0,
                  round: !0,
                  type: 'primary',
                  onClick: this.onShare
                },
                {
                  default: () => [
                    $('\u4E0B\u8F7D\u9177\u4E50\u79C0\u8FDB\u5165\u8BFE\u7A0B')
                  ]
                }
              )
            ])
          ]
        }
      ),
      this.wxStatus &&
        o(
          'div',
          {
            class: u.wxpopup,
            onClick: () => {
              this.wxStatus = !1
            }
          },
          [o('img', { src: N('wx_bg.png'), alt: '' }, null)]
        )
    ])
  }
})
export { Q as default, N as getAssetsHomeFile }
