live.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. type: '简介'
  14. },
  15. activity: "",
  16. id: "",
  17. getDate() {
  18. const _this = this;
  19. httpCloud({
  20. name: "server",
  21. type: "getLiveData",
  22. data: {
  23. activityName: _this.activity,
  24. id: _this.id
  25. },
  26. call(res) {
  27. const obj = res || {};
  28. _this.setData({
  29. liveData: obj
  30. })
  31. wx.setNavigationBarTitle({
  32. title: decodeURIComponent(obj.title)
  33. })
  34. }
  35. })
  36. },
  37. select(e){
  38. console.log(e.currentTarget.dataset.type);
  39. this.setData({
  40. type: e.currentTarget.dataset.type
  41. })
  42. },
  43. liveing(e) {
  44. this.setData({
  45. isLive: true
  46. })
  47. },
  48. liveerr() {
  49. this.setData({
  50. isLive: false
  51. })
  52. },
  53. /**
  54. * 生命周期函数--监听页面加载
  55. */
  56. onLoad(options) {
  57. this.activity = decodeURIComponent(options.activityName);
  58. this.id = options.id;
  59. this.getDate();
  60. },
  61. /**
  62. * 生命周期函数--监听页面初次渲染完成
  63. */
  64. onReady() {
  65. },
  66. /**
  67. * 生命周期函数--监听页面显示
  68. */
  69. onShow() {
  70. },
  71. /**
  72. * 生命周期函数--监听页面隐藏
  73. */
  74. onHide() {
  75. },
  76. /**
  77. * 生命周期函数--监听页面卸载
  78. */
  79. onUnload() {
  80. },
  81. /**
  82. * 页面相关事件处理函数--监听用户下拉动作
  83. */
  84. onPullDownRefresh() {
  85. },
  86. /**
  87. * 页面上拉触底事件的处理函数
  88. */
  89. onReachBottom() {
  90. },
  91. /**
  92. * 用户点击右上角分享
  93. */
  94. onShareAppMessage() {
  95. }
  96. })