feat:我的页面,首次重复加载修改

This commit is contained in:
pengtao 2025-10-14 15:55:11 +08:00
parent c9e777b6c7
commit be0d7eae45

View File

@ -38,8 +38,8 @@ class MyListLogic extends GetxController {
state.loadStatus = KtLoadStatusType.loading; state.loadStatus = KtLoadStatusType.loading;
if (refresh) { if (refresh) {
state.curFavoriteIndex = 1; state.curFavoriteIndex = 1;
state.favoriteList.clear(); // state.favoriteList.clear();
state.chestList.clear(); // state.chestList.clear();
} }
if (loadMore) { if (loadMore) {
state.curFavoriteIndex++; state.curFavoriteIndex++;
@ -64,6 +64,10 @@ class MyListLogic extends GetxController {
refreshCtrl.loadNoData(); refreshCtrl.loadNoData();
chestRefreshCtrl.loadNoData(); chestRefreshCtrl.loadNoData();
} }
if (refresh) {
state.favoriteList.clear();
state.chestList.clear();
}
state.favoriteList.addAll(list); state.favoriteList.addAll(list);
if (state.favoriteList.length > 3) { if (state.favoriteList.length > 3) {
state.chestList = state.favoriteList.sublist(0, 3); state.chestList = state.favoriteList.sublist(0, 3);
@ -86,7 +90,7 @@ class MyListLogic extends GetxController {
getHistoryList({bool refresh = false, bool loadMore = false}) async { getHistoryList({bool refresh = false, bool loadMore = false}) async {
if (refresh) { if (refresh) {
state.curHistoryIndex = 1; state.curHistoryIndex = 1;
state.historyList.clear(); // state.historyList.clear();
} }
if (loadMore) { if (loadMore) {
state.curHistoryIndex++; state.curHistoryIndex++;
@ -107,7 +111,9 @@ class MyListLogic extends GetxController {
...res.data['list'].map((item) => KtHistoryVideoBean.fromJson(item)), ...res.data['list'].map((item) => KtHistoryVideoBean.fromJson(item)),
]; ];
if (list.length < 20) refreshCtrl.loadNoData(); if (list.length < 20) refreshCtrl.loadNoData();
if (refresh) {
state.historyList.clear();
}
state.historyList.addAll(list); state.historyList.addAll(list);
update(); update();
} else { } else {