forked from nsjcy/frontEnd/nsjcy

liuwh
2020-02-28 20b4c7ccf58191066b6a9ecf434604087d675d38
SunshineLnsMinApp/pages/zhdt/zhdt.js
@@ -11,13 +11,44 @@
    dongtai3_1: app.globalData.imgUrl + '/image/dongtai3-1.jpg',
    inputShowed: false,
    inputVal: "",
    dataSet:[]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
  onLoad: function (options) {
    var that = this;
    wx.showLoading();
    wx.request({
      url: app.globalData.url + '/api/article/publicMsgQuery',
      data: {
        page: 1,
        size: 1000,
        flag: '未检动态',
      },
      success: function (res) {
        wx.hideLoading();
        console.log('res', res);
        if (res.data.code == 0) {
          let content = res.data.data.result.content.map(({
            createTime,
            ...i
          }) => ({
            ...i,
            createTime: app.formatDate(createTime),
          }));
          console.log(content)
          that.setData({
            dataSet: content
          })
        } else {
          wx.showToast({
            title: res.data.msg,
          })
        }
      }
    })
  },
  linkFunction: function (event) {
@@ -28,19 +59,19 @@
    })
  },
  showInput: function() {
  showInput: function () {
    this.setData({
      inputShowed: true
    });
  },
  hideInput: function() {
  hideInput: function () {
    this.setData({
      inputVal: "",
      inputShowed: false
    });
  },
  clearInput: function() {
  clearInput: function () {
    this.setData({
      inputVal: ""
    }, () => {});