enterprise.js 2.5 KB
let t = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navbar: [{
      name: '企业咨询'
    },
    {
      name: '企话吧'
    }
    ],
    zixunList: [],
    currentTab: 0,
    page: 1 ,
    ifData: !1,
    noMore: !1,
    show:!0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let c = this;wx.getSystemInfo({
      success: function(res) {
        c.setData({
          winHeight:res.windowHeight
        })
      },
    })
  },
  getzixun(){
    let url = '/api/interact/getQuestionList',d = this,params = {
      header:true,
      page: d.data.page   
    };
    t.post(url,params,false).then((r)=>{
      let list = d.data.zixunList.concat(r.data);
      d.setData({
        zixunList: list
      })
      list.length==0?d.setData({
        ifData:!0,
      }):(r.data.length<r.per_page?d.setData({
        noMore:!0
      }):"")
      setTimeout(()=>{
        d.setData({
          show: !1
        },1200)
      })
    })
  },
  askQuestion(){
    wx.navigateTo({
      url: '/pages/question/question',
    })
  },
  checkstatus() {
    let b = this, url = '/api/user/getAuthStatus', params = {
      header: true
    };
    t.post(url, params).then((r) => {
     b.setData({
         auth:r
     });
    r == 2 ? b.getzixun():'';
    })
  },
  renzheng(e){
    let type = e.currentTarget.dataset.type;
    type==1?wx.showToast({
      title: '认证审批中请耐心等待',
      icon:'none',
      duration: 1200
    }):wx.navigateTo({
        url: '/pages/my/approve/approve',
    })
  },
  navbarTap: function (e) {
    let that = this;
    this.setData({
      currentTab: e.currentTarget.dataset.idx,
    })
  },
  jump(){
    wx.navigateTo({
      url: '',
    })

    wx.switchTab({
      url: '',
    })
  },
  
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setData({
      zixunList:[]
    })
    this.checkstatus()
  },

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

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

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

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

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