提交删除文件

This commit is contained in:
魏少阳 2023-11-03 14:00:12 +08:00
parent 1434a44f78
commit 771a3abb24
4 changed files with 0 additions and 692 deletions

View File

@ -1,65 +0,0 @@
class GetPassageModeConfigEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
GetPassageModeConfigEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
GetPassageModeConfigEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.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 Data {
int? passageMode;
int? startDate;
int? endDate;
int? isAllDay;
List<dynamic>? weekDays;
int? autoUnlock;
Data(
{this.passageMode,
this.startDate,
this.endDate,
this.isAllDay,
this.weekDays,
this.autoUnlock});
Data.fromJson(Map<String, dynamic> json) {
passageMode = json['passageMode'];
startDate = json['startDate'];
endDate = json['endDate'];
isAllDay = json['isAllDay'];
weekDays = json['weekDays'];
autoUnlock = json['autoUnlock'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['passageMode'] = passageMode;
data['startDate'] = startDate;
data['endDate'] = endDate;
data['isAllDay'] = isAllDay;
data['weekDays'] = weekDays;
data['autoUnlock'] = autoUnlock;
return data;
}
}

View File

@ -1,206 +0,0 @@
class KeyListByUserEntity {
int? errorCode;
String? description;
String? errorMsg;
KeyListByUserData? data;
KeyListByUserEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
KeyListByUserEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data =
json['data'] != null ? KeyListByUserData.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 KeyListByUserData {
List<KeyListItem>? keyList;
int? pageNo;
int? pageSize;
int? pages;
int? total;
KeyListByUserData(
{this.keyList, this.pageNo, this.pageSize, this.pages, this.total});
KeyListByUserData.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
keyList = <KeyListItem>[];
json['list'].forEach((v) {
keyList!.add(KeyListItem.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 (keyList != null) {
data['list'] = keyList!.map((v) => v.toJson()).toList();
}
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
data['pages'] = pages;
data['total'] = total;
return data;
}
}
class KeyListItem {
String? clientId;
int? lockOwnerId;
int? lockId;
int? senderUserId;
String? keyName;
int? keyType;
int? startDate;
int? endDate;
List? weekDays;
String? remarks;
int? remoteEnable;
int? isCameraEnable;
int? faceAuthentication;
int? keyRight;
int? userType;
int? keyStatus;
int? groupId;
int? lockUserNo;
int? date;
String? createdAt;
String? updatedAt;
UserInfo? userInfo;
int? keyId;
int? uid;
String? lockAlias;
KeyListItem(
{this.clientId,
this.lockOwnerId,
this.lockId,
this.senderUserId,
this.keyName,
this.keyType,
this.startDate,
this.endDate,
this.weekDays,
this.remarks,
this.remoteEnable,
this.isCameraEnable,
this.faceAuthentication,
this.keyRight,
this.userType,
this.keyStatus,
this.groupId,
this.lockUserNo,
this.date,
this.createdAt,
this.updatedAt,
this.userInfo,
this.keyId,
this.uid,
this.lockAlias});
KeyListItem.fromJson(Map<String, dynamic> json) {
clientId = json['clientId'];
lockOwnerId = json['lockOwnerId'];
lockId = json['lockId'];
senderUserId = json['senderUserId'];
keyName = json['keyName'];
keyType = json['keyType'];
startDate = json['startDate'];
endDate = json['endDate'];
if (json['weekDays'] != null) {
weekDays = [];
json['weekDays'].forEach((v) {
weekDays!.add(v);
});
}
remarks = json['remarks'];
remoteEnable = json['remoteEnable'];
isCameraEnable = json['isCameraEnable'];
faceAuthentication = json['faceAuthentication'];
keyRight = json['keyRight'];
userType = json['userType'];
keyStatus = json['keyStatus'];
groupId = json['groupId'];
lockUserNo = json['lockUserNo'];
date = json['date'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
userInfo =
json['user_info'] != null ? UserInfo.fromJson(json['user_info']) : null;
keyId = json['keyId'];
uid = json['uid'];
lockAlias = json['lockAlias'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['clientId'] = clientId;
data['lockOwnerId'] = lockOwnerId;
data['lockId'] = lockId;
data['senderUserId'] = senderUserId;
data['keyName'] = keyName;
data['keyType'] = keyType;
data['startDate'] = startDate;
data['endDate'] = endDate;
if (weekDays != null) {
data['weekDays'] = weekDays!.map((v) => v.toJson()).toList();
}
data['remarks'] = remarks;
data['remoteEnable'] = remoteEnable;
data['isCameraEnable'] = isCameraEnable;
data['faceAuthentication'] = faceAuthentication;
data['keyRight'] = keyRight;
data['userType'] = userType;
data['keyStatus'] = keyStatus;
data['groupId'] = groupId;
data['lockUserNo'] = lockUserNo;
data['date'] = date;
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
if (userInfo != null) {
data['user_info'] = userInfo!.toJson();
}
data['keyId'] = keyId;
data['uid'] = uid;
data['lockAlias'] = lockAlias;
return data;
}
}
class UserInfo {
int? id;
String? accountName;
UserInfo({this.id, this.accountName});
UserInfo.fromJson(Map<String, dynamic> json) {
id = json['id'];
accountName = json['account_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['account_name'] = accountName;
return data;
}
}

View File

@ -1,223 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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 'package:star_lock/tools/noData.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
class LockUserManageListPage extends StatefulWidget {
const LockUserManageListPage({Key? key}) : super(key: key);
@override
State<LockUserManageListPage> createState() => _LockUserManageListPageState();
}
class _LockUserManageListPageState extends State<LockUserManageListPage> {
List<LockUserData> dataList = [];
final TextEditingController searchController = TextEditingController();
@override
void initState() {
super.initState();
lockUserListRequest();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.lockUserManagement!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
TextButton(
child: Text(
TranslationLoader.lanKeys!.aboutToExpire!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
Navigator.pushNamed(context, Routers.expireLockListPage);
},
),
],
),
body: Column(
children: [
_searchWidget(),
SizedBox(
height: 20.h,
),
Expanded(child: _buildMainUI()),
SizedBox(
width: ScreenUtil().screenWidth - 40.w,
height: 90.h,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
),
onPressed: () {
Navigator.pushNamed(
context, Routers.massSendElectronicKeyManagePage)
.then((value) {
lockUserListRequest();
});
},
child: Text(
TranslationLoader.lanKeys!.sendGroupKey!.tr,
style: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
fontWeight: FontWeight.w600),
)),
),
SizedBox(
height: 64.h,
)
],
),
);
}
Widget _searchWidget() {
return Container(
height: 60.h,
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 20.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: TextField(
//
maxLines: 1,
controller: searchController,
autofocus: false,
onSubmitted: (value) {
lockUserListRequest();
},
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
//线
border: InputBorder.none,
//
icon: Padding(
padding: EdgeInsets.only(
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
child: Image.asset(
'images/main/icon_main_search.png',
width: 40.w,
height: 40.w,
),
),
),
),
);
}
Widget _buildMainUI() {
return dataList.isEmpty
? const NoData()
: 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>> lockUserListRequest() async {
LockUserListEntity entity =
await ApiRepository.to.lockUserList('1', '20', searchController.text);
if (entity.errorCode!.codeIsSuccessful) {
setState(() {
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),
],
),
),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
),
SizedBox(width: 20.w),
],
),
),
);
}
}

