# Conflicts:
#	star_lock/lib/appRouters.dart
#	star_lock/lib/main/lockDetail/checkingIn/checkingInSetStaffList/checkingInStaffList_page.dart
#	star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart
#	star_lock/lib/network/api_provider.dart
#	star_lock/lib/network/api_repository.dart
#	star_lock/lib/network/request_interceptor.dart
This commit is contained in:
魏少阳 2023-09-15 16:15:31 +08:00
commit dd69edd4e8
47 changed files with 2653 additions and 809 deletions

25
star_lock/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,25 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "star_lock",
"request": "launch",
"type": "dart"
},
{
"name": "star_lock (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "star_lock (release mode)",
"request": "launch",
"type": "dart",
"flutterMode": "release"
}
]
}

View File

@ -136,7 +136,7 @@
"lockEscalation":"锁升级", "lockEscalation":"锁升级",
"markedHouseState":"标记房态", "markedHouseState":"标记房态",
"unlockReminder":"开锁提醒", "unlockReminder":"开锁提醒",
"unlockQRCode":"开锁二维码", "unlockQRCode":"微信二维码",
"lockNumber":"锁编号", "lockNumber":"锁编号",
"electricQuantity":"电量", "electricQuantity":"电量",
"lockName":"名称", "lockName":"名称",

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -1,15 +1,22 @@
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:get/get.dart';
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
import 'package:star_lock/login/register/starLock_register_binding.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart';
import 'package:star_lock/main/lockDetail/checkingIn/checkingInSetStaffList/checkingInStaffList_page.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.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/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/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_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/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/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/mineSet_page.dart';
import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_page.dart'; import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_page.dart';
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation_page.dart'; import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation_page.dart';
@ -301,6 +308,8 @@ abstract class Routers {
static const massSendLockGroupPage = '/massSendLockGroupPage'; // static const massSendLockGroupPage = '/massSendLockGroupPage'; //
static const massSendReceiverPage = '/massSendReceiverPage'; // static const massSendReceiverPage = '/massSendReceiverPage'; //
static const lockUserListPage = '/lockUserListPage'; // static const lockUserListPage = '/lockUserListPage'; //
static const administratorDetailsPage = '/administratorDetailsPage'; //
static const expireLockListPage = '/expireLockListPage'; //
} }
abstract class AppRouters { abstract class AppRouters {
@ -706,7 +715,7 @@ abstract class AppRouters {
page: () => const AuthorizedAdministratorListPage()), page: () => const AuthorizedAdministratorListPage()),
GetPage( GetPage(
name: Routers.lockUserManageLisPage, name: Routers.lockUserManageLisPage,
page: () => const LockUserManageListListPage()), page: () => const LockUserManageListPage()),
GetPage( GetPage(
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()), name: Routers.lockGroupListPage, page: () => const LockGroupListPage()),
GetPage( GetPage(
@ -753,7 +762,7 @@ abstract class AppRouters {
GetPage( GetPage(
name: Routers.configuringWifiPage, name: Routers.configuringWifiPage,
page: () => const ConfiguringWifiPage()), page: () => const ConfiguringWifiPage()),
GetPage( GetPage(
name: Routers.massSendLockGroupPage, name: Routers.massSendLockGroupPage,
page: () => const MassSendLockGroupListPage()), page: () => const MassSendLockGroupListPage()),
GetPage( GetPage(
@ -766,5 +775,13 @@ abstract class AppRouters {
GetPage( GetPage(
name: Routers.checkingInStaffDetailPage, page: () => const CheckingInStaffDetailPage()) name: Routers.checkingInStaffDetailPage, page: () => const CheckingInStaffDetailPage())
name: Routers.checkInCreatCompanyPage,
page: () => const CheckInCreatCompanyPage()),
GetPage(
name: Routers.administratorDetailsPage,
page: () => const AdministratorDetailsPage()),
GetPage(
name: Routers.expireLockListPage,
page: () => const ExpireLockListPage())
]; ];
} }

View File

@ -452,7 +452,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
value: _isAuthentication, value: _isAuthentication,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
_isAuthentication = value; _isAuthentication = !_isAuthentication;
}); });
}, },
); );

View File

@ -1,8 +1,14 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
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: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:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
@ -23,27 +29,71 @@ class VolumeAuthorizationLockPage extends StatefulWidget {
class _VolumeAuthorizationLockPageState class _VolumeAuthorizationLockPageState
extends State<VolumeAuthorizationLockPage> { extends State<VolumeAuthorizationLockPage> {
final FlutterContactPicker _contactPicker = FlutterContactPicker(); final FlutterContactPicker _contactPicker = FlutterContactPicker();
final TextEditingController _emailOrPhoneController =
TextEditingController(); ///
final TextEditingController _keyNameController =
TextEditingController(); //
late Contact _contact; late Contact _contact;
late List _lockIdList;
late bool _isSendSuccess;
late bool _isCreateUser; //
late bool _isRemoteUnlock; //
var _selectEffectiveDate = ''; //
var _selectFailureDate = ''; //
late DateTime _effectiveDateTime;
late DateTime _failureDateTime;
String countryName = '中国';
String countryCode = '86';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return indexChangeWidget(); return SingleChildScrollView(
child: indexChangeWidget(),
);
} }
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
_lockIdList = [];
_isRemoteUnlock = false;
_isSendSuccess = false;
_isCreateUser = false;
DateTime dateTime = DateTime.now();
_effectiveDateTime = dateTime;
_failureDateTime = dateTime;
_selectEffectiveDate =
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //
_selectFailureDate =
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //
} }
Widget indexChangeWidget() { Widget indexChangeWidget() {
switch (int.parse(widget.type)) { if (_isSendSuccess) {
case 0: return sendElectronicKeySucceed();
{ } else {
// switch (int.parse(widget.type)) {
case 0:
{
//
return Column(
children: [
keyInfoWidget(),
remoteUnlockingWidget(),
SizedBox(
height: 30.h,
),
keyBottomWidget()
],
);
}
default:
//
return Column( return Column(
children: [ children: [
keyInfoWidget(), keyInfoWidget(),
keyTimeWidget(),
remoteUnlockingWidget(), remoteUnlockingWidget(),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
@ -51,20 +101,7 @@ class _VolumeAuthorizationLockPageState
keyBottomWidget() keyBottomWidget()
], ],
); );
} }
default:
//
return Column(
children: [
keyInfoWidget(),
keyTimeWidget(),
remoteUnlockingWidget(),
SizedBox(
height: 30.h,
),
keyBottomWidget()
],
);
} }
} }
@ -74,18 +111,43 @@ class _VolumeAuthorizationLockPageState
children: [ children: [
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.number!.tr, leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: getTFWidget( rightWidget: getTFWidget(
true, TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr)), 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( CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr, leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: "", rightTitle: "",
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: rightWidget: getTFWidget(
getTFWidget(false, TranslationLoader.lanKeys!.pleaseEnter!.tr)), false,
TranslationLoader.lanKeys!.pleaseEnter!.tr,
_keyNameController)),
Container(height: 10.h), Container(height: 10.h),
], ],
); );
@ -97,12 +159,33 @@ class _VolumeAuthorizationLockPageState
children: [ children: [
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: "2020.06.20 11:49", rightTitle: _selectEffectiveDate,
isHaveLine: true), isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
_selectEffectiveDate =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
});
});
}),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: "2020.06.20 11:49", rightTitle: _selectFailureDate,
), isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
_selectFailureDate =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
_failureDateTime = DateTime.parse(_selectFailureDate);
});
});
}),
Container(height: 10.h), Container(height: 10.h),
], ],
); );
@ -114,9 +197,22 @@ class _VolumeAuthorizationLockPageState
children: [ children: [
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.lock!.tr, leftTitel: TranslationLoader.lanKeys!.lock!.tr,
rightTitle: TranslationLoader.lanKeys!.pleaseSelet!.tr, rightTitle: _lockIdList.isEmpty
? TranslationLoader.lanKeys!.pleaseSelet!.tr
: _lockIdList.length.toString(),
isHaveDirection: true, isHaveDirection: true,
action: () {}), action: () {
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
.then((value) {
//ID列表
if (value != null) {
value as Map<String, dynamic>;
_lockIdList = value['selectLockIdList'];
setState(() {});
}
});
}),
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr, leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
@ -138,21 +234,23 @@ class _VolumeAuthorizationLockPageState
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w), margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () { onClick: () {
// Navigator.pushNamed(context, Routers.nearbyLockPage); addAuthorizedAdminRequest();
}), }),
], ],
); );
} }
// //
Widget getTFWidget(bool isHaveBtn, String tfStr) { Widget getTFWidget(
return Container( bool isHaveBtn, String tfStr, TextEditingController editController) {
return SizedBox(
height: 50.h, height: 50.h,
width: 300.w, width: 300.w,
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: TextField( child: TextField(
controller: editController,
// //
maxLines: 1, maxLines: 1,
// controller: _controller, // controller: _controller,
@ -198,18 +296,127 @@ class _VolumeAuthorizationLockPageState
); );
} }
//
Future<void> addAuthorizedAdminRequest() async {
String getFailureDateTime = '0';
String getEffectiveDateTime = '0';
if (widget.type == '1') {
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
getEffectiveDateTime =
_effectiveDateTime.millisecondsSinceEpoch.toString();
}
var entity = await ApiRepository.to.addAuthorizedAdmin(
_isCreateUser ? "1" : "0",
getFailureDateTime,
_isRemoteUnlock == true ? '1' : '2',
[],
_lockIdList,
_keyNameController.text,
getEffectiveDateTime,
_emailOrPhoneController.text,
countryCode,
'1',
);
if (entity.errorCode!.codeIsSuccessful) {
print('发送电子钥匙成功');
_isSendSuccess = true;
setState(() {});
} else {
Toast.show(msg: '${entity.errorMsg}');
if (entity.errorCode == 425) {
//
_isCreateUser = true;
}
}
}
//
Widget sendElectronicKeySucceed() {
return Column(
children: [
Container(
height: 250.h,
width: 1.sw,
color: Colors.white,
child: Column(
children: [
SizedBox(
height: 30.h,
),
Image.asset(
'images/icon_send_success.png',
width: 100.w,
height: 100.w,
),
SizedBox(
height: 20.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"发送成功",
style: TextStyle(
fontSize: 26.sp,
color: Colors.black,
fontWeight: FontWeight.w500),
),
],
),
],
),
),
SizedBox(
height: 20.h,
),
SubmitBtn(
btnName: '完成',
onClick: () {
_isSendSuccess = false;
Navigator.pop(context, true);
}),
SizedBox(
height: 10.h,
),
OutLineBtn(
btnName: '邮件通知',
onClick: () {
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
},
),
SizedBox(
height: 10.h,
),
OutLineBtn(
btnName: '微信通知',
onClick: () {},
),
SizedBox(
height: 10.h,
),
OutLineBtn(
btnName: '标记为已入住',
onClick: () {},
),
],
);
}
CupertinoSwitch _switch() { CupertinoSwitch _switch() {
bool _isOn = false;
return CupertinoSwitch( return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: _isOn, value: _isRemoteUnlock,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
_isOn = value; _isRemoteUnlock = !_isRemoteUnlock;
}); });
}, },
); );
} }
String intToStr(int v) {
return (v < 10) ? "0$v" : "$v";
}
} }

View File

@ -0,0 +1,117 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'checkingInStaffList_logic.dart';
class CheckingInStaffListPage extends StatefulWidget {
const CheckingInStaffListPage({Key? key}) : super(key: key);
@override
State<CheckingInStaffListPage> createState() =>
_CheckingInStaffListPageState();
}
class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
final logic = Get.put(CheckingInStaffManageLogic());
final state = Get.find<CheckingInStaffManageLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.greyBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.staff!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
GestureDetector(
onTap: () {
Navigator.pushNamed(context, Routers.checkingInAddStaffPage,
arguments: {
"getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value
});
},
child: Image.asset(
'images/icon_add_white.png',
width: 36.w,
height: 36.w,
)),
SizedBox(
width: 30.w,
),
],
),
body: Container(
color: Colors.white,
child: ListView.separated(
itemCount: 10,
itemBuilder: (c, index) {
return _checkingInStaffManageItem('images/icon_lock.png', "张三",
"2023.6.21 11.15", "2023.6.21 11.15", () {
// Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
});
},
separatorBuilder: (context, index) {
return const Divider(
height: 1, indent: 20, color: AppColors.greyLineColor);
},
),
));
}
Widget _checkingInStaffManageItem(String lockTypeIcon, String lockTypeTitle,
String beginTime, String endTime, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
height: 60.h,
margin:
EdgeInsets.only(left: 10.w, right: 10.w, top: 10.h, bottom: 10.h),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(10.w),
// ),
child: Row(
children: [
SizedBox(
width: 30.w,
),
Image.asset(
'images/controls_user.png',
width: 40.w,
height: 40.w,
),
// Container(
// width: 60.h,
// height: 60.h,
// decoration: BoxDecoration(
// color: AppColors.mainColor,
// border: Border.all(width: 1, color: AppColors.mainColor),
// borderRadius: BorderRadius.circular(30.h),
// ),
// padding: EdgeInsets.all(10.w),
// child: Image.asset(
// 'images/controls_user.png',
// width: 40.w,
// height: 40.w,
// color: Colors.white,
// )),
SizedBox(
width: 30.w,
),
Text(
lockTypeTitle,
style: TextStyle(fontSize: 24.sp),
),
],
),
),
);
}
}

