1、添加锁管理模块中,密码、卡、指纹即将到期功能。2、修改TAPD bug
This commit is contained in:
parent
a6602f1d27
commit
665c1922b8
@ -17,6 +17,8 @@ import 'baseWidget.dart';
|
||||
import 'tools/appRouteObserver.dart';
|
||||
import 'dart:io';
|
||||
|
||||
import 'tools/store_service.dart';
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({GlobalKey? key}) : super(key: key);
|
||||
|
||||
@ -47,8 +49,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
],
|
||||
localeResolutionCallback: (locale, supportedLocales) {
|
||||
if (!supportedLocales.contains(locale)) {
|
||||
int idx = appSupportedLocales.indexWhere(
|
||||
(element) => element.languageCode == locale!.languageCode);
|
||||
int idx = appSupportedLocales.indexWhere((element) => element.languageCode == locale!.languageCode);
|
||||
if (idx != -1) {
|
||||
locale = appSupportedLocales[idx];
|
||||
} else {
|
||||
@ -56,12 +57,11 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
}
|
||||
}
|
||||
// print("localelocalelocalelocalelocale locale:${locale} locale.languageCode:${locale.languageCode} locale.countryCode:${locale.countryCode} supportedLocales:${supportedLocales}");
|
||||
AppManager()
|
||||
.setLanCode(code: '${locale!.languageCode}_${locale.countryCode}');
|
||||
AppManager().setLanCode(code: '${locale!.languageCode}_${locale.countryCode}');
|
||||
return locale;
|
||||
},
|
||||
// locale: StoreService.to.getLanguageCode().isNotEmpty ? appDept.deptSupportedLocales.where((element) => element.languageCode == StoreService.to.getLanguageCode()).first : Get.deviceLocale,
|
||||
locale: Get.deviceLocale,
|
||||
locale: StoreService.to.getLanguageCode()!.isNotEmpty ? appDept.deptSupportedLocales.where((element) => element.languageCode == StoreService.to.getLanguageCode()).first : Get.deviceLocale,
|
||||
// locale: Get.deviceLocale,
|
||||
fallbackLocale: const Locale('zh', 'CN'),
|
||||
theme: ThemeData(
|
||||
scaffoldBackgroundColor: const Color(0xFFF6F6F6),
|
||||
|
||||
@ -30,7 +30,7 @@ import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/mi
|
||||
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/lockGroup/lockGroupList/lockGroupList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockManage_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_page.dart';
|
||||
@ -368,12 +368,10 @@ abstract class Routers {
|
||||
static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人
|
||||
static const lockUserListPage = '/lockUserListPage'; //锁用户列表
|
||||
static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情
|
||||
static const expireLockListPage = '/expireLockListPage'; //即将到期
|
||||
static const expireLockManagePage = '/expireLockManagePage'; //即将到期
|
||||
static const adminDetailChangeDatePage =
|
||||
'/adminDetailChangeDatePage'; //管理员详情修改生效时间
|
||||
static const adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表
|
||||
static const expireLockChangeDatePage =
|
||||
'/expireLockChangeDatePage'; //即将到期列表有效期修改
|
||||
static const safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证
|
||||
static const webviewShowPage = '/webviewShowPage'; //网页
|
||||
static const demoModeLockDetailPage = '/DemoModeLockDetailPage'; // 演示模式锁详情页
|
||||
@ -906,8 +904,8 @@ abstract class AppRouters {
|
||||
name: Routers.administratorDetailsPage,
|
||||
page: () => const AdministratorDetailsPage()),
|
||||
GetPage(
|
||||
name: Routers.expireLockListPage,
|
||||
page: () => const ExpireLockListPage()),
|
||||
name: Routers.expireLockManagePage,
|
||||
page: () => const ExpireLockManagePage()),
|
||||
GetPage(
|
||||
name: Routers.otherTypeKeyChangeDatePage,
|
||||
page: () => const OtherTypeKeyChangeDatePage()),
|
||||
|
||||
@ -99,6 +99,13 @@ class SenderGetWifiCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
class SenderGetWifiReply extends Reply {
|
||||
SenderGetWifiReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderGetWifiListReply extends Reply {
|
||||
SenderGetWifiListReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
|
||||
@ -111,7 +111,7 @@ class CommandReciverManager {
|
||||
break;
|
||||
}
|
||||
parseData(oriDataList).then((value) async {
|
||||
// Get.log("parseData222 data:$value");
|
||||
Get.log("parseData222 data:$value");
|
||||
EasyLoading.dismiss();
|
||||
await EventBusManager().eventBusFir(value);
|
||||
}).catchError((error) {
|
||||
@ -293,6 +293,13 @@ class CommandReciverManager {
|
||||
SenderConfiguringWifiReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 53:
|
||||
{
|
||||
// 获取wifilist
|
||||
reply =
|
||||
SenderGetWifiReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 54:
|
||||
{
|
||||
// 门锁搜索2.4G WIFI SSID 结果
|
||||
|
||||
@ -17,6 +17,10 @@ class OtherTypeKeyChangeDateState{
|
||||
pushType.value = map["pushType"];
|
||||
}
|
||||
|
||||
if(map["fingerprintItemData"] != null){
|
||||
fingerprintItemData.value = map["fingerprintItemData"];
|
||||
}
|
||||
|
||||
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
|
||||
// getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //生效时间
|
||||
// // state.selectEffectiveDate.value = getStartDate;
|
||||
|
||||
@ -56,11 +56,11 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//删除电子钥匙名称请求 setAdministrator
|
||||
//删除电子钥匙名称请求
|
||||
Future<void> deleteKeyRequest(int includeUnderlings) async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
||||
keyId:state.itemData.value.keyId.toString(),
|
||||
includeUnderlings: 0
|
||||
includeUnderlings: includeUnderlings
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("删除电子钥匙成功");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
|
||||
|
||||
@ -455,6 +455,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// signKey: signKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// );
|
||||
|
||||
Get.log("openMode:$openMode");
|
||||
BlueManage()
|
||||
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
|
||||
@ -22,12 +22,52 @@ class WifiListLogic extends BaseGetXController {
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
if(reply is SenderGetWifiReply) {
|
||||
_replySendGetWifiParameters(reply);
|
||||
}
|
||||
|
||||
if(reply is SenderGetWifiListReply) {
|
||||
_replyGetWifiListParameters(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 发送获取wifi列表数据解析
|
||||
Future<void> _replySendGetWifiParameters(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
showEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
Future.delayed(5.seconds, (){
|
||||
dismissEasyLoading();
|
||||
});
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 设置自动落锁数据解析
|
||||
Future<void> _replyGetWifiListParameters(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
@ -36,11 +76,8 @@ class WifiListLogic extends BaseGetXController {
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
// showEasyLoading();
|
||||
Future.delayed(4.seconds, (){
|
||||
dismissEasyLoading();
|
||||
});
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
if (reply.data[6] > 0) {
|
||||
reply.data.removeRange(0, 7);
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -78,15 +79,22 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
rightTitle: "",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
Map result = await Get.toNamed(
|
||||
Routers.electronicKeyPeriodValidityPage);
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.effectiveDateTime.value =
|
||||
result['starDate'].millisecondsSinceEpoch;
|
||||
state.failureDateTime.value =
|
||||
result['endDate'].millisecondsSinceEpoch;
|
||||
print(
|
||||
'得到的有效期数据:${state.weekdaysList.value} == ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.beginTime.value,
|
||||
'endDate': state.endTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
if(result != null && result.isNotEmpty){
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
state.endTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
}
|
||||
}),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
@ -103,7 +111,6 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
String titleStr, String rightTitle, TextEditingController controller) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: titleStr,
|
||||
rightTitle: "",
|
||||
@ -126,16 +133,7 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
action: () async {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
setState(() {
|
||||
state.beginTime.value =
|
||||
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
|
||||
state.beginTimeTimestamp.value =
|
||||
DateTime.parse(state.beginTime.value)
|
||||
.millisecondsSinceEpoch
|
||||
.toString();
|
||||
});
|
||||
});
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -143,18 +141,8 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
rightTitle: state.endTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
setState(() {
|
||||
state.endTime.value =
|
||||
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
|
||||
state.endTimeTimestamp.value =
|
||||
DateTime.parse(state.endTime.value)
|
||||
.millisecondsSinceEpoch
|
||||
.toString();
|
||||
});
|
||||
});
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Container(height: 10.h),
|
||||
|
||||
@ -6,11 +6,8 @@ class AddRemoteControlState{
|
||||
|
||||
var beginTime = "".obs;// 开始时间
|
||||
var endTime = "".obs;// 结束时间
|
||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
||||
|
||||
var effectiveDateTime = 0.obs;// 生效时间
|
||||
var failureDateTime = 0.obs;// 失效时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
|
||||
@ -39,18 +39,18 @@ class _MineMultiLanguagePageState extends State<MineMultiLanguagePage> {
|
||||
|
||||
List<Widget> _children() {
|
||||
List<Widget> l = [];
|
||||
l.add(
|
||||
CommonItem(
|
||||
leftTitel: '跟随系统',
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: Container(),
|
||||
action: () {
|
||||
// logic.changeLanguage(e);
|
||||
}),
|
||||
);
|
||||
// l.add(
|
||||
// CommonItem(
|
||||
// leftTitel: '跟随系统',
|
||||
// rightTitle: "",
|
||||
// isHaveLine: true,
|
||||
// isHaveDirection: false,
|
||||
// isHaveRightWidget: true,
|
||||
// rightWidget: Container(),
|
||||
// action: () {
|
||||
// // logic.changeLanguage(e);
|
||||
// }),
|
||||
// );
|
||||
for (int i = 0; i < state.languages.length; i++) {
|
||||
var e = state.languages[i];
|
||||
var lanType = ExtensionLanguageType.fromLanguageCode(e.languageCode);
|
||||
|
||||
@ -20,6 +20,6 @@ class MineMultiLanguageState {
|
||||
void resetLan() {
|
||||
currentLanguageType.value = ExtensionLanguageType.fromLanguageCode(Get.locale!.languageCode);
|
||||
print("currentLanguageType.value:${currentLanguageType.value}");
|
||||
// StoreService.to.saveLanguageCode(Get.locale!.languageCode);
|
||||
StoreService.to.saveLanguageCode(Get.locale!.languageCode);
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,7 @@ import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectL
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/commonItem.dart';
|
||||
import '../../../tools/noData.dart';
|
||||
import '../../../tools/submitBtn.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
@ -46,7 +47,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
||||
// ))
|
||||
// ],
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
body: Obx(() => state.lockItemList.value.isEmpty ? NoData() :Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(30.w),
|
||||
@ -73,10 +74,10 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
||||
state.isCheckAll.value = !state.isCheckAll.value;
|
||||
for(LockItemData lockItemData in state.lockItemList.value){
|
||||
if(state.isCheckAll.value == true){
|
||||
lockItemData.isCheck = true;
|
||||
lockItemData.appUnlockOnline = 1;
|
||||
state.selectLockIdList.add(lockItemData.lockId);
|
||||
}else{
|
||||
lockItemData.isCheck = false;
|
||||
lockItemData.appUnlockOnline = 0;
|
||||
state.selectLockIdList = [];
|
||||
}
|
||||
}
|
||||
@ -94,7 +95,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
||||
)),
|
||||
SizedBox(height: 15.h),
|
||||
Expanded(
|
||||
child: Obx(() => ListView.builder(
|
||||
child: ListView.builder(
|
||||
itemCount: state.lockItemList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
LockItemData itemData = state.lockItemList.value[index];
|
||||
@ -104,7 +105,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
||||
// itemData.isCheck = false;
|
||||
// }
|
||||
return _gatewatListItem(itemData);
|
||||
})),
|
||||
}),
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
@ -119,17 +120,18 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
||||
height: 40.h,
|
||||
)
|
||||
],
|
||||
));
|
||||
)));
|
||||
}
|
||||
|
||||
Widget _gatewatListItem(LockItemData itemData) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
itemData.isCheck = !itemData.isCheck;
|
||||
if (itemData.isCheck == true) {
|
||||
if (itemData.appUnlockOnline == 0) {
|
||||
itemData.appUnlockOnline = 1;
|
||||
state.selectLockIdList.add(itemData.lockId);
|
||||
} else {
|
||||
itemData.appUnlockOnline = 0;
|
||||
state.selectLockIdList.remove(itemData.lockId);
|
||||
}
|
||||
|
||||
@ -155,7 +157,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
||||
width: 15.w,
|
||||
),
|
||||
Image.asset(
|
||||
itemData.isCheck == true
|
||||
itemData.appUnlockOnline == 1
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
|
||||
@ -52,19 +52,25 @@ class Data {
|
||||
class LockItemData {
|
||||
int? lockId;
|
||||
String? lockAlias;
|
||||
bool isCheck = false;
|
||||
int? appUnlockOnline;
|
||||
|
||||
LockItemData({this.lockId, this.lockAlias, required this.isCheck});
|
||||
LockItemData({
|
||||
this.lockId,
|
||||
this.lockAlias,
|
||||
this.appUnlockOnline,
|
||||
});
|
||||
|
||||
LockItemData.fromJson(Map<String, dynamic> json) {
|
||||
lockId = json['lockId'];
|
||||
lockAlias = json['lockAlias'];
|
||||
appUnlockOnline = json['appUnlockOnline'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['lockId'] = lockId;
|
||||
data['lockAlias'] = lockAlias;
|
||||
data['appUnlockOnline'] = appUnlockOnline;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
|
||||
@ -0,0 +1,217 @@
|
||||
class ExpireCardEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
ExpireCardListEntity? data;
|
||||
|
||||
ExpireCardEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
ExpireCardEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? ExpireCardListEntity.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 ExpireCardListEntity {
|
||||
List<ExpireCardItemEntity>? list;
|
||||
int? pageNo;
|
||||
int? pageSize;
|
||||
int? pages;
|
||||
int? total;
|
||||
|
||||
ExpireCardListEntity({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
||||
|
||||
ExpireCardListEntity.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] != null) {
|
||||
list = <ExpireCardItemEntity>[];
|
||||
json['list'].forEach((v) {
|
||||
list!.add(ExpireCardItemEntity.fromJson(v));
|
||||
});
|
||||
}
|
||||
pageNo = json['pageNo'];
|
||||
pageSize = json['pageSize'];
|
||||
pages = json['pages'];
|
||||
total = json['total'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (list != null) {
|
||||
data['list'] = list!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['pageNo'] = pageNo;
|
||||
data['pageSize'] = pageSize;
|
||||
data['pages'] = pages;
|
||||
data['total'] = total;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ExpireCardItemEntity {
|
||||
String? clientId;
|
||||
int? lockOwnerId;
|
||||
int? lockId;
|
||||
String? cardNumber;
|
||||
int? startDate;
|
||||
int? endDate;
|
||||
int? cardStatus;
|
||||
int? cardType;
|
||||
int? cardRight;
|
||||
List? weekDay;
|
||||
int? addType;
|
||||
int? isCoerced;
|
||||
int? cardUserNo;
|
||||
int? businessId;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
ApiUser? apiUser;
|
||||
LockInfo? lockInfo;
|
||||
int? cardId;
|
||||
int? uid;
|
||||
String? nickname;
|
||||
String? lockAlias;
|
||||
int? expireDate;
|
||||
|
||||
ExpireCardItemEntity(
|
||||
{this.clientId,
|
||||
this.lockOwnerId,
|
||||
this.lockId,
|
||||
this.cardNumber,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.cardStatus,
|
||||
this.cardType,
|
||||
this.cardRight,
|
||||
this.weekDay,
|
||||
this.addType,
|
||||
this.isCoerced,
|
||||
this.cardUserNo,
|
||||
this.businessId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.apiUser,
|
||||
this.lockInfo,
|
||||
this.cardId,
|
||||
this.uid,
|
||||
this.nickname,
|
||||
this.lockAlias,
|
||||
this.expireDate});
|
||||
|
||||
ExpireCardItemEntity.fromJson(Map<String, dynamic> json) {
|
||||
clientId = json['clientId'];
|
||||
lockOwnerId = json['lockOwnerId'];
|
||||
lockId = json['lockId'];
|
||||
cardNumber = json['cardNumber'];
|
||||
startDate = json['startDate'];
|
||||
endDate = json['endDate'];
|
||||
cardStatus = json['cardStatus'];
|
||||
cardType = json['cardType'];
|
||||
cardRight = json['cardRight'];
|
||||
if (json['weekDays'] != null) {
|
||||
weekDay = [];
|
||||
json['weekDays'].forEach((v) {
|
||||
weekDay!.add(v);
|
||||
});
|
||||
}
|
||||
addType = json['addType'];
|
||||
isCoerced = json['isCoerced'];
|
||||
cardUserNo = json['cardUserNo'];
|
||||
businessId = json['businessId'];
|
||||
createdAt = json['created_at'];
|
||||
updatedAt = json['updated_at'];
|
||||
apiUser = json['api_user'] != null
|
||||
? ApiUser.fromJson(json['api_user'])
|
||||
: null;
|
||||
lockInfo = json['lock_info'] != null
|
||||
? new LockInfo.fromJson(json['lock_info'])
|
||||
: null;
|
||||
cardId = json['cardId'];
|
||||
uid = json['uid'];
|
||||
nickname = json['nickname'];
|
||||
lockAlias = json['lockAlias'];
|
||||
expireDate = json['expireDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['clientId'] = clientId;
|
||||
data['lockOwnerId'] = lockOwnerId;
|
||||
data['lockId'] = lockId;
|
||||
data['cardNumber'] = cardNumber;
|
||||
data['startDate'] = startDate;
|
||||
data['endDate'] = endDate;
|
||||
data['cardStatus'] = cardStatus;
|
||||
data['cardType'] = cardType;
|
||||
data['cardRight'] = cardRight;
|
||||
if (weekDay != null) {
|
||||
data['weekDay'] = weekDay!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['addType'] = addType;
|
||||
data['isCoerced'] = isCoerced;
|
||||
data['cardUserNo'] = cardUserNo;
|
||||
data['businessId'] = businessId;
|
||||
data['created_at'] = createdAt;
|
||||
data['updated_at'] = updatedAt;
|
||||
if (apiUser != null) {
|
||||
data['api_user'] = apiUser!.toJson();
|
||||
}
|
||||
if (this.lockInfo != null) {
|
||||
data['lock_info'] = this.lockInfo!.toJson();
|
||||
}
|
||||
data['cardId'] = cardId;
|
||||
data['uid'] = uid;
|
||||
data['nickname'] = nickname;
|
||||
data['lockAlias'] = lockAlias;
|
||||
data['expireDate'] = expireDate;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ApiUser {
|
||||
int? id;
|
||||
String? accountName;
|
||||
|
||||
ApiUser({this.id, this.accountName});
|
||||
|
||||
ApiUser.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
accountName = json['account_name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['account_name'] = accountName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class LockInfo {
|
||||
String? btDeviceName;
|
||||
|
||||
LockInfo({this.btDeviceName});
|
||||
|
||||
LockInfo.fromJson(Map<String, dynamic> json) {
|
||||
btDeviceName = json['btDeviceName'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = Map<String, dynamic>();
|
||||
data['btDeviceName'] = btDeviceName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,209 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/blue/io_reply.dart';
|
||||
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../../blue/io_protocol/io_addICCard.dart';
|
||||
import '../../../../../blue/sender_manage.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../../tools/storage.dart';
|
||||
import 'expireCard_entity.dart';
|
||||
import 'expireCard_state.dart';
|
||||
|
||||
class ExpireCardLogic extends BaseGetXController {
|
||||
ExpireCardState state = ExpireCardState();
|
||||
|
||||
// 监听设备返回的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 添加卡片开始(重置锁里面所有卡)
|
||||
if((reply is SenderAddICCardReply)) {
|
||||
_replyAddICCardBegin(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 添加卡片开始(此处用作删除卡片)
|
||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFingerprintStatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
deletICCardData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
String? userID = await Storage.getUid();
|
||||
IoSenderManage.senderAddICCardCommand(
|
||||
keyID:state.deletExpireCardItemEntity.cardId.toString(),
|
||||
userID:userID,
|
||||
cardNo:state.deletExpireCardItemEntity.cardUserNo!,
|
||||
useCountLimit:0,
|
||||
startTime:state.deletExpireCardItemEntity.startDate!~/1000,
|
||||
endTime:state.deletExpireCardItemEntity.endDate!~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加卡片
|
||||
Future<void> senderAddICCard() async {
|
||||
if(state.sureBtnState.value == 1){
|
||||
return;
|
||||
}
|
||||
state.sureBtnState.value = 1;
|
||||
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
});
|
||||
BlueManage().bludSendData(state.deletExpireCardItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
String? userID = await Storage.getUid();
|
||||
IoSenderManage.senderAddICCardCommand(
|
||||
keyID:state.deletExpireCardItemEntity.cardId.toString(),
|
||||
userID:userID,
|
||||
cardNo:state.deletExpireCardItemEntity.cardUserNo!,
|
||||
useCountLimit:0,
|
||||
startTime:state.deletExpireCardItemEntity.startDate!~/1000,
|
||||
endTime:state.deletExpireCardItemEntity.endDate!~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//请求卡即将到期列表
|
||||
Future<ExpireCardEntity> expirCardListRequest() async {
|
||||
ExpireCardEntity entity = await ApiRepository.to.expireCardList(pageNo.toString(), pageSize.toString());
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (pageNo == 1) {
|
||||
state.dataList.value = entity.data!.list!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.list!.isNotEmpty) {
|
||||
state.dataList.value.addAll(entity.data!.list!);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
// 删除IC卡
|
||||
void deletICCardData() async{
|
||||
var entity = await ApiRepository.to.deletIcCardData(
|
||||
cardId: state.deletExpireCardItemEntity.cardId.toString(),
|
||||
lockId: state.deletExpireCardItemEntity.lockId.toString(),
|
||||
type: "0",
|
||||
deleteType:"1"
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("删除成功", something: (){
|
||||
BlueManage().disconnect();
|
||||
pageNo = 1;
|
||||
expirCardListRequest();
|
||||
eventBus.fire(LockUserManageListRefreshUI());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getExpireDateStr(ExpireCardItemEntity itemData) {
|
||||
String useDateStr = '';
|
||||
if(itemData.cardType == 4){
|
||||
useDateStr = '循环';
|
||||
}else{
|
||||
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,242 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../tools/showTipView.dart';
|
||||
import 'expireCard_entity.dart';
|
||||
import 'expireCard_logic.dart';
|
||||
|
||||
class ExpireCardPage extends StatefulWidget {
|
||||
const ExpireCardPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ExpireCardPage> createState() => _ExpireCardPageState();
|
||||
}
|
||||
|
||||
class _ExpireCardPageState extends State<ExpireCardPage> {
|
||||
final logic = Get.put(ExpireCardLogic());
|
||||
final state = Get.find<ExpireCardLogic>().state;
|
||||
|
||||
Future<void> getHttpData() async {
|
||||
logic.expirCardListRequest().then((ExpireCardEntity value){
|
||||
if(mounted) setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: (){
|
||||
getHttpData();
|
||||
},
|
||||
child: Obx(() => _buildMainUI())
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return state.dataList.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.dataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
ExpireCardItemEntity indexEntity = state.dataList[index];
|
||||
return Slidable(
|
||||
key:ValueKey(indexEntity.uid),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
ShowTipView().showIosTipWithContentDialog("确定删除卡吗?", (){
|
||||
state.deletExpireCardItemEntity = indexEntity;
|
||||
logic.senderAddICCard();
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(indexEntity),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(ExpireCardItemEntity itemData) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
// if(itemData.cardType! == 4){
|
||||
// // 循环
|
||||
// var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||
// "pushType": 0,
|
||||
// "expireLockItem": itemData,
|
||||
// });
|
||||
// if(data != null) {
|
||||
// // setState(() {
|
||||
// // state.starDate.value = data["starDate"];
|
||||
// // state.endDate.value = data["endDate"];
|
||||
// // state.starTime.value = data["starTime"];
|
||||
// // state.endTime.value = data["endTime"];
|
||||
// // state.weekDay.value = data["validityValue"];
|
||||
// // });
|
||||
// logic.pageNo = 1;
|
||||
// getHttpData();
|
||||
// }
|
||||
// }else{
|
||||
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {
|
||||
// "pushType": 0,
|
||||
// "expireLockItem": itemData,
|
||||
// });
|
||||
// if(data != null) {
|
||||
// setState(() {
|
||||
// // state.starDate.value = data["beginTimeTimestamp"].toString();
|
||||
// // state.endDate.value = data["endTimeTimestamp"].toString();
|
||||
// // state.keyType.value = 2;
|
||||
// logic.pageNo = 1;
|
||||
// getHttpData();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
},
|
||||
child: Container(
|
||||
height: 90.h,
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/controls_user.png',
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
itemData.nickname ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 10.w,
|
||||
)),
|
||||
Text(
|
||||
itemData.lockAlias ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
logic.getExpireDateStr(itemData),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
getStatus(itemData),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getStatus(ExpireCardItemEntity itemData) {
|
||||
// if (itemData.keyboardPwdStatus! == 1) {
|
||||
// return Container(
|
||||
// padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.red,
|
||||
// borderRadius: BorderRadius.circular(2.0),
|
||||
// ),
|
||||
// child: Text(
|
||||
// '未生效',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white, fontSize: 13.sp),
|
||||
// ),
|
||||
// );
|
||||
// } else {
|
||||
if (itemData.expireDate! > 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.expireTextBgColor,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'余${itemData.expireDate.toString()}天',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'已过期',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'expireCard_entity.dart';
|
||||
|
||||
class ExpireCardState{
|
||||
final dataList = <ExpireCardItemEntity>[].obs;
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
ExpireCardItemEntity deletExpireCardItemEntity = ExpireCardItemEntity();
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../../../main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import 'expireLockList_entity.dart';
|
||||
import 'expireLockList_state.dart';
|
||||
|
||||
class ExpireLockListLogic extends BaseGetXController{
|
||||
ExpireLockListState state = ExpireLockListState();
|
||||
|
||||
//请求即将到期列表
|
||||
Future<ExpireLockListEntity> expireLockListRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to.expireLockList(pageNo.toString(), pageSize.toString());
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (pageNo == 1) {
|
||||
state.dataList.value = entity.data!.itemList!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.itemList!.isNotEmpty) {
|
||||
state.dataList.value.addAll(entity.data!.itemList!);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
//删除电子钥匙名称请求
|
||||
Future<void> deleteKeyRequest(int includeUnderlings, ExpireLockItem expireLockItem) async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
||||
keyId:expireLockItem.keyId.toString(),
|
||||
includeUnderlings: includeUnderlings
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("删除电子钥匙成功");
|
||||
showToast("删除成功", something: () {
|
||||
pageNo = 1;
|
||||
expireLockListRequest();
|
||||
eventBus.fire(LockUserManageListRefreshUI());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getExpireDateStr(ExpireLockItem itemData) {
|
||||
String useDateStr = '';
|
||||
if(itemData.keyType == 4){
|
||||
useDateStr = '循环';
|
||||
}else{
|
||||
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
deletKeyLogic(ExpireLockItem expireLockItem){
|
||||
if(expireLockItem.keyRight == 1){
|
||||
// 授权管理员
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
||||
deleteKeyRequest(isAllData ? 1 : 0, expireLockItem);
|
||||
});
|
||||
}else{
|
||||
// 普通用户
|
||||
ShowTipView().showDeleteKeyDataDialogDialog((){
|
||||
deleteKeyRequest(0, expireLockItem);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,14 +1,15 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/noData.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../../tools/noData.dart';
|
||||
import 'expireLockList_logic.dart';
|
||||
|
||||
class ExpireLockListPage extends StatefulWidget {
|
||||
@ -37,48 +38,61 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.aboutToExpire!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: (){
|
||||
getHttpData();
|
||||
},
|
||||
child: Obx(() => _buildMainUI())
|
||||
),
|
||||
return EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: (){
|
||||
getHttpData();
|
||||
},
|
||||
child: Obx(() => _buildMainUI())
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return state.dataList.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||
: ListView.separated(
|
||||
itemCount: state.dataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
ExpireLockItem indexEntity = state.dataList[index];
|
||||
return _electronicKeyItem(indexEntity);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.dataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
ExpireLockItem indexEntity = state.dataList[index];
|
||||
return Slidable(
|
||||
key:ValueKey(indexEntity.uid),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
logic.deletKeyLogic(indexEntity);
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(indexEntity),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(ExpireLockItem itemData) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
if(itemData.keyType! == 4){
|
||||
// 循环
|
||||
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||
"pushType": 0,
|
||||
"expireLockItem": itemData,
|
||||
@ -163,31 +177,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
itemData.expireDate! > 0
|
||||
? Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.expireTextBgColor,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'余${itemData.expireDate.toString()}天',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'已过期',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
)
|
||||
getStatus(itemData),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
@ -200,4 +190,50 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getStatus(ExpireLockItem itemData) {
|
||||
if (itemData.keyStatus! == XSConstantMacro.keyStatusWaitIneffective) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'未生效',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (itemData.expireDate! > 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.expireTextBgColor,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'余${itemData.expireDate.toString()}天',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'已过期',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import '../expireFingerprint/expireFingerprint_entity.dart';
|
||||
import 'expireFace_state.dart';
|
||||
|
||||
class ExpireFaceLogic extends BaseGetXController {
|
||||
ExpireFaceState state = ExpireFaceState();
|
||||
|
||||
//请求人脸即将到期列表
|
||||
Future<ExpireFingerprintEntity> expirFaceListRequest() async {
|
||||
ExpireFingerprintEntity entity = await ApiRepository.to.expireFingerprintList(pageNo.toString(), pageSize.toString());
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (pageNo == 1) {
|
||||
state.dataList.value = entity.data!.list!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.list!.isNotEmpty) {
|
||||
state.dataList.value.addAll(entity.data!.list!);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getExpireDateStr(ExpireFingerprintItemEntity itemData) {
|
||||
String useDateStr = '';
|
||||
if(itemData.fingerprintType == 4){
|
||||
useDateStr = '循环';
|
||||
}else{
|
||||
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,240 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/noData.dart';
|
||||
import '../../../../../tools/showTipView.dart';
|
||||
import '../expireFingerprint/expireFingerprint_entity.dart';
|
||||
import 'expireFace_logic.dart';
|
||||
|
||||
class ExpireFacePage extends StatefulWidget {
|
||||
const ExpireFacePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ExpireFacePage> createState() => _ExpireFacePageState();
|
||||
}
|
||||
|
||||
class _ExpireFacePageState extends State<ExpireFacePage> {
|
||||
final logic = Get.put(ExpireFaceLogic());
|
||||
final state = Get.find<ExpireFaceLogic>().state;
|
||||
|
||||
Future<void> getHttpData() async {
|
||||
logic.expirFaceListRequest().then((ExpireFingerprintEntity value){
|
||||
if(mounted) setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: (){
|
||||
getHttpData();
|
||||
},
|
||||
child: Obx(() => _buildMainUI())
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return state.dataList.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.dataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
ExpireFingerprintItemEntity indexEntity = state.dataList[index];
|
||||
return Slidable(
|
||||
key:ValueKey(indexEntity.uid),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
ShowTipView().showIosTipWithContentDialog("确定删除卡吗?", (){
|
||||
// state.deletExpireFingerprintItemEntity = indexEntity;
|
||||
// logic.senderAddFingerprint();
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(indexEntity),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(ExpireFingerprintItemEntity itemData) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
// if(itemData.cardType! == 4){
|
||||
// // 循环
|
||||
// var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||
// "pushType": 0,
|
||||
// "expireLockItem": itemData,
|
||||
// });
|
||||
// if(data != null) {
|
||||
// // setState(() {
|
||||
// // state.starDate.value = data["starDate"];
|
||||
// // state.endDate.value = data["endDate"];
|
||||
// // state.starTime.value = data["starTime"];
|
||||
// // state.endTime.value = data["endTime"];
|
||||
// // state.weekDay.value = data["validityValue"];
|
||||
// // });
|
||||
// logic.pageNo = 1;
|
||||
// getHttpData();
|
||||
// }
|
||||
// }else{
|
||||
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {
|
||||
// "pushType": 0,
|
||||
// "expireLockItem": itemData,
|
||||
// });
|
||||
// if(data != null) {
|
||||
// setState(() {
|
||||
// // state.starDate.value = data["beginTimeTimestamp"].toString();
|
||||
// // state.endDate.value = data["endTimeTimestamp"].toString();
|
||||
// // state.keyType.value = 2;
|
||||
// logic.pageNo = 1;
|
||||
// getHttpData();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
},
|
||||
child: Container(
|
||||
height: 90.h,
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/controls_user.png',
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
itemData.nickname ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 10.w,
|
||||
)),
|
||||
Text(
|
||||
itemData.lockAlias ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
logic.getExpireDateStr(itemData),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
getStatus(itemData),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getStatus(ExpireFingerprintItemEntity itemData) {
|
||||
// if (itemData.keyboardPwdStatus! == 1) {
|
||||
// return Container(
|
||||
// padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.red,
|
||||
// borderRadius: BorderRadius.circular(2.0),
|
||||
// ),
|
||||
// child: Text(
|
||||
// '未生效',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white, fontSize: 13.sp),
|
||||
// ),
|
||||
// );
|
||||
// } else {
|
||||
if (itemData.expireDate! > 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.expireTextBgColor,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'余${itemData.expireDate.toString()}天',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'已过期',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../expireFingerprint/expireFingerprint_entity.dart';
|
||||
|
||||
class ExpireFaceState{
|
||||
final dataList = <ExpireFingerprintItemEntity>[].obs;
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
ExpireFingerprintItemEntity deletExpireFingerprintItemEntity = ExpireFingerprintItemEntity();
|
||||
|
||||
}
|
||||
@ -0,0 +1,218 @@
|
||||
|
||||
class ExpireFingerprintEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
ExpireFingerprintListEntity? data;
|
||||
|
||||
ExpireFingerprintEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
ExpireFingerprintEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? ExpireFingerprintListEntity.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 ExpireFingerprintListEntity {
|
||||
List<ExpireFingerprintItemEntity>? list;
|
||||
int? pageNo;
|
||||
int? pageSize;
|
||||
int? pages;
|
||||
int? total;
|
||||
|
||||
ExpireFingerprintListEntity({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
||||
|
||||
ExpireFingerprintListEntity.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] != null) {
|
||||
list = <ExpireFingerprintItemEntity>[];
|
||||
json['list'].forEach((v) {
|
||||
list!.add(ExpireFingerprintItemEntity.fromJson(v));
|
||||
});
|
||||
}
|
||||
pageNo = json['pageNo'];
|
||||
pageSize = json['pageSize'];
|
||||
pages = json['pages'];
|
||||
total = json['total'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (list != null) {
|
||||
data['list'] = list!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['pageNo'] = pageNo;
|
||||
data['pageSize'] = pageSize;
|
||||
data['pages'] = pages;
|
||||
data['total'] = total;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ExpireFingerprintItemEntity {
|
||||
String? clientId;
|
||||
int? lockOwnerId;
|
||||
int? lockId;
|
||||
int? fingerprintStatus;
|
||||
String? fingerprintNumber;
|
||||
int? fingerprintType;
|
||||
int? startDate;
|
||||
int? endDate;
|
||||
List? weekDay;
|
||||
int? addType;
|
||||
int? fingerRight;
|
||||
int? isCoerced;
|
||||
int? fingerprintUserNo;
|
||||
int? businessId;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
ApiUser? apiUser;
|
||||
LockInfo? lockInfo;
|
||||
int? fingerprintId;
|
||||
int? uid;
|
||||
String? nickname;
|
||||
String? lockAlias;
|
||||
int? expireDate;
|
||||
|
||||
ExpireFingerprintItemEntity(
|
||||
{this.clientId,
|
||||
this.lockOwnerId,
|
||||
this.lockId,
|
||||
this.fingerprintStatus,
|
||||
this.fingerprintNumber,
|
||||
this.fingerprintType,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.weekDay,
|
||||
this.addType,
|
||||
this.fingerRight,
|
||||
this.isCoerced,
|
||||
this.fingerprintUserNo,
|
||||
this.businessId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.apiUser,
|
||||
this.lockInfo,
|
||||
this.fingerprintId,
|
||||
this.uid,
|
||||
this.nickname,
|
||||
this.lockAlias,
|
||||
this.expireDate});
|
||||
|
||||
ExpireFingerprintItemEntity.fromJson(Map<String, dynamic> json) {
|
||||
clientId = json['clientId'];
|
||||
lockOwnerId = json['lockOwnerId'];
|
||||
lockId = json['lockId'];
|
||||
fingerprintStatus = json['fingerprintStatus'];
|
||||
fingerprintNumber = json['fingerprintNumber'];
|
||||
fingerprintType = json['fingerprintType'];
|
||||
startDate = json['startDate'];
|
||||
endDate = json['endDate'];
|
||||
if (json['weekDays'] != null) {
|
||||
weekDay = [];
|
||||
json['weekDays'].forEach((v) {
|
||||
weekDay!.add(v);
|
||||
});
|
||||
}
|
||||
addType = json['addType'];
|
||||
fingerRight = json['fingerRight'];
|
||||
isCoerced = json['isCoerced'];
|
||||
fingerprintUserNo = json['fingerprintUserNo'];
|
||||
businessId = json['businessId'];
|
||||
createdAt = json['created_at'];
|
||||
updatedAt = json['updated_at'];
|
||||
apiUser = json['api_user'] != null
|
||||
? ApiUser.fromJson(json['api_user'])
|
||||
: null;
|
||||
lockInfo = json['lock_info'] != null
|
||||
? LockInfo.fromJson(json['lock_info'])
|
||||
: null;
|
||||
fingerprintId = json['fingerprintId'];
|
||||
uid = json['uid'];
|
||||
nickname = json['nickname'];
|
||||
lockAlias = json['lockAlias'];
|
||||
expireDate = json['expireDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['clientId'] = clientId;
|
||||
data['lockOwnerId'] = lockOwnerId;
|
||||
data['lockId'] = lockId;
|
||||
data['fingerprintStatus'] = fingerprintStatus;
|
||||
data['fingerprintNumber'] = fingerprintNumber;
|
||||
data['fingerprintType'] = fingerprintType;
|
||||
data['startDate'] = startDate;
|
||||
data['endDate'] = endDate;
|
||||
if (weekDay != null) {
|
||||
data['weekDay'] = weekDay!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['addType'] = addType;
|
||||
data['fingerRight'] = fingerRight;
|
||||
data['isCoerced'] = isCoerced;
|
||||
data['fingerprintUserNo'] = fingerprintUserNo;
|
||||
data['businessId'] = businessId;
|
||||
data['created_at'] = createdAt;
|
||||
data['updated_at'] = updatedAt;
|
||||
if (apiUser != null) {
|
||||
data['api_user'] = apiUser!.toJson();
|
||||
}
|
||||
if (lockInfo != null) {
|
||||
data['lock_info'] = lockInfo!.toJson();
|
||||
}
|
||||
data['fingerprintId'] = fingerprintId;
|
||||
data['uid'] = uid;
|
||||
data['nickname'] = nickname;
|
||||
data['lockAlias'] = lockAlias;
|
||||
data['expireDate'] = expireDate;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ApiUser {
|
||||
int? id;
|
||||
String? accountName;
|
||||
|
||||
ApiUser({this.id, this.accountName});
|
||||
|
||||
ApiUser.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
accountName = json['account_name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['account_name'] = accountName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class LockInfo {
|
||||
String? btDeviceName;
|
||||
|
||||
LockInfo({this.btDeviceName});
|
||||
|
||||
LockInfo.fromJson(Map<String, dynamic> json) {
|
||||
btDeviceName = json['btDeviceName'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['btDeviceName'] = btDeviceName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,211 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addFingerprint.dart';
|
||||
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
import '../../../../../blue/io_reply.dart';
|
||||
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../../blue/sender_manage.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../../tools/storage.dart';
|
||||
import 'expireFingerprint_entity.dart';
|
||||
import 'expireFingerprint_state.dart';
|
||||
|
||||
class ExpireFingerprintLogic extends BaseGetXController {
|
||||
ExpireFingerprintState state = ExpireFingerprintState();
|
||||
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
// 添加指纹开始(此处用作删除指纹)
|
||||
if((reply is SenderAddFingerprintReply)) {
|
||||
_replyAddFingerprintBegin(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 添加指纹开始
|
||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
deletFingerprintsData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
String? userID = await Storage.getUid();
|
||||
IoSenderManage.senderAddFingerprintCommand(
|
||||
keyID:state.deletExpireFingerprintItemEntity.fingerprintId.toString(),
|
||||
userID:userID,
|
||||
fingerNo:int.parse(state.deletExpireFingerprintItemEntity.fingerprintNumber!),
|
||||
useCountLimit:0,
|
||||
startTime:state.deletExpireFingerprintItemEntity.startDate!~/1000,
|
||||
endTime:state.deletExpireFingerprintItemEntity.endDate!~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 删除指纹
|
||||
Future<void> senderAddFingerprint() async {
|
||||
if(state.sureBtnState.value == 1){
|
||||
return;
|
||||
}
|
||||
state.sureBtnState.value = 1;
|
||||
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
});
|
||||
BlueManage().bludSendData(state.deletExpireFingerprintItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
String? userID = await Storage.getUid();
|
||||
|
||||
IoSenderManage.senderAddFingerprintCommand(
|
||||
keyID:state.deletExpireFingerprintItemEntity.fingerprintId.toString(),
|
||||
userID:userID,
|
||||
fingerNo:int.parse(state.deletExpireFingerprintItemEntity.fingerprintNumber!),
|
||||
useCountLimit:0,
|
||||
startTime:state.deletExpireFingerprintItemEntity.startDate!~/1000,
|
||||
endTime:state.deletExpireFingerprintItemEntity.endDate!~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 删除指纹
|
||||
void deletFingerprintsData() async{
|
||||
var entity = await ApiRepository.to.deletFingerprintsData(
|
||||
fingerprintId: state.deletExpireFingerprintItemEntity.fingerprintId.toString(),
|
||||
lockId: state.deletExpireFingerprintItemEntity.lockId.toString(),
|
||||
type: "0",
|
||||
deleteType:"1"
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("删除成功",something: (){
|
||||
BlueManage().disconnect();
|
||||
pageNo = 1;
|
||||
expirFingerprintListRequest();
|
||||
eventBus.fire(LockUserManageListRefreshUI());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//请求指纹即将到期列表
|
||||
Future<ExpireFingerprintEntity> expirFingerprintListRequest() async {
|
||||
ExpireFingerprintEntity entity = await ApiRepository.to.expireFingerprintList(pageNo.toString(), pageSize.toString());
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (pageNo == 1) {
|
||||
state.dataList.value = entity.data!.list!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.list!.isNotEmpty) {
|
||||
state.dataList.value.addAll(entity.data!.list!);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getExpireDateStr(ExpireFingerprintItemEntity itemData) {
|
||||
String useDateStr = '';
|
||||
if(itemData.fingerprintType == 4){
|
||||
useDateStr = '循环';
|
||||
}else{
|
||||
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,240 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/EasyRefreshTool.dart';
|
||||
import 'expireFingerprint_entity.dart';
|
||||
import 'expireFingerprint_logic.dart';
|
||||
|
||||
class ExpireFingerprintPage extends StatefulWidget {
|
||||
const ExpireFingerprintPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ExpireFingerprintPage> createState() => _ExpireFingerprintPageState();
|
||||
}
|
||||
|
||||
class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
|
||||
final logic = Get.put(ExpireFingerprintLogic());
|
||||
final state = Get.find<ExpireFingerprintLogic>().state;
|
||||
|
||||
Future<void> getHttpData() async {
|
||||
logic.expirFingerprintListRequest().then((ExpireFingerprintEntity value){
|
||||
if(mounted) setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: (){
|
||||
getHttpData();
|
||||
},
|
||||
child: Obx(() => _buildMainUI())
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return state.dataList.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.dataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
ExpireFingerprintItemEntity indexEntity = state.dataList[index];
|
||||
return Slidable(
|
||||
key:ValueKey(indexEntity.uid),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
ShowTipView().showIosTipWithContentDialog("确定删除卡吗?", (){
|
||||
state.deletExpireFingerprintItemEntity = indexEntity;
|
||||
logic.senderAddFingerprint();
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(indexEntity),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(ExpireFingerprintItemEntity itemData) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
// if(itemData.cardType! == 4){
|
||||
// // 循环
|
||||
// var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||
// "pushType": 0,
|
||||
// "expireLockItem": itemData,
|
||||
// });
|
||||
// if(data != null) {
|
||||
// // setState(() {
|
||||
// // state.starDate.value = data["starDate"];
|
||||
// // state.endDate.value = data["endDate"];
|
||||
// // state.starTime.value = data["starTime"];
|
||||
// // state.endTime.value = data["endTime"];
|
||||
// // state.weekDay.value = data["validityValue"];
|
||||
// // });
|
||||
// logic.pageNo = 1;
|
||||
// getHttpData();
|
||||
// }
|
||||
// }else{
|
||||
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {
|
||||
// "pushType": 0,
|
||||
// "expireLockItem": itemData,
|
||||
// });
|
||||
// if(data != null) {
|
||||
// setState(() {
|
||||
// // state.starDate.value = data["beginTimeTimestamp"].toString();
|
||||
// // state.endDate.value = data["endTimeTimestamp"].toString();
|
||||
// // state.keyType.value = 2;
|
||||
// logic.pageNo = 1;
|
||||
// getHttpData();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
},
|
||||
child: Container(
|
||||
height: 90.h,
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/controls_user.png',
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
itemData.nickname ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 10.w,
|
||||
)),
|
||||
Text(
|
||||
itemData.lockAlias ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
logic.getExpireDateStr(itemData),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
getStatus(itemData),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getStatus(ExpireFingerprintItemEntity itemData) {
|
||||
// if (itemData.keyboardPwdStatus! == 1) {
|
||||
// return Container(
|
||||
// padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.red,
|
||||
// borderRadius: BorderRadius.circular(2.0),
|
||||
// ),
|
||||
// child: Text(
|
||||
// '未生效',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white, fontSize: 13.sp),
|
||||
// ),
|
||||
// );
|
||||
// } else {
|
||||
if (itemData.expireDate! > 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.expireTextBgColor,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'余${itemData.expireDate.toString()}天',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'已过期',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'expireFingerprint_entity.dart';
|
||||
|
||||
class ExpireFingerprintState{
|
||||
final dataList = <ExpireFingerprintItemEntity>[].obs;
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
ExpireFingerprintItemEntity deletExpireFingerprintItemEntity = ExpireFingerprintItemEntity();
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../network/api_repository.dart';
|
||||
import 'expireLockList_entity.dart';
|
||||
import 'expireLockList_state.dart';
|
||||
|
||||
class ExpireLockListLogic extends BaseGetXController{
|
||||
ExpireLockListState state = ExpireLockListState();
|
||||
|
||||
//请求即将到期列表
|
||||
Future<ExpireLockListEntity> expireLockListRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to.expireLockList(pageNo.toString(), pageSize.toString());
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (pageNo == 1) {
|
||||
state.dataList.value = entity.data!.itemList!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.itemList!.isNotEmpty) {
|
||||
state.dataList.value.addAll(entity.data!.itemList!);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getExpireDateStr(ExpireLockItem itemData) {
|
||||
String useDateStr = '';
|
||||
if(itemData.keyType == 4){
|
||||
useDateStr = '循环';
|
||||
}else{
|
||||
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:star_lock/tools/titleAppBar.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import 'expireLockManage_tabbar.dart';
|
||||
|
||||
class ExpireLockManagePage extends StatefulWidget {
|
||||
const ExpireLockManagePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ExpireLockManagePage> createState() => _ExpireLockManagePageState();
|
||||
}
|
||||
|
||||
class _ExpireLockManagePageState extends State<ExpireLockManagePage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: "即将到期",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: const Column(
|
||||
children: [
|
||||
ExpireLockManageTabbar(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/tools/CustomUnderlineTabIndicator.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
import 'expireCard/expireCard_page.dart';
|
||||
import 'expireElectronicKey/expireLockList_page.dart';
|
||||
import 'expireFace/expireFace_page.dart';
|
||||
import 'expireFingerprint/expireFingerprint_page.dart';
|
||||
import 'expirePassword/expirePassword_page.dart';
|
||||
|
||||
class ExpireLockManageTabbar extends StatefulWidget {
|
||||
|
||||
const ExpireLockManageTabbar({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ExpireLockManageTabbar> createState() => _ExpireLockManageTabbarState();
|
||||
}
|
||||
|
||||
class _ExpireLockManageTabbarState extends State<ExpireLockManageTabbar> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.electronicKey!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.password!.tr, selectType: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.card!.tr, selectType: "2"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.fingerprint!.tr, selectType: "3"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.face!.tr, selectType: "4"),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
_tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: 1);
|
||||
_tabController.addListener(() {
|
||||
if (_tabController.animation!.value == _tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: _tabController,
|
||||
onTap: (index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
automaticIndicatorColorAdjustment: true,
|
||||
labelColor: AppColors.mainColor,
|
||||
labelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
indicator: CustomUnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||
strokeCap: StrokeCap.round,
|
||||
width: 30.w),
|
||||
);
|
||||
}
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(
|
||||
child: SizedBox(
|
||||
// width: 1.sw / 5,
|
||||
child: Text(item.title, textAlign: TextAlign.center)));
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children:const [
|
||||
ExpireLockListPage(),
|
||||
ExpirePasswordPage(),
|
||||
ExpireCardPage(),
|
||||
ExpireFingerprintPage(),
|
||||
ExpireFacePage(),
|
||||
]
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.selectType});
|
||||
|
||||
final String title;
|
||||
final String selectType;
|
||||
}
|
||||
|
||||
@ -0,0 +1,198 @@
|
||||
class ExpirePasswordEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
ExpirePasswordListData? data;
|
||||
|
||||
ExpirePasswordEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
ExpirePasswordEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? ExpirePasswordListData.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 ExpirePasswordListData {
|
||||
List<ExpirePasswordItemData>? list;
|
||||
int? pageNo;
|
||||
int? pageSize;
|
||||
int? pages;
|
||||
int? total;
|
||||
|
||||
ExpirePasswordListData({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
||||
|
||||
ExpirePasswordListData.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] != null) {
|
||||
list = <ExpirePasswordItemData>[];
|
||||
json['list'].forEach((v) {
|
||||
list!.add(ExpirePasswordItemData.fromJson(v));
|
||||
});
|
||||
}
|
||||
pageNo = json['pageNo'];
|
||||
pageSize = json['pageSize'];
|
||||
pages = json['pages'];
|
||||
total = json['total'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (list != null) {
|
||||
data['list'] = list!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['pageNo'] = pageNo;
|
||||
data['pageSize'] = pageSize;
|
||||
data['pages'] = pages;
|
||||
data['total'] = total;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ExpirePasswordItemData {
|
||||
String? clientId;
|
||||
int? lockOwnerId;
|
||||
int? lockId;
|
||||
int? keyboardPwdType;
|
||||
int? keyboardPwdStatus;
|
||||
int? startDate;
|
||||
int? endDate;
|
||||
String? keyboardPwd;
|
||||
String? keyboardPwdHash;
|
||||
int? addType;
|
||||
int? pwdRight;
|
||||
int? isCustom;
|
||||
int? isCoerced;
|
||||
int? hoursStart;
|
||||
int? hoursEnd;
|
||||
int? pwdUserNo;
|
||||
int? businessId;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
ApiUser? apiUser;
|
||||
int? pwdId;
|
||||
int? uid;
|
||||
String? nickname;
|
||||
String? lockAlias;
|
||||
int? expireDate;
|
||||
|
||||
ExpirePasswordItemData(
|
||||
{this.clientId,
|
||||
this.lockOwnerId,
|
||||
this.lockId,
|
||||
this.keyboardPwdType,
|
||||
this.keyboardPwdStatus,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.keyboardPwd,
|
||||
this.keyboardPwdHash,
|
||||
this.addType,
|
||||
this.pwdRight,
|
||||
this.isCustom,
|
||||
this.isCoerced,
|
||||
this.hoursStart,
|
||||
this.hoursEnd,
|
||||
this.pwdUserNo,
|
||||
this.businessId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.apiUser,
|
||||
this.pwdId,
|
||||
this.uid,
|
||||
this.nickname,
|
||||
this.lockAlias,
|
||||
this.expireDate});
|
||||
|
||||
ExpirePasswordItemData.fromJson(Map<String, dynamic> json) {
|
||||
clientId = json['clientId'];
|
||||
lockOwnerId = json['lockOwnerId'];
|
||||
lockId = json['lockId'];
|
||||
keyboardPwdType = json['keyboardPwdType'];
|
||||
keyboardPwdStatus = json['keyboardPwdStatus'];
|
||||
startDate = json['startDate'];
|
||||
endDate = json['endDate'];
|
||||
keyboardPwd = json['keyboardPwd'];
|
||||
keyboardPwdHash = json['keyboardPwdHash'];
|
||||
addType = json['addType'];
|
||||
pwdRight = json['pwdRight'];
|
||||
isCustom = json['isCustom'];
|
||||
isCoerced = json['isCoerced'];
|
||||
hoursStart = json['hoursStart'];
|
||||
hoursEnd = json['hoursEnd'];
|
||||
pwdUserNo = json['pwdUserNo'];
|
||||
businessId = json['businessId'];
|
||||
createdAt = json['created_at'];
|
||||
updatedAt = json['updated_at'];
|
||||
apiUser = json['api_user'] != null
|
||||
? ApiUser.fromJson(json['api_user'])
|
||||
: null;
|
||||
pwdId = json['pwdId'];
|
||||
uid = json['uid'];
|
||||
nickname = json['nickname'];
|
||||
lockAlias = json['lockAlias'];
|
||||
expireDate = json['expireDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['clientId'] = clientId;
|
||||
data['lockOwnerId'] = lockOwnerId;
|
||||
data['lockId'] = lockId;
|
||||
data['keyboardPwdType'] = keyboardPwdType;
|
||||
data['keyboardPwdStatus'] = keyboardPwdStatus;
|
||||
data['startDate'] = startDate;
|
||||
data['endDate'] = endDate;
|
||||
data['keyboardPwd'] = keyboardPwd;
|
||||
data['keyboardPwdHash'] = keyboardPwdHash;
|
||||
data['addType'] = addType;
|
||||
data['pwdRight'] = pwdRight;
|
||||
data['isCustom'] = isCustom;
|
||||
data['isCoerced'] = isCoerced;
|
||||
data['hoursStart'] = hoursStart;
|
||||
data['hoursEnd'] = hoursEnd;
|
||||
data['pwdUserNo'] = pwdUserNo;
|
||||
data['businessId'] = businessId;
|
||||
data['created_at'] = createdAt;
|
||||
data['updated_at'] = updatedAt;
|
||||
if (apiUser != null) {
|
||||
data['api_user'] = apiUser!.toJson();
|
||||
}
|
||||
data['pwdId'] = pwdId;
|
||||
data['uid'] = uid;
|
||||
data['nickname'] = nickname;
|
||||
data['lockAlias'] = lockAlias;
|
||||
data['expireDate'] = expireDate;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ApiUser {
|
||||
int? id;
|
||||
String? accountName;
|
||||
|
||||
ApiUser({this.id, this.accountName});
|
||||
|
||||
ApiUser.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
accountName = json['account_name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['account_name'] = accountName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../../main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
import 'expirePassword_entity.dart';
|
||||
import 'expirePassword_state.dart';
|
||||
|
||||
class ExpirePasswordLogic extends BaseGetXController {
|
||||
ExpirePasswordState state = ExpirePasswordState();
|
||||
|
||||
//请求即将到期列表
|
||||
Future<ExpirePasswordEntity> expirePasswordListRequest() async {
|
||||
ExpirePasswordEntity entity = await ApiRepository.to.expirePasswordList(pageNo.toString(), pageSize.toString());
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (pageNo == 1) {
|
||||
state.dataList.value = entity.data!.list!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.list!.isNotEmpty) {
|
||||
state.dataList.value.addAll(entity.data!.list!);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||
Future<void> deletePwdRequest(ExpirePasswordItemData expirePasswordItemData) async {
|
||||
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||
expirePasswordItemData.lockId.toString(),
|
||||
expirePasswordItemData.pwdId.toString(),
|
||||
1);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功", something: () {
|
||||
pageNo = 1;
|
||||
expirePasswordListRequest();
|
||||
eventBus.fire(LockUserManageListRefreshUI());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getExpireDateStr(ExpirePasswordItemData itemData) {
|
||||
String useDateStr = '';
|
||||
if(itemData.keyboardPwdType == 4){
|
||||
useDateStr = '循环';
|
||||
}else{
|
||||
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,240 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
|
||||
import '../../../../../tools/showTipView.dart';
|
||||
import 'expirePassword_entity.dart';
|
||||
import 'expirePassword_logic.dart';
|
||||
|
||||
class ExpirePasswordPage extends StatefulWidget {
|
||||
const ExpirePasswordPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ExpirePasswordPage> createState() => _ExpirePasswordPageState();
|
||||
}
|
||||
|
||||
class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
|
||||
final logic = Get.put(ExpirePasswordLogic());
|
||||
final state = Get.find<ExpirePasswordLogic>().state;
|
||||
|
||||
Future<void> getHttpData() async {
|
||||
logic.expirePasswordListRequest().then((ExpirePasswordEntity value){
|
||||
if(mounted) setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: (){
|
||||
getHttpData();
|
||||
},
|
||||
child: Obx(() => _buildMainUI())
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return state.dataList.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.dataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
ExpirePasswordItemData indexEntity = state.dataList[index];
|
||||
return Slidable(
|
||||
key:ValueKey(indexEntity.uid),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
ShowTipView().showIosTipWithContentDialog("确定删除该密码吗?", (){
|
||||
logic.deletePwdRequest(indexEntity);
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(indexEntity),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(ExpirePasswordItemData itemData) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
// if(itemData.keyboardPwdType! == 4){
|
||||
// // 循环
|
||||
// var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||
// "pushType": 0,
|
||||
// "expireLockItem": itemData,
|
||||
// });
|
||||
// if(data != null) {
|
||||
// // setState(() {
|
||||
// // state.starDate.value = data["starDate"];
|
||||
// // state.endDate.value = data["endDate"];
|
||||
// // state.starTime.value = data["starTime"];
|
||||
// // state.endTime.value = data["endTime"];
|
||||
// // state.weekDay.value = data["validityValue"];
|
||||
// // });
|
||||
// logic.pageNo = 1;
|
||||
// getHttpData();
|
||||
// }
|
||||
// }else{
|
||||
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {
|
||||
// "pushType": 0,
|
||||
// "expireLockItem": itemData,
|
||||
// });
|
||||
// if(data != null) {
|
||||
// setState(() {
|
||||
// // state.starDate.value = data["beginTimeTimestamp"].toString();
|
||||
// // state.endDate.value = data["endTimeTimestamp"].toString();
|
||||
// // state.keyType.value = 2;
|
||||
// logic.pageNo = 1;
|
||||
// getHttpData();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
},
|
||||
child: Container(
|
||||
height: 90.h,
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/controls_user.png',
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
itemData.nickname ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 10.w,
|
||||
)),
|
||||
Text(
|
||||
itemData.lockAlias ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
logic.getExpireDateStr(itemData),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
getStatus(itemData),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getStatus(ExpirePasswordItemData itemData) {
|
||||
// if (itemData.keyboardPwdStatus! == 1) {
|
||||
// return Container(
|
||||
// padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.red,
|
||||
// borderRadius: BorderRadius.circular(2.0),
|
||||
// ),
|
||||
// child: Text(
|
||||
// '未生效',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white, fontSize: 13.sp),
|
||||
// ),
|
||||
// );
|
||||
// } else {
|
||||
if (itemData.expireDate! > 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.expireTextBgColor,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'余${itemData.expireDate.toString()}天',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
),
|
||||
child: Text(
|
||||
'已过期',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'expirePassword_entity.dart';
|
||||
|
||||
class ExpirePasswordState {
|
||||
final dataList = <ExpirePasswordItemData>[].obs;
|
||||
}
|
||||
@ -1,10 +1,13 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import 'lockUserManageList_state.dart';
|
||||
|
||||
class LockUserManageListLogic extends BaseGetXController {
|
||||
@ -13,7 +16,7 @@ class LockUserManageListLogic extends BaseGetXController {
|
||||
//请求锁用户列表
|
||||
Future<LockUserListEntity> lockUserListRequest() async {
|
||||
LockUserListEntity entity =
|
||||
await ApiRepository.to.lockUserList(pageNo.toString(), '20', state.searchController.text);
|
||||
await ApiRepository.to.lockUserList(pageNo.toString(), pageSize, state.searchController.text);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (pageNo == 1) {
|
||||
state.dataList.value = entity.data!;
|
||||
@ -41,12 +44,22 @@ class LockUserManageListLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
/// 刷新电子钥匙列表
|
||||
StreamSubscription? _getElectronicKeyListRefreshUIEvent;
|
||||
void _getElectronicKeyListRefreshUIAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getElectronicKeyListRefreshUIEvent = eventBus.on<LockUserManageListRefreshUI>().listen((event) {
|
||||
pageNo = 1;
|
||||
lockUserListRequest();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
// lockUserListRequest();
|
||||
_getElectronicKeyListRefreshUIAction();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -58,5 +71,8 @@ class LockUserManageListLogic extends BaseGetXController {
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
_getElectronicKeyListRefreshUIEvent?.cancel();
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,6 @@ import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/keySearchWidget.dart';
|
||||
import '../../../../tools/left_slide_actions.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import 'lockUserManageList_logic.dart';
|
||||
|
||||
@ -54,7 +53,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, Routers.expireLockListPage);
|
||||
Navigator.pushNamed(context, Routers.expireLockManagePage);
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -139,18 +138,6 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
||||
),
|
||||
child: _electronicKeyItem(indexEntity),
|
||||
);
|
||||
|
||||
// return LeftSlideActions(
|
||||
// key: Key(indexEntity.userid!),
|
||||
// actionsWidth: 60,
|
||||
// actions: [
|
||||
// _buildDeleteBtn(indexEntity),
|
||||
// ],
|
||||
// decoration: const BoxDecoration(
|
||||
// borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
// ),
|
||||
// child: _electronicKeyItem(indexEntity),
|
||||
// );
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
// return _electronicKeyItem(indexEntity);
|
||||
@ -233,36 +220,13 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// Widget _buildDeleteBtn(LockUserData passwordKeyListItem) {
|
||||
// return GestureDetector(
|
||||
// onTap: () {
|
||||
// // 省略: 弹出是否删除的确认对话框。
|
||||
// showIosTipViewDialog(context, passwordKeyListItem);
|
||||
// },
|
||||
// child: Container(
|
||||
// width: 60,
|
||||
// color: const Color(0xFFF20101),
|
||||
// alignment: Alignment.center,
|
||||
// child: const Text(
|
||||
// '删除',
|
||||
// style: TextStyle(
|
||||
// fontSize: 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: Colors.white,
|
||||
// height: 1,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
void showIosTipViewDialog(BuildContext context, LockUserData lockUserData) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "确定要删除吗?",
|
||||
tipTitle: "删除用户时,会将用户拥有的钥匙一起删除。",
|
||||
sureClick: () {
|
||||
Get.back();
|
||||
logic.deletelockUserRequest(lockUserData.uid!);
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
import '../../../../main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../lockUserManageList/keyListByUserEntity.dart';
|
||||
import 'ownedKeyList_state.dart';
|
||||
@ -9,19 +12,63 @@ class OwnedKeyListLogic extends BaseGetXController {
|
||||
OwnedKeyListState state = OwnedKeyListState();
|
||||
|
||||
//请求用户拥有的锁
|
||||
Future<List<KeyListItem>> mockNetworkDataRequest() async {
|
||||
KeyListByUserEntity entity = await ApiRepository.to.keyListByUser('1', '20', state.getUidStr);
|
||||
Future<KeyListByUserEntity> mockNetworkDataRequest() async {
|
||||
KeyListByUserEntity entity = await ApiRepository.to.keyListByUser(pageNo.toString(), pageSize, state.getUidStr.toString());
|
||||
// if (entity.errorCode!.codeIsSuccessful) {
|
||||
// print("请求用户拥有的锁:${entity.data!.keyList}");
|
||||
// }
|
||||
// if (entity.data != null) {
|
||||
// return entity.data!.keyList!;
|
||||
// } else {
|
||||
// List<KeyListItem> dataList = [];
|
||||
// return dataList;
|
||||
// }
|
||||
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (pageNo == 1) {
|
||||
state.dataList.value = entity.data!.keyList!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.keyList!.isNotEmpty) {
|
||||
state.dataList.value.addAll(entity.data!.keyList!);
|
||||
print("state.itemDataList.value.length:${state.dataList.value.length}");
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
//删除电子钥匙名称请求 setAdministrator
|
||||
Future<void> deleteKeyRequest(int keyId) async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
||||
keyId:keyId.toString(),
|
||||
includeUnderlings: 0
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("请求用户拥有的锁:${entity.data!.keyList}");
|
||||
}
|
||||
if (entity.data != null) {
|
||||
return entity.data!.keyList!;
|
||||
} else {
|
||||
List<KeyListItem> dataList = [];
|
||||
return dataList;
|
||||
print("删除电子钥匙成功");
|
||||
showToast("删除成功", something: () {
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
eventBus.fire(LockUserManageListRefreshUI());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//设置授权管理员
|
||||
Future<void> setAdministrator() async {
|
||||
// ElectronicKeyListEntity entity = await ApiRepository.to.setAdministrator(
|
||||
// keyId:state.itemData.value.keyId.toString(),
|
||||
// );
|
||||
// if (entity.errorCode!.codeIsSuccessful) {
|
||||
// showToast("设置成功", something: () {
|
||||
// // eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
// // eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
// Get.back();
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getUseDateStr(KeyListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
|
||||
@ -1,15 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_utils/get_utils.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/showIosTipView.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import 'ownedKeyList_logic.dart';
|
||||
|
||||
class OwnedKeyListPage extends StatefulWidget {
|
||||
@ -23,9 +27,18 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
final logic = Get.put(OwnedKeyListLogic());
|
||||
final state = Get.find<OwnedKeyListLogic>().state;
|
||||
|
||||
|
||||
Future<void> getHttpData() async {
|
||||
logic.mockNetworkDataRequest().then((KeyListByUserEntity value){
|
||||
if(mounted) setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -37,31 +50,20 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: FutureBuilder<List<KeyListItem>>(
|
||||
future: logic.mockNetworkDataRequest(),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<KeyListItem>> snapshot) {
|
||||
//请求结束
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
//请求失败
|
||||
return const Text('请求失败');
|
||||
} else {
|
||||
//请求成功
|
||||
final List<KeyListItem> itemList = snapshot.data!;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
_topOwnedKeyText(),
|
||||
Expanded(child: _buildMainUI(itemList)),
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//请求未结束 显示loading
|
||||
return Container();
|
||||
}
|
||||
}));
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: () {
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: () {
|
||||
getHttpData();
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
_topOwnedKeyText(),
|
||||
Obx(() => Expanded(child: _buildMainUI())),
|
||||
],
|
||||
)));
|
||||
}
|
||||
|
||||
Widget _topOwnedKeyText() {
|
||||
@ -80,16 +82,43 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI(List itemList) {
|
||||
return ListView.builder(
|
||||
itemCount: itemList.length,
|
||||
itemBuilder: (c, index) {
|
||||
KeyListItem itemData = itemList[index];
|
||||
return _electronicKeyItem(itemData);
|
||||
});
|
||||
Widget _buildMainUI() {
|
||||
return state.dataList.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.builder(
|
||||
itemCount: state.dataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
KeyListItem itemData = state.dataList[index];
|
||||
return Slidable(
|
||||
key:ValueKey(itemData.keyId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
showIosTipViewDialog(itemData);
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(itemData),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(KeyListItem itemData) {
|
||||
var isHaveExpired = false;
|
||||
if(itemData.keyStatus == XSConstantMacro.keyStatusExpired){
|
||||
isHaveExpired = true;
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
@ -111,7 +140,28 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(itemData.lockAlias ?? '', style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)),
|
||||
// Text(itemData.lockAlias ?? '', style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)),
|
||||
SizedBox(
|
||||
width: 1.sw - 110.w - 100.w,
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
itemData.lockAlias ?? '',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 24.sp, color: isHaveExpired ? Colors.grey:AppColors.blackColor)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: isHaveExpired,
|
||||
child: Text("已过期",
|
||||
style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
@ -120,7 +170,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
children: [
|
||||
Text(
|
||||
logic.getUseDateStr(itemData),
|
||||
style: TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor),
|
||||
style: TextStyle(fontSize: 18.sp, color: isHaveExpired ? Colors.grey:AppColors.placeholderTextColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -134,4 +184,24 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showIosTipViewDialog(KeyListItem lockUserData) {
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "删除钥匙会在用户APP连网后生效",
|
||||
sureClick: () {
|
||||
Get.back();
|
||||
logic.deleteKeyRequest(lockUserData.keyId!);
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import '../lockUserManageList/keyListByUserEntity.dart';
|
||||
|
||||
class OwnedKeyListState{
|
||||
|
||||
var getUidStr = '';
|
||||
var dataList = [].obs;
|
||||
var getUidStr = 0;
|
||||
var dataList = <KeyListItem>[].obs;
|
||||
|
||||
OwnedKeyListState(){
|
||||
Map map = Get.arguments;
|
||||
|
||||
@ -2,7 +2,7 @@ import 'dart:async';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
|
||||
@ -27,7 +27,7 @@ class RecipientInformationEntity {
|
||||
}
|
||||
|
||||
class RecipientInformationData {
|
||||
String? uid;
|
||||
int? uid;
|
||||
String? nickname;
|
||||
String? headUrl;
|
||||
String? userid;
|
||||
|
||||
@ -292,7 +292,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
||||
return Center(
|
||||
child: Container(
|
||||
width: 400.w,
|
||||
height: 370.h,
|
||||
height: 400.h,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@ -66,7 +66,7 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
||||
onRefresh: (){
|
||||
getHttpData();
|
||||
},
|
||||
child: Column(
|
||||
child: Obx(() => state.transferSmartLockListData.value.isNotEmpty ? Column(
|
||||
children: [
|
||||
// KeySearchWidget(
|
||||
// editingController: state.searchController,
|
||||
@ -80,13 +80,13 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
||||
_buildNextBtn(),
|
||||
SizedBox(height: 64.h)
|
||||
],
|
||||
),
|
||||
): NoData()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return Obx(() => state.transferSmartLockListData.value.isNotEmpty ? ListView.separated(
|
||||
return ListView.separated(
|
||||
itemCount: state.transferSmartLockListData.value.length,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(
|
||||
@ -107,7 +107,7 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
||||
}
|
||||
});
|
||||
});
|
||||
}): NoData());
|
||||
});
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(TransferSmartLockItemData transferSmartLockItemData, Function() action) {
|
||||
|
||||
@ -147,6 +147,10 @@ abstract class Api {
|
||||
final String updateAdministratorURL =
|
||||
'/authorizedAdmin/update'; //管理员姓名/有效期/远程开锁修改
|
||||
final String expireLockListURL = '/keyUser/listExpireUser'; //即将到期的锁列表
|
||||
final String expirePasswordListURL = '/keyUser/listExpirePwd'; //即将到期的密码列表
|
||||
final String expireCardListURL = '/keyUser/listExpireCard'; //即将到期的卡列表
|
||||
final String expireFingerprintListURL = '/keyUser/listExpireFingerprint'; //即将到期的指纹列表
|
||||
final String expireFaceListURL = '//keyUser/listExpireFace'; //即将到期的人脸列表
|
||||
final String userSettingsInfoURL = '/user/userSettingsInfo'; //个人设置信息
|
||||
final String setAlertModeURL = '/user/setAlertMode'; //提示音
|
||||
final String setTouchUnlockFlagURL = '/user/setTouchUnlockFlag'; //触摸开锁
|
||||
|
||||
@ -586,6 +586,34 @@ class ApiProvider extends BaseProvider {
|
||||
'pageSize': pageSize,
|
||||
}));
|
||||
|
||||
Future<Response> expirePasswordList(String pageNo, String pageSize) => post(
|
||||
expirePasswordListURL.toUrl,
|
||||
jsonEncode({
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
}));
|
||||
|
||||
Future<Response> expireCardList(String pageNo, String pageSize) => post(
|
||||
expireCardListURL.toUrl,
|
||||
jsonEncode({
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
}));
|
||||
|
||||
Future<Response> expireFingerprintList(String pageNo, String pageSize) => post(
|
||||
expireFingerprintListURL.toUrl,
|
||||
jsonEncode({
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
}));
|
||||
|
||||
Future<Response> expireFaceList(String pageNo, String pageSize) => post(
|
||||
expireFaceListURL.toUrl,
|
||||
jsonEncode({
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
}));
|
||||
|
||||
Future<Response> deleteKeyboardPwd(
|
||||
String lockId, String keyboardPwdId, int deleteType) =>
|
||||
post(
|
||||
|
||||
@ -17,7 +17,8 @@ import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/mi
|
||||
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/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
|
||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||
@ -45,6 +46,8 @@ import '../main/lockMian/entity/lockListInfo_entity.dart';
|
||||
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
|
||||
import '../mine/message/messageList/messageList_entity.dart';
|
||||
import '../mine/minePersonInfo/minePersonInfoPage/minePersonGetUploadFileInfo_entity.dart';
|
||||
import '../mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_entity.dart';
|
||||
import '../mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_entity.dart';
|
||||
import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
|
||||
import '../mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_entity.dart';
|
||||
@ -586,13 +589,32 @@ class ApiRepository {
|
||||
return ElectronicKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//即将到期的锁列表
|
||||
//即将到期的电子钥匙列表
|
||||
Future<ExpireLockListEntity> expireLockList(
|
||||
String pageNo, String pageSize) async {
|
||||
final res = await apiProvider.expireLockList(pageNo, pageSize);
|
||||
return ExpireLockListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//即将到期的密码列表
|
||||
Future<ExpirePasswordEntity> expirePasswordList(
|
||||
String pageNo, String pageSize) async {
|
||||
final res = await apiProvider.expirePasswordList(pageNo, pageSize);
|
||||
return ExpirePasswordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//即将到期的卡列表
|
||||
Future<ExpireCardEntity> expireCardList(String pageNo, String pageSize) async {
|
||||
final res = await apiProvider.expireCardList(pageNo, pageSize);
|
||||
return ExpireCardEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//即将到期的指纹列表
|
||||
Future<ExpireFingerprintEntity> expireFingerprintList(String pageNo, String pageSize) async {
|
||||
final res = await apiProvider.expireFingerprintList(pageNo, pageSize);
|
||||
return ExpireFingerprintEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//删除密码
|
||||
Future<PasswordKeyEntity> deleteKeyboardPwd(
|
||||
String lockId, String keyboardPwdId, int deleteType) async {
|
||||
|
||||
@ -110,3 +110,8 @@ class DoorLockLogListRefreshUI {
|
||||
DateTime getDoorLockLogTime;
|
||||
DoorLockLogListRefreshUI(this.getDoorLockLogTime);
|
||||
}
|
||||
|
||||
/// 刷新更多设置锁用户管理列表
|
||||
class LockUserManageListRefreshUI {
|
||||
LockUserManageListRefreshUI();
|
||||
}
|
||||
|
||||
@ -93,4 +93,30 @@ class ShowTipView {
|
||||
);
|
||||
}
|
||||
|
||||
void showIosTipWithContentDialog(String contentStr, Function sureClick) {
|
||||
showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
content: Text(contentStr),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
sureClick();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -23,9 +23,9 @@ class StoreService<T> extends GetxService {
|
||||
final String _deviceUUID = 'DEVICE_ID';
|
||||
final String _languageCode = 'LANGUAGE_CODE';
|
||||
|
||||
Object? getDeviceId() => hasData(_deviceUUID) ? read(_deviceUUID): "";
|
||||
String? getDeviceId() => hasData(_deviceUUID) ? read(_deviceUUID).toString(): "";
|
||||
Future saveDeviceId(String uuid) => save(_deviceUUID, uuid);
|
||||
|
||||
Object? getLanguageCode() => hasData(_languageCode) ? read(_languageCode): "";
|
||||
String? getLanguageCode() => hasData(_languageCode) ? read(_languageCode).toString(): "";
|
||||
Future saveLanguageCode(String code) => save(_languageCode, code);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user