course_detail.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // pages/course_detail/course_detail.js
  2. import {
  3. getVRCourseDetail
  4. } from '../../utils/request';
  5. import {
  6. IsNotStart,
  7. IsInTime
  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. }
  37. },
  38. /**
  39. * 生命周期函数--监听页面加载
  40. */
  41. onLoad(options) {
  42. if (options.id) {
  43. // debugger
  44. this.getVRCourseDetailData(options.id);
  45. }
  46. },
  47. async getVRCourseDetailData(id) {
  48. const data = await getVRCourseDetail(id)
  49. console.log('data', data.data)
  50. this.setData({
  51. detail: data.data
  52. }, () => {
  53. const res = IsNotStart(this.data.detail.createTime)
  54. console.log('IsNotStart', res, this.data.detail.createTime)
  55. })
  56. },
  57. /**
  58. * 生命周期函数--监听页面初次渲染完成
  59. */
  60. onReady() {
  61. },
  62. /**
  63. * 生命周期函数--监听页面显示
  64. */
  65. onShow() {
  66. },
  67. /**
  68. * 生命周期函数--监听页面隐藏
  69. */
  70. onHide() {
  71. },
  72. /**
  73. * 生命周期函数--监听页面卸载
  74. */
  75. onUnload() {
  76. },
  77. /**
  78. * 页面相关事件处理函数--监听用户下拉动作
  79. */
  80. onPullDownRefresh() {
  81. },
  82. /**
  83. * 页面上拉触底事件的处理函数
  84. */
  85. onReachBottom() {
  86. },
  87. /**
  88. * 用户点击右上角分享
  89. */
  90. onShareAppMessage() {
  91. },
  92. openHost() {
  93. wx.navigateToMiniProgram({
  94. appId: 'wxd55ee54235e90359',
  95. path: 'pages/paid-room/paid-room',
  96. extraData: {
  97. roomId: 'test-01586',
  98. role: "leader",
  99. userId: '066893f525e56f09ce8b4420dff7e0681',
  100. nickname: "四维展主持人",
  101. avatar: "https://4dkk.4dage.com/take-look/images/other/6d5298a02bd849119b7e5357cbd6edff.jpeg"
  102. },
  103. envVersion: 'develop',
  104. success(res) {
  105. // 打开成功
  106. }
  107. })
  108. },
  109. })