View File

@ -1,7 +1,14 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
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:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:star_lock/app_settings/app_colors.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/toast.dart';
import '../../../../../tools/commonItem.dart'; import '../../../../../tools/commonItem.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
@ -22,6 +29,18 @@ class MassSendElectronicKeyPage extends StatefulWidget {
class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> { class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
final FlutterContactPicker _contactPicker = FlutterContactPicker(); final FlutterContactPicker _contactPicker = FlutterContactPicker();
late Contact _contact; late Contact _contact;
var _selectEffectiveDate = ''; //
var _selectFailureDate = ''; //
late DateTime _effectiveDateTime;
late DateTime _failureDateTime;
late bool _isSendSuccess;
late bool _isRemote; //
List _receiverList = []; //
List _lockIdList = []; //ID列表
String countryName = '中国';
String countryCode = '86';
List weekdaysList = [];
bool _isCreateUser = false; //1 0
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -31,6 +50,16 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
DateTime dateTime = DateTime.now();
_effectiveDateTime = dateTime;
_failureDateTime = dateTime;
_selectEffectiveDate =
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //
_selectFailureDate =
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //
_isSendSuccess = false;
_isRemote = false;
} }
Widget indexChangeWidget() { Widget indexChangeWidget() {
@ -75,6 +104,58 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
} }
} }
//
Future<void> MassKeyChecksRequest() async {
String getFailureDateTime = '0';
if (int.parse(widget.type) != 1) {
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
}
var entity =
await ApiRepository.to.canSendKey(getFailureDateTime, [], _lockIdList);
if (entity.errorCode!.codeIsSuccessful) {
for (int i = 0; i < _receiverList.length; i++) {
LockUserData data = _receiverList[i];
batchSendElectronicKeyRequest(data.userid ?? '');
}
} else {
Toast.show(msg: '检查失败');
}
}
//
Future<void> batchSendElectronicKeyRequest(String receiverUserID) async {
String getFailureDateTime = '0';
String getEffectiveDateTime = '0';
if (widget.type == '0') {
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
getEffectiveDateTime =
_effectiveDateTime.millisecondsSinceEpoch.toString();
}
var entity = await ApiRepository.to.batchSendKey(
getFailureDateTime,
[],
_lockIdList,
'1',
_isRemote ? '1' : '2',
receiverUserID,
receiverUserID,
getEffectiveDateTime,
countryCode,
'1',
weekdaysList);
if (entity.errorCode!.codeIsSuccessful) {
print('群发电子钥匙成功');
_isSendSuccess = true;
setState(() {});
} else {
Toast.show(msg: '${entity.errorMsg}');
if (entity.errorCode == 425) {
//
_isCreateUser = true;
}
}
}
// widget // widget
Widget keyInfoWidget() { Widget keyInfoWidget() {
return Column( return Column(
@ -82,18 +163,60 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.receiver!.tr, leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
rightTitle: TranslationLoader.lanKeys!.pleaseAdd!.tr, rightTitle: _receiverList.isEmpty
? TranslationLoader.lanKeys!.pleaseAdd!.tr
: _receiverList.length.toString(),
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed(context, Routers.massSendReceiverPage); Navigator.pushNamed(context, Routers.massSendReceiverPage)
.then((value) {
if (value != null) {
value as Map<String, dynamic>;
_receiverList = value['lockUserList'];
setState(() {});
}
});
}), }),
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( CommonItem(
leftTitel: TranslationLoader.lanKeys!.lock!.tr, leftTitel: TranslationLoader.lanKeys!.lock!.tr,
rightTitle: TranslationLoader.lanKeys!.pleaseSelet!.tr, rightTitle: _lockIdList.isEmpty
? TranslationLoader.lanKeys!.pleaseSelet!.tr
: _lockIdList.length.toString(),
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed(context, Routers.massSendLockGroupPage); Navigator.pushNamed(context, Routers.massSendLockGroupPage)
.then((value) {
//ID列表
if (value != null) {
value as Map<String, dynamic>;
_lockIdList = value['selectLockIdList'];
setState(() {});
}
});
}), }),
Container(height: 10.h), Container(height: 10.h),
], ],
@ -106,12 +229,33 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
children: [ children: [
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: "2020.06.20 11:49", rightTitle: _selectEffectiveDate,
isHaveLine: true), isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
_selectEffectiveDate =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
});
});
}),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: "2020.06.20 11:49", rightTitle: _selectFailureDate,
), isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
_selectFailureDate =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
_failureDateTime = DateTime.parse(_selectFailureDate);
});
});
}),
Container(height: 10.h), Container(height: 10.h),
], ],
); );
@ -155,24 +299,27 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
SubmitBtn( SubmitBtn(
btnName: TranslationLoader.lanKeys!.send!.tr, btnName: TranslationLoader.lanKeys!.send!.tr,
onClick: () { onClick: () {
// Navigator.pushNamed(context, Routers.nearbyLockPage); MassKeyChecksRequest();
}), }),
], ],
); );
} }
CupertinoSwitch _switch() { CupertinoSwitch _switch() {
bool _isOn = false;
return CupertinoSwitch( return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: _isOn, value: _isRemote,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
_isOn = value; _isRemote = !_isRemote;
}); });
}, },
); );
} }
String intToStr(int v) {
return (v < 10) ? "0$v" : "$v";
}
} }

View File

