feat: 调整图标、调整获取团队详情

This commit is contained in:
liyi 2025-10-10 09:40:14 +08:00
parent 9e10952bef
commit bb1d3eb819
12 changed files with 141 additions and 21 deletions

BIN
assets/icon/icon_face.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
assets/icon/icon_role.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -9,6 +9,7 @@ class ApiPath {
static const String changeTeam = "/v1/team/changeTeam"; static const String changeTeam = "/v1/team/changeTeam";
static const String bindTeamStarCloudAccount = "/v1/team/bindStarCloudAccount"; static const String bindTeamStarCloudAccount = "/v1/team/bindStarCloudAccount";
static const String updateTeamInfo = "/v1/team/updateTeam"; static const String updateTeamInfo = "/v1/team/updateTeam";
static const String teamDetail = "/v1/team/detail";
static const String getInviteInfo = "/v1/team/getInviteInfo"; static const String getInviteInfo = "/v1/team/getInviteInfo";
static const String getTeamInviteConfig = "/v1/team/teamApplyConfig"; static const String getTeamInviteConfig = "/v1/team/teamApplyConfig";
static const String updateTeamInviteConfig = "/v1/team/teamPersonConfigUpdate"; static const String updateTeamInviteConfig = "/v1/team/teamPersonConfigUpdate";

View File

@ -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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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}';
}
}

View File

