index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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: function () {
  79. return {
  80. title: "", // 分享名称
  81. path: 'pages/home/index', // 点击分享后的链接要来到的页面的路径已经对应需要的参数
  82. }
  83. }
  84. })