img_text.js 2.7 KB
// pages/img_text/img_text.js
const app=getApp();
var wxParse = require('../../wxParse/wxParse.js')
Page({
 /**
  * 页面的初始数据
  */
 data: {
  state: 1,//1开通城市,2预约流程,3关于我们,4公告详情,5消息
  id:'',
  postdata:''
 },

//公告详情
getdata(){
 let that=this;
 let url ='home/home/notice_info';
 let param={
  id:that.data.id
 }
 app.post(url, param).then((res)=>{
  that.setData({
   postdata:res
  })
  wxParse.wxParse('content', 'html', res.content, that, 5);
 }).catch((errMsg)=>{
  console.log(errMsg)
 })
},
//开通城市、预约流程、关于象合家、公益基金池(id只有2,3,4,9)
getmoredata(id){
 let that=this;
 let url ='home/home/page_info';
 let param = {
  id: id
 }
 app.post(url, param).then((res) => {
  that.setData({
   postdata: res
  })
  wxParse.wxParse('content', 'html', res.content, that, 5);
 }).catch((errMsg) => {
  console.log(errMsg)
 })


},
//系消息详情
 system_bell_info(id){
  let that=this;
  let url ='home/Member_center/system_bell_info';
  let params={
   id:id
  }
  let header={
   'XX-Token':wx.getStorageSync('token')
  }
  app.post(url, params, header).then((res)=>{
   that.setData({
    postdata: res
   })
   wxParse.wxParse('content', 'html', res.content, that, 5);
  }).catch((err)=>{
   console.log(err)
  })
 },
 /**
  * 生命周期函数--监听页面加载,开通城市、预约流程、关于象合家、公益基金池(id只有2,3,4,9)
  */
 onLoad: function (options) {
  let that=this;
  that.setData({
   state:options.state
  })
  let BarTitle=''
  if (options.state== '1'){
   BarTitle='开通城市'
   that.getmoredata(2);
  } else if (options.state == '2'){
   BarTitle = '预约流程';
   that.getmoredata(3);
  } else if (options.state == '3'){
   BarTitle = '关于我们';
   that.getmoredata(4);
  } else if (options.state == '4'){
   BarTitle = '公告详情';
   that.setData({
    id: options.id
   })
   that.getdata();
  } else if (options.state == '5'){
   BarTitle = '消息';
   that.setData({
    id: options.id
   })
   that.system_bell_info(options.id)
  }
  wx.setNavigationBarTitle({
   title: BarTitle
  })

 },

 /**
  * 生命周期函数--监听页面初次渲染完成
  */
 onReady: function () {

 },

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

 },

 /**
  * 生命周期函数--监听页面隐藏
  */
 onHide: function () {

 },

 /**
  * 生命周期函数--监听页面卸载
  */
 onUnload: function () {

 },

 /**
  * 页面相关事件处理函数--监听用户下拉动作
  */
 onPullDownRefresh: function () {

 },

 /**
  * 页面上拉触底事件的处理函数
  */
 onReachBottom: function () {

 },

 /**
  * 用户点击右上角分享
  */
 onShareAppMessage: function () {

 }
})