1,新增授权管理员列表接口调试

2,新增锁用户管理列表接口调试
3,新增删除授权管理员接口调试
4,新增即将到期的锁列表页面及接口调试
This commit is contained in:
Daisy 2023-09-15 09:43:20 +08:00
parent 4045a13d8d
commit a1417f5be8
14 changed files with 803 additions and 69 deletions

View File

@ -8,8 +8,10 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList_page.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList_Page.dart';
import 'package:star_lock/mine/mineSet/mineSet_page.dart';
import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_page.dart';
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation_page.dart';
@ -296,6 +298,8 @@ abstract class Routers {
static const massSendLockGroupPage = '/massSendLockGroupPage'; //
static const massSendReceiverPage = '/massSendReceiverPage'; //
static const lockUserListPage = '/lockUserListPage'; //
static const administratorDetailsPage = '/administratorDetailsPage'; //
static const expireLockListPage = '/expireLockListPage'; //
}
abstract class AppRouters {
@ -697,7 +701,7 @@ abstract class AppRouters {
page: () => const AuthorizedAdministratorListPage()),
GetPage(
name: Routers.lockUserManageLisPage,
page: () => const LockUserManageListListPage()),
page: () => const LockUserManageListPage()),
GetPage(
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()),
GetPage(
@ -754,6 +758,12 @@ abstract class AppRouters {
name: Routers.lockUserListPage, page: () => const LockUserListPage()),
GetPage(
name: Routers.checkInCreatCompanyPage,
page: () => const CheckInCreatCompanyPage())
page: () => const CheckInCreatCompanyPage()),
GetPage(
name: Routers.administratorDetailsPage,
page: () => const AdministratorDetailsPage()),
GetPage(
name: Routers.expireLockListPage,
page: () => const ExpireLockListPage())
];
}

View File

