Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
# Conflicts: # star_lock/images/lan/lan_en.json # star_lock/images/lan/lan_keys.json # star_lock/images/lan/lan_zh.json
This commit is contained in:
commit
881df8cac1
@ -796,6 +796,7 @@
|
||||
"购买":"Buy",
|
||||
"实名认证为付费功能,请购买后再使用":"Real-name authentication is a paid function, please use it after purchase",
|
||||
"密码不一致哦":"The passwords are inconsistent",
|
||||
<<<<<<< HEAD
|
||||
|
||||
"退出添加":"Quit adding",
|
||||
"管理员已满":"Admin full",
|
||||
@ -809,4 +810,10 @@
|
||||
"锁上面添加密码已满": "Lock above add password is full",
|
||||
"密码已存在": "Password already exists",
|
||||
"请输入密码": "Please enter password"
|
||||
|
||||
"真实姓名":"Real name",
|
||||
"身份证号":"ID number",
|
||||
"请输入真实姓名":"Please enter your real name",
|
||||
"请输入身份证号":"Please enter your ID number"
|
||||
|
||||
}
|
||||
|
||||
@ -823,6 +823,7 @@
|
||||
"当前剩余数量":"当前剩余数量",
|
||||
"购买":"购买",
|
||||
"实名认证为付费功能,请购买后再使用":"实名认证为付费功能,请购买后再使用",
|
||||
<<<<<<< HEAD
|
||||
|
||||
"退出添加":"退出添加",
|
||||
"管理员已满":"管理员已满",
|
||||
@ -836,4 +837,10 @@
|
||||
"锁上面添加密码已满": "锁上面添加密码已满",
|
||||
"密码已存在": "密码已存在",
|
||||
"请输入密码": "请输入密码"
|
||||
|
||||
"真实姓名":"真实姓名",
|
||||
"身份证号":"身份证号",
|
||||
"请输入真实姓名":"请输入真实姓名",
|
||||
"请输入身份证号":"请输入身份证号"
|
||||
|
||||
}
|
||||
|
||||
@ -826,6 +826,7 @@
|
||||
"当前剩余数量":"当前剩余数量",
|
||||
"购买":"购买",
|
||||
"实名认证为付费功能,请购买后再使用":"实名认证为付费功能,请购买后再使用",
|
||||
<<<<<<< HEAD
|
||||
|
||||
"退出添加":"退出添加",
|
||||
"管理员已满":"管理员已满",
|
||||
@ -839,4 +840,9 @@
|
||||
"锁上面添加密码已满": "锁上面添加密码已满",
|
||||
"密码已存在": "密码已存在",
|
||||
"请输入密码": "请输入密码"
|
||||
|
||||
"真实姓名":"真实姓名",
|
||||
"身份证号":"身份证号",
|
||||
"请输入真实姓名":"请输入真实姓名",
|
||||
"请输入身份证号":"请输入身份证号"
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
username: state.emailOrPhone.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Storage.saveLoginData(entity.data);
|
||||
Storage.setBool(saveIsVip, entity.data!.isVip! == 0 ? false : true);
|
||||
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
|
||||
eventBus.fire(MineInfoChangeRefreshUI());
|
||||
// Get.back();
|
||||
// Get.toNamed(Routers.starLockMain);
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
@ -117,7 +115,8 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
if (state.seletType.value == 0) {
|
||||
getKeyType = "2";
|
||||
|
||||
startDate = DateTool().dateToTimestamp(state.beginDate.value, 1).toString();
|
||||
startDate =
|
||||
DateTool().dateToTimestamp(state.beginDate.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endDate.value, 1).toString();
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
@ -156,7 +155,9 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
weekDays: state.weekdaysList,
|
||||
startTime: int.parse(startTime),
|
||||
endTime: int.parse(endTime),
|
||||
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0);
|
||||
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0,
|
||||
realName: '',
|
||||
idCardNumber: '');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isCreateUser.value = false;
|
||||
state.isSendSuccess.value = true;
|
||||
@ -169,7 +170,9 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
//用户未注册
|
||||
state.isCreateUser.value = true;
|
||||
// _showDialog('${entity.errorMsg}');
|
||||
ShowTipView().showIosTipWithContentDialog('${"是否发送授权管理员给未注册账号".tr}\n${state.emailOrPhoneController.text}', (){
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'${"是否发送授权管理员给未注册账号".tr}\n${state.emailOrPhoneController.text}',
|
||||
() {
|
||||
sendElectronicKeyRequest();
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,14 +1,5 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
|
||||
import '../../../../../tools/showTipView.dart';
|
||||
|
||||
class SendElectronicKeyLogic extends BaseGetXController {
|
||||
final SendElectronicKeyState state = SendElectronicKeyState();
|
||||
|
||||
@ -1,28 +1,11 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../tools/NativeInteractionTool.dart';
|
||||
import '../../../../../tools/commonDataManage.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
@ -107,8 +90,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage>
|
||||
controller: state.tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => SendElectronicKeyView(
|
||||
type: item.type,
|
||||
))
|
||||
type: item.type,
|
||||
))
|
||||
.toList()),
|
||||
);
|
||||
}
|
||||
@ -119,7 +102,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage>
|
||||
ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "3"),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
|
||||
@ -1,27 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class SendElectronicKeyState {
|
||||
|
||||
late TabController tabController;
|
||||
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
|
||||
|
||||
final timeLimitTips = '接收者在有效期内可以不限次数使用'; //限时
|
||||
final permanentTips = '接收者可以使用此App开关锁'; //永久
|
||||
final onceLimitTips = '单次钥匙有效期为1小时,只能使用一次'; //单次
|
||||
final cycleLimitTips = '接收者可以在有效期内的固定时间段里,不限次数使用'; //循环
|
||||
|
||||
SendElectronicKeyState() {
|
||||
// Map map = Get.arguments;
|
||||
// if ((map["keyInfo"] != null)) {
|
||||
// keyInfo.value = map["keyInfo"];
|
||||
// }
|
||||
}
|
||||
SendElectronicKeyState() {}
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_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/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
@ -40,22 +42,20 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
switch (type) {
|
||||
case '0':
|
||||
// 限时
|
||||
if (state.timeLimitBeginTime.value.isEmpty) {
|
||||
if (state.timeLimitBeginTime.isEmpty) {
|
||||
showToast("请选择开始时间".tr);
|
||||
return;
|
||||
}
|
||||
if (state.timeLimitEndTime.value.isEmpty) {
|
||||
if (state.timeLimitEndTime.isEmpty) {
|
||||
showToast("请选择结束时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
typeValue = XSConstantMacro.keyTypeTime;
|
||||
startDate = DateTool()
|
||||
.dateToTimestamp(state.timeLimitBeginTime.value, 1)
|
||||
.toString();
|
||||
endDate = DateTool()
|
||||
.dateToTimestamp(state.timeLimitEndTime.value, 1)
|
||||
.toString();
|
||||
startDate =
|
||||
DateTool().dateToTimestamp(state.timeLimitBeginTime, 1).toString();
|
||||
endDate =
|
||||
DateTool().dateToTimestamp(state.timeLimitEndTime, 1).toString();
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
|
||||
@ -73,21 +73,17 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
break;
|
||||
case '3':
|
||||
typeValue = XSConstantMacro.keyTypeLoop;
|
||||
if (state.cycleBeginTime.value.isEmpty) {
|
||||
if (state.cycleBeginTime.isEmpty) {
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
}
|
||||
startDate = DateTool()
|
||||
.dateToTimestamp(state.cycleBeginTime.value, 1)
|
||||
.toString();
|
||||
endDate =
|
||||
DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
|
||||
startTime = DateTool()
|
||||
.dateToTimestamp(state.effectiveDateTime.value, 0)
|
||||
.toString();
|
||||
endTime = DateTool()
|
||||
.dateToTimestamp(state.failureDateTime.value, 0)
|
||||
.toString();
|
||||
startDate =
|
||||
DateTool().dateToTimestamp(state.cycleBeginTime, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.cycleEndTime, 1).toString();
|
||||
startTime =
|
||||
DateTool().dateToTimestamp(state.effectiveDateTime, 0).toString();
|
||||
endTime =
|
||||
DateTool().dateToTimestamp(state.failureDateTime, 0).toString();
|
||||
break;
|
||||
default:
|
||||
typeValue = XSConstantMacro.keyTypeTime;
|
||||
@ -96,15 +92,15 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
String getKeyType = typeValue.toString();
|
||||
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
createUser: state.isCreateUser.value == true ? "1" : "0",
|
||||
countryCode: state.countryCode.value,
|
||||
createUser: state.isCreateUser == true ? "1" : "0",
|
||||
countryCode: state.countryCode,
|
||||
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
||||
? '1'
|
||||
: '2',
|
||||
endDate: int.parse(endDate),
|
||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||
faceAuthentication: state.isAuthentication == true ? '1' : '2',
|
||||
isCameraEnable: '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock == true ? '1' : '2',
|
||||
keyNameForAdmin: state.keyNameController.text,
|
||||
keyRight: '0',
|
||||
keyType: getKeyType,
|
||||
@ -116,15 +112,23 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
weekDays: state.weekdaysList,
|
||||
startTime: int.parse(startTime),
|
||||
endTime: int.parse(endTime),
|
||||
isOnlyManageSelf: 0);
|
||||
isOnlyManageSelf: 0,
|
||||
realName: state.isRequireAuth.value == true
|
||||
? state.realNameController.text
|
||||
: "",
|
||||
idCardNumber: state.isRequireAuth.value == true
|
||||
? state.idCardController.text
|
||||
: "");
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isSendSuccess.value = true;
|
||||
state.isSendSuccess = true;
|
||||
resetData();
|
||||
update();
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
} else {
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
state.isCreateUser.value = true;
|
||||
state.isCreateUser = true;
|
||||
update();
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'${"是否发送电子钥匙给未注册账号".tr}\n${state.emailOrPhoneController.text}', () {
|
||||
sendElectronicKeyRequest();
|
||||
@ -133,6 +137,24 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//检测实名认证是否支持开启
|
||||
Future<void> keyCheckFace() async {
|
||||
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
|
||||
countryCode: int.parse(state.countryCode),
|
||||
account: state.emailOrPhoneController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
ShowTipView().showBuyTipWithContentAlert(
|
||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||
sureClick: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: {'isShop': false});
|
||||
});
|
||||
} else if (entity.errorCode! == 431) {
|
||||
//431代表改用户没有身份证信息,需要弹出输入身份证信息框
|
||||
state.isRequireAuth.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool isPhoneNumber(String input) {
|
||||
// 手机号正则表达式,这里简化为11位数字
|
||||
final RegExp phoneRegExp = RegExp(r'^\d{11}$');
|
||||
@ -146,19 +168,38 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
return emailRegExp.hasMatch(input);
|
||||
}
|
||||
|
||||
TextEditingController getCurrentController(int lineIndex) {
|
||||
TextEditingController currentController = TextEditingController();
|
||||
switch (lineIndex) {
|
||||
case 1:
|
||||
currentController = state.emailOrPhoneController;
|
||||
break;
|
||||
case 2:
|
||||
currentController = state.keyNameController;
|
||||
break;
|
||||
case 3:
|
||||
currentController = state.realNameController;
|
||||
break;
|
||||
case 4:
|
||||
currentController = state.idCardController;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return currentController;
|
||||
}
|
||||
|
||||
void resetData() {
|
||||
state.emailOrPhoneController.text = "";
|
||||
state.keyNameController.text = "";
|
||||
state.timeLimitBeginTime = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; // 限时开始时间
|
||||
state.timeLimitEndTime = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; // 限时结束时间
|
||||
state.cycleBeginTime = "".obs; // 循环开始时间
|
||||
state.cycleEndTime = "".obs; // 循环结束时间
|
||||
state.effectiveDateTime = "".obs; // 生效时间
|
||||
state.failureDateTime = "".obs; // 失效时间
|
||||
state.weekdaysList = [].obs;
|
||||
state.timeLimitBeginTime = DateTool().dateToYMDHNString(
|
||||
DateTime.now().millisecondsSinceEpoch.toString()); // 限时开始时间
|
||||
state.timeLimitEndTime = DateTool().dateToYMDHNString(
|
||||
DateTime.now().millisecondsSinceEpoch.toString()); // 限时结束时间
|
||||
state.cycleBeginTime = ""; // 循环开始时间
|
||||
state.cycleEndTime = ""; // 循环结束时间
|
||||
state.effectiveDateTime = ""; // 生效时间
|
||||
state.failureDateTime = ""; // 失效时间
|
||||
state.weekdaysList = [];
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import 'package:star_lock/tools/submitBtn.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
@ -34,70 +33,69 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return GetBuilder<SendElectronicKeyViewLogic>(
|
||||
tag: widget.type,
|
||||
init: SendElectronicKeyViewLogic(widget.type),
|
||||
builder: (SendElectronicKeyViewLogic logic) {
|
||||
return Obx(() {
|
||||
if (logic.state.isSendSuccess.value == true) {
|
||||
return sendElectronicKeySucceed(logic);
|
||||
} else {
|
||||
switch (widget.type) {
|
||||
case '0':
|
||||
// 限时
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
keyTimeWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.timeLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '1':
|
||||
// 永久
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.permanentTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '2':
|
||||
// 单次
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.onceLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '3':
|
||||
// 循环
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
keyPeriodValidityWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.cycleLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
if (logic.state.isSendSuccess == true) {
|
||||
return sendElectronicKeySucceed(logic);
|
||||
} else {
|
||||
switch (widget.type) {
|
||||
case '0':
|
||||
// 限时
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
keyTimeWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.timeLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '1':
|
||||
// 永久
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.permanentTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '2':
|
||||
// 单次
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.onceLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '3':
|
||||
// 循环
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
keyPeriodValidityWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.cycleLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -123,7 +121,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
rightWidget: Text(
|
||||
'${logic.state.countryName.value} +${logic.state.countryCode.value}',
|
||||
'${logic.state.countryName} +${logic.state.countryCode}',
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
@ -133,8 +131,9 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
context, Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
logic.state.countryCode.value = result['code'];
|
||||
logic.state.countryName.value = result['countryName'];
|
||||
logic.state.countryCode = result['code'];
|
||||
logic.state.countryName = result['countryName'];
|
||||
logic.update();
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -153,33 +152,35 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
Widget keyTimeWidget(SendElectronicKeyViewLogic logic) {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: logic.state.timeLimitBeginTime.value,
|
||||
rightTitle: logic.state.timeLimitBeginTime,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
PDuration selectDate = PDuration.parse(
|
||||
DateTime.parse(logic.state.timeLimitBeginTime.value));
|
||||
DateTime.parse(logic.state.timeLimitBeginTime));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
logic.state.timeLimitBeginTime.value =
|
||||
logic.state.timeLimitBeginTime =
|
||||
DateTool().getYMDHNDateString(p, 1);
|
||||
logic.update();
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: logic.state.timeLimitEndTime.value,
|
||||
rightTitle: logic.state.timeLimitEndTime,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
PDuration selectDate = PDuration.parse(
|
||||
DateTime.tryParse(logic.state.timeLimitEndTime.value));
|
||||
DateTime.tryParse(logic.state.timeLimitEndTime));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
logic.state.timeLimitEndTime.value =
|
||||
logic.state.timeLimitEndTime =
|
||||
DateTool().getYMDHNDateString(p, 1);
|
||||
logic.update();
|
||||
});
|
||||
})),
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
);
|
||||
@ -189,18 +190,37 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
Widget keyRealNameWidget(SendElectronicKeyViewLogic logic) {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: true,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。".tr);
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _remoteSwitch(false, logic)),
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: true,
|
||||
isHaveLine:
|
||||
logic.state.isRequireAuth.value == true ? true : false,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。".tr);
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: _remoteSwitch(false, logic)),
|
||||
)),
|
||||
Obx(() => Visibility(
|
||||
visible: logic.state.isRequireAuth.value,
|
||||
child: CommonItem(
|
||||
leftTitel: '真实姓名'.tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
isHaveLine: true,
|
||||
rightWidget: getTFWidget(false, '请输入真实姓名'.tr, 3, logic)))),
|
||||
Obx(() => Visibility(
|
||||
visible: logic.state.isRequireAuth.value,
|
||||
child: CommonItem(
|
||||
leftTitel: '身份证号'.tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: getTFWidget(false, '请输入身份证号'.tr, 4, logic)))),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -209,30 +229,31 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
Widget keyPeriodValidityWidget(SendElectronicKeyViewLogic logic) {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle:
|
||||
"${logic.state.cycleBeginTime.value}\n${logic.state.cycleEndTime.value}",
|
||||
"${logic.state.cycleBeginTime}\n${logic.state.cycleEndTime}",
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result =
|
||||
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': logic.state.weekdaysList,
|
||||
'starDate': logic.state.cycleBeginTime.value,
|
||||
'endDate': logic.state.cycleEndTime.value,
|
||||
'starTime': logic.state.effectiveDateTime.value,
|
||||
'endTime': logic.state.failureDateTime.value
|
||||
'starDate': logic.state.cycleBeginTime,
|
||||
'endDate': logic.state.cycleEndTime,
|
||||
'starTime': logic.state.effectiveDateTime,
|
||||
'endTime': logic.state.failureDateTime
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
logic.state.weekdaysList.value = result['validityValue'];
|
||||
logic.state.cycleBeginTime.value = result['starDate'];
|
||||
logic.state.cycleEndTime.value = result['endDate'];
|
||||
logic.state.effectiveDateTime.value = result['starTime'];
|
||||
logic.state.failureDateTime.value = result['endTime'];
|
||||
logic.state.weekdaysList = result['validityValue'];
|
||||
logic.state.cycleBeginTime = result['starDate'];
|
||||
logic.state.cycleEndTime = result['endDate'];
|
||||
logic.state.effectiveDateTime = result['starTime'];
|
||||
logic.state.failureDateTime = result['endTime'];
|
||||
logic.update();
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
}),
|
||||
Visibility(
|
||||
visible: logic.state.weekdaysList.isNotEmpty ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效日".tr,
|
||||
@ -243,43 +264,45 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
arguments: {
|
||||
'validityValue': logic.state.weekdaysList,
|
||||
'starDate': logic.state.cycleBeginTime.value,
|
||||
'endDate': logic.state.cycleEndTime.value,
|
||||
'starTime': logic.state.effectiveDateTime.value,
|
||||
'endTime': logic.state.failureDateTime.value
|
||||
'starDate': logic.state.cycleBeginTime,
|
||||
'endDate': logic.state.cycleEndTime,
|
||||
'starTime': logic.state.effectiveDateTime,
|
||||
'endTime': logic.state.failureDateTime
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
logic.state.weekdaysList.value = result['validityValue'];
|
||||
logic.state.cycleBeginTime.value = result['starDate'];
|
||||
logic.state.cycleEndTime.value = result['endDate'];
|
||||
logic.state.effectiveDateTime.value = result['starTime'];
|
||||
logic.state.failureDateTime.value = result['endTime'];
|
||||
logic.state.weekdaysList = result['validityValue'];
|
||||
logic.state.cycleBeginTime = result['starDate'];
|
||||
logic.state.cycleEndTime = result['endDate'];
|
||||
logic.state.effectiveDateTime = result['starTime'];
|
||||
logic.state.failureDateTime = result['endTime'];
|
||||
logic.update();
|
||||
}
|
||||
}))),
|
||||
Obx(() => Visibility(
|
||||
visible: logic.state.effectiveDateTime.value.isNotEmpty,
|
||||
})),
|
||||
Visibility(
|
||||
visible: logic.state.effectiveDateTime.isNotEmpty,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle:
|
||||
"${logic.state.effectiveDateTime.value}-${logic.state.failureDateTime.value}",
|
||||
"${logic.state.effectiveDateTime}-${logic.state.failureDateTime}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
arguments: {
|
||||
'validityValue': logic.state.weekdaysList,
|
||||
'starDate': logic.state.cycleBeginTime.value,
|
||||
'endDate': logic.state.cycleEndTime.value,
|
||||
'starTime': logic.state.effectiveDateTime.value,
|
||||
'endTime': logic.state.failureDateTime.value
|
||||
'starDate': logic.state.cycleBeginTime,
|
||||
'endDate': logic.state.cycleEndTime,
|
||||
'starTime': logic.state.effectiveDateTime,
|
||||
'endTime': logic.state.failureDateTime
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
logic.state.weekdaysList.value = result['validityValue'];
|
||||
logic.state.cycleBeginTime.value = result['starDate'];
|
||||
logic.state.cycleEndTime.value = result['endDate'];
|
||||
logic.state.effectiveDateTime.value = result['starTime'];
|
||||
logic.state.failureDateTime.value = result['endTime'];
|
||||
logic.state.weekdaysList = result['validityValue'];
|
||||
logic.state.cycleBeginTime = result['starDate'];
|
||||
logic.state.cycleEndTime = result['endDate'];
|
||||
logic.state.effectiveDateTime = result['starTime'];
|
||||
logic.state.failureDateTime = result['endTime'];
|
||||
logic.update();
|
||||
}
|
||||
}))),
|
||||
})),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -291,7 +314,6 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.w),
|
||||
child: Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
@ -316,7 +338,6 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 30.w),
|
||||
// color: Colors.red,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
@ -384,8 +405,9 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
SubmitBtn(
|
||||
btnName: '完成'.tr,
|
||||
onClick: () {
|
||||
logic.state.isSendSuccess.value = false;
|
||||
logic.state.isSendSuccess = false;
|
||||
logic.resetData();
|
||||
logic.update();
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
@ -424,9 +446,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: lineIndex == 1
|
||||
? logic.state.emailOrPhoneController
|
||||
: logic.state.keyNameController,
|
||||
controller: logic.getCurrentController(lineIndex),
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
@ -525,22 +545,17 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: isRemote
|
||||
? logic.state.isRemoteUnlock.value
|
||||
: logic.state.isAuthentication.value,
|
||||
value:
|
||||
isRemote ? logic.state.isRemoteUnlock : logic.state.isAuthentication,
|
||||
onChanged: (value) {
|
||||
if (isRemote) {
|
||||
logic.state.isRemoteUnlock.value = !logic.state.isRemoteUnlock.value;
|
||||
logic.state.isRemoteUnlock = !logic.state.isRemoteUnlock;
|
||||
} else {
|
||||
logic.state.isAuthentication.value =
|
||||
!logic.state.isAuthentication.value;
|
||||
if (logic.state.isAuthentication.value) {
|
||||
ShowTipView().showBuyTipWithContentAlert(
|
||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||
sureClick: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: {'isShop': false});
|
||||
});
|
||||
logic.state.isAuthentication = !logic.state.isAuthentication;
|
||||
if (logic.state.isAuthentication) {
|
||||
logic.keyCheckFace();
|
||||
} else {
|
||||
logic.state.isRequireAuth.value = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -3,34 +3,38 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
|
||||
class SendElectronicKeyViewState {
|
||||
TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框
|
||||
TextEditingController emailOrPhoneController =
|
||||
TextEditingController(); //邮箱/手机号输入框
|
||||
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||
TextEditingController realNameController = TextEditingController(); //真实姓名输入框
|
||||
TextEditingController idCardController = TextEditingController(); //身份证号输入框
|
||||
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
|
||||
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||
final isAuthentication = false.obs; //是否可以实名认证
|
||||
bool isRemoteUnlock = false; //是否允许远程开锁
|
||||
bool isAuthentication = false; //是否可以实名认证
|
||||
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||
var cycleBeginTime = "".obs;// 循环开始时间
|
||||
var cycleEndTime = "".obs;// 循环结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(
|
||||
DateTime.now().millisecondsSinceEpoch.toString()); // 限时开始时间
|
||||
var timeLimitEndTime = DateTool().dateToYMDHNString(
|
||||
DateTime.now().millisecondsSinceEpoch.toString()); // 限时结束时间
|
||||
var cycleBeginTime = ""; // 循环开始时间
|
||||
var cycleEndTime = ""; // 循环结束时间
|
||||
var effectiveDateTime = ""; // 生效时间
|
||||
var failureDateTime = ""; // 失效时间
|
||||
var weekdaysList = [];
|
||||
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.tr.obs;
|
||||
var countryCode = '86'.obs;
|
||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||
var isSendSuccess = false;
|
||||
var countryName = '中国'.tr;
|
||||
var countryCode = '86';
|
||||
var isCreateUser = false; //用户未注册时传1 已注册传0
|
||||
var isDemoMode = false;
|
||||
var isRequireAuth = false.obs; //是否需要实名认证的必填项
|
||||
|
||||
final timeLimitTips = '接收者在有效期内可以不限次数使用'; //限时
|
||||
final permanentTips = '接收者可以使用此App开关锁'; //永久
|
||||
final onceLimitTips = '单次钥匙有效期为1小时,只能使用一次'; //单次
|
||||
final cycleLimitTips = '接收者可以在有效期内的固定时间段里,不限次数使用'; //循环
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
@ -11,13 +11,12 @@ class GroupEditLockLogic extends BaseGetXController {
|
||||
|
||||
//锁分组里面添加锁
|
||||
Future<void> lockGroupAddLock(List lockIds) async {
|
||||
if(lockIds.isEmpty){
|
||||
if (lockIds.isEmpty) {
|
||||
showToast("请选择锁".tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.lockGroupAddLock(
|
||||
lockIds: lockIds,
|
||||
groupId: state.selectGroupListItem.keyGroupId!);
|
||||
lockIds: lockIds, groupId: state.selectGroupListItem.keyGroupId!);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("添加成功");
|
||||
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
||||
@ -28,7 +27,7 @@ class GroupEditLockLogic extends BaseGetXController {
|
||||
|
||||
//锁分组里面添加锁
|
||||
Future<void> lockGroupDeletLock(List lockIds) async {
|
||||
if(lockIds.isEmpty){
|
||||
if (lockIds.isEmpty) {
|
||||
showToast("请选择锁".tr);
|
||||
return;
|
||||
}
|
||||
@ -41,4 +40,11 @@ class GroupEditLockLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
onReady() async {
|
||||
super.onReady();
|
||||
|
||||
var isVip = await Storage.getBool(saveIsVip);
|
||||
state.isVip.value = isVip ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
import 'package:star_lock/tools/advancedFunctionHandle.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
|
||||
import '../../../../../../app_settings/app_colors.dart';
|
||||
@ -26,61 +27,78 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: state.type == 0 ? TranslationLoader.lanKeys!.add!.tr : TranslationLoader.lanKeys!.delete!.tr,
|
||||
barTitle: state.type == 0
|
||||
? TranslationLoader.lanKeys!.add!.tr
|
||||
: TranslationLoader.lanKeys!.delete!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
Obx(() => Visibility(
|
||||
visible: state.isVip.value ? false : true,
|
||||
child: AdvancedFunctionHandle()
|
||||
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
|
||||
Container(
|
||||
margin: EdgeInsets.all(15.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(TranslationLoader.lanKeys!.selectTheLockToJoinTheGroup!.tr, style: TextStyle(fontSize: 25.sp)),
|
||||
Text(
|
||||
TranslationLoader
|
||||
.lanKeys!.selectTheLockToJoinTheGroup!.tr,
|
||||
style: TextStyle(fontSize: 25.sp)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: _buildMainUI()),
|
||||
SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () async {
|
||||
var idList = [];
|
||||
for(int i = 0; i<state.lockList.length; i++){
|
||||
LockListItem lockListItem = state.lockList[i];
|
||||
if(lockListItem.isChecked == true){
|
||||
idList.add(lockListItem.lockId);
|
||||
}
|
||||
}
|
||||
if(state.type == 0){
|
||||
// 添加
|
||||
logic.lockGroupAddLock(idList);
|
||||
}else if(state.type == 1){
|
||||
// 删除
|
||||
logic.lockGroupDeletLock(idList);
|
||||
}
|
||||
}),
|
||||
Obx(() => Visibility(
|
||||
visible: state.isVip.value ? true : false,
|
||||
child: SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
onClick: () async {
|
||||
var idList = [];
|
||||
for (int i = 0; i < state.lockList.length; i++) {
|
||||
LockListItem lockListItem = state.lockList[i];
|
||||
if (lockListItem.isChecked == true) {
|
||||
idList.add(lockListItem.lockId);
|
||||
}
|
||||
}
|
||||
if (state.type == 0) {
|
||||
// 添加
|
||||
logic.lockGroupAddLock(idList);
|
||||
} else if (state.type == 1) {
|
||||
// 删除
|
||||
logic.lockGroupDeletLock(idList);
|
||||
}
|
||||
}))),
|
||||
SizedBox(height: 20.h)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildMainUI(){
|
||||
Widget _buildMainUI() {
|
||||
return state.lockList.isNotEmpty
|
||||
? ListView.separated(
|
||||
itemBuilder: (context, index) {
|
||||
LockListItem itemData = state.lockList[index];
|
||||
return _listItemView(itemData);
|
||||
},
|
||||
itemCount: state.lockList.length,
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
height: 1.h,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
) : NoData();
|
||||
itemBuilder: (context, index) {
|
||||
LockListItem itemData = state.lockList[index];
|
||||
return _listItemView(itemData);
|
||||
},
|
||||
itemCount: state.lockList.length,
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
height: 1.h,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
)
|
||||
: NoData();
|
||||
}
|
||||
|
||||
Widget _listItemView(LockListItem itemData) {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
onTap: () {
|
||||
if (!state.isVip.value) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
itemData.isChecked = !itemData.isChecked;
|
||||
});
|
||||
@ -92,9 +110,18 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 20.w,),
|
||||
Image.asset('images/icon_lockGroup_item.png', width: 36, height: 36, fit: BoxFit.fill,),
|
||||
SizedBox(width: 10.w,),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/icon_lockGroup_item.png',
|
||||
width: 36,
|
||||
height: 36,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
itemData.lockAlias ?? '',
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
@ -113,5 +140,4 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,24 +1,25 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
|
||||
class GroupEditLockState {
|
||||
var lockList = <LockListItem>[];
|
||||
var type = 0;// 0添加 1删除
|
||||
var type = 0; // 0添加 1删除
|
||||
var selectGroupListItem = GroupListItem();
|
||||
var ungrouped = GroupListItem();
|
||||
var isVip = false.obs;
|
||||
|
||||
GroupEditLockState() {
|
||||
Map map = Get.arguments;
|
||||
type = map["type"];
|
||||
selectGroupListItem = map["groupListItem"];
|
||||
ungrouped = map["ungrouped"];
|
||||
if(type == 0){
|
||||
if (type == 0) {
|
||||
lockList = ungrouped.lockList!;
|
||||
}else{
|
||||
} else {
|
||||
lockList = selectGroupListItem.lockList!;
|
||||
}
|
||||
|
||||
for(int i = 0; i<lockList.length; i++){
|
||||
for (int i = 0; i < lockList.length; i++) {
|
||||
LockListItem lockListItem = lockList[i];
|
||||
lockListItem.isChecked = false;
|
||||
}
|
||||
|
||||
@ -43,12 +43,17 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
// 处理操作按钮的点击事件-添加锁分组
|
||||
state.changeNameController.text = "";
|
||||
// showCupertinoAlertDialog(context, true, 0);
|
||||
ShowTipView().showTFViewAlertDialog(state.changeNameController, TranslationLoader.lanKeys!.createNewGroup!.tr, TranslationLoader.lanKeys!.pleaseEnter!.tr, (){
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.changeNameController,
|
||||
TranslationLoader.lanKeys!.createNewGroup!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr, () {
|
||||
//发送编辑钥匙名称请求
|
||||
if (state.changeNameController.text.isNotEmpty) {
|
||||
Navigator.of(context).pop();
|
||||
logic.addLockGroupRequest();
|
||||
} else {
|
||||
logic.showToast(TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
|
||||
logic.showToast(
|
||||
TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -57,7 +62,10 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(child: Obx(() => state.itemDataList.value.isEmpty ? NoData(): _buildMainUI())),
|
||||
Expanded(
|
||||
child: Obx(() => state.itemDataList.value.isEmpty
|
||||
? NoData()
|
||||
: _buildMainUI())),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -81,7 +89,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
child: Text(
|
||||
'${TranslationLoader.lanKeys!.lockTrCount!.tr}:${state.lockNum.toString()}',
|
||||
'${TranslationLoader.lanKeys!.lockTrCount!.tr}:${state.lockNum.toString()}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 20.sp),
|
||||
),
|
||||
@ -91,28 +99,32 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
);
|
||||
} else {
|
||||
GroupListItem itemData = state.itemDataList.value[index];
|
||||
if(itemData.groupType == 0){
|
||||
if (itemData.groupType == 0) {
|
||||
state.ungrouped = itemData;
|
||||
}
|
||||
if (index < state.itemDataList.value.length) {
|
||||
return LeftSlideActions(
|
||||
key: Key(itemData.keyGroupId!.toString()),
|
||||
actionsWidth: itemData.groupType != 0 ? 200.w : 0,
|
||||
actions: itemData.groupType != 0 ? [
|
||||
_buildEditBtn(itemData),
|
||||
_buildDeleteBtn(itemData),
|
||||
] : [],
|
||||
actions: itemData.groupType != 0
|
||||
? [
|
||||
_buildEditBtn(itemData),
|
||||
_buildDeleteBtn(itemData),
|
||||
]
|
||||
: [],
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
),
|
||||
child: CommonItem(
|
||||
leftTitel:
|
||||
'${itemData.keyGroupName}(${itemData.lockList?.length})',
|
||||
'${itemData.keyGroupName}(${itemData.lockList?.length})',
|
||||
rightTitle: "",
|
||||
allHeight: 70.h,
|
||||
action: () {
|
||||
|
||||
Get.toNamed(Routers.lockItemListPage, arguments: {'groupListItem': itemData, "ungrouped": state.ungrouped});
|
||||
Get.toNamed(Routers.lockItemListPage, arguments: {
|
||||
'groupListItem': itemData,
|
||||
"ungrouped": state.ungrouped
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
@ -161,7 +173,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
onTap: () {
|
||||
// 省略: 弹出是否删除的确认对话框。
|
||||
// showIosTipViewDialog(context, groupListItem);
|
||||
ShowTipView().showIosTipWithContentDialog("分组下的锁将被移到未分组里".tr, (){
|
||||
ShowTipView().showIosTipWithContentDialog("分组下的锁将被移到未分组里".tr, () {
|
||||
logic.deleteLockGroupRequest(groupListItem.keyGroupId!);
|
||||
});
|
||||
},
|
||||
@ -189,11 +201,15 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
state.changeNameController.text = groupListItem.keyGroupName!;
|
||||
// showCupertinoAlertDialog(context, false, groupListItem.keyGroupId!);
|
||||
|
||||
ShowTipView().showTFViewAlertDialog(state.changeNameController, TranslationLoader.lanKeys!.createNewGroup!.tr, TranslationLoader.lanKeys!.pleaseEnter!.tr, (){
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.changeNameController,
|
||||
TranslationLoader.lanKeys!.createNewGroup!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr, () {
|
||||
if (state.changeNameController.text.isNotEmpty) {
|
||||
logic.editLockGroupRequest(groupListItem.keyGroupId!);
|
||||
} else {
|
||||
logic.showToast(TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
|
||||
logic.showToast(
|
||||
TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -232,5 +248,4 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/buy_record_list_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
@ -29,13 +29,15 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
|
||||
if (!load) {
|
||||
buyPageNo = 1;
|
||||
}
|
||||
BuyRecordListEntity entity = await ApiRepository.to.getBuyRecordList(
|
||||
AdvancedFunctionRecordEntity entity =
|
||||
await ApiRepository.to.getBuyRecordList(
|
||||
type: type,
|
||||
recordType: 10,
|
||||
pageNo: buyPageNo,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.buyRecordList.value = entity.data!.buyRecordlist!;
|
||||
state.buyRecordList.value = entity.data!.recordList!;
|
||||
state.buyRecordList.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:easy_refresh/easy_refresh.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -41,16 +42,16 @@ class _ValueAddedServicesRealNamePageState
|
||||
labelColor: AppColors.mainColor,
|
||||
unselectedLabelColor: AppColors.darkGrayTextColor,
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(children: [
|
||||
_PurchaseRecords(
|
||||
getRecordList: logic.state.buyRecordList.value,
|
||||
),
|
||||
_PurchaseRecords(
|
||||
getRecordList: logic.state.useRecordList.value,
|
||||
),
|
||||
]),
|
||||
),
|
||||
Obx(() => Expanded(
|
||||
child: TabBarView(children: [
|
||||
_PurchaseRecords(
|
||||
getRecordList: logic.state.buyRecordList.value,
|
||||
),
|
||||
_PurchaseRecords(
|
||||
getRecordList: logic.state.useRecordList.value,
|
||||
),
|
||||
]),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -91,10 +92,54 @@ class _PurchaseRecordsState extends State<_PurchaseRecords> {
|
||||
? ListView.builder(
|
||||
itemCount: widget.getRecordList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return const SizedBox();
|
||||
return _recordKeyItem(widget.getRecordList[index]);
|
||||
})
|
||||
: NoData(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _recordKeyItem(RecordItem itemData) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
||||
padding:
|
||||
EdgeInsets.only(left: 20.w, right: 20.w, top: 16.h, bottom: 16.h),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
itemData.createdAt!.length > 10
|
||||
? itemData.createdAt!.substring(0, 10)
|
||||
: itemData.createdAt!,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: AppColors.blackColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
Text('¥${itemData.amount}',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: AppColors.blackColor,
|
||||
fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text('实名认证/${itemData.cloudauthCount}次',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor))
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,6 @@ import 'package:get/get.dart';
|
||||
|
||||
class ValueAddedServicesRecordState {
|
||||
int index = 0;
|
||||
var buyRecordList = [].obs;
|
||||
var useRecordList = [].obs;
|
||||
var buyRecordList = [].obs; //购买记录列表
|
||||
var useRecordList = [].obs; //使用记录列表
|
||||
}
|
||||
|
||||
@ -227,4 +227,5 @@ abstract class Api {
|
||||
final String deleteLockCloudStorageURL = '/lockCloudStorage/delete'; //删除云存
|
||||
final String getServiceUserPackageURL =
|
||||
'/v2/service/getUserPackage'; //获取增值服务用户余量包
|
||||
final String isFaceAuthenticationURL = '/key/checkFace'; //检测实名认证是否支持开启
|
||||
}
|
||||
|
||||
@ -142,7 +142,9 @@ class ApiProvider extends BaseProvider {
|
||||
List weekDays,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int isOnlyManageSelf) =>
|
||||
int isOnlyManageSelf,
|
||||
String realName,
|
||||
String idCardNumber) =>
|
||||
post(
|
||||
sendElectronicKeyURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -165,6 +167,8 @@ class ApiProvider extends BaseProvider {
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'isOnlyManageSelf': isOnlyManageSelf,
|
||||
'realName': realName,
|
||||
'idCardNumber': idCardNumber
|
||||
}));
|
||||
|
||||
Future<Response> uploadElectricQuantity(
|
||||
@ -452,7 +456,7 @@ class ApiProvider extends BaseProvider {
|
||||
String startDate,
|
||||
String endDate,
|
||||
String addType,
|
||||
int? pwdRight,
|
||||
int? pwdRight,
|
||||
) =>
|
||||
post(
|
||||
passwordKeyAddURL.toUrl,
|
||||
@ -2026,6 +2030,18 @@ class ApiProvider extends BaseProvider {
|
||||
'pageSize': pageSize,
|
||||
'record_type': recordType,
|
||||
}));
|
||||
|
||||
// 检测实名认证是否支持开启
|
||||
Future<Response> keyCheckFace(
|
||||
int countryCode,
|
||||
String account,
|
||||
) =>
|
||||
post(
|
||||
isFaceAuthenticationURL.toUrl,
|
||||
jsonEncode({
|
||||
'countryCode': countryCode,
|
||||
'account': account,
|
||||
}));
|
||||
}
|
||||
|
||||
extension ExtensionString on String {
|
||||
|
||||
@ -179,7 +179,9 @@ class ApiRepository {
|
||||
required List weekDays,
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
required int isOnlyManageSelf}) async {
|
||||
required int isOnlyManageSelf,
|
||||
required String realName,
|
||||
required String idCardNumber}) async {
|
||||
final res = await apiProvider.sendElectronicKey(
|
||||
createUser,
|
||||
countryCode,
|
||||
@ -199,7 +201,9 @@ class ApiRepository {
|
||||
weekDays,
|
||||
startTime,
|
||||
endTime,
|
||||
isOnlyManageSelf);
|
||||
isOnlyManageSelf,
|
||||
realName,
|
||||
idCardNumber);
|
||||
return AuthorizedAdminSendEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -317,13 +321,11 @@ class ApiRepository {
|
||||
|
||||
//锁电量更新
|
||||
Future<KeyOperationRecordEntity> uploadElectricQuantity(
|
||||
{
|
||||
String? electricQuantity,
|
||||
String? electricQuantityStandby,
|
||||
String? lockId
|
||||
}) async {
|
||||
final res =
|
||||
await apiProvider.uploadElectricQuantity(electricQuantity!, electricQuantityStandby!, lockId!);
|
||||
{String? electricQuantity,
|
||||
String? electricQuantityStandby,
|
||||
String? lockId}) async {
|
||||
final res = await apiProvider.uploadElectricQuantity(
|
||||
electricQuantity!, electricQuantityStandby!, lockId!);
|
||||
return KeyOperationRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -465,8 +467,7 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//自定义密码
|
||||
Future<PasswordKeyEntity> addPasswordKey(
|
||||
{
|
||||
Future<PasswordKeyEntity> addPasswordKey({
|
||||
required String lockId,
|
||||
required String keyboardPwdName,
|
||||
required String keyboardPwd,
|
||||
@ -2012,7 +2013,7 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 获取使用记录
|
||||
Future<BuyRecordListEntity> getBuyRecordList({
|
||||
Future<AdvancedFunctionRecordEntity> getBuyRecordList({
|
||||
required String type,
|
||||
required int pageNo,
|
||||
required int recordType,
|
||||
@ -2020,7 +2021,7 @@ class ApiRepository {
|
||||
}) async {
|
||||
final res =
|
||||
await apiProvider.getBuyRecordList(type, recordType, pageNo, pageSize);
|
||||
return BuyRecordListEntity.fromJson(res.body);
|
||||
return AdvancedFunctionRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 获取购买记录
|
||||
@ -2056,4 +2057,13 @@ class ApiRepository {
|
||||
type, pageNo, recordType, pageSize);
|
||||
return AdvancedFunctionRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 检测实名认证是否支持开启
|
||||
Future<AdvancedFunctionRecordEntity> keyCheckFace({
|
||||
required int countryCode,
|
||||
required String account,
|
||||
}) async {
|
||||
final res = await apiProvider.keyCheckFace(countryCode, account);
|
||||
return AdvancedFunctionRecordEntity.fromJson(res.body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/tools/showTFView.dart';
|
||||
|
||||
import '../translations/trans_lib.dart';
|
||||
@ -132,13 +133,17 @@ class ShowTipView {
|
||||
title: Text(titleStr),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
child: Text(
|
||||
'取消'.tr,
|
||||
style: TextStyle(color: AppColors.mainColor),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('购买'.tr),
|
||||
child:
|
||||
Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
sureClick();
|
||||
|
||||
@ -170,7 +170,6 @@ dependencies:
|
||||
expandable: ^5.0.1
|
||||
colorfilter_generator: ^0.0.8
|
||||
file_picker: ^5.3.1
|
||||
extended_text_field: 13.1.0
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user