From 9e1515f2457e1124cb06fc04015bf87620c5906a Mon Sep 17 00:00:00 2001 From: laiiihz Date: Fri, 22 Jan 2021 17:14:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E5=92=A8=E8=AF=A2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=B7=B3=E8=BD=AC=20REMOVE=20SH*T=20CODE=20AGAIN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/home/home_page.dart | 4 - lib/pages/property/property_index.dart | 30 +-- lib/pages/things_page/things_page.dart | 202 ------------------ .../total_applications_page.dart | 36 +--- lib/ui/manager/advice/advice_page.dart | 49 ++++- 5 files changed, 58 insertions(+), 263 deletions(-) delete mode 100644 lib/pages/things_page/things_page.dart diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 6e426746..3f5e5052 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -10,7 +10,6 @@ import 'package:akuCommunity/pages/message_center_page/message_center_page.dart' import 'package:akuCommunity/pages/open_door_page/open_door_page.dart'; import 'package:akuCommunity/pages/scan/scan_page.dart'; import 'package:akuCommunity/pages/things_page/fixed_submit_page.dart'; -import 'package:akuCommunity/pages/things_page/things_page.dart'; import 'package:akuCommunity/pages/total_application_page/total_applications_page.dart'; import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart'; import 'package:akuCommunity/extensions/num_ext.dart'; @@ -20,7 +19,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'widget/home_search.dart'; @@ -31,8 +29,6 @@ import 'package:akuCommunity/widget/container_comment.dart'; import 'package:akuCommunity/widget/single_ad_space.dart'; import 'package:akuCommunity/service/base_model.dart'; import 'package:akuCommunity/model/aku_shop_model.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; - import 'package:velocity_x/velocity_x.dart'; import 'package:akuCommunity/extensions/page_router.dart'; diff --git a/lib/pages/property/property_index.dart b/lib/pages/property/property_index.dart index 39f03f3c..6e8f2bab 100644 --- a/lib/pages/property/property_index.dart +++ b/lib/pages/property/property_index.dart @@ -11,9 +11,9 @@ import 'package:akuCommunity/pages/open_door_page/open_door_page.dart'; import 'package:akuCommunity/pages/opening_code_page/opening_code_page.dart'; import 'package:akuCommunity/pages/questionnaire_page/questionnaire_page.dart'; import 'package:akuCommunity/pages/things_page/fixed_submit_page.dart'; -import 'package:akuCommunity/pages/things_page/things_page.dart'; import 'package:akuCommunity/pages/total_application_page/total_applications_page.dart'; import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart'; +import 'package:akuCommunity/ui/manager/advice/advice_page.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/grid_buttons.dart'; import 'package:flutter/material.dart'; @@ -57,18 +57,8 @@ class _PropertyIndexState extends State GridButton('业委会', R.ASSETS_ICONS_TOOL_YWH_PNG, () { IndustryCommitteePage().to(); }), - GridButton('建议咨询', R.ASSETS_ICONS_TOOL_JYTS_PNG, () { - Get.to(ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '建议咨询', - 'treeList': >[ - {'name': '您的建议'}, - {'name': '您的咨询'}, - ] - }), - )); - }), + GridButton('建议咨询', R.ASSETS_ICONS_TOOL_JYTS_PNG, + AdvicePage(type: AdviceType.SUGGESTION).to), GridButton('便民电话', R.ASSETS_ICONS_TOOL_BMDH_PNG, () { ConvenientPhonePage().to(); }), @@ -78,18 +68,8 @@ class _PropertyIndexState extends State GridButton('物品出户', R.ASSETS_ICONS_TOOL_WPCM_PNG, () { GoodsDetoPage().to(); }), - GridButton('投诉表扬', R.ASSETS_ICONS_TOOL_TSBY_PNG, () { - Get.to(ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '投诉表扬', - 'treeList': >[ - {'name': '您的表扬'}, - {'name': '您的投诉'}, - ] - }), - )); - }), + GridButton('投诉表扬', R.ASSETS_ICONS_TOOL_TSBY_PNG, + AdvicePage(type: AdviceType.SUGGESTION).to), GridButton('问卷调查', R.ASSETS_ICONS_TOOL_WJDC_PNG, () { QuestionnairePage().to(); }), diff --git a/lib/pages/things_page/things_page.dart b/lib/pages/things_page/things_page.dart deleted file mode 100644 index 5789d39f..00000000 --- a/lib/pages/things_page/things_page.dart +++ /dev/null @@ -1,202 +0,0 @@ -import 'package:akuCommunity/pages/things_page/things_create_page/things_create_page.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; -import 'package:akuCommunity/utils/headers.dart'; -import 'package:akuCommunity/widget/common_app_bar.dart'; -import 'widget/things_app_bar.dart'; -import 'widget/things_list.dart'; - -//TODO CLEAN BOTTOM CODES. -@Deprecated("sh*t page need to be cleaned.") -class ThingsPage extends StatefulWidget { - final Bundle bundle; - ThingsPage({Key key, this.bundle}) : super(key: key); - - @override - _ThingsPageState createState() => _ThingsPageState(); -} - -class _ThingsPageState extends State with TickerProviderStateMixin { - List> _listCard = [ - { - 'time': '2020年10月13日', - 'tag': '已提交', - 'content': '我觉得我们小区的绿化可以再多一点', - 'imageList': [ - 'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=111636878,534819054&fm=26&gp=0.jpg', - 'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3834533673,769780989&fm=26&gp=0.jpg', - 'https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1683501076,3787404077&fm=26&gp=0.jpg', - 'https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1040644610,2290865162&fm=26&gp=0.jpg', - ] - }, - { - 'time': '2020年09月23日', - 'tag': '已审阅', - 'content': '我觉得外面的小摊贩还是不要来了,毕竟为了环保,还有小区的孩子很多,大狗什么的希望主人能管好它', - 'imageList': [] - }, - { - 'time': '2020年08月12日', - 'tag': '已反馈', - 'content': '夏天蛇蚁虫属真多,希望小区能组队给整个小区保洁一下', - 'imageList': [ - 'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1696975393,2205543181&fm=26&gp=0.jpg', - 'https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3220834958,1457978756&fm=26&gp=0.jpg', - ] - }, - ]; - - List> _listRepair = [ - { - 'time': '公区报修', - 'tag': '已处理', - 'content': '小区花园的健身器材坏了请注意抓紧时间维修。还有一些健身器材年限到了麻烦注意更换,因为怕出现安全隐患。', - 'imageList': [ - 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2390449629,3468003032&fm=26&gp=0.jpg', - 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=123602716,1727529947&fm=26&gp=0.jpg', - 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3789981542,2569571902&fm=26&gp=0.jpg', - ] - }, - { - 'time': '家庭维修', - 'tag': '待分配', - 'content': '家里的洗衣机坏了请师傅抓紧时间,赶快支援。', - 'imageList': [ - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1199114124,190063793&fm=26&gp=0.jpg', - 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1009468563,227812083&fm=26&gp=0.jpg', - ] - }, - { - 'time': '家庭维修', - 'tag': '维修中', - 'content': '家里的空调坏了,热死人了,请师傅火速来修。', - 'imageList': [ - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1349979411,865756316&fm=26&gp=0.jpg', - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2162579969,1968776994&fm=26&gp=0.jpg', - ] - }, - { - 'time': '家庭维修', - 'tag': '已完成', - 'content': '家里的冰箱坏了,师傅赶紧来看看', - 'imageList': [ - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=466219337,2269488732&fm=15&gp=0.jpg', - 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=907707978,1526051881&fm=26&gp=0.jpg', - ] - }, - { - 'time': '家庭维修', - 'tag': '已取消', - 'content': '家里的电饭煲坏了,师傅快上门修一下。', - 'imageList': [ - 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=61782379,2829421550&fm=26&gp=0.jpg', - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=921027380,3023940375&fm=15&gp=0.jpg', - ] - }, - ]; - - TabController _controller; - - @override - void initState() { - if (widget.bundle.getMap('things')['treeList'] != null) { - _controller = TabController( - length: widget.bundle.getMap('things')['treeList'].length, - vsync: this); - } - super.initState(); - } - - @override - void dispose() { - if (widget.bundle.getMap('things')['treeList'] != null) { - _controller.dispose(); - } - super.dispose(); - } - - Widget _positionedButton() { - return Positioned( - bottom: 0, - child: InkWell( - onTap: () { - bool isIdea; - switch (widget.bundle.getMap('things')['title']) { - case '建议咨询': - isIdea = true; - break; - case '投诉表扬': - isIdea = false; - break; - case '报事报修': - break; - default: - } - ThingsCreatePage( - bundle: Bundle() - ..putMap('create', { - 'title': widget.bundle.getMap('things')['title'], - 'isIdea': isIdea - }), - ).to; - }, - child: Container( - alignment: Alignment.center, - height: 98.w, - width: 750.w, - padding: EdgeInsets.symmetric(vertical: 26.5.w), - color: Color(0xffffc40c), - child: Text( - '新增', - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 32.sp, - color: Color(0xff333333), - ), - ), - ), - ), - ); - } - - Widget build(BuildContext context) { - return Scaffold( - appBar: PreferredSize( - child: widget.bundle.getMap('things')['title'] == '报事报修' - ? CommonAppBar( - title: '${widget.bundle.getMap('things')['title']}', - ) - : ThingsAppBar( - title: '${widget.bundle.getMap('things')['title']}', - tabController: _controller, - treeList: widget.bundle.getMap('things')['treeList'], - ), - preferredSize: Size.fromHeight( - widget.bundle.getMap('things')['title'] == '报事报修' - ? kToolbarHeight - : kToolbarHeight * 1.8), - ), - body: Stack( - children: [ - widget.bundle.getMap('things')['title'] == '报事报修' - ? ThingsList( - listCard: _listRepair, - isRepair: true, - ) - : TabBarView( - controller: _controller, - children: List.generate( - widget.bundle.getMap('things')['treeList'].length, - (index) => ThingsList( - listCard: _listCard, - isRepair: false, - ), - ), - ), - _positionedButton(), - ], - ), - ); - } -} diff --git a/lib/pages/total_application_page/total_applications_page.dart b/lib/pages/total_application_page/total_applications_page.dart index 95d0cb20..6a4a7c2e 100644 --- a/lib/pages/total_application_page/total_applications_page.dart +++ b/lib/pages/total_application_page/total_applications_page.dart @@ -10,8 +10,9 @@ import 'package:akuCommunity/pages/one_alarm/widget/alarm_page.dart'; import 'package:akuCommunity/pages/open_door_page/open_door_page.dart'; import 'package:akuCommunity/pages/opening_code_page/opening_code_page.dart'; import 'package:akuCommunity/pages/questionnaire_page/questionnaire_page.dart'; -import 'package:akuCommunity/pages/things_page/things_page.dart'; +import 'package:akuCommunity/pages/things_page/fixed_submit_page.dart'; import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart'; +import 'package:akuCommunity/ui/manager/advice/advice_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/utils/headers.dart'; @@ -135,12 +136,7 @@ class _TotalApplicationsPageState extends State { VisitorAccessPage().to(); break; case '报事报修': - ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '报事报修', - }), - ).to; + FixedSubmitPage().to(); break; case '生活缴费': case '我的缴费': @@ -150,40 +146,22 @@ class _TotalApplicationsPageState extends State { IndustryCommitteePage().to(); break; case '建议咨询': - ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '建议咨询', - 'treeList': >[ - {'name': '您的建议'}, - {'name': '您的咨询'}, - ] - }), - ).to(); + AdvicePage(type: AdviceType.SUGGESTION).to(); break; case '便民电话': ConvenientPhonePage().to(); break; case '活动投票': - ActivitiesPage().to; + ActivitiesPage().to(); break; case '社区活动': - ActivitiesPage().to; + ActivitiesPage().to(); break; case '物品出户': GoodsDetoPage().to(); break; case '投诉表扬': - ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '投诉表扬', - 'treeList': >[ - {'name': '您的表扬'}, - {'name': '您的投诉'}, - ] - }), - ).to; + AdvicePage(type: AdviceType.COMPLAIN).to(); break; case '问卷调查': QuestionnairePage().to(); diff --git a/lib/ui/manager/advice/advice_page.dart b/lib/ui/manager/advice/advice_page.dart index 0903b781..aefb26a1 100644 --- a/lib/ui/manager/advice/advice_page.dart +++ b/lib/ui/manager/advice/advice_page.dart @@ -12,6 +12,13 @@ enum AdviceType { COMPLAIN, } +enum _adviceInnerType { + SUGGESTION, + QUESTION, + COMPLAIN, + PRAISE, +} + class AdvicePage extends StatefulWidget { final AdviceType type; AdvicePage({Key key, @required this.type}) : super(key: key); @@ -23,6 +30,42 @@ class AdvicePage extends StatefulWidget { class _AdvicePageState extends State with TickerProviderStateMixin { EasyRefreshController _refreshController = EasyRefreshController(); TabController _tabController; + + String get title { + switch (widget.type) { + case AdviceType.SUGGESTION: + return '建议咨询'; + break; + case AdviceType.COMPLAIN: + return '投诉表扬'; + break; + } + return ''; + } + + List get tabs { + switch (widget.type) { + case AdviceType.SUGGESTION: + return ['您的建议', '您的咨询']; + break; + case AdviceType.COMPLAIN: + return ['您的投诉', '您的表扬']; + break; + } + return []; + } + + int adviceValue(int index) { + switch (widget.type) { + case AdviceType.SUGGESTION: + return index == 0 ? 2 : 1; + break; + case AdviceType.COMPLAIN: + return index == 0 ? 4 : 3; + break; + } + } + @override void initState() { super.initState(); @@ -38,17 +81,17 @@ class _AdvicePageState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { return BeeScaffold( - title: '建议咨询', + title: title, appBarBottom: BeeTabBar( controller: _tabController, - tabs: ['您的建议', '您的咨询'], + tabs: tabs, ), body: TabBarView( controller: _tabController, children: List.generate(2, (index) { return BeeListView( path: API.manager.advice, - extraParams: {'adviceType': index == 0 ? 2 : 1}, + extraParams: {'adviceType': adviceValue(index)}, controller: _refreshController, convert: (model) => model.tableList .map((e) => SuggestionOrComplainModel.fromJson(e))