From 36a629a3cf1e082a750e9691632d3b3bf28888b8 Mon Sep 17 00:00:00 2001 From: liuwh <liuwh@hugeinfo.com.cn> Date: Sat, 14 Mar 2020 22:47:52 +0800 Subject: [PATCH] 小程序bug修改 --- SunshineLnsMinApp/pages/zhdtInfo/zhdtInfo.js | 131 +++++++------------------------------------ 1 files changed, 22 insertions(+), 109 deletions(-) diff --git a/SunshineLnsMinApp/pages/zhdtInfo/zhdtInfo.js b/SunshineLnsMinApp/pages/zhdtInfo/zhdtInfo.js index 30ea5b2..dbc0766 100644 --- a/SunshineLnsMinApp/pages/zhdtInfo/zhdtInfo.js +++ b/SunshineLnsMinApp/pages/zhdtInfo/zhdtInfo.js @@ -8,121 +8,34 @@ data: { id: '', swiperList: [], + data:{}, }, /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { + onLoad: function (options) { console.log(options.id) - this.setData({ - id: options.id, + var that = this; + wx.request({ + url: app.globalData.url + '/api/article/publicMsgDetails?msgId=' + options.id, + success: function (res) { + wx.hideLoading(); + console.log(res) + if (res.data.code == 0) { + that.setData({ + data: { + ...res.data.data, + createTime: app.formatDate(res.data.data.createTime), + } + }) + } else { + wx.showModal({ + title: '提示', + content: "请求失败!" + }) + } + } }) - if (options.id == '1') { - this.setData({ - swiperList: [{ - id: 0, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai1-1.jpg', - }, { - id: 1, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai1-2.jpg', - }, { - id: 2, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai1-3.jpg', - }], - }) - } else if (options.id == '2') { - this.setData({ - swiperList: [{ - id: 0, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai2-1.jpg', - }, { - id: 1, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai2-2.jpg', - }, { - id: 4, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai2-5.jpg', - }, { - id: 5, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai2-6.jpg', - }, { - id: 6, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai2-7.jpg', - }], - }) - }else{ - this.setData({ - swiperList: [{ - id: 0, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai3-1.jpg', - }, { - id: 1, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai3-2.jpg', - }, { - id: 2, - type: 'image', - url: app.globalData.imgUrl + '/image/dongtai3-3.jpg', - }], - }) - } }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { - - } }) \ No newline at end of file -- Gitblit v1.8.0