1,新增APP打开时需联网的锁接口及页面逻辑
2,新增到期列表修改日期页面及接口调试逻辑 3,新增退出登录接口
This commit is contained in:
parent
b83a5c4c01
commit
41338d8392
@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
||||||
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
||||||
@ -15,6 +13,7 @@ import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdmi
|
|||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
|
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockChangeDate_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart';
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList_Page.dart';
|
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList_Page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/mineSet_page.dart';
|
import 'package:star_lock/mine/mineSet/mineSet_page.dart';
|
||||||
@ -162,10 +161,14 @@ abstract class Routers {
|
|||||||
static const passwordKeyManagePage = '/PasswordKeyManagePage'; // 密码钥匙
|
static const passwordKeyManagePage = '/PasswordKeyManagePage'; // 密码钥匙
|
||||||
static const passwordKeyDetailPage = '/PasswordKeyDetailPage'; // 密码钥匙详情
|
static const passwordKeyDetailPage = '/PasswordKeyDetailPage'; // 密码钥匙详情
|
||||||
static const otherTypeKeyListPage = '/OtherTypeKeyListPage'; // 卡、指纹、遥控钥匙列表
|
static const otherTypeKeyListPage = '/OtherTypeKeyListPage'; // 卡、指纹、遥控钥匙列表
|
||||||
static const otherTypeKeyDetailPage = '/OtherTypeKeyDetailPage'; // 卡、指纹、遥控钥匙详情
|
static const otherTypeKeyDetailPage =
|
||||||
static const otherTypeKeyManagePage = '/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加
|
'/OtherTypeKeyDetailPage'; // 卡、指纹、遥控钥匙详情
|
||||||
static const otherTypeKeyChangeDatePage = '/OtherTypeKeyChangeDatePage'; // 卡、指纹、遥控钥匙详情修改日期
|
static const otherTypeKeyManagePage =
|
||||||
static const otherTypeKeyChangeValidityDatePage = '/OtherTypeKeyChangeValidityDatePage'; // 卡、指纹、遥控钥匙详情修改有效期
|
'/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加
|
||||||
|
static const otherTypeKeyChangeDatePage =
|
||||||
|
'/OtherTypeKeyChangeDatePage'; // 卡、指纹、遥控钥匙详情修改日期
|
||||||
|
static const otherTypeKeyChangeValidityDatePage =
|
||||||
|
'/OtherTypeKeyChangeValidityDatePage'; // 卡、指纹、遥控钥匙详情修改有效期
|
||||||
|
|
||||||
static const addFingerprintTipPage = '/AddFingerprintTipPage'; // 添加指纹提示
|
static const addFingerprintTipPage = '/AddFingerprintTipPage'; // 添加指纹提示
|
||||||
static const addFingerprintPage = '/AddFingerprintPage'; // 添加指纹
|
static const addFingerprintPage = '/AddFingerprintPage'; // 添加指纹
|
||||||
@ -223,7 +226,8 @@ abstract class Routers {
|
|||||||
'/CheckingInSetHolidaysPage'; // 节假日设置
|
'/CheckingInSetHolidaysPage'; // 节假日设置
|
||||||
static const checkingInAddHolidaysPage = '/CheckingInAddHolidaysPage'; // 添加假日
|
static const checkingInAddHolidaysPage = '/CheckingInAddHolidaysPage'; // 添加假日
|
||||||
static const checkingInDetailPage = '/CheckingInDetailPage'; // 考勤详情
|
static const checkingInDetailPage = '/CheckingInDetailPage'; // 考勤详情
|
||||||
static const checkingInDeletHolidaysPage = '/CheckingInDeletHolidaysPage'; // 删除考勤
|
static const checkingInDeletHolidaysPage =
|
||||||
|
'/CheckingInDeletHolidaysPage'; // 删除考勤
|
||||||
|
|
||||||
static const mineSetPage = '/MineSetPage'; // 我的设置
|
static const mineSetPage = '/MineSetPage'; // 我的设置
|
||||||
static const mineMultiLanguagePage = '/MineMultiLanguagePage'; // 我的设置
|
static const mineMultiLanguagePage = '/MineMultiLanguagePage'; // 我的设置
|
||||||
@ -317,6 +321,8 @@ abstract class Routers {
|
|||||||
static const adminDetailChangeDatePage =
|
static const adminDetailChangeDatePage =
|
||||||
'/adminDetailChangeDatePage'; //管理员详情修改生效时间
|
'/adminDetailChangeDatePage'; //管理员详情修改生效时间
|
||||||
static const adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表
|
static const adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表
|
||||||
|
static const expireLockChangeDatePage =
|
||||||
|
'/expireLockChangeDatePage'; //即将到期列表有效期修改
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AppRouters {
|
abstract class AppRouters {
|
||||||
@ -798,6 +804,9 @@ abstract class AppRouters {
|
|||||||
GetPage(name: Routers.addICCardPage, page: () => const AddICCardPage()),
|
GetPage(name: Routers.addICCardPage, page: () => const AddICCardPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.adminDetailChangeDatePage,
|
name: Routers.adminDetailChangeDatePage,
|
||||||
page: () => const AdminDetailChangeDatePage())
|
page: () => const AdminDetailChangeDatePage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.expireLockChangeDatePage,
|
||||||
|
page: () => const ExpireLockChangeDatePage())
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/commonItem.dart';
|
import '../../../tools/commonItem.dart';
|
||||||
@ -18,6 +22,16 @@ class APPUnlockNeedMobileNetworkingLockPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _APPUnlockNeedMobileNetworkingLockPageState
|
class _APPUnlockNeedMobileNetworkingLockPageState
|
||||||
extends State<APPUnlockNeedMobileNetworkingLockPage> {
|
extends State<APPUnlockNeedMobileNetworkingLockPage> {
|
||||||
|
List<LockItemData> lockItemList = [];
|
||||||
|
List selectLockIdList = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -73,19 +87,22 @@ class _APPUnlockNeedMobileNetworkingLockPageState
|
|||||||
SizedBox(height: 15.h),
|
SizedBox(height: 15.h),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: 10,
|
itemCount: lockItemList.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
return _gatewatListItem(
|
LockItemData itemData = lockItemList[index];
|
||||||
'images/mine/icon_mine_gatewayListMainIcon.png',
|
// itemData.isCheck = false;
|
||||||
"星锁网关",
|
return _gatewatListItem(itemData);
|
||||||
"在线",
|
|
||||||
"2", () {
|
|
||||||
// Navigator.pushNamed(context, Routers.gatewayDetailPage);
|
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () {}),
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
|
onClick: () {
|
||||||
|
if (selectLockIdList.isNotEmpty) {
|
||||||
|
setAppUnlockMustOnlineRequest();
|
||||||
|
} else {
|
||||||
|
Toast.show(msg: '请选择需设置的锁');
|
||||||
|
}
|
||||||
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
)
|
)
|
||||||
@ -93,10 +110,18 @@ class _APPUnlockNeedMobileNetworkingLockPageState
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _gatewatListItem(String lockTypeIcon, String gateWayName,
|
Widget _gatewatListItem(LockItemData itemData) {
|
||||||
String isOnline, String lockNumber, Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
itemData.isCheck = !itemData.isCheck;
|
||||||
|
if (itemData.isCheck == true) {
|
||||||
|
selectLockIdList.add(itemData.lockId);
|
||||||
|
} else {
|
||||||
|
selectLockIdList.remove(itemData.lockId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 80.h,
|
height: 80.h,
|
||||||
margin: const EdgeInsets.only(bottom: 2),
|
margin: const EdgeInsets.only(bottom: 2),
|
||||||
@ -112,7 +137,9 @@ class _APPUnlockNeedMobileNetworkingLockPageState
|
|||||||
width: 15.w,
|
width: 15.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/icon_round_unSelet.png',
|
itemData.isCheck == true
|
||||||
|
? 'images/icon_round_selet.png'
|
||||||
|
: 'images/icon_round_unSelet.png',
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
height: 30.w,
|
height: 30.w,
|
||||||
),
|
),
|
||||||
@ -120,7 +147,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState
|
|||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"MCBN01_8f3106",
|
itemData.lockAlias ?? "",
|
||||||
style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w600),
|
style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w600),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -128,4 +155,26 @@ class _APPUnlockNeedMobileNetworkingLockPageState
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//请求锁列表
|
||||||
|
Future<List<LockItemData>> mockNetworkDataRequest() async {
|
||||||
|
SelectLockListEntity entity = await ApiRepository.to.selectLockList();
|
||||||
|
List<LockItemData> dataList = [];
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
dataList = entity.data!.list!;
|
||||||
|
setState(() {
|
||||||
|
lockItemList = dataList;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
//APP开锁时需手机联网的锁
|
||||||
|
Future<void> setAppUnlockMustOnlineRequest() async {
|
||||||
|
SelectLockListEntity entity =
|
||||||
|
await ApiRepository.to.setAppUnlockMustOnline(selectLockIdList);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: '操作成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,70 @@
|
|||||||
|
class SelectLockListEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
|
SelectLockListEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
SelectLockListEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['errorCode'] = errorCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['errorMsg'] = errorMsg;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data!.toJson();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
List<LockItemData>? list;
|
||||||
|
|
||||||
|
Data({this.list});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['list'] != null) {
|
||||||
|
list = <LockItemData>[];
|
||||||
|
json['list'].forEach((v) {
|
||||||
|
list!.add(LockItemData.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (list != null) {
|
||||||
|
data['list'] = list!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LockItemData {
|
||||||
|
int? lockId;
|
||||||
|
String? lockAlias;
|
||||||
|
bool isCheck = false;
|
||||||
|
|
||||||
|
LockItemData({this.lockId, this.lockAlias, required this.isCheck});
|
||||||
|
|
||||||
|
LockItemData.fromJson(Map<String, dynamic> json) {
|
||||||
|
lockId = json['lockId'];
|
||||||
|
lockAlias = json['lockAlias'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['lockId'] = lockId;
|
||||||
|
data['lockAlias'] = lockAlias;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -113,46 +113,6 @@ class _AdminDetailChangeDatePage extends State<AdminDetailChangeDatePage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
//修改钥匙名称请求
|
|
||||||
Future<void> updateKeyDateRequest() async {
|
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
|
||||||
itemData.keyId.toString(),
|
|
||||||
itemData.lockId.toString(),
|
|
||||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
|
||||||
endDay,
|
|
||||||
'',
|
|
||||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
|
||||||
startDay,
|
|
||||||
weekDays);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("修改要是名称成功啦啦啦啦啦");
|
|
||||||
Toast.show(msg: "修改成功");
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//更新密码请求
|
|
||||||
Future<void> updatePwdRequest() async {
|
|
||||||
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
|
||||||
lockId,
|
|
||||||
pwdId,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
|
||||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
|
||||||
'');
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
Toast.show(msg: "修改成功");
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
String intToStr(int v) {
|
String intToStr(int v) {
|
||||||
return (v < 10) ? "0$v" : "$v";
|
return (v < 10) ? "0$v" : "$v";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -229,7 +229,7 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isOnRemote = !_isOnRemote;
|
_isOnRemote = !_isOnRemote;
|
||||||
updateAdministratorRequest();
|
updateAdministratorRequest(true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -247,7 +247,7 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//更新管理员信息请求
|
//更新管理员信息请求
|
||||||
Future<void> updateAdministratorRequest() async {
|
Future<void> updateAdministratorRequest(bool isRemote) async {
|
||||||
String isRemoteUnlock = _isOnRemote == true ? '1' : '2';
|
String isRemoteUnlock = _isOnRemote == true ? '1' : '2';
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
|
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
|
||||||
itemData.uid.toString(),
|
itemData.uid.toString(),
|
||||||
@ -259,7 +259,9 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
print("修改管理员信息成功啦啦啦啦啦");
|
print("修改管理员信息成功啦啦啦啦啦");
|
||||||
Toast.show(msg: "修改成功");
|
Toast.show(msg: "修改成功");
|
||||||
setState(() {
|
setState(() {
|
||||||
Navigator.pop(context);
|
if (isRemote) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,7 +291,7 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
//发送编辑钥匙名称请求
|
||||||
if (_changeNameController.text.isNotEmpty) {
|
if (_changeNameController.text.isNotEmpty) {
|
||||||
updateAdministratorRequest();
|
updateAdministratorRequest(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
|
|||||||
@ -0,0 +1,121 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_pickers/pickers.dart';
|
||||||
|
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class ExpireLockChangeDatePage extends StatefulWidget {
|
||||||
|
const ExpireLockChangeDatePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ExpireLockChangeDatePage> createState() =>
|
||||||
|
_ExpireLockChangeDatePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ExpireLockChangeDatePageState extends State<ExpireLockChangeDatePage> {
|
||||||
|
ExpireLockItem itemData = ExpireLockItem();
|
||||||
|
|
||||||
|
String _selectEffectiveDate = ''; //生效时间
|
||||||
|
String _selectFailureDate = ''; //失效时间
|
||||||
|
late DateTime _effectiveDateTime;
|
||||||
|
late DateTime _failureDateTime;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["itemData"] != null)) {
|
||||||
|
itemData = obj["itemData"];
|
||||||
|
}
|
||||||
|
|
||||||
|
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: () {
|
||||||
|
updateKeyDateRequest();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: buildMainUI(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildMainUI() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
|
rightTitle: _selectEffectiveDate,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
_selectEffectiveDate =
|
||||||
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
|
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
|
rightTitle: _selectFailureDate,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
_selectFailureDate =
|
||||||
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
|
_failureDateTime = DateTime.parse(_selectFailureDate);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改有效期请求
|
||||||
|
Future<void> updateKeyDateRequest() async {
|
||||||
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||||
|
itemData.keyId.toString(),
|
||||||
|
itemData.lockId.toString(),
|
||||||
|
_failureDateTime.millisecondsSinceEpoch.toString(),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||||
|
'', []);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("修改要是名称成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "修改成功");
|
||||||
|
setState(() {
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String intToStr(int v) {
|
||||||
|
return (v < 10) ? "0$v" : "$v";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -83,8 +83,8 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
Widget _electronicKeyItem(ExpireLockItem itemData) {
|
Widget _electronicKeyItem(ExpireLockItem itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushNamed(context, Routers.ownedKeyListPage,
|
Navigator.pushNamed(context, Routers.expireLockChangeDatePage,
|
||||||
arguments: {'uid': itemData.uid});
|
arguments: {"itemData": itemData});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 90.h,
|
height: 90.h,
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/mine/mineSet/entity/userSettingInfoEntity.dart';
|
import 'package:star_lock/mine/mineSet/entity/userSettingInfoEntity.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
@ -243,7 +244,10 @@ class _MineSetPageState extends State<MineSetPage> {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.logout!.tr,
|
btnName: TranslationLoader.lanKeys!.logout!.tr,
|
||||||
isDelete: true,
|
isDelete: true,
|
||||||
onClick: () {}),
|
onClick: () {
|
||||||
|
//退出登录
|
||||||
|
userLogoutRequest();
|
||||||
|
}),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(right: 30.w),
|
padding: EdgeInsets.only(right: 30.w),
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
@ -301,6 +305,16 @@ class _MineSetPageState extends State<MineSetPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//退出登录请求
|
||||||
|
Future<void> userLogoutRequest() async {
|
||||||
|
LoginEntity entity = await ApiRepository.to.userLogout();
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
setState(() {
|
||||||
|
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//更新触摸开锁
|
//更新触摸开锁
|
||||||
Future<void> updateTouchUnlockRequest() async {
|
Future<void> updateTouchUnlockRequest() async {
|
||||||
ExpireLockListEntity entity = await ApiRepository.to
|
ExpireLockListEntity entity = await ApiRepository.to
|
||||||
|
|||||||
@ -105,4 +105,8 @@ abstract class Api {
|
|||||||
final String setAlertModeURL = '/user/setAlertMode'; //提示音
|
final String setAlertModeURL = '/user/setAlertMode'; //提示音
|
||||||
final String setTouchUnlockFlagURL = '/user/setTouchUnlockFlag'; //触摸开锁
|
final String setTouchUnlockFlagURL = '/user/setTouchUnlockFlag'; //触摸开锁
|
||||||
final String changeSettingsURL = '/user/changeSettings'; //锁屏/隐藏无效开锁权限
|
final String changeSettingsURL = '/user/changeSettings'; //锁屏/隐藏无效开锁权限
|
||||||
|
final String selectLockListURL = '/room/listForTransfer'; //选择锁列表
|
||||||
|
final String setAppUnlockMustOnlineURL =
|
||||||
|
'/room/setAppUnlockMustOnline'; //APP开锁时需手机联网的锁
|
||||||
|
final String userLogoutURL = '/user/logout'; //退出登录
|
||||||
}
|
}
|
||||||
|
|||||||
@ -402,6 +402,13 @@ class ApiProvider extends BaseProvider {
|
|||||||
Future<Response> lockGroupList(String type) =>
|
Future<Response> lockGroupList(String type) =>
|
||||||
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
|
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
|
||||||
|
|
||||||
|
Future<Response> selectLockList() =>
|
||||||
|
post(selectLockListURL.toUrl, jsonEncode({}));
|
||||||
|
|
||||||
|
//APP开锁时需手机联网的锁
|
||||||
|
Future<Response> setAppUnlockMustOnline(List lockIdList) => post(
|
||||||
|
setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList}));
|
||||||
|
|
||||||
Future<Response> deleteElectronicKey(String keyId) =>
|
Future<Response> deleteElectronicKey(String keyId) =>
|
||||||
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId}));
|
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId}));
|
||||||
|
|
||||||
@ -1055,6 +1062,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
'usernameType': usernameType
|
'usernameType': usernameType
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
//退出登录
|
||||||
|
Future<Response> userLogout() => get(userLogoutURL.toUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformat
|
|||||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
import 'package:star_lock/mine/mineSet/entity/userSettingInfoEntity.dart';
|
import 'package:star_lock/mine/mineSet/entity/userSettingInfoEntity.dart';
|
||||||
@ -388,6 +389,18 @@ class ApiRepository {
|
|||||||
return MassSendLockGroupListEntity.fromJson(res.body);
|
return MassSendLockGroupListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//选择锁列表
|
||||||
|
Future<SelectLockListEntity> selectLockList() async {
|
||||||
|
final res = await apiProvider.selectLockList();
|
||||||
|
return SelectLockListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//APP开锁时需手机联网的锁
|
||||||
|
Future<SelectLockListEntity> setAppUnlockMustOnline(List lockIdList) async {
|
||||||
|
final res = await apiProvider.setAppUnlockMustOnline(lockIdList);
|
||||||
|
return SelectLockListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//删除电子钥匙
|
//删除电子钥匙
|
||||||
Future<ElectronicKeyListEntity> deleteElectronicKey(String keyId) async {
|
Future<ElectronicKeyListEntity> deleteElectronicKey(String keyId) async {
|
||||||
final res = await apiProvider.deleteElectronicKey(keyId);
|
final res = await apiProvider.deleteElectronicKey(keyId);
|
||||||
@ -1032,4 +1045,10 @@ class ApiRepository {
|
|||||||
lockId, cardId, cardUserNo);
|
lockId, cardId, cardUserNo);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 退出登录
|
||||||
|
Future<LoginEntity> userLogout() async {
|
||||||
|
final res = await apiProvider.userLogout();
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user