index.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. showDownIndex: -1, //显示下拉下标
  20. liveSelectClassify: '全部', //直播分类选择
  21. agentSelectClassify: '全部', //展商分类选择
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad: function (options) {
  27. let data = {
  28. "classname": "publicmethod.live.live",
  29. "method": "getLiveChannelData",
  30. "content": {
  31. "tactivityid": options.id
  32. }
  33. }
  34. /* 云展会直播大厅 */
  35. _Http.basic(data).then(res => {
  36. if (res.msg != "成功") {
  37. wx.showToast({
  38. title: '直播大厅加载失败,请重新进入页面',
  39. icon: "error",
  40. duration: 5000
  41. })
  42. } else {
  43. const liveList = handleList.twoDimensionalArr(res.data.tlivelist, 4, 10);
  44. this.setData({
  45. liveList,
  46. fagentcount: res.data.fagentcount,
  47. flivecount: res.data.flivecount,
  48. ftotalcustcount: res.data.ftotalcustcount
  49. })
  50. }
  51. });
  52. /* 热门展商 */
  53. data.method = "agentList";
  54. _Http.basic(data).then(res => {
  55. if (res.msg != "成功") {
  56. wx.showToast({
  57. title: '热门展商加载失败,请重新进入页面',
  58. icon: "error",
  59. duration: 5000
  60. })
  61. } else {
  62. const agentList = handleList.twoDimensionalArr(res.data, 4, 10);
  63. this.setData({
  64. agentList
  65. })
  66. }
  67. });
  68. /* 热门展品 */
  69. data.method = "prodList";
  70. _Http.basic(data).then(res => {
  71. if (res.msg != "成功") {
  72. wx.showToast({
  73. title: '热门展品加载失败,请重新进入页面',
  74. icon: "error",
  75. duration: 5000
  76. })
  77. } else {
  78. const prodList = handleList.twoDimensionalArr(res.data, 6, 10);
  79. this.setData({
  80. prodList,
  81. })
  82. }
  83. });
  84. /* 分类 */
  85. _Http.basic({
  86. "classname": "publicmethod.homepage.homepage",
  87. "method": "query_typeselectList",
  88. "content": {}
  89. }).then(res => {
  90. if (res.msg != '成功') {
  91. wx.showToast({
  92. title: '分类加载失败,请重新进入页面',
  93. icon: "error",
  94. duration: 5000
  95. })
  96. } else {
  97. res.data.unshift({
  98. ftype: "全部"
  99. });
  100. console.log(res.data)
  101. this.setData({
  102. typeselectList: res.data
  103. })
  104. }
  105. })
  106. /* 获取轮播图 */
  107. const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'activity_head');
  108. this.setData({
  109. swiperBannerList: bannerList[0].banner
  110. });
  111. },
  112. /* 数据展示 */
  113. searchBlur(e) {
  114. const {
  115. value
  116. } = e.detail;
  117. console.log(value)
  118. },
  119. /* 显示下拉 */
  120. showPullDown(e) {
  121. const {
  122. index
  123. } = e.target.dataset;
  124. if (this.data.showDownIndex == index) return this.setData({
  125. showDownIndex: -1
  126. });
  127. this.setData({
  128. showDownIndex: index
  129. })
  130. },
  131. /* 关闭 */
  132. closeTheDropDown() {
  133. this.setData({
  134. showDownIndex: -1
  135. })
  136. },
  137. /* 选择分类 */
  138. modeSelect(e) {
  139. const {
  140. name,
  141. index
  142. } = e.target.dataset
  143. console.log(index, name)
  144. if (this.data.showDownIndex == 1) {
  145. //直播大厅
  146. this.setData({
  147. showDownIndex: -1,
  148. liveSelectClassify: name
  149. })
  150. } else {
  151. //热门展商
  152. this.setData({
  153. showDownIndex: -1,
  154. agentSelectClassify: name
  155. })
  156. }
  157. },
  158. /**
  159. * 生命周期函数--监听页面初次渲染完成
  160. */
  161. onReady: function () {
  162. },
  163. /**
  164. * 生命周期函数--监听页面显示
  165. */
  166. onShow: function () {
  167. },
  168. /**
  169. * 生命周期函数--监听页面隐藏
  170. */
  171. onHide: function () {
  172. },
  173. /**
  174. * 生命周期函数--监听页面卸载
  175. */
  176. onUnload: function () {
  177. },
  178. /**
  179. * 页面相关事件处理函数--监听用户下拉动作
  180. */
  181. onPullDownRefresh: function () {
  182. },
  183. /**
  184. * 页面上拉触底事件的处理函数
  185. */
  186. onReachBottom: function () {
  187. },
  188. /**
  189. * 用户点击右上角分享
  190. */
  191. onShareAppMessage: function () {
  192. }
  193. })