1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import * as requestAPI from '../../models/dataModel'
- Page({
- data: {
- timesheetList: [],
- current: 1,
- size: 10,
- total: 0
- },
- //onLoad: function (options) {
- // this.gettimesheetList()
- // },
- onReady() {
- this.gettimesheetList()
- },
- // 获取列表
- gettimesheetList() {
- //wx.showLoading({title: '加载中', icon: 'loading'});
- let form = {
- current: this.data.current,
- size: this.data.size,
- eCnname:wx.getStorageSync('username')
- }
- requestAPI.getTimeSheetList(form).then(res => {
- this.setData({
- timesheetList: res.data.data.records,
- total: res.data.data.total
- })
- })
- },
- // 下拉刷新
- onPullDownRefresh: function () {
- wx.showNavigationBarLoading(); //在当前页面显示导航条加载动画
- this.onLoad(); //刷新页面
- setTimeout(function () {
- wx.hideNavigationBarLoading(); //在当前页面隐藏导航条加载动画
- wx.stopPullDownRefresh(); //停止下拉动作
- }, 2000)
- },
- // 下拉加载
- onReachBottom: function () {
- if (this.data.size > this.data.total) {
- return;
- } else {
- this.gettimesheetList();
- this.setData({
- size: this.data.size+10
- })
- }
- },
- openPreview: function (event) {
- wx.previewImage({
- urls: new Array(event.currentTarget.dataset.url),
- })
- },
- generate() {
- wx.navigateTo({
- url: `/pages/timesheet/detail`,
- })
-
- }
- })
|