// pages/vNewsDetail/vNewsDetail.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    newsDetail: {},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      newsId: options.newsId
    }, () => {
      this.getNewDetail();
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  //获取列表
  getNewDetail() {
    var that = this;
    var config = wx.getStorageSync('config');
    //获取用户消息列表
    wx.request({
      url: app.url + 'ajax_get_news_detail.php',
      header: {
        'content-type': 'application/json'
      },
      data: {
        unionId: config.unionId,
        newsId: that.data.newsId
      },
      method: 'GET',
      dataType: 'json',
      success: function (res) {
        if (res.statusCode == 200) {
          that.setData({
            newsDetail: res.data.result.newsDat
          })
        }
      },
      fail: function (res) {},
      complete: function (res) {},
    })
  },
})