course_detail.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // pages/course_detail/course_detail.js
  2. import dayjs from 'dayjs'
  3. import {
  4. getVRCourseDetail
  5. } from '../../utils/request';
  6. import {
  7. getCourseStatus,
  8. } from '../../utils/courseTime';
  9. Page({
  10. /**
  11. * 页面的初始数据
  12. */
  13. data: {
  14. time: 96 * 60 * 1000,
  15. detail: {
  16. compereId: null,
  17. createTime: "",
  18. creatorId: null,
  19. creatorName: "",
  20. display: null,
  21. duration: null,
  22. fee: null,
  23. id: null,
  24. isDap: null,
  25. isFee: null,
  26. isTop: null,
  27. organization: "",
  28. rtf: "",
  29. sceneCode: "",
  30. sort: null,
  31. thumb: "",
  32. thumbShare: "",
  33. title: "",
  34. titleSub: "",
  35. updateTime: "",
  36. openRoomTime: '',
  37. endRoomTime: ''
  38. },
  39. courseStaus: {
  40. status: 0,
  41. time: 0,
  42. showTime: ''
  43. }
  44. },
  45. /**
  46. * 生命周期函数--监听页面加载
  47. */
  48. onLoad(options) {
  49. if (options.id) {
  50. // debugger
  51. this.getVRCourseDetailData(options.id);
  52. }
  53. },
  54. async getVRCourseDetailData(id) {
  55. const data = await getVRCourseDetail(id)
  56. console.log('data', data.data)
  57. this.setData({
  58. detail: data.data
  59. }, () => {
  60. const res = getCourseStatus(this.data.detail.openRoomTime, this.data.detail.endRoomTime)
  61. // const res = getCourseStatus(dayjs('2024-09-02 10:00:00'), dayjs('2024-09-04 10:00:00'))
  62. console.log('getCourseStatus', res)
  63. this.setData({
  64. courseStaus: res
  65. })
  66. })
  67. },
  68. /**
  69. * 生命周期函数--监听页面初次渲染完成
  70. */
  71. onReady() {
  72. },
  73. /**
  74. * 生命周期函数--监听页面显示
  75. */
  76. onShow() {
  77. },
  78. /**
  79. * 生命周期函数--监听页面隐藏
  80. */
  81. onHide() {
  82. },
  83. /**
  84. * 生命周期函数--监听页面卸载
  85. */
  86. onUnload() {
  87. },
  88. /**
  89. * 页面相关事件处理函数--监听用户下拉动作
  90. */
  91. onPullDownRefresh() {
  92. },
  93. /**
  94. * 页面上拉触底事件的处理函数
  95. */
  96. onReachBottom() {
  97. },
  98. /**
  99. * 用户点击右上角分享
  100. */
  101. onShareAppMessage() {
  102. },
  103. openHost() {
  104. wx.navigateToMiniProgram({
  105. appId: 'wxd55ee54235e90359',
  106. path: 'pages/paid-room/paid-room',
  107. extraData: {
  108. roomId: 'test-01586',
  109. role: "leader",
  110. userId: '066893f525e56f09ce8b4420dff7e0681',
  111. nickname: "四维展主持人",
  112. avatar: "https://4dkk.4dage.com/take-look/images/other/6d5298a02bd849119b7e5357cbd6edff.jpeg"
  113. },
  114. envVersion: 'develop',
  115. success(res) {
  116. // 打开成功
  117. }
  118. })
  119. },
  120. })