index.js 3.2 KB

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