1,修复密码选择日期的问题
2,修复类型不一致导致的电子钥匙点击无法发送问题
This commit is contained in:
parent
b57c18a9c0
commit
31e3250cec
@ -27,7 +27,7 @@ class AuthorizedAdminSendEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Data {
|
class Data {
|
||||||
int? receiverUid;
|
String? receiverUid;
|
||||||
ReceiverUser? receiverUser;
|
ReceiverUser? receiverUser;
|
||||||
int? keyId;
|
int? keyId;
|
||||||
|
|
||||||
@ -149,15 +149,16 @@ class Phone {
|
|||||||
class Cloud {
|
class Cloud {
|
||||||
String? username;
|
String? username;
|
||||||
String? password;
|
String? password;
|
||||||
int? cloudUid;
|
// String? cloudUid;
|
||||||
int? userId;
|
int? userId;
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
String? createdAt;
|
String? createdAt;
|
||||||
int? id;
|
int? id;
|
||||||
|
|
||||||
Cloud({this.username,
|
Cloud(
|
||||||
|
{this.username,
|
||||||
this.password,
|
this.password,
|
||||||
this.cloudUid,
|
// this.cloudUid,
|
||||||
this.userId,
|
this.userId,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
@ -166,7 +167,7 @@ class Cloud {
|
|||||||
Cloud.fromJson(Map<String, dynamic> json) {
|
Cloud.fromJson(Map<String, dynamic> json) {
|
||||||
username = json['username'];
|
username = json['username'];
|
||||||
password = json['password'];
|
password = json['password'];
|
||||||
cloudUid = json['cloud_uid'];
|
// cloudUid = json['cloud_uid'];
|
||||||
userId = json['user_id'];
|
userId = json['user_id'];
|
||||||
updatedAt = json['updated_at'];
|
updatedAt = json['updated_at'];
|
||||||
createdAt = json['created_at'];
|
createdAt = json['created_at'];
|
||||||
@ -177,7 +178,7 @@ class Cloud {
|
|||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['username'] = username;
|
data['username'] = username;
|
||||||
data['password'] = password;
|
data['password'] = password;
|
||||||
data['cloud_uid'] = cloudUid;
|
// data['cloud_uid'] = cloudUid;
|
||||||
data['user_id'] = userId;
|
data['user_id'] = userId;
|
||||||
data['updated_at'] = updatedAt;
|
data['updated_at'] = updatedAt;
|
||||||
data['created_at'] = createdAt;
|
data['created_at'] = createdAt;
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_utils/get_utils.dart';
|
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.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/sendElectronicKey_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
class SendElectronicKeyLogic extends BaseGetXController {
|
class SendElectronicKeyLogic extends BaseGetXController {
|
||||||
@ -43,7 +41,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
String getKeyType = typeValue.toString();
|
String getKeyType = typeValue.toString();
|
||||||
|
|
||||||
var entity = await ApiRepository.to.sendElectronicKey(
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
createUser: state.isCreateUser.value ? "1" : "0",
|
createUser: state.isCreateUser.value == true ? "1" : "0",
|
||||||
countryCode: state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
||||||
? '1'
|
? '1'
|
||||||
|
|||||||
@ -31,10 +31,17 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
final logic = Get.put(SendElectronicKeyLogic());
|
final logic = Get.put(SendElectronicKeyLogic());
|
||||||
final state = Get.find<SendElectronicKeyLogic>().state;
|
final state = Get.find<SendElectronicKeyLogic>().state;
|
||||||
static const methodChannel = MethodChannel('talkPlugin');
|
static const methodChannel = MethodChannel('talkPlugin');
|
||||||
|
bool isDemoMode = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
getDemoMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getDemoMode() async {
|
||||||
|
isDemoMode = (await Storage.getBool(ifIsDemoModeOrNot))!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -260,9 +267,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
),
|
),
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||||
onClick: () async {
|
onClick: () {
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
//发送钥匙请求
|
//发送钥匙请求
|
||||||
if (state.emailOrPhoneController.text.isNotEmpty &&
|
if (state.emailOrPhoneController.text.isNotEmpty &&
|
||||||
@ -283,6 +288,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
Toast.show(msg: '请完善信息');
|
Toast.show(msg: '请完善信息');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//演示模式不获取接口
|
||||||
Toast.show(msg: '演示模式');
|
Toast.show(msg: '演示模式');
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -293,9 +299,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () {
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.massSendElectronicKeyManagePage);
|
context, Routers.massSendElectronicKeyManagePage);
|
||||||
|
|||||||
@ -54,7 +54,9 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
//自定义
|
//自定义
|
||||||
} else if (passwordType == 4) {
|
} else if (passwordType == 4) {
|
||||||
//循环
|
//循环
|
||||||
if (state.loopModeStr.value == '每日') {
|
if (state.loopModeStr.value == '周末') {
|
||||||
|
getKeyType = '5';
|
||||||
|
} else if (state.loopModeStr.value == '每日') {
|
||||||
getKeyType = '6';
|
getKeyType = '6';
|
||||||
} else if (state.loopModeStr.value == '工作日') {
|
} else if (state.loopModeStr.value == '工作日') {
|
||||||
getKeyType = '7';
|
getKeyType = '7';
|
||||||
|
|||||||
@ -290,13 +290,32 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
|
// Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
|
||||||
|
// state.effectiveDateTime.value = DateTime.parse(
|
||||||
|
// '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}');
|
||||||
|
// state.loopEffectiveDate.value =
|
||||||
|
// "${formatDate(state.effectiveDateTime.value, [HH])}:00";
|
||||||
|
// state.loopStartHours.value = p.hour!;
|
||||||
|
// state.selectEffectiveDate.value = state.loopEffectiveDate.value;
|
||||||
|
// });
|
||||||
Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
|
Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
|
||||||
state.effectiveDateTime.value =
|
DateTime selectedDateTime = DateTime(
|
||||||
DateTime.parse('${intToStr(p.hour!)}:00');
|
p.year!,
|
||||||
state.loopEffectiveDate.value =
|
p.month!,
|
||||||
"${formatDate(state.effectiveDateTime.value, [HH])}:00";
|
p.day!,
|
||||||
state.loopStartHours.value = p.hour!;
|
p.hour!,
|
||||||
state.selectEffectiveDate.value = state.loopEffectiveDate.value;
|
);
|
||||||
|
|
||||||
|
if (isValidDateTime(selectedDateTime)) {
|
||||||
|
state.effectiveDateTime.value = selectedDateTime;
|
||||||
|
state.loopEffectiveDate.value =
|
||||||
|
"${formatDate(state.effectiveDateTime.value, [HH])}:00";
|
||||||
|
state.loopStartHours.value = p.hour!;
|
||||||
|
state.selectEffectiveDate.value =
|
||||||
|
state.loopEffectiveDate.value;
|
||||||
|
} else {
|
||||||
|
// 处理日期不合法的情况,可以使用默认值或者其他策略
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -304,19 +323,43 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
rightTitle: state.loopFailureDate.value,
|
rightTitle: state.loopFailureDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
|
// Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
|
||||||
|
// state.failureDateTime.value = DateTime.parse(
|
||||||
|
// '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}');
|
||||||
|
// state.loopFailureDate.value =
|
||||||
|
// "${formatDate(state.failureDateTime.value, [HH])}:00";
|
||||||
|
// state.loopEndHours.value = p.hour!;
|
||||||
|
// state.selectFailureDate.value = state.loopFailureDate.value;
|
||||||
|
// });
|
||||||
Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
|
Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
|
||||||
state.failureDateTime.value =
|
DateTime selectedDateTime = DateTime(
|
||||||
DateTime.parse('${intToStr(p.hour!)}:00');
|
p.year!,
|
||||||
state.loopEffectiveDate.value =
|
p.month!,
|
||||||
"${formatDate(state.failureDateTime.value, [HH])}:00";
|
p.day!,
|
||||||
state.loopEndHours.value = p.hour!;
|
p.hour!,
|
||||||
state.selectFailureDate.value = state.loopFailureDate.value;
|
);
|
||||||
|
|
||||||
|
if (isValidDateTime(selectedDateTime)) {
|
||||||
|
state.failureDateTime.value = selectedDateTime;
|
||||||
|
state.loopFailureDate.value =
|
||||||
|
"${formatDate(state.failureDateTime.value, [HH])}:00";
|
||||||
|
state.loopEndHours.value = p.hour!;
|
||||||
|
state.selectFailureDate.value = state.loopFailureDate.value;
|
||||||
|
} else {
|
||||||
|
// 处理日期不合法的情况,可以使用默认值或者其他策略
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isValidDateTime(DateTime dateTime) {
|
||||||
|
// 在这里添加日期时间合法性检查的逻辑
|
||||||
|
// 如果日期时间合法,返回 true,否则返回 false
|
||||||
|
return true; // 这里先简单返回 true,实际应用中需要根据具体需求来实现
|
||||||
|
}
|
||||||
|
|
||||||
//底部选择pickerView
|
//底部选择pickerView
|
||||||
showPickerView(BuildContext context, List dataList) {
|
showPickerView(BuildContext context, List dataList) {
|
||||||
Pickers.showSinglePicker(context,
|
Pickers.showSinglePicker(context,
|
||||||
@ -358,7 +401,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//限时||循环
|
//限时||循环
|
||||||
if (getWidgetNumber == 1 || getWidgetNumber == 4) {
|
if (getWidgetNumber == 1) {
|
||||||
if (state.failureDateTime.value
|
if (state.failureDateTime.value
|
||||||
.compareTo(state.effectiveDateTime.value) !=
|
.compareTo(state.effectiveDateTime.value) !=
|
||||||
1) {
|
1) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user