拓恒河湖长制全民护河平台WEB端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.5KB

  1. // pages/all/index.js
  2. import {getUserInfo} from '../../utils/getUserInfo.js'
  3. import {getCityTree} from '../../api/feeddback.js'
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. // 列表数据筛选条件
  10. params: {
  11. name: ''
  12. },
  13. name: '',
  14. list: [],
  15. current: "",
  16. },
  17. /**
  18. * 生命周期函数--监听页面加载
  19. */
  20. onLoad: function (options) {
  21. this.getTabBar().setData({
  22. selected: 1
  23. })
  24. let positionParams = wx.getStorageSync('positionParams')
  25. if(Object.keys(positionParams).length) {
  26. let params = this.data.params
  27. params.provinceCode = positionParams.provinceCode
  28. params.cityCode = positionParams.cityCode
  29. params.districtCode = positionParams.districtCode
  30. this.setData({params, current: '/stream/index'})
  31. } else {
  32. const path = '/pages/all/index'
  33. const fromType = 'tabbar'
  34. wx.redirectTo({
  35. url: `/pages/login/login?path=${path}&fromType=${fromType}`,
  36. })
  37. }
  38. },
  39. /**
  40. * 生命周期函数--监听页面显示
  41. */
  42. onShow: function () {
  43. },
  44. /* 输入河流名称搜索 */
  45. search(e) {
  46. let params = this.data.params
  47. params.name = this.data.name
  48. this.setData({ params: params })
  49. },
  50. /* 更新数据 */
  51. updateList(e) {
  52. let list = this.data.list.concat(e.detail || [])
  53. this.setData({ list })
  54. },
  55. /* 重置数据 */
  56. resetList() {
  57. this.setData({ list: [] })
  58. },
  59. /* 跳转上报问题页面 */
  60. uploadProblem(e) {
  61. let detail = e.currentTarget.dataset.detail
  62. let openId = wx.getStorageSync('openId')
  63. if(openId) {
  64. wx.navigateTo({
  65. url: '/package_A/pages/report/index?data=' + JSON.stringify(detail),
  66. })
  67. } else {
  68. getUserInfo().then(res=> {
  69. wx.navigateTo({
  70. url: '/package_A/pages/report/index?data=' + JSON.stringify(detail),
  71. })
  72. })
  73. }
  74. },
  75. // /* 跳转至筛选页 */
  76. // goSelectLocation(e) {
  77. // const path = '/pages/all/index'
  78. // wx.redirectTo({
  79. // url: `/pages/login/login?path=${path}`,
  80. // })
  81. // },
  82. /* 跳转至详情页 */
  83. showDetail(e) {
  84. let data = e.currentTarget.dataset.item
  85. wx.navigateTo({
  86. url: '/package_A/pages/riverDetail/index?data='+ JSON.stringify(data),
  87. })
  88. }
  89. })