From 5658335989c8d86874b78a411f242d1e680ea33f Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Sun, 16 Jan 2022 17:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E7=A7=AF=E5=88=86=E7=AD=BE?= =?UTF-8?q?=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/profile_api.dart | 9 ++++++ .../personal/clock_in/clock_in_page.dart | 29 ++++++++++--------- lib/pages/personal/personal_page.dart | 9 +++--- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/lib/constants/profile_api.dart b/lib/constants/profile_api.dart index 3339f3a9..4ba963ad 100644 --- a/lib/constants/profile_api.dart +++ b/lib/constants/profile_api.dart @@ -3,6 +3,7 @@ part of 'sars_api.dart'; class _ProfileApi { _MyHouse house = _MyHouse(); _MyFamily family = _MyFamily(); + _Integral integral = _Integral(); } class _MyHouse { @@ -26,3 +27,11 @@ class _MyFamily { ///通过/驳回房屋审核 String get myFamilyReview => '/app/user/myFamily/review'; } + +class _Integral { + ///获取积分页面详情 + String get info => '/app/user/points/getPointsInfo'; + + ///积分签到 + String get sign => '/app/user/points/sign'; +} diff --git a/lib/pages/personal/clock_in/clock_in_page.dart b/lib/pages/personal/clock_in/clock_in_page.dart index 094dbd8c..9ebab979 100644 --- a/lib/pages/personal/clock_in/clock_in_page.dart +++ b/lib/pages/personal/clock_in/clock_in_page.dart @@ -1,4 +1,5 @@ import 'package:aku_new_community/base/base_style.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/extensions/num_ext.dart'; import 'package:aku_new_community/extensions/widget_list_ext.dart'; import 'package:aku_new_community/gen/assets.gen.dart'; @@ -33,17 +34,9 @@ class _ClockInPageState extends State { bool get hasClocked => _integralModel?.isSign ?? false; Future getData() async { - var base = await NetUtil().get(API.intergral.info); - if (base.status ?? false) { + var base = await NetUtil().get(SARSAPI.profile.integral.info); + if (base.success) { _integralModel = IntegralInfoModel.fromJson(base.data); - } else { - BotToast.showText(text: base.message!); - } - } - - @override - void initState() { - getData().then((value) { if (_integralModel != null) { _records = _integralModel!.signRecordList; _configs = _integralModel!.rewardSetting @@ -54,7 +47,14 @@ class _ClockInPageState extends State { .toList(); setState(() {}); } - }); + } else { + BotToast.showText(text: base.msg); + } + } + + @override + void initState() { + getData(); super.initState(); } @@ -221,14 +221,15 @@ class _ClockInPageState extends State { onPressed: hasClocked ? null : () async { - var base = await NetUtil().get(API.intergral.sign); - if (base.status ?? false) { + var base = + await NetUtil().get(SARSAPI.profile.integral.sign); + if (base.success) { await Get.dialog(ClockSuccessDialog( todayIntegral: 1, tomorrowIntegral: 2)); await UserTool.userProvider.changeTodayClocked(); await getData(); } else { - BotToast.showText(text: base.message!); + BotToast.showText(text: base.msg); } }, elevation: 0, diff --git a/lib/pages/personal/personal_page.dart b/lib/pages/personal/personal_page.dart index ab7e55b2..9054a52b 100644 --- a/lib/pages/personal/personal_page.dart +++ b/lib/pages/personal/personal_page.dart @@ -1,4 +1,5 @@ import 'package:aku_new_community/const/resource.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/pages/personal/clock_in/clock_in_page.dart'; import 'package:aku_new_community/pages/personal/user_profile_page.dart'; @@ -338,15 +339,15 @@ class _PersonalIndexState extends State Spacer(), MaterialButton( onPressed: () async { - var base = - await NetUtil().get(API.intergral.sign); - if (base.status ?? false) { + var base = await NetUtil() + .get(SARSAPI.profile.integral.sign); + if (base.success) { await Get.dialog(ClockSuccessDialog( todayIntegral: 1, tomorrowIntegral: 2)); await UserTool.userProvider .changeTodayClocked(); } else { - BotToast.showText(text: base.message!); + BotToast.showText(text: base.msg); } }, elevation: 0,