@ -1,10 +1,8 @@
import 'dart:ui';
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/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/massSendReceiver/lockUserListEntity.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/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
@ -162,7 +160,7 @@ class _LockUserListPageState extends State<LockUserListPage> {
Row( Row(
children: [ children: [
Text( Text(
itemData.nickname!, itemData.nickname ?? '',
style: TextStyle( style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor), fontSize: 24.sp, color: AppColors.blackColor),
) )
@ -173,7 +171,7 @@ class _LockUserListPageState extends State<LockUserListPage> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
itemData.userid!, itemData.userid ?? '',
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.placeholderTextColor), color: AppColors.placeholderTextColor),

View File

@ -0,0 +1,85 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
typedef _CallBack = void Function(int selectIndex, String selectLockId);
class massSendLockGroupCell extends StatelessWidget {
final int currentIndex;
List lockListByGroup;
final _CallBack selectLockAction;
massSendLockGroupCell(int index,
{Key? key,
required this.currentIndex,
required this.lockListByGroup,
required this.selectLockAction})
: super(key: key);
@override
Widget build(BuildContext context) {
return ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: lockListByGroup.length,
itemBuilder: (_, itemIndex) {
LockListItem itemData = lockListByGroup[itemIndex];
return _itemBuilder(itemData, itemIndex);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
);
}
Widget _itemBuilder(LockListItem itemData, int itemIndex) {
return GestureDetector(
child: Container(
height: 60.h,
color: Colors.white,
width: ScreenUtil().screenWidth,
child: Row(
children: [
SizedBox(
width: 30.w,
),
Image.asset(
'images/mine/icon_mine_gatewaySignal_prompt.png',
width: 36.w,
height: 36.w,
),
SizedBox(
width: 10.w,
),
Text(
itemData.lockAlias!,
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
),
Expanded(
child: SizedBox(
width: 20.w,
)),
Image.asset(
itemData.isChecked
? "images/icon_round_selet.png"
: "images/icon_round_unSelet.png",
width: 30.w,
height: 30.w,
),
SizedBox(
width: 30.w,
)
],
),
),
onTap: () {
selectLockAction(itemIndex, itemData.lockId.toString());
},
);
}
}

View File

@ -2,7 +2,7 @@ class MassSendLockGroupListEntity {
int? errorCode; int? errorCode;
String? description; String? description;
String? errorMsg; String? errorMsg;
LockListData? data; GroupListData? data;
MassSendLockGroupListEntity( MassSendLockGroupListEntity(
{this.errorCode, this.description, this.errorMsg, this.data}); {this.errorCode, this.description, this.errorMsg, this.data});
@ -11,7 +11,7 @@ class MassSendLockGroupListEntity {
errorCode = json['errorCode']; errorCode = json['errorCode'];
description = json['description']; description = json['description'];
errorMsg = json['errorMsg']; errorMsg = json['errorMsg'];
data = json['data'] != null ? LockListData.fromJson(json['data']) : null; data = json['data'] != null ? GroupListData.fromJson(json['data']) : null;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -26,15 +26,49 @@ class MassSendLockGroupListEntity {
} }
} }
class LockListData { class GroupListData {
List<LockListItem>? lockList; List<GroupListItem>? groupList;
LockListData({this.lockList}); GroupListData({this.groupList});
LockListData.fromJson(Map<String, dynamic> json) { GroupListData.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) { if (json['list'] != null) {
lockList = <LockListItem>[]; groupList = <GroupListItem>[];
json['list'].forEach((v) { json['list'].forEach((v) {
groupList!.add(GroupListItem.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (groupList != null) {
data['list'] = groupList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class GroupListItem {
int? lockNum;
int? keyGroupId;
String? keyGroupName;
List<LockListItem>? lockList;
bool _isChecked = false;
bool get isChecked => _isChecked ?? false;
set isChecked(bool value) => _isChecked = value;
GroupListItem(
{this.lockNum, this.keyGroupId, this.keyGroupName, this.lockList});
GroupListItem.fromJson(Map<String, dynamic> json) {
lockNum = json['lockNum'];
keyGroupId = json['keyGroupId'];
keyGroupName = json['keyGroupName'];
if (json['lockList'] != null) {
lockList = <LockListItem>[];
json['lockList'].forEach((v) {
lockList!.add(LockListItem.fromJson(v)); lockList!.add(LockListItem.fromJson(v));
}); });
} }
@ -42,8 +76,11 @@ class LockListData {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
data['lockNum'] = lockNum;
data['keyGroupId'] = keyGroupId;
data['keyGroupName'] = keyGroupName;
if (lockList != null) { if (lockList != null) {
data['list'] = lockList!.map((v) => v.toJson()).toList(); data['lockList'] = lockList!.map((v) => v.toJson()).toList();
} }
return data; return data;
} }
@ -52,9 +89,12 @@ class LockListData {
class LockListItem { class LockListItem {
int? lockId; int? lockId;
String? lockAlias; String? lockAlias;
bool? isRefresh = false; bool _isChecked = false;
bool get isChecked => _isChecked ?? false;
LockListItem({this.lockId, this.lockAlias, this.isRefresh}); set isChecked(bool value) => _isChecked = value;
LockListItem({this.lockId, this.lockAlias});
LockListItem.fromJson(Map<String, dynamic> json) { LockListItem.fromJson(Map<String, dynamic> json) {
lockId = json['lockId']; lockId = json['lockId'];

View File

@ -2,11 +2,12 @@ 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/massSendLockGroupCell.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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/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/tools/baseGetXController.dart';
import 'package:star_lock/tools/submitBtn.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 {
@ -19,9 +20,10 @@ class MassSendLockGroupListPage extends StatefulWidget {
} }
class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> { class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
List lockListByGroup = [];
List lockGroupList = []; List lockGroupList = [];
List clickIndexList = []; List selectGroupIdList = [];
List selectLockIdList = [];
int clickIndex = -1;
@override @override
void initState() { void initState() {
@ -66,6 +68,15 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
height: 10.h, height: 10.h,
), ),
Expanded(child: _buildListView(context, lockGroupList)), Expanded(child: _buildListView(context, lockGroupList)),
SubmitBtn(
btnName: '确定',
onClick: () {
print('得到lockid为$selectLockIdList ');
Map<String, dynamic> resultMap = {};
resultMap['selectLockIdList'] = selectLockIdList;
Navigator.pop(context, resultMap);
},
),
SizedBox( SizedBox(
height: 40.h, height: 40.h,
) )
@ -74,12 +85,13 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
} }
// //
Future<List<LockGroupItem>> mockNetworkDataRequest() async { Future<List<GroupListItem>> mockNetworkDataRequest() async {
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1'); MassSendLockGroupListEntity entity =
List<LockGroupItem> dataList = []; await ApiRepository.to.lockGroupList('1');
List<GroupListItem> dataList = [];
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) { if (entity.data != null) {
dataList = entity.data!.itemList!; dataList = entity.data!.groupList!;
} }
} }
lockGroupList = dataList; lockGroupList = dataList;
@ -87,27 +99,11 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
return dataList; return dataList;
} }
//
Future<List<LockListItem>> listLockByGroup(String groupId) async {
MassSendLockGroupListEntity entity =
await ApiRepository.to.listLockByGroup('3', groupId);
List<LockListItem> dataList = [];
if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) {
dataList = entity.data!.lockList!;
}
}
lockListByGroup = dataList;
setState(() {});
return dataList;
}
Widget _buildListView(BuildContext context, List itemList) { Widget _buildListView(BuildContext context, List itemList) {
return ListView.separated( return ListView.separated(
itemCount: itemList.length, itemCount: itemList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
LockGroupItem itemData = itemList[index]; GroupListItem itemData = itemList[index];
return _buildLockExpandedList(context, index, itemData); return _buildLockExpandedList(context, index, itemData);
}, },
shrinkWrap: true, shrinkWrap: true,
@ -120,73 +116,26 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
} }
// //
Widget _buildLockExpandedList(context, index, LockGroupItem itemData) { Widget _buildLockExpandedList(context, index, GroupListItem itemData) {
List lockItemList = itemData.lockList ?? [];
return ExpandedListTile( return ExpandedListTile(
onTap: () { onTap: () {
listLockByGroup(itemData.keyGroupId.toString()); selectGroupIdList.add(index);
clickIndexList.add(index); clickIndex = index;
}, },
title: itemData.keyGroupName!,
imgName: '',
typeImgList: const [], typeImgList: const [],
child: ListView.separated( groupItem: itemData,
physics: const NeverScrollableScrollPhysics(), child: massSendLockGroupCell(index,
shrinkWrap: true, currentIndex: index, lockListByGroup: lockItemList,
itemCount: lockListByGroup.length, selectLockAction: (selectIndex, selectLockId) {
itemBuilder: (_, itemIndex) { LockListItem lockItem = lockItemList[selectIndex];
LockListItem itemData = lockListByGroup[itemIndex]; setState(() {
return _buildNameWidget(context, itemIndex, lockItem.isChecked = !lockItem.isChecked;
'images/icon_password.png', itemData.lockAlias); if (lockItem.isChecked) {
}, selectLockIdList.add(lockItem.lockId);
separatorBuilder: (BuildContext context, int index) { }
return const Divider( });
height: 1, }),
color: AppColors.greyLineColor,
);
},
),
);
}
//
Widget _buildNameWidget(context, index, imageName, getName) {
return GestureDetector(
child: Container(
height: 60.h,
color: Colors.white,
width: ScreenUtil().screenWidth,
child: Row(
children: [
SizedBox(
width: 30.w,
),
Image.asset(
'images/mine/icon_mine_gatewaySignal_prompt.png',
width: 36.w,
height: 36.w,
),
SizedBox(
width: 10.w,
),
Text(
getName,
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(
width: 30.w,
)
],
),
),
onTap: () {
// selectNameIndex = index;
// setState(() {
// if (selectNameIndex == index) {
// isNameSelect = !isNameSelect;
// }
// });
},
); );
} }
} }

View File

@ -0,0 +1,155 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/translations/trans_lib.dart';
class MassSendReceiverCell extends StatelessWidget {
final int currentIndex;
LockUserData userData;
final VoidCallback clickDeleteUser;
MassSendReceiverCell(int index,
{Key? key,
required this.currentIndex,
required this.userData,
required this.clickDeleteUser})
: super(key: key);
@override
Widget build(BuildContext context) {
TextEditingController emailOrPhoneController = TextEditingController();
TextEditingController keyNameController = TextEditingController();
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: () {
clickDeleteUser();
// _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,
userData)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: userData.nickname ?? ' ',
isHaveRightWidget: true,
rightWidget: getTFWidget(
false,
TranslationLoader.lanKeys!.enterYourName!.tr,
2,
userData)),
],
))
],
),
);
}
TextEditingController _receiverController(String getStr) {
TextEditingController controller = TextEditingController(text: getStr);
controller.addListener(() {
print(controller.text);
});
return controller;
}
TextEditingController _nickNameController(String getStr) {
TextEditingController controller = TextEditingController(text: getStr);
controller.addListener(() {
print(controller.text);
});
return controller;
}
//
Widget getTFWidget(
bool isHaveBtn, String tfStr, int lineIndex, LockUserData userData) {
return SizedBox(
height: 50.h,
width: 380.w,
child: Row(
children: [
Expanded(
child: TextField(
controller: lineIndex == 1
? _receiverController(userData.userid ?? '')
: _nickNameController(userData.nickname ?? ''),
//
maxLines: 1,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.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()
],
),
);
}
}

View File

@ -3,7 +3,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/utils.dart'; import 'package:get/utils.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.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/massSendReceiver/lockUserListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart';
import 'package:star_lock/tools/commonItem.dart'; import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/translations/trans_lib.dart'; import 'package:star_lock/translations/trans_lib.dart';
@ -38,7 +39,7 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
appBar: AppBar( appBar: AppBar(
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
title: Text( title: Text(
'接收者', TranslationLoader.lanKeys!.receiver!.tr,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 28.sp, fontSize: 28.sp,
@ -49,6 +50,19 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
icon: const Icon(Icons.arrow_back_ios, color: Colors.white), icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
actions: [
TextButton(
child: Text(
TranslationLoader.lanKeys!.save!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
Map<String, dynamic> resultMap = {};
resultMap['lockUserList'] = _lockUserList;
Navigator.pop(context, resultMap);
},
),
],
), ),
body: Column( body: Column(
children: [ children: [
@ -83,6 +97,9 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
child: ListView.separated( child: ListView.separated(
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
LockUserData data = _lockUserList[index]; LockUserData data = _lockUserList[index];
emailOrPhoneController.text = data.userid ?? '';
keyNameController.text = data.nickname ?? '';
return _itemBuilder(index, data); return _itemBuilder(index, data);
}, },
itemCount: _lockUserList.length, itemCount: _lockUserList.length,
@ -149,110 +166,14 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
} }
Widget _itemBuilder(int index, LockUserData userData) { Widget _itemBuilder(int index, LockUserData userData) {
return Container( return MassSendReceiverCell(
color: Colors.white, index,
child: Row( currentIndex: index,
children: [ userData: userData,
GestureDetector( clickDeleteUser: () {
child: SizedBox( _lockUserList.removeAt(index - 1);
width: 40.w, setState(() {});
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()
],
),
); );
} }
} }

View File

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

View File

@ -128,12 +128,21 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
leftTitel: TranslationLoader leftTitel: TranslationLoader
.lanKeys!.adminOpenLockPassword!.tr, .lanKeys!.adminOpenLockPassword!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: false, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed(context, Navigator.pushNamed(context,
Routers.adminOpenLockPasswordPage); Routers.adminOpenLockPasswordPage);
}), }),
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.unlockQRCode!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.unlockQRCodePage);
}),
], ],
), ),
), ),

View File

@ -1,8 +1,8 @@
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/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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/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/showTFView.dart';
@ -38,10 +38,10 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
barTitle: TranslationLoader.lanKeys!.selectGroup!.tr, barTitle: TranslationLoader.lanKeys!.selectGroup!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: FutureBuilder<List<LockGroupItem>>( body: FutureBuilder<List<GroupListItem>>(
future: mockNetworkDataRequest(), future: mockNetworkDataRequest(),
builder: (BuildContext context, builder: (BuildContext context,
AsyncSnapshot<List<LockGroupItem>> snapshot) { AsyncSnapshot<List<GroupListItem>> snapshot) {
// //
if (snapshot.connectionState == ConnectionState.done) { if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) { if (snapshot.hasError) {
@ -49,7 +49,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
return const Text('请求失败'); return const Text('请求失败');
} else { } else {
// //
final List<LockGroupItem> itemData = snapshot.data!; final List<GroupListItem> itemData = snapshot.data!;
return Column( return Column(
children: [ children: [
@ -82,7 +82,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
return ListView.builder( return ListView.builder(
itemCount: itemList.length, itemCount: itemList.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
LockGroupItem itemData = itemList[index]; GroupListItem itemData = itemList[index];
return CommonItem( return CommonItem(
leftTitel: itemData.keyGroupName, leftTitel: itemData.keyGroupName,
rightTitle: "", rightTitle: "",
@ -107,7 +107,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
// //
Future<void> addLockGroupRequest() async { Future<void> addLockGroupRequest() async {
LockGroupListEntity entity = MassSendLockGroupListEntity entity =
await ApiRepository.to.addLockGroup(_changeNameController.text, '0'); await ApiRepository.to.addLockGroup(_changeNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "创建成功"); Toast.show(msg: "创建成功");
@ -117,8 +117,8 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
} }
// //
Future<void> setLockGroupRequest(LockGroupItem itemData) async { Future<void> setLockGroupRequest(GroupListItem itemData) async {
LockGroupListEntity entity = await ApiRepository.to.setLockGroup( MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
_lockData.lockId.toString(), itemData.keyGroupId.toString()); _lockData.lockId.toString(), itemData.keyGroupId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "设置锁分组成功"); Toast.show(msg: "设置锁分组成功");
@ -127,13 +127,14 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
} }
// //
Future<List<LockGroupItem>> mockNetworkDataRequest() async { Future<List<GroupListItem>> mockNetworkDataRequest() async {
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1'); MassSendLockGroupListEntity entity =
await ApiRepository.to.lockGroupList('1');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) { if (entity.data != null) {
return entity.data!.itemList!; return entity.data!.groupList!;
} else { } else {
List<LockGroupItem> dataList = []; List<GroupListItem> dataList = [];
return dataList; return dataList;
} }
} else { } else {

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
@ -21,73 +20,76 @@ import 'CheckingInInfoDataEntity.dart';
import 'lockSet_state.dart'; import 'lockSet_state.dart';
typedef BlockSetStateCallback = void Function(); typedef BlockSetStateCallback = void Function();
typedef BlockSetCheckInCallback = void Function(CheckingInInfoDataEntity checkingInInfoDataEntity); typedef BlockSetCheckInCallback = void Function(
CheckingInInfoDataEntity checkingInInfoDataEntity);
class LockSetLogic extends BaseGetXController{ class LockSetLogic extends BaseGetXController {
final LockSetState state = LockSetState(); final LockSetState state = LockSetState();
// //
void deletLockInfoData() async{ void deletLockInfoData() async {
var entity = await ApiRepository.to.deletLockData( var entity = await ApiRepository.to.deletLockData(
lockId:state.getKeyInfosData.value.lockId.toString(), lockId: state.getKeyInfosData.value.lockId.toString(),
); );
if(entity.errorCode!.codeIsSuccessful){ if (entity.errorCode!.codeIsSuccessful) {
Get.offAllNamed(Routers.starLockMain); Get.offAllNamed(Routers.starLockMain);
} }
} }
// //
void openCheckingInData(BlockSetCheckInCallback blockSetCheckInCallback) async{ void openCheckingInData(
BlockSetCheckInCallback blockSetCheckInCallback) async {
var entity = await ApiRepository.to.openCheckingInData( var entity = await ApiRepository.to.openCheckingInData(
lockId:state.getKeyInfosData.value.lockId.toString(), lockId: state.getKeyInfosData.value.lockId.toString(),
); );
if(entity.errorCode!.codeIsSuccessful){ if (entity.errorCode!.codeIsSuccessful) {
blockSetCheckInCallback(entity); blockSetCheckInCallback(entity);
} }
} }
// //
void setLockSetGeneralSetting(String isOn) async{ void setLockSetGeneralSetting(String isOn) async {
var entity = await ApiRepository.to.setLockSetGeneralSettingData( var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.getKeyInfosData.value.lockId.toString(),
changeType:"1", changeType: "1",
isOn:isOn, isOn: isOn,
type:"1", type: "1",
); );
if(entity.errorCode!.codeIsSuccessful){ if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.isAttendance = int.parse(isOn); state.getKeyInfosData.value.isAttendance = int.parse(isOn);
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); eventBus
.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "设置成功"); Toast.show(msg: "设置成功");
}else{ } else {}
}
} }
// //
void setLockPickingReminder() async{ void setLockPickingReminder() async {
var entity = await ApiRepository.to.setLockPickingReminderData( var entity = await ApiRepository.to.setLockPickingReminderData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.getKeyInfosData.value.lockId.toString(),
keyId:state.getKeyInfosData.value.keyId.toString(), keyId: state.getKeyInfosData.value.keyId.toString(),
monitorFlag:state.isLockPickingReminder.value == 1 ? "1" : "2", // 12 monitorFlag:
state.isLockPickingReminder.value == 1 ? "1" : "2", // 12
); );
if(entity.errorCode!.codeIsSuccessful){ if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.monitorFlag = state.isLockPickingReminder.value; state.getKeyInfosData.value.monitorFlag =
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); state.isLockPickingReminder.value;
eventBus
.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "设置成功"); Toast.show(msg: "设置成功");
}else{ } else {}
}
} }
// //
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) { _passCurrentLockInformationEvent =
eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
state.getKeyInfosData.value = event.keyInfo; state.getKeyInfosData.value = event.keyInfo;
blockSetStateCallback(); blockSetStateCallback();
}); });
@ -96,8 +98,9 @@ class LockSetLogic extends BaseGetXController{
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async { _replySubscription =
if(reply is DeletUserReply) { EventBusManager().eventBus!.on<Reply>().listen((reply) async {
if (reply is DeletUserReply) {
var tokenData = reply.data.sublist(2, 6); var tokenData = reply.data.sublist(2, 6);
var saveStrList = changeIntListToStringList(tokenData); var saveStrList = changeIntListToStringList(tokenData);
print("openDoorToken:$tokenData"); print("openDoorToken:$tokenData");
@ -105,45 +108,46 @@ class LockSetLogic extends BaseGetXController{
int status = reply.data[6]; int status = reply.data[6];
print("status:$status"); print("status:$status");
switch(status){ switch (status) {
case 0x00: case 0x00:
// //
print("${reply.commandType}解析成功"); print("${reply.commandType}解析成功");
deletLockInfoData(); deletLockInfoData();
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType}需要鉴权"); print("${reply.commandType}需要鉴权");
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey); var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!); List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
IoSenderManage.deletUser( IoSenderManage.deletUser(
lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, lockID:
authUserID:await Storage.getUid(), state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
keyID:"1", authUserID: await Storage.getUid(),
delUserID:await Storage.getUid(), keyID: "1",
needAuthor:1, delUserID: await Storage.getUid(),
publicKey:publicKeyDataList, needAuthor: 1,
privateKey:getPrivateKeyList, publicKey: publicKeyDataList,
token: tokenData privateKey: getPrivateKeyList,
); token: tokenData);
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType}用户无权限"); print("${reply.commandType}用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType}权限校验错误"); print("${reply.commandType}权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType}失败"); print("${reply.commandType}失败");
break; break;
@ -154,8 +158,10 @@ class LockSetLogic extends BaseGetXController{
// //
Future<void> deletUserAction() async { Future<void> deletUserAction() async {
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async { BlueManage().judgeReconnect(
if (connectionState == DeviceConnectionState.connected){ BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
(DeviceConnectionState connectionState) async {
if (connectionState == DeviceConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -165,17 +171,17 @@ class LockSetLogic extends BaseGetXController{
var token = await Storage.getStringList(saveBlueToken); var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList"); print("openDoorTokenPubToken:$getTokenList");
print("state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName:${state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName}"); print(
"state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName:${state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName}");
IoSenderManage.deletUser( IoSenderManage.deletUser(
lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, lockID: state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
authUserID:"100001", authUserID: "100001",
keyID:"1", keyID: "1",
delUserID:"100001", delUserID: "100001",
needAuthor:1, needAuthor: 1,
publicKey:publicKeyDataList, publicKey: publicKeyDataList,
privateKey:getPrivateKeyList, privateKey: getPrivateKeyList,
token: getTokenList token: getTokenList);
);
} }
}); });
} }
@ -194,8 +200,6 @@ class LockSetLogic extends BaseGetXController{
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
print("onInit()"); print("onInit()");
} }
@override @override
@ -204,5 +208,4 @@ class LockSetLogic extends BaseGetXController{
_replySubscription.cancel(); _replySubscription.cancel();
_passCurrentLockInformationEvent!.cancel(); _passCurrentLockInformationEvent!.cancel();
} }
}
}

View File

@ -67,57 +67,43 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
height: 10.h, height: 10.h,
), ),
CommonItem( CommonItem(
leftTitel: leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr,
TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
// Get.toNamed(Routers.wirelessKeyboardPage); Get.toNamed(Routers.doorMagneticPage);
Toast.show(msg: "功能暂未开放"); // Toast.show(msg: "功能暂未开放");
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr, leftTitel:
TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
// Get.toNamed(Routers.doorMagneticPage); Get.toNamed(Routers.wirelessKeyboardPage);
Toast.show(msg: "功能暂未开放"); // Toast.show(msg: "功能暂未开放");
}), }),
SizedBox( SizedBox(
height: 10.h, height: 10.h,
), ),
Obx(()=> CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: state.getKeyInfosData.value.remoteEnable == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage, arguments: state.getKeyInfosData.value);
})),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: leftTitel:
TranslationLoader.lanKeys!.automaticBlocking!.tr, TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.getKeyInfosData.value.autoLockTime! > -1 ? "${state.getKeyInfosData.value.autoLockTime!.toString()}s" : TranslationLoader.lanKeys!.closed!.tr, rightTitle: state.getKeyInfosData.value.autoLockTime! > -1
? "${state.getKeyInfosData.value.autoLockTime!.toString()}s"
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.automaticBlockingPage, arguments: state.getKeyInfosData.value); Get.toNamed(Routers.automaticBlockingPage,
arguments: state.getKeyInfosData.value);
})), })),
Obx(() => CommonItem(
leftTitel:
TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: state.getKeyInfosData.value.passageMode == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage, arguments: state.getKeyInfosData.value);
}),),
Obx(() { Obx(() {
var titleStr = ""; var titleStr = "";
if(state.getKeyInfosData.value.lockSound == 1){ if (state.getKeyInfosData.value.lockSound == 1) {
switch(state.getKeyInfosData.value.volume){ switch (state.getKeyInfosData.value.volume) {
case 1: case 1:
titleStr = TranslationLoader.lanKeys!.low!.tr; titleStr = TranslationLoader.lanKeys!.low!.tr;
break; break;
@ -134,7 +120,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
titleStr = TranslationLoader.lanKeys!.higher!.tr; titleStr = TranslationLoader.lanKeys!.higher!.tr;
break; break;
} }
}else{ } else {
titleStr = TranslationLoader.lanKeys!.closed!.tr; titleStr = TranslationLoader.lanKeys!.closed!.tr;
} }
return CommonItem( return CommonItem(
@ -143,51 +129,115 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockSoundSetPage, arguments: state.getKeyInfosData.value); Get.toNamed(Routers.lockSoundSetPage,
arguments: state.getKeyInfosData.value);
}); });
}), }),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr, leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: state.getKeyInfosData.value.tamperAlert == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr, rightTitle: state.getKeyInfosData.value.tamperAlert == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.burglarAlarmPage, arguments: state.getKeyInfosData.value); Get.toNamed(Routers.burglarAlarmPage,
arguments: state.getKeyInfosData.value);
})),
SizedBox(
height: 10.h,
),
Obx(
() => CommonItem(
leftTitel:
TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: state.getKeyInfosData.value.passageMode == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: state.getKeyInfosData.value);
}),
),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: state.getKeyInfosData.value.remoteEnable == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage,
arguments: state.getKeyInfosData.value);
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr, leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: state.getKeyInfosData.value.resetButton == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr, rightTitle: state.getKeyInfosData.value.resetButton == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.resetButtonPage, arguments: state.getKeyInfosData.value); Get.toNamed(Routers.resetButtonPage,
arguments: state.getKeyInfosData.value);
})), })),
SizedBox(
height: 10.h,
),
Obx(() {
var title = "";
if (state.getKeyInfosData.value.roomStatus == 1) {
title = TranslationLoader.lanKeys!.checkedIn!.tr;
} else if (state.getKeyInfosData.value.roomStatus == 2) {
title = TranslationLoader.lanKeys!.leisure!.tr;
}
return CommonItem(
leftTitel:
TranslationLoader.lanKeys!.markedHouseState!.tr,
rightTitle: title,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.markedHouseStatePage,
arguments: state.getKeyInfosData.value);
});
}),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockQRCode!.tr, leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveRightWidget: true,
action: () { rightWidget:
Get.toNamed(Routers.unlockQRCodePage); SizedBox(width: 60.w, child: _openCheckInSwitch())),
}),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr, leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: true,
rightWidget:
SizedBox(width: 60.w, child: _lockRemindSwitch())),
SizedBox(
height: 10.h,
),
CommonItem(
leftTitel: TranslationLoader
.lanKeys!.wifiDistributionNetwork!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.configuringWifiPage); Get.toNamed(Routers.configuringWifiPage);
}), }),
SizedBox(
height: 10.h,
),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockTime!.tr, leftTitel: TranslationLoader.lanKeys!.lockTime!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockTimePage, arguments: state.getKeyInfosData.value); Get.toNamed(Routers.lockTimePage,
arguments: state.getKeyInfosData.value);
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.diagnose!.tr, leftTitel: TranslationLoader.lanKeys!.diagnose!.tr,
@ -195,7 +245,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.diagnosePage, arguments: state.getKeyInfosData.value); Get.toNamed(Routers.diagnosePage,
arguments: state.getKeyInfosData.value);
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.uploadData!.tr, leftTitel: TranslationLoader.lanKeys!.uploadData!.tr,
@ -222,57 +273,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
action: () { action: () {
Get.toNamed(Routers.lockEscalationPage); Get.toNamed(Routers.lockEscalationPage);
}), }),
SizedBox(
height: 10.h,
),
CommonItem(
leftTitel: "Amazon Alexa",
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Toast.show(msg: "功能暂未开放");
}),
CommonItem(
leftTitel: "Google Home",
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Toast.show(msg: "功能暂未开放");
}),
SizedBox(
height: 10.h,
),
Obx((){
var title = "";
if(state.getKeyInfosData.value.roomStatus == 1){
title = TranslationLoader.lanKeys!.checkedIn!.tr;
}else if(state.getKeyInfosData.value.roomStatus == 2){
title = TranslationLoader.lanKeys!.leisure!.tr;
}
return CommonItem(
leftTitel:
TranslationLoader.lanKeys!.markedHouseState!.tr,
rightTitle: title,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.markedHouseStatePage, arguments: state.getKeyInfosData.value);
});
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: SizedBox(width: 60.w, child: _openCheckInSwitch())),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: SizedBox(width: 60.w, child: _lockRemindSwitch())),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
@ -302,16 +302,16 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
int isOnStr; int isOnStr;
if(value == true){ if (value == true) {
isOnStr = 1; isOnStr = 1;
}else{ } else {
isOnStr = 2; isOnStr = 2;
} }
logic.openCheckingInData((checkingInInfoDataEntity){ logic.openCheckingInData((checkingInInfoDataEntity) {
if(checkingInInfoDataEntity.data!.companyId == 0){ if (checkingInInfoDataEntity.data!.companyId == 0) {
showCupertinoAlertDialog(context); showCupertinoAlertDialog(context);
}else{ } else {
logic.setLockSetGeneralSetting(isOnStr.toString()); logic.setLockSetGeneralSetting(isOnStr.toString());
} }
}); });
@ -328,7 +328,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
value: state.isLockPickingReminder.value == 1 ? true : false, value: state.isLockPickingReminder.value == 1 ? true : false,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
state.isLockPickingReminder.value = state.isLockPickingReminder.value == 1 ? 2 : 1; state.isLockPickingReminder.value =
state.isLockPickingReminder.value == 1 ? 2 : 1;
logic.setLockPickingReminder(); logic.setLockPickingReminder();
}); });
}, },
@ -336,8 +337,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
} }
void showCupertinoAlertDialog( void showCupertinoAlertDialog(
BuildContext context, BuildContext context,
) { ) {
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
@ -347,7 +348,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
sureClick: () { sureClick: () {
// //
Navigator.pop(context); Navigator.pop(context);
Get.toNamed(Routers.checkInCreatCompanyPage, arguments: state.getKeyInfosData.value); Get.toNamed(Routers.checkInCreatCompanyPage,
arguments: state.getKeyInfosData.value);
}, },
cancelClick: () { cancelClick: () {
Navigator.pop(context); Navigator.pop(context);
@ -361,6 +363,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies // TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
} }
@ -396,5 +399,4 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
void didPushNext() { void didPushNext() {
print("lockSet===didPushNext"); print("lockSet===didPushNext");
} }
} }

