修改普通用户、授权管理员开锁逻辑,修改电子钥匙、授权管理员部分bug

This commit is contained in:
魏少阳 2024-01-29 17:23:45 +08:00
parent d0d406ff3d
commit ccbe402c01
38 changed files with 366 additions and 263 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -130,4 +130,6 @@ class AppColors {
static Color openPassageModeColor = const Color(0xFFEB2A3B);// ()
static Color listTimeYellowColor = const Color(0xFFF3BA37);// ()
static Color get lockDetailBottomBtnUneable => const Color(0xFF808080);// ()
}

View File

@ -1,8 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.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:get/get.dart';
import 'package:star_lock/network/api_repository.dart';
@ -340,7 +339,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
//
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
return SizedBox(
height: 50.h,
height: 65.h,
width: 300.w,
child: Row(
children: [
@ -348,6 +347,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
child: TextField(
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
],
controller: lineIndex == 1
? state.emailOrPhoneController
: state.keyNameController,
@ -355,13 +358,24 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(
color: AppColors.placeholderTextColor, fontSize: 22.sp),
//线
border: InputBorder.none,
hintStyle: TextStyle(fontSize: 22.sp),
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
// decoration: InputDecoration(
// //
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// hintText: tfStr,
// hintStyle: TextStyle(
// color: AppColors.placeholderTextColor, fontSize: 22.sp),
// //线
// border: InputBorder.none,
// ),
),
),
SizedBox(

View File

@ -9,16 +9,16 @@ class AuthorizedAdminListLogic extends BaseGetXController {
//
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
'0',
state.keyInfo.value.keyId.toString(),
'',
state.keyInfo.value.lockId.toString(),
'',
state.pageNum.toString(),
state.pageSize.toString(),
'0',
'0',
state.searchStr.value);
endDate: '0',
keyId: state.keyInfo.value.keyId.toString(),
keyStatus: '',
lockId: state.keyInfo.value.lockId.toString(),
operatorUid: '',
pageNo: pageNo.toString(),
pageSize: pageSize.toString(),
startDate: '0',
keyRight: '0',
searchStr:state.searchStr.value);
List<ElectronicKeyListItem> dataList = [];
if (entity.errorCode!.codeIsSuccessful) {
print("电子钥匙列表成功:${entity.data?.itemList}");

View File

@ -36,6 +36,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
(state.getKeyInfosData.value.isLockOwner == 1 && state.getKeyInfosData.value.keyRight == 1) ?
GestureDetector(
onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
@ -48,7 +49,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
logic.showToast("演示模式");
}
},
child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)),
child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)) : Container(),
SizedBox(width: 30.w),
],
),

View File

@ -115,17 +115,20 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
SizedBox(
height: 30.h,
),
SubmitBtn(
btnName:
"${TranslationLoader.lanKeys!.delete!.tr}${TranslationLoader.lanKeys!.company!.tr}",
borderRadius: 20.w,
fontSize: 32.sp,
isDelete: true,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
onClick: () {
showDeletCompanyAlertDialog(context);
}),
Visibility(
visible: state.getKeyInfosData.value.isLockOwner == 1,
child: SubmitBtn(
btnName:
"${TranslationLoader.lanKeys!.delete!.tr}${TranslationLoader.lanKeys!.company!.tr}",
borderRadius: 20.w,
fontSize: 32.sp,
isDelete: true,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
onClick: () {
showDeletCompanyAlertDialog(context);
}),
),
],
),
);

View File

@ -5,6 +5,8 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../tools/eventBusEventManage.dart';
class ElectronicKeyDetailLogic extends BaseGetXController {
final ElectronicKeyDetailState state = ElectronicKeyDetailState();
@ -15,8 +17,10 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
state.changeNameController.text, '');
if (entity.errorCode!.codeIsSuccessful) {
print("修改要是名称成功啦啦啦啦啦");
showToast("修改成功");
Get.back();
showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI());
Get.back();
});
}
}
@ -26,8 +30,10 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
.deleteElectronicKey(state.itemData.value.keyId.toString());
if (entity.errorCode!.codeIsSuccessful) {
print("删除电子钥匙成功");
showToast("删除成功");
Get.back();
showToast("删除成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI());
Get.back();
});
}
}
}

View File

