point.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // pages/tabber/news/index.js
  2. const app=getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. taskInfo:[],
  9. columns: ['北京','杭州', '宁波', '温州', '嘉兴', '湖州'],
  10. show:false,
  11. vtype:'北京',
  12. ktype:'0',
  13. keyword:"",
  14. pageindex: 1
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. this.gettasklist();
  21. },
  22. /**
  23. * 生命周期函数--监听页面初次渲染完成
  24. */
  25. onReady: function () {
  26. },
  27. /**
  28. * 页面上拉触底事件的处理函数
  29. */
  30. onReachBottom: function () {
  31. this.setData({pageindex:this.data.pageindex+=1})
  32. this.gettasklist()
  33. },
  34. bindinput(e){
  35. this.setData({
  36. inputValue: e.detail.value
  37. })
  38. },
  39. city(){
  40. this.setData({
  41. show:!this.data.show
  42. })
  43. },
  44. onClose() {
  45. this.setData({ show: false });
  46. },
  47. onChange(event) {
  48. const { picker, value, index } = event.detail;
  49. this.setData({
  50. vtype:value,
  51. show:!this.data.show,
  52. ktype:index
  53. })
  54. console.log(`当前值:${value}, 当前索引:${index}`);
  55. },
  56. gettasklist(){
  57. var that=this
  58. var lng=wx.getStorageSync('longitude');
  59. var lat=wx.getStorageSync('latitude');
  60. var id=this.data.ktype;
  61. var key=this.data.keyword
  62. app.api.useApi(app.globalData.baseAppUrl + "api/admin/GetNetworker", {
  63. city_id:id,
  64. key:key,
  65. lng:lng,
  66. lat:lat,
  67. page: that.data.pageindex
  68. }, "get").then(function (res) {
  69. console.log(res);
  70. if (res.code != 200) {
  71. wx.showLoading({
  72. title: res.message.msg,
  73. })
  74. that.setData({pageindex: that.data.pageindex -= 1})
  75. setTimeout(function () {
  76. wx.hideLoading();
  77. }, 1000);
  78. } else {
  79. wx.hideLoading();
  80. if (that.data.pageindex == 1) {
  81. that.setData({taskInfo: []})
  82. }
  83. if (res.message.data.length > 0) {
  84. that.setData({taskInfo: that.data.taskInfo.concat(res.message.data)})
  85. } else {
  86. that.setData({pageindex: that.data.pageindex -= 1})
  87. }
  88. }
  89. }).catch(function (err) {
  90. console.log(222);
  91. })
  92. }
  93. })