View File

@ -1,198 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
class OwnedKeyListPage extends StatefulWidget {
const OwnedKeyListPage({Key? key}) : super(key: key);
@override
State<OwnedKeyListPage> createState() => _OwnedKeyListPageState();
}
class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
String getUidStr = '';
List dataList = [];
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["uid"] != null)) {
getUidStr = obj["uid"].toString();
}
return Scaffold(
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() {
return Container(
color: Colors.white,
width: ScreenUtil().screenWidth,
// margin: EdgeInsets.only(left: 30.w, top: 30.w, right: 30.w, bottom: 30.w),
child: Padding(
padding:
EdgeInsets.only(left: 30.w, top: 20.w, right: 20.w, bottom: 10.w),
child: Text(
TranslationLoader.lanKeys!.ownedKey!.tr,
style: TextStyle(fontSize: 24.sp),
),
),
);
}
//
Future<List<KeyListItem>> mockNetworkDataRequest() async {
KeyListByUserEntity entity =
await ApiRepository.to.keyListByUser('1', '20', getUidStr);
if (entity.errorCode!.codeIsSuccessful) {
print("请求用户拥有的锁:${entity.data!.keyList}");
}
if (entity.data != null) {
return entity.data!.keyList!;
} else {
List<KeyListItem> dataList = [];
return dataList;
}
}
//使
String getUseDateStr(KeyListItem indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
//
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 == XSConstantMacro.keyTypeLong) {
//
useDateStr = '永久';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
useDateStr = '单次';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环';
}
return useDateStr;
}
Widget _buildMainUI(List itemList) {
return ListView.builder(
itemCount: itemList.length,
itemBuilder: (c, index) {
KeyListItem itemData = itemList[index];
return _electronicKeyItem(itemData);
});
}
Widget _electronicKeyItem(KeyListItem itemData) {
return GestureDetector(
onTap: () {},
child: Container(
height: 90.h,
margin: const EdgeInsets.only(top: 1),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
),
child: Row(
children: [
SizedBox(
width: 30.w,
),
Image.asset(
'images/icon_lockGroup_item.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.lockAlias ?? '',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
],
),
SizedBox(height: 5.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
getUseDateStr(itemData),
style: TextStyle(
fontSize: 18.sp,
color: AppColors.placeholderTextColor),
),
],
),
SizedBox(width: 20.h),
],
),
),
SizedBox(width: 20.h),
],
),
),
);
}
}