video-detail.cde382a2.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. import { C as c } from './index.84afa5a4.js'
  2. import { S as d } from './index.2778830d.js'
  3. import { U as l } from './index.fdb44d83.js'
  4. import { d as u, D as i, a as o, x as m, B as p } from './vendor.3506a68e.js'
  5. import { r as n } from './index.9e4b607f.js'
  6. import { C as h } from './index.9a4c80cd.js'
  7. import { o as s, a as f } from './orderStatus.81f9c36b.js'
  8. import { t as I } from './tradeOrder.2a9cc20f.js'
  9. import { C as y } from './index.e311a214.js'
  10. /* empty css */ /* empty css */ import './bars.4f1962a6.js'
  11. /* empty css */ import './icon_teacher.cb128c00.js'
  12. import './icon_timer2.5fb1750d.js'
  13. import './icon-jiaozi.20e415ca.js'
  14. /* empty css */ import './index.aec0a459.js'
  15. const b = '_introduction_lw312_1',
  16. j = '_btnGroup_lw312_6',
  17. _ = '_btnMore_lw312_10',
  18. g = '_videoItem_lw312_17'
  19. var a = {
  20. 'video-detail': '_video-detail_lw312_1',
  21. introduction: b,
  22. btnGroup: j,
  23. btnMore: _,
  24. videoItem: g,
  25. 'van-cell__title': '_van-cell__title_lw312_17'
  26. }
  27. function v(e) {
  28. return (
  29. typeof e == 'function' ||
  30. (Object.prototype.toString.call(e) === '[object Object]' && !m(e))
  31. )
  32. }
  33. var z = u({
  34. name: 'VideoDetail',
  35. data() {
  36. const e = this.$route.query
  37. return {
  38. userInfo: {},
  39. detailList: [],
  40. recomUserId: e.recomUserId,
  41. params: { groupId: e.groupId }
  42. }
  43. },
  44. async mounted() {
  45. await this._init()
  46. },
  47. methods: {
  48. async _init() {
  49. try {
  50. const r =
  51. (
  52. await n.get('/api-student/videoLesson/selectVideoLesson', {
  53. params: { groupId: this.params.groupId }
  54. })
  55. ).data || {},
  56. t = r.lessonGroup || {},
  57. O = r.teachertTag || ''
  58. ;(this.userInfo = {
  59. alreadyBuy: r.alreadyBuy,
  60. username: t.username || `\u6E38\u5BA2${t.teacherId || ''}`,
  61. headUrl: t.avatar,
  62. buyNum: t.countStudent,
  63. id: t.id,
  64. lessonNum: t.lessonCount,
  65. lessonName: t.lessonName,
  66. lessonDesc: t.lessonDesc,
  67. lessonPrice: t.lessonPrice,
  68. teacherId: t.teacherId,
  69. lessonCoverUrl: t.lessonCoverUrl,
  70. auditVersion: t.auditVersion,
  71. isDegree: !!r.degreeFlag,
  72. isTeacher: !!r.teacherFlag
  73. }),
  74. (this.detailList = r.detailList || [])
  75. } catch {}
  76. },
  77. onPlay(e) {
  78. this.$router.push({
  79. path: '/videoClassDetail',
  80. query: { groupId: this.params.groupId, classId: e.id }
  81. })
  82. },
  83. async onBuy() {
  84. try {
  85. const e = this.userInfo
  86. if (
  87. ((s.orderObject.orderType = 'VIDEO'),
  88. (s.orderObject.orderName = '\u89C6\u9891\u8BFE\u8D2D\u4E70'),
  89. (s.orderObject.orderDesc = '\u89C6\u9891\u8BFE\u8D2D\u4E70'),
  90. (s.orderObject.actualPrice = e.lessonPrice),
  91. (s.orderObject.recomUserId = this.recomUserId),
  92. (s.orderObject.orderNo = ''),
  93. (s.orderObject.orderList = [
  94. {
  95. orderType: 'VIDEO',
  96. goodsName: '\u89C6\u9891\u8BFE\u8D2D\u4E70',
  97. courseGroupId: e.id,
  98. courseGroupName: e.lessonName,
  99. coursePrice: e.lessonPrice,
  100. teacherName: e.username || `\u6E38\u5BA2${e.teacherId || ''}`,
  101. teacherId: e.teacherId,
  102. avatar: e.headUrl,
  103. courseInfo: this.detailList,
  104. recomUserId: this.recomUserId
  105. }
  106. ]),
  107. e.lessonPrice <= 0)
  108. ) {
  109. await f(() => {
  110. i.alert({
  111. message: '\u9886\u53D6\u6210\u529F',
  112. confirmButtonText: '\u786E\u5B9A',
  113. confirmButtonColor: '#01C1B5'
  114. }).then(() => {
  115. this._init()
  116. })
  117. })
  118. return
  119. }
  120. const t = (
  121. await n.post('/api-student/userOrder/getPendingOrder', {
  122. data: { goodType: 'VIDEO', bizId: this.params.groupId }
  123. })
  124. ).data
  125. t
  126. ? i
  127. .confirm({
  128. title: '\u63D0\u793A',
  129. message:
  130. '\u60A8\u6709\u4E00\u4E2A\u672A\u652F\u4ED8\u7684\u8BA2\u5355\uFF0C\u662F\u5426\u7EE7\u7EED\u652F\u4ED8\uFF1F',
  131. confirmButtonColor: '#269a93',
  132. cancelButtonText: '\u53D6\u6D88\u8BA2\u5355',
  133. confirmButtonText: '\u7EE7\u7EED\u652F\u4ED8'
  134. })
  135. .then(async () => {
  136. I(t, this.routerTo)
  137. })
  138. .catch(() => {
  139. i.close(), this.cancelPayment(t.orderNo)
  140. })
  141. : this.routerTo()
  142. } catch {}
  143. },
  144. routerTo() {
  145. this.$router.push({
  146. path: '/orderDetail',
  147. query: { orderType: 'VIDEO', courseGroupId: this.params.groupId }
  148. })
  149. },
  150. async cancelPayment(e) {
  151. try {
  152. await n.post('/api-student/userOrder/orderCancel', {
  153. data: { orderNo: e }
  154. })
  155. } catch {}
  156. }
  157. },
  158. render() {
  159. let e
  160. return o('div', { class: [a['video-detail']] }, [
  161. o(h, null, null),
  162. o(l, { userInfo: this.userInfo }, null),
  163. o(
  164. d,
  165. { border: !0 },
  166. {
  167. default: () => [
  168. o('p', { class: a.introduction }, [this.userInfo.lessonDesc])
  169. ]
  170. }
  171. ),
  172. o(
  173. d,
  174. {
  175. title: '\u8BFE\u7A0B\u5217\u8868',
  176. icon: 'courseList',
  177. class: 'mb12',
  178. border: !0
  179. },
  180. v(
  181. (e = this.detailList.map(r =>
  182. o(
  183. c,
  184. {
  185. class: ['mb12', a.videoItem],
  186. detail: {
  187. id: r.id,
  188. title: r.videoTitle,
  189. content: r.videoContent,
  190. imgUrl: r.coverUrl
  191. },
  192. onPlay: this.onPlay
  193. },
  194. null
  195. )
  196. ))
  197. )
  198. ? e
  199. : { default: () => [e] }
  200. ),
  201. this.userInfo.id &&
  202. !this.userInfo.alreadyBuy &&
  203. o(
  204. y,
  205. { position: 'bottom', background: 'white' },
  206. {
  207. default: () => [
  208. o('div', { class: ['btnGroup', a.btnMore] }, [
  209. o(
  210. p,
  211. {
  212. block: !0,
  213. round: !0,
  214. type: 'primary',
  215. onClick: this.onBuy
  216. },
  217. {
  218. default: () => [
  219. this.userInfo.lessonPrice <= 0
  220. ? '\u514D\u8D39\u9886\u53D6'
  221. : '\u7ACB\u5373\u8D2D\u4E70'
  222. ]
  223. }
  224. )
  225. ])
  226. ]
  227. }
  228. )
  229. ])
  230. }
  231. })
  232. export { z as default }