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

196 lines
4.4 KiB
JavaScript

// pages/circle/index.js
const app = getApp();
import dateUtil from "../../utils/dateUtil";
Page({
/**
* 页面的初始数据
*/
data: {
allShow:false,
idNull:0,
isTrigger:false,
recordList:[],
isLoading:false,
hasMoreData: false,
searchParam: { pageNum: 1, pageSize:20, del: 0, keys: '', noticeState: 40,type:0 },
record:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
open(e){
var that = this;
let id = e.currentTarget.dataset.id;
that.data.recordList.forEach((item,index)=>{
if(item.id == id){
item.isZhedie = false
}
})
that.setData({
recordList:that.data.recordList
})
},
onScrollRefresh(){
this.data.recordList = [];
this.data.searchParam.pageNum = 1;
this.getList();
},
onScrollToLower:function(){
this.data.searchParam.pageNum = this.data.searchParam.pageNum + 1;
this.getList();
},
close(e){
var that = this;
let id = e.currentTarget.dataset.id;
that.data.recordList.forEach((item,index)=>{
if(item.id == id){
item.isZhedie = true
}
})
that.setData({
recordList:that.data.recordList
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this;
that.getList();
},
getList: function () {
var that = this;
wx.showLoading({
title: "加载中",
});
that.setData({
isLoading: true
});
// that.data.searchParam.keys = that.data.inputVal == '搜索职位名称' ? '' : that.data.inputVal;
wx.request({
url: app.globalData.ip + '/cms/notice/list',
data: that.data.searchParam,
header: app.globalData.header,
method: "GET",
success: function (res) {
console.log(res.data);
if (res.data.status == 200) {
that.setData({
isLoading: false,
allShow:true
});
res.data.data.pageBean.recordList.forEach(item => {
item['updateTimeStr'] = dateUtil.timeShowXXX(item.updateTime);
item['content'] = item.content.replace(/\*\*\*\*\*/g,"")
item['isZhedie'] = false;
item['showAll'] = false
});
if (res.data.data.pageBean.recordList != null && res.data.data.pageBean.recordList.length < 20) {
var recordListTemp = res.data.data.pageBean.recordList;
that.data.recordList = that.data.recordList.concat(recordListTemp);
that.setData({
hasMoreData: false
});
} else {
var recordListTemp = res.data.data.pageBean.recordList;
that.data.recordList = that.data.recordList.concat(recordListTemp);
that.setData({
hasMoreData: true
});
}
that.setData({
recordList: that.data.recordList,
isLoading: false,
isTrigger:false,
});
if (res.data.data.pageBean.recordList != null && res.data.data.pageBean.recordList.length < 20) {
that.setData({
hasMoreData: false
});
} else {
that.setData({
hasMoreData: true
});
}
const query = wx.createSelectorQuery();
query.selectAll('.content_bottom').boundingClientRect(rect=>{
rect.forEach((item , index) => {
console.log(index , item.height);
if(item.height > 111){
that.data.recordList[index].isZhedie = true
that.data.recordList[index].showAll = true
}
that.setData({
recordList:that.data.recordList
})
});
}).exec();
wx.hideLoading();
} else {
app.showTips(that, res.data.msg);
wx.hideLoading();
}
},
fail: function (res) {
console.log(res);
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})