From f9c25b29171c36140454e44aa6926ce1afe68d8d Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 18 Oct 2023 11:42:27 +0800 Subject: [PATCH 1/5] =?UTF-8?q?1=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E7=9A=84=E5=B8=B8=E9=87=8F=E5=AE=9A=E4=B9=89=202?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=9C=89=E6=95=88=E6=9C=9F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E4=B9=B1=E9=97=AE=E9=A2=98=203=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=B4=A6=E5=8F=B7=20=E4=BC=98=E5=85=88?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authorizedAdminList_page.dart | 9 ++--- .../electronicKeyDetail_page.dart | 9 ++--- .../electronicKeyList_page.dart | 9 ++--- .../basicInformation_page.dart | 11 ++++--- .../lcokSet/lockSet/lockSet_page.dart | 33 +++++++++---------- .../main/lockMian/lockMain/lockMain_page.dart | 26 ++++++++------- star_lock/lib/mine/about/about_page.dart | 26 ++++----------- .../mine/mine/safeVerify/safeVerify_page.dart | 2 +- .../mine/safeVerify/safeVerify_state.dart | 20 +++++++++++ .../administratorDetails_page.dart | 9 ++--- .../authorizedAdministratorList_page.dart | 9 ++--- .../lockUserManage/ownedKeyList_page.dart | 9 ++--- .../mine/mineSet/mineSet/mineSet_page.dart | 2 +- 13 files changed, 95 insertions(+), 79 deletions(-) diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index 19c2a8f2..8cb98928 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -150,7 +151,7 @@ class _AuthorizedAdminListPageState extends State { //使用期限 String getUseDateStr(ElectronicKeyListItem indexEntity) { String useDateStr = ''; - if (indexEntity.keyType == 1) { + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); @@ -158,15 +159,15 @@ class _AuthorizedAdminListPageState extends State { DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; - } else if (indexEntity.keyType == 2) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; - } else if (indexEntity.keyType == 3) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; - } else if (indexEntity.keyType == 4) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index 3cf63cb9..44f5ca03 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -2,6 +2,7 @@ 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/common/XSConstantMacro/XSConstantMacro.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/network/api_repository.dart'; @@ -141,7 +142,7 @@ class _ElectronicKeyDetailPageState extends State { //使用期限 String getUseDateStr(ElectronicKeyListItem indexEntity) { String useDateStr = ''; - if (indexEntity.keyType == 1) { + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); @@ -149,15 +150,15 @@ class _ElectronicKeyDetailPageState extends State { DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}'; - } else if (indexEntity.keyType == 2) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; - } else if (indexEntity.keyType == 3) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; - } else if (indexEntity.keyType == 4) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 720c3315..d018b966 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/tools/noData.dart'; @@ -223,7 +224,7 @@ class _ElectronicKeyListPageState extends State { //使用期限 String getUseDateStr(ElectronicKeyListItem indexEntity) { String useDateStr = ''; - if (indexEntity.keyType == 1) { + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); @@ -231,15 +232,15 @@ class _ElectronicKeyListPageState extends State { DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; - } else if (indexEntity.keyType == 2) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; - } else if (indexEntity.keyType == 3) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; - } else if (indexEntity.keyType == 4) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; } diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart index d07aaea1..c8971ce7 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart'; import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -88,7 +89,7 @@ class _BasicInformationPageState extends State { CommonItem( leftTitel: TranslationLoader .lanKeys!.periodValidity!.tr, - rightTitle: getUseDateStr(itemData), + rightTitle: getUseDateStr(_lockData), allHeight: 70.h, isHaveLine: false), SizedBox( @@ -159,7 +160,7 @@ class _BasicInformationPageState extends State { //使用期限 String getUseDateStr(LockData indexEntity) { String useDateStr = ''; - if (indexEntity.keyType == 1) { + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 if (indexEntity.startDate != null && indexEntity.endDate != null) { DateTime startDateStr = @@ -171,13 +172,13 @@ class _BasicInformationPageState extends State { } else { useDateStr = '限期'; } - } else if (indexEntity.keyType == 2) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 useDateStr = '永久'; - } else if (indexEntity.keyType == 3) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 useDateStr = '单次'; - } else if (indexEntity.keyType == 4) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; } diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index 4ef9b2e8..1dcd1833 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -246,18 +246,7 @@ class _LockSetPageState extends State with RouteAware { rightWidget: SizedBox( width: 60.w, child: _otherUnHaveDoneSwitch()))), // ), - // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: '感应距离', - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Toast.show(msg: "功能暂未开放"); - })), - // ), + // Obx(() => Visibility( visible: true, @@ -292,6 +281,18 @@ class _LockSetPageState extends State with RouteAware { width: 60.w, child: _otherUnHaveDoneSwitch()))), // ), // Obx(() => + Visibility( + visible: true, + child: CommonItem( + leftTitel: '感应距离', + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Toast.show(msg: "功能暂未开放"); + })), + // ), + // Obx(() => Visibility( visible: true, child: CommonItem( @@ -538,8 +539,8 @@ class _LockSetPageState extends State with RouteAware { } void showDeletPasswordAlertDialog( - BuildContext context, - ) { + BuildContext context, + ) { showDialog( context: context, builder: (BuildContext context) { @@ -549,9 +550,7 @@ class _LockSetPageState extends State with RouteAware { controller: state.passwordTF, sureClick: () { //发送编辑钥匙名称请求 - if (state.passwordTF.text.isNotEmpty) { - - } + if (state.passwordTF.text.isNotEmpty) {} }, cancelClick: () { Navigator.pop(context); diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart index 6ff1b15f..a14db939 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -100,15 +99,15 @@ class _StarLockMainPageState extends State with BaseWidget { Widget unHaveData() { return Column( - // mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( + SizedBox( width: 330.w, - height: 330.w, - margin: EdgeInsets.only(top: 180.h), + // height: 330.w, + // margin: EdgeInsets.only(top: 180.h), // decoration: BoxDecoration( // border: Border.all(width: 4.w, color: AppColors.mainColor), // borderRadius: BorderRadius.circular(110.w), @@ -118,8 +117,8 @@ class _StarLockMainPageState extends State with BaseWidget { padding: const EdgeInsets.all(30.0), child: Image.asset( 'images/main/icon_main_unHaveLockData.png', - width: 150.w, - height: 150.w, + width: 260.w, + height: 260.w, ), ), onTap: () { @@ -136,7 +135,7 @@ class _StarLockMainPageState extends State with BaseWidget { ], ), Container( - padding: EdgeInsets.only(top: 10.h), + padding: EdgeInsets.all(30.w), child: Text( TranslationLoader .lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr, @@ -146,11 +145,14 @@ class _StarLockMainPageState extends State with BaseWidget { color: Colors.black), )), SizedBox( - height: 200.h, + height: 160.h, ), - SubmitBtn(btnName: '演示模式', onClick: (){ - Get.toNamed(Routers.demoModeLockDetailPage); - },) + SubmitBtn( + btnName: '演示模式', + onClick: () { + Get.toNamed(Routers.demoModeLockDetailPage); + }, + ) ], ); } diff --git a/star_lock/lib/mine/about/about_page.dart b/star_lock/lib/mine/about/about_page.dart index ed317ca5..3b9b53a9 100644 --- a/star_lock/lib/mine/about/about_page.dart +++ b/star_lock/lib/mine/about/about_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/network/api.dart'; import '../../app_settings/app_colors.dart'; @@ -9,19 +10,6 @@ import '../../tools/commonItem.dart'; import '../../tools/titleAppBar.dart'; import '../../translations/trans_lib.dart'; -// 网页的宏定义网址 -class XSWebviewURLMacro { - static String baseWebURL = Api.baseAddress; //base地址 - static String userAgreementURL = '$baseWebURL/app/userAgreement'; //用户协议 - static String privacyPolicyURL = '$baseWebURL/app/privacy'; //隐私政策 - static String collectionListURL = - '$baseWebURL/app/personalInformationCollectionList'; //个人信息收集清单 - static String thirdPartyInfShareListURL = - '$baseWebURL/app/thirdPartyInformationSharingList'; //第三方信息共享清单 - static String appPermissionDescURL = - '$baseWebURL/app/applicationPermissionDescription'; //应用权限说明 -} - class AbountPage extends StatefulWidget { const AbountPage({Key? key}) : super(key: key); @@ -72,7 +60,7 @@ class _AbountPageState extends State { action: () { Navigator.pushNamed(context, Routers.webviewShowPage, arguments: { - "url": XSWebviewURLMacro.userAgreementURL, + "url": XSConstantMacro.introduceURL, "title": '介绍' }); }), @@ -90,7 +78,7 @@ class _AbountPageState extends State { action: () { Navigator.pushNamed(context, Routers.webviewShowPage, arguments: { - "url": XSWebviewURLMacro.userAgreementURL, + "url": XSConstantMacro.userAgreementURL, "title": '用户协议' }); }), @@ -108,7 +96,7 @@ class _AbountPageState extends State { action: () { Navigator.pushNamed(context, Routers.webviewShowPage, arguments: { - "url": XSWebviewURLMacro.privacyPolicyURL, + "url": XSConstantMacro.privacyPolicyURL, "title": '隐私政策' }); }), @@ -127,7 +115,7 @@ class _AbountPageState extends State { action: () { Navigator.pushNamed(context, Routers.webviewShowPage, arguments: { - "url": XSWebviewURLMacro.collectionListURL, + "url": XSConstantMacro.collectionListURL, "title": '个人信息收集清单' }); }), @@ -146,7 +134,7 @@ class _AbountPageState extends State { action: () { Navigator.pushNamed(context, Routers.webviewShowPage, arguments: { - "url": XSWebviewURLMacro.appPermissionDescURL, + "url": XSConstantMacro.appPermissionDescURL, "title": '应用权限说明' }); }), @@ -165,7 +153,7 @@ class _AbountPageState extends State { action: () { Navigator.pushNamed(context, Routers.webviewShowPage, arguments: { - "url": XSWebviewURLMacro.thirdPartyInfShareListURL, + "url": XSConstantMacro.thirdPartyInfShareListURL, "title": '第三方信息共享清单' }); }), diff --git a/star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart b/star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart index a13ea601..e6071d1a 100644 --- a/star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart +++ b/star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart @@ -82,7 +82,7 @@ class _SafeVerifyPageState extends State { Obx(() => Padding( padding: EdgeInsets.only(left: 60.w, right: 60.w), child: Text( - '请点击获取验证码,验证码将发送到${state.loginData.value.mobile}', + '请点击获取验证码,验证码将发送到${state.accountStr.value}', style: TextStyle( color: AppColors.darkGrayTextColor, fontSize: 22.sp), ), diff --git a/star_lock/lib/mine/mine/safeVerify/safeVerify_state.dart b/star_lock/lib/mine/mine/safeVerify/safeVerify_state.dart index 4913a8fc..05ea13a9 100644 --- a/star_lock/lib/mine/mine/safeVerify/safeVerify_state.dart +++ b/star_lock/lib/mine/mine/safeVerify/safeVerify_state.dart @@ -19,6 +19,9 @@ class SafeVerifyState { var xWidth = ''.obs; // 滑动验证码滑动位置 var canSub = false.obs; var date = currentTimeMillis().toString().obs; + var accountStr = ''.obs; + var toggleStr = ''.obs; //可切换字眼 + var isToggle = false.obs; //是否点击切换 bool get codeIsOK => verificationCode.value.isNotEmpty; @@ -42,6 +45,23 @@ class SafeVerifyState { print("getLoginData:$data"); if (data != null && data.isNotEmpty) { loginData.value = LoginData.fromJson(jsonDecode(data)); + + //有手机号无邮箱 优先显示手机号 不可切换 + if (loginData.value.mobile!.isNotEmpty && + loginData.value.email!.isEmpty) { + accountStr.value = loginData.value.mobile!; + isToggle.value = false; + } else if (loginData.value.mobile!.isNotEmpty && + loginData.value.email!.isNotEmpty) { + //有手机号有邮箱 优先显示手机号 可切换至邮箱 + accountStr.value = loginData.value.mobile!; + isToggle.value = true; + } else if (loginData.value.mobile!.isNotEmpty && + loginData.value.email!.isNotEmpty) { + //无手机号有邮箱 优先显示邮箱 不可切换 + accountStr.value = loginData.value.email!; + isToggle.value = false; + } } } diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart b/star_lock/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart index f2e2c3f5..88179e3b 100644 --- a/star_lock/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart +++ b/star_lock/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart @@ -2,6 +2,7 @@ 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/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -133,7 +134,7 @@ class _AdministratorDetailsPageState extends State { //使用期限 String getUseDateStr(AuthorizedAdminListItem indexEntity) { String useDateStr = ''; - if (indexEntity.keyType == 1) { + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); @@ -141,15 +142,15 @@ class _AdministratorDetailsPageState extends State { DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}'; - } else if (indexEntity.keyType == 2) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; - } else if (indexEntity.keyType == 3) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; - } else if (indexEntity.keyType == 4) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; } diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart index 379bba0b..a83233f1 100644 --- a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart +++ b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.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'; @@ -212,7 +213,7 @@ class _AuthorizedAdministratorListPageState //使用期限 String getUseDateStr(AuthorizedAdminListItem indexEntity) { String useDateStr = ''; - if (indexEntity.keyType == 1) { + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 if (indexEntity.startDate != null && indexEntity.endDate != null) { DateTime startDateStr = @@ -224,13 +225,13 @@ class _AuthorizedAdministratorListPageState } else { useDateStr = '限期'; } - } else if (indexEntity.keyType == 2) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 useDateStr = '永久'; - } else if (indexEntity.keyType == 3) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 useDateStr = '单次'; - } else if (indexEntity.keyType == 4) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; } diff --git a/star_lock/lib/mine/mineSet/lockUserManage/ownedKeyList_page.dart b/star_lock/lib/mine/mineSet/lockUserManage/ownedKeyList_page.dart index 539c7b24..2fe20d9d 100644 --- a/star_lock/lib/mine/mineSet/lockUserManage/ownedKeyList_page.dart +++ b/star_lock/lib/mine/mineSet/lockUserManage/ownedKeyList_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_utils/get_utils.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -100,7 +101,7 @@ class _OwnedKeyListPageState extends State { //使用期限 String getUseDateStr(KeyListItem indexEntity) { String useDateStr = ''; - if (indexEntity.keyType == 1) { + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 if (indexEntity.startDate != null && indexEntity.endDate != null) { DateTime startDateStr = @@ -112,13 +113,13 @@ class _OwnedKeyListPageState extends State { } else { useDateStr = '限期'; } - } else if (indexEntity.keyType == 2) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 useDateStr = '永久'; - } else if (indexEntity.keyType == 3) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 useDateStr = '单次'; - } else if (indexEntity.keyType == 4) { + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; } diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart index 644d3471..be9dea06 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -236,7 +236,7 @@ class _MineSetPageState extends State { logic.userLogoutRequest(); }), Container( - padding: EdgeInsets.only(right: 30.w), + padding: EdgeInsets.only(right: 30.w, top: 30.h), // color: Colors.red, child: Row( mainAxisAlignment: MainAxisAlignment.end, From 1b86c22dcf004128d8dd6786fcefd5bad0543ddb Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 18 Oct 2023 11:42:45 +0800 Subject: [PATCH 2/5] =?UTF-8?q?1=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=B8=B8=E9=87=8F=E5=AE=9A=E4=B9=89=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XSConstantMacro/XSConstantMacro.dart | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 star_lock/lib/common/XSConstantMacro/XSConstantMacro.dart diff --git a/star_lock/lib/common/XSConstantMacro/XSConstantMacro.dart b/star_lock/lib/common/XSConstantMacro/XSConstantMacro.dart new file mode 100644 index 00000000..c9f07eae --- /dev/null +++ b/star_lock/lib/common/XSConstantMacro/XSConstantMacro.dart @@ -0,0 +1,22 @@ +import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart'; +import 'package:star_lock/network/api.dart'; + +class XSConstantMacro { + // 网页的宏定义网址 + static String baseWebURL = Api.baseAddress; //base地址 + static String introduceURL = '$baseWebURL/app/introduce'; //介绍页 + static String userAgreementURL = '$baseWebURL/app/userAgreement'; //用户协议 + static String privacyPolicyURL = '$baseWebURL/app/privacy'; //隐私政策 + static String collectionListURL = + '$baseWebURL/app/personalInformationCollectionList'; //个人信息收集清单 + static String thirdPartyInfShareListURL = + '$baseWebURL/app/thirdPartyInformationSharingList'; //第三方信息共享清单 + static String appPermissionDescURL = + '$baseWebURL/app/applicationPermissionDescription'; //应用权限说明 + +// 钥匙类型 keyType 1-永久 2-限期 3-单次 4-循环 + static int keyTypeLong = 1; + static int keyTypeTime = 2; + static int keyTypeOnce = 3; + static int keyTypeLoop = 4; +} From 860300e16ae2f90e92b3be3bcc2bb044a3853c5c Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 18 Oct 2023 15:50:51 +0800 Subject: [PATCH 3/5] =?UTF-8?q?1=EF=BC=8C=E7=94=B5=E5=AD=90=E9=92=A5?= =?UTF-8?q?=E5=8C=99=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86=202=EF=BC=8C?= =?UTF-8?q?=E6=BC=94=E7=A4=BA=E6=A8=A1=E5=BC=8F=E4=B8=8B=20=E7=94=B5?= =?UTF-8?q?=E5=AD=90=E9=92=A5=E5=8C=99=E6=A8=A1=E5=9D=97=E3=80=81=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=A8=A1=E5=9D=97=E3=80=81=E6=8E=88=E6=9D=83=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E6=A8=A1=E5=9D=97=E5=A4=84=E7=90=86=203?= =?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E5=AF=86=E7=A0=81=E3=80=81=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E7=AE=A1=E7=90=86=E5=91=98=20=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=20=E6=9C=AA=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=204=EF=BC=8C=E5=8F=91?= =?UTF-8?q?=E9=80=81=E7=94=B5=E5=AD=90=E9=92=A5=E5=8C=99=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=90=8E=E9=A1=B5=E9=9D=A2=20=E8=A6=81=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=88=86=E4=BA=AB=EF=BC=88=E5=90=8C=E5=AF=86?= =?UTF-8?q?=E7=A0=81=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authorizedAdminList_logic.dart | 48 ++++++ .../authorizedAdminList_page.dart | 139 +++++++++++----- .../authorizedAdminList_state.dart | 17 ++ .../electronicKeyDetail_page.dart | 1 - .../electronicKeyList_logic.dart | 12 +- .../electronicKeyList_page.dart | 84 +++++++--- .../electronicKeyList_state.dart | 3 +- .../sendElectronicKey_page.dart | 143 +++++++++++++++-- .../lcokSet/lockSet/lockSet_page.dart | 64 +++++--- .../passwordKeyDetail_page.dart | 7 +- .../passwordKeyList_logic.dart | 12 +- .../passwordKeyList/passwordKeyList_page.dart | 90 ++++++++--- .../passwordKeyList_state.dart | 2 + .../demoModeLockDetail_page.dart | 148 +++++++++--------- 14 files changed, 567 insertions(+), 203 deletions(-) create mode 100644 star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart create mode 100644 star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart new file mode 100644 index 00000000..0aba9876 --- /dev/null +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart @@ -0,0 +1,48 @@ +import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_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'; + +class AuthorizedAdminListLogic extends BaseGetXController { + final AuthorizedAdminListState state = AuthorizedAdminListState(); + + //请求电子钥匙列表 + Future> 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'); + List dataList = []; + if (entity.errorCode!.codeIsSuccessful) { + print("电子钥匙列表成功:${entity.data?.itemList}"); + if (entity.data != null) { + dataList = entity.data!.itemList; + } + } + state.itemDataList.value = dataList; + return dataList; + } + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + } + + @override + void onClose() { + // TODO: implement onClose + } +} diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index 8cb98928..c67cfbd1 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -2,11 +2,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; +import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; -import 'package:star_lock/network/api_repository.dart'; -import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/noData.dart'; +import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; @@ -23,27 +22,75 @@ class AuthorizedAdminListPage extends StatefulWidget { } class _AuthorizedAdminListPageState extends State { - late KeyInfos keyInfo; - late LockMainEntity lockMainEntity; + final logic = Get.put(AuthorizedAdminListLogic()); + final state = Get.find().state; + + // late KeyInfos keyInfo; + // late LockMainEntity lockMainEntity; + + @override + void initState() { + super.initState(); + + mockRequest(); + } + + Future mockRequest() async { + // 获取是否是演示模式 演示模式不获取接口 + var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); + if (isDemoMode == false) { + logic.mockNetworkDataRequest(); + } + } @override Widget build(BuildContext context) { - dynamic obj = ModalRoute.of(context)?.settings.arguments; - if (obj != null && (obj["lockMainEntity"] != null)) { - lockMainEntity = obj["lockMainEntity"]; - } - if (obj != null && (obj["keyInfo"] != null)) { - keyInfo = obj["keyInfo"]; - } + // dynamic obj = ModalRoute.of(context)?.settings.arguments; + // if (obj != null && (obj["lockMainEntity"] != null)) { + // lockMainEntity = obj["lockMainEntity"]; + // } + // if (obj != null && (obj["keyInfo"] != null)) { + // keyInfo = obj["keyInfo"]; + // } return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor, - ), - body: FutureBuilder>( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: Column( + children: [ + Expanded( + child: Obx(() => state.itemDataList.value.isEmpty + ? const NoData() + : _buildMainUI(state.itemDataList.value))), + SizedBox( + height: 20.h, + ), + AddBottomWhiteBtn( + btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr, + onClick: () { + Navigator.pushNamed(context, Routers.authorizedAdminManagePage, + arguments: { + "lockMainEntity": state.lockMainEntity.value, + "keyInfo": state.keyInfo.value + }).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + setState(() {}); + } + }); + }, + ), + SizedBox( + height: 64.h, + ) + ], + ) + /* + FutureBuilder>( future: mockNetworkDataRequest(), builder: (BuildContext context, AsyncSnapshot> snapshot) { @@ -90,31 +137,32 @@ class _AuthorizedAdminListPageState extends State { return Container(); } }), - ); + */ + ); } - //请求授权管理员列表 跟电子钥匙列表的接口一样,但必须在参数中加keyRight=1为授权管理员 - Future> mockNetworkDataRequest() async { - ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( - '0', - keyInfo.keyId.toString(), - '', - keyInfo.lockId.toString(), - '', - '1', - '20', - '0', - '1'); - if (entity.errorCode!.codeIsSuccessful) { - print("电子钥匙列表成功:${entity.data?.itemList}"); - } - if (entity.data != null) { - return entity.data!.itemList; - } else { - List dataList = []; - return dataList; - } - } + // //请求授权管理员列表 跟电子钥匙列表的接口一样,但必须在参数中加keyRight=1为授权管理员 + // Future> mockNetworkDataRequest() async { + // ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( + // '0', + // keyInfo.keyId.toString(), + // '', + // keyInfo.lockId.toString(), + // '', + // '1', + // '20', + // '0', + // '1'); + // if (entity.errorCode!.codeIsSuccessful) { + // print("电子钥匙列表成功:${entity.data?.itemList}"); + // } + // if (entity.data != null) { + // return entity.data!.itemList; + // } else { + // List dataList = []; + // return dataList; + // } + // } Widget _buildMainUI(itemData) { List getItemData = itemData; @@ -143,7 +191,12 @@ class _AuthorizedAdminListPageState extends State { return _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { Navigator.pushNamed(context, Routers.electronicKeyDetailPage, - arguments: {'itemData': indexEntity}); + arguments: {'itemData': indexEntity}).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + setState(() {}); + } + }); }); }); } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart new file mode 100644 index 00000000..11bd6b15 --- /dev/null +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart @@ -0,0 +1,17 @@ +import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; +import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; + +class AuthorizedAdminListState { + final keyInfo = KeyInfos().obs; + final lockMainEntity = LockMainEntity().obs; + var pageNum = 1.obs; //请求页码 + final pageSize = 20.obs; //请求每页数据条数 + final itemDataList = [].obs; + + AuthorizedAdminListState() { + Map map = Get.arguments; + lockMainEntity.value = map["lockMainEntity"]; + keyInfo.value = map["keyInfo"]; + } +} diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index 44f5ca03..5eb1d424 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -8,7 +8,6 @@ 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 'package:star_lock/tools/jh_pop_menus.dart'; -import 'package:star_lock/tools/showCupertinoAlert.dart'; import 'package:star_lock/tools/toast.dart'; import '../../../../../appRouters.dart'; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart index 84d2d74e..a0e94873 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart @@ -19,15 +19,15 @@ class ElectronicKeyListLogic extends BaseGetXController { state.pageSize.toString(), '0', '0'); + List dataList = []; if (entity.errorCode!.codeIsSuccessful) { print("电子钥匙列表成功:${entity.data?.itemList}"); + if (entity.data != null) { + dataList = entity.data!.itemList; + } } - if (entity.data != null) { - return entity.data!.itemList; - } else { - List dataList = []; - return dataList; - } + state.itemDataList.value = dataList; + return dataList; } //电子钥匙重置请求 diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index d018b966..1c100b0f 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -7,6 +7,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/tools/noData.dart'; +import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/submitBtn.dart'; @@ -24,35 +25,76 @@ class _ElectronicKeyListPageState extends State { final logic = Get.put(ElectronicKeyListLogic()); final state = Get.find().state; late RefreshController _refreshController; - late List itemDataList = []; + // late List itemDataList = []; @override void initState() { super.initState(); _refreshController = RefreshController(initialRefresh: true); + + mockRequest(); + } + + Future mockRequest() async { + // 获取是否是演示模式 演示模式不获取接口 + var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); + if (isDemoMode == false) { + logic.mockNetworkDataRequest(); + } } @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.electronicKey!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor, - actionsList: [ - TextButton( - child: Text( - TranslationLoader.lanKeys!.reset!.tr, - style: TextStyle(color: Colors.white, fontSize: 24.sp), + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.electronicKey!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + actionsList: [ + TextButton( + child: Text( + TranslationLoader.lanKeys!.reset!.tr, + style: TextStyle(color: Colors.white, fontSize: 24.sp), + ), + onPressed: () { + _showDialog(context); + }, ), - onPressed: () { - _showDialog(context); - }, - ), - ], - ), - body: FutureBuilder>( + ], + ), + body: Column( + children: [ + _searchWidget(), + SizedBox( + height: 20.h, + ), + Expanded( + child: Obx(() => state.itemDataList.value.isEmpty + ? const NoData() + : _buildMainUI(state.itemDataList.value))), + AddBottomWhiteBtn( + btnName: TranslationLoader.lanKeys!.sendKey!.tr, + onClick: () { + Navigator.pushNamed( + context, Routers.sendElectronicKeyManagePage, arguments: { + "lockMainEntity": state.lockMainEntity.value, + "keyInfo": state.keyInfo.value + }).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + setState(() {}); + } + }); + }, + ), + SizedBox( + height: 64.h, + ) + ], + ) + /* + FutureBuilder>( future: logic.mockNetworkDataRequest(), builder: (BuildContext context, AsyncSnapshot> snapshot) { @@ -115,13 +157,14 @@ class _ElectronicKeyListPageState extends State { return Container(); } }), - ); + */ + ); } ///加载更多函数 Future _loadMore() async { if (state.pageNum.value == 1) { - if (itemDataList.length < 10) { + if (state.itemDataList.value.length < 10) { _refreshController.loadComplete(); } else { state.pageNum.value++; @@ -209,7 +252,6 @@ class _ElectronicKeyListPageState extends State { setState(() {}); } }); - ; }); }, separatorBuilder: (BuildContext context, int index) { diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart index cd7b7a00..b51f5cef 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart @@ -1,12 +1,13 @@ import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; -import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart'; class ElectronicKeyListState { final keyInfo = KeyInfos().obs; final lockMainEntity = LockMainEntity().obs; var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 + final itemDataList = [].obs; ElectronicKeyListState() { Map map = Get.arguments; diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart index 41d19843..a55d88e7 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_pickers/pickers.dart'; import 'package:flutter_pickers/time_picker/model/date_mode.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -28,6 +29,7 @@ class SendElectronicKeyPage extends StatefulWidget { class _SendElectronicKeyPageState extends State { final logic = Get.put(SendElectronicKeyLogic()); final state = Get.find().state; + static const methodChannel = MethodChannel('flutter_native_ios'); @override void initState() { @@ -345,21 +347,22 @@ class _SendElectronicKeyPageState extends State { height: 10.h, ), OutLineBtn( - btnName: '邮件通知', + btnName: '分享', onClick: () { - Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + // Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + _openModalBottomSheet(); }, ), SizedBox( height: 10.h, ), - OutLineBtn( - btnName: '微信通知', - onClick: () {}, - ), - SizedBox( - height: 10.h, - ), + // OutLineBtn( + // btnName: '微信通知', + // onClick: () {}, + // ), + // SizedBox( + // height: 10.h, + // ), OutLineBtn( btnName: '标记为已入住', onClick: () { @@ -484,4 +487,126 @@ class _SendElectronicKeyPageState extends State { String intToStr(int v) { return (v < 10) ? "0$v" : "$v"; } + + Future _openModalBottomSheet() async { + showModalBottomSheet( + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadiusDirectional.circular(10)), + constraints: BoxConstraints(maxHeight: 260.h), + builder: (BuildContext context) { + return Column( + children: [ + SizedBox( + width: ScreenUtil().screenWidth, + height: 180.h, + child: ListView( + scrollDirection: Axis.horizontal, //横向滚动 + children: initBottomSheetList()), + ), + Container( + height: 8.h, + color: AppColors.greyBackgroundColor, + ), + TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消', + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + ); + }); + } + + List initBottomSheetList() { + List widgetList = []; + + widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0)); + widgetList.add(buildCenter3('images/icon_message.png', '短信', 1)); + widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2)); + widgetList.add(buildCenter3('images/icon_more.png', '更多', 3)); + + return widgetList; + } + + GestureDetector buildCenter3( + String imageName, String titleStr, int itemIndex) { + return GestureDetector( + child: Container( + width: 120.w, + // height: 64.h, + margin: + EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + imageName, + width: 50.w, + height: 50.h, + ), + SizedBox( + height: 16.w, + ), + Text( + titleStr, + style: TextStyle( + fontSize: ScreenUtil().setSp(20), color: Colors.black), + ), + ], + ), + ), + onTap: () => _jumpSmartDeviceRoute(itemIndex), + ); + } + + _jumpSmartDeviceRoute(int itemIndex) { + switch (itemIndex) { + case 0: + //微信好友 + { + Navigator.pop(context); + String pwdShareStr = '您好,您的电子钥匙生成成功'; + tokNative('flutter_sharePassword_to_ios', + arguments: {'pwdShareStr': pwdShareStr}).then((result) { + print('$result'); + }); + print('与原生交互'); + } + break; + case 1: + //短信 + {} + break; + case 2: + //邮件 + { + Navigator.pop(context); + Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + } + break; + case 3: + //更多 + {} + break; + default: + } + } + + static Future tokNative(String method, + {required Map arguments}) async { + if (arguments == null) { + return await methodChannel.invokeMethod(method); + } else { + return await methodChannel.invokeMethod(method, arguments); + } + } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index 1dcd1833..63201932 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -515,29 +515,57 @@ class _LockSetPageState extends State with RouteAware { ); } - void showCupertinoAlertDialog( - BuildContext context, - ) { - showDialog( - context: context, - builder: (BuildContext context) { - return ShowIosTipView( - title: "提示", - tipTitle: "创建公司号,考勤功能才能使用", - sureClick: () { - // - Navigator.pop(context); - Get.toNamed(Routers.checkInCreatCompanyPage, - arguments: state.getKeyInfosData.value); - }, - cancelClick: () { - Navigator.pop(context); - }, + //确认弹窗 + void showCupertinoAlertDialog(widgetContext) { + showCupertinoDialog( + context: widgetContext, + builder: (context) { + return CupertinoAlertDialog( + title: const Text('创建公司号,考勤功能才能使用'), + actions: [ + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.cancel!.tr), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.sure!.tr), + onPressed: () { + Navigator.pop(context); + Get.toNamed(Routers.checkInCreatCompanyPage, + arguments: state.getKeyInfosData.value); + }, + ), + ], ); }, ); } + // void showCupertinoAlertDialog( + // BuildContext context, + // ) { + // showDialog( + // context: context, + // builder: (BuildContext context) { + // return ShowIosTipView( + // title: "提示", + // tipTitle: "创建公司号,考勤功能才能使用", + // sureClick: () { + // // + // Navigator.pop(context); + // Get.toNamed(Routers.checkInCreatCompanyPage, + // arguments: state.getKeyInfosData.value); + // }, + // cancelClick: () { + // Navigator.pop(context); + // }, + // ); + // }, + // ); + // } + void showDeletPasswordAlertDialog( BuildContext context, ) { diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index d82bd6fa..195892fb 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -1,4 +1,3 @@ -import 'package:date_format/date_format.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -193,7 +192,6 @@ class _PasswordKeyDetailPageState extends State { padding: EdgeInsets.only(top: 25.w, bottom: 25.w), onClick: () { deletePwdRequest(); - Navigator.pop(context, true); }), ], ), @@ -278,6 +276,9 @@ class _PasswordKeyDetailPageState extends State { itemData.lockId.toString(), itemData.keyboardPwdId.toString(), 1); if (entity.errorCode!.codeIsSuccessful) { Toast.show(msg: "删除成功"); + setState(() { + Navigator.pop(context, true); + }); } } @@ -409,6 +410,7 @@ class _PasswordKeyDetailPageState extends State { case 0: //微信好友 { + Navigator.pop(context); String pwdShareStr = '您好,您的密码是:${itemData.keyboardPwd}\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}'; tokNative('flutter_sharePassword_to_ios', @@ -425,6 +427,7 @@ class _PasswordKeyDetailPageState extends State { case 2: //邮件 { + Navigator.pop(context); Navigator.pushNamed(context, Routers.sendEmailNotificationPage); } break; diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index cde1378f..e3c7888c 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -15,15 +15,15 @@ class PasswordKeyListLogic extends BaseGetXController { '0', state.pageNum.toString(), state.pageSize.toString()); + List dataList = []; if (entity.errorCode!.codeIsSuccessful) { print("密码钥匙列表成功:${entity.data?.itemList}"); + if (entity.data != null) { + dataList = entity.data!.itemList!; + } } - if (entity.data != null) { - return entity.data!.itemList!; - } else { - List dataList = []; - return dataList; - } + state.itemDataList.value = dataList; + return dataList; } //密码钥匙重置请求 diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index 2697fa90..86d82868 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -6,6 +6,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart'; import 'package:star_lock/tools/noData.dart'; +import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/submitBtn.dart'; @@ -22,7 +23,7 @@ class PasswordKeyListPage extends StatefulWidget { class _PasswordKeyListPageState extends State { final logic = Get.put(PasswordKeyListLogic()); final state = Get.find().state; - late List _itemDataList = []; + // late List _itemDataList = []; late RefreshController _refreshController; @@ -30,29 +31,70 @@ class _PasswordKeyListPageState extends State { void initState() { super.initState(); _refreshController = RefreshController(initialRefresh: true); + mockRequest(); + } + + Future mockRequest() async { + // 获取是否是演示模式 演示模式不获取接口 + var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); + if (isDemoMode == false) { + logic.mockNetworkDataRequest(); + } } @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.password!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor, - actionsList: [ - TextButton( - child: Text( - TranslationLoader.lanKeys!.reset!.tr, - style: TextStyle(color: Colors.white, fontSize: 24.sp), + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.password!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + actionsList: [ + TextButton( + child: Text( + TranslationLoader.lanKeys!.reset!.tr, + style: TextStyle(color: Colors.white, fontSize: 24.sp), + ), + onPressed: () { + _showDialog(context); + }, ), - onPressed: () { - _showDialog(context); - }, - ), - ], - ), - body: FutureBuilder>( + ], + ), + body: Column( + children: [ + _searchWidget(), + SizedBox( + height: 20.h, + ), + Expanded( + child: Obx(() => state.itemDataList.value.isEmpty + ? const NoData() + : _buildMainUI(state.itemDataList.value))), + SizedBox( + height: 20.h, + ), + AddBottomWhiteBtn( + btnName: TranslationLoader.lanKeys!.getPassword!.tr, + onClick: () { + Navigator.pushNamed(context, Routers.passwordKeyManagePage, + arguments: { + "lockMainEntity": state.lockMainEntity.value, + "keyInfo": state.keyInfo.value + }).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + } + }); + }), + SizedBox( + height: 42.h, + ) + ], + ) + /* + FutureBuilder>( future: logic.mockNetworkDataRequest(), builder: (BuildContext context, AsyncSnapshot> snapshot) { @@ -119,13 +161,14 @@ class _PasswordKeyListPageState extends State { return Container(); } }), - ); + */ + ); } ///加载更多函数 Future _loadMore() async { if (state.pageNum.value == 1) { - if (_itemDataList.length < 10) { + if (state.itemDataList.length < 10) { _refreshController.loadComplete(); } else { state.pageNum.value++; @@ -195,7 +238,12 @@ class _PasswordKeyListPageState extends State { return _electronicKeyItem('images/controls_user.png', indexEntity.keyboardPwdName!, useDateStr, () { Navigator.pushNamed(context, Routers.passwordKeyDetailPage, - arguments: {"itemData": indexEntity}); + arguments: {"itemData": indexEntity}).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + } + }); + ; }); }, separatorBuilder: (BuildContext context, int index) { diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart index 6b2e9d15..c6c7cde1 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart @@ -1,4 +1,5 @@ import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; class PasswordKeyListState { @@ -6,6 +7,7 @@ class PasswordKeyListState { final lockMainEntity = LockMainEntity().obs; var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 + final itemDataList = [].obs; PasswordKeyListState() { Map map = Get.arguments; diff --git a/star_lock/lib/main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart b/star_lock/lib/main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart index ffe51330..d8079371 100644 --- a/star_lock/lib/main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart +++ b/star_lock/lib/main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -26,7 +25,6 @@ class _DemoModeLockDetailPageState extends State { void initState() { // TODO: implement initState super.initState(); - } @override @@ -34,25 +32,21 @@ class _DemoModeLockDetailPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: "演示模式", - haveBack: true, - backgroundColor: AppColors.mainColor, - ), - body: Container( - width: 1.sw, - height: 1.sh - ScreenUtil().statusBarHeight * 2, - color: Colors.white, - child: Column( - children: [ - topTip(), - topWidget(), - Expanded(child: bottomWidget()) - ], - ), - )); + barTitle: "演示模式", + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: Container( + width: 1.sw, + height: 1.sh - ScreenUtil().statusBarHeight * 2, + color: Colors.white, + child: Column( + children: [topTip(), topWidget(), Expanded(child: bottomWidget())], + ), + )); } - Widget topTip(){ + Widget topTip() { return Container( // height: 120.h, width: 1.sw, @@ -61,7 +55,10 @@ class _DemoModeLockDetailPageState extends State { children: [ Row( children: [ - Expanded(child: Text("提示:当前界面为展示界面,添加设备后才能继续使用", style: TextStyle(fontSize: 24.sp, color: AppColors.mainColor))), + Expanded( + child: Text("提示:当前界面为展示界面,添加设备后才能继续使用", + style: TextStyle( + fontSize: 24.sp, color: AppColors.mainColor))), ], ), ], @@ -82,7 +79,7 @@ class _DemoModeLockDetailPageState extends State { child: Text( "TMH_78f16712781a", style: - TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400), + TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400), )), Row( mainAxisAlignment: MainAxisAlignment.end, @@ -112,12 +109,12 @@ class _DemoModeLockDetailPageState extends State { children: [ Center( child: GestureDetector( - onTap: () { - gotoLogin(); - }, - child: Image.asset('images/main/icon_main_openLockBtn.png', - width: 268.w, height: 268.w), - )), + onTap: () { + gotoLogin(); + }, + child: Image.asset('images/main/icon_main_openLockBtn.png', + width: 268.w, height: 268.w), + )), ], ), ), @@ -168,12 +165,13 @@ class _DemoModeLockDetailPageState extends State { Text( '超级管理员', style: - TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor), + TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor), ), SizedBox( width: 80.w, ), - Image.asset('images/main/icon_main_remoteUnlocking_grey.png', + Image.asset( + 'images/main/icon_main_remoteUnlocking_grey.png', // state.keyInfos.value.remoteEnable == 1 // ? 'images/main/icon_main_remoteUnlocking.png' // : 'images/main/icon_main_remoteUnlocking_grey.png', @@ -189,7 +187,7 @@ class _DemoModeLockDetailPageState extends State { Text( '网关设备', style: - TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor), + TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor), ), ], ), @@ -227,58 +225,57 @@ class _DemoModeLockDetailPageState extends State { // 考勤 // if (state.keyInfos.value.isAttendance == 1) { - showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', - TranslationLoader.lanKeys!.checkingIn!.tr, () { - // gotoLogin(); - Get.toNamed(Routers.checkingInListPage, arguments: KeyInfos()); - })); + showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', + TranslationLoader.lanKeys!.checkingIn!.tr, () { + // gotoLogin(); + Get.toNamed(Routers.checkingInListPage, arguments: KeyInfos()); + })); // } var defaultWidgetArr = [ // 电子钥匙 bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, () { - gotoLogin(); + // gotoLogin(); - // Get.toNamed(Routers.electronicKeyListPage, arguments: { - // "lockMainEntity": widget.lockMainEntity, - // "keyInfo": widget.keyInfo - // }); - }), + Get.toNamed(Routers.electronicKeyListPage, arguments: { + "lockMainEntity": LockMainEntity(), + "keyInfo": KeyInfos() + }); + }), // 密码 bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, () { - gotoLogin(); - - // Get.toNamed(Routers.passwordKeyListPage, arguments: { - // "lockMainEntity": widget.lockMainEntity, - // "keyInfo": widget.keyInfo - // }); - }), - - // ic卡 - bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () { // gotoLogin(); - Get.toNamed(Routers.otherTypeKeyListPage, arguments: { - "lockId": 0, - "fromType": 0 + Get.toNamed(Routers.passwordKeyListPage, arguments: { + "lockMainEntity": LockMainEntity(), + "keyInfo": KeyInfos() }); }), + // ic卡 + bottomItem('images/main/icon_main_icCard.png', + TranslationLoader.lanKeys!.card!.tr, () { + // gotoLogin(); + + Get.toNamed(Routers.otherTypeKeyListPage, + arguments: {"lockId": 0, "fromType": 0}); + }), + // 指纹 - bottomItem('images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, () { + bottomItem('images/main/icon_main_fingerprint.png', + TranslationLoader.lanKeys!.fingerprint!.tr, () { // gotoLogin(); - Get.toNamed(Routers.otherTypeKeyListPage, arguments: { - "lockId": 1, - "fromType": 1 - }); + Get.toNamed(Routers.otherTypeKeyListPage, + arguments: {"lockId": 1, "fromType": 1}); }), // 遥控 - bottomItem('images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, () { + bottomItem('images/main/icon_main_remoteControl.png', + TranslationLoader.lanKeys!.remoteControl!.tr, () { gotoLogin(); // Get.toNamed(Routers.otherTypeKeyListPage, arguments: { @@ -315,25 +312,26 @@ class _DemoModeLockDetailPageState extends State { // 授权管理员 bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, () { - gotoLogin(); + // gotoLogin(); - // Get.toNamed(Routers.authorizedAdminListPage, arguments: { - // "keyInfo": KeyInfos() - // }); - }), + Get.toNamed(Routers.authorizedAdminListPage, arguments: { + "lockMainEntity": LockMainEntity(), + "keyInfo": KeyInfos() + }); + }), // 操作记录 bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () { - // gotoLogin(); - Get.toNamed(Routers.lockOperatingRecordPage, arguments: { - "keyInfo": KeyInfos() - }); - }), + // gotoLogin(); + Get.toNamed(Routers.lockOperatingRecordPage, + arguments: {"keyInfo": KeyInfos()}); + }), // 设置 bottomItem( - 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () { - Get.toNamed(Routers.demoModeLockSetPage); - }), + 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, + () { + Get.toNamed(Routers.demoModeLockSetPage); + }), ]; showWidgetArr.addAll(endWiddget); return showWidgetArr; @@ -345,7 +343,7 @@ class _DemoModeLockDetailPageState extends State { return GestureDetector( onTap: onClick, child: Container( - // height: 300.h, + // height: 300.h, color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -367,7 +365,7 @@ class _DemoModeLockDetailPageState extends State { ); } - void gotoLogin(){ + void gotoLogin() { // Get.toNamed(Routers.seletLockTypePage); Toast.show(msg: "演示模式"); } From 5b8524bfaa83e10b538391c9bf42f3fcbaf65d90 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 18 Oct 2023 16:20:46 +0800 Subject: [PATCH 4/5] =?UTF-8?q?1=EF=BC=8C=E7=94=B5=E5=AD=90=E9=92=A5?= =?UTF-8?q?=E5=8C=99=E3=80=81=E5=AF=86=E7=A0=81=E6=A8=A1=E5=9D=97=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authorizedAdminList_logic.dart | 3 +- .../authorizedAdminList_page.dart | 86 +----------- .../authorizedAdminList_state.dart | 1 + .../electronicKeyList_logic.dart | 3 +- .../electronicKeyList_page.dart | 74 +---------- .../electronicKeyList_state.dart | 2 + .../passwordKeyList_logic.dart | 13 +- .../passwordKeyList/passwordKeyList_page.dart | 122 ++++-------------- .../passwordKeyList_state.dart | 2 + star_lock/lib/network/api_provider.dart | 23 ++-- star_lock/lib/network/api_repository.dart | 19 +-- 11 files changed, 69 insertions(+), 279 deletions(-) diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart index 0aba9876..c4a05ffe 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart @@ -17,7 +17,8 @@ class AuthorizedAdminListLogic extends BaseGetXController { state.pageNum.toString(), state.pageSize.toString(), '0', - '0'); + '0', + state.searchStr.value); List dataList = []; if (entity.errorCode!.codeIsSuccessful) { print("电子钥匙列表成功:${entity.data?.itemList}"); diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index c67cfbd1..31a49855 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -25,9 +25,6 @@ class _AuthorizedAdminListPageState extends State { final logic = Get.put(AuthorizedAdminListLogic()); final state = Get.find().state; - // late KeyInfos keyInfo; - // late LockMainEntity lockMainEntity; - @override void initState() { super.initState(); @@ -45,14 +42,6 @@ class _AuthorizedAdminListPageState extends State { @override Widget build(BuildContext context) { - // dynamic obj = ModalRoute.of(context)?.settings.arguments; - // if (obj != null && (obj["lockMainEntity"] != null)) { - // lockMainEntity = obj["lockMainEntity"]; - // } - // if (obj != null && (obj["keyInfo"] != null)) { - // keyInfo = obj["keyInfo"]; - // } - return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( @@ -88,82 +77,9 @@ class _AuthorizedAdminListPageState extends State { height: 64.h, ) ], - ) - /* - FutureBuilder>( - future: mockNetworkDataRequest(), - builder: (BuildContext context, - AsyncSnapshot> snapshot) { - //请求结束 - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - //请求失败 - return const Text('请求失败'); - } else { - //请求成功 - final List itemData = snapshot.data!; - - return Column( - children: [ - Expanded(child: _buildMainUI(itemData)), - SizedBox( - height: 20.h, - ), - AddBottomWhiteBtn( - btnName: - TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr, - onClick: () { - Navigator.pushNamed( - context, Routers.authorizedAdminManagePage, - arguments: { - "lockMainEntity": lockMainEntity, - "keyInfo": keyInfo - }).then((val) { - if (val != null) { - mockNetworkDataRequest(); - setState(() {}); - } - }); - }, - ), - SizedBox( - height: 64.h, - ) - ], - ); - } - } else { - //请求未结束 显示loading - return Container(); - } - }), - */ - ); + )); } - // //请求授权管理员列表 跟电子钥匙列表的接口一样,但必须在参数中加keyRight=1为授权管理员 - // Future> mockNetworkDataRequest() async { - // ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( - // '0', - // keyInfo.keyId.toString(), - // '', - // keyInfo.lockId.toString(), - // '', - // '1', - // '20', - // '0', - // '1'); - // if (entity.errorCode!.codeIsSuccessful) { - // print("电子钥匙列表成功:${entity.data?.itemList}"); - // } - // if (entity.data != null) { - // return entity.data!.itemList; - // } else { - // List dataList = []; - // return dataList; - // } - // } - Widget _buildMainUI(itemData) { List getItemData = itemData; return getItemData.isEmpty diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart index 11bd6b15..47ddc0b9 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart @@ -8,6 +8,7 @@ class AuthorizedAdminListState { var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 final itemDataList = [].obs; + final searchStr = ''.obs; AuthorizedAdminListState() { Map map = Get.arguments; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart index a0e94873..106ea751 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart @@ -18,7 +18,8 @@ class ElectronicKeyListLogic extends BaseGetXController { state.pageNum.toString(), state.pageSize.toString(), '0', - '0'); + '0', + state.searchController.text); List dataList = []; if (entity.errorCode!.codeIsSuccessful) { print("电子钥匙列表成功:${entity.data?.itemList}"); diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 1c100b0f..9fa0cf45 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -25,7 +25,6 @@ class _ElectronicKeyListPageState extends State { final logic = Get.put(ElectronicKeyListLogic()); final state = Get.find().state; late RefreshController _refreshController; - // late List itemDataList = []; @override void initState() { @@ -92,73 +91,7 @@ class _ElectronicKeyListPageState extends State { height: 64.h, ) ], - ) - /* - FutureBuilder>( - future: logic.mockNetworkDataRequest(), - builder: (BuildContext context, - AsyncSnapshot> snapshot) { - //请求结束 - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - //请求失败 - return const Text('请求失败'); - } else { - //请求成功 - itemDataList = snapshot.data!; - - return Column( - children: [ - _searchWidget(), - SizedBox( - height: 20.h, - ), - Expanded( - child: itemDataList.isEmpty - ? const NoData() - : SmartRefresher( - controller: _refreshController, - onRefresh: _refresh, - onLoading: _loadMore, - header: ClassicHeader( - height: 45.h, - releaseText: '松开手刷新', - refreshingText: '刷新中', - completeText: '刷新完成', - failedText: '刷新失败', - idleText: '下拉刷新', - ), - child: _buildMainUI(itemDataList), - )), - AddBottomWhiteBtn( - btnName: TranslationLoader.lanKeys!.sendKey!.tr, - onClick: () { - Navigator.pushNamed( - context, Routers.sendElectronicKeyManagePage, - arguments: { - "lockMainEntity": state.lockMainEntity.value, - "keyInfo": state.keyInfo.value - }).then((val) { - if (val != null) { - logic.mockNetworkDataRequest(); - setState(() {}); - } - }); - }, - ), - SizedBox( - height: 64.h, - ) - ], - ); - } - } else { - //请求未结束 显示loading - return Container(); - } - }), - */ - ); + )); } ///加载更多函数 @@ -196,7 +129,10 @@ class _ElectronicKeyListPageState extends State { maxLines: 1, // controller: _controller, autofocus: false, - + controller: state.searchController, + onSubmitted: (value) { + logic.mockNetworkDataRequest(); + }, decoration: InputDecoration( //输入里面输入文字内边距设置 contentPadding: const EdgeInsets.only( diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart index b51f5cef..f3c342a7 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart @@ -1,8 +1,10 @@ +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; class ElectronicKeyListState { + TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框 final keyInfo = KeyInfos().obs; final lockMainEntity = LockMainEntity().obs; var pageNum = 1.obs; //请求页码 diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index e3c7888c..0b21808c 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -8,22 +8,17 @@ class PasswordKeyListLogic extends BaseGetXController { final PasswordKeyListState state = PasswordKeyListState(); //请求密码钥匙列表 - Future> mockNetworkDataRequest() async { + void mockNetworkDataRequest() async { PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList( '0', state.keyInfo.value.lockId.toString(), '0', state.pageNum.toString(), - state.pageSize.toString()); - List dataList = []; + state.pageSize.toString(), + state.searchController.text); if (entity.errorCode!.codeIsSuccessful) { - print("密码钥匙列表成功:${entity.data?.itemList}"); - if (entity.data != null) { - dataList = entity.data!.itemList!; - } + state.itemDataList.value = entity.data!.itemList!; } - state.itemDataList.value = dataList; - return dataList; } //密码钥匙重置请求 diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index 86d82868..5b65a89e 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -23,7 +23,6 @@ class PasswordKeyListPage extends StatefulWidget { class _PasswordKeyListPageState extends State { final logic = Get.put(PasswordKeyListLogic()); final state = Get.find().state; - // late List _itemDataList = []; late RefreshController _refreshController; @@ -92,102 +91,32 @@ class _PasswordKeyListPageState extends State { height: 42.h, ) ], - ) - /* - FutureBuilder>( - future: logic.mockNetworkDataRequest(), - builder: (BuildContext context, - AsyncSnapshot> snapshot) { - //请求结束 - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - //请求失败 - return const Text('请求失败'); - } else { - //请求成功 - _itemDataList = snapshot.data!; - - return Column( - children: [ - _searchWidget(), - SizedBox( - height: 20.h, - ), - Expanded( - child: _itemDataList.isEmpty - ? const NoData() - : SmartRefresher( - controller: _refreshController, - onRefresh: _refresh, - onLoading: _loadMore, - enablePullUp: true, - enablePullDown: true, - header: ClassicHeader( - height: 45.h, - releaseText: '松开手刷新', - refreshingText: '刷新中', - completeText: '刷新完成', - failedText: '刷新失败', - idleText: '下拉刷新', - ), - child: _buildMainUI(_itemDataList), - )), - SizedBox( - height: 20.h, - ), - AddBottomWhiteBtn( - btnName: TranslationLoader.lanKeys!.getPassword!.tr, - onClick: () { - Navigator.pushNamed( - context, Routers.passwordKeyManagePage, - arguments: { - "lockMainEntity": state.lockMainEntity.value, - "keyInfo": state.keyInfo.value - }).then((val) { - if (val != null) { - logic.mockNetworkDataRequest(); - setState(() {}); - } - }); - }), - SizedBox( - height: 42.h, - ) - ], - ); - } - } else { - //请求未结束 显示loading - return Container(); - } - }), - */ - ); + )); } - ///加载更多函数 - Future _loadMore() async { - if (state.pageNum.value == 1) { - if (state.itemDataList.length < 10) { - _refreshController.loadComplete(); - } else { - state.pageNum.value++; - await logic.mockNetworkDataRequest(); - _refreshController.loadComplete(); - } - } else { - state.pageNum.value++; - await logic.mockNetworkDataRequest(); - _refreshController.loadComplete(); - } - } + // ///加载更多函数 + // Future _loadMore() async { + // if (state.pageNum.value == 1) { + // if (state.itemDataList.length < 10) { + // _refreshController.loadComplete(); + // } else { + // state.pageNum.value++; + // await logic.mockNetworkDataRequest(); + // _refreshController.loadComplete(); + // } + // } else { + // state.pageNum.value++; + // await logic.mockNetworkDataRequest(); + // _refreshController.loadComplete(); + // } + // } - ///刷新函数 - Future _refresh() async { - state.pageNum.value = 1; - await logic.mockNetworkDataRequest(); - _refreshController.refreshCompleted(); - } + // ///刷新函数 + // Future _refresh() async { + // state.pageNum.value = 1; + // await logic.mockNetworkDataRequest(); + // _refreshController.refreshCompleted(); + // } Widget _searchWidget() { return Container( @@ -200,7 +129,10 @@ class _PasswordKeyListPageState extends State { maxLines: 1, // controller: _controller, autofocus: false, - + controller: state.searchController, + onSubmitted: (value) { + logic.mockNetworkDataRequest(); + }, decoration: InputDecoration( //输入里面输入文字内边距设置 contentPadding: const EdgeInsets.only( diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart index c6c7cde1..de9cc5b5 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; @@ -8,6 +9,7 @@ class PasswordKeyListState { var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 final itemDataList = [].obs; + final TextEditingController searchController = TextEditingController(); PasswordKeyListState() { Map map = Get.arguments; diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 2468f419..b203f9f2 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -102,7 +102,8 @@ class ApiProvider extends BaseProvider { String pageNo, String pageSize, String startDate, - String keyRight) => + String keyRight, + String searchStr) => post( electronicKeyListURL.toUrl, jsonEncode({ @@ -114,7 +115,8 @@ class ApiProvider extends BaseProvider { 'pageNo': pageNo, 'pageSize': pageSize, 'startDate': startDate, - 'keyRight': keyRight + 'keyRight': keyRight, + 'searchStr': searchStr })); Future sendElectronicKey( @@ -323,12 +325,12 @@ class ApiProvider extends BaseProvider { post(getWifiServiceIpURL.toUrl, jsonEncode({})); Future passwordKeyList( - String keyStatus, - String lockId, - String operatorUid, - String pageNo, - String pageSize, - ) => + String keyStatus, + String lockId, + String operatorUid, + String pageNo, + String pageSize, + String searchStr) => post( passwordKeyListURL.toUrl, jsonEncode({ @@ -336,7 +338,8 @@ class ApiProvider extends BaseProvider { 'lockId': lockId, 'operatorUid': operatorUid, 'pageNo': pageNo, - 'pageSize': pageSize + 'pageSize': pageSize, + 'searchStr': searchStr })); Future resetPasswordKey(String lockId, String operatorUid) => post( @@ -960,7 +963,7 @@ class ApiProvider extends BaseProvider { // 更新ICCard序号 Future updateIdCardUserNoLoadData( - String lockId, String cardId, String cardUserNo) => + String lockId, String cardId, String cardUserNo) => post( updateICCardUserNoURL.toUrl, jsonEncode( diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index f3424af2..f64e2f05 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -128,9 +128,10 @@ class ApiRepository { String pageNo, String pageSize, String startDate, - String keyRight) async { + String keyRight, + String searchStr) async { final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus, - lockId, operatorUid, pageNo, pageSize, startDate, keyRight); + lockId, operatorUid, pageNo, pageSize, startDate, keyRight, searchStr); return ElectronicKeyListEntity.fromJson(res.body); } @@ -301,14 +302,14 @@ class ApiRepository { //密码列表 Future passwordKeyList( - String keyStatus, - String lockId, - String operatorUid, - String pageNo, - String pageSize, - ) async { + String keyStatus, + String lockId, + String operatorUid, + String pageNo, + String pageSize, + String searchStr) async { final res = await apiProvider.passwordKeyList( - keyStatus, lockId, operatorUid, pageNo, pageSize); + keyStatus, lockId, operatorUid, pageNo, pageSize, searchStr); return PasswordKeyListEntity.fromJson(res.body); } From 6d73934327ff8dbfc5f1a38df7b90fa01b2b73d2 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Thu, 19 Oct 2023 09:13:13 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=83=A8=E5=88=86=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendElectronicKey_logic.dart | 14 ++++++-------- .../sendElectronicKey_page.dart | 16 +++++++++++----- .../sendElectronicKey_state.dart | 2 ++ .../authorizedAdministratorList_page.dart | 2 +- .../lockUserManage/lockUserManageList_page.dart | 8 ++++++-- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart index 71b58301..d77924e2 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart @@ -13,22 +13,20 @@ class SendElectronicKeyLogic extends BaseGetXController { //发送钥匙请求 Future sendElectronicKeyRequest(BuildContext widgetContext) async { - String getFailureDateTime = '0'; - String getEffectiveDateTime = '0'; String lockID = state.keyInfo.value.lockId.toString(); String getKeyType = (int.parse(state.type.value) + 1).toString(); if (state.type.value == '0') { - getFailureDateTime = - state.failureDateTime.value.millisecondsSinceEpoch.toString(); - getEffectiveDateTime = - state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); + state.failureTimestamp.value = + state.failureDateTime.value.millisecondsSinceEpoch; + state.effectiveTimestamp.value = + state.effectiveDateTime.value.millisecondsSinceEpoch; } var entity = await ApiRepository.to.sendElectronicKey( createUser: state.isCreateUser.value ? "1" : "0", countryCode: state.countryCode.value, usernameType: '1', - endDate: getFailureDateTime, + endDate: state.failureTimestamp.value.toString(), faceAuthentication: state.isAuthentication.value == true ? '1' : '2', isCameraEnable: '2', isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2', @@ -39,7 +37,7 @@ class SendElectronicKeyLogic extends BaseGetXController { operatorUid: '', receiverUsername: state.emailOrPhoneController.text, remarks: '', - startDate: getEffectiveDateTime, + startDate: state.effectiveTimestamp.value.toString(), weekDays: state.weekdaysList); if (entity.errorCode!.codeIsSuccessful) { print('发送电子钥匙成功'); diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart index a55d88e7..20804f7a 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart @@ -214,9 +214,13 @@ class _SendElectronicKeyPageState extends State { Widget keyPeriodValidityWidget() { return Column( children: [ - CommonItem( + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, - rightTitle: "", + rightTitle: state.weekdaysList.isEmpty + ? '' + : state.weekdaysList + .reduce((value, element) => value + ',' + element) + .toString(), isHaveDirection: true, action: () async { var result = await Navigator.pushNamed( @@ -224,10 +228,12 @@ class _SendElectronicKeyPageState extends State { if (result != null) { result as Map; state.weekdaysList.value = result['validityValue']; - state.effectiveDateTime.value = result['starDate']; - state.failureDateTime.value = result['endDate']; + state.effectiveTimestamp.value = + result['starDate'].millisecondsSinceEpoch; + state.failureTimestamp.value = + result['endDate'].millisecondsSinceEpoch; } - }), + })), SizedBox( height: 10.h, ) diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart index 7c721187..1b79bc58 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart @@ -18,6 +18,8 @@ class SendElectronicKeyState { DateTime dateTime = DateTime.now(); final effectiveDateTime = DateTime.now().obs; final failureDateTime = DateTime.now().obs; + final effectiveTimestamp = 0.obs; + final failureTimestamp = 0.obs; var selectEffectiveDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}' diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart index a83233f1..cb258b47 100644 --- a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart +++ b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart @@ -70,7 +70,7 @@ class _AuthorizedAdministratorListPageState return Column( children: [ - _searchWidget(), + // _searchWidget(), Expanded(child: _buildMainUI(itemList)), ], ); diff --git a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList_page.dart b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList_page.dart index 2c313057..8508211c 100644 --- a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList_page.dart +++ b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList_page.dart @@ -20,6 +20,7 @@ class LockUserManageListPage extends StatefulWidget { class _LockUserManageListPageState extends State { List dataList = []; + final TextEditingController searchController = TextEditingController(); @override void initState() { @@ -94,8 +95,11 @@ class _LockUserManageListPageState extends State { child: TextField( //输入框一行 maxLines: 1, - // controller: _controller, + controller: searchController, autofocus: false, + onSubmitted: (value) { + lockUserListRequest(); + }, decoration: InputDecoration( //输入里面输入文字内边距设置 contentPadding: const EdgeInsets.only( @@ -140,7 +144,7 @@ class _LockUserManageListPageState extends State { //请求锁用户列表 Future> lockUserListRequest() async { LockUserListEntity entity = - await ApiRepository.to.lockUserList('1', '20', ''); + await ApiRepository.to.lockUserList('1', '20', searchController.text); if (entity.errorCode!.codeIsSuccessful) { setState(() { dataList = entity.data!;