@ -5,6 +5,7 @@ import 'package:flutter_pickers/pickers.dart';
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
@ -41,6 +42,8 @@ class _VolumeAuthorizationLockPageState
var _selectFailureDate = ''; //
late DateTime _effectiveDateTime;
late DateTime _failureDateTime;
String countryName = '中国';
String countryCode = '86';
@override
Widget build(BuildContext context) {
@ -116,6 +119,27 @@ class _VolumeAuthorizationLockPageState
true,
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
_emailOrPhoneController)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'$countryName +$countryCode',
textAlign: TextAlign.end,
style:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
var result = await Navigator.pushNamed(
context, Routers.seletCountryRegionPage);
result as Map<String, dynamic>;
countryCode = result['code'];
countryName = result['countryName'];
setState(() {});
},
),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: "",
@ -290,7 +314,7 @@ class _VolumeAuthorizationLockPageState
_keyNameController.text,
getEffectiveDateTime,
_emailOrPhoneController.text,
'86',
countryCode,
'1',
);
if (entity.errorCode!.codeIsSuccessful) {

View File

@ -100,7 +100,7 @@ class MassSendReceiverCell extends StatelessWidget {
bool isHaveBtn, String tfStr, int lineIndex, LockUserData userData) {
return SizedBox(
height: 50.h,
width: 320.w,
width: 380.w,
child: Row(
children: [
Expanded(
@ -114,7 +114,7 @@ class MassSendReceiverCell extends StatelessWidget {
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//线

View File

@ -39,7 +39,7 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
appBar: AppBar(
backgroundColor: AppColors.mainColor,
title: Text(
'接收者',
TranslationLoader.lanKeys!.receiver!.tr,
style: TextStyle(
color: Colors.white,
fontSize: 28.sp,

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart';
@ -30,7 +32,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
body: Column(
children: [
CommonItem(
leftTitel: "接收者",
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
rightTitle: "786612630@qq.com",
isHaveLine: true,
),

View File

@ -0,0 +1,272 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/jh_pop_menus.dart';
import 'package:star_lock/tools/toast.dart';
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
import '../../../../../tools/showTFView.dart';
import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
class AdministratorDetailsPage extends StatefulWidget {
const AdministratorDetailsPage({Key? key}) : super(key: key);
@override
State<AdministratorDetailsPage> createState() =>
_AdministratorDetailsPageState();
}
class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
final TextEditingController _changeNameController = TextEditingController();
AuthorizedAdminListItem itemData = AuthorizedAdminListItem();
@override
Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["itemData"] != null)) {
itemData = obj["itemData"];
}
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '管理员详情',
haveBack: true,
actionsList: [
IconButton(
icon: Image.asset(
'images/icon_bar_more.png',
height: 30.h,
width: 10.w,
),
onPressed: () {
JhPopMenus.showLinePop(context,
clickCallback: (index, selText) {
print('选中index: $index');
print('选中text: $selText');
}, listData: [
{'text': '冻结'},
{'text': '取消授权'}
]);
},
),
],
backgroundColor: AppColors.mainColor),
body: Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: _changeNameController.text.isNotEmpty
? _changeNameController.text
: itemData.name,
isHaveDirection: true,
isHaveLine: true,
action: () {
showCupertinoAlertDialog(context);
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
allHeight: 90.h,
rightTitle: getUseDateStr(itemData),
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.electronicKeyDetailChangeDate,
arguments: {"itemData": itemData});
}),
Container(height: 10.h),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
rightTitle: itemData.lockNum.toString(),
isHaveDirection: true,
action: () {
//
}),
Container(height: 10.h),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: "",
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w,
child: _switch(itemData.isRemoteUnlock == 1 ? true : false)),
action: () {}),
Container(height: 40.h),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.delete!.tr,
borderRadius: 20.w,
isDelete: true,
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
deleteAdministratorRequest();
}),
],
),
);
}
//使
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == 1) {
//
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == 2) {
//
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
} else if (indexEntity.keyType == 3) {
//
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
} else if (indexEntity.keyType == 4) {
//
useDateStr = '循环';
}
return useDateStr;
}
Widget commonItem(String leftTitle, String rightTitle,
{bool isHaveDirection = false,
bool isHaveLine = false,
bool isHaveRightWidget = false,
Widget? rightWidget,
Function()? action}) {
return GestureDetector(
onTap: action,
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// height: 80.h,
color: Colors.white,
padding: EdgeInsets.only(
left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
child: Row(
children: [
SizedBox(width: 20.w),
Text(
leftTitle,
style:
TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500),
),
SizedBox(width: 20.w),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
isHaveRightWidget
? rightWidget!
: Text(
rightTitle,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 28.sp, fontWeight: FontWeight.w500),
)
],
),
),
SizedBox(width: 5.w),
isHaveDirection
? Image.asset(
'images/icon_right.png',
width: 50.w,
height: 50.w,
)
: SizedBox(width: 10.w),
// SizedBox(width:10.w),
],
),
),
isHaveLine
? Container(
height: 0.5.h,
color: Colors.grey,
)
: Container()
],
),
);
}
CupertinoSwitch _switch(isOn) {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: isOn,
onChanged: (value) {
setState(() {
isOn = value;
});
},
);
}
//
Future<void> updateAdministratorRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
itemData.uid.toString(), _changeNameController.text, '', '', '');
if (entity.errorCode!.codeIsSuccessful) {
print("修改管理员信息成功啦啦啦啦啦");
Toast.show(msg: "修改成功");
setState(() {
Navigator.pop(context);
});
}
}
//
Future<void> deleteAdministratorRequest() async {
ElectronicKeyListEntity entity =
await ApiRepository.to.deleteAdministrator(itemData.uid.toString(), '');
if (entity.errorCode!.codeIsSuccessful) {
print("删除电子钥匙成功");
Toast.show(msg: "删除成功");
setState(() {
Navigator.pop(context);
});
}
}
void showCupertinoAlertDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowTFView(
title:
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
tipTitle: "请输入",
controller: _changeNameController,
sureClick: () {
//
if (_changeNameController.text.isNotEmpty) {
updateAdministratorRequest();
}
},
cancelClick: () {
Navigator.pop(context);
},
);
},
);
}
}

View File

