import { _ as c, c as p, d as m } from './icon_discount.202ead11.js'
import { _ as f, a as _ } from './share-vip-tips.975e41da.js'
import { _ as g, a as h } from './wx_bg.5eddda0b.js'
import { C as b } from './index.84afa5a4.js'
import { S as l } from './index.2778830d.js'
import { U as w } from './index.fdb44d83.js'
import {
  d as x,
  D as y,
  a as t,
  x as v,
  B as j,
  j as C
} from './vendor.3506a68e.js'
import { b as i, s as d, p as a, r as I } from './index.9e4b607f.js'
import { C as S } from './index.e311a214.js'
import { s as D } from './share.622205d9.js'
import { q as r } from './index.339fc024.js'
/* empty css              */ /* empty css               */ import './bars.4f1962a6.js'
/* empty css               */ import './icon_teacher.cb128c00.js'
import './icon_timer2.5fb1750d.js'
import './icon-jiaozi.20e415ca.js'
const U = '_introduction_q1sek_1',
  $ = '_wxpopup_q1sek_9'
var n = { 'video-detail': '_video-detail_q1sek_1', introduction: U, wxpopup: $ }
function q(e) {
  return (
    typeof e == 'function' ||
    (Object.prototype.toString.call(e) === '[object Object]' && !v(e))
  )
}
const T = e => {
  const o = `../images/${e}`
  return {
    '../images/icon-cert.png': c,
    '../images/icon_discount.png': p,
    '../images/icon_music.png': m,
    '../images/music-share-banner.png': f,
    '../images/share-banner.png': g,
    '../images/share-vip-tips.png': _,
    '../images/wx_bg.png': h
  }[o].default
}
var Q = x({
  name: 'VideoDetail',
  data() {
    const e = this.$route.query
    return {
      userInfo: {},
      detailList: [],
      buyUserList: [],
      dataShow: !0,
      loading: !1,
      finished: !1,
      recomUserId: e.recomUserId,
      params: { videoLessonGroupId: e.groupId, page: 1, rows: 20 },
      wxStatus: !1
    }
  },
  created() {
    if (i().isApp)
      if (d.platformType === 'STUDENT') {
        window.location.replace(
          `${location.origin}/student/#/videoDetail?${r.stringify(
            this.$route.query
          )}`
        ),
          i().ios
            ? window.location.replace(
                `${location.origin}/student/#/videoDetail?${r.stringify(
                  this.$route.query
                )}`
              )
            : (a({
                api: 'openWebView',
                content: {
                  url: `${location.origin}/student/#/videoDetail?${r.stringify(
                    this.$route.query
                  )}`,
                  orientation: 1,
                  isHideTitle: !1
                }
              }),
              a({ api: 'back' }))
        return
      } else
        d.platformType === 'TEACHER' &&
          y
            .alert({
              title: '\u63D0\u793A',
              message:
                '\u8BF7\u4F7F\u7528\u9177\u4E50\u79C0\u5B66\u751F\u7AEF\u626B\u7801\u6253\u5F00',
              confirmButtonColor: '#01C1B5'
            })
            .then(() => {
              a({ api: 'back' })
            })
    else this.reCall()
  },
  async mounted() {
    try {
      const o =
          (
            await I.post('/api-teacher/open/videoShareProfit', {
              data: {
                bizId: this.params.videoLessonGroupId,
                userId: this.recomUserId
              }
            })
          ).data || {},
        { lessonGroup: s, detailList: u } = o.videoGroup
      ;(this.userInfo = {
        username: o.name,
        headUrl: o.avatar,
        buyNum: s.countStudent,
        lessonNum: s.lessonCount,
        lessonName: s.lessonName,
        lessonDesc: s.lessonDesc,
        lessonPrice: s.lessonPrice,
        lessonCoverUrl: s.lessonCoverUrl
      }),
        (this.detailList = u || [])
    } catch {}
  },
  methods: {
    locationReplace(e) {
      history.replaceState
        ? (history.replaceState(null, document.title, e),
          window.location.reload())
        : location.replace(e)
    },
    reCall() {
      const { origin: e } = location
      let o = e + '/student/#/videoDetail'
      const s = this.$route.query
      ;(o += `?recomUserId=${this.recomUserId}&groupId=${s.groupId}`),
        console.log(o),
        D(o, {})
    },
    onShare() {
      if (i().weixin) {
        this.wxStatus = !0
        return
      }
      this.reCall(),
        setTimeout(() => {
          window.location.href = location.origin + '/student/#/download'
        }, 3e3)
    }
  },
  render() {
    let e
    return t('div', { class: [n['video-detail'], 'mb12'] }, [
      t(w, { userInfo: this.userInfo, showBuy: !1 }, null),
      t(
        l,
        { border: !0 },
        {
          default: () => [
            t('p', { class: n.introduction }, [this.userInfo.lessonDesc])
          ]
        }
      ),
      t(
        l,
        {
          title: '\u8BFE\u7A0B\u5217\u8868',
          icon: 'courseList',
          contentStyle: { paddingTop: '0' }
        },
        q(
          (e = this.detailList.map(o =>
            t(
              b,
              {
                class: 'mb12',
                detail: {
                  id: o.id,
                  title: o.videoTitle,
                  content: o.videoContent,
                  imgUrl: o.coverUrl
                }
              },
              null
            )
          ))
        )
          ? e
          : { default: () => [e] }
      ),
      t(
        S,
        { position: 'bottom' },
        {
          default: () => [
            t('div', { class: ['btnGroup'], style: { paddingTop: '12px' } }, [
              t(
                j,
                {
                  block: !0,
                  round: !0,
                  type: 'primary',
                  onClick: this.onShare
                },
                {
                  default: () => [
                    C('\u4E0B\u8F7D\u9177\u4E50\u79C0\u8FDB\u5165\u8BFE\u7A0B')
                  ]
                }
              )
            ])
          ]
        }
      ),
      this.wxStatus &&
        t(
          'div',
          {
            class: n.wxpopup,
            onClick: () => {
              this.wxStatus = !1
            }
          },
          [t('img', { src: T('wx_bg.png'), alt: '' }, null)]
        )
    ])
  }
})
export { Q as default, T as getAssetsHomeFile }
