From a2d1b9886b00b5f4d4722c3379d3bd4f2f94b421 Mon Sep 17 00:00:00 2001 From: LAPTOP-RI7D261L\Mr Ke <545800322@qq.com> Date: Mon, 09 Mar 2020 17:02:35 +0800 Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/nsjcy/frontEnd/nsjcy --- SunshineLnsMinApp/pages/fzxkt/fzxkt.js | 53 ++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 38 insertions(+), 15 deletions(-) diff --git a/SunshineLnsMinApp/pages/fzxkt/fzxkt.js b/SunshineLnsMinApp/pages/fzxkt/fzxkt.js index 54adb6f..bfbd781 100644 --- a/SunshineLnsMinApp/pages/fzxkt/fzxkt.js +++ b/SunshineLnsMinApp/pages/fzxkt/fzxkt.js @@ -1,4 +1,5 @@ // pages/fzxkt/fzxkt.js +var app = getApp() Page({ /** @@ -8,15 +9,7 @@ TabCur: 0, scrollLeft: 0, tabList: ['未成年人', '公益诉讼', '其他'], - dataSet: [{ - createTime: '2020/2/3 15:30', - readCount: 2, - title: '课堂名称' - }, { - createTime: '2020/2/3 15:30', - readCount: 2, - title: '课堂名称' - }], + dataSet: [], isHideLoadMore: true, //loading样式 isHideMorebtn: true, //更多按钮样式 isHideEnd: true, //有底线样式 (三者默认隐藏) @@ -41,35 +34,65 @@ /** * 生命周期函数--监听页面加载 */ - 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, + }) + } + } + }) }, /** * 生命周期函数--监听页面显示 */ - onShow: function() { + onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ - onHide: function() { + onHide: function () { }, /** * 页面上拉触底事件的处理函数 */ - onReachBottom: function() { + onReachBottom: function () { }, /** * 用户点击右上角分享 */ - onShareAppMessage: function() { + onShareAppMessage: function () { } }) \ No newline at end of file -- Gitblit v1.8.0