@ -0,0 +1,122 @@
class AuthorizedAdminListEntity {
int? errorCode;
String? description;
String? errorMsg;
AuthorizedAdminListData? data;
AuthorizedAdminListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
AuthorizedAdminListEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null
? AuthorizedAdminListData.fromJson(json['data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class AuthorizedAdminListData {
List<AuthorizedAdminListItem>? itemList;
int? pageNo;
int? pageSize;
int? pages;
int? total;
AuthorizedAdminListData(
{this.itemList, this.pageNo, this.pageSize, this.pages, this.total});
AuthorizedAdminListData.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
itemList = <AuthorizedAdminListItem>[];
json['list'].forEach((v) {
itemList!.add(AuthorizedAdminListItem.fromJson(v));
});
}
pageNo = json['pageNo'];
pageSize = json['pageSize'];
pages = json['pages'];
total = json['total'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (itemList != null) {
data['list'] = itemList!.map((v) => v.toJson()).toList();
}
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
data['pages'] = pages;
data['total'] = total;
return data;
}
}
class AuthorizedAdminListItem {
int? uid;
int? keyStatus;
int? lockNum;
int? endDate;
int? startDate;
String? name;
String? headUrl;
String? userid;
int? keyType;
int? date;
int? isRemoteUnlock;
AuthorizedAdminListItem(
{this.uid,
this.keyStatus,
this.lockNum,
this.endDate,
this.startDate,
this.name,
this.headUrl,
this.userid,
this.keyType,
this.date,
this.isRemoteUnlock});
AuthorizedAdminListItem.fromJson(Map<String, dynamic> json) {
uid = json['uid'];
keyStatus = json['keyStatus'];
lockNum = json['lockNum'];
endDate = json['endDate'];
startDate = json['startDate'];
name = json['name'];
headUrl = json['headUrl'];
userid = json['userid'];
keyType = json['keyType'];
date = json['date'];
isRemoteUnlock = json['isRemoteUnlock'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['uid'] = uid;
data['keyStatus'] = keyStatus;
data['lockNum'] = lockNum;
data['endDate'] = endDate;
data['startDate'] = startDate;
data['name'] = name;
data['headUrl'] = headUrl;
data['userid'] = userid;
data['keyType'] = keyType;
data['date'] = date;
data['isRemoteUnlock'] = isRemoteUnlock;
return data;
}
}

View File

@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -17,6 +20,13 @@ class AuthorizedAdministratorListPage extends StatefulWidget {
class _AuthorizedAdministratorListPageState
extends State<AuthorizedAdministratorListPage> {
@override
void initState() {
super.initState();
mockNetworkDataRequest();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -40,15 +50,49 @@ class _AuthorizedAdministratorListPageState
),
],
),
body: Column(
children: [
_searchWidget(),
Expanded(child: _buildMainUI()),
],
),
body: FutureBuilder<List<AuthorizedAdminListItem>>(
future: mockNetworkDataRequest(),
builder: (BuildContext context,
AsyncSnapshot<List<AuthorizedAdminListItem>> snapshot) {
//
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
//
return const Text('请求失败');
} else {
//
final List<AuthorizedAdminListItem> itemList = snapshot.data!;
return Column(
children: [
_searchWidget(),
Expanded(child: _buildMainUI(itemList)),
],
);
}
} else {
// loading
return Container();
}
}),
);
}
//
Future<List<AuthorizedAdminListItem>> mockNetworkDataRequest() async {
AuthorizedAdminListEntity entity =
await ApiRepository.to.authorizedAdminList('1', '20');
if (entity.errorCode!.codeIsSuccessful) {
print("授权管理员列表成功:${entity.data?.itemList}");
}
if (entity.data != null) {
return entity.data!.itemList!;
} else {
List<AuthorizedAdminListItem> dataList = [];
return dataList;
}
}
Widget _searchWidget() {
return Container(
height: 60.h,
@ -84,22 +128,21 @@ class _AuthorizedAdministratorListPageState
);
}
Widget _buildMainUI() {
Widget _buildMainUI(List itemList) {
return ListView.builder(
itemCount: 5,
itemCount: itemList.length,
itemBuilder: (c, index) {
return _electronicKeyItem('images/controls_user.png', "张三",
"2023.6.21 11.15", "2023.6.21 11.15", () {
// Navigator.pushNamed(context, Routers.authorizedAdminDetailPage);
Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
});
AuthorizedAdminListItem itemData = itemList[index];
return _electronicKeyItem(itemData);
});
}
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle,
String beginTime, String endTime, Function() action) {
Widget _electronicKeyItem(AuthorizedAdminListItem itemData) {
return GestureDetector(
onTap: action,
onTap: () {
Navigator.pushNamed(context, Routers.administratorDetailsPage,
arguments: {'itemData': itemData});
},
child: Container(
height: 100.h,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
@ -113,7 +156,7 @@ class _AuthorizedAdministratorListPageState
width: 30.w,
),
Image.asset(
lockTypeIcon,
'images/controls_user.png',
width: 60.w,
height: 60.w,
),
@ -128,7 +171,7 @@ class _AuthorizedAdministratorListPageState
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
lockTypeTitle,
itemData.name ?? '',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
@ -156,4 +199,33 @@ class _AuthorizedAdministratorListPageState
),
);
}
//使
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == 1) {
//
if (indexEntity.startDate != null && indexEntity.endDate != null) {
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else {
useDateStr = '限期';
}
} else if (indexEntity.keyType == 2) {
//
useDateStr = '永久';
} else if (indexEntity.keyType == 3) {
//
useDateStr = '单次';
} else if (indexEntity.keyType == 4) {
//
useDateStr = '循环';
}
return useDateStr;
}
}

