zyjydetail.js 3.24 KB
// pages/recruit/recruit.js
var app = getApp();
var WxParse = require('../../wxParse/wxParse.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id: '',
    skey: '',
    windowHeight: 0,
    scrollTop: 0,
    con: ''
  },
  scroll: function (e) {
    console.log('aa', e)
    console.log(e.detail.scrollTop);
    var that = this, scrollTop = that.data.scrollTop;
    that.setData({
      scrollTop: e.detail.scrollTop
    })
    if (scrollTop <= -20) {

    }
    // console.log('e.detail.scrollTop:'+e.detail.scrollTop) ;
    // console.log('scrollTop:'+scrollTop)
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var id = options.id
    var con = that.data.con
    var skey = wx.getStorageSync('key')
    that.setData({
      id: id
    })
    console.log('id', id)
    if (id == "") {
      wx.showToast({
        title: '访问错误!',
        icon: 'success',
        duration: 2000
      })
      return false;
    }
    console.log('skey', skey)
    that.setData({
      skey: skey
    })
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          windowHeight: res.windowHeight
        })
      },
    })
    wx.request({
      url: app.url + '/mpapi/1.0.0/career-advice/' + id,
      method: 'GET',
      header: {
        'content-type': 'application/json',
        'x-wx-skey': skey
      },
      data: {
        // contentType: 'career_advice,academic_conference,job_opportunities',
        // offset: 0,
        // limit: 4
      },
      success: function (res) {
        wx.setNavigationBarTitle({
          title: res.data.data.title
        })
        console.log('recruit', res.data)
        that.setData({
          // list: res.data.data
          con: res.data.data
        })
        var body = res.data.data.content;
        WxParse.wxParse('body', 'html', body, that, 5);
        var body1 = res.data.data.extendContent;
        WxParse.wxParse('body1', 'html', body1, that, 5);
    
      }
    })
    // wx.request({
    //   url: app.url + '/mpapi/1.0.0/academic-conference?tag=&offset=&limit=',
    //   method: 'GET',
    //   header: {
    //     'content-type': 'application/json',
    //     'x-wx-skey': skey
    //   },
    //   data: {
    //     // contentType: 'career_advice,academic_conference,job_opportunities',
    //     offset: 0,
    //     limit: 10,
    //     tag:'date',
    //     // id: id
    //   },
    //   success: function (res) {
    //     console.log('recruit2', res.data)
    //     that.setData({
    //       // list: res.data.data
    //     })
    //   }
    // })
  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  }
})