修改了版本升级界面,自定义密码日期跟离线密码日期分离
This commit is contained in:
parent
dd16c0dcb0
commit
21ce56ff0f
@ -61,7 +61,8 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
|
|||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
TranslationLoader.lanKeys!.haveNewVersion!.tr,
|
// TranslationLoader.lanKeys!.haveNewVersion!.tr,
|
||||||
|
"未发现新版本",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24.sp, fontWeight: FontWeight.w600),
|
fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||||||
)
|
)
|
||||||
@ -75,80 +76,6 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
),
|
),
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
Obx(() {
|
|
||||||
return !logic.state.otaUpdateIng.value
|
|
||||||
? Stack(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(top: 8, bottom: 8),
|
|
||||||
width: Get.width,
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
// "${TranslationLoader.lanKeys!.newVersion!.tr}:1.0.1",
|
|
||||||
"未发现新版本",
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 18.sp),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
right: 80.w,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
logic.otaUpdate();
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'手动升级',
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 18.sp,
|
|
||||||
fontWeight: FontWeight.w400),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Padding(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 50.w, vertical: 15.h),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'固件传输中',
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 18.sp,
|
|
||||||
fontWeight: FontWeight.w400),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 10.w,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(10.r)),
|
|
||||||
child: LinearProgressIndicator(
|
|
||||||
value: logic
|
|
||||||
.state.otaProgress.value, // 50% 进度
|
|
||||||
backgroundColor: Colors.grey[200],
|
|
||||||
valueColor:
|
|
||||||
AlwaysStoppedAnimation<Color>(
|
|
||||||
AppColors.mainColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
),
|
),
|
||||||
@ -159,6 +86,78 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
|
|||||||
onClick: () {})
|
onClick: () {})
|
||||||
: SizedBox();
|
: SizedBox();
|
||||||
}),
|
}),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
Obx(() {
|
||||||
|
return !logic.state.otaUpdateIng.value
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
// Container(
|
||||||
|
// margin: EdgeInsets.only(top: 8, bottom: 8),
|
||||||
|
// width: Get.width,
|
||||||
|
// child: Center(
|
||||||
|
// child: Text(
|
||||||
|
// // "${TranslationLoader.lanKeys!.newVersion!.tr}:1.0.1",
|
||||||
|
// "未发现新版本",
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: AppColors.mainColor,
|
||||||
|
// fontSize: 18.sp),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
logic.otaUpdate();
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
'手动升级',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 18.sp,
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 50.w, vertical: 15.h),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'固件传输中',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 18.sp,
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(10.r)),
|
||||||
|
child: LinearProgressIndicator(
|
||||||
|
value: logic
|
||||||
|
.state.otaProgress.value, // 50% 进度
|
||||||
|
backgroundColor: Colors.grey[200],
|
||||||
|
valueColor:
|
||||||
|
AlwaysStoppedAnimation<Color>(
|
||||||
|
AppColors.mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|||||||
@ -143,17 +143,17 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
//是否为永久
|
//是否为永久
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
getKeyType = '3';
|
getKeyType = '3';
|
||||||
getEffectiveDateTime = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
||||||
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.addPasswordKey(
|
var entity = await ApiRepository.to.addPasswordKey(
|
||||||
lockId,
|
lockId:lockId,
|
||||||
state.nameController.text,
|
keyboardPwdName:state.nameController.text,
|
||||||
state.pwdController.text,
|
keyboardPwd:state.pwdController.text,
|
||||||
getKeyType,
|
keyboardPwdType:getKeyType,
|
||||||
getEffectiveDateTime,
|
startDate:getEffectiveDateTime,
|
||||||
getFailureDateTime,
|
endDate:getFailureDateTime,
|
||||||
'1');
|
addType:'1');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
state.sendSucceedType.value = state.widgetType.value;
|
state.sendSucceedType.value = state.widgetType.value;
|
||||||
@ -234,8 +234,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
pwdNo: state.isAdministrator.value == true ? 254 : 0,
|
pwdNo: state.isAdministrator.value == true ? 254 : 0,
|
||||||
pwd:state.pwdController.text,
|
pwd:state.pwdController.text,
|
||||||
useCountLimit: 0xff,
|
useCountLimit: 0xff,
|
||||||
startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000,
|
startTime: DateTool().dateToTimestamp(state.customBeginTime.value, 1)~/1000,
|
||||||
endTime: DateTool().dateToTimestamp(state.endTime.value, 1)~/1000,
|
endTime: DateTool().dateToTimestamp(state.customEndTime.value, 1)~/1000,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
@ -265,8 +265,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 设置自定义密码
|
// 设置自定义密码
|
||||||
Future<void> senderCustomPasswords() async {
|
Future<void> senderCustomPasswords() async {
|
||||||
var startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
var startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
||||||
var endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
|
var endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||||
//非永久 须有时限
|
//非永久 须有时限
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
@ -359,7 +359,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
case 3:
|
case 3:
|
||||||
//自定义
|
//自定义
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
'类型:自定义-限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
||||||
} else {
|
} else {
|
||||||
useDateStr = '类型:自定义-永久';
|
useDateStr = '类型:自定义-永久';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,7 +139,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
children: [
|
children: [
|
||||||
keyIfPerpetualWidget(),
|
keyIfPerpetualWidget(),
|
||||||
state.isPermanent.value == false
|
state.isPermanent.value == false
|
||||||
? keyTimeLimitWidget()
|
? keyCustomTimeLimitWidget()
|
||||||
: Container(),
|
: Container(),
|
||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
false,
|
false,
|
||||||
@ -228,14 +228,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
context,
|
context,
|
||||||
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
|
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
|
||||||
// minDate: PDuration.now(),
|
// minDate: PDuration.now(),
|
||||||
mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH,
|
mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
if (state.widgetType.value == 3) {
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 4);
|
||||||
// 自定义
|
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
|
||||||
} else {
|
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 4);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@ -251,12 +246,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
|
minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
|
||||||
mode: DateMode.YMDH,
|
mode: DateMode.YMDH,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
if (state.widgetType.value == 3) {
|
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
|
||||||
// 自定义
|
|
||||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
|
||||||
} else {
|
|
||||||
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -264,6 +254,44 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 自定义限时顶部选择日期
|
||||||
|
Widget keyCustomTimeLimitWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
|
rightTitle: state.customBeginTime.value,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(
|
||||||
|
context,
|
||||||
|
// maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
|
||||||
|
// minDate: PDuration.now(),
|
||||||
|
mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.customBeginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
|
rightTitle: state.customEndTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
// maxDate传入三年以后得今天的时间
|
||||||
|
// maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day),
|
||||||
|
// minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
|
||||||
|
mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.customEndTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 自定义是否永久
|
// 自定义是否永久
|
||||||
Widget keyIfPerpetualWidget() {
|
Widget keyIfPerpetualWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
|
|||||||
@ -25,6 +25,9 @@ class PasswordKeyPerpetualState {
|
|||||||
var loopEndHours = DateTime.now().hour.obs;
|
var loopEndHours = DateTime.now().hour.obs;
|
||||||
var loopModeStr = '周末'.obs; //循环模式
|
var loopModeStr = '周末'.obs; //循环模式
|
||||||
|
|
||||||
|
var customBeginTime = DateTool().getNowDateWithType(2).obs; //默认为当前时间 开始时间
|
||||||
|
var customEndTime = DateTool().getNowDateWithType(2).obs;//默认为当前时间 结束时间
|
||||||
|
|
||||||
final widgetType = 0.obs;
|
final widgetType = 0.obs;
|
||||||
final sendSucceedType = 0.obs;
|
final sendSucceedType = 0.obs;
|
||||||
final keyInfo = LockListInfoItemEntity().obs;
|
final keyInfo = LockListInfoItemEntity().obs;
|
||||||
|
|||||||
@ -466,14 +466,15 @@ class ApiRepository {
|
|||||||
|
|
||||||
//自定义密码
|
//自定义密码
|
||||||
Future<PasswordKeyEntity> addPasswordKey(
|
Future<PasswordKeyEntity> addPasswordKey(
|
||||||
String lockId,
|
{
|
||||||
String keyboardPwdName,
|
required String lockId,
|
||||||
String keyboardPwd,
|
required String keyboardPwdName,
|
||||||
String keyboardPwdType,
|
required String keyboardPwd,
|
||||||
String startDate,
|
required String keyboardPwdType,
|
||||||
String endDate,
|
required String startDate,
|
||||||
String addType,
|
required String endDate,
|
||||||
) async {
|
required String addType,
|
||||||
|
}) async {
|
||||||
final res = await apiProvider.addKeyboardPwd(lockId, keyboardPwdName,
|
final res = await apiProvider.addKeyboardPwd(lockId, keyboardPwdName,
|
||||||
keyboardPwd, keyboardPwdType, startDate, endDate, addType);
|
keyboardPwd, keyboardPwdType, startDate, endDate, addType);
|
||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user