jingmei.js 2.1 KB
// pages/jingmei/jingmei.js
var WxParse = require('../../wxParse/wxParse.js');
const app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    jingmeilist:[],
    page:1
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.getjingmei()
  },

  //获取精美大片列表
  getjingmei() {
    let that = this;
    let url = 'user/won';
    let param={
      page:that.data.page,
      pageNum:10
    }
    app.post(url, param, 'post').then((res) => {
      console.log(res);
      that.setData({
        jingmeilist: that.data.jingmeilist.concat(res) 
      })

      let newjingmeilist = that.data.jingmeilist;
     
      for (let i = 0; i < newjingmeilist.length; i++) {
        console.log(i)

        WxParse.wxParse('content' + i, 'html', newjingmeilist[i]['content'], that, 5);

        if (i === newjingmeilist.length - 1) {

          WxParse.wxParseTemArray("artileList", 'content', newjingmeilist.length, that)
        }
      }

      that.setData({
        jingmeilist:newjingmeilist
      })
      console.log(this.data.jingmeilist)


    }).catch((err) => {

    })

  },
  govideo(e) {
    let url=e.currentTarget.dataset.url;
    let thumb=e.currentTarget.dataset.thumb;
    let title=e.currentTarget.dataset.title
    wx.navigateTo({
      url: '/pages/videoplay/videoplay?url='+url+'&thumb='+thumb+'&title='+title,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

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

  },

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

  },

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

  },

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

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {
    let newpage=this.data.page;
    newpage++;
    this.setData({
      page:newpage
    })

    this.getjingmei()
  },

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

  }
})