riku
2022-08-10 51600113c20d84ee54660de23324400604704dc2
pages/module_consult/consultresult/consultresult.js
@@ -8,7 +8,26 @@
   * 页面的初始数据
   */
  data: {
    keyword: ''
    keyword: 'asdad',
    result: [{
      id: '',
      name: '法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规',
      des: '法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规',
      fileIndustry: '生态环境',
      itemType: '大气',
      fileUrl: '',
      keywords: ['生态环境', '大气', '生态环境', '大气大', '大气', '大气', '大气大气大气大气大气大气'],
      time: ''
    },{
      id: '',
      name: '法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规',
      des: '法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规法律法规',
      fileIndustry: '生态环境',
      itemType: '大气',
      fileUrl: '',
      keywords: ['生态环境', '大气', '生态环境', '大气大', '大气', '大气', '大气大气大气大气大气大气'],
      time: ''
    }]
  },
  /**
@@ -18,11 +37,49 @@
    var that = this
    this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
      console.log(data);
      that.data.keyword = data.keyword
      that.setData({
        keyword: data.keyword
      })
      that.search()
    })
  },
  search () {
    consultservice.search(app)
    var that = this
    wx.showLoading({
      title: '搜索中',
      mask: true,
      success: (res) => {},
      fail: (res) => {},
      complete: (res) => {},
    })
    setTimeout(() => {
      wx.hideLoading()
    }, 20000);
    consultservice.searchLaw(app.globalData.accessToken.userId, this.data.keyword, {
      success (res) {
        that.setData({
          result: res
        })
      },
      complete (res) {
        wx.hideLoading()
      }
    })
  },
  gotoDetail (e) {
    var i = e.currentTarget.dataset.index
    var fileId = this.data.result[i].id
    wx.navigateTo({
      url: '/pages/module_consult/consultdetail/consultdetail',
      success: (res) => {
        // 通过 eventChannel 向被打开页面传送数据
        res.eventChannel.emit('acceptDataFromOpenerPage', {
          fileId: fileId
        })
      },
    })
  }
})