123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- import recruitApi from '../../api/recruit'
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list:[],
- page:1,
- pageNum:10,
- count:0
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: async function () {
- const isAuth = await app.isAuth()
- if (!isAuth) {
- wx.redirectTo({
- url: '/pages/prompt/prompt?page=' + this.route+"?type="+this.data.type,
- })
- return
- }
- var openId = wx.getStorageSync('openId');
- this.setData({
- openId:openId
- })
- this.getList(openId);
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- var totalPage = Math.ceil(this.data.count/this.data.pageNum)
- console.log('到底了')
- var page = this.data.page
- page++;
- this.setData({
- page:page
- })
- if(page<=totalPage){
- this.getList();
- }
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- getList: async function(openId) {
- var result = await recruitApi.getDelivery(openId,this.data.page,this.data.pageNum);
- var nowList = this.data.list.concat(result.list)
- this.setData({
- list:nowList,
- count:result.count,
- page:result.page
- })
- },
- goToInfo:function(e){
- var id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '../recruitInfo/recruitInfo?id='+id
- })
- },
- })
|