@ -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/invite_info_response.dart';
import 'package:starwork_flutter/api/model/team/response/role_list_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/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/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/request/validation_code_login.dart';
import 'package:starwork_flutter/api/model/user/response/token_response.dart'; import 'package:starwork_flutter/api/model/user/response/token_response.dart';
@ -95,6 +96,16 @@ class TeamApiService {
); );
} }
//
Future<ApiResponse<TeamDetailsResponse>> requestTeamDetails() {
return _api.makeRequest(
path: ApiPath.teamDetail,
method: HttpConstant.post,
fromJson: (data) => TeamDetailsResponse.fromJson(data),
);
}
/// ///
Future<ApiResponse<InviteInfoResponse>> requestInviteInfo({ Future<ApiResponse<InviteInfoResponse>> requestInviteInfo({
required InviteInfoRequest request, required InviteInfoRequest request,

View File

@ -57,6 +57,9 @@ class AppImages{
static const String defaultAvatar = 'assets/images/default_avatar.png'; static const String defaultAvatar = 'assets/images/default_avatar.png';
static const String iconLockGroupItem = 'assets/icon/icon_lockGroup_item.png'; static const String iconLockGroupItem = 'assets/icon/icon_lockGroup_item.png';
static const String iconLockTypeDoorLock = 'assets/icon/lockType_doorLock.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 iconHome = 'assets/icon/bar/home.png';
static const String iconHomeSelected = 'assets/icon/bar/home_selected.png'; static const String iconHomeSelected = 'assets/icon/bar/home_selected.png';

View File

@ -9,5 +9,4 @@ class CacheKeys {
static const String starCloudUid = 'starCloudUid'; static const String starCloudUid = 'starCloudUid';
static const String starCloudUserLoginInfo = 'starCloudUserLoginInfo'; static const String starCloudUserLoginInfo = 'starCloudUserLoginInfo';
static const String userAccountInfo = 'userAccountInfo'; static const String userAccountInfo = 'userAccountInfo';
} }

View File

@ -243,7 +243,7 @@ class HomeView extends GetView<HomeController> {
), ),
HomeTeamNoticeRowWidget(), HomeTeamNoticeRowWidget(),
HomeStatisticsRowWidget( HomeStatisticsRowWidget(
personCount: 0, personCount: controller.mainController.selectedTeamDetails.value.personCount ?? 0,
deviceCount: controller.mainController.deviceCountSize.value, deviceCount: controller.mainController.deviceCountSize.value,
), ),
SizedBox(height: 10.h), SizedBox(height: 10.h),

View File

@ -11,6 +11,7 @@ import 'package:starcloud/sdk/sdk_device_operate_extension.dart';
import 'package:starcloud/sdk/starcloud.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/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/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/team/response/team_info_response.dart';
import 'package:starwork_flutter/api/model/user/response/user_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'; import 'package:starwork_flutter/api/service/team_api_service.dart';
@ -50,6 +51,9 @@ class MainController extends BaseController {
// //
var selectedTeam = TeamInfoResponse().obs; var selectedTeam = TeamInfoResponse().obs;
//
var selectedTeamDetails = TeamDetailsResponse().obs;
// //
final deviceCountSize = 0.obs; final deviceCountSize = 0.obs;
@ -106,12 +110,14 @@ class MainController extends BaseController {
// //
Widget _buildTabIcon(String unselectedIcon, String selectedIcon, int index) { Widget _buildTabIcon(String unselectedIcon, String selectedIcon, int index) {
return Obx(() => Image.asset( return Obx(
currentIndex.value == index ? selectedIcon : unselectedIcon, () => Image.asset(
width: 24.w, currentIndex.value == index ? selectedIcon : unselectedIcon,
height: 24.w, width: 24.w,
fit: BoxFit.contain, height: 24.w,
)); fit: BoxFit.contain,
),
);
} }
// //
@ -155,6 +161,7 @@ class MainController extends BaseController {
return; return;
} }
selectedTeam.value = myTeamList.first; selectedTeam.value = myTeamList.first;
await requestTeamDetail();
// //
if (selectedTeam.value.teamCloudInfo != null) { if (selectedTeam.value.teamCloudInfo != null) {
@ -221,6 +228,9 @@ class MainController extends BaseController {
onError: (err) {}, onError: (err) {},
); );
} }
//
await requestTeamDetail();
} }
} }
@ -245,8 +255,6 @@ class MainController extends BaseController {
void requestUserAccountInfo() async { void requestUserAccountInfo() async {
var userInfo = await userApi.requestUserInfo(); var userInfo = await userApi.requestUserInfo();
if (userInfo.isSuccess) { if (userInfo.isSuccess) {
//
// 1: JSON
await SharedPreferencesUtils.setString(CacheKeys.userAccountInfo, jsonEncode(userInfo.data!.toJson())); await SharedPreferencesUtils.setString(CacheKeys.userAccountInfo, jsonEncode(userInfo.data!.toJson()));
// //
// String? cachedJson = await SharedPreferencesUtils.getString(CacheKeys.userAccountInfo); // 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!;
}
}
} }

View File

@ -39,7 +39,6 @@ class MainView extends GetView<MainController> {
selectedTeam: controller.selectedTeam.value, selectedTeam: controller.selectedTeam.value,
onTeamSelected: (team) { onTeamSelected: (team) {
controller.requestChangeCurrentTeam(team); controller.requestChangeCurrentTeam(team);
}, },
onRefreshList: () { onRefreshList: () {
controller.requestAllTeamInfoList(); controller.requestAllTeamInfoList();

View File

@ -50,8 +50,10 @@ class PersonnelManageView extends GetView<PersonnelManageController> {
children: [ children: [
Column( Column(
children: [ children: [
Icon( Image.asset(
Icons.person, AppImages.iconFace,
width: 24.w,
fit: BoxFit.cover,
), ),
SizedBox( SizedBox(
height: 4.h, height: 4.h,
@ -59,7 +61,7 @@ class PersonnelManageView extends GetView<PersonnelManageController> {
Text( Text(
'人脸信息'.tr, '人脸信息'.tr,
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 12.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
@ -71,8 +73,10 @@ class PersonnelManageView extends GetView<PersonnelManageController> {
}, },
child: Column( child: Column(
children: [ children: [
Icon( Image.asset(
Icons.person, AppImages.iconRole,
width: 24.w,
fit: BoxFit.cover,
), ),
SizedBox( SizedBox(
height: 4.h, height: 4.h,
@ -80,7 +84,7 @@ class PersonnelManageView extends GetView<PersonnelManageController> {
Text( Text(
'角色管理'.tr, '角色管理'.tr,
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 12.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
@ -89,8 +93,10 @@ class PersonnelManageView extends GetView<PersonnelManageController> {
), ),
Column( Column(
children: [ children: [
Icon( Image.asset(
Icons.person, AppImages.iconNewPerson,
width: 24.w,
fit: BoxFit.cover,
), ),
SizedBox( SizedBox(
height: 4.h, height: 4.h,
@ -208,7 +214,7 @@ class PersonnelManageView extends GetView<PersonnelManageController> {
width: 34.w, width: 34.w,
height: 34.w, height: 34.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[300], color: const Color(0xFFEBF3FE),
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
), ),
child: ClipRRect( child: ClipRRect(
@ -216,7 +222,7 @@ class PersonnelManageView extends GetView<PersonnelManageController> {
child: Icon( child: Icon(
Icons.folder, Icons.folder,
size: 22.w, size: 22.w,
color: Colors.blue, color: const Color(0xFF5B9CF8),
), ),
), ),
) )