| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 | 
							- const _Http = getApp().globalData.http;
 
- Page({
 
- 	data: {
 
- 		loading: true,
 
- 		"content": {
 
- 			"version": 1,
 
- 			nocache: true,
 
- 			"pageNumber": 1,
 
- 			"pageTotal": 1,
 
- 			"where": {
 
- 				"condition": ""
 
- 			},
 
- 			sort: []
 
- 		}
 
- 	},
 
- 	onLoad(options) {
 
- 		this.getList()
 
- 	},
 
- 	/* 处理筛选 */
 
- 	handleFilter({
 
- 		detail
 
- 	}) {
 
- 		console.log(detail)
 
- 	},
 
- 	getList(init = false) {
 
- 		if (init.detail != undefined) init = init.detail;
 
- 		let content = this.data.content;
 
- 		if (init) content.pageNumber = 1;
 
- 		if (content.pageNumber > content.pageTotal) return;
 
- 		_Http.basic({
 
- 			"id": 20220103140003,
 
- 			content
 
- 		}).then(res => {
 
- 			console.log("活动列表", res)
 
- 			this.selectComponent('#ListBox').RefreshToComplete();
 
- 			let list = res.data.map(v => {
 
- 				v.surplus = Date.parse(new Date(v.enddate)) - Date.parse(new Date())
 
- 				return v
 
- 			});
 
- 			this.setData({
 
- 				list: res.pageNumber == 1 ? list : this.data.list.concat(list),
 
- 				"content.pageNumber": res.pageNumber + 1,
 
- 				"content.pageTotal": res.pageTotal,
 
- 				"content.sort": res.sort,
 
- 				loading: false
 
- 			})
 
- 		})
 
- 	},
 
- 	/* 	intervalTime(startTime, endTime) {
 
- 			var timestamp = ,
 
- 				startTamp = Date.parse(new Date(startTime)),
 
- 				endTamp = Date.parse(new Date(endTime));
 
- 			return endTamp - timestamp
 
- 		}, */
 
- 	/* 搜索 */
 
- 	onSearch({
 
- 		detail
 
- 	}) {
 
- 		this.setData({
 
- 			"content.where.condition": detail
 
- 		});
 
- 		this.getList(true)
 
- 	},
 
- 	onReady() {
 
- 		this.setListHeight()
 
- 	},
 
- 	/* 设置页面高度 */
 
- 	setListHeight() {
 
- 		this.selectComponent("#ListBox").setHeight(".division", this);
 
- 	},
 
- })
 
 
  |