@ -5,6 +5,8 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/pass
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../tools/eventBusEventManage.dart';
class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
final ElectronicKeyDetailChangeDateState state =
ElectronicKeyDetailChangeDateState();
@ -23,8 +25,10 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
hoursEnd: state.hoursEnd.value,
isCoerced: state.isCoerced.value);
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功");
Get.back();
showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI());
Get.back();
});
}
}
@ -40,8 +44,10 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
state.startDay.value,
state.weekDays.value);
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功");
Get.back();
showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI());
Get.back();
});
}
}
}

View File

@ -1,24 +1,28 @@
import 'dart:async';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.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 '../../../../tools/eventBusEventManage.dart';
class ElectronicKeyListLogic extends BaseGetXController {
final ElectronicKeyListState state = ElectronicKeyListState();
//
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
'0',
state.keyInfo.value.keyId.toString(),
'',
state.keyInfo.value.lockId.toString(),
'',
pageNo.toString(),
pageSize.toString(),
'0',
'0',
state.searchController.text);
endDate: '0',
keyId: state.keyInfo.value.keyId.toString(),
keyStatus: '',
lockId: state.keyInfo.value.lockId.toString(),
operatorUid: '',
pageNo: pageNo.toString(),
pageSize: pageSize.toString(),
startDate: '0',
keyRight: '0',
searchStr: state.searchController.text);
if (entity.errorCode!.codeIsSuccessful) {
if (pageNo == 1) {
state.itemDataList.value = entity.data!.itemList!;
@ -40,6 +44,7 @@ class ElectronicKeyListLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
print("重置电子钥匙成功啦啦啦啦啦");
showToast("重置成功");
pageNo = 1;
mockNetworkDataRequest();
}
}
@ -51,14 +56,27 @@ class ElectronicKeyListLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
print("删除电子钥匙成功");
showToast("删除成功");
pageNo = 1;
mockNetworkDataRequest();
}
}
///
StreamSubscription? _getElectronicKeyListRefreshUIEvent;
void _getElectronicKeyListRefreshUIAction() {
// eventBus
_getElectronicKeyListRefreshUIEvent = eventBus.on<ElectronicKeyListRefreshUI>().listen((event) {
pageNo = 1;
mockNetworkDataRequest();
});
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_getElectronicKeyListRefreshUIAction();
}
@override
@ -70,5 +88,8 @@ class ElectronicKeyListLogic extends BaseGetXController {
@override
void onClose() {
// TODO: implement onClose
super.onClose();
_getElectronicKeyListRefreshUIEvent?.cancel();
}
}

View File

@ -121,63 +121,64 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
Widget _buildMainUI() {
return Obx(() => state.itemDataList.value.isEmpty
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
: ListView.separated(
: SlidableAutoCloseBehavior(
child: ListView.separated(
shrinkWrap: true,
itemCount: state.itemDataList.value.length,
itemBuilder: (c, index) {
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
String useDateStr = ''; //使
String keyStatus = ''; //
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
String useDateStr = ''; //使
String keyStatus = ''; //
//使
useDateStr = getUseDateStr(indexEntity);
//使
useDateStr = getUseDateStr(indexEntity);
//
keyStatus = getKeyStatus(indexEntity.keyStatus);
//
keyStatus = getKeyStatus(indexEntity.keyStatus);
//
bool isAdminKey = false;
if (indexEntity.keyRight == 1) {
isAdminKey = true;
} else {
isAdminKey = false;
}
//
bool isAdminKey = false;
if (indexEntity.keyRight == 1) {
isAdminKey = true;
} else {
isAdminKey = false;
}
return Slidable(
key:ValueKey(indexEntity.keyId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context){
showIosTipViewDialog(context, indexEntity.keyId!.toString());
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
),
],
),
child: _electronicKeyItem('images/controls_user.png',
indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
arguments: {"itemData": indexEntity}).then((val) {
if (val != null) {
logic.mockNetworkDataRequest();
setState(() {});
}
});
}),
);
return Slidable(
key:ValueKey(indexEntity.keyId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context){
showIosTipViewDialog(context, indexEntity.keyId!.toString());
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
),
],
),
child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
arguments: {"itemData": indexEntity}).then((val) {
if (val != null) {
logic.mockNetworkDataRequest();
setState(() {});
}
});
}),
);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
));
),
));
}
Widget _buildDeleteBtn(String keyId) {
@ -269,6 +270,9 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
} else if (keyStatusFlag == 110410) {
//
keyStatus = '已重置';
} else if (keyStatusFlag == 110412) {
//
keyStatus = '已过期';
}
return keyStatus;

