|
- // pages/all/index.js
- import {getUserInfo} from '../../utils/getUserInfo.js'
- import {getCityTree} from '../../api/feeddback.js'
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- // 列表数据筛选条件
- params: {
- name: ''
- },
- name: '',
- list: [],
- current: "",
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.getTabBar().setData({
- selected: 1
- })
- let positionParams = wx.getStorageSync('positionParams')
- if(Object.keys(positionParams).length) {
- let params = this.data.params
- params.provinceCode = positionParams.provinceCode
- params.cityCode = positionParams.cityCode
- params.districtCode = positionParams.districtCode
- this.setData({params, current: '/stream/index'})
- } else {
- const path = '/pages/all/index'
- const fromType = 'tabbar'
- wx.redirectTo({
- url: `/pages/login/login?path=${path}&fromType=${fromType}`,
- })
- }
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /* 输入河流名称搜索 */
- search(e) {
- let params = this.data.params
- params.name = this.data.name
- this.setData({ params: params })
- },
-
- /* 更新数据 */
- updateList(e) {
- let list = this.data.list.concat(e.detail || [])
- this.setData({ list })
- },
- /* 重置数据 */
- resetList() {
- this.setData({ list: [] })
- },
-
- /* 跳转上报问题页面 */
- uploadProblem(e) {
- let detail = e.currentTarget.dataset.detail
- let openId = wx.getStorageSync('openId')
- if(openId) {
- wx.navigateTo({
- url: '/package_A/pages/report/index?data=' + JSON.stringify(detail),
- })
- } else {
- getUserInfo().then(res=> {
- wx.navigateTo({
- url: '/package_A/pages/report/index?data=' + JSON.stringify(detail),
- })
- })
- }
- },
- // /* 跳转至筛选页 */
- // goSelectLocation(e) {
- // const path = '/pages/all/index'
- // wx.redirectTo({
- // url: `/pages/login/login?path=${path}`,
- // })
- // },
- /* 跳转至详情页 */
- showDetail(e) {
- let data = e.currentTarget.dataset.item
- wx.navigateTo({
- url: '/package_A/pages/riverDetail/index?data='+ JSON.stringify(data),
- })
- }
- })
|