diff --git a/assets/icon/icon_face.jpg b/assets/icon/icon_face.jpg new file mode 100644 index 0000000..db72297 Binary files /dev/null and b/assets/icon/icon_face.jpg differ diff --git a/assets/icon/icon_new_person.jpg b/assets/icon/icon_new_person.jpg new file mode 100644 index 0000000..a3625b1 Binary files /dev/null and b/assets/icon/icon_new_person.jpg differ diff --git a/assets/icon/icon_role.jpg b/assets/icon/icon_role.jpg new file mode 100644 index 0000000..0a46d88 Binary files /dev/null and b/assets/icon/icon_role.jpg differ diff --git a/lib/api/api_path.dart b/lib/api/api_path.dart index d05c4ef..5b3f4e4 100644 --- a/lib/api/api_path.dart +++ b/lib/api/api_path.dart @@ -9,6 +9,7 @@ class ApiPath { static const String changeTeam = "/v1/team/changeTeam"; static const String bindTeamStarCloudAccount = "/v1/team/bindStarCloudAccount"; static const String updateTeamInfo = "/v1/team/updateTeam"; + static const String teamDetail = "/v1/team/detail"; static const String getInviteInfo = "/v1/team/getInviteInfo"; static const String getTeamInviteConfig = "/v1/team/teamApplyConfig"; static const String updateTeamInviteConfig = "/v1/team/teamPersonConfigUpdate"; diff --git a/lib/api/model/team/response/team_details_response.dart b/lib/api/model/team/response/team_details_response.dart new file mode 100644 index 0000000..49ae593 --- /dev/null +++ b/lib/api/model/team/response/team_details_response.dart @@ -0,0 +1,86 @@ +class TeamDetailsResponse { + String? teamNo; + String? teamName; + int? scene; + String? sceneCustomName; + String? teamCode; + bool? isOwner; + String? owner; + bool? isVip; + String? personName; + String? personNo; + String? personPhone; + int? personCount; + int? isPersonal; + int? isUpgrade; + int? isBindEzviz; + int? state; + int? authStatus; + + TeamDetailsResponse({ + this.teamNo, + this.teamName, + this.scene, + this.sceneCustomName, + this.teamCode, + this.isOwner, + this.owner, + this.isVip, + this.personName, + this.personNo, + this.personPhone, + this.personCount, + this.isPersonal, + this.isUpgrade, + this.isBindEzviz, + this.state, + this.authStatus, + }); + + TeamDetailsResponse.fromJson(Map json) { + teamNo = json['teamNo'] as String?; + teamName = json['teamName'] as String?; + scene = json['scene'] as int?; + sceneCustomName = json['sceneCustomName'] as String?; + teamCode = json['teamCode'] as String?; + isOwner = json['isOwner'] as bool?; + owner = json['owner'] as String?; + isVip = json['isVip'] as bool?; + personName = json['personName'] as String?; + personNo = json['personNo'] as String?; + personPhone = json['personPhone'] as String?; + personCount = json['personCount'] as int?; + isPersonal = json['isPersonal'] as int?; + isUpgrade = json['isUpgrade'] as int?; + isBindEzviz = json['isBindEzviz'] as int?; + state = json['state'] as int?; + authStatus = json['authStatus'] as int?; + } + + Map toJson() { + final Map data = {}; + data['teamNo'] = teamNo; + data['teamName'] = teamName; + data['scene'] = scene; + data['sceneCustomName'] = sceneCustomName; + data['teamCode'] = teamCode; + data['isOwner'] = isOwner; + data['owner'] = owner; + data['isVip'] = isVip; + data['personName'] = personName; + data['personNo'] = personNo; + data['personPhone'] = personPhone; + data['personCount'] = personCount; + data['isPersonal'] = isPersonal; + data['isUpgrade'] = isUpgrade; + data['isBindEzviz'] = isBindEzviz; + data['state'] = state; + data['authStatus'] = authStatus; + return data; + } + + @override + String toString() { + return 'TeamDetailsResponse{teamNo: $teamNo, teamName: $teamName, scene: $scene, sceneCustomName: $sceneCustomName, teamCode: $teamCode, isOwner: $isOwner, owner: $owner, isVip: $isVip, personName: $personName, personNo: $personNo, personPhone: $personPhone, personCount: $personCount, isPersonal: $isPersonal, isUpgrade: $isUpgrade, isBindEzviz: $isBindEzviz, state: $state, authStatus: $authStatus}'; + } +} diff --git a/lib/api/service/team_api_service.dart b/lib/api/service/team_api_service.dart index a3aa50b..424c673 100644 --- a/lib/api/service/team_api_service.dart +++ b/lib/api/service/team_api_service.dart @@ -19,6 +19,7 @@ import 'package:starwork_flutter/api/model/team/response/depart_list_reponse.dar import 'package:starwork_flutter/api/model/team/response/invite_info_response.dart'; import 'package:starwork_flutter/api/model/team/response/role_list_response.dart'; import 'package:starwork_flutter/api/model/team/response/scene_info_response.dart'; +import 'package:starwork_flutter/api/model/team/response/team_details_response.dart'; import 'package:starwork_flutter/api/model/team/response/team_invite_parameter_config_response.dart'; import 'package:starwork_flutter/api/model/user/request/validation_code_login.dart'; import 'package:starwork_flutter/api/model/user/response/token_response.dart'; @@ -95,6 +96,16 @@ class TeamApiService { ); } + // 查询团队详情 + Future> requestTeamDetails() { + return _api.makeRequest( + path: ApiPath.teamDetail, + method: HttpConstant.post, + fromJson: (data) => TeamDetailsResponse.fromJson(data), + ); + } + + /// 获取邀请信息 Future> requestInviteInfo({ required InviteInfoRequest request, diff --git a/lib/common/constant/app_images.dart b/lib/common/constant/app_images.dart index 930a7d5..55488d9 100644 --- a/lib/common/constant/app_images.dart +++ b/lib/common/constant/app_images.dart @@ -57,6 +57,9 @@ class AppImages{ static const String defaultAvatar = 'assets/images/default_avatar.png'; static const String iconLockGroupItem = 'assets/icon/icon_lockGroup_item.png'; static const String iconLockTypeDoorLock = 'assets/icon/lockType_doorLock.png'; + static const String iconFace = 'assets/icon/icon_face.jpg'; + static const String iconRole = 'assets/icon/icon_role.jpg'; + static const String iconNewPerson = 'assets/icon/icon_new_person.jpg'; // 底部导航栏图标 static const String iconHome = 'assets/icon/bar/home.png'; static const String iconHomeSelected = 'assets/icon/bar/home_selected.png'; diff --git a/lib/common/constant/cache_keys.dart b/lib/common/constant/cache_keys.dart index fee15fb..5302e38 100644 --- a/lib/common/constant/cache_keys.dart +++ b/lib/common/constant/cache_keys.dart @@ -9,5 +9,4 @@ class CacheKeys { static const String starCloudUid = 'starCloudUid'; static const String starCloudUserLoginInfo = 'starCloudUserLoginInfo'; static const String userAccountInfo = 'userAccountInfo'; - } diff --git a/lib/views/home/home_view.dart b/lib/views/home/home_view.dart index 7edcdde..851c765 100644 --- a/lib/views/home/home_view.dart +++ b/lib/views/home/home_view.dart @@ -243,7 +243,7 @@ class HomeView extends GetView { ), HomeTeamNoticeRowWidget(), HomeStatisticsRowWidget( - personCount: 0, + personCount: controller.mainController.selectedTeamDetails.value.personCount ?? 0, deviceCount: controller.mainController.deviceCountSize.value, ), SizedBox(height: 10.h), diff --git a/lib/views/main/main_controller.dart b/lib/views/main/main_controller.dart index d177871..f47384f 100644 --- a/lib/views/main/main_controller.dart +++ b/lib/views/main/main_controller.dart @@ -11,6 +11,7 @@ import 'package:starcloud/sdk/sdk_device_operate_extension.dart'; import 'package:starcloud/sdk/starcloud.dart'; import 'package:starwork_flutter/api/model/team/request/bind_team_star_cloud_account_request.dart'; import 'package:starwork_flutter/api/model/team/request/change_current_team_request.dart'; +import 'package:starwork_flutter/api/model/team/response/team_details_response.dart'; import 'package:starwork_flutter/api/model/team/response/team_info_response.dart'; import 'package:starwork_flutter/api/model/user/response/user_info_response.dart'; import 'package:starwork_flutter/api/service/team_api_service.dart'; @@ -50,6 +51,9 @@ class MainController extends BaseController { // 选中的团队 var selectedTeam = TeamInfoResponse().obs; + // 选中团队的详情 + var selectedTeamDetails = TeamDetailsResponse().obs; + // 设备数量 final deviceCountSize = 0.obs; @@ -106,12 +110,14 @@ class MainController extends BaseController { // 构建自定义图标组件 Widget _buildTabIcon(String unselectedIcon, String selectedIcon, int index) { - return Obx(() => Image.asset( - currentIndex.value == index ? selectedIcon : unselectedIcon, - width: 24.w, - height: 24.w, - fit: BoxFit.contain, - )); + return Obx( + () => Image.asset( + currentIndex.value == index ? selectedIcon : unselectedIcon, + width: 24.w, + height: 24.w, + fit: BoxFit.contain, + ), + ); } // 打开抽屉的方法 @@ -155,6 +161,7 @@ class MainController extends BaseController { return; } selectedTeam.value = myTeamList.first; + await requestTeamDetail(); // 设置星云账户 if (selectedTeam.value.teamCloudInfo != null) { @@ -221,6 +228,9 @@ class MainController extends BaseController { onError: (err) {}, ); } + + // 请求切换团队后的详情数据 + await requestTeamDetail(); } } @@ -245,8 +255,6 @@ class MainController extends BaseController { void requestUserAccountInfo() async { var userInfo = await userApi.requestUserInfo(); if (userInfo.isSuccess) { - // 保存到缓存 - // 方式1: 直接存储 JSON 字符串(推荐) await SharedPreferencesUtils.setString(CacheKeys.userAccountInfo, jsonEncode(userInfo.data!.toJson())); // 从缓存中读取 // String? cachedJson = await SharedPreferencesUtils.getString(CacheKeys.userAccountInfo); @@ -260,4 +268,11 @@ class MainController extends BaseController { // } } } + + requestTeamDetail() async { + var response = await teamApi.requestTeamDetails(); + if (response.isSuccess) { + selectedTeamDetails.value = response.data!; + } + } } diff --git a/lib/views/main/main_view.dart b/lib/views/main/main_view.dart index bf633ef..b401e7a 100644 --- a/lib/views/main/main_view.dart +++ b/lib/views/main/main_view.dart @@ -39,7 +39,6 @@ class MainView extends GetView { selectedTeam: controller.selectedTeam.value, onTeamSelected: (team) { controller.requestChangeCurrentTeam(team); - }, onRefreshList: () { controller.requestAllTeamInfoList(); diff --git a/lib/views/team/personnelManage/personnel_manage_view.dart b/lib/views/team/personnelManage/personnel_manage_view.dart index 0df1552..6bc6167 100644 --- a/lib/views/team/personnelManage/personnel_manage_view.dart +++ b/lib/views/team/personnelManage/personnel_manage_view.dart @@ -50,8 +50,10 @@ class PersonnelManageView extends GetView { children: [ Column( children: [ - Icon( - Icons.person, + Image.asset( + AppImages.iconFace, + width: 24.w, + fit: BoxFit.cover, ), SizedBox( height: 4.h, @@ -59,7 +61,7 @@ class PersonnelManageView extends GetView { Text( '人脸信息'.tr, style: TextStyle( - fontSize: 10.sp, + fontSize: 12.sp, fontWeight: FontWeight.w500, ), ), @@ -71,8 +73,10 @@ class PersonnelManageView extends GetView { }, child: Column( children: [ - Icon( - Icons.person, + Image.asset( + AppImages.iconRole, + width: 24.w, + fit: BoxFit.cover, ), SizedBox( height: 4.h, @@ -80,7 +84,7 @@ class PersonnelManageView extends GetView { Text( '角色管理'.tr, style: TextStyle( - fontSize: 10.sp, + fontSize: 12.sp, fontWeight: FontWeight.w500, ), ), @@ -89,8 +93,10 @@ class PersonnelManageView extends GetView { ), Column( children: [ - Icon( - Icons.person, + Image.asset( + AppImages.iconNewPerson, + width: 24.w, + fit: BoxFit.cover, ), SizedBox( height: 4.h, @@ -208,7 +214,7 @@ class PersonnelManageView extends GetView { width: 34.w, height: 34.w, decoration: BoxDecoration( - color: Colors.grey[300], + color: const Color(0xFFEBF3FE), borderRadius: BorderRadius.circular(8.r), ), child: ClipRRect( @@ -216,7 +222,7 @@ class PersonnelManageView extends GetView { child: Icon( Icons.folder, size: 22.w, - color: Colors.blue, + color: const Color(0xFF5B9CF8), ), ), )