From 883013fef0dcfb636d295e082dd327f847563773 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 18 Mar 2022 16:04:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2netutil=20model=20=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E7=99=BB=E5=BD=95=E6=B3=A8=E5=86=8C=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8F=8A=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/const/other_api.dart | 10 + lib/const/saas_api.dart | 115 ++++ lib/gen/assets.gen.dart | 506 ++++++++++++++++++ lib/gen/fonts.gen.dart | 13 + .../today_clock_record_model.g.dart | 33 +- .../engineer_repair_detail_model.g.dart | 59 +- .../engineer_repair_list_model.g.dart | 25 +- ..._repair_new_acceptance_record_model.g.dart | 41 +- .../engineer_repair_organization_model.g.dart | 33 +- .../engineer_repair_person_model.g.dart | 63 ++- .../engineer_repair_process_model.g.dart | 21 +- .../engineer_repair_result_model.g.dart | 25 +- .../engineer_repair_work_report_model.g.dart | 25 +- .../house_keeping_list_model.g.dart | 59 +- .../house_keeping_pick_staff_model.g.dart | 63 ++- .../house_keeping_process_model.g.dart | 21 +- .../key_manage_record_list_model.g.dart | 27 +- .../message/system_message_green_model.g.dart | 15 +- .../system_message_house_keeping_model.g.dart | 59 +- .../system_message_hygience_model.g.dart | 15 +- lib/models/user/user_info_model.dart | 7 +- lib/models/user/user_profile_model.dart | 1 + lib/new_ui/auth/code_message_page.dart | 138 +++++ lib/new_ui/auth/forgot_psd_page.dart | 93 ++++ lib/new_ui/auth/forgot_set_psd_page.dart | 183 +++++++ lib/new_ui/auth/login_root_page.dart | 147 +++++ lib/new_ui/auth/other_login_page.dart | 207 +++++++ lib/new_ui/auth/psd_verify.dart | 36 ++ lib/new_ui/auth/select_community_page.dart | 194 +++++++ lib/new_ui/auth/set_nick_nage_page.dart | 150 ++++++ lib/new_ui/auth/set_psd_page.dart | 104 ++++ lib/new_ui/auth/sign_func.dart | 122 +++++ .../auth/widget/login_button_widget.dart | 29 + lib/new_ui/auth/widget/psd_textfield.dart | 66 +++ lib/new_ui/auth/widget/tel_textfield.dart | 41 ++ lib/provider/app_provider.dart | 59 +- lib/provider/data_provider.dart | 52 ++ lib/provider/user_provider.dart | 39 +- lib/saas_models/login/china_region_model.dart | 48 ++ .../login/china_region_model.g.dart | 64 +++ lib/saas_models/login/community_model.dart | 28 + lib/saas_models/login/community_model.g.dart | 15 + .../login/history_login_model.dart | 27 + .../login/history_login_model.g.dart | 58 ++ lib/saas_models/login/picked_city_model.dart | 53 ++ .../login/picked_city_model.g.dart | 60 +++ .../net_model/base_list_model.dart | 29 + .../net_model/base_list_model.g.dart | 14 + lib/saas_models/net_model/base_model.dart | 26 + lib/saas_models/net_model/base_model.g.dart | 14 + lib/saas_models/user/user_info_model.dart | 58 ++ lib/saas_models/user/user_info_model.g.dart | 26 + lib/tools/user_tool.dart | 15 +- lib/ui/home/announcement/All_anouncement.dart | 19 +- lib/ui/home/home_page.dart | 4 +- lib/ui/home/messages/comment_message.dart | 17 +- .../home/messages/comment_message_card.dart | 19 +- lib/ui/home/messages/message.dart | 6 +- .../home/messages/system/system_message.dart | 23 +- .../messages/system/system_message_card.dart | 295 +++++----- .../system/system_message_green_card.dart | 291 +++++----- .../system_message_house_keeping_card.dart | 4 +- .../system/system_message_hygience_card.dart | 16 +- .../manage_pages/clock_in_out/clock_func.dart | 8 +- .../clock_in_out/clock_in_out_view.dart | 4 +- .../engineer_repair/engineer_repair_func.dart | 32 +- .../engineer_repair/engineer_repair_view.dart | 2 +- ...facilities_inspect_report_detail_page.dart | 6 +- .../facilities_inspect_report_page.dart | 6 +- .../facilities/facilities_view.dart | 11 +- .../green_manage/green_manage_card.dart | 26 +- .../green_manage/green_manage_view.dart | 7 +- .../house_keeping/house_keeping_add_page.dart | 11 +- .../house_keeping/house_keeping_func.dart | 18 +- .../house_keeping/house_keeping_view.dart | 4 +- .../hygience_manage/hygience_manage_card.dart | 6 +- .../hygience_manage/hygience_manage_view.dart | 17 +- .../inspection_manage_details_page.dart | 58 +- .../inspection_manage_view.dart | 21 +- .../inspection_point_detail_page.dart | 24 +- .../inspection_point_input_page.dart | 39 +- .../interview/interview_feedback_page.dart | 24 +- .../interview/interview_view.dart | 2 +- .../key_manage/key_apply_record_card.dart | 4 +- .../key_manage/key_apply_record_view.dart | 2 +- .../key_manage/key_manage_card.dart | 27 +- .../key_manage/key_manage_view.dart | 10 +- .../packages_manage/add_package_page.dart | 28 +- .../packages_manage/packages_manage_card.dart | 26 +- .../packages_manage/packages_manage_view.dart | 17 +- .../rules_manage/rules_manage_page.dart | 2 +- lib/ui/settings/nick_name_change_page.dart | 6 +- lib/ui/settings/setting_feedback_page.dart | 22 +- lib/ui/settings/tel_change_page.dart | 8 +- lib/ui/settings/update_userinfo_func.dart | 2 +- .../activity_detail_page.dart | 2 +- .../activity_manager_page.dart | 14 +- .../borrow_manager/add_borrow_item_page.dart | 30 +- .../add_borrow_object_page.dart | 24 +- .../borrow_manager/all_borrow_goods.dart | 16 +- .../borrow_item_detail_page.dart | 16 +- .../borrow_manager/borrow_items_page.dart | 19 +- .../borrow_manager_check_page.dart | 14 +- .../borrow_manager_examine_page.dart | 2 +- .../borrow_manager/borrow_manager_view.dart | 18 +- .../business_and_fix_detail_page.dart | 53 +- .../business_and_fix/business_fix_card.dart | 18 +- .../bussiness_and_fix_view.dart | 16 +- .../business_and_fix/fix_more_time_page.dart | 23 +- .../fix_work_finish_page.dart | 31 +- .../fixer_department_page.dart | 28 +- .../decoration_manager_detail_page.dart | 4 +- .../new_renovation_finsih_submit_page.dart | 8 +- .../new_renovation/new_renovation_view.dart | 2 +- .../items_outdoor_details_page.dart | 2 +- .../items_outdoor/items_outdoor_view.dart | 12 +- lib/ui/sub_pages/manage_func.dart | 17 +- .../visitor_manager/visitor_manager_view.dart | 16 +- .../app_widgets/bee_search_textfield.dart | 165 ++++++ lib/ui/widgets/common/bee_city_picker.dart | 159 ++++++ .../widgets/common/bee_community_picker.dart | 106 ++++ lib/ui/widgets/common/bee_divider.dart | 56 ++ lib/ui/widgets/common/bee_list_view.dart | 18 +- lib/ui/widgets/common/bee_picker_box.dart | 69 +++ lib/utils/hive_store.dart | 17 +- lib/utils/network/base_file_model.dart | 19 - lib/utils/network/base_list_model.dart | 27 - lib/utils/network/base_model.dart | 20 - lib/utils/network/manage_func.dart | 7 +- lib/utils/network/net_util.dart | 31 +- .../websocket/alarm_models/fall_model.g.dart | 18 +- .../websocket/alarm_models/fire_model.g.dart | 18 +- pubspec.lock | 92 +++- pubspec.yaml | 6 +- 134 files changed, 4545 insertions(+), 1273 deletions(-) create mode 100644 lib/const/other_api.dart create mode 100644 lib/const/saas_api.dart create mode 100644 lib/gen/assets.gen.dart create mode 100644 lib/gen/fonts.gen.dart create mode 100644 lib/new_ui/auth/code_message_page.dart create mode 100644 lib/new_ui/auth/forgot_psd_page.dart create mode 100644 lib/new_ui/auth/forgot_set_psd_page.dart create mode 100644 lib/new_ui/auth/login_root_page.dart create mode 100644 lib/new_ui/auth/other_login_page.dart create mode 100644 lib/new_ui/auth/psd_verify.dart create mode 100644 lib/new_ui/auth/select_community_page.dart create mode 100644 lib/new_ui/auth/set_nick_nage_page.dart create mode 100644 lib/new_ui/auth/set_psd_page.dart create mode 100644 lib/new_ui/auth/sign_func.dart create mode 100644 lib/new_ui/auth/widget/login_button_widget.dart create mode 100644 lib/new_ui/auth/widget/psd_textfield.dart create mode 100644 lib/new_ui/auth/widget/tel_textfield.dart create mode 100644 lib/provider/data_provider.dart create mode 100644 lib/saas_models/login/china_region_model.dart create mode 100644 lib/saas_models/login/china_region_model.g.dart create mode 100644 lib/saas_models/login/community_model.dart create mode 100644 lib/saas_models/login/community_model.g.dart create mode 100644 lib/saas_models/login/history_login_model.dart create mode 100644 lib/saas_models/login/history_login_model.g.dart create mode 100644 lib/saas_models/login/picked_city_model.dart create mode 100644 lib/saas_models/login/picked_city_model.g.dart create mode 100644 lib/saas_models/net_model/base_list_model.dart create mode 100644 lib/saas_models/net_model/base_list_model.g.dart create mode 100644 lib/saas_models/net_model/base_model.dart create mode 100644 lib/saas_models/net_model/base_model.g.dart create mode 100644 lib/saas_models/user/user_info_model.dart create mode 100644 lib/saas_models/user/user_info_model.g.dart create mode 100644 lib/ui/widgets/app_widgets/bee_search_textfield.dart create mode 100644 lib/ui/widgets/common/bee_city_picker.dart create mode 100644 lib/ui/widgets/common/bee_community_picker.dart create mode 100644 lib/ui/widgets/common/bee_divider.dart create mode 100644 lib/ui/widgets/common/bee_picker_box.dart delete mode 100644 lib/utils/network/base_file_model.dart delete mode 100644 lib/utils/network/base_list_model.dart delete mode 100644 lib/utils/network/base_model.dart diff --git a/lib/const/other_api.dart b/lib/const/other_api.dart new file mode 100644 index 0000000..dac194c --- /dev/null +++ b/lib/const/other_api.dart @@ -0,0 +1,10 @@ +part of 'saas_api.dart'; + +class _OtherApi { + _File file = _File(); +} + +class _File { + ///上传app照片 + String get uploadImg => '/butlerApp/user/upload/uploadImg'; +} diff --git a/lib/const/saas_api.dart b/lib/const/saas_api.dart new file mode 100644 index 0000000..6e937b6 --- /dev/null +++ b/lib/const/saas_api.dart @@ -0,0 +1,115 @@ +import 'package:aku_new_community_manager/tools/user_tool.dart'; + +part 'other_api.dart'; + +class SAASAPI { + ///HOST + static const String host = 'http://121.41.26.225:8006'; + + ///接口基础地址 + static const String baseURL = '$host'; + + ///静态资源路径 + static String get resource => + 'https://saas.kaidalai.cn/resource/${UserTool.userProvider.infoModel!.id}/'; + + static String image(String? path) => '$resource$path'; + + static String file(String? path) => '$resource$path'; + static const int networkTimeOut = 10000; + + ///根分类 + + static _Login login = _Login(); + static _Inspection inspection = _Inspection(); + static _City city = _City(); + static _User user = _User(); + + ///二级分类 + static _OtherApi other = _OtherApi(); +} + +class _Login { + ///查询所有小区信息 + String get allCommunity => '/butlerApp/login/findAllCommunity'; + + ///手机号密码登录 + String get login => '/butlerApp/login/loginTelPwd'; + + /// 获取手机验证码 + String get sendSMSCode => '/butlerApp/login/sendTelCode'; + + ///app用户(手机号验证码)登录 + String get loginTelCode => '/butlerApp/login/loginTelCode'; +} + +class _Inspection { + ///获取巡检执行的定位信息 + String get getLocation => '/butlerApp/user/inspection/getLocation'; + + /// 上传巡检定位信息 + String get uploadLocation => '/butlerApp/user/inspection/uploadLocation'; + + ///查询当前用户所有的巡检信息 + String get list => '/butlerApp/user/inspection/list'; + + ///根据巡检执行项主键id查询巡检详情 + String get detail => '/butlerApp/user/inspection/detail'; + + ///根据巡检计划主键id查询巡检点部分信息(开始巡检前调用) + String get findPointByPlanId => + '/butlerApp/user/inspection/findPointByPlanId'; + + ///根据巡检执行情况主键id查询巡检点部分信息(开始巡检后调用) + String get findPointByExecuteId => + '/butlerApp/user/inspection/findPointByExecuteId'; + + ///开始巡检 + String get startInspection => '/butlerApp/user/inspection/startInspection'; + + ///扫码二维码查询巡检执行点信息 + String get findCheckDetailByQR => + '/butlerApp/user/inspection/findCheckDetailByQR'; + + ///提交巡检执行点信息 + String get submit => '/butlerApp/user/inspection/submit'; + + ///查询巡检执行点信息(当前巡检执行项状态为【2.已巡检,3.巡检中】时调用) + String get findExecutePointInfo => + '/butlerApp/user/inspection/findExecutePointInfo'; + + ///查询计划巡检点信息(当前巡检执行计划状态为【1.待巡检,4.未巡检】时调用) + String get findPlanPointInfo => + '/butlerApp/user/inspection/findPlanPointInfo'; +} + +class _City { + ///查询所有的城市信息 + String get allCity => '/app/city/allCity'; +} + +class _User { + ///用户资料 + String get userProfile => '/app/user/findDetail'; + + ///设置密码(密码不存在时调用) + String get settingPsd => '/app/user/settingPassword'; + + ///提交修改的新密码(忘记密码) + String get settingForgotPsd => '/app/user/forgetPassword'; + + ///app用户发送手机号验证码(忘记密码) + String get sendForgotTelCode => '/app/user/sendTelCodeForgetPwd'; + + ///检测昵称是否重复 + String get checkNickRepeat => '/app/user/checkNickNameRepeat'; + + ///设置昵称 + String get setNickName => '/app/user/settingNickName'; + + ///实名认证 + String get certification => '/app/user/verified'; + + ///修改用户头像 + String get updateAvatar => '/app/user/updateAvatarImg'; +} diff --git a/lib/gen/assets.gen.dart b/lib/gen/assets.gen.dart new file mode 100644 index 0000000..2435521 --- /dev/null +++ b/lib/gen/assets.gen.dart @@ -0,0 +1,506 @@ +/// GENERATED CODE - DO NOT MODIFY BY HAND +/// ***************************************************** +/// FlutterGen +/// ***************************************************** + +// ignore_for_file: directives_ordering,unnecessary_import + +import 'package:flutter/widgets.dart'; + +class $AssetsHomeGen { + const $AssetsHomeGen(); + + /// File path: assets/home/app_alarm.png + AssetGenImage get appAlarm => + const AssetGenImage('assets/home/app_alarm.png'); + + /// File path: assets/home/bee_task.png + AssetGenImage get beeTask => const AssetGenImage('assets/home/bee_task.png'); + + /// File path: assets/home/clock_in_out.png + AssetGenImage get clockInOut => + const AssetGenImage('assets/home/clock_in_out.png'); + + /// File path: assets/home/device_alarm.png + AssetGenImage get deviceAlarm => + const AssetGenImage('assets/home/device_alarm.png'); + + /// File path: assets/home/facilities.png + AssetGenImage get facilities => + const AssetGenImage('assets/home/facilities.png'); + + /// File path: assets/home/fire_alarm.png + AssetGenImage get fireAlarm => + const AssetGenImage('assets/home/fire_alarm.png'); + + /// File path: assets/home/house_keeping.png + AssetGenImage get houseKeeping => + const AssetGenImage('assets/home/house_keeping.png'); + + /// File path: assets/home/hygienice.png + AssetGenImage get hygienice => + const AssetGenImage('assets/home/hygienice.png'); + + /// File path: assets/home/ic_Patrol.png + AssetGenImage get icPatrol => + const AssetGenImage('assets/home/ic_Patrol.png'); + + /// File path: assets/home/ic_activity.png + AssetGenImage get icActivity => + const AssetGenImage('assets/home/ic_activity.png'); + + /// File path: assets/home/ic_all.png + AssetGenImage get icAll => const AssetGenImage('assets/home/ic_all.png'); + + /// File path: assets/home/ic_article.png + AssetGenImage get icArticle => + const AssetGenImage('assets/home/ic_article.png'); + + /// File path: assets/home/ic_borrow.png + AssetGenImage get icBorrow => + const AssetGenImage('assets/home/ic_borrow.png'); + + /// File path: assets/home/ic_decoration.png + AssetGenImage get icDecoration => + const AssetGenImage('assets/home/ic_decoration.png'); + + /// File path: assets/home/ic_facilities.png + AssetGenImage get icFacilities => + const AssetGenImage('assets/home/ic_facilities.png'); + + /// File path: assets/home/ic_greening.png + AssetGenImage get icGreening => + const AssetGenImage('assets/home/ic_greening.png'); + + /// File path: assets/home/ic_news.png + AssetGenImage get icNews => const AssetGenImage('assets/home/ic_news.png'); + + /// File path: assets/home/ic_police.png + AssetGenImage get icPolice => + const AssetGenImage('assets/home/ic_police.png'); + + /// File path: assets/home/ic_scan.png + AssetGenImage get icScan => const AssetGenImage('assets/home/ic_scan.png'); + + /// File path: assets/home/ic_search.png + AssetGenImage get icSearch => + const AssetGenImage('assets/home/ic_search.png'); + + /// File path: assets/home/ic_service.png + AssetGenImage get icService => + const AssetGenImage('assets/home/ic_service.png'); + + /// File path: assets/home/ic_visitors.png + AssetGenImage get icVisitors => + const AssetGenImage('assets/home/ic_visitors.png'); + + /// File path: assets/home/interview.png + AssetGenImage get interview => + const AssetGenImage('assets/home/interview.png'); + + /// File path: assets/home/key.png + AssetGenImage get key => const AssetGenImage('assets/home/key.png'); + + /// File path: assets/home/nearby_pet.png + AssetGenImage get nearbyPet => + const AssetGenImage('assets/home/nearby_pet.png'); + + /// File path: assets/home/nearby_service.png + AssetGenImage get nearbyService => + const AssetGenImage('assets/home/nearby_service.png'); + + /// File path: assets/home/package.png + AssetGenImage get package => const AssetGenImage('assets/home/package.png'); + + /// File path: assets/home/provide_aged.png + AssetGenImage get provideAged => + const AssetGenImage('assets/home/provide_aged.png'); + + /// File path: assets/home/rules.png + AssetGenImage get rules => const AssetGenImage('assets/home/rules.png'); + + /// File path: assets/home/second_hand_market.png + AssetGenImage get secondHandMarket => + const AssetGenImage('assets/home/second_hand_market.png'); + + /// File path: assets/home/share_park.png + AssetGenImage get sharePark => + const AssetGenImage('assets/home/share_park.png'); + + /// File path: assets/home/shopping_mall.png + AssetGenImage get shoppingMall => + const AssetGenImage('assets/home/shopping_mall.png'); + + /// File path: assets/home/sos.png + AssetGenImage get sos => const AssetGenImage('assets/home/sos.png'); +} + +class $AssetsInspectionGen { + const $AssetsInspectionGen(); + + /// File path: assets/inspection/ic_date.png + AssetGenImage get icDate => + const AssetGenImage('assets/inspection/ic_date.png'); + + /// File path: assets/inspection/ic_inspection_name.png + AssetGenImage get icInspectionName => + const AssetGenImage('assets/inspection/ic_inspection_name.png'); + + /// File path: assets/inspection/ic_pattern.png + AssetGenImage get icPattern => + const AssetGenImage('assets/inspection/ic_pattern.png'); + + /// File path: assets/inspection/ic_station.png + AssetGenImage get icStation => + const AssetGenImage('assets/inspection/ic_station.png'); + + /// File path: assets/inspection/ic_way.png + AssetGenImage get icWay => + const AssetGenImage('assets/inspection/ic_way.png'); + + /// File path: assets/inspection/ic_xunjian.png + AssetGenImage get icXunjian => + const AssetGenImage('assets/inspection/ic_xunjian.png'); + + /// File path: assets/inspection/inspection_station.png + AssetGenImage get inspectionStation => + const AssetGenImage('assets/inspection/inspection_station.png'); +} + +class $AssetsManageGen { + const $AssetsManageGen(); + + /// File path: assets/manage/add.png + AssetGenImage get add => const AssetGenImage('assets/manage/add.png'); + + /// File path: assets/manage/address.png + AssetGenImage get address => const AssetGenImage('assets/manage/address.png'); + + /// File path: assets/manage/article.png + AssetGenImage get article => const AssetGenImage('assets/manage/article.png'); + + /// File path: assets/manage/borrow.png + AssetGenImage get borrow => const AssetGenImage('assets/manage/borrow.png'); + + /// File path: assets/manage/check.png + AssetGenImage get check => const AssetGenImage('assets/manage/check.png'); + + /// File path: assets/manage/circuit.png + AssetGenImage get circuit => const AssetGenImage('assets/manage/circuit.png'); + + /// File path: assets/manage/clock.png + AssetGenImage get clock => const AssetGenImage('assets/manage/clock.png'); + + /// File path: assets/manage/decoration.png + AssetGenImage get decoration => + const AssetGenImage('assets/manage/decoration.png'); + + /// File path: assets/manage/dingwei.png + AssetGenImage get dingwei => const AssetGenImage('assets/manage/dingwei.png'); + + /// File path: assets/manage/estate.png + AssetGenImage get estate => const AssetGenImage('assets/manage/estate.png'); + + /// File path: assets/manage/home.png + AssetGenImage get home => const AssetGenImage('assets/manage/home.png'); + + /// File path: assets/manage/ic_announce.png + AssetGenImage get icAnnounce => + const AssetGenImage('assets/manage/ic_announce.png'); + + /// File path: assets/manage/ic_car.png + AssetGenImage get icCar => const AssetGenImage('assets/manage/ic_car.png'); + + /// File path: assets/manage/ic_daofang.png + AssetGenImage get icDaofang => + const AssetGenImage('assets/manage/ic_daofang.png'); + + /// File path: assets/manage/ic_guoqi.png + AssetGenImage get icGuoqi => + const AssetGenImage('assets/manage/ic_guoqi.png'); + + /// File path: assets/manage/ic_image.png + AssetGenImage get icImage => + const AssetGenImage('assets/manage/ic_image.png'); + + /// File path: assets/manage/ic_renwu.png + AssetGenImage get icRenwu => + const AssetGenImage('assets/manage/ic_renwu.png'); + + /// File path: assets/manage/ic_time.png + AssetGenImage get icTime => const AssetGenImage('assets/manage/ic_time.png'); + + /// File path: assets/manage/ic_wancheng.png + AssetGenImage get icWancheng => + const AssetGenImage('assets/manage/ic_wancheng.png'); + + /// File path: assets/manage/ic_weidao.png + AssetGenImage get icWeidao => + const AssetGenImage('assets/manage/ic_weidao.png'); + + /// File path: assets/manage/ic_zhuangxiu.png + AssetGenImage get icZhuangxiu => + const AssetGenImage('assets/manage/ic_zhuangxiu.png'); + + /// File path: assets/manage/ic_zuofei.png + AssetGenImage get icZuofei => + const AssetGenImage('assets/manage/ic_zuofei.png'); + + /// File path: assets/manage/info.png + AssetGenImage get info => const AssetGenImage('assets/manage/info.png'); + + /// File path: assets/manage/key.png + AssetGenImage get key => const AssetGenImage('assets/manage/key.png'); + + /// File path: assets/manage/location.png + AssetGenImage get location => + const AssetGenImage('assets/manage/location.png'); + + /// File path: assets/manage/lock.png + AssetGenImage get lock => const AssetGenImage('assets/manage/lock.png'); + + /// File path: assets/manage/police.png + AssetGenImage get police => const AssetGenImage('assets/manage/police.png'); + + /// File path: assets/manage/remaining.png + AssetGenImage get remaining => + const AssetGenImage('assets/manage/remaining.png'); + + /// File path: assets/manage/security.png + AssetGenImage get security => + const AssetGenImage('assets/manage/security.png'); + + /// File path: assets/manage/status.png + AssetGenImage get status => const AssetGenImage('assets/manage/status.png'); + + /// File path: assets/manage/submit_success.png + AssetGenImage get submitSuccess => + const AssetGenImage('assets/manage/submit_success.png'); + + /// File path: assets/manage/wall.png + AssetGenImage get wall => const AssetGenImage('assets/manage/wall.png'); + + /// File path: assets/manage/warning.png + AssetGenImage get warning => const AssetGenImage('assets/manage/warning.png'); + + /// File path: assets/manage/waterway.png + AssetGenImage get waterway => + const AssetGenImage('assets/manage/waterway.png'); + + /// File path: assets/manage/window.png + AssetGenImage get window => const AssetGenImage('assets/manage/window.png'); +} + +class $AssetsMessageGen { + const $AssetsMessageGen(); + + /// File path: assets/message/ic_area.png + AssetGenImage get icArea => const AssetGenImage('assets/message/ic_area.png'); + + /// File path: assets/message/ic_people.png + AssetGenImage get icPeople => + const AssetGenImage('assets/message/ic_people.png'); + + /// File path: assets/message/ic_phone.png + AssetGenImage get icPhone => + const AssetGenImage('assets/message/ic_phone.png'); + + /// File path: assets/message/ic_pinglun.png + AssetGenImage get icPinglun => + const AssetGenImage('assets/message/ic_pinglun.png'); + + /// File path: assets/message/ic_star.png + AssetGenImage get icStar => const AssetGenImage('assets/message/ic_star.png'); + + /// File path: assets/message/ic_tongzhi.png + AssetGenImage get icTongzhi => + const AssetGenImage('assets/message/ic_tongzhi.png'); +} + +class $AssetsOutdoorGen { + const $AssetsOutdoorGen(); + + /// File path: assets/outdoor/ic_address.png + AssetGenImage get icAddress => + const AssetGenImage('assets/outdoor/ic_address.png'); + + /// File path: assets/outdoor/ic_chuhu.png + AssetGenImage get icChuhu => + const AssetGenImage('assets/outdoor/ic_chuhu.png'); + + /// File path: assets/outdoor/ic_goout.png + AssetGenImage get icGoout => + const AssetGenImage('assets/outdoor/ic_goout.png'); + + /// File path: assets/outdoor/ic_home.png + AssetGenImage get icHome => const AssetGenImage('assets/outdoor/ic_home.png'); + + /// File path: assets/outdoor/ic_image.png + AssetGenImage get icImage => + const AssetGenImage('assets/outdoor/ic_image.png'); + + /// File path: assets/outdoor/ic_people.png + AssetGenImage get icPeople => + const AssetGenImage('assets/outdoor/ic_people.png'); + + /// File path: assets/outdoor/ic_phoneblue.png + AssetGenImage get icPhoneblue => + const AssetGenImage('assets/outdoor/ic_phoneblue.png'); + + /// File path: assets/outdoor/ic_time.png + AssetGenImage get icTime => const AssetGenImage('assets/outdoor/ic_time.png'); + + /// File path: assets/outdoor/ic_transport.png + AssetGenImage get icTransport => + const AssetGenImage('assets/outdoor/ic_transport.png'); + + /// File path: assets/outdoor/ic_weight.png + AssetGenImage get icWeight => + const AssetGenImage('assets/outdoor/ic_weight.png'); + + /// File path: assets/outdoor/item2.png + AssetGenImage get item2 => const AssetGenImage('assets/outdoor/item2.png'); + + /// File path: assets/outdoor/item3.png + AssetGenImage get item3 => const AssetGenImage('assets/outdoor/item3.png'); + + /// File path: assets/outdoor/itme1.png + AssetGenImage get itme1 => const AssetGenImage('assets/outdoor/itme1.png'); +} + +class $AssetsStaticFixGen { + const $AssetsStaticFixGen(); + + /// File path: assets/static_fix/air1.png + AssetGenImage get air1 => const AssetGenImage('assets/static_fix/air1.png'); + + /// File path: assets/static_fix/air2.png + AssetGenImage get air2 => const AssetGenImage('assets/static_fix/air2.png'); + + /// File path: assets/static_fix/food.png + AssetGenImage get food => const AssetGenImage('assets/static_fix/food.png'); + + /// File path: assets/static_fix/food2.png + AssetGenImage get food2 => const AssetGenImage('assets/static_fix/food2.png'); + + /// File path: assets/static_fix/light1.png + AssetGenImage get light1 => + const AssetGenImage('assets/static_fix/light1.png'); + + /// File path: assets/static_fix/light2.png + AssetGenImage get light2 => + const AssetGenImage('assets/static_fix/light2.png'); + + /// File path: assets/static_fix/light3.png + AssetGenImage get light3 => + const AssetGenImage('assets/static_fix/light3.png'); +} + +class $AssetsStaticTempGen { + const $AssetsStaticTempGen(); + + /// File path: assets/static_temp/drill.png + AssetGenImage get drill => + const AssetGenImage('assets/static_temp/drill.png'); + + /// File path: assets/static_temp/f1.webp + AssetGenImage get f1 => const AssetGenImage('assets/static_temp/f1.webp'); + + /// File path: assets/static_temp/f2.webp + AssetGenImage get f2 => const AssetGenImage('assets/static_temp/f2.webp'); + + /// File path: assets/static_temp/f3.webp + AssetGenImage get f3 => const AssetGenImage('assets/static_temp/f3.webp'); + + /// File path: assets/static_temp/f4.webp + AssetGenImage get f4 => const AssetGenImage('assets/static_temp/f4.webp'); + + /// File path: assets/static_temp/f5.webp + AssetGenImage get f5 => const AssetGenImage('assets/static_temp/f5.webp'); + + /// File path: assets/static_temp/hammer.png + AssetGenImage get hammer => + const AssetGenImage('assets/static_temp/hammer.png'); + + /// File path: assets/static_temp/ladder.png + AssetGenImage get ladder => + const AssetGenImage('assets/static_temp/ladder.png'); +} + +class $AssetsUserGen { + const $AssetsUserGen(); + + /// File path: assets/user/ic_kefu.png + AssetGenImage get icKefu => const AssetGenImage('assets/user/ic_kefu.png'); + + /// File path: assets/user/ic_person.png + AssetGenImage get icPerson => + const AssetGenImage('assets/user/ic_person.png'); + + /// File path: assets/user/ic_setup.png + AssetGenImage get icSetup => const AssetGenImage('assets/user/ic_setup.png'); +} + +class Assets { + Assets._(); + + static const $AssetsHomeGen home = $AssetsHomeGen(); + static const $AssetsInspectionGen inspection = $AssetsInspectionGen(); + static const $AssetsManageGen manage = $AssetsManageGen(); + static const $AssetsMessageGen message = $AssetsMessageGen(); + static const $AssetsOutdoorGen outdoor = $AssetsOutdoorGen(); + static const AssetGenImage placeholder = + AssetGenImage('assets/placeholder.webp'); + static const $AssetsStaticFixGen staticFix = $AssetsStaticFixGen(); + static const $AssetsStaticTempGen staticTemp = $AssetsStaticTempGen(); + static const $AssetsUserGen user = $AssetsUserGen(); +} + +class AssetGenImage extends AssetImage { + const AssetGenImage(String assetName) : super(assetName); + + Image image({ + Key? key, + ImageFrameBuilder? frameBuilder, + ImageLoadingBuilder? loadingBuilder, + ImageErrorWidgetBuilder? errorBuilder, + String? semanticLabel, + bool excludeFromSemantics = false, + double? width, + double? height, + Color? color, + BlendMode? colorBlendMode, + BoxFit? fit, + AlignmentGeometry alignment = Alignment.center, + ImageRepeat repeat = ImageRepeat.noRepeat, + Rect? centerSlice, + bool matchTextDirection = false, + bool gaplessPlayback = false, + bool isAntiAlias = false, + FilterQuality filterQuality = FilterQuality.low, + }) { + return Image( + key: key, + image: this, + frameBuilder: frameBuilder, + loadingBuilder: loadingBuilder, + errorBuilder: errorBuilder, + semanticLabel: semanticLabel, + excludeFromSemantics: excludeFromSemantics, + width: width, + height: height, + color: color, + colorBlendMode: colorBlendMode, + fit: fit, + alignment: alignment, + repeat: repeat, + centerSlice: centerSlice, + matchTextDirection: matchTextDirection, + gaplessPlayback: gaplessPlayback, + isAntiAlias: isAntiAlias, + filterQuality: filterQuality, + ); + } + + String get path => assetName; +} diff --git a/lib/gen/fonts.gen.dart b/lib/gen/fonts.gen.dart new file mode 100644 index 0000000..69d5c31 --- /dev/null +++ b/lib/gen/fonts.gen.dart @@ -0,0 +1,13 @@ +/// GENERATED CODE - DO NOT MODIFY BY HAND +/// ***************************************************** +/// FlutterGen +/// ***************************************************** + +// ignore_for_file: directives_ordering,unnecessary_import + +class FontFamily { + FontFamily._(); + + /// Font family: Bebas + static const String bebas = 'Bebas'; +} diff --git a/lib/json_models/clock_in_out/today_clock_record_model.g.dart b/lib/json_models/clock_in_out/today_clock_record_model.g.dart index 4365faf..90257b4 100644 --- a/lib/json_models/clock_in_out/today_clock_record_model.g.dart +++ b/lib/json_models/clock_in_out/today_clock_record_model.g.dart @@ -7,20 +7,19 @@ part of 'today_clock_record_model.dart'; // ************************************************************************** TodayClockRecordModel _$TodayClockRecordModelFromJson( - Map json) { - return TodayClockRecordModel( - id: json['id'] as int, - startClockDate: json['startClockDate'] as String?, - endClockDate: json['endClockDate'] as String?, - cardReplacementDate: json['cardReplacementDate'] as String?, - operatorName: json['operatorName'] as String?, - clockName: json['clockName'] as String, - clockTel: json['clockTel'] as String, - createDate: json['createDate'] as String, - status: json['status'] as int, - firstTimeStart: json['firstTimeStart'] as String?, - firstTimeEnd: json['firstTimeEnd'] as String?, - secondTimeStart: json['secondTimeStart'] as String?, - secondTimeEnd: json['secondTimeEnd'] as String?, - ); -} + Map json) => + TodayClockRecordModel( + id: json['id'] as int, + startClockDate: json['startClockDate'] as String?, + endClockDate: json['endClockDate'] as String?, + cardReplacementDate: json['cardReplacementDate'] as String?, + operatorName: json['operatorName'] as String?, + clockName: json['clockName'] as String, + clockTel: json['clockTel'] as String, + createDate: json['createDate'] as String, + status: json['status'] as int, + firstTimeStart: json['firstTimeStart'] as String?, + firstTimeEnd: json['firstTimeEnd'] as String?, + secondTimeStart: json['secondTimeStart'] as String?, + secondTimeEnd: json['secondTimeEnd'] as String?, + ); diff --git a/lib/json_models/manager/engineer_repair/engineer_repair_detail_model.g.dart b/lib/json_models/manager/engineer_repair/engineer_repair_detail_model.g.dart index f0d44a2..5203495 100644 --- a/lib/json_models/manager/engineer_repair/engineer_repair_detail_model.g.dart +++ b/lib/json_models/manager/engineer_repair/engineer_repair_detail_model.g.dart @@ -7,33 +7,32 @@ part of 'engineer_repair_detail_model.dart'; // ************************************************************************** EngineerRepairDetailModel _$EngineerRepairDetailModelFromJson( - Map json) { - return EngineerRepairDetailModel( - json['id'] as int, - json['createName'] as String, - json['createTel'] as String, - json['repairArea'] as String, - json['code'] as String, - json['type'] as int, - json['reportDetail'] as String, - json['status'] as int, - json['organizationId'] as int?, - json['organizationName'] as String?, - json['organizationLeadingName'] as String?, - json['organizationLeadingTel'] as String?, - json['maintenanceStaff'] as int?, - json['maintenanceStaffOrganizationName'] as String?, - json['maintenanceStaffName'] as String?, - json['maintenanceStaffTel'] as String?, - json['maintenanceStaffPickSingleDate'] as String?, - json['maintenanceCompanySendSingle'] as int?, - json['maintenanceCompanySendSingleDate'] as String?, - json['maintenancePersonnelSendSingle'] as int?, - json['maintenancePersonnelSendSingleDate'] as String?, - (json['imgUrls'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - json['createId'] as int, - json['createDate'] as String, - ); -} + Map json) => + EngineerRepairDetailModel( + json['id'] as int, + json['createName'] as String, + json['createTel'] as String, + json['repairArea'] as String, + json['code'] as String, + json['type'] as int, + json['reportDetail'] as String, + json['status'] as int, + json['organizationId'] as int?, + json['organizationName'] as String?, + json['organizationLeadingName'] as String?, + json['organizationLeadingTel'] as String?, + json['maintenanceStaff'] as int?, + json['maintenanceStaffOrganizationName'] as String?, + json['maintenanceStaffName'] as String?, + json['maintenanceStaffTel'] as String?, + json['maintenanceStaffPickSingleDate'] as String?, + json['maintenanceCompanySendSingle'] as int?, + json['maintenanceCompanySendSingleDate'] as String?, + json['maintenancePersonnelSendSingle'] as int?, + json['maintenancePersonnelSendSingleDate'] as String?, + (json['imgUrls'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + json['createId'] as int, + json['createDate'] as String, + ); diff --git a/lib/json_models/manager/engineer_repair/engineer_repair_list_model.g.dart b/lib/json_models/manager/engineer_repair/engineer_repair_list_model.g.dart index b3d6a74..419e4ce 100644 --- a/lib/json_models/manager/engineer_repair/engineer_repair_list_model.g.dart +++ b/lib/json_models/manager/engineer_repair/engineer_repair_list_model.g.dart @@ -7,16 +7,15 @@ part of 'engineer_repair_list_model.dart'; // ************************************************************************** EngineerRepairListModel _$EngineerRepairListModelFromJson( - Map json) { - return EngineerRepairListModel( - id: json['id'] as int, - code: json['code'] as String, - type: json['type'] as int, - reportDetail: json['reportDetail'] as String, - status: json['status'] as int, - imgUrls: (json['imgUrls'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - createDate: json['createDate'] as String, - ); -} + Map json) => + EngineerRepairListModel( + id: json['id'] as int, + code: json['code'] as String, + type: json['type'] as int, + reportDetail: json['reportDetail'] as String, + status: json['status'] as int, + imgUrls: (json['imgUrls'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + createDate: json['createDate'] as String, + ); diff --git a/lib/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.g.dart b/lib/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.g.dart index c683d40..7262d70 100644 --- a/lib/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.g.dart +++ b/lib/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.g.dart @@ -8,24 +8,23 @@ part of 'engineer_repair_new_acceptance_record_model.dart'; EngineerRepairNewAcceptanceRecordModel _$EngineerRepairNewAcceptanceRecordModelFromJson( - Map json) { - return EngineerRepairNewAcceptanceRecordModel( - json['id'] as int, - json['repairEngineeringId'] as int, - json['content'] as String?, - json['billMaterials'] as String?, - (json['maintenanceImgLists'] as List?) - ?.map((e) => ImgModel.fromJson(e as Map)) - .toList(), - json['createName'] as String, - json['createDate'] as String, - json['results'] as int, - json['advice'] as String, - json['acceptancePeople'] as int, - json['acceptancePeopleName'] as String, - json['acceptanceDate'] as String, - (json['acceptanceImgLists'] as List?) - ?.map((e) => ImgModel.fromJson(e as Map)) - .toList(), - ); -} + Map json) => + EngineerRepairNewAcceptanceRecordModel( + json['id'] as int, + json['repairEngineeringId'] as int, + json['content'] as String?, + json['billMaterials'] as String?, + (json['maintenanceImgLists'] as List?) + ?.map((e) => ImgModel.fromJson(e as Map)) + .toList(), + json['createName'] as String, + json['createDate'] as String, + json['results'] as int, + json['advice'] as String, + json['acceptancePeople'] as int, + json['acceptancePeopleName'] as String, + json['acceptanceDate'] as String, + (json['acceptanceImgLists'] as List?) + ?.map((e) => ImgModel.fromJson(e as Map)) + .toList(), + ); diff --git a/lib/json_models/manager/engineer_repair/engineer_repair_organization_model.g.dart b/lib/json_models/manager/engineer_repair/engineer_repair_organization_model.g.dart index a9a1650..8abb928 100644 --- a/lib/json_models/manager/engineer_repair/engineer_repair_organization_model.g.dart +++ b/lib/json_models/manager/engineer_repair/engineer_repair_organization_model.g.dart @@ -7,20 +7,19 @@ part of 'engineer_repair_organization_model.dart'; // ************************************************************************** EngineerRepairOrganizationModel _$EngineerRepairOrganizationModelFromJson( - Map json) { - return EngineerRepairOrganizationModel( - json['id'] as int, - json['name'] as String, - json['code'] as String?, - json['parentId'] as int, - json['leadingId'] as int?, - json['status'] as int, - json['sort'] as int, - json['remake'] as String?, - json['categoryId'] as int, - json['createId'] as int, - json['createDate'] as String, - json['modifyId'] as int?, - json['modifyDate'] as String?, - ); -} + Map json) => + EngineerRepairOrganizationModel( + json['id'] as int, + json['name'] as String, + json['code'] as String?, + json['parentId'] as int, + json['leadingId'] as int?, + json['status'] as int, + json['sort'] as int, + json['remake'] as String?, + json['categoryId'] as int, + json['createId'] as int, + json['createDate'] as String, + json['modifyId'] as int?, + json['modifyDate'] as String?, + ); diff --git a/lib/json_models/manager/engineer_repair/engineer_repair_person_model.g.dart b/lib/json_models/manager/engineer_repair/engineer_repair_person_model.g.dart index 800939d..d81ba55 100644 --- a/lib/json_models/manager/engineer_repair/engineer_repair_person_model.g.dart +++ b/lib/json_models/manager/engineer_repair/engineer_repair_person_model.g.dart @@ -7,35 +7,34 @@ part of 'engineer_repair_person_model.dart'; // ************************************************************************** EngineerRepairPersonModel _$EngineerRepairPersonModelFromJson( - Map json) { - return EngineerRepairPersonModel( - json['id'] as int, - json['userName'] as String?, - json['pwd'] as String?, - json['actualName'] as String, - json['tel'] as String, - json['sex'] as int?, - json['userCode'] as String?, - json['birthday'] as String?, - json['email'] as String?, - json['idCard'] as String?, - json['organizationId'] as int?, - json['organizationPath'] as String?, - json['positionId'] as int?, - json['roleId'] as int?, - json['status'] as int?, - json['isDelete'] as int?, - json['createId'] as int?, - json['createDate'] as String?, - json['modifyId'] as int?, - json['modifyDate'] as String?, - json['lastLoginIp'] as int?, - json['lastLoginDate'] as String?, - json['nickName'] as String?, - json['code'] as String?, - json['codeSendDate'] as String?, - json['remake'] as String?, - json['reportTo'] as int?, - json['entryDate'] as String?, - ); -} + Map json) => + EngineerRepairPersonModel( + json['id'] as int, + json['userName'] as String?, + json['pwd'] as String?, + json['actualName'] as String, + json['tel'] as String, + json['sex'] as int?, + json['userCode'] as String?, + json['birthday'] as String?, + json['email'] as String?, + json['idCard'] as String?, + json['organizationId'] as int?, + json['organizationPath'] as String?, + json['positionId'] as int?, + json['roleId'] as int?, + json['status'] as int?, + json['isDelete'] as int?, + json['createId'] as int?, + json['createDate'] as String?, + json['modifyId'] as int?, + json['modifyDate'] as String?, + json['lastLoginIp'] as int?, + json['lastLoginDate'] as String?, + json['nickName'] as String?, + json['code'] as String?, + json['codeSendDate'] as String?, + json['remake'] as String?, + json['reportTo'] as int?, + json['entryDate'] as String?, + ); diff --git a/lib/json_models/manager/engineer_repair/engineer_repair_process_model.g.dart b/lib/json_models/manager/engineer_repair/engineer_repair_process_model.g.dart index 57773e4..68d6b07 100644 --- a/lib/json_models/manager/engineer_repair/engineer_repair_process_model.g.dart +++ b/lib/json_models/manager/engineer_repair/engineer_repair_process_model.g.dart @@ -7,14 +7,13 @@ part of 'engineer_repair_process_model.dart'; // ************************************************************************** EngineerRepairProcessModel _$EngineerRepairProcessModelFromJson( - Map json) { - return EngineerRepairProcessModel( - json['id'] as int, - json['repairEngineeringId'] as int, - json['operationDate'] as String, - json['operationType'] as int, - json['operator'] as int, - json['operatorType'] as int, - json['operatorContent'] as String, - ); -} + Map json) => + EngineerRepairProcessModel( + json['id'] as int, + json['repairEngineeringId'] as int, + json['operationDate'] as String, + json['operationType'] as int, + json['operator'] as int, + json['operatorType'] as int, + json['operatorContent'] as String, + ); diff --git a/lib/json_models/manager/engineer_repair/engineer_repair_result_model.g.dart b/lib/json_models/manager/engineer_repair/engineer_repair_result_model.g.dart index 459c802..06eec7c 100644 --- a/lib/json_models/manager/engineer_repair/engineer_repair_result_model.g.dart +++ b/lib/json_models/manager/engineer_repair/engineer_repair_result_model.g.dart @@ -7,16 +7,15 @@ part of 'engineer_repair_result_model.dart'; // ************************************************************************** EngineerRepairResultModel _$EngineerRepairResultModelFromJson( - Map json) { - return EngineerRepairResultModel( - json['id'] as int, - json['repairEngineeringId'] as int, - json['content'] as String?, - json['billMaterials'] as String?, - (json['maintenanceImgLists'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - json['createName'] as String, - json['createDate'] as String, - ); -} + Map json) => + EngineerRepairResultModel( + json['id'] as int, + json['repairEngineeringId'] as int, + json['content'] as String?, + json['billMaterials'] as String?, + (json['maintenanceImgLists'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + json['createName'] as String, + json['createDate'] as String, + ); diff --git a/lib/json_models/manager/engineer_repair/engineer_repair_work_report_model.g.dart b/lib/json_models/manager/engineer_repair/engineer_repair_work_report_model.g.dart index a4ba099..f569da5 100644 --- a/lib/json_models/manager/engineer_repair/engineer_repair_work_report_model.g.dart +++ b/lib/json_models/manager/engineer_repair/engineer_repair_work_report_model.g.dart @@ -7,16 +7,15 @@ part of 'engineer_repair_work_report_model.dart'; // ************************************************************************** EngineerRepairWorkReportModel _$EngineerRepairWorkReportModelFromJson( - Map json) { - return EngineerRepairWorkReportModel( - json['id'] as int, - json['repairEngineeringId'] as int, - json['content'] as String, - json['createId'] as int, - json['createName'] as String, - json['createDate'] as String, - (json['workReportImgLists'] as List?) - ?.map((e) => ImgModel.fromJson(e as Map)) - .toList(), - ); -} + Map json) => + EngineerRepairWorkReportModel( + json['id'] as int, + json['repairEngineeringId'] as int, + json['content'] as String, + json['createId'] as int, + json['createName'] as String, + json['createDate'] as String, + (json['workReportImgLists'] as List?) + ?.map((e) => ImgModel.fromJson(e as Map)) + .toList(), + ); diff --git a/lib/json_models/manager/house_keeping/house_keeping_list_model.g.dart b/lib/json_models/manager/house_keeping/house_keeping_list_model.g.dart index 320043f..d572e67 100644 --- a/lib/json_models/manager/house_keeping/house_keeping_list_model.g.dart +++ b/lib/json_models/manager/house_keeping/house_keeping_list_model.g.dart @@ -7,33 +7,32 @@ part of 'house_keeping_list_model.dart'; // ************************************************************************** HouseKeepingListModel _$HouseKeepingListModelFromJson( - Map json) { - return HouseKeepingListModel( - id: json['id'] as int, - proposerName: json['proposerName'] as String, - proposerTel: json['proposerTel'] as String, - roomName: json['roomName'] as String, - type: json['type'] as int, - content: json['content'] as String, - status: json['status'] as int, - completion: json['completion'] as int?, - handlerName: json['handlerName'] as String?, - handlerTel: json['handlerTel'] as String?, - processDescription: json['processDescription'] as String?, - handlingTime: json['handlingTime'] as String?, - handlerImgList: (json['handlerImgList'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - payFee: json['payFee'] as num?, - evaluation: json['evaluation'] as int?, - evaluationContent: json['evaluationContent'] as String?, - evaluationTime: json['evaluationTime'] as String?, - evaluationImgList: (json['evaluationImgList'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - createDate: json['createDate'] as String, - submitImgList: (json['submitImgList'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - ); -} + Map json) => + HouseKeepingListModel( + id: json['id'] as int, + proposerName: json['proposerName'] as String, + proposerTel: json['proposerTel'] as String, + roomName: json['roomName'] as String, + type: json['type'] as int, + content: json['content'] as String, + status: json['status'] as int, + completion: json['completion'] as int?, + handlerName: json['handlerName'] as String?, + handlerTel: json['handlerTel'] as String?, + processDescription: json['processDescription'] as String?, + handlingTime: json['handlingTime'] as String?, + handlerImgList: (json['handlerImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + payFee: json['payFee'] as num?, + evaluation: json['evaluation'] as int?, + evaluationContent: json['evaluationContent'] as String?, + evaluationTime: json['evaluationTime'] as String?, + evaluationImgList: (json['evaluationImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + createDate: json['createDate'] as String, + submitImgList: (json['submitImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + ); diff --git a/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.g.dart b/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.g.dart index 8a34519..276cbaa 100644 --- a/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.g.dart +++ b/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.g.dart @@ -7,35 +7,34 @@ part of 'house_keeping_pick_staff_model.dart'; // ************************************************************************** HouseKeepingPickStaffModel _$HouseKeepingPickStaffModelFromJson( - Map json) { - return HouseKeepingPickStaffModel( - id: json['id'] as int, - userName: json['userName'] as String?, - pwd: json['pwd'] as String?, - actualName: json['actualName'] as String, - tel: json['tel'] as String, - sex: json['sex'] as int?, - userCode: json['userCode'] as String?, - birthday: json['birthday'] as String?, - email: json['email'] as String?, - idCard: json['idCard'] as String?, - organizationId: json['organizationId'] as int?, - organizationIdPath: json['organizationIdPath'] as String?, - positionId: json['positionId'] as int?, - roleId: json['roleId'] as int?, - status: json['status'] as int?, - isDelete: json['isDelete'] as int?, - createId: json['createId'] as int?, - createDate: json['createDate'] as String?, - modifyId: json['modifyId'] as int?, - modifyDate: json['modifyDate'] as String?, - lastLoginIp: json['lastLoginIp'] as String?, - lastLoginDate: json['lastLoginDate'] as String?, - nickName: json['nickName'] as String?, - code: json['code'] as String?, - codeSendDate: json['codeSendDate'] as String?, - remake: json['remake'] as String?, - reportTo: json['reportTo'] as String?, - entryDate: json['entryDate'] as String?, - ); -} + Map json) => + HouseKeepingPickStaffModel( + id: json['id'] as int, + userName: json['userName'] as String?, + pwd: json['pwd'] as String?, + actualName: json['actualName'] as String, + tel: json['tel'] as String, + sex: json['sex'] as int?, + userCode: json['userCode'] as String?, + birthday: json['birthday'] as String?, + email: json['email'] as String?, + idCard: json['idCard'] as String?, + organizationId: json['organizationId'] as int?, + organizationIdPath: json['organizationIdPath'] as String?, + positionId: json['positionId'] as int?, + roleId: json['roleId'] as int?, + status: json['status'] as int?, + isDelete: json['isDelete'] as int?, + createId: json['createId'] as int?, + createDate: json['createDate'] as String?, + modifyId: json['modifyId'] as int?, + modifyDate: json['modifyDate'] as String?, + lastLoginIp: json['lastLoginIp'] as String?, + lastLoginDate: json['lastLoginDate'] as String?, + nickName: json['nickName'] as String?, + code: json['code'] as String?, + codeSendDate: json['codeSendDate'] as String?, + remake: json['remake'] as String?, + reportTo: json['reportTo'] as String?, + entryDate: json['entryDate'] as String?, + ); diff --git a/lib/json_models/manager/house_keeping/house_keeping_process_model.g.dart b/lib/json_models/manager/house_keeping/house_keeping_process_model.g.dart index f746283..29df772 100644 --- a/lib/json_models/manager/house_keeping/house_keeping_process_model.g.dart +++ b/lib/json_models/manager/house_keeping/house_keeping_process_model.g.dart @@ -7,14 +7,13 @@ part of 'house_keeping_process_model.dart'; // ************************************************************************** HouseKeepingProcessModel _$HouseKeepingProcessModelFromJson( - Map json) { - return HouseKeepingProcessModel( - id: json['id'] as int, - housekeepingServiceId: json['housekeepingServiceId'] as int, - operationDate: json['operationDate'] as String, - operationType: json['operationType'] as int, - opName: json['operator'] as int, - operatorType: json['operatorType'] as int, - operatorContent: json['operatorContent'] as String, - ); -} + Map json) => + HouseKeepingProcessModel( + id: json['id'] as int, + housekeepingServiceId: json['housekeepingServiceId'] as int, + operationDate: json['operationDate'] as String, + operationType: json['operationType'] as int, + opName: json['operator'] as int, + operatorType: json['operatorType'] as int, + operatorContent: json['operatorContent'] as String, + ); diff --git a/lib/json_models/manager/key_manage/key_manage_record_list_model.g.dart b/lib/json_models/manager/key_manage/key_manage_record_list_model.g.dart index 2184f1b..b1f19c3 100644 --- a/lib/json_models/manager/key_manage/key_manage_record_list_model.g.dart +++ b/lib/json_models/manager/key_manage/key_manage_record_list_model.g.dart @@ -7,17 +7,16 @@ part of 'key_manage_record_list_model.dart'; // ************************************************************************** KeyManageRecordListModel _$KeyManageRecordListModelFromJson( - Map json) { - return KeyManageRecordListModel( - id: json['id'] as int, - code: json['code'] as String, - status: json['status'] as int, - facilityName: json['facilityName'] as String?, - correspondingPosition: json['correspondingPosition'] as String?, - storageLocation: json['storageLocation'] as String?, - auditDate: json['auditDate'] as String?, - reason: json['reason'] as String?, - returnAuditDate: json['returnAuditDate'] as String?, - returnReason: json['returnReason'] as String?, - ); -} + Map json) => + KeyManageRecordListModel( + id: json['id'] as int, + code: json['code'] as String, + status: json['status'] as int, + facilityName: json['facilityName'] as String?, + correspondingPosition: json['correspondingPosition'] as String?, + storageLocation: json['storageLocation'] as String?, + auditDate: json['auditDate'] as String?, + reason: json['reason'] as String?, + returnAuditDate: json['returnAuditDate'] as String?, + returnReason: json['returnReason'] as String?, + ); diff --git a/lib/json_models/message/system_message_green_model.g.dart b/lib/json_models/message/system_message_green_model.g.dart index 9f69155..aae903b 100644 --- a/lib/json_models/message/system_message_green_model.g.dart +++ b/lib/json_models/message/system_message_green_model.g.dart @@ -7,11 +7,10 @@ part of 'system_message_green_model.dart'; // ************************************************************************** SystemMessageGreenModel _$SystemMessageGreenModelFromJson( - Map json) { - return SystemMessageGreenModel( - id: json['id'] as int, - name: json['name'] as String, - tel: json['tel'] as String, - areaName: json['areaName'] as String, - ); -} + Map json) => + SystemMessageGreenModel( + id: json['id'] as int, + name: json['name'] as String, + tel: json['tel'] as String, + areaName: json['areaName'] as String, + ); diff --git a/lib/json_models/message/system_message_house_keeping_model.g.dart b/lib/json_models/message/system_message_house_keeping_model.g.dart index 261225b..e035f35 100644 --- a/lib/json_models/message/system_message_house_keeping_model.g.dart +++ b/lib/json_models/message/system_message_house_keeping_model.g.dart @@ -7,33 +7,32 @@ part of 'system_message_house_keeping_model.dart'; // ************************************************************************** SystemMessageHouseKeepingModel _$SystemMessageHouseKeepingModelFromJson( - Map json) { - return SystemMessageHouseKeepingModel( - id: json['id'] as int, - proposerName: json['proposerName'] as String, - proposerTel: json['proposerTel'] as String, - roomName: json['roomName'] as String, - type: json['type'] as int, - content: json['content'] as String, - status: json['status'] as int, - completion: json['completion'] as int?, - handlerName: json['handlerName'] as String?, - handlerTel: json['handlerTel'] as String?, - processDescription: json['processDescription'] as String?, - handlingTime: json['handlingTime'] as String?, - handlerImgList: (json['handlerImgList'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - payFee: json['payFee'] as num?, - evaluation: json['evaluation'] as int?, - evaluationContent: json['evaluationContent'] as String?, - evaluationTime: json['evaluationTime'] as String?, - evaluationImgList: (json['evaluationImgList'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - createDate: json['createDate'] as String, - submitImgList: (json['submitImgList'] as List) - .map((e) => ImgModel.fromJson(e as Map)) - .toList(), - ); -} + Map json) => + SystemMessageHouseKeepingModel( + id: json['id'] as int, + proposerName: json['proposerName'] as String, + proposerTel: json['proposerTel'] as String, + roomName: json['roomName'] as String, + type: json['type'] as int, + content: json['content'] as String, + status: json['status'] as int, + completion: json['completion'] as int?, + handlerName: json['handlerName'] as String?, + handlerTel: json['handlerTel'] as String?, + processDescription: json['processDescription'] as String?, + handlingTime: json['handlingTime'] as String?, + handlerImgList: (json['handlerImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + payFee: json['payFee'] as num?, + evaluation: json['evaluation'] as int?, + evaluationContent: json['evaluationContent'] as String?, + evaluationTime: json['evaluationTime'] as String?, + evaluationImgList: (json['evaluationImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + createDate: json['createDate'] as String, + submitImgList: (json['submitImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + ); diff --git a/lib/json_models/message/system_message_hygience_model.g.dart b/lib/json_models/message/system_message_hygience_model.g.dart index 76748a2..5e6c79c 100644 --- a/lib/json_models/message/system_message_hygience_model.g.dart +++ b/lib/json_models/message/system_message_hygience_model.g.dart @@ -7,11 +7,10 @@ part of 'system_message_hygience_model.dart'; // ************************************************************************** SystemMessageHygineceModel _$SystemMessageHygineceModelFromJson( - Map json) { - return SystemMessageHygineceModel( - id: json['id'] as int, - name: json['name'] as String, - tel: json['tel'] as String, - areaName: json['areaName'] as String, - ); -} + Map json) => + SystemMessageHygineceModel( + id: json['id'] as int, + name: json['name'] as String, + tel: json['tel'] as String, + areaName: json['areaName'] as String, + ); diff --git a/lib/models/user/user_info_model.dart b/lib/models/user/user_info_model.dart index 17956de..039088f 100644 --- a/lib/models/user/user_info_model.dart +++ b/lib/models/user/user_info_model.dart @@ -24,7 +24,8 @@ enum ERAUTH { HIDE } -class UserInfoModel { +@Deprecated('逐步删除') +class UserInformationModel { int? id; String? roleId; String? nickName; @@ -77,10 +78,10 @@ class UserInfoModel { } } - UserInfoModel( + UserInformationModel( {required this.id, this.roleId, this.nickName, this.jurisdiction}); - UserInfoModel.fromJson(Map json) { + UserInformationModel.fromJson(Map json) { id = json['id']; roleId = json['roleId']; nickName = json['nickName']; diff --git a/lib/models/user/user_profile_model.dart b/lib/models/user/user_profile_model.dart index 69be722..30da172 100644 --- a/lib/models/user/user_profile_model.dart +++ b/lib/models/user/user_profile_model.dart @@ -1,6 +1,7 @@ // Project imports: import 'package:aku_new_community_manager/models/common/img_model.dart'; +@Deprecated('逐步删除') class UserProfileModel { int? id; List? imgUrls; diff --git a/lib/new_ui/auth/code_message_page.dart b/lib/new_ui/auth/code_message_page.dart new file mode 100644 index 0000000..78b1933 --- /dev/null +++ b/lib/new_ui/auth/code_message_page.dart @@ -0,0 +1,138 @@ +import 'package:aku_new_community_manager/new_ui/auth/sign_func.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/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:sms_autofill/sms_autofill.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class CodeMessagePage extends StatefulWidget { + final String tel; + + const CodeMessagePage({Key? key, required this.tel}) : super(key: key); + + @override + _CodeMessagePageState createState() => _CodeMessagePageState(); +} + +class _CodeMessagePageState extends State { + String? _errorMessage; + TextEditingController _controller = TextEditingController(); + String? _currentCode; + + @override + void initState() { + Future.delayed(Duration(milliseconds: 0), () async { + await SmsAutoFill().listenForCode(); + }); + super.initState(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '', + body: SafeArea( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 48.w, vertical: 24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 46.w.heightBox, + '请输入验证码' + .text + .size(36.sp) + .color(Colors.black.withOpacity(0.65)) + .bold + .make(), + 16.w.heightBox, + _errorMessage != null + ? '${_errorMessage}'.text.color(Colors.red).size(28.sp).make() + : '验证码已发送至' + .richText + .withTextSpanChildren([ + '${widget.tel}' + .textSpan + .size(28.sp) + .color(Color(0xFFCF1322).withOpacity(0.8)) + .make(), + ]) + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + 80.w.heightBox, + PinFieldAutoFill( + autoFocus: true, + currentCode: _currentCode, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + codeLength: 6, + onCodeChanged: (code) async { + if (code!.length >= 6) { + var re = await SignFunc.loginBySms( + widget.tel, + code, + UserTool.appProvider.pickedCityAndCommunity! + .communityModel!.id); + if (re.data['success']) { + await UserTool.userProvider + .setLogin(re.data['data'] as int); + await UserTool.dataProvider.addHistories(); + } else { + _errorMessage = re.data['msg']; + BotToast.showText(text: re.data['msg']); + _controller.clear(); + } + } + _currentCode = code; + }, + decoration: UnderlineDecoration( + colorBuilder: FixedColorListBuilder([ + Colors.black.withOpacity(0.3), + Colors.black.withOpacity(0.3), + Colors.black.withOpacity(0.3), + Colors.black.withOpacity(0.3), + Colors.black.withOpacity(0.3), + Colors.black.withOpacity(0.3), + ])), + ), + 24.w.heightBox, + Row( + children: [ + Spacer(), + TextButton( + onPressed: () async { + var base = await SignFunc.sendMessageCode( + widget.tel, + UserTool.appProvider.pickedCityAndCommunity! + .communityModel!.id); + if (base.success) { + _errorMessage = null; + UserTool.appProvider.startTimer(); + } else { + BotToast.showText(text: base.msg); + } + }, + child: (UserTool.appProvider.second >= 60 + ? '重新发送验证码' + : '${UserTool.appProvider.second}秒后可重新发送') + .text + .size(28.sp) + .color(Color(0xFF5096F1)) + .make()), + ], + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/new_ui/auth/forgot_psd_page.dart b/lib/new_ui/auth/forgot_psd_page.dart new file mode 100644 index 0000000..1d661fc --- /dev/null +++ b/lib/new_ui/auth/forgot_psd_page.dart @@ -0,0 +1,93 @@ +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/new_ui/auth/widget/tel_textfield.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:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import 'forgot_set_psd_page.dart'; + +class ForgotPsdPage extends StatefulWidget { + const ForgotPsdPage({Key? key}) : super(key: key); + + @override + _ForgotPsdPageState createState() => _ForgotPsdPageState(); +} + +class _ForgotPsdPageState extends State { + TextEditingController _telController = TextEditingController(); + + @override + void dispose() { + _telController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '', + backgroundColor: Colors.white, + body: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 24.w.heightBox, + Row( + children: [ + 48.w.widthBox, + '忘记密码' + .text + .size(36.sp) + .bold + .color(Colors.black.withOpacity(0.65)) + .make(), + Spacer(), + ], + ), + 16.w.heightBox, + Row( + children: [ + 48.w.widthBox, + '为了安全,我们会向你的手机发送验证码' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + ], + ), + 144.w.heightBox, + TelTextField(controller: _telController), + 100.w.heightBox, + LoginButtonWidget( + onTap: _telController.text.isNotEmpty + ? () async { + if (!RegexUtil.isMobileSimple(_telController.text)) { + BotToast.showText(text: '请输入正确的手机号!'); + return; + } + var base = await SignFunc.sendForgotMessageCode( + _telController.text, + UserTool.appProvider.pickedCityAndCommunity! + .communityModel!.id); + if (base.success) { + Get.to(() => ForgotSetPsdPage( + tel: _telController.text, + )); + UserTool.appProvider.startTimer(); + } else { + BotToast.showText(text: base.msg); + } + } + : null, + text: '下一步'), + ], + ), + ); + } +} diff --git a/lib/new_ui/auth/forgot_set_psd_page.dart b/lib/new_ui/auth/forgot_set_psd_page.dart new file mode 100644 index 0000000..ec45b54 --- /dev/null +++ b/lib/new_ui/auth/forgot_set_psd_page.dart @@ -0,0 +1,183 @@ +import 'package:aku_new_community_manager/new_ui/auth/psd_verify.dart'; +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/new_ui/auth/widget/psd_textfield.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/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import 'login_root_page.dart'; + +class ForgotSetPsdPage extends StatefulWidget { + final String tel; + + const ForgotSetPsdPage({Key? key, required this.tel}) : super(key: key); + + @override + _ForgotSetPsdPageState createState() => _ForgotSetPsdPageState(); +} + +class _ForgotSetPsdPageState extends State { + TextEditingController _psdController = TextEditingController(); + TextEditingController _confirmPsdController = TextEditingController(); + TextEditingController _codeController = TextEditingController(); + + PSDVERIFY get psdCheck => + PsdVerify.check(_psdController.text, _confirmPsdController.text); + + @override + void initState() { + _psdController.addListener(() { + setState(() {}); + }); + _confirmPsdController.addListener(() { + setState(() {}); + }); + super.initState(); + } + + @override + void dispose() { + _psdController.removeListener(() {}); + _confirmPsdController.removeListener(() {}); + _psdController.dispose(); + _confirmPsdController.dispose(); + _codeController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '', + backgroundColor: Colors.white, + body: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 24.w.heightBox, + Row( + children: [ + 48.w.widthBox, + '已向 ' + .richText + .withTextSpanChildren([ + widget.tel.textSpan + .size(36.sp) + .color(Colors.red) + .bold + .make(), + ' 发送验证码' + .textSpan + .size(36.sp) + .color(Colors.black.withOpacity(0.65)) + .bold + .make() + ]) + .size(36.sp) + .bold + .color(Colors.black.withOpacity(0.65)) + .make(), + Spacer(), + ], + ), + 16.w.heightBox, + Row( + children: [ + 48.w.widthBox, + '密码需由6-20位数字、字母、或符号组成,至少两种' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + ], + ), + 144.w.heightBox, + Container( + width: 686.w, + height: 94.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(60.w), + color: Colors.black.withOpacity(0.06), + ), + child: TextField( + onChanged: (text) { + setState(() {}); + }, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + controller: _codeController, + decoration: InputDecoration( + isDense: false, + contentPadding: + EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + border: InputBorder.none, + hintText: '请输入验证码', + suffixIconConstraints: + BoxConstraints(minHeight: 100.w, maxHeight: 100.w), + suffixIcon: GestureDetector( + onTap: () async { + var base = await SignFunc.sendMessageCode( + widget.tel, + UserTool.appProvider.pickedCityAndCommunity! + .communityModel!.id); + if (base.success) { + Get.to(() => ForgotSetPsdPage( + tel: widget.tel, + )); + UserTool.appProvider.startTimer(); + } else { + BotToast.showText(text: base.msg); + } + }, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + '|${UserTool.appProvider.second < 60 ? '${UserTool.appProvider.second}秒后重新获取' : '获取验证码'}' + .text + .size(28.sp) + .color(Color(0xFF5096F1)) + .make(), + 20.w.widthBox, + ], + ), + ), + hintStyle: TextStyle( + color: Colors.black.withOpacity(0.25), fontSize: 28.sp)), + ), + ), + 24.w.heightBox, + PsdTextField(controller: _psdController, hintText: '请输入密码'), + 24.w.heightBox, + PsdTextField(controller: _confirmPsdController, hintText: '请再次输入密码'), + 16.w.heightBox, + PsdVerify.checkString(psdCheck) + .text + .size(28.sp) + .color(Color(0xFFCF1322).withOpacity(0.8)) + .make(), + 37.w.heightBox, + LoginButtonWidget( + onTap: (psdCheck == PSDVERIFY.correct && + _codeController.text.isNotEmpty) + ? () async { + var result = await SignFunc.settingForgotPsd( + _psdController.text, + widget.tel, + _codeController.text); + if (result) { + Get.offAll(() => LoginPage()); + } + } + : null, + text: '确认'), + ], + ), + ); + } +} diff --git a/lib/new_ui/auth/login_root_page.dart b/lib/new_ui/auth/login_root_page.dart new file mode 100644 index 0000000..2e8e27a --- /dev/null +++ b/lib/new_ui/auth/login_root_page.dart @@ -0,0 +1,147 @@ +import 'package:aku_new_community_manager/new_ui/auth/select_community_page.dart'; +import 'package:aku_new_community_manager/provider/app_provider.dart'; +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import 'other_login_page.dart'; + +class LoginPage extends StatefulWidget { + const LoginPage({Key? key}) : super(key: key); + + @override + _LoginPageState createState() => _LoginPageState(); +} + +class _LoginPageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '', + backgroundColor: Colors.white, + body: SafeArea( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 44.w.heightBox, + '登录解锁更多功能'.text.size(36.sp).color(kPrimaryColor).bold.make(), + 144.w.heightBox, + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CommunityWidget(), + 80.w.heightBox, + '${'1547***93018'}' + .text + .size(36.sp) + .color(kTextPrimaryColor) + .bold + .make(), + 40.w.heightBox, + MaterialButton( + onPressed: () {}, + elevation: 0, + height: 100.w, + minWidth: 686.w, + color: kPrimaryColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(60.w)), + child: '本机号码一键登录'.text.size(32.sp).black.bold.make(), + ), + 24.w.heightBox, + InkWell( + onTap: () { + Get.to(() => OtherLoginPage()); + }, + child: Text( + '其他登录方式', + style: TextStyle( + color: Color(0xFF5096F1), + fontSize: 28.sp, + ), + ), + ) + ], + ), + Spacer(), + BottomTip(), + ], + ), + ), + ); + } +} + +class BottomTip extends StatelessWidget { + const BottomTip({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.only(bottom: 100.w), + child: RichText( + text: TextSpan( + style: TextStyle( + fontSize: 24.sp, + color: kTextSubColor, + ), + text: '注册/登记即代表同意', + children: [ + WidgetSpan( + child: InkWell( + onTap: () { + //TODO:跳转隐私政策 + }, + child: '《小蜜蜂隐私政策及用户协议》' + .text + .size(24.sp) + .color(Color(0xFF5096F1)) + .make(), + )), + ])), + ); + } +} + +class CommunityWidget extends StatelessWidget { + final MainAxisAlignment? align; + + const CommunityWidget({ + Key? key, + this.align, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + AppProvider appProveider = Provider.of(context, listen: true); + var hasSelect = appProveider.pickedCityAndCommunity != null && + appProveider.pickedCityAndCommunity!.communityModel != null; + return GestureDetector( + onTap: () async { + await Get.to(() => SelectCommunity()); + }, + child: Row( + mainAxisAlignment: align ?? MainAxisAlignment.center, + children: [ + (hasSelect + ? '${appProveider.pickedCityAndCommunity!.cityModel.district.name} ${appProveider.pickedCityAndCommunity!.communityModel!.name}' + : '') + .text + .color(Colors.black) + .make(), + '${hasSelect ? ' 切换' : '请先选择小区'}' + .text + .size(32.sp) + .color(Color(0xFF5096F1)) + .make(), + ], + ), + ); + } +} diff --git a/lib/new_ui/auth/other_login_page.dart b/lib/new_ui/auth/other_login_page.dart new file mode 100644 index 0000000..7d24b91 --- /dev/null +++ b/lib/new_ui/auth/other_login_page.dart @@ -0,0 +1,207 @@ +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/new_ui/auth/widget/psd_textfield.dart'; +import 'package:aku_new_community_manager/new_ui/auth/widget/tel_textfield.dart'; +import 'package:aku_new_community_manager/provider/app_provider.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:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import 'code_message_page.dart'; +import 'forgot_psd_page.dart'; +import 'login_root_page.dart'; + +class OtherLoginPage extends StatefulWidget { + const OtherLoginPage({Key? key}) : super(key: key); + + @override + _OtherLoginPageState createState() => _OtherLoginPageState(); +} + +class _OtherLoginPageState extends State { + PageController _controller = PageController(); + List _tabs = ['账号登录', '验证码登录']; + int _currentIndex = 0; + TextEditingController _tel = TextEditingController(); + TextEditingController _psd = TextEditingController(); + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + _controller.dispose(); + _tel.dispose(); + _psd.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '', + backgroundColor: Colors.white, + body: Column( + children: [ + Row( + children: [ + 24.w.widthBox, + ..._tabs + .mapIndexed((e, index) => _tab(e, index, onTap: (value) { + _currentIndex = value; + _controller.jumpToPage(_currentIndex); + setState(() {}); + })) + .toList(), + ], + ), + Flexible( + child: PageView( + controller: _controller, + children: [_accountView(), _verificationView()], + ), + ), + BottomTip(), + ], + ), + ); + } + + Widget _accountView() { + return ListView( + padding: EdgeInsets.symmetric(horizontal: 32.w), + children: [ + 140.w.heightBox, + CommunityWidget( + align: MainAxisAlignment.start, + ), + 40.w.heightBox, + TelTextField( + controller: _tel, + ), + 40.w.heightBox, + PsdTextField( + controller: _psd, + ), + 100.w.heightBox, + LoginButtonWidget( + onTap: () async { + var check = checkInput(); + if (!check) { + return; + } + var cancel = BotToast.showLoading(); + var response = await SignFunc.login( + _tel.text, + _psd.text, + UserTool + .appProvider.pickedCityAndCommunity!.communityModel!.id); + if (response.data['success']) { + await UserTool.userProvider.setLogin(response.data['data']); + await UserTool.dataProvider.addHistories(); + } else { + BotToast.showText(text: response.data['message']); + } + cancel(); + }, + text: '登录'), + 24.w.heightBox, + TextButton( + onPressed: () { + Get.to(() => ForgotPsdPage()); + }, + child: '忘记密码'.text.size(28.sp).color(Color(0xFF5096F1)).make()) + ], + ); + } + + bool checkInput() { + if (!RegexUtil.isMobileSimple(_tel.text)) { + BotToast.showText(text: '请输入正确的手机号!'); + return false; + } + if (UserTool.appProvider.pickedCityAndCommunity == null) { + BotToast.showText(text: '请先选择小区!'); + return false; + } + if (_currentIndex == 0 && _psd.text.isEmpty) { + BotToast.showText(text: '密码不能为空'); + return false; + } + return true; + } + + Widget _verificationView() { + AppProvider appProvider = Provider.of(context); + return ListView( + padding: EdgeInsets.symmetric(horizontal: 32.w), + children: [ + 140.w.heightBox, + CommunityWidget( + align: MainAxisAlignment.start, + ), + 40.w.heightBox, + TelTextField(controller: _tel), + 100.w.heightBox, + LoginButtonWidget( + onTap: UserTool.appProvider.second < 60 + ? () {} + : () async { + var check = checkInput(); + if (!check) { + return; + } + var base = await SignFunc.sendMessageCode( + _tel.text, + UserTool.appProvider.pickedCityAndCommunity! + .communityModel!.id); + if (base.success) { + Get.to(() => CodeMessagePage(tel: _tel.text)); + appProvider.startTimer(); + } else { + BotToast.showText(text: base.msg); + } + }, + text: appProvider.timerStart + ? '${appProvider.second}秒后重新获取' + : '获取验证码'), + 24.w.heightBox, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + '未注册的手机验证后会自动创建账号' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.25)) + .make(), + ], + ), + ], + ); + } + + Widget _tab(String text, int index, {required Function(int) onTap}) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => onTap(index), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + alignment: Alignment.center, + child: text.text + .size(_currentIndex == index ? 36.sp : 32.sp) + .lineHeight(_currentIndex == index ? 1.2 : 1.2) + .color( + Colors.black.withOpacity(_currentIndex == index ? 0.65 : 0.45)) + .make(), + ), + ); + } +} diff --git a/lib/new_ui/auth/psd_verify.dart b/lib/new_ui/auth/psd_verify.dart new file mode 100644 index 0000000..488d126 --- /dev/null +++ b/lib/new_ui/auth/psd_verify.dart @@ -0,0 +1,36 @@ +import 'package:common_utils/common_utils.dart'; + +enum PSDVERIFY { shorLength, Insufficient, different, correct, empty } + +class PsdVerify { + //检测含有字母、数字、符号中两种的正则表达式 + static String reg = r'^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).*'; + static PSDVERIFY check(String psd, String confirmPsd) { + if (psd.isEmpty || confirmPsd.isEmpty) { + return PSDVERIFY.empty; + } else if (psd != confirmPsd) { + return PSDVERIFY.different; + } else if (psd.length < 6) { + return PSDVERIFY.shorLength; + } else if (!RegexUtil.matches(reg, psd)) { + return PSDVERIFY.Insufficient; + } else { + return PSDVERIFY.correct; + } + } + + static String checkString(PSDVERIFY enu) { + switch (enu) { + case PSDVERIFY.shorLength: + return '密码不能小于6位'; + case PSDVERIFY.Insufficient: + return '密码至少由两种类型组成'; + case PSDVERIFY.different: + return '您输入的确认密码和新密码不一致,请检查后重新输入'; + case PSDVERIFY.correct: + return ''; + case PSDVERIFY.empty: + return ''; + } + } +} diff --git a/lib/new_ui/auth/select_community_page.dart b/lib/new_ui/auth/select_community_page.dart new file mode 100644 index 0000000..ce24d33 --- /dev/null +++ b/lib/new_ui/auth/select_community_page.dart @@ -0,0 +1,194 @@ +import 'package:aku_new_community_manager/const/saas_api.dart'; +import 'package:aku_new_community_manager/saas_models/login/community_model.dart'; +import 'package:aku_new_community_manager/saas_models/login/history_login_model.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:aku_new_community_manager/ui/widgets/common/bee_city_picker.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/bee_community_picker.dart'; +import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class SelectCommunity extends StatefulWidget { + const SelectCommunity({ + Key? key, + }) : super(key: key); + + @override + _SelectCommunityState createState() => _SelectCommunityState(); +} + +class _SelectCommunityState extends State { + String get cityName { + var _model = UserTool.appProvider.pickedCityAndCommunity; + if (_model == null) { + return '请选择省、市、县/区'; + } else { + return _model.cityModel.province.name + + _model.cityModel.city.name + + _model.cityModel.district.name; + } + } + + String get communityName { + var _community = + UserTool.appProvider.pickedCityAndCommunity?.communityModel; + if (_community == null) { + return '请选择小区'; + } else { + return _community.name; + } + } + + @override + void initState() { + super.initState(); + } + + @override + void deactivate() { + Future.delayed(Duration(milliseconds: 0), () async { + if (UserTool.appProvider.pickedCityAndCommunity != null && + UserTool.appProvider.pickedCityAndCommunity?.communityModel == null) { + UserTool.appProvider.resetPickedCity(); + } + }); + super.deactivate(); + } + + @override + Widget build(BuildContext context) { + var selectCity = GestureDetector( + onTap: () async { + var _city = await BeeCityPicker.pick(context); + if (_city != null) { + UserTool.appProvider.setPickedCity(city: _city); + } + setState(() {}); + }, + child: Container( + color: Colors.white, + width: double.infinity, + height: 88.w, + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + child: Row( + children: [ + '选择城市'.text.size(28.sp).black.make(), + Spacer(), + '${cityName}'.text.black.make(), + 32.w.widthBox, + Icon( + CupertinoIcons.right_chevron, + size: 20.w, + ) + ], + ), + ), + ); + var selectCommunity = GestureDetector( + onTap: () async { + var cancel = BotToast.showLoading(); + List _communities = []; + var base = await NetUtil().get(SAASAPI.login.allCommunity, params: { + 'cityId': UserTool + .appProvider.pickedCityAndCommunity!.cityModel.district.id, + }); + if (base.success) { + _communities = (base.data as List) + .map((e) => CommunityModel.fromJson(e)) + .toList(); + } + cancel(); + var _community = await BeeCommunityPicker.pick(context, _communities); + print(_community?.name); + if (_community != null) { + UserTool.appProvider.setPickedCity(community: _community); + } + setState(() {}); + }, + child: Container( + color: Colors.white, + width: double.infinity, + height: 88.w, + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + child: Row( + children: [ + '选择小区'.text.size(28.sp).black.make(), + Spacer(), + '${communityName}'.text.black.make(), + 32.w.widthBox, + Icon( + CupertinoIcons.right_chevron, + size: 20.w, + ) + ], + ), + ), + ); + var history = Offstage( + offstage: UserTool.dataProvider.loginHistories.length == 0, + child: Container( + width: double.infinity, + color: Colors.white, + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '历史登录'.text.size(28.sp).color(Colors.black.withOpacity(0.2)).make(), + 24.w.widthBox, + ...UserTool.dataProvider.loginHistories + .map((e) => _historyTile(e)) + .toList(), + ], + ), + ), + ); + return WillPopScope( + onWillPop: () async { + var bool = UserTool.appProvider.pickedCityAndCommunity != null && + UserTool.appProvider.pickedCityAndCommunity?.communityModel == null; + if (bool) { + BotToast.showText(text: '请选择小区'); + return false; + } else { + return true; + } + }, + child: AkuScaffold( + title: '选择登录小区', + body: ListView( + children: [ + selectCity, + selectCommunity, + 10.w.heightBox, + history, + ], + ), + ), + ); + } + + Widget _historyTile(HistoryLoginModel model) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + child: Row( + children: [ + Icon( + CupertinoIcons.search, + size: 30.w, + color: Colors.black.withOpacity(0.2), + ), + 24.w.widthBox, + '${model.communityModel!.name}(${model.cityModel.province.name}·${model.cityModel.city.name}·${model.cityModel.district.name})' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.2)) + .make(), + ], + ), + ); + } +} diff --git a/lib/new_ui/auth/set_nick_nage_page.dart b/lib/new_ui/auth/set_nick_nage_page.dart new file mode 100644 index 0000000..07915d6 --- /dev/null +++ b/lib/new_ui/auth/set_nick_nage_page.dart @@ -0,0 +1,150 @@ +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:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class SetNickNamePage extends StatefulWidget { + const SetNickNamePage({Key? key}) : super(key: key); + + @override + _SetNickNamePageState createState() => _SetNickNamePageState(); +} + +class _SetNickNamePageState extends State { + TextEditingController _nickController = TextEditingController(); + bool _nickIsRepeat = false; + + @override + void dispose() { + _nickController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '', + backgroundColor: Colors.white, + body: ListView( + children: [ + 24.w.heightBox, + Row( + children: [ + 48.w.widthBox, + '请设置您的昵称' + .text + .size(36.sp) + .bold + .color(Colors.black.withOpacity(0.65)) + .make(), + Spacer(), + ], + ), + 16.w.heightBox, + Row( + children: [ + 48.w.widthBox, + '昵称不可设置侮辱性词汇、特殊符号、敏感字符' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + ], + ), + 95.w.heightBox, + Container( + width: 686.w, + height: 94.w, + margin: EdgeInsets.symmetric(horizontal: 32.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(60.w), + color: Colors.black.withOpacity(0.06), + ), + child: TextField( + onChanged: (text) async { + _nickIsRepeat = !(await SignFunc.checkNickRepeat(text)); + setState(() {}); + }, + maxLength: 20, + controller: _nickController, + decoration: InputDecoration( + isDense: false, + contentPadding: + EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + border: InputBorder.none, + counterText: '', + hintText: '请输入您的昵称,不超过20个字符', + hintStyle: TextStyle( + color: Colors.black.withOpacity(0.25), fontSize: 28.sp)), + ), + ), + _nickIsRepeat ? _nickRepeat() : 100.w.heightBox, + Padding( + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: LoginButtonWidget( + onTap: () async { + var result = await SignFunc.setNickName(_nickController.text); + if (result) { + await UserTool.userProvider.updateUserInfo(); + } + }, + text: '确定'), + ), + ], + ), + ); + } + + Widget _nickRepeat() { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 48.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 24.w.heightBox, + '该昵称已有人注册,请重新输入'.text.size(28.sp).color(Colors.red).make(), + 50.w.heightBox, + '试试以下昵称' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + 24.w.heightBox, + otherNick('123'), + 24.w.heightBox, + otherNick('321'), + 24.w.heightBox, + otherNick('231'), + 100.w.heightBox, + ], + ), + ); + } + + Widget otherNick(String extra) { + return GestureDetector( + onTap: () { + _nickController.text = '${_nickController.text}$extra'; + }, + child: Material( + child: Container( + height: 70.w, + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.w), + alignment: Alignment.centerLeft, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.03), + borderRadius: BorderRadius.circular(42.sp)), + child: '${_nickController.text}$extra' + .text + .size(28.sp) + .color(Color(0xFF5096F1)) + .make(), + ), + ), + ); + } +} diff --git a/lib/new_ui/auth/set_psd_page.dart b/lib/new_ui/auth/set_psd_page.dart new file mode 100644 index 0000000..0802d04 --- /dev/null +++ b/lib/new_ui/auth/set_psd_page.dart @@ -0,0 +1,104 @@ +import 'package:aku_new_community_manager/new_ui/auth/psd_verify.dart'; +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/new_ui/auth/widget/psd_textfield.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:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class SetPsdPage extends StatefulWidget { + const SetPsdPage({Key? key}) : super(key: key); + + @override + _SetPsdPageState createState() => _SetPsdPageState(); +} + +class _SetPsdPageState extends State { + TextEditingController _psdController = TextEditingController(); + TextEditingController _confirmPsdController = TextEditingController(); + + PSDVERIFY get psdCheck => + PsdVerify.check(_psdController.text, _confirmPsdController.text); + + @override + void initState() { + _psdController.addListener(() { + setState(() {}); + }); + _confirmPsdController.addListener(() { + setState(() {}); + }); + super.initState(); + } + + @override + void dispose() { + _psdController.removeListener(() {}); + _confirmPsdController.removeListener(() {}); + _psdController.dispose(); + _confirmPsdController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '', + backgroundColor: Colors.white, + body: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 24.w.heightBox, + Row( + children: [ + 48.w.widthBox, + '首次登陆,请设置账号密码' + .text + .size(36.sp) + .bold + .color(Colors.black.withOpacity(0.65)) + .make(), + Spacer(), + ], + ), + 16.w.heightBox, + Row( + children: [ + 48.w.widthBox, + '密码需由6-20位数字、字母、或符号组成,至少两种' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + ], + ), + 144.w.heightBox, + PsdTextField(controller: _psdController, hintText: '请输入密码'), + 24.w.heightBox, + PsdTextField(controller: _confirmPsdController, hintText: '请再次输入密码'), + 16.w.heightBox, + PsdVerify.checkString(psdCheck) + .text + .size(28.sp) + .color(Color(0xFFCF1322).withOpacity(0.8)) + .make(), + 37.w.heightBox, + LoginButtonWidget( + onTap: psdCheck == PSDVERIFY.correct + ? () async { + var result = + await SignFunc.settingPsd(_psdController.text); + if (result) { + await UserTool.userProvider.updateUserInfo(); + } + } + : null, + text: '确认'), + ], + ), + ); + } +} diff --git a/lib/new_ui/auth/sign_func.dart b/lib/new_ui/auth/sign_func.dart new file mode 100644 index 0000000..890a029 --- /dev/null +++ b/lib/new_ui/auth/sign_func.dart @@ -0,0 +1,122 @@ +import 'package:aku_new_community_manager/const/saas_api.dart'; +import 'package:aku_new_community_manager/models/user/user_info_model.dart'; +import 'package:aku_new_community_manager/new_ui/auth/set_nick_nage_page.dart'; +import 'package:aku_new_community_manager/new_ui/auth/set_psd_page.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; +import 'package:aku_new_community_manager/tools/user_tool.dart'; +import 'package:aku_new_community_manager/ui/home/home_page.dart'; +import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:dio/dio.dart'; +import 'package:get/get.dart' hide Response; + +class SignFunc { + //发送手机号验证码 + static Future sendMessageCode( + String phone, int communityId) async { + BaseModel baseModel = await NetUtil().post( + SAASAPI.login.sendSMSCode, + params: {'tel': phone, 'communityId': communityId}, + showMessage: true, + ); + return baseModel; + } //发送手机号验证码 + + static Future sendForgotMessageCode( + String phone, int communityId) async { + BaseModel baseModel = await NetUtil().post( + SAASAPI.user.sendForgotTelCode, + params: {'tel': phone, 'communityId': communityId}, + showMessage: true, + ); + return baseModel; + } + + //验证码登录 + static Future loginBySms( + String phone, String code, int communityId) async { + Response response = await NetUtil().dio!.post( + SAASAPI.login.loginTelCode, + data: { + 'tel': phone, + 'code': code, + 'communityId': communityId, + }, + ); + return response; + } + + ///更新用户信息 + static Future getUserInfo() async { + BaseModel baseModel = await NetUtil().get(SAASAPI.user.userProfile); + if (baseModel.data == null || !baseModel.success) return null; + return UserInformationModel.fromJson(baseModel.data); + } + + ///设置密码(密码不存在时调用 + static Future settingPsd(String psd) async { + BaseModel baseModel = await NetUtil().get(SAASAPI.user.settingPsd, + params: {'password': psd}, showMessage: true); + if (baseModel.data == null || !baseModel.success) return false; + return true; + } + + ///提交修改的新密码(忘记密码) + static Future settingForgotPsd( + String psd, String tel, String telcode) async { + BaseModel baseModel = await NetUtil().get(SAASAPI.user.settingForgotPsd, + params: { + 'newPassword': psd, + 'tel': tel, + 'telCode': telcode, + 'communityId': + UserTool.appProvider.pickedCityAndCommunity!.communityModel!.id + }, + showMessage: true); + if (baseModel.data == null || !baseModel.success) return false; + return true; + } + + //登录 + static Future login( + String phone, String code, int communityId) async { + Response response = await NetUtil().dio!.post( + SAASAPI.login.login, + data: { + 'tel': phone, + 'password': code, + 'communityId': communityId, + }, + ); + return response; + } + + static Future checkNameAndAccount() async { + if (!UserTool.userProvider.userInfoModel!.isExistPassword) { + await Get.to(() => SetPsdPage()); + } else if (UserTool.userProvider.userInfoModel!.nickName == null) { + await Get.to(() => SetNickNamePage()); + } else { + Get.offAll(() => HomePage()); + } + } + + ///检测昵称是否重复 + static Future checkNickRepeat(String nick) async { + BaseModel baseModel = await NetUtil().get(SAASAPI.user.checkNickRepeat, + params: { + 'nickName': nick, + }, + showMessage: true); + return baseModel.msg == '昵称可用'; + } + + ///设置昵称 + static Future setNickName(String nick) async { + BaseModel baseModel = await NetUtil().get(SAASAPI.user.setNickName, + params: { + 'nickName': nick, + }, + showMessage: true); + return baseModel.msg == '设置成功'; + } +} diff --git a/lib/new_ui/auth/widget/login_button_widget.dart b/lib/new_ui/auth/widget/login_button_widget.dart new file mode 100644 index 0000000..2a1568b --- /dev/null +++ b/lib/new_ui/auth/widget/login_button_widget.dart @@ -0,0 +1,29 @@ +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; + +class LoginButtonWidget extends StatelessWidget { + final VoidCallback? onTap; + final String text; + const LoginButtonWidget({Key? key, required this.onTap, required this.text}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialButton( + minWidth: 686.w, + height: 97.w, + onPressed: onTap, + elevation: 0, + child: Text( + text, + style: TextStyle( + fontSize: 32.sp, + ), + ), + disabledTextColor: Colors.black.withOpacity(0.45), + disabledColor: Colors.black.withOpacity(0.06), + color: kPrimaryColor, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(60.w)), + ); + } +} diff --git a/lib/new_ui/auth/widget/psd_textfield.dart b/lib/new_ui/auth/widget/psd_textfield.dart new file mode 100644 index 0000000..75bc50f --- /dev/null +++ b/lib/new_ui/auth/widget/psd_textfield.dart @@ -0,0 +1,66 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class PsdTextField extends StatefulWidget { + final TextEditingController controller; + final String? hintText; + + const PsdTextField({ + Key? key, + required this.controller, + this.hintText, + }) : super(key: key); + + @override + _PsdTextFieldState createState() => _PsdTextFieldState(); +} + +class _PsdTextFieldState extends State { + bool visible = false; + + @override + Widget build(BuildContext context) { + return Container( + width: 686.w, + height: 94.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(60.w), + color: Colors.black.withOpacity(0.06), + ), + child: TextField( + maxLength: 20, + onChanged: (text) { + setState(() {}); + }, + controller: widget.controller, + obscureText: !visible, + obscuringCharacter: '*', + decoration: InputDecoration( + isDense: false, + contentPadding: + EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + border: InputBorder.none, + hintText: widget.hintText ?? '请输入密码', + counterText: '', + suffixIconConstraints: + BoxConstraints(minHeight: 50.w, maxHeight: 50.w), + suffixIcon: GestureDetector( + onTap: () { + visible = !visible; + setState(() {}); + }, + child: Padding( + padding: EdgeInsets.only(right: 20.w), + child: Icon( + visible ? CupertinoIcons.eye : CupertinoIcons.eye_slash, + color: Colors.black.withOpacity(0.4), + ), + ), + ), + hintStyle: TextStyle( + color: Colors.black.withOpacity(0.25), fontSize: 28.sp)), + ), + ); + } +} diff --git a/lib/new_ui/auth/widget/tel_textfield.dart b/lib/new_ui/auth/widget/tel_textfield.dart new file mode 100644 index 0000000..9f1bb89 --- /dev/null +++ b/lib/new_ui/auth/widget/tel_textfield.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class TelTextField extends StatefulWidget { + final TextEditingController controller; + const TelTextField({Key? key, required this.controller}) : super(key: key); + + @override + _TelTextFieldState createState() => _TelTextFieldState(); +} + +class _TelTextFieldState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: 686.w, + height: 94.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(60.w), + color: Colors.black.withOpacity(0.06), + ), + child: TextField( + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + keyboardType: TextInputType.number, + controller: widget.controller, + decoration: InputDecoration( + isDense: true, + border: InputBorder.none, + prefixIcon: Center(child: '+86|'.text.black.make()), + prefixIconConstraints: BoxConstraints.loose(Size(60, 60)), + contentPadding: EdgeInsets.symmetric(vertical: 30.w), + hintText: '点击输入手机号', + hintStyle: + TextStyle(color: Colors.black.withOpacity(0.25), fontSize: 28.sp), + ), + ), + ); + } +} diff --git a/lib/provider/app_provider.dart b/lib/provider/app_provider.dart index 77a0121..10bc464 100644 --- a/lib/provider/app_provider.dart +++ b/lib/provider/app_provider.dart @@ -1,13 +1,16 @@ // Flutter imports: -import 'package:common_utils/common_utils.dart'; -import 'package:flutter/material.dart'; +import 'dart:async'; +import 'package:aku_new_community_manager/saas_models/login/community_model.dart'; +import 'package:aku_new_community_manager/saas_models/login/history_login_model.dart'; +import 'package:aku_new_community_manager/saas_models/login/picked_city_model.dart'; +// Project imports: +import 'package:aku_new_community_manager/ui/home/application/applications_page.dart'; // Package imports: import 'package:amap_flutter_location/amap_flutter_location.dart'; import 'package:amap_flutter_location/amap_location_option.dart'; - -// Project imports: -import 'package:aku_new_community_manager/ui/home/application/applications_page.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; import 'package:power_logger/power_logger.dart'; enum WORKCLOCK { @@ -122,4 +125,50 @@ class AppProvider extends ChangeNotifier { _clockStatus = WORKCLOCK.NOTIN; notifyListeners(); } + + ///saas + ///历史登录信息 + HistoryLoginModel? _pickedCityAndCommunity; + + HistoryLoginModel? get pickedCityAndCommunity => _pickedCityAndCommunity; + + void setPickedCity({PickedCityModel? city, CommunityModel? community}) { + if (city != null) { + _pickedCityAndCommunity = HistoryLoginModel(cityModel: city); + } + if (community != null) { + _pickedCityAndCommunity!.communityModel = community; + } + notifyListeners(); + } + + void resetPickedCity() { + _pickedCityAndCommunity = null; + notifyListeners(); + } + + ///登录页验证码计时器 + int second = 60; + bool timerStart = false; + Timer? timer; + + void startTimer() { + timerStart = true; + timer = Timer.periodic(Duration(seconds: 1), (timer) { + if (second > 0) { + second--; + notifyListeners(); + } else { + stopTimer(); + } + }); + } + + void stopTimer() { + second = 60; + timerStart = false; + timer?.cancel(); + timer = null; + notifyListeners(); + } } diff --git a/lib/provider/data_provider.dart b/lib/provider/data_provider.dart new file mode 100644 index 0000000..c5aa685 --- /dev/null +++ b/lib/provider/data_provider.dart @@ -0,0 +1,52 @@ +import 'package:aku_new_community_manager/const/saas_api.dart'; +import 'package:aku_new_community_manager/saas_models/login/china_region_model.dart'; +import 'package:aku_new_community_manager/saas_models/login/history_login_model.dart'; +import 'package:aku_new_community_manager/tools/user_tool.dart'; +import 'package:aku_new_community_manager/utils/hive_store.dart'; +import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:flutter/material.dart'; + +class DataProvider extends ChangeNotifier { + Future init() async { + _loginHistories = HiveStore.dataBox! + .get('historyLogin') + ?.cast() + .toList() ?? + []; + _cityModel = + HiveStore.dataBox!.get('cities')?.cast().toList() ?? + []; + if (_cityModel.isEmpty) { + updateCityList(); + } + } + + List _cityModel = []; + + List get cityModel => _cityModel; + + Future updateCityList() async { + var model = await NetUtil().get(SAASAPI.city.allCity); + if (model.success) { + _cityModel = (model.data as List) + .map((e) => ChinaRegionModel.fromJson(e)) + .toList(); + HiveStore.dataBox!.put('cities', _cityModel); + return true; + } else { + return false; + } + } + + List _loginHistories = []; + + List get loginHistories => _loginHistories; + + Future addHistories() async { + _loginHistories.insert(0, UserTool.appProvider.pickedCityAndCommunity!); + if (_loginHistories.length > 4) { + _loginHistories.removeAt(_loginHistories.length - 1); + } + HiveStore.dataBox!.put('historyLogin', _loginHistories); + } +} diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 3a3237c..230936c 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -3,13 +3,14 @@ import 'dart:io'; // Project imports: import 'package:aku_new_community_manager/const/api.dart'; +import 'package:aku_new_community_manager/const/saas_api.dart'; // Flutter imports: import 'package:aku_new_community_manager/models/user/user_info_model.dart'; import 'package:aku_new_community_manager/models/user/user_profile_model.dart'; import 'package:aku_new_community_manager/provider/message_provider.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/user/user_info_model.dart'; import 'package:aku_new_community_manager/utils/hive_store.dart'; -import 'package:aku_new_community_manager/utils/network/base_file_model.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:aku_new_community_manager/utils/websocket/web_socket_util.dart'; // Package imports: @@ -46,9 +47,9 @@ class UserProvider extends ChangeNotifier { UserProfileModel? _profileModel; UserProfileModel? get profileModel => _profileModel; - UserInfoModel? _infoModel; + UserInformationModel? _infoModel; - UserInfoModel? get infoModel => _infoModel; + UserInformationModel? get infoModel => _infoModel; ///更新用户profile Future updateProfile() async { @@ -62,13 +63,13 @@ class UserProvider extends ChangeNotifier { return UserProfileModel.fromJson(model.data); } - Future updateUserInfo() async { + Future updateUserInfo() async { BaseModel? model = await NetUtil().get(API.user.info); if (model.data == null) return null; else { - var userModel = UserInfoModel.fromJson(model.data); + var userModel = UserInformationModel.fromJson(model.data); JPush().setAlias(userModel.id.toString()); print('jpush alias is ${userModel.id}'); return userModel; @@ -106,12 +107,12 @@ class UserProvider extends ChangeNotifier { ///修改头像 setAvatar(File file) async { Function cancel = BotToast.showLoading(); - BaseFileModel fileModel = await NetUtil().upload(API.upload.avatar, file); - if (fileModel.status == true) { + BaseModel fileModel = await NetUtil().upload(API.upload.avatar, file); + if (fileModel.success) { await NetUtil().post( API.user.updateAvatar, params: { - 'fileUrls': [fileModel.url], + 'fileUrls': [fileModel.data], }, showMessage: true, ); @@ -126,4 +127,24 @@ class UserProvider extends ChangeNotifier { _profileModel!.tel = tel; notifyListeners(); } + + ///saas + + UserInfoModel? _userInfoModel; + + UserInfoModel? get userInfoModel => _userInfoModel; + + ///修改头像 + Future updateAvatar(String? path) async { + BaseModel model = await NetUtil().post( + SAASAPI.user.updateAvatar, + params: { + 'fileUrls': [path] + }, + showMessage: true, + ); + if (model.success) { + await updateUserInfo(); + } + } } diff --git a/lib/saas_models/login/china_region_model.dart b/lib/saas_models/login/china_region_model.dart new file mode 100644 index 0000000..e702acc --- /dev/null +++ b/lib/saas_models/login/china_region_model.dart @@ -0,0 +1,48 @@ +import 'package:equatable/equatable.dart'; +import 'package:hive/hive.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'china_region_model.g.dart'; + +@JsonSerializable() +@HiveType(typeId: 3) +class ChinaRegionModel extends Equatable { + @HiveField(0) + final int id; + @HiveField(1) + final String name; + @HiveField(2) + final int parentId; + @HiveField(3) + final List? cityList; + + factory ChinaRegionModel.fromJson(Map json) => + _$ChinaRegionModelFromJson(json); + + static ChinaRegionModel empty(int parentId) { + return ChinaRegionModel(id: 0, name: '', cityList: [], parentId: 0); + } + + ChinaRegionModel({ + required this.id, + required this.name, + required this.parentId, + this.cityList, + }); + @override + List get props => [id, name, parentId, cityList]; + + ChinaRegionModel copyWith({ + int? id, + String? name, + int? parentId, + List? cityList, + }) { + return ChinaRegionModel( + id: id ?? this.id, + name: name ?? this.name, + parentId: parentId ?? this.parentId, + cityList: cityList ?? this.cityList, + ); + } +} diff --git a/lib/saas_models/login/china_region_model.g.dart b/lib/saas_models/login/china_region_model.g.dart new file mode 100644 index 0000000..d43bc36 --- /dev/null +++ b/lib/saas_models/login/china_region_model.g.dart @@ -0,0 +1,64 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'china_region_model.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class ChinaRegionModelAdapter extends TypeAdapter { + @override + final int typeId = 3; + + @override + ChinaRegionModel read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return ChinaRegionModel( + id: fields[0] as int, + name: fields[1] as String, + parentId: fields[2] as int, + cityList: (fields[3] as List?)?.cast(), + ); + } + + @override + void write(BinaryWriter writer, ChinaRegionModel obj) { + writer + ..writeByte(4) + ..writeByte(0) + ..write(obj.id) + ..writeByte(1) + ..write(obj.name) + ..writeByte(2) + ..write(obj.parentId) + ..writeByte(3) + ..write(obj.cityList); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ChinaRegionModelAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChinaRegionModel _$ChinaRegionModelFromJson(Map json) => + ChinaRegionModel( + id: json['id'] as int, + name: json['name'] as String, + parentId: json['parentId'] as int, + cityList: (json['cityList'] as List?) + ?.map((e) => ChinaRegionModel.fromJson(e as Map)) + .toList(), + ); diff --git a/lib/saas_models/login/community_model.dart b/lib/saas_models/login/community_model.dart new file mode 100644 index 0000000..be2d020 --- /dev/null +++ b/lib/saas_models/login/community_model.dart @@ -0,0 +1,28 @@ +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'community_model.g.dart'; + +@JsonSerializable() +class CommunityModel extends Equatable { + final int id; + final String name; + final String address; + final String addressDetails; + factory CommunityModel.fromJson(Map json) => + _$CommunityModelFromJson(json); + + const CommunityModel({ + required this.id, + required this.name, + required this.address, + required this.addressDetails, + }); + @override + List get props => [ + id, + name, + address, + addressDetails, + ]; +} diff --git a/lib/saas_models/login/community_model.g.dart b/lib/saas_models/login/community_model.g.dart new file mode 100644 index 0000000..2e34b47 --- /dev/null +++ b/lib/saas_models/login/community_model.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'community_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CommunityModel _$CommunityModelFromJson(Map json) => + CommunityModel( + id: json['id'] as int, + name: json['name'] as String, + address: json['address'] as String, + addressDetails: json['addressDetails'] as String, + ); diff --git a/lib/saas_models/login/history_login_model.dart b/lib/saas_models/login/history_login_model.dart new file mode 100644 index 0000000..8548736 --- /dev/null +++ b/lib/saas_models/login/history_login_model.dart @@ -0,0 +1,27 @@ +import 'package:aku_new_community_manager/saas_models/login/picked_city_model.dart'; +import 'package:equatable/equatable.dart'; +import 'package:hive/hive.dart'; +import 'package:json_annotation/json_annotation.dart'; + +import 'community_model.dart'; + +part 'history_login_model.g.dart'; + +@JsonSerializable() +@HiveType(typeId: 4) +class HistoryLoginModel extends Equatable { + @HiveField(0) + PickedCityModel cityModel; + @HiveField(1) + CommunityModel? communityModel; + factory HistoryLoginModel.fromJson(Map json) => + _$HistoryLoginModelFromJson(json); + + HistoryLoginModel({ + required this.cityModel, + this.communityModel, + }); + + @override + List get props => [cityModel, communityModel]; +} diff --git a/lib/saas_models/login/history_login_model.g.dart b/lib/saas_models/login/history_login_model.g.dart new file mode 100644 index 0000000..2783cf3 --- /dev/null +++ b/lib/saas_models/login/history_login_model.g.dart @@ -0,0 +1,58 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'history_login_model.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class HistoryLoginModelAdapter extends TypeAdapter { + @override + final int typeId = 4; + + @override + HistoryLoginModel read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return HistoryLoginModel( + cityModel: fields[0] as PickedCityModel, + communityModel: fields[1] as CommunityModel?, + ); + } + + @override + void write(BinaryWriter writer, HistoryLoginModel obj) { + writer + ..writeByte(2) + ..writeByte(0) + ..write(obj.cityModel) + ..writeByte(1) + ..write(obj.communityModel); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is HistoryLoginModelAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HistoryLoginModel _$HistoryLoginModelFromJson(Map json) => + HistoryLoginModel( + cityModel: + PickedCityModel.fromJson(json['cityModel'] as Map), + communityModel: json['communityModel'] == null + ? null + : CommunityModel.fromJson( + json['communityModel'] as Map), + ); diff --git a/lib/saas_models/login/picked_city_model.dart b/lib/saas_models/login/picked_city_model.dart new file mode 100644 index 0000000..6b055ec --- /dev/null +++ b/lib/saas_models/login/picked_city_model.dart @@ -0,0 +1,53 @@ +import 'package:aku_new_community_manager/utils/hive_store.dart'; +import 'package:equatable/equatable.dart'; +import 'package:hive/hive.dart'; +import 'package:json_annotation/json_annotation.dart'; + +import 'china_region_model.dart'; + +part 'picked_city_model.g.dart'; + +@JsonSerializable() +@HiveType(typeId: 6) +class PickedCityModel extends Equatable { + @HiveField(0) + final ChinaRegionModel province; + @HiveField(1) + final ChinaRegionModel city; + @HiveField(2) + final ChinaRegionModel district; + + factory PickedCityModel.fromJson(Map json) => + _$PickedCityModelFromJson(json); + + const PickedCityModel({ + required this.province, + required this.city, + required this.district, + }); + + factory PickedCityModel.fromId( + {required int provinceId, required int cityId, required int distrctId}) { + var provinces = + HiveStore.dataBox!.get('cities').cast().toList(); + final _province = + provinces.firstWhere((element) => element.id == provinceId); + final _city = + _province.cityList.firstWhere((element) => element.id == cityId); + final _district = + _city.cityList.firstWhere((element) => element.id == distrctId); + + return PickedCityModel( + province: _province, + city: _city, + district: _district, + ); + } + + String get address => province.name + city.name + district.name; + + int get id => district.id; + + @override + List get props => [province, city, district]; +} diff --git a/lib/saas_models/login/picked_city_model.g.dart b/lib/saas_models/login/picked_city_model.g.dart new file mode 100644 index 0000000..546da83 --- /dev/null +++ b/lib/saas_models/login/picked_city_model.g.dart @@ -0,0 +1,60 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'picked_city_model.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class PickedCityModelAdapter extends TypeAdapter { + @override + final int typeId = 6; + + @override + PickedCityModel read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return PickedCityModel( + province: fields[0] as ChinaRegionModel, + city: fields[1] as ChinaRegionModel, + district: fields[2] as ChinaRegionModel, + ); + } + + @override + void write(BinaryWriter writer, PickedCityModel obj) { + writer + ..writeByte(3) + ..writeByte(0) + ..write(obj.province) + ..writeByte(1) + ..write(obj.city) + ..writeByte(2) + ..write(obj.district); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is PickedCityModelAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PickedCityModel _$PickedCityModelFromJson(Map json) => + PickedCityModel( + province: + ChinaRegionModel.fromJson(json['province'] as Map), + city: ChinaRegionModel.fromJson(json['city'] as Map), + district: + ChinaRegionModel.fromJson(json['district'] as Map), + ); diff --git a/lib/saas_models/net_model/base_list_model.dart b/lib/saas_models/net_model/base_list_model.dart new file mode 100644 index 0000000..53816ba --- /dev/null +++ b/lib/saas_models/net_model/base_list_model.dart @@ -0,0 +1,29 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'base_list_model.g.dart'; + +@JsonSerializable() +class BaseListModel { + final int pages; + final List rows; + final int total; + + BaseListModel.zero({ + this.total = 0, + this.pages = 0, + this.rows = const [], + }); + + BaseListModel.err({ + this.pages = 0, + this.total = 0, + this.rows = const [], + }); + factory BaseListModel.fromJson(Map json) => + _$BaseListModelFromJson(json); + const BaseListModel({ + required this.pages, + required this.rows, + required this.total, + }); +} diff --git a/lib/saas_models/net_model/base_list_model.g.dart b/lib/saas_models/net_model/base_list_model.g.dart new file mode 100644 index 0000000..251b50b --- /dev/null +++ b/lib/saas_models/net_model/base_list_model.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'base_list_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BaseListModel _$BaseListModelFromJson(Map json) => + BaseListModel( + pages: json['pages'] as int, + rows: json['rows'] as List, + total: json['total'] as int, + ); diff --git a/lib/saas_models/net_model/base_model.dart b/lib/saas_models/net_model/base_model.dart new file mode 100644 index 0000000..c9d2d9e --- /dev/null +++ b/lib/saas_models/net_model/base_model.dart @@ -0,0 +1,26 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'base_model.g.dart'; + +@JsonSerializable(includeIfNull: false) +class BaseModel { + final int code; + final String msg; + final bool success; + final dynamic data; + + factory BaseModel.fromJson(Map json) => + _$BaseModelFromJson(json); + + static BaseModel error( + {String? message, bool? success, dynamic data, int? code}) => + BaseModel( + code: code ?? 0, msg: message ?? '未知错误', success: success ?? false); + + BaseModel({ + required this.code, + required this.msg, + required this.success, + this.data, + }); +} diff --git a/lib/saas_models/net_model/base_model.g.dart b/lib/saas_models/net_model/base_model.g.dart new file mode 100644 index 0000000..4e7be45 --- /dev/null +++ b/lib/saas_models/net_model/base_model.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'base_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BaseModel _$BaseModelFromJson(Map json) => BaseModel( + code: json['code'] as int, + msg: json['msg'] as String, + success: json['success'] as bool, + data: json['data'], + ); diff --git a/lib/saas_models/user/user_info_model.dart b/lib/saas_models/user/user_info_model.dart new file mode 100644 index 0000000..f207882 --- /dev/null +++ b/lib/saas_models/user/user_info_model.dart @@ -0,0 +1,58 @@ +import 'package:aku_new_community_manager/models/common/img_model.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'user_info_model.g.dart'; + +@JsonSerializable() +class UserInfoModel { + final int id; + final int communityId; + final String communityCode; + final String? name; + final String? idCard; + final String tel; + + // 性别 1.男 2.女 3.保密 + final int? sex; + final String? nickName; + final bool isExistPassword; + final bool isPointsSignSetting; + final bool isSign; + final int? points; + final List imgList; + + String get sexValue { + if (sex == 1) return '男'; + if (sex == 2) return '女'; + if (sex == 3) return '保密'; + return '未设置'; + } + + // DateTime? get birthdayDate => DateUtil.getDateTime(birthday ?? ''); + + // String get birthdayValue { + // if (TextUtil.isEmpty(birthday)) + // return '未设置'; + // else + // return DateUtil.formatDate(birthdayDate, format: 'yyyy-MM-dd'); + // } + + factory UserInfoModel.fromJson(Map json) => + _$UserInfoModelFromJson(json); + + const UserInfoModel({ + required this.id, + required this.communityId, + required this.communityCode, + this.name, + this.idCard, + required this.tel, + this.sex, + this.nickName, + required this.isExistPassword, + required this.isPointsSignSetting, + required this.isSign, + this.points, + required this.imgList, + }); +} diff --git a/lib/saas_models/user/user_info_model.g.dart b/lib/saas_models/user/user_info_model.g.dart new file mode 100644 index 0000000..dc46024 --- /dev/null +++ b/lib/saas_models/user/user_info_model.g.dart @@ -0,0 +1,26 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_info_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserInfoModel _$UserInfoModelFromJson(Map json) => + UserInfoModel( + id: json['id'] as int, + communityId: json['communityId'] as int, + communityCode: json['communityCode'] as String, + name: json['name'] as String?, + idCard: json['idCard'] as String?, + tel: json['tel'] as String, + sex: json['sex'] as int?, + nickName: json['nickName'] as String?, + isExistPassword: json['isExistPassword'] as bool, + isPointsSignSetting: json['isPointsSignSetting'] as bool, + isSign: json['isSign'] as bool, + points: json['points'] as int?, + imgList: (json['imgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + ); diff --git a/lib/tools/user_tool.dart b/lib/tools/user_tool.dart index b6f0037..195ad82 100644 --- a/lib/tools/user_tool.dart +++ b/lib/tools/user_tool.dart @@ -1,11 +1,11 @@ // Package imports: -import 'package:aku_new_community_manager/provider/message_provider.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/provider/app_provider.dart'; +import 'package:aku_new_community_manager/provider/data_provider.dart'; +import 'package:aku_new_community_manager/provider/message_provider.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; ///获取应用或用户状态 class UserTool { @@ -18,7 +18,12 @@ class UserTool { Provider.of(Get.context!, listen: false); ///消息中心 - static MessageProvider get messageProvider => Provider.of(Get.context!,listen: false); + static MessageProvider get messageProvider => + Provider.of(Get.context!, listen: false); + + ///本地存储数据信息 + static DataProvider get dataProvider => + Provider.of(Get.context!, listen: false); UserTool(); } diff --git a/lib/ui/home/announcement/All_anouncement.dart b/lib/ui/home/announcement/All_anouncement.dart index 2566142..f6745b5 100644 --- a/lib/ui/home/announcement/All_anouncement.dart +++ b/lib/ui/home/announcement/All_anouncement.dart @@ -1,27 +1,24 @@ // Dart imports: import 'dart:ui'; -// Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/const/resource.dart'; import 'package:aku_new_community_manager/models/announce/announcement_detail_model.dart'; import 'package:aku_new_community_manager/models/announce/announcement_list_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/home/announcement/anouncement_details.dart'; +// Flutter imports: +import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; class AllAnouncement extends StatefulWidget { AllAnouncement({Key? key}) : super(key: key); @@ -146,7 +143,7 @@ class AllAnouncementState extends State { path: API.message.announcementList, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => AnnouncementListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 21be13f..8d1999b 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -12,6 +12,7 @@ import 'package:aku_new_community_manager/models/todo_bussiness/todo_outdoor_mod import 'package:aku_new_community_manager/provider/app_provider.dart'; import 'package:aku_new_community_manager/provider/message_provider.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/style/app_style.dart'; import 'package:aku_new_community_manager/tools/screen_tool.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; @@ -33,7 +34,6 @@ import 'package:aku_new_community_manager/ui/tool_pages/warning/warning_page.dar import 'package:aku_new_community_manager/ui/widgets/app_widgets/aku_avatar.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_list_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:aku_new_community_manager/utils/websocket/web_socket_util.dart'; // Package imports: @@ -172,7 +172,7 @@ class _HomePageState extends State { "pageNum": 1, "size": 3, })); - List anounceModels = baseListModel.tableList! + List anounceModels = baseListModel.rows .map((e) => AnnouncementListModel.fromJson(e)) .toList(); return anounceModels; diff --git a/lib/ui/home/messages/comment_message.dart b/lib/ui/home/messages/comment_message.dart index 2870671..95f82c5 100644 --- a/lib/ui/home/messages/comment_message.dart +++ b/lib/ui/home/messages/comment_message.dart @@ -1,11 +1,4 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/message/comment_message_item_model.dart'; @@ -13,6 +6,11 @@ import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/ui/home/messages/comment_message_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; class CommentMessage extends StatefulWidget { CommentMessage({Key? key}) : super(key: key); @@ -31,9 +29,8 @@ class _CommentMessageState extends State { body: BeeListView( controller: _refreshController, path: API.message.commentList, - convert: (model) => model.tableList! - .map((e) => CommentMessageItemModel.fromJson(e)) - .toList(), + convert: (model) => + model.rows.map((e) => CommentMessageItemModel.fromJson(e)).toList(), builder: (items) { return ListView.separated( padding: EdgeInsets.symmetric(horizontal: 32.w), diff --git a/lib/ui/home/messages/comment_message_card.dart b/lib/ui/home/messages/comment_message_card.dart index 5927d32..049830e 100644 --- a/lib/ui/home/messages/comment_message_card.dart +++ b/lib/ui/home/messages/comment_message_card.dart @@ -1,20 +1,17 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_rating_bar/flutter_rating_bar.dart'; - -// Package imports: -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:shimmer/shimmer.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/message/comment_message_detail_model.dart'; import 'package:aku_new_community_manager/models/message/comment_message_item_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_rating_bar/flutter_rating_bar.dart'; +// Package imports: +import 'package:shimmer/shimmer.dart'; +import 'package:velocity_x/velocity_x.dart'; class CommentMessageCard extends StatefulWidget { final CommentMessageItemModel itemModel; @@ -295,7 +292,7 @@ class _CommentMessageCardState extends State { // color: AppStyle.primaryTextColor, // fontSize: 28.sp)), RatingBar.builder( - ignoreGestures: true, + ignoreGestures: true, initialRating: model.level!.toDouble(), itemSize: 40.w, allowHalfRating: true, diff --git a/lib/ui/home/messages/message.dart b/lib/ui/home/messages/message.dart index e68f638..9db401f 100644 --- a/lib/ui/home/messages/message.dart +++ b/lib/ui/home/messages/message.dart @@ -8,7 +8,7 @@ import 'package:aku_new_community_manager/ui/home/messages/comment_message.dart' import 'package:aku_new_community_manager/ui/home/messages/system/system_message.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; // Package imports: import 'package:dio/dio.dart'; @@ -162,7 +162,7 @@ class _MessageState extends State { onpressed: () async { BaseModel baseModel = await NetUtil().get(API.message.allReadSysMes); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { messageProvider.updateMessage(); Get.to(() => SystemMessage()); } @@ -180,7 +180,7 @@ class _MessageState extends State { onpressed: () async { BaseModel baseModel = await NetUtil().get(API.message.allReadCommentMes); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { messageProvider.updateMessage(); Get.to(() => CommentMessage()); } diff --git a/lib/ui/home/messages/system/system_message.dart b/lib/ui/home/messages/system/system_message.dart index 1d0230f..1b403fb 100644 --- a/lib/ui/home/messages/system/system_message.dart +++ b/lib/ui/home/messages/system/system_message.dart @@ -1,22 +1,20 @@ // Flutter imports: +// Project imports: +import 'package:aku_new_community_manager/const/api.dart'; +import 'package:aku_new_community_manager/models/message/system_message_item_model.dart'; +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/ui/home/messages/system/system_message_card.dart'; import 'package:aku_new_community_manager/ui/home/messages/system/system_message_green_card.dart'; import 'package:aku_new_community_manager/ui/home/messages/system/system_message_hygience_card.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; - // Package imports: import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; -// Project imports: -import 'package:aku_new_community_manager/const/api.dart'; -import 'package:aku_new_community_manager/models/message/system_message_item_model.dart'; -import 'package:aku_new_community_manager/style/app_style.dart'; -import 'package:aku_new_community_manager/ui/home/messages/system/system_message_card.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; - class SystemMessage extends StatefulWidget { SystemMessage({Key? key}) : super(key: key); @@ -46,9 +44,8 @@ class _SystemMessageState extends State { itemCount: items.length); }, path: API.message.systemList, - convert: (model) => model.tableList! - .map((e) => SystemMessageItemModel.fromJson(e)) - .toList(), + convert: (model) => + model.rows.map((e) => SystemMessageItemModel.fromJson(e)).toList(), ), ); } @@ -77,7 +74,7 @@ class _SystemMessageState extends State { return SystemMessageHygienceCard( relationId: model.relationId!, date: _date, type: 4); case 5: - return SystemMessageHygienceCard( + return SystemMessageHygienceCard( relationId: model.relationId!, date: _date, type: 5); default: return Container(); diff --git a/lib/ui/home/messages/system/system_message_card.dart b/lib/ui/home/messages/system/system_message_card.dart index c0ecce9..792f524 100644 --- a/lib/ui/home/messages/system/system_message_card.dart +++ b/lib/ui/home/messages/system/system_message_card.dart @@ -1,23 +1,20 @@ // Flutter imports: import 'dart:async'; -import 'package:aku_new_community_manager/ui/home/messages/message_map.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:shimmer/shimmer.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/message/system_message_detail_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/ui/home/messages/message_map.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:get/get.dart'; +import 'package:shimmer/shimmer.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; class SystemMessageCard extends StatefulWidget { final int relationId; @@ -26,7 +23,8 @@ class SystemMessageCard extends StatefulWidget { SystemMessageCard({ Key? key, required this.relationId, - required this.date, required this.type, + required this.date, + required this.type, }) : super(key: key); @override @@ -189,152 +187,145 @@ class _SystemMessageCardState extends State { Widget _messageList(SystemMessageDetailModel? model) { return Column( + children: [ + widget.date == null ? 16.w.heightBox : SizedBox(), + widget.date == null + ? SizedBox() + : Container( + margin: EdgeInsets.only(top: 24.w, bottom: 24.w), + alignment: Alignment.center, + width: double.infinity, + child: Text( + widget.date!, + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 24.sp), + ), + ), + Container( + padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w), + color: Color(0xFFFFFFFF), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - - widget.date==null?16.w.heightBox:SizedBox(), - widget.date == null - ? SizedBox() - : Container( - margin: EdgeInsets.only(top: 24.w, bottom: 24.w), - alignment: Alignment.center, - width: double.infinity, - child: Text( - widget.date!, - style: TextStyle( - color: AppStyle.minorTextColor, fontSize: 24.sp), - ), - ), - Container( - padding: EdgeInsets.only(top:24.w,left: 24.w, right: 24.w), - color: Color(0xFFFFFFFF), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row(children: [ - // Container( - // width: 16.w, - // height: 16.w, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(8.w), - // color: Color(0xFFFF4501)), - // ), - // SizedBox( - // width: 16.w, - // ), + Row(children: [ + // Container( + // width: 16.w, + // height: 16.w, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(8.w), + // color: Color(0xFFFF4501)), + // ), + // SizedBox( + // width: 16.w, + // ), + Text( + '系统通知', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.w600), + ), + SizedBox(height: 8.w), + ]), + Text( + '你有一条新的${MessageMap.sysType(widget.type)},请立即处理', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold), + ), + SizedBox(height: 24.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text( + '报修人员', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp), + ), + Spacer(), + Text( + model!.name!, + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp), + ), + ], + ), + SizedBox(height: 16.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PHONE_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text('联系电话', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp)), + Spacer(), + Text(model.tel!, + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp)), + ], + ), + SizedBox(height: 16.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_AREA_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text('服务类型', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp)), + Spacer(), + Text('${model.typeString}', + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp)), + ], + ), + SizedBox(height: 16.w), + Divider( + height: 1.w, + ), + AkuButton( + onPressed: () { + Get.to(() => BusinessAndFixPage()); + }, + child: Container( + height: 88.w, + alignment: Alignment.center, + child: Row( + children: [ Text( - '系统通知', + '查看详情', style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 32.sp, - fontWeight: FontWeight.w600), - ), - SizedBox(height: 8.w), - ]), - Text( - '你有一条新的${MessageMap.sysType(widget.type)},请立即处理', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold), - ), - SizedBox(height: 24.w), - Row( - children: [ - Image.asset( - R.ASSETS_MESSAGE_IC_PEOPLE_PNG, - width: 40.w, - height: 40.w, - ), - SizedBox( - width: 4.w, - ), - Text( - '报修人员', - style: TextStyle( - color: AppStyle.minorTextColor, fontSize: 28.sp), - ), - Spacer(), - Text( - model!.name!, - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp), - ), - ], - ), - SizedBox(height: 16.w), - Row( - children: [ - Image.asset( - R.ASSETS_MESSAGE_IC_PHONE_PNG, - width: 40.w, - height: 40.w, - ), - SizedBox( - width: 4.w, - ), - Text('联系电话', - style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 28.sp)), - Spacer(), - Text(model.tel!, - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp)), - ], - ), - SizedBox(height: 16.w), - Row( - children: [ - Image.asset( - R.ASSETS_MESSAGE_IC_AREA_PNG, - width: 40.w, - height: 40.w, - ), - SizedBox( - width: 4.w, - ), - Text('服务类型', - style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 28.sp)), - Spacer(), - Text('${model.typeString}', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp)), - ], - ), - SizedBox(height: 16.w), - Divider( - height: 1.w, - ), - AkuButton( - onPressed: () { - Get.to(() => BusinessAndFixPage()); - }, - child: Container( - height: 88.w, - alignment: Alignment.center, - child: Row( - children: [ - Text( - '查看详情', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp), - ), - Spacer(), - Icon(Icons.arrow_forward_ios, size: 22.w), - ], - ), + color: AppStyle.primaryTextColor, fontSize: 28.sp), ), - ), - ], + Spacer(), + Icon(Icons.arrow_forward_ios, size: 22.w), + ], + ), ), ), ], - ); + ), + ), + ], + ); } } diff --git a/lib/ui/home/messages/system/system_message_green_card.dart b/lib/ui/home/messages/system/system_message_green_card.dart index 4ca740a..83e32ca 100644 --- a/lib/ui/home/messages/system/system_message_green_card.dart +++ b/lib/ui/home/messages/system/system_message_green_card.dart @@ -1,24 +1,22 @@ // Flutter imports: import 'dart:async'; +// Project imports: +import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/message/system_message_green_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; +import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/ui/home/messages/message_map.dart'; import 'package:aku_new_community_manager/ui/manage_pages/green_manage/green_manage_page.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; +import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:flutter/material.dart'; - // Package imports: import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:shimmer/shimmer.dart'; import 'package:velocity_x/velocity_x.dart'; -// Project imports: -import 'package:aku_new_community_manager/const/api.dart'; -import 'package:aku_new_community_manager/style/app_style.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; -import 'package:aku_new_community_manager/utils/network/net_util.dart'; - class SystemMessageGreenCard extends StatefulWidget { final int relationId; final String? date; @@ -51,7 +49,7 @@ class _SystemMessageGreenCardState extends State { Widget build(BuildContext context) { return (_systemModel == null || _onLoad) ? _loadingWidget() - :_messageList(_systemModel!); + : _messageList(_systemModel!); } Future getSystemMessage(int repairId) async { @@ -59,7 +57,7 @@ class _SystemMessageGreenCardState extends State { await NetUtil().get(API.message.getSysGreenMessageById, params: { "greenTaskId": repairId, }); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { return SystemMessageGreenModel.fromJson(baseModel.data); } else { return SystemMessageGreenModel.fail(); @@ -193,153 +191,146 @@ class _SystemMessageGreenCardState extends State { } Widget _messageList(SystemMessageGreenModel model) { - return Column( + return Column( + children: [ + widget.date == null ? 16.w.heightBox : SizedBox(), + widget.date == null + ? SizedBox() + : Container( + margin: EdgeInsets.only(top: 24.w, bottom: 24.w), + alignment: Alignment.center, + width: double.infinity, + child: Text( + widget.date!, + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 24.sp), + ), + ), + Container( + padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w), + color: Color(0xFFFFFFFF), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - - widget.date==null?16.w.heightBox:SizedBox(), - widget.date == null - ? SizedBox() - : Container( - margin: EdgeInsets.only(top: 24.w, bottom: 24.w), - alignment: Alignment.center, - width: double.infinity, - child: Text( - widget.date!, - style: TextStyle( - color: AppStyle.minorTextColor, fontSize: 24.sp), - ), - ), - Container( - padding: EdgeInsets.only(top:24.w,left: 24.w, right: 24.w), - color: Color(0xFFFFFFFF), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row(children: [ - // Container( - // width: 16.w, - // height: 16.w, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(8.w), - // color: Color(0xFFFF4501)), - // ), - // SizedBox( - // width: 16.w, - // ), + Row(children: [ + // Container( + // width: 16.w, + // height: 16.w, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(8.w), + // color: Color(0xFFFF4501)), + // ), + // SizedBox( + // width: 16.w, + // ), + Text( + '系统通知', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.w600), + ), + SizedBox(height: 8.w), + ]), + Text( + '你有一条新的${MessageMap.sysType(widget.type)},请立即处理', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold), + ), + SizedBox(height: 24.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text( + '保修人', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp), + ), + Spacer(), + Text( + model.name, + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp), + ), + ], + ), + SizedBox(height: 16.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PHONE_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text('联系电话', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp)), + Spacer(), + Text(model.tel, + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp)), + ], + ), + SizedBox(height: 16.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_AREA_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text('报修区域', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp)), + Spacer(), + Text('area', + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp)), + ], + ), + SizedBox(height: 16.w), + Divider( + height: 1.w, + ), + AkuButton( + onPressed: () { + Get.to(() => GreenManagePage()); + }, + child: Container( + height: 88.w, + alignment: Alignment.center, + child: Row( + children: [ Text( - '系统通知', + '查看详情', style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 32.sp, - fontWeight: FontWeight.w600), + color: AppStyle.primaryTextColor, fontSize: 28.sp), ), - SizedBox(height: 8.w), - ]), - Text( - '你有一条新的${MessageMap.sysType(widget.type)},请立即处理', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold), - ), - SizedBox(height: 24.w), - Row( - children: [ - Image.asset( - R.ASSETS_MESSAGE_IC_PEOPLE_PNG, - width: 40.w, - height: 40.w, - ), - SizedBox( - width: 4.w, - ), - Text( - '保修人', - style: TextStyle( - color: AppStyle.minorTextColor, fontSize: 28.sp), - ), - Spacer(), - Text( - model.name, - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp), - ), - ], - ), - SizedBox(height: 16.w), - Row( - children: [ - Image.asset( - R.ASSETS_MESSAGE_IC_PHONE_PNG, - width: 40.w, - height: 40.w, - ), - SizedBox( - width: 4.w, - ), - Text('联系电话', - style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 28.sp)), - Spacer(), - Text(model.tel, - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp)), - ], - ), - SizedBox(height: 16.w), - Row( - children: [ - Image.asset( - R.ASSETS_MESSAGE_IC_AREA_PNG, - width: 40.w, - height: 40.w, - ), - SizedBox( - width: 4.w, - ), - Text('报修区域', - style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 28.sp)), - Spacer(), - Text('area', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp)), - ], - ), - SizedBox(height: 16.w), - Divider( - height: 1.w, - ), - AkuButton( - onPressed: () { - Get.to(() => GreenManagePage()); - }, - child: Container( - height: 88.w, - alignment: Alignment.center, - child: Row( - children: [ - Text( - '查看详情', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp), - ), - Spacer(), - Icon(Icons.arrow_forward_ios, size: 22.w), - ], - ), - ), - ), - ], + Spacer(), + Icon(Icons.arrow_forward_ios, size: 22.w), + ], + ), ), ), ], - ); + ), + ), + ], + ); } } diff --git a/lib/ui/home/messages/system/system_message_house_keeping_card.dart b/lib/ui/home/messages/system/system_message_house_keeping_card.dart index 5eb7652..8e70fdf 100644 --- a/lib/ui/home/messages/system/system_message_house_keeping_card.dart +++ b/lib/ui/home/messages/system/system_message_house_keeping_card.dart @@ -4,7 +4,7 @@ import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/ui/home/messages/message_map.dart'; import 'package:aku_new_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -51,7 +51,7 @@ class _SystemMessageHouseKeepingCardState await NetUtil().get(API.message.getSysHygienceMessageById, params: { "housekeepingServiceId": relationId, }); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { return SystemMessageHouseKeepingModel.fromJson(baseModel.data); } } diff --git a/lib/ui/home/messages/system/system_message_hygience_card.dart b/lib/ui/home/messages/system/system_message_hygience_card.dart index 5a49717..2deb1b5 100644 --- a/lib/ui/home/messages/system/system_message_hygience_card.dart +++ b/lib/ui/home/messages/system/system_message_hygience_card.dart @@ -1,23 +1,21 @@ // Flutter imports: import 'dart:async'; +// Project imports: +import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/message/system_message_hygience_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; +import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/ui/home/messages/message_map.dart'; import 'package:aku_new_community_manager/ui/manage_pages/hygience_manage/hygience_manage_page.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; +import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:flutter/material.dart'; - // Package imports: import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:shimmer/shimmer.dart'; -import 'package:velocity_x/velocity_x.dart'; - -// Project imports: -import 'package:aku_new_community_manager/const/api.dart'; -import 'package:aku_new_community_manager/style/app_style.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; -import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; class SystemMessageHygienceCard extends StatefulWidget { final int relationId; @@ -60,7 +58,7 @@ class _SystemMessageHygienceCardState extends State { await NetUtil().get(API.message.getSysHygienceMessageById, params: { "hygieneTaskId": repairId, }); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { return SystemMessageHygineceModel.fromJson(baseModel.data); } } diff --git a/lib/ui/manage_pages/clock_in_out/clock_func.dart b/lib/ui/manage_pages/clock_in_out/clock_func.dart index 927496f..3db8364 100644 --- a/lib/ui/manage_pages/clock_in_out/clock_func.dart +++ b/lib/ui/manage_pages/clock_in_out/clock_func.dart @@ -1,7 +1,7 @@ import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/clock_in_out/today_clock_record_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:common_utils/common_utils.dart'; @@ -10,10 +10,10 @@ import 'package:flutter/material.dart'; class ClockFunc { static Future initClockInfo() async { BaseModel baseModel = await NetUtil().get(API.manage.todayClockRecord); - if (baseModel.status! && baseModel.data != null) { + if (baseModel.success! && baseModel.data != null) { return TodayClockRecordModel.fromJson(baseModel.data); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } } @@ -50,7 +50,7 @@ class ClockFunc { "endDate": DateUtil.formatDate(end, format: 'yyyy-MM-dd HH:mm:ss') }, showMessage: true); - return baseModel.status; + return baseModel.success; } static Color lateOrLeaveEarlyColor( diff --git a/lib/ui/manage_pages/clock_in_out/clock_in_out_view.dart b/lib/ui/manage_pages/clock_in_out/clock_in_out_view.dart index cc2d7bc..fa7a05a 100644 --- a/lib/ui/manage_pages/clock_in_out/clock_in_out_view.dart +++ b/lib/ui/manage_pages/clock_in_out/clock_in_out_view.dart @@ -43,7 +43,7 @@ class _ClockInOutViewState extends State { path: API.manage.clockRecord, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => ClockRecordListModel.fromJson(e)) .toList(); }, @@ -65,7 +65,7 @@ class _ClockInOutViewState extends State { path: API.manage.clockApplyRecord, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => ClockApplyRecordListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_func.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_func.dart index b64c591..3d4dc5a 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_func.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_func.dart @@ -20,7 +20,7 @@ class EngineerRepairFunc { 'reportDetail': reportDetail, 'fileUrls': urls, }); - return model.status ?? false; + return model.success; } static Future getEngineerRepairDetail( @@ -28,7 +28,7 @@ class EngineerRepairFunc { var model = await NetUtil().get(API.engineerRepair.detail, params: {'repairEngineeringId': repairEngineeringId}); - if (model.status ?? false) { + if (model.success) { return EngineerRepairDetailModel.fromJson(model.data); } else { return null; @@ -40,7 +40,7 @@ class EngineerRepairFunc { var model = await NetUtil().get(API.engineerRepair.process, params: {'repairEngineeringId': repairEngineeringId}); - if (model.status ?? false) { + if (model.success) { return (model.data as List) .map((e) => EngineerRepairProcessModel.fromJson(e)) .toList(); @@ -54,7 +54,7 @@ class EngineerRepairFunc { var model = await NetUtil().get(API.engineerRepair.workReport, params: {'repairEngineeringId': repairEngineeringId}); - if (model.status ?? false) { + if (model.success) { return (model.data as List) .map((e) => EngineerRepairWorkReportModel.fromJson(e)) .toList(); @@ -68,7 +68,7 @@ class EngineerRepairFunc { API.engineerRepair.organization, ); - if (model.status ?? false) { + if (model.success) { return (model.data as List) .map((e) => EngineerRepairOrganizationModel.fromJson(e)) .toList(); @@ -82,7 +82,7 @@ class EngineerRepairFunc { var model = await NetUtil().get(API.engineerRepair.persons, params: {'repairOrganizationId': organizationId}); - if (model.status ?? false) { + if (model.success) { return (model.data as List) .map((e) => EngineerRepairPersonModel.fromJson(e)) .toList(); @@ -94,20 +94,20 @@ class EngineerRepairFunc { static Future companySend(int repairId, int organizationId) async { var model = await NetUtil().post(API.engineerRepair.companySend, params: {'id': repairId, 'organizationId': organizationId}); - return model.status ?? false; + return model.success; } static Future personSend(int repairId, int maintenanceStaffId) async { var model = await NetUtil().post(API.engineerRepair.personSend, params: {'id': repairId, 'maintenanceStaff': maintenanceStaffId}); - return model.status ?? false; + return model.success; } static Future personPick(int repairId) async { var model = await NetUtil().post(API.engineerRepair.personPick, params: { 'id': repairId, }); - return model.status ?? false; + return model.success; } static Future uploadReportImages(List files) async { @@ -123,7 +123,7 @@ class EngineerRepairFunc { 'content': detail, 'workReportImgUrls': urls, }); - return model.status ?? false; + return model.success; } static Future complete( @@ -138,7 +138,7 @@ class EngineerRepairFunc { 'billMaterials': material, 'maintenanceImgUrls': urls, }); - return model.status ?? false; + return model.success; } static Future uploadCompleteImages(List files) async { @@ -151,7 +151,7 @@ class EngineerRepairFunc { var model = await NetUtil().get(API.engineerRepair.repairResult, params: { 'repairEngineeringId': repairId, }); - if (model.status ?? false) { + if (model.success) { return EngineerRepairResultModel.fromJson(model.data); } else { return null; @@ -168,7 +168,7 @@ class EngineerRepairFunc { 'advice': advice, 'acceptanceImgUrls': urls, }); - return model.status ?? false; + return model.success; } static Future uploadAcceptanceImages(List files) async { @@ -182,7 +182,7 @@ class EngineerRepairFunc { await NetUtil().get(API.engineerRepair.acceptanceRecordNew, params: { 'repairEngineeringId': repairId, }); - if (model.status ?? false) { + if (model.success) { return EngineerRepairNewAcceptanceRecordModel.fromJson(model.data); } else { return null; @@ -195,7 +195,7 @@ class EngineerRepairFunc { await NetUtil().get(API.engineerRepair.acceptanceRecordList, params: { 'repairEngineeringId': repairId, }); - if (model.status ?? false) { + if (model.success) { return (model.data as List) .map((e) => EngineerRepairNewAcceptanceRecordModel.fromJson(e)) .toList(); @@ -209,6 +209,6 @@ class EngineerRepairFunc { await NetUtil().post(API.engineerRepair.startRectification, params: { 'id': repairId, }); - return model.status ?? false; + return model.success; } } diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart index 6d50cc3..ae8cff5 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart @@ -51,7 +51,7 @@ class _EngineerRepairViewState extends State { }, controller: widget.controller, convert: (models) { - return models.tableList! + return models.rows .map((e) => EngineerRepairListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/manage_pages/facilities/facilities_inspect_report_detail_page.dart b/lib/ui/manage_pages/facilities/facilities_inspect_report_detail_page.dart index 8f772b5..3fe3f12 100644 --- a/lib/ui/manage_pages/facilities/facilities_inspect_report_detail_page.dart +++ b/lib/ui/manage_pages/facilities/facilities_inspect_report_detail_page.dart @@ -11,7 +11,7 @@ import 'package:aku_new_community_manager/ui/widgets/app_widgets/aku_single_chec import 'package:aku_new_community_manager/ui/widgets/app_widgets/bee_grid_image_view.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; @@ -104,10 +104,10 @@ class _FacilitiesInspectReportDetailPageState "detail": _describtion, "imgUrls": _scenePhotoUrl, }); - if (baseModel.status!) { + if (baseModel.success!) { Get.back(); } - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); }, width: double.infinity, height: 100.w, diff --git a/lib/ui/manage_pages/facilities/facilities_inspect_report_page.dart b/lib/ui/manage_pages/facilities/facilities_inspect_report_page.dart index bd53e56..54990e1 100644 --- a/lib/ui/manage_pages/facilities/facilities_inspect_report_page.dart +++ b/lib/ui/manage_pages/facilities/facilities_inspect_report_page.dart @@ -11,7 +11,7 @@ import 'package:aku_new_community_manager/ui/widgets/app_widgets/aku_single_chec import 'package:aku_new_community_manager/ui/widgets/app_widgets/bee_grid_image_view.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; @@ -78,10 +78,10 @@ class _FacilitiesInspectReportPageState "detail": _describtion, "imgUrls": _scenePhotoUrl, }); - if (baseModel.status!) { + if (baseModel.success!) { Get.back(); } - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); }, width: double.infinity, height: 100.w, diff --git a/lib/ui/manage_pages/facilities/facilities_view.dart b/lib/ui/manage_pages/facilities/facilities_view.dart index 8c7330c..1e90b8f 100644 --- a/lib/ui/manage_pages/facilities/facilities_view.dart +++ b/lib/ui/manage_pages/facilities/facilities_view.dart @@ -5,17 +5,17 @@ import 'package:aku_new_community_manager/ui/manage_pages/facilities/facilities_ import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Package imports: import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; // Project imports: class FacilitiesView extends StatefulWidget { final int index; final int facilitiesType; - FacilitiesView({Key? key, required this.index, required this.facilitiesType}) : super(key: key); + FacilitiesView({Key? key, required this.index, required this.facilitiesType}) + : super(key: key); @override _FacilitiesViewState createState() => _FacilitiesViewState(); @@ -45,7 +45,7 @@ class _FacilitiesViewState extends State { }, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => FacilitiesCheckListModel.fromJson(e)) .toList(); }, @@ -59,7 +59,8 @@ class _FacilitiesViewState extends State { model: items[index], callRefresh: () { _refreshController!.callRefresh(); - }, executeStatus: widget.index + 1, + }, + executeStatus: widget.index + 1, ); }, separatorBuilder: (_, __) { diff --git a/lib/ui/manage_pages/green_manage/green_manage_card.dart b/lib/ui/manage_pages/green_manage/green_manage_card.dart index 85da581..72026c3 100644 --- a/lib/ui/manage_pages/green_manage/green_manage_card.dart +++ b/lib/ui/manage_pages/green_manage/green_manage_card.dart @@ -1,30 +1,30 @@ // Flutter imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/green_manage/green_manage_list_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; +// Project imports: +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/tools/aku_divider.dart'; +import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; +import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/green_manage/green_manage_details_page.dart'; +import 'package:aku_new_community_manager/ui/manage_pages/green_manage/green_manage_map.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; - // Package imports: import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:velocity_x/velocity_x.dart'; - -// Project imports: -import 'package:aku_new_community_manager/style/app_style.dart'; -import 'package:aku_new_community_manager/tools/aku_divider.dart'; -import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; -import 'package:aku_new_community_manager/tools/widget_tool.dart'; -import 'package:aku_new_community_manager/ui/manage_pages/green_manage/green_manage_map.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; class GreenManageCard extends StatefulWidget { final int index; final GreenManageListModel model; final VoidCallback? callRefresh; - GreenManageCard({Key? key, required this.index, required this.model, this.callRefresh}) + GreenManageCard( + {Key? key, required this.index, required this.model, this.callRefresh}) : super(key: key); @override @@ -163,10 +163,10 @@ class _GreenManageCardState extends State { .post(API.manage.greenManageComplete, params: { "id": widget.model.id, }); - if (baseModel.status!) { + if (baseModel.success!) { widget.callRefresh!(); } - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); }, ) ], diff --git a/lib/ui/manage_pages/green_manage/green_manage_view.dart b/lib/ui/manage_pages/green_manage/green_manage_view.dart index 1ac6725..f5981e1 100644 --- a/lib/ui/manage_pages/green_manage/green_manage_view.dart +++ b/lib/ui/manage_pages/green_manage/green_manage_view.dart @@ -1,11 +1,10 @@ // Flutter imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/green_manage/green_manage_list_model.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; -import 'package:flutter/material.dart'; - // Project imports: import 'package:aku_new_community_manager/ui/manage_pages/green_manage/green_manage_card.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.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'; @@ -41,7 +40,7 @@ class _GreenManageViewState extends State { }, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => GreenManageListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_add_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_add_page.dart index 9afb8d8..2c04ef7 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_add_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_add_page.dart @@ -1,20 +1,21 @@ import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/house_keeping/house_keeping_building_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/aku_divider.dart'; +import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_bottom_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart' hide Response; -import 'package:velocity_x/velocity_x.dart'; -import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; +import 'package:velocity_x/src/flutter/widgets.dart'; class HouseKeepingAddPage extends StatefulWidget { HouseKeepingAddPage({Key? key}) : super(key: key); @@ -94,7 +95,7 @@ class _HouseKeepingAddPageState extends State { }, showMessage: true, ); - if (baseModel.status!) { + if (baseModel.success!) { Get.back(); } } diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_func.dart b/lib/ui/manage_pages/house_keeping/house_keeping_func.dart index 587cb22..69b8aa2 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_func.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_func.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/manager/house_keeping/house_keeping_pick_staff_model.dart'; import 'package:aku_new_community_manager/json_models/manager/house_keeping/house_keeping_process_model.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; @@ -13,7 +13,7 @@ class HouseKeepingFunc { int id) async { BaseModel baseModel = await NetUtil().get(API.manage.newHouseKeepingProcess, params: {"housekeepingServiceId": id}); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { return (baseModel.data as List) .map((e) => HouseKeepingProcessModel.fromJson(e)) .toList(); @@ -28,7 +28,7 @@ class HouseKeepingFunc { await NetUtil().get(API.manage.newHouseKeepingUrgeWork, params: { "housekeepingServiceId": id, }); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { BotToast.showText(text: '已成功催单,请耐心等候'); return true; } else { @@ -42,7 +42,7 @@ class HouseKeepingFunc { await NetUtil().post(API.manage.newHouseKeepingOrderReceive, params: { "id": id, }); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { BotToast.showText(text: '接单成功'); return true; } else { @@ -54,7 +54,7 @@ class HouseKeepingFunc { static Future newHouseKeepingPickStaffList() async { BaseModel baseModel = await NetUtil().get(API.manage.newHouseKeepingPickStaffList); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { return (baseModel.data as List) .map((e) => HouseKeepingPickStaffModel.fromJson(e)) .toList(); @@ -70,11 +70,11 @@ class HouseKeepingFunc { "id": id, "handler": handlerId, }); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { BotToast.showText(text: '派单成功'); return true; } else { - BotToast.showText(text: baseModel.message ?? '派单失败'); + BotToast.showText(text: baseModel.msg); return false; } } @@ -108,11 +108,11 @@ class HouseKeepingFunc { "payFee": payFee, "handlerImgUrls": urls, }); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { BotToast.showText(text: '提交成功'); return true; } else { - BotToast.showText(text: baseModel.message ?? '提交失败'); + BotToast.showText(text: baseModel.msg); return false; } } diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_view.dart b/lib/ui/manage_pages/house_keeping/house_keeping_view.dart index 7746502..7a14a60 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_view.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_view.dart @@ -6,8 +6,8 @@ import 'package:aku_new_community_manager/ui/manage_pages/house_keeping/house_ke import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:velocity_x/velocity_x.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; class HouseKeepingView extends StatefulWidget { final int index; @@ -56,7 +56,7 @@ class _HouseKeepingViewState extends State { }, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => HouseKeepingListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/manage_pages/hygience_manage/hygience_manage_card.dart b/lib/ui/manage_pages/hygience_manage/hygience_manage_card.dart index 2406f48..ccfd196 100644 --- a/lib/ui/manage_pages/hygience_manage/hygience_manage_card.dart +++ b/lib/ui/manage_pages/hygience_manage/hygience_manage_card.dart @@ -9,7 +9,7 @@ import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/hygience_manage/hygience_manage_detail_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/hygience_manage/hygience_manage_map.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; @@ -161,10 +161,10 @@ class _HyginecManageCardState extends State { .post(API.manage.hygienceComplete, params: { "id": widget.model.id, }); - if (baseModel.status!) { + if (baseModel.success!) { widget.callRefresh!(); } - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); }, ) ], diff --git a/lib/ui/manage_pages/hygience_manage/hygience_manage_view.dart b/lib/ui/manage_pages/hygience_manage/hygience_manage_view.dart index 003c686..d6ba4ae 100644 --- a/lib/ui/manage_pages/hygience_manage/hygience_manage_view.dart +++ b/lib/ui/manage_pages/hygience_manage/hygience_manage_view.dart @@ -1,14 +1,13 @@ // Flutter imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/hygience_manage/heygience_list_model.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; -import 'package:flutter/material.dart'; - // Project imports: import 'package:aku_new_community_manager/ui/manage_pages/hygience_manage/hygience_manage_card.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:velocity_x/velocity_x.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; class HygienceManageView extends StatefulWidget { final int index; @@ -19,7 +18,7 @@ class HygienceManageView extends StatefulWidget { } class _HygienceManageViewState extends State { - late EasyRefreshController _refreshController; + late EasyRefreshController _refreshController; @override void initState() { super.initState(); @@ -38,16 +37,14 @@ class _HygienceManageViewState extends State { path: API.manage.hygienceList, controller: _refreshController, extraParams: { - "hygieneStatus":widget.index+1, + "hygieneStatus": widget.index + 1, }, convert: (models) { - return models.tableList! - .map((e) => HygienceListModel.fromJson(e)) - .toList(); + return models.rows.map((e) => HygienceListModel.fromJson(e)).toList(); }, builder: (items) { return ListView.separated( - padding: EdgeInsets.all(24.w), + padding: EdgeInsets.all(24.w), itemBuilder: (context, index) { return HyginecManageCard( index: widget.index, diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart index b989b3d..f956fa3 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart @@ -1,38 +1,40 @@ // Dart imports: import 'dart:async'; -// Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'package:amap_flutter_base/amap_flutter_base.dart'; -import 'package:amap_flutter_map/amap_flutter_map.dart'; -import 'package:bot_toast/bot_toast.dart'; -import 'package:common_utils/common_utils.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; -import 'package:qr_code_scanner/qr_code_scanner.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_detail_model.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_point_model.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_qrcode_model.dart'; import 'package:aku_new_community_manager/provider/app_provider.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_point_input_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/qr_scanner_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/manage_func.dart'; import 'package:aku_new_community_manager/ui/tool_pages/warning/warning_page.dart'; +// Flutter imports: +import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/utils/extension/list_extension.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:amap_flutter_base/amap_flutter_base.dart'; +import 'package:amap_flutter_map/amap_flutter_map.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; +import 'package:velocity_x/src/flutter/container.dart'; +import 'package:velocity_x/src/flutter/gesture.dart'; +import 'package:velocity_x/src/flutter/padding.dart'; +import 'package:velocity_x/src/flutter/widgets.dart'; class InspectionManageDetailsPage extends StatefulWidget { final int executeId; @@ -55,7 +57,7 @@ class _InspectionManageDetailsPageState switch (status) { case 1: return Color(0xFFFF4501); - + case 2: return Color(0xFF999999); case 3: @@ -167,20 +169,21 @@ class _InspectionManageDetailsPageState BaseModel _baseModel = await NetUtil().get( API.manage.inspectionStart, params: {"executeId": widget.executeId}); - if (_baseModel.status!) { - BotToast.showText(text: _baseModel.message!); + if (_baseModel.success!) { + BotToast.showText(text: _baseModel.msg); _refreshController!.callRefresh(); _startTimer(5000); } else { - BotToast.showText(text: _baseModel.message!); + BotToast.showText(text: _baseModel.msg); } } : () async { - Barcode result = await (Get.to(() => QrScannerPage()) ); + Barcode result = + await (Get.to(() => QrScannerPage())); BaseModel baseModel = await ManageFunc.getInspectionFindCheckDetailByQr( _detailModel!.id!, result.code); - if (baseModel.status!) { + if (baseModel.success!) { Get.to(() => InspectionPointInputPage( inspectionName: _detailModel!.name, qrModel: InspectionQRCodeModel.fromJson( @@ -507,7 +510,8 @@ class _InspectionManageDetailsPageState zoomGesturesEnabled: false, onMapCreated: (controller) { _aMapController = controller; - LatLng _target = LatLng(appProvider.location!['latitude'] as double, + LatLng _target = LatLng( + appProvider.location!['latitude'] as double, appProvider.location!['longitude'] as double); _aMapController!.moveCamera(CameraUpdate.newCameraPosition( CameraPosition(target: _target, zoom: 19))); @@ -521,9 +525,9 @@ class _InspectionManageDetailsPageState CameraPosition(target: argument.latLng, zoom: 19))); if (_canUploadLocation) { BaseModel baseModel = await (_uploadLocation(widget.executeId, - argument.latLng.longitude, argument.latLng.latitude) ); - if (!baseModel.status!) { - BotToast.showText(text: baseModel.message!); + argument.latLng.longitude, argument.latLng.latitude)); + if (!baseModel.success!) { + BotToast.showText(text: baseModel.msg); } else { _canUploadLocation = false; //绘制折线 diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_view.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_view.dart index 2560de8..a192511 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_view.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_view.dart @@ -1,20 +1,19 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_list_model.dart'; import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_manage_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; class InspectionMangeView extends StatefulWidget { - final int/*!*/ inspectionStatus; - InspectionMangeView({Key? key, required this.inspectionStatus}) : super(key: key); + final int /*!*/ inspectionStatus; + InspectionMangeView({Key? key, required this.inspectionStatus}) + : super(key: key); @override _InspectionMangeViewState createState() => _InspectionMangeViewState(); @@ -41,9 +40,7 @@ class _InspectionMangeViewState extends State { controller: _easyRefreshController, extraParams: {"inspectionStatus": widget.inspectionStatus}, convert: (models) { - return models.tableList! - .map((e) => InspectionListModel.fromJson(e)) - .toList(); + return models.rows.map((e) => InspectionListModel.fromJson(e)).toList(); }, builder: (items) { return ListView.separated( diff --git a/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart index b3a34db..2435616 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart @@ -1,24 +1,24 @@ // Flutter imports: import 'dart:async'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:common_utils/common_utils.dart'; -import 'package:dotted_border/dotted_border.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/common/img_model.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_check_detail_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_utils.dart'; import 'package:aku_new_community_manager/ui/sub_pages/manage_func.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +// Package imports: +import 'package:common_utils/common_utils.dart'; +import 'package:dotted_border/dotted_border.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; +import 'package:velocity_x/src/flutter/container.dart'; +import 'package:velocity_x/src/flutter/widgets.dart'; class InspectionPointDetailPage extends StatefulWidget { final int executePointId; @@ -48,8 +48,6 @@ class _InspectionPointDetailPageState extends State { _easyRefreshController = EasyRefreshController(); } - - @override void dispose() { _easyRefreshController?.dispose(); @@ -66,7 +64,7 @@ class _InspectionPointDetailPageState extends State { MaterialHeader(valueColor: AlwaysStoppedAnimation(kPrimaryColor)), firstRefresh: true, onRefresh: () async { - BaseModel baseModel = await (_getModels ); + BaseModel baseModel = await (_getModels); if (baseModel.data != null) { _detialModel = InspectionCheckDetialModel.fromJson(baseModel.data); _onload = false; diff --git a/lib/ui/manage_pages/inspection_manage/inspection_point_input_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_point_input_page.dart index d41d73b..a547877 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_point_input_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_point_input_page.dart @@ -1,29 +1,30 @@ // Dart imports: import 'dart:io'; -// Flutter imports: -import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_point_submit_page.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_point_submit_model.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_qrcode_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; +// Flutter imports: +import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_point_submit_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_utils.dart'; import 'package:aku_new_community_manager/ui/sub_pages/manage_func.dart'; import 'package:aku_new_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.dart'; import 'package:aku_new_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; +import 'package:velocity_x/src/flutter/container.dart'; +import 'package:velocity_x/src/flutter/padding.dart'; +import 'package:velocity_x/src/flutter/widgets.dart'; class InspectionPointInputPage extends StatefulWidget { final InspectionQRCodeModel? qrModel; @@ -63,7 +64,8 @@ class _InspectionPointInputPageState extends State { ); _submitModel.executeCheckList = List.generate( widget.qrModel!.checkVoList!.length, - (index) => ExecuteCheckList(widget.qrModel!.checkVoList![index].id, -1, ''), + (index) => + ExecuteCheckList(widget.qrModel!.checkVoList![index].id, -1, ''), ); } @@ -95,14 +97,15 @@ class _InspectionPointInputPageState extends State { .uploadFiles(_selfPhotos!, API.upload.uploadInspectionFace); _submitModel.inspectionSpaceImgPath = await NetUtil() - .uploadFiles(_scenePhots!, API.upload.uploadInspectionSpace); + .uploadFiles( + _scenePhots!, API.upload.uploadInspectionSpace); BaseModel baseModel = - await (ManageFunc.getSubmitPoint(_submitModel) ); - if (baseModel.status!) { - BotToast.showText(text: baseModel.message!); + await (ManageFunc.getSubmitPoint(_submitModel)); + if (baseModel.success!) { + BotToast.showText(text: baseModel.msg); Get.to(() => InspectionPointSubmitPage()); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } } : () {}, diff --git a/lib/ui/manage_pages/interview/interview_feedback_page.dart b/lib/ui/manage_pages/interview/interview_feedback_page.dart index 966570f..2a1a9c6 100644 --- a/lib/ui/manage_pages/interview/interview_feedback_page.dart +++ b/lib/ui/manage_pages/interview/interview_feedback_page.dart @@ -1,16 +1,16 @@ import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/interview/interview_list_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/aku_divider.dart'; +import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_bottom_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:velocity_x/velocity_x.dart'; -import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; class InterviewFeedBackPage extends StatefulWidget { final InterviewListModel model; @@ -57,7 +57,7 @@ class _InterviewFeedBackPageState extends State { }, showMessage: true, ); - if (baseModel.status!) { + if (baseModel.success!) { Get.back(); } }, @@ -83,16 +83,16 @@ class _InterviewFeedBackPageState extends State { ], ), 16.w.heightBox, - _inputWidget(_textEditingController,hintText:'请输入回复内容'), + _inputWidget(_textEditingController, hintText: '请输入回复内容'), ], ), ); } Widget _inputWidget( - TextEditingController? controller, - {String? hintText,} - ) { + TextEditingController? controller, { + String? hintText, + }) { return Container( width: double.infinity, decoration: BoxDecoration( @@ -108,12 +108,10 @@ class _InterviewFeedBackPageState extends State { autofocus: false, controller: controller, onChanged: (value) { - setState(() { - - }); + setState(() {}); }, decoration: InputDecoration( - hintText: hintText??'', + hintText: hintText ?? '', hintStyle: TextStyle( fontSize: 28.sp, color: kTextSubColor, diff --git a/lib/ui/manage_pages/interview/interview_view.dart b/lib/ui/manage_pages/interview/interview_view.dart index 95c86fd..980fa65 100644 --- a/lib/ui/manage_pages/interview/interview_view.dart +++ b/lib/ui/manage_pages/interview/interview_view.dart @@ -38,7 +38,7 @@ class _InterviewViewState extends State { "interviewStatus": widget.index + 1, }, convert: (models) { - return models.tableList! + return models.rows .map((e) => InterviewListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/manage_pages/key_manage/key_apply_record_card.dart b/lib/ui/manage_pages/key_manage/key_apply_record_card.dart index d4f5a6d..544ee47 100644 --- a/lib/ui/manage_pages/key_manage/key_apply_record_card.dart +++ b/lib/ui/manage_pages/key_manage/key_apply_record_card.dart @@ -1,12 +1,12 @@ // Flutter imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/manager/key_manage/key_manage_record_list_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; // Project imports: import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/aku_divider.dart'; import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/key_manage/key_manage_map.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; @@ -100,7 +100,7 @@ class _KeyApplyRecordCardState extends State { button = _bottomButton('重新申请', () async { BaseModel baseModel = await NetUtil() .post(API.manage.applyKey, params: {"keyId": widget.model.id}); - BotToast.showText(text: baseModel.message ?? '网络错误'); + BotToast.showText(text: baseModel.msg); widget.callRefresh!(); }, Colors.white, Colors.black) as MaterialButton?; break; diff --git a/lib/ui/manage_pages/key_manage/key_apply_record_view.dart b/lib/ui/manage_pages/key_manage/key_apply_record_view.dart index eb2b117..64f1a6f 100644 --- a/lib/ui/manage_pages/key_manage/key_apply_record_view.dart +++ b/lib/ui/manage_pages/key_manage/key_apply_record_view.dart @@ -42,7 +42,7 @@ class _KeyApplyRecordViewState extends State }, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => KeyManageRecordListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/manage_pages/key_manage/key_manage_card.dart b/lib/ui/manage_pages/key_manage/key_manage_card.dart index b62e5cb..016eb0d 100644 --- a/lib/ui/manage_pages/key_manage/key_manage_card.dart +++ b/lib/ui/manage_pages/key_manage/key_manage_card.dart @@ -1,27 +1,26 @@ // Flutter imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/key_manage/key_manage_all_key_model.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; -import 'package:aku_new_community_manager/utils/network/net_util.dart'; -import 'package:bot_toast/bot_toast.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:velocity_x/velocity_x.dart'; - +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; // Project imports: import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/aku_divider.dart'; import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/key_manage/key_manage_map.dart'; +import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:url_launcher/url_launcher.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; class KeyManageCard extends StatefulWidget { - final int/*!*/ index; + final int /*!*/ index; final KeyMangeAllKeyModel model; final VoidCallback? callRefresh; - KeyManageCard({Key? key, required this.index, required this.model, this.callRefresh}) + KeyManageCard( + {Key? key, required this.index, required this.model, this.callRefresh}) : super(key: key); @override @@ -94,7 +93,7 @@ class _KeyManageCardState extends State { button = _bottomButton('申请钥匙', () async { BaseModel baseModel = await NetUtil() .post(API.manage.applyKey, params: {"keyId": widget.model.id}); - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); widget.callRefresh!(); }, Color(0xFFFFC40C), Colors.black) as MaterialButton?; break; @@ -102,7 +101,7 @@ class _KeyManageCardState extends State { button = _bottomButton('归还钥匙', () async { BaseModel baseModel = await NetUtil() .get(API.manage.returnKey, params: {"keyId": widget.model.id}); - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); widget.callRefresh!(); }, Color(0xFFFFC40C), Colors.black) as MaterialButton?; break; diff --git a/lib/ui/manage_pages/key_manage/key_manage_view.dart b/lib/ui/manage_pages/key_manage/key_manage_view.dart index e5375da..061c5d8 100644 --- a/lib/ui/manage_pages/key_manage/key_manage_view.dart +++ b/lib/ui/manage_pages/key_manage/key_manage_view.dart @@ -1,15 +1,13 @@ // Flutter imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/key_manage/key_manage_all_key_model.dart'; +// Project imports: +import 'package:aku_new_community_manager/ui/manage_pages/key_manage/key_manage_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; - // Package imports: import 'package:flutter_screenutil/flutter_screenutil.dart'; - -// Project imports: -import 'package:aku_new_community_manager/ui/manage_pages/key_manage/key_manage_card.dart'; import 'package:velocity_x/velocity_x.dart'; class KeyManageView extends StatefulWidget { @@ -43,13 +41,13 @@ class _KeyManageViewState extends State { : API.manage.getNOReturnList, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => KeyMangeAllKeyModel.fromJson(e)) .toList(); }, builder: (items) { return ListView.separated( - padding: EdgeInsets.all(24.w), + padding: EdgeInsets.all(24.w), itemBuilder: (context, index) { return KeyManageCard( index: widget.index, diff --git a/lib/ui/manage_pages/packages_manage/add_package_page.dart b/lib/ui/manage_pages/packages_manage/add_package_page.dart index 1587782..a002fdf 100644 --- a/lib/ui/manage_pages/packages_manage/add_package_page.dart +++ b/lib/ui/manage_pages/packages_manage/add_package_page.dart @@ -1,22 +1,20 @@ // Flutter imports: -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:common_utils/common_utils.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_bottom_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; -import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; class AddPackagePage extends StatefulWidget { AddPackagePage({Key? key}) : super(key: key); @@ -139,11 +137,11 @@ class _AddPackagePageState extends State { }, ); - if (!baseModel.status!) { - BotToast.showText(text: baseModel.message!); + if (!baseModel.success!) { + BotToast.showText(text: baseModel.msg); return; } - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); Get.back(); } diff --git a/lib/ui/manage_pages/packages_manage/packages_manage_card.dart b/lib/ui/manage_pages/packages_manage/packages_manage_card.dart index 5fd092c..f1ab284 100644 --- a/lib/ui/manage_pages/packages_manage/packages_manage_card.dart +++ b/lib/ui/manage_pages/packages_manage/packages_manage_card.dart @@ -1,29 +1,27 @@ // Dart imports: -// Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:common_utils/common_utils.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; -import 'package:aku_new_community_manager/const/resource.dart'; import 'package:aku_new_community_manager/models/manager/package_manage/package_manage_list_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/aku_divider.dart'; import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +// Flutter imports: +import 'package:flutter/material.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; class PackageManageCard extends StatefulWidget { final int index; final PackageManageListModel model; final VoidCallback? callRefresh; - PackageManageCard({Key? key, required this.index, required this.model, this.callRefresh}) + PackageManageCard( + {Key? key, required this.index, required this.model, this.callRefresh}) : super(key: key); @override @@ -130,8 +128,8 @@ class _PackageManageCardState extends State { Future _remindPackage(int packageCollectionId) async { BaseModel baseModel = await NetUtil().get(API.manage.packageManageRemind, params: {"packageCollectionId": packageCollectionId}); - if (!baseModel.status!) { - BotToast.showText(text: baseModel.message!); + if (!baseModel.success!) { + BotToast.showText(text: baseModel.msg); } else { BotToast.showText(text: '已成功提醒领取'); } diff --git a/lib/ui/manage_pages/packages_manage/packages_manage_view.dart b/lib/ui/manage_pages/packages_manage/packages_manage_view.dart index 1712481..d036ff3 100644 --- a/lib/ui/manage_pages/packages_manage/packages_manage_view.dart +++ b/lib/ui/manage_pages/packages_manage/packages_manage_view.dart @@ -1,16 +1,14 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/package_manage/package_manage_list_model.dart'; import 'package:aku_new_community_manager/ui/manage_pages/packages_manage/packages_manage_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; class PackagesManageView extends StatefulWidget { final int index; @@ -45,9 +43,8 @@ class _PackagesManageViewState extends State { controller: _refreshController, extraParams: {"collectionStatus": widget.index + 1}, convert: (models) { - List modelList = models.tableList! - .map((e) => PackageManageListModel.fromJson(e)) - .toList(); + List modelList = + models.rows.map((e) => PackageManageListModel.fromJson(e)).toList(); print(modelList); return modelList; }, diff --git a/lib/ui/manage_pages/rules_manage/rules_manage_page.dart b/lib/ui/manage_pages/rules_manage/rules_manage_page.dart index 5f4d4e8..a32a2bd 100644 --- a/lib/ui/manage_pages/rules_manage/rules_manage_page.dart +++ b/lib/ui/manage_pages/rules_manage/rules_manage_page.dart @@ -44,7 +44,7 @@ class _RulesManagePageState extends State { path: API.manage.rulesManageList, controller: _refreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => RulesManageListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/settings/nick_name_change_page.dart b/lib/ui/settings/nick_name_change_page.dart index 1c57ffc..4ed3ed8 100644 --- a/lib/ui/settings/nick_name_change_page.dart +++ b/lib/ui/settings/nick_name_change_page.dart @@ -12,7 +12,7 @@ import 'package:velocity_x/velocity_x.dart'; import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; class NickNameChangePage extends StatefulWidget { @@ -71,11 +71,11 @@ class _NickNameChangePageState extends State { API.user.updateNickName, params: {'nickName': _textEditingController!.text}); - if (baseModel.status == true) { + if (baseModel.success == true) { userProvider.setNickName(_textEditingController!.text); Get.back(); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } }, child: '保存'.text.black.size(32.sp).make(), diff --git a/lib/ui/settings/setting_feedback_page.dart b/lib/ui/settings/setting_feedback_page.dart index dd26656..fbce4e0 100644 --- a/lib/ui/settings/setting_feedback_page.dart +++ b/lib/ui/settings/setting_feedback_page.dart @@ -1,22 +1,20 @@ // Dart imports: import 'dart:io'; -// Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:get/get.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/screen_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.dart'; +// Flutter imports: +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; class SettingFeedBackPage extends StatefulWidget { SettingFeedBackPage({Key? key}) : super(key: key); @@ -90,11 +88,11 @@ class _SettingFeedBackPageState extends State { "content": _content, "fileUrls": _imgeUrls, }); - if (baseModel.status!) { - BotToast.showText(text: baseModel.message!); + if (baseModel.success!) { + BotToast.showText(text: baseModel.msg); Get.back(); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } }, child: Text('提交'), diff --git a/lib/ui/settings/tel_change_page.dart b/lib/ui/settings/tel_change_page.dart index 1fed5be..c817845 100644 --- a/lib/ui/settings/tel_change_page.dart +++ b/lib/ui/settings/tel_change_page.dart @@ -17,7 +17,7 @@ import 'package:velocity_x/velocity_x.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/ui/settings/update_userinfo_func.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; class TelChangePage extends StatefulWidget { TelChangePage({Key? key}) : super(key: key); @@ -112,7 +112,7 @@ class _TelChangePageState extends State { BaseModel baseModel = await UpdateUserInfoFunc.sendTelUpdateCode( _newTelController!.text); - if (baseModel.status!) { + if (baseModel.success!) { startTick(); } else {} } @@ -187,11 +187,11 @@ class _TelChangePageState extends State { _oldTelController!.text, _newTelController!.text, _codeController!.text); - if (baseModel.status!) { + if (baseModel.success!) { userProvider.setTel(_newTelController!.text); Get.back(); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } } }, diff --git a/lib/ui/settings/update_userinfo_func.dart b/lib/ui/settings/update_userinfo_func.dart index 5a6850c..cf2ded3 100644 --- a/lib/ui/settings/update_userinfo_func.dart +++ b/lib/ui/settings/update_userinfo_func.dart @@ -1,6 +1,6 @@ // Project imports: import 'package:aku_new_community_manager/const/api.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; class UpdateUserInfoFunc { diff --git a/lib/ui/sub_pages/activity_manager/activity_detail_page.dart b/lib/ui/sub_pages/activity_manager/activity_detail_page.dart index 498763d..d1ff849 100644 --- a/lib/ui/sub_pages/activity_manager/activity_detail_page.dart +++ b/lib/ui/sub_pages/activity_manager/activity_detail_page.dart @@ -12,7 +12,7 @@ import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/screen_tool.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; class ActivityDetailPage extends StatefulWidget { diff --git a/lib/ui/sub_pages/activity_manager/activity_manager_page.dart b/lib/ui/sub_pages/activity_manager/activity_manager_page.dart index ffd184d..9afa279 100644 --- a/lib/ui/sub_pages/activity_manager/activity_manager_page.dart +++ b/lib/ui/sub_pages/activity_manager/activity_manager_page.dart @@ -1,16 +1,14 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/activity_item_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_list_model.dart'; import 'package:aku_new_community_manager/ui/sub_pages/activity_manager/activity_manager_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; -import 'package:aku_new_community_manager/utils/network/base_list_model.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; class ActivityManagerPage extends StatefulWidget { ActivityManagerPage({Key? key}) : super(key: key); @@ -36,9 +34,7 @@ class _ActivityManagerPageState extends State { }, controller: _refreshController, convert: (BaseListModel model) { - return model.tableList! - .map((e) => ActivityItemModel.fromJson(e)) - .toList(); + return model.rows.map((e) => ActivityItemModel.fromJson(e)).toList(); }, path: API.manage.acitivityList, ), diff --git a/lib/ui/sub_pages/borrow_manager/add_borrow_item_page.dart b/lib/ui/sub_pages/borrow_manager/add_borrow_item_page.dart index 20ba167..8569af0 100644 --- a/lib/ui/sub_pages/borrow_manager/add_borrow_item_page.dart +++ b/lib/ui/sub_pages/borrow_manager/add_borrow_item_page.dart @@ -1,27 +1,25 @@ // Dart imports: import 'dart:io'; -// Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:get/get.dart'; -import 'package:get/instance_manager.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; +// Flutter imports: +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/pick_image.dart'; -import 'package:aku_new_community_manager/utils/network/base_file_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:get/get.dart'; +import 'package:get/instance_manager.dart'; class AddBorrowItemPage extends StatefulWidget { - final int/*!*/ articleId; + final int /*!*/ articleId; AddBorrowItemPage({ Key? key, required this.articleId, @@ -57,23 +55,23 @@ class _AddBorrowItemPageState extends State { AkuMaterialButton( minWidth: 120.w, onPressed: () async { - BaseFileModel baseFileModel = + BaseModel baseFileModel = await NetUtil().upload(API.upload.uploadArticleDetail, file!); - if (baseFileModel.status!) { + if (baseFileModel.success) { await NetUtil().post( API.manage.borrowinsertArticleDetail, params: { "articleId": widget.articleId, "name": _textEditingController!.text, "code": _codeEditingCOntroller!.text, - "fileUrls": [baseFileModel.url] + "fileUrls": [baseFileModel.data] }, showMessage: true, ); Get.back(); } else { - BotToast.showText(text: baseFileModel.message!); + BotToast.showText(text: baseFileModel.msg); } }, child: Text( diff --git a/lib/ui/sub_pages/borrow_manager/add_borrow_object_page.dart b/lib/ui/sub_pages/borrow_manager/add_borrow_object_page.dart index 87d7b93..4c757f2 100644 --- a/lib/ui/sub_pages/borrow_manager/add_borrow_object_page.dart +++ b/lib/ui/sub_pages/borrow_manager/add_borrow_object_page.dart @@ -1,23 +1,21 @@ // Dart imports: import 'dart:io'; -// Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:common_utils/common_utils.dart'; -import 'package:get/get.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_bottom_button.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/pick_image.dart'; -import 'package:aku_new_community_manager/utils/network/base_file_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +// Flutter imports: +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; class AddBorrowObjectPage extends StatefulWidget { AddBorrowObjectPage({Key? key}) : super(key: key); @@ -142,19 +140,19 @@ class _AddBorrowObjectPageState extends State { // int.tryParse(_numberController.text) == null ? null : () async { - BaseFileModel baseFileModel = await NetUtil() + BaseModel baseFileModel = await NetUtil() .upload(API.upload.uploadArtical, file!); - if (baseFileModel.status!) { + if (baseFileModel.success) { await NetUtil().post( API.manage.insertArticle, params: { "name": _textEditingController.text, - "fileUrls": [baseFileModel.url] + "fileUrls": [baseFileModel.data] }, showMessage: true, ); } else { - BotToast.showText(text: baseFileModel.message!); + BotToast.showText(text: baseFileModel.msg); } Get.back(); }, diff --git a/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart b/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart index 0718a6d..952a1db 100644 --- a/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart +++ b/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart @@ -1,12 +1,4 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/const/resource.dart'; @@ -16,8 +8,14 @@ import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/sub_pages/borrow_manager/add_borrow_object_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/borrow_manager/borrow_items_page.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; class AllBorrowGoods extends StatefulWidget { AllBorrowGoods({Key? key}) : super(key: key); @@ -54,7 +52,7 @@ class _AllBorrowGoodsState extends State { path: API.manage.borrowList, controller: _refreshController, convert: (model) => - model.tableList!.map((e) => BorrowItemModel.fromJson(e)).toList(), + model.rows.map((e) => BorrowItemModel.fromJson(e)).toList(), builder: (items) { return ListView.builder( padding: EdgeInsets.symmetric( diff --git a/lib/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart index 8b0a880..298d9a2 100644 --- a/lib/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart +++ b/lib/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart @@ -1,21 +1,19 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/borrow/borrow_item_detail_model.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:provider/provider.dart'; class BorrowItemDetailPage extends StatefulWidget { final int id; diff --git a/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart index b19132a..c12f80e 100644 --- a/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart +++ b/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart @@ -1,12 +1,4 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/borrow/borrow_detail_item_model.dart'; @@ -15,9 +7,15 @@ import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/sub_pages/borrow_manager/add_borrow_item_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.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:get/get.dart'; +import 'package:provider/provider.dart'; class BorrowItemPage extends StatefulWidget { final int id; @@ -59,9 +57,8 @@ class _BorrowItemPageState extends State { path: API.manage.borrowDetailList, controller: _refreshController, extraParams: {'articleId': widget.id}, - convert: (model) => model.tableList! - .map((e) => BorrowDetailItemModel.fromJson(e)) - .toList(), + convert: (model) => + model.rows.map((e) => BorrowDetailItemModel.fromJson(e)).toList(), builder: (items) { return ListView.builder( padding: EdgeInsets.symmetric(horizontal: 32.w), diff --git a/lib/ui/sub_pages/borrow_manager/borrow_manager_check_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_manager_check_page.dart index 056178f..f0ec95e 100644 --- a/lib/ui/sub_pages/borrow_manager/borrow_manager_check_page.dart +++ b/lib/ui/sub_pages/borrow_manager/borrow_manager_check_page.dart @@ -1,20 +1,18 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:get/get.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/borrow/borrow_check_item_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_bottom_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; class BorrowManagerCheckPage extends StatefulWidget { final int id; diff --git a/lib/ui/sub_pages/borrow_manager/borrow_manager_examine_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_manager_examine_page.dart index a19bb0d..adc7307 100644 --- a/lib/ui/sub_pages/borrow_manager/borrow_manager_examine_page.dart +++ b/lib/ui/sub_pages/borrow_manager/borrow_manager_examine_page.dart @@ -16,7 +16,7 @@ import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_bottom_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:velocity_x/velocity_x.dart'; diff --git a/lib/ui/sub_pages/borrow_manager/borrow_manager_view.dart b/lib/ui/sub_pages/borrow_manager/borrow_manager_view.dart index 6b7c3fd..b3eceda 100644 --- a/lib/ui/sub_pages/borrow_manager/borrow_manager_view.dart +++ b/lib/ui/sub_pages/borrow_manager/borrow_manager_view.dart @@ -1,18 +1,16 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/borrow/borrow_status_item_model.dart'; import 'package:aku_new_community_manager/ui/sub_pages/borrow_manager/borrow_manager_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; class BorrowManagerView extends StatefulWidget { final int? status; - BorrowManagerView({Key? key, this.status}) : super(key: key); + BorrowManagerView({Key? key, this.status}) : super(key: key); @override _BorrowManagerViewState createState() => _BorrowManagerViewState(); @@ -25,16 +23,14 @@ class _BorrowManagerViewState extends State Widget build(BuildContext context) { super.build(context); return BeeListView( - path: API.manage.borrowStatusList, extraParams: {'borrowStatus': widget.status}, controller: _refreshController, - convert: (model) => model.tableList! - .map((e) => BorrowStatusItemModel.fromJson(e)) - .toList(), + convert: (model) => + model.rows.map((e) => BorrowStatusItemModel.fromJson(e)).toList(), builder: (items) { return ListView.builder( - padding: EdgeInsets.only(left:16,right: 16 ), + padding: EdgeInsets.only(left: 16, right: 16), itemBuilder: (context, index) { return BorrowManagerCard(model: items[index]); }, diff --git a/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart index 2fc9978..dc1c62c 100644 --- a/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart +++ b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart @@ -1,14 +1,4 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:common_utils/common_utils.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/const/resource.dart'; @@ -19,6 +9,7 @@ import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/fixed import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/work_order_type_model.dart'; import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/work_time_limit_model.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/aku_map.dart'; import 'package:aku_new_community_manager/tools/screen_tool.dart'; @@ -26,11 +17,18 @@ import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/fixer_department_page.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_title_box.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/show_bottom_sheet.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/manage_func.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; class BusinessAndFixDetailPage extends StatefulWidget { final BussinessAndFixModel model; @@ -91,7 +89,7 @@ class _BusinessAndFixDetailPageState extends State { controller: _easyRefreshController, header: MaterialHeader(), onRefresh: () async { - _detailModel = await (ManageFunc.repairDetail(widget.model.id!) ); + _detailModel = await (ManageFunc.repairDetail(widget.model.id!)); _reportModel.dispatchListId = widget.model.dispatchId!; _reportModel.workOrderTyoe = 1; _onload = false; @@ -118,8 +116,9 @@ class _BusinessAndFixDetailPageState extends State { builder: (context) { final userProvider = Provider.of(context, listen: false); - //派单权限 + 待派单状态=立即派单 - if (userProvider.infoModel!.canSendTicket && widget.model.status! < 2) { + //派单权限 + 待派单状态=立即派单 + if (userProvider.infoModel!.canSendTicket && + widget.model.status! < 2) { return AkuMaterialButton( color: AppStyle.primaryColor, nullColor: AppStyle.minorColor, @@ -144,10 +143,10 @@ class _BusinessAndFixDetailPageState extends State { color: AppStyle.primaryColor, nullColor: AppStyle.minorColor, onPressed: () { - Get.to(()=>FixerDepartmentPage( - model: _reportModel, - changeType: true, - )); + Get.to(() => FixerDepartmentPage( + model: _reportModel, + changeType: true, + )); }, child: Text( '改派', @@ -162,12 +161,12 @@ class _BusinessAndFixDetailPageState extends State { color: AppStyle.primaryColor, nullColor: AppStyle.minorColor, onPressed: () async { - BaseModel baseModel = - await (ManageFunc.recevingOrders(widget.model.dispatchId) ); - if (baseModel.status!) { + BaseModel baseModel = await (ManageFunc.recevingOrders( + widget.model.dispatchId)); + if (baseModel.success) { Get.back(); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } }, child: Text( @@ -208,8 +207,8 @@ class _BusinessAndFixDetailPageState extends State { ), ), onPressed: () async { - await Get.to( - ()=> FixMoreTimePage(dispatchId: widget.model.dispatchId!)); + await Get.to(() => FixMoreTimePage( + dispatchId: widget.model.dispatchId!)); _easyRefreshController!.callRefresh(); }, child: Text( @@ -226,7 +225,7 @@ class _BusinessAndFixDetailPageState extends State { radius: 4.w, color: AppStyle.primaryColor, onPressed: () { - Get.to(()=>FixWorkFinishPage( + Get.to(() => FixWorkFinishPage( fixModel: widget.model, model: _detailModel, dispatchType: @@ -259,7 +258,7 @@ class _BusinessAndFixDetailPageState extends State { _buildTile( R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '绑定房屋', - _detailModel.repairDetail!.roomName??'', + _detailModel.repairDetail!.roomName ?? '', ), _buildTile( R.ASSETS_MESSAGE_IC_PEOPLE_PNG, @@ -385,7 +384,7 @@ class _BusinessAndFixDetailPageState extends State { canTap, helpContent: '请选择工单子类', onTap: () async { - List models = await (ManageFunc.workOrderTypeDetail(1) ); + List models = await (ManageFunc.workOrderTypeDetail(1)); _workTypeModels = models.map((e) => WorkOrderTypeModel.fromJson(e)).toList(); showItemSheet( diff --git a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart index 1a48fcc..4c3f5a5 100644 --- a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart +++ b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart @@ -1,13 +1,4 @@ // Flutter imports: -import 'package:aku_new_community_manager/tools/user_tool.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:common_utils/common_utils.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; @@ -16,10 +7,17 @@ import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/aku_map.dart'; import 'package:aku_new_community_manager/tools/screen_tool.dart'; +import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_chip_box.dart'; +// Package imports: +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; class BusinessFixCard extends StatefulWidget { @@ -43,7 +41,7 @@ class BusinessFixCard extends StatefulWidget { } class _BusinessFixCardState extends State { - UserInfoModel? get userInfoModel { + UserInformationModel? get userInfoModel { final userProvider = Provider.of(context, listen: false); return userProvider.infoModel; } diff --git a/lib/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart b/lib/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart index 4ad5bbe..f53979a 100644 --- a/lib/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart +++ b/lib/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart @@ -1,20 +1,18 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; class BussinessAndFixView extends StatefulWidget { final int? status; - BussinessAndFixView({Key? key, this.status}) : super(key: key); + BussinessAndFixView({Key? key, this.status}) : super(key: key); @override _BussinessAndFixViewState createState() => _BussinessAndFixViewState(); @@ -45,7 +43,7 @@ class _BussinessAndFixViewState extends State }, controller: _easyRefreshController, convert: (models) { - return models.tableList! + return models.rows .map((e) => BussinessAndFixModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/sub_pages/business_and_fix/fix_more_time_page.dart b/lib/ui/sub_pages/business_and_fix/fix_more_time_page.dart index ab8031c..67e82c1 100644 --- a/lib/ui/sub_pages/business_and_fix/fix_more_time_page.dart +++ b/lib/ui/sub_pages/business_and_fix/fix_more_time_page.dart @@ -1,23 +1,22 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:get/get.dart'; - // Project imports: import 'package:aku_new_community_manager/const/resource.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/screen_tool.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/manage_func.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; class FixMoreTimePage extends StatefulWidget { final int dispatchId; - FixMoreTimePage({Key? key, /*required*/ required this.dispatchId}) : super(key: key); + FixMoreTimePage({Key? key, /*required*/ required this.dispatchId}) + : super(key: key); @override _FixMoreTimePageState createState() => _FixMoreTimePageState(); @@ -171,11 +170,11 @@ class _FixMoreTimePageState extends State { BaseModel baseModel = await (ManageFunc.applyDelayed( widget.dispatchId, _delayList.indexOf(_nowSelect) + 1, - _textEditingController?.text??'' )); - if (baseModel.status!) { + _textEditingController?.text ?? '')); + if (baseModel.success) { Get.back(); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } }, radius: 8.w, diff --git a/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart b/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart index 9237ba2..6e882db 100644 --- a/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart +++ b/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart @@ -1,30 +1,27 @@ // Dart imports: import 'dart:io'; -// Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:common_utils/common_utils.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/fixed_detail_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/extensions/router_extension_tool.dart'; -import 'package:aku_new_community_manager/tools/screen_tool.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/fix_submit_finish_page.dart'; +// Flutter imports: +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_title_box.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/pick_image.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/manage_func.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; class FixWorkFinishPage extends StatefulWidget { final FixedDetailModel model; @@ -32,9 +29,9 @@ class FixWorkFinishPage extends StatefulWidget { final bool dispatchType; FixWorkFinishPage( {Key? key, - /*required*/ required this.model, - /*required*/ required this.dispatchType, - /*required*/ required this.fixModel}) + required this.model, + required this.dispatchType, + required this.fixModel}) : super(key: key); @override @@ -425,13 +422,13 @@ class _FixWorkFinishPageState extends State { materialPrice, humanPrice! + materialPrice!, 1, - urls) ); - if (baseModel.status!) { + urls)); + if (baseModel.success!) { FixSubmitFinishPage( model: widget.fixModel, ).to(); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } }, ), diff --git a/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart b/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart index 08bbb1f..5a62d08 100644 --- a/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart +++ b/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart @@ -1,26 +1,22 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:bot_toast/bot_toast.dart'; -import 'package:expandable/expandable.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:get/get.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; -import 'package:aku_new_community_manager/const/resource.dart'; import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart'; import 'package:aku_new_community_manager/models/manager/fixer_item_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; -import 'package:aku_new_community_manager/tools/screen_tool.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/manage_func.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +// Package imports: +import 'package:bot_toast/bot_toast.dart'; +import 'package:expandable/expandable.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; class FixerDepartmentPage extends StatefulWidget { final DispatchReportModel model; @@ -91,20 +87,20 @@ class _FixerDepartmentPageState extends State { if (widget.changeType) { BaseModel baseModel = await (ManageFunc.repairReassignment( _reportModel!.dispatchListId!, _reportModel!.operato)); - if (baseModel.status!) { + if (baseModel.success!) { BotToast.showText(text: '改派成功'); Get.back(); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } } else { BaseModel baseModel = await (ManageFunc.repairDispatch(_reportModel!)); - if (baseModel.status!) { + if (baseModel.success) { Get.back(); Get.back(); } else { - BotToast.showText(text: baseModel.message!); + BotToast.showText(text: baseModel.msg); } } } diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart index 860d1af..e83a4ea 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart @@ -5,7 +5,7 @@ // import 'package:aku_new_community_manager/const/api.dart'; // import 'package:aku_new_community_manager/models/manager/decoration/decoration_detail_model.dart'; // import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -// import 'package:aku_new_community_manager/utils/network/base_model.dart'; +// import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; // import 'package:aku_new_community_manager/utils/network/net_util.dart'; // import 'package:bot_toast/bot_toast.dart'; // import 'package:flutter/cupertino.dart'; @@ -77,7 +77,7 @@ // await NetUtil().get(API.manage.decorationFindByld, params: { // "decorationId ": widget.id, // }); -// if (baseModel.status) { +// if (baseModel.success) { // _model = DecorationDetailModel.fromJson(baseModel.data); // _onload = false; // } else { diff --git a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_finsih_submit_page.dart b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_finsih_submit_page.dart index 6b4de2d..1ea411d 100644 --- a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_finsih_submit_page.dart +++ b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_finsih_submit_page.dart @@ -1,10 +1,10 @@ import 'package:aku_new_community_manager/const/api.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_text_field.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_bottom_button.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -14,7 +14,9 @@ import 'package:velocity_x/velocity_x.dart'; class NewRenovationFinishSubmitPage extends StatefulWidget { final int id; final VoidCallback? callRefresh; - NewRenovationFinishSubmitPage({Key? key, /*required*/ required this.id, this.callRefresh}) : super(key: key); + NewRenovationFinishSubmitPage( + {Key? key, /*required*/ required this.id, this.callRefresh}) + : super(key: key); @override _NewRenovationFinishSubmitPageState createState() => @@ -78,7 +80,7 @@ class _NewRenovationFinishSubmitPageState "isQualified": _isQualified, }, showMessage: true); - if (baseModel.status ?? false) { + if (baseModel.success ?? false) { Get.back(); } }, diff --git a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_view.dart b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_view.dart index 48c1dcd..b3eccea 100644 --- a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_view.dart +++ b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_view.dart @@ -38,7 +38,7 @@ class _NewRenovationState extends State controller: _refreshController, extraParams: {"userDecorationNewStatus": widget.index}, convert: (models) { - return models.tableList! + return models.rows .map((e) => NewRenovationListModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart b/lib/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart index ceb61d3..0719faa 100644 --- a/lib/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart +++ b/lib/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart @@ -12,7 +12,7 @@ import 'package:aku_new_community_manager/ui/sub_pages/items_outdoor/outdoor_pas import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; // Package imports: import 'package:common_utils/common_utils.dart'; diff --git a/lib/ui/sub_pages/items_outdoor/items_outdoor_view.dart b/lib/ui/sub_pages/items_outdoor/items_outdoor_view.dart index 4128ba0..5d16cbc 100644 --- a/lib/ui/sub_pages/items_outdoor/items_outdoor_view.dart +++ b/lib/ui/sub_pages/items_outdoor/items_outdoor_view.dart @@ -1,15 +1,13 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/goods_out/goods_out_item_model.dart'; import 'package:aku_new_community_manager/ui/sub_pages/items_outdoor/items_outdoor_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; class ItemsOutdoorView extends StatefulWidget { final int? status; @@ -30,7 +28,7 @@ class _ItemsOutdoorViewState extends State extraParams: {'articleOutStatus': widget.status}, controller: _refreshController, convert: (model) => - model.tableList!.map((e) => GoodsOutItemModel.fromJson(e)).toList(), + model.rows.map((e) => GoodsOutItemModel.fromJson(e)).toList(), builder: (items) { return ListView.builder( itemBuilder: (context, index) { diff --git a/lib/ui/sub_pages/manage_func.dart b/lib/ui/sub_pages/manage_func.dart index ef49a34..6f4db28 100644 --- a/lib/ui/sub_pages/manage_func.dart +++ b/lib/ui/sub_pages/manage_func.dart @@ -2,17 +2,16 @@ // Flutter imports: -// Package imports: -import 'package:dio/dio.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/decoration/decoration_detail_model.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_detail_model.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_point_model.dart'; import 'package:aku_new_community_manager/models/manager/inspection/inspection_point_submit_model.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:dio/dio.dart'; +// Package imports: class ManageFunc { static Future getDetcorationDetail(int id) async { @@ -35,7 +34,7 @@ class ManageFunc { } static Future getInspectionDetail( - int/*!*/ executeId) async { + int /*!*/ executeId) async { BaseModel baseModel = await NetUtil().get(API.manage.inspectionFindDetailByld, params: { "executeId": executeId, @@ -55,7 +54,7 @@ class ManageFunc { } static Future> getInspectionPointByExcuteId( - {required int/*!*/ excuteId}) async { + {required int /*!*/ excuteId}) async { BaseModel baseModel = await NetUtil() .get(API.manage.inspecntionFindPointByExecuteId, params: { "executeId": excuteId, @@ -95,9 +94,9 @@ class ManageFunc { return baseModel; } - static Future getInspectionPointCheckDetailUnbegin(int planPointId) async{ - BaseModel baseModel = - await NetUtil().get(API.manage.inspectionPointCheckDetailUnbegin, params: { + static Future getInspectionPointCheckDetailUnbegin(int planPointId) async { + BaseModel baseModel = await NetUtil() + .get(API.manage.inspectionPointCheckDetailUnbegin, params: { "planPointId": planPointId, }); return baseModel; diff --git a/lib/ui/sub_pages/visitor_manager/visitor_manager_view.dart b/lib/ui/sub_pages/visitor_manager/visitor_manager_view.dart index 37926eb..ffda217 100644 --- a/lib/ui/sub_pages/visitor_manager/visitor_manager_view.dart +++ b/lib/ui/sub_pages/visitor_manager/visitor_manager_view.dart @@ -1,19 +1,17 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/visitor_item_model.dart'; import 'package:aku_new_community_manager/ui/sub_pages/visitor_manager/visitor_manager_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; class VisitorManagerView extends StatefulWidget { final int? status; - VisitorManagerView({Key? key, this.status}) : super(key: key); + VisitorManagerView({Key? key, this.status}) : super(key: key); @override _VisitorManagerViewState createState() => _VisitorManagerViewState(); @@ -29,9 +27,7 @@ class _VisitorManagerViewState extends State path: API.manage.visitorList, controller: _refreshController, convert: (model) { - return model.tableList! - .map((e) => VisitorItemModel.fromJson(e)) - .toList(); + return model.rows.map((e) => VisitorItemModel.fromJson(e)).toList(); }, extraParams: {'visitorStatus': widget.status}, builder: (items) { diff --git a/lib/ui/widgets/app_widgets/bee_search_textfield.dart b/lib/ui/widgets/app_widgets/bee_search_textfield.dart new file mode 100644 index 0000000..f4a073d --- /dev/null +++ b/lib/ui/widgets/app_widgets/bee_search_textfield.dart @@ -0,0 +1,165 @@ +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +///TextFiled +class BeeSearchTextField extends StatefulWidget implements PreferredSizeWidget { + BeeSearchTextField({ + Key? key, + this.controller, + this.hintText, + this.onChanged, + this.focusNode, + this.onSubmitted, + this.margin, + this.onPressed, + this.height, + }) : button = false, + super(key: key); + + /// + BeeSearchTextField.button({ + Key? key, + this.controller, + this.hintText, + this.onChanged, + this.focusNode, + this.onSubmitted, + this.margin, + this.onPressed, + this.height, + }) : button = true, + super(key: key); + + ///渲染成按钮 + final bool button; + + ///控制器 + final TextEditingController? controller; + + ///hint Text + final String? hintText; + + ///文字变化回调 + final ValueChanged? onChanged; + + ///完成输入回调 + final ValueChanged? onSubmitted; + + ///焦点 + final FocusNode? focusNode; + + ///margin + final EdgeInsets? margin; + + final VoidCallback? onPressed; + + ///高度 + final double? height; + + @override + _BeeSearchTextFieldState createState() => _BeeSearchTextFieldState(); + + @override + Size get preferredSize => Size.fromHeight(this.height ?? 42.w); +} + +class _BeeSearchTextFieldState extends State { + get _border => OutlineInputBorder( + borderRadius: BorderRadius.circular(21.w), + borderSide: BorderSide( + color: Color(0xFF979797), + width: 1.w, + ), + ); + + _buildButton() { + return Padding( + padding: widget.margin ?? + EdgeInsets.symmetric( + horizontal: 15.w, + vertical: 3.w, + ), + child: MaterialButton( + padding: EdgeInsets.zero, + color: Color(0xFFF8F8F8), + elevation: 0, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(21.w), + side: BorderSide( + color: Color(0xFF979797), + width: 1.w, + ), + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.only(left: 26.w, right: 16.w), + child: Icon( + Icons.search, + size: 32.w, + color: Colors.black, + ), + ), + Expanded( + child: Text( + widget.hintText ?? '', + style: TextStyle( + color: kTextSubColor, + fontSize: 28.sp, + ), + ), + ), + ], + ), + onPressed: widget.onPressed, + ), + ); + } + + @override + Widget build(BuildContext context) { + if (widget.button) return _buildButton(); + return Container( + height: 72.w, + padding: widget.margin ?? + EdgeInsets.symmetric( + horizontal: 30.w, + vertical: 6.w, + ), + child: TextField( + controller: widget.controller, + onChanged: widget.onChanged, + onSubmitted: widget.onSubmitted, + onTap: widget.onPressed, + focusNode: widget.focusNode, + cursorColor: kPrimaryColor, + textInputAction: TextInputAction.search, + decoration: InputDecoration( + fillColor: Color(0xFFF8F8F8), + filled: true, + hintText: widget.hintText, + hintStyle: TextStyle( + color: kTextSubColor, + fontSize: 28.sp, + ), + border: _border, + enabledBorder: _border, + focusedBorder: _border, + focusedErrorBorder: _border, + prefixIcon: Padding( + padding: EdgeInsets.only(left: 26.w, right: 16.w), + child: Icon( + Icons.search, + size: 32.w, + color: Colors.black, + ), + ), + prefixIconConstraints: BoxConstraints(minWidth: 0, minHeight: 0), + contentPadding: EdgeInsets.zero, + ), + ), + ); + } +} diff --git a/lib/ui/widgets/common/bee_city_picker.dart b/lib/ui/widgets/common/bee_city_picker.dart new file mode 100644 index 0000000..3b91e30 --- /dev/null +++ b/lib/ui/widgets/common/bee_city_picker.dart @@ -0,0 +1,159 @@ +import 'package:aku_new_community_manager/saas_models/login/china_region_model.dart'; +import 'package:aku_new_community_manager/saas_models/login/picked_city_model.dart'; +import 'package:aku_new_community_manager/utils/hive_store.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import 'bee_picker_box.dart'; + +class BeeCityPicker extends StatefulWidget { + static Future pick(BuildContext context) async { + return await showModalBottomSheet( + context: context, + builder: (context) { + return BeeCityPicker(); + }, + ); + } + + BeeCityPicker({Key? key}) : super(key: key); + + @override + _BeeCityPickerState createState() => _BeeCityPickerState(); +} + +class _BeeCityPickerState extends State { + List get provinces => + HiveStore.dataBox!.get('cities')?.cast().toList() ?? []; + + late int _pickedProvinceIndex; + late int _pickedCityIndex; + late int _pickedDistrictIndex; + + ChinaRegionModel get _pickedProvince => provinces[_pickedProvinceIndex]; + + ChinaRegionModel get _pickedCity => cities[_pickedCityIndex]; + + ChinaRegionModel get _pickedDistrict => districts.isEmpty + ? ChinaRegionModel.empty(_pickedCity.id) + : districts[_pickedDistrictIndex]; + + List get cities => _pickedProvince.cityList ?? []; + + List get districts => _pickedCity.cityList ?? []; + + final FixedExtentScrollController _cityController = + FixedExtentScrollController(); + final FixedExtentScrollController _districtController = + FixedExtentScrollController(); + late PickedCityModel _pickedCityModel; + + void updatePickedCity() { + pickCity(); + setState(() {}); + } + + void pickCity() { + _pickedCityModel = PickedCityModel( + province: _pickedProvince, + city: _pickedCity, + district: _pickedDistrict, + ); + } + + @override + void initState() { + super.initState(); + _pickedProvinceIndex = 0; + _pickedCityIndex = 0; + _pickedDistrictIndex = 0; + pickCity(); + } + + @override + void dispose() { + _cityController.dispose(); + _districtController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeePickerBox( + onPressed: () { + Navigator.pop(context, _pickedCityModel); + }, + child: Row( + children: [ + Expanded( + child: CupertinoPicker( + itemExtent: 60.w, + magnification: 1.0, + // offAxisFraction: -0.6, + looping: true, + onSelectedItemChanged: (index) { + _pickedProvinceIndex = index; + _cityController.jumpToItem(0); + _districtController.jumpToItem(0); + updatePickedCity(); + }, + children: provinces + .map((e) => Center( + child: Padding( + padding: EdgeInsets.only(left: 20.w, right: 20.w), + child: Text(e.name, textAlign: TextAlign.center), + ), + )) + .toList(), + ), + ), + Expanded( + child: CupertinoPicker( + itemExtent: 60.w, + magnification: 1.0, + looping: true, + scrollController: _cityController, + onSelectedItemChanged: (index) { + _pickedCityIndex = index; + _districtController.jumpToItem(0); + updatePickedCity(); + }, + children: cities + .map((e) => Center( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.w), + child: Text(e.name, textAlign: TextAlign.center), + ), + )) + .toList(), + ), + ), + Expanded( + child: CupertinoPicker( + itemExtent: 60.w, + magnification: 1.0, + // offAxisFraction: 0.6, + looping: true, + scrollController: _districtController, + onSelectedItemChanged: (index) { + _pickedDistrictIndex = index; + updatePickedCity(); + }, + children: districts.isEmpty + ? [Container()] + : districts + .map((e) => Center( + child: Padding( + padding: EdgeInsets.only(left: 20.w, right: 20.w), + child: Text(e.name, textAlign: TextAlign.center), + ), + )) + .toList(), + ), + ), + ], + ), + ); + } +} diff --git a/lib/ui/widgets/common/bee_community_picker.dart b/lib/ui/widgets/common/bee_community_picker.dart new file mode 100644 index 0000000..7043605 --- /dev/null +++ b/lib/ui/widgets/common/bee_community_picker.dart @@ -0,0 +1,106 @@ +import 'package:aku_new_community_manager/saas_models/login/community_model.dart'; +import 'package:aku_new_community_manager/ui/widgets/app_widgets/bee_search_textfield.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import 'bee_picker_box.dart'; + +class BeeCommunityPicker extends StatefulWidget { + static Future pick( + BuildContext context, List communities) async { + return await showModalBottomSheet( + context: context, + builder: (context) { + return BeeCommunityPicker( + communities: communities, + ); + }, + ); + } + + final List communities; + + const BeeCommunityPicker({Key? key, required this.communities}) + : super(key: key); + + @override + _BeeCommunityPickerState createState() => _BeeCommunityPickerState(); +} + +class _BeeCommunityPickerState extends State { + TextEditingController _searchController = TextEditingController(); + CommunityModel? _pickedCommunity; + List _communities = []; + + List screenList(String text) { + var list = []; + widget.communities.forEach((element) { + if (element.name.contains(text)) { + list.add(element); + } + }); + return list; + } + + @override + void initState() { + _communities = widget.communities; + if (widget.communities.isNotEmpty) { + _pickedCommunity = widget.communities[0]; + } + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeePickerBox( + title: '选择小区', + confirmString: '确定', + onPressed: () { + Navigator.pop(context, _pickedCommunity); + }, + child: Container( + color: Colors.white, + child: Column( + children: [ + BeeSearchTextField( + controller: _searchController, + hintText: '请输入小区名称搜索', + onChanged: (text) { + _communities = screenList(text); + setState(() {}); + }, + ), + Expanded( + child: CupertinoPicker( + itemExtent: 80.w, + looping: false, + onSelectedItemChanged: (index) { + _pickedCommunity = _communities[index]; + }, + children: _communities.isEmpty + ? [Container()] + : _communities + .map((e) => Center( + child: Padding( + padding: + EdgeInsets.only(left: 8.w, right: 40.w), + child: + Text(e.name, textAlign: TextAlign.center), + ), + )) + .toList(), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/ui/widgets/common/bee_divider.dart b/lib/ui/widgets/common/bee_divider.dart new file mode 100644 index 0000000..2043059 --- /dev/null +++ b/lib/ui/widgets/common/bee_divider.dart @@ -0,0 +1,56 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class BeeDivider extends StatelessWidget { + final double? thickness; + final double? indent; + final double? endIndent; + final Color? color; + final bool? isHorizontal; + + BeeDivider( + {Key? key, + this.thickness, + this.indent, + this.endIndent, + this.color, + this.isHorizontal = true}) + : super(key: key); + + BeeDivider.horizontal({ + Key? key, + this.indent, + this.endIndent, + }) : thickness = 1.w, + color = Color(0xFFE8E8E8), + isHorizontal = true, + super(key: key); + + BeeDivider.vertical({ + Key? key, + this.indent, + this.endIndent, + }) : thickness = 1.w, + color = Color(0xFFE8E8E8), + isHorizontal = false, + super(key: key); + + @override + Widget build(BuildContext context) { + return isHorizontal! + ? Divider( + height: 0, + thickness: this.thickness ?? 1.w, + indent: this.indent ?? 0, + endIndent: this.endIndent ?? 0, + color: this.color ?? Color(0xFFE8E8E8), + ) + : VerticalDivider( + width: 0, + thickness: this.thickness ?? 1.w, + indent: this.indent ?? 0, + endIndent: this.endIndent ?? 0, + color: this.color ?? Color(0xFFE8E8E8), + ); + } +} diff --git a/lib/ui/widgets/common/bee_list_view.dart b/lib/ui/widgets/common/bee_list_view.dart index 41dfb4b..32a6ee3 100644 --- a/lib/ui/widgets/common/bee_list_view.dart +++ b/lib/ui/widgets/common/bee_list_view.dart @@ -1,13 +1,11 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_easyrefresh/easy_refresh.dart'; - +import 'package:aku_new_community_manager/saas_models/net_model/base_list_model.dart'; // Project imports: import 'package:aku_new_community_manager/style/app_style.dart'; -import 'package:aku_new_community_manager/utils/network/base_list_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_easyrefresh/easy_refresh.dart'; /// ## BeeListView ///```dart @@ -63,9 +61,9 @@ class BeeListView extends StatefulWidget { final Map? extraParams; BeeListView({ Key? key, - required this.path, + required this.path, required this.controller, - required this.convert, + required this.convert, required this.builder, this.size = 10, this.extraParams, @@ -114,10 +112,10 @@ class _BeeListViewState extends State { widget.path, params: _params, ); - if (_pageNum <= _model.pageCount!) { + if (_models.length <= _model.total) { _models.addAll(widget.convert(_model) as List); } - if (_pageNum >= _model.pageCount!) { + if (_models.length >= _model.total) { widget.controller!.finishLoad( success: true, noMore: true, diff --git a/lib/ui/widgets/common/bee_picker_box.dart b/lib/ui/widgets/common/bee_picker_box.dart new file mode 100644 index 0000000..1856a72 --- /dev/null +++ b/lib/ui/widgets/common/bee_picker_box.dart @@ -0,0 +1,69 @@ +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; + +import 'bee_divider.dart'; + +class BeePickerBox extends StatelessWidget { + final VoidCallback? onPressed; + final String confirmString; + final String? title; + final Widget child; + + const BeePickerBox( + {Key? key, + this.onPressed, + this.confirmString = '完成', + this.title, + required this.child}) + : super(key: key); + + _buildButton({ + required String title, + required VoidCallback? onPressed, + }) { + return SizedBox( + // height: 48.w, + child: TextButton( + onPressed: onPressed, + child: Text(title), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Material( + color: Colors.white, + child: SizedBox( + height: 650.w, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 88.w, + child: NavigationToolbar( + leading: _buildButton( + title: '取消', + onPressed: () => Navigator.pop(context), + ), + middle: Text( + title ?? '', + style: TextStyle( + color: kTextPrimaryColor, + fontSize: 28.sp, + ), + ), + trailing: _buildButton( + title: confirmString, + onPressed: onPressed, + ), + ), + ), + BeeDivider.horizontal(), + Expanded(child: child), + ], + ), + ), + ); + } +} diff --git a/lib/utils/hive_store.dart b/lib/utils/hive_store.dart index b6f715a..400ca66 100644 --- a/lib/utils/hive_store.dart +++ b/lib/utils/hive_store.dart @@ -1,10 +1,23 @@ // Package imports: +import 'package:flutter/foundation.dart'; import 'package:hive/hive.dart'; +import 'package:path_provider/path_provider.dart'; class HiveStore { static Box? _appBox; + static Box? get appBox => _appBox; - static init() async { - _appBox = await Hive.openBox('app'); + + static Box? _dataBox; + + static Box? get dataBox => _dataBox; + + static Future init() async { + if (!kIsWeb) { + var dir = await getApplicationDocumentsDirectory(); + Hive.init(dir.path); + _appBox = await Hive.openBox('app'); + _dataBox = await Hive.openBox('dataBox'); + } } } diff --git a/lib/utils/network/base_file_model.dart b/lib/utils/network/base_file_model.dart deleted file mode 100644 index d7d74aa..0000000 --- a/lib/utils/network/base_file_model.dart +++ /dev/null @@ -1,19 +0,0 @@ -class BaseFileModel { - String? message; - String? url; - bool? status; - BaseFileModel({ - this.message, - this.url, - this.status, - }); - - BaseFileModel.err( - {this.message = '未知错误', this.url = '', this.status = false}); - - BaseFileModel.fromJson(Map json) { - message = json['message'] ?? ''; - url = json['url'] ?? null; - status = json['status'] ?? false; - } -} diff --git a/lib/utils/network/base_list_model.dart b/lib/utils/network/base_list_model.dart deleted file mode 100644 index 5864b13..0000000 --- a/lib/utils/network/base_list_model.dart +++ /dev/null @@ -1,27 +0,0 @@ -class BaseListModel { - int? pageCount; - int? rowCount; - List? tableList; - BaseListModel({ - this.pageCount, - this.rowCount, - this.tableList, - }); - BaseListModel.zero({ - this.pageCount = 0, - this.rowCount = 0, - this.tableList = const [], - }); - - BaseListModel.err({ - this.pageCount = 0, - this.rowCount = 0, - this.tableList = const [], - }); - - BaseListModel.fromJson(Map json) { - pageCount = json['pageCount'] ?? 0; - rowCount = json['rowCount'] ?? 0; - tableList = json['tableList'] ?? []; - } -} diff --git a/lib/utils/network/base_model.dart b/lib/utils/network/base_model.dart deleted file mode 100644 index 1b22c35..0000000 --- a/lib/utils/network/base_model.dart +++ /dev/null @@ -1,20 +0,0 @@ -class BaseModel { - int? code; - String? message; - bool? status; - dynamic data; - BaseModel({ - this.code, - this.message, - this.data, - this.status, - }); - - BaseModel.err({this.message = '未知错误', this.status = false}); - - BaseModel.fromJson(Map json) { - message = json['message'] ?? ''; - data = json['data'] ?? null; - status = json['status'] ?? false; - } -} diff --git a/lib/utils/network/manage_func.dart b/lib/utils/network/manage_func.dart index 2870a3b..a56afb8 100644 --- a/lib/utils/network/manage_func.dart +++ b/lib/utils/network/manage_func.dart @@ -1,14 +1,13 @@ // Flutter imports: -// Package imports: -import 'package:dio/dio.dart'; - // Project imports: import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart'; import 'package:aku_new_community_manager/models/manager/bussiness_and_fix/fixed_detail_model.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; +// Package imports: +import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart'; +import 'package:dio/dio.dart'; class ManageFunc { ///报事报修详情 diff --git a/lib/utils/network/net_util.dart b/lib/utils/network/net_util.dart index 38b5170..fcedb71 100644 --- a/lib/utils/network/net_util.dart +++ b/lib/utils/network/net_util.dart @@ -4,10 +4,9 @@ import 'dart:io'; // Project imports: import 'package:aku_new_community_manager/const/api.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'; import 'package:aku_new_community_manager/ui/login/login_page.dart'; -import 'package:aku_new_community_manager/utils/network/base_file_model.dart'; -import 'package:aku_new_community_manager/utils/network/base_list_model.dart'; -import 'package:aku_new_community_manager/utils/network/base_model.dart'; // Package imports: import 'package:bot_toast/bot_toast.dart'; import 'package:dio/dio.dart'; @@ -73,7 +72,7 @@ class NetUtil { } on DioError catch (e) { _parseErr(e); } - return BaseModel.err(); + return BaseModel.error(); } /// ## alias of Dio().post @@ -96,7 +95,7 @@ class NetUtil { } on DioError catch (e) { _parseErr(e); } - return BaseModel.err(); + return BaseModel.error(); } Future getList( @@ -120,18 +119,18 @@ class NetUtil { return BaseListModel.err(); } - Future upload(String path, File file) async { + Future upload(String path, File file) async { try { Response res = await _dio!.post(path, data: FormData.fromMap({ 'file': await MultipartFile.fromFile(file.path), })); - BaseFileModel baseListModel = BaseFileModel.fromJson(res.data); - return baseListModel; + BaseModel baseModel = BaseModel.fromJson(res.data); + return baseModel; } on DioError catch (e) { print(e); } - return BaseFileModel.err(); + return BaseModel.error(); } Future> uploadFiles(List files, String api) async { @@ -140,8 +139,10 @@ class NetUtil { return []; } else { for (var item in files) { - BaseFileModel model = await NetUtil().upload(api, item); - urls.add(model.url ?? ''); + BaseModel model = await NetUtil().upload(api, item); + if (model.data != null) { + urls.add(model.data as String); + } } } @@ -173,12 +174,12 @@ class NetUtil { _parseRequestError(BaseModel model, {bool showMessage = false}) { final userProvider = Provider.of(Get.context!, listen: false); - if (!model.status! && model.message == '登录失效,请登录' && userProvider.isLogin) { + if (!model.success && (model.code == 10010 || model.msg == '登录失效,请重新登录')) { userProvider.logout(); Get.offAll(() => LoginPage()); - } - if (!model.status! || showMessage) { - BotToast.showText(text: model.message!); + if (userProvider.isLogin) { + BotToast.showText(text: model.msg); + } } } } diff --git a/lib/utils/websocket/alarm_models/fall_model.g.dart b/lib/utils/websocket/alarm_models/fall_model.g.dart index 68471e8..7af23b2 100644 --- a/lib/utils/websocket/alarm_models/fall_model.g.dart +++ b/lib/utils/websocket/alarm_models/fall_model.g.dart @@ -6,13 +6,11 @@ part of 'fall_model.dart'; // JsonSerializableGenerator // ************************************************************************** -FallModel _$FallModelFromJson(Map json) { - return FallModel( - userName: json['userName'] as String?, - tel: json['tel'] as String?, - address: json['address'] as String?, - lon: json['lon'] as num?, - lat: json['lat'] as num?, - type: json['type'] as int?, - ); -} +FallModel _$FallModelFromJson(Map json) => FallModel( + userName: json['userName'] as String?, + tel: json['tel'] as String?, + address: json['address'] as String?, + lon: json['lon'] as num?, + lat: json['lat'] as num?, + type: json['type'] as int?, + ); diff --git a/lib/utils/websocket/alarm_models/fire_model.g.dart b/lib/utils/websocket/alarm_models/fire_model.g.dart index 68e5c7f..092a400 100644 --- a/lib/utils/websocket/alarm_models/fire_model.g.dart +++ b/lib/utils/websocket/alarm_models/fire_model.g.dart @@ -6,13 +6,11 @@ part of 'fire_model.dart'; // JsonSerializableGenerator // ************************************************************************** -FireModel _$FireModelFromJson(Map json) { - return FireModel( - alarmNo: json['alarmNo'] as String?, - alarmType: json['alarmType'] as String?, - deviceName: json['deviceName'] as String?, - deviceNo: json['deviceNo'] as String?, - time: json['time'] as String?, - type: json['type'] as int?, - ); -} +FireModel _$FireModelFromJson(Map json) => FireModel( + alarmNo: json['alarmNo'] as String?, + alarmType: json['alarmType'] as String?, + deviceName: json['deviceName'] as String?, + deviceNo: json['deviceNo'] as String?, + time: json['time'] as String?, + type: json['type'] as int?, + ); diff --git a/pubspec.lock b/pubspec.lock index 840ab23..2252271 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: _fe_analyzer_shared url: "https://pub.flutter-io.cn" source: hosted - version: "21.0.0" + version: "36.0.0" amap_flutter_base: dependency: "direct main" description: @@ -35,7 +35,7 @@ packages: name: analyzer url: "https://pub.flutter-io.cn" source: hosted - version: "1.5.0" + version: "3.3.1" animator: dependency: transitive description: @@ -98,7 +98,7 @@ packages: name: build url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.1" + version: "2.2.1" build_config: dependency: transitive description: @@ -119,21 +119,21 @@ packages: name: build_resolvers url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.1" + version: "2.0.6" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.3" + version: "2.1.8" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.flutter-io.cn" source: hosted - version: "7.0.0" + version: "7.2.3" built_collection: dependency: transitive description: @@ -204,6 +204,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.15.0" + color: + dependency: transitive + description: + name: color + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" common_utils: dependency: "direct main" description: @@ -238,7 +245,14 @@ packages: name: dart_style url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.1" + version: "2.2.2" + dartx: + dependency: transitive + description: + name: dartx + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" decimal: dependency: transitive description: @@ -377,6 +391,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1" + flutter_gen_core: + dependency: transitive + description: + name: flutter_gen_core + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.6" + flutter_gen_runner: + dependency: "direct dev" + description: + name: flutter_gen_runner + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.6" flutter_highlight: dependency: transitive description: @@ -476,6 +504,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + hive_generator: + dependency: "direct dev" + description: + name: hive_generator + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.2" http: dependency: transitive description: @@ -561,14 +596,14 @@ packages: name: json_annotation url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.1" + version: "4.4.0" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.flutter-io.cn" source: hosted - version: "4.1.1" + version: "6.1.5" logger: dependency: "direct main" description: @@ -744,13 +779,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.4.0" pin_input_text_field: dependency: "direct main" description: name: pin_input_text_field url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.0" + version: "4.1.1" platform: dependency: transitive description: @@ -847,13 +889,27 @@ packages: description: flutter source: sdk version: "0.0.99" + sms_autofill: + dependency: "direct dev" + description: + name: sms_autofill + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.0" source_gen: dependency: transitive description: name: source_gen url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.0" + version: "1.2.1" + source_helper: + dependency: transitive + description: + name: source_helper + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.1" source_span: dependency: transitive description: @@ -910,6 +966,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.4.3" + time: + dependency: transitive + description: + name: time + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" timing: dependency: transitive description: @@ -1029,6 +1092,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.2.0" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.3.1" yaml: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index 6c01237..e0e88fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -81,12 +81,16 @@ dev_dependencies: flutter_test: sdk: flutter import_sorter: ^4.5.1 + hive_generator: ^1.1.0 grinder: ^0.9.0 #json序列化 - json_serializable: ^4.1.1 + json_serializable: ^6.1.3 build_runner: ^2.0.3 yaml: ^3.1.0 pub_semver: ^2.0.0 + flutter_gen_runner: ^4.1.3 + #验证码自动填充 + sms_autofill: ^2.2.0 flutter: uses-material-design: true