index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. import {
  2. ApiModel
  3. } from "../../utils/api";
  4. const _Http = new ApiModel();
  5. const handleList = require("../../utils/processingData")
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. //轮播图列表
  12. swiperBannerList: [],
  13. liveList: [], //云展会直播大厅
  14. agentList: [], //热门展商
  15. prodList: [], //热门展品
  16. fagentcount: null, //展示商
  17. flivecount: null, //正在直播
  18. ftotalcustcount: null, //观众总数
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad: function (options) {
  24. let data = {
  25. "classname": "publicmethod.live.live",
  26. "method": "getLiveChannelData",
  27. "content": {
  28. "tactivityid": options.id
  29. }
  30. }
  31. /* 云展会直播大厅 */
  32. _Http.basic(data).then(res => {
  33. if (res.msg != "成功") wx.showToast({
  34. title: '直播大厅加载失败,请重新进入页面',
  35. icon: "error",
  36. duration: 5000
  37. })
  38. console.log("直播大厅", res)
  39. const liveList = handleList.twoDimensionalArr(res.data.tlivelist, 4, 10);
  40. this.setData({
  41. liveList,
  42. fagentcount: res.data.fagentcount,
  43. flivecount: res.data.flivecount,
  44. ftotalcustcount: res.data.ftotalcustcount
  45. })
  46. });
  47. /* 热门展商 */
  48. data.method = "agentList";
  49. _Http.basic(data).then(res => {
  50. console.log("热门展商", res)
  51. if (res.msg != "成功") wx.showToast({
  52. title: '热门展商加载失败,请重新进入页面',
  53. icon: "error",
  54. duration: 5000
  55. })
  56. const agentList = handleList.twoDimensionalArr(res.data, 4, 10);
  57. this.setData({
  58. agentList
  59. })
  60. });
  61. /* 热门展品 */
  62. data.method = "prodList";
  63. _Http.basic(data).then(res => {
  64. console.log("热门展品", res)
  65. if (res.msg != "成功") wx.showToast({
  66. title: '热门展品加载失败,请重新进入页面',
  67. icon: "error",
  68. duration: 5000
  69. })
  70. const prodList = handleList.twoDimensionalArr(res.data, 6, 10);
  71. this.setData({
  72. prodList,
  73. })
  74. });
  75. /* 获取轮播图 */
  76. const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'activity_head');
  77. this.setData({
  78. swiperBannerList: bannerList[0].banner
  79. });
  80. },
  81. /* 数据展示 */
  82. searchBlur(e) {
  83. const {
  84. value
  85. } = e.detail;
  86. console.log(value)
  87. },
  88. /**
  89. * 生命周期函数--监听页面初次渲染完成
  90. */
  91. onReady: function () {
  92. },
  93. /**
  94. * 生命周期函数--监听页面显示
  95. */
  96. onShow: function () {
  97. },
  98. /**
  99. * 生命周期函数--监听页面隐藏
  100. */
  101. onHide: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面卸载
  105. */
  106. onUnload: function () {
  107. },
  108. /**
  109. * 页面相关事件处理函数--监听用户下拉动作
  110. */
  111. onPullDownRefresh: function () {
  112. },
  113. /**
  114. * 页面上拉触底事件的处理函数
  115. */
  116. onReachBottom: function () {
  117. },
  118. /**
  119. * 用户点击右上角分享
  120. */
  121. onShareAppMessage: function () {
  122. }
  123. })