// pages/tabber/news/index.js const app=getApp() Page({ /** * 页面的初始数据 */ data: { taskInfo:[], columns: ['北京','杭州', '宁波', '温州', '嘉兴', '湖州'], show:false, vtype:'北京', ktype:'0', inputValue:"", pageindex: 1 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.gettasklist(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, bindinput(e){ this.setData({ inputValue: e.detail.value }) }, city(){ this.setData({ show:!this.data.show }) }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.setData({pageindex:this.data.pageindex+=1}) this.gettasklist() }, onClose() { this.setData({ show: false }); }, onChange(event) { const { picker, value, index } = event.detail; this.setData({ vtype:value, show:!this.data.show, ktype:index }) console.log(`当前值:${value}, 当前索引:${index}`); }, gettasklist(){ var that=this var lng=wx.getStorageSync('longitude'); var lat=wx.getStorageSync('latitude'); var id=this.data.ktype; var key=this.data.inputValue app.api.useApi(app.globalData.baseAppUrl + "api/admin/DevicesListManage", { city_id:id, key:key, lng:lat, lat:lng, page: that.data.pageindex }, "get").then(function (res) { console.log(res); if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) that.setData({pageindex: that.data.pageindex -= 1}) setTimeout(function () { wx.hideLoading(); }, 1000); } else { wx.hideLoading(); if (that.data.pageindex == 1) { that.setData({taskInfo: []}) } if (res.message.data.length > 0) { that.setData({taskInfo: that.data.taskInfo.concat(res.message.data)}) } else { that.setData({pageindex: that.data.pageindex -= 1}) } } }).catch(function (err) { console.log(222); }) } })