View File

@ -0,0 +1,144 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
class ExpireLockListPage extends StatefulWidget {
const ExpireLockListPage({Key? key}) : super(key: key);
@override
State<ExpireLockListPage> createState() => _ExpireLockListPageState();
}
class _ExpireLockListPageState extends State<ExpireLockListPage> {
List<LockUserData> dataList = [];
@override
void initState() {
super.initState();
expireLockListRequest();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '即将到期',
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
TextButton(
child: Text(
TranslationLoader.lanKeys!.aboutToExpire!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {},
),
],
),
body: _buildMainUI(),
);
}
Widget _buildMainUI() {
return ListView.separated(
itemCount: dataList.length,
itemBuilder: (c, index) {
LockUserData indexEntity = dataList[index];
return _electronicKeyItem(indexEntity);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
);
}
//
Future<List<LockUserData>> expireLockListRequest() async {
ElectronicKeyListEntity entity =
await ApiRepository.to.expireLockList('0', '1', '20');
// if (entity.errorCode!.codeIsSuccessful) {
// setState(() {
// dataList = entity.data! as List<LockUserData>;
// // dataList = entity.data!;
// });
// }
return dataList;
}
Widget _electronicKeyItem(LockUserData itemData) {
return GestureDetector(
onTap: () {
Navigator.pushNamed(context, Routers.ownedKeyListPage,
arguments: {'uid': itemData.uid});
},
child: Container(
height: 90.h,
color: Colors.white,
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(10.w),
// ),
child: Row(
children: [
SizedBox(
width: 30.w,
),
Image.asset(
'images/controls_user.png',
width: 60.w,
height: 60.w,
),
SizedBox(
width: 20.w,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
itemData.nickname ?? '',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
],
),
SizedBox(height: 5.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
itemData.userid ?? '',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.placeholderTextColor),
),
],
),
SizedBox(width: 20.h),
],
),
),
SizedBox(width: 20.w),
],
),
),
);
}
}

View File

