1,封装身份证信息和真实姓名输入框及确认框
2,新增更新电子钥匙实名认证信息接口对接 3,电子钥匙详情修改实名认证状态/身份证号/真实姓名的逻辑处理
This commit is contained in:
parent
7a785587db
commit
cbae36bd97
@ -829,5 +829,7 @@
|
|||||||
"发送人":"Sender",
|
"发送人":"Sender",
|
||||||
"发送时间":"Send time",
|
"发送时间":"Send time",
|
||||||
"钥匙详情":"Key details",
|
"钥匙详情":"Key details",
|
||||||
"姓名":"Name"
|
"姓名":"Name",
|
||||||
|
"发送":"Send",
|
||||||
|
"请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -857,5 +857,7 @@
|
|||||||
"发送人":"发送人",
|
"发送人":"发送人",
|
||||||
"发送时间":"发送时间",
|
"发送时间":"发送时间",
|
||||||
"钥匙详情":"钥匙详情",
|
"钥匙详情":"钥匙详情",
|
||||||
"姓名":"姓名"
|
"姓名":"姓名",
|
||||||
|
"发送":"发送",
|
||||||
|
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -860,5 +860,7 @@
|
|||||||
"发送人":"发送人",
|
"发送人":"发送人",
|
||||||
"发送时间":"发送时间",
|
"发送时间":"发送时间",
|
||||||
"钥匙详情":"钥匙详情",
|
"钥匙详情":"钥匙详情",
|
||||||
"姓名":"姓名"
|
"姓名":"姓名",
|
||||||
|
"发送":"发送",
|
||||||
|
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/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/showCupertinoAlertView.dart';
|
||||||
|
|
||||||
import '../../../../../tools/custom_bottom_sheet.dart';
|
import '../../../../../tools/custom_bottom_sheet.dart';
|
||||||
import '../../../../../tools/dateTool.dart';
|
import '../../../../../tools/dateTool.dart';
|
||||||
@ -40,14 +41,14 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
//编辑电子钥匙有效期请求 updateType 1:仅管理自己创建的用户 2:远程开锁
|
//编辑电子钥匙有效期请求 updateType 1:仅管理自己创建的用户 2:远程开锁
|
||||||
Future<void> updateKeyDateRequest(int updateType) async {
|
Future<void> updateKeyDateRequest(int updateType) async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
lockId:state.itemData.value.lockId.toString(),
|
lockId: state.itemData.value.lockId.toString(),
|
||||||
endDate:state.endDate.value.toString(),
|
endDate: state.endDate.value.toString(),
|
||||||
startDate:state.starDate.value.toString(),
|
startDate: state.starDate.value.toString(),
|
||||||
weekDays:state.itemData.value.weekDays!,
|
weekDays: state.itemData.value.weekDays!,
|
||||||
keyType:state.itemData.value.keyType!,
|
keyType: state.itemData.value.keyType!,
|
||||||
startTime:int.parse(state.starTime.value),
|
startTime: int.parse(state.starTime.value),
|
||||||
endTime:int.parse(state.endTime.value),
|
endTime: int.parse(state.endTime.value),
|
||||||
isOnlyManageSelf: state.onlyManageYouCreatesUser.value == true ? 1 : 0,
|
isOnlyManageSelf: state.onlyManageYouCreatesUser.value == true ? 1 : 0,
|
||||||
remoteEnable: state.isRemoteUnlock.value == true ? 1 : 2);
|
remoteEnable: state.isRemoteUnlock.value == true ? 1 : 2);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
@ -61,9 +62,8 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
//删除电子钥匙名称请求
|
//删除电子钥匙名称请求
|
||||||
Future<void> deleteKeyRequest(int includeUnderlings) async {
|
Future<void> deleteKeyRequest(int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
includeUnderlings: includeUnderlings
|
includeUnderlings: includeUnderlings);
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功".tr, something: () {
|
showToast("删除成功".tr, something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
@ -76,7 +76,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
//设置授权管理员
|
//设置授权管理员
|
||||||
Future<void> setAdministrator() async {
|
Future<void> setAdministrator() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.setAdministrator(
|
ElectronicKeyListEntity entity = await ApiRepository.to.setAdministrator(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功".tr, something: () {
|
showToast("设置成功".tr, something: () {
|
||||||
@ -90,7 +90,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
//取消授权管理员
|
//取消授权管理员
|
||||||
Future<void> cancelAdministrator() async {
|
Future<void> cancelAdministrator() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.cancelAdministrator(
|
ElectronicKeyListEntity entity = await ApiRepository.to.cancelAdministrator(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功".tr, something: () {
|
showToast("设置成功".tr, something: () {
|
||||||
@ -104,9 +104,8 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
//冻结
|
//冻结
|
||||||
Future<void> freezeKey(int includeUnderlings) async {
|
Future<void> freezeKey(int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
|
ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
includeUnderlings: includeUnderlings
|
includeUnderlings: includeUnderlings);
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功".tr, something: () {
|
showToast("设置成功".tr, something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
@ -119,9 +118,8 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
//取消冻结
|
//取消冻结
|
||||||
Future<void> cancelFreeze(int includeUnderlings) async {
|
Future<void> cancelFreeze(int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
|
ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
includeUnderlings: includeUnderlings
|
includeUnderlings: includeUnderlings);
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功".tr, something: () {
|
showToast("设置成功".tr, something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
@ -131,26 +129,119 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyTypeShowDateTime(){
|
//检查实名认证状态
|
||||||
|
Future<void> checkRealNameStatus(int realNameAuthStatus) async {
|
||||||
|
//打开实名认证 必须输入身份证号和真实姓名
|
||||||
|
if (realNameAuthStatus == 1) {
|
||||||
|
if (state.getRealName.value.isEmpty ||
|
||||||
|
state.getIDCardNumber.value.isEmpty) {
|
||||||
|
ShowCupertinoAlertView()
|
||||||
|
.showOpenAuthWithIDCardInfoAlert((idCard, realName) {
|
||||||
|
if (idCard.isNotEmpty && realName.isNotEmpty) {
|
||||||
|
state.getIDCardNumber.value = idCard;
|
||||||
|
state.getRealName.value = realName;
|
||||||
|
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
|
||||||
|
} else {
|
||||||
|
showToast("请输入完整信息".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新钥匙实名认证信息--实名认证状态
|
||||||
|
Future<void> updateRealNameInfoWithAuthStatus(int realNameAuthStatus) async {
|
||||||
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateRealNameInfo(
|
||||||
|
lockId: state.itemData.value.lockId ?? 0,
|
||||||
|
keyId: state.itemData.value.keyId ?? 0,
|
||||||
|
uid: state.itemData.value.uid ?? 0,
|
||||||
|
faceAuthentication: realNameAuthStatus,
|
||||||
|
realName: state.getRealName.value,
|
||||||
|
idCardNumber: state.getIDCardNumber.value);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.isRealNameAuth.value = !state.isRealNameAuth.value;
|
||||||
|
showToast("修改成功".tr, something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新钥匙实名认证信息
|
||||||
|
Future<void> updateRealNameInfoRequest(ShowAlertEnum alertEnum) async {
|
||||||
|
switch (alertEnum) {
|
||||||
|
case ShowAlertEnum.realName:
|
||||||
|
if (state.changeRealNameController.text.isEmpty) {
|
||||||
|
showToast("请输入真实姓名".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ShowAlertEnum.idCardNumber:
|
||||||
|
if (state.changeIDCardController.text.isEmpty) {
|
||||||
|
showToast("请输入身份证号".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateRealNameInfo(
|
||||||
|
lockId: state.itemData.value.lockId ?? 0,
|
||||||
|
keyId: state.itemData.value.keyId ?? 0,
|
||||||
|
uid: state.itemData.value.uid ?? 0,
|
||||||
|
faceAuthentication: state.isRealNameAuth.value ? 1 : 2,
|
||||||
|
realName: state.changeRealNameController.text,
|
||||||
|
idCardNumber: state.changeIDCardController.text);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
if (alertEnum == ShowAlertEnum.realName) {
|
||||||
|
state.itemData.value.userIdCard!.realName =
|
||||||
|
state.changeRealNameController.text;
|
||||||
|
state.getRealName.value = state.itemData.value.userIdCard!.realName!;
|
||||||
|
} else if (alertEnum == ShowAlertEnum.idCardNumber) {
|
||||||
|
state.itemData.value.userIdCard!.idCardNumber =
|
||||||
|
state.changeIDCardController.text;
|
||||||
|
state.getIDCardNumber.value =
|
||||||
|
state.itemData.value.userIdCard!.idCardNumber!;
|
||||||
|
}
|
||||||
|
showToast("修改成功".tr, something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getKeyTypeShowDateTime() {
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
if(state.keyType.value == 1){
|
if (state.keyType.value == 1) {
|
||||||
useDateStr = "永久".tr;
|
useDateStr = "永久".tr;
|
||||||
}else if(state.keyType.value == 2){
|
} else if (state.keyType.value == 2) {
|
||||||
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
useDateStr =
|
||||||
}else if(state.keyType.value == 3){
|
"${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
|
} else if (state.keyType.value == 3) {
|
||||||
useDateStr = "单次".tr;
|
useDateStr = "单次".tr;
|
||||||
}else if(state.keyType.value == 4){
|
} else if (state.keyType.value == 4) {
|
||||||
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
useDateStr =
|
||||||
|
"${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
}
|
}
|
||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future openModalBottomSheet(BuildContext context) async {
|
Future openModalBottomSheet(BuildContext context) async {
|
||||||
var textList = <String>[];
|
var textList = <String>[];
|
||||||
if(state.keyType.value == 1 || state.keyType.value == 2){
|
if (state.keyType.value == 1 || state.keyType.value == 2) {
|
||||||
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr, state.itemData.value.keyRight == 1 ? '取消授权'.tr : '授权'.tr];
|
textList = [
|
||||||
} else if(state.keyType.value == 4){
|
state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr,
|
||||||
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr];
|
state.itemData.value.keyRight == 1 ? '取消授权'.tr : '授权'.tr
|
||||||
|
];
|
||||||
|
} else if (state.keyType.value == 4) {
|
||||||
|
textList = [
|
||||||
|
state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr
|
||||||
|
];
|
||||||
}
|
}
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@ -162,40 +253,46 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
items: textList,
|
items: textList,
|
||||||
chooseCallback: (value) {
|
chooseCallback: (value) {
|
||||||
int index = value;
|
int index = value;
|
||||||
if(index == 0){
|
if (index == 0) {
|
||||||
if(state.itemData.value.keyStatus == 110405){
|
if (state.itemData.value.keyStatus == 110405) {
|
||||||
// 取消冻结
|
// 取消冻结
|
||||||
if(state.itemData.value.keyRight == 1){
|
if (state.itemData.value.keyRight == 1) {
|
||||||
// 管理员
|
// 管理员
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙'.tr, (isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||||
|
'同时解冻其发送的钥匙'.tr, (isAllData) {
|
||||||
cancelFreeze(isAllData ? 1 : 0);
|
cancelFreeze(isAllData ? 1 : 0);
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效".tr, (){
|
ShowTipView()
|
||||||
|
.showIosTipWithContentDialog("取消冻结会在用户APP连网后生效".tr, () {
|
||||||
cancelFreeze(0);
|
cancelFreeze(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(state.itemData.value.keyRight == 1){
|
if (state.itemData.value.keyRight == 1) {
|
||||||
// 管理员
|
// 管理员
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时冻结其发送的钥匙'.tr, (isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||||
|
'同时冻结其发送的钥匙'.tr, (isAllData) {
|
||||||
freezeKey(isAllData ? 1 : 0);
|
freezeKey(isAllData ? 1 : 0);
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效".tr, (){
|
ShowTipView()
|
||||||
|
.showIosTipWithContentDialog("冻结会在用户APP连网后生效".tr, () {
|
||||||
freezeKey(0);
|
freezeKey(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
// 取消/授权管理员
|
// 取消/授权管理员
|
||||||
if(state.itemData.value.keyRight == 1){
|
if (state.itemData.value.keyRight == 1) {
|
||||||
// 管理员
|
// 管理员
|
||||||
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效".tr, (){
|
ShowTipView()
|
||||||
|
.showIosTipWithContentDialog("取消授权会在用户APP连网后生效".tr, () {
|
||||||
cancelAdministrator();
|
cancelAdministrator();
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码".tr, (){
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
"授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码".tr, () {
|
||||||
setAdministrator();
|
setAdministrator();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -205,20 +302,38 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deletKeyLogic(){
|
deletKeyLogic() {
|
||||||
if(state.itemData.value.keyRight == 1){
|
if (state.itemData.value.keyRight == 1) {
|
||||||
// 授权管理员
|
// 授权管理员
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||||
|
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
|
||||||
deleteKeyRequest(isAllData ? 1 : 0);
|
deleteKeyRequest(isAllData ? 1 : 0);
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
// 普通用户
|
// 普通用户
|
||||||
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){
|
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr, () {
|
||||||
deleteKeyRequest(0);
|
deleteKeyRequest(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextEditingController getCurrentController(ShowAlertEnum alertEnum) {
|
||||||
|
TextEditingController currentController = TextEditingController();
|
||||||
|
switch (alertEnum) {
|
||||||
|
case ShowAlertEnum.name:
|
||||||
|
currentController = state.changeNameController;
|
||||||
|
break;
|
||||||
|
case ShowAlertEnum.realName:
|
||||||
|
currentController = state.changeRealNameController;
|
||||||
|
break;
|
||||||
|
case ShowAlertEnum.idCardNumber:
|
||||||
|
currentController = state.changeIDCardController;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
return currentController;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -2,7 +2,9 @@ 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:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
|
||||||
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -14,6 +16,8 @@ import '../../../../../tools/showTFView.dart';
|
|||||||
import '../../../../../tools/submitBtn.dart';
|
import '../../../../../tools/submitBtn.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
|
|
||||||
|
enum ShowAlertEnum { name, realName, idCardNumber }
|
||||||
|
|
||||||
class ElectronicKeyDetailPage extends StatefulWidget {
|
class ElectronicKeyDetailPage extends StatefulWidget {
|
||||||
const ElectronicKeyDetailPage({Key? key}) : super(key: key);
|
const ElectronicKeyDetailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@ -57,8 +61,33 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(
|
||||||
|
tipsTitle: "修改姓名".tr, alertEnum: ShowAlertEnum.name);
|
||||||
})),
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.isRealNameAuth.value,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: '真实姓名'.tr,
|
||||||
|
rightTitle: state.getRealName.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
showCupertinoAlertDialog(
|
||||||
|
tipsTitle: "修改真实姓名".tr,
|
||||||
|
alertEnum: ShowAlertEnum.realName);
|
||||||
|
}))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.isRealNameAuth.value,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: '身份证'.tr,
|
||||||
|
rightTitle: state.getIDCardNumber.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
showCupertinoAlertDialog(
|
||||||
|
tipsTitle: "修改身份证号".tr,
|
||||||
|
alertEnum: ShowAlertEnum.idCardNumber);
|
||||||
|
}))),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '有效期'.tr,
|
leftTitel: '有效期'.tr,
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
@ -184,31 +213,31 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(
|
||||||
width: 60.w, child: _onlyManageYouCreatesUserSwitch())),
|
width: 60.w, child: _onlyManageYouCreatesUserSwitch())),
|
||||||
),
|
),
|
||||||
Visibility(
|
Obx(
|
||||||
// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
|
() => Visibility(
|
||||||
visible:
|
// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
|
||||||
CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock ==
|
visible: CommonDataManage()
|
||||||
|
.currentKeyInfo
|
||||||
|
.lockSetting!
|
||||||
|
.remoteUnlock ==
|
||||||
1 &&
|
1 &&
|
||||||
state.itemData.value.keyRight != 1
|
state.itemData.value.keyRight != 1
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: "远程开锁".tr,
|
leftTitel: "远程开锁".tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
rightWidget:
|
rightWidget: SizedBox(
|
||||||
SizedBox(width: 60.w, child: _remoteUnlockingSwitch())),
|
width: 60.w, child: _remoteUnlockingSwitch()))),
|
||||||
),
|
),
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '实名认证'.tr,
|
leftTitel: '实名认证'.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
rightWidget:
|
||||||
width: 60.w,
|
SizedBox(width: 60.w, child: _realNameAuthSwitch()))),
|
||||||
child: _switch(state.itemData.value.faceAuthentication == 1
|
|
||||||
? true
|
|
||||||
: false))),
|
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: '操作记录'.tr,
|
leftTitel: '操作记录'.tr,
|
||||||
@ -221,31 +250,36 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 40.h),
|
Container(height: 40.h),
|
||||||
SubmitBtn(
|
Container(
|
||||||
btnName: '删除'.tr,
|
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
borderRadius: 20.w,
|
child: SubmitBtn(
|
||||||
isDelete: true,
|
btnName: '删除'.tr,
|
||||||
margin: EdgeInsets.only(
|
borderRadius: 20.w,
|
||||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
isDelete: true,
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
margin: EdgeInsets.only(
|
||||||
onClick: () {
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
logic.deletKeyLogic();
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
}),
|
onClick: () {
|
||||||
|
logic.deletKeyLogic();
|
||||||
|
}),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CupertinoSwitch _switch(isOn) {
|
CupertinoSwitch _realNameAuthSwitch() {
|
||||||
return CupertinoSwitch(
|
return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: isOn,
|
value: state.isRealNameAuth.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
if (!state.isRealNameAuth.value) {
|
||||||
isOn = value;
|
logic.checkRealNameStatus(1);
|
||||||
});
|
} else {
|
||||||
|
logic.checkRealNameStatus(2);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -257,10 +291,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: state.isRemoteUnlock.value,
|
value: state.isRemoteUnlock.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
logic.updateKeyDateRequest(2);
|
||||||
logic.updateKeyDateRequest(2);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -281,18 +313,20 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
void showCupertinoAlertDialog(
|
||||||
|
{required String tipsTitle, required ShowAlertEnum alertEnum}) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title: "修改姓名".tr,
|
title: tipsTitle,
|
||||||
tipTitle: "请输入".tr,
|
tipTitle: "请输入".tr,
|
||||||
controller: state.changeNameController,
|
controller: logic.getCurrentController(alertEnum),
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
if (alertEnum == ShowAlertEnum.name) {
|
||||||
if (state.changeNameController.text.isNotEmpty) {
|
|
||||||
logic.modifyKeyNameRequest();
|
logic.modifyKeyNameRequest();
|
||||||
|
} else {
|
||||||
|
logic.updateRealNameInfoRequest(alertEnum);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
|
|||||||
@ -2,24 +2,28 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
|
||||||
import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
|
||||||
|
|
||||||
class ElectronicKeyDetailState {
|
class ElectronicKeyDetailState {
|
||||||
final itemData = ElectronicKeyListItem().obs;
|
final itemData = ElectronicKeyListItem().obs;
|
||||||
// final keyInfo = LockListInfoItemEntity().obs;
|
// final keyInfo = LockListInfoItemEntity().obs;
|
||||||
|
|
||||||
final keyName = "".obs;
|
final keyName = "".obs;
|
||||||
final TextEditingController changeNameController = TextEditingController();
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
final TextEditingController changeRealNameController =
|
||||||
|
TextEditingController();
|
||||||
|
final TextEditingController changeIDCardController = TextEditingController();
|
||||||
|
|
||||||
var starDate = "".obs;// 开始时间
|
var starDate = "".obs; // 开始时间
|
||||||
var endDate = "".obs;// 结束时间
|
var endDate = "".obs; // 结束时间
|
||||||
var starTime = "".obs;// 生效时间
|
var starTime = "".obs; // 生效时间
|
||||||
var endTime = "".obs;// 失效时间
|
var endTime = "".obs; // 失效时间
|
||||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||||
var weekDay = [].obs;// 有效日
|
var weekDay = [].obs; // 有效日
|
||||||
|
|
||||||
var onlyManageYouCreatesUser = false.obs;// 0:可以管理所有用户 1:只能管理自己创建的用户
|
var onlyManageYouCreatesUser = false.obs; // 0:可以管理所有用户 1:只能管理自己创建的用户
|
||||||
var isRemoteUnlock = false.obs; //是否允许远程开锁 0:不允许 1:允许
|
var isRemoteUnlock = false.obs; //是否允许远程开锁 0:不允许 1:允许
|
||||||
|
var isRealNameAuth = false.obs; //是否实名认证 0:不需要 1:需要
|
||||||
|
var getRealName = ''.obs; //真实姓名
|
||||||
|
var getIDCardNumber = ''.obs; //身份证号
|
||||||
|
|
||||||
ElectronicKeyDetailState() {
|
ElectronicKeyDetailState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
@ -29,9 +33,16 @@ class ElectronicKeyDetailState {
|
|||||||
// }
|
// }
|
||||||
changeNameController.text = itemData.value.keyName!;
|
changeNameController.text = itemData.value.keyName!;
|
||||||
keyName.value = itemData.value.keyName!;
|
keyName.value = itemData.value.keyName!;
|
||||||
|
if (itemData.value.userIdCard != null) {
|
||||||
|
getRealName.value = itemData.value.userIdCard!.realName ?? "";
|
||||||
|
getIDCardNumber.value = itemData.value.userIdCard!.idCardNumber ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
isRemoteUnlock.value = itemData.value.remoteEnable! == 1 ? true : false;
|
isRemoteUnlock.value = itemData.value.remoteEnable! == 1 ? true : false;
|
||||||
onlyManageYouCreatesUser.value = itemData.value.isOnlyManageSelf! == 0 ? false : true;
|
isRealNameAuth.value =
|
||||||
|
itemData.value.faceAuthentication == 1 ? true : false;
|
||||||
|
onlyManageYouCreatesUser.value =
|
||||||
|
itemData.value.isOnlyManageSelf! == 0 ? false : true;
|
||||||
|
|
||||||
starDate.value = itemData.value.startDate!.toString();
|
starDate.value = itemData.value.startDate!.toString();
|
||||||
endDate.value = itemData.value.endDate!.toString();
|
endDate.value = itemData.value.endDate!.toString();
|
||||||
|
|||||||
@ -88,30 +88,34 @@ class ElectronicKeyListItem {
|
|||||||
int? appUnlockMustOnline;
|
int? appUnlockMustOnline;
|
||||||
List? weekDays;
|
List? weekDays;
|
||||||
int? isOnlyManageSelf;
|
int? isOnlyManageSelf;
|
||||||
|
UserIdCard? userIdCard;
|
||||||
|
int? uid;
|
||||||
|
|
||||||
ElectronicKeyListItem(
|
ElectronicKeyListItem({
|
||||||
{this.keyId,
|
this.keyId,
|
||||||
this.lockId,
|
this.lockId,
|
||||||
this.username,
|
this.username,
|
||||||
this.lockName,
|
this.lockName,
|
||||||
this.lockAlias,
|
this.lockAlias,
|
||||||
this.userType,
|
this.userType,
|
||||||
this.keyName,
|
this.keyName,
|
||||||
this.keyStatus,
|
this.keyStatus,
|
||||||
this.startDate,
|
this.startDate,
|
||||||
this.endDate,
|
this.endDate,
|
||||||
this.keyRight,
|
this.keyRight,
|
||||||
this.keyType,
|
this.keyType,
|
||||||
this.senderUsername,
|
this.senderUsername,
|
||||||
this.remarks,
|
this.remarks,
|
||||||
this.isCameraEnable,
|
this.isCameraEnable,
|
||||||
this.faceAuthentication,
|
this.faceAuthentication,
|
||||||
this.sendDate,
|
this.sendDate,
|
||||||
this.remoteEnable,
|
this.remoteEnable,
|
||||||
this.appUnlockMustOnline,
|
this.appUnlockMustOnline,
|
||||||
this.weekDays,
|
this.weekDays,
|
||||||
this.isOnlyManageSelf
|
this.isOnlyManageSelf,
|
||||||
});
|
this.userIdCard,
|
||||||
|
this.uid,
|
||||||
|
});
|
||||||
|
|
||||||
ElectronicKeyListItem.fromJson(Map<String, dynamic> json) {
|
ElectronicKeyListItem.fromJson(Map<String, dynamic> json) {
|
||||||
keyId = json['keyId'];
|
keyId = json['keyId'];
|
||||||
@ -139,6 +143,10 @@ class ElectronicKeyListItem {
|
|||||||
appUnlockMustOnline = json['appUnlockMustOnline'];
|
appUnlockMustOnline = json['appUnlockMustOnline'];
|
||||||
isOnlyManageSelf = json['isOnlyManageSelf'];
|
isOnlyManageSelf = json['isOnlyManageSelf'];
|
||||||
json['weekDays'] != null ? weekDays = json['weekDays'] : [];
|
json['weekDays'] != null ? weekDays = json['weekDays'] : [];
|
||||||
|
json['userIdCard'] != null
|
||||||
|
? userIdCard = UserIdCard.fromJson(json['userIdCard'])
|
||||||
|
: null;
|
||||||
|
uid = json['uid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -164,6 +172,29 @@ class ElectronicKeyListItem {
|
|||||||
data['appUnlockMustOnline'] = appUnlockMustOnline;
|
data['appUnlockMustOnline'] = appUnlockMustOnline;
|
||||||
data['weekDays'] = weekDays;
|
data['weekDays'] = weekDays;
|
||||||
data['isOnlyManageSelf'] = isOnlyManageSelf;
|
data['isOnlyManageSelf'] = isOnlyManageSelf;
|
||||||
|
if (userIdCard != null) {
|
||||||
|
data['userIdCard'] = userIdCard!.toJson();
|
||||||
|
}
|
||||||
|
data['uid'] = uid;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserIdCard {
|
||||||
|
String? realName;
|
||||||
|
String? idCardNumber;
|
||||||
|
|
||||||
|
UserIdCard({this.realName, this.idCardNumber});
|
||||||
|
|
||||||
|
UserIdCard.fromJson(Map<String, dynamic> json) {
|
||||||
|
realName = json['realName'];
|
||||||
|
idCardNumber = json['idCardNumber'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['realName'] = realName;
|
||||||
|
data['idCardNumber'] = idCardNumber;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_logic.dart';
|
||||||
import 'package:star_lock/tools/ExpandedListView.dart';
|
import 'package:star_lock/tools/ExpandedListView.dart';
|
||||||
import 'package:star_lock/tools/advancedFunctionHandle.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? false : true,
|
visible: state.isVip.value ? false : true,
|
||||||
child: AdvancedFunctionHandle()
|
child: ShowCupertinoAlertView()
|
||||||
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
|
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import 'package:star_lock/app_settings/app_colors.dart';
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_logic.dart';
|
||||||
import 'package:star_lock/tools/advancedFunctionHandle.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? false : true,
|
visible: state.isVip.value ? false : true,
|
||||||
child: AdvancedFunctionHandle()
|
child: ShowCupertinoAlertView()
|
||||||
.topTipsAdvancedFeatures('开通高级功能后才可以选择和添加接收者'.tr))),
|
.topTipsAdvancedFeatures('开通高级功能后才可以选择和添加接收者'.tr))),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? true : false,
|
visible: state.isVip.value ? true : false,
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
|
||||||
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
import 'package:star_lock/tools/dateTool.dart';
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
@ -33,7 +34,6 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送钥匙请求
|
|
||||||
var startDate = "0";
|
var startDate = "0";
|
||||||
var endDate = "0";
|
var endDate = "0";
|
||||||
var startTime = "0";
|
var startTime = "0";
|
||||||
@ -91,6 +91,50 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
String getKeyType = typeValue.toString();
|
String getKeyType = typeValue.toString();
|
||||||
|
|
||||||
|
//如果打开了实名认证,需要弹出输入身份证信息框
|
||||||
|
if (state.isAuthentication.value == true) {
|
||||||
|
if (state.realNameController.text.isEmpty) {
|
||||||
|
showToast("请输入真实姓名".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.idCardController.text.isEmpty) {
|
||||||
|
showToast("请输入身份证号".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//弹出身份证信息确认框
|
||||||
|
ShowCupertinoAlertView().realNameIDCardInfoComfirmAlert(
|
||||||
|
getNameStr: state.realNameController.text,
|
||||||
|
getIDCardStr: state.idCardController.text,
|
||||||
|
onConfirm: () {
|
||||||
|
goSendElectronicKey(
|
||||||
|
startDate: startDate,
|
||||||
|
endDate: endDate,
|
||||||
|
startTime: startTime,
|
||||||
|
endTime: endTime,
|
||||||
|
typeValue: typeValue,
|
||||||
|
getKeyType: getKeyType);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
goSendElectronicKey(
|
||||||
|
startDate: startDate,
|
||||||
|
endDate: endDate,
|
||||||
|
startTime: startTime,
|
||||||
|
endTime: endTime,
|
||||||
|
typeValue: typeValue,
|
||||||
|
getKeyType: getKeyType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//只负责发起发送钥匙请求,数据已经准备好
|
||||||
|
Future<void> goSendElectronicKey({
|
||||||
|
required String startDate,
|
||||||
|
required String endDate,
|
||||||
|
required String startTime,
|
||||||
|
required String endTime,
|
||||||
|
required int typeValue,
|
||||||
|
required String getKeyType,
|
||||||
|
}) async {
|
||||||
var entity = await ApiRepository.to.sendElectronicKey(
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
createUser: state.isCreateUser == true ? "1" : "0",
|
createUser: state.isCreateUser == true ? "1" : "0",
|
||||||
countryCode: state.countryCode,
|
countryCode: state.countryCode,
|
||||||
|
|||||||
@ -326,7 +326,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
btnName: '发送'.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (logic.state.isDemoMode == false) {
|
if (logic.state.isDemoMode == false) {
|
||||||
logic.sendElectronicKeyRequest();
|
logic.sendElectronicKeyRequest();
|
||||||
@ -545,14 +545,16 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
|||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value:
|
value: isRemote
|
||||||
isRemote ? logic.state.isRemoteUnlock : logic.state.isAuthentication,
|
? logic.state.isRemoteUnlock
|
||||||
|
: logic.state.isAuthentication.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (isRemote) {
|
if (isRemote) {
|
||||||
logic.state.isRemoteUnlock = !logic.state.isRemoteUnlock;
|
logic.state.isRemoteUnlock = !logic.state.isRemoteUnlock;
|
||||||
} else {
|
} else {
|
||||||
logic.state.isAuthentication = !logic.state.isAuthentication;
|
logic.state.isAuthentication.value =
|
||||||
if (logic.state.isAuthentication) {
|
!logic.state.isAuthentication.value;
|
||||||
|
if (logic.state.isAuthentication.value == true) {
|
||||||
logic.keyCheckFace();
|
logic.keyCheckFace();
|
||||||
} else {
|
} else {
|
||||||
logic.state.isRequireAuth.value = false;
|
logic.state.isRequireAuth.value = false;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class SendElectronicKeyViewState {
|
|||||||
late Contact contact;
|
late Contact contact;
|
||||||
|
|
||||||
bool isRemoteUnlock = false; //是否允许远程开锁
|
bool isRemoteUnlock = false; //是否允许远程开锁
|
||||||
bool isAuthentication = false; //是否可以实名认证
|
var isAuthentication = false.obs; //是否可以实名认证
|
||||||
|
|
||||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(
|
var timeLimitBeginTime = DateTool().dateToYMDHNString(
|
||||||
DateTime.now().millisecondsSinceEpoch.toString()); // 限时开始时间
|
DateTime.now().millisecondsSinceEpoch.toString()); // 限时开始时间
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart';
|
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart';
|
||||||
import 'package:star_lock/tools/advancedFunctionHandle.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
import 'package:star_lock/tools/showTFView.dart';
|
import 'package:star_lock/tools/showTFView.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
@ -125,7 +125,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
|||||||
logic.addLockNoticeSetting();
|
logic.addLockNoticeSetting();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AdvancedFunctionHandle().advancedFeatureAlert();
|
ShowCupertinoAlertView().advancedFeatureAlert();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprint/coerceFingerprint_logic.dart';
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprint/coerceFingerprint_logic.dart';
|
||||||
import 'package:star_lock/tools/advancedFunctionHandle.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
@ -118,7 +118,7 @@ class _CoerceFingerprintPageState extends State<CoerceFingerprintPage> {
|
|||||||
logic.addLockNoticeSetting();
|
logic.addLockNoticeSetting();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AdvancedFunctionHandle().advancedFeatureAlert();
|
ShowCupertinoAlertView().advancedFeatureAlert();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -3,7 +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/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/tools/advancedFunctionHandle.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
@ -118,7 +118,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
|
|||||||
onClick: () async {
|
onClick: () async {
|
||||||
var isVip = await Storage.getBool(saveIsVip);
|
var isVip = await Storage.getBool(saveIsVip);
|
||||||
if (isVip == false) {
|
if (isVip == false) {
|
||||||
AdvancedFunctionHandle().advancedFeatureAlert();
|
ShowCupertinoAlertView().advancedFeatureAlert();
|
||||||
} else {
|
} else {
|
||||||
logic.lockNoticeSettingAccountList();
|
logic.lockNoticeSettingAccountList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
|
||||||
import 'package:star_lock/tools/advancedFunctionHandle.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/style/default_style.dart';
|
import 'package:star_lock/tools/pickers/style/default_style.dart';
|
||||||
@ -69,7 +69,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
|||||||
onClick: () async {
|
onClick: () async {
|
||||||
var isVip = await Storage.getBool(saveIsVip);
|
var isVip = await Storage.getBool(saveIsVip);
|
||||||
if (isVip == false) {
|
if (isVip == false) {
|
||||||
AdvancedFunctionHandle().advancedFeatureAlert();
|
ShowCupertinoAlertView().advancedFeatureAlert();
|
||||||
} else {
|
} else {
|
||||||
logic.lockNoticeSettingAccountList();
|
logic.lockNoticeSettingAccountList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
import 'package:star_lock/tools/advancedFunctionHandle.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
import '../../../../../../app_settings/app_colors.dart';
|
import '../../../../../../app_settings/app_colors.dart';
|
||||||
@ -36,7 +36,7 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? false : true,
|
visible: state.isVip.value ? false : true,
|
||||||
child: AdvancedFunctionHandle()
|
child: ShowCupertinoAlertView()
|
||||||
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
|
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.all(15.w),
|
margin: EdgeInsets.all(15.w),
|
||||||
|
|||||||
@ -221,6 +221,7 @@ abstract class Api {
|
|||||||
final String getFaceCertifyIdURL = '/service/getCertifyId'; //获取人脸认证certifyId
|
final String getFaceCertifyIdURL = '/service/getCertifyId'; //获取人脸认证certifyId
|
||||||
final String getServiceCheckCertifyURL =
|
final String getServiceCheckCertifyURL =
|
||||||
'/service/checkCertify'; //检测certifyId是否完成认证
|
'/service/checkCertify'; //检测certifyId是否完成认证
|
||||||
|
final String updateRealNameInfoURL = '/key/updateRealName'; //更新实名认证信息
|
||||||
|
|
||||||
final String getBuyRecordListURL = '/v2/service/getBuyRecordList'; //获取购买记录列表
|
final String getBuyRecordListURL = '/v2/service/getBuyRecordList'; //获取购买记录列表
|
||||||
final String getUseRecordListURL = '/v2/service/getUseRecordList'; //获取使用记录列表
|
final String getUseRecordListURL = '/v2/service/getUseRecordList'; //获取使用记录列表
|
||||||
|
|||||||
@ -236,6 +236,26 @@ class ApiProvider extends BaseProvider {
|
|||||||
'remoteEnable': remoteEnable,
|
'remoteEnable': remoteEnable,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// 更新钥匙实名认证信息
|
||||||
|
Future<Response> updateRealNameInfo(
|
||||||
|
int lockId,
|
||||||
|
int keyId,
|
||||||
|
int uid,
|
||||||
|
int faceAuthentication,
|
||||||
|
String realName,
|
||||||
|
String idCardNumber,
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
updateRealNameInfoURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'keyId': keyId,
|
||||||
|
'uid': uid,
|
||||||
|
'faceAuthentication': faceAuthentication,
|
||||||
|
'realName': realName,
|
||||||
|
'idCardNumber': idCardNumber,
|
||||||
|
}));
|
||||||
|
|
||||||
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
||||||
post(resetElectronicKeyURL.toUrl,
|
post(resetElectronicKeyURL.toUrl,
|
||||||
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||||
|
|||||||
@ -384,6 +384,19 @@ class ApiRepository {
|
|||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新钥匙实名认证信息
|
||||||
|
Future<KeyOperationRecordEntity> updateRealNameInfo(
|
||||||
|
{required int lockId,
|
||||||
|
required int keyId,
|
||||||
|
required int uid,
|
||||||
|
required int faceAuthentication,
|
||||||
|
required String realName,
|
||||||
|
required String idCardNumber}) async {
|
||||||
|
final res = await apiProvider.updateRealNameInfo(
|
||||||
|
lockId, keyId, uid, faceAuthentication, realName, idCardNumber);
|
||||||
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//密码列表
|
//密码列表
|
||||||
Future<PasswordKeyListEntity> passwordKeyList(String keyStatus, String lockId,
|
Future<PasswordKeyListEntity> passwordKeyList(String keyStatus, String lockId,
|
||||||
String pageNo, String pageSize, String searchStr) async {
|
String pageNo, String pageSize, String searchStr) async {
|
||||||
|
|||||||
@ -1,88 +0,0 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/appRouters.dart';
|
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
|
||||||
|
|
||||||
class AdvancedFunctionHandle {
|
|
||||||
//高级功能弹窗
|
|
||||||
void advancedFeatureAlert() {
|
|
||||||
showCupertinoDialog(
|
|
||||||
context: Get.context!,
|
|
||||||
builder: (context) {
|
|
||||||
return CupertinoAlertDialog(
|
|
||||||
title: Container(
|
|
||||||
margin: EdgeInsets.only(bottom: 20.h),
|
|
||||||
child: Image.asset(
|
|
||||||
'images/icon_gift.png',
|
|
||||||
width: 50.w,
|
|
||||||
height: 50.w,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
content: Text('该功能是高级功能,请开通后再使用'.tr),
|
|
||||||
actions: [
|
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text(
|
|
||||||
'取消'.tr,
|
|
||||||
style: TextStyle(color: AppColors.mainColor),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text(
|
|
||||||
'去开通'.tr,
|
|
||||||
style: TextStyle(color: AppColors.mainColor),
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
|
||||||
arguments: {'isShop': true});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//高级功能顶部提示框
|
|
||||||
Widget topTipsAdvancedFeatures(String tipsText) {
|
|
||||||
return Container(
|
|
||||||
color: AppColors.vipFeatureBgColor,
|
|
||||||
padding: EdgeInsets.only(left: 20.w),
|
|
||||||
height: 80.h,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(tipsText,
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.vipFeatureBtnTextColor, fontSize: 22.sp)),
|
|
||||||
SizedBox(
|
|
||||||
width: 10.w,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 146.w,
|
|
||||||
height: 46.h,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: AppColors.vipFeatureBtnBgColor,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
|
||||||
'isShop': true,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
'去开通'.tr,
|
|
||||||
style: TextStyle(color: Colors.white, fontSize: 22.sp),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: SizedBox(
|
|
||||||
width: 2.w,
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
223
star_lock/lib/tools/showCupertinoAlertView.dart
Normal file
223
star_lock/lib/tools/showCupertinoAlertView.dart
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
|
||||||
|
typedef AuthInfoCallback = void Function(String idCard, String name);
|
||||||
|
|
||||||
|
class ShowCupertinoAlertView {
|
||||||
|
//高级功能弹窗
|
||||||
|
void advancedFeatureAlert() {
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 20.h),
|
||||||
|
child: Image.asset(
|
||||||
|
'images/icon_gift.png',
|
||||||
|
width: 50.w,
|
||||||
|
height: 50.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
content: Text('该功能是高级功能,请开通后再使用'.tr),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(
|
||||||
|
'取消'.tr,
|
||||||
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(
|
||||||
|
'去开通'.tr,
|
||||||
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||||
|
arguments: {'isShop': true});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//高级功能顶部提示框
|
||||||
|
Widget topTipsAdvancedFeatures(String tipsText) {
|
||||||
|
return Container(
|
||||||
|
color: AppColors.vipFeatureBgColor,
|
||||||
|
padding: EdgeInsets.only(left: 20.w),
|
||||||
|
height: 80.h,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(tipsText,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.vipFeatureBtnTextColor, fontSize: 22.sp)),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 146.w,
|
||||||
|
height: 46.h,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: AppColors.vipFeatureBtnBgColor,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||||
|
'isShop': true,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'去开通'.tr,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 22.sp),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 2.w,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//发送需要实名认证的电子钥匙时身份信息确认框
|
||||||
|
void realNameIDCardInfoComfirmAlert(
|
||||||
|
{required String getNameStr,
|
||||||
|
required String getIDCardStr,
|
||||||
|
required VoidCallback onConfirm}) {
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: Text('请确认姓名全名和身份证号码是否正确'.tr),
|
||||||
|
content: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'姓名 ',
|
||||||
|
style: TextStyle(fontSize: 22.sp, color: Colors.black),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'身份证',
|
||||||
|
style: TextStyle(fontSize: 22.sp, color: Colors.black),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
getNameStr,
|
||||||
|
style: TextStyle(fontSize: 22.sp, color: Colors.black),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
getIDCardStr,
|
||||||
|
style: TextStyle(fontSize: 22.sp, color: Colors.black),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(
|
||||||
|
'取消'.tr,
|
||||||
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(
|
||||||
|
'确定'.tr,
|
||||||
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
// 执行回调函数
|
||||||
|
onConfirm();
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//打开实名认证弹出输入身份证信息框
|
||||||
|
void showOpenAuthWithIDCardInfoAlert(AuthInfoCallback callback) {
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
String idCard = '';
|
||||||
|
String name = '';
|
||||||
|
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: const Text('请输入身份证号和真实姓名'),
|
||||||
|
content: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
CupertinoTextField(
|
||||||
|
placeholder: '请输入身份证号',
|
||||||
|
onChanged: (value) {
|
||||||
|
idCard = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
CupertinoTextField(
|
||||||
|
placeholder: '请输入真实姓名',
|
||||||
|
onChanged: (value) {
|
||||||
|
name = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CupertinoDialogAction(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'取消'.tr,
|
||||||
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
onPressed: () {
|
||||||
|
// 在这里处理确认按钮的逻辑
|
||||||
|
callback(idCard, name);
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'确定'.tr,
|
||||||
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
|
||||||
import '../translations/trans_lib.dart';
|
import '../translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -70,10 +71,8 @@ class ShowTFView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(
|
child: Text(leftBtnTitle ?? TranslationLoader.lanKeys!.cancel!.tr,
|
||||||
leftBtnTitle ?? TranslationLoader.lanKeys!.cancel!.tr,
|
style: TextStyle(color: AppColors.mainColor)),
|
||||||
style: const TextStyle(color: Colors.black),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
if (cancelClick != null) {
|
if (cancelClick != null) {
|
||||||
@ -82,9 +81,8 @@ class ShowTFView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(
|
child: Text(rightBtnTitle ?? TranslationLoader.lanKeys!.sure!.tr,
|
||||||
rightBtnTitle ?? TranslationLoader.lanKeys!.sure!.tr,
|
style: TextStyle(color: AppColors.mainColor)),
|
||||||
style: const TextStyle(color: Colors.black)),
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (sureClick != null) {
|
if (sureClick != null) {
|
||||||
sureClick!();
|
sureClick!();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user