Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
This commit is contained in:
commit
ef5a7c63fb
@ -15,6 +15,7 @@ import 'package:star_lock/main/lockDetail/lcokSet/msgNotification/msgNotificatio
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/notificationMode/notificationMode_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/openDoorDirection/openDoorDirection_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart';
|
||||
import 'package:star_lock/mine/about/webviewShow_page.dart';
|
||||
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart';
|
||||
@ -383,23 +384,28 @@ abstract class Routers {
|
||||
static const lowBatteryReminderPage = '/lowBatteryReminderPage'; //低电量提醒
|
||||
static const coerceFingerprintListPage = '/coerceFingerprintListPage'; //指纹列表
|
||||
static const lockMonitoringPage = '/LockMonitoringPage'; //监控
|
||||
static const monitoringRealTimeScreenPage = '/MonitoringRealTimeScreenPage'; //实时画面
|
||||
static const monitoringRealTimeScreenPage =
|
||||
'/MonitoringRealTimeScreenPage'; //实时画面
|
||||
static const videoLogPage = '/VideoLogPage'; // 视频日志
|
||||
static const editVideoLogPage = '/EditVideoLogPage'; // 编辑视频日志
|
||||
static const videoLogDetailPage = '/VideoLogDetailPage'; // 视频日志详情
|
||||
static const videoLogDownLoadPage = '/VideoLogDownLoadPage'; // 视频下载列表
|
||||
|
||||
static const remoteControlListPage = '/RemoteControlListPage'; // 遥控列表
|
||||
static const addRemoteControlManagePage = '/AddRemoteControlManagePage'; // 添加遥控
|
||||
static const addRemoteControlManagePage =
|
||||
'/AddRemoteControlManagePage'; // 添加遥控
|
||||
|
||||
static const cardListPage = '/CardListPage'; // 卡列表
|
||||
static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡
|
||||
static const cardDetailPage = '/CardDetailPage'; // 卡详情
|
||||
static const fingerprintListPage = '/FingerprintListPage'; // 指纹列表
|
||||
static const addFingerprintTypeManagePage = '/AddFingerprintTypeManagePage'; // 添加指纹
|
||||
static const addFingerprintTypeManagePage =
|
||||
'/AddFingerprintTypeManagePage'; // 添加指纹
|
||||
static const fingerprintDetailPage = '/FingerprintDetailPage'; // 指纹详情
|
||||
static const faceList = '/FaceList'; // 人脸列表
|
||||
static const addFaceTypeManagePage = '/AddFaceTypeManagePage'; // 添加人脸
|
||||
static const passwordKeyDetailChangeDatePage =
|
||||
'/passwordKeyDetailChangeDatePage'; //密码更改时间
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -983,11 +989,12 @@ abstract class AppRouters {
|
||||
GetPage(
|
||||
name: Routers.fingerprintDetailPage,
|
||||
page: () => const FingerprintDetailPage()),
|
||||
GetPage(
|
||||
name: Routers.faceList,
|
||||
page: () => const FaceList()),
|
||||
GetPage(name: Routers.faceList, page: () => const FaceList()),
|
||||
GetPage(
|
||||
name: Routers.addFaceTypeManagePage,
|
||||
page: () => const AddFaceTypeManagePage()),
|
||||
GetPage(
|
||||
name: Routers.passwordKeyDetailChangeDatePage,
|
||||
page: () => const PasswordKeyDetailChangeDatePage())
|
||||
];
|
||||
}
|
||||
|
||||
@ -56,11 +56,26 @@ class _ElectronicKeyDetailChangeDateState
|
||||
}
|
||||
|
||||
Widget buildMainUI() {
|
||||
String getStartDate = "";
|
||||
String getEndDate = "";
|
||||
if (state.itemData.value.startDate != null) {
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||
getStartDate = startDateStr.toLocal().toString().substring(0, 16);
|
||||
}
|
||||
|
||||
if (state.itemData.value.endDate != null) {
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||
getEndDate = endDateStr.toLocal().toString().substring(0, 16);
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.selectEffectiveDate.value,
|
||||
rightTitle: state.selectEffectiveDate.value.isNotEmpty
|
||||
? state.selectEffectiveDate.value
|
||||
: getStartDate,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -74,7 +89,9 @@ class _ElectronicKeyDetailChangeDateState
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: state.selectFailureDate.value,
|
||||
rightTitle: state.selectFailureDate.value.isNotEmpty
|
||||
? state.selectFailureDate.value
|
||||
: getEndDate,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
|
||||
@ -92,9 +92,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
return;
|
||||
}
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyDetailChangeDate,
|
||||
context, Routers.passwordKeyDetailChangeDatePage,
|
||||
arguments: {
|
||||
'lockId': state.itemData.value.lockId.toString(),
|
||||
'itemData': state.itemData.value,
|
||||
'lockId': state.itemData.value.lockId,
|
||||
'pwdId': state.itemData.value.keyboardPwdId.toString()
|
||||
});
|
||||
}),
|
||||
@ -298,7 +299,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
title: inputController == state.inputNameController
|
||||
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}"
|
||||
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
tipTitle: "请输入",
|
||||
tipTitle:
|
||||
inputController.text.isNotEmpty ? inputController.text : "请输入",
|
||||
controller: inputController,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
final PasswordKeyDetailChangeDateState state =
|
||||
PasswordKeyDetailChangeDateState();
|
||||
|
||||
//更新密码请求
|
||||
Future<void> updatePwdRequest() async {
|
||||
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||
lockId: state.itemData.value.lockId!,
|
||||
keyboardPwdId: state.pwdId.value.toString(),
|
||||
keyboardPwdName: state.inputNameController.text,
|
||||
newKeyboardPwd: state.inputPwdController.text,
|
||||
startDate: state.startDate.value,
|
||||
endDate: state.endDate.value,
|
||||
changeType: state.changeType.value,
|
||||
hoursStart: state.hoursStart.value,
|
||||
hoursEnd: state.hoursEnd.value,
|
||||
isCoerced: state.isCoerced.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: "修改成功");
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
class PasswordKeyDetailChangeDatePage extends StatefulWidget {
|
||||
const PasswordKeyDetailChangeDatePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<PasswordKeyDetailChangeDatePage> createState() =>
|
||||
_PasswordKeyDetailChangeDatePage();
|
||||
}
|
||||
|
||||
class _PasswordKeyDetailChangeDatePage
|
||||
extends State<PasswordKeyDetailChangeDatePage> {
|
||||
final logic = Get.put(PasswordKeyDetailChangeDateLogic());
|
||||
final state = Get.find<PasswordKeyDetailChangeDateLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.periodValidity!.tr}",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.sure!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if (state.lockId.value != 0 && state.pwdId.value.isNotEmpty) {
|
||||
logic.updatePwdRequest();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: buildMainUI(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildMainUI() {
|
||||
String getStartDate = "";
|
||||
String getEndDate = "";
|
||||
if (state.itemData.value.startDate != null) {
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||
getStartDate = startDateStr.toLocal().toString().substring(0, 16);
|
||||
}
|
||||
|
||||
if (state.itemData.value.endDate != null) {
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||
getEndDate = endDateStr.toLocal().toString().substring(0, 16);
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.selectEffectiveDate.value.isNotEmpty
|
||||
? state.selectEffectiveDate.value
|
||||
: getStartDate,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.selectEffectiveDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
state.effectiveDateTime =
|
||||
DateTime.parse(state.selectEffectiveDate.value);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: state.selectFailureDate.value.isNotEmpty
|
||||
? state.selectFailureDate.value
|
||||
: getEndDate,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.selectFailureDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
state.failureDateTime =
|
||||
DateTime.parse(state.selectFailureDate.value);
|
||||
});
|
||||
})),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
String intToStr(int v) {
|
||||
return (v < 10) ? "0$v" : "$v";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
|
||||
class PasswordKeyDetailChangeDateState {
|
||||
final itemData = PasswordKeyListItem().obs;
|
||||
final TextEditingController inputPwdController = TextEditingController();
|
||||
final TextEditingController inputNameController = TextEditingController();
|
||||
final changeType = '1'
|
||||
.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效
|
||||
final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警)
|
||||
final hoursStart = 0.obs;
|
||||
final hoursEnd = 0.obs;
|
||||
final startDate = 0.obs;
|
||||
final endDate = 0.obs;
|
||||
final pwdId = ''.obs;
|
||||
final lockId = 0.obs;
|
||||
final fromType = ''.obs;
|
||||
final selectEffectiveDate = ''.obs; //生效时间
|
||||
final selectFailureDate = ''.obs; //失效时间
|
||||
DateTime effectiveDateTime = DateTime.now();
|
||||
DateTime failureDateTime = DateTime.now();
|
||||
final endDay = ''.obs;
|
||||
final startDay = ''.obs;
|
||||
final weekDays = [].obs;
|
||||
|
||||
PasswordKeyDetailChangeDateState() {
|
||||
Map map = Get.arguments;
|
||||
// itemData.value = map["itemData"];
|
||||
if ((map["itemData"] != null)) {
|
||||
itemData.value = map["itemData"];
|
||||
}
|
||||
if ((map["pwdId"] != null)) {
|
||||
pwdId.value = map["pwdId"];
|
||||
}
|
||||
if ((map["lockId"] != null)) {
|
||||
lockId.value = map["lockId"];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ class PasswordKeyListItem {
|
||||
int? lockId;
|
||||
String? keyboardPwd;
|
||||
String? keyboardPwdName;
|
||||
int? keyboardPwdStatus;
|
||||
int? keyboardPwdStatus; //1:正常 2:已过期
|
||||
int? keyboardPwdType;
|
||||
int? startDate;
|
||||
int? endDate;
|
||||
|
||||
@ -182,7 +182,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
),
|
||||
child: _electronicKeyItem('images/icon_password.png',
|
||||
child: _electronicKeyItem(index, 'images/icon_password.png',
|
||||
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||
arguments: {"itemData": passwordKeyListItem}).then((val) {
|
||||
@ -334,8 +334,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle,
|
||||
String useDateStr, Function()? action) {
|
||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
|
||||
String lockTypeTitle, String useDateStr, Function()? action) {
|
||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
||||
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
@ -367,6 +369,20 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 20.w,
|
||||
)),
|
||||
passwordKeyListItem.keyboardPwdStatus == 2
|
||||
? Text(
|
||||
'已失效',
|
||||
style:
|
||||
TextStyle(color: Colors.red, fontSize: 20.sp),
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user