1,新增自定义密码接口
2,新增修改密码详情各项信息接口 3,新增设置锁分组接口 4,新增获取锁分组下的锁列表接口 5,新增锁用户列表接口调试 6,新增群发锁分组列表页面 7,新增群发接收人页面 8,新增锁用户列表页面
This commit is contained in:
parent
af89f9428d
commit
c888f27142
BIN
star_lock/images/icon_massSend_delete.png
Normal file
BIN
star_lock/images/icon_massSend_delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@ -1,7 +1,11 @@
|
|||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
||||||
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/lockUserList_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
||||||
@ -152,10 +156,8 @@ abstract class Routers {
|
|||||||
static const otherTypeKeyManagePage =
|
static const otherTypeKeyManagePage =
|
||||||
'/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加
|
'/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加
|
||||||
|
|
||||||
static const addFingerprintTipPage =
|
static const addFingerprintTipPage = '/AddFingerprintTipPage'; // 添加指纹提示
|
||||||
'/AddFingerprintTipPage'; // 添加指纹提示
|
static const addFingerprintPage = '/AddFingerprintPage'; // 添加指纹
|
||||||
static const addFingerprintPage =
|
|
||||||
'/AddFingerprintPage'; // 添加指纹
|
|
||||||
|
|
||||||
static const authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表
|
static const authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表
|
||||||
static const authorizedAdminDetailPage =
|
static const authorizedAdminDetailPage =
|
||||||
@ -291,6 +293,9 @@ abstract class Routers {
|
|||||||
static const getDeviceListPage = '/getDeviceListPage'; //设备列表
|
static const getDeviceListPage = '/getDeviceListPage'; //设备列表
|
||||||
static const getNameListPage = '/getNameListPage'; //姓名列表
|
static const getNameListPage = '/getNameListPage'; //姓名列表
|
||||||
static const authorityManagementPage = '/authorityManagementPage'; //权限管理
|
static const authorityManagementPage = '/authorityManagementPage'; //权限管理
|
||||||
|
static const massSendLockGroupPage = '/massSendLockGroupPage'; //群发锁分组列表
|
||||||
|
static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人
|
||||||
|
static const lockUserListPage = '/lockUserListPage'; //锁用户列表
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AppRouters {
|
abstract class AppRouters {
|
||||||
@ -730,9 +735,19 @@ abstract class AppRouters {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.authorityManagementPage,
|
name: Routers.authorityManagementPage,
|
||||||
page: () => const AuthorityManagementPage()),
|
page: () => const AuthorityManagementPage()),
|
||||||
GetPage(name: Routers.addFingerprintTipPage, page: () => const AddFingerprintTipPage()),
|
GetPage(
|
||||||
|
name: Routers.addFingerprintTipPage,
|
||||||
|
page: () => const AddFingerprintTipPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.addFingerprintPage,
|
name: Routers.addFingerprintPage,
|
||||||
page: () => const AddFingerprintPage()),
|
page: () => const AddFingerprintPage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.massSendLockGroupPage,
|
||||||
|
page: () => const MassSendLockGroupListPage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.massSendReceiverPage,
|
||||||
|
page: () => const MassSendReceiverPage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.lockUserListPage, page: () => const LockUserListPage())
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -276,9 +276,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
BuildContext context,
|
|
||||||
) {
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
@ -33,6 +34,8 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
late String endDay = '';
|
late String endDay = '';
|
||||||
late String startDay = '';
|
late String startDay = '';
|
||||||
late List weekDays = [];
|
late List weekDays = [];
|
||||||
|
late String pwdId = '';
|
||||||
|
late String lockId = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -40,6 +43,12 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
if (obj != null && (obj["itemData"] != null)) {
|
if (obj != null && (obj["itemData"] != null)) {
|
||||||
itemData = obj["itemData"];
|
itemData = obj["itemData"];
|
||||||
}
|
}
|
||||||
|
if (obj != null && (obj["pwdId"] != null)) {
|
||||||
|
pwdId = obj["pwdId"];
|
||||||
|
}
|
||||||
|
if (obj != null && (obj["lockId"] != null)) {
|
||||||
|
lockId = obj["lockId"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
@ -55,7 +64,11 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
updateKeyDateRequest();
|
if (lockId.isNotEmpty && pwdId.isNotEmpty) {
|
||||||
|
updatePwdRequest();
|
||||||
|
} else {
|
||||||
|
updateKeyDateRequest();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -120,6 +133,24 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新密码请求
|
||||||
|
Future<void> updatePwdRequest() async {
|
||||||
|
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||||
|
lockId,
|
||||||
|
pwdId,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||||
|
_failureDateTime.millisecondsSinceEpoch.toString(),
|
||||||
|
'');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: "修改成功");
|
||||||
|
setState(() {
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
String intToStr(int v) {
|
||||||
return (v < 10) ? "0$v" : "$v";
|
return (v < 10) ? "0$v" : "$v";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
|
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
@ -87,12 +85,16 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
rightTitle: TranslationLoader.lanKeys!.pleaseAdd!.tr,
|
rightTitle: TranslationLoader.lanKeys!.pleaseAdd!.tr,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {}),
|
action: () {
|
||||||
|
Navigator.pushNamed(context, Routers.massSendReceiverPage);
|
||||||
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
rightTitle: TranslationLoader.lanKeys!.pleaseSelet!.tr,
|
rightTitle: TranslationLoader.lanKeys!.pleaseSelet!.tr,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {}),
|
action: () {
|
||||||
|
Navigator.pushNamed(context, Routers.massSendLockGroupPage);
|
||||||
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -0,0 +1,70 @@
|
|||||||
|
class MassSendLockGroupListEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
LockListData? data;
|
||||||
|
|
||||||
|
MassSendLockGroupListEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
MassSendLockGroupListEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? LockListData.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 LockListData {
|
||||||
|
List<LockListItem>? lockList;
|
||||||
|
|
||||||
|
LockListData({this.lockList});
|
||||||
|
|
||||||
|
LockListData.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['list'] != null) {
|
||||||
|
lockList = <LockListItem>[];
|
||||||
|
json['list'].forEach((v) {
|
||||||
|
lockList!.add(LockListItem.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (lockList != null) {
|
||||||
|
data['list'] = lockList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LockListItem {
|
||||||
|
int? lockId;
|
||||||
|
String? lockAlias;
|
||||||
|
bool? isRefresh = false;
|
||||||
|
|
||||||
|
LockListItem({this.lockId, this.lockAlias, this.isRefresh});
|
||||||
|
|
||||||
|
LockListItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
lockId = json['lockId'];
|
||||||
|
lockAlias = json['lockAlias'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['lockId'] = lockId;
|
||||||
|
data['lockAlias'] = lockAlias;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/utils.dart';
|
import 'package:get/utils.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/ExpandedListView.dart';
|
import 'package:star_lock/tools/ExpandedListView.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
class MassSendLockGroupListPage extends StatefulWidget {
|
class MassSendLockGroupListPage extends StatefulWidget {
|
||||||
@ -15,9 +19,15 @@ class MassSendLockGroupListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||||
|
List lockListByGroup = [];
|
||||||
|
List lockGroupList = [];
|
||||||
|
List clickIndexList = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
mockNetworkDataRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -26,7 +36,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
title: Text(
|
title: Text(
|
||||||
TranslationLoader.lanKeys!.authorityManagement!.tr,
|
TranslationLoader.lanKeys!.lock!.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 28.sp,
|
fontSize: 28.sp,
|
||||||
@ -39,75 +49,94 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
SizedBox(
|
||||||
'请选择要发送的锁',
|
height: 10.h,
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
|
|
||||||
),
|
),
|
||||||
_keyGroupList()
|
Container(
|
||||||
|
width: ScreenUtil().screenWidth,
|
||||||
|
margin: EdgeInsets.only(left: 20.w),
|
||||||
|
child: Text('请选择要发送的锁',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
Expanded(child: _buildListView(context, lockGroupList)),
|
||||||
|
SizedBox(
|
||||||
|
height: 40.h,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备列表
|
//分组列表请求
|
||||||
Widget _keyGroupList() {
|
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
||||||
return Column(
|
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||||
children: [
|
List<LockGroupItem> dataList = [];
|
||||||
SizedBox(
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
height: 10.h,
|
if (entity.data != null) {
|
||||||
),
|
dataList = entity.data!.itemList!;
|
||||||
Expanded(
|
}
|
||||||
child: ListView.separated(
|
}
|
||||||
itemBuilder: (context, index) {
|
lockGroupList = dataList;
|
||||||
if (index == 0) {
|
setState(() {});
|
||||||
return _buildLockExpandedList(context, index, "大门锁");
|
return dataList;
|
||||||
} else if (index == 1) {
|
}
|
||||||
return _buildLockExpandedList(context, index, "办公室锁");
|
|
||||||
} else if (index == 2) {
|
//分组列表请求
|
||||||
return _buildLockExpandedList(context, index, "会议室锁");
|
Future<List<LockListItem>> listLockByGroup(String groupId) async {
|
||||||
} else {
|
MassSendLockGroupListEntity entity =
|
||||||
return _buildLockExpandedList(context, index, "宴会厅锁");
|
await ApiRepository.to.listLockByGroup('3', groupId);
|
||||||
}
|
List<LockListItem> dataList = [];
|
||||||
},
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
separatorBuilder: (context, index) {
|
if (entity.data != null) {
|
||||||
return const Divider(
|
dataList = entity.data!.lockList!;
|
||||||
height: 1,
|
}
|
||||||
color: AppColors.greyLineColor,
|
}
|
||||||
);
|
lockListByGroup = dataList;
|
||||||
},
|
|
||||||
itemCount: 5)),
|
setState(() {});
|
||||||
],
|
return dataList;
|
||||||
);
|
}
|
||||||
|
|
||||||
|
Widget _buildListView(BuildContext context, List itemList) {
|
||||||
|
return ListView.separated(
|
||||||
|
itemCount: itemList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
LockGroupItem itemData = itemList[index];
|
||||||
|
return _buildLockExpandedList(context, index, itemData);
|
||||||
|
},
|
||||||
|
shrinkWrap: true,
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备多层级列表
|
//设备多层级列表
|
||||||
Widget _buildLockExpandedList(context, index, deviceName) {
|
Widget _buildLockExpandedList(context, index, LockGroupItem itemData) {
|
||||||
return ExpandedListTile(
|
return ExpandedListTile(
|
||||||
onTap: () => print("onTap."),
|
onTap: () {
|
||||||
title: deviceName,
|
listLockByGroup(itemData.keyGroupId.toString());
|
||||||
imgName: 'images/icon_lock.png',
|
clickIndexList.add(index);
|
||||||
|
},
|
||||||
|
title: itemData.keyGroupName!,
|
||||||
|
imgName: '',
|
||||||
typeImgList: const [],
|
typeImgList: const [],
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: 10,
|
itemCount: lockListByGroup.length,
|
||||||
itemBuilder: (_, index) {
|
itemBuilder: (_, itemIndex) {
|
||||||
if (index == 0) {
|
LockListItem itemData = lockListByGroup[itemIndex];
|
||||||
return _buildNameWidget(
|
return _buildNameWidget(context, itemIndex,
|
||||||
context, index, 'images/icon_password.png', '张三');
|
'images/icon_password.png', itemData.lockAlias);
|
||||||
} else if (index == 1) {
|
|
||||||
return _buildNameWidget(
|
|
||||||
context, index, 'images/icon_card.png', '李四');
|
|
||||||
} else if (index == 2) {
|
|
||||||
return _buildNameWidget(
|
|
||||||
context, index, 'images/icon_fingerprint.png', '王二');
|
|
||||||
} else if (index == 3) {
|
|
||||||
return _buildNameWidget(
|
|
||||||
context, index, 'images/icon_card.png', '麻子');
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return const Divider(
|
return const Divider(
|
||||||
@ -132,7 +161,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
|||||||
width: 30.w,
|
width: 30.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/controls_user.png',
|
'images/mine/icon_mine_gatewaySignal_prompt.png',
|
||||||
width: 36.w,
|
width: 36.w,
|
||||||
height: 36.w,
|
height: 36.w,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -0,0 +1,59 @@
|
|||||||
|
class LockUserListEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
List<LockUserData>? data;
|
||||||
|
|
||||||
|
LockUserListEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
LockUserListEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
if (json['data'] != null) {
|
||||||
|
data = <LockUserData>[];
|
||||||
|
json['data'].forEach((v) {
|
||||||
|
data!.add(LockUserData.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LockUserData {
|
||||||
|
int? uid;
|
||||||
|
String? nickname;
|
||||||
|
String? headUrl;
|
||||||
|
String? userid;
|
||||||
|
bool? isCheck = false;
|
||||||
|
|
||||||
|
LockUserData(
|
||||||
|
{this.uid, this.nickname, this.headUrl, this.userid, this.isCheck});
|
||||||
|
|
||||||
|
LockUserData.fromJson(Map<String, dynamic> json) {
|
||||||
|
uid = json['uid'];
|
||||||
|
nickname = json['nickname'];
|
||||||
|
headUrl = json['headUrl'];
|
||||||
|
userid = json['userid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['uid'] = uid;
|
||||||
|
data['nickname'] = nickname;
|
||||||
|
data['headUrl'] = headUrl;
|
||||||
|
data['userid'] = userid;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,224 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/utils.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/lockUserListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class LockUserListPage extends StatefulWidget {
|
||||||
|
const LockUserListPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _LockUserListPageState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LockUserListPageState extends State<LockUserListPage> {
|
||||||
|
List<LockUserData> dataList = [];
|
||||||
|
List selectUserIdList = [];
|
||||||
|
List<LockUserData> selectDataList = [];
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
lockUserListRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
title: Text(
|
||||||
|
'选择用户',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
_searchWidget(),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
LockUserData indexEntity = dataList[index];
|
||||||
|
return _electronicKeyItem(indexEntity);
|
||||||
|
},
|
||||||
|
itemCount: dataList.length,
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return const Divider(height: 1, color: AppColors.greyLineColor);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
Container(
|
||||||
|
height: 120.h,
|
||||||
|
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 0.h),
|
||||||
|
margin: const EdgeInsets.only(left: 0, right: 0, bottom: 0),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'已选中:${selectUserIdList.length}',
|
||||||
|
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
width: 120.w,
|
||||||
|
height: 60.h,
|
||||||
|
child: SubmitBtn(
|
||||||
|
btnName: '确定',
|
||||||
|
onClick: () {
|
||||||
|
Map<String, dynamic> resultMap = {};
|
||||||
|
resultMap['lockUserList'] = selectDataList;
|
||||||
|
Navigator.pop(context, resultMap);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _searchWidget() {
|
||||||
|
return Container(
|
||||||
|
height: 60.h,
|
||||||
|
margin: EdgeInsets.only(left: 20.w, right: 10.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||||
|
child: TextField(
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
// controller: _controller,
|
||||||
|
autofocus: false,
|
||||||
|
|
||||||
|
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 _electronicKeyItem(LockUserData itemData) {
|
||||||
|
return Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: 90.h,
|
||||||
|
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,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
itemData.nickname!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp, color: AppColors.blackColor),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
itemData.userid!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
color: AppColors.placeholderTextColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(width: 20.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
itemData.isCheck = !itemData.isCheck!;
|
||||||
|
if (itemData.isCheck == true) {
|
||||||
|
selectUserIdList.add(itemData.userid);
|
||||||
|
selectDataList.add(itemData);
|
||||||
|
} else {
|
||||||
|
selectUserIdList.remove(itemData.userid);
|
||||||
|
selectDataList.remove(itemData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
itemData.isCheck!
|
||||||
|
? 'images/icon_round_selet.png'
|
||||||
|
: 'images/icon_round_unSelet.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
)),
|
||||||
|
SizedBox(width: 20.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//请求锁用户列表
|
||||||
|
Future<List<LockUserData>> lockUserListRequest() async {
|
||||||
|
LockUserListEntity entity =
|
||||||
|
await ApiRepository.to.lockUserList('1', '20', '');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
setState(() {
|
||||||
|
dataList = entity.data!;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,258 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/utils.dart';
|
||||||
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/lockUserListEntity.dart';
|
||||||
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MassSendReceiverPage extends StatefulWidget {
|
||||||
|
const MassSendReceiverPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _MassSendReceiverPageState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
||||||
|
late List<LockUserData> _lockUserList = [];
|
||||||
|
TextEditingController emailOrPhoneController = TextEditingController();
|
||||||
|
TextEditingController keyNameController = TextEditingController();
|
||||||
|
|
||||||
|
String countryCode = '86';
|
||||||
|
String countryName = '中国';
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
LockUserData data = LockUserData();
|
||||||
|
_lockUserList.add(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
title: Text(
|
||||||
|
'接收者',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
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(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [controlViewTitle(0), controlViewTitle(1)],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 2.h,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
LockUserData data = _lockUserList[index];
|
||||||
|
return _itemBuilder(index, data);
|
||||||
|
},
|
||||||
|
itemCount: _lockUserList.length,
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return Divider(
|
||||||
|
height: 20.h,
|
||||||
|
color: AppColors.greyBackgroundColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget controlViewTitle(int btnIndex) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
width: (ScreenUtil().screenWidth - 60.w) / 2,
|
||||||
|
height: 90.h,
|
||||||
|
margin: EdgeInsets.only(left: 20.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_btn_add.png',
|
||||||
|
width: 28.w,
|
||||||
|
height: 28.w,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 6.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
btnIndex == 0 ? '已有' : '新增',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
if (btnIndex == 0) {
|
||||||
|
//已有
|
||||||
|
Navigator.pushNamed(context, Routers.lockUserListPage).then((val) {
|
||||||
|
if (val != null) {
|
||||||
|
val as Map<String, dynamic>;
|
||||||
|
_lockUserList = val['lockUserList'];
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (btnIndex == 1) {
|
||||||
|
//新增
|
||||||
|
_lockUserList.add(LockUserData());
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _itemBuilder(int index, LockUserData userData) {
|
||||||
|
return Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 40.w,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_massSend_delete.png',
|
||||||
|
width: 26.w,
|
||||||
|
height: 26.w,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
_lockUserList.removeAt(index - 1);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
|
rightTitle: userData.userid ?? ' ',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: getTFWidget(
|
||||||
|
true,
|
||||||
|
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
|
1)),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
rightTitle: userData.nickname ?? ' ',
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: getTFWidget(
|
||||||
|
false, TranslationLoader.lanKeys!.enterYourName!.tr, 2)),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接受者信息输入框
|
||||||
|
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 50.h,
|
||||||
|
width: 320.w,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller:
|
||||||
|
lineIndex == 1 ? emailOrPhoneController : keyNameController,
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
// controller: _controller,
|
||||||
|
autofocus: false,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//输入里面输入文字内边距设置
|
||||||
|
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
|
hintText: tfStr,
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
|
//不需要输入框下划线
|
||||||
|
border: InputBorder.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
isHaveBtn
|
||||||
|
? Container(
|
||||||
|
width: 32.w,
|
||||||
|
height: 32.w,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('images/icon_addressBook.png'),
|
||||||
|
fit: BoxFit.fill),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
// Contact? currentContact =
|
||||||
|
// await _contactPicker.selectContact();
|
||||||
|
// setState(() {
|
||||||
|
// _contact = currentContact!;
|
||||||
|
// // print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}");
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -45,7 +45,7 @@ class LockData {
|
|||||||
int? noKeyPwd;
|
int? noKeyPwd;
|
||||||
int? electricQuantity;
|
int? electricQuantity;
|
||||||
String? featureValue;
|
String? featureValue;
|
||||||
String? groupId;
|
int? groupId;
|
||||||
String? groupName;
|
String? groupName;
|
||||||
|
|
||||||
LockData(
|
LockData(
|
||||||
@ -96,7 +96,7 @@ class LockData {
|
|||||||
? electricQuantity = json['electricQuantity']
|
? electricQuantity = json['electricQuantity']
|
||||||
: 0;
|
: 0;
|
||||||
json['featureValue'] != null ? featureValue = json['featureValue'] : "";
|
json['featureValue'] != null ? featureValue = json['featureValue'] : "";
|
||||||
json['groupId'] != null ? groupId = json['groupId'] : "";
|
json['groupId'] != null ? groupId = json['groupId'] : 0;
|
||||||
groupName = json['groupName'];
|
groupName = json['groupName'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.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/main/lockMian/entity/lockInfoEntity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -25,6 +23,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
late String _groupName = "";
|
late String _groupName = "";
|
||||||
late KeyInfos keyInfo;
|
late KeyInfos keyInfo;
|
||||||
late LockMainEntity lockMainEntity;
|
late LockMainEntity lockMainEntity;
|
||||||
|
late LockData _lockData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -114,11 +113,16 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.lockSeletGroupingPage);
|
context, Routers.lockSeletGroupingPage,
|
||||||
result as Map<String, dynamic>;
|
arguments: {
|
||||||
_groupName = result['groupName'];
|
'LockData': _lockData
|
||||||
setState(() {});
|
}).then((val) {
|
||||||
|
if (val != null) {
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader
|
leftTitel: TranslationLoader
|
||||||
@ -193,6 +197,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString());
|
await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// print("电子钥匙列表成功:${entity.data?.itemList}");
|
// print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
|
_lockData = entity.data!;
|
||||||
return entity.data!;
|
return entity.data!;
|
||||||
}
|
}
|
||||||
LockData data = LockData();
|
LockData data = LockData();
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -22,10 +23,15 @@ class LockSeletGroupingPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
||||||
final TextEditingController _changeNameController = TextEditingController();
|
final TextEditingController _changeNameController = TextEditingController();
|
||||||
final int _selectGroupIndex = -1;
|
late LockData _lockData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["LockData"] != null)) {
|
||||||
|
_lockData = obj["LockData"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -56,7 +62,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context);
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
@ -84,7 +90,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: false,
|
isHaveDirection: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: _selectGroupIndex == index
|
rightWidget: _lockData.groupId == itemData.keyGroupId
|
||||||
? Image(
|
? Image(
|
||||||
image: const AssetImage("images/icon_item_checked.png"),
|
image: const AssetImage("images/icon_item_checked.png"),
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
@ -93,11 +99,8 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
action: () {
|
action: () {
|
||||||
Map<String, dynamic> resultMap = {};
|
Navigator.pop(context, true);
|
||||||
resultMap['groupName'] = itemData.keyGroupName;
|
setLockGroupRequest(itemData);
|
||||||
Navigator.pop(context, resultMap);
|
|
||||||
|
|
||||||
setState(() {});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -113,6 +116,16 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置锁分组请求
|
||||||
|
Future<void> setLockGroupRequest(LockGroupItem itemData) async {
|
||||||
|
LockGroupListEntity entity = await ApiRepository.to.setLockGroup(
|
||||||
|
_lockData.lockId.toString(), itemData.keyGroupId.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: "设置锁分组成功");
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//分组列表请求
|
//分组列表请求
|
||||||
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
||||||
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||||
@ -128,21 +141,22 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
BuildContext context,
|
|
||||||
) {
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title:
|
title:
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.lockGroup!.tr}",
|
||||||
tipTitle: "请输入",
|
tipTitle: "请输入",
|
||||||
controller: _changeNameController,
|
controller: _changeNameController,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
//发送编辑钥匙名称请求
|
||||||
if (_changeNameController.text.isNotEmpty) {
|
if (_changeNameController.text.isNotEmpty) {
|
||||||
addLockGroupRequest();
|
addLockGroupRequest();
|
||||||
|
Navigator.pop(context);
|
||||||
|
} else {
|
||||||
|
Toast.show(msg: '请输入分组名称');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
|
|||||||
@ -2,11 +2,11 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.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/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/showTFView.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
@ -25,6 +25,16 @@ class PasswordKeyDetailPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||||
PasswordKeyListItem itemData = PasswordKeyListItem();
|
PasswordKeyListItem itemData = PasswordKeyListItem();
|
||||||
|
late TextEditingController _inputPwdController;
|
||||||
|
late TextEditingController _inputNameController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
_inputPwdController = TextEditingController();
|
||||||
|
_inputNameController = TextEditingController();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -64,19 +74,23 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||||
rightTitle: itemData.keyboardPwd,
|
rightTitle: _inputPwdController.text.isNotEmpty
|
||||||
|
? _inputPwdController.text
|
||||||
|
: itemData.keyboardPwd,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context, _inputPwdController);
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: itemData.keyboardPwdName,
|
rightTitle: _inputNameController.text.isNotEmpty
|
||||||
|
? _inputNameController.text
|
||||||
|
: itemData.keyboardPwdName,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context, _inputNameController);
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
@ -84,7 +98,11 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.electronicKeyDetailChangeDate);
|
context, Routers.electronicKeyDetailChangeDate,
|
||||||
|
arguments: {
|
||||||
|
'lockId': itemData.lockId.toString(),
|
||||||
|
'pwdId': itemData.keyboardPwdId.toString()
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -272,7 +290,51 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
//更新密码请求
|
||||||
|
Future<void> updatePwdRequest() async {
|
||||||
|
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||||
|
itemData.lockId.toString(),
|
||||||
|
itemData.keyboardPwdId.toString(),
|
||||||
|
_inputNameController.text,
|
||||||
|
_inputPwdController.text,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: "修改成功");
|
||||||
|
setState(() {
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showCupertinoAlertDialog(
|
||||||
|
BuildContext context, TextEditingController inputController) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowTFView(
|
||||||
|
title:
|
||||||
|
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||||
|
tipTitle: "请输入",
|
||||||
|
controller: inputController,
|
||||||
|
sureClick: () {
|
||||||
|
//发送编辑钥匙名称请求
|
||||||
|
if (inputController.text.isNotEmpty) {
|
||||||
|
updatePwdRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void showCupertinoAlertDialog(
|
||||||
|
BuildContext context, TextEditingController inputController) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -291,6 +353,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
margin: EdgeInsets.all(10.w),
|
margin: EdgeInsets.all(10.w),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
controller: inputController,
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
// controller: _controller,
|
// controller: _controller,
|
||||||
@ -330,14 +393,13 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
// print("取消");
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
updatePwdRequest();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
// print("确定");
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -345,4 +407,5 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -352,8 +352,34 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
|
/*
|
||||||
|
int getWidgetNumber = int.parse(widget.type);
|
||||||
|
|
||||||
|
if (_nameController.text.isEmpty) {
|
||||||
|
Toast.show(msg: '请输入密码姓名');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (getWidgetNumber != 0 ||
|
||||||
|
getWidgetNumber != 2 ||
|
||||||
|
getWidgetNumber != 5) {
|
||||||
|
if (getWidgetNumber == 3 && _pwdController.text.isEmpty) {
|
||||||
|
Toast.show(msg: '请输入密码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_failureDateTime.compareTo(_effectiveDateTime) != 1) {
|
||||||
|
Toast.show(msg: '失效时间需大于生效时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
logic.getStartDate(_effectiveDateTime);
|
logic.getStartDate(_effectiveDateTime);
|
||||||
getKeyboardPwdRequest();
|
int passwordType = int.parse(widget.type);
|
||||||
|
if (passwordType == 3) {
|
||||||
|
//自定义密码
|
||||||
|
addKeyboardPwdRequest();
|
||||||
|
} else {
|
||||||
|
getKeyboardPwdRequest();
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -400,7 +426,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
//清空码
|
//清空码
|
||||||
getKeyType = '4';
|
getKeyType = '4';
|
||||||
}
|
}
|
||||||
if (widget.type != '0' || widget.type != '2' || widget.type == '5') {
|
if (widget.type != '0' || widget.type != '2' || widget.type != '5') {
|
||||||
getFailureDateTime =
|
getFailureDateTime =
|
||||||
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||||
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||||
@ -429,6 +455,43 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//自定义密码请求
|
||||||
|
Future<void> addKeyboardPwdRequest() async {
|
||||||
|
String getFailureDateTime = '0';
|
||||||
|
String getEffectiveDateTime = '0';
|
||||||
|
String lockId = widget.getKeyInfo.lockId.toString();
|
||||||
|
String getKeyType = '3';
|
||||||
|
//是否为永久
|
||||||
|
if (_isPermanent == false) {
|
||||||
|
getKeyType = '3';
|
||||||
|
getFailureDateTime =
|
||||||
|
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||||
|
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||||
|
.millisecondsSinceEpoch
|
||||||
|
.toString();
|
||||||
|
} else {
|
||||||
|
getKeyType = '2';
|
||||||
|
}
|
||||||
|
var entity = await ApiRepository.to.addPasswordKey(
|
||||||
|
lockId,
|
||||||
|
_nameController.text,
|
||||||
|
_pwdController.text,
|
||||||
|
getKeyType,
|
||||||
|
getEffectiveDateTime,
|
||||||
|
getFailureDateTime,
|
||||||
|
'0');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print('获取密码成功');
|
||||||
|
_isSendSuccess = true;
|
||||||
|
if (entity.data != null) {
|
||||||
|
_getPwdStr = entity.data!.keyboardPwd!;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.show(msg: '${entity.errorMsg}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
// 发送电子钥匙成功
|
||||||
Widget sendElectronicKeySucceed() {
|
Widget sendElectronicKeySucceed() {
|
||||||
return Column(
|
return Column(
|
||||||
|
|||||||
@ -32,11 +32,19 @@ abstract class Api {
|
|||||||
final String deletLockURL = '/lock/delete'; // 删除锁
|
final String deletLockURL = '/lock/delete'; // 删除锁
|
||||||
|
|
||||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||||
|
final String passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
||||||
|
final String updatePasswordKeyURL = '/keyboardPwd/update'; //修改密码详情
|
||||||
final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录
|
final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录
|
||||||
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
||||||
|
final String setlockGroupURL = '/keyGroup/setGroup'; //设置锁分组
|
||||||
final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表
|
final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表
|
||||||
|
final String listLockByGroupURL =
|
||||||
|
'/authorizedAdmin/listLockByGroup'; //获取分组下的锁列表
|
||||||
final String updateSettingURL = '/room/updateSetting'; //标记房态
|
final String updateSettingURL = '/room/updateSetting'; //标记房态
|
||||||
final String keyGroupListURL = '/keyGroup/list'; //分组列表
|
final String keyGroupListURL = '/keyGroup/list'; //分组列表
|
||||||
final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁
|
final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁
|
||||||
final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息
|
final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息
|
||||||
|
final String lockUserListURL = '/keyUser/listKeyUser'; //锁用户列表
|
||||||
|
final String canSendKeyURL = '/keyUser/canSendKey'; //群发钥匙检查
|
||||||
|
final String batchSendKeyURL = '/key/batchSend'; //批处理群发钥匙
|
||||||
}
|
}
|
||||||
|
|||||||
@ -340,6 +340,48 @@ class ApiProvider extends BaseProvider {
|
|||||||
'timezoneRawOffSet': timezoneRawOffSet
|
'timezoneRawOffSet': timezoneRawOffSet
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Future<Response> addKeyboardPwd(
|
||||||
|
String lockId,
|
||||||
|
String keyboardPwdName,
|
||||||
|
String keyboardPwd,
|
||||||
|
String keyboardPwdType,
|
||||||
|
String startDate,
|
||||||
|
String endDate,
|
||||||
|
String addType,
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
passwordKeyAddURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'keyboardPwdName': keyboardPwdName,
|
||||||
|
'keyboardPwd': keyboardPwd,
|
||||||
|
'keyboardPwdType': keyboardPwdType,
|
||||||
|
'startDate': startDate,
|
||||||
|
'endDate': endDate,
|
||||||
|
'addType': addType,
|
||||||
|
}));
|
||||||
|
|
||||||
|
Future<Response> updateKeyboardPwd(
|
||||||
|
String lockId,
|
||||||
|
String keyboardPwdId,
|
||||||
|
String keyboardPwdName,
|
||||||
|
String newKeyboardPwd,
|
||||||
|
String startDate,
|
||||||
|
String endDate,
|
||||||
|
String changeType,
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
updatePasswordKeyURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'keyboardPwdId': keyboardPwdId,
|
||||||
|
'keyboardPwdName': keyboardPwdName,
|
||||||
|
'newKeyboardPwd': newKeyboardPwd,
|
||||||
|
'startDate': startDate,
|
||||||
|
'endDate': endDate,
|
||||||
|
'changeType': changeType,
|
||||||
|
}));
|
||||||
|
|
||||||
Future<Response> clearOperationRecord(String lockId) =>
|
Future<Response> clearOperationRecord(String lockId) =>
|
||||||
post(clearOperationRecordURL.toUrl, jsonEncode({'lockId': lockId}));
|
post(clearOperationRecordURL.toUrl, jsonEncode({'lockId': lockId}));
|
||||||
|
|
||||||
@ -347,6 +389,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
addlockGroupURL.toUrl,
|
addlockGroupURL.toUrl,
|
||||||
jsonEncode({'groupName': groupName, 'operatorUid': operatorUid}));
|
jsonEncode({'groupName': groupName, 'operatorUid': operatorUid}));
|
||||||
|
|
||||||
|
Future<Response> setLockGroup(String lockId, String groupId) => post(
|
||||||
|
setlockGroupURL.toUrl,
|
||||||
|
jsonEncode({'lockId': lockId, 'groupId': groupId}));
|
||||||
|
|
||||||
Future<Response> lockGroupList(String type) =>
|
Future<Response> lockGroupList(String type) =>
|
||||||
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
|
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
|
||||||
|
|
||||||
@ -374,8 +420,32 @@ class ApiProvider extends BaseProvider {
|
|||||||
lockListByGroupURL.toUrl,
|
lockListByGroupURL.toUrl,
|
||||||
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
||||||
|
|
||||||
|
Future<Response> listLockByGroup(String type, String keyGroupId) => post(
|
||||||
|
listLockByGroupURL.toUrl,
|
||||||
|
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
||||||
|
|
||||||
Future<Response> getKeyDetail(String lockId) =>
|
Future<Response> getKeyDetail(String lockId) =>
|
||||||
post(getKeyDetailURL.toUrl, jsonEncode({'lockId': lockId}));
|
post(getKeyDetailURL.toUrl, jsonEncode({'lockId': lockId}));
|
||||||
|
|
||||||
|
Future<Response> lockUserList(
|
||||||
|
String pageNo, String pageSize, String searchStr) =>
|
||||||
|
post(
|
||||||
|
lockUserListURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'pageNo': pageNo,
|
||||||
|
'pageSize': pageSize,
|
||||||
|
'searchStr': searchStr
|
||||||
|
}));
|
||||||
|
|
||||||
|
Future<Response> canSendKey(
|
||||||
|
String endDate, String keyGroupIdList, String lockIdList) =>
|
||||||
|
post(
|
||||||
|
canSendKeyURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'endDate': endDate,
|
||||||
|
'keyGroupIdList': keyGroupIdList,
|
||||||
|
'lockIdList': lockIdList
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/login/seletCountryRegion/common/countryRegionEntity.dart';
|
import 'package:star_lock/login/seletCountryRegion/common/countryRegionEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/lockUserListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
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/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
@ -311,6 +313,36 @@ class ApiRepository {
|
|||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//自定义密码
|
||||||
|
Future<PasswordKeyEntity> addPasswordKey(
|
||||||
|
String lockId,
|
||||||
|
String keyboardPwdName,
|
||||||
|
String keyboardPwd,
|
||||||
|
String keyboardPwdType,
|
||||||
|
String startDate,
|
||||||
|
String endDate,
|
||||||
|
String addType,
|
||||||
|
) async {
|
||||||
|
final res = await apiProvider.addKeyboardPwd(lockId, keyboardPwdName,
|
||||||
|
keyboardPwd, keyboardPwdType, startDate, endDate, addType);
|
||||||
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改密码
|
||||||
|
Future<PasswordKeyEntity> updatePasswordKey(
|
||||||
|
String lockId,
|
||||||
|
String keyboardPwdId,
|
||||||
|
String keyboardPwdName,
|
||||||
|
String newKeyboardPwd,
|
||||||
|
String startDate,
|
||||||
|
String endDate,
|
||||||
|
String changeType,
|
||||||
|
) async {
|
||||||
|
final res = await apiProvider.updateKeyboardPwd(lockId, keyboardPwdId,
|
||||||
|
keyboardPwdName, newKeyboardPwd, startDate, endDate, changeType);
|
||||||
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//清空操作记录
|
//清空操作记录
|
||||||
Future<KeyOperationRecordEntity> clearOperationRecord(String lockId) async {
|
Future<KeyOperationRecordEntity> clearOperationRecord(String lockId) async {
|
||||||
final res = await apiProvider.clearOperationRecord(lockId);
|
final res = await apiProvider.clearOperationRecord(lockId);
|
||||||
@ -324,6 +356,13 @@ class ApiRepository {
|
|||||||
return LockGroupListEntity.fromJson(res.body);
|
return LockGroupListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置锁分组
|
||||||
|
Future<LockGroupListEntity> setLockGroup(
|
||||||
|
String lockId, String groupId) async {
|
||||||
|
final res = await apiProvider.setLockGroup(lockId, groupId);
|
||||||
|
return LockGroupListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//锁分组列表
|
//锁分组列表
|
||||||
Future<LockGroupListEntity> lockGroupList(String type) async {
|
Future<LockGroupListEntity> lockGroupList(String type) async {
|
||||||
final res = await apiProvider.lockGroupList(type);
|
final res = await apiProvider.lockGroupList(type);
|
||||||
@ -364,9 +403,31 @@ class ApiRepository {
|
|||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//分组下的锁列表
|
||||||
|
Future<MassSendLockGroupListEntity> listLockByGroup(
|
||||||
|
String type, String keyGroupId) async {
|
||||||
|
final res = await apiProvider.listLockByGroup(type, keyGroupId);
|
||||||
|
return MassSendLockGroupListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//获取单把钥匙详情信息
|
//获取单把钥匙详情信息
|
||||||
Future<KeyDetailEntity> getKeyDetail(String lockId) async {
|
Future<KeyDetailEntity> getKeyDetail(String lockId) async {
|
||||||
final res = await apiProvider.getKeyDetail(lockId);
|
final res = await apiProvider.getKeyDetail(lockId);
|
||||||
return KeyDetailEntity.fromJson(res.body);
|
return KeyDetailEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//锁用户列表
|
||||||
|
Future<LockUserListEntity> lockUserList(
|
||||||
|
String pageNo, String pageSize, String searchStr) async {
|
||||||
|
final res = await apiProvider.lockUserList(pageNo, pageSize, searchStr);
|
||||||
|
return LockUserListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//群发钥匙检查
|
||||||
|
Future<KeyDetailEntity> canSendKey(
|
||||||
|
String endDate, String keyGroupIdList, String lockIdList) async {
|
||||||
|
final res =
|
||||||
|
await apiProvider.canSendKey(endDate, keyGroupIdList, lockIdList);
|
||||||
|
return KeyDetailEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_connect/http/src/request/request.dart';
|
import 'package:get/get_connect/http/src/request/request.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginData.dart';
|
||||||
|
|
||||||
import '../login/login/entity/LoginEntity.dart';
|
import '../login/login/entity/LoginEntity.dart';
|
||||||
import '../tools/platform_info_services.dart';
|
import '../tools/platform_info_services.dart';
|
||||||
@ -18,7 +19,9 @@ FutureOr<Request> requestInterceptor(Request request) async {
|
|||||||
String? xToken = '';
|
String? xToken = '';
|
||||||
final data = await Storage.getString('userLoginData');
|
final data = await Storage.getString('userLoginData');
|
||||||
if (data != null && data.isNotEmpty) {
|
if (data != null && data.isNotEmpty) {
|
||||||
xToken = LoginEntity.fromJson(jsonDecode(data)).data!.accessToken;
|
LoginData loginData = LoginData.fromJson(jsonDecode(data));
|
||||||
|
xToken = loginData.accessToken;
|
||||||
|
// xToken = LoginEntity.fromJson(jsonDecode(data)).data!.accessToken;
|
||||||
}
|
}
|
||||||
request.headers['Authorization'] = "Bearer ${xToken ?? ''}";
|
request.headers['Authorization'] = "Bearer ${xToken ?? ''}";
|
||||||
return request;
|
return request;
|
||||||
|
|||||||
@ -87,11 +87,11 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
// Image.asset(
|
||||||
widget.imgName,
|
// widget.imgName,
|
||||||
width: 36.w,
|
// width: 36.w,
|
||||||
height: 36.w,
|
// height: 36.w,
|
||||||
),
|
// ),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user