View File

@ -6,6 +6,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import 'package:star_lock/translations/trans_lib.dart';
class SendElectronicKeyLogic extends BaseGetXController {
@ -62,6 +63,9 @@ class SendElectronicKeyLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
print('发送电子钥匙成功');
state.isSendSuccess.value = true;
state.sendSucceedType.value = int.parse(state.type.value);
resetData();
eventBus.fire(ElectronicKeyListRefreshUI());
} else {
if (entity.errorCode == 425) {
//
@ -162,4 +166,11 @@ class SendElectronicKeyLogic extends BaseGetXController {
},
);
}
void resetData(){
state.emailOrPhoneController.text = "";
state.keyNameController.text = "";
state.selectEffectiveDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //
state.selectFailureDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //
}
}

View File

@ -53,7 +53,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
}
Widget indexChangeWidget() {
if (state.isSendSuccess.value == true) {
if (state.isSendSuccess.value == true && state.sendSucceedType.value.toString() == widget.type) {
return sendElectronicKeySucceed();
} else {
switch (int.parse(widget.type)) {
@ -281,8 +281,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
state.failureDateTime.value.hour,
state.failureDateTime.value.minute);
//
if (state.emailOrPhoneController.text.isNotEmpty &&
state.keyNameController.text.isNotEmpty) {
if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.text.isNotEmpty) {
if (int.parse(widget.type) == 0) {
if (!startDateTime.isBefore(endDateTime) ||
startDateTime.isAtSameMomentAs(endDateTime)) {
@ -372,7 +371,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
btnName: '完成',
onClick: () {
state.isSendSuccess.value = false;
Navigator.pop(context, true);
logic.resetData();
}),
SizedBox(
height: 10.h,
@ -443,7 +442,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
LengthLimitingTextInputFormatter(30),
],
// controller: _controller,
autofocus: false,
@ -508,17 +507,20 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
//
Widget remoteUnlockingWidget() {
return Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
rightTitle: "",
isHaveRightWidget: true,
rightWidget:
SizedBox(width: 60.w, height: 50.h, child: _remoteSwitch(true)),
action: () {}),
Container(height: 10.h),
],
return Visibility(
visible: state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false,
child: Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
rightTitle: "",
isHaveRightWidget: true,
rightWidget:
SizedBox(width: 60.w, height: 50.h, child: _remoteSwitch(true)),
action: () {}),
Container(height: 10.h),
],
),
);
}

View File

