import { ApiModel } from "../../../utils/api"; const _Http = new ApiModel(); const handleList = require("../../../utils/processingData"); Page({ /** * 页面的初始数据 */ data: { productList: [], //供需列表 //轮播图列表 swiperBannerList: [{ id: "001", url: "/static/changeImg.png", src: '' }, { id: "002", url: "/static/changeImg.png", src: '' }, { id: "003", url: "/static/changeImg.png", src: '' }], /* 宫格列表 */ gridList: [{ text: '开单', icon: '/static/login/Phone.png' }, { text: '产品资料', icon: '/static/login/username.png' }, { text: '私域直播', icon: '/static/login/verificationcode.png' }, { text: '供需广场', icon: '/static/login/verificationcode.png' }], /* 圆角按钮tabs列表 */ roundedList: [ "兴趣爱好", "关注板块", "最新发布" ] }, /* tabs切换 */ /* tabsSelectedIitem(text) { console.log(text.detail) }, */ /* 宫格区跳转 */ gridJumpPage(e) { const { name } = e.target.dataset; if (name == '供需广场') { wx.switchTab({ url: '/pages/tabbar-pages/supplyAndDemand/index', }) } else if (name == '私域直播') { wx.navigateTo({ url: '/pages/liveStreaming/index', }) } }, /* 获得展示区标题 */ getExhibitionTitle(title) { console.log(title.detail) if (title.detail == '最新供需') { wx.switchTab({ url: '/pages/tabbar-pages/supplyAndDemand/index', }) } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { /* 获取最新供需列表 */ _Http.basic({ "accesstoken": wx.getStorageSync('userData').token, "classname": "customer.supplyanddemand.supplyanddemand", "method": "query_supplyanddemandList", "content": { "getdatafromdbanyway": true, "pageNumber": 1, "pageSize": 8, "where": { "fissupply": "0", "fstatus": "待对接" } } }).then(res => { console.log(res) if (res.msg != '成功') return; const data = handleList.getYTD(res.data) const productList = handleList.listOrdering(data); this.setData({ productList }) }) }, /* 一键联系 */ contact() { console.log('一键联系') }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getTabBar().init(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })