zcmx.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // pages/zcmx/zcmx.js
  2. import {
  3. emptyAreaList,
  4. contactList
  5. } from "../api/gzw-api"
  6. import {
  7. imgUrl
  8. } from "../api/request"
  9. import{
  10. js_date_time
  11. }from "../../utils/util"
  12. Page({
  13. /**
  14. * 页面的初始数据
  15. */
  16. data: {
  17. contactList:[],
  18. emptyAreaList:[],
  19. emptyAreaIndex:1,
  20. emptyAreaTotalPage:0,
  21. contactIndex:1,
  22. contactTotalPage:0
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad(options) {
  28. this.loadHotline(1,10);
  29. this.loadDetail(1,10);
  30. },
  31. /**
  32. * 生命周期函数--监听页面初次渲染完成
  33. */
  34. onReady() {
  35. },
  36. /**
  37. * 生命周期函数--监听页面显示
  38. */
  39. onShow() {
  40. },
  41. /**
  42. * 生命周期函数--监听页面隐藏
  43. */
  44. onHide() {
  45. },
  46. /**
  47. * 生命周期函数--监听页面卸载
  48. */
  49. onUnload() {
  50. },
  51. /**
  52. * 页面相关事件处理函数--监听用户下拉动作
  53. */
  54. onPullDownRefresh() {
  55. },
  56. /**
  57. * 页面上拉触底事件的处理函数
  58. */
  59. onReachBottom() {
  60. },
  61. /**
  62. * 用户点击右上角分享
  63. */
  64. onShareAppMessage() {
  65. },
  66. prevLoadDetail(){
  67. let a = this.data.emptyAreaIndex - 1
  68. this.setData({
  69. emptyAreaIndex: a
  70. })
  71. this.loadDetail(a,10);
  72. },
  73. nextLoadDetail(){
  74. let a = this.data.emptyAreaIndex + 1
  75. this.setData({
  76. emptyAreaIndex: a
  77. })
  78. this.loadDetail(a,10);
  79. },
  80. loadDetail(page,size){
  81. emptyAreaList(page,size,{}).then(res=>{
  82. if (res.success) {
  83. if(res.data.size>0){
  84. let emptyAreaList = res.data.records
  85. this.setData({
  86. emptyAreaList,
  87. emptyAreaTotalPage: res.data.pages
  88. })
  89. }
  90. }
  91. })
  92. },
  93. prevLoadHotline(){
  94. let a = this.data.contactIndex - 1
  95. this.setData({
  96. contactIndex: a
  97. })
  98. this.loadHotline(a,10);
  99. },
  100. nextLoadHotline(){
  101. let a = this.data.contactIndex + 1
  102. this.setData({
  103. contactIndex: a
  104. })
  105. this.loadHotline(a,10);
  106. },
  107. loadHotline(page,size){
  108. contactList(page,size,{}).then(res=>{
  109. if (res.success) {
  110. if(res.data.size>0){
  111. let contactList = res.data.records
  112. this.setData({
  113. contactList,
  114. contactTotalPage: res.data.pages
  115. })
  116. }
  117. }
  118. })
  119. }
  120. })