// pages/healthEncyclopedia/healthEncyclopedia.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { msgList:[], url:'' }, naviToMsg(e){ console.log(e.currentTarget.dataset.item) let item = e.currentTarget.dataset.item let hosId = item.HOS_ARTICLE_ID wx.navigateTo({ url: '/pages/articleDetails/articleDetails?hosId='+hosId, }) }, getList(){ wx.request({ url:'https://fy.btlsoln.com:8443/findHospitalArticle', // url:'http://sayetest.f3322.org:5000/findHospitalArticle', method:"GET", data:{}, header: { 'content-type': 'application/json' }, success: (res)=> { console.log(res,"健康百科") let data = res.data data.map((item,index) => { let str = item.IMG var html = str.replace("/showFile",'https://fy.btlsoln.com:8443/showFile') item.IMG = html return data }) console.log(data,"新") this.setData({ msgList:data }) } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ url:app.globalData.url2 }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { wx.setNavigationBarTitle({ title: '健康百科' }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getList() }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })