修改了版本升级界面,自定义密码日期跟离线密码日期分离
This commit is contained in:
parent
dd16c0dcb0
commit
21ce56ff0f
@ -61,7 +61,8 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
TranslationLoader.lanKeys!.haveNewVersion!.tr,
|
||||
// TranslationLoader.lanKeys!.haveNewVersion!.tr,
|
||||
"未发现新版本",
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||||
)
|
||||
@ -75,80 +76,6 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
|
||||
style: TextStyle(
|
||||
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(
|
||||
height: 40.h,
|
||||
),
|
||||
@ -159,6 +86,78 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
|
||||
onClick: () {})
|
||||
: 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) {
|
||||
getKeyType = '3';
|
||||
getEffectiveDateTime = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
||||
getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
||||
}
|
||||
var entity = await ApiRepository.to.addPasswordKey(
|
||||
lockId,
|
||||
state.nameController.text,
|
||||
state.pwdController.text,
|
||||
getKeyType,
|
||||
getEffectiveDateTime,
|
||||
getFailureDateTime,
|
||||
'1');
|
||||
lockId:lockId,
|
||||
keyboardPwdName:state.nameController.text,
|
||||
keyboardPwd:state.pwdController.text,
|
||||
keyboardPwdType:getKeyType,
|
||||
startDate:getEffectiveDateTime,
|
||||
endDate:getFailureDateTime,
|
||||
addType:'1');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = state.widgetType.value;
|
||||
@ -234,8 +234,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
pwdNo: state.isAdministrator.value == true ? 254 : 0,
|
||||
pwd:state.pwdController.text,
|
||||
useCountLimit: 0xff,
|
||||
startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000,
|
||||
endTime: DateTool().dateToTimestamp(state.endTime.value, 1)~/1000,
|
||||
startTime: DateTool().dateToTimestamp(state.customBeginTime.value, 1)~/1000,
|
||||
endTime: DateTool().dateToTimestamp(state.customEndTime.value, 1)~/1000,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: false,
|
||||
signKey: signKeyDataList,
|
||||
@ -265,8 +265,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
|
||||
// 设置自定义密码
|
||||
Future<void> senderCustomPasswords() async {
|
||||
var startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
var endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||
var startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
||||
var endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||
//非永久 须有时限
|
||||
if (state.isPermanent.value == false) {
|
||||
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
@ -359,7 +359,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
case 3:
|
||||
//自定义
|
||||
if (state.isPermanent.value == false) {
|
||||
'类型:自定义-限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
||||
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
||||
} else {
|
||||
useDateStr = '类型:自定义-永久';
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
children: [
|
||||
keyIfPerpetualWidget(),
|
||||
state.isPermanent.value == false
|
||||
? keyTimeLimitWidget()
|
||||
? keyCustomTimeLimitWidget()
|
||||
: Container(),
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
@ -228,14 +228,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
context,
|
||||
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
|
||||
// minDate: PDuration.now(),
|
||||
mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH,
|
||||
mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
if (state.widgetType.value == 3) {
|
||||
// 自定义
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
} else {
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 4);
|
||||
}
|
||||
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),
|
||||
mode: DateMode.YMDH,
|
||||
onConfirm: (p) {
|
||||
if (state.widgetType.value == 3) {
|
||||
// 自定义
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
} else {
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
|
||||
}
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
|
||||
});
|
||||
}),
|
||||
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() {
|
||||
return Column(
|
||||
|
||||
@ -25,6 +25,9 @@ class PasswordKeyPerpetualState {
|
||||
var loopEndHours = DateTime.now().hour.obs;
|
||||
var loopModeStr = '周末'.obs; //循环模式
|
||||
|
||||
var customBeginTime = DateTool().getNowDateWithType(2).obs; //默认为当前时间 开始时间
|
||||
var customEndTime = DateTool().getNowDateWithType(2).obs;//默认为当前时间 结束时间
|
||||
|
||||
final widgetType = 0.obs;
|
||||
final sendSucceedType = 0.obs;
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
|
||||
@ -466,14 +466,15 @@ class ApiRepository {
|
||||
|
||||
//自定义密码
|
||||
Future<PasswordKeyEntity> addPasswordKey(
|
||||
String lockId,
|
||||
String keyboardPwdName,
|
||||
String keyboardPwd,
|
||||
String keyboardPwdType,
|
||||
String startDate,
|
||||
String endDate,
|
||||
String addType,
|
||||
) async {
|
||||
{
|
||||
required String lockId,
|
||||
required String keyboardPwdName,
|
||||
required String keyboardPwd,
|
||||
required String keyboardPwdType,
|
||||
required String startDate,
|
||||
required String endDate,
|
||||
required String addType,
|
||||
}) async {
|
||||
final res = await apiProvider.addKeyboardPwd(lockId, keyboardPwdName,
|
||||
keyboardPwd, keyboardPwdType, startDate, endDate, addType);
|
||||
return PasswordKeyEntity.fromJson(res.body);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user