refactor(app): 优化错误处理和请求频率

- 在多个组件中添加对 'cancel' 错误码的处理,提高用户体验- 在某些场景下增加请求频率限制,减少不必要的网络请求
- 优化部分页面的刷新逻辑,提高性能
这个提交包含在:
徐勤民 2024-11-21 15:22:13 +08:00
父节点 976cb9f23a
当前提交 788e449b25

查看文件

@ -12,6 +12,7 @@ export struct RefreshView {
private endY: number = 0
private lastNum: number = 0
private _openMore: boolean = false
private _oTime: number = 0
aboutToAppear(): void {
this.onRefresh && this.onRefresh()
@ -43,7 +44,13 @@ export struct RefreshView {
if (this.endY - this.startY < -100 && this._openMore) {
const v = this.data && (this.data.length % this.pageSize) === 0
if (v) {
this.onLoadMore && this.onLoadMore(Math.floor(this.data.length / this.pageSize))
const cTime = new Date().getTime()
// 2024.11.21 测试觉得刷新太多了,暂时改为1秒5间隔
if (cTime - this._oTime > 1500) {
this.onLoadMore && this.onLoadMore(Math.floor(this.data.length / this.pageSize))
this._oTime = cTime
}
} else {
ToolsHelper.showMessage('没有更多数据了')
}