diff --git a/lib/const/api.dart b/lib/const/api.dart index 15ed156..49f0e14 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -164,6 +164,9 @@ class _Manage { ///巡检管理:查询巡检执行点信息(点击已巡检查看详情) String get inspectionPointCheckDetail => '/user/inspection/findCheckDetailById'; + + ///待办事项:查询处理事项的数量 + String get findItemNum => '/user/backlog/findItemNum'; } class _Upload { diff --git a/lib/models/manager/item_num_model.dart b/lib/models/manager/item_num_model.dart new file mode 100644 index 0000000..2f126a0 --- /dev/null +++ b/lib/models/manager/item_num_model.dart @@ -0,0 +1,28 @@ +class ItemNumModel { + int unProcessedNum; + int processedNum; + int processingNum; + int allNum; + + ItemNumModel( + {this.unProcessedNum, + this.processedNum, + this.processingNum, + this.allNum}); + + ItemNumModel.fromJson(Map json) { + unProcessedNum = json['unProcessedNum']; + processedNum = json['processedNum']; + processingNum = json['processingNum']; + allNum = json['allNum']; + } + + Map toJson() { + final Map data = new Map(); + data['unProcessedNum'] = this.unProcessedNum; + data['processedNum'] = this.processedNum; + data['processingNum'] = this.processingNum; + data['allNum'] = this.allNum; + return data; + } +} diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 224cc56..85f8388 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -1,6 +1,7 @@ // Flutter imports: import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/manager/decoration/decoration_list_model.dart'; +import 'package:aku_community_manager/models/manager/item_num_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -39,7 +40,8 @@ import 'package:aku_community_manager/ui/tool_pages/warning/warning_page.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/aku_avatar.dart'; class HomePage extends StatefulWidget { - HomePage({Key key}) : super(key: key); + final ItemNumModel itemNumModel; + HomePage({Key key, @required this.itemNumModel}) : super(key: key); @override _HomePageState createState() => _HomePageState(); @@ -530,11 +532,11 @@ class _HomePageState extends State { children: [ Row( children: [ - _card(AllModel(context).waitThings?.length, '未处理事项', + _card(widget.itemNumModel.unProcessedNum??0, '未处理事项', Color(0xFFFF4E0D), 0), GridientDiveder().verticalDivider(166.5.w), - _card(AllModel(context).processingThings?.length, - '处理中事项', Color(0xFFFFC40C), 1), + _card(widget.itemNumModel.processingNum??0, '处理中事项', + Color(0xFFFFC40C), 1), ], ), Row(children: [ @@ -544,12 +546,12 @@ class _HomePageState extends State { ]), Row( children: [ - _card(AllModel(context).doneThings?.length, '已处理事项', + _card(widget.itemNumModel.processedNum??0, '已处理事项', Color(0xFF3F8FFE), 2), GridientDiveder(isReverse: true).verticalDivider( 166.5.w, ), - _card(AllModel(context).allThings?.length, '全部事项', + _card(widget.itemNumModel.allNum??0, '全部事项', Color(0xFF333333), 3), ], ), diff --git a/lib/ui/splash/splash_page.dart b/lib/ui/splash/splash_page.dart index 03af16a..97ef9a1 100644 --- a/lib/ui/splash/splash_page.dart +++ b/lib/ui/splash/splash_page.dart @@ -1,12 +1,16 @@ // Flutter imports: +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/manager/item_num_model.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/utils/dev_util.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:amap_map_fluttify/amap_map_fluttify.dart'; -import 'package:get/get.dart'; +import 'package:get/get.dart' hide Response; import 'package:hive/hive.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:power_logger/power_logger.dart'; @@ -45,10 +49,18 @@ class _SplashPageState extends State { }); Future.delayed(Duration(milliseconds: 2000), () async { await _originOp(); - Get.off(HomePage()); + ItemNumModel itemNumModel = await _getItemNum(); + Get.off(HomePage( + itemNumModel: itemNumModel, + )); }); } + Future _getItemNum() async { + Response response = await NetUtil().dio.get(API.manage.findItemNum); + return ItemNumModel.fromJson(response.data); + } + @override Widget build(BuildContext context) { return Scaffold(