You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

110 lines
2.2 KiB

// package/advisoryNotice/advisoryNotice.js
import { getAdvisoryNotices } from "../../utils/getApiUrl";
import { Request } from "../../common";
const moment = require("../../utils/moment");
Page({
/**
* 页面的初始数据
*/
data: {
limit: 10, //条数
page: 0, //当前页
count: '', //总条数
dataList:[],//公告列表
},
navToDetail:function(e){
const { item } = e.currentTarget.dataset
const res = JSON.stringify(item)
wx.navigateTo({
url: `/package/advisoryNotice/detail/detail?detailData=${encodeURIComponent(res)}`,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const {windowHeight}=wx.getSystemInfoSync()
const pageHeight=windowHeight - 48
this.getAdvisoryNotices()
},
getAdvisoryNotices: function () {
const {limit,page}=this.data
wx.showLoading({
title: '加载中'
})
Request.get(getAdvisoryNotices({home:false}),{limit, page}).then(res=>{
if(res.rows.length){
this.setData({
dataList:res.rows,
count:res.count
},()=>{
wx.hideLoading()
})
}else{
wx.hideLoading()
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let _that = this;
let page = _that.data.page + 1; //获取当前页数并+1
let { dataList, count } = _that.data;
if (dataList.length == count) {
wx.showToast({
title: '没有更多数据了...',
icon: 'none',
})
return;
}
_that.setData({
page: page, //更新当前页数
})
_that.getAdvisoryNotices()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})