Browse Source

refactor(student): 优化作业列表刷新逻辑

- 重命名 loadData 方法为 resetFilteredData,提升代码可读性
- 在获取作业列表时,添加对第一页的特殊处理,解决重复加载问题- 移除不必要的 tableList清空操作,避免数据重复赋值
master
liutong 1 year ago
parent
commit
ddf50e2684
  1. 11
      pages/student/index/job_list.vue

11
pages/student/index/job_list.vue

@ -71,7 +71,7 @@ import memberApi from '@/api/member.js';
// //
async onPullDownRefresh() { async onPullDownRefresh() {
// //
await this.loadData() await this.resetFilteredData()
await this.getList() await this.getList()
}, },
methods: { methods: {
@ -89,14 +89,12 @@ import memberApi from '@/api/member.js';
} }
}, },
// //
async loadData() { async resetFilteredData() {
this.isReachedBottom = false; // 便 this.isReachedBottom = false; // 便
this.filteredData.page = 1// this.filteredData.page = 1//
this.filteredData.limit = 10// this.filteredData.limit = 10//
this.filteredData.total = 10// this.filteredData.total = 10//
this.tableList = []
}, },
// //
@ -114,6 +112,11 @@ import memberApi from '@/api/member.js';
}) })
return return
} }
if(data.page == 1){
this.tableList = []
}
let res = await memberApi.assignmentsList(data) let res = await memberApi.assignmentsList(data)
this.loading = false this.loading = false
this.isReachedBottom = false; this.isReachedBottom = false;

Loading…
Cancel
Save