index.js 1.4 KB

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