代码合并
This commit is contained in:
commit
e53c274e09
@ -55,12 +55,26 @@ android {
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
||||
// signingConfigs {
|
||||
// release {
|
||||
// storeFile file("key/keystore.jks")
|
||||
// storePassword '123456'
|
||||
// keyAlias = 'key0'
|
||||
// keyPassword '123456'
|
||||
// }
|
||||
// }
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
// debug {
|
||||
// // TODO: Add your own signing config for the release build.
|
||||
// // Signing with the debug keys for now, so `flutter run --release` works.
|
||||
// signingConfig signingConfigs.release
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" />
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />-->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" />-->
|
||||
|
||||
<!--允许访问网络,必选权限-->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.9.0'
|
||||
ext.kotlin_version = '1.8.20'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
||||
@ -405,5 +405,15 @@
|
||||
"pleaseEnterWifiPwd":"Please Enter WiFi Password",
|
||||
"edit":"Edit",
|
||||
"stressFingerprint":"Stress Fingerprint",
|
||||
"effectiveDay":"Effective Day"
|
||||
"effectiveDay":"Effective Day",
|
||||
|
||||
"whetherTheEmployeeHasPassword":"If The Employee Has A Password",
|
||||
"whetherTheEmployeeHasCard":"If The Employee Has A Card",
|
||||
"whetherTheEmployeeHasFingerprint":"If The Employee Has A Fingerprint",
|
||||
"seletPassword":"Selet Password",
|
||||
"seletCard":"Selet Card",
|
||||
"seletFingerprint":"Selet Fingerprint",
|
||||
"getKey":"Get Key",
|
||||
"getCard":"Get Card",
|
||||
"getFingerprint":"Get Fingerprint"
|
||||
}
|
||||
|
||||
@ -405,5 +405,15 @@
|
||||
"pleaseEnterWifiPwd":"pleaseEnterWifiPwd",
|
||||
"edit":"edit",
|
||||
"stressFingerprint":"stressFingerprint",
|
||||
"effectiveDay":"effectiveDay"
|
||||
"effectiveDay":"effectiveDay",
|
||||
|
||||
"whetherTheEmployeeHasPassword":"whetherTheEmployeeHasPassword",
|
||||
"whetherTheEmployeeHasCard":"whetherTheEmployeeHasCard",
|
||||
"whetherTheEmployeeHasFingerprint":"whetherTheEmployeeHasFingerprint",
|
||||
"seletPassword":"seletPassword",
|
||||
"seletCard":"seletCard",
|
||||
"seletFingerprint":"seletFingerprint",
|
||||
"getKey":"getKey",
|
||||
"getCard":"getCard",
|
||||
"getFingerprint":"getFingerprint"
|
||||
}
|
||||
@ -408,5 +408,15 @@
|
||||
"pleaseEnterWifiPwd":"请输入WiFi密码",
|
||||
"edit":"编辑",
|
||||
"stressFingerprint":"胁迫指纹",
|
||||
"effectiveDay":"有效日"
|
||||
"effectiveDay":"有效日",
|
||||
|
||||
"whetherTheEmployeeHasPassword":"员工是否有密码",
|
||||
"whetherTheEmployeeHasCard":"员工是否有卡",
|
||||
"whetherTheEmployeeHasFingerprint":"员工是否有指纹",
|
||||
"seletPassword":"选择密码",
|
||||
"seletCard":"选择卡",
|
||||
"seletFingerprint":"选择指纹",
|
||||
"getKey":"获取钥匙",
|
||||
"getCard":"获取卡",
|
||||
"getFingerprint":"获取指纹"
|
||||
}
|
||||
@ -23,8 +23,6 @@ PODS:
|
||||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
- geocoding_ios (1.0.5):
|
||||
- Flutter
|
||||
- google_maps_flutter_ios (0.0.1):
|
||||
- Flutter
|
||||
- GoogleMaps (< 8.0)
|
||||
@ -68,7 +66,6 @@ DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- geocoding_ios (from `.symlinks/plugins/geocoding_ios/ios`)
|
||||
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
|
||||
@ -106,8 +103,6 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/flutter_native_contact_picker/ios"
|
||||
fluttertoast:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
geocoding_ios:
|
||||
:path: ".symlinks/plugins/geocoding_ios/ios"
|
||||
google_maps_flutter_ios:
|
||||
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
|
||||
image_picker_ios:
|
||||
@ -141,7 +136,6 @@ SPEC CHECKSUMS:
|
||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
geocoding_ios: a389ea40f6f548de6e63006a2e31bf66ff80769a
|
||||
google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd
|
||||
GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693
|
||||
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
|
||||
|
||||
@ -375,14 +375,14 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 7NLFRKNVY3;
|
||||
DEVELOPMENT_TEAM = ZJ29NYHTV5;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock123";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
@ -506,14 +506,14 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 7NLFRKNVY3;
|
||||
DEVELOPMENT_TEAM = ZJ29NYHTV5;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock123";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
@ -530,14 +530,14 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 7NLFRKNVY3;
|
||||
DEVELOPMENT_TEAM = ZJ29NYHTV5;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock123";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
||||
@ -16,11 +16,11 @@ import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockChangeDate_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList_Page.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/selectBranch_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/transferSmartLock_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/selectBranch/selectBranch_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_page.dart';
|
||||
|
||||
import 'common/safetyVerification/safetyVerification_page.dart';
|
||||
import 'login/forgetPassword/starLock_forgetPassword_page.dart';
|
||||
|
||||
@ -71,7 +71,7 @@ class BlueManage{
|
||||
if(device.name.isEmpty){
|
||||
return;
|
||||
}
|
||||
// print("startScanDevice:${device}");
|
||||
print("startScanDevice:${device}");
|
||||
if (((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "").toString().contains("758824")) && ((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "").toString()[31] != "1") && (device.rssi >= -100)) {
|
||||
final knownDeviceIndex = _scanDevices.indexWhere((d) => d.id == device.id);
|
||||
|
||||
|
||||
@ -1,17 +1,16 @@
|
||||
//TODO:发送指令类型
|
||||
import 'package:get/get.dart';
|
||||
|
||||
//TODO:发送指令类型
|
||||
enum CommandType {
|
||||
addUser, //增加用户 = 0x3001
|
||||
deletUser , //删除用户 = 0x3002
|
||||
editUser , //修改用户 = 0x3003
|
||||
factoryDataReset , //恢复出厂设置 = 0x3004
|
||||
openLock , //开门 = 0x3005
|
||||
deletUser, //删除用户 = 0x3002
|
||||
editUser, //修改用户 = 0x3003
|
||||
factoryDataReset, //恢复出厂设置 = 0x3004
|
||||
openLock, //开门 = 0x3005
|
||||
readLockStatusInfo, //读取锁状态信息 = 0x300A
|
||||
transferPermissions, //转移权限 = 0x300B
|
||||
reportDoorOpenRecord, //开门记录上报 = 0x3020
|
||||
generalExtendedCommond , // 通用扩展指令 = 0x3030
|
||||
getLockPublicKey , // 获取锁公钥 = 0x3090
|
||||
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
||||
getLockPublicKey, // 获取锁公钥 = 0x3090
|
||||
getLockPrivateKey, // 获取锁私钥 = 0x3091
|
||||
calibrationTime, // 校时 = 0x30f0
|
||||
synchronizingLocationInformation, // 同步位置信息 = 0x30f1
|
||||
|
||||
@ -0,0 +1,188 @@
|
||||
class AuthorizedAdminSendEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
AuthorizedAdminSendEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
AuthorizedAdminSendEntity.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 {
|
||||
int? receiverUid;
|
||||
ReceiverUser? receiverUser;
|
||||
int? keyId;
|
||||
|
||||
Data({this.receiverUid, this.receiverUser, this.keyId});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
receiverUid = json['receiverUid'];
|
||||
receiverUser = json['receiverUser'] != null
|
||||
? ReceiverUser.fromJson(json['receiverUser'])
|
||||
: null;
|
||||
keyId = json['keyId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['receiverUid'] = receiverUid;
|
||||
if (receiverUser != null) {
|
||||
data['receiverUser'] = receiverUser!.toJson();
|
||||
}
|
||||
data['keyId'] = keyId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ReceiverUser {
|
||||
String? email;
|
||||
String? name;
|
||||
String? updatedAt;
|
||||
String? createdAt;
|
||||
int? id;
|
||||
String? profilePhotoUrl;
|
||||
Phone? phone;
|
||||
Cloud? cloud;
|
||||
|
||||
ReceiverUser(
|
||||
{this.email,
|
||||
this.name,
|
||||
this.updatedAt,
|
||||
this.createdAt,
|
||||
this.id,
|
||||
this.profilePhotoUrl,
|
||||
this.phone,
|
||||
this.cloud});
|
||||
|
||||
ReceiverUser.fromJson(Map<String, dynamic> json) {
|
||||
email = json['email'];
|
||||
name = json['name'];
|
||||
updatedAt = json['updated_at'];
|
||||
createdAt = json['created_at'];
|
||||
id = json['id'];
|
||||
profilePhotoUrl = json['profile_photo_url'];
|
||||
phone = json['phone'] != null ? Phone.fromJson(json['phone']) : null;
|
||||
cloud = json['cloud'] != null ? Cloud.fromJson(json['cloud']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = Map<String, dynamic>();
|
||||
data['email'] = email;
|
||||
data['name'] = name;
|
||||
data['updated_at'] = updatedAt;
|
||||
data['created_at'] = createdAt;
|
||||
data['id'] = id;
|
||||
data['profile_photo_url'] = profilePhotoUrl;
|
||||
if (phone != null) {
|
||||
data['phone'] = phone!.toJson();
|
||||
}
|
||||
if (cloud != null) {
|
||||
data['cloud'] = cloud!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Phone {
|
||||
int? userId;
|
||||
String? phoneNumberHash;
|
||||
String? phoneNumberEncrypt;
|
||||
String? countryCode;
|
||||
String? phoneNumberVerifiedAt;
|
||||
String? updatedAt;
|
||||
String? createdAt;
|
||||
int? id;
|
||||
|
||||
Phone(
|
||||
{this.userId,
|
||||
this.phoneNumberHash,
|
||||
this.phoneNumberEncrypt,
|
||||
this.countryCode,
|
||||
this.phoneNumberVerifiedAt,
|
||||
this.updatedAt,
|
||||
this.createdAt,
|
||||
this.id});
|
||||
|
||||
Phone.fromJson(Map<String, dynamic> json) {
|
||||
userId = json['user_id'];
|
||||
phoneNumberHash = json['phone_number_hash'];
|
||||
phoneNumberEncrypt = json['phone_number_encrypt'];
|
||||
countryCode = json['country_code'];
|
||||
phoneNumberVerifiedAt = json['phone_number_verified_at'];
|
||||
updatedAt = json['updated_at'];
|
||||
createdAt = json['created_at'];
|
||||
id = json['id'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['user_id'] = userId;
|
||||
data['phone_number_hash'] = phoneNumberHash;
|
||||
data['phone_number_encrypt'] = phoneNumberEncrypt;
|
||||
data['country_code'] = countryCode;
|
||||
data['phone_number_verified_at'] = phoneNumberVerifiedAt;
|
||||
data['updated_at'] = updatedAt;
|
||||
data['created_at'] = createdAt;
|
||||
data['id'] = id;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Cloud {
|
||||
String? username;
|
||||
String? password;
|
||||
int? cloudUid;
|
||||
int? userId;
|
||||
String? updatedAt;
|
||||
String? createdAt;
|
||||
int? id;
|
||||
|
||||
Cloud(
|
||||
{this.username,
|
||||
this.password,
|
||||
this.cloudUid,
|
||||
this.userId,
|
||||
this.updatedAt,
|
||||
this.createdAt,
|
||||
this.id});
|
||||
|
||||
Cloud.fromJson(Map<String, dynamic> json) {
|
||||
username = json['username'];
|
||||
password = json['password'];
|
||||
cloudUid = json['cloud_uid'];
|
||||
userId = json['user_id'];
|
||||
updatedAt = json['updated_at'];
|
||||
createdAt = json['created_at'];
|
||||
id = json['id'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['username'] = username;
|
||||
data['password'] = password;
|
||||
data['cloud_uid'] = cloudUid;
|
||||
data['user_id'] = userId;
|
||||
data['updated_at'] = updatedAt;
|
||||
data['created_at'] = createdAt;
|
||||
data['id'] = id;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -4,14 +4,17 @@ import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_addUser.dart';
|
||||
import '../../../../blue/io_reply.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/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
import 'authorizedAdmin_state.dart';
|
||||
|
||||
class AuthorizedAdminLogic extends BaseGetXController {
|
||||
@ -20,9 +23,8 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
// 监听设备返回的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 开门
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 转移权限
|
||||
if (reply is TransferPermissionsReply) {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
@ -77,9 +79,79 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(reply is AddUserReply) {
|
||||
_replyAddUserKey(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _replyAddUserKey(Reply reply) async {
|
||||
var lockId = reply.data.sublist(2, 42);
|
||||
print("lockId:$lockId");
|
||||
|
||||
var token = reply.data.sublist(42, 46);
|
||||
List<String> strTokenList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, strTokenList);
|
||||
print("token:$token");
|
||||
|
||||
int status = reply.data[46];
|
||||
print("status:$status");
|
||||
|
||||
// userNo = reply.data[46];
|
||||
print("status:$status");
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("添加用户数据解析成功");
|
||||
state.isSendSuccess.value = true;
|
||||
Toast.show(msg: "添加成功");
|
||||
// bindBlueAdmin();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
IoSenderManage.senderAddUser(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
openMode:1,
|
||||
keyType:1,
|
||||
startDate:0x11223344,
|
||||
expireDate:0x11223344,
|
||||
role:255,
|
||||
password:"123456",
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: token
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("添加用户权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("领锁失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 转移权限
|
||||
Future<void> transferPermissionsAction() async {
|
||||
BlueManage().judgeReconnect(
|
||||
@ -110,6 +182,87 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
// 添加用户
|
||||
Future<void> addUserConnectBlue(String receiveId) async {
|
||||
// 进来之后首先连接
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connecteState) async {
|
||||
if (connecteState == DeviceConnectionState.connected){
|
||||
// 私钥
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = [0,0,0,0];
|
||||
if(token != null){
|
||||
getTokenList = changeStringListToIntList(token);
|
||||
}
|
||||
|
||||
IoSenderManage.senderAddUser(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
userID:receiveId,
|
||||
openMode:1,
|
||||
keyType:(state.type.value == "1") ? 0 : 1,
|
||||
startDate:state.effectiveDateTime.value.millisecondsSinceEpoch,
|
||||
expireDate:state.failureDateTime.value.millisecondsSinceEpoch,
|
||||
role:0,
|
||||
password:"123456",
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//发送授权管理员列表请求
|
||||
Future<void> sendElectronicKeyRequest() async {
|
||||
String getFailureDateTime = '0';
|
||||
String getEffectiveDateTime = '0';
|
||||
String lockID = state.keyInfo.value.lockId.toString();
|
||||
String getKeyType = (int.parse(state.type.value) + 1).toString();
|
||||
if (state.type.value == '0') {
|
||||
getFailureDateTime = state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime =
|
||||
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
||||
}
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
state.isCreateUser.value ? "1" : "0",
|
||||
state.countryCode.value,
|
||||
'1',
|
||||
getFailureDateTime,
|
||||
state.isAuthentication.value == true ? '1' : '2',
|
||||
'2',
|
||||
'2',
|
||||
state.keyNameController.text,
|
||||
'1',
|
||||
getKeyType,
|
||||
lockID,
|
||||
'',
|
||||
state.emailOrPhoneController.text,
|
||||
'',
|
||||
getEffectiveDateTime,
|
||||
state.weekdaysList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('发送电子钥匙成功');
|
||||
state.isSendSuccess.value = true;
|
||||
Toast.show(msg: "添加成功");
|
||||
// addUserConnectBlue(entity.data!.receiverUser!.id.toString());
|
||||
} else {
|
||||
// Toast.show(msg: '${entity.errorMsg}');
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
state.isCreateUser.value = true;
|
||||
sendElectronicKeyRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -30,56 +30,57 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
final logic = Get.put(AuthorizedAdminLogic());
|
||||
final state = Get.find<AuthorizedAdminLogic>().state;
|
||||
|
||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||
late Contact _contact;
|
||||
late KeyInfos keyInfo;
|
||||
late LockMainEntity lockMainEntity;
|
||||
bool _isAuthentication = false; //是否可以实名认证
|
||||
var _selectEffectiveDate = ''; //生效时间
|
||||
var _selectFailureDate = ''; //失效时间
|
||||
late DateTime _effectiveDateTime;
|
||||
late DateTime _failureDateTime;
|
||||
final TextEditingController _emailOrPhoneController =
|
||||
TextEditingController(); //邮箱/手机号输入框
|
||||
final TextEditingController _keyNameController =
|
||||
TextEditingController(); //钥匙名输入框
|
||||
late bool _isSendSuccess;
|
||||
String countryName = '中国';
|
||||
String countryCode = '86';
|
||||
List weekdaysList = [];
|
||||
bool _isCreateUser = false; //用户未注册时传1 已注册传0
|
||||
// final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||
// late Contact _contact;
|
||||
// late KeyInfos keyInfo;
|
||||
// late LockMainEntity lockMainEntity;
|
||||
// bool _isAuthentication = false; //是否可以实名认证
|
||||
// var _selectEffectiveDate = ''; //生效时间
|
||||
// var _selectFailureDate = ''; //失效时间
|
||||
// late DateTime _effectiveDateTime;
|
||||
// late DateTime _failureDateTime;
|
||||
// final TextEditingController _emailOrPhoneController =
|
||||
// TextEditingController(); //邮箱/手机号输入框
|
||||
// final TextEditingController _keyNameController =
|
||||
// TextEditingController(); //钥匙名输入框
|
||||
// late bool _isSendSuccess;
|
||||
// String countryName = '中国';
|
||||
// String countryCode = '86';
|
||||
// List weekdaysList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
DateTime dateTime = DateTime.now();
|
||||
_effectiveDateTime = dateTime;
|
||||
_failureDateTime = dateTime;
|
||||
_selectEffectiveDate =
|
||||
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||
_selectFailureDate =
|
||||
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||
_isSendSuccess = false;
|
||||
// DateTime dateTime = DateTime.now();
|
||||
// _effectiveDateTime = dateTime;
|
||||
// _failureDateTime = dateTime;
|
||||
// _selectEffectiveDate =
|
||||
// '${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||
// _selectFailureDate =
|
||||
// '${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||
// _isSendSuccess = false;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||
lockMainEntity = obj["lockMainEntity"];
|
||||
}
|
||||
if (obj != null && (obj["keyInfo"] != null)) {
|
||||
keyInfo = obj["keyInfo"];
|
||||
}
|
||||
// dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
// if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||
// lockMainEntity = obj["lockMainEntity"];
|
||||
// }
|
||||
// if (obj != null && (obj["keyInfo"] != null)) {
|
||||
// keyInfo = obj["keyInfo"];
|
||||
// }
|
||||
|
||||
state.type.value = widget.type;
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: indexChangeWidget(),
|
||||
child: Obx(() => indexChangeWidget()),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
if (_isSendSuccess) {
|
||||
if (state.isSendSuccess.value) {
|
||||
return sendElectronicKeySucceed();
|
||||
} else {
|
||||
switch (int.parse(widget.type)) {
|
||||
@ -128,7 +129,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
rightWidget: Text(
|
||||
'$countryName +$countryCode',
|
||||
'${state.countryName.value} +${state.countryCode.value}',
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
@ -137,8 +138,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.seletCountryRegionPage);
|
||||
result as Map<String, dynamic>;
|
||||
countryCode = result['code'];
|
||||
countryName = result['countryName'];
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
@ -159,30 +160,30 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: _selectEffectiveDate,
|
||||
rightTitle: state.selectEffectiveDate.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_selectEffectiveDate =
|
||||
state.selectEffectiveDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
||||
state.effectiveDateTime.value = DateTime.parse(state.selectEffectiveDate.value);
|
||||
});
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: _selectFailureDate,
|
||||
rightTitle: state.selectFailureDate.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_selectFailureDate =
|
||||
state.selectFailureDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
_failureDateTime = DateTime.parse(_selectFailureDate);
|
||||
state.failureDateTime.value = DateTime.parse(state.selectFailureDate.value);
|
||||
});
|
||||
});
|
||||
}),
|
||||
@ -231,9 +232,9 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||
onClick: () {
|
||||
//发送钥匙请求
|
||||
if (_emailOrPhoneController.text.isNotEmpty &&
|
||||
_keyNameController.text.isNotEmpty) {
|
||||
sendElectronicKeyRequest();
|
||||
if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.value.text.isNotEmpty) {
|
||||
// logic.addUserConnectBlue();
|
||||
logic.sendElectronicKeyRequest();
|
||||
}
|
||||
}),
|
||||
Container(
|
||||
@ -301,7 +302,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
onClick: () {
|
||||
_isSendSuccess = false;
|
||||
state.isSendSuccess.value = false;
|
||||
Navigator.pop(context, true);
|
||||
}),
|
||||
SizedBox(
|
||||
@ -336,7 +337,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
||||
Future<void> updateRoomCheckIn() async {
|
||||
var entity = await ApiRepository.to
|
||||
.updateSetting(keyInfo.lockId.toString(), '1', '13');
|
||||
.updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("标记为已入住成功啦啦啦啦啦");
|
||||
Toast.show(msg: "标记成功");
|
||||
@ -358,7 +359,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
controller:
|
||||
lineIndex == 1 ? _emailOrPhoneController : _keyNameController,
|
||||
lineIndex == 1 ? state.emailOrPhoneController : state.keyNameController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
@ -388,9 +389,9 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
alignment: Alignment.center,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
Contact? contact = await _contactPicker.selectContact();
|
||||
Contact? contact = await state.contactPicker.selectContact();
|
||||
setState(() {
|
||||
_contact = contact!;
|
||||
state.contact = contact!;
|
||||
// print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}");
|
||||
});
|
||||
},
|
||||
@ -403,46 +404,46 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
}
|
||||
|
||||
//发送授权管理员列表请求
|
||||
Future<void> sendElectronicKeyRequest() async {
|
||||
String getFailureDateTime = '0';
|
||||
String getEffectiveDateTime = '0';
|
||||
String lockID = keyInfo.lockId.toString();
|
||||
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||
if (widget.type == '0') {
|
||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime =
|
||||
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
||||
}
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
_isCreateUser ? "1" : "0",
|
||||
countryCode,
|
||||
'1',
|
||||
getFailureDateTime,
|
||||
_isAuthentication == true ? '1' : '2',
|
||||
'2',
|
||||
'2',
|
||||
_keyNameController.text,
|
||||
'1',
|
||||
getKeyType,
|
||||
lockID,
|
||||
'',
|
||||
_emailOrPhoneController.text,
|
||||
'',
|
||||
getEffectiveDateTime,
|
||||
weekdaysList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('发送电子钥匙成功');
|
||||
_isSendSuccess = true;
|
||||
setState(() {});
|
||||
} else {
|
||||
Toast.show(msg: '${entity.errorMsg}');
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
_isCreateUser = true;
|
||||
sendElectronicKeyRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Future<void> sendElectronicKeyRequest() async {
|
||||
// String getFailureDateTime = '0';
|
||||
// String getEffectiveDateTime = '0';
|
||||
// String lockID = state.keyInfo.value.lockId.toString();
|
||||
// String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||
// if (widget.type == '0') {
|
||||
// getFailureDateTime = state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||
// getEffectiveDateTime =
|
||||
// state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
||||
// }
|
||||
// var entity = await ApiRepository.to.sendElectronicKey(
|
||||
// state.isCreateUser.value ? "1" : "0",
|
||||
// state.countryCode.value,
|
||||
// '1',
|
||||
// getFailureDateTime,
|
||||
// state.isAuthentication.value == true ? '1' : '2',
|
||||
// '2',
|
||||
// '2',
|
||||
// state.keyNameController.text,
|
||||
// '1',
|
||||
// getKeyType,
|
||||
// lockID,
|
||||
// '',
|
||||
// state.emailOrPhoneController.text,
|
||||
// '',
|
||||
// getEffectiveDateTime,
|
||||
// state.weekdaysList);
|
||||
// if (entity.errorCode!.codeIsSuccessful) {
|
||||
// print('发送电子钥匙成功');
|
||||
// state.isSendSuccess.value = true;
|
||||
// setState(() {});
|
||||
// } else {
|
||||
// Toast.show(msg: '${entity.errorMsg}');
|
||||
// if (entity.errorCode == 425) {
|
||||
// //用户未注册
|
||||
// state.isCreateUser.value = true;
|
||||
// sendElectronicKeyRequest();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//实名认证
|
||||
CupertinoSwitch _switch() {
|
||||
@ -450,10 +451,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: _isAuthentication,
|
||||
value: state.isAuthentication.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_isAuthentication = !_isAuthentication;
|
||||
state.isAuthentication.value = !state.isAuthentication.value;
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
@ -1,4 +1,38 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../lockMian/entity/lockInfoEntity.dart';
|
||||
|
||||
class AuthorizedAdminState {
|
||||
final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框
|
||||
final TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
|
||||
var type = ''.obs;
|
||||
final keyInfo = KeyInfos().obs;
|
||||
final lockMainEntity = LockMainEntity().obs;
|
||||
final isAuthentication = false.obs; //是否可以实名认证
|
||||
DateTime dateTime = DateTime.now();
|
||||
final effectiveDateTime = 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 selectFailureDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
||||
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.obs;
|
||||
var countryCode = '86'.obs;
|
||||
var weekdaysList = [].obs;
|
||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||
|
||||
|
||||
AuthorizedAdminState() {
|
||||
Map map = Get.arguments;
|
||||
lockMainEntity.value = map["lockMainEntity"];
|
||||
keyInfo.value = map["keyInfo"];
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
@ -11,6 +13,16 @@ typedef KeyClickCallback = void Function(List<CheckingInAddStaffKeyEntity> selet
|
||||
class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
CheckingInAddStaffState state = CheckingInAddStaffState();
|
||||
|
||||
// 下级界面修改成功后传递数据
|
||||
StreamSubscription? _getNumberEvent;
|
||||
void _initLoadDataAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getNumberEvent =
|
||||
eventBus.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>().listen((event) {
|
||||
state.getDataPassword.value = event.number;
|
||||
});
|
||||
}
|
||||
|
||||
// 添加员工
|
||||
void addStaffLoadData() async{
|
||||
var attendanceWay = "";
|
||||
@ -51,11 +63,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
break;
|
||||
}
|
||||
|
||||
if(state.staffNameController.text.isEmpty){
|
||||
Toast.show(msg: "请输入姓名");
|
||||
return;
|
||||
}
|
||||
|
||||
var entity = await ApiRepository.to.addStaffData(
|
||||
attendanceType: state.seletPrintingMethodType.value,
|
||||
attendanceWay: attendanceWay,
|
||||
@ -72,11 +79,11 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
}
|
||||
}
|
||||
|
||||
// 考勤设置添加员工-选择钥匙
|
||||
// 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中,attendanceWay分别为用户名、密码、卡号、指纹号
|
||||
void addStaffSeletKey(KeyClickCallback kyClickCallback) async{
|
||||
var entity = await ApiRepository.to.addStaffSeletKeyData(
|
||||
companyId: state.companyId.value,
|
||||
type:"1",
|
||||
type:state.seletPrintingMethodType.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
state.keyEntity.value = entity.data!;
|
||||
@ -124,11 +131,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
break;
|
||||
}
|
||||
|
||||
if(state.staffNameController.text.isEmpty){
|
||||
Toast.show(msg: "请输入姓名");
|
||||
return;
|
||||
}
|
||||
|
||||
var entity = await ApiRepository.to.editStaffData(
|
||||
attendanceType: state.seletPrintingMethodType.value,
|
||||
attendanceWay: attendanceWay,
|
||||
@ -146,12 +148,38 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
}
|
||||
}
|
||||
|
||||
//获取密码请求
|
||||
void getKeyboardPwdRequest() async {
|
||||
if(state.staffNameController.text.isEmpty){
|
||||
Toast.show(msg: "请输入姓名");
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.getPasswordKey(
|
||||
"0",
|
||||
'0',
|
||||
state.staffNameController.text,
|
||||
2.toString(),
|
||||
'0',
|
||||
state.getKeyInfosData.value.lockId.toString(),
|
||||
'0',
|
||||
"0",
|
||||
'0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('获取密码成功');
|
||||
if (entity.data != null) {
|
||||
state.getDataPassword.value = entity.data!.keyboardPwd!;
|
||||
}
|
||||
} else {
|
||||
Toast.show(msg: '${entity.errorMsg}');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
_initLoadDataAction();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -159,13 +187,14 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
_getNumberEvent!.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,6 +8,7 @@ import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/showBottomSheetTool.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../tools/toast.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'checkingInAddStaff_logic.dart';
|
||||
|
||||
@ -49,12 +50,10 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
var list = ["APP", "密码", "卡", "指纹"];
|
||||
_showSeletClockInType(list, "1");
|
||||
})),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.whetherTheEmployeeHasAKey!.tr,
|
||||
SizedBox(height: 10.h,),
|
||||
//员工是否有App、卡、钥匙、指纹必须显示
|
||||
Obx(() => CommonItem(
|
||||
leftTitel:addStaffGetIfHaveKey(),
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
@ -72,9 +71,10 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
});
|
||||
}),
|
||||
],
|
||||
)),
|
||||
))),
|
||||
// 当选择App时显示 其他隐藏
|
||||
Obx(() => Visibility(
|
||||
visible: state.appUnHaveAccount.value,
|
||||
visible: (state.appUnHaveAccount.value && state.seletPrintingMethodType.value == "1") ? true : false,
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
@ -108,10 +108,77 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
],
|
||||
),
|
||||
)),
|
||||
// 当选择密码、卡、指纹时显示
|
||||
Obx(() => Visibility(
|
||||
visible: (state.seletPrintingMethodType.value != "1" && state.appUnHaveAccount.value) ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: addStaffGetKeyType(),
|
||||
isHaveLine: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: Row(
|
||||
children: [
|
||||
Obx(() => Text(state.getDataPassword.value, style: TextStyle(fontSize: 24.sp))),
|
||||
SizedBox(width: 30.w,),
|
||||
SizedBox(
|
||||
width: 130.w,
|
||||
height: 40.h,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: AppColors.mainColor,),
|
||||
child: Text(addStaffSeletKeyType(), style: TextStyle(color: Colors.white, fontSize: 22.sp)),
|
||||
onPressed: () async {
|
||||
switch(int.parse(state.seletPrintingMethodType.value)){
|
||||
case 2:
|
||||
// 获取密码
|
||||
logic.getKeyboardPwdRequest();
|
||||
break;
|
||||
case 3:
|
||||
// 卡
|
||||
if(state.staffNameController.text.isEmpty){
|
||||
Toast.show(msg: "请输入姓名");
|
||||
return;
|
||||
}
|
||||
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyManagePage, arguments: {
|
||||
"lockId": state.getKeyInfosData.value.lockId,
|
||||
"keyType": 0,
|
||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
"fromTypeTwoStaffName" :state.staffNameController.text
|
||||
});
|
||||
if(data != null) {
|
||||
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// 指纹
|
||||
if(state.staffNameController.text.isEmpty){
|
||||
Toast.show(msg: "请输入姓名");
|
||||
return;
|
||||
}
|
||||
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyManagePage, arguments: {
|
||||
"lockId": state.getKeyInfosData.value.lockId,
|
||||
"keyType": 1,
|
||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
"fromTypeTwoStaffName" :state.staffNameController.text
|
||||
});
|
||||
if(data != null) {
|
||||
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
)),
|
||||
// 当选择钥匙类型为有时 必显示
|
||||
Obx(() => Visibility(
|
||||
visible: !state.appUnHaveAccount.value,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.selectKey!.tr,
|
||||
leftTitel: addStaffGetKeyType(),
|
||||
rightTitle: state.seletKey.value,
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
@ -126,15 +193,18 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
|
||||
}),
|
||||
)),
|
||||
SizedBox(
|
||||
height: 50.w,
|
||||
),
|
||||
SizedBox(height: 50.w),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
if(state.staffNameController.text.isEmpty){
|
||||
Toast.show(msg: "请输入姓名");
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.isAdd.value == "2"){
|
||||
logic.editStaffLoadData();
|
||||
}else{
|
||||
@ -191,13 +261,16 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
data: list,
|
||||
//选择事件的回调
|
||||
clickCallBack: (int index, var str) {
|
||||
print("object:$index str:$str");
|
||||
if(type == "1"){
|
||||
state.seletPrintingMethodType.value = (index+1).toString();
|
||||
state.seletPrintingMethodStr.value = str.toString();
|
||||
}else{
|
||||
state.seletKey.value = str.toString();
|
||||
}
|
||||
setState(() {
|
||||
if(type == "1"){
|
||||
state.seletPrintingMethodType.value = (index+1).toString();
|
||||
state.seletPrintingMethodStr.value = str.toString();
|
||||
state.getDataPassword.value = "";
|
||||
}else{
|
||||
state.seletKey.value = str.toString();
|
||||
}
|
||||
print("object:$index str:$str type:$type state.seletPrintingMethodType.value:${state.seletPrintingMethodType.value}");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -224,4 +297,62 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String addStaffGetIfHaveKey(){
|
||||
String title = "";
|
||||
switch(int.parse(state.seletPrintingMethodType.value)){
|
||||
case 1:
|
||||
title = TranslationLoader.lanKeys!.whetherTheEmployeeHasAKey!.tr;
|
||||
break;
|
||||
case 2:
|
||||
title = TranslationLoader.lanKeys!.whetherTheEmployeeHasPassword!.tr;
|
||||
break;
|
||||
case 3:
|
||||
title = TranslationLoader.lanKeys!.whetherTheEmployeeHasCard!.tr;
|
||||
break;
|
||||
case 4:
|
||||
title = TranslationLoader.lanKeys!.whetherTheEmployeeHasFingerprint!.tr;
|
||||
break;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
String addStaffGetKeyType(){
|
||||
String title = "";
|
||||
switch(int.parse(state.seletPrintingMethodType.value)){
|
||||
case 1:
|
||||
title = TranslationLoader.lanKeys!.accountNumber!.tr;
|
||||
break;
|
||||
case 2:
|
||||
title = TranslationLoader.lanKeys!.password!.tr;
|
||||
break;
|
||||
case 3:
|
||||
title = TranslationLoader.lanKeys!.card!.tr;
|
||||
break;
|
||||
case 4:
|
||||
title = TranslationLoader.lanKeys!.fingerprint!.tr;
|
||||
break;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
String addStaffSeletKeyType(){
|
||||
String title = "";
|
||||
switch(int.parse(state.seletPrintingMethodType.value)){
|
||||
case 1:
|
||||
title = TranslationLoader.lanKeys!.getKey!.tr;
|
||||
break;
|
||||
case 2:
|
||||
title = TranslationLoader.lanKeys!.getPassword!.tr;
|
||||
break;
|
||||
case 3:
|
||||
title = TranslationLoader.lanKeys!.getCard!.tr;
|
||||
break;
|
||||
case 4:
|
||||
title = TranslationLoader.lanKeys!.getFingerprint!.tr;
|
||||
break;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ class CheckingInAddStaffState{
|
||||
final seletKey = "".obs;
|
||||
|
||||
final isAdd = "1".obs; // 1添加 2编辑
|
||||
final getDataPassword = "".obs;
|
||||
|
||||
CheckingInAddStaffState() {
|
||||
Map map = Get.arguments;
|
||||
|
||||
@ -86,8 +86,8 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 30.w,),
|
||||
CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
|
||||
// Image.asset('images/controls_user.png', width: 40.w, height: 40.w),
|
||||
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
|
||||
Image.asset('images/controls_user.png', width: 40.w, height: 40.w),
|
||||
SizedBox(width: 30.w,),
|
||||
Text(staffListItem.staffName!, style: TextStyle(fontSize: 24.sp)),
|
||||
],
|
||||
|
||||
@ -82,7 +82,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
String? userId = '';
|
||||
final data = await Storage.getString('userLoginData');
|
||||
if (data != null && data.isNotEmpty) {
|
||||
userId = LoginEntity.fromJson(jsonDecode(data)).data!.userid.toString();
|
||||
userId = LoginData.fromJson(jsonDecode(data)).userid.toString();
|
||||
}
|
||||
|
||||
IoSenderManage.senderOpenLock(
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
class AddFingerprintEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
AddFingerprintEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
AddFingerprintEntity.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 {
|
||||
int? fingerprintId;
|
||||
|
||||
Data({this.fingerprintId});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
fingerprintId = json['fingerprintId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['fingerprintId'] = fingerprintId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,7 @@ import '../../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../../blue/sender_manage.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import '../../../../../tools/baseGetXController.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../../tools/storage.dart';
|
||||
import '../../../../../tools/toast.dart';
|
||||
import 'addFingerprint_state.dart';
|
||||
@ -56,6 +57,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.ifConnectScuess.value = true;
|
||||
state.fingerprintNumber.value = reply.data.last.toString();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
@ -218,7 +220,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Toast.show(msg: "添加成功");
|
||||
updateFingerprintUserNoLoadData("");
|
||||
updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,6 +233,12 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Toast.show(msg: "添加成功");
|
||||
if(state.fromType.value == 2){
|
||||
// 回调指纹号
|
||||
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(fingerprintId));
|
||||
}else if(state.fromType.value == 1){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
Get.close(3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ class AddFingerprintState{
|
||||
final isCoerced = "".obs;
|
||||
final startDate = "".obs;
|
||||
final weekDay = [].obs;
|
||||
final fromType = 1.obs;
|
||||
|
||||
AddFingerprintState() {
|
||||
Map map = Get.arguments;
|
||||
@ -26,5 +27,6 @@ class AddFingerprintState{
|
||||
startDate.value = map["startDate"];
|
||||
lockId.value = map["lockId"];
|
||||
weekDay.value = map["weekDay"];
|
||||
fromType.value = map["fromType"];
|
||||
}
|
||||
}
|
||||
@ -80,6 +80,7 @@ class _AddFingerprintTipPageState extends State<AddFingerprintTipPage> {
|
||||
"isCoerced": state.isCoerced.value,
|
||||
"startDate": state.startDate.value,
|
||||
"weekDay": state.weekDay.value,
|
||||
"fromType": state.fromType.value,
|
||||
});
|
||||
}),
|
||||
),
|
||||
|
||||
@ -11,6 +11,7 @@ class AddFingerprintTipState{
|
||||
final isCoerced = "".obs;
|
||||
final startDate = "".obs;
|
||||
final weekDay = [].obs;
|
||||
final fromType = 1.obs;
|
||||
|
||||
AddFingerprintTipState() {
|
||||
Map map = Get.arguments;
|
||||
@ -24,5 +25,6 @@ class AddFingerprintTipState{
|
||||
startDate.value = map["startDate"];
|
||||
lockId.value = map["lockId"];
|
||||
weekDay.value = map["weekDay"];
|
||||
fromType.value = map["fromType"];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
class AddICCardEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
AddICCardEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
AddICCardEntity.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 {
|
||||
int? cardId;
|
||||
|
||||
Data({this.cardId});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
cardId = json['cardId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['cardId'] = cardId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,7 @@ import '../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
import 'addICCard_state.dart';
|
||||
@ -44,12 +45,13 @@ class AddICCardLogic extends BaseGetXController{
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
print("_replyAddFingerprintStatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.cardNumber.value = reply.data.last.toString();
|
||||
state.ifConnectScuess.value = true;
|
||||
break;
|
||||
case 0x06:
|
||||
@ -95,11 +97,11 @@ class AddICCardLogic extends BaseGetXController{
|
||||
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyAddFingerprintReplyToken:$token");
|
||||
print("_replyAddICCardConfirmationReplyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
print("_replyAddFingerprintstatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -174,7 +176,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: "添加成功");
|
||||
updateIdCardUserNoLoadData("0");
|
||||
updateIdCardUserNoLoadData(entity.data!.cardId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +188,13 @@ class AddICCardLogic extends BaseGetXController{
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Toast.show(msg: "添加成功");
|
||||
Get.close(3);
|
||||
if(state.fromType.value == 2){
|
||||
// 回调指纹号
|
||||
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(cardId));
|
||||
}else if(state.fromType.value == 1){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
Get.close(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,9 @@ class _AddICCardPageState extends State<AddICCardPage> {
|
||||
color: AppColors.blackColor,
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
),
|
||||
child: Center(child: Text("尝试连接设备...", style:TextStyle(color: Colors.white, fontSize: 24.sp))),
|
||||
child: Center(
|
||||
child: Obx(() => Text(state.ifConnectScuess.value ? "已连接到锁,请将卡靠近锁的读卡区" : "尝试连接设备...", style:TextStyle(color: Colors.white, fontSize: 24.sp)))
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -13,6 +13,7 @@ class AddICCardState{
|
||||
final isCoerced = "".obs;
|
||||
final startDate = "".obs;
|
||||
final weekDay = [].obs;
|
||||
final fromType = 0.obs;
|
||||
|
||||
AddICCardState() {
|
||||
Map map = Get.arguments;
|
||||
@ -26,5 +27,6 @@ class AddICCardState{
|
||||
startDate.value = map["startDate"];
|
||||
lockId.value = map["lockId"];
|
||||
weekDay.value = map["weekDay"];
|
||||
fromType.value = map["fromType"];
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
|
||||
switch (state.fromType.value) {
|
||||
switch (state.lockType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
Get.toNamed(Routers.addICCardPage, arguments: {
|
||||
@ -86,6 +86,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController {
|
||||
"isCoerced": state.isStressFingerprint.value ? "1" : "2",
|
||||
"startDate": startDate,
|
||||
"weekDay": state.weekdaysList.value,
|
||||
"fromType": state.fromType.value,
|
||||
});
|
||||
|
||||
// var entity = await ApiRepository.to.addICCardData(
|
||||
@ -117,6 +118,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController {
|
||||
"isCoerced": state.isStressFingerprint.value ? "1" : "2",
|
||||
"startDate": startDate,
|
||||
"weekDay": state.weekdaysList.value,
|
||||
"fromType": state.fromType.value,
|
||||
});
|
||||
|
||||
// var entity = await ApiRepository.to.addFingerprintsData(
|
||||
|
||||
@ -18,8 +18,10 @@ class OtherTypeAddKeyPage extends StatefulWidget {
|
||||
final String seletType;
|
||||
final int lockType; // 0卡 1指纹 2钥匙
|
||||
final int lockId;
|
||||
final int fromType;// // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
final String fromTypeTwoStaffName;// 从添加员工进入 传入员工名字
|
||||
const OtherTypeAddKeyPage(
|
||||
{Key? key, required this.seletType, required this.lockType, required this.lockId}) : super(key: key);
|
||||
{Key? key, required this.seletType, required this.lockType, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<OtherTypeAddKeyPage> createState() => _OtherTypeAddKeyPageState();
|
||||
@ -32,8 +34,9 @@ class _OtherTypeAddKeyPageState extends State<OtherTypeAddKeyPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.seletType.value = widget.seletType;
|
||||
state.fromType.value = widget.lockType;
|
||||
state.lockType.value = widget.lockType;
|
||||
state.lockId.value = widget.lockId;
|
||||
state.nameController.text = widget.fromTypeTwoStaffName;
|
||||
|
||||
return indexChangeWidget();
|
||||
}
|
||||
|
||||
@ -6,7 +6,8 @@ import 'package:get/get.dart';
|
||||
class OtherTypeAddKeyState{
|
||||
final lockId = 0.obs;
|
||||
final seletType = "0".obs;// 0永久 1显示 2循环
|
||||
final fromType = 0.obs;// 0卡 1指纹 2钥匙
|
||||
final lockType = 0.obs;// 0卡 1指纹 2钥匙
|
||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
final isStressFingerprint = false.obs;
|
||||
|
||||
var beginTime = "".obs;// 开始时间
|
||||
@ -20,8 +21,8 @@ class OtherTypeAddKeyState{
|
||||
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
OtherTypeAddKeyState() {
|
||||
Map map = Get.arguments;
|
||||
lockId.value = map["lockId"];
|
||||
fromType.value = map["fromType"];
|
||||
// Map map = Get.arguments;
|
||||
// lockId.value = map["lockId"];
|
||||
// fromType.value = map["fromType"];
|
||||
}
|
||||
}
|
||||
@ -251,95 +251,95 @@ class _OtherTypeKeyDetailPageState extends State<OtherTypeKeyDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget addControlsBtn(int type) {
|
||||
List<Widget> widgetList = [];
|
||||
List<Map<String, dynamic>> routerList = [];
|
||||
//卡详情
|
||||
if (type == 0) {
|
||||
routerList.add({
|
||||
'btnTitle': '设置密码',
|
||||
'routerName': Routers.passwordKeyDetailPage,
|
||||
'type': 9
|
||||
});
|
||||
routerList.add({
|
||||
'btnTitle': '设置指纹',
|
||||
'routerName': Routers.otherTypeKeyManagePage,
|
||||
'type': 1
|
||||
});
|
||||
routerList.add({
|
||||
'btnTitle': '设置遥控',
|
||||
'routerName': Routers.otherTypeKeyManagePage,
|
||||
'type': 2
|
||||
});
|
||||
} else if (type == 1) {
|
||||
//指纹详情
|
||||
routerList.add({
|
||||
'btnTitle': '设置密码',
|
||||
'routerName': Routers.passwordKeyDetailPage,
|
||||
'type': 9
|
||||
});
|
||||
routerList.add({
|
||||
'btnTitle': '设置卡',
|
||||
'routerName': Routers.otherTypeKeyManagePage,
|
||||
'type': 0
|
||||
});
|
||||
routerList.add({
|
||||
'btnTitle': '设置遥控',
|
||||
'routerName': Routers.otherTypeKeyManagePage,
|
||||
'type': 2
|
||||
});
|
||||
} else if (type == 2) {
|
||||
//遥控详情
|
||||
routerList.add({
|
||||
'btnTitle': '设置密码',
|
||||
'routerName': Routers.passwordKeyDetailPage,
|
||||
'type': 9
|
||||
});
|
||||
routerList.add({
|
||||
'btnTitle': '设置卡',
|
||||
'routerName': Routers.otherTypeKeyManagePage,
|
||||
'type': 0
|
||||
});
|
||||
routerList.add({
|
||||
'btnTitle': '设置指纹',
|
||||
'routerName': Routers.otherTypeKeyManagePage,
|
||||
'type': 1
|
||||
});
|
||||
}
|
||||
|
||||
for (int i = 0; i < routerList.length; i++) {
|
||||
widgetList.add(SizedBox(
|
||||
width: ScreenUtil().screenWidth - 40.w,
|
||||
height: 60.h,
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
// backgroundColor: Colors.white,
|
||||
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||
onPressed: () {
|
||||
if (routerList[i]['type'] == 9) {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyManagePage);
|
||||
} else {
|
||||
Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
||||
arguments: routerList[i]['type']);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
routerList[i]['btnTitle'],
|
||||
style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
||||
)),
|
||||
));
|
||||
|
||||
widgetList.add(
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: widgetList,
|
||||
);
|
||||
}
|
||||
// Widget addControlsBtn(int type) {
|
||||
// List<Widget> widgetList = [];
|
||||
// List<Map<String, dynamic>> routerList = [];
|
||||
// //卡详情
|
||||
// if (type == 0) {
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置密码',
|
||||
// 'routerName': Routers.passwordKeyDetailPage,
|
||||
// 'type': 9
|
||||
// });
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置指纹',
|
||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||
// 'type': 1
|
||||
// });
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置遥控',
|
||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||
// 'type': 2
|
||||
// });
|
||||
// } else if (type == 1) {
|
||||
// //指纹详情
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置密码',
|
||||
// 'routerName': Routers.passwordKeyDetailPage,
|
||||
// 'type': 9
|
||||
// });
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置卡',
|
||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||
// 'type': 0
|
||||
// });
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置遥控',
|
||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||
// 'type': 2
|
||||
// });
|
||||
// } else if (type == 2) {
|
||||
// //遥控详情
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置密码',
|
||||
// 'routerName': Routers.passwordKeyDetailPage,
|
||||
// 'type': 9
|
||||
// });
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置卡',
|
||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||
// 'type': 0
|
||||
// });
|
||||
// routerList.add({
|
||||
// 'btnTitle': '设置指纹',
|
||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||
// 'type': 1
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < routerList.length; i++) {
|
||||
// widgetList.add(SizedBox(
|
||||
// width: ScreenUtil().screenWidth - 40.w,
|
||||
// height: 60.h,
|
||||
// child: OutlinedButton(
|
||||
// style: OutlinedButton.styleFrom(
|
||||
// // backgroundColor: Colors.white,
|
||||
// side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||
// onPressed: () {
|
||||
// if (routerList[i]['type'] == 9) {
|
||||
// Navigator.pushNamed(context, Routers.passwordKeyManagePage);
|
||||
// } else {
|
||||
// Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
||||
// arguments: routerList[i]['type']);
|
||||
// }
|
||||
// },
|
||||
// child: Text(
|
||||
// routerList[i]['btnTitle'],
|
||||
// style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
||||
// )),
|
||||
// ));
|
||||
//
|
||||
// widgetList.add(
|
||||
// SizedBox(
|
||||
// height: 10.h,
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// return Column(
|
||||
// children: widgetList,
|
||||
// );
|
||||
// }
|
||||
|
||||
String getAppBarTitle(int type) {
|
||||
String title = "";
|
||||
|
||||
@ -321,7 +321,22 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
late StreamSubscription _teamEvent;
|
||||
void _initRefreshAction() {
|
||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((event) {
|
||||
getFingerprintsListData();
|
||||
switch (state.fromType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
getICCardListData();
|
||||
break;
|
||||
case 1:
|
||||
// 指纹
|
||||
getFingerprintsListData();
|
||||
break;
|
||||
case 2:
|
||||
// 遥控
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -70,7 +70,8 @@ class _OtherTypeKeyListPageState extends State<OtherTypeKeyListPage> {
|
||||
onClick: () async {
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyManagePage, arguments: {
|
||||
"lockId": state.lockId.value,
|
||||
"fromType": state.fromType.value
|
||||
"keyType": state.fromType.value,
|
||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
});
|
||||
if(data != null) {
|
||||
switch (state.fromType.value) {
|
||||
|
||||
@ -22,18 +22,23 @@ class _OtherTypeKeyManagePageState extends State<OtherTypeKeyManagePage> {
|
||||
// 0卡 1指纹 2钥匙
|
||||
Map map = Get.arguments;
|
||||
var lockId = map["lockId"];
|
||||
var lockType = map["fromType"];
|
||||
var lockKeyType = map["keyType"];
|
||||
var fromType = map["fromType"]; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "";
|
||||
if(fromType == 2){
|
||||
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${getAppBarTitle(lockType)}",
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${getAppBarTitle(lockKeyType)}",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
OtherTypeKeyManageTabbar(initialIndex: index, lockType: lockType, lockId: lockId),
|
||||
OtherTypeKeyManageTabbar(initialIndex: index, lockType: lockKeyType, lockId: lockId, fromType: fromType, fromTypeTwoStaffName:fromTypeTwoStaffName),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -11,8 +11,10 @@ class OtherTypeKeyManageTabbar extends StatefulWidget {
|
||||
var initialIndex = 1;
|
||||
var lockType = 0;
|
||||
var lockId = 0;
|
||||
var fromType = 0; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "";// 从添加员工进入 传入员工名字
|
||||
OtherTypeKeyManageTabbar(
|
||||
{Key? key, required this.initialIndex, required this.lockType, required this.lockId})
|
||||
{Key? key, required this.initialIndex, required this.lockType, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@ -91,6 +93,8 @@ class _OtherTypeKeyManageTabbarState extends State<OtherTypeKeyManageTabbar>
|
||||
seletType: item.seletType,
|
||||
lockType: widget.lockType,
|
||||
lockId: widget.lockId,
|
||||
fromType: widget.fromType,
|
||||
fromTypeTwoStaffName:widget.fromTypeTwoStaffName
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
|
||||
@ -3,17 +3,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/entity/userSettingInfoEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
import '../../tools/commonItem.dart';
|
||||
import '../../tools/submitBtn.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/commonItem.dart';
|
||||
import '../../../tools/submitBtn.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import 'entity/userSettingInfoEntity.dart';
|
||||
|
||||
class MineSetPage extends StatefulWidget {
|
||||
const MineSetPage({Key? key}) : super(key: key);
|
||||
@ -0,0 +1,111 @@
|
||||
class GetewayDataEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
GetewayListData? data;
|
||||
|
||||
GetewayDataEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
GetewayDataEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? GetewayListData.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 GetewayListData {
|
||||
List<GetewayItemData>? list;
|
||||
int? pageNo;
|
||||
int? pageSize;
|
||||
int? pages;
|
||||
int? total;
|
||||
|
||||
GetewayListData({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
||||
|
||||
GetewayListData.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] != null) {
|
||||
list = <GetewayItemData>[];
|
||||
json['list'].forEach((v) {
|
||||
list!.add(GetewayItemData.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 (list != null) {
|
||||
data['list'] = list!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['pageNo'] = pageNo;
|
||||
data['pageSize'] = pageSize;
|
||||
data['pages'] = pages;
|
||||
data['total'] = total;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GetewayItemData {
|
||||
String? serialNumber;
|
||||
int? plugId;
|
||||
String? plugName;
|
||||
String? networkName;
|
||||
int? lockNum;
|
||||
String? plugMac;
|
||||
String? networkMac;
|
||||
int? isOnline;
|
||||
String? plugVersion;
|
||||
int? selet = 0;
|
||||
GetewayItemData(
|
||||
{this.serialNumber,
|
||||
this.plugId,
|
||||
this.plugName,
|
||||
this.networkName,
|
||||
this.lockNum,
|
||||
this.plugMac,
|
||||
this.networkMac,
|
||||
this.isOnline,
|
||||
this.plugVersion});
|
||||
|
||||
GetewayItemData.fromJson(Map<String, dynamic> json) {
|
||||
serialNumber = json['serialNumber'];
|
||||
plugId = json['plugId'];
|
||||
plugName = json['plugName'];
|
||||
networkName = json['networkName'];
|
||||
lockNum = json['lockNum'];
|
||||
plugMac = json['plugMac'];
|
||||
networkMac = json['networkMac'];
|
||||
isOnline = json['isOnline'];
|
||||
plugVersion = json['plugVersion'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['serialNumber'] = serialNumber;
|
||||
data['plugId'] = plugId;
|
||||
data['plugName'] = plugName;
|
||||
data['networkName'] = networkName;
|
||||
data['lockNum'] = lockNum;
|
||||
data['plugMac'] = plugMac;
|
||||
data['networkMac'] = networkMac;
|
||||
data['isOnline'] = isOnline;
|
||||
data['plugVersion'] = plugVersion;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../network/api_repository.dart';
|
||||
import 'selectGetewayList_state.dart';
|
||||
|
||||
class SelectGetewayListLogic extends BaseGetXController{
|
||||
SelectGetewayListState state = SelectGetewayListState();
|
||||
|
||||
// 获取锁列表
|
||||
Future<void> getGetewayListData() async{
|
||||
var entity = await ApiRepository.to.getGatewayListData(
|
||||
pageNo: '1',
|
||||
pageSize: '20'
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
state.getewayListData.value = entity.data!.list!;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
getGetewayListData();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,6 +6,10 @@ import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import '../../../tools/noData.dart';
|
||||
import '../../../tools/toast.dart';
|
||||
import 'selectGetewayList_entity.dart';
|
||||
import 'selectGetewayList_logic.dart';
|
||||
|
||||
class SelectGetewayListPage extends StatefulWidget {
|
||||
const SelectGetewayListPage({Key? key}) : super(key: key);
|
||||
@ -15,6 +19,9 @@ class SelectGetewayListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
||||
final logic = Get.put(SelectGetewayListLogic());
|
||||
final state = Get.find<SelectGetewayListLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -25,7 +32,19 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
for (var element in state.getewayListData.value) {
|
||||
if(state.isSeletAll == true){
|
||||
state.isSeletAll = false;
|
||||
element.selet = 0;
|
||||
}else{
|
||||
state.isSeletAll = true;
|
||||
element.selet = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
'全选',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
@ -48,8 +67,8 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return ListView.separated(
|
||||
itemCount: 10,
|
||||
return Obx(() => state.getewayListData.value.isNotEmpty ? ListView.separated(
|
||||
itemCount: state.getewayListData.value.length,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(
|
||||
height: 1,
|
||||
@ -59,16 +78,22 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
||||
);
|
||||
},
|
||||
itemBuilder: (c, index) {
|
||||
return _electronicKeyItem('images/icon_lock.png', "张三",
|
||||
"2023.6.21 11.15", "2023.6.21 11.15", () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminDetailPage);
|
||||
GetewayItemData getewayItemData = state.getewayListData.value[index];
|
||||
return _electronicKeyItem(getewayItemData, () {
|
||||
setState(() {
|
||||
if(getewayItemData.selet == 1){
|
||||
getewayItemData.selet = 0;
|
||||
}else{
|
||||
getewayItemData.selet = 1;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}):const NoData());
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle,
|
||||
String beginTime, String endTime, Function() action) {
|
||||
Widget _electronicKeyItem(GetewayItemData getewayItemData, Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 80.h,
|
||||
@ -81,9 +106,9 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
||||
),
|
||||
GestureDetector(
|
||||
child: Image.asset(
|
||||
'images/icon_round_unSelet.png',
|
||||
width: 16,
|
||||
height: 16,
|
||||
(getewayItemData.selet == 1) ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
@ -98,26 +123,40 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
||||
SizedBox(
|
||||
width: 16.w,
|
||||
),
|
||||
Text(
|
||||
'星锁网关',
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
)
|
||||
Text(getewayItemData.plugName!, style: TextStyle(fontSize: 24.sp),)
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNextBtn() {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: AppColors.btnDisableColor,
|
||||
color: AppColors.mainColor,
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 64.h,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, Routers.recipientInformationPage);
|
||||
onPressed: () async {
|
||||
bool isCanNext = false;
|
||||
var idList = [];
|
||||
for (var element in state.getewayListData.value) {
|
||||
if(element.selet == 1){
|
||||
isCanNext = true;
|
||||
idList.add(element.plugId);
|
||||
}
|
||||
}
|
||||
if(isCanNext == false){
|
||||
Toast.show(msg: "请选择锁");
|
||||
return;
|
||||
}
|
||||
var data = await Get.toNamed(Routers.recipientInformationPage, arguments: {
|
||||
"idList":idList,
|
||||
"isFromType":2,
|
||||
});
|
||||
if(data != null) {
|
||||
logic.getGetewayListData();
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'下一步',
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'selectGetewayList_entity.dart';
|
||||
|
||||
class SelectGetewayListState{
|
||||
var getewayListData = <GetewayItemData>[].obs;
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
bool isSeletAll = false;
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
class RecipientInformationEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
RecipientInformationData? data;
|
||||
|
||||
RecipientInformationEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
RecipientInformationEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? RecipientInformationData.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 RecipientInformationData {
|
||||
String? uid;
|
||||
String? nickname;
|
||||
String? headUrl;
|
||||
String? userid;
|
||||
|
||||
RecipientInformationData({this.uid, this.nickname, this.headUrl, this.userid});
|
||||
|
||||
RecipientInformationData.fromJson(Map<String, dynamic> json) {
|
||||
uid = json['uid'];
|
||||
nickname = json['nickname'];
|
||||
headUrl = json['headUrl'];
|
||||
userid = json['userid'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['uid'] = uid;
|
||||
data['nickname'] = nickname;
|
||||
data['headUrl'] = headUrl;
|
||||
data['userid'] = userid;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
import 'recipientInformation_entity.dart';
|
||||
import 'recipientInformation_state.dart';
|
||||
|
||||
|
||||
class RecipientInformationLogic extends BaseGetXController{
|
||||
RecipientInformationState state = RecipientInformationState();
|
||||
|
||||
// 转移智能锁确认
|
||||
Future<void> transferLockConfirmInfoData(void Function(RecipientInformationData recipientInformationData) action) async{
|
||||
var entity = await ApiRepository.to.transferLockConfirmInfoData(
|
||||
receiverUserid: state.numberController.text,
|
||||
type: state.type.value.toString(),
|
||||
countryCode: state.countryCode.value
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
action(entity.data!);
|
||||
}
|
||||
}
|
||||
|
||||
// 转移智能锁
|
||||
Future<void> transferLockInfoData() async{
|
||||
var entity = await ApiRepository.to.transferLockInfoData(
|
||||
receiverUserid: state.numberController.text,
|
||||
lockIdList: state.idList.value,
|
||||
countryCode: state.countryCode.value
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Get.back(result: "scuess");
|
||||
}
|
||||
}
|
||||
|
||||
// 转移网关确认
|
||||
Future<void> transferGateWayConfirmInfoData(void Function(RecipientInformationData recipientInformationData) action) async{
|
||||
var entity = await ApiRepository.to.transferGatewayConfirmInfoData(
|
||||
receiverUserid: state.numberController.text,
|
||||
type: state.type.value.toString(),
|
||||
countryCode: state.countryCode.value
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
action(entity.data!);
|
||||
}
|
||||
}
|
||||
|
||||
// 转移网关
|
||||
Future<void> transferGatewayInfoData() async{
|
||||
var entity = await ApiRepository.to.transferGatewayInfoData(
|
||||
receiverUserid: state.numberController.text,
|
||||
plugIdList: state.idList.value,
|
||||
countryCode: state.countryCode.value
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Get.back(result: "scuess");
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,327 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart';
|
||||
import 'package:star_lock/tools/submitBtn.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import 'recipientInformation_entity.dart';
|
||||
|
||||
class RecipientInformationPage extends StatefulWidget {
|
||||
const RecipientInformationPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<RecipientInformationPage> createState() =>
|
||||
_RecipientInformationPageState();
|
||||
}
|
||||
|
||||
class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
||||
final logic = Get.put(RecipientInformationLogic());
|
||||
final state = Get.find<RecipientInformationLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.recipientInformation!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(height: 150.h, child: _buildMainUI()),
|
||||
SizedBox(height: 10.h),
|
||||
_buildAccoutRow(),
|
||||
_buildBottomText(),
|
||||
_buildNextBtn(context),
|
||||
SizedBox(height: 64.h),
|
||||
Visibility(
|
||||
visible: state.isFromType.value == 2 ? true : false,
|
||||
child: _buildRemoveBadLockBtn()),
|
||||
SizedBox(height: 64.h,)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return Obx(() => Column(
|
||||
children: [
|
||||
_electronicKeyItem(state.type.value == 1 ? 'images/select_circle.png' : 'images/normal_circle.png', "个人用户", () {
|
||||
setState(() {
|
||||
state.type.value = 1;
|
||||
});
|
||||
}),
|
||||
_electronicKeyItem(state.type.value == 2 ? 'images/select_circle.png' : 'images/normal_circle.png', "星寓", () {
|
||||
setState(() {
|
||||
state.type.value = 2;
|
||||
});
|
||||
})
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(
|
||||
String leftIcon, String leftTitle, Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 70.h,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
GestureDetector(
|
||||
child: Image.asset(
|
||||
leftIcon,
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.w,
|
||||
),
|
||||
Text(
|
||||
leftTitle,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAccoutRow() {
|
||||
return Container(
|
||||
// height: 60.h,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(width: 40.w,),
|
||||
Text('账号', style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: state.numberController,
|
||||
textAlign: TextAlign.right,
|
||||
keyboardType: TextInputType.text,
|
||||
onChanged: (value) {},
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
hintText: state.type.value == 1 ? "请输入手机号或email" : "请输入星寓管理员的账号",
|
||||
hintStyle: TextStyle(
|
||||
color: AppColors.placeholderTextColor,
|
||||
fontSize: ScreenUtil().setSp(22),
|
||||
textBaseline: TextBaseline.alphabetic),
|
||||
),
|
||||
)),
|
||||
SizedBox(width: 20.w,),
|
||||
Image.asset('images/icon_addressBook.png', width: 28.w, height: 28.h,),
|
||||
SizedBox(width: 40.w,)
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: AppColors.greyLineColor,
|
||||
indent: 20.w,
|
||||
endIndent: 20.w,
|
||||
height: 1,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
rightWidget: Text(
|
||||
'${state.countryName.value} +${state.countryCode.value}',
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.seletCountryRegionPage);
|
||||
result as Map<String, dynamic>;
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomText() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 20.h, bottom: 80.h),
|
||||
child: Text(
|
||||
'选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权',
|
||||
style:
|
||||
TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNextBtn(BuildContext context) {
|
||||
return SubmitBtn(btnName: '下一步', onClick: () {
|
||||
if(state.numberController.text.isEmpty){
|
||||
Toast.show(msg: "请输入手机号或email");
|
||||
return;
|
||||
}
|
||||
if(state.isFromType.value == 1){
|
||||
// 转移智能锁
|
||||
if(state.type.value == 1){
|
||||
logic.transferLockConfirmInfoData((v){
|
||||
showCupertinoAlertDialog(context, v);
|
||||
});
|
||||
}else{
|
||||
Get.toNamed(Routers.selectBranchPage, arguments: {
|
||||
"idList":state.idList.value,
|
||||
"countryCode":state.countryCode.value,
|
||||
"number":state.numberController.text,
|
||||
"isFromType":state.isFromType.value,
|
||||
});
|
||||
}
|
||||
}else{
|
||||
// 转移网关
|
||||
if(state.type.value == 1){
|
||||
logic.transferGateWayConfirmInfoData((v){
|
||||
showCupertinoAlertDialog(context, v);
|
||||
});
|
||||
}else{
|
||||
Get.toNamed(Routers.selectBranchPage, arguments: {
|
||||
"idList":state.idList.value,
|
||||
"countryCode":state.countryCode.value,
|
||||
"number":state.numberController.text,
|
||||
"isFromType":state.isFromType.value
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildRemoveBadLockBtn() {
|
||||
return Row(
|
||||
children: [
|
||||
const Expanded(child: SizedBox()),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
},
|
||||
child: Text('移除坏锁', style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), textAlign: TextAlign.end,)),
|
||||
SizedBox(width: 10.h,)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 点击确认
|
||||
void showCupertinoAlertDialog(BuildContext context, RecipientInformationData recipientInformationData) {
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
barrierColor: Colors.black.withOpacity(.5),
|
||||
barrierDismissible: true,
|
||||
barrierLabel: '',
|
||||
transitionDuration: const Duration(milliseconds: 200),
|
||||
transitionBuilder: (BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child) {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
},
|
||||
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
|
||||
// recipientInformationData.nickname = "张三张三张三";
|
||||
return Center(
|
||||
child: Container(
|
||||
width: 400.w,
|
||||
height: 370.h,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 20.h),
|
||||
Text("转移确认", style: TextStyle(fontSize: 24.sp)),
|
||||
SizedBox(height: 20.h),
|
||||
Image.asset('images/icon_lockGroup_item.png', width: 70.h, height: 70.h, fit: BoxFit.fill),
|
||||
SizedBox(height: 15.h),
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: <Widget>[
|
||||
Text(recipientInformationData.nickname!, style: TextStyle(fontSize: 22.sp)),
|
||||
Positioned(
|
||||
left: (recipientInformationData.nickname!.length*19.w).w,
|
||||
child: Container(
|
||||
width: 80.w,
|
||||
color: Colors.red,
|
||||
child: Center(child: Text(state.type.value == 1 ? "个人用户" : "星寓", style: TextStyle(fontSize: 18.sp, color: Colors.white))),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.h),
|
||||
Text(recipientInformationData.userid!, style: TextStyle(fontSize: 22.sp)),
|
||||
SizedBox(height: 8.h),
|
||||
Text("本次共转移${state.idList.value.length}把智能锁", style: TextStyle(fontSize: 20.sp)),
|
||||
SizedBox(height: 20.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
onPrimary: AppColors.appBarIconColor,
|
||||
backgroundColor: Colors.grey,
|
||||
minimumSize: Size(110.w, 45.h),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
),
|
||||
),
|
||||
child: Text('取消', style: TextStyle(fontSize: 22.sp)),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
if(state.isFromType.value == 1){
|
||||
// 转移智能锁 transferGatewayInfoData
|
||||
logic.transferLockInfoData();
|
||||
}else{
|
||||
// 转移网关
|
||||
logic.transferGatewayInfoData();
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
onPrimary: AppColors.appBarIconColor,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
minimumSize: Size(110.w, 45.h),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
),
|
||||
),
|
||||
child: Text('确认', style: TextStyle(fontSize: 22.sp)),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class RecipientInformationState{
|
||||
var type = 1.obs;// 1、个人用户 2、星寓用户
|
||||
final TextEditingController numberController = TextEditingController();
|
||||
|
||||
final countryName = "中国".obs;
|
||||
final countryCode = "86".obs;
|
||||
final isFromType = 1.obs; // 1从转移智能锁过来 2 转移网关
|
||||
final idList = [].obs;
|
||||
RecipientInformationState() {
|
||||
Map map = Get.arguments;
|
||||
idList.value = map["idList"];
|
||||
isFromType.value = map["isFromType"];
|
||||
}
|
||||
}
|
||||
@ -1,185 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/submitBtn.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
|
||||
class RecipientInformationPage extends StatefulWidget {
|
||||
const RecipientInformationPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<RecipientInformationPage> createState() =>
|
||||
_RecipientInformationPageState();
|
||||
}
|
||||
|
||||
class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.recipientInformation!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(height: 150.h, child: _buildMainUI()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
_buildAccoutRow(),
|
||||
_buildBottomText(),
|
||||
_buildNextBtn(),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 64.h,
|
||||
)),
|
||||
_buildRemoveBadLockBtn(),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return ListView.separated(
|
||||
itemCount: 2,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(
|
||||
height: 1,
|
||||
indent: 20.w,
|
||||
endIndent: 20.w,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
itemBuilder: (c, index) {
|
||||
if (index == 0) {
|
||||
return _electronicKeyItem(
|
||||
'images/select_circle.png', "个人用户", () {});
|
||||
} else {
|
||||
return _electronicKeyItem(
|
||||
'images/normal_circle.png', "好房管家", () {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(
|
||||
String leftIcon, String leftTitle, Function() action) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 70.h,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
GestureDetector(
|
||||
child: Image.asset(
|
||||
leftIcon,
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.w,
|
||||
),
|
||||
Text(
|
||||
leftTitle,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAccoutRow() {
|
||||
return Container(
|
||||
height: 60.h,
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
Text(
|
||||
'账号',
|
||||
style:
|
||||
TextStyle(color: AppColors.darkGrayTextColor, fontSize: 22.sp),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
textAlign: TextAlign.right,
|
||||
keyboardType: TextInputType.text,
|
||||
onChanged: (value) {},
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
hintText: '请输入手机号或email',
|
||||
hintStyle: TextStyle(
|
||||
color: AppColors.placeholderTextColor,
|
||||
fontSize: ScreenUtil().setSp(22),
|
||||
textBaseline: TextBaseline.alphabetic),
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/icon_addressBook.png',
|
||||
width: 28.w,
|
||||
height: 28.h,
|
||||
),
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomText() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 20.h, bottom: 80.h),
|
||||
child: Text(
|
||||
'选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权',
|
||||
style:
|
||||
TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNextBtn() {
|
||||
return SubmitBtn(btnName: '下一步', onClick: () {});
|
||||
}
|
||||
|
||||
Widget _buildRemoveBadLockBtn() {
|
||||
return Row(
|
||||
children: [
|
||||
const Expanded(child: SizedBox()),
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
'移除坏锁',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
textAlign: TextAlign.end,
|
||||
)),
|
||||
SizedBox(
|
||||
width: 10.h,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'selectBranch_state.dart';
|
||||
|
||||
class SelectBranchLogic extends BaseGetXController{
|
||||
SelectBranchState state = SelectBranchState();
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,230 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../recipientInformation/recipientInformation_entity.dart';
|
||||
import 'selectBranch_logic.dart';
|
||||
|
||||
class SelectBranchPage extends StatefulWidget {
|
||||
const SelectBranchPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SelectBranchPage> createState() => _SelectBranchPageState();
|
||||
}
|
||||
|
||||
class _SelectBranchPageState extends State<SelectBranchPage> {
|
||||
final logic = Get.put(SelectBranchLogic());
|
||||
final state = Get.find<SelectBranchLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.recipientInformation!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_buildTopView(),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(child: _buildMainUI()),
|
||||
_buildNextBtn(),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTopView() {
|
||||
return Container(
|
||||
height: 120.h,
|
||||
width: ScreenUtil().screenWidth,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 40.w, top: 20.h, bottom: 16.h),
|
||||
child: Text(
|
||||
'公寓',
|
||||
style: TextStyle(fontSize: 28.sp),
|
||||
),
|
||||
),
|
||||
Obx(() => Padding(
|
||||
padding: EdgeInsets.only(left: 40.w),
|
||||
child: Text('管理员:${state.receiverNumber.value}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 24.sp)),
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return ListView.separated(
|
||||
itemCount: 1,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(
|
||||
height: 1,
|
||||
indent: 20.w,
|
||||
endIndent: 20.w,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
itemBuilder: (c, index) {
|
||||
return _electronicKeyItem('images/normal_circle.png', "分组一", () {});
|
||||
});
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(
|
||||
String leftIcon, String leftTitle, Function() action) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 70.h,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
GestureDetector(
|
||||
child: Image.asset(
|
||||
leftIcon,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.w,
|
||||
),
|
||||
Text(
|
||||
leftTitle,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNextBtn() {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: AppColors.mainColor,
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 64.h,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
// showCupertinoAlertDialog(context, RecipientInformationData());
|
||||
},
|
||||
child: Text(
|
||||
'下一步',
|
||||
style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showCupertinoAlertDialog(BuildContext context, RecipientInformationData recipientInformationData) {
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
barrierColor: Colors.black.withOpacity(.5),
|
||||
barrierDismissible: true,
|
||||
barrierLabel: '',
|
||||
transitionDuration: const Duration(milliseconds: 200),
|
||||
transitionBuilder: (BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child) {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
},
|
||||
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
|
||||
// recipientInformationData.nickname = "张三张三张三";
|
||||
return Center(
|
||||
child: Container(
|
||||
width: 400.w,
|
||||
height: 370.h,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 20.h),
|
||||
Text("转移确认", style: TextStyle(fontSize: 24.sp)),
|
||||
SizedBox(height: 20.h),
|
||||
Image.asset('images/icon_lockGroup_item.png', width: 70.h, height: 70.h, fit: BoxFit.fill),
|
||||
SizedBox(height: 15.h),
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: <Widget>[
|
||||
Text(recipientInformationData.nickname!, style: TextStyle(fontSize: 22.sp)),
|
||||
Positioned(
|
||||
left: (recipientInformationData.nickname!.length*19.w).w,
|
||||
child: Container(
|
||||
width: 80.w,
|
||||
color: Colors.red,
|
||||
child: Center(child: Text(state.type.value == 1 ? "个人用户" : "星寓", style: TextStyle(fontSize: 18.sp, color: Colors.white))),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.h),
|
||||
Text(recipientInformationData.userid!, style: TextStyle(fontSize: 22.sp)),
|
||||
SizedBox(height: 8.h),
|
||||
Text("本次共转移${state.idList.value.length}把智能锁", style: TextStyle(fontSize: 20.sp)),
|
||||
SizedBox(height: 20.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
onPrimary: AppColors.appBarIconColor,
|
||||
backgroundColor: Colors.grey,
|
||||
minimumSize: Size(110.w, 45.h),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
),
|
||||
),
|
||||
child: Text('取消', style: TextStyle(fontSize: 22.sp)),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
// logic.transferLockInfoData();
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
onPrimary: AppColors.appBarIconColor,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
minimumSize: Size(110.w, 45.h),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
),
|
||||
),
|
||||
child: Text('确认', style: TextStyle(fontSize: 22.sp)),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class SelectBranchState{
|
||||
var type = 1.obs;// 1、个人用户 2、星寓用户
|
||||
|
||||
final receiverNumber = "".obs;
|
||||
final countryName = "中国".obs;
|
||||
final countryCode = "86".obs;
|
||||
final idList = [].obs;
|
||||
SelectBranchState() {
|
||||
Map map = Get.arguments;
|
||||
idList.value = map["idList"];
|
||||
countryCode.value = map["countryCode"];
|
||||
receiverNumber.value = map["number"];
|
||||
}
|
||||
}
|
||||
@ -1,133 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
|
||||
class SelectBranchPage extends StatefulWidget {
|
||||
const SelectBranchPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SelectBranchPage> createState() => _SelectBranchPageState();
|
||||
}
|
||||
|
||||
class _SelectBranchPageState extends State<SelectBranchPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.recipientInformation!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_buildTopView(),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(child: _buildMainUI()),
|
||||
_buildNextBtn(),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTopView() {
|
||||
return Container(
|
||||
height: 120.h,
|
||||
width: ScreenUtil().screenWidth,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 40.w, top: 20.h, bottom: 16.h),
|
||||
child: Text(
|
||||
'公寓',
|
||||
style: TextStyle(fontSize: 28.sp),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 40.w),
|
||||
child: Text('管理员:18682150237',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 24.sp)),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return ListView.separated(
|
||||
itemCount: 5,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(
|
||||
height: 1,
|
||||
indent: 20.w,
|
||||
endIndent: 20.w,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
itemBuilder: (c, index) {
|
||||
return _electronicKeyItem('images/select_circle.png', "分组一", () {});
|
||||
});
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(
|
||||
String leftIcon, String leftTitle, Function() action) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 70.h,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
GestureDetector(
|
||||
child: Image.asset(
|
||||
leftIcon,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.w,
|
||||
),
|
||||
Text(
|
||||
leftTitle,
|
||||
style: TextStyle(fontSize: 28.sp),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNextBtn() {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: AppColors.mainColor,
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 64.h,
|
||||
child: TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
'下一步',
|
||||
style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
class TransferSmartLockEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
TransferSmartLockListData? data;
|
||||
|
||||
TransferSmartLockEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
TransferSmartLockEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? TransferSmartLockListData.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 TransferSmartLockListData {
|
||||
List<TransferSmartLockItemData>? list;
|
||||
|
||||
TransferSmartLockListData({this.list});
|
||||
|
||||
TransferSmartLockListData.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] != null) {
|
||||
list = <TransferSmartLockItemData>[];
|
||||
json['list'].forEach((v) {
|
||||
list!.add(TransferSmartLockItemData.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (list != null) {
|
||||
data['list'] = list!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class TransferSmartLockItemData {
|
||||
int? lockId;
|
||||
int? selet = 0;
|
||||
String? lockAlias;
|
||||
LockVersion? lockVersion;
|
||||
|
||||
TransferSmartLockItemData({this.lockId, this.lockAlias, this.lockVersion});
|
||||
|
||||
TransferSmartLockItemData.fromJson(Map<String, dynamic> json) {
|
||||
lockId = json['lockId'];
|
||||
lockAlias = json['lockAlias'];
|
||||
// lockVersion = json['lockVersion'] != null
|
||||
// ? LockVersion.fromJson(json['lockVersion'])
|
||||
// : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['lockId'] = lockId;
|
||||
data['lockAlias'] = lockAlias;
|
||||
// if (lockVersion != null) {
|
||||
// data['lockVersion'] = lockVersion!.toJson();
|
||||
// }
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class LockVersion {
|
||||
bool? showAdminKbpwdFlag;
|
||||
int? groupId;
|
||||
int? protocolVersion;
|
||||
int? protocolType;
|
||||
int? orgId;
|
||||
String? logoUrl;
|
||||
int? scene;
|
||||
|
||||
LockVersion(
|
||||
{this.showAdminKbpwdFlag,
|
||||
this.groupId,
|
||||
this.protocolVersion,
|
||||
this.protocolType,
|
||||
this.orgId,
|
||||
this.logoUrl,
|
||||
this.scene});
|
||||
|
||||
LockVersion.fromJson(Map<String, dynamic> json) {
|
||||
showAdminKbpwdFlag = json['showAdminKbpwdFlag'];
|
||||
groupId = json['groupId'];
|
||||
protocolVersion = json['protocolVersion'];
|
||||
protocolType = json['protocolType'];
|
||||
orgId = json['orgId'];
|
||||
logoUrl = json['logoUrl'];
|
||||
scene = json['scene'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['showAdminKbpwdFlag'] = showAdminKbpwdFlag;
|
||||
data['groupId'] = groupId;
|
||||
data['protocolVersion'] = protocolVersion;
|
||||
data['protocolType'] = protocolType;
|
||||
data['orgId'] = orgId;
|
||||
data['logoUrl'] = logoUrl;
|
||||
data['scene'] = scene;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import 'transferSmartLock_state.dart';
|
||||
|
||||
class TransferSmartLockLogic extends BaseGetXController{
|
||||
TransferSmartLockState state = TransferSmartLockState();
|
||||
|
||||
// 获取锁列表
|
||||
Future<void> getTransferLockListData() async{
|
||||
var entity = await ApiRepository.to.getTransferLockListData();
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
state.transferSmartLockListData.value = entity.data!.list!;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
getTransferLockListData();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,197 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../../../../tools/noData.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
import 'transferSmartLock_entity.dart';
|
||||
import 'transferSmartLock_logic.dart';
|
||||
|
||||
class TransferSmartLockPage extends StatefulWidget {
|
||||
const TransferSmartLockPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<TransferSmartLockPage> createState() => _TransferSmartLockPageState();
|
||||
}
|
||||
|
||||
class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
||||
final logic = Get.put(TransferSmartLockLogic());
|
||||
final state = Get.find<TransferSmartLockLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.selectiveLock!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
for (var element in state.transferSmartLockListData.value) {
|
||||
if(state.isSeletAll == true){
|
||||
state.isSeletAll = false;
|
||||
element.selet = 0;
|
||||
}else{
|
||||
state.isSeletAll = true;
|
||||
element.selet = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(state.isSeletAll == true ? TranslationLoader.lanKeys!.checkAll!.tr : TranslationLoader.lanKeys!.cancel!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp)))
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_searchWidget(),
|
||||
SizedBox(height: 10.h),
|
||||
Expanded(child: _buildMainUI()),
|
||||
SizedBox(height: 20.h),
|
||||
_buildNextBtn(),
|
||||
SizedBox(height: 64.h)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _searchWidget() {
|
||||
return Container(
|
||||
height: 60.h,
|
||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
controller: state.searchController,
|
||||
autofocus: false,
|
||||
onChanged: (value){
|
||||
print("onChanged:$value");
|
||||
},
|
||||
onEditingComplete: (){
|
||||
print("onEditingComplete:");
|
||||
},
|
||||
onSubmitted: (value) async {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
await logic.getTransferLockListData();
|
||||
if(state.searchController.text.isNotEmpty){
|
||||
var contrList = <TransferSmartLockItemData>[];
|
||||
for (var element in state.transferSmartLockListData.value) {
|
||||
if(element.lockAlias!.contains(state.searchController.text)){
|
||||
contrList.add(element);
|
||||
}
|
||||
}
|
||||
state.transferSmartLockListData.value = contrList;
|
||||
print("contrList:${contrList[0].lockAlias} state.transferSmartLockListData.value:${state.transferSmartLockListData.value[0].lockAlias}");
|
||||
}
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
//左边图标设置
|
||||
icon: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_search.png',
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return Obx(() => state.transferSmartLockListData.value.isNotEmpty ? ListView.separated(
|
||||
itemCount: state.transferSmartLockListData.value.length,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(
|
||||
height: 1,
|
||||
indent: 20.w,
|
||||
endIndent: 20.w,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
itemBuilder: (c, index) {
|
||||
TransferSmartLockItemData transferSmartLockItemData = state.transferSmartLockListData.value[index];
|
||||
return _electronicKeyItem(transferSmartLockItemData, () {
|
||||
setState(() {
|
||||
if(transferSmartLockItemData.selet == 1){
|
||||
transferSmartLockItemData.selet = 0;
|
||||
}else{
|
||||
transferSmartLockItemData.selet = 1;
|
||||
}
|
||||
});
|
||||
});
|
||||
}):const NoData());
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(TransferSmartLockItemData transferSmartLockItemData, Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 90.h,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 20.w),
|
||||
Image.asset((transferSmartLockItemData.selet == 1) ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w),
|
||||
SizedBox(width: 16.w),
|
||||
Image.asset('images/icon_lockGroup_item.png', width: 50.h, height: 50.h, fit: BoxFit.fill),
|
||||
SizedBox(width: 10.w),
|
||||
Text(transferSmartLockItemData.lockAlias!, style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNextBtn() {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: AppColors.mainColor,
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 64.h,
|
||||
child: TextButton(
|
||||
onPressed: () async {
|
||||
bool isCanNext = false;
|
||||
var idList = [];
|
||||
for (var element in state.transferSmartLockListData.value) {
|
||||
if(element.selet == 1){
|
||||
isCanNext = true;
|
||||
idList.add(element.lockId);
|
||||
}
|
||||
}
|
||||
if(isCanNext == false){
|
||||
Toast.show(msg: "请选择锁");
|
||||
return;
|
||||
}
|
||||
var data = await Get.toNamed(Routers.recipientInformationPage, arguments: {
|
||||
"idList":idList,
|
||||
"isFromType":1,
|
||||
});
|
||||
if(data != null) {
|
||||
logic.getTransferLockListData();
|
||||
}
|
||||
},
|
||||
child: Text('下一步', style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'transferSmartLock_entity.dart';
|
||||
|
||||
class TransferSmartLockState{
|
||||
var transferSmartLockListData = <TransferSmartLockItemData>[].obs;
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
bool isSeletAll = false;
|
||||
}
|
||||
@ -1,168 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
|
||||
class TransferSmartLockPage extends StatefulWidget {
|
||||
const TransferSmartLockPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<TransferSmartLockPage> createState() => _TransferSmartLockPageState();
|
||||
}
|
||||
|
||||
class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.selectiveLock!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
'全选',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
))
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_searchWidget(),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Expanded(child: _buildMainUI()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
_buildNextBtn(),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _searchWidget() {
|
||||
return Container(
|
||||
height: 60.h,
|
||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
// controller: _controller,
|
||||
autofocus: false,
|
||||
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(
|
||||
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
//左边图标设置
|
||||
icon: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_search.png',
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return ListView.separated(
|
||||
itemCount: 10,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(
|
||||
height: 1,
|
||||
indent: 20.w,
|
||||
endIndent: 20.w,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
itemBuilder: (c, index) {
|
||||
return _electronicKeyItem('images/icon_lock.png', "张三",
|
||||
"2023.6.21 11.15", "2023.6.21 11.15", () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminDetailPage);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle,
|
||||
String beginTime, String endTime, Function() action) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 90.h,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
GestureDetector(
|
||||
child: Image.asset(
|
||||
'images/icon_round_unSelet.png',
|
||||
width: 22,
|
||||
height: 22,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/icon_lockGroup_item.png',
|
||||
width: 36,
|
||||
height: 36,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
'Daisy',
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNextBtn() {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
color: Colors.grey,
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 64.h,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, Routers.recipientInformationPage);
|
||||
},
|
||||
child: Text(
|
||||
'下一步',
|
||||
style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -89,6 +89,14 @@ abstract class Api {
|
||||
final String deleteICCardURL = '/identityCard/delete'; // 删除IC卡
|
||||
final String updateICCardUserNoURL = '/identityCard/updatePwdUserNo'; // 更新ic卡用户序号
|
||||
|
||||
final String transferLockListURL = '/room/listForTransfer'; // 转移锁锁列表
|
||||
final String transferLockConfirmURL = '/room/transferLockConfirm'; // 转移智能锁确认
|
||||
final String transferLockURL = '/room/transfer'; // 转移智能锁
|
||||
|
||||
final String gatewaykListURL = '/plug/list'; // 转网关列表
|
||||
final String transferGatewayConfirmURL = '/plug/transferPlugConfirm'; // 转移网关确认
|
||||
final String transferGatewayURL = '/plug/transfer'; // 转移网关
|
||||
|
||||
final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息
|
||||
final String lockUserListURL = '/keyUser/listKeyUser'; //锁用户列表
|
||||
final String canSendKeyURL = '/keyUser/canSendKey'; //群发钥匙检查
|
||||
|
||||
@ -941,6 +941,81 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode(
|
||||
{'cardId': cardId, 'lockId': lockId, 'cardUserNo': cardUserNo}));
|
||||
|
||||
// 获取转移锁锁列表
|
||||
Future<Response> getTransferLockListData() =>
|
||||
post(
|
||||
transferLockListURL.toUrl,
|
||||
jsonEncode({})
|
||||
);
|
||||
|
||||
// 转移智能锁确认
|
||||
Future<Response> transferLockConfirmInfoData(
|
||||
String receiverUserid,
|
||||
String type,
|
||||
String countryCode) =>
|
||||
post(
|
||||
transferLockConfirmURL.toUrl,
|
||||
jsonEncode({
|
||||
'receiverUserid': receiverUserid,
|
||||
'type': type,
|
||||
'countryCode': countryCode
|
||||
})
|
||||
);
|
||||
|
||||
// 转移智能锁
|
||||
Future<Response> transferLockInfoData(
|
||||
String receiverUserid,
|
||||
List lockIdList,
|
||||
String countryCode) =>
|
||||
post(
|
||||
transferLockURL.toUrl,
|
||||
jsonEncode({
|
||||
'receiverUserid': receiverUserid,
|
||||
'lockIdList': lockIdList,
|
||||
'countryCode': countryCode
|
||||
})
|
||||
);
|
||||
|
||||
// 获取网关列表
|
||||
Future<Response> getGatewayListData(
|
||||
String pageNo,
|
||||
String pageSize) =>
|
||||
post(
|
||||
gatewaykListURL.toUrl,
|
||||
jsonEncode({
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize
|
||||
})
|
||||
);
|
||||
|
||||
// 转移网关确认
|
||||
Future<Response> transferGatewayConfirmInfoData(
|
||||
String receiverUserid,
|
||||
String type,
|
||||
String countryCode) =>
|
||||
post(
|
||||
transferGatewayConfirmURL.toUrl,
|
||||
jsonEncode({
|
||||
'receiverUserid': receiverUserid,
|
||||
'type': type,
|
||||
'countryCode': countryCode
|
||||
})
|
||||
);
|
||||
|
||||
// 转移网关
|
||||
Future<Response> transferGatewayInfoData(
|
||||
String receiverUserid,
|
||||
List plugIdList,
|
||||
String countryCode) =>
|
||||
post(
|
||||
transferGatewayURL.toUrl,
|
||||
jsonEncode({
|
||||
'receiverUserid': receiverUserid,
|
||||
'plugIdList': plugIdList,
|
||||
'countryCode': countryCode
|
||||
})
|
||||
);
|
||||
|
||||
Future<Response> listLockByGroup(String type, String keyGroupId) => post(
|
||||
listLockByGroupURL.toUrl,
|
||||
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
||||
|
||||
@ -11,13 +11,13 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/pass
|
||||
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/entity/userSettingInfoEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart';
|
||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
import '../login/register/entity/SendValidationCodeEntity.dart';
|
||||
import '../main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart';
|
||||
import '../main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_entity.dart';
|
||||
import '../main/lockDetail/checkingIn/checkingInHolidays/checkingInSetHolidays/checkingInSetHolidays_entity.dart';
|
||||
import '../main/lockDetail/checkingIn/checkingInList/checkingInListDay_entity.dart';
|
||||
@ -29,9 +29,15 @@ import '../main/lockDetail/lcokSet/configuringWifi/configuringWifiEntity.dart';
|
||||
import '../main/lockDetail/lcokSet/lockSet/CheckingInInfoDataEntity.dart';
|
||||
import '../main/lockDetail/lcokSet/lockTime/GetServerDatetimeEntity.dart';
|
||||
import '../main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart';
|
||||
import '../main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart';
|
||||
import '../main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart';
|
||||
import '../main/lockDetail/otherTypeKey/otherTypeKeyList/fingerprintListData_entity.dart';
|
||||
import '../main/lockMian/entity/lockInfoEntity.dart';
|
||||
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
|
||||
import '../mine/mineSet/mineSet/entity/userSettingInfoEntity.dart';
|
||||
import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
|
||||
import '../mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_entity.dart';
|
||||
import 'api_provider.dart';
|
||||
|
||||
class ApiRepository {
|
||||
@ -125,7 +131,7 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//发送电子钥匙
|
||||
Future<ElectronicKeyListEntity> sendElectronicKey(
|
||||
Future<AuthorizedAdminSendEntity> sendElectronicKey(
|
||||
String createUser,
|
||||
String countryCode,
|
||||
String usernameType,
|
||||
@ -159,7 +165,7 @@ class ApiRepository {
|
||||
remarks,
|
||||
startDate,
|
||||
weekDays);
|
||||
return ElectronicKeyListEntity.fromJson(res.body);
|
||||
return AuthorizedAdminSendEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//重置电子钥匙
|
||||
@ -923,7 +929,7 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 添加指纹
|
||||
Future<CheckingInListMonthEntity> addFingerprintsData({
|
||||
Future<AddFingerprintEntity> addFingerprintsData({
|
||||
required String lockId,
|
||||
required String endDate,
|
||||
required String addType,
|
||||
@ -944,7 +950,7 @@ class ApiRepository {
|
||||
isCoerced,
|
||||
startDate,
|
||||
weekDay);
|
||||
return CheckingInListMonthEntity.fromJson(res.body);
|
||||
return AddFingerprintEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 编辑指纹
|
||||
@ -995,7 +1001,7 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 添加ID卡
|
||||
Future<CheckingInListMonthEntity> addICCardData({
|
||||
Future<AddICCardEntity> addICCardData({
|
||||
required String lockId,
|
||||
required String endDate,
|
||||
required String cardName,
|
||||
@ -1008,7 +1014,7 @@ class ApiRepository {
|
||||
}) async {
|
||||
final res = await apiProvider.addICCardData(lockId, endDate, cardName,
|
||||
cardNumber, cardType, addType, startDate, isCoerced, weekDay);
|
||||
return CheckingInListMonthEntity.fromJson(res.body);
|
||||
return AddICCardEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 编辑IC卡
|
||||
@ -1051,4 +1057,57 @@ class ApiRepository {
|
||||
final res = await apiProvider.userLogout();
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 获取转移锁锁列表
|
||||
Future<TransferSmartLockEntity> getTransferLockListData() async {
|
||||
final res = await apiProvider.getTransferLockListData();
|
||||
return TransferSmartLockEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 转移智能锁确认
|
||||
Future<RecipientInformationEntity> transferLockConfirmInfoData(
|
||||
{required String receiverUserid,
|
||||
required String type,
|
||||
required String countryCode}) async {
|
||||
final res = await apiProvider.transferLockConfirmInfoData(
|
||||
receiverUserid, type, countryCode);
|
||||
return RecipientInformationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 转移智能锁
|
||||
Future<RecipientInformationEntity> transferLockInfoData(
|
||||
{required String receiverUserid,
|
||||
required List lockIdList,
|
||||
required String countryCode}) async {
|
||||
final res = await apiProvider.transferLockInfoData(
|
||||
receiverUserid, lockIdList, countryCode);
|
||||
return RecipientInformationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 获取网关列表
|
||||
Future<GetewayDataEntity> getGatewayListData(
|
||||
{required String pageNo, required String pageSize}) async {
|
||||
final res = await apiProvider.getGatewayListData(pageNo, pageSize);
|
||||
return GetewayDataEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 转移网关确认
|
||||
Future<RecipientInformationEntity> transferGatewayConfirmInfoData(
|
||||
{required String receiverUserid,
|
||||
required String type,
|
||||
required String countryCode}) async {
|
||||
final res = await apiProvider.transferGatewayConfirmInfoData(
|
||||
receiverUserid, type, countryCode);
|
||||
return RecipientInformationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 转移智能锁
|
||||
Future<RecipientInformationEntity> transferGatewayInfoData(
|
||||
{required String receiverUserid,
|
||||
required List plugIdList,
|
||||
required String countryCode}) async {
|
||||
final res = await apiProvider.transferGatewayInfoData(
|
||||
receiverUserid, plugIdList, countryCode);
|
||||
return RecipientInformationEntity.fromJson(res.body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,3 +24,9 @@ class PassCurrentLockInformationEvent{
|
||||
class OtherTypeRefreshListEvent{
|
||||
OtherTypeRefreshListEvent();
|
||||
}
|
||||
|
||||
/// 考情添加员工卡、指纹之后回调卡、指纹number
|
||||
class ChickInAddStaffCardAndFingerprintBlockNumberEvent{
|
||||
String number;
|
||||
ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../login/login/entity/LoginData.dart';
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
|
||||
class Storage {
|
||||
@ -122,7 +123,7 @@ class Storage {
|
||||
String? userId = '';
|
||||
final data = await Storage.getString('userLoginData');
|
||||
if (data != null && data.isNotEmpty) {
|
||||
userId = LoginEntity.fromJson(jsonDecode(data)).data!.userid.toString();
|
||||
userId = LoginData.fromJson(jsonDecode(data)).userid.toString();
|
||||
}
|
||||
print("pubUserId:$userId");
|
||||
return userId;
|
||||
|
||||
@ -387,10 +387,19 @@ class LanKeyEntity {
|
||||
this.wifiPwd,
|
||||
this.pleaseEnterWifiPwd,
|
||||
this.wifiDistributionNetwork,
|
||||
this.attendanceRecord,
|
||||
this.edit,
|
||||
this.stressFingerprint,
|
||||
this.effectiveDay
|
||||
this.attendanceRecord,
|
||||
this.edit,
|
||||
this.stressFingerprint,
|
||||
this.effectiveDay,
|
||||
this.whetherTheEmployeeHasPassword,
|
||||
this.whetherTheEmployeeHasCard,
|
||||
this.whetherTheEmployeeHasFingerprint,
|
||||
this.seletPassword,
|
||||
this.seletCard,
|
||||
this.seletFingerprint,
|
||||
this.getKey,
|
||||
this.getCard,
|
||||
this.getFingerprint,
|
||||
});
|
||||
|
||||
LanKeyEntity.fromJson(dynamic json) {
|
||||
@ -815,6 +824,15 @@ class LanKeyEntity {
|
||||
edit = json['edit'];
|
||||
stressFingerprint = json['stressFingerprint'];
|
||||
effectiveDay = json['effectiveDay'];
|
||||
whetherTheEmployeeHasPassword = json['whetherTheEmployeeHasPassword'];
|
||||
whetherTheEmployeeHasCard = json['whetherTheEmployeeHasCard'];
|
||||
whetherTheEmployeeHasFingerprint = json['whetherTheEmployeeHasFingerprint'];
|
||||
seletPassword = json['seletPassword'];
|
||||
seletCard = json['seletCard'];
|
||||
seletFingerprint = json['seletFingerprint'];
|
||||
getKey = json['getKey'];
|
||||
getCard = json['getCard'];
|
||||
getFingerprint = json['getFingerprint'];
|
||||
}
|
||||
String? starLock;
|
||||
String? clickUnlockAndHoldDownClose;
|
||||
@ -1225,6 +1243,16 @@ class LanKeyEntity {
|
||||
String? edit;
|
||||
String? stressFingerprint;
|
||||
String? effectiveDay;
|
||||
String? whetherTheEmployeeHasPassword;
|
||||
String? whetherTheEmployeeHasCard;
|
||||
String? whetherTheEmployeeHasFingerprint;
|
||||
String? seletPassword;
|
||||
String? seletCard;
|
||||
String? seletFingerprint;
|
||||
String? getKey;
|
||||
String? getCard;
|
||||
String? getFingerprint;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['starLock'] = starLock;
|
||||
@ -1645,6 +1673,15 @@ class LanKeyEntity {
|
||||
map['edit'] = edit;
|
||||
map['stressFingerprint'] = stressFingerprint;
|
||||
map['effectiveDay'] = effectiveDay;
|
||||
map['whetherTheEmployeeHasPassword'] = whetherTheEmployeeHasPassword;
|
||||
map['whetherTheEmployeeHasCard'] = whetherTheEmployeeHasCard;
|
||||
map['whetherTheEmployeeHasFingerprint'] = whetherTheEmployeeHasFingerprint;
|
||||
map['seletPassword'] = seletPassword;
|
||||
map['seletCard'] = seletCard;
|
||||
map['seletFingerprint'] = seletFingerprint;
|
||||
map['getKey'] = getKey;
|
||||
map['getCard'] = getCard;
|
||||
map['getFingerprint'] = getFingerprint;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ dependencies:
|
||||
|
||||
# 谷歌地图
|
||||
google_maps_flutter: ^2.2.5
|
||||
geocoding: ^2.1.0
|
||||
# geocoding: ^2.1.0
|
||||
|
||||
# 允许App发现网络的相关信息并且进行相应的配置
|
||||
network_info_plus: ^4.0.2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user