@ -35,6 +35,8 @@ class SendElectronicKeyState {
var weekdaysList = [].obs;
var isCreateUser = false.obs; //1 0
final sendSucceedType = 0.obs;
SendElectronicKeyState() {
Map map = Get.arguments;
keyInfo.value = map["keyInfo"];

View File

@ -38,6 +38,13 @@ class _SendElectronicKeyManageTabbarState
vsync: this,
length: _itemTabs.length,
initialIndex: widget.initialIndex);
_tabController.addListener(() {
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
if (_tabController.animation!.value==_tabController.index){
FocusScope.of(context).requestFocus(FocusNode());
}
});
}
@override
@ -54,6 +61,9 @@ class _SendElectronicKeyManageTabbarState
TabBar _tabBar() {
return TabBar(
controller: _tabController,
onTap: (index){
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true,
indicatorColor: Colors.red,

View File

@ -137,7 +137,10 @@ class LockDetailLogic extends BaseGetXController {
case 0x16:
// ...
print("${reply.commandType}正在开锁中...");
showToast("正在开锁中...");
state.openLockBtnState.value = 0;
showToast("正在开锁中...", something: (){
cancelBlueConnetctToastTimer();
});
break;
default:
//
@ -317,7 +320,7 @@ class LockDetailLogic extends BaseGetXController {
} else {
getLockNetToken();
}
// clickPushBtnAction();
break;
case 0x06:
//
@ -598,38 +601,45 @@ class LockDetailLogic extends BaseGetXController {
}
}
// 0 1 2 3 4 5 6 7 8 9 10
clickItemBtnAction(int type){
state.clickNextType = type;
if (state.lockUserNo == 0) {
// lockUserNo为0
addUserConnectBlue();
} else {
clickPushBtnAction();
}
}
clickPushBtnAction(){
// 0 1 2 3 4 5 6 7 8 9 10
switch(state.clickNextType){
case 0:
//
startOpenLock();
break;
case 1:
//
startUnLock();
break;
case 2:
//
Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value});
break;
case 3:
//
Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value});
break;
}
}
// // 0 1 2 3 4 5 6 7 8 9 10
// clickItemBtnAction(int type){
// state.clickNextType = type;
// if (state.lockUserNo == 0) {
// // lockUserNo为0
// addUserConnectBlue();
// } else {
// clickPushBtnAction();
// }
// }
//
// clickPushBtnAction(){
// // 0 1 2 3 4 5 6 7 8 9 10
// switch(state.clickNextType){
// case 0:
// //
// startOpenLock();
// break;
// case 1:
// //
// startUnLock();
// break;
// case 2:
// //
// Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value});
// break;
// case 3:
// //
// Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value});
// break;
// case 10:
// //
// Get.toNamed(Routers.lockSetPage, arguments: {
// "lockId": state.keyInfos.value.lockId,
// "isOnlyOneData": state.isOnlyOneData,
// });
// break;
// }
// }
// token
void getLockNetToken() async {
@ -648,6 +658,8 @@ class LockDetailLogic extends BaseGetXController {
lockUserNo: state.lockUserNo.toString());
if (entity.errorCode!.codeIsSuccessful) {
if (state.isOpenLockNeedOnline.value == 0) {
state.bottomBtnisUneable.value = false;
eventBus.fire(RefreshLockListInfoDataEvent());
openDoorAction(1);
} else {
getLockNetToken();

View File

@ -36,12 +36,15 @@ class _LockDetailPageState extends State<LockDetailPage>
void initState() {
// TODO: implement initState
super.initState();
Get.log("LockDetailPage initState1111");
// Get.log("LockDetailPage initState1111");
print("LockDetailPage isOnlyOneData==${widget.isOnlyOneData}");
state.keyInfos.value = widget.lockListInfoItemEntity;
state.lockUserNo = state.keyInfos.value.lockUserNo!;
print("state.lockUserNo==${state.lockUserNo}");
if(state.lockUserNo == 0){
state.bottomBtnisUneable.value = true;
}
state.isOnlyOneData = widget.isOnlyOneData;
// print("state.lockUserNo==${state.lockUserNo}");
state.senderUserId = state.keyInfos.value.senderUserId!;
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
state.isOpenLockNeedOnline.value =
@ -111,7 +114,6 @@ class _LockDetailPageState extends State<LockDetailPage>
}
Widget topWidget() {
// KeyInfos keyInfo = widget.lockMainEntity.data!.keyInfos![0];
return Column(
children: [
SizedBox(height: 50.h),
@ -300,8 +302,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
List<Widget> getBottomWidget() {
if (state.keyInfos.value.isLockOwner == 1 ||
state.keyInfos.value.keyRight == 1) {
if (state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1) {
//
return getAllWidget();
} else {
@ -311,20 +312,24 @@ class _LockDetailPageState extends State<LockDetailPage>
//
List<Widget> getNormalWidget() {
var showWidgetArr = [
var showWidgetArr = <Widget>[];
//
if (state.isAttendance.value == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', TranslationLoader.lanKeys!.checkingIn!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.checkingInListPage,
arguments: state.keyInfos.value);
}));
}
//
bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": state.keyInfos.value});
}),
showWidgetArr.add(bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, state.bottomBtnisUneable.value,() {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": state.keyInfos.value});
}));
//
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
"isOnlyOneData": widget.isOnlyOneData,
});
}),
];
showWidgetArr.add(bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.lockSetPage, arguments: {"lockId": state.keyInfos.value.lockId, "isOnlyOneData": state.isOnlyOneData});
}));
return showWidgetArr;
}
@ -333,30 +338,27 @@ class _LockDetailPageState extends State<LockDetailPage>
var showWidgetArr = <Widget>[];
//
if (state.isAttendance.value == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', TranslationLoader.lanKeys!.checkingIn!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.checkingInListPage,
arguments: state.keyInfos.value);
}));
}
//
showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png',
TranslationLoader.lanKeys!.electronicKey!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.electronicKeyListPage,
arguments: {"keyInfo": state.keyInfos.value});
}));
//
showWidgetArr.add(bottomItem('images/main/icon_main_password.png',
TranslationLoader.lanKeys!.password!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.passwordKeyListPage,
arguments: {"keyInfo": state.keyInfos.value});
}));
// ic卡
if (state.keyInfos.value.lockFeature!.icCard == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, state.bottomBtnisUneable.value, () {
// logic.showToast("普通用户第一次需要在锁旁边操作哦。", something: () {
// logic.showEasyLoading();
// });
@ -368,8 +370,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
if (state.keyInfos.value.lockFeature!.fingerprint == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png',
TranslationLoader.lanKeys!.fingerprint!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.fingerprintListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
@ -378,8 +379,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
if (state.keyInfos.value.lockFeature!.bluetoothRemoteControl == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_remoteControl.png',
TranslationLoader.lanKeys!.remoteControl!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.remoteControlListPage);
}));
}
@ -387,8 +387,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//->
if (state.keyInfos.value.lockFeature!.d3Face == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_face.png',
TranslationLoader.lanKeys!.humanFace!.tr, () {
bottomItem('images/main/icon_face.png', TranslationLoader.lanKeys!.humanFace!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.faceList, arguments: {
"lockId": state.keyInfos.value.lockId,
}); // Toast.show(msg: "功能暂未开放");
@ -399,8 +398,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//->
if (state.keyInfos.value.lockFeature!.videoIntercom == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_catEyes.png',
TranslationLoader.lanKeys!.monitoring!.tr, () {
bottomItem('images/main/icon_catEyes.png', TranslationLoader.lanKeys!.monitoring!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.realTimePicturePage, arguments: {
"lockName": state.keyInfos.value.lockName,
"isMonitoring": true
@ -409,40 +407,41 @@ class _LockDetailPageState extends State<LockDetailPage>
);
}
var endWiddget = [
//
bottomItem('images/main/icon_main_authorizedAdmin.png',
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
//
if(state.keyInfos.value.isLockOwner == 1){
showWidgetArr.add(bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.authorizedAdminListPage,
arguments: {"keyInfo": state.keyInfos.value});
}),
}));
}
// bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, state.bottomBtnisUneable.value, () {
// Get.toNamed(Routers.authorizedAdminListPage,
// arguments: {"keyInfo": state.keyInfos.value});
// })
var endWiddget = [
//
bottomItem('images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, state.bottomBtnisUneable.value, () {
// Get.toNamed(Routers.lockOperatingRecordPage,
// arguments: {"keyInfo": state.keyInfos.value});
Get.toNamed(Routers.doorLockLogPage,
arguments: {"keyInfo": state.keyInfos.value});
}),
//
bottomItem('images/main/icon_lockDetail_videoLog.png',
TranslationLoader.lanKeys!.videoLog!.tr, () {
bottomItem('images/main/icon_lockDetail_videoLog.png', TranslationLoader.lanKeys!.videoLog!.tr, state.bottomBtnisUneable.value, () {
//
Get.toNamed(Routers.videoLogPage);
}),
//
bottomItem('images/main/icon_lockDetail_messageReminding.png',
TranslationLoader.lanKeys!.messageReminding!.tr, () {
bottomItem('images/main/icon_lockDetail_messageReminding.png', TranslationLoader.lanKeys!.messageReminding!.tr, state.bottomBtnisUneable.value, () {
Get.toNamed(Routers.msgNotificationPage);
}),
//
bottomItem(
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
() {
// BlueManage().stopScan();
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, state.bottomBtnisUneable.value, () {
// logic.clickItemBtnAction(10);
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
"isOnlyOneData": widget.isOnlyOneData,
"isOnlyOneData": state.isOnlyOneData,
});
}),
];
@ -450,11 +449,14 @@ class _LockDetailPageState extends State<LockDetailPage>
return showWidgetArr;
}
Widget bottomItem(String iconUrl, String name, Function() onClick) {
//
Widget bottomItem(String iconUrl, String name, bool isForbidden, Function() onClick) {
var width = 42.w;
var height = 42.h;
return GestureDetector(
onTap: onClick,
onTap: isForbidden ? (){
logic.showToast("请在锁旁边完成第一次开锁");
} : onClick ,
child: Container(
// height: 300.h,
color: Colors.white,
@ -463,16 +465,13 @@ class _LockDetailPageState extends State<LockDetailPage>
children: [
SizedBox(
width: width,
height: height,
child: Image.asset(iconUrl,
width: width, height: height, fit: BoxFit.fitWidth),
height: height,// isForbidden ? "${iconUrl}_uneable.png" :"${iconUrl}.png"
child: Image.asset(iconUrl, width: width, height: height, color: isForbidden ? AppColors.lockDetailBottomBtnUneable : AppColors.mainColor,fit: BoxFit.fitWidth),
),
SizedBox(height: 10.w),
Expanded(
child: Text(name,
style: TextStyle(
fontSize: 20.sp, color: AppColors.blackColor),
textAlign: TextAlign.center))
child: Text(name, style: TextStyle(fontSize: 20.sp, color: isForbidden ? AppColors.lockDetailBottomBtnUneable : AppColors.blackColor), textAlign: TextAlign.center)
)
],
)),
);
@ -552,7 +551,7 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Column(
children: [
Text(
widget.lockListInfoItemEntity.lockAlias!,
state.keyInfos.value.lockAlias!,
style: TextStyle(
color: AppColors.placeholderTextColor, fontSize: 24.sp),
),

View File

@ -21,6 +21,7 @@ class LockDetailState {
String lockNetToken = "";
var lockUserNo = 0;
var senderUserId = 0;
var isOnlyOneData = false;
var isAttendance = 0.obs;//
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
@ -35,8 +36,7 @@ class LockDetailState {
var iSOpenLock = true.obs; //
Timer? closedUnlockSuccessfulTimer;
// 0 1 2 3 4 5 6 7 8 9 10
var clickNextType = 0;
var bottomBtnisUneable = false.obs; //
//
late AnimationController animationController;

View File

@ -34,7 +34,8 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
IconButton(
(state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1)
? IconButton(
icon: Image.asset(
'images/icon_bar_more.png',
height: 30.h,
@ -63,7 +64,8 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
logic.showToast("演示模式");
}
},
),
)
: Container(),
],
),
body: Column(

View File

@ -91,6 +91,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
if (data != null) {
setState(() {
state.lockBasicInfo.value = data["lockBasicInfo"];
print("state.lockBasicInfo.value.lockAlias:${state.lockBasicInfo.value.lockAlias}");
});
}
})),
@ -111,8 +112,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
});
})),
Visibility(
visible: (state.lockBasicInfo.value.isLockOwner == 1 ||
state.lockBasicInfo.value.keyRight == 1)
visible: state.lockBasicInfo.value.isLockOwner == 1
? true
: false,
child: CommonItem(

View File

@ -16,8 +16,8 @@ class EditLockNameLogic extends BaseGetXController{
lockId: state.lockSetInfoData.value.lockId.toString(),
lockName:state.changeLockNameController.text);
if (entity.errorCode!.codeIsSuccessful) {
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
showToast("修改成功", something: (){
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!));
eventBus.fire(RefreshLockListInfoDataEvent());
});

View File

@ -330,7 +330,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}))),
//
Obx(() => Visibility(
visible: state.lockFeature.value.resetSwitch == 1 ? true : false,
visible: (state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.resetSwitch == 1) ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
@ -470,7 +470,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
Obx(
() => Visibility(
visible: state.lockFeature.value.attendance == 1 ? true : false,
visible: (state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.attendance == 1) ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: "",
@ -481,7 +481,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
Obx(
() => Visibility(
visible: state.lockFeature.value.unlockReminder == 1 ? true : false,
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.unlockReminder == 1 ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "",
@ -492,7 +492,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// APP开锁时是否需联网
Obx(
() => Visibility(
visible: state.lockFeature.value.appUnlockOnline == 1 ? true : false,
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.appUnlockOnline == 1 ? true : false,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,

View File

@ -23,13 +23,13 @@ class RemoteUnlockingLogic extends BaseGetXController{
remoteUnlock:state.remoteEnable.value == 1 ? 0 : 1
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value;
print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}");
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
showToast("操作成功");
showToast("操作成功", something: (){
eventBus.fire(RefreshLockListInfoDataEvent());
state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value;
print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}");
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
});
}
}

View File

@ -41,6 +41,7 @@ class PasswordKeyListLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
print("重置电子钥匙成功啦啦啦啦啦");
showToast("重置成功");
pageNo = 1;
mockNetworkDataRequest();
}
}
@ -52,6 +53,7 @@ class PasswordKeyListLogic extends BaseGetXController {
.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功");
pageNo = 1;
mockNetworkDataRequest();
}
}
@ -146,6 +148,7 @@ class PasswordKeyListLogic extends BaseGetXController {
void _getPasswordListRefreshUIAction() {
// eventBus
_getPasswordListRefreshUIEvent = eventBus.on<GetPasswordListRefreshUI>().listen((event) {
pageNo = 1;
mockNetworkDataRequest();
});
}

View File

@ -1,4 +1,3 @@
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -6,7 +5,6 @@ import 'package:star_lock/tools/noData.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../network/api_repository.dart';
import '../../../tools/EasyRefreshTool.dart';
import '../../../tools/dateTool.dart';
import '../../../tools/titleAppBar.dart';
@ -79,7 +77,7 @@ class _MessageListPageState extends State<MessageListPage> with TickerProviderSt
),
],
),
child: _selectGatewayListListItem(messageItemEntity, () {
child: _messageListItem(messageItemEntity, () {
Get.toNamed(Routers.messageDetailPage, arguments: {"messageItemEntity": messageItemEntity});
}),
);
@ -90,51 +88,51 @@ class _MessageListPageState extends State<MessageListPage> with TickerProviderSt
);
}
Widget _selectGatewayListListItem(MessageItemEntity messageItemEntity, Function() action) {
Widget _messageListItem(MessageItemEntity messageItemEntity, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
height: 90.h,
width: 1.sw,
margin: EdgeInsets.only(bottom: 2.h),
// padding:
// EdgeInsets.only(left: 10.w, right: 20.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
),
child: Row(
children: [
SizedBox(
width: 20.w,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
child: Container(
width: 1.sw,
margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
SizedBox(
width: 1.sw - 20.w*2,
child: Flexible(
child: Text(
messageItemEntity.data!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 22.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor),
),
],
),
),
SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 40.w, height: 40.w,),
// SizedBox(width: 10.w,),
Text(DateTool().dateToYMDHNString(messageItemEntity.createdAt!.toString()), style: TextStyle(fontSize: 18.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor)),
],
),
SizedBox(width: 20.h),
],
),
)
],
SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 40.w, height: 40.w,),
// SizedBox(width: 10.w,),
Text(DateTool().dateToYMDHNString(messageItemEntity.createdAt!.toString()), style: TextStyle(fontSize: 18.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor)),
],
),
SizedBox(width: 20.h),
],
),
),
),
);

View File

@ -32,7 +32,7 @@ class BaseProvider extends GetConnect with Api {
// print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}");
if (isUnShowLoading == false) EasyLoading.show();
// print('请求url======>$url');
// print('请求body体======>$body');
print('请求body体======>$body');
var res = await super.post(url, body,
contentType: contentType,
headers: headers,

View File

@ -125,16 +125,18 @@ class ApiRepository {
//
Future<ElectronicKeyListEntity> electronicKeyList(
String endDate,
String keyId,
String keyStatus,
String lockId,
String operatorUid,
String pageNo,
String pageSize,
String startDate,
String keyRight,
String searchStr) async {
{
required String endDate,
required String keyId,
required String keyStatus,
required String lockId,
required String operatorUid,
required String pageNo,
required String pageSize,
required String startDate,
required String keyRight,
required String searchStr
}) async {
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus,
lockId, operatorUid, pageNo, pageSize, startDate, keyRight, searchStr);
return ElectronicKeyListEntity.fromJson(res.body);

View File

@ -89,3 +89,8 @@ class GetPasswordListRefreshUI {
class ReadMessageRefreshUI {
ReadMessageRefreshUI();
}
///
class ElectronicKeyListRefreshUI {
ElectronicKeyListRefreshUI();
}