;(function () {
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
    try {
      var info = gen[key](arg)
      var value = info.value
    } catch (error) {
      reject(error)
      return
    }
    if (info.done) {
      resolve(value)
    } else {
      Promise.resolve(value).then(_next, _throw)
    }
  }
  function _asyncToGenerator(fn) {
    return function () {
      var self = this,
        args = arguments
      return new Promise(function (resolve, reject) {
        var gen = fn.apply(self, args)
        function _next(value) {
          asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value)
        }
        function _throw(err) {
          asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err)
        }
        _next(undefined)
      })
    }
  }
  var __vite_style__ = document.createElement('style')
  __vite_style__.innerHTML =
    '._live-detail_17dsu_1 ._introduction_17dsu_1{color:#7a7a7a;line-height:.61333rem;padding-bottom:.21333rem}._live-detail_17dsu_1 .van-tabs__wrap{margin-bottom:.4rem}._live-detail_17dsu_1 .van-button--disabled{opacity:.9}._live-detail_17dsu_1 ._tips_17dsu_12{background-color:#fff;border-radius:.26667rem;margin:.37333rem .32rem;padding:var(--van-cell-vertical-padding) var(--van-cell-horizontal-padding)}._live-detail_17dsu_1 ._tips_17dsu_12 h3{display:flex;font-size:.37333rem;font-weight:500;color:#333;line-height:1}._live-detail_17dsu_1 ._tips_17dsu_12 p{text-align:justify;padding-top:.24rem;font-size:.32rem;color:#7a7a7a;line-height:.61333rem}._live-detail_17dsu_1 ._tips_17dsu_12 .van-icon{margin-right:.16rem}._live-detail_17dsu_1 ._btnMore_17dsu_35{display:flex;justify-content:space-around}._live-detail_17dsu_1 ._btnMore_17dsu_35 .van-button{width:60%}\n'
  document.head.appendChild(__vite_style__)
  System.register(
    [
      './index-legacy.91b80b61.js',
      './index-legacy.f9759ffc.js',
      './index-legacy.34e07a99.js',
      './index-legacy.595c24c3.js',
      './vendor-legacy.09f20d09.js',
      './orderStatus-legacy.6131dfb6.js',
      './index-legacy.fa4145a4.js',
      './index-legacy.53480b15.js',
      './index-legacy.69ca4eed.js',
      './index-legacy.f25f109a.js',
      './index-legacy.f25f109a4.js',
      './index-legacy.f25f109a2.js',
      './icon_teacher-legacy.e765b7f7.js',
      './icon_timer2-legacy.b6c78faa.js',
      './icon-jiaozi-legacy.dd5ed0e2.js',
      './index-legacy.f25f109a8.js'
    ],
    function (exports) {
      'use strict'
      var CoursePlanStep,
        SectionDetail,
        UserDetail,
        request,
        postMessage,
        defineComponent,
        dayjs,
        Toast,
        Dialog,
        createVNode,
        Icon,
        createTextVNode,
        Button,
        orderStatus,
        onSubmitZero,
        ColHeader,
        ColSticky
      return {
        setters: [
          function (module) {
            CoursePlanStep = module.C
          },
          function (module) {
            SectionDetail = module.S
          },
          function (module) {
            UserDetail = module.U
          },
          function (module) {
            request = module.r
            postMessage = module.p
          },
          function (module) {
            defineComponent = module.d
            dayjs = module.g
            Toast = module.T
            Dialog = module.D
            createVNode = module.a
            Icon = module.K
            createTextVNode = module.j
            Button = module.B
          },
          function (module) {
            orderStatus = module.o
            onSubmitZero = module.a
          },
          function (module) {
            ColHeader = module.C
          },
          function (module) {
            ColSticky = module.C
          },
          function () {},
          function () {},
          function () {},
          function () {},
          function () {},
          function () {},
          function () {},
          function () {}
        ],
        execute: function execute() {
          var introduction = '_introduction_17dsu_1'
          var tips = '_tips_17dsu_12'
          var btnMore = '_btnMore_17dsu_35'
          var styles = {
            'live-detail': '_live-detail_17dsu_1',
            introduction: introduction,
            tips: tips,
            btnMore: btnMore
          }
          var iconTips =
            'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAAXNSR0IArs4c6QAAASNQTFRFAAAA/wAA/4AA/6pV/5kz/4Ar/4BA/49A/445/4BA/4xA/4VD/4pA/4U9/4lA/4g7/4M+/4Y5/4Y9/4VA/4g+/4U9/4g8/4Y8/4Q+/4U//4U9/4g8/4Y+/4c9/4Y9/4c8/4c+/4c+/4U9/4Y+/4Y9/4Y8/4c+/4Y+/4c9/4Y9/4Y8/4Y9/4c9/4Y9/4Y8/4Y+/4U+/4U9/4c9/4Y8/4U+/4Y9/4c8/4Y8/4Y+/4Y9/4Y+/4c+/4c9/4Y9/4c+/4Y9/4Y9/4Y8/4c9/4Y9/4Y8/4Y9/4U9/4c9/4Y8/4c9/4Y9/4Y9/4Y9/4c9/4Y8/4Y+/4Y9/4Y9/4U8/4Y9/4Y9/4Y9/4Y8/4Y9/4Y9/4Y8/4Y9/4Y9/4Y9/4c9/4Y8/4Y9/4Y9qWZ60gAAAGB0Uk5TAAECAwUGEBASFBQXGBkcHiUoKiwtLi83OkFLTU5TVFVXYmRnaXJzdH1+h42Ok5SUlZeXmJmgoaWlp6qusLGys7u+w8rL0NbW19jZ3d7j5OTn7O3t8vP19/j5+fr7/P3+TBv5LQAAAThJREFUOMvF1OszQkEYx/FK6KakXMpBSDfkknIJSYUuKIVOl+P7//8VXmiOc057mDHTeF7t85vP7uzu7KzFMrE6eY3/jhQebD8Lf7IMdMtJvynx5oaMapjzik2oBdxnEonjO6AVEhmpD4Wlr/HiNfSlcRPsIG99t5tdOkGjsZb4WNcGawolqwFFYE+f7ELEgIq0Z/XJzAtFfeIYkDHu4IiBQxeEYewwEoR1QRTGzhKAqC6IgceIPBDTBXFwG5Eb4v+JUmKU0rS2LGJE1qa9AKXpNCJnU9FeQpW6T/TEfHWqatMjLX6saXrquEHNJTKuGg21SYD8LCgZkiqyX2JSV3bNwqvpU0EdSNY//QJzGwujidMr2/MmqA7tm7P9w4vbN3g0QUXtjvMmaGo5lq88vcutyvlOYEIf2ydPMlkWBCFozgAAAABJRU5ErkJggg=='
          var liveDetail = exports(
            'default',
            defineComponent({
              name: 'LiveDetail',
              data: function data() {
                var query = this.$route.query
                return {
                  joinRoom: query.joinRoom, // 原生传递过来的参数，判断是否进入直播间
                  recomUserId: query.recomUserId, // 推荐人id
                  groupId: query.groupId,
                  courseId: query.classId,
                  live: {}
                }
              },
              computed: {
                userInfo: function userInfo() {
                  var _planList$, _planList$2
                  var live = this.live
                  var planList = live.planList || []
                  var startTime =
                    ((_planList$ = planList[0]) === null ||
                    _planList$ === void 0
                      ? void 0
                      : _planList$.startTime) || new Date()
                  var endTime =
                    ((_planList$2 = planList[0]) === null ||
                    _planList$2 === void 0
                      ? void 0
                      : _planList$2.endTime) || new Date()
                  return {
                    headUrl: live.avatar,
                    username:
                      live.userName ||
                      '\u6E38\u5BA2'.concat(live.teacherId || ''),
                    startTime:
                      ''
                        .concat(dayjs(startTime).format('YYYY-MM-DD'), ' ')
                        .concat(dayjs(startTime).format('HH:mm'), '~')
                        .concat(dayjs(endTime).format('HH:mm')) || '',
                    buyNum: live.studentCount,
                    lessonPrice: live.coursePrice,
                    lessonNum: live.courseNum,
                    lessonDesc: live.courseIntroduce,
                    lessonCoverUrl:
                      live.backgroundPic || live.backgroundPicTemplate,
                    lessonName: live.courseGroupName,
                    auditVersion: live.auditVersion || 0,
                    isDegree: live.degreeFlag ? true : false,
                    isTeacher: live.teacherFlag ? true : false
                  }
                },
                courseInfo: function courseInfo() {
                  var tempArr = []
                  var coursePlanList = this.live.planList || []
                  coursePlanList.forEach(function (item) {
                    var startTime = item.startTime || new Date()
                    var endTime = item.endTime || new Date()
                    tempArr.push({
                      courseTime: ''
                        .concat(dayjs(startTime).format('YYYY-MM-DD'), ' ')
                        .concat(dayjs(startTime).format('HH:mm'), '~')
                        .concat(dayjs(endTime).format('HH:mm')),
                      coursePlan: item.plan,
                      roomUid: item.roomUid,
                      liveState: item.liveState,
                      id: item.courseId
                    })
                  })
                  return tempArr || []
                },
                salesEndDate: function salesEndDate() {
                  var live = this.live
                  return dayjs(live.salesEndDate || new Date()).format(
                    'YYYY-MM-DD'
                  )
                },
                liveStatus: function liveStatus() {
                  var _this = this
                  var coursePlanList = this.live.planList || []
                  var tempObj = { status: false, liveStatus: 0, roomUid: '' }
                  coursePlanList.forEach(function (item) {
                    if (item.courseId === Number(_this.courseId)) {
                      tempObj.status = true
                      tempObj.liveStatus = item.liveStatus
                      tempObj.roomUid = item.roomUid
                    }
                  })
                  return tempObj
                }
              },
              mounted: function mounted() {
                var _this2 = this
                return _asyncToGenerator(
                  /*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
                    return regeneratorRuntime.wrap(function _callee$(_context) {
                      while (1) {
                        switch ((_context.prev = _context.next)) {
                          case 0:
                            _context.next = 2
                            return _this2._init()
                          case 2:
                          case 'end':
                            return _context.stop()
                        }
                      }
                    }, _callee)
                  })
                )()
              },
              methods: {
                _init: function _init() {
                  var _this3 = this
                  return _asyncToGenerator(
                    /*#__PURE__*/ regeneratorRuntime.mark(function _callee2() {
                      var res
                      return regeneratorRuntime.wrap(
                        function _callee2$(_context2) {
                          while (1) {
                            switch ((_context2.prev = _context2.next)) {
                              case 0:
                                _context2.prev = 0
                                _context2.next = 3
                                return request.get(
                                  '/api-student/courseGroup/queryLiveCourseInfo',
                                  { params: { groupId: _this3.groupId } }
                                )
                              case 3:
                                res = _context2.sent
                                _this3.live = res.data || {}
                                _context2.next = 9
                                break
                              case 7:
                                _context2.prev = 7
                                _context2.t0 = _context2['catch'](0)
                              case 9:
                              case 'end':
                                return _context2.stop()
                            }
                          }
                        },
                        _callee2,
                        null,
                        [[0, 7]]
                      )
                    })
                  )()
                },
                onJoinRoom: function onJoinRoom() {
                  var _this4 = this
                  return _asyncToGenerator(
                    /*#__PURE__*/ regeneratorRuntime.mark(function _callee3() {
                      var res, result, coursePlanList, tempObj
                      return regeneratorRuntime.wrap(
                        function _callee3$(_context3) {
                          while (1) {
                            switch ((_context3.prev = _context3.next)) {
                              case 0:
                                _context3.prev = 0
                                _context3.next = 3
                                return request.get(
                                  '/api-student/courseGroup/queryLiveCourseInfo',
                                  { params: { groupId: _this4.groupId } }
                                )
                              case 3:
                                res = _context3.sent
                                result = res.data || {}
                                coursePlanList = result.planList || []
                                tempObj = {}
                                coursePlanList.forEach(function (item) {
                                  if (
                                    item.courseId === Number(_this4.courseId)
                                  ) {
                                    tempObj = item
                                  }
                                })
                                console.log(tempObj, _this4.live, 'tempObj')
                                if (tempObj && tempObj.liveState === 1) {
                                  postMessage({
                                    api: 'joinLiveRoom',
                                    content: {
                                      roomId: tempObj.roomUid,
                                      teacherId: _this4.live.teacherId
                                    }
                                  })
                                } else if (tempObj && tempObj.liveState === 2) {
                                  setTimeout(function () {
                                    Toast('课程已结束')
                                  }, 100)
                                } else {
                                  setTimeout(function () {
                                    Toast('课程尚未开始，请耐心等候')
                                  }, 100)
                                }
                                _context3.next = 14
                                break
                              case 12:
                                _context3.prev = 12
                                _context3.t0 = _context3['catch'](0)
                              case 14:
                              case 'end':
                                return _context3.stop()
                            }
                          }
                        },
                        _callee3,
                        null,
                        [[0, 12]]
                      )
                    })
                  )()
                },
                onBuy: function onBuy() {
                  var _this5 = this
                  return _asyncToGenerator(
                    /*#__PURE__*/ regeneratorRuntime.mark(function _callee5() {
                      var live, res, result
                      return regeneratorRuntime.wrap(
                        function _callee5$(_context5) {
                          while (1) {
                            switch ((_context5.prev = _context5.next)) {
                              case 0:
                                _context5.prev = 0
                                live = _this5.live
                                orderStatus.orderObject.orderType = 'LIVE'
                                orderStatus.orderObject.orderName = '直播课购买'
                                orderStatus.orderObject.orderDesc = '直播课购买'
                                orderStatus.orderObject.actualPrice =
                                  live.coursePrice
                                orderStatus.orderObject.recomUserId =
                                  _this5.recomUserId
                                orderStatus.orderObject.orderNo = ''
                                orderStatus.orderObject.orderList = [
                                  {
                                    orderType: 'LIVE',
                                    goodsName: '直播课购买',
                                    courseGroupId: live.courseGroupId,
                                    courseGroupName: live.courseGroupName,
                                    coursePrice: live.coursePrice,
                                    teacherName:
                                      live.userName ||
                                      '\u6E38\u5BA2'.concat(
                                        live.teacherId || ''
                                      ),
                                    teacherId: live.teacherId,
                                    avatar: live.avatar,
                                    courseInfo: _this5.courseInfo,
                                    recomUserId: _this5.recomUserId
                                  }
                                ] // 判断是否是0无订单
                                if (!(live.coursePrice <= 0)) {
                                  _context5.next = 13
                                  break
                                }
                                _context5.next = 12
                                return onSubmitZero(function () {
                                  Dialog.alert({
                                    message: '领取成功',
                                    confirmButtonText: '确定',
                                    confirmButtonColor: '#01C1B5'
                                  }).then(function () {
                                    _this5._init()
                                  })
                                })
                              case 12:
                                return _context5.abrupt('return')
                              case 13:
                                _context5.next = 15
                                return request.post(
                                  '/api-student/userOrder/getPendingOrder',
                                  {
                                    data: {
                                      goodType: 'LIVE',
                                      bizId: _this5.groupId
                                    }
                                  }
                                )
                              case 15:
                                res = _context5.sent
                                result = res.data
                                if (result) {
                                  Dialog.confirm({
                                    title: '提示',
                                    message:
                                      '您有一个未支付的订单，是否继续支付？',
                                    confirmButtonColor: '#269a93',
                                    cancelButtonText: '取消订单',
                                    confirmButtonText: '继续支付'
                                  })
                                    .then(
                                      /*#__PURE__*/ _asyncToGenerator(
                                        /*#__PURE__*/ regeneratorRuntime.mark(
                                          function _callee4() {
                                            return regeneratorRuntime.wrap(
                                              function _callee4$(_context4) {
                                                while (1) {
                                                  switch (
                                                    (_context4.prev =
                                                      _context4.next)
                                                  ) {
                                                    case 0:
                                                      orderStatus.orderObject.orderNo =
                                                        result.orderNo
                                                      orderStatus.orderObject.actualPrice =
                                                        result.actualPrice
                                                      orderStatus.orderObject.discountPrice =
                                                        result.discountPrice
                                                      _this5.routerTo()
                                                    case 4:
                                                    case 'end':
                                                      return _context4.stop()
                                                  }
                                                }
                                              },
                                              _callee4
                                            )
                                          }
                                        )
                                      )
                                    )
                                    .catch(function () {
                                      Dialog.close() // 只用取消订单，不用做其它处理
                                      _this5.cancelPayment(result.orderNo)
                                    })
                                } else {
                                  _this5.routerTo()
                                }
                                _context5.next = 22
                                break
                              case 20:
                                _context5.prev = 20
                                _context5.t0 = _context5['catch'](0)
                              case 22:
                              case 'end':
                                return _context5.stop()
                            }
                          }
                        },
                        _callee5,
                        null,
                        [[0, 20]]
                      )
                    })
                  )()
                },
                routerTo: function routerTo() {
                  var live = this.live
                  this.$router.push({
                    path: '/orderDetail',
                    query: {
                      orderType: 'LIVE',
                      courseGroupId: live.courseGroupId
                    }
                  })
                },
                cancelPayment: function cancelPayment(orderNo) {
                  return _asyncToGenerator(
                    /*#__PURE__*/ regeneratorRuntime.mark(function _callee6() {
                      return regeneratorRuntime.wrap(
                        function _callee6$(_context6) {
                          while (1) {
                            switch ((_context6.prev = _context6.next)) {
                              case 0:
                                _context6.prev = 0
                                _context6.next = 3
                                return request.post(
                                  '/api-student/userOrder/orderCancel',
                                  { data: { orderNo: orderNo } }
                                )
                              case 3:
                                _context6.next = 7
                                break
                              case 5:
                                _context6.prev = 5
                                _context6.t0 = _context6['catch'](0)
                              case 7:
                              case 'end':
                                return _context6.stop()
                            }
                          }
                        },
                        _callee6,
                        null,
                        [[0, 5]]
                      )
                    })
                  )()
                }
              },
              render: function render() {
                var _this6 = this
                return createVNode(
                  'div',
                  { class: [styles['live-detail'], 'mb12'] },
                  [
                    createVNode(ColHeader, null, null),
                    createVNode(
                      UserDetail,
                      { userInfo: this.userInfo, showBuy: false },
                      null
                    ),
                    createVNode(
                      SectionDetail,
                      { border: true },
                      {
                        default: function _default() {
                          return [
                            createVNode('p', { class: styles.introduction }, [
                              _this6.userInfo.lessonDesc
                            ])
                          ]
                        }
                      }
                    ),
                    createVNode(
                      SectionDetail,
                      {
                        title: '课程列表',
                        icon: 'courseList',
                        border: true,
                        contentStyle: { paddingTop: '0' }
                      },
                      {
                        default: function _default() {
                          return [
                            _this6.courseInfo.length > 0 &&
                              createVNode(
                                CoursePlanStep,
                                {
                                  courseInfo: _this6.courseInfo,
                                  courseId: Number(_this6.courseId) || 0
                                },
                                null
                              )
                          ]
                        }
                      }
                    ),
                    createVNode('div', { class: styles.tips }, [
                      createVNode('h3', null, [
                        createVNode(Icon, { name: iconTips, size: 15 }, null),
                        createTextVNode('\u6E29\u99A8\u63D0\u793A')
                      ]),
                      createVNode('p', null, [
                        createTextVNode(
                          '1\u3001\u8BE5\u76F4\u64AD\u8BFE\u7A0B\u9500\u552E\u622A\u6B62\u540E\uFF0C\u62A5\u540D\u4EBA\u6570\u82E5\u5C11\u4E8E'
                        ),
                        this.live.mixStudentNum || 0,
                        createTextVNode(
                          '\u4EBA\u5C06\u53D6\u6D88\u5F00\u8BFE\uFF0C\u5DF2\u8D2D\u4E70\u5B66\u5458\u4ED8\u8D39\u91D1\u989D\u5C06\u81EA\u52A8\u8FD4\u8FD8\uFF0C\u8BF7\u60A8\u653E\u5FC3\u8D2D\u4E70\uFF1B'
                        ),
                        createVNode('br', null, null),
                        createTextVNode(
                          '2\u3001\u76F4\u64AD\u8BFE\u6559\u5B66\u8BA1\u5212\u4E2D\u7684\u4E0A\u8BFE\u65F6\u95F4\u4E3A\u8001\u5E08\u9884\u8BA1\u65F6\u95F4\uFF0C\u5B9E\u9645\u4E0A\u8BFE\u65F6\u95F4\u4EE5\u8001\u5E08\u5F00\u542F\u76F4\u64AD\u65F6\u95F4\u4E3A\u51C6\uFF1B'
                        ),
                        createVNode('br', null, null),
                        createTextVNode(
                          '3\u3001\u82E5\u60A8\u9519\u8FC7\u8001\u5E08\u76F4\u64AD\uFF0C\u53EF\u901A\u8FC7\u89C6\u9891\u56DE\u653E\u89C2\u770B\u5B8C\u6574\u8BFE\u7A0B\u3002'
                        )
                      ])
                    ]),
                    this.courseInfo.length > 0 &&
                      this.live.existBuy !== 1 && // <Sticky offsetBottom={0} position="bottom">
                      //   <div class={['btnGroup', styles.btnMore]}>
                      //     <Button block round type="primary" onClick={this.onBuy}>
                      //       {this.live.coursePrice <= 0 ? '免费领取' : `立即购买`}
                      //     </Button>
                      //   </div>
                      // </Sticky>
                      createVNode(
                        ColSticky,
                        { position: 'bottom', background: 'white' },
                        {
                          default: function _default() {
                            return [
                              createVNode(
                                'div',
                                { class: ['btnGroup', styles.btnMore] },
                                [
                                  createVNode(
                                    Button,
                                    {
                                      block: true,
                                      round: true,
                                      type: 'primary',
                                      onClick: _this6.onBuy
                                    },
                                    {
                                      default: function _default() {
                                        return [
                                          _this6.live.coursePrice <= 0
                                            ? '免费领取'
                                            : '\u7ACB\u5373\u8D2D\u4E70'
                                        ]
                                      }
                                    }
                                  )
                                ]
                              )
                            ]
                          }
                        }
                      ),
                    this.joinRoom == '1' &&
                      this.liveStatus.liveStatus !== 2 && // <Sticky offsetBottom={0} position="bottom">
                      //   <div class={['btnGroup']} style={{ paddingTop: '12px' }}>
                      //     <Button block round type="primary" onClick={this.onJoinRoom}>
                      //       进入直播间
                      //     </Button>
                      //   </div>
                      // </Sticky>
                      createVNode(
                        ColSticky,
                        { position: 'bottom', background: 'white' },
                        {
                          default: function _default() {
                            return [
                              createVNode(
                                'div',
                                {
                                  class: ['btnGroup'],
                                  style: { paddingTop: '12px' }
                                },
                                [
                                  createVNode(
                                    Button,
                                    {
                                      block: true,
                                      round: true,
                                      type: 'primary',
                                      onClick: _this6.onJoinRoom
                                    },
                                    {
                                      default: function _default() {
                                        return [
                                          createTextVNode(
                                            '\u8FDB\u5165\u76F4\u64AD\u95F4'
                                          )
                                        ]
                                      }
                                    }
                                  )
                                ]
                              )
                            ]
                          }
                        }
                      )
                  ]
                )
              }
            })
          )
        }
      }
    }
  )
})()