View File

@ -21,7 +21,7 @@ class _UnlockQRCodePageState extends State<UnlockQRCodePage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.burglarAlarm!.tr, barTitle: TranslationLoader.lanKeys!.unlockQRCode!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(

View File

@ -30,7 +30,7 @@ class LockDetailPage extends StatefulWidget {
State<LockDetailPage> createState() => _LockDetailPageState(); State<LockDetailPage> createState() => _LockDetailPageState();
} }
class _LockDetailPageState extends State<LockDetailPage> with RouteAware{ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
final logic = Get.put(LockDetailLogic()); final logic = Get.put(LockDetailLogic());
final state = Get.find<LockDetailLogic>().state; final state = Get.find<LockDetailLogic>().state;
@ -57,7 +57,8 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware{
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey // signKey
List<int> signKeyData = state.keyInfos.value.bluetooth!.signKey!.cast<int>(); List<int> signKeyData =
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
var saveSignKeyList = changeIntListToStringList(signKeyData); var saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList); Storage.setStringList(saveBlueSignKey, saveSignKeyList);
// print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList"); // print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList");
@ -130,7 +131,8 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware{
width: 268.w, height: 268.w), width: 268.w, height: 268.w),
)), )),
Visibility( Visibility(
visible: state.keyInfos.value.remoteEnable == 1 ? true: false, visible:
state.keyInfos.value.remoteEnable == 1 ? true : false,
child: Align( child: Align(
alignment: const Alignment(0.6, 1), alignment: const Alignment(0.6, 1),
child: Image.asset( child: Image.asset(
@ -175,31 +177,32 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware{
// color: Colors.blue, // color: Colors.blue,
child: SizedBox( child: SizedBox(
child: GridView.count( child: GridView.count(
crossAxisCount: 4, crossAxisCount: 4,
// childAspectRatio: 3, // childAspectRatio: 3,
crossAxisSpacing: 20.w, crossAxisSpacing: 20.w,
mainAxisSpacing: 0.h, mainAxisSpacing: 0.h,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
children: getShowWidget() children: getShowWidget()),
),
), ),
); );
} }
List<Widget> getShowWidget(){ List<Widget> getShowWidget() {
var showWidgetArr = <Widget>[]; var showWidgetArr = <Widget>[];
// //
if(state.keyInfos.value.isAttendance == 1){ if (state.keyInfos.value.isAttendance == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr, () { TranslationLoader.lanKeys!.checkingIn!.tr, () {
Get.toNamed(Routers.checkingInListPage, arguments: state.keyInfos.value); Get.toNamed(Routers.checkingInListPage,
})); arguments: state.keyInfos.value);
}));
} }
var defaultWidgetArr = [ var defaultWidgetArr = [
// //
bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, () { bottomItem('images/main/icon_main_electronicKey.png',
TranslationLoader.lanKeys!.electronicKey!.tr, () {
Get.toNamed(Routers.electronicKeyListPage, arguments: { Get.toNamed(Routers.electronicKeyListPage, arguments: {
"lockMainEntity": widget.lockMainEntity, "lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo "keyInfo": widget.keyInfo
@ -207,13 +210,13 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware{
}), }),
// //
bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, () { bottomItem('images/main/icon_main_password.png',
Get.toNamed(Routers.passwordKeyListPage, TranslationLoader.lanKeys!.password!.tr, () {
arguments: { Get.toNamed(Routers.passwordKeyListPage, arguments: {
"lockMainEntity": widget.lockMainEntity, "lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo "keyInfo": widget.keyInfo
}); });
}), }),
// ic卡 // ic卡
bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () { bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () {
@ -237,42 +240,49 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware{
"lockId": widget.keyInfo.lockId, "lockId": widget.keyInfo.lockId,
"fromType": 2 "fromType": 2
}); });
}),
]; ];
showWidgetArr.addAll(defaultWidgetArr); showWidgetArr.addAll(defaultWidgetArr);
//-> //->
showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', '人脸', () { showWidgetArr.add(
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage, bottomItem('images/main/icon_face.png', '人脸', () {
// arguments: 1); // Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
}),); // arguments: 1);
}),
);
//-> //->
showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', '监控', () { showWidgetArr.add(
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage, bottomItem('images/main/icon_catEyes.png', '监控', () {
// arguments: 1); // Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
}),); // arguments: 1);
}),
);
var endWiddget = [ var endWiddget = [
// //
bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, () { bottomItem('images/main/icon_main_authorizedAdmin.png',
Get.toNamed(Routers.authorizedAdminListPage, arguments: { TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
"lockMainEntity": widget.lockMainEntity, Get.toNamed(Routers.authorizedAdminListPage, arguments: {
"keyInfo": widget.keyInfo "lockMainEntity": widget.lockMainEntity,
}); "keyInfo": widget.keyInfo
}), });
}),
// //
bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () { bottomItem('images/main/icon_main_operatingRecord.png',
Get.toNamed(Routers.lockOperatingRecordPage, TranslationLoader.lanKeys!.operatingRecord!.tr, () {
arguments: { Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
"lockMainEntity": widget.lockMainEntity, "lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo "keyInfo": widget.keyInfo
}); });
}), }),
// //
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () { bottomItem(
Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo); 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
}), () {
Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo);
}),
]; ];
showWidgetArr.addAll(endWiddget); showWidgetArr.addAll(endWiddget);
return showWidgetArr; return showWidgetArr;
@ -310,6 +320,7 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware{
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies // TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
} }
@ -324,26 +335,17 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware{
/// ///
@override @override
void didPush() { void didPush() {}
}
/// Called when the current route has been popped off. /// Called when the current route has been popped off.
@override @override
void didPop() { void didPop() {}
}
/// Called when the current route has been popped off. /// Called when the current route has been popped off.
@override @override
void didPopNext() { void didPopNext() {}
}
/// Called when the current route has been popped off. /// Called when the current route has been popped off.
@override @override
void didPushNext() { void didPushNext() {}
}
} }

View File

