feat:更新个人主页模块
This commit is contained in:
@@ -306,6 +306,26 @@ class FoodProvider with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> queryMomentByUserId(int userId) async {
|
||||
if (isLoading) return;
|
||||
|
||||
try {
|
||||
isLoading = true;
|
||||
error = null;
|
||||
notifyListeners();
|
||||
|
||||
final result = await queryMomentListByUserIdApi(userId);
|
||||
momentList = result;
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
error = '加载数据失败: $e';
|
||||
debugPrint('加载数据失败: $e');
|
||||
} finally {
|
||||
isLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadMoreMomentList() async {
|
||||
if (hasMore && !isLoading) {
|
||||
await queryMomentByPage(isRefresh: false);
|
||||
|
||||
Reference in New Issue
Block a user