live.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // pages/live/live.js
  2. import {
  3. httpCloud
  4. } from "../../utils/httpFunc";
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. isLive: false,
  11. liveData: {},
  12. list: []
  13. },
  14. activity: "",
  15. id: "",
  16. getDate() {
  17. const _this = this;
  18. httpCloud({
  19. name: "server",
  20. type: "getLiveData",
  21. data: {
  22. activityName: _this.activity,
  23. id: _this.id
  24. },
  25. call(res) {
  26. const obj = res || {};
  27. _this.setData({
  28. liveData: obj
  29. })
  30. wx.setNavigationBarTitle({
  31. title: decodeURIComponent(obj.title)
  32. })
  33. }
  34. })
  35. },
  36. liveing() {
  37. this.setData({
  38. isLive: true
  39. })
  40. },
  41. liveerr() {
  42. this.setData({
  43. isLive: false
  44. })
  45. },
  46. /**
  47. * 生命周期函数--监听页面加载
  48. */
  49. onLoad(options) {
  50. this.activity = options.activityName;
  51. this.id = options.id;
  52. this.getDate();
  53. },
  54. /**
  55. * 生命周期函数--监听页面初次渲染完成
  56. */
  57. onReady() {
  58. },
  59. /**
  60. * 生命周期函数--监听页面显示
  61. */
  62. onShow() {
  63. },
  64. /**
  65. * 生命周期函数--监听页面隐藏
  66. */
  67. onHide() {
  68. },
  69. /**
  70. * 生命周期函数--监听页面卸载
  71. */
  72. onUnload() {
  73. },
  74. /**
  75. * 页面相关事件处理函数--监听用户下拉动作
  76. */
  77. onPullDownRefresh() {
  78. },
  79. /**
  80. * 页面上拉触底事件的处理函数
  81. */
  82. onReachBottom() {
  83. },
  84. /**
  85. * 用户点击右上角分享
  86. */
  87. onShareAppMessage() {
  88. }
  89. })