@ -86,8 +86,8 @@ class _PasswordKeyManageTabbarPageState
Tab _tab(ItemView item) { Tab _tab(ItemView item) {
return Tab( return Tab(
// text: item.title, // text: item.title,
child: Container( child: SizedBox(
width: 1.sw / 8, width: item.title.length > 2 ? 1.sw / 8 : 1.sw / 12,
// margin: EdgeInsets.all(10.w), // margin: EdgeInsets.all(10.w),
// color: Colors.red, // color: Colors.red,
child: Text( child: Text(

View File

@ -41,7 +41,7 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
TranslationLoader.lanKeys!.doorLock!.tr, () { TranslationLoader.lanKeys!.doorLock!.tr, () {
Navigator.pushNamed(context, Routers.addLockPage); Navigator.pushNamed(context, Routers.addLockPage);
}), }),
lockTypeItem('images/lockType/lockType_doorLock.png', lockTypeItem('images/lockType/lockType_NFCLock.png',
TranslationLoader.lanKeys!.NFCPassiveLock!.tr, () { TranslationLoader.lanKeys!.NFCPassiveLock!.tr, () {
Navigator.pushNamed(context, Routers.addLockPage); Navigator.pushNamed(context, Routers.addLockPage);
}), }),
@ -57,8 +57,7 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
TranslationLoader.lanKeys!.parkingLock!.tr, () { TranslationLoader.lanKeys!.parkingLock!.tr, () {
Navigator.pushNamed(context, Routers.addLockPage); Navigator.pushNamed(context, Routers.addLockPage);
}), }),
lockTypeItem( lockTypeItem('images/lockType/lockType_entranceGuardLock.png',
'images/lockType/lockType_intelligentLockCore.png',
TranslationLoader.lanKeys!.itelligentAccessControl!.tr, TranslationLoader.lanKeys!.itelligentAccessControl!.tr,
() { () {
Navigator.pushNamed(context, Routers.addLockPage); Navigator.pushNamed(context, Routers.addLockPage);
@ -68,7 +67,7 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
// TranslationLoader.lanKeys!.bicycleLock!.tr, () { // TranslationLoader.lanKeys!.bicycleLock!.tr, () {
// Navigator.pushNamed(context, Routers.addLockPage); // Navigator.pushNamed(context, Routers.addLockPage);
// }), // }),
lockTypeItem('images/lockType/lockType_remoteControl.png', lockTypeItem('images/lockType/lockType_gatewayLock.png',
TranslationLoader.lanKeys!.gateway!.tr, () { TranslationLoader.lanKeys!.gateway!.tr, () {
Navigator.pushNamed(context, Routers.gatewayListPage); Navigator.pushNamed(context, Routers.gatewayListPage);
}), }),
@ -138,8 +137,8 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
SizedBox(width: 30.w), SizedBox(width: 30.w),
Image.asset( Image.asset(
lockTypeIcon, lockTypeIcon,
width: 32.w, width: 48.w,
height: 48.w, height: 60.w,
), ),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Expanded( Expanded(

View File

@ -17,32 +17,62 @@ class MineMultiLanguagePage extends StatefulWidget {
} }
class _MineMultiLanguagePageState extends State<MineMultiLanguagePage> { class _MineMultiLanguagePageState extends State<MineMultiLanguagePage> {
final logic = Get.put(MineMultiLanguageLogic()); final logic = Get.put(MineMultiLanguageLogic());
final state = Get.find<MineMultiLanguageLogic>().state; final state = Get.find<MineMultiLanguageLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.multilingual!.tr, haveBack:true, backgroundColor: AppColors.mainColor), appBar: TitleAppBar(
body: Column( barTitle: TranslationLoader.lanKeys!.multilingual!.tr,
mainAxisAlignment: MainAxisAlignment.start, haveBack: true,
mainAxisSize: MainAxisSize.min, backgroundColor: AppColors.mainColor),
children: _children(), body: Column(
) mainAxisAlignment: MainAxisAlignment.start,
); mainAxisSize: MainAxisSize.min,
children: _children(),
));
} }
List<Widget> _children(){ List<Widget> _children() {
List<Widget> l = []; List<Widget> l = [];
for(int i = 0; i < state.languages.length; i++){ l.add(
CommonItem(
leftTitel: '跟随系统',
rightTitle: "",
allHeight: 90.h,
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: Container(),
action: () {
// logic.changeLanguage(e);
}),
);
for (int i = 0; i < state.languages.length; i++) {
var e = state.languages[i]; var e = state.languages[i];
var lanType = ExtensionLanguageType.fromLanguageCode(e.languageCode); var lanType = ExtensionLanguageType.fromLanguageCode(e.languageCode);
l.add(CommonItem(leftTitel:lanType.lanTitle, rightTitle:"", allHeight: 90.h, isHaveLine: true, isHaveDirection:false, isHaveRightWidget: true, rightWidget: Obx(() => state.currentLanguageType.value == lanType ? Image(image: const AssetImage("images/icon_item_checked.png"),width:30.w,height:30.w, fit: BoxFit.contain,): Container()), action: (){ l.add(
logic.changeLanguage(e); CommonItem(
}),); leftTitel: lanType.lanTitle,
rightTitle: "",
allHeight: 90.h,
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: Obx(() => state.currentLanguageType.value == lanType
? Image(
image: const AssetImage("images/icon_item_checked.png"),
width: 30.w,
height: 30.w,
fit: BoxFit.contain,
)
: Container()),
action: () {
logic.changeLanguage(e);
}),
);
} }
return l; return l;
} }

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_utils/get_utils.dart'; import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.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/tools/ExpandedListView.dart'; import 'package:star_lock/tools/ExpandedListView.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart'; import 'package:star_lock/translations/trans_lib.dart';
@ -167,9 +168,10 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
Widget _buildDeviceExpandedList(context, index, deviceName) { Widget _buildDeviceExpandedList(context, index, deviceName) {
return ExpandedListTile( return ExpandedListTile(
onTap: () => print("onTap."), onTap: () => print("onTap."),
title: deviceName, // title: deviceName,
imgName: 'images/icon_lock.png', // imgName: 'images/icon_lock.png',
typeImgList: const [], typeImgList: const [],
groupItem: GroupListItem(),
child: ListView.separated( child: ListView.separated(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
@ -205,9 +207,10 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
Widget _buildNameExpandedList(context, index, deviceName) { Widget _buildNameExpandedList(context, index, deviceName) {
return ExpandedListTile( return ExpandedListTile(
onTap: () => print("onTap."), onTap: () => print("onTap."),
title: deviceName, // title: deviceName,
imgName: 'images/controls_user.png', // imgName: 'images/controls_user.png',
typeImgList: const ['images/icon_password.png', 'images/icon_card.png'], typeImgList: const ['images/icon_password.png', 'images/icon_card.png'],
groupItem: GroupListItem(),
child: ListView.separated( child: ListView.separated(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: 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/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/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -17,6 +20,13 @@ class AuthorizedAdministratorListPage extends StatefulWidget {
class _AuthorizedAdministratorListPageState class _AuthorizedAdministratorListPageState
extends State<AuthorizedAdministratorListPage> { extends State<AuthorizedAdministratorListPage> {
@override
void initState() {
super.initState();
mockNetworkDataRequest();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -40,15 +50,49 @@ class _AuthorizedAdministratorListPageState
), ),
], ],
), ),
body: Column( body: FutureBuilder<List<AuthorizedAdminListItem>>(
children: [ future: mockNetworkDataRequest(),
_searchWidget(), builder: (BuildContext context,
Expanded(child: _buildMainUI()), 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() { Widget _searchWidget() {
return Container( return Container(
height: 60.h, height: 60.h,
@ -84,22 +128,21 @@ class _AuthorizedAdministratorListPageState
); );
} }
Widget _buildMainUI() { Widget _buildMainUI(List itemList) {
return ListView.builder( return ListView.builder(
itemCount: 5, itemCount: itemList.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
return _electronicKeyItem('images/controls_user.png', "张三", AuthorizedAdminListItem itemData = itemList[index];
"2023.6.21 11.15", "2023.6.21 11.15", () { return _electronicKeyItem(itemData);
// Navigator.pushNamed(context, Routers.authorizedAdminDetailPage);
Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
});
}); });
} }
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle, Widget _electronicKeyItem(AuthorizedAdminListItem itemData) {
String beginTime, String endTime, Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: () {
Navigator.pushNamed(context, Routers.administratorDetailsPage,
arguments: {'itemData': itemData});
},
child: Container( child: Container(
height: 100.h, height: 100.h,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
@ -113,7 +156,7 @@ class _AuthorizedAdministratorListPageState
width: 30.w, width: 30.w,
), ),
Image.asset( Image.asset(
lockTypeIcon, 'images/controls_user.png',
width: 60.w, width: 60.w,
height: 60.w, height: 60.w,
), ),
@ -128,7 +171,7 @@ class _AuthorizedAdministratorListPageState
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
lockTypeTitle, itemData.name ?? '',
style: TextStyle( style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor), 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

@ -0,0 +1,206 @@
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,22 +1,32 @@
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/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
class LockUserManageListListPage extends StatefulWidget { class LockUserManageListPage extends StatefulWidget {
const LockUserManageListListPage({Key? key}) : super(key: key); const LockUserManageListPage({Key? key}) : super(key: key);
@override @override
State<LockUserManageListListPage> createState() => State<LockUserManageListPage> createState() => _LockUserManageListPageState();
_LockUserManageListListPageState();
} }
class _LockUserManageListListPageState class _LockUserManageListPageState extends State<LockUserManageListPage> {
extends State<LockUserManageListListPage> { List<LockUserData> dataList = [];
@override
void initState() {
super.initState();
lockUserListRequest();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -31,7 +41,9 @@ class _LockUserManageListListPageState
TranslationLoader.lanKeys!.aboutToExpire!.tr, TranslationLoader.lanKeys!.aboutToExpire!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () {}, onPressed: () {
Navigator.pushNamed(context, Routers.expireLockListPage);
},
), ),
], ],
), ),
@ -54,7 +66,7 @@ class _LockUserManageListListPageState
context, Routers.massSendElectronicKeyManagePage); context, Routers.massSendElectronicKeyManagePage);
}, },
child: Text( child: Text(
'群发钥匙', TranslationLoader.lanKeys!.sendGroupKey!.tr,
style: TextStyle( style: TextStyle(
color: AppColors.mainColor, color: AppColors.mainColor,
fontSize: 24.sp, fontSize: 24.sp,
@ -105,12 +117,10 @@ class _LockUserManageListListPageState
Widget _buildMainUI() { Widget _buildMainUI() {
return ListView.separated( return ListView.separated(
itemCount: 5, itemCount: dataList.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
return _electronicKeyItem('images/controls_user.png', "张三", LockUserData indexEntity = dataList[index];
"2023.6.21 11.15", "2023.6.21 11.15", () { return _electronicKeyItem(indexEntity);
Navigator.pushNamed(context, Routers.ownedKeyListPage);
});
}, },
separatorBuilder: (BuildContext context, int index) { separatorBuilder: (BuildContext context, int index) {
return const Divider( return const Divider(
@ -121,10 +131,24 @@ class _LockUserManageListListPageState
); );
} }
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle, //
String beginTime, String endTime, Function() action) { Future<List<LockUserData>> lockUserListRequest() async {
LockUserListEntity entity =
await ApiRepository.to.lockUserList('1', '20', '');
if (entity.errorCode!.codeIsSuccessful) {
setState(() {
dataList = entity.data!;
});
}
return dataList;
}
Widget _electronicKeyItem(LockUserData itemData) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: () {
Navigator.pushNamed(context, Routers.ownedKeyListPage,
arguments: {'uid': itemData.uid});
},
child: Container( child: Container(
height: 90.h, height: 90.h,
color: Colors.white, color: Colors.white,
@ -138,7 +162,7 @@ class _LockUserManageListListPageState
width: 30.w, width: 30.w,
), ),
Image.asset( Image.asset(
lockTypeIcon, 'images/controls_user.png',
width: 60.w, width: 60.w,
height: 60.w, height: 60.w,
), ),
@ -153,7 +177,7 @@ class _LockUserManageListListPageState
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
lockTypeTitle, itemData.nickname ?? '',
style: TextStyle( style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor), fontSize: 24.sp, color: AppColors.blackColor),
), ),
@ -164,7 +188,7 @@ class _LockUserManageListListPageState
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
"2023.6.21 11.15 永久", itemData.userid ?? '',
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.placeholderTextColor), color: AppColors.placeholderTextColor),

View File

@ -1,9 +1,11 @@
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_utils/get_utils.dart'; import 'package:get/get_utils/get_utils.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 'package:star_lock/translations/trans_lib.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
@ -15,22 +17,53 @@ class OwnedKeyListPage extends StatefulWidget {
} }
class _OwnedKeyListPageState extends State<OwnedKeyListPage> { class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
String getUidStr = '';
List dataList = [];
@override
void initState() {
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["uid"] != null)) {
getUidStr = obj["uid"].toString();
}
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.ownedKey!.tr, barTitle: TranslationLoader.lanKeys!.ownedKey!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
body: Column( body: FutureBuilder<List<KeyListItem>>(
children: [ future: mockNetworkDataRequest(),
_topOwnedKeyText(), builder: (BuildContext context,
Expanded(child: _buildMainUI()), 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() { Widget _topOwnedKeyText() {
@ -49,21 +82,62 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
); );
} }
Widget _buildMainUI() { //
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 == 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;
}
Widget _buildMainUI(List itemList) {
return ListView.builder( return ListView.builder(
itemCount: 5, itemCount: itemList.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
return _electronicKeyItem('images/controls_user.png', "JBL01_5a3de9", KeyListItem itemData = itemList[index];
"2023.6.21 11.15", "2023.6.21 11.15", () { return _electronicKeyItem(itemData);
// Navigator.pushNamed(context, Routers.authorizedAdminDetailPage);
});
}); });
} }
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle, Widget _electronicKeyItem(KeyListItem itemData) {
String beginTime, String endTime, Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: () {},
child: Container( child: Container(
height: 90.h, height: 90.h,
margin: const EdgeInsets.only(top: 1), margin: const EdgeInsets.only(top: 1),
@ -77,7 +151,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
width: 30.w, width: 30.w,
), ),
Image.asset( Image.asset(
lockTypeIcon, 'images/icon_lockGroup_item.png',
width: 60.w, width: 60.w,
height: 60.w, height: 60.w,
), ),
@ -92,7 +166,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
lockTypeTitle, itemData.lockAlias ?? '',
style: TextStyle( style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor), fontSize: 24.sp, color: AppColors.blackColor),
), ),
@ -103,7 +177,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
"2023.6.21 11.15 永久", getUseDateStr(itemData),
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.placeholderTextColor), color: AppColors.placeholderTextColor),

View File

@ -153,6 +153,21 @@ class _MineSetPageState extends State<MineSetPage> {
Navigator.pushNamed(context, Navigator.pushNamed(context,
Routers.aPPUnlockNeedMobileNetworkingLockPage); Routers.aPPUnlockNeedMobileNetworkingLockPage);
}), }),
SizedBox(
height: 10.h,
),
CommonItem(
leftTitel: "Amazon Alexa",
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {}),
CommonItem(
leftTitel: "Google Home",
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {}),
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){ // CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
// //
// }), // }),

View File

@ -46,16 +46,20 @@ abstract class Api {
final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // Wifi锁服务器 final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // Wifi锁服务器
final String updateSpecialValueUrl = '/room/updateSpecialValue'; // / final String updateSpecialValueUrl = '/room/updateSpecialValue'; // /
final String setAutoLockTimeUrl = '/room/setAutoLockTime'; // final String setAutoLockTimeUrl = '/room/setAutoLockTime'; //
final String getPassageModeConfigUrl = '/room/getPassageModeConfig'; // final String getPassageModeConfigUrl =
'/room/getPassageModeConfig'; //
final String configPassageModeUrl = '/room/configPassageMode'; // final String configPassageModeUrl = '/room/configPassageMode'; //
final String updateSettingUrl = '/room/updateSetting'; // /// final String updateSettingUrl = '/room/updateSetting'; // ///
final String roomQueryDateUrl = '/room/queryDate'; // final String roomQueryDateUrl = '/room/queryDate'; //
final String lockDiagnoseUrl = '/room/uploadLockInfo'; // final String lockDiagnoseUrl = '/room/uploadLockInfo'; //
final String getServerDatetimeUrl = '/check/getServerDatetime'; // final String getServerDatetimeUrl = '/check/getServerDatetime'; //
final String getLockVersionInfoUrl = '/room/update'; // final String getLockVersionInfoUrl = '/room/update'; //
final String openCheckingInURL = '/attendanceCompany/isExistenceCompany'; // final String openCheckingInURL =
final String setCheckInCreateCompanyURL = '/attendanceCompany/add'; // '/attendanceCompany/isExistenceCompany'; //
final String setLockPickingReminderDataURL = '/key/updateMonitorFlag'; // final String setCheckInCreateCompanyURL =
'/attendanceCompany/add'; //
final String setLockPickingReminderDataURL =
'/key/updateMonitorFlag'; //
final String getAttendanceRecordListByDateURL = '/attendanceRecord/listByDate'; // - final String getAttendanceRecordListByDateURL = '/attendanceRecord/listByDate'; // -
final String getAttendanceRecordListByMonthURL = '/attendanceRecord/earlyListByMonth'; // - final String getAttendanceRecordListByMonthURL = '/attendanceRecord/earlyListByMonth'; // -
@ -80,5 +84,11 @@ abstract class Api {
final String lockUserListURL = '/keyUser/listKeyUser'; // final String lockUserListURL = '/keyUser/listKeyUser'; //
final String canSendKeyURL = '/keyUser/canSendKey'; // final String canSendKeyURL = '/keyUser/canSendKey'; //
final String batchSendKeyURL = '/key/batchSend'; // 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

@ -115,7 +115,8 @@ class ApiProvider extends BaseProvider {
'pageSize': pageSize, 'pageSize': pageSize,
'startDate': startDate, 'startDate': startDate,
'keyRight': keyRight 'keyRight': keyRight
})); }),
isShowLoading: true);
Future<Response> sendElectronicKey( Future<Response> sendElectronicKey(
String createUser, String createUser,
@ -252,7 +253,8 @@ class ApiProvider extends BaseProvider {
'keyboardPwdId': keyboardPwdId, 'keyboardPwdId': keyboardPwdId,
'cardId': cardId, 'cardId': cardId,
'fingerprintId': fingerprintId 'fingerprintId': fingerprintId
})); }),
isShowLoading: true);
// //
Future<Response> bindingBlueAdmin( Future<Response> bindingBlueAdmin(
@ -297,10 +299,8 @@ class ApiProvider extends BaseProvider {
})); }));
// Wifi锁服务器 // Wifi锁服务器
Future<Response> getWifiLockServiceIpAndPort() => post( Future<Response> getWifiLockServiceIpAndPort() =>
getWifiServiceIpURL.toUrl, post(getWifiServiceIpURL.toUrl, jsonEncode({}));
jsonEncode({
}));
Future<Response> passwordKeyList( Future<Response> passwordKeyList(
String keyStatus, String keyStatus,
@ -346,7 +346,8 @@ class ApiProvider extends BaseProvider {
'operatorUid': operatorUid, 'operatorUid': operatorUid,
'startDate': startDate, 'startDate': startDate,
'timezoneRawOffSet': timezoneRawOffSet 'timezoneRawOffSet': timezoneRawOffSet
})); }),
isShowLoading: true);
Future<Response> addKeyboardPwd( Future<Response> addKeyboardPwd(
String lockId, String lockId,
@ -402,11 +403,38 @@ class ApiProvider extends BaseProvider {
jsonEncode({'lockId': lockId, 'groupId': groupId})); 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}),
isShowLoading: true);
Future<Response> deleteElectronicKey(String keyId) => Future<Response> deleteElectronicKey(String keyId) =>
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': 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( Future<Response> deleteKeyboardPwd(
String lockId, String keyboardPwdId, String deleteType) => String lockId, String keyboardPwdId, String deleteType) =>
post( post(
@ -428,10 +456,10 @@ class ApiProvider extends BaseProvider {
lockListByGroupURL.toUrl, lockListByGroupURL.toUrl,
jsonEncode({'type': type, 'keyGroupId': keyGroupId})); jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
///
///
// //
Future<Response> remoteUnlockingOpenOrCloseLoadData(String lockId, String featureValue) => Future<Response> remoteUnlockingOpenOrCloseLoadData(
String lockId, String featureValue) =>
post( post(
updateSpecialValueUrl.toUrl, updateSpecialValueUrl.toUrl,
jsonEncode({ jsonEncode({
@ -440,7 +468,8 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> setAutoUnlockLoadData(String lockId, String autoLockTime, String type) => Future<Response> setAutoUnlockLoadData(
String lockId, String autoLockTime, String type) =>
post( post(
setAutoLockTimeUrl.toUrl, setAutoLockTimeUrl.toUrl,
jsonEncode({ jsonEncode({
@ -450,15 +479,22 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> getPassageModeConfigLoadData(String lockId) => Future<Response> getPassageModeConfigLoadData(String lockId) => post(
post( getPassageModeConfigUrl.toUrl,
getPassageModeConfigUrl.toUrl, jsonEncode({
jsonEncode({ 'lockId': lockId,
'lockId': lockId, }));
}));
// //
Future<Response> configPassageMode(String lockId, String passageMode, String autoUnlock, String type, String startDate, String endDate, String isAllDay, List weekDays) => Future<Response> configPassageMode(
String lockId,
String passageMode,
String autoUnlock,
String type,
String startDate,
String endDate,
String isAllDay,
List weekDays) =>
post( post(
configPassageModeUrl.toUrl, configPassageModeUrl.toUrl,
jsonEncode({ jsonEncode({
@ -473,7 +509,8 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> setLockSetGeneralSetting(String lockId, String changeType, String isOn, String type) => Future<Response> setLockSetGeneralSetting(
String lockId, String changeType, String isOn, String type) =>
post( post(
updateSettingUrl.toUrl, updateSettingUrl.toUrl,
jsonEncode({ jsonEncode({
@ -484,31 +521,29 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> getLockTimeFromGatewayLoadData(String lockId) => Future<Response> getLockTimeFromGatewayLoadData(String lockId) => post(
post( roomQueryDateUrl.toUrl,
roomQueryDateUrl.toUrl, jsonEncode({
jsonEncode({ 'lockId': lockId,
'lockId': lockId, }));
}));
// //
Future<Response> getServerDatetimeLoadData(String lockId) => Future<Response> getServerDatetimeLoadData(String lockId) => post(
post( getServerDatetimeUrl.toUrl,
getServerDatetimeUrl.toUrl, jsonEncode({
jsonEncode({ 'lockId': lockId,
'lockId': lockId, }));
}));
// //
Future<Response> setLockDiagnoseData( Future<Response> setLockDiagnoseData(
String lockId, String lockId,
String electricQuantity, String electricQuantity,
String firmwareRevision, String firmwareRevision,
String hardwareRevision, String hardwareRevision,
String lockDate, String lockDate,
String modelNum, String modelNum,
String pwdInfo, String pwdInfo,
String timestamp) => String timestamp) =>
post( post(
lockDiagnoseUrl.toUrl, lockDiagnoseUrl.toUrl,
jsonEncode({ jsonEncode({
@ -523,11 +558,11 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> getLockVersionInfoLoadData(String lockId) => Future<Response> getLockVersionInfoLoadData(String lockId) => post(
post( getLockVersionInfoUrl.toUrl,
getLockVersionInfoUrl.toUrl, jsonEncode({
jsonEncode({ 'lockId': lockId,
'lockId': lockId,})); }));
// //
Future<Response> openCheckingInGetData(String lockId) => post( Future<Response> openCheckingInGetData(String lockId) => post(
@ -540,22 +575,26 @@ class ApiProvider extends BaseProvider {
// //
Future<Response> setCheckInCreateCompanyData( Future<Response> setCheckInCreateCompanyData(
String lockId, String lockId,
String attendanceType, String attendanceType,
String companyName, String companyName,
List workDay, List workDay,
String workEndTime, String workEndTime,
String workStartTime) => post(setCheckInCreateCompanyURL.toUrl, jsonEncode({ String workStartTime) =>
'lockId': lockId, post(
'attendanceType': attendanceType, setCheckInCreateCompanyURL.toUrl,
'companyName': companyName, jsonEncode({
'workDay': workDay, 'lockId': lockId,
'workEndTime': workEndTime, 'attendanceType': attendanceType,
'workStartTime': workStartTime, 'companyName': companyName,
})); 'workDay': workDay,
'workEndTime': workEndTime,
'workStartTime': workStartTime,
}));
// //
Future<Response> setLockPickingReminderData(String lockId, String keyId, String monitorFlag) => Future<Response> setLockPickingReminderData(
String lockId, String keyId, String monitorFlag) =>
post( post(
setLockPickingReminderDataURL.toUrl, setLockPickingReminderDataURL.toUrl,
jsonEncode({ jsonEncode({
@ -565,23 +604,22 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> getStaffListData(String companyId, String lockId) => Future<Response> getStaffListData(String companyId, String lockId) => post(
post( getStaffListURL.toUrl,
getStaffListURL.toUrl, jsonEncode({
jsonEncode({ 'companyId': companyId,
'companyId': companyId, 'lockId': lockId,
'lockId': lockId, }));
}));
// //
Future<Response> addStaffData( Future<Response> addStaffData(
String attendanceType, String attendanceType,
String attendanceWay, String attendanceWay,
String companyId, String companyId,
String have, String have,
String staffName, String staffName,
String countryCode, String countryCode,
String usernameType) => String usernameType) =>
post( post(
addStaffURL.toUrl, addStaffURL.toUrl,
jsonEncode({ jsonEncode({
@ -790,20 +828,29 @@ class ApiProvider extends BaseProvider {
jsonEncode({'type': type, 'keyGroupId': keyGroupId})); 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}),
isShowLoading: true);
Future<Response> lockUserList( Future<Response> lockUserList(
String pageNo, String pageSize, String searchStr) => String pageNo, String pageSize, String searchStr) =>
post( post(
lockUserListURL.toUrl, lockUserListURL.toUrl,
jsonEncode({ jsonEncode(
'pageNo': pageNo, {'pageNo': pageNo, 'pageSize': pageSize, 'searchStr': searchStr}),
'pageSize': pageSize, isShowLoading: true);
'searchStr': searchStr
})); Future<Response> keyListByUser(String pageNo, String pageSize, String uid) =>
post(keyListByUserURL.toUrl,
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( Future<Response> canSendKey(
String endDate, String keyGroupIdList, String lockIdList) => String endDate, List keyGroupIdList, List lockIdList) =>
post( post(
canSendKeyURL.toUrl, canSendKeyURL.toUrl,
jsonEncode({ jsonEncode({
@ -811,6 +858,60 @@ class ApiProvider extends BaseProvider {
'keyGroupIdList': keyGroupIdList, 'keyGroupIdList': keyGroupIdList,
'lockIdList': lockIdList 'lockIdList': lockIdList
})); }));
Future<Response> batchSendKey(
String endDate,
List keyGroupIdList,
List lockIdList,
String createUser,
String isRemoteUnlock,
String keyNameForAdmin,
String receiverUsername,
String startDate,
String countryCode,
String usernameType,
List weekDays) =>
post(
batchSendKeyURL.toUrl,
jsonEncode({
'endDate': endDate,
'keyGroupIdList': keyGroupIdList,
'lockIdList': lockIdList,
'createUser': createUser,
'isRemoteUnlock': isRemoteUnlock,
'keyNameForAdmin': keyNameForAdmin,
'receiverUsername': receiverUsername,
'startDate': startDate,
'countryCode': countryCode,
'usernameType': usernameType,
'weekDays': weekDays,
}));
Future<Response> addAuthorizedAdmin(
String createUser,
String endDate,
String isRemoteUnlock,
List keyGroupIdList,
List lockIdList,
String name,
String startDate,
String userid,
String countryCode,
String usernameType) =>
post(
addAuthorizedAdminURL.toUrl,
jsonEncode({
'createUser': createUser,
'endDate': endDate,
'isRemoteUnlock': isRemoteUnlock,
'keyGroupIdList': keyGroupIdList,
'lockIdList': lockIdList,
'name': name,
'startDate': startDate,
'userid': userid,
'countryCode': countryCode,
'usernameType': usernameType
}));
} }
extension ExtensionString on String { extension ExtensionString on String {

View File

@ -2,12 +2,14 @@ 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/lockUserList/lockUserListEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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';
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/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart';
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart'; import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart'; import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
import '../login/login/entity/LoginEntity.dart'; import '../login/login/entity/LoginEntity.dart';
@ -364,23 +366,23 @@ class ApiRepository {
} }
// //
Future<LockGroupListEntity> addLockGroup( Future<MassSendLockGroupListEntity> addLockGroup(
String groupName, String operatorUid) async { String groupName, String operatorUid) async {
final res = await apiProvider.addLockGroup(groupName, operatorUid); final res = await apiProvider.addLockGroup(groupName, operatorUid);
return LockGroupListEntity.fromJson(res.body); return MassSendLockGroupListEntity.fromJson(res.body);
} }
// //
Future<LockGroupListEntity> setLockGroup( Future<MassSendLockGroupListEntity> setLockGroup(
String lockId, String groupId) async { String lockId, String groupId) async {
final res = await apiProvider.setLockGroup(lockId, groupId); final res = await apiProvider.setLockGroup(lockId, groupId);
return LockGroupListEntity.fromJson(res.body); return MassSendLockGroupListEntity.fromJson(res.body);
} }
// //
Future<LockGroupListEntity> lockGroupList(String type) async { Future<MassSendLockGroupListEntity> lockGroupList(String type) async {
final res = await apiProvider.lockGroupList(type); final res = await apiProvider.lockGroupList(type);
return LockGroupListEntity.fromJson(res.body); return MassSendLockGroupListEntity.fromJson(res.body);
} }
// //
@ -389,6 +391,28 @@ class ApiRepository {
return ElectronicKeyListEntity.fromJson(res.body); 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( Future<PasswordKeyEntity> deleteKeyboardPwd(
String lockId, String keyboardPwdId, String deleteType) async { String lockId, String keyboardPwdId, String deleteType) async {
@ -417,122 +441,116 @@ class ApiRepository {
return PasswordKeyEntity.fromJson(res.body); return PasswordKeyEntity.fromJson(res.body);
} }
// Wifi锁服务器 // Wifi锁服务器
Future<ConfiguringWifiEntity> getWifiLockServiceIpAndPort() async { Future<ConfiguringWifiEntity> getWifiLockServiceIpAndPort() async {
final res = await apiProvider.getWifiLockServiceIpAndPort(); final res = await apiProvider.getWifiLockServiceIpAndPort();
return ConfiguringWifiEntity.fromJson(res.body); return ConfiguringWifiEntity.fromJson(res.body);
} }
/// ///
// / // /
Future<LoginEntity> remoteUnlockingOpenOrClose( Future<LoginEntity> remoteUnlockingOpenOrClose({
{
required String lockId, required String lockId,
required String featureValue, required String featureValue,
}) async { }) async {
final res = final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData(
await apiProvider.remoteUnlockingOpenOrCloseLoadData(lockId, featureValue); lockId, featureValue);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
// //
Future<LoginEntity> setAutoUnlock( Future<LoginEntity> setAutoUnlock({
{ required String lockId,
required String lockId, required String autoLockTime,
required String autoLockTime, required String type,
required String type, }) async {
}) async {
final res = final res =
await apiProvider.setAutoUnlockLoadData(lockId, autoLockTime, type); await apiProvider.setAutoUnlockLoadData(lockId, autoLockTime, type);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
// configPassageMode // configPassageMode
Future<GetPassageModeConfigEntity> getPassageModeConfig( Future<GetPassageModeConfigEntity> getPassageModeConfig({
{ required String lockId,
required String lockId, }) async {
}) async { final res = await apiProvider.getPassageModeConfigLoadData(lockId);
final res =
await apiProvider.getPassageModeConfigLoadData(lockId);
return GetPassageModeConfigEntity.fromJson(res.body); return GetPassageModeConfigEntity.fromJson(res.body);
} }
// //
Future<GetPassageModeConfigEntity> configPassageModeLoadData( Future<GetPassageModeConfigEntity> configPassageModeLoadData({
{ required String lockId,
required String lockId, required String passageMode,
required String passageMode, required String autoUnlock,
required String autoUnlock, required String type,
required String type, required String startDate,
required String startDate, required String endDate,
required String endDate, required String isAllDay,
required String isAllDay, required List weekDays,
required List weekDays, }) async {
}) async { final res = await apiProvider.configPassageMode(lockId, passageMode,
final res = autoUnlock, type, startDate, endDate, isAllDay, weekDays);
await apiProvider.configPassageMode(lockId, passageMode, autoUnlock, type, startDate, endDate, isAllDay, weekDays);
return GetPassageModeConfigEntity.fromJson(res.body); return GetPassageModeConfigEntity.fromJson(res.body);
} }
// //
Future<LoginEntity> setLockSetGeneralSettingData( Future<LoginEntity> setLockSetGeneralSettingData({
{ required String lockId,
required String lockId, required String changeType,
required String changeType, required String isOn,
required String isOn, required String type,
required String type, }) async {
}) async { final res = await apiProvider.setLockSetGeneralSetting(
final res = lockId, changeType, isOn, type);
await apiProvider.setLockSetGeneralSetting(lockId, changeType, isOn, type);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
// //
Future<GetPassageModeConfigEntity> getLockTimeFromGateway( Future<GetPassageModeConfigEntity> getLockTimeFromGateway({
{ required String lockId,
required String lockId, }) async {
}) async { final res = await apiProvider.getLockTimeFromGatewayLoadData(lockId);
final res =
await apiProvider.getLockTimeFromGatewayLoadData(lockId);
return GetPassageModeConfigEntity.fromJson(res.body); return GetPassageModeConfigEntity.fromJson(res.body);
} }
// //
Future<GetServerDatetimeEntity> getServerDatetimeData( Future<GetServerDatetimeEntity> getServerDatetimeData({
{ required String lockId,
required String lockId, }) async {
}) async { final res = await apiProvider.getServerDatetimeLoadData(lockId);
final res =
await apiProvider.getServerDatetimeLoadData(lockId);
return GetServerDatetimeEntity.fromJson(res.body); return GetServerDatetimeEntity.fromJson(res.body);
} }
// //
Future<LoginEntity> setLockDiagnoseData( Future<LoginEntity> setLockDiagnoseData({
{ required String lockId,
required String lockId, required String electricQuantity,
required String electricQuantity, required String firmwareRevision,
required String firmwareRevision, required String hardwareRevision,
required String hardwareRevision, required String lockDate,
required String lockDate, required String modelNum,
required String modelNum, required String pwdInfo,
required String pwdInfo, required String timestamp,
required String timestamp, }) async {
}) async { final res = await apiProvider.setLockDiagnoseData(
final res = lockId,
await apiProvider.setLockDiagnoseData(lockId, electricQuantity, firmwareRevision, hardwareRevision, lockDate, modelNum, pwdInfo, timestamp); electricQuantity,
firmwareRevision,
hardwareRevision,
lockDate,
modelNum,
pwdInfo,
timestamp);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
// //
Future<GetServerDatetimeEntity> getLockVersionInfoData( Future<GetServerDatetimeEntity> getLockVersionInfoData({
{ required String lockId,
required String lockId, }) async {
}) async { final res = await apiProvider.getLockVersionInfoLoadData(lockId);
final res = return GetServerDatetimeEntity.fromJson(res.body);
await apiProvider.getLockVersionInfoLoadData(lockId); }
return GetServerDatetimeEntity.fromJson(res.body);}
// //
Future<MassSendLockGroupListEntity> listLockByGroup( Future<MassSendLockGroupListEntity> listLockByGroup(
@ -554,44 +572,110 @@ class ApiRepository {
return LockUserListEntity.fromJson(res.body); return LockUserListEntity.fromJson(res.body);
} }
// //
Future<KeyListByUserEntity> keyListByUser(
String pageNo, String pageSize, String uid) async {
final res = await apiProvider.keyListByUser(pageNo, pageSize, uid);
return KeyListByUserEntity.fromJson(res.body);
}
//
Future<KeyDetailEntity> canSendKey( Future<KeyDetailEntity> canSendKey(
String endDate, String keyGroupIdList, String lockIdList) async { String endDate, List keyGroupIdList, List lockIdList) async {
final res = final res =
await apiProvider.canSendKey(endDate, keyGroupIdList, lockIdList); await apiProvider.canSendKey(endDate, keyGroupIdList, lockIdList);
return KeyDetailEntity.fromJson(res.body); return KeyDetailEntity.fromJson(res.body);
} }
//
Future<KeyDetailEntity> batchSendKey(
String endDate,
List keyGroupIdList,
List lockIdList,
String createUser,
String isRemoteUnlock,
String keyNameForAdmin,
String receiverUsername,
String startDate,
String countryCode,
String usernameType,
List weekDays) async {
final res = await apiProvider.batchSendKey(
endDate,
keyGroupIdList,
lockIdList,
createUser,
isRemoteUnlock,
keyNameForAdmin,
receiverUsername,
startDate,
countryCode,
usernameType,
weekDays);
return KeyDetailEntity.fromJson(res.body);
}
//
Future<KeyDetailEntity> addAuthorizedAdmin(
String createUser,
String endDate,
String isRemoteUnlock,
List keyGroupIdList,
List lockIdList,
String name,
String startDate,
String userid,
String countryCode,
String usernameType) async {
final res = await apiProvider.addAuthorizedAdmin(
createUser,
endDate,
isRemoteUnlock,
keyGroupIdList,
lockIdList,
name,
startDate,
userid,
countryCode,
usernameType);
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 { Future<CheckingInInfoDataEntity> openCheckingInData(
{required String lockId}) async {
final res = await apiProvider.openCheckingInGetData(lockId); final res = await apiProvider.openCheckingInGetData(lockId);
return CheckingInInfoDataEntity.fromJson(res.body); return CheckingInInfoDataEntity.fromJson(res.body);
} }
// //
Future<LoginEntity> setCheckInCreateCompanyData( Future<LoginEntity> setCheckInCreateCompanyData(
{ {required String lockId,
required String lockId, required String attendanceType,
required String attendanceType, required String companyName,
required String companyName, required List workDay,
required List workDay, required String workEndTime,
required String workEndTime, required String workStartTime}) async {
required String workStartTime final res = await apiProvider.setCheckInCreateCompanyData(lockId,
}) async { attendanceType, companyName, workDay, workEndTime, workStartTime);
final res =
await apiProvider.setCheckInCreateCompanyData(lockId, attendanceType, companyName, workDay, workEndTime, workStartTime);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
// //
Future<LoginEntity> setLockPickingReminderData( Future<LoginEntity> setLockPickingReminderData({
{ required String lockId,
required String lockId, required String keyId,
required String keyId, required String monitorFlag,
required String monitorFlag, }) async {
}) async { final res = await apiProvider.setLockPickingReminderData(
final res = lockId, keyId, monitorFlag);
await apiProvider.setLockPickingReminderData(lockId, keyId, monitorFlag);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
@ -672,21 +756,28 @@ class ApiRepository {
final res = final res =
await apiProvider.getStaffListData(companyId, lockId); await apiProvider.getStaffListData(companyId, lockId);
return CheckingInAddStaffListEntity.fromJson(res.body); return CheckingInAddStaffListEntity.fromJson(res.body);
//
Future<LoginEntity> getStaffListData({
required String companyId,
required String lockId,
}) async {
final res = await apiProvider.getStaffListData(companyId, lockId);
return LoginEntity.fromJson(res.body);
} }
// //
Future<LoginEntity> addStaffData( Future<LoginEntity> addStaffData({
{ required String attendanceType,
required String attendanceType, required String attendanceWay,
required String attendanceWay, required String companyId,
required String companyId, required String have,
required String have, required String staffName,
required String staffName, required String countryCode,
required String countryCode, required String usernameType,
required String usernameType, }) async {
}) async { final res = await apiProvider.addStaffData(attendanceType, attendanceWay,
final res = companyId, have, staffName, countryCode, usernameType);
await apiProvider.addStaffData(attendanceType, attendanceWay, companyId, have, staffName, countryCode, usernameType);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
@ -808,5 +899,4 @@ class ApiRepository {
await apiProvider.addFingerprintsData(lockId, endDate, addType, fingerprintName, fingerprintNumber, fingerprintType, isCoerced, startDate, cyclicConfig); await apiProvider.addFingerprintsData(lockId, endDate, addType, fingerprintName, fingerprintNumber, fingerprintType, isCoerced, startDate, cyclicConfig);
return CheckingInListMonthEntity.fromJson(res.body); return CheckingInListMonthEntity.fromJson(res.body);
} }
} }

View File

@ -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/LoginData.dart'; import '../login/login/entity/LoginData.dart';
import '../login/login/entity/LoginEntity.dart'; import '../login/login/entity/LoginEntity.dart';

View File

@ -1,22 +1,23 @@
import 'dart:core';
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: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';
class ExpandedListTile extends StatefulWidget { class ExpandedListTile extends StatefulWidget {
const ExpandedListTile( const ExpandedListTile(
{Key? key, {Key? key,
required this.title,
this.child, this.child,
this.onTap, this.onTap,
required this.typeImgList, required this.groupItem,
required this.imgName}) required this.typeImgList})
: super(key: key); : super(key: key);
final String title;
final String imgName;
final Widget? child; final Widget? child;
final List typeImgList; final List typeImgList;
final Function()? onTap; final Function()? onTap;
final GroupListItem groupItem;
@override @override
_ExpandedListTileState createState() => _ExpandedListTileState(); _ExpandedListTileState createState() => _ExpandedListTileState();
@ -78,7 +79,9 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
// //
setState(() { setState(() {
_isCheck = !_isCheck; _isCheck = !_isCheck;
widget.groupItem.isChecked = _isCheck;
}); });
widget.onTap?.call();
}, },
)); ));
widgetList.add(GestureDetector( widgetList.add(GestureDetector(
@ -96,7 +99,7 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
width: 10.w, width: 10.w,
), ),
Text( Text(
widget.title, widget.groupItem.keyGroupName ?? '',
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp), style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
), ),
Expanded( Expanded(
@ -119,7 +122,6 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
setState(() { setState(() {
_isExpanded = !_isExpanded; _isExpanded = !_isExpanded;
}); });
widget.onTap?.call();
}, },
)); ));
return widgetList; return widgetList;

View File

@ -45,11 +45,10 @@ class ShowTFView extends StatelessWidget {
controller: controller, controller: controller,
autofocus: false, autofocus: false,
decoration: InputDecoration( decoration: InputDecoration(
//
contentPadding: contentPadding:
EdgeInsets.only(top: 20.h, left: 15.0, bottom: 13.h), const EdgeInsets.only(left: 5, top: -8, bottom: 6),
hintText: tipTitle, hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintStyle: TextStyle(fontSize: 28.sp), hintStyle: TextStyle(fontSize: 22.sp, height: 1.0),
//线 //线
border: InputBorder.none, border: InputBorder.none,
// //