diff --git a/lib/const/api.dart b/lib/const/api.dart index 49f0e14..1151aed 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -167,6 +167,9 @@ class _Manage { ///待办事项:查询处理事项的数量 String get findItemNum => '/user/backlog/findItemNum'; + + ///待办事项:查询所有的待办事务 + String get backlogList => '/user/backlog/list'; } class _Upload { diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 85f8388..d3fbec5 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -1,7 +1,10 @@ // Flutter imports: +import 'package:aku_community_manager/const/api.dart'; 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:aku_community_manager/utils/network/net_util.dart'; +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -10,7 +13,7 @@ import 'package:aku_ui/aku_ui.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; +import 'package:get/get.dart' hide Response; import 'package:provider/provider.dart'; // Project imports: @@ -40,14 +43,17 @@ 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 { - final ItemNumModel itemNumModel; - HomePage({Key key, @required this.itemNumModel}) : super(key: key); + HomePage({ + Key key, + }) : super(key: key); @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State { + ItemNumModel _itemNumModel; + ///自定义bar的菜单按钮 Widget _menuButton(String assetPath, String text, Widget page) { final appProvider = Provider.of(context); @@ -133,14 +139,21 @@ class _HomePageState extends State { } @override - void initState() { + void initState() async { super.initState(); SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( statusBarColor: Colors.transparent, )); + _itemNumModel = await _getItemNum(); } int _currentIndicator = 0; + + Future _getItemNum() async { + Response response = await NetUtil().dio.get(API.manage.findItemNum); + return ItemNumModel.fromJson(response.data); + } + @override Widget build(BuildContext context) { final userProvider = Provider.of(context); @@ -532,10 +545,10 @@ class _HomePageState extends State { children: [ Row( children: [ - _card(widget.itemNumModel.unProcessedNum??0, '未处理事项', + _card(_itemNumModel.unProcessedNum ?? 0, '未处理事项', Color(0xFFFF4E0D), 0), GridientDiveder().verticalDivider(166.5.w), - _card(widget.itemNumModel.processingNum??0, '处理中事项', + _card(_itemNumModel.processingNum ?? 0, '处理中事项', Color(0xFFFFC40C), 1), ], ), @@ -546,12 +559,12 @@ class _HomePageState extends State { ]), Row( children: [ - _card(widget.itemNumModel.processedNum??0, '已处理事项', + _card(_itemNumModel.processedNum ?? 0, '已处理事项', Color(0xFF3F8FFE), 2), GridientDiveder(isReverse: true).verticalDivider( 166.5.w, ), - _card(widget.itemNumModel.allNum??0, '全部事项', + _card(_itemNumModel.allNum ?? 0, '全部事项', Color(0xFF333333), 3), ], ), diff --git a/lib/ui/splash/splash_page.dart b/lib/ui/splash/splash_page.dart index 97ef9a1..1cbcfaa 100644 --- a/lib/ui/splash/splash_page.dart +++ b/lib/ui/splash/splash_page.dart @@ -49,18 +49,10 @@ class _SplashPageState extends State { }); Future.delayed(Duration(milliseconds: 2000), () async { await _originOp(); - ItemNumModel itemNumModel = await _getItemNum(); - Get.off(HomePage( - itemNumModel: itemNumModel, - )); + Get.off(HomePage()); }); } - Future _getItemNum() async { - Response response = await NetUtil().dio.get(API.manage.findItemNum); - return ItemNumModel.fromJson(response.data); - } - @override Widget build(BuildContext context) { return Scaffold(