|
@@ -111,7 +111,7 @@ export default class Home extends Vue {
|
|
|
next()
|
|
|
}
|
|
|
|
|
|
- getReportList () {
|
|
|
+ getReportList (type = 'load') {
|
|
|
this.listState.loading = true
|
|
|
this.getList(`page_index=${this.listState.currentPage}`).then((res: any) => {
|
|
|
if (res.error_code === 0 && res.data.list) {
|
|
@@ -126,6 +126,10 @@ export default class Home extends Vue {
|
|
|
this.listState.finished = true
|
|
|
}
|
|
|
if (this.listState.currentPage === 1) {
|
|
|
+ if (type === 'refresh') {
|
|
|
+ this.isLoading = false
|
|
|
+ Toast('刷新成功')
|
|
|
+ }
|
|
|
this.listState.list = rows
|
|
|
} else {
|
|
|
this.listState.list = this.listState.list.concat(rows)
|
|
@@ -148,22 +152,15 @@ export default class Home extends Vue {
|
|
|
}
|
|
|
|
|
|
onRefresh () {
|
|
|
- setTimeout(() => {
|
|
|
- this.isLoading = false
|
|
|
- this.clearList()
|
|
|
- this.$nextTick(() => {
|
|
|
- this.listState = {
|
|
|
- list: [],
|
|
|
- loading: false,
|
|
|
- finished: false,
|
|
|
- currentPage: 1,
|
|
|
- totalPage: 0,
|
|
|
- scroll: 0
|
|
|
- }
|
|
|
- this.getReportList()
|
|
|
- Toast('刷新成功')
|
|
|
- })
|
|
|
- }, 1000)
|
|
|
+ this.clearList(this.listState)
|
|
|
+ this.listState.loading = false
|
|
|
+ this.listState.finished = false
|
|
|
+ this.listState.currentPage = 1
|
|
|
+ this.listState.totalPage = 0
|
|
|
+ this.listState.scroll = 0
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.getReportList('refresh')
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
</script>
|