index.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. productList: [], //供需列表
  12. //轮播图列表
  13. swiperBannerList: [{
  14. id: "001",
  15. url: "/static/changeImg.png",
  16. src: ''
  17. }, {
  18. id: "002",
  19. url: "/static/changeImg.png",
  20. src: ''
  21. }, {
  22. id: "003",
  23. url: "/static/changeImg.png",
  24. src: ''
  25. }],
  26. /* 宫格列表 */
  27. gridList: [{
  28. text: '开单',
  29. icon: '/static/login/Phone.png'
  30. }, {
  31. text: '产品资料',
  32. icon: '/static/login/username.png'
  33. }, {
  34. text: '私域直播',
  35. icon: '/static/login/verificationcode.png'
  36. }, {
  37. text: '供需广场',
  38. icon: '/static/login/verificationcode.png'
  39. }],
  40. /* 圆角按钮tabs列表 */
  41. roundedList: [
  42. "兴趣爱好", "关注板块", "最新发布"
  43. ]
  44. },
  45. /* tabs切换 */
  46. /* tabsSelectedIitem(text) {
  47. console.log(text.detail)
  48. }, */
  49. /* 宫格区跳转 */
  50. gridJumpPage(e) {
  51. const {
  52. name
  53. } = e.target.dataset;
  54. if (name == '供需广场') {
  55. wx.switchTab({
  56. url: '/pages/tabbar-pages/supplyAndDemand/index',
  57. })
  58. } else if (name == '私域直播') {
  59. wx.navigateTo({
  60. url: '/pages/liveStreaming/index',
  61. })
  62. }
  63. },
  64. /* 获得展示区标题 */
  65. getExhibitionTitle(title) {
  66. console.log(title.detail)
  67. if (title.detail == '最新供需') {
  68. wx.switchTab({
  69. url: '/pages/tabbar-pages/supplyAndDemand/index',
  70. })
  71. }
  72. },
  73. /**
  74. * 生命周期函数--监听页面加载
  75. */
  76. onLoad: function (options) {
  77. /* 获取最新供需列表 */
  78. _Http.basic({
  79. "accesstoken": wx.getStorageSync('userData').token,
  80. "classname": "customer.supplyanddemand.supplyanddemand",
  81. "method": "query_supplyanddemandList",
  82. "content": {
  83. "getdatafromdbanyway": true,
  84. "pageNumber": 1,
  85. "pageSize": 8,
  86. "where": {
  87. "fissupply": "0",
  88. "fstatus": "待对接"
  89. }
  90. }
  91. }).then(res => {
  92. console.log(res)
  93. if (res.msg != '成功') return;
  94. const data = handleList.getYTD(res.data)
  95. const productList = handleList.listOrdering(data);
  96. this.setData({
  97. productList
  98. })
  99. })
  100. },
  101. /* 一键联系 */
  102. contact() {
  103. console.log('一键联系')
  104. },
  105. /**
  106. * 生命周期函数--监听页面初次渲染完成
  107. */
  108. onReady: function () {
  109. },
  110. /**
  111. * 生命周期函数--监听页面显示
  112. */
  113. onShow: function () {
  114. this.getTabBar().init();
  115. },
  116. /**
  117. * 生命周期函数--监听页面隐藏
  118. */
  119. onHide: function () {
  120. },
  121. /**
  122. * 生命周期函数--监听页面卸载
  123. */
  124. onUnload: function () {
  125. },
  126. /**
  127. * 页面相关事件处理函数--监听用户下拉动作
  128. */
  129. onPullDownRefresh: function () {
  130. },
  131. /**
  132. * 页面上拉触底事件的处理函数
  133. */
  134. onReachBottom: function () {
  135. },
  136. /**
  137. * 用户点击右上角分享
  138. */
  139. onShareAppMessage: function () {
  140. }
  141. })