Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
# Conflicts: # star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart # star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart # star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart # star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart # star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart
This commit is contained in:
commit
4a377f380e
@ -70,3 +70,21 @@ flutter build apk --split-per-abi --release --flavor sky -t lib/main_sky.dart
|
|||||||
```bash
|
```bash
|
||||||
apksigner verify --print-certs -v build/app/outputs/flutter-apk/app-sky-release.apk
|
apksigner verify --print-certs -v build/app/outputs/flutter-apk/app-sky-release.apk
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 用于Google Play发布的指南
|
||||||
|
https://www.gstatic.com/play-apps-publisher-rapid/signing-tool/prod/pepk-src.jar
|
||||||
|
1. 下载 Play Encrypt Private Key (PEPK) 工具,请注意 [pepk-src.jar中没有主清单属性](https://stackoverflow.com/questions/44719351/googles-pepk-src-not-working)
|
||||||
|
2. 生成密钥
|
||||||
|
```bash
|
||||||
|
java -jar android/google/pepk.jar --keystore=android/app/sky.jks --alias=upload --output=android/google/google_pek.zip --include-cert --rsa-aes-encryption --encryption-key-path=android/google/encryption_public_key.pem
|
||||||
|
```
|
||||||
|
3. 上传密钥
|
||||||
|
上传android/google/google_pek.zip文件到谷歌Play管理中心
|
||||||
|
4. 编译和上传 app bundle
|
||||||
|
```bash
|
||||||
|
flutter build appbundle --release --flavor sky -t lib/main_sky.dart
|
||||||
|
```
|
||||||
|
然后文件在:`build/app/outputs/bundle/skyRelease/app-sky-release.aab`
|
||||||
|
|
||||||
|
- 注意,这里的sky.jks和google_pek.zip和encryption_public_key.pem都是sky渠道的,和谷歌账号对应。如果需要使用其他谷歌账号,需要更换这两个文件。
|
||||||
|
|||||||
11
star_lock/android/google/encryption_public_key.pem
Normal file
11
star_lock/android/google/encryption_public_key.pem
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAk4KvDplvoZN04n0son5V
|
||||||
|
wrG4vN92MkPuXLWCpU97OaUJUKtlROZkhwrMMeFlLLYBJOsymN3J4qISDVQJRxpl
|
||||||
|
D7vNZfb0NE8WleTRdhOjkWGvtODczOK+ZmYy3xCSnsAAH4+GYdAH+35rVshJ4EcC
|
||||||
|
6ibeuPTOuboqtS6jXN7Zh+FH/LZ0rMUgSQ7+W6ydlo/05d2j+dAaEEc3YSo63/0W
|
||||||
|
waBAV35IXWhgxqllgVw3ZEW3wdBGtbF7Xp3NkS0NrJIFNdE6oyBe8Vdtc17+M2mA
|
||||||
|
bEuWHAbe0bj5kOG+XQYbZXy9TuK+/vS2KKsIEWDx1OewgcHZFP9qXkTfWGV2am8k
|
||||||
|
MKdT8XunatKIrUabroxjQMk/70F4uQ9/xKxk7vN+ouiJUYUlBw59THCkgi/Iyfdu
|
||||||
|
Df6+OFJCuuTU4KlhnH3LqT4WF7wDxuP5tryzG1qHYDtBAwrD3P7R3zkhkl4RtqWC
|
||||||
|
/J5L88XY/XjdN7OdPdMzmMsgDGQQw6dIRQSAEQhUEu2HAgMBAAE=
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
BIN
star_lock/android/google/google_pek.zip
Normal file
BIN
star_lock/android/google/google_pek.zip
Normal file
Binary file not shown.
BIN
star_lock/android/google/pepk.jar
Normal file
BIN
star_lock/android/google/pepk.jar
Normal file
Binary file not shown.
77
star_lock/assets/DoorLockLogEntity.json
Normal file
77
star_lock/assets/DoorLockLogEntity.json
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"errorCode": 0,
|
||||||
|
"description": "success",
|
||||||
|
"errorMsg": "success",
|
||||||
|
"data": {
|
||||||
|
"list": [{
|
||||||
|
"recordId": 42672,
|
||||||
|
"lockId": 1744,
|
||||||
|
"lockAlias": "T9A_d7d74b2f66b8",
|
||||||
|
"recordType": 130,
|
||||||
|
"recordTypeName": "防拆报警",
|
||||||
|
"username": "",
|
||||||
|
"operateDate": 1705852800000,
|
||||||
|
"imagesUrl": null,
|
||||||
|
"videoUrl": null,
|
||||||
|
"headUrl": "",
|
||||||
|
"userid": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"recordId": 42660,
|
||||||
|
"lockId": 1744,
|
||||||
|
"lockAlias": "T9A_d7d74b2f66b8",
|
||||||
|
"recordType": 220,
|
||||||
|
"recordTypeName": "逗留检测",
|
||||||
|
"username": "",
|
||||||
|
"operateDate": 1706494730335,
|
||||||
|
"imagesUrl": "http:\/\/oss-pre-starlock.star-lock.cn\/starchart\/T9A_d7d74b2f66b8-1706494718\/54c5044a-93bd-466d-a123-e1face292841.jpg",
|
||||||
|
"videoUrl": "http:\/\/oss-pre-starlock.star-lock.cn\/starchart\/T9A_d7d74b2f66b8-1706494718\/08a2b732-536b-4f06-9d20-778fdf94f137.mp4",
|
||||||
|
"headUrl": "",
|
||||||
|
"userid": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"recordId": 42659,
|
||||||
|
"lockId": 1744,
|
||||||
|
"lockAlias": "T9A_d7d74b2f66b8",
|
||||||
|
"recordType": 220,
|
||||||
|
"recordTypeName": "逗留检测",
|
||||||
|
"username": "",
|
||||||
|
"operateDate": 1706494672036,
|
||||||
|
"imagesUrl": "http:\/\/oss-pre-starlock.star-lock.cn\/starchart\/T9A_d7d74b2f66b8-1706494660\/d85dcea0-c402-4f68-8664-5641a0feabe3.jpg",
|
||||||
|
"videoUrl": "http:\/\/oss-pre-starlock.star-lock.cn\/starchart\/T9A_d7d74b2f66b8-1706494660\/f3de0384-63f8-4177-9611-d8c43707afce.mp4",
|
||||||
|
"headUrl": "",
|
||||||
|
"userid": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"recordId": 42658,
|
||||||
|
"lockId": 1744,
|
||||||
|
"lockAlias": "T9A_d7d74b2f66b8",
|
||||||
|
"recordType": 130,
|
||||||
|
"recordTypeName": "防拆报警",
|
||||||
|
"username": "",
|
||||||
|
"operateDate": 1706493793884,
|
||||||
|
"imagesUrl": "http:\/\/oss-pre-starlock.star-lock.cn\/starchart\/T9A_d7d74b2f66b8-1706493778\/f43ec840-ddaa-4d94-b759-7ae4384edd8f.jpg",
|
||||||
|
"videoUrl": "http:\/\/oss-pre-starlock.star-lock.cn\/starchart\/T9A_d7d74b2f66b8-1706493778\/b4a90c5c-d86f-4995-8365-d7e21a67a48d.mp4",
|
||||||
|
"headUrl": "",
|
||||||
|
"userid": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"recordId": 42657,
|
||||||
|
"lockId": 1744,
|
||||||
|
"lockAlias": "T9A_d7d74b2f66b8",
|
||||||
|
"recordType": 130,
|
||||||
|
"recordTypeName": "防拆报警",
|
||||||
|
"username": "",
|
||||||
|
"operateDate": 1706493715812,
|
||||||
|
"imagesUrl": "http:\/\/oss-pre-starlock.star-lock.cn\/starchart\/T9A_d7d74b2f66b8-1706493702\/928c2b1d-1cd4-4d7f-9e61-e9315f8c4547.jpg",
|
||||||
|
"videoUrl": "http:\/\/oss-pre-starlock.star-lock.cn\/starchart\/T9A_d7d74b2f66b8-1706493702\/29e8b8e4-cd79-436d-a384-3e50dacf5cc8.mp4",
|
||||||
|
"headUrl": "",
|
||||||
|
"userid": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pageNo": 1,
|
||||||
|
"pageSize": 5,
|
||||||
|
"pages": 4,
|
||||||
|
"total": 18
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,8 +18,8 @@
|
|||||||
- (BOOL)application:(UIApplication *)application
|
- (BOOL)application:(UIApplication *)application
|
||||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
|
|
||||||
[self initCloudPush];
|
// [self initCloudPush];
|
||||||
[CloudPushSDK sendNotificationAck:launchOptions];
|
// [CloudPushSDK sendNotificationAck:launchOptions];
|
||||||
XSFlutterManager *VC = [[XSFlutterManager alloc] init];
|
XSFlutterManager *VC = [[XSFlutterManager alloc] init];
|
||||||
self.window.rootViewController = VC;
|
self.window.rootViewController = VC;
|
||||||
[self.window makeKeyAndVisible];
|
[self.window makeKeyAndVisible];
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'package:aliyun_push/aliyun_push.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
@ -8,8 +7,6 @@ import 'package:permission_handler/permission_handler.dart';
|
|||||||
import 'package:star_lock/tools/app_manager.dart';
|
import 'package:star_lock/tools/app_manager.dart';
|
||||||
import 'package:star_lock/tools/bindings/app_binding.dart';
|
import 'package:star_lock/tools/bindings/app_binding.dart';
|
||||||
|
|
||||||
import 'package:star_lock/tools/storage.dart';
|
|
||||||
import 'package:star_lock/tools/xs_aliyunPush.dart';
|
|
||||||
import 'package:star_lock/translations/app_dept.dart';
|
import 'package:star_lock/translations/app_dept.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -17,7 +14,6 @@ import 'appRouters.dart';
|
|||||||
import 'baseWidget.dart';
|
import 'baseWidget.dart';
|
||||||
import 'tools/appRouteObserver.dart';
|
import 'tools/appRouteObserver.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
const MyApp({GlobalKey? key}) : super(key: key);
|
const MyApp({GlobalKey? key}) : super(key: key);
|
||||||
@ -50,7 +46,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
localeResolutionCallback: (locale, supportedLocales) {
|
localeResolutionCallback: (locale, supportedLocales) {
|
||||||
if (!supportedLocales.contains(locale)) {
|
if (!supportedLocales.contains(locale)) {
|
||||||
int idx = appSupportedLocales.indexWhere(
|
int idx = appSupportedLocales.indexWhere(
|
||||||
(element) => element.languageCode == locale!.languageCode);
|
(element) => element.languageCode == locale!.languageCode);
|
||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
locale = appSupportedLocales[idx];
|
locale = appSupportedLocales[idx];
|
||||||
} else {
|
} else {
|
||||||
@ -70,12 +66,12 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
backgroundColor: const Color(0xFFF6F6F6),
|
backgroundColor: const Color(0xFFF6F6F6),
|
||||||
primaryColor: const Color(0xFFFFFFFF),
|
primaryColor: const Color(0xFFFFFFFF),
|
||||||
textTheme: TextTheme(
|
textTheme: TextTheme(
|
||||||
//用在非Material组件上的文字显示,
|
//用在非Material组件上的文字显示,
|
||||||
bodyText1:
|
bodyText1:
|
||||||
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
||||||
//Material组件上的文字显示
|
//Material组件上的文字显示
|
||||||
bodyText2:
|
bodyText2:
|
||||||
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
||||||
button: TextStyle(fontSize: 28.sp)),
|
button: TextStyle(fontSize: 28.sp)),
|
||||||
iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)),
|
iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)),
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
@ -103,29 +99,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
// openBlueScan();
|
// openBlueScan();
|
||||||
|
|
||||||
initAliyunPush();
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化阿里云推送
|
|
||||||
void initAliyunPush() {
|
|
||||||
final aliyunPush = AliyunPush();
|
|
||||||
XSAliyunPushProvider().init(aliyunPush);
|
|
||||||
XSAliyunPushProvider().initAliyunPush();
|
|
||||||
|
|
||||||
if (Platform.isAndroid) {
|
|
||||||
XSAliyunPushProvider().initAliyunThirdPush();
|
|
||||||
}
|
|
||||||
|
|
||||||
//暂使用DeviceID推送
|
|
||||||
aliyunPush.getDeviceId().then((deviceId) async {
|
|
||||||
// print('得到的DeviceId$deviceId');
|
|
||||||
final data = await Storage.getString(saveUserLoginData);
|
|
||||||
if (data!.isNotEmpty && deviceId.isNotEmpty) {
|
|
||||||
XSAliyunPushProvider()
|
|
||||||
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -135,7 +108,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void openBlueScan() {
|
void openBlueScan() {
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
print("有蓝牙权限开始扫描");
|
print("有蓝牙权限开始扫描");
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
||||||
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_page.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_page.dart';
|
||||||
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart';
|
||||||
@ -59,7 +60,6 @@ import 'main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdayS
|
|||||||
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart';
|
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart';
|
||||||
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart';
|
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart';
|
||||||
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart';
|
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart';
|
||||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord_page.dart';
|
|
||||||
import 'main/lockDetail/face/addFace/addFace_page.dart';
|
import 'main/lockDetail/face/addFace/addFace_page.dart';
|
||||||
import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart';
|
import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart';
|
||||||
import 'main/lockDetail/face/faceList/faceList_page.dart';
|
import 'main/lockDetail/face/faceList/faceList_page.dart';
|
||||||
|
|||||||
@ -8,10 +8,8 @@ import 'package:star_lock/blue/io_type.dart';
|
|||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_protocol/io_addUser.dart';
|
|
||||||
import '../../../../blue/io_reply.dart';
|
import '../../../../blue/io_reply.dart';
|
||||||
import '../../../../blue/io_protocol/io_transferPermissions.dart';
|
import '../../../../blue/io_protocol/io_transferPermissions.dart';
|
||||||
import '../../../../blue/io_tool/io_manager.dart';
|
|
||||||
import '../../../../blue/io_tool/io_tool.dart';
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../../blue/sender_manage.dart';
|
import '../../../../blue/sender_manage.dart';
|
||||||
@ -163,7 +161,8 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 转移权限
|
// 转移权限
|
||||||
Future<void> transferPermissionsAction() async {
|
Future<void> transferPermissionsAction() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(DeviceConnectionState state) async {
|
||||||
if (state == DeviceConnectionState.connected) {
|
if (state == DeviceConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -228,33 +227,47 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//发送授权管理员列表请求
|
//发送授权管理员列表请求
|
||||||
Future<void> sendElectronicKeyRequest() async {
|
Future<void> sendElectronicKeyRequest() async {
|
||||||
if(state.emailOrPhoneController.text.isEmpty){
|
if (state.emailOrPhoneController.text.isEmpty) {
|
||||||
showToast("请输入接收者账号");
|
showToast("请输入接收者账号");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(state.keyNameController.text.isEmpty){
|
if (state.keyNameController.text.isEmpty) {
|
||||||
showToast("请输入接收者姓名");
|
showToast("请输入接收者姓名");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getFailureDateTime = '0';
|
// String getFailureDateTime = '0';
|
||||||
String getEffectiveDateTime = '0';
|
// String getEffectiveDateTime = '0';
|
||||||
String lockID = state.keyInfo.value.lockId.toString();
|
String lockID = state.keyInfo.value.lockId.toString();
|
||||||
Get.log("state.type.value:${state.type.value}");
|
Get.log("state.type.value:${state.type.value}");
|
||||||
String getKeyType = "1";
|
String getKeyType = "1";
|
||||||
if (state.type.value == '0') {
|
if (state.type.value == '0') {
|
||||||
getKeyType = "2";
|
getKeyType = "2";
|
||||||
getFailureDateTime = state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
// getFailureDateTime =
|
||||||
getEffectiveDateTime = state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
// state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||||
|
// getEffectiveDateTime =
|
||||||
|
// state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
||||||
|
|
||||||
DateTime startDateTime = DateTime(state.effectiveDateTime.value.year, state.effectiveDateTime.value.month, state.effectiveDateTime.value.day, state.effectiveDateTime.value.hour, state.effectiveDateTime.value.minute);
|
DateTime startDateTime = DateTime(
|
||||||
DateTime endDateTime = DateTime(state.failureDateTime.value.year, state.failureDateTime.value.month, state.failureDateTime.value.day, state.failureDateTime.value.hour, state.failureDateTime.value.minute);
|
state.effectiveDateTime.value.year,
|
||||||
if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) {
|
state.effectiveDateTime.value.month,
|
||||||
|
state.effectiveDateTime.value.day,
|
||||||
|
state.effectiveDateTime.value.hour,
|
||||||
|
state.effectiveDateTime.value.minute);
|
||||||
|
DateTime endDateTime = DateTime(
|
||||||
|
state.failureDateTime.value.year,
|
||||||
|
state.failureDateTime.value.month,
|
||||||
|
state.failureDateTime.value.day,
|
||||||
|
state.failureDateTime.value.hour,
|
||||||
|
state.failureDateTime.value.minute);
|
||||||
|
if (!startDateTime.isBefore(endDateTime) ||
|
||||||
|
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||||
showToast("失效时间需大于生效时间");
|
showToast("失效时间需大于生效时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
|
if (!startDateTime.isBefore(DateTime.now()) ||
|
||||||
|
startDateTime.isAtSameMomentAs(DateTime.now())) {
|
||||||
showToast("生效时间需大于当前时间");
|
showToast("生效时间需大于当前时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -264,7 +277,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
createUser: state.isCreateUser.value ? "1" : "0",
|
createUser: state.isCreateUser.value ? "1" : "0",
|
||||||
countryCode: state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
usernameType: '1',
|
usernameType: '1',
|
||||||
endDate: getFailureDateTime,
|
endDate: state.failureDateTime.value.millisecondsSinceEpoch,
|
||||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||||
isCameraEnable: '2',
|
isCameraEnable: '2',
|
||||||
isRemoteUnlock: '2',
|
isRemoteUnlock: '2',
|
||||||
@ -275,8 +288,10 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
operatorUid: '',
|
operatorUid: '',
|
||||||
receiverUsername: state.emailOrPhoneController.text,
|
receiverUsername: state.emailOrPhoneController.text,
|
||||||
remarks: '',
|
remarks: '',
|
||||||
startDate: getEffectiveDateTime,
|
startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
|
||||||
weekDays: state.weekdaysList);
|
weekDays: state.weekdaysList,
|
||||||
|
startTime: state.startTime.value,
|
||||||
|
endTime: state.endTime.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print('发送电子钥匙成功');
|
print('发送电子钥匙成功');
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateUtils.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
@ -135,10 +136,11 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.selectEffectiveDate.value =
|
state.effectiveDateTime.value = XSDateUtils.parseDateTime(
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
state.effectiveDateTime.value =
|
'yyyy-mm-dd HH:mm');
|
||||||
DateTime.parse(state.selectEffectiveDate.value);
|
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
||||||
|
state.effectiveDateTime.value, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -150,10 +152,11 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.selectFailureDate.value =
|
state.failureDateTime.value = XSDateUtils.parseDateTime(
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
state.failureDateTime.value =
|
'yyyy-mm-dd HH:mm');
|
||||||
DateTime.parse(state.selectFailureDate.value);
|
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
||||||
|
state.failureDateTime.value, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -286,13 +289,15 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
OutLineBtn(
|
OutLineBtn(
|
||||||
btnName: state.emailOrPhoneController.text.contains("@")?'邮件通知':"短信通知",
|
btnName:
|
||||||
|
state.emailOrPhoneController.text.contains("@") ? '邮件通知' : "短信通知",
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if(state.emailOrPhoneController.text.contains("@")){
|
if (state.emailOrPhoneController.text.contains("@")) {
|
||||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||||
}else{
|
} else {
|
||||||
// _openModalBottomSheet();
|
// _openModalBottomSheet();
|
||||||
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
|
NativeInteractionTool.loadNativeShare(
|
||||||
|
shareText: state.pwdShareStr);
|
||||||
}
|
}
|
||||||
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
|
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
|
||||||
},
|
},
|
||||||
@ -304,7 +309,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
btnName: '微信通知',
|
btnName: '微信通知',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
// _openModalBottomSheet();
|
// _openModalBottomSheet();
|
||||||
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
|
NativeInteractionTool.loadNativeShare(shareText: state.pwdShareStr);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -345,10 +350,18 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
hintText: tfStr,
|
hintText: tfStr,
|
||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
|
focusedBorder: const OutlineInputBorder(
|
||||||
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
|
borderSide:
|
||||||
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
border: 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),
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
),
|
),
|
||||||
// decoration: InputDecoration(
|
// decoration: InputDecoration(
|
||||||
@ -389,7 +402,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentContact.fullName!.isNotEmpty) {
|
if (currentContact.fullName!.isNotEmpty) {
|
||||||
state.keyNameController.text = currentContact.fullName!;
|
state.keyNameController.text =
|
||||||
|
currentContact.fullName!;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -416,10 +430,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? "0$v" : "$v";
|
|
||||||
}
|
|
||||||
|
|
||||||
Future _openModalBottomSheet() async {
|
Future _openModalBottomSheet() async {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@ -443,7 +453,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
TextButton(
|
TextButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
overlayColor:
|
overlayColor:
|
||||||
MaterialStateProperty.all<Color>(Colors.white)),
|
MaterialStateProperty.all<Color>(Colors.white)),
|
||||||
child: Text(
|
child: Text(
|
||||||
'取消',
|
'取消',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -469,13 +479,14 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
return widgetList;
|
return widgetList;
|
||||||
}
|
}
|
||||||
|
|
||||||
GestureDetector buildCenter3(String imageName, String titleStr, int itemIndex) {
|
GestureDetector buildCenter3(
|
||||||
|
String imageName, String titleStr, int itemIndex) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 120.w,
|
width: 120.w,
|
||||||
// height: 64.h,
|
// height: 64.h,
|
||||||
margin:
|
margin:
|
||||||
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
|
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@ -504,31 +515,30 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
Get.back();
|
Get.back();
|
||||||
switch (itemIndex) {
|
switch (itemIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
//微信好友
|
//微信好友
|
||||||
{
|
{
|
||||||
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
|
NativeInteractionTool.loadNativeShare(shareText: state.pwdShareStr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//短信
|
//短信
|
||||||
{
|
{
|
||||||
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
|
NativeInteractionTool.loadNativeShare(shareText: state.pwdShareStr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//邮件
|
//邮件
|
||||||
{
|
{
|
||||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//更多
|
//更多
|
||||||
{
|
{
|
||||||
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
|
NativeInteractionTool.loadNativeShare(shareText: state.pwdShareStr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -6,8 +5,10 @@ import 'package:get/get.dart';
|
|||||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
class AuthorizedAdminState {
|
class AuthorizedAdminState {
|
||||||
final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框
|
final TextEditingController emailOrPhoneController =
|
||||||
final TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
TextEditingController(); //邮箱/手机号输入框
|
||||||
|
final TextEditingController keyNameController =
|
||||||
|
TextEditingController(); //钥匙名输入框
|
||||||
|
|
||||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||||
late Contact contact;
|
late Contact contact;
|
||||||
@ -20,8 +21,15 @@ class AuthorizedAdminState {
|
|||||||
final effectiveDateTime = DateTime.now().obs;
|
final effectiveDateTime = DateTime.now().obs;
|
||||||
final failureDateTime = DateTime.now().obs;
|
final failureDateTime = DateTime.now().obs;
|
||||||
|
|
||||||
var selectEffectiveDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
var selectEffectiveDate =
|
||||||
var selectFailureDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||||
|
.obs; //默认为当前时间
|
||||||
|
var selectFailureDate =
|
||||||
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||||
|
.obs; //默认为当前时间
|
||||||
|
|
||||||
|
var startTime = 0.obs;
|
||||||
|
var endTime = 0.obs;
|
||||||
|
|
||||||
var isSendSuccess = false.obs;
|
var isSendSuccess = false.obs;
|
||||||
var countryName = '中国'.obs;
|
var countryName = '中国'.obs;
|
||||||
@ -38,4 +46,4 @@ class AuthorizedAdminState {
|
|||||||
// lockMainEntity.value = map["lockMainEntity"];
|
// lockMainEntity.value = map["lockMainEntity"];
|
||||||
keyInfo.value = map["keyInfo"];
|
keyInfo.value = map["keyInfo"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,119 @@
|
|||||||
|
class DoorLockLogEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
|
DoorLockLogEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
DoorLockLogEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['errorCode'] = errorCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['errorMsg'] = errorMsg;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data!.toJson();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
List<DoorLockLogDataItem>? itemList;
|
||||||
|
int? pageNo;
|
||||||
|
int? pageSize;
|
||||||
|
int? pages;
|
||||||
|
int? total;
|
||||||
|
|
||||||
|
Data({this.itemList, this.pageNo, this.pageSize, this.pages, this.total});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['list'] != null) {
|
||||||
|
itemList = <DoorLockLogDataItem>[];
|
||||||
|
json['list'].forEach((v) {
|
||||||
|
itemList!.add(DoorLockLogDataItem.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
pageNo = json['pageNo'];
|
||||||
|
pageSize = json['pageSize'];
|
||||||
|
pages = json['pages'];
|
||||||
|
total = json['total'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (itemList != null) {
|
||||||
|
data['list'] = itemList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['pageNo'] = pageNo;
|
||||||
|
data['pageSize'] = pageSize;
|
||||||
|
data['pages'] = pages;
|
||||||
|
data['total'] = total;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DoorLockLogDataItem {
|
||||||
|
int? recordId;
|
||||||
|
int? lockId;
|
||||||
|
String? lockAlias;
|
||||||
|
int? recordType;
|
||||||
|
String? recordTypeName;
|
||||||
|
String? username;
|
||||||
|
int? operateDate;
|
||||||
|
String? imagesUrl;
|
||||||
|
String? videoUrl;
|
||||||
|
String? headUrl;
|
||||||
|
String? userid;
|
||||||
|
|
||||||
|
DoorLockLogDataItem(
|
||||||
|
{this.recordId,
|
||||||
|
this.lockId,
|
||||||
|
this.lockAlias,
|
||||||
|
this.recordType,
|
||||||
|
this.recordTypeName,
|
||||||
|
this.username,
|
||||||
|
this.operateDate,
|
||||||
|
this.imagesUrl,
|
||||||
|
this.videoUrl,
|
||||||
|
this.headUrl,
|
||||||
|
this.userid});
|
||||||
|
|
||||||
|
DoorLockLogDataItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
recordId = json['recordId'];
|
||||||
|
lockId = json['lockId'];
|
||||||
|
lockAlias = json['lockAlias'];
|
||||||
|
recordType = json['recordType'];
|
||||||
|
recordTypeName = json['recordTypeName'];
|
||||||
|
username = json['username'];
|
||||||
|
operateDate = json['operateDate'];
|
||||||
|
imagesUrl = json['imagesUrl'];
|
||||||
|
videoUrl = json['videoUrl'];
|
||||||
|
headUrl = json['headUrl'];
|
||||||
|
userid = json['userid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['recordId'] = recordId;
|
||||||
|
data['lockId'] = lockId;
|
||||||
|
data['lockAlias'] = lockAlias;
|
||||||
|
data['recordType'] = recordType;
|
||||||
|
data['recordTypeName'] = recordTypeName;
|
||||||
|
data['username'] = username;
|
||||||
|
data['operateDate'] = operateDate;
|
||||||
|
data['imagesUrl'] = imagesUrl;
|
||||||
|
data['videoUrl'] = videoUrl;
|
||||||
|
data['headUrl'] = headUrl;
|
||||||
|
data['userid'] = userid;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,12 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
import 'package:star_lock/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
@ -15,7 +19,6 @@ import '../../../blue/sender_manage.dart';
|
|||||||
import '../../../network/api_repository.dart';
|
import '../../../network/api_repository.dart';
|
||||||
import '../../../tools/baseGetXController.dart';
|
import '../../../tools/baseGetXController.dart';
|
||||||
import '../../../tools/storage.dart';
|
import '../../../tools/storage.dart';
|
||||||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
|
||||||
|
|
||||||
class DoorLockLogLogic extends BaseGetXController {
|
class DoorLockLogLogic extends BaseGetXController {
|
||||||
DoorLockLogState state = DoorLockLogState();
|
DoorLockLogState state = DoorLockLogState();
|
||||||
@ -186,16 +189,17 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//请求操作记录列表(门锁日志)
|
//请求操作记录列表(门锁日志)
|
||||||
void mockNetworkDataRequest() async {
|
void mockNetworkDataRequest() async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockEventList(
|
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
||||||
lockId: state.keyInfos.value.lockId!,
|
lockId: state.keyInfos.value.lockId!,
|
||||||
lockEventType: state.dropdownValue.value,
|
lockEventType: state.dropdownValue.value,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
startDate: state.startDate.value,
|
startDate: state.startDate.value,
|
||||||
endDate: state.endDate.value);
|
endDate: state.endDate.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("操作记录列表成功:${entity.data?.itemList}");
|
if (state.lockLogEntity.value.errorCode!.codeIsSuccessful) {
|
||||||
state.lockOperatingRecordListData.value = entity.data!.itemList!;
|
print("操作记录列表成功:${state.lockLogEntity.value.data?.itemList}");
|
||||||
|
state.lockLogItemList.value = state.lockLogEntity.value.data!.itemList!;
|
||||||
} else {}
|
} else {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,35 +263,27 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
_initReplySubscription();
|
// _initReplySubscription();
|
||||||
|
|
||||||
mockNetworkDataRequest();
|
// mockNetworkDataRequest();
|
||||||
_getDoorLockLogListRefreshUIAction();
|
// _getDoorLockLogListRefreshUIAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onInit() async {
|
Future<void> onInit() async {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
print("onInit()");
|
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
// getLockRecordLastUploadDataTime();
|
getLockRecordLastUploadDataTime();
|
||||||
// senderReferEventRecordTime();
|
// senderReferEventRecordTime();
|
||||||
// senderReferEventRecordNumber();
|
// senderReferEventRecordNumber();
|
||||||
}
|
|
||||||
|
|
||||||
DateTime now = DateTime.now();
|
testReadJsonData();
|
||||||
// 设置startDate为当天的0点
|
mockNetworkDataRequest();
|
||||||
state.startDate.value =
|
}
|
||||||
DateTime(now.year, now.month, now.day).millisecondsSinceEpoch;
|
|
||||||
// 设置endDate为下一天的0点,然后减去1毫秒
|
|
||||||
state.endDate.value = (DateTime(now.year, now.month, now.day + 1)
|
|
||||||
.subtract(const Duration(milliseconds: 1)))
|
|
||||||
.millisecondsSinceEpoch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -302,4 +298,15 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
_getDoorLockLogListRefreshUIEvent?.cancel();
|
_getDoorLockLogListRefreshUIEvent?.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//测试方法,得到真实数据后删除
|
||||||
|
testReadJsonData() async {
|
||||||
|
// 读取JSON文件
|
||||||
|
String jsonString =
|
||||||
|
await rootBundle.loadString('assets/DoorLockLogEntity.json');
|
||||||
|
|
||||||
|
// 解析JSON数据并转换为实体对象
|
||||||
|
Map<String, dynamic> jsonData = json.decode(jsonString);
|
||||||
|
state.lockLogEntity.value = DoorLockLogEntity.fromJson(jsonData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
||||||
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
||||||
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
||||||
@ -66,15 +67,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
|||||||
endIndent: 30.w,
|
endIndent: 30.w,
|
||||||
),
|
),
|
||||||
eventDropDownWidget(),
|
eventDropDownWidget(),
|
||||||
// Expanded(child: timeLineView())
|
Expanded(child: Obx(() => timeLineView(state.lockLogItemList.value)))
|
||||||
Expanded(
|
|
||||||
child: ListView.builder(
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return timeLineView();
|
|
||||||
},
|
|
||||||
itemCount: state.lockOperatingRecordListData.value.length,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -123,7 +116,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
|||||||
//事件下拉框组件
|
//事件下拉框组件
|
||||||
Widget eventDropDownWidget() {
|
Widget eventDropDownWidget() {
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.only(top: 20.h, left: 30.w, bottom: 20.h),
|
margin: EdgeInsets.only(top: 20.h, left: 30.w, bottom: 10.h, right: 20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -131,7 +124,6 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
|||||||
items: state.getDropDownItemList,
|
items: state.getDropDownItemList,
|
||||||
value: state.dropdownTitle.value,
|
value: state.dropdownTitle.value,
|
||||||
valueChanged: (value) {
|
valueChanged: (value) {
|
||||||
print('dropdownValue选中了$value');
|
|
||||||
state.dropdownValue.value = int.parse(value);
|
state.dropdownValue.value = int.parse(value);
|
||||||
logic.mockNetworkDataRequest();
|
logic.mockNetworkDataRequest();
|
||||||
})),
|
})),
|
||||||
@ -141,64 +133,96 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//时间轴组件
|
//时间轴组件
|
||||||
Widget timeLineView() {
|
Widget timeLineView(List<DoorLockLogDataItem> timelineDataList) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h, top: 20.h),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h, top: 20.h),
|
||||||
//给contain设置一个10像素的圆角
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white, borderRadius: BorderRadius.circular(16.w)),
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(16.w),
|
||||||
|
),
|
||||||
child: Timeline.tileBuilder(
|
child: Timeline.tileBuilder(
|
||||||
builder: TimelineTileBuilder.fromStyle(
|
builder: TimelineTileBuilder.fromStyle(
|
||||||
contentsAlign: ContentsAlign.basic,
|
contentsAlign: ContentsAlign.basic,
|
||||||
contentsBuilder: (context, index) => Padding(
|
itemCount: timelineDataList.length,
|
||||||
padding: EdgeInsets.only(left: 20.w, top: 20.h),
|
contentsBuilder: (context, index) {
|
||||||
child: Column(
|
DoorLockLogDataItem timelineData = timelineDataList[index];
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
DateTime dateTime =
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
DateTime.fromMillisecondsSinceEpoch(timelineData.operateDate!);
|
||||||
children: [
|
String formattedTime =
|
||||||
Text('09:30 有人出现在门口',
|
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(left: 20.w, top: 20.h),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'$formattedTime ${timelineData.recordTypeName}',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontSize: 24.sp,
|
fontSize: 24.sp,
|
||||||
fontWeight: FontWeight.w600)),
|
fontWeight: FontWeight.w600,
|
||||||
GestureDetector(
|
),
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(Routers.videoLogDetailPage);
|
|
||||||
},
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Image(
|
|
||||||
image: const AssetImage(
|
|
||||||
'images/main/icon_lockDetail_monitoringvoiceFrist.png'),
|
|
||||||
width: 260.w,
|
|
||||||
height: 260.h,
|
|
||||||
),
|
|
||||||
//在图片上添加一个三角视频图标
|
|
||||||
Positioned(
|
|
||||||
top: 200.h,
|
|
||||||
left: 10.w,
|
|
||||||
child: Image(
|
|
||||||
image: const AssetImage(
|
|
||||||
'images/main/icon_lockLog_play.png'),
|
|
||||||
width: 24.w,
|
|
||||||
height: 20.w,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
],
|
height: 10.h,
|
||||||
),
|
),
|
||||||
),
|
GestureDetector(
|
||||||
itemCount: 10,
|
onTap: () {
|
||||||
|
Get.toNamed(Routers.videoLogDetailPage);
|
||||||
|
},
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
timelineData.imagesUrl != null
|
||||||
|
?
|
||||||
|
// Image.network(
|
||||||
|
// timelineData.imagesUrl!,
|
||||||
|
// width: 260.w,
|
||||||
|
// height: 260.h,
|
||||||
|
// )
|
||||||
|
Image(
|
||||||
|
image: const AssetImage(
|
||||||
|
'images/main/icon_lockDetail_monitoringvoiceFrist.png'),
|
||||||
|
width: 240.w,
|
||||||
|
height: 180.h,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
Positioned(
|
||||||
|
top: 150.h,
|
||||||
|
left: 10.w,
|
||||||
|
child: Image(
|
||||||
|
image: const AssetImage(
|
||||||
|
'images/main/icon_lockLog_play.png'),
|
||||||
|
width: 24.w,
|
||||||
|
height: 20.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
theme: TimelineThemeData(
|
theme: TimelineThemeData(
|
||||||
nodePosition: 0.04, //居左侧距离
|
nodePosition: 0.04, //居左侧距离
|
||||||
connectorTheme: const ConnectorThemeData(
|
connectorTheme: const ConnectorThemeData(
|
||||||
thickness: 1.0, color: AppColors.greyLineColor, indent: 0.5),
|
thickness: 1.0,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
indent: 0.5,
|
||||||
|
),
|
||||||
indicatorTheme: const IndicatorThemeData(
|
indicatorTheme: const IndicatorThemeData(
|
||||||
size: 8.0, color: AppColors.greyLineColor, position: 0.07),
|
size: 8.0,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
position: 0.4,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,14 +1,15 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/tools/advancedCalendar/src/controller.dart';
|
import 'package:star_lock/tools/advancedCalendar/src/controller.dart';
|
||||||
import 'package:star_lock/tools/menuItem/dropDownItem.dart';
|
import 'package:star_lock/tools/menuItem/dropDownItem.dart';
|
||||||
|
|
||||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
|
||||||
|
|
||||||
class DoorLockLogState {
|
class DoorLockLogState {
|
||||||
|
final lockLogEntity = DoorLockLogEntity().obs;
|
||||||
final keyInfos = LockListInfoItemEntity().obs;
|
final keyInfos = LockListInfoItemEntity().obs;
|
||||||
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
final lockLogItemList = <DoorLockLogDataItem>[].obs;
|
||||||
final calendarControllerToday = AdvancedCalendarController.today();
|
final calendarControllerToday = AdvancedCalendarController.today();
|
||||||
final calendarControllerCustom = AdvancedCalendarController.today();
|
final calendarControllerCustom = AdvancedCalendarController.today();
|
||||||
final events = <DateTime>[
|
final events = <DateTime>[
|
||||||
@ -16,8 +17,15 @@ class DoorLockLogState {
|
|||||||
DateTime(2024, 10, 10),
|
DateTime(2024, 10, 10),
|
||||||
];
|
];
|
||||||
|
|
||||||
final startDate = 0.obs;
|
final startDate =
|
||||||
final endDate = 0.obs;
|
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
|
||||||
|
.millisecondsSinceEpoch
|
||||||
|
.obs;
|
||||||
|
final endDate = (DateTime(
|
||||||
|
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1)
|
||||||
|
.subtract(const Duration(milliseconds: 1)))
|
||||||
|
.millisecondsSinceEpoch
|
||||||
|
.obs;
|
||||||
|
|
||||||
var dropdownTitle = '全部事件'.obs;
|
var dropdownTitle = '全部事件'.obs;
|
||||||
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -23,7 +23,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
state.itemData.value.keyName = state.changeNameController.text;
|
state.itemData.value.keyName = state.changeNameController.text;
|
||||||
state.keyName.value = state.itemData.value.keyName!;
|
state.keyName.value = state.itemData.value.keyName!;
|
||||||
Get.back();
|
Get.back();
|
||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
});
|
});
|
||||||
@ -36,7 +36,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
.deleteElectronicKey(state.itemData.value.keyId.toString());
|
.deleteElectronicKey(state.itemData.value.keyId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("删除电子钥匙成功");
|
print("删除电子钥匙成功");
|
||||||
showToast("删除成功", something: (){
|
showToast("删除成功", something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
Get.back();
|
Get.back();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -18,14 +18,14 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
|||||||
keyboardPwdId: state.pwdId.value.toString(),
|
keyboardPwdId: state.pwdId.value.toString(),
|
||||||
keyboardPwdName: state.inputNameController.text,
|
keyboardPwdName: state.inputNameController.text,
|
||||||
newKeyboardPwd: state.inputPwdController.text,
|
newKeyboardPwd: state.inputPwdController.text,
|
||||||
startDate: state.beginTimeTimestamp.value,
|
startDate: state.effectiveDateTime.millisecondsSinceEpoch,
|
||||||
endDate: state.endTimeTimestamp.value,
|
endDate: state.failureDateTime.millisecondsSinceEpoch,
|
||||||
changeType: state.changeType.value,
|
changeType: state.changeType.value,
|
||||||
hoursStart: state.hoursStart.value,
|
hoursStart: state.hoursStart.value,
|
||||||
hoursEnd: state.hoursEnd.value,
|
hoursEnd: state.hoursEnd.value,
|
||||||
isCoerced: state.isCoerced.value);
|
isCoerced: state.isCoerced.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -33,11 +33,13 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改钥匙请求
|
//编辑电子钥匙有效期请求
|
||||||
Future<void> updateKeyDateRequest() async {
|
Future<void> updateKeyDateRequest() async {
|
||||||
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
|
var beginTimeTimestamp =
|
||||||
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
|
state.effectiveDateTime.millisecondsSinceEpoch ~/ 1000;
|
||||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
var endTimeTimestamp = state.failureDateTime.millisecondsSinceEpoch ~/ 1000;
|
||||||
|
if (beginTimeTimestamp > endTimeTimestamp ||
|
||||||
|
beginTimeTimestamp == endTimeTimestamp) {
|
||||||
showToast("失效时间需大于生效时间");
|
showToast("失效时间需大于生效时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -49,19 +51,17 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
|||||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||||
state.itemData.value.keyId.toString(),
|
state.itemData.value.keyId.toString(),
|
||||||
state.itemData.value.lockId.toString(),
|
state.itemData.value.lockId.toString(),
|
||||||
state.endTimeTimestamp.value.toString(),
|
state.failureDateTime.millisecondsSinceEpoch.toString(),
|
||||||
state.endDay.value,
|
state.effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||||
'',
|
state.weekDays.value,
|
||||||
state.beginTimeTimestamp.value.toString(),
|
state.itemData.value.keyType! == 1 ? 2 : state.itemData.value.keyType!);
|
||||||
state.startDay.value,
|
|
||||||
state.weekDays.value);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
"beginTimeTimestamp": beginTimeTimestamp,
|
||||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
"endTimeTimestamp": endTimeTimestamp,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart';
|
||||||
|
import 'package:star_lock/tools/dateUtils.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
|
||||||
@ -73,32 +74,34 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.beginTime.value,
|
rightTitle: state.selectEffectiveDate.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
state.beginTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
onConfirm: (p) {
|
||||||
state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch;
|
state.effectiveDateTime = XSDateUtils.parseDateTime(
|
||||||
print("state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}");
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
|
'yyyy-mm-dd HH:mm');
|
||||||
|
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
||||||
|
state.effectiveDateTime, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: state.endTime.value,
|
rightTitle: state.selectFailureDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
state.endTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
onConfirm: (p) {
|
||||||
state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch;
|
state.failureDateTime = XSDateUtils.parseDateTime(
|
||||||
print("state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
|
'yyyy-mm-dd HH:mm');
|
||||||
|
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
||||||
|
state.failureDateTime, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? "0$v" : "$v";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,21 +16,10 @@ class ElectronicKeyDetailChangeDateState {
|
|||||||
final pwdId = ''.obs;
|
final pwdId = ''.obs;
|
||||||
final lockId = 0.obs;
|
final lockId = 0.obs;
|
||||||
final fromType = ''.obs;
|
final fromType = ''.obs;
|
||||||
|
final selectEffectiveDate = ''.obs; //生效时间
|
||||||
// final startDate = 0.obs;
|
final selectFailureDate = ''.obs; //失效时间
|
||||||
// final endDate = 0.obs;
|
DateTime effectiveDateTime = DateTime.now();
|
||||||
// final selectEffectiveDate = ''.obs; //生效时间
|
DateTime failureDateTime = DateTime.now();
|
||||||
// final selectFailureDate = ''.obs; //失效时间
|
|
||||||
// DateTime effectiveDateTime = DateTime.now();
|
|
||||||
// DateTime failureDateTime = DateTime.now();
|
|
||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
|
||||||
var endTime = "".obs;// 结束时间
|
|
||||||
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
|
||||||
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
|
||||||
|
|
||||||
final endDay = ''.obs;
|
|
||||||
final startDay = ''.obs;
|
|
||||||
final weekDays = [].obs;
|
final weekDays = [].obs;
|
||||||
|
|
||||||
ElectronicKeyDetailChangeDateState() {
|
ElectronicKeyDetailChangeDateState() {
|
||||||
@ -38,10 +27,10 @@ class ElectronicKeyDetailChangeDateState {
|
|||||||
// itemData.value = map["itemData"];
|
// itemData.value = map["itemData"];
|
||||||
if ((map["itemData"] != null)) {
|
if ((map["itemData"] != null)) {
|
||||||
itemData.value = map["itemData"];
|
itemData.value = map["itemData"];
|
||||||
beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
|
// beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
|
||||||
endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
|
// endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
|
||||||
beginTimeTimestamp.value = itemData.value.startDate!;
|
// beginTimeTimestamp.value = itemData.value.startDate!;
|
||||||
endTimeTimestamp.value = itemData.value.endDate!;
|
// endTimeTimestamp.value = itemData.value.endDate!;
|
||||||
}
|
}
|
||||||
if ((map["pwdId"] != null)) {
|
if ((map["pwdId"] != null)) {
|
||||||
pwdId.value = map["pwdId"];
|
pwdId.value = map["pwdId"];
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_state.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
class KeyOperationRecordLogic extends BaseGetXController {
|
||||||
|
final KeyOperationRecordState state = KeyOperationRecordState();
|
||||||
|
|
||||||
|
//请求操作记录列表
|
||||||
|
Future<void> mockNetworkDataRequest() async {
|
||||||
|
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
||||||
|
'0',
|
||||||
|
state.keyId.value,
|
||||||
|
'0',
|
||||||
|
state.lockId.value,
|
||||||
|
'1',
|
||||||
|
'1',
|
||||||
|
'20',
|
||||||
|
'0',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
state.keyboardPwdId.value,
|
||||||
|
state.cardId.value,
|
||||||
|
state.fingerprintId.value);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("操作记录列表成功:${entity.data?.itemList}");
|
||||||
|
state.dataList.value = entity.data!.itemList!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_logic.dart';
|
||||||
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
import 'package:star_lock/tools/titleAppBar.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class KeyOperationRecordPage extends StatefulWidget {
|
||||||
|
const KeyOperationRecordPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<KeyOperationRecordPage> createState() => _KeyOperationRecordPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _KeyOperationRecordPageState extends State<KeyOperationRecordPage> {
|
||||||
|
final logic = Get.put(KeyOperationRecordLogic());
|
||||||
|
final state = Get.find<KeyOperationRecordLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
body: Obx(() => state.dataList.value.isEmpty
|
||||||
|
? NoData()
|
||||||
|
: _buildMainUI(state.dataList.value)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMainUI(List<KeyRecordDataItem> itemDataList) {
|
||||||
|
return ListView.separated(
|
||||||
|
itemCount: itemDataList.length,
|
||||||
|
itemBuilder: (c, index) {
|
||||||
|
KeyRecordDataItem dataItem = itemDataList[index];
|
||||||
|
int? operateDate = dataItem.operateDate;
|
||||||
|
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
||||||
|
String operateDateStr =
|
||||||
|
'${dateStr.toLocal().toString().substring(0, 16)} 开锁';
|
||||||
|
|
||||||
|
return _electronicKeyItem(operateDateStr, () {});
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _electronicKeyItem(String operateDate, Function() action) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: action,
|
||||||
|
child: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: 68.h,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 30.w,
|
||||||
|
),
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_recordDate.png',
|
||||||
|
width: 24.w,
|
||||||
|
height: 24.w,
|
||||||
|
color: AppColors.darkGrayTextColor,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
operateDate,
|
||||||
|
style: TextStyle(color: AppColors.blackColor, fontSize: 20.sp),
|
||||||
|
),
|
||||||
|
SizedBox(width: 20.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
|
||||||
|
class KeyOperationRecordState {
|
||||||
|
var dataList = <KeyRecordDataItem>[].obs;
|
||||||
|
final keyId = ''.obs;
|
||||||
|
final lockId = ''.obs;
|
||||||
|
final keyboardPwdId = ''.obs; //密码ID
|
||||||
|
final cardId = ''.obs; //卡ID
|
||||||
|
final fingerprintId = ''.obs; //指纹ID
|
||||||
|
|
||||||
|
KeyOperationRecordState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if ((map["keyId"] != null)) {
|
||||||
|
keyId.value = map["keyId"];
|
||||||
|
}
|
||||||
|
if ((map["lockId"] != null)) {
|
||||||
|
lockId.value = map["lockId"];
|
||||||
|
}
|
||||||
|
if ((map["keyboardPwdId"] != null)) {
|
||||||
|
keyboardPwdId.value = map["keyboardPwdId"];
|
||||||
|
}
|
||||||
|
if ((map["cardId"] != null)) {
|
||||||
|
cardId.value = map["cardId"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((map["fingerprintId"] != null)) {
|
||||||
|
fingerprintId.value = map["fingerprintId"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,159 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../translations/trans_lib.dart';
|
|
||||||
|
|
||||||
class KeyOperationRecordPage extends StatefulWidget {
|
|
||||||
const KeyOperationRecordPage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<KeyOperationRecordPage> createState() => _KeyOperationRecordPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _KeyOperationRecordPageState extends State<KeyOperationRecordPage> {
|
|
||||||
String _keyId = '';
|
|
||||||
String _lockId = '';
|
|
||||||
String _keyboardPwdId = ''; //密码ID
|
|
||||||
String _cardId = ''; //卡ID
|
|
||||||
String _fingerprintId = ''; //指纹ID
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
if (obj != null && (obj["keyId"] != null)) {
|
|
||||||
_keyId = obj["keyId"];
|
|
||||||
}
|
|
||||||
if (obj != null && (obj["lockId"] != null)) {
|
|
||||||
_lockId = obj["lockId"];
|
|
||||||
}
|
|
||||||
if (obj != null && (obj["keyboardPwdId"] != null)) {
|
|
||||||
_keyboardPwdId = obj["keyboardPwdId"];
|
|
||||||
}
|
|
||||||
if (obj != null && (obj["cardId"] != null)) {
|
|
||||||
_cardId = obj["cardId"];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj != null && (obj["fingerprintId"] != null)) {
|
|
||||||
_fingerprintId = obj["fingerprintId"];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor,
|
|
||||||
),
|
|
||||||
body: FutureBuilder<List<KeyRecordDataItem>>(
|
|
||||||
future: mockNetworkDataRequest(),
|
|
||||||
builder: (BuildContext context,
|
|
||||||
AsyncSnapshot<List<KeyRecordDataItem>> snapshot) {
|
|
||||||
//请求结束
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
if (snapshot.hasError) {
|
|
||||||
//请求失败
|
|
||||||
return const Text('请求失败');
|
|
||||||
} else {
|
|
||||||
//请求成功
|
|
||||||
final List<KeyRecordDataItem> itemDataList = snapshot.data!;
|
|
||||||
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Expanded(child: _buildMainUI(itemDataList)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//请求未结束 显示loading
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//请求操作记录列表
|
|
||||||
Future<List<KeyRecordDataItem>> mockNetworkDataRequest() async {
|
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
|
||||||
'0',
|
|
||||||
_keyId,
|
|
||||||
'0',
|
|
||||||
_lockId,
|
|
||||||
'1',
|
|
||||||
'1',
|
|
||||||
'20',
|
|
||||||
'0',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
_keyboardPwdId,
|
|
||||||
_cardId,
|
|
||||||
_fingerprintId);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("操作记录列表成功:${entity.data?.itemList}");
|
|
||||||
}
|
|
||||||
final data = entity.data;
|
|
||||||
if (data != null) {
|
|
||||||
return data.itemList!;
|
|
||||||
} else {
|
|
||||||
List<KeyRecordDataItem> dataList = [];
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildMainUI(List<KeyRecordDataItem> itemDataList) {
|
|
||||||
return ListView.separated(
|
|
||||||
itemCount: itemDataList.length,
|
|
||||||
itemBuilder: (c, index) {
|
|
||||||
KeyRecordDataItem dataItem = itemDataList[index];
|
|
||||||
int? operateDate = dataItem.operateDate;
|
|
||||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
|
||||||
String operateDateStr =
|
|
||||||
'${dateStr.toLocal().toString().substring(0, 16)} 开锁';
|
|
||||||
|
|
||||||
return _electronicKeyItem(operateDateStr, () {});
|
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return const Divider(
|
|
||||||
height: 1,
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _electronicKeyItem(String operateDate, Function() action) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: action,
|
|
||||||
child: Container(
|
|
||||||
color: Colors.white,
|
|
||||||
height: 68.h,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 30.w,
|
|
||||||
),
|
|
||||||
Image.asset(
|
|
||||||
'images/icon_recordDate.png',
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.w,
|
|
||||||
color: AppColors.darkGrayTextColor,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 20.w,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
operateDate,
|
|
||||||
style: TextStyle(color: AppColors.blackColor, fontSize: 20.sp),
|
|
||||||
),
|
|
||||||
SizedBox(width: 20.h),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -40,7 +40,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value){
|
logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -73,11 +73,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
mockRequest();
|
mockRequest();
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: () {
|
||||||
mockRequest();
|
mockRequest();
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -92,8 +92,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(child: _buildMainUI()),
|
||||||
child: _buildMainUI()),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
@ -123,65 +122,78 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return Obx(() => state.itemDataList.value.isEmpty
|
return Obx(() => state.itemDataList.value.isEmpty
|
||||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
? NoData(
|
||||||
|
noDataHeight: 1.sh -
|
||||||
|
ScreenUtil().statusBarHeight -
|
||||||
|
ScreenUtil().bottomBarHeight -
|
||||||
|
190.h -
|
||||||
|
64.h)
|
||||||
: SlidableAutoCloseBehavior(
|
: SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: state.itemDataList.value.length,
|
itemCount: state.itemDataList.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
|
ElectronicKeyListItem indexEntity =
|
||||||
String useDateStr = ''; //使用期限
|
state.itemDataList.value[index];
|
||||||
String keyStatus = ''; //钥匙状态
|
String useDateStr = ''; //使用期限
|
||||||
|
String keyStatus = ''; //钥匙状态
|
||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
useDateStr = getUseDateStr(indexEntity);
|
useDateStr = getUseDateStr(indexEntity);
|
||||||
|
|
||||||
//钥匙状态
|
//钥匙状态
|
||||||
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
||||||
|
|
||||||
//是否为管理钥匙
|
//是否为管理钥匙
|
||||||
bool isAdminKey = false;
|
bool isAdminKey = false;
|
||||||
if (indexEntity.keyRight == 1) {
|
if (indexEntity.keyRight == 1) {
|
||||||
isAdminKey = true;
|
isAdminKey = true;
|
||||||
} else {
|
} else {
|
||||||
isAdminKey = false;
|
isAdminKey = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key:ValueKey(indexEntity.keyId),
|
key: ValueKey(indexEntity.keyId),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: 0.2,
|
extentRatio: 0.2,
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context){
|
onPressed: (BuildContext context) {
|
||||||
showIosTipViewDialog(context, indexEntity.keyId!.toString());
|
showIosTipViewDialog(
|
||||||
},
|
context, indexEntity.keyId!.toString());
|
||||||
backgroundColor: Colors.red,
|
},
|
||||||
foregroundColor: Colors.white,
|
backgroundColor: Colors.red,
|
||||||
label: '删除',
|
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,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
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,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDeleteBtn(String keyId) {
|
Widget _buildDeleteBtn(String keyId) {
|
||||||
@ -291,7 +303,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Image.asset(avatarURL, width: 60.w, height: 60.w,),
|
Image.asset(
|
||||||
|
avatarURL,
|
||||||
|
width: 60.w,
|
||||||
|
height: 60.w,
|
||||||
|
),
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -305,16 +321,20 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(receiveUser,
|
||||||
receiveUser,
|
maxLines: 1,
|
||||||
maxLines: 1,
|
overflow: TextOverflow.ellipsis,
|
||||||
overflow: TextOverflow.ellipsis,
|
style: TextStyle(
|
||||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
fontSize: 24.sp,
|
||||||
),
|
color: AppColors.blackColor)),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
isAdminKey
|
isAdminKey
|
||||||
? Image.asset('images/icon_electronicKey_admin.png', width: 24.w, height: 20.w,)
|
? Image.asset(
|
||||||
|
'images/icon_electronicKey_admin.png',
|
||||||
|
width: 24.w,
|
||||||
|
height: 20.w,
|
||||||
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import 'package:date_format/date_format.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyPeriodValidity/KeyPeriodValidityModel.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyPeriodValidity/KeyPeriodValidityModel.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_logic.dart';
|
||||||
|
import 'package:star_lock/tools/dateUtils.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
|
||||||
@ -52,15 +52,15 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
topWidget(),
|
effectiveDateWidget(),
|
||||||
Container(
|
SizedBox(
|
||||||
color: Colors.white,
|
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
const Divider(
|
topWidget(),
|
||||||
height: 1,
|
SizedBox(
|
||||||
color: AppColors.greyLineColor,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
|
effectiveTimeWidget(),
|
||||||
bottomWidget()
|
bottomWidget()
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
@ -68,7 +68,7 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
|
|
||||||
Widget topWidget() {
|
Widget topWidget() {
|
||||||
return Container(
|
return Container(
|
||||||
height: 150.h,
|
height: 160.h,
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -92,7 +92,11 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
KeyPeriodValidityModel model =
|
KeyPeriodValidityModel model =
|
||||||
state.validityDataList.value[index];
|
state.validityDataList.value[index];
|
||||||
return btnItem(model);
|
return btnItem(model);
|
||||||
}))
|
})),
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -107,6 +111,7 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
} else {
|
} else {
|
||||||
state.selectIndexList.value.remove(model.validityValue);
|
state.selectIndexList.value.remove(model.validityValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -135,7 +140,8 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bottomWidget() {
|
//生效日期
|
||||||
|
Widget effectiveDateWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -144,14 +150,13 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.isHaveEffectiveDate.value = true;
|
state.isHaveEffectiveDate.value = true;
|
||||||
state.effectiveDateTime.value = DateTime.parse(
|
state.effectiveDate.value = XSDateUtils.parseDateTime(
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
'${p.year}-${p.month!}-${p.day!}', 'yyyy-mm-dd');
|
||||||
state.selectEffectiveDate.value = formatDate(
|
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
||||||
state.effectiveDateTime.value,
|
state.effectiveDate.value, 'yyyy-mm-dd');
|
||||||
[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]);
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -159,16 +164,59 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
rightTitle: state.selectFailureDate.value,
|
rightTitle: state.selectFailureDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.isHaveFailureDate.value = true;
|
state.isHaveFailureDate.value = true;
|
||||||
state.failureDateTime.value = DateTime.parse(
|
state.failureDate.value = XSDateUtils.parseDateTime(
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
'${p.year}-${p.month!}-${p.day!}', 'yyyy-mm-dd');
|
||||||
state.selectFailureDate.value = formatDate(
|
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
||||||
state.failureDateTime.value,
|
state.failureDate.value, 'yyyy-mm-dd');
|
||||||
[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]);
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//生效时间
|
||||||
|
Widget effectiveTimeWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
|
rightTitle: state.selectEffectiveTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.isHaveEffectiveTime.value = true;
|
||||||
|
state.effectiveTime.value = XSDateUtils.parseDateTime(
|
||||||
|
'${p.hour!}:${p.minute!}', 'HH:mm');
|
||||||
|
state.selectEffectiveTime.value = XSDateUtils.formatDateTime(
|
||||||
|
state.effectiveTime.value, 'HH:mm');
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
|
rightTitle: state.selectFailureTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.isHaveFailureTime.value = true;
|
||||||
|
state.failureTime.value = XSDateUtils.parseDateTime(
|
||||||
|
'${p.hour!}:${p.minute!}', 'HH:mm');
|
||||||
|
state.selectFailureTime.value = XSDateUtils.formatDateTime(
|
||||||
|
state.failureTime.value, 'HH:mm');
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget bottomWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
Container(height: 40.h),
|
Container(height: 40.h),
|
||||||
Obx(() => SubmitBtn(
|
Obx(() => SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
@ -177,7 +225,9 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
isDisabled: (state.selectIndexList.value.isNotEmpty &&
|
isDisabled: (state.selectIndexList.value.isNotEmpty &&
|
||||||
state.isHaveEffectiveDate.value == true &&
|
state.isHaveEffectiveDate.value == true &&
|
||||||
state.isHaveFailureDate.value == true)
|
state.isHaveFailureDate.value == true &&
|
||||||
|
state.isHaveEffectiveTime.value == true &&
|
||||||
|
state.isHaveFailureTime.value == true)
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
@ -185,17 +235,17 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
state.isHaveEffectiveDate.value == true &&
|
state.isHaveEffectiveDate.value == true &&
|
||||||
state.isHaveFailureDate.value == true)) {
|
state.isHaveFailureDate.value == true)) {
|
||||||
DateTime startDateTime = DateTime(
|
DateTime startDateTime = DateTime(
|
||||||
state.effectiveDateTime.value.year,
|
state.effectiveDate.value.year,
|
||||||
state.effectiveDateTime.value.month,
|
state.effectiveDate.value.month,
|
||||||
state.effectiveDateTime.value.day,
|
state.effectiveDate.value.day,
|
||||||
state.effectiveDateTime.value.hour,
|
state.effectiveDate.value.hour,
|
||||||
state.effectiveDateTime.value.minute);
|
state.effectiveDate.value.minute);
|
||||||
DateTime endDateTime = DateTime(
|
DateTime endDateTime = DateTime(
|
||||||
state.failureDateTime.value.year,
|
state.failureDate.value.year,
|
||||||
state.failureDateTime.value.month,
|
state.failureDate.value.month,
|
||||||
state.failureDateTime.value.day,
|
state.failureDate.value.day,
|
||||||
state.failureDateTime.value.hour,
|
state.failureDate.value.hour,
|
||||||
state.failureDateTime.value.minute);
|
state.failureDate.value.minute);
|
||||||
//时间判断
|
//时间判断
|
||||||
if (!startDateTime.isBefore(endDateTime) ||
|
if (!startDateTime.isBefore(endDateTime) ||
|
||||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||||
@ -203,8 +253,10 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
} else {
|
} else {
|
||||||
Map<String, dynamic> resultMap = {};
|
Map<String, dynamic> resultMap = {};
|
||||||
resultMap['validityValue'] = state.selectIndexList.value;
|
resultMap['validityValue'] = state.selectIndexList.value;
|
||||||
resultMap['starDate'] = state.effectiveDateTime.value;
|
resultMap['starDate'] = state.effectiveDate.value;
|
||||||
resultMap['endDate'] = state.failureDateTime.value;
|
resultMap['endDate'] = state.failureDate.value;
|
||||||
|
resultMap['starTime'] = state.effectiveTime.value;
|
||||||
|
resultMap['endTime'] = state.failureTime.value;
|
||||||
Navigator.pop(context, resultMap);
|
Navigator.pop(context, resultMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,8 +264,4 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? "0$v" : "$v";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:date_format/date_format.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
@ -24,11 +25,24 @@ class ElectronicKeyPeriodValidityState {
|
|||||||
].obs;
|
].obs;
|
||||||
final validityDataList = [].obs; //自定义数据块
|
final validityDataList = [].obs; //自定义数据块
|
||||||
final selectIndexList = [].obs; //选中的有效期数组
|
final selectIndexList = [].obs; //选中的有效期数组
|
||||||
final selectEffectiveDate = ''.obs; //生效时间
|
|
||||||
final selectFailureDate = ''.obs; //失效时间
|
|
||||||
DateTime dateTime = DateTime.now();
|
DateTime dateTime = DateTime.now();
|
||||||
final effectiveDateTime = DateTime.now().obs;
|
final effectiveDate = DateTime.now().obs;
|
||||||
final failureDateTime = DateTime.now().obs;
|
final failureDate = DateTime.now().obs;
|
||||||
|
final selectEffectiveDate = ''.obs; //生效日期
|
||||||
|
final selectFailureDate = ''.obs; //失效日期
|
||||||
|
|
||||||
|
final selectEffectiveTime = ''.obs; //生效时间
|
||||||
|
final selectFailureTime = ''.obs; //失效时间
|
||||||
|
final effectiveTime = DateTime.now().obs;
|
||||||
|
final failureTime = DateTime.now().obs;
|
||||||
|
|
||||||
var isHaveEffectiveDate = false.obs;
|
var isHaveEffectiveDate = false.obs;
|
||||||
var isHaveFailureDate = false.obs;
|
var isHaveFailureDate = false.obs;
|
||||||
|
var isHaveEffectiveTime = false.obs;
|
||||||
|
var isHaveFailureTime = false.obs;
|
||||||
|
|
||||||
|
String intToStr(int v) {
|
||||||
|
return (v < 10) ? "0$v" : "$v";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,26 +14,41 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//发送钥匙请求
|
//发送钥匙请求
|
||||||
Future<void> sendElectronicKeyRequest() async {
|
Future<void> sendElectronicKeyRequest() async {
|
||||||
if(state.emailOrPhoneController.text.isEmpty){
|
if (state.emailOrPhoneController.text.isEmpty) {
|
||||||
showToast("请输入接收者账号");
|
showToast("请输入接收者账号");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(state.keyNameController.text.isEmpty){
|
// 姓名变为非必填(同通通锁)
|
||||||
showToast("请输入接收者姓名");
|
// if(state.keyNameController.text.isEmpty){
|
||||||
return;
|
// showToast("请输入接收者姓名");
|
||||||
}
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
DateTime startDateTime = DateTime(
|
||||||
|
state.effectiveDateTime.value.year,
|
||||||
|
state.effectiveDateTime.value.month,
|
||||||
|
state.effectiveDateTime.value.day,
|
||||||
|
state.effectiveDateTime.value.hour,
|
||||||
|
state.effectiveDateTime.value.minute);
|
||||||
|
DateTime endDateTime = DateTime(
|
||||||
|
state.failureDateTime.value.year,
|
||||||
|
state.failureDateTime.value.month,
|
||||||
|
state.failureDateTime.value.day,
|
||||||
|
state.failureDateTime.value.hour,
|
||||||
|
state.failureDateTime.value.minute);
|
||||||
|
|
||||||
DateTime startDateTime = DateTime(state.effectiveDateTime.value.year, state.effectiveDateTime.value.month, state.effectiveDateTime.value.day, state.effectiveDateTime.value.hour, state.effectiveDateTime.value.minute);
|
|
||||||
DateTime endDateTime = DateTime(state.failureDateTime.value.year, state.failureDateTime.value.month, state.failureDateTime.value.day, state.failureDateTime.value.hour, state.failureDateTime.value.minute);
|
|
||||||
//发送钥匙请求
|
//发送钥匙请求
|
||||||
if (state.type.value == "0" || state.type.value == "3") {
|
if (state.type.value == "0" || state.type.value == "3") {
|
||||||
print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
|
print(
|
||||||
if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) {
|
"startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
|
||||||
|
if (!startDateTime.isBefore(endDateTime) ||
|
||||||
|
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||||
showToast("失效时间需大于生效时间");
|
showToast("失效时间需大于生效时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
|
if (!startDateTime.isBefore(DateTime.now()) ||
|
||||||
|
startDateTime.isAtSameMomentAs(DateTime.now())) {
|
||||||
showToast("生效时间需大于当前时间");
|
showToast("生效时间需大于当前时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -45,8 +60,10 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
typeValue = XSConstantMacro.keyTypeTime;
|
typeValue = XSConstantMacro.keyTypeTime;
|
||||||
state.failureTimestamp.value = state.failureDateTime.value.millisecondsSinceEpoch;
|
state.failureTimestamp.value =
|
||||||
state.effectiveTimestamp.value = state.effectiveDateTime.value.millisecondsSinceEpoch;
|
state.failureDateTime.value.millisecondsSinceEpoch;
|
||||||
|
state.effectiveTimestamp.value =
|
||||||
|
state.effectiveDateTime.value.millisecondsSinceEpoch;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@ -70,7 +87,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
||||||
? '1'
|
? '1'
|
||||||
: '2',
|
: '2',
|
||||||
endDate: state.failureTimestamp.value.toString(),
|
endDate: state.failureTimestamp.value,
|
||||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||||
isCameraEnable: '2',
|
isCameraEnable: '2',
|
||||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||||
@ -81,8 +98,10 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
operatorUid: '',
|
operatorUid: '',
|
||||||
receiverUsername: state.emailOrPhoneController.text,
|
receiverUsername: state.emailOrPhoneController.text,
|
||||||
remarks: '',
|
remarks: '',
|
||||||
startDate: state.effectiveTimestamp.value.toString(),
|
startDate: state.effectiveTimestamp.value,
|
||||||
weekDays: state.weekdaysList.value);
|
weekDays: state.weekdaysList.value,
|
||||||
|
startTime: state.startTime.value,
|
||||||
|
endTime: state.endTime.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print('发送电子钥匙成功');
|
print('发送电子钥匙成功');
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
@ -190,10 +209,14 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetData(){
|
void resetData() {
|
||||||
state.emailOrPhoneController.text = "";
|
state.emailOrPhoneController.text = "";
|
||||||
state.keyNameController.text = "";
|
state.keyNameController.text = "";
|
||||||
state.selectEffectiveDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
state.selectEffectiveDate =
|
||||||
state.selectFailureDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
'${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; //默认为当前时间
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateUtils.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
@ -53,7 +54,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
if (state.isSendSuccess.value == true && state.sendSucceedType.value.toString() == widget.type) {
|
if (state.isSendSuccess.value == true &&
|
||||||
|
state.sendSucceedType.value.toString() == widget.type) {
|
||||||
return sendElectronicKeySucceed();
|
return sendElectronicKeySucceed();
|
||||||
} else {
|
} else {
|
||||||
switch (int.parse(widget.type)) {
|
switch (int.parse(widget.type)) {
|
||||||
@ -66,7 +68,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
keyTimeWidget(),
|
keyTimeWidget(),
|
||||||
remoteUnlockingWidget(),
|
remoteUnlockingWidget(),
|
||||||
keyRealNameWidget(),
|
keyRealNameWidget(),
|
||||||
keyBottomWidget()
|
keyBottomWidget(state.timeLimitTips)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -78,7 +80,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
keyInfoWidget(),
|
keyInfoWidget(),
|
||||||
remoteUnlockingWidget(),
|
remoteUnlockingWidget(),
|
||||||
keyRealNameWidget(),
|
keyRealNameWidget(),
|
||||||
keyBottomWidget()
|
keyBottomWidget(state.permanentTips)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -90,7 +92,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
keyInfoWidget(),
|
keyInfoWidget(),
|
||||||
remoteUnlockingWidget(),
|
remoteUnlockingWidget(),
|
||||||
keyRealNameWidget(),
|
keyRealNameWidget(),
|
||||||
keyBottomWidget()
|
keyBottomWidget(state.onceLimitTips)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -103,7 +105,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
keyPeriodValidityWidget(),
|
keyPeriodValidityWidget(),
|
||||||
remoteUnlockingWidget(),
|
remoteUnlockingWidget(),
|
||||||
keyRealNameWidget(),
|
keyRealNameWidget(),
|
||||||
keyBottomWidget()
|
keyBottomWidget(state.cycleLimitTips)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -144,7 +146,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
setState(() {});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -171,12 +172,11 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
state.effectiveDateTime.value = XSDateUtils.parseDateTime(
|
||||||
state.selectEffectiveDate.value =
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'yyyy-mm-dd HH:mm');
|
||||||
state.effectiveDateTime.value =
|
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
||||||
DateTime.parse(state.selectEffectiveDate.value);
|
state.effectiveDateTime.value, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -186,12 +186,11 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
state.failureDateTime.value = XSDateUtils.parseDateTime(
|
||||||
state.selectFailureDate.value =
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'yyyy-mm-dd HH:mm');
|
||||||
state.failureDateTime.value =
|
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
||||||
DateTime.parse(state.selectFailureDate.value);
|
state.failureDateTime.value, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -221,7 +220,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
Widget keyPeriodValidityWidget() {
|
Widget keyPeriodValidityWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
rightTitle: state.weekdaysList.value.isEmpty
|
rightTitle: state.weekdaysList.value.isEmpty
|
||||||
? ''
|
? ''
|
||||||
@ -237,8 +236,11 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
result['starDate'].millisecondsSinceEpoch;
|
result['starDate'].millisecondsSinceEpoch;
|
||||||
state.failureTimestamp.value =
|
state.failureTimestamp.value =
|
||||||
result['endDate'].millisecondsSinceEpoch;
|
result['endDate'].millisecondsSinceEpoch;
|
||||||
|
state.startTime.value =
|
||||||
|
result['starTime'].millisecondsSinceEpoch;
|
||||||
|
state.endTime.value = result['endTime'].millisecondsSinceEpoch;
|
||||||
}
|
}
|
||||||
})),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
)
|
)
|
||||||
@ -246,7 +248,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget keyBottomWidget() {
|
Widget keyBottomWidget(String sendElectronicKeyTips) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@ -256,7 +258,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.sendKeyBottomTip!.tr,
|
sendElectronicKeyTips,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
@ -411,7 +413,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
// if (entity.errorCode!.codeIsSuccessful) {
|
// if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// print("标记为已入住成功啦啦啦啦啦");
|
// print("标记为已入住成功啦啦啦啦啦");
|
||||||
// Toast.show(msg: "标记成功");
|
// Toast.show(msg: "标记成功");
|
||||||
// setState(() {});
|
|
||||||
// } else {
|
// } else {
|
||||||
// Toast.show(msg: '操作失败');
|
// Toast.show(msg: '操作失败');
|
||||||
// }
|
// }
|
||||||
@ -423,7 +424,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("标记为已入住成功啦啦啦啦啦");
|
print("标记为已入住成功啦啦啦啦啦");
|
||||||
logic.showToast("标记成功");
|
logic.showToast("标记成功");
|
||||||
setState(() {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,10 +461,18 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
hintText: tfStr,
|
hintText: tfStr,
|
||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
|
focusedBorder: const OutlineInputBorder(
|
||||||
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
|
borderSide:
|
||||||
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
border: 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),
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -489,17 +497,15 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
Contact? currentContact =
|
Contact? currentContact =
|
||||||
await state.contactPicker.selectContact();
|
await state.contactPicker.selectContact();
|
||||||
setState(() {
|
state.contact = currentContact!;
|
||||||
state.contact = currentContact!;
|
if (currentContact.phoneNumbers!.isNotEmpty) {
|
||||||
if (currentContact.phoneNumbers!.isNotEmpty) {
|
state.emailOrPhoneController.text = currentContact
|
||||||
state.emailOrPhoneController.text = currentContact
|
.phoneNumbers![0]
|
||||||
.phoneNumbers![0]
|
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
||||||
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
}
|
||||||
}
|
if (currentContact.fullName!.isNotEmpty) {
|
||||||
if (currentContact.fullName!.isNotEmpty) {
|
state.keyNameController.text = currentContact.fullName!;
|
||||||
state.keyNameController.text = currentContact.fullName!;
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -512,15 +518,16 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
// 远程开锁
|
// 远程开锁
|
||||||
Widget remoteUnlockingWidget() {
|
Widget remoteUnlockingWidget() {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false,
|
visible:
|
||||||
|
state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget:
|
rightWidget: SizedBox(
|
||||||
SizedBox(width: 60.w, height: 50.h, child: _remoteSwitch(true)),
|
width: 60.w, height: 50.h, child: _remoteSwitch(true)),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
@ -537,21 +544,15 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
value:
|
value:
|
||||||
isRemote ? state.isRemoteUnlock.value : state.isAuthentication.value,
|
isRemote ? state.isRemoteUnlock.value : state.isAuthentication.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
if (isRemote) {
|
||||||
if (isRemote) {
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
} else {
|
||||||
} else {
|
state.isAuthentication.value = !state.isAuthentication.value;
|
||||||
state.isAuthentication.value = !state.isAuthentication.value;
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? "0$v" : "$v";
|
|
||||||
}
|
|
||||||
|
|
||||||
Future _openModalBottomSheet() async {
|
Future _openModalBottomSheet() async {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@ -639,14 +640,14 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
//微信好友
|
//微信好友
|
||||||
{
|
{
|
||||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
NativeInteractionTool.loadNativeShare(shareText: pwdShareStr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//短信
|
//短信
|
||||||
{
|
{
|
||||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
NativeInteractionTool.loadNativeShare(shareText: pwdShareStr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -659,7 +660,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
//更多
|
//更多
|
||||||
{
|
{
|
||||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
NativeInteractionTool.loadNativeShare(shareText: pwdShareStr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -19,6 +19,8 @@ class SendElectronicKeyState {
|
|||||||
final failureDateTime = DateTime.now().obs;
|
final failureDateTime = DateTime.now().obs;
|
||||||
final effectiveTimestamp = 0.obs;
|
final effectiveTimestamp = 0.obs;
|
||||||
final failureTimestamp = 0.obs;
|
final failureTimestamp = 0.obs;
|
||||||
|
final startTime = 0.obs;
|
||||||
|
final endTime = 0.obs;
|
||||||
|
|
||||||
var selectEffectiveDate =
|
var selectEffectiveDate =
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||||
@ -36,6 +38,11 @@ class SendElectronicKeyState {
|
|||||||
|
|
||||||
final sendSucceedType = 0.obs;
|
final sendSucceedType = 0.obs;
|
||||||
|
|
||||||
|
final timeLimitTips = '接收者在有效期内可以不限次数使用'; //限时
|
||||||
|
final permanentTips = '接收者可以使用此App开关锁'; //永久
|
||||||
|
final onceLimitTips = '单次钥匙有效期为1小时,只能使用一次'; //单次
|
||||||
|
final cycleLimitTips = '接收者可以在有效期内的固定时间段里,不限次数使用'; //循环
|
||||||
|
|
||||||
SendElectronicKeyState() {
|
SendElectronicKeyState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
keyInfo.value = map["keyInfo"];
|
keyInfo.value = map["keyInfo"];
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../blue/blue_manage.dart';
|
import '../../../blue/blue_manage.dart';
|
||||||
import '../../../blue/io_protocol/io_addUser.dart';
|
import '../../../blue/io_protocol/io_addUser.dart';
|
||||||
@ -21,7 +21,6 @@ import '../../../network/api_repository.dart';
|
|||||||
import '../../../tools/baseGetXController.dart';
|
import '../../../tools/baseGetXController.dart';
|
||||||
import '../../../tools/eventBusEventManage.dart';
|
import '../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../tools/storage.dart';
|
import '../../../tools/storage.dart';
|
||||||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
|
||||||
import '../lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
import '../lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
||||||
import 'lockDetail_state.dart';
|
import 'lockDetail_state.dart';
|
||||||
import 'lockNetToken_entity.dart';
|
import 'lockNetToken_entity.dart';
|
||||||
@ -73,7 +72,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// _showFullScreenOverlay(Get.context!);
|
// _showFullScreenOverlay(Get.context!);
|
||||||
|
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = true;
|
state.iSClosedUnlockSuccessfulPopup.value = true;
|
||||||
if(state.closedUnlockSuccessfulTimer != null){
|
if (state.closedUnlockSuccessfulTimer != null) {
|
||||||
state.closedUnlockSuccessfulTimer!.cancel();
|
state.closedUnlockSuccessfulTimer!.cancel();
|
||||||
state.closedUnlockSuccessfulTimer = null;
|
state.closedUnlockSuccessfulTimer = null;
|
||||||
}
|
}
|
||||||
@ -135,10 +134,10 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x16:
|
case 0x16:
|
||||||
// 正在开锁中...
|
// 正在开锁中...
|
||||||
print("${reply.commandType}正在开锁中...");
|
print("${reply.commandType}正在开锁中...");
|
||||||
state.openLockBtnState.value = 0;
|
state.openLockBtnState.value = 0;
|
||||||
showToast("正在开锁中...", something: (){
|
showToast("正在开锁中...", something: () {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -370,13 +369,15 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 添加用户(普通用户接收电子钥匙)
|
// 添加用户(普通用户接收电子钥匙)
|
||||||
Future<void> addUserConnectBlue() async {
|
Future<void> addUserConnectBlue() async {
|
||||||
showBlueConnetctToastTimer(action:() {
|
showBlueConnetctToastTimer(action: () {
|
||||||
state.openLockBtnState.value = 0;
|
state.openLockBtnState.value = 0;
|
||||||
// state.animationController.reset();
|
// state.animationController.reset();
|
||||||
// state.animationController.forward();
|
// state.animationController.forward();
|
||||||
});
|
});
|
||||||
|
|
||||||
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (DeviceConnectionState deviceConnectionState) async {
|
BlueManage()
|
||||||
|
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||||
|
(DeviceConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == DeviceConnectionState.connected) {
|
if (deviceConnectionState == DeviceConnectionState.connected) {
|
||||||
// 私钥
|
// 私钥
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -390,7 +391,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
if (token != null) {
|
if (token != null) {
|
||||||
getTokenList = changeStringListToIntList(token);
|
getTokenList = changeStringListToIntList(token);
|
||||||
}
|
}
|
||||||
print("BlueManage().connectDeviceName:${BlueManage().connectDeviceName} authUserID:${state.senderUserId.toString()} keyID:${state.keyInfos.value.keyId.toString()} userID:${await Storage.getUid()}");
|
print(
|
||||||
|
"BlueManage().connectDeviceName:${BlueManage().connectDeviceName} authUserID:${state.senderUserId.toString()} keyID:${state.keyInfos.value.keyId.toString()} userID:${await Storage.getUid()}");
|
||||||
IoSenderManage.senderAddUser(
|
IoSenderManage.senderAddUser(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
authUserID: state.senderUserId.toString(),
|
authUserID: state.senderUserId.toString(),
|
||||||
@ -406,9 +408,9 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
publicKey: publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
}else if (deviceConnectionState == DeviceConnectionState.disconnected){
|
} else if (deviceConnectionState == DeviceConnectionState.disconnected) {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +423,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 点击开门事件
|
// 点击开门事件
|
||||||
Future<void> openDoorAction(int openMode) async {
|
Future<void> openDoorAction(int openMode) async {
|
||||||
showBlueConnetctToastTimer(action:() {
|
showBlueConnetctToastTimer(action: () {
|
||||||
state.openLockBtnState.value = 0;
|
state.openLockBtnState.value = 0;
|
||||||
BlueManage().stopScan();
|
BlueManage().stopScan();
|
||||||
|
|
||||||
@ -437,7 +439,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
var token = await Storage.getStringList(saveBlueToken);
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
print("openDoorTokenPubToken:$getTokenList getPrivateKeyList:$getPrivateKeyList");
|
print(
|
||||||
|
"openDoorTokenPubToken:$getTokenList getPrivateKeyList:$getPrivateKeyList");
|
||||||
// List<int>listData = await IoSenderManage.senderOpenLock(
|
// List<int>listData = await IoSenderManage.senderOpenLock(
|
||||||
// keyID: BlueManage().connectDeviceName,
|
// keyID: BlueManage().connectDeviceName,
|
||||||
// userID: await Storage.getUid(),
|
// userID: await Storage.getUid(),
|
||||||
@ -449,8 +452,10 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// signKey: signKeyDataList,
|
// signKey: signKeyDataList,
|
||||||
// privateKey: getPrivateKeyList,
|
// privateKey: getPrivateKeyList,
|
||||||
// );
|
// );
|
||||||
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (DeviceConnectionState deviceConnectionState) async {
|
BlueManage()
|
||||||
if (deviceConnectionState == DeviceConnectionState.connected){
|
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||||
|
(DeviceConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == DeviceConnectionState.connected) {
|
||||||
IoSenderManage.senderOpenLock(
|
IoSenderManage.senderOpenLock(
|
||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
@ -462,9 +467,9 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
}else if (deviceConnectionState == DeviceConnectionState.disconnected){
|
} else if (deviceConnectionState == DeviceConnectionState.disconnected) {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,10 +542,11 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// 获取锁状态 更新电量
|
// 获取锁状态 更新电量
|
||||||
Future<void> getStarLockStatus() async {
|
Future<void> getStarLockStatus() async {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(DeviceConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == DeviceConnectionState.connected) {
|
if (deviceConnectionState == DeviceConnectionState.connected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -553,7 +559,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
} else if (deviceConnectionState == DeviceConnectionState.disconnected) {
|
} else if (deviceConnectionState == DeviceConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,7 +597,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//
|
//
|
||||||
startOpenLock() {
|
startOpenLock() {
|
||||||
if(state.openLockBtnState.value == 1){
|
if (state.openLockBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.iSOpenLock.value = true;
|
state.iSOpenLock.value = true;
|
||||||
@ -614,7 +620,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startUnLock() {
|
startUnLock() {
|
||||||
if(state.openLockBtnState.value == 1){
|
if (state.openLockBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.iSOpenLock.value = false;
|
state.iSOpenLock.value = false;
|
||||||
@ -672,7 +678,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
||||||
void getLockNetToken() async {
|
void getLockNetToken() async {
|
||||||
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
LockNetTokenEntity entity = await ApiRepository.to
|
||||||
|
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockNetToken = entity.data!.token!;
|
state.lockNetToken = entity.data!.token!;
|
||||||
print("state.lockNetToken:${state.lockNetToken}");
|
print("state.lockNetToken:${state.lockNetToken}");
|
||||||
@ -698,7 +705,9 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 查询锁记录最后时间
|
// 查询锁记录最后时间
|
||||||
void getLockRecordLastUploadDataTime() async {
|
void getLockRecordLastUploadDataTime() async {
|
||||||
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to.getLockRecordLastUploadDataTime(lockId: state.keyInfos.value.lockId.toString());
|
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
|
||||||
|
.getLockRecordLastUploadDataTime(
|
||||||
|
lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
senderReferEventRecordTime(entity.data!.operateDate! ~/ 1000);
|
senderReferEventRecordTime(entity.data!.operateDate! ~/ 1000);
|
||||||
}
|
}
|
||||||
@ -716,27 +725,34 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//电量更新请求
|
//电量更新请求
|
||||||
Future<void> uploadElectricQuantityRequest(String electricQuantity) async {
|
Future<void> uploadElectricQuantityRequest(String electricQuantity) async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(electricQuantity, state.keyInfos.value.lockId.toString());
|
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
|
.uploadElectricQuantity(
|
||||||
|
electricQuantity, state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("电量更新成功", something: (){
|
showToast("电量更新成功", something: () {
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 锁设置里面开启关闭考勤刷新锁详情
|
/// 锁设置里面开启关闭考勤刷新锁详情
|
||||||
StreamSubscription?
|
StreamSubscription?
|
||||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||||
void _initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
|
void _initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = eventBus.on<LockSetChangeSetRefreshLockDetailWithType>().listen((event) {
|
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = eventBus
|
||||||
|
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||||
|
.listen((event) {
|
||||||
if (event.type == 0) {
|
if (event.type == 0) {
|
||||||
// 0考勤
|
// 0考勤
|
||||||
state.isAttendance.value = int.parse(event.setResult);
|
state.isAttendance.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.lockSetting!.attendance = int.parse(event.setResult);
|
state.keyInfos.value.lockSetting!.attendance =
|
||||||
|
int.parse(event.setResult);
|
||||||
} else if (event.type == 1) {
|
} else if (event.type == 1) {
|
||||||
// 1 开锁时是否需联网
|
// 1 开锁时是否需联网
|
||||||
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.lockSetting!.appUnlockOnline = int.parse(event.setResult);
|
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
||||||
|
int.parse(event.setResult);
|
||||||
} else if (event.type == 2) {
|
} else if (event.type == 2) {
|
||||||
// 2 常开模式
|
// 2 常开模式
|
||||||
state.isOpenPassageMode.value = int.parse(event.setResult);
|
state.isOpenPassageMode.value = int.parse(event.setResult);
|
||||||
@ -753,13 +769,22 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
late StreamSubscription<List<DiscoveredDevice>>_scanListDiscoveredDeviceSubscription;
|
late StreamSubscription<List<DiscoveredDevice>>
|
||||||
|
_scanListDiscoveredDeviceSubscription;
|
||||||
void _scanListDiscoveredDeviceSubscriptionAction() {
|
void _scanListDiscoveredDeviceSubscriptionAction() {
|
||||||
_scanListDiscoveredDeviceSubscription = EventBusManager().eventBus!.on<List<DiscoveredDevice>>().listen((List<DiscoveredDevice> list) {
|
_scanListDiscoveredDeviceSubscription = EventBusManager()
|
||||||
final knownDeviceIndex = list.indexWhere((d) => d.name == state.keyInfos.value.bluetooth!.bluetoothDeviceName!);
|
.eventBus!
|
||||||
|
.on<List<DiscoveredDevice>>()
|
||||||
|
.listen((List<DiscoveredDevice> list) {
|
||||||
|
final knownDeviceIndex = list.indexWhere((d) =>
|
||||||
|
d.name == state.keyInfos.value.bluetooth!.bluetoothDeviceName!);
|
||||||
if (knownDeviceIndex >= 0) {
|
if (knownDeviceIndex >= 0) {
|
||||||
// 存在的时候赋值
|
// 存在的时候赋值
|
||||||
state.currentDeviceUUid.value = (list[knownDeviceIndex].serviceUuids.isNotEmpty ? list[knownDeviceIndex].serviceUuids[0] : "").toString();
|
state.currentDeviceUUid.value =
|
||||||
|
(list[knownDeviceIndex].serviceUuids.isNotEmpty
|
||||||
|
? list[knownDeviceIndex].serviceUuids[0]
|
||||||
|
: "")
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -767,7 +792,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
//开锁成功弹出的小界面
|
//开锁成功弹出的小界面
|
||||||
void _showFullScreenOverlay(BuildContext context) {
|
void _showFullScreenOverlay(BuildContext context) {
|
||||||
Future.delayed(const Duration(seconds: 3), () {
|
Future.delayed(const Duration(seconds: 3), () {
|
||||||
if(state.iSClosedUnlockSuccessfulPopup.value != true){
|
if (state.iSClosedUnlockSuccessfulPopup.value != true) {
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = true;
|
state.iSClosedUnlockSuccessfulPopup.value = true;
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
@ -779,7 +804,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if(state.iSClosedUnlockSuccessfulPopup.value != true){
|
if (state.iSClosedUnlockSuccessfulPopup.value != true) {
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = true;
|
state.iSClosedUnlockSuccessfulPopup.value = true;
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -160,10 +160,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
)))),
|
)))),
|
||||||
Positioned(
|
Positioned(
|
||||||
child: Obx(() => GestureDetector(
|
child: Obx(() => GestureDetector(
|
||||||
onTap: (){
|
onTap: () {
|
||||||
logic.getStarLockStatus();
|
logic.getStarLockStatus();
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
@ -184,7 +184,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)))
|
)))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 30.h),
|
SizedBox(height: 30.h),
|
||||||
@ -391,6 +391,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'照明', state.bottomBtnisUneable.value, () {}));
|
'照明', state.bottomBtnisUneable.value, () {}));
|
||||||
|
|
||||||
// 照明
|
// 照明
|
||||||
|
showWidgetArr.add(bottomItem('images/main/icon_lockDetail_illuminator.png',
|
||||||
|
'门磁', state.bottomBtnisUneable.value, () {}));
|
||||||
|
|
||||||
|
// 门磁
|
||||||
showWidgetArr.add(bottomItem('images/main/icon_lockDetail_illuminator.png',
|
showWidgetArr.add(bottomItem('images/main/icon_lockDetail_illuminator.png',
|
||||||
'开门器', state.bottomBtnisUneable.value, () {}));
|
'开门器', state.bottomBtnisUneable.value, () {}));
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
|
||||||
import '../../../blue/blue_manage.dart';
|
import '../../../blue/blue_manage.dart';
|
||||||
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
|
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
|
||||||
@ -13,22 +13,22 @@ import '../../../blue/sender_manage.dart';
|
|||||||
import '../../../network/api_repository.dart';
|
import '../../../network/api_repository.dart';
|
||||||
import '../../../tools/baseGetXController.dart';
|
import '../../../tools/baseGetXController.dart';
|
||||||
import '../../../tools/storage.dart';
|
import '../../../tools/storage.dart';
|
||||||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
|
||||||
import 'lockOperatingRecordGetLastRecordTime_entity.dart';
|
import 'lockOperatingRecordGetLastRecordTime_entity.dart';
|
||||||
import 'lockOperatingRecord_state.dart';
|
import 'lockOperatingRecord_state.dart';
|
||||||
|
|
||||||
class LockOperatingRecordLogic extends BaseGetXController{
|
class LockOperatingRecordLogic extends BaseGetXController {
|
||||||
LockOperatingRecordState state = LockOperatingRecordState();
|
LockOperatingRecordState state = LockOperatingRecordState();
|
||||||
|
|
||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
// if(reply is SenderReferEventRecordNumberReply) {
|
// if(reply is SenderReferEventRecordNumberReply) {
|
||||||
// _replyReferEventRecordNumber(reply);
|
// _replyReferEventRecordNumber(reply);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(reply is SenderReferEventRecordTimeReply) {
|
if (reply is SenderReferEventRecordTimeReply) {
|
||||||
_replyReferEventRecordTime(reply);
|
_replyReferEventRecordTime(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -69,17 +69,17 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
// 根据时间查解析数据
|
// 根据时间查解析数据
|
||||||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
switch(status){
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
print("${reply.commandType}数据解析成功");
|
print("${reply.commandType}数据解析成功");
|
||||||
if(reply.data[5] > 0){
|
if (reply.data[5] > 0) {
|
||||||
reply.data.removeRange(0, 6);
|
reply.data.removeRange(0, 6);
|
||||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||||
var getList = splitList(reply.data, 8);
|
var getList = splitList(reply.data, 8);
|
||||||
print("getList:$getList");
|
print("getList:$getList");
|
||||||
var uploadList = [];
|
var uploadList = [];
|
||||||
for(int i = 0; i<getList.length; i++){
|
for (int i = 0; i < getList.length; i++) {
|
||||||
var indexList = getList[i];
|
var indexList = getList[i];
|
||||||
print("indexList:$indexList");
|
print("indexList:$indexList");
|
||||||
var indexMap = {};
|
var indexMap = {};
|
||||||
@ -90,13 +90,13 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
indexMap["type"] = indexList[1].toString();
|
indexMap["type"] = indexList[1].toString();
|
||||||
|
|
||||||
int value = ((0xff & indexList[(4)]) << 24 |
|
int value = ((0xff & indexList[(4)]) << 24 |
|
||||||
(0xff & indexList[5]) << 16 |
|
(0xff & indexList[5]) << 16 |
|
||||||
(0xff & indexList[6]) << 8 |
|
(0xff & indexList[6]) << 8 |
|
||||||
(0xFF & indexList[7]));
|
(0xFF & indexList[7]));
|
||||||
// indexMap["date"] = DateTool().dateToYMDHNSString("$value");
|
// indexMap["date"] = DateTool().dateToYMDHNSString("$value");
|
||||||
// print("value:${DateTool().dateToYMDHNSString("$value")}");
|
// print("value:${DateTool().dateToYMDHNSString("$value")}");
|
||||||
|
|
||||||
indexMap["date"] = "${value*1000}";
|
indexMap["date"] = "${value * 1000}";
|
||||||
uploadList.add(indexMap);
|
uploadList.add(indexMap);
|
||||||
}
|
}
|
||||||
lockRecordUploadData(uploadList);
|
lockRecordUploadData(uploadList);
|
||||||
@ -155,7 +155,8 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 查询事件记录(时间查询)
|
// 查询事件记录(时间查询)
|
||||||
Future<void> senderReferEventRecordTime(int time) async {
|
Future<void> senderReferEventRecordTime(int time) async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(DeviceConnectionState state) async {
|
||||||
if (state == DeviceConnectionState.connected) {
|
if (state == DeviceConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -168,15 +169,15 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
|
|
||||||
EasyLoading.show();
|
EasyLoading.show();
|
||||||
IoSenderManage.senderReferEventRecordTimeCommand(
|
IoSenderManage.senderReferEventRecordTimeCommand(
|
||||||
keyID:BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
userID:await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
logsCount:20,
|
logsCount: 20,
|
||||||
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
||||||
time: time,
|
time: time,
|
||||||
token:getTokenList,
|
token: getTokenList,
|
||||||
needAuthor:1,
|
needAuthor: 1,
|
||||||
publicKey:getPublicKeyList,
|
publicKey: getPublicKeyList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -202,25 +203,24 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("操作记录列表成功:${entity.data?.itemList}");
|
print("操作记录列表成功:${entity.data?.itemList}");
|
||||||
state.lockOperatingRecordListData.value = entity.data!.itemList!;
|
state.lockOperatingRecordListData.value = entity.data!.itemList!;
|
||||||
}else{
|
} else {}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询锁记录最后时间
|
// 查询锁记录最后时间
|
||||||
void getLockRecordLastUploadDataTime() async {
|
void getLockRecordLastUploadDataTime() async {
|
||||||
LockOperatingRecordGetLastRecordTimeEntity entity =
|
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
|
||||||
await ApiRepository.to.getLockRecordLastUploadDataTime(lockId: state.keyInfos.value.lockId.toString());
|
.getLockRecordLastUploadDataTime(
|
||||||
|
lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
senderReferEventRecordTime(entity.data!.operateDate!~/1000);
|
senderReferEventRecordTime(entity.data!.operateDate! ~/ 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 操作记录上传
|
// 操作记录上传
|
||||||
void lockRecordUploadData(List list) async {
|
void lockRecordUploadData(List list) async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordUploadData(
|
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
lockId: state.keyInfos.value.lockId.toString(),
|
.lockRecordUploadData(
|
||||||
records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
//清空操作记录
|
//清空操作记录
|
||||||
void clearOperationRecordRequest() async {
|
void clearOperationRecordRequest() async {
|
||||||
KeyOperationRecordEntity entity =
|
KeyOperationRecordEntity entity =
|
||||||
await ApiRepository.to.clearOperationRecord('28');
|
await ApiRepository.to.clearOperationRecord('28');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("清除数据成功");
|
showToast("清除数据成功");
|
||||||
}
|
}
|
||||||
@ -242,8 +242,8 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
print("onReady()");
|
print("onReady()");
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if (isDemoMode == false) {
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
|
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
@ -257,8 +257,8 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
print("onInit()");
|
print("onInit()");
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if (isDemoMode == false) {
|
||||||
getLockRecordLastUploadDataTime();
|
getLockRecordLastUploadDataTime();
|
||||||
// senderReferEventRecordTime();
|
// senderReferEventRecordTime();
|
||||||
// senderReferEventRecordNumber();
|
// senderReferEventRecordNumber();
|
||||||
@ -271,10 +271,9 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if (isDemoMode == false) {
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/custom_bottom_sheet.dart';
|
import '../../../tools/custom_bottom_sheet.dart';
|
||||||
@ -26,7 +25,6 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -34,38 +32,39 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: [
|
||||||
(state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1)
|
(state.keyInfos.value.isLockOwner == 1 ||
|
||||||
? IconButton(
|
state.keyInfos.value.keyRight == 1)
|
||||||
icon: Image.asset(
|
? IconButton(
|
||||||
'images/icon_bar_more.png',
|
icon: Image.asset(
|
||||||
height: 30.h,
|
'images/icon_bar_more.png',
|
||||||
width: 10.w,
|
height: 30.h,
|
||||||
),
|
width: 10.w,
|
||||||
onPressed: () async {
|
),
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
onPressed: () async {
|
||||||
if(isDemoMode == false){
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
// JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
if (isDemoMode == false) {
|
||||||
// print('选中index: $index');
|
// JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||||
// print('选中text: $selText');
|
// print('选中index: $index');
|
||||||
// if (index == 0) {
|
// print('选中text: $selText');
|
||||||
// logic.mockNetworkDataRequest();
|
// if (index == 0) {
|
||||||
// } else if (index == 1) {
|
// logic.mockNetworkDataRequest();
|
||||||
// logic.clearOperationRecordRequest();
|
// } else if (index == 1) {
|
||||||
// }
|
// logic.clearOperationRecordRequest();
|
||||||
// }, listData: [
|
// }
|
||||||
// {'text': '读取记录'},
|
// }, listData: [
|
||||||
// {'text': '清空记录'},
|
// {'text': '读取记录'},
|
||||||
// {'text': '导出记录'},
|
// {'text': '清空记录'},
|
||||||
// ]);
|
// {'text': '导出记录'},
|
||||||
|
// ]);
|
||||||
|
|
||||||
_openModalBottomSheet();
|
_openModalBottomSheet();
|
||||||
}else{
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast("演示模式");
|
logic.showToast("演示模式");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
@ -79,9 +78,7 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
_searchWidget(),
|
_searchWidget(),
|
||||||
SizedBox(
|
SizedBox(height: 10.h),
|
||||||
height: 10.h
|
|
||||||
),
|
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -124,24 +121,28 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return Obx(() => state.lockOperatingRecordListData.value.isNotEmpty ? ListView.separated(
|
return Obx(() => state.lockOperatingRecordListData.value.isNotEmpty
|
||||||
itemCount: state.lockOperatingRecordListData.length,
|
? ListView.separated(
|
||||||
itemBuilder: (c, index) {
|
itemCount: state.lockOperatingRecordListData.length,
|
||||||
KeyRecordDataItem dataItem = state.lockOperatingRecordListData[index];
|
itemBuilder: (c, index) {
|
||||||
int? operateDate = dataItem.operateDate;
|
KeyRecordDataItem dataItem =
|
||||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
state.lockOperatingRecordListData[index];
|
||||||
String operateDateStr = '${dateStr.toLocal().toString().substring(0, 16)} ';
|
int? operateDate = dataItem.operateDate;
|
||||||
return _operatingRecordItem(getTypeIcon(dataItem.recordType!), dataItem.recordTypeName!, operateDateStr, () {
|
DateTime dateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
||||||
});
|
String operateDateStr =
|
||||||
},
|
'${dateStr.toLocal().toString().substring(0, 16)} ';
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
return _operatingRecordItem(getTypeIcon(dataItem.recordType!),
|
||||||
return const Divider(
|
dataItem.recordTypeName!, operateDateStr, () {});
|
||||||
height: 1,
|
},
|
||||||
color: AppColors.greyLineColor,
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
);
|
return const Divider(
|
||||||
},
|
height: 1,
|
||||||
) : NoData());
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: NoData());
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _dateItem(String lockDate) {
|
Widget _dateItem(String lockDate) {
|
||||||
@ -185,7 +186,8 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _operatingRecordItem(String userAvatarStr, String userNameStr, String unlockDescStr, Function() action) {
|
Widget _operatingRecordItem(String userAvatarStr, String userNameStr,
|
||||||
|
String unlockDescStr, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -261,5 +263,4 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
|
||||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
|
||||||
|
|
||||||
class LockOperatingRecordState{
|
class LockOperatingRecordState {
|
||||||
final keyInfos = LockListInfoItemEntity().obs;
|
final keyInfos = LockListInfoItemEntity().obs;
|
||||||
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
||||||
LockOperatingRecordState() {
|
LockOperatingRecordState() {
|
||||||
keyInfos.value = Get.arguments["keyInfo"];
|
keyInfos.value = Get.arguments["keyInfo"];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,31 +1,28 @@
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
|
||||||
import '../../../../../network/api_repository.dart';
|
import '../../../../../network/api_repository.dart';
|
||||||
import '../../../../../tools/baseGetXController.dart';
|
import '../../../../../tools/baseGetXController.dart';
|
||||||
import '../../../../../tools/eventBusEventManage.dart';
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
|
||||||
import 'editLockName_state.dart';
|
import 'editLockName_state.dart';
|
||||||
|
|
||||||
class EditLockNameLogic extends BaseGetXController{
|
class EditLockNameLogic extends BaseGetXController {
|
||||||
final EditLockNameState state = EditLockNameState();
|
final EditLockNameState state = EditLockNameState();
|
||||||
|
|
||||||
//修改锁名称请求
|
//修改锁名称请求
|
||||||
Future<void> modifyKeyNameRequest() async {
|
Future<void> modifyKeyNameRequest() async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateLockName(
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateLockName(
|
||||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||||
lockName:state.changeLockNameController.text);
|
lockName: state.changeLockNameController.text);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
|
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
|
||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: () {
|
||||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!));
|
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(
|
||||||
|
3, state.lockBasicInfo.value.lockAlias!));
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
});
|
});
|
||||||
|
|
||||||
Get.back(result: {
|
Get.back(result: {"lockBasicInfo": state.lockBasicInfo.value});
|
||||||
"lockBasicInfo":state.lockBasicInfo.value
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
|
||||||
import '../../../../../blue/blue_manage.dart';
|
import '../../../../../blue/blue_manage.dart';
|
||||||
import '../../../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
|
import '../../../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
|
||||||
@ -13,7 +13,6 @@ import '../../../../../network/api_repository.dart';
|
|||||||
import '../../../../../tools/baseGetXController.dart';
|
import '../../../../../tools/baseGetXController.dart';
|
||||||
import '../../../../../tools/eventBusEventManage.dart';
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../../tools/storage.dart';
|
import '../../../../../tools/storage.dart';
|
||||||
import '../../../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
|
||||||
import 'uploadElectricQuantity_state.dart';
|
import 'uploadElectricQuantity_state.dart';
|
||||||
|
|
||||||
class UploadElectricQuantityLogic extends BaseGetXController {
|
class UploadElectricQuantityLogic extends BaseGetXController {
|
||||||
@ -21,12 +20,15 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//电量更新请求
|
//电量更新请求
|
||||||
Future<void> uploadElectricQuantityRequest(String electricQuantity) async {
|
Future<void> uploadElectricQuantityRequest(String electricQuantity) async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(electricQuantity, state.lockSetInfoData.value.lockId.toString());
|
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
|
.uploadElectricQuantity(
|
||||||
|
electricQuantity, state.lockSetInfoData.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("锁电量更新成功", something: () {
|
||||||
showToast("锁电量更新成功", something: (){
|
eventBus
|
||||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, electricQuantity));
|
eventBus.fire(
|
||||||
|
LockSetChangeSetRefreshLockDetailWithType(0, electricQuantity));
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -34,17 +36,18 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取锁状态
|
// 获取锁状态
|
||||||
Future<void> getStarLockStatus() async {
|
Future<void> getStarLockStatus() async {
|
||||||
if(state.sureBtnState.value == 1){
|
if (state.sureBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.sureBtnState.value = 1;
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(DeviceConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == DeviceConnectionState.connected) {
|
if (deviceConnectionState == DeviceConnectionState.connected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -58,7 +61,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +71,8 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
// 获取锁状态信息
|
// 获取锁状态信息
|
||||||
if (reply is GetStarLockStatuInfoReply) {
|
if (reply is GetStarLockStatuInfoReply) {
|
||||||
_replyGetStarLockStatusInfo(reply);
|
_replyGetStarLockStatusInfo(reply);
|
||||||
@ -81,7 +85,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
print("${reply.commandType}数据解析成功");
|
print("${reply.commandType}数据解析成功");
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
@ -89,28 +93,31 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 电池剩余电量
|
// 电池剩余电量
|
||||||
var battRemCap = reply.data[132];
|
var battRemCap = reply.data[132];
|
||||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity = battRemCap;
|
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity =
|
||||||
state.uploadElectricQuantityDate.value = DateTime.now().millisecondsSinceEpoch;
|
battRemCap;
|
||||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate = DateTime.now().millisecondsSinceEpoch;
|
state.uploadElectricQuantityDate.value =
|
||||||
|
DateTime.now().millisecondsSinceEpoch;
|
||||||
|
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate =
|
||||||
|
DateTime.now().millisecondsSinceEpoch;
|
||||||
uploadElectricQuantityRequest(battRemCap.toString());
|
uploadElectricQuantityRequest(battRemCap.toString());
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType}需要鉴权");
|
print("${reply.commandType}需要鉴权");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType}用户无权限");
|
print("${reply.commandType}用户无权限");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
// 权限校验错误
|
// 权限校验错误
|
||||||
print("${reply.commandType}权限校验错误");
|
print("${reply.commandType}权限校验错误");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
print("${reply.commandType}失败");
|
print("${reply.commandType}失败");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -139,5 +146,4 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -177,19 +177,19 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
arguments: {'lockSetInfoData': state.lockSetInfoData.value});
|
arguments: {'lockSetInfoData': state.lockSetInfoData.value});
|
||||||
}),
|
}),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
// 门磁
|
|
||||||
Obx(() => Visibility(
|
|
||||||
visible: state.lockFeature.value.doorStatus == 1 ? true : false,
|
|
||||||
child: CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Get.toNamed(Routers.doorMagneticPage);
|
|
||||||
// Toast.show(msg: "功能暂未开放");
|
|
||||||
}))),
|
|
||||||
//by DaisyWu 田总:移至锁详情配件区
|
//by DaisyWu 田总:移至锁详情配件区
|
||||||
|
// 门磁
|
||||||
|
// Obx(() => Visibility(
|
||||||
|
// visible: state.lockFeature.value.doorStatus == 1 ? true : false,
|
||||||
|
// child: CommonItem(
|
||||||
|
// leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr,
|
||||||
|
// rightTitle: "",
|
||||||
|
// isHaveLine: true,
|
||||||
|
// isHaveDirection: true,
|
||||||
|
// action: () {
|
||||||
|
// Get.toNamed(Routers.doorMagneticPage);
|
||||||
|
// // Toast.show(msg: "功能暂未开放");
|
||||||
|
// }))),
|
||||||
// // 无线键盘
|
// // 无线键盘
|
||||||
// Obx(() => Visibility(
|
// Obx(() => Visibility(
|
||||||
// visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false,
|
// visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false,
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:aliyun_push/aliyun_push.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
|
import 'package:star_lock/tools/xs_aliyunPush.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../baseWidget.dart';
|
import '../../../baseWidget.dart';
|
||||||
@ -29,8 +33,8 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
final logic = Get.put(LockMainLogic());
|
final logic = Get.put(LockMainLogic());
|
||||||
final state = Get.find<LockMainLogic>().state;
|
final state = Get.find<LockMainLogic>().state;
|
||||||
|
|
||||||
void getHttpData(){
|
void getHttpData() {
|
||||||
logic.getStarLockInfo().then((LockListInfoEntity value){
|
logic.getStarLockInfo().then((LockListInfoEntity value) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -40,6 +44,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData();
|
||||||
|
initAliyunPush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -92,12 +97,11 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
child: Obx(() => getDataReturnUI(state.dataLength.value))
|
child: Obx(() => getDataReturnUI(state.dataLength.value))),
|
||||||
),
|
|
||||||
// body:smartRefresher(
|
// body:smartRefresher(
|
||||||
// logic.refreshController,
|
// logic.refreshController,
|
||||||
// onRefresh:logic.onRefresh,
|
// onRefresh:logic.onRefresh,
|
||||||
@ -118,12 +122,16 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
case 1:
|
case 1:
|
||||||
// 只有一条数据
|
// 只有一条数据
|
||||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||||
returnWidget = LockDetailPage(isOnlyOneData: true, lockListInfoItemEntity: state.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
|
returnWidget = LockDetailPage(
|
||||||
|
isOnlyOneData: true,
|
||||||
|
lockListInfoItemEntity: state
|
||||||
|
.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 有多条数据
|
// 有多条数据
|
||||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||||
returnWidget = LockListPage(lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
|
returnWidget = LockListPage(
|
||||||
|
lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
returnWidget = NoData();
|
returnWidget = NoData();
|
||||||
@ -179,13 +187,13 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
Container(
|
Container(
|
||||||
// padding: EdgeInsets.all(30.w),
|
// padding: EdgeInsets.all(30.w),
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader
|
TranslationLoader
|
||||||
.lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr,
|
.lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 26.sp,
|
fontSize: 26.sp,
|
||||||
// fontWeight: FontWeight.w800,
|
// fontWeight: FontWeight.w800,
|
||||||
color: Colors.black),
|
color: Colors.black),
|
||||||
)),
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 160.h,
|
height: 160.h,
|
||||||
),
|
),
|
||||||
@ -204,4 +212,25 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
void onShow() {}
|
void onShow() {}
|
||||||
|
|
||||||
void onHide() {}
|
void onHide() {}
|
||||||
|
|
||||||
|
//初始化阿里云推送
|
||||||
|
void initAliyunPush() {
|
||||||
|
final aliyunPush = AliyunPush();
|
||||||
|
XSAliyunPushProvider().init(aliyunPush);
|
||||||
|
XSAliyunPushProvider().initAliyunPush();
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
XSAliyunPushProvider().initAliyunThirdPush();
|
||||||
|
}
|
||||||
|
|
||||||
|
//暂使用DeviceID推送
|
||||||
|
aliyunPush.getDeviceId().then((deviceId) async {
|
||||||
|
// print('得到的DeviceId$deviceId');
|
||||||
|
final data = await Storage.getString(saveUserLoginData);
|
||||||
|
if (data!.isNotEmpty && deviceId.isNotEmpty) {
|
||||||
|
XSAliyunPushProvider()
|
||||||
|
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:star_lock/mine/mall/lockMall_entity.dart';
|
import 'package:star_lock/mine/mall/lockMall_entity.dart';
|
||||||
import 'package:star_lock/mine/mall/lockMall_state.dart';
|
import 'package:star_lock/mine/mall/lockMall_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
import '../../tools/baseGetXController.dart';
|
import '../../tools/baseGetXController.dart';
|
||||||
|
|
||||||
@ -12,6 +13,27 @@ class LockMallLogic extends BaseGetXController {
|
|||||||
LockMallDataEntity entity = await ApiRepository.to.getMallURLData();
|
LockMallDataEntity entity = await ApiRepository.to.getMallURLData();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockMallUrl.value = entity.data!.url!;
|
state.lockMallUrl.value = entity.data!.url!;
|
||||||
|
state.mallWebView.setNavigationDelegate(
|
||||||
|
NavigationDelegate(
|
||||||
|
onProgress: (int progress) {
|
||||||
|
// Update loading bar.
|
||||||
|
state.webProgress.value = progress / 100;
|
||||||
|
},
|
||||||
|
onPageStarted: (String url) {
|
||||||
|
state.webProgress.value = 0.0;
|
||||||
|
},
|
||||||
|
onPageFinished: (String url) {
|
||||||
|
state.webProgress.value = 1.0;
|
||||||
|
},
|
||||||
|
onWebResourceError: (WebResourceError error) {},
|
||||||
|
onNavigationRequest: (NavigationRequest request) {
|
||||||
|
// if (request.url.startsWith('https://www.youtube.com/')) {
|
||||||
|
// return NavigationDecision.prevent;
|
||||||
|
// }
|
||||||
|
return NavigationDecision.navigate;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
state.mallWebView.loadRequest(Uri.parse(state.lockMallUrl.value));
|
state.mallWebView.loadRequest(Uri.parse(state.lockMallUrl.value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/mine/mall/lockMall_logic.dart';
|
import 'package:star_lock/mine/mall/lockMall_logic.dart';
|
||||||
@ -36,7 +37,22 @@ class _LockMallPageState extends State<LockMallPage> {
|
|||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
body: WebViewWidget(controller: state.mallWebView));
|
body: Obx(() => Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(bottom: 10.w),
|
||||||
|
child: LinearProgressIndicator(
|
||||||
|
value: state.webProgress.value,
|
||||||
|
backgroundColor: Colors.grey,
|
||||||
|
valueColor:
|
||||||
|
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: WebViewWidget(controller: state.mallWebView),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
String getWebTitle() {
|
String getWebTitle() {
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
class LockMallState {
|
class LockMallState {
|
||||||
var lockMallUrl = "".obs;
|
var lockMallUrl = "".obs;
|
||||||
|
var webProgress = 0.0.obs;
|
||||||
late WebViewController mallWebView = WebViewController()
|
late WebViewController mallWebView = WebViewController()
|
||||||
..setJavaScriptMode(JavaScriptMode.unrestricted);
|
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||||
|
..setBackgroundColor(Colors.white);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,9 +16,9 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
|||||||
String getEffectiveDateTime = '0';
|
String getEffectiveDateTime = '0';
|
||||||
if (state.tabController!.index == 1) {
|
if (state.tabController!.index == 1) {
|
||||||
getFailureDateTime =
|
getFailureDateTime =
|
||||||
state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
state.failureDate.value.millisecondsSinceEpoch.toString();
|
||||||
getEffectiveDateTime =
|
getEffectiveDateTime =
|
||||||
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
state.effectiveDate.value.millisecondsSinceEpoch.toString();
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
||||||
state.isCreateUser.value ? "1" : "0",
|
state.isCreateUser.value ? "1" : "0",
|
||||||
@ -45,46 +45,46 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送钥匙请求
|
// //发送钥匙请求
|
||||||
Future<void> sendElectronicKeyRequest(BuildContext widgetContext) async {
|
// Future<void> sendElectronicKeyRequest(BuildContext widgetContext) async {
|
||||||
String getFailureDateTime = '0';
|
// String lockID = state.keyInfo.value.lockId.toString();
|
||||||
String getEffectiveDateTime = '0';
|
// String getKeyType = (int.parse(state.type.value) + 1).toString();
|
||||||
String lockID = state.keyInfo.value.lockId.toString();
|
// if (state.type.value == '0') {
|
||||||
String getKeyType = (int.parse(state.type.value) + 1).toString();
|
// // getFailureDateTime =
|
||||||
if (state.type.value == '0') {
|
// // state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||||
getFailureDateTime =
|
// // getEffectiveDateTime =
|
||||||
state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
// // state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
||||||
getEffectiveDateTime =
|
// }
|
||||||
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
var entity = await ApiRepository.to.sendElectronicKey(
|
// var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
createUser: state.isCreateUser.value ? "1" : "0",
|
// createUser: state.isCreateUser.value ? "1" : "0",
|
||||||
countryCode: state.countryCode.value,
|
// countryCode: state.countryCode.value,
|
||||||
usernameType: '1',
|
// usernameType: '1',
|
||||||
endDate: getFailureDateTime,
|
// endDate: state.failureDateTime.value.millisecondsSinceEpoch,
|
||||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
// faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||||
isCameraEnable: '2',
|
// isCameraEnable: '2',
|
||||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
// isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||||
keyNameForAdmin: state.keyNameController.text,
|
// keyNameForAdmin: state.keyNameController.text,
|
||||||
keyRight: '0',
|
// keyRight: '0',
|
||||||
keyType: getKeyType,
|
// keyType: getKeyType,
|
||||||
lockId: lockID,
|
// lockId: lockID,
|
||||||
operatorUid: '',
|
// operatorUid: '',
|
||||||
receiverUsername: state.emailOrPhoneController.text,
|
// receiverUsername: state.emailOrPhoneController.text,
|
||||||
remarks: '',
|
// remarks: '',
|
||||||
startDate: getEffectiveDateTime,
|
// startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
|
||||||
weekDays: state.weekdaysList);
|
// weekDays: state.weekdaysList,
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
// startTime: state.st.value,
|
||||||
print('发送电子钥匙成功');
|
// endTime: state.endTime.value);
|
||||||
state.isSendSuccess.value = true;
|
// if (entity.errorCode!.codeIsSuccessful) {
|
||||||
} else {
|
// print('发送电子钥匙成功');
|
||||||
if (entity.errorCode == 425) {
|
// state.isSendSuccess.value = true;
|
||||||
//用户未注册
|
// } else {
|
||||||
_showDialog(widgetContext, '${entity.errorMsg}');
|
// if (entity.errorCode == 425) {
|
||||||
}
|
// //用户未注册
|
||||||
}
|
// _showDialog(widgetContext, '${entity.errorMsg}');
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
//用户未注册确认弹窗
|
//用户未注册确认弹窗
|
||||||
void _showDialog(widgetContext, String errMsg) {
|
void _showDialog(widgetContext, String errMsg) {
|
||||||
|
|||||||
@ -3,12 +3,10 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_utils/get_utils.dart';
|
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
|
import 'package:star_lock/tools/dateUtils.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
@ -25,28 +23,13 @@ class AddAuthorizedAdministratorPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministratorPage> with SingleTickerProviderStateMixin {
|
class _AddAuthorizedAdministratorPageState
|
||||||
|
extends State<AddAuthorizedAdministratorPage>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
final logic = Get.put(AddAuthorizedAdministratorLogic());
|
final logic = Get.put(AddAuthorizedAdministratorLogic());
|
||||||
final state = Get.find<AddAuthorizedAdministratorLogic>().state;
|
final state = Get.find<AddAuthorizedAdministratorLogic>().state;
|
||||||
|
|
||||||
TabController? _tabController;
|
TabController? _tabController;
|
||||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
|
||||||
late Contact _contact;
|
|
||||||
final _templateNameTf = TextEditingController();
|
|
||||||
late List _lockIdList;
|
|
||||||
late bool _isRemoteUnlock;
|
|
||||||
late bool _isCreateUser;
|
|
||||||
var _selectEffectiveDate = ''; //生效时间
|
|
||||||
var _selectFailureDate = ''; //失效时间
|
|
||||||
late DateTime _effectiveDateTime;
|
|
||||||
late DateTime _failureDateTime;
|
|
||||||
final TextEditingController _emailOrPhoneController =
|
|
||||||
TextEditingController(); //邮箱/手机号输入框
|
|
||||||
final TextEditingController _keyNameController =
|
|
||||||
TextEditingController(); //钥匙名输入框
|
|
||||||
String countryName = '中国';
|
|
||||||
String countryCode = '86';
|
|
||||||
late bool _isSendSuccess;
|
|
||||||
|
|
||||||
List tabs = [
|
List tabs = [
|
||||||
TranslationLoader.lanKeys!.permanent!.tr,
|
TranslationLoader.lanKeys!.permanent!.tr,
|
||||||
@ -57,10 +40,6 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_isCreateUser = false;
|
|
||||||
_lockIdList = [];
|
|
||||||
_isRemoteUnlock = false;
|
|
||||||
_isSendSuccess = false;
|
|
||||||
_tabController = TabController(length: 2, vsync: this);
|
_tabController = TabController(length: 2, vsync: this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +98,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
|
|
||||||
//永久
|
//永久
|
||||||
Widget _permanentAdministrator() {
|
Widget _permanentAdministrator() {
|
||||||
if (_isSendSuccess) {
|
if (state.isSendSuccess.value == true) {
|
||||||
return sendElectronicKeySucceed();
|
return sendElectronicKeySucceed();
|
||||||
} else {
|
} else {
|
||||||
return Column(
|
return Column(
|
||||||
@ -133,9 +112,9 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
rightTitle: _lockIdList.isEmpty
|
rightTitle: state.lockIdList.value.isEmpty
|
||||||
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
||||||
: _lockIdList.length.toString(),
|
: state.lockIdList.value.length.toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
||||||
@ -143,7 +122,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
//得到选中的锁ID列表
|
//得到选中的锁ID列表
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
_lockIdList = value['selectLockIdList'];
|
state.lockIdList.value = value['selectLockIdList'];
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -164,7 +143,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
|
|
||||||
//限时管理员
|
//限时管理员
|
||||||
Widget _timeLimitAdministrator() {
|
Widget _timeLimitAdministrator() {
|
||||||
if (_isSendSuccess) {
|
if (state.isSendSuccess.value == true) {
|
||||||
return sendElectronicKeySucceed();
|
return sendElectronicKeySucceed();
|
||||||
} else {
|
} else {
|
||||||
return Column(
|
return Column(
|
||||||
@ -182,9 +161,9 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
rightTitle: _lockIdList.isEmpty
|
rightTitle: state.lockIdList.value.isEmpty
|
||||||
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
||||||
: _lockIdList.length.toString(),
|
: state.lockIdList.value.length.toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
||||||
@ -192,7 +171,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
//得到选中的锁ID列表
|
//得到选中的锁ID列表
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
_lockIdList = value['selectLockIdList'];
|
state.lockIdList.value = value['selectLockIdList'];
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -211,41 +190,6 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送批量授权管理员
|
|
||||||
Future<void> addAuthorizedAdminRequest() async {
|
|
||||||
String getFailureDateTime = '0';
|
|
||||||
String getEffectiveDateTime = '0';
|
|
||||||
if (_tabController!.index == 1) {
|
|
||||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
|
||||||
getEffectiveDateTime =
|
|
||||||
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
|
||||||
}
|
|
||||||
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
|
||||||
_isCreateUser ? "1" : "0",
|
|
||||||
getFailureDateTime,
|
|
||||||
_isRemoteUnlock == true ? '1' : '2',
|
|
||||||
[],
|
|
||||||
_lockIdList,
|
|
||||||
_keyNameController.text,
|
|
||||||
getEffectiveDateTime,
|
|
||||||
_emailOrPhoneController.text,
|
|
||||||
countryCode,
|
|
||||||
'1',
|
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print('发送电子钥匙成功');
|
|
||||||
_isSendSuccess = true;
|
|
||||||
setState(() {});
|
|
||||||
} else {
|
|
||||||
logic.showToast("${entity.errorMsg}");
|
|
||||||
if (entity.errorCode == 425) {
|
|
||||||
//用户未注册
|
|
||||||
_isCreateUser = true;
|
|
||||||
addAuthorizedAdminRequest();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 顶部钥匙信息widget
|
// 顶部钥匙信息widget
|
||||||
Widget keyInfoWidget() {
|
Widget keyInfoWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
@ -259,7 +203,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
true,
|
true,
|
||||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
_emailOrPhoneController)),
|
state.emailOrPhoneController)),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
@ -267,7 +211,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
rightWidget: Text(
|
rightWidget: Text(
|
||||||
'$countryName +$countryCode',
|
'${state.countryName.value} +${state.countryCode.value}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
@ -277,8 +221,8 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
context, Routers.selectCountryRegionPage);
|
context, Routers.selectCountryRegionPage);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
countryCode = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
countryName = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -290,7 +234,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
false,
|
false,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
_keyNameController)),
|
state.keyNameController)),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -339,10 +283,10 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Contact? currentContact =
|
Contact? currentContact =
|
||||||
await _contactPicker.selectContact();
|
await state.contactPicker.selectContact();
|
||||||
setState(() {
|
setState(() {
|
||||||
if (currentContact!.phoneNumbers!.isNotEmpty) {
|
if (currentContact!.phoneNumbers!.isNotEmpty) {
|
||||||
_emailOrPhoneController.text = currentContact
|
state.emailOrPhoneController.text = currentContact
|
||||||
.phoneNumbers![0]
|
.phoneNumbers![0]
|
||||||
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
||||||
}
|
}
|
||||||
@ -364,7 +308,8 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w, height: 50.h, child: Obx(() => _switch())),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
Container(height: 40.h),
|
Container(height: 40.h),
|
||||||
],
|
],
|
||||||
@ -377,30 +322,34 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: _selectEffectiveDate,
|
rightTitle: state.selectEffectiveDate.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectEffectiveDate =
|
state.effectiveDate.value = XSDateUtils.parseDateTime(
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
'yyyy-mm-dd HH:mm');
|
||||||
|
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
||||||
|
state.effectiveDate.value, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: _selectFailureDate,
|
rightTitle: state.selectFailureDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectFailureDate =
|
state.failureDate.value = XSDateUtils.parseDateTime(
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
_failureDateTime = DateTime.parse(_selectFailureDate);
|
'yyyy-mm-dd HH:mm');
|
||||||
|
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
||||||
|
state.failureDate.value, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -430,7 +379,9 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
borderRadius: 20.w,
|
borderRadius: 20.w,
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {}),
|
onClick: () {
|
||||||
|
logic.addAuthorizedAdminRequest();
|
||||||
|
}),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(right: 30.w),
|
padding: EdgeInsets.only(right: 30.w),
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
@ -497,7 +448,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '完成',
|
btnName: '完成',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
_isSendSuccess = false;
|
state.isSendSuccess.value = false;
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -532,11 +483,9 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: _isRemoteUnlock,
|
value: state.isRemoteUnlock.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
_isRemoteUnlock = !_isRemoteUnlock;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -545,12 +494,8 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
return SubmitBtn(
|
return SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
addAuthorizedAdminRequest();
|
logic.addAuthorizedAdminRequest();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? "0$v" : "$v";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,8 +22,10 @@ class AddAuthorizedAdministratorState {
|
|||||||
var selectFailureDate =
|
var selectFailureDate =
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||||
.obs; //默认为当前时间
|
.obs; //默认为当前时间
|
||||||
final effectiveDateTime = DateTime.now().obs;
|
final effectiveDate = DateTime.now().obs;
|
||||||
final failureDateTime = DateTime.now().obs;
|
final failureDate = DateTime.now().obs;
|
||||||
|
var startTime = 0.obs;
|
||||||
|
var endTime = 0.obs;
|
||||||
var countryName = '中国'.obs;
|
var countryName = '中国'.obs;
|
||||||
var countryCode = '86'.obs;
|
var countryCode = '86'.obs;
|
||||||
var isSendSuccess = false.obs;
|
var isSendSuccess = false.obs;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -102,13 +102,12 @@ class _ExpireLockChangeDatePageState extends State<ExpireLockChangeDatePage> {
|
|||||||
itemData.keyId.toString(),
|
itemData.keyId.toString(),
|
||||||
itemData.lockId.toString(),
|
itemData.lockId.toString(),
|
||||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
_failureDateTime.millisecondsSinceEpoch.toString(),
|
||||||
'',
|
|
||||||
'',
|
|
||||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||||
'', []);
|
[],
|
||||||
|
itemData.keyType!);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("修改要是名称成功啦啦啦啦啦");
|
print("修改要是名称成功啦啦啦啦啦");
|
||||||
EasyLoading.showToast('修改成功',duration: 2000.milliseconds);
|
EasyLoading.showToast('修改成功', duration: 2000.milliseconds);
|
||||||
setState(() {
|
setState(() {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -17,20 +17,22 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> register(
|
Future<Response> register(
|
||||||
int receiverType,
|
int receiverType,
|
||||||
int countryCode,
|
int countryCode,
|
||||||
String account,
|
String account,
|
||||||
String password,
|
String password,
|
||||||
String verificationCode,
|
String verificationCode,
|
||||||
) =>
|
) =>
|
||||||
post(registerUrl.toUrl, jsonEncode({
|
post(
|
||||||
'receiverType': receiverType,
|
registerUrl.toUrl,
|
||||||
'countryCode': countryCode,
|
jsonEncode({
|
||||||
"account": account,
|
'receiverType': receiverType,
|
||||||
'password': password,
|
'countryCode': countryCode,
|
||||||
'verificationCode': verificationCode,
|
"account": account,
|
||||||
'platId': "2",
|
'password': password,
|
||||||
}));
|
'verificationCode': verificationCode,
|
||||||
|
'platId': "2",
|
||||||
|
}));
|
||||||
|
|
||||||
// post(
|
// post(
|
||||||
// registerUrl.toUrl,
|
// registerUrl.toUrl,
|
||||||
@ -97,16 +99,16 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(getCountryRegionURL.toUrl, jsonEncode({'type': type}));
|
post(getCountryRegionURL.toUrl, jsonEncode({'type': type}));
|
||||||
|
|
||||||
Future<Response> electronicKeyList(
|
Future<Response> electronicKeyList(
|
||||||
String endDate,
|
String endDate,
|
||||||
String keyId,
|
String keyId,
|
||||||
String keyStatus,
|
String keyStatus,
|
||||||
String keyRight,
|
String keyRight,
|
||||||
String lockId,
|
String lockId,
|
||||||
String pageNo,
|
String pageNo,
|
||||||
String pageSize,
|
String pageSize,
|
||||||
String startDate,
|
String startDate,
|
||||||
String searchStr,
|
String searchStr,
|
||||||
) =>
|
) =>
|
||||||
post(
|
post(
|
||||||
electronicKeyListURL.toUrl,
|
electronicKeyListURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -125,7 +127,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
String createUser,
|
String createUser,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
String usernameType,
|
String usernameType,
|
||||||
String endDate,
|
int endDate,
|
||||||
String faceAuthentication,
|
String faceAuthentication,
|
||||||
String isCameraEnable,
|
String isCameraEnable,
|
||||||
String isRemoteUnlock,
|
String isRemoteUnlock,
|
||||||
@ -136,8 +138,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
String operatorUid,
|
String operatorUid,
|
||||||
String receiverUsername,
|
String receiverUsername,
|
||||||
String remarks,
|
String remarks,
|
||||||
String startDate,
|
int startDate,
|
||||||
List weekDays) =>
|
List weekDays,
|
||||||
|
int startTime,
|
||||||
|
int endTime) =>
|
||||||
post(
|
post(
|
||||||
sendElectronicKeyURL.toUrl,
|
sendElectronicKeyURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -156,7 +160,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
'receiverUsername': receiverUsername,
|
'receiverUsername': receiverUsername,
|
||||||
'remarks': remarks,
|
'remarks': remarks,
|
||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'weekDays': weekDays
|
'weekDays': weekDays,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> uploadElectricQuantity(
|
Future<Response> uploadElectricQuantity(
|
||||||
@ -196,26 +202,17 @@ class ApiProvider extends BaseProvider {
|
|||||||
'operatorUid': operatorUid,
|
'operatorUid': operatorUid,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> updateKeyDate(
|
Future<Response> updateKeyDate(String keyId, String lockId, String endDate,
|
||||||
String keyId,
|
String startDate, List weekDays, int keyType) =>
|
||||||
String lockId,
|
|
||||||
String endDate,
|
|
||||||
String endDay,
|
|
||||||
String operatorUid,
|
|
||||||
String startDate,
|
|
||||||
String startDay,
|
|
||||||
List weekDays) =>
|
|
||||||
post(
|
post(
|
||||||
updateKeyDateURL.toUrl,
|
updateKeyDateURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
'endDate': endDate,
|
'endDate': endDate,
|
||||||
'endDay': endDay,
|
|
||||||
'operatorUid': operatorUid,
|
|
||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'startDay': startDay,
|
|
||||||
'weekDays': weekDays,
|
'weekDays': weekDays,
|
||||||
|
'keyType': keyType
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart';
|
import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
@ -143,7 +144,7 @@ class ApiRepository {
|
|||||||
{required String createUser,
|
{required String createUser,
|
||||||
required String countryCode,
|
required String countryCode,
|
||||||
required String usernameType,
|
required String usernameType,
|
||||||
required String endDate,
|
required int endDate,
|
||||||
required String faceAuthentication,
|
required String faceAuthentication,
|
||||||
required String isCameraEnable,
|
required String isCameraEnable,
|
||||||
required String isRemoteUnlock,
|
required String isRemoteUnlock,
|
||||||
@ -154,8 +155,10 @@ class ApiRepository {
|
|||||||
required String operatorUid,
|
required String operatorUid,
|
||||||
required String receiverUsername,
|
required String receiverUsername,
|
||||||
required String remarks,
|
required String remarks,
|
||||||
required String startDate,
|
required int startDate,
|
||||||
required List weekDays}) async {
|
required List weekDays,
|
||||||
|
required int startTime,
|
||||||
|
required int endTime}) async {
|
||||||
final res = await apiProvider.sendElectronicKey(
|
final res = await apiProvider.sendElectronicKey(
|
||||||
createUser,
|
createUser,
|
||||||
countryCode,
|
countryCode,
|
||||||
@ -172,7 +175,9 @@ class ApiRepository {
|
|||||||
receiverUsername,
|
receiverUsername,
|
||||||
remarks,
|
remarks,
|
||||||
startDate,
|
startDate,
|
||||||
weekDays);
|
weekDays,
|
||||||
|
startTime,
|
||||||
|
endTime);
|
||||||
return AuthorizedAdminSendEntity.fromJson(res.body);
|
return AuthorizedAdminSendEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +223,7 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//门锁事件日志
|
//门锁事件日志
|
||||||
Future<KeyOperationRecordEntity> lockEventList({
|
Future<DoorLockLogEntity> lockEventList({
|
||||||
required int lockId,
|
required int lockId,
|
||||||
required int lockEventType,
|
required int lockEventType,
|
||||||
required int pageNo,
|
required int pageNo,
|
||||||
@ -234,7 +239,7 @@ class ApiRepository {
|
|||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
);
|
);
|
||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return DoorLockLogEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
//操作记录上传
|
//操作记录上传
|
||||||
@ -324,17 +329,10 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//编辑电子钥匙有效期
|
//编辑电子钥匙有效期
|
||||||
Future<KeyOperationRecordEntity> updateKeyDate(
|
Future<KeyOperationRecordEntity> updateKeyDate(String keyId, String lockId,
|
||||||
String keyId,
|
String endDate, String startDate, List weekDays, int keyType) async {
|
||||||
String lockId,
|
final res = await apiProvider.updateKeyDate(
|
||||||
String endDate,
|
keyId, lockId, endDate, startDate, weekDays, keyType);
|
||||||
String endDay,
|
|
||||||
String operatorUid,
|
|
||||||
String startDate,
|
|
||||||
String startDay,
|
|
||||||
List weekDays) async {
|
|
||||||
final res = await apiProvider.updateKeyDate(keyId, lockId, endDate, endDay,
|
|
||||||
operatorUid, startDate, startDay, weekDays);
|
|
||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
28
star_lock/lib/tools/dateUtils.dart
Normal file
28
star_lock/lib/tools/dateUtils.dart
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
class XSDateUtils {
|
||||||
|
// 将DateTime对象格式化为指定格式的字符串
|
||||||
|
static String formatDateTime(DateTime dateTime, String format) {
|
||||||
|
DateFormat dateFormat = DateFormat(format);
|
||||||
|
return dateFormat.format(dateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将指定格式的日期时间字符串解析为DateTime对象
|
||||||
|
static DateTime parseDateTime(String dateString, String format) {
|
||||||
|
DateFormat dateFormat = DateFormat(format);
|
||||||
|
return dateFormat.parse(dateString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用示例
|
||||||
|
// void main() {
|
||||||
|
// // 格式化日期时间
|
||||||
|
// DateTime now = DateTime.now();
|
||||||
|
// String formattedDateTime = DateUtils.formatDateTime(now, 'HH:mm');
|
||||||
|
// print('Formatted DateTime: $formattedDateTime');
|
||||||
|
|
||||||
|
// // 解析日期时间字符串
|
||||||
|
// String dateString = '08:30';
|
||||||
|
// DateTime parsedDateTime = DateUtils.parseDateTime(dateString, 'HH:mm');
|
||||||
|
// print('Parsed DateTime: $parsedDateTime');
|
||||||
|
// }
|
||||||
@ -127,6 +127,7 @@ class _XSDropDownWidgetState extends State<XSDropDownWidget> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
item.itemTitle,
|
item.itemTitle,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp,
|
||||||
color: item.itemValue == currentValue
|
color: item.itemValue == currentValue
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: Colors.black, // 设置选中项文字颜色为白色
|
: Colors.black, // 设置选中项文字颜色为白色
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user