@ -10,16 +10,14 @@ import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
class LockUserManageListListPage extends StatefulWidget {
const LockUserManageListListPage({Key? key}) : super(key: key);
class LockUserManageListPage extends StatefulWidget {
const LockUserManageListPage({Key? key}) : super(key: key);
@override
State<LockUserManageListListPage> createState() =>
_LockUserManageListListPageState();
State<LockUserManageListPage> createState() => _LockUserManageListPageState();
}
class _LockUserManageListListPageState
extends State<LockUserManageListListPage> {
class _LockUserManageListPageState extends State<LockUserManageListPage> {
List<LockUserData> dataList = [];
@override
@ -43,7 +41,9 @@ class _LockUserManageListListPageState
TranslationLoader.lanKeys!.aboutToExpire!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {},
onPressed: () {
Navigator.pushNamed(context, Routers.expireLockListPage);
},
),
],
),
@ -66,7 +66,7 @@ class _LockUserManageListListPageState
context, Routers.massSendElectronicKeyManagePage);
},
child: Text(
'群发钥匙',
TranslationLoader.lanKeys!.sendGroupKey!.tr,
style: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,

View File

@ -32,22 +32,38 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
getUidStr = obj["uid"].toString();
}
keyListByUserRequest();
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.ownedKey!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: Column(
children: [
_topOwnedKeyText(),
Expanded(child: _buildMainUI()),
],
),
);
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.ownedKey!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: FutureBuilder<List<KeyListItem>>(
future: mockNetworkDataRequest(),
builder: (BuildContext context,
AsyncSnapshot<List<KeyListItem>> snapshot) {
//
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
//
return const Text('请求失败');
} else {
//
final List<KeyListItem> itemList = snapshot.data!;
return Column(
children: [
_topOwnedKeyText(),
Expanded(child: _buildMainUI(itemList)),
],
);
}
} else {
// loading
return Container();
}
}));
}
Widget _topOwnedKeyText() {
@ -67,15 +83,18 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
}
//
Future<List<KeyListItem>> keyListByUserRequest() async {
Future<List<KeyListItem>> mockNetworkDataRequest() async {
KeyListByUserEntity entity =
await ApiRepository.to.keyListByUser('1', '20', getUidStr);
if (entity.errorCode!.codeIsSuccessful) {
setState(() {
dataList = entity.data!.keyList!;
});
print("请求用户拥有的锁:${entity.data!.keyList}");
}
if (entity.data != null) {
return entity.data!.keyList!;
} else {
List<KeyListItem> dataList = [];
return dataList;
}
return [];
}
//使
@ -107,11 +126,11 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
return useDateStr;
}
Widget _buildMainUI() {
Widget _buildMainUI(List itemList) {
return ListView.builder(
itemCount: dataList.length,
itemCount: itemList.length,
itemBuilder: (c, index) {
KeyListItem itemData = dataList[index];
KeyListItem itemData = itemList[index];
return _electronicKeyItem(itemData);
});
}
@ -147,7 +166,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
itemData.keyName ?? '',
itemData.lockAlias ?? '',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),

View File

@ -54,9 +54,12 @@ abstract class Api {
final String lockDiagnoseUrl = '/room/uploadLockInfo'; //
final String getServerDatetimeUrl = '/check/getServerDatetime'; //
final String getLockVersionInfoUrl = '/room/update'; //
final String openCheckingInURL = '/attendanceCompany/isExistenceCompany'; //
final String setCheckInCreateCompanyURL = '/attendanceCompany/add'; //
final String setLockPickingReminderDataURL = '/key/updateMonitorFlag'; //
final String openCheckingInURL =
'/attendanceCompany/isExistenceCompany'; //
final String setCheckInCreateCompanyURL =
'/attendanceCompany/add'; //
final String setLockPickingReminderDataURL =
'/key/updateMonitorFlag'; //
final String getStaffListURL = '/staff/list'; //
final String addStaffURL = '/staff/add'; //
@ -67,4 +70,9 @@ abstract class Api {
final String batchSendKeyURL = '/key/batchSend'; //
final String addAuthorizedAdminURL = '/authorizedAdmin/add'; //
final String keyListByUserURL = '/keyUser/listByUse'; //
final String authorizedAdminListURL = '/authorizedAdmin/list'; //
final String deleteAdministratorURL = '/authorizedAdmin/delete'; //
final String updateAdministratorURL =
'/authorizedAdmin/update'; ////
final String expireLockListURL = '/keyUser/listExpireUser'; //
}

View File

@ -403,11 +403,38 @@ class ApiProvider extends BaseProvider {
jsonEncode({'lockId': lockId, 'groupId': groupId}));
Future<Response> lockGroupList(String type) =>
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
post(lockGroupListURL.toUrl, jsonEncode({'type': type}),
isShowLoading: true);
Future<Response> deleteElectronicKey(String keyId) =>
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId}));
Future<Response> deleteAdministrator(String uid, String includeUnderlings) =>
post(deleteElectronicKeyURL.toUrl,
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
Future<Response> updateAdministrator(String uid, String name, String endDate,
String startDate, String isRemoteUnlock) =>
post(
deleteElectronicKeyURL.toUrl,
jsonEncode({
'uid': uid,
'name': name,
'endDate': endDate,
'startDate': startDate,
'isRemoteUnlock': isRemoteUnlock
}));
Future<Response> expireLockList(
String operatorUid, String pageNo, String pageSize) =>
post(
expireLockListURL.toUrl,
jsonEncode({
'operatorUid': operatorUid,
'pageNo': pageNo,
'pageSize': pageSize,
}));
Future<Response> deleteKeyboardPwd(
String lockId, String keyboardPwdId, String deleteType) =>
post(
@ -616,15 +643,19 @@ class ApiProvider extends BaseProvider {
String pageNo, String pageSize, String searchStr) =>
post(
lockUserListURL.toUrl,
jsonEncode({
'pageNo': pageNo,
'pageSize': pageSize,
'searchStr': searchStr
}));
jsonEncode(
{'pageNo': pageNo, 'pageSize': pageSize, 'searchStr': searchStr}),
isShowLoading: true);
Future<Response> keyListByUser(String pageNo, String pageSize, String uid) =>
post(keyListByUserURL.toUrl,
jsonEncode({'pageNo': pageNo, 'pageSize': pageSize, 'uid': uid}));
jsonEncode({'pageNo': pageNo, 'pageSize': pageSize, 'uid': uid}),
isShowLoading: true);
Future<Response> authorizedAdminList(String pageNo, String pageSize) => post(
authorizedAdminListURL.toUrl,
jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}),
isShowLoading: true);
Future<Response> canSendKey(
String endDate, List keyGroupIdList, List lockIdList) =>

View File

@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformat
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart';
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
@ -382,6 +383,28 @@ class ApiRepository {
return ElectronicKeyListEntity.fromJson(res.body);
}
//
Future<ElectronicKeyListEntity> deleteAdministrator(
String uid, String includeUnderlings) async {
final res = await apiProvider.deleteAdministrator(uid, includeUnderlings);
return ElectronicKeyListEntity.fromJson(res.body);
}
//
Future<ElectronicKeyListEntity> updateAdministrator(String uid, String name,
String endDate, String startDate, String isRemoteUnlock) async {
final res = await apiProvider.updateAdministrator(
uid, name, endDate, startDate, isRemoteUnlock);
return ElectronicKeyListEntity.fromJson(res.body);
}
//
Future<ElectronicKeyListEntity> expireLockList(
String operatorUid, String pageNo, String pageSize) async {
final res = await apiProvider.expireLockList(operatorUid, pageNo, pageSize);
return ElectronicKeyListEntity.fromJson(res.body);
}
//
Future<PasswordKeyEntity> deleteKeyboardPwd(
String lockId, String keyboardPwdId, String deleteType) async {
@ -541,7 +564,7 @@ class ApiRepository {
return LockUserListEntity.fromJson(res.body);
}
//
//
Future<KeyListByUserEntity> keyListByUser(
String pageNo, String pageSize, String uid) async {
final res = await apiProvider.keyListByUser(pageNo, pageSize, uid);
@ -610,6 +633,13 @@ class ApiRepository {
return KeyDetailEntity.fromJson(res.body);
}
//
Future<AuthorizedAdminListEntity> authorizedAdminList(
String pageNo, String pageSize) async {
final res = await apiProvider.authorizedAdminList(pageNo, pageSize);
return AuthorizedAdminListEntity.fromJson(res.body);
}
//
Future<CheckingInInfoDataEntity> openCheckingInData(
{required String lockId}) async {