From ad17ad1593053dd93363907a858cb74cd402ad60 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 24 Mar 2022 17:53:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E7=94=A8=E6=88=B7=E8=AF=A6?= =?UTF-8?q?=E6=83=85=20=E5=88=A0=E9=99=A4=E6=97=A7=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/const/saas_api.dart | 5 +- .../house_keeping_list_model.dart | 8 +- lib/models/user/user_info_model.dart | 102 ------------------ lib/models/user/user_profile_model.dart | 43 -------- lib/new_ui/auth/sign_func.dart | 13 +-- lib/provider/user_provider.dart | 98 +++++------------ lib/saas_models/user/user_info_model.dart | 89 +++++++++------ lib/saas_models/user/user_info_model.g.dart | 26 +++-- .../home/application/applications_page.dart | 11 +- lib/ui/home/home_page.dart | 2 +- lib/ui/home/personal_draw.dart | 2 +- lib/ui/home/search_workorder_page.dart | 28 +++-- .../engineer_repair/engineer_repair_card.dart | 25 ++--- .../engineer_repair_detail_page.dart | 21 ++-- .../engineer_repair/engineer_repair_page.dart | 15 ++- .../engineer_repair/engineer_repair_view.dart | 23 ++-- .../house_keeping/house_keeping_card.dart | 17 +-- .../house_keeping_detail_page.dart | 8 +- .../house_keeping/house_keeping_page.dart | 9 +- .../house_keeping/house_keeping_view.dart | 9 +- .../inspection_manage_card.dart | 20 ++-- .../inspection_manage_page.dart | 12 +-- lib/ui/settings/nick_name_change_page.dart | 18 ++-- lib/ui/settings/user_info_page.dart | 18 ++-- lib/ui/splash/splash_page.dart | 5 +- .../borrow_manager/all_borrow_goods.dart | 2 +- .../borrow_item_detail_page.dart | 2 +- .../borrow_manager/borrow_items_page.dart | 4 +- .../borrow_manager/borrow_manager_card.dart | 90 +++++++++------- .../borrow_manager/borrow_manager_page.dart | 28 +++-- .../business_and_fix_detail_page.dart | 10 +- .../business_and_fix_page.dart | 14 +-- .../business_and_fix/business_fix_card.dart | 20 ++-- .../decoration_manager/decoration_util.dart | 9 +- .../items_outdoor_details_page.dart | 4 +- lib/ui/widgets/app_widgets/aku_avatar.dart | 16 +-- 36 files changed, 308 insertions(+), 518 deletions(-) delete mode 100644 lib/models/user/user_info_model.dart delete mode 100644 lib/models/user/user_profile_model.dart diff --git a/lib/const/saas_api.dart b/lib/const/saas_api.dart index 6e937b6..511c5b9 100644 --- a/lib/const/saas_api.dart +++ b/lib/const/saas_api.dart @@ -11,7 +11,7 @@ class SAASAPI { ///静态资源路径 static String get resource => - 'https://saas.kaidalai.cn/resource/${UserTool.userProvider.infoModel!.id}/'; + 'https://saas.kaidalai.cn/resource/${UserTool.userProvider.userInfoModel!.id}/'; static String image(String? path) => '$resource$path'; @@ -30,6 +30,9 @@ class SAASAPI { } class _Login { + ///获取用户详情 + String get userInfo => '/butlerApp/user/findDetail'; + ///查询所有小区信息 String get allCommunity => '/butlerApp/login/findAllCommunity'; diff --git a/lib/json_models/manager/house_keeping/house_keeping_list_model.dart b/lib/json_models/manager/house_keeping/house_keeping_list_model.dart index a963748..2b50f67 100644 --- a/lib/json_models/manager/house_keeping/house_keeping_list_model.dart +++ b/lib/json_models/manager/house_keeping/house_keeping_list_model.dart @@ -1,9 +1,8 @@ -import 'package:aku_new_community_manager/models/user/user_info_model.dart'; +import 'package:aku_new_community_manager/models/common/img_model.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:equatable/equatable.dart'; - -import 'package:aku_new_community_manager/models/common/img_model.dart'; import 'package:json_annotation/json_annotation.dart'; + part 'house_keeping_list_model.g.dart'; @JsonSerializable() @@ -58,8 +57,7 @@ class HouseKeepingListModel extends Equatable { case 1: return '待派单'; case 2: - if (UserTool.userProvider.infoModel!.houseKeepingAuthority == - HKAUTH.PICK) { + if (UserTool.userProvider.userInfoModel!.type == 1) { return '已派单'; } else { return '待接单'; diff --git a/lib/models/user/user_info_model.dart b/lib/models/user/user_info_model.dart deleted file mode 100644 index 039088f..0000000 --- a/lib/models/user/user_info_model.dart +++ /dev/null @@ -1,102 +0,0 @@ -enum HKAUTH { - ///家政服务派单权限 - SEND, - - ///家政服务接单权限 - PICK, - - ///家政服务隐藏 - HIDE -} - -///工程维修权限 -enum ERAUTH { - ///福航公司派单给维修公司 - SENDTOCOMPANY, - - ///维修公司派单给维修人员 - SENDTOPERSON, - - ///维修人员接单, - PICK, - - ///无权限,隐藏入口 - HIDE -} - -@Deprecated('逐步删除') -class UserInformationModel { - int? id; - String? roleId; - String? nickName; - List? jurisdiction; - - ///报事报修派单(派单人) - bool get canSendTicket => jurisdiction!.contains(52); - - ///报事报修接单(维修人) - bool get canPickUpTicket => jurisdiction!.contains(53); - - ///放行(保安) - bool get canPass => jurisdiction!.contains(55); - - ///操作权限(借还管理) - bool get canOperation => jurisdiction!.contains(57); - - ///装修派工权限 - bool get canDecorationDispatch => jurisdiction!.contains(59); - - ///装修管理跟踪执行权限 - bool get canDecorationTrack => jurisdiction!.contains(60); - - ///报事报修管家 - bool get manager => canSendTicket && canPickUpTicket; - - ///隐藏报事报修 - bool get hideFix => - (!jurisdiction!.contains(53)) && (!jurisdiction!.contains(52)); - - HKAUTH get houseKeepingAuthority { - if (jurisdiction!.contains(68)) { - return HKAUTH.PICK; - } else if (jurisdiction!.contains(67)) { - return HKAUTH.SEND; - } else { - return HKAUTH.HIDE; - } - } - - ERAUTH get engineeringRepairAuthority { - if (jurisdiction!.contains(69)) { - return ERAUTH.SENDTOCOMPANY; - } else if (jurisdiction!.contains(70)) { - return ERAUTH.SENDTOPERSON; - } else if (jurisdiction!.contains(71)) { - return ERAUTH.PICK; - } else { - return ERAUTH.HIDE; - } - } - - UserInformationModel( - {required this.id, this.roleId, this.nickName, this.jurisdiction}); - - UserInformationModel.fromJson(Map json) { - id = json['id']; - roleId = json['roleId']; - nickName = json['nickName']; - if (json['jurisdiction'] != null) - jurisdiction = json['jurisdiction'].cast(); - else - json['jurisdiction'] = []; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['roleId'] = this.roleId; - data['nickName'] = this.nickName; - data['jurisdiction'] = this.jurisdiction; - return data; - } -} diff --git a/lib/models/user/user_profile_model.dart b/lib/models/user/user_profile_model.dart deleted file mode 100644 index 30da172..0000000 --- a/lib/models/user/user_profile_model.dart +++ /dev/null @@ -1,43 +0,0 @@ -// Project imports: -import 'package:aku_new_community_manager/models/common/img_model.dart'; - -@Deprecated('逐步删除') -class UserProfileModel { - int? id; - List? imgUrls; - String? nickName; - String? tel; - - UserProfileModel({required this.id, this.imgUrls, this.nickName, this.tel}); - - ImgModel? get firstImg { - if (imgUrls!.isEmpty) - return null; - else - return imgUrls!.first; - } - - UserProfileModel.fromJson(Map json) { - id = json['id']; - if (json['imgUrls'] != null) { - imgUrls = []; - json['imgUrls'].forEach((v) { - imgUrls!.add(new ImgModel.fromJson(v)); - }); - } - nickName = json['nickName']; - tel = json['tel']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); - } else - imgUrls = []; - data['nickName'] = this.nickName; - data['tel'] = this.tel; - return data; - } -} diff --git a/lib/new_ui/auth/sign_func.dart b/lib/new_ui/auth/sign_func.dart index 890a029..a6d3c88 100644 --- a/lib/new_ui/auth/sign_func.dart +++ b/lib/new_ui/auth/sign_func.dart @@ -1,7 +1,5 @@ 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'; @@ -45,13 +43,6 @@ class SignFunc { 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, @@ -91,9 +82,7 @@ class SignFunc { } static Future checkNameAndAccount() async { - if (!UserTool.userProvider.userInfoModel!.isExistPassword) { - await Get.to(() => SetPsdPage()); - } else if (UserTool.userProvider.userInfoModel!.nickName == null) { + if (UserTool.userProvider.userInfoModel!.nickName == null) { await Get.to(() => SetNickNamePage()); } else { Get.offAll(() => HomePage()); diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 230936c..f41ea59 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -1,13 +1,10 @@ // Dart imports: + 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'; @@ -16,9 +13,6 @@ import 'package:aku_new_community_manager/utils/websocket/web_socket_util.dart'; // Package imports: import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:jpush_flutter/jpush_flutter.dart'; -import 'package:provider/provider.dart'; //登录状态管理 class UserProvider extends ChangeNotifier { @@ -32,50 +26,14 @@ class UserProvider extends ChangeNotifier { NetUtil().auth(token); await HiveStore.appBox!.put('token', token); await HiveStore.appBox!.put('login', true); - _profileModel = await updateProfile(); - _infoModel = await updateUserInfo(); if (isLogin) { - WebSocketUtil().setUser(_infoModel?.id.toString() ?? ''); + await updateUserInfo(); + WebSocketUtil().setUser(_userInfoModel!.id.toString()); WebSocketUtil().startWebSocket(); } - // await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true) - // ? '' - // : _userDetailModel?.estateNames?.first); notifyListeners(); } - UserProfileModel? _profileModel; - - UserProfileModel? get profileModel => _profileModel; - UserInformationModel? _infoModel; - - UserInformationModel? get infoModel => _infoModel; - - ///更新用户profile - Future updateProfile() async { - final messageProvider = - Provider.of(Get.context!, listen: false); - messageProvider.updateMessage(); - BaseModel? model = await NetUtil().get(API.user.profile); - if (model.data == null) - return null; - else - return UserProfileModel.fromJson(model.data); - } - - Future updateUserInfo() async { - BaseModel? model = await NetUtil().get(API.user.info); - - if (model.data == null) - return null; - else { - var userModel = UserInformationModel.fromJson(model.data); - JPush().setAlias(userModel.id.toString()); - print('jpush alias is ${userModel.id}'); - return userModel; - } - } - ///注销登录 logout() async { await NetUtil().get(API.auth.logout, showMessage: true); @@ -92,39 +50,14 @@ class UserProvider extends ChangeNotifier { ///用户是否登陆 get isSigned => _isSigned; - ///设置用户登陆 - setisSigned(bool state) { - _isSigned = state; - notifyListeners(); - } - ///修改昵称 setNickName(String name) { - _infoModel!.nickName = name; + // _infoModel!.nickName = name; notifyListeners(); } - ///修改头像 - setAvatar(File file) async { - Function cancel = BotToast.showLoading(); - BaseModel fileModel = await NetUtil().upload(API.upload.avatar, file); - if (fileModel.success) { - await NetUtil().post( - API.user.updateAvatar, - params: { - 'fileUrls': [fileModel.data], - }, - showMessage: true, - ); - _profileModel = await updateProfile(); - cancel(); - notifyListeners(); - } - } - ///修改手机 setTel(String tel) { - _profileModel!.tel = tel; notifyListeners(); } @@ -135,11 +68,20 @@ class UserProvider extends ChangeNotifier { UserInfoModel? get userInfoModel => _userInfoModel; ///修改头像 - Future updateAvatar(String? path) async { + Future updateAvatar(File file) async { + var url = ''; + try { + var base = await NetUtil().upload(SAASAPI.other.file.uploadImg, file); + if (base.success) { + url = base.data as String; + } + } catch (e) { + print(e.toString()); + } BaseModel model = await NetUtil().post( SAASAPI.user.updateAvatar, params: { - 'fileUrls': [path] + 'fileUrls': [url] }, showMessage: true, ); @@ -147,4 +89,14 @@ class UserProvider extends ChangeNotifier { await updateUserInfo(); } } + + Future updateUserInfo() async { + var base = await NetUtil().get(SAASAPI.login.userInfo); + if (base.success) { + _userInfoModel = UserInfoModel.fromJson(base.data); + } else { + BotToast.showText(text: '用户信息更新失败'); + } + notifyListeners(); + } } diff --git a/lib/saas_models/user/user_info_model.dart b/lib/saas_models/user/user_info_model.dart index f207882..7a506ba 100644 --- a/lib/saas_models/user/user_info_model.dart +++ b/lib/saas_models/user/user_info_model.dart @@ -1,25 +1,29 @@ import 'package:aku_new_community_manager/models/common/img_model.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; part 'user_info_model.g.dart'; @JsonSerializable() -class UserInfoModel { +class UserInfoModel extends Equatable { final int id; - final int communityId; - final String communityCode; - final String? name; - final String? idCard; + final String userName; + final int type; + final String actualName; final String tel; - - // 性别 1.男 2.女 3.保密 - final int? sex; + final int sex; + final String userCode; + final String? birthDay; + final String? email; + final int status; + final int? lastLoginIp; + final String? lastLoginDate; final String? nickName; - final bool isExistPassword; - final bool isPointsSignSetting; - final bool isSign; - final int? points; - final List imgList; + final String? address; + final String entryDate; + final String? remake; + final List? imgList; String get sexValue { if (sex == 1) return '男'; @@ -28,31 +32,56 @@ class UserInfoModel { return '未设置'; } - // DateTime? get birthdayDate => DateUtil.getDateTime(birthday ?? ''); + DateTime? get birthdayDate => DateUtil.getDateTime(birthDay ?? ''); - // String get birthdayValue { - // if (TextUtil.isEmpty(birthday)) - // return '未设置'; - // else - // return DateUtil.formatDate(birthdayDate, format: 'yyyy-MM-dd'); - // } + String get birthdayValue { + if (TextUtil.isEmpty(birthDay)) + return '未设置'; + else + return DateUtil.formatDate(birthdayDate, format: 'yyyy-MM-dd'); + } factory UserInfoModel.fromJson(Map json) => _$UserInfoModelFromJson(json); + @override + List get props => [ + id, + userName, + type, + actualName, + tel, + sex, + userCode, + birthDay, + email, + status, + lastLoginIp, + lastLoginDate, + nickName, + address, + entryDate, + remake, + imgList, + ]; + const UserInfoModel({ required this.id, - required this.communityId, - required this.communityCode, - this.name, - this.idCard, + required this.userName, + required this.type, + required this.actualName, required this.tel, - this.sex, + required this.sex, + required this.userCode, + this.birthDay, + this.email, + required this.status, + this.lastLoginIp, + this.lastLoginDate, this.nickName, - required this.isExistPassword, - required this.isPointsSignSetting, - required this.isSign, - this.points, - required this.imgList, + this.address, + required this.entryDate, + this.remake, + this.imgList, }); } diff --git a/lib/saas_models/user/user_info_model.g.dart b/lib/saas_models/user/user_info_model.g.dart index dc46024..41fecea 100644 --- a/lib/saas_models/user/user_info_model.g.dart +++ b/lib/saas_models/user/user_info_model.g.dart @@ -9,18 +9,22 @@ part of 'user_info_model.dart'; 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?, + userName: json['userName'] as String, + type: json['type'] as int, + actualName: json['actualName'] as String, tel: json['tel'] as String, - sex: json['sex'] as int?, + sex: json['sex'] as int, + userCode: json['userCode'] as String, + birthDay: json['birthDay'] as String?, + email: json['email'] as String?, + status: json['status'] as int, + lastLoginIp: json['lastLoginIp'] as int?, + lastLoginDate: json['lastLoginDate'] as String?, 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)) + address: json['address'] as String?, + entryDate: json['entryDate'] as String, + remake: json['remake'] as String?, + imgList: (json['imgList'] as List?) + ?.map((e) => ImgModel.fromJson(e as Map)) .toList(), ); diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index a12bd7f..1057c1b 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -1,7 +1,3 @@ -// Flutter imports: -// Project imports: -import 'package:aku_new_community_manager/const/resource.dart'; -import 'package:aku_new_community_manager/models/user/user_info_model.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/tools/screen_tool.dart'; @@ -71,7 +67,7 @@ class _ApplicationPageState extends State AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, () => WarningPage()), AppApplication( '访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, () => VisitorManagerPage()), - if (!UserTool.userProvider.infoModel!.hideFix) + if (!(UserTool.userProvider.userInfoModel!.type == 1)) AppApplication( '报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, () => BusinessAndFixPage()), AppApplication( @@ -97,11 +93,10 @@ class _ApplicationPageState extends State AppApplication( '考勤管理', R.ASSETS_HOME_CLOCK_IN_OUT_PNG, () => ClockInOutPage()), AppApplication('访谈管理', R.ASSETS_HOME_INTERVIEW_PNG, () => InterviewPage()), - if (UserTool.userProvider.infoModel!.houseKeepingAuthority != HKAUTH.HIDE) + if (UserTool.userProvider.userInfoModel!.type == 1) AppApplication( '家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()), - if (UserTool.userProvider.infoModel!.engineeringRepairAuthority != - ERAUTH.HIDE) + if (UserTool.userProvider.userInfoModel!.type == 1) AppApplication( '工程维修', R.ASSETS_HOME_IC_SERVICE_PNG, () => EngineerRepairPage()), ]; diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 8d1999b..94582dd 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -358,7 +358,7 @@ class _HomePageState extends State { height: 67.w, child: Text( userProvider.isLogin - ? 'HI,${userProvider.infoModel!.nickName}' + ? 'HI,${userProvider.userInfoModel!.nickName}' : '登录/注册', style: TextStyle( color: AppStyle.primaryTextColor, diff --git a/lib/ui/home/personal_draw.dart b/lib/ui/home/personal_draw.dart index e44cf44..4e2a409 100644 --- a/lib/ui/home/personal_draw.dart +++ b/lib/ui/home/personal_draw.dart @@ -83,7 +83,7 @@ class _PersonalDrawState extends State { //登录按钮 userProvider.isLogin ? Text( - userProvider.infoModel!.nickName!, + userProvider.userInfoModel!.nickName!, style: TextStyle( color: AppStyle.primaryTextColor, fontSize: 28.sp, diff --git a/lib/ui/home/search_workorder_page.dart b/lib/ui/home/search_workorder_page.dart index fe4c1ec..f70f2bb 100644 --- a/lib/ui/home/search_workorder_page.dart +++ b/lib/ui/home/search_workorder_page.dart @@ -1,38 +1,36 @@ // Flutter imports: -import 'package:aku_new_community_manager/tools/user_tool.dart'; -import 'package:aku_new_community_manager/ui/manage_pages/clock_in_out/clock_in_out_page.dart'; -import 'package:aku_new_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; -import 'package:aku_new_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; -import 'package:aku_new_community_manager/ui/manage_pages/interview/interview_page.dart'; -import 'package:aku_new_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/const/resource.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/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; import 'package:aku_new_community_manager/ui/home/application/applications_page.dart'; +import 'package:aku_new_community_manager/ui/manage_pages/clock_in_out/clock_in_out_page.dart'; +import 'package:aku_new_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/green_manage/green_manage_page.dart'; +import 'package:aku_new_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/hygience_manage/hygience_manage_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_manage_page.dart'; +import 'package:aku_new_community_manager/ui/manage_pages/interview/interview_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/key_manage/key_manage_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/packages_manage/packages_manage_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/rules_manage/rules_manage_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/activity_manager/activity_manager_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/borrow_manager/borrow_manager_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; +import 'package:aku_new_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/items_outdoor/items_outdoor_page.dart'; import 'package:aku_new_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_new_community_manager/ui/tool_pages/warning/warning_page.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_back_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:flutter/material.dart'; +// Package imports: +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; class SearchWorkOrderPage extends StatefulWidget { SearchWorkOrderPage({Key? key}) : super(key: key); @@ -47,7 +45,7 @@ class _SearchWorkOrderpageState extends State { AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, () => WarningPage()), AppApplication( '访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, () => VisitorManagerPage()), - if (UserTool.userProvider.infoModel!.manager) + if (UserTool.userProvider.userInfoModel!.type == 1) AppApplication( '报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, () => BusinessAndFixPage()), AppApplication( diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart index d0dfdbd..814a535 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart @@ -2,7 +2,6 @@ import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/manager/engineer_repair/engineer_repair_list_model.dart'; import 'package:aku_new_community_manager/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.dart'; import 'package:aku_new_community_manager/json_models/manager/engineer_repair/engineer_repair_result_model.dart'; -import 'package:aku_new_community_manager/models/user/user_info_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/engineer_repair/engineer_repair_acceptance_page.dart'; @@ -130,8 +129,7 @@ class EngineerRepairCard extends StatelessWidget { AkuMaterialButton( height: 64.w, onPressed: () async { - (UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOCOMPANY) + (true) ? await Get.to( () => EngineerRepairDepartCompany(repairId: model.id)) : await Get.to(() => @@ -142,8 +140,7 @@ class EngineerRepairCard extends StatelessWidget { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOCOMPANY + (UserTool.userProvider.userInfoModel!.type == 1 ? '分派单位' : '查看详情'), style: TextStyle( @@ -160,8 +157,7 @@ class EngineerRepairCard extends StatelessWidget { AkuMaterialButton( height: 64.w, onPressed: () async { - (UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOPERSON) + (UserTool.userProvider.userInfoModel!.type == 1) ? await Get.to(() => EngineerRepairDetailPage(repairEngineerId: model.id)) : await Get.to(() => @@ -172,8 +168,7 @@ class EngineerRepairCard extends StatelessWidget { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOPERSON + (UserTool.userProvider.userInfoModel!.type == 1 ? '指派人员' : '查看详情'), style: TextStyle( @@ -187,8 +182,7 @@ class EngineerRepairCard extends StatelessWidget { ]; case 3: return [ - UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.PICK + UserTool.userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( height: 64.w, onPressed: () async { @@ -258,9 +252,7 @@ class EngineerRepairCard extends StatelessWidget { return [ AkuMaterialButton( height: 64.w, - onPressed: UserTool - .userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOCOMPANY + onPressed: UserTool.userProvider.userInfoModel!.type == 1 ? () async { EngineerRepairResultModel? resultModel = await EngineerRepairFunc.getRepairResult(model.id); @@ -285,10 +277,7 @@ class EngineerRepairCard extends StatelessWidget { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOCOMPANY - ? '验收审核' - : '验收记录', + UserTool.userProvider.userInfoModel!.type == 1 ? '验收审核' : '验收记录', style: TextStyle( color: AppStyle.primaryTextColor, fontWeight: FontWeight.bold, diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_detail_page.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_detail_page.dart index 1e5b854..b6ec149 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_detail_page.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_detail_page.dart @@ -5,7 +5,6 @@ import 'package:aku_new_community_manager/json_models/manager/engineer_repair/en import 'package:aku_new_community_manager/json_models/manager/engineer_repair/engineer_repair_process_model.dart'; import 'package:aku_new_community_manager/json_models/manager/engineer_repair/engineer_repair_result_model.dart'; import 'package:aku_new_community_manager/json_models/manager/engineer_repair/engineer_repair_work_report_model.dart'; -import 'package:aku_new_community_manager/models/user/user_info_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; @@ -127,8 +126,7 @@ class _EngineerRepairDetailPageState extends State { if (_model != null) { switch (_model!.status) { case 1: - return UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOCOMPANY + return UserTool.userProvider.userInfoModel!.type == 1 ? AkuBottomButton( title: '立即派单', onTap: () async { @@ -138,10 +136,7 @@ class _EngineerRepairDetailPageState extends State { ) : SizedBox(); case 2: - print(UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOPERSON); - return UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOPERSON + return UserTool.userProvider.userInfoModel!.type == 1 ? AkuBottomButton( title: '立即派单', onTap: () async { @@ -153,8 +148,7 @@ class _EngineerRepairDetailPageState extends State { ) : SizedBox(); case 3: - return UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.PICK + return UserTool.userProvider.userInfoModel!.type == 1 ? AkuBottomButton( title: '立即接单', onTap: () async { @@ -167,8 +161,7 @@ class _EngineerRepairDetailPageState extends State { ) : SizedBox(); case 4: - return UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.PICK + return UserTool.userProvider.userInfoModel!.type == 1 ? Row( children: [ AkuMaterialButton( @@ -193,8 +186,7 @@ class _EngineerRepairDetailPageState extends State { ) : SizedBox(); case 5: - return UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.SENDTOCOMPANY + return UserTool.userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( color: kPrimaryColor, onPressed: () async { @@ -213,8 +205,7 @@ class _EngineerRepairDetailPageState extends State { '验收审核'.text.size(32.sp).bold.color(Colors.black).make()) : SizedBox(); case 6: - return UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.PICK + return UserTool.userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( color: kPrimaryColor, onPressed: () async { diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_page.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_page.dart index 8d7b15b..6ba3827 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_page.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_page.dart @@ -1,4 +1,3 @@ -import 'package:aku_new_community_manager/models/user/user_info_model.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/engineer_repair/add_engineer_repair_page.dart'; import 'package:aku_new_community_manager/ui/manage_pages/engineer_repair/engineer_repair_view.dart'; @@ -21,13 +20,13 @@ class EngineerRepairPage extends StatefulWidget { class _EngineerRepairPageState extends State with TickerProviderStateMixin { List get _tabs { - switch (UserTool.userProvider.infoModel!.engineeringRepairAuthority) { - case ERAUTH.SENDTOCOMPANY: - return ['全部', '待派单', '已派单', '处理中', '待验收', '验收驳回', '已完成']; - case ERAUTH.SENDTOPERSON: - return ['全部', '待派单', '已派单', '处理中', '待验收', '验收驳回', '已完成']; - case ERAUTH.PICK: - return ['全部', '已派单', '处理中', '待验收', '验收驳回', '已完成']; + switch (UserTool.userProvider.userInfoModel!.type == 1) { + // case ERAUTH.SENDTOCOMPANY: + // return ['全部', '待派单', '已派单', '处理中', '待验收', '验收驳回', '已完成']; + // case ERAUTH.SENDTOPERSON: + // return ['全部', '待派单', '已派单', '处理中', '待验收', '验收驳回', '已完成']; + // case ERAUTH.PICK: + // return ['全部', '已派单', '处理中', '待验收', '验收驳回', '已完成']; default: return ['全部', '待派单', '已派单', '处理中', '待验收', '验收驳回', '已完成']; } 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 ae8cff5..e0ce9c8 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart @@ -1,6 +1,5 @@ import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/manager/engineer_repair/engineer_repair_list_model.dart'; -import 'package:aku_new_community_manager/models/user/user_info_model.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/engineer_repair/engineer_repair_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; @@ -24,19 +23,19 @@ class _EngineerRepairViewState extends State { if (widget.index == 0) { return null; } else if (widget.index == 1) { - switch (UserTool.userProvider.infoModel!.engineeringRepairAuthority) { - case ERAUTH.SENDTOCOMPANY: - return 1; - case ERAUTH.SENDTOPERSON: - return 2; - case ERAUTH.PICK: - return 3; - case ERAUTH.HIDE: - break; + switch (UserTool.userProvider.userInfoModel!.type == 1) { + // case ERAUTH.SENDTOCOMPANY: + // return 1; + // case ERAUTH.SENDTOPERSON: + // return 2; + // case ERAUTH.PICK: + // return 3; + // case ERAUTH.HIDE: + // break; + default: } } else { - return UserTool.userProvider.infoModel!.engineeringRepairAuthority == - ERAUTH.PICK + return UserTool.userProvider.userInfoModel!.type == 1 ? widget.index + 2 : widget.index + 1; } diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart index 6085f59..fc3ed1b 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart @@ -1,7 +1,6 @@ import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/manager/house_keeping/house_keeping_list_model.dart'; import 'package:aku_new_community_manager/json_models/manager/house_keeping/house_keeping_process_model.dart'; -import 'package:aku_new_community_manager/models/user/user_info_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/house_keeping/house_keeping_department_page.dart'; @@ -134,8 +133,7 @@ class HouseKeepingCard extends StatelessWidget { AkuMaterialButton( height: 64.w, onPressed: () async { - (UserTool.userProvider.infoModel!.houseKeepingAuthority == - HKAUTH.SEND) + (UserTool.userProvider.userInfoModel!.type == 1) ? Get.to(() => HouseKeepingDepartmentPage( id: model.id, callRefresh: callRefresh, @@ -157,8 +155,7 @@ class HouseKeepingCard extends StatelessWidget { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.houseKeepingAuthority == - HKAUTH.SEND + (UserTool.userProvider.userInfoModel!.type == 1 ? '立即派单' : '查看详情'), style: TextStyle( @@ -176,8 +173,7 @@ class HouseKeepingCard extends StatelessWidget { height: 64.w, onPressed: () async { Function cancel = BotToast.showLoading(); - (UserTool.userProvider.infoModel!.houseKeepingAuthority == - HKAUTH.SEND) + (UserTool.userProvider.userInfoModel!.type == 1) ? await HouseKeepingFunc.newHouseKeepingUrgeWork(model.id) : await HouseKeepingFunc.newHouseKeepingOrderReceive( model.id); @@ -188,10 +184,7 @@ class HouseKeepingCard extends StatelessWidget { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.houseKeepingAuthority == - HKAUTH.PICK - ? '立即接单' - : '催单'), + (UserTool.userProvider.userInfoModel!.type == 1 ? '立即接单' : '催单'), style: TextStyle( color: AppStyle.primaryTextColor, fontWeight: FontWeight.bold, @@ -203,7 +196,7 @@ class HouseKeepingCard extends StatelessWidget { ]; case 3: return [ - UserTool.userProvider.infoModel!.houseKeepingAuthority == HKAUTH.PICK + UserTool.userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( height: 64.w, onPressed: () async { diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart index 14d50f4..70ee9db 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart @@ -1,7 +1,6 @@ import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/manager/house_keeping/house_keeping_list_model.dart'; import 'package:aku_new_community_manager/json_models/manager/house_keeping/house_keeping_process_model.dart'; -import 'package:aku_new_community_manager/models/user/user_info_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/user_tool.dart'; @@ -12,16 +11,16 @@ import 'package:aku_new_community_manager/ui/widgets/app_widgets/bee_grid_image_ 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/aku_title_box.dart'; +import 'package:aku_new_community_manager/utils/extension/list_extension.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:velocity_x/velocity_x.dart'; -import 'package:aku_new_community_manager/utils/extension/list_extension.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class HouseKeepingDetailPage extends StatefulWidget { final HouseKeepingListModel model; @@ -79,8 +78,7 @@ class _HouseKeepingDetailPageState extends State { }, ); case 2: - return UserTool.userProvider.infoModel!.houseKeepingAuthority == - HKAUTH.PICK + return UserTool.userProvider.userInfoModel!.type == 1 ? AkuBottomButton( title: '立即接单', onTap: () async { diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_page.dart index 58d0e4a..38c59bc 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_page.dart @@ -1,4 +1,3 @@ -import 'package:aku_new_community_manager/models/user/user_info_model.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/house_keeping/house_keeping_view.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; @@ -17,10 +16,12 @@ class HouseKeepingPage extends StatefulWidget { class _HouseKeepingPageState extends State with TickerProviderStateMixin { List get _tabs { - switch (UserTool.userProvider.infoModel!.houseKeepingAuthority) { - case HKAUTH.SEND: + switch (UserTool.userProvider.userInfoModel!.type == 1) { + // case HKAUTH.SEND: + case true: return ['全部', '待派单', '已派单', '处理中', '待支付', '待评价', '已完成']; - case HKAUTH.PICK: + // case HKAUTH.PICK: + case false: return ['全部', '已派单', '处理中', '待支付', '待评价', '已完成']; default: return []; 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 7a14a60..764719c 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_view.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_view.dart @@ -1,6 +1,5 @@ import 'package:aku_new_community_manager/const/api.dart'; import 'package:aku_new_community_manager/json_models/manager/house_keeping/house_keeping_list_model.dart'; -import 'package:aku_new_community_manager/models/user/user_info_model.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/ui/manage_pages/house_keeping/house_keeping_card.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart'; @@ -33,14 +32,16 @@ class _HouseKeepingViewState extends State { } int? get housekeepingServiceStatus { - switch (UserTool.userProvider.infoModel!.houseKeepingAuthority) { - case HKAUTH.PICK: + switch (UserTool.userProvider.userInfoModel!.type) { + // case HKAUTH.PICK: + case 1: if (widget.index == 0) { return null; } else { return widget.index + 1; } - case HKAUTH.SEND: + // case HKAUTH.SEND: + case 2: return widget.index == 0 ? null : widget.index; default: return widget.index == 0 ? null : widget.index; diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart index e99de1b..85bd99e 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart @@ -1,19 +1,17 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_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'; -import 'package:velocity_x/velocity_x.dart'; - // Project imports: import 'package:aku_new_community_manager/models/manager/inspection/inspection_list_model.dart'; 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/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_new_community_manager/utils/extension/aku_date.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 InspectionManageCard extends StatefulWidget { final InspectionListModel cardModel; @@ -34,7 +32,7 @@ class _InspectionManageCardState extends State { switch (status) { case 1: return Color(0xFFFF4501); - + case 2: return Color(0xFF999999); case 3: @@ -48,7 +46,7 @@ class _InspectionManageCardState extends State { bool get isManager { UserProvider userProvider = Provider.of(context); - return userProvider.infoModel!.canOperation; + return userProvider.userInfoModel!.type == 1; } @override diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart index 2ce1654..8f8fbfc 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart @@ -1,15 +1,13 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_manage_view.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_tab_bar.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:provider/provider.dart'; // Package imports: @@ -25,7 +23,7 @@ class _InspectionManagePageState extends State List get _tabs { UserProvider _userProvider = Provider.of(context, listen: false); - if (_userProvider.infoModel!.canOperation) { + if (_userProvider.userInfoModel!.type == 1) { return ['待巡检', '已巡检', '巡检中', '未巡检', '全部']; } else { return ['待巡检', '已巡检', '巡检中', '未巡检', '全部']; diff --git a/lib/ui/settings/nick_name_change_page.dart b/lib/ui/settings/nick_name_change_page.dart index 4ed3ed8..b73b378 100644 --- a/lib/ui/settings/nick_name_change_page.dart +++ b/lib/ui/settings/nick_name_change_page.dart @@ -1,20 +1,18 @@ // Flutter imports: -import 'package:flutter/material.dart'; - +// 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_model.dart'; +import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.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_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:provider/provider.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/provider/user_provider.dart'; -import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.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 { NickNameChangePage({Key? key}) : super(key: key); @@ -54,7 +52,7 @@ class _NickNameChangePageState extends State { controller: _textEditingController, decoration: InputDecoration( contentPadding: EdgeInsets.zero, - hintText: '${userProvider.infoModel!.nickName}', + hintText: '${userProvider.userInfoModel!.nickName}', hintStyle: TextStyle(color: Color(0xFF999999), fontSize: 34.sp), border: UnderlineInputBorder( diff --git a/lib/ui/settings/user_info_page.dart b/lib/ui/settings/user_info_page.dart index 1c46851..5afe767 100644 --- a/lib/ui/settings/user_info_page.dart +++ b/lib/ui/settings/user_info_page.dart @@ -1,13 +1,6 @@ // Dart imports: import 'dart:io'; -// Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:common_utils/common_utils.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/tools/aku_divider.dart'; @@ -20,6 +13,11 @@ import 'package:aku_new_community_manager/ui/widgets/app_widgets/aku_avatar.dart import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_tile.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/pick_image.dart'; +// Package imports: +import 'package:common_utils/common_utils.dart'; +// Flutter imports: +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class UserInfoPage extends StatefulWidget { UserInfoPage({Key? key}) : super(key: key); @@ -40,7 +38,7 @@ class _UserInfoPageState extends State { AkuTile( onTap: () async { File? file = await akuPickImage(); - if (file != null) await userProvider.setAvatar(file); + if (file != null) await userProvider.updateAvatar(file); }, title: Text('头像'), height: 168.w, @@ -52,7 +50,7 @@ class _UserInfoPageState extends State { setState(() {}); }, title: Text('昵称'), - suffix: Text(userProvider.infoModel!.nickName!), + suffix: Text(userProvider.userInfoModel!.nickName!), ), AkuTile( onTap: () async { @@ -60,7 +58,7 @@ class _UserInfoPageState extends State { setState(() {}); }, title: Text('手机'), - suffix: Text(TextUtil.hideNumber(userProvider.profileModel!.tel!)), + suffix: Text(TextUtil.hideNumber(userProvider.userInfoModel!.tel)), ), ].sepWidget(separate: AkuDivider.horizontal()), ), diff --git a/lib/ui/splash/splash_page.dart b/lib/ui/splash/splash_page.dart index c4cb029..9890ec6 100644 --- a/lib/ui/splash/splash_page.dart +++ b/lib/ui/splash/splash_page.dart @@ -1,11 +1,11 @@ // Flutter imports: // Project imports: +import 'package:aku_new_community_manager/new_ui/auth/login_root_page.dart'; import 'package:aku_new_community_manager/provider/app_provider.dart'; 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/ui/agreements/agreement_page.dart'; import 'package:aku_new_community_manager/ui/agreements/privacy_page.dart'; -import 'package:aku_new_community_manager/ui/home/home_page.dart'; import 'package:aku_new_community_manager/utils/dev_util.dart'; import 'package:aku_new_community_manager/utils/hive_store.dart'; // Package imports: @@ -43,6 +43,8 @@ class _SplashPageState extends State { final userProvider = Provider.of(context, listen: false); if (HiveStore.appBox!.containsKey('token')) { await userProvider.setLogin(HiveStore.appBox!.get('token')); + } else { + Get.to(() => LoginPage()); } //初始化AMap // await AmapLocation.instance.init(iosKey: 'ios key'); @@ -122,7 +124,6 @@ class _SplashPageState extends State { } if (mounted) PowerLogger.start(context, debug: DevUtil.isDev); await _initOp(); - Get.off(() => HomePage()); }); } 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 952a1db..3eab413 100644 --- a/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart +++ b/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart @@ -32,7 +32,7 @@ class _AllBorrowGoodsState extends State { return AkuScaffold( title: '全部物品', actions: [ - userProvider.infoModel!.canOperation + userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( minWidth: 120.w, onPressed: () { 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 298d9a2..d2ed9a1 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 @@ -45,7 +45,7 @@ class _BorrowItemDetailPageState extends State { return AkuScaffold( title: '物品详情', actions: [ - userProvider.infoModel!.canOperation + userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( minWidth: 120.w, onPressed: () async { 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 c12f80e..9052095 100644 --- a/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart +++ b/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart @@ -33,7 +33,7 @@ class _BorrowItemPageState extends State { return AkuScaffold( title: '物品查看', actions: [ - userProvider.infoModel!.canOperation + userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( minWidth: 120.w, onPressed: () { @@ -95,7 +95,7 @@ class _BorrowItemPageState extends State { ), ), Spacer(), - userProvider.infoModel!.canOperation + userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( padding: EdgeInsets.symmetric(horizontal: 24.w), onPressed: () { diff --git a/lib/ui/sub_pages/borrow_manager/borrow_manager_card.dart b/lib/ui/sub_pages/borrow_manager/borrow_manager_card.dart index f5b0386..502f4d0 100644 --- a/lib/ui/sub_pages/borrow_manager/borrow_manager_card.dart +++ b/lib/ui/sub_pages/borrow_manager/borrow_manager_card.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:get/get.dart'; -import 'package:provider/provider.dart'; -import 'package:url_launcher/url_launcher.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'; @@ -16,8 +6,16 @@ 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/widget_tool.dart'; import 'package:aku_new_community_manager/ui/sub_pages/borrow_manager/borrow_manager_check_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'; 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/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'borrow_manager_examine_page.dart'; @@ -57,13 +55,19 @@ class _BorrowManagerCardState extends State { Text( widget.model.borrowStatusValue, style: TextStyle( - color: widget.model.borrowStatus==-1?Color(0xFFFB7302): - widget.model.borrowStatus==0?Color(0xD9E60E0E): - widget.model.borrowStatus==1?Color(0xD9000000): - widget.model.borrowStatus==2?Color(0x73000000): - widget.model.borrowStatus==3?Color(0xD9FB7402): - widget.model.borrowStatus==4?Color(0xD9E60E0E): - AppStyle.failColor, + color: widget.model.borrowStatus == -1 + ? Color(0xFFFB7302) + : widget.model.borrowStatus == 0 + ? Color(0xD9E60E0E) + : widget.model.borrowStatus == 1 + ? Color(0xD9000000) + : widget.model.borrowStatus == 2 + ? Color(0x73000000) + : widget.model.borrowStatus == 3 + ? Color(0xD9FB7402) + : widget.model.borrowStatus == 4 + ? Color(0xD9E60E0E) + : AppStyle.failColor, fontWeight: FontWeight.bold, fontSize: 24.sp, ), @@ -85,12 +89,17 @@ class _BorrowManagerCardState extends State { children: [ FadeInImage.assetNetwork( placeholder: R.ASSETS_PLACEHOLDER_WEBP, - image: API.image(widget.model.imgUrls!.isEmpty?'':widget.model.imgUrls![0].url??''), + image: API.image(widget.model.imgUrls!.isEmpty + ? '' + : widget.model.imgUrls![0].url ?? ''), height: 184.w, width: 184.w, imageErrorBuilder: (context, error, stackTrace) { - return Image.asset(R.ASSETS_PLACEHOLDER_WEBP,height: 184.w, - width: 184.w,); + return Image.asset( + R.ASSETS_PLACEHOLDER_WEBP, + height: 184.w, + width: 184.w, + ); }, ), AkuBox.w(24), @@ -122,7 +131,7 @@ class _BorrowManagerCardState extends State { List _buildCard() { final userProvider = Provider.of(context); - if (!userProvider.infoModel!.canOperation) + if (!(userProvider.userInfoModel!.type == 1)) return []; else if (widget.model.borrowStatus == 2) { return []; @@ -190,7 +199,8 @@ class _BorrowManagerCardState extends State { color: AppStyle.primaryColor, radius: 4.w, onPressed: () async { - await Get.to(BorrowManagerCheckPage(id: widget.model.id!)); + await Get.to( + BorrowManagerCheckPage(id: widget.model.id!)); }, child: Text( '检查信息', @@ -204,22 +214,26 @@ class _BorrowManagerCardState extends State { : SizedBox(), widget.model.borrowStatus == -1 ? AkuMaterialButton( - minWidth: 160.w, - height: 64.w, - color: AppStyle.primaryColor, - radius: 4.w, - onPressed: () async { - await Get.to(BorrowManagerExaminePage(id: widget.model.id!, model: widget.model, type: 1,)); - }, - child: Text( - '点击审核', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontWeight: FontWeight.bold, - fontSize: 28.w, - ), - ), - ) + minWidth: 160.w, + height: 64.w, + color: AppStyle.primaryColor, + radius: 4.w, + onPressed: () async { + await Get.to(BorrowManagerExaminePage( + id: widget.model.id!, + model: widget.model, + type: 1, + )); + }, + child: Text( + '点击审核', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.w, + ), + ), + ) : SizedBox(), ], ), diff --git a/lib/ui/sub_pages/borrow_manager/borrow_manager_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_manager_page.dart index e199459..bd1a208 100644 --- a/lib/ui/sub_pages/borrow_manager/borrow_manager_page.dart +++ b/lib/ui/sub_pages/borrow_manager/borrow_manager_page.dart @@ -1,17 +1,15 @@ // Flutter imports: -import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; - // Project imports: 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/ui/sub_pages/borrow_manager/all_borrow_goods.dart'; import 'package:aku_new_community_manager/ui/sub_pages/borrow_manager/borrow_manager_view.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_tab_bar.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; class BorrowManagerPage extends StatefulWidget { BorrowManagerPage({Key? key}) : super(key: key); @@ -22,14 +20,13 @@ class BorrowManagerPage extends StatefulWidget { class _BorrowManagerPageState extends State with TickerProviderStateMixin { - TabController? _tabController; List get _tabs { final userProvider = Provider.of(context, listen: false); return [ '全部', - ...userProvider.infoModel!.canOperation ? ['待审核'] : [], - ...userProvider.infoModel!.canOperation ? ['检查中'] : [], + ...userProvider.userInfoModel!.type == 1 ? ['待审核'] : [], + ...userProvider.userInfoModel!.type == 1 ? ['检查中'] : [], '出借中', '已归还' ]; @@ -77,14 +74,13 @@ class _BorrowManagerPageState extends State final userProvider = Provider.of(context); return [ BorrowManagerView(), - ...userProvider.infoModel!.canOperation - ? [BorrowManagerView(status: -1)] - : [], - ...userProvider.infoModel!.canOperation - ? [BorrowManagerView(status: 3)] - : [], + ...userProvider.userInfoModel!.type == 1 + ? [BorrowManagerView(status: -1)] + : [], + ...userProvider.userInfoModel!.type == 1 + ? [BorrowManagerView(status: 3)] + : [], BorrowManagerView(status: 1), - BorrowManagerView(status: 2), ]; } 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 dc1c62c..097bb85 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 @@ -66,8 +66,8 @@ class _BusinessAndFixDetailPageState extends State { UserProvider userProvider = Provider.of(context, listen: false); return Text( - AkuMap.fixStatus(userProvider.infoModel!.canOperation, - userProvider.infoModel!.canPickUpTicket, widget.model.status!), + AkuMap.fixStatus(userProvider.userInfoModel!.type == 1, + userProvider.userInfoModel!.type == 1, widget.model.status!), style: TextStyle( color: widget.model.status! < 4 ? Color(0XFFFF4501) @@ -117,7 +117,7 @@ class _BusinessAndFixDetailPageState extends State { final userProvider = Provider.of(context, listen: false); //派单权限 + 待派单状态=立即派单 - if (userProvider.infoModel!.canSendTicket && + if (userProvider.userInfoModel!.type == 1 && widget.model.status! < 2) { return AkuMaterialButton( color: AppStyle.primaryColor, @@ -138,7 +138,7 @@ class _BusinessAndFixDetailPageState extends State { ); //派单权限+已派单状态=改派 } else if (widget.model.status == 2) { - if (userProvider.infoModel!.canSendTicket) { + if (userProvider.userInfoModel!.type == 1) { return AkuMaterialButton( color: AppStyle.primaryColor, nullColor: AppStyle.minorColor, @@ -179,7 +179,7 @@ class _BusinessAndFixDetailPageState extends State { } //已接单状态+接单权限=申请延时 } else if ((widget.model.status == 3) && - userProvider.infoModel!.canPickUpTicket) + userProvider.userInfoModel!.type == 1) return Container( height: 96.w, alignment: Alignment.center, diff --git a/lib/ui/sub_pages/business_and_fix/business_and_fix_page.dart b/lib/ui/sub_pages/business_and_fix/business_and_fix_page.dart index 4645227..4a63c21 100644 --- a/lib/ui/sub_pages/business_and_fix/business_and_fix_page.dart +++ b/lib/ui/sub_pages/business_and_fix/business_and_fix_page.dart @@ -1,15 +1,13 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/tools/screen_tool.dart'; import 'package:aku_new_community_manager/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_tab_bar.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:provider/provider.dart'; class BusinessAndFixPage extends StatefulWidget { BusinessAndFixPage({Key? key}) : super(key: key); @@ -35,11 +33,9 @@ class _BusinessAndFixPageState extends State // return ['待接单', '处理中', '已处理', '全部']; // break; // } - if ((userProvider.infoModel!.canPickUpTicket) && - (!userProvider.infoModel!.canSendTicket)) { + if ((userProvider.userInfoModel!.type == 1)) { return ['待接单', '处理中', '已处理', '全部']; - } else if ((!userProvider.infoModel!.canPickUpTicket) && - (userProvider.infoModel!.canSendTicket)) { + } else if ((userProvider.userInfoModel!.type == 1)) { return ['待派单', '已派单', '处理中', '已处理', '全部']; } else { return ['未处理', '处理中', '已处理', '全部']; 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 4c3f5a5..3f3fb55 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 @@ -2,8 +2,8 @@ // 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/user/user_info_model.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; +import 'package:aku_new_community_manager/saas_models/user/user_info_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'; @@ -41,9 +41,9 @@ class BusinessFixCard extends StatefulWidget { } class _BusinessFixCardState extends State { - UserInformationModel? get userInfoModel { + UserInfoModel? get userInfoModel { final userProvider = Provider.of(context, listen: false); - return userProvider.infoModel; + return userProvider.userInfoModel; } String get dateStart => DateUtil.formatDateStr(widget.model.repairDate!, @@ -102,8 +102,8 @@ class _BusinessFixCardState extends State { Text( widget.hasFinished ? '已处理' - : AkuMap.fixStatus(userInfoModel!.canSendTicket, - userInfoModel!.canPickUpTicket, widget.model.status!), + : AkuMap.fixStatus(userInfoModel!.type == 1, + userInfoModel!.type == 1, widget.model.status!), style: widget.hasFinished ? TextStyle(color: AppStyle.minorTextColor) : TextStyle( @@ -196,7 +196,7 @@ class _BusinessFixCardState extends State { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.canSendTicket + (UserTool.userProvider.userInfoModel!.type == 1 ? '立即派单' : '查看详情'), style: TextStyle( @@ -222,9 +222,9 @@ class _BusinessFixCardState extends State { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.canSendTicket + (UserTool.userProvider.userInfoModel!.type == 1 ? '改派' - : UserTool.userProvider.infoModel!.canPickUpTicket + : UserTool.userProvider.userInfoModel!.type == 1 ? '立即接单' : '查看详情'), style: TextStyle( @@ -238,7 +238,7 @@ class _BusinessFixCardState extends State { ]; case 3: return [ - UserTool.userProvider.infoModel!.canPickUpTicket + UserTool.userProvider.userInfoModel!.type == 1 ? AkuMaterialButton( height: 64.w, onPressed: () async { @@ -275,7 +275,7 @@ class _BusinessFixCardState extends State { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.canPickUpTicket + (UserTool.userProvider.userInfoModel!.type == 1 ? '处理完成' : '查看详情'), style: TextStyle( diff --git a/lib/ui/sub_pages/decoration_manager/decoration_util.dart b/lib/ui/sub_pages/decoration_manager/decoration_util.dart index c884e56..cfcf08a 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_util.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_util.dart @@ -1,12 +1,10 @@ // Flutter imports: +// Project imports: +import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:flutter/material.dart'; - // Package imports: import 'package:provider/provider.dart'; -// Project imports: -import 'package:aku_new_community_manager/provider/user_provider.dart'; - class DecorationUIUtil { BuildContext context; UserProvider get userProvider => @@ -50,8 +48,7 @@ class DecorationUIUtil { } case 2: if (status < 5) { - if (userProvider.infoModel?.canOperation != null && - userProvider.infoModel!.canOperation) { + if (userProvider.userInfoModel!.type == 1) { return '已指派'; } else { return '待执行'; 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 0719faa..ce4d986 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 @@ -4,6 +4,7 @@ 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/goods_out/goods_out_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/extensions/list_extension_tool.dart'; import 'package:aku_new_community_manager/tools/widget_tool.dart'; @@ -12,7 +13,6 @@ 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/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'; @@ -277,7 +277,7 @@ class _ItemsOutdoorDetailsPageState extends State { final userProvider = Provider.of(context); switch (_model!.status) { case 1: - return userProvider.infoModel!.canPass + return userProvider.userInfoModel!.type == 1 ? Container( height: 98.w, decoration: BoxDecoration( diff --git a/lib/ui/widgets/app_widgets/aku_avatar.dart b/lib/ui/widgets/app_widgets/aku_avatar.dart index e7995ae..c8e090b 100644 --- a/lib/ui/widgets/app_widgets/aku_avatar.dart +++ b/lib/ui/widgets/app_widgets/aku_avatar.dart @@ -1,18 +1,17 @@ // Flutter imports: -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_screenutil/flutter_screenutil.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'; +import 'package:aku_new_community_manager/models/common/img_model.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:provider/provider.dart'; class AkuAvatar extends StatelessWidget { final double? size; - AkuAvatar({Key? key, this.size}) : super(key: key); + AkuAvatar({Key? key, this.size}) : super(key: key); @override Widget build(BuildContext context) { @@ -24,7 +23,8 @@ class AkuAvatar extends StatelessWidget { clipBehavior: Clip.antiAlias, child: FadeInImage.assetNetwork( placeholder: R.ASSETS_PLACEHOLDER_WEBP, - image: API.image(userProvider.profileModel!.firstImg?.url ?? ''), + image: API.image( + ImgModel.first(userProvider.userInfoModel!.imgList) ?? ''), height: size ?? 72.w, width: size ?? 72.w, fit: BoxFit.cover,