riku
2022-10-21 0f2fdf16f47bd2d1d8fee86449c3a5095ccc8c23
pages/test2/test2.js
@@ -50,4 +50,64 @@
      showPreview: true
    });
  },
    /**
   * 获取热门搜索内容
   */
  getHotTopic() {
    var that = this
    // 1. 热门法律法规
    consultservice.getTopicLaw(app.globalData.accessToken.userId, {
      success(res) {
        res.forEach(r => {
          r.mfKeywordLv1 = r.mfKeywordLv1.split('、').slice(0, 5)
          r.mfReleaseDate = that.formatTime(r.mfReleaseDate)
          r.mfEffectiveDate = that.formatTime(r.mfEffectiveDate)
          r.mfClosingDate = that.formatTime(r.mfClosingDate)
        });
        that.setData({
          'pageList[0]': res,
          'pageList[4]': res
        })
      }
    })
    // 2. 热门法律法规条目
    consultservice.getTopicItem(app.globalData.accessToken.userId, {
      success(res) {
        res.forEach(r => {
          r.miItemContent = r.miItemContent.replaceAll('\\n', '<br/>')
        });
        that.setData({
          'pageList[3]': res
        })
      }
    })
    // 3. 热门问答
    consultservice.getTopicQA(app.globalData.accessToken.userId, {
      success(res) {
        res.forEach(r => {
          r.cqCreateTime = that.formatTime(r.cqCreateTime)
        });
        that.setData({
          'pageList[1]': res
        })
      }
    })
    // 4. 热门案例
    consultservice.getTopicCase(app.globalData.accessToken.userId, {
      success(res) {
        res.forEach(r => {
          r.ecSummary = r.ecSummary.replaceAll('\\n', '<br/>')
          r.ecMeaning = r.ecMeaning.replaceAll('\\n', '<br/>')
          r.ecExamined = r.ecExamined.replaceAll('\\n', '<br/>')
          r.ecEnlightenment = r.ecEnlightenment.replaceAll('\\n', '<br/>')
          r.ecOccurDate = that.formatTime(r.ecOccurDate)
        });
        that.setData({
          'pageList[2]': res
        })
        console.log(that.data.pageList);
      }
    })
  },
})