From 5f44ca4cc8313944836c6ad3e825917c3b8e906a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A0=E6=96=87=E8=BD=A9?= <12812285557@qq.com> Date: Thu, 7 Apr 2022 18:07:57 +0800 Subject: [PATCH] fix bugs --- lib/new_ui/auth/set_nick_name_page.dart | 8 ++ .../household_audit/household_audit_page.dart | 19 +++- .../distributor/distributor_detail_page.dart | 8 +- .../receiver/work_order_receiver_page.dart | 8 +- .../receiver/work_order_receiver_widget.dart | 90 +++++++++++++++++++ lib/ui/splash/splash_page.dart | 1 + lib/utils/network/net_util.dart | 3 +- 7 files changed, 129 insertions(+), 8 deletions(-) create mode 100644 lib/new_ui/work_order/receiver/work_order_receiver_widget.dart diff --git a/lib/new_ui/auth/set_nick_name_page.dart b/lib/new_ui/auth/set_nick_name_page.dart index ba31f3c..95b19e6 100644 --- a/lib/new_ui/auth/set_nick_name_page.dart +++ b/lib/new_ui/auth/set_nick_name_page.dart @@ -2,6 +2,7 @@ import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -23,6 +24,13 @@ class _SetNickNamePageState extends State { super.dispose(); } + + @override + void initState() { + super.initState(); + BotToast.closeAllLoading(); + } + @override Widget build(BuildContext context) { return AkuScaffold( diff --git a/lib/new_ui/household_audit/household_audit_page.dart b/lib/new_ui/household_audit/household_audit_page.dart index 09ecf9f..e66152a 100644 --- a/lib/new_ui/household_audit/household_audit_page.dart +++ b/lib/new_ui/household_audit/household_audit_page.dart @@ -23,10 +23,12 @@ class HouseholdAuditPage extends StatefulWidget { class _HouseholdAuditPageState extends State with SingleTickerProviderStateMixin { - List _tabs = ['全部', '待审核', '已同意', '已驳回']; + List _tabs = ['全部', '待审核', '已驳回', '已同意']; List _refreshControllers = []; late TabController _tabController; List _models = []; + int _page = 1; + int _size = 10; @override void initState() { @@ -67,14 +69,25 @@ class _HouseholdAuditPageState extends State header: MaterialHeader(), footer: MaterialFooter(), onRefresh: () async { - var base = await NetUtil().getList(SAASAPI.householdAudit.list); + _models = []; + _page = 1; + var base = await NetUtil().getList(SAASAPI.householdAudit.list,params: { + 'pageNum': _page, + 'size': _size, + 'status':index==0?null:index + }); _models = base.rows .map((e) => HouseholdAuditListModel.fromJson(e)) .toList(); setState(() {}); }, onLoad: () async { - var base = await NetUtil().getList(SAASAPI.householdAudit.list); + _page++; + var base = await NetUtil().getList(SAASAPI.householdAudit.list,params: { + 'pageNum': _page, + 'size': _size, + 'status':index==0?null:index + }); if (_models.length < base.total) { _models.addAll(base.rows .map((e) => HouseholdAuditListModel.fromJson(e)) diff --git a/lib/new_ui/work_order/distributor/distributor_detail_page.dart b/lib/new_ui/work_order/distributor/distributor_detail_page.dart index 03a9e1f..ce9ee7f 100644 --- a/lib/new_ui/work_order/distributor/distributor_detail_page.dart +++ b/lib/new_ui/work_order/distributor/distributor_detail_page.dart @@ -72,6 +72,7 @@ class _DistributorDetailPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + 40.w.heightBox, GestureDetector( onTap: () async { await WorkOrderFuc.getProgress( @@ -106,6 +107,7 @@ class _DistributorDetailPageState extends State { ], ), ), + Spacer(), ], ), @@ -128,7 +130,7 @@ class _DistributorDetailPageState extends State { ? Container() : ListView( padding: - EdgeInsets.only(top: 120.w, left: 32.w, right: 32.w), + EdgeInsets.only(top: 140.w, left: 32.w, right: 32.w), children: [ Offstage( offstage: _model!.status < 5, @@ -245,6 +247,10 @@ class _DistributorDetailPageState extends State { var re = await WorkOrderFuc.reminderPay(widget.id); if (re) { _refreshController.callRefresh(); + setState(() { + + }); + } Get.back(); }, diff --git a/lib/new_ui/work_order/receiver/work_order_receiver_page.dart b/lib/new_ui/work_order/receiver/work_order_receiver_page.dart index 00c38fd..b811c2f 100644 --- a/lib/new_ui/work_order/receiver/work_order_receiver_page.dart +++ b/lib/new_ui/work_order/receiver/work_order_receiver_page.dart @@ -1,5 +1,6 @@ import 'package:aku_new_community_manager/const/saas_api.dart'; import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_card.dart'; +import 'package:aku_new_community_manager/new_ui/work_order/receiver/work_order_receiver_widget.dart'; import 'package:aku_new_community_manager/saas_models/work_order/work_order_list_model.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_tab_bar.dart'; @@ -19,7 +20,7 @@ class WorkOrderReceiverPage extends StatefulWidget { class _WorkOrderReceiverPageState extends State with SingleTickerProviderStateMixin { - List _tabs = ['全部', '工单池', '已接单', '处理中', '待确认', '已完成', '已评价', '已取消']; + List _tabs = ['全部', '待分配', '工单池', '已接单', '处理中', '待确认', '待支付', '已完成', '已评价', '已取消']; late TabController _tabController; EasyRefreshController _refreshController = EasyRefreshController(); int _page = 1; @@ -62,7 +63,7 @@ class _WorkOrderReceiverPageState extends State body: TabBarView( controller: _tabController, children: - _tabs.mapIndexed((e, index) => _getOrderView(index)).toList()), + _tabs.mapIndexed((e, index) => WorkOrderReceiverWidget( index:index,)).toList()), ); } @@ -71,6 +72,7 @@ class _WorkOrderReceiverPageState extends State firstRefresh: true, header: MaterialHeader(), onRefresh: () async { + _models = []; _page = 1; var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { 'pageNum': _page, @@ -96,7 +98,7 @@ class _WorkOrderReceiverPageState extends State _refreshController.finishLoad(); } }, - child: ListView.separated( + child:_models==[]?SizedBox(): ListView.separated( padding: EdgeInsets.all(24.w), itemBuilder: (context, index) { return DistributorCard( diff --git a/lib/new_ui/work_order/receiver/work_order_receiver_widget.dart b/lib/new_ui/work_order/receiver/work_order_receiver_widget.dart new file mode 100644 index 0000000..a5d5aa3 --- /dev/null +++ b/lib/new_ui/work_order/receiver/work_order_receiver_widget.dart @@ -0,0 +1,90 @@ +import 'package:aku_new_community_manager/const/saas_api.dart'; +import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_card.dart'; +import 'package:aku_new_community_manager/saas_models/work_order/work_order_list_model.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_new_community_manager/ui/widgets/inner/aku_tab_bar.dart'; +import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class WorkOrderReceiverWidget extends StatefulWidget { + final int index; + + + const WorkOrderReceiverWidget({Key? key, required this.index}) : super(key: key); + + @override + _WorkOrderReceiverWidgetState createState() => _WorkOrderReceiverWidgetState(); +} + +class _WorkOrderReceiverWidgetState extends State + with SingleTickerProviderStateMixin { + + EasyRefreshController _refreshController = EasyRefreshController(); + int _page = 1; + int _size = 10; + List _models = []; + + @override + void initState() { + + super.initState(); + } + + @override + void dispose() { + _refreshController.dispose(); + + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async { + _models = []; + _page = 1; + var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': widget.index == 0 ? null : widget.index , + }); + _models = + base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList(); + setState(() {}); + }, + onLoad: () async { + _page++; + var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': widget.index == 0 ? null : widget.index , + }); + if (_models.length < base.total) { + _models.addAll( + base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList()); + setState(() {}); + } else { + _refreshController.finishLoad(); + } + }, + child:_models==[]?SizedBox(): ListView.separated( + padding: EdgeInsets.all(24.w), + itemBuilder: (context, index) { + return DistributorCard( + model: _models[index], + refresh: _refreshController.callRefresh, + ); + }, + separatorBuilder: (context, index) { + return 24.w.heightBox; + }, + itemCount: _models.length)); + } + +} diff --git a/lib/ui/splash/splash_page.dart b/lib/ui/splash/splash_page.dart index a8278dd..dc74677 100644 --- a/lib/ui/splash/splash_page.dart +++ b/lib/ui/splash/splash_page.dart @@ -109,6 +109,7 @@ class _SplashPageState extends State { var result = await _showLoginVerify(); if (result == null || !result) { SystemNavigator.pop(); + HiveStore.appBox!.put('agreement', false); } else { HiveStore.appBox!.put('agreement', true); diff --git a/lib/utils/network/net_util.dart b/lib/utils/network/net_util.dart index 93b5b8a..174bc2a 100644 --- a/lib/utils/network/net_util.dart +++ b/lib/utils/network/net_util.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:aku_new_community_manager/const/saas_api.dart'; +import 'package:aku_new_community_manager/new_ui/auth/other_login_page.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/saas_models/net_model/base_list_model.dart'; import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; @@ -172,7 +173,7 @@ class NetUtil { final userProvider = Provider.of(Get.context!, listen: false); if (!model.success && (model.code == 10010 || model.msg == '登录失效,请重新登录')) { userProvider.logout(); - Get.offAll(() => LoginPage()); + Get.offAll(() => OtherLoginPage()); if (userProvider.isLogin) { BotToast.showText(text: model.msg); }