diff --git a/lib/daos/home_dao.dart b/lib/daos/home_dao.dart index c22868f..0b51146 100644 --- a/lib/daos/home_dao.dart +++ b/lib/daos/home_dao.dart @@ -13,21 +13,20 @@ import 'package:recook/manager/http_manager.dart'; import 'package:recook/models/category_model.dart'; class HomeDao { - static getCategories({@required OnSuccess> success,@required OnFailure failure}) async { - ResultData res = await HttpManager.post(GoodsApi.categories, { - }); + static Future getCategories( + {@required OnSuccess> success, + @required OnFailure failure}) async { + ResultData res = await HttpManager.post(GoodsApi.categories, {}); if (!res.result) { failure(res.code, res.msg); - }else { + } else { CategoryModel model = CategoryModel.fromJson(res.data); if (model.code == HttpStatus.SUCCESS) { success(model.data, model.code, model.msg); - }else { + } else { failure(HttpStatus.FAILURE, model.msg); } } } - - -} \ No newline at end of file +} diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 7ebc4d1..d146af0 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -1162,8 +1162,10 @@ class _HomePageState extends BaseStoreState Widget _buildSingleGoodsCard(String path, String name) { return InkWell( - onTap: () { - HomeDao.getCategories(success: (data, code, msg) { + onTap: () async { + GSDialog.of(context).showLoadingDialog(context, ''); + await HomeDao.getCategories(success: (data, code, msg) { + GSDialog.of(context).dismiss(context); CRoute.push( context, ClassifyPage(