var WxParse = null;
var app = getApp()
var that=null
var aid=0
var ParentID = 0
Page( {
  data: {
    loadingHidden:false,
    type:0,
    ltype:0,
    body:""
  },

  onLoad: function(options) {
    that = this
    WxParse = require('../../wxParse/wxParse.js')
    aid=options.id?options.id:0
    ParentID =options.ParentID
    that.rdata();//第一次加载数据
    }, rdata: function () {
  
      wx.request({
        url: app.globalData.apiurl + "/xapiajax.ashx", 
        data: {
          action:"getnewdetail",
           id:aid,
           ParentID:ParentID
        },
        method:"GET", 
        dataType:"json", 
        header: { 
          "content-type": "application/json" // 默认值
        }, 
        success (res) {
              let content = res.data.content;
              WxParse.wxParse('body', 'html', content, that);
              if(res.data.type==6||res.data.type==7){
                wx.setNavigationBarTitle({
                  title: res.data.title
               })
              }else if(res.data.type==8){
                wx.setNavigationBarTitle({
                  title: "健康知识"
               })
              }else if(res.data.type==9){
                wx.setNavigationBarTitle({
                  title: "发图素材"
               })
              }else if(res.data.type==19){
                wx.setNavigationBarTitle({
                  title: "操作教程"
               })
              }else{
                wx.setNavigationBarTitle({
                    title: "公告详情"
                 })
              }
              that.setData({
                  loadingHidden:true,
                  type: res.data.type,
                  ltype: res.data.ltype,
                  title: res.data.title
              })
              
             
          }
      })
  },
    
    // 下拉刷新
    onPullDownRefresh: function () {
    
       that.rdata();//第一次加载数据
    }


})
