1,密码钥匙重置接口增加
2,新增删除账号入口及安全验证页面 3,新增删除账号接口调试 4,新增刷新库 5,部分页面状态刷新重构
This commit is contained in:
parent
073a7ad38b
commit
eca37e7588
@ -415,5 +415,7 @@
|
|||||||
"seletFingerprint":"Selet Fingerprint",
|
"seletFingerprint":"Selet Fingerprint",
|
||||||
"getKey":"Get Key",
|
"getKey":"Get Key",
|
||||||
"getCard":"Get Card",
|
"getCard":"Get Card",
|
||||||
"getFingerprint":"Get Fingerprint"
|
"getFingerprint":"Get Fingerprint",
|
||||||
|
"safeVerify":"Security verification",
|
||||||
|
"deleteAccountTips": "After deleting the account, all your information and related records will be completely deleted from the platform, and can not be recovered, delete or not"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -415,5 +415,7 @@
|
|||||||
"seletFingerprint":"seletFingerprint",
|
"seletFingerprint":"seletFingerprint",
|
||||||
"getKey":"getKey",
|
"getKey":"getKey",
|
||||||
"getCard":"getCard",
|
"getCard":"getCard",
|
||||||
"getFingerprint":"getFingerprint"
|
"getFingerprint":"getFingerprint",
|
||||||
|
"safeVerify":"safeVerify",
|
||||||
|
"deleteAccountTips":"deleteAccountTips"
|
||||||
}
|
}
|
||||||
@ -418,5 +418,7 @@
|
|||||||
"seletFingerprint":"选择指纹",
|
"seletFingerprint":"选择指纹",
|
||||||
"getKey":"获取钥匙",
|
"getKey":"获取钥匙",
|
||||||
"getCard":"获取卡",
|
"getCard":"获取卡",
|
||||||
"getFingerprint":"获取指纹"
|
"getFingerprint":"获取指纹",
|
||||||
|
"safeVerify":"安全验证",
|
||||||
|
"deleteAccountTips":"删除账号后,你的所有信息及相关记录都会从平台彻底删除,且不可恢复,是否删除?"
|
||||||
}
|
}
|
||||||
@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
||||||
|
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
||||||
@ -323,6 +324,7 @@ abstract class Routers {
|
|||||||
static const adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表
|
static const adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表
|
||||||
static const expireLockChangeDatePage =
|
static const expireLockChangeDatePage =
|
||||||
'/expireLockChangeDatePage'; //即将到期列表有效期修改
|
'/expireLockChangeDatePage'; //即将到期列表有效期修改
|
||||||
|
static const safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AppRouters {
|
abstract class AppRouters {
|
||||||
@ -807,6 +809,7 @@ abstract class AppRouters {
|
|||||||
page: () => const AdminDetailChangeDatePage()),
|
page: () => const AdminDetailChangeDatePage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.expireLockChangeDatePage,
|
name: Routers.expireLockChangeDatePage,
|
||||||
page: () => const ExpireLockChangeDatePage())
|
page: () => const ExpireLockChangeDatePage()),
|
||||||
|
GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage())
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
@ -9,18 +8,14 @@ import '../../network/api_repository.dart';
|
|||||||
import '../../tools/store_service.dart';
|
import '../../tools/store_service.dart';
|
||||||
import 'starLock_login_state.dart';
|
import 'starLock_login_state.dart';
|
||||||
|
|
||||||
class StarLockLoginLogic extends BaseGetXController{
|
class StarLockLoginLogic extends BaseGetXController {
|
||||||
final StarLockLoginState state = StarLockLoginState();
|
final StarLockLoginState state = StarLockLoginState();
|
||||||
final stateMyLogic = Get.put(StarLockMineLogic()).state;
|
final stateMyLogic = Get.put(StarLockMineLogic()).state;
|
||||||
|
|
||||||
void login() async{
|
void login() async {
|
||||||
var entity = await ApiRepository.to.login(
|
var entity = await ApiRepository.to
|
||||||
"1",
|
.login("1", state.pwd.value, "+86", state.emailOrPhone.value);
|
||||||
state.pwd.value,
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
"+86",
|
|
||||||
state.emailOrPhone.value
|
|
||||||
);
|
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
|
||||||
// await StoreService.to.saveLogInInfo(entity);
|
// await StoreService.to.saveLogInInfo(entity);
|
||||||
stateMyLogic.saveLoginData(entity.data);
|
stateMyLogic.saveLoginData(entity.data);
|
||||||
// Get.back();
|
// Get.back();
|
||||||
@ -32,24 +27,26 @@ class StarLockLoginLogic extends BaseGetXController{
|
|||||||
_resetCanNext();
|
_resetCanNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void exchangeFistShow() => state.passwordShow.value = !state.passwordShow.value;
|
void exchangeFistShow() =>
|
||||||
|
state.passwordShow.value = !state.passwordShow.value;
|
||||||
|
|
||||||
void checkNext(TextEditingController controller) {
|
void checkNext(TextEditingController controller) {
|
||||||
changeInput(controller);
|
changeInput(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeInput(TextEditingController controller) {
|
void changeInput(TextEditingController controller) {
|
||||||
if(controller == state.emailOrPhoneController){
|
if (controller == state.emailOrPhoneController) {
|
||||||
state.emailOrPhone.value = controller.text;
|
state.emailOrPhone.value = controller.text;
|
||||||
}
|
}
|
||||||
if(controller == state.pwdController) {
|
if (controller == state.pwdController) {
|
||||||
state.pwd.value = controller.text;
|
state.pwd.value = controller.text;
|
||||||
}
|
}
|
||||||
_resetCanNext();
|
_resetCanNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _resetCanNext(){
|
void _resetCanNext() {
|
||||||
state.canNext.value = state.pwdIsOK && state.isEmailOrPhone && state.agree.value;
|
state.canNext.value =
|
||||||
|
state.pwdIsOK && state.isEmailOrPhone && state.agree.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -57,5 +54,4 @@ class StarLockLoginLogic extends BaseGetXController{
|
|||||||
state.onClose();
|
state.onClose();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -142,10 +142,12 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.seletCountryRegionPage);
|
context, Routers.seletCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
logic.state.countryCode.value = result['code'];
|
result as Map<String, dynamic>;
|
||||||
logic.state.countryId.value = result["countryId"];
|
logic.state.countryCode.value = result['code'];
|
||||||
logic.state.countryName.value = result['countryName'];
|
logic.state.countryId.value = result["countryId"];
|
||||||
|
logic.state.countryName.value = result['countryName'];
|
||||||
|
}
|
||||||
print(
|
print(
|
||||||
"路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
|
"路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
|
||||||
},
|
},
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class AuthorizedAdminSendEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Data {
|
class Data {
|
||||||
int? receiverUid;
|
String? receiverUid;
|
||||||
ReceiverUser? receiverUser;
|
ReceiverUser? receiverUser;
|
||||||
int? keyId;
|
int? keyId;
|
||||||
|
|
||||||
@ -64,13 +64,13 @@ class ReceiverUser {
|
|||||||
|
|
||||||
ReceiverUser(
|
ReceiverUser(
|
||||||
{this.email,
|
{this.email,
|
||||||
this.name,
|
this.name,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.id,
|
this.id,
|
||||||
this.profilePhotoUrl,
|
this.profilePhotoUrl,
|
||||||
this.phone,
|
this.phone,
|
||||||
this.cloud});
|
this.cloud});
|
||||||
|
|
||||||
ReceiverUser.fromJson(Map<String, dynamic> json) {
|
ReceiverUser.fromJson(Map<String, dynamic> json) {
|
||||||
email = json['email'];
|
email = json['email'];
|
||||||
@ -113,13 +113,13 @@ class Phone {
|
|||||||
|
|
||||||
Phone(
|
Phone(
|
||||||
{this.userId,
|
{this.userId,
|
||||||
this.phoneNumberHash,
|
this.phoneNumberHash,
|
||||||
this.phoneNumberEncrypt,
|
this.phoneNumberEncrypt,
|
||||||
this.countryCode,
|
this.countryCode,
|
||||||
this.phoneNumberVerifiedAt,
|
this.phoneNumberVerifiedAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.id});
|
this.id});
|
||||||
|
|
||||||
Phone.fromJson(Map<String, dynamic> json) {
|
Phone.fromJson(Map<String, dynamic> json) {
|
||||||
userId = json['user_id'];
|
userId = json['user_id'];
|
||||||
@ -149,7 +149,7 @@ class Phone {
|
|||||||
class Cloud {
|
class Cloud {
|
||||||
String? username;
|
String? username;
|
||||||
String? password;
|
String? password;
|
||||||
int? cloudUid;
|
String? cloudUid;
|
||||||
int? userId;
|
int? userId;
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
String? createdAt;
|
String? createdAt;
|
||||||
@ -157,12 +157,12 @@ class Cloud {
|
|||||||
|
|
||||||
Cloud(
|
Cloud(
|
||||||
{this.username,
|
{this.username,
|
||||||
this.password,
|
this.password,
|
||||||
this.cloudUid,
|
this.cloudUid,
|
||||||
this.userId,
|
this.userId,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.id});
|
this.id});
|
||||||
|
|
||||||
Cloud.fromJson(Map<String, dynamic> json) {
|
Cloud.fromJson(Map<String, dynamic> json) {
|
||||||
username = json['username'];
|
username = json['username'];
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'package:date_format/date_format.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
@ -6,7 +5,6 @@ import 'package:flutter_pickers/pickers.dart';
|
|||||||
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
@ -30,48 +28,13 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
final logic = Get.put(AuthorizedAdminLogic());
|
final logic = Get.put(AuthorizedAdminLogic());
|
||||||
final state = Get.find<AuthorizedAdminLogic>().state;
|
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 = [];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
// DateTime dateTime = DateTime.now();
|
|
||||||
// _effectiveDateTime = dateTime;
|
|
||||||
// _failureDateTime = dateTime;
|
|
||||||
// _selectEffectiveDate =
|
|
||||||
// '${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
|
||||||
// _selectFailureDate =
|
|
||||||
// '${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
|
||||||
// _isSendSuccess = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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"];
|
|
||||||
// }
|
|
||||||
|
|
||||||
state.type.value = widget.type;
|
state.type.value = widget.type;
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
@ -137,10 +100,12 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.seletCountryRegionPage);
|
context, Routers.seletCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
state.countryCode.value = result['code'];
|
result as Map<String, dynamic>;
|
||||||
state.countryName.value = result['countryName'];
|
state.countryCode.value = result['code'];
|
||||||
setState(() {});
|
state.countryName.value = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -169,7 +134,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
state.selectEffectiveDate.value =
|
state.selectEffectiveDate.value =
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
state.effectiveDateTime.value = DateTime.parse(state.selectEffectiveDate.value);
|
state.effectiveDateTime.value =
|
||||||
|
DateTime.parse(state.selectEffectiveDate.value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -183,7 +149,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
state.selectFailureDate.value =
|
state.selectFailureDate.value =
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
state.failureDateTime.value = DateTime.parse(state.selectFailureDate.value);
|
state.failureDateTime.value =
|
||||||
|
DateTime.parse(state.selectFailureDate.value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -232,7 +199,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
//发送钥匙请求
|
//发送钥匙请求
|
||||||
if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.value.text.isNotEmpty) {
|
if (state.emailOrPhoneController.text.isNotEmpty &&
|
||||||
|
state.keyNameController.value.text.isNotEmpty) {
|
||||||
// logic.addUserConnectBlue();
|
// logic.addUserConnectBlue();
|
||||||
logic.sendElectronicKeyRequest();
|
logic.sendElectronicKeyRequest();
|
||||||
}
|
}
|
||||||
@ -358,8 +326,9 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
controller:
|
controller: lineIndex == 1
|
||||||
lineIndex == 1 ? state.emailOrPhoneController : state.keyNameController,
|
? state.emailOrPhoneController
|
||||||
|
: state.keyNameController,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@ -389,7 +358,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Contact? contact = await state.contactPicker.selectContact();
|
Contact? contact =
|
||||||
|
await state.contactPicker.selectContact();
|
||||||
setState(() {
|
setState(() {
|
||||||
state.contact = contact!;
|
state.contact = contact!;
|
||||||
// print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}");
|
// print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}");
|
||||||
@ -403,48 +373,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送授权管理员列表请求
|
|
||||||
// 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() {
|
CupertinoSwitch _switch() {
|
||||||
return CupertinoSwitch(
|
return CupertinoSwitch(
|
||||||
|
|||||||
@ -134,10 +134,12 @@ class _VolumeAuthorizationLockPageState
|
|||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.seletCountryRegionPage);
|
context, Routers.seletCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
countryCode = result['code'];
|
result as Map<String, dynamic>;
|
||||||
countryName = result['countryName'];
|
countryCode = result['code'];
|
||||||
setState(() {});
|
countryName = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
|
|||||||
@ -39,8 +39,9 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget:
|
rightWidget: getTFWidget(
|
||||||
getTFWidget(TranslationLoader.lanKeys!.pleaseEnter!.tr, state.staffNameController)),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
state.staffNameController)),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr,
|
leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr,
|
||||||
rightTitle: state.seletPrintingMethodStr.value,
|
rightTitle: state.seletPrintingMethodStr.value,
|
||||||
@ -50,22 +51,28 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
var list = ["APP", "密码", "卡", "指纹"];
|
var list = ["APP", "密码", "卡", "指纹"];
|
||||||
_showSeletClockInType(list, "1");
|
_showSeletClockInType(list, "1");
|
||||||
})),
|
})),
|
||||||
SizedBox(height: 10.h,),
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
//员工是否有App、卡、钥匙、指纹必须显示
|
//员工是否有App、卡、钥匙、指纹必须显示
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:addStaffGetIfHaveKey(),
|
leftTitel: addStaffGetIfHaveKey(),
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: Row(
|
rightWidget: Row(
|
||||||
children: [
|
children: [
|
||||||
whetherTheEmployeeHasAKeyWidget("无", state.appUnHaveAccount.value, () {
|
whetherTheEmployeeHasAKeyWidget(
|
||||||
|
"无", state.appUnHaveAccount.value, () {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.appUnHaveAccount.value = true;
|
state.appUnHaveAccount.value = true;
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
SizedBox(width: 30.w,),
|
SizedBox(
|
||||||
whetherTheEmployeeHasAKeyWidget("有", !state.appUnHaveAccount.value, () {
|
width: 30.w,
|
||||||
|
),
|
||||||
|
whetherTheEmployeeHasAKeyWidget(
|
||||||
|
"有", !state.appUnHaveAccount.value, () {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.appUnHaveAccount.value = false;
|
state.appUnHaveAccount.value = false;
|
||||||
});
|
});
|
||||||
@ -74,125 +81,149 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
))),
|
))),
|
||||||
// 当选择App时显示 其他隐藏
|
// 当选择App时显示 其他隐藏
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: (state.appUnHaveAccount.value && state.seletPrintingMethodType.value == "1") ? true : false,
|
visible: (state.appUnHaveAccount.value &&
|
||||||
child: Column(
|
state.seletPrintingMethodType.value == "1")
|
||||||
children: [
|
? true
|
||||||
CommonItem(
|
: false,
|
||||||
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
child: Column(
|
||||||
rightTitle: "",
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveRightWidget: true,
|
|
||||||
rightWidget:
|
|
||||||
getTFWidget(TranslationLoader.lanKeys!.pleaseEnter!.tr, state.staffAccountController)),
|
|
||||||
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(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
// 当选择密码、卡、指纹时显示
|
|
||||||
Obx(() => Visibility(
|
|
||||||
visible: (state.seletPrintingMethodType.value != "1" && state.appUnHaveAccount.value) ? true : false,
|
|
||||||
child: CommonItem(
|
|
||||||
leftTitel: addStaffGetKeyType(),
|
|
||||||
isHaveLine: false,
|
|
||||||
isHaveRightWidget: true,
|
|
||||||
rightWidget: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Obx(() => Text(state.getDataPassword.value, style: TextStyle(fontSize: 24.sp))),
|
CommonItem(
|
||||||
SizedBox(width: 30.w,),
|
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
||||||
SizedBox(
|
rightTitle: "",
|
||||||
width: 130.w,
|
isHaveLine: true,
|
||||||
height: 40.h,
|
isHaveRightWidget: true,
|
||||||
child: ElevatedButton(
|
rightWidget: getTFWidget(
|
||||||
style: ElevatedButton.styleFrom(backgroundColor: AppColors.mainColor,),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
child: Text(addStaffSeletKeyType(), style: TextStyle(color: Colors.white, fontSize: 22.sp)),
|
state.staffAccountController)),
|
||||||
onPressed: () async {
|
CommonItem(
|
||||||
switch(int.parse(state.seletPrintingMethodType.value)){
|
leftTitel:
|
||||||
case 2:
|
TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
// 获取密码
|
rightTitle: "",
|
||||||
logic.getKeyboardPwdRequest();
|
isHaveLine: true,
|
||||||
break;
|
isHaveRightWidget: true,
|
||||||
case 3:
|
isHaveDirection: true,
|
||||||
// 卡
|
rightWidget: Text(
|
||||||
if(state.staffNameController.text.isEmpty){
|
'${state.countryName.value} +${state.countryCode.value}',
|
||||||
Toast.show(msg: "请输入姓名");
|
textAlign: TextAlign.end,
|
||||||
return;
|
style: TextStyle(
|
||||||
}
|
fontSize: 22.sp,
|
||||||
|
color: AppColors.darkGrayTextColor),
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
),
|
),
|
||||||
|
action: () async {
|
||||||
|
var result = await Navigator.pushNamed(
|
||||||
|
context, Routers.seletCountryRegionPage);
|
||||||
|
if (result != null) {
|
||||||
|
result as Map<String, dynamic>;
|
||||||
|
state.countryCode.value = result['code'];
|
||||||
|
state.countryName.value = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
)),
|
)),
|
||||||
|
// 当选择密码、卡、指纹时显示
|
||||||
|
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(
|
Obx(() => Visibility(
|
||||||
visible: !state.appUnHaveAccount.value,
|
visible: !state.appUnHaveAccount.value,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: addStaffGetKeyType(),
|
leftTitel: addStaffGetKeyType(),
|
||||||
rightTitle: state.seletKey.value,
|
rightTitle: state.seletKey.value,
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
logic.addStaffSeletKey((v){
|
logic.addStaffSeletKey((v) {
|
||||||
var list = [];
|
var list = [];
|
||||||
for (var element in v) {
|
for (var element in v) {
|
||||||
list.add(element.attendanceWay);
|
list.add(element.attendanceWay);
|
||||||
}
|
}
|
||||||
_showSeletClockInType(list, "2");
|
_showSeletClockInType(list, "2");
|
||||||
});
|
});
|
||||||
|
}),
|
||||||
}),
|
)),
|
||||||
)),
|
|
||||||
SizedBox(height: 50.w),
|
SizedBox(height: 50.w),
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
@ -200,14 +231,14 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if(state.staffNameController.text.isEmpty){
|
if (state.staffNameController.text.isEmpty) {
|
||||||
Toast.show(msg: "请输入姓名");
|
Toast.show(msg: "请输入姓名");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.isAdd.value == "2"){
|
if (state.isAdd.value == "2") {
|
||||||
logic.editStaffLoadData();
|
logic.editStaffLoadData();
|
||||||
}else{
|
} else {
|
||||||
logic.addStaffLoadData();
|
logic.addStaffLoadData();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -261,26 +292,30 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
data: list,
|
data: list,
|
||||||
//选择事件的回调
|
//选择事件的回调
|
||||||
clickCallBack: (int index, var str) {
|
clickCallBack: (int index, var str) {
|
||||||
setState(() {
|
setState(() {
|
||||||
if(type == "1"){
|
if (type == "1") {
|
||||||
state.seletPrintingMethodType.value = (index+1).toString();
|
state.seletPrintingMethodType.value = (index + 1).toString();
|
||||||
state.seletPrintingMethodStr.value = str.toString();
|
state.seletPrintingMethodStr.value = str.toString();
|
||||||
state.getDataPassword.value = "";
|
state.getDataPassword.value = "";
|
||||||
}else{
|
} else {
|
||||||
state.seletKey.value = str.toString();
|
state.seletKey.value = str.toString();
|
||||||
}
|
}
|
||||||
print("object:$index str:$str type:$type state.seletPrintingMethodType.value:${state.seletPrintingMethodType.value}");
|
print(
|
||||||
});
|
"object:$index str:$str type:$type state.seletPrintingMethodType.value:${state.seletPrintingMethodType.value}");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget whetherTheEmployeeHasAKeyWidget(String title, bool appUnHaveAccount, Function() action) {
|
Widget whetherTheEmployeeHasAKeyWidget(
|
||||||
|
String title, bool appUnHaveAccount, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
appUnHaveAccount ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png',
|
appUnHaveAccount
|
||||||
|
? 'images/icon_round_selet.png'
|
||||||
|
: 'images/icon_round_unSelet.png',
|
||||||
width: 26.w,
|
width: 26.w,
|
||||||
height: 26.w,
|
height: 26.w,
|
||||||
),
|
),
|
||||||
@ -298,9 +333,9 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String addStaffGetIfHaveKey(){
|
String addStaffGetIfHaveKey() {
|
||||||
String title = "";
|
String title = "";
|
||||||
switch(int.parse(state.seletPrintingMethodType.value)){
|
switch (int.parse(state.seletPrintingMethodType.value)) {
|
||||||
case 1:
|
case 1:
|
||||||
title = TranslationLoader.lanKeys!.whetherTheEmployeeHasAKey!.tr;
|
title = TranslationLoader.lanKeys!.whetherTheEmployeeHasAKey!.tr;
|
||||||
break;
|
break;
|
||||||
@ -317,9 +352,9 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
String addStaffGetKeyType(){
|
String addStaffGetKeyType() {
|
||||||
String title = "";
|
String title = "";
|
||||||
switch(int.parse(state.seletPrintingMethodType.value)){
|
switch (int.parse(state.seletPrintingMethodType.value)) {
|
||||||
case 1:
|
case 1:
|
||||||
title = TranslationLoader.lanKeys!.accountNumber!.tr;
|
title = TranslationLoader.lanKeys!.accountNumber!.tr;
|
||||||
break;
|
break;
|
||||||
@ -336,9 +371,9 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
String addStaffSeletKeyType(){
|
String addStaffSeletKeyType() {
|
||||||
String title = "";
|
String title = "";
|
||||||
switch(int.parse(state.seletPrintingMethodType.value)){
|
switch (int.parse(state.seletPrintingMethodType.value)) {
|
||||||
case 1:
|
case 1:
|
||||||
title = TranslationLoader.lanKeys!.getKey!.tr;
|
title = TranslationLoader.lanKeys!.getKey!.tr;
|
||||||
break;
|
break;
|
||||||
@ -354,5 +389,4 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
}
|
}
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity
|
|||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/jh_pop_menus.dart';
|
import 'package:star_lock/tools/jh_pop_menus.dart';
|
||||||
|
import 'package:star_lock/tools/showCupertinoAlert.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
@ -271,7 +272,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
print("删除电子钥匙成功");
|
print("删除电子钥匙成功");
|
||||||
Toast.show(msg: "删除成功");
|
Toast.show(msg: "删除成功");
|
||||||
setState(() {
|
setState(() {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
|
|
||||||
|
|
||||||
class ElectronicKeyListBinding extends Bindings {
|
|
||||||
@override
|
|
||||||
void dependencies() {
|
|
||||||
Get.lazyPut(() => ElectronicKeyListLogic());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +1,60 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
class ElectronicKeyListLogic {
|
class ElectronicKeyListLogic extends BaseGetXController {
|
||||||
late ElectronicKeyListEntity dataEntity = ElectronicKeyListEntity();
|
final ElectronicKeyListState state = ElectronicKeyListState();
|
||||||
void electronicKeyList() async {
|
|
||||||
var entity = await ApiRepository.to
|
//请求电子钥匙列表
|
||||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0', '0');
|
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||||
|
'0',
|
||||||
|
state.keyInfo.value.keyId.toString(),
|
||||||
|
'',
|
||||||
|
state.keyInfo.value.lockId.toString(),
|
||||||
|
'',
|
||||||
|
state.pageNum.toString(),
|
||||||
|
state.pageSize.toString(),
|
||||||
|
'0',
|
||||||
|
'0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
dataEntity = entity;
|
}
|
||||||
|
if (entity.data != null) {
|
||||||
|
return entity.data!.itemList;
|
||||||
|
} else {
|
||||||
|
List<ElectronicKeyListItem> dataList = [];
|
||||||
|
return dataList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//电子钥匙重置请求
|
||||||
|
Future<void> resetElectronicKeyListRequest() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
|
.resetElectronicKey(state.keyInfo.value.lockId.toString(), '0');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("重置电子钥匙成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "重置成功");
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/toast.dart';
|
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
@ -23,19 +20,18 @@ class ElectronicKeyListPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||||
final logic = Get.put(ElectronicKeyListLogic());
|
final logic = Get.put(ElectronicKeyListLogic());
|
||||||
late KeyInfos keyInfo;
|
final state = Get.find<ElectronicKeyListLogic>().state;
|
||||||
late LockMainEntity lockMainEntity;
|
late RefreshController _refreshController;
|
||||||
|
late List<ElectronicKeyListItem> itemDataList = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_refreshController = RefreshController(initialRefresh: true);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
|
||||||
lockMainEntity = obj["lockMainEntity"];
|
|
||||||
}
|
|
||||||
if (obj != null && (obj["keyInfo"] != null)) {
|
|
||||||
keyInfo = obj["keyInfo"];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -49,13 +45,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
resetElectronicKeyListRequest();
|
logic.resetElectronicKeyListRequest();
|
||||||
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: FutureBuilder<List<ElectronicKeyListItem>>(
|
body: FutureBuilder<List<ElectronicKeyListItem>>(
|
||||||
future: mockNetworkDataRequest(),
|
future: logic.mockNetworkDataRequest(),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<List<ElectronicKeyListItem>> snapshot) {
|
AsyncSnapshot<List<ElectronicKeyListItem>> snapshot) {
|
||||||
//请求结束
|
//请求结束
|
||||||
@ -65,7 +62,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
return const Text('请求失败');
|
return const Text('请求失败');
|
||||||
} else {
|
} else {
|
||||||
//请求成功
|
//请求成功
|
||||||
final List<ElectronicKeyListItem> itemData = snapshot.data!;
|
itemDataList = snapshot.data!;
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@ -73,18 +70,34 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
Expanded(child: _buildMainUI(itemData)),
|
Expanded(
|
||||||
|
child: itemDataList.isEmpty
|
||||||
|
? const NoData()
|
||||||
|
: SmartRefresher(
|
||||||
|
controller: _refreshController,
|
||||||
|
onRefresh: _refresh,
|
||||||
|
onLoading: _loadMore,
|
||||||
|
header: ClassicHeader(
|
||||||
|
height: 45.h,
|
||||||
|
releaseText: '松开手刷新',
|
||||||
|
refreshingText: '刷新中',
|
||||||
|
completeText: '刷新完成',
|
||||||
|
failedText: '刷新失败',
|
||||||
|
idleText: '下拉刷新',
|
||||||
|
),
|
||||||
|
child: _buildMainUI(itemDataList),
|
||||||
|
)),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.sendElectronicKeyManagePage,
|
context, Routers.sendElectronicKeyManagePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"lockMainEntity": lockMainEntity,
|
"lockMainEntity": state.lockMainEntity.value,
|
||||||
"keyInfo": keyInfo
|
"keyInfo": state.keyInfo.value
|
||||||
}).then((val) {
|
}).then((val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
mockNetworkDataRequest();
|
logic.mockNetworkDataRequest();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -104,6 +117,30 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///加载更多函数
|
||||||
|
Future<void> _loadMore() async {
|
||||||
|
if (state.pageNum.value == 1) {
|
||||||
|
if (itemDataList.length < 10) {
|
||||||
|
_refreshController.loadComplete();
|
||||||
|
} else {
|
||||||
|
state.pageNum.value++;
|
||||||
|
await logic.mockNetworkDataRequest();
|
||||||
|
_refreshController.loadComplete();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
state.pageNum.value++;
|
||||||
|
await logic.mockNetworkDataRequest();
|
||||||
|
_refreshController.loadComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///刷新函数
|
||||||
|
Future<void> _refresh() async {
|
||||||
|
state.pageNum.value = 1;
|
||||||
|
await logic.mockNetworkDataRequest();
|
||||||
|
_refreshController.refreshCompleted();
|
||||||
|
}
|
||||||
|
|
||||||
Widget _searchWidget() {
|
Widget _searchWidget() {
|
||||||
return Container(
|
return Container(
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
@ -142,6 +179,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
Widget _buildMainUI(itemData) {
|
Widget _buildMainUI(itemData) {
|
||||||
List<ElectronicKeyListItem> getItemData = itemData;
|
List<ElectronicKeyListItem> getItemData = itemData;
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
itemCount: getItemData.length,
|
itemCount: getItemData.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
ElectronicKeyListItem indexEntity = getItemData[index];
|
ElectronicKeyListItem indexEntity = getItemData[index];
|
||||||
@ -164,7 +202,13 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
return _electronicKeyItem('images/controls_user.png',
|
return _electronicKeyItem('images/controls_user.png',
|
||||||
indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
|
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
|
||||||
arguments: {"itemData": indexEntity});
|
arguments: {"itemData": indexEntity}).then((val) {
|
||||||
|
if (val != null) {
|
||||||
|
logic.mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
@ -176,41 +220,6 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求电子钥匙列表
|
|
||||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
|
||||||
'0',
|
|
||||||
keyInfo.keyId.toString(),
|
|
||||||
'',
|
|
||||||
keyInfo.lockId.toString(),
|
|
||||||
'',
|
|
||||||
'1',
|
|
||||||
'20',
|
|
||||||
'0',
|
|
||||||
'0');
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
|
||||||
}
|
|
||||||
if (entity.data != null) {
|
|
||||||
return entity.data!.itemList;
|
|
||||||
} else {
|
|
||||||
List<ElectronicKeyListItem> dataList = [];
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//电子钥匙重置请求
|
|
||||||
Future<void> resetElectronicKeyListRequest() async {
|
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
|
||||||
.resetElectronicKey(keyInfo.lockId.toString(), '0');
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("重置电子钥匙成功啦啦啦啦啦");
|
|
||||||
Toast.show(msg: "重置成功");
|
|
||||||
mockNetworkDataRequest();
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
|
||||||
|
|
||||||
|
class ElectronicKeyListState {
|
||||||
|
final keyInfo = KeyInfos().obs;
|
||||||
|
final lockMainEntity = LockMainEntity().obs;
|
||||||
|
var pageNum = 1.obs; //请求页码
|
||||||
|
final pageSize = 20.obs; //请求每页数据条数
|
||||||
|
|
||||||
|
ElectronicKeyListState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockMainEntity.value = map["lockMainEntity"];
|
||||||
|
keyInfo.value = map["keyInfo"];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -249,10 +249,12 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.seletCountryRegionPage);
|
context, Routers.seletCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
countryCode = result['code'];
|
result as Map<String, dynamic>;
|
||||||
countryName = result['countryName'];
|
countryCode = result['code'];
|
||||||
setState(() {});
|
countryName = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
|
|||||||
@ -81,10 +81,12 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.seletCountryRegionPage);
|
context, Routers.seletCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
countryCode = result['code'];
|
result as Map<String, dynamic>;
|
||||||
countryName = result['countryName'];
|
countryCode = result['code'];
|
||||||
setState(() {});
|
countryName = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
|
||||||
|
|
||||||
class SendElectronicKeyBinding extends Bindings {
|
|
||||||
@override
|
|
||||||
void dependencies() {
|
|
||||||
Get.lazyPut(() => SendElectronicKeyLogic());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,90 +1,50 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
class SendElectronicKeyLogic extends BaseGetXController {
|
class SendElectronicKeyLogic extends BaseGetXController {
|
||||||
final SendElectronicKeyState state = SendElectronicKeyState();
|
final SendElectronicKeyState state = SendElectronicKeyState();
|
||||||
final stateMyLogic = Get.put(SendElectronicKeyLogic()).state;
|
|
||||||
|
|
||||||
void sendElectronicKey() async {
|
//发送钥匙请求
|
||||||
// String getFailureDateTime = '0';
|
Future<void> sendElectronicKeyRequest() async {
|
||||||
// String getEffectiveDateTime = '0';
|
String getFailureDateTime = '0';
|
||||||
// String getKeyType = (int.parse(state.keyType) + 1).toString();
|
String getEffectiveDateTime = '0';
|
||||||
|
String lockID = state.keyInfo.value.lockId.toString();
|
||||||
// if (state.keyType == '1') {
|
String getKeyType = (int.parse(state.type.value) + 1).toString();
|
||||||
// getFailureDateTime = DateTime.fromMillisecondsSinceEpoch(
|
if (state.type.value == '0') {
|
||||||
// int.parse(state.failureDate.value) * 1000)
|
getFailureDateTime =
|
||||||
// .toString()
|
state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||||
// .substring(0, 19);
|
getEffectiveDateTime =
|
||||||
// getEffectiveDateTime = DateTime.fromMillisecondsSinceEpoch(
|
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
||||||
// int.parse(state.effectiveDate.value) * 1000)
|
}
|
||||||
// .toString()
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
// .substring(0, 19);
|
state.isCreateUser.value ? "1" : "0",
|
||||||
// }
|
state.countryCode.value,
|
||||||
// var entity = await ApiRepository.to.sendElectronicKey(
|
'1',
|
||||||
// '0',
|
getFailureDateTime,
|
||||||
// '0',
|
state.isAuthentication.value == true ? '1' : '2',
|
||||||
// '1',
|
'2',
|
||||||
// getFailureDateTime,
|
state.isRemoteUnlock.value == true ? '1' : '2',
|
||||||
// state.isRealName == true ? '1' : '2',
|
state.keyNameController.text,
|
||||||
// '2',
|
'0',
|
||||||
// state.isRemoteUnlock == true ? '1' : '2',
|
getKeyType,
|
||||||
// state.keyNameController.text,
|
lockID,
|
||||||
// '1',
|
'',
|
||||||
// getKeyType,
|
state.emailOrPhoneController.text,
|
||||||
// '28',
|
'',
|
||||||
// '小吴副号',
|
getEffectiveDateTime,
|
||||||
// emailOrPhoneController.text,
|
state.weekdaysList);
|
||||||
// '0',
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// getEffectiveDateTime, []);
|
print('发送电子钥匙成功');
|
||||||
// if (entity.errorCode!.codeIsSuccessful) {
|
state.isSendSuccess.value = true;
|
||||||
// // print('发送电子钥匙成功');
|
} else {
|
||||||
// }
|
Toast.show(msg: '${entity.errorMsg}');
|
||||||
// var entity = await ApiRepository.to.sendElectronicKey(
|
if (entity.errorCode == 425) {
|
||||||
// '0',
|
//用户未注册
|
||||||
// '0',
|
state.isCreateUser.value = true;
|
||||||
// '1',
|
sendElectronicKeyRequest();
|
||||||
// state.failureDate,
|
}
|
||||||
// state.isRealName == true ? '1' : '2',
|
}
|
||||||
// '2',
|
|
||||||
// state.isRemoteUnlock == true ? '1' : '2',
|
|
||||||
// state.emailOrPhoneController.text,
|
|
||||||
// '1',
|
|
||||||
// '0',
|
|
||||||
// '28',
|
|
||||||
// '小吴副号',
|
|
||||||
// '18682150237',
|
|
||||||
// '0',
|
|
||||||
// '0', []);
|
|
||||||
// if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
// print('发送电子钥匙成功');
|
|
||||||
// Get.back();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void checkNext(TextEditingController controller) {
|
|
||||||
// changeInput(controller);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void changeInput(TextEditingController controller) {
|
|
||||||
// if (controller == state.emailOrPhoneController) {
|
|
||||||
// state.emailOrPhone.value = controller.text;
|
|
||||||
// }
|
|
||||||
// if (controller == state.keyNameController) {
|
|
||||||
// state.keyName.value = controller.text;
|
|
||||||
// }
|
|
||||||
// _resetCanNext();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void _resetCanNext() {
|
|
||||||
// state.canNext.value = state.isEmailOrPhoneOK && state.isKeyNameOK;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// void onClose() {
|
|
||||||
// state.onClose();
|
|
||||||
// super.onClose();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'package:date_format/date_format.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_pickers/pickers.dart';
|
import 'package:flutter_pickers/pickers.dart';
|
||||||
@ -7,7 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
@ -27,60 +26,25 @@ class SendElectronicKeyPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
final logic = Get.put(SendElectronicKeyLogic());
|
||||||
late Contact _contact;
|
final state = Get.find<SendElectronicKeyLogic>().state;
|
||||||
late KeyInfos keyInfo;
|
|
||||||
late LockMainEntity lockMainEntity;
|
|
||||||
|
|
||||||
// final logic = Get.put(SendElectronicKeyLogic());
|
|
||||||
// final state = Get.find<SendElectronicKeyLogic>().state;
|
|
||||||
|
|
||||||
bool _isRemoteUnlock = false; //是否允许远程开锁
|
|
||||||
bool _isAuthentication = false; //是否可以实名认证
|
|
||||||
String _selectEffectiveDate = ''; //生效时间
|
|
||||||
String _selectFailureDate = ''; //失效时间
|
|
||||||
late DateTime _effectiveDateTime;
|
|
||||||
late DateTime _failureDateTime;
|
|
||||||
TextEditingController emailOrPhoneController =
|
|
||||||
TextEditingController(); //邮箱/手机号输入框
|
|
||||||
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
|
||||||
late bool _isSendSuccess;
|
|
||||||
String countryName = '中国';
|
|
||||||
String countryCode = '86';
|
|
||||||
List weekdaysList = [];
|
|
||||||
bool _isCreateUser = false; //用户未注册时传1 已注册传0
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
DateTime dateTime = DateTime.now();
|
|
||||||
_effectiveDateTime = dateTime;
|
|
||||||
_failureDateTime = dateTime;
|
|
||||||
_selectEffectiveDate = formatDate(
|
|
||||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
|
||||||
_selectFailureDate = formatDate(
|
|
||||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
|
||||||
_isSendSuccess = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
state.type.value = widget.type;
|
||||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
|
||||||
lockMainEntity = obj["lockMainEntity"];
|
|
||||||
}
|
|
||||||
if (obj != null && (obj["keyInfo"] != null)) {
|
|
||||||
keyInfo = obj["keyInfo"];
|
|
||||||
}
|
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: indexChangeWidget(),
|
child: Obx(() => indexChangeWidget()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
if (_isSendSuccess) {
|
if (state.isSendSuccess.value == true) {
|
||||||
return sendElectronicKeySucceed();
|
return sendElectronicKeySucceed();
|
||||||
} else {
|
} else {
|
||||||
switch (int.parse(widget.type)) {
|
switch (int.parse(widget.type)) {
|
||||||
@ -159,7 +123,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
rightWidget: Text(
|
rightWidget: Text(
|
||||||
'$countryName +$countryCode',
|
'${state.countryName.value} +${state.countryCode.value}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
@ -167,10 +131,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.seletCountryRegionPage);
|
context, Routers.seletCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
countryCode = result['code'];
|
result as Map<String, dynamic>;
|
||||||
countryName = result['countryName'];
|
state.countryCode.value = result['code'];
|
||||||
setState(() {});
|
state.countryName.value = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -190,30 +156,32 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: _selectEffectiveDate,
|
rightTitle: state.selectEffectiveDate.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectEffectiveDate =
|
state.selectEffectiveDate.value =
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'${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(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: _selectFailureDate,
|
rightTitle: state.selectFailureDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectFailureDate =
|
state.selectFailureDate.value =
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
'${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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -249,12 +217,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.electronicKeyPeriodValidityPage);
|
context, Routers.electronicKeyPeriodValidityPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
weekdaysList = result['validityValue'];
|
result as Map<String, dynamic>;
|
||||||
_effectiveDateTime = result['starDate'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
_failureDateTime = result['endDate'];
|
state.effectiveDateTime.value = result['starDate'];
|
||||||
print(
|
state.failureDateTime.value = result['endDate'];
|
||||||
'得到的有效期数据:$weekdaysList $_effectiveDateTime $_failureDateTime');
|
}
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
@ -285,17 +253,19 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
//发送钥匙请求
|
//发送钥匙请求
|
||||||
if (emailOrPhoneController.text.isNotEmpty &&
|
if (state.emailOrPhoneController.text.isNotEmpty &&
|
||||||
keyNameController.text.isNotEmpty) {
|
state.keyNameController.text.isNotEmpty) {
|
||||||
if (int.parse(widget.type) == 0) {
|
if (int.parse(widget.type) == 0) {
|
||||||
//失效时间大于生效时间
|
//失效时间大于生效时间
|
||||||
if (_failureDateTime.compareTo(_effectiveDateTime) == 1) {
|
if (state.failureDateTime.value
|
||||||
sendElectronicKeyRequest();
|
.compareTo(state.effectiveDateTime.value) ==
|
||||||
|
1) {
|
||||||
|
logic.sendElectronicKeyRequest();
|
||||||
} else {
|
} else {
|
||||||
Toast.show(msg: '失效时间需大于生效时间');
|
Toast.show(msg: '失效时间需大于生效时间');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sendElectronicKeyRequest();
|
logic.sendElectronicKeyRequest();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.show(msg: '请完善信息');
|
Toast.show(msg: '请完善信息');
|
||||||
@ -324,48 +294,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送钥匙请求
|
|
||||||
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',
|
|
||||||
_isRemoteUnlock == true ? '1' : '2',
|
|
||||||
keyNameController.text,
|
|
||||||
'0',
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
// 发送电子钥匙成功
|
||||||
Widget sendElectronicKeySucceed() {
|
Widget sendElectronicKeySucceed() {
|
||||||
return Column(
|
return Column(
|
||||||
@ -408,7 +336,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '完成',
|
btnName: '完成',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
_isSendSuccess = false;
|
state.isSendSuccess.value = false;
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -443,7 +371,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
||||||
Future<void> updateRoomCheckIn() async {
|
Future<void> updateRoomCheckIn() async {
|
||||||
var entity = await ApiRepository.to
|
var entity = await ApiRepository.to
|
||||||
.updateSetting(keyInfo.lockId.toString(), '1', '13');
|
.updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("标记为已入住成功啦啦啦啦啦");
|
print("标记为已入住成功啦啦啦啦啦");
|
||||||
Toast.show(msg: "标记成功");
|
Toast.show(msg: "标记成功");
|
||||||
@ -462,8 +390,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller:
|
controller: lineIndex == 1
|
||||||
lineIndex == 1 ? emailOrPhoneController : keyNameController,
|
? state.emailOrPhoneController
|
||||||
|
: state.keyNameController,
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
// controller: _controller,
|
// controller: _controller,
|
||||||
@ -496,9 +425,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Contact? currentContact =
|
Contact? currentContact =
|
||||||
await _contactPicker.selectContact();
|
await state.contactPicker.selectContact();
|
||||||
setState(() {
|
setState(() {
|
||||||
_contact = currentContact!;
|
state.contact = currentContact!;
|
||||||
// print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}");
|
// print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -532,13 +461,14 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: isRemote ? _isRemoteUnlock : _isAuthentication,
|
value:
|
||||||
|
isRemote ? state.isRemoteUnlock.value : state.isAuthentication.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (isRemote) {
|
if (isRemote) {
|
||||||
_isRemoteUnlock = value;
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
} else {
|
} else {
|
||||||
_isAuthentication = value;
|
state.isAuthentication.value = !state.isAuthentication.value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,29 +1,41 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
|
|
||||||
class SendElectronicKeyState {
|
class SendElectronicKeyState {
|
||||||
// var emailOrPhone = ''.obs;
|
TextEditingController emailOrPhoneController =
|
||||||
// var keyName = ''.obs;
|
TextEditingController(); //邮箱/手机号输入框
|
||||||
// var effectiveDate = ''.obs; //生效时间
|
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||||
// var failureDate = ''.obs; //失效时间
|
|
||||||
// var isRemoteUnlock = false; //远程开锁
|
|
||||||
// var isRealName = false; //实名认证
|
|
||||||
// var keyType = '1'; //钥匙类型 限期1,永久2,单次3,循环4
|
|
||||||
// var canNext = false.obs;
|
|
||||||
|
|
||||||
// bool get isEmailOrPhoneOK => emailOrPhone.value.isNotEmpty;
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||||
// bool get isKeyNameOK => keyName.value.isNotEmpty;
|
late Contact contact;
|
||||||
|
final keyInfo = KeyInfos().obs;
|
||||||
|
final lockMainEntity = LockMainEntity().obs;
|
||||||
|
|
||||||
// TextEditingController emailOrPhoneController =
|
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||||
// TextEditingController(); //邮箱/手机号输入框
|
final isAuthentication = false.obs; //是否可以实名认证
|
||||||
// TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
DateTime dateTime = DateTime.now();
|
||||||
// SendElectronicKeyState() {
|
final effectiveDateTime = DateTime.now().obs;
|
||||||
// emailOrPhoneController.text = emailOrPhone.value;
|
final failureDateTime = DateTime.now().obs;
|
||||||
// keyNameController.text = keyName.value;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void onClose() {
|
var selectEffectiveDate =
|
||||||
// emailOrPhoneController.dispose();
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||||
// keyNameController.dispose();
|
.obs; //默认为当前时间
|
||||||
// }
|
var selectFailureDate =
|
||||||
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||||
|
.obs; //默认为当前时间
|
||||||
|
|
||||||
|
var type = ''.obs;
|
||||||
|
var isSendSuccess = false.obs;
|
||||||
|
var countryName = '中国'.obs;
|
||||||
|
var countryCode = '86'.obs;
|
||||||
|
var weekdaysList = [].obs;
|
||||||
|
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||||
|
|
||||||
|
SendElectronicKeyState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockMainEntity.value = map["lockMainEntity"];
|
||||||
|
keyInfo.value = map["keyInfo"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,6 +199,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
deletePwdRequest();
|
deletePwdRequest();
|
||||||
|
Navigator.pop(context, true);
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -280,13 +281,9 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||||
Future<void> deletePwdRequest() async {
|
Future<void> deletePwdRequest() async {
|
||||||
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||||
itemData.lockId.toString(), itemData.keyboardPwdId.toString(), '1');
|
itemData.lockId.toString(), itemData.keyboardPwdId.toString(), 1);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("删除密码成功");
|
|
||||||
Toast.show(msg: "删除成功");
|
Toast.show(msg: "删除成功");
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,8 +311,9 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title:
|
title: inputController == _inputNameController
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}"
|
||||||
|
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
tipTitle: "请输入",
|
tipTitle: "请输入",
|
||||||
controller: inputController,
|
controller: inputController,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
@ -331,81 +329,4 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void showCupertinoAlertDialog(
|
|
||||||
BuildContext context, TextEditingController inputController) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return Card(
|
|
||||||
color: const Color(0x00FFFFFF),
|
|
||||||
child: CupertinoAlertDialog(
|
|
||||||
title: Text(
|
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.password!.tr}"),
|
|
||||||
content: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
height: 80.h,
|
|
||||||
// color: Colors.white,
|
|
||||||
margin: EdgeInsets.all(10.w),
|
|
||||||
child: TextField(
|
|
||||||
controller: inputController,
|
|
||||||
//输入框一行
|
|
||||||
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,
|
|
||||||
//不需要输入框下划线
|
|
||||||
border: InputBorder.none,
|
|
||||||
//左边图标设置
|
|
||||||
// icon: Padding(
|
|
||||||
// padding: EdgeInsets.only(top:30.w, bottom: 20.w, right: 20.w, left: 20.w),
|
|
||||||
// child: Image.asset('images/main/icon_main_search.png', width: 40.w, height: 40.w,),
|
|
||||||
// ),
|
|
||||||
// //右边图标设置
|
|
||||||
// suffixIcon: GestureDetector(
|
|
||||||
// onTap: () {
|
|
||||||
// //addPostFrameCallback是 StatefulWidge 渲染结束的回调,只会被调用一次
|
|
||||||
// // SchedulerBinding.instance.addPostFrameCallback((_) {
|
|
||||||
// // _controller.text = "";
|
|
||||||
// // });
|
|
||||||
// },
|
|
||||||
// child: Padding(
|
|
||||||
// padding: EdgeInsets.all(8),
|
|
||||||
// child: Image.asset('images/main/icon_main_cell.png', width: 50.w, height: 50.w,),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
|
||||||
onPressed: () {
|
|
||||||
updatePwdRequest();
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,56 @@
|
|||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
|
class PasswordKeyListLogic extends BaseGetXController {
|
||||||
|
final PasswordKeyListState state = PasswordKeyListState();
|
||||||
|
|
||||||
|
//请求密码钥匙列表
|
||||||
|
Future<List<PasswordKeyListItem>> mockNetworkDataRequest() async {
|
||||||
|
PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList(
|
||||||
|
'0',
|
||||||
|
state.keyInfo.value.lockId.toString(),
|
||||||
|
'0',
|
||||||
|
state.pageNum.toString(),
|
||||||
|
state.pageSize.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("密码钥匙列表成功:${entity.data?.itemList}");
|
||||||
|
}
|
||||||
|
if (entity.data != null) {
|
||||||
|
return entity.data!.itemList!;
|
||||||
|
} else {
|
||||||
|
List<PasswordKeyListItem> dataList = [];
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//密码钥匙重置请求
|
||||||
|
Future<void> resetPasswordKeyListRequest() async {
|
||||||
|
PasswordKeyListEntity entity = await ApiRepository.to
|
||||||
|
.keyboardPwdReset(state.keyInfo.value.lockId.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("重置电子钥匙成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "重置成功");
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,12 +1,11 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/toast.dart';
|
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
@ -21,18 +20,20 @@ class PasswordKeyListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||||
late KeyInfos keyInfo;
|
final logic = Get.put(PasswordKeyListLogic());
|
||||||
late LockMainEntity lockMainEntity;
|
final state = Get.find<PasswordKeyListLogic>().state;
|
||||||
|
late List<PasswordKeyListItem> _itemDataList = [];
|
||||||
|
|
||||||
|
late RefreshController _refreshController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_refreshController = RefreshController(initialRefresh: true);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
|
||||||
lockMainEntity = obj["lockMainEntity"];
|
|
||||||
}
|
|
||||||
if (obj != null && (obj["keyInfo"] != null)) {
|
|
||||||
keyInfo = obj["keyInfo"];
|
|
||||||
}
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -46,13 +47,13 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
resetPasswordKeyListRequest();
|
showCupertinoDialogStyle();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: FutureBuilder<List<PasswordKeyListItem>>(
|
body: FutureBuilder<List<PasswordKeyListItem>>(
|
||||||
future: mockNetworkDataRequest(),
|
future: logic.mockNetworkDataRequest(),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<List<PasswordKeyListItem>> snapshot) {
|
AsyncSnapshot<List<PasswordKeyListItem>> snapshot) {
|
||||||
//请求结束
|
//请求结束
|
||||||
@ -62,7 +63,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
return const Text('请求失败');
|
return const Text('请求失败');
|
||||||
} else {
|
} else {
|
||||||
//请求成功
|
//请求成功
|
||||||
final List<PasswordKeyListItem> itemData = snapshot.data!;
|
_itemDataList = snapshot.data!;
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@ -70,7 +71,25 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
Expanded(child: _buildMainUI(itemData)),
|
Expanded(
|
||||||
|
child: _itemDataList.isEmpty
|
||||||
|
? const NoData()
|
||||||
|
: SmartRefresher(
|
||||||
|
controller: _refreshController,
|
||||||
|
onRefresh: _refresh,
|
||||||
|
onLoading: _loadMore,
|
||||||
|
enablePullUp: true,
|
||||||
|
enablePullDown: true,
|
||||||
|
header: ClassicHeader(
|
||||||
|
height: 45.h,
|
||||||
|
releaseText: '松开手刷新',
|
||||||
|
refreshingText: '刷新中',
|
||||||
|
completeText: '刷新完成',
|
||||||
|
failedText: '刷新失败',
|
||||||
|
idleText: '下拉刷新',
|
||||||
|
),
|
||||||
|
child: _buildMainUI(_itemDataList),
|
||||||
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
@ -80,11 +99,11 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.passwordKeyManagePage,
|
context, Routers.passwordKeyManagePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"lockMainEntity": lockMainEntity,
|
"lockMainEntity": state.lockMainEntity.value,
|
||||||
"keyInfo": keyInfo
|
"keyInfo": state.keyInfo.value
|
||||||
}).then((val) {
|
}).then((val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
mockNetworkDataRequest();
|
logic.mockNetworkDataRequest();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -103,31 +122,28 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求密码钥匙列表
|
///加载更多函数
|
||||||
Future<List<PasswordKeyListItem>> mockNetworkDataRequest() async {
|
Future<void> _loadMore() async {
|
||||||
PasswordKeyListEntity entity = await ApiRepository.to
|
if (state.pageNum.value == 1) {
|
||||||
.passwordKeyList('0', keyInfo.lockId.toString(), '0', '1', '20');
|
if (_itemDataList.length < 10) {
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
_refreshController.loadComplete();
|
||||||
print("密码钥匙列表成功:${entity.data?.itemList}");
|
} else {
|
||||||
}
|
state.pageNum.value++;
|
||||||
if (entity.data != null) {
|
await logic.mockNetworkDataRequest();
|
||||||
return entity.data!.itemList!;
|
_refreshController.loadComplete();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
List<PasswordKeyListItem> dataList = [];
|
state.pageNum.value++;
|
||||||
return dataList;
|
await logic.mockNetworkDataRequest();
|
||||||
|
_refreshController.loadComplete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//密码钥匙重置请求
|
///刷新函数
|
||||||
Future<void> resetPasswordKeyListRequest() async {
|
Future<void> _refresh() async {
|
||||||
PasswordKeyListEntity entity =
|
state.pageNum.value = 1;
|
||||||
await ApiRepository.to.resetPasswordKey(keyInfo.lockId.toString(), '0');
|
await logic.mockNetworkDataRequest();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
_refreshController.refreshCompleted();
|
||||||
print("重置电子钥匙成功啦啦啦啦啦");
|
|
||||||
Toast.show(msg: "重置成功");
|
|
||||||
mockNetworkDataRequest();
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _searchWidget() {
|
Widget _searchWidget() {
|
||||||
@ -300,4 +316,47 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showCupertinoDialogStyle() async {
|
||||||
|
var result = await showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: const Text(''),
|
||||||
|
content: Text(
|
||||||
|
"该锁的密码钥匙都将被删除",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w700),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CupertinoButton(
|
||||||
|
child: Text(
|
||||||
|
"取消",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoButton(
|
||||||
|
child: Text(
|
||||||
|
"重置",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
logic.resetPasswordKeyListRequest();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
|
|
||||||
|
class PasswordKeyListState {
|
||||||
|
final keyInfo = KeyInfos().obs;
|
||||||
|
final lockMainEntity = LockMainEntity().obs;
|
||||||
|
var pageNum = 1.obs; //请求页码
|
||||||
|
final pageSize = 20.obs; //请求每页数据条数
|
||||||
|
|
||||||
|
PasswordKeyListState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockMainEntity.value = map["lockMainEntity"];
|
||||||
|
keyInfo.value = map["keyInfo"];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -353,7 +353,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
// logic.senderCustomPasswords();
|
// logic.senderCustomPasswords();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int getWidgetNumber = int.parse(widget.type);
|
int getWidgetNumber = int.parse(widget.type);
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
//清空码
|
//清空码
|
||||||
getKeyType = '4';
|
getKeyType = '4';
|
||||||
}
|
}
|
||||||
if (widget.type != '0' || widget.type != '2' || widget.type != '5') {
|
if (widget.type != '0' && widget.type != '2' && widget.type != '5') {
|
||||||
getFailureDateTime =
|
getFailureDateTime =
|
||||||
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||||
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -26,13 +25,11 @@ class StarLockMainPage extends StatefulWidget {
|
|||||||
|
|
||||||
// GlobalKey<_StarLockMainPageState> starLockMainKey = GlobalKey();
|
// GlobalKey<_StarLockMainPageState> starLockMainKey = GlobalKey();
|
||||||
class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||||
|
|
||||||
final logic = Get.put(LockMainLogic());
|
final logic = Get.put(LockMainLogic());
|
||||||
final state = Get.find<LockMainLogic>().state;
|
final state = Get.find<LockMainLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: const Color(0xFFF5F5F5),
|
backgroundColor: const Color(0xFFF5F5F5),
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -77,17 +74,21 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getDataReturnUI(int type){
|
Widget getDataReturnUI(int type) {
|
||||||
Widget returnWidget;
|
Widget returnWidget;
|
||||||
switch(type){
|
switch (type) {
|
||||||
case 0:
|
case 0:
|
||||||
returnWidget = unHaveData();
|
returnWidget = unHaveData();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
returnWidget = LockDetailPage(lockMainEntity: logic.state.lockMainEntity.value, isFrist: true, keyInfo:logic.state.lockMainEntity.value.data!.keyInfos![0]);
|
returnWidget = LockDetailPage(
|
||||||
|
lockMainEntity: logic.state.lockMainEntity.value,
|
||||||
|
isFrist: true,
|
||||||
|
keyInfo: logic.state.lockMainEntity.value.data!.keyInfos![0]);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
returnWidget = LockListPage(lockMainEntity:logic.state.lockMainEntity.value);
|
returnWidget =
|
||||||
|
LockListPage(lockMainEntity: logic.state.lockMainEntity.value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
returnWidget = unHaveData();
|
returnWidget = unHaveData();
|
||||||
@ -104,7 +105,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: 330.w,
|
width: 330.w,
|
||||||
height: 330.w,
|
height: 330.w,
|
||||||
// decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
// border: Border.all(width: 4.w, color: AppColors.mainColor),
|
// border: Border.all(width: 4.w, color: AppColors.mainColor),
|
||||||
|
|||||||
@ -265,7 +265,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
deviceNo:"123456",
|
deviceNo:"123456",
|
||||||
// lockUserNo:userNo.toString(),
|
// lockUserNo:userNo.toString(),
|
||||||
lockUserNo:"1234",
|
lockUserNo:"1234",
|
||||||
pwdTimestamp:"11223344"
|
pwdTimestamp:DateTime.now().millisecondsSinceEpoch.toString()
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
|
|||||||
88
star_lock/lib/mine/mine/safeVerify/safeVerify_logic.dart
Normal file
88
star_lock/lib/mine/mine/safeVerify/safeVerify_logic.dart
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:get/get_core/src/get_main.dart';
|
||||||
|
import 'package:get/get_navigation/src/extension_navigation.dart';
|
||||||
|
import 'package:get/get_utils/get_utils.dart';
|
||||||
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
|
import 'package:star_lock/mine/mine/safeVerify/safeVerify_state.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
|
class SafeVerifyLogic extends BaseGetXController {
|
||||||
|
final SafeVerifyState state = SafeVerifyState();
|
||||||
|
|
||||||
|
late Timer _timer;
|
||||||
|
void _startTimer() {
|
||||||
|
_timer = Timer.periodic(1.seconds, (timer) {
|
||||||
|
if (state.currentSecond > 1) {
|
||||||
|
state.currentSecond--;
|
||||||
|
} else {
|
||||||
|
_cancelTimer();
|
||||||
|
state.currentSecond = state.totalSeconds;
|
||||||
|
}
|
||||||
|
state.resetResend();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _cancelTimer() {
|
||||||
|
_timer.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取验证码请求
|
||||||
|
void sendValidationCode() async {
|
||||||
|
var entity = await ApiRepository.to.sendValidationCode(
|
||||||
|
"+86",
|
||||||
|
state.loginData.value.mobile!,
|
||||||
|
'1',
|
||||||
|
state.codeType.value,
|
||||||
|
"B748F838-94EE-4BDB-A0E6-7B2D16849792",
|
||||||
|
state.xWidth.value.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
_startTimer();
|
||||||
|
} else {}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除账号请求
|
||||||
|
Future<void> userLogoutRequest() async {
|
||||||
|
LoginEntity entity = await ApiRepository.to.userLogout();
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: '验证成功,账号已删除');
|
||||||
|
//删除账号成功,
|
||||||
|
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkNext(TextEditingController controller) {
|
||||||
|
changeInput(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
void changeInput(TextEditingController controller) {
|
||||||
|
if (controller == state.codeController) {
|
||||||
|
state.verificationCode.value = controller.text;
|
||||||
|
}
|
||||||
|
_resetCanSub();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _resetCanSub() {
|
||||||
|
state.canSub.value = state.codeIsOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
super.onReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
state.initLoginData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
101
star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart
Normal file
101
star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/mine/mine/safeVerify/safeVerify_logic.dart';
|
||||||
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
|
import 'package:star_lock/tools/titleAppBar.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class SafeVerifyPage extends StatefulWidget {
|
||||||
|
const SafeVerifyPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SafeVerifyPage> createState() => _SafeVerifyPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SafeVerifyPageState extends State<SafeVerifyPage> {
|
||||||
|
final logic = Get.put(SafeVerifyLogic());
|
||||||
|
final state = Get.find<SafeVerifyLogic>().state;
|
||||||
|
String mobilePhone = '';
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
|
backgroundColor: const Color(0xFFFFFFFF),
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.safeVerify!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: safeVerifyColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget safeVerifyColumn() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 60.h,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 60.w, right: 60.w),
|
||||||
|
height: 60.h,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white, borderRadius: BorderRadius.circular(30.w)),
|
||||||
|
child: TextField(
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
controller: state.codeController,
|
||||||
|
autofocus: false,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.only(left: 5, top: -8, bottom: 6),
|
||||||
|
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp, height: 1.0),
|
||||||
|
//不需要输入框下划线
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.h,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 200.w,
|
||||||
|
child: SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.getVerificationCode!.tr,
|
||||||
|
onClick: () {
|
||||||
|
logic.sendValidationCode();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 60.h,
|
||||||
|
),
|
||||||
|
Obx(() => Padding(
|
||||||
|
padding: EdgeInsets.only(left: 60.w, right: 60.w),
|
||||||
|
child: Text(
|
||||||
|
'请点击获取验证码,验证码将发送到${state.loginData.value.mobile}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 120.h,
|
||||||
|
),
|
||||||
|
Obx(() => SubmitBtn(
|
||||||
|
btnName: '验证',
|
||||||
|
isDisabled: state.canSub.value,
|
||||||
|
onClick: () {
|
||||||
|
logic.userLogoutRequest();
|
||||||
|
},
|
||||||
|
))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
60
star_lock/lib/mine/mine/safeVerify/safeVerify_state.dart
Normal file
60
star_lock/lib/mine/mine/safeVerify/safeVerify_state.dart
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginData.dart';
|
||||||
|
import 'package:star_lock/login/seletCountryRegion/common/index.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class SafeVerifyState {
|
||||||
|
final TextEditingController codeController = TextEditingController();
|
||||||
|
|
||||||
|
static int currentTimeMillis() {
|
||||||
|
return DateTime.now().millisecondsSinceEpoch;
|
||||||
|
}
|
||||||
|
|
||||||
|
var countryCode = '+86'.obs;
|
||||||
|
var countryId = '9'.obs;
|
||||||
|
var codeType = '5'.obs;
|
||||||
|
var verificationCode = ''.obs;
|
||||||
|
var xWidth = ''.obs; // 滑动验证码滑动位置
|
||||||
|
var canSub = false.obs;
|
||||||
|
var date = currentTimeMillis().toString().obs;
|
||||||
|
|
||||||
|
bool get codeIsOK => verificationCode.value.isNotEmpty;
|
||||||
|
|
||||||
|
var canResend = false.obs;
|
||||||
|
var btnText = ''.obs;
|
||||||
|
var totalSeconds = 120;
|
||||||
|
var currentSecond = 120;
|
||||||
|
|
||||||
|
final loginData = LoginData().obs;
|
||||||
|
|
||||||
|
///本地存储 登录信息
|
||||||
|
void saveLoginData(LoginData? data) async {
|
||||||
|
print("saveLoginData:${data!.mobile}");
|
||||||
|
await Storage.setString('userLoginData', jsonEncode(data));
|
||||||
|
loginData.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
///初始化本地数据
|
||||||
|
void initLoginData() async {
|
||||||
|
final data = await Storage.getString('userLoginData');
|
||||||
|
print("getLoginData:$data");
|
||||||
|
if (data != null && data.isNotEmpty) {
|
||||||
|
loginData.value = LoginData.fromJson(jsonDecode(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SafeVerifyState() {
|
||||||
|
resetResend();
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetResend() {
|
||||||
|
canResend.value = totalSeconds == currentSecond;
|
||||||
|
btnText.value = !canResend.value
|
||||||
|
? '$currentSecond s'
|
||||||
|
: btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void onClose() {}
|
||||||
|
}
|
||||||
@ -1,9 +1,18 @@
|
|||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
|
||||||
import '../../tools/baseGetXController.dart';
|
import '../../tools/baseGetXController.dart';
|
||||||
import 'starLockMine_state.dart';
|
import 'starLockMine_state.dart';
|
||||||
|
|
||||||
class StarLockMineLogic extends BaseGetXController {
|
class StarLockMineLogic extends BaseGetXController {
|
||||||
final StarLockMineState state = StarLockMineState();
|
final StarLockMineState state = StarLockMineState();
|
||||||
|
|
||||||
|
//删除账号请求
|
||||||
|
Future<void> userLogoutRequest() async {
|
||||||
|
LoginEntity entity = await ApiRepository.to.userLogout();
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
print("ready home");
|
print("ready home");
|
||||||
@ -23,5 +32,4 @@ class StarLockMineLogic extends BaseGetXController {
|
|||||||
print("close home");
|
print("close home");
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -272,10 +272,12 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.seletCountryRegionPage);
|
context, Routers.seletCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
countryCode = result['code'];
|
result as Map<String, dynamic>;
|
||||||
countryName = result['countryName'];
|
countryCode = result['code'];
|
||||||
setState(() {});
|
countryName = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart';
|
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart';
|
||||||
|
import 'package:star_lock/tools/showIosTipView.dart';
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/commonItem.dart';
|
import '../../../tools/commonItem.dart';
|
||||||
@ -240,7 +241,9 @@ class _MineSetPageState extends State<MineSetPage> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
|
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
showCupertinoAlertDialog(context);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -252,6 +255,25 @@ class _MineSetPageState extends State<MineSetPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowIosTipView(
|
||||||
|
title: "",
|
||||||
|
tipTitle: TranslationLoader.lanKeys!.deleteAccountTips!.tr,
|
||||||
|
sureClick: () {
|
||||||
|
//安全验证
|
||||||
|
Navigator.pushNamed(context, Routers.safeVerifyPage);
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
CupertinoSwitch _isPrompToneSwitch() {
|
CupertinoSwitch _isPrompToneSwitch() {
|
||||||
return CupertinoSwitch(
|
return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
|||||||
@ -45,7 +45,9 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
Visibility(
|
Visibility(
|
||||||
visible: state.isFromType.value == 2 ? true : false,
|
visible: state.isFromType.value == 2 ? true : false,
|
||||||
child: _buildRemoveBadLockBtn()),
|
child: _buildRemoveBadLockBtn()),
|
||||||
SizedBox(height: 64.h,)
|
SizedBox(
|
||||||
|
height: 64.h,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -53,19 +55,27 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return Obx(() => Column(
|
return Obx(() => Column(
|
||||||
children: [
|
children: [
|
||||||
_electronicKeyItem(state.type.value == 1 ? 'images/select_circle.png' : 'images/normal_circle.png', "个人用户", () {
|
_electronicKeyItem(
|
||||||
setState(() {
|
state.type.value == 1
|
||||||
state.type.value = 1;
|
? 'images/select_circle.png'
|
||||||
});
|
: 'images/normal_circle.png',
|
||||||
}),
|
"个人用户", () {
|
||||||
_electronicKeyItem(state.type.value == 2 ? 'images/select_circle.png' : 'images/normal_circle.png', "星寓", () {
|
setState(() {
|
||||||
setState(() {
|
state.type.value = 1;
|
||||||
state.type.value = 2;
|
});
|
||||||
});
|
}),
|
||||||
})
|
_electronicKeyItem(
|
||||||
],
|
state.type.value == 2
|
||||||
));
|
? 'images/select_circle.png'
|
||||||
|
: 'images/normal_circle.png',
|
||||||
|
"星寓", () {
|
||||||
|
setState(() {
|
||||||
|
state.type.value = 2;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(
|
Widget _electronicKeyItem(
|
||||||
@ -110,26 +120,39 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 40.w,),
|
SizedBox(
|
||||||
Text('账号', style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
width: 40.w,
|
||||||
|
),
|
||||||
|
Text('账号',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: state.numberController,
|
controller: state.numberController,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
onChanged: (value) {},
|
onChanged: (value) {},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintText: state.type.value == 1 ? "请输入手机号或email" : "请输入星寓管理员的账号",
|
hintText:
|
||||||
hintStyle: TextStyle(
|
state.type.value == 1 ? "请输入手机号或email" : "请输入星寓管理员的账号",
|
||||||
color: AppColors.placeholderTextColor,
|
hintStyle: TextStyle(
|
||||||
fontSize: ScreenUtil().setSp(22),
|
color: AppColors.placeholderTextColor,
|
||||||
textBaseline: TextBaseline.alphabetic),
|
fontSize: ScreenUtil().setSp(22),
|
||||||
),
|
textBaseline: TextBaseline.alphabetic),
|
||||||
|
),
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 20.w,),
|
SizedBox(
|
||||||
Image.asset('images/icon_addressBook.png', width: 28.w, height: 28.h,),
|
width: 20.w,
|
||||||
SizedBox(width: 40.w,)
|
),
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_addressBook.png',
|
||||||
|
width: 28.w,
|
||||||
|
height: 28.h,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 40.w,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Divider(
|
Divider(
|
||||||
@ -147,16 +170,18 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
rightWidget: Text(
|
rightWidget: Text(
|
||||||
'${state.countryName.value} +${state.countryCode.value}',
|
'${state.countryName.value} +${state.countryCode.value}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style:
|
style: TextStyle(
|
||||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
),
|
),
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.seletCountryRegionPage);
|
context, Routers.seletCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
if (result != null) {
|
||||||
state.countryCode.value = result['code'];
|
result as Map<String, dynamic>;
|
||||||
state.countryName.value = result['countryName'];
|
state.countryCode.value = result['code'];
|
||||||
setState(() {});
|
state.countryName.value = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -177,41 +202,43 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNextBtn(BuildContext context) {
|
Widget _buildNextBtn(BuildContext context) {
|
||||||
return SubmitBtn(btnName: '下一步', onClick: () {
|
return SubmitBtn(
|
||||||
if(state.numberController.text.isEmpty){
|
btnName: '下一步',
|
||||||
Toast.show(msg: "请输入手机号或email");
|
onClick: () {
|
||||||
return;
|
if (state.numberController.text.isEmpty) {
|
||||||
}
|
Toast.show(msg: "请输入手机号或email");
|
||||||
if(state.isFromType.value == 1){
|
return;
|
||||||
// 转移智能锁
|
}
|
||||||
if(state.type.value == 1){
|
if (state.isFromType.value == 1) {
|
||||||
logic.transferLockConfirmInfoData((v){
|
// 转移智能锁
|
||||||
showCupertinoAlertDialog(context, v);
|
if (state.type.value == 1) {
|
||||||
});
|
logic.transferLockConfirmInfoData((v) {
|
||||||
}else{
|
showCupertinoAlertDialog(context, v);
|
||||||
Get.toNamed(Routers.selectBranchPage, arguments: {
|
});
|
||||||
"idList":state.idList.value,
|
} else {
|
||||||
"countryCode":state.countryCode.value,
|
Get.toNamed(Routers.selectBranchPage, arguments: {
|
||||||
"number":state.numberController.text,
|
"idList": state.idList.value,
|
||||||
"isFromType":state.isFromType.value,
|
"countryCode": state.countryCode.value,
|
||||||
});
|
"number": state.numberController.text,
|
||||||
}
|
"isFromType": state.isFromType.value,
|
||||||
}else{
|
});
|
||||||
// 转移网关
|
}
|
||||||
if(state.type.value == 1){
|
} else {
|
||||||
logic.transferGateWayConfirmInfoData((v){
|
// 转移网关
|
||||||
showCupertinoAlertDialog(context, v);
|
if (state.type.value == 1) {
|
||||||
});
|
logic.transferGateWayConfirmInfoData((v) {
|
||||||
}else{
|
showCupertinoAlertDialog(context, v);
|
||||||
Get.toNamed(Routers.selectBranchPage, arguments: {
|
});
|
||||||
"idList":state.idList.value,
|
} else {
|
||||||
"countryCode":state.countryCode.value,
|
Get.toNamed(Routers.selectBranchPage, arguments: {
|
||||||
"number":state.numberController.text,
|
"idList": state.idList.value,
|
||||||
"isFromType":state.isFromType.value
|
"countryCode": state.countryCode.value,
|
||||||
});
|
"number": state.numberController.text,
|
||||||
}
|
"isFromType": state.isFromType.value
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRemoveBadLockBtn() {
|
Widget _buildRemoveBadLockBtn() {
|
||||||
@ -219,30 +246,35 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
children: [
|
children: [
|
||||||
const Expanded(child: SizedBox()),
|
const Expanded(child: SizedBox()),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {},
|
||||||
|
child: Text(
|
||||||
},
|
'移除坏锁',
|
||||||
child: Text('移除坏锁', style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), textAlign: TextAlign.end,)),
|
style: TextStyle(
|
||||||
SizedBox(width: 10.h,)
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.h,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击确认
|
// 点击确认
|
||||||
void showCupertinoAlertDialog(BuildContext context, RecipientInformationData recipientInformationData) {
|
void showCupertinoAlertDialog(
|
||||||
|
BuildContext context, RecipientInformationData recipientInformationData) {
|
||||||
showGeneralDialog(
|
showGeneralDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierColor: Colors.black.withOpacity(.5),
|
barrierColor: Colors.black.withOpacity(.5),
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
barrierLabel: '',
|
barrierLabel: '',
|
||||||
transitionDuration: const Duration(milliseconds: 200),
|
transitionDuration: const Duration(milliseconds: 200),
|
||||||
transitionBuilder: (BuildContext context,
|
transitionBuilder: (BuildContext context, Animation<double> animation,
|
||||||
Animation<double> animation,
|
Animation<double> secondaryAnimation, Widget child) {
|
||||||
Animation<double> secondaryAnimation,
|
|
||||||
Widget child) {
|
|
||||||
return ScaleTransition(scale: animation, child: child);
|
return ScaleTransition(scale: animation, child: child);
|
||||||
},
|
},
|
||||||
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
|
pageBuilder: (BuildContext context, Animation<double> animation,
|
||||||
|
Animation<double> secondaryAnimation) {
|
||||||
// recipientInformationData.nickname = "张三张三张三";
|
// recipientInformationData.nickname = "张三张三张三";
|
||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -254,27 +286,35 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Text("转移确认", style: TextStyle(fontSize: 24.sp)),
|
Text("转移确认", style: TextStyle(fontSize: 24.sp)),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Image.asset('images/icon_lockGroup_item.png', width: 70.h, height: 70.h, fit: BoxFit.fill),
|
Image.asset('images/icon_lockGroup_item.png',
|
||||||
|
width: 70.h, height: 70.h, fit: BoxFit.fill),
|
||||||
SizedBox(height: 15.h),
|
SizedBox(height: 15.h),
|
||||||
Stack(
|
Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(recipientInformationData.nickname!, style: TextStyle(fontSize: 22.sp)),
|
Text(recipientInformationData.nickname!,
|
||||||
Positioned(
|
style: TextStyle(fontSize: 22.sp)),
|
||||||
left: (recipientInformationData.nickname!.length*19.w).w,
|
Positioned(
|
||||||
child: Container(
|
left: (recipientInformationData.nickname!.length * 19.w)
|
||||||
width: 80.w,
|
.w,
|
||||||
color: Colors.red,
|
child: Container(
|
||||||
child: Center(child: Text(state.type.value == 1 ? "个人用户" : "星寓", style: TextStyle(fontSize: 18.sp, color: Colors.white))),
|
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),
|
SizedBox(height: 8.h),
|
||||||
Text(recipientInformationData.userid!, style: TextStyle(fontSize: 22.sp)),
|
Text(recipientInformationData.userid!,
|
||||||
|
style: TextStyle(fontSize: 22.sp)),
|
||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8.h),
|
||||||
Text("本次共转移${state.idList.value.length}把智能锁", style: TextStyle(fontSize: 20.sp)),
|
Text("本次共转移${state.idList.value.length}把智能锁",
|
||||||
|
style: TextStyle(fontSize: 20.sp)),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
@ -297,10 +337,10 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
if(state.isFromType.value == 1){
|
if (state.isFromType.value == 1) {
|
||||||
// 转移智能锁 transferGatewayInfoData
|
// 转移智能锁 transferGatewayInfoData
|
||||||
logic.transferLockInfoData();
|
logic.transferLockInfoData();
|
||||||
}else{
|
} else {
|
||||||
// 转移网关
|
// 转移网关
|
||||||
logic.transferGatewayInfoData();
|
logic.transferGatewayInfoData();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ abstract class Api {
|
|||||||
// final String baseUrl = "https://lock.star-lock.cn/api"; // 测试环境
|
// final String baseUrl = "https://lock.star-lock.cn/api"; // 测试环境
|
||||||
// final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; //曾工
|
// final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; //曾工
|
||||||
final String baseUrl = "http://192.168.56.101:8099/api"; //曾工本地
|
final String baseUrl = "http://192.168.56.101:8099/api"; //曾工本地
|
||||||
|
// final String baseUrl = "http://192.168.1.14:8099/api"; //葛工开发环境地址
|
||||||
|
|
||||||
// 登录注册
|
// 登录注册
|
||||||
final String getVerificationCodeUrl = '/user/sendValidationCode';
|
final String getVerificationCodeUrl = '/user/sendValidationCode';
|
||||||
@ -25,7 +26,7 @@ abstract class Api {
|
|||||||
'/key/modifyKeyNameForAdmin'; //编辑电子钥匙名字
|
'/key/modifyKeyNameForAdmin'; //编辑电子钥匙名字
|
||||||
final String updateKeyDateURL = '/key/updateKeyDate'; //编辑电子钥匙的有效期、有效时间、有效日
|
final String updateKeyDateURL = '/key/updateKeyDate'; //编辑电子钥匙的有效期、有效时间、有效日
|
||||||
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //密码钥匙列表
|
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //密码钥匙列表
|
||||||
final String passwordKeyResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
final String keyboardPwdResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
||||||
final String deleteElectronicKeyURL = '/key/delete'; //删除电子钥匙
|
final String deleteElectronicKeyURL = '/key/delete'; //删除电子钥匙
|
||||||
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //删除密码
|
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //删除密码
|
||||||
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
||||||
@ -117,4 +118,6 @@ abstract class Api {
|
|||||||
final String setAppUnlockMustOnlineURL =
|
final String setAppUnlockMustOnlineURL =
|
||||||
'/room/setAppUnlockMustOnline'; //APP开锁时需手机联网的锁
|
'/room/setAppUnlockMustOnline'; //APP开锁时需手机联网的锁
|
||||||
final String userLogoutURL = '/user/logout'; //退出登录
|
final String userLogoutURL = '/user/logout'; //退出登录
|
||||||
|
final String deleteAccountURL = '/user/delete'; //删除账号
|
||||||
|
final String getUserInfoURL = '/user/getUserInfo'; //获取个人信息
|
||||||
}
|
}
|
||||||
|
|||||||
@ -439,7 +439,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> deleteKeyboardPwd(
|
Future<Response> deleteKeyboardPwd(
|
||||||
String lockId, String keyboardPwdId, String deleteType) =>
|
String lockId, String keyboardPwdId, int deleteType) =>
|
||||||
post(
|
post(
|
||||||
deleteKeyboardPwdURL.toUrl,
|
deleteKeyboardPwdURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -943,78 +943,56 @@ class ApiProvider extends BaseProvider {
|
|||||||
|
|
||||||
// 获取转移锁锁列表
|
// 获取转移锁锁列表
|
||||||
Future<Response> getTransferLockListData() =>
|
Future<Response> getTransferLockListData() =>
|
||||||
post(
|
post(transferLockListURL.toUrl, jsonEncode({}));
|
||||||
transferLockListURL.toUrl,
|
|
||||||
jsonEncode({})
|
|
||||||
);
|
|
||||||
|
|
||||||
// 转移智能锁确认
|
// 转移智能锁确认
|
||||||
Future<Response> transferLockConfirmInfoData(
|
Future<Response> transferLockConfirmInfoData(
|
||||||
String receiverUserid,
|
String receiverUserid, String type, String countryCode) =>
|
||||||
String type,
|
|
||||||
String countryCode) =>
|
|
||||||
post(
|
post(
|
||||||
transferLockConfirmURL.toUrl,
|
transferLockConfirmURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverUserid': receiverUserid,
|
'receiverUserid': receiverUserid,
|
||||||
'type': type,
|
'type': type,
|
||||||
'countryCode': countryCode
|
'countryCode': countryCode
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// 转移智能锁
|
// 转移智能锁
|
||||||
Future<Response> transferLockInfoData(
|
Future<Response> transferLockInfoData(
|
||||||
String receiverUserid,
|
String receiverUserid, List lockIdList, String countryCode) =>
|
||||||
List lockIdList,
|
|
||||||
String countryCode) =>
|
|
||||||
post(
|
post(
|
||||||
transferLockURL.toUrl,
|
transferLockURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverUserid': receiverUserid,
|
'receiverUserid': receiverUserid,
|
||||||
'lockIdList': lockIdList,
|
'lockIdList': lockIdList,
|
||||||
'countryCode': countryCode
|
'countryCode': countryCode
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// 获取网关列表
|
// 获取网关列表
|
||||||
Future<Response> getGatewayListData(
|
Future<Response> getGatewayListData(String pageNo, String pageSize) => post(
|
||||||
String pageNo,
|
gatewaykListURL.toUrl,
|
||||||
String pageSize) =>
|
jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}));
|
||||||
post(
|
|
||||||
gatewaykListURL.toUrl,
|
|
||||||
jsonEncode({
|
|
||||||
'pageNo': pageNo,
|
|
||||||
'pageSize': pageSize
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// 转移网关确认
|
// 转移网关确认
|
||||||
Future<Response> transferGatewayConfirmInfoData(
|
Future<Response> transferGatewayConfirmInfoData(
|
||||||
String receiverUserid,
|
String receiverUserid, String type, String countryCode) =>
|
||||||
String type,
|
|
||||||
String countryCode) =>
|
|
||||||
post(
|
post(
|
||||||
transferGatewayConfirmURL.toUrl,
|
transferGatewayConfirmURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverUserid': receiverUserid,
|
'receiverUserid': receiverUserid,
|
||||||
'type': type,
|
'type': type,
|
||||||
'countryCode': countryCode
|
'countryCode': countryCode
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// 转移网关
|
// 转移网关
|
||||||
Future<Response> transferGatewayInfoData(
|
Future<Response> transferGatewayInfoData(
|
||||||
String receiverUserid,
|
String receiverUserid, List plugIdList, String countryCode) =>
|
||||||
List plugIdList,
|
|
||||||
String countryCode) =>
|
|
||||||
post(
|
post(
|
||||||
transferGatewayURL.toUrl,
|
transferGatewayURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverUserid': receiverUserid,
|
'receiverUserid': receiverUserid,
|
||||||
'plugIdList': plugIdList,
|
'plugIdList': plugIdList,
|
||||||
'countryCode': countryCode
|
'countryCode': countryCode
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
Future<Response> listLockByGroup(String type, String keyGroupId) => post(
|
Future<Response> listLockByGroup(String type, String keyGroupId) => post(
|
||||||
listLockByGroupURL.toUrl,
|
listLockByGroupURL.toUrl,
|
||||||
@ -1140,6 +1118,25 @@ class ApiProvider extends BaseProvider {
|
|||||||
|
|
||||||
//退出登录
|
//退出登录
|
||||||
Future<Response> userLogout() => get(userLogoutURL.toUrl);
|
Future<Response> userLogout() => get(userLogoutURL.toUrl);
|
||||||
|
|
||||||
|
//删除账号
|
||||||
|
Future<Response> deleteAccount(
|
||||||
|
String operatorUid, String uniqueid, String verificationCode) =>
|
||||||
|
post(
|
||||||
|
deleteAccountURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'operatorUid': operatorUid,
|
||||||
|
'uniqueid': uniqueid,
|
||||||
|
'verificationCode': verificationCode
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 获取个人信息
|
||||||
|
Future<Response> getUserInfo(String operatorUid) =>
|
||||||
|
post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid}));
|
||||||
|
|
||||||
|
// 重置密码钥匙
|
||||||
|
Future<Response> keyboardPwdReset(String lockId) =>
|
||||||
|
post(keyboardPwdResetURL.toUrl, jsonEncode({'lockId': lockId}));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -28,9 +28,9 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
Map<String, dynamic>? query,
|
Map<String, dynamic>? query,
|
||||||
Decoder<T>? decoder,
|
Decoder<T>? decoder,
|
||||||
Progress? uploadProgress,
|
Progress? uploadProgress,
|
||||||
bool? isUnShowLoading = false}) async {
|
bool? isUnShowLoading = false}) async {
|
||||||
// print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}");
|
// print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}");
|
||||||
if(isUnShowLoading == false) EasyLoading.show();
|
if (isUnShowLoading == false) EasyLoading.show();
|
||||||
|
|
||||||
print('哈喽请求body体为:${body}');
|
print('哈喽请求body体为:${body}');
|
||||||
var res = await super.post(url, body,
|
var res = await super.post(url, body,
|
||||||
|
|||||||
@ -440,7 +440,7 @@ class ApiRepository {
|
|||||||
|
|
||||||
//删除密码
|
//删除密码
|
||||||
Future<PasswordKeyEntity> deleteKeyboardPwd(
|
Future<PasswordKeyEntity> deleteKeyboardPwd(
|
||||||
String lockId, String keyboardPwdId, String deleteType) async {
|
String lockId, String keyboardPwdId, int deleteType) async {
|
||||||
final res =
|
final res =
|
||||||
await apiProvider.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
|
await apiProvider.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
|
||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
@ -449,7 +449,7 @@ class ApiRepository {
|
|||||||
//标记房态
|
//标记房态
|
||||||
Future<PasswordKeyEntity> updateSetting(
|
Future<PasswordKeyEntity> updateSetting(
|
||||||
String lockId, String isOn, String type) async {
|
String lockId, String isOn, String type) async {
|
||||||
final res = await apiProvider.deleteKeyboardPwd(lockId, isOn, type);
|
final res = await apiProvider.updateSetting(lockId, isOn, type);
|
||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1109,4 +1109,24 @@ class ApiRepository {
|
|||||||
receiverUserid, plugIdList, countryCode);
|
receiverUserid, plugIdList, countryCode);
|
||||||
return RecipientInformationEntity.fromJson(res.body);
|
return RecipientInformationEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//删除账号
|
||||||
|
Future<AuthorizedAdminListEntity> deleteAccount(
|
||||||
|
String operatorUid, String uniqueid, String verificationCode) async {
|
||||||
|
final res = await apiProvider.deleteAccount(
|
||||||
|
operatorUid, uniqueid, verificationCode);
|
||||||
|
return AuthorizedAdminListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取个人信息
|
||||||
|
Future<AuthorizedAdminListEntity> getUserInfo(String operatorUid) async {
|
||||||
|
final res = await apiProvider.getUserInfo(operatorUid);
|
||||||
|
return AuthorizedAdminListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置密码钥匙
|
||||||
|
Future<PasswordKeyListEntity> keyboardPwdReset(String lockId) async {
|
||||||
|
final res = await apiProvider.keyboardPwdReset(lockId);
|
||||||
|
return PasswordKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
56
star_lock/lib/tools/showCupertinoAlert.dart
Normal file
56
star_lock/lib/tools/showCupertinoAlert.dart
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
//封装一个适合我们项目的,结果返回一个 future
|
||||||
|
//颜色等受系统默认的值影响,这里面就不填写属性了,primaryColor 更新会影响到所有的默认效果
|
||||||
|
Future<bool> showCupertinoAlert({
|
||||||
|
BuildContext? context, //如果没设置全局,需要传递自己的context
|
||||||
|
String title = '',
|
||||||
|
String message = '',
|
||||||
|
confirmText = '确定',
|
||||||
|
cancelText = '取消',
|
||||||
|
isShowCancel = true,
|
||||||
|
isDestructiveConfirm = false,
|
||||||
|
isDestructiveCancel = false,
|
||||||
|
}) {
|
||||||
|
// context = context ?? DialogConfig.context;
|
||||||
|
final completer = Completer<bool>();
|
||||||
|
final actions = <CupertinoDialogAction>[
|
||||||
|
CupertinoDialogAction(
|
||||||
|
isDestructiveAction: isDestructiveConfirm,
|
||||||
|
onPressed: () {
|
||||||
|
completer.complete(true);
|
||||||
|
Navigator.of(context!).pop();
|
||||||
|
},
|
||||||
|
child: Text(confirmText),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
if (isShowCancel) {
|
||||||
|
actions.insert(
|
||||||
|
0,
|
||||||
|
CupertinoDialogAction(
|
||||||
|
isDestructiveAction: isDestructiveCancel,
|
||||||
|
onPressed: () {
|
||||||
|
completer.complete(false);
|
||||||
|
Navigator.of(context!).pop();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
cancelText,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// showCupertinoModalPopup<void>(
|
||||||
|
// context: context,
|
||||||
|
// barrierDismissible: false,
|
||||||
|
// builder: (BuildContext context) => CupertinoAlertDialog(
|
||||||
|
// title: Text(title),
|
||||||
|
// content: Padding(
|
||||||
|
// padding: const EdgeInsets.only(top: 10),
|
||||||
|
// child: Text(message),
|
||||||
|
// ),
|
||||||
|
// actions: actions,
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
return completer.future;
|
||||||
|
}
|
||||||
@ -185,7 +185,8 @@ class LanKeyEntity {
|
|||||||
this.workingHoursWereNotReleased,
|
this.workingHoursWereNotReleased,
|
||||||
this.beLate,
|
this.beLate,
|
||||||
this.leaveEarly,
|
this.leaveEarly,
|
||||||
this.noCardPunched, this.holidayInfo,
|
this.noCardPunched,
|
||||||
|
this.holidayInfo,
|
||||||
this.lanEnglish,
|
this.lanEnglish,
|
||||||
this.lanChinese,
|
this.lanChinese,
|
||||||
this.multilingual,
|
this.multilingual,
|
||||||
@ -400,7 +401,8 @@ class LanKeyEntity {
|
|||||||
this.getKey,
|
this.getKey,
|
||||||
this.getCard,
|
this.getCard,
|
||||||
this.getFingerprint,
|
this.getFingerprint,
|
||||||
});
|
this.safeVerify,
|
||||||
|
this.deleteAccountTips});
|
||||||
|
|
||||||
LanKeyEntity.fromJson(dynamic json) {
|
LanKeyEntity.fromJson(dynamic json) {
|
||||||
starLock = json['starLock'];
|
starLock = json['starLock'];
|
||||||
@ -833,6 +835,8 @@ class LanKeyEntity {
|
|||||||
getKey = json['getKey'];
|
getKey = json['getKey'];
|
||||||
getCard = json['getCard'];
|
getCard = json['getCard'];
|
||||||
getFingerprint = json['getFingerprint'];
|
getFingerprint = json['getFingerprint'];
|
||||||
|
safeVerify = json['safeVerify'];
|
||||||
|
deleteAccountTips = json['deleteAccountTips'];
|
||||||
}
|
}
|
||||||
String? starLock;
|
String? starLock;
|
||||||
String? clickUnlockAndHoldDownClose;
|
String? clickUnlockAndHoldDownClose;
|
||||||
@ -1252,6 +1256,8 @@ class LanKeyEntity {
|
|||||||
String? getKey;
|
String? getKey;
|
||||||
String? getCard;
|
String? getCard;
|
||||||
String? getFingerprint;
|
String? getFingerprint;
|
||||||
|
String? safeVerify;
|
||||||
|
String? deleteAccountTips;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final map = <String, dynamic>{};
|
final map = <String, dynamic>{};
|
||||||
@ -1682,6 +1688,8 @@ class LanKeyEntity {
|
|||||||
map['getKey'] = getKey;
|
map['getKey'] = getKey;
|
||||||
map['getCard'] = getCard;
|
map['getCard'] = getCard;
|
||||||
map['getFingerprint'] = getFingerprint;
|
map['getFingerprint'] = getFingerprint;
|
||||||
|
map['safeVerify'] = safeVerify;
|
||||||
|
map['deleteAccountTips'] = deleteAccountTips;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user