Commit 363e7591 authored by leon's avatar leon

fix: fix pull down refresh

parent 2a5ad7e6
......@@ -71,6 +71,7 @@
pageSize: 0,
timename: null,
pageScrollTop: 0,
stickyTables: [], // 设置了吸顶的table
horizontalBarHeight: 0
}
},
......@@ -198,6 +199,7 @@
}
}
that.reportInfo = res.data.Result
that.getStickyTables()
}
},
/**
......@@ -235,6 +237,15 @@
}
},
getStickyTables() {
this.reportInfo.list.forEach(item=> {
// 后端会增加一个表头吸顶的配置,headerSticky=true
if(item.type === 'NormalTable' && item.table.tableHeader.headerSticky) {
this.stickyTables.push(item)
}
})
},
/**
* 点击向左切换按钮
*/
......@@ -278,7 +289,7 @@
var pageNumber = parseInt((this.idList.length-1) / this.pageSize)+2
var list = []
const that = this
var param = {"pageSize":that.pageSize, "pageNumber":pageNumber, "folderId":"621db7710668d7e647d5f4cc", "superAdmin":true}
var param = {"pageSize":that.pageSize, "pageNumber":pageNumber, "folderId":"62837a79bfa93100013596c1", "superAdmin":true}
let res = await that.$u.api.getReportList(param)
const { Status, Result } = res.data
if (Status === 'true') {
......@@ -298,11 +309,38 @@
}
},
onPullDownRefresh() {
// 让list数据做下改变,下拉刷新后才能触发页面的渲染,让组件里面的接口调用
this.reportInfo.list = this.reportInfo.list.map(item => {
item.value = "2022"
return item
})
this.getReportCharts()
},
onPageScroll(res) {
if(res.scrollTop > this.pageScrollTop) {
// 向上滑动
this.stickyTables.forEach(item=> {
if(res.scrollTop >= item.top * this.scale) {
uni.$emit(item.id,{sticky: true})
}
if(res.scrollTop >= item.top * this.scale + item.height * this.scale) {
uni.$emit(item.id,{sticky: false})
}
})
} else {
this.stickyTables.forEach(item=> {
if(res.scrollTop < item.top * this.scale + item.height * this.scale) {
uni.$emit(item.id,{sticky: true})
}
if(res.scrollTop < item.top * this.scale) {
uni.$emit(item.id,{sticky: false})
}
})
}
this.pageScrollTop = res.scrollTop
}
},
}
</script>
......
......@@ -270,6 +270,11 @@
},
onPullDownRefresh() {
// 让list数据做下改变,下拉刷新后才能触发页面的渲染,让组件里面的接口调用
this.reportInfo.list = this.reportInfo.list.map(item => {
item.value = "2022"
return item
})
this.getReportCharts()
},
onPageScroll(res) {
......
......@@ -37,9 +37,10 @@
pageSize: 10,
totalPages: 0,
totals: 0,
folderId: '621db7710668d7e647d5f4cc',
folderId: '62837a79bfa93100013596c1',
superAdmin: true
}
},
}
},
onLoad() {
......@@ -76,7 +77,8 @@
uni.navigateTo({
url: url
})
}
},
},
onPullDownRefresh() {
this.reportList = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment