修改电子钥匙、授权管理员添加类型不对的问题
This commit is contained in:
parent
84b3042579
commit
3ee09ff746
@ -512,7 +512,7 @@
|
||||
"未打卡":"No card punched",
|
||||
"钥匙将在":"The key will be in",
|
||||
"天后失效":"Days later invalid",
|
||||
"锁更新时间:":"Lock update time:",
|
||||
"锁电量更新时间:":"Lock power update time:",
|
||||
"新增配件":"Add accessories",
|
||||
"请在锁旁边完成第一次开锁":"Please complete the first unlock next to the lock",
|
||||
"正在开锁中...":"Unlocking...",
|
||||
|
||||
@ -512,7 +512,7 @@
|
||||
"未打卡":"未打卡",
|
||||
"钥匙将在":"钥匙将在",
|
||||
"天后失效":"天后失效",
|
||||
"锁更新时间:":"锁更新时间:",
|
||||
"锁电量更新时间:":"锁电量更新时间:",
|
||||
"新增配件":"新增配件",
|
||||
"请在锁旁边完成第一次开锁":"请在锁旁边完成第一次开锁",
|
||||
"正在开锁中...":"正在开锁中...",
|
||||
|
||||
@ -514,7 +514,7 @@
|
||||
"早退":"早退",
|
||||
"钥匙将在":"钥匙将在",
|
||||
"天后失效":"天后失效",
|
||||
"锁更新时间:":"锁更新时间:",
|
||||
"锁电量更新时间:":"锁电量更新时间:",
|
||||
"新增配件":"新增配件",
|
||||
"请在锁旁边完成第一次开锁":"请在锁旁边完成第一次开锁",
|
||||
"正在开锁中...":"正在开锁中...",
|
||||
|
||||
@ -56,6 +56,7 @@ import 'login/forgetPassword/starLock_forgetPassword_page.dart';
|
||||
import 'login/login/starLock_login_page.dart';
|
||||
import 'login/register/starLock_register_page.dart';
|
||||
import 'login/selectCountryRegion/selectCountryRegion_page.dart';
|
||||
import 'main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart';
|
||||
import 'main/lockDetail/card/addCardType/addCardType_page.dart';
|
||||
import 'main/lockDetail/card/addICCard/addICCard_page.dart';
|
||||
import 'main/lockDetail/card/cardDetail/cardDetail_page.dart';
|
||||
@ -75,6 +76,7 @@ import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checki
|
||||
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart';
|
||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart';
|
||||
import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart';
|
||||
import 'main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart';
|
||||
import 'main/lockDetail/face/addFace/addFace_page.dart';
|
||||
import 'main/lockDetail/face/addFaceType/addFaceType_page.dart';
|
||||
import 'main/lockDetail/face/faceList/faceList_page.dart';
|
||||
@ -127,13 +129,11 @@ import 'main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart';
|
||||
import 'main/lockMian/demoMode/demoModeLockSet/demoModeLockSet_page.dart';
|
||||
import 'mine/about/about_page.dart';
|
||||
import 'mine/addLock/addLock/addLock_page.dart';
|
||||
import 'main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart';
|
||||
import 'main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart';
|
||||
import 'main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLockManage/volumeAuthorizationLockManage_page.dart';
|
||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart';
|
||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart';
|
||||
import 'main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart';
|
||||
import 'main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_page.dart';
|
||||
import 'main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart';
|
||||
import 'main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart';
|
||||
import 'main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart';
|
||||
@ -206,8 +206,8 @@ abstract class Routers {
|
||||
static const electronicKeyDetailPage = '/ElectronicKeyDetailPage'; // 电子钥匙详情
|
||||
static const electronicKeyDetailChangeDate =
|
||||
'/ElectronicKeyDetailChangeDate'; // 修改有效期
|
||||
static const sendElectronicKeyManagePage =
|
||||
'/SendElectronicKeyManagePage'; // 发送电子钥匙
|
||||
static const sendElectronicKeyPage =
|
||||
'/SendElectronicKeyPage'; // 发送电子钥匙
|
||||
static const massSendElectronicKeyManagePage =
|
||||
'/MassSendElectronicKeyManagePage'; // 群发钥匙
|
||||
static const electronicKeyPeriodValidityPage =
|
||||
@ -231,8 +231,8 @@ abstract class Routers {
|
||||
static const authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表
|
||||
static const authorizedAdminDetailPage =
|
||||
'/AuthorizedAdminDetailPage'; // 授权管理员详情
|
||||
static const authorizedAdminManagePage =
|
||||
'/AuthorizedAdminManagePage'; // 授权管理员
|
||||
static const authorizedAdminPage =
|
||||
'/AuthorizedAdminPage'; // 授权管理员
|
||||
static const volumeAuthorizationLockManagePage =
|
||||
'/VolumeAuthorizationLockManagePage'; // 批量授权锁
|
||||
static const lockOperatingRecordPage = '/LockOperatingRecordPage'; // 操作记录
|
||||
@ -499,8 +499,8 @@ abstract class AppRouters {
|
||||
page: () => const ElectronicKeyDetailChangeDate(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.sendElectronicKeyManagePage,
|
||||
page: () => const SendElectronicKeyManagePage(),
|
||||
name: Routers.sendElectronicKeyPage,
|
||||
page: () => const SendElectronicKeyPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.massSendElectronicKeyManagePage,
|
||||
@ -543,8 +543,8 @@ abstract class AppRouters {
|
||||
page: () => const AuthorizedAdminListPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.authorizedAdminManagePage,
|
||||
page: () => const AuthorizedAdminManagePage(),
|
||||
name: Routers.authorizedAdminPage,
|
||||
page: () => const AuthorizedAdminPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.lockOperatingRecordPage,
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'authorizedAdminManage_tabbar.dart';
|
||||
|
||||
class AuthorizedAdminManagePage extends StatefulWidget {
|
||||
const AuthorizedAdminManagePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AuthorizedAdminManagePage> createState() =>
|
||||
_AuthorizedAdminManagePageState();
|
||||
}
|
||||
|
||||
class _AuthorizedAdminManagePageState extends State<AuthorizedAdminManagePage> {
|
||||
var index = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
AuthorizedAdminManageTabbar(
|
||||
initialIndex: index,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,118 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../../../electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart';
|
||||
import '../authorizedAdmin_page.dart';
|
||||
|
||||
class AuthorizedAdminManageTabbar extends StatefulWidget {
|
||||
var initialIndex = 1;
|
||||
|
||||
AuthorizedAdminManageTabbar({Key? key, required this.initialIndex}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AuthorizedAdminManageTabbar> createState() =>
|
||||
_AuthorizedAdminManageTabbarState();
|
||||
}
|
||||
|
||||
class _AuthorizedAdminManageTabbarState extends State<AuthorizedAdminManageTabbar> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
_tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
|
||||
_tabController.addListener(() {
|
||||
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
|
||||
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,
|
||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
onTap: (index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
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(
|
||||
// text: item.title,
|
||||
child: Container(
|
||||
width: 1.sw / 4,
|
||||
margin: EdgeInsets.all(10.w),
|
||||
// color: Colors.red,
|
||||
child: Text(
|
||||
item.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => AuthorizedAdminPage(
|
||||
type: item.type,
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.type});
|
||||
|
||||
final String title;
|
||||
final String type;
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
@ -13,6 +14,7 @@ import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../../tools/commonDataManage.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
@ -220,10 +222,9 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
var endDate = "0";
|
||||
var startTime = "0";
|
||||
var endTime = "0";
|
||||
String lockID = state.keyInfo.value.lockId.toString();
|
||||
Get.log("state.type.value:${state.type.value}");
|
||||
Get.log("state.type.value:${state.seletType.value}");
|
||||
String getKeyType = "1";
|
||||
if (state.type.value == '0') {
|
||||
if (state.seletType.value == 0) {
|
||||
getKeyType = "2";
|
||||
|
||||
startDate = DateTool().dateToTimestamp(state.beginDate.value, 1).toString();
|
||||
@ -257,7 +258,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
keyNameForAdmin: state.keyNameController.text,
|
||||
keyRight: '1',
|
||||
keyType: getKeyType,
|
||||
lockId: lockID,
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!.toString(),
|
||||
operatorUid: '',
|
||||
receiverUsername: state.emailOrPhoneController.text,
|
||||
remarks: '',
|
||||
@ -289,7 +290,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
||||
Future<void> updateRoomCheckIn() async {
|
||||
var entity = await ApiRepository.to.setRoomStatusData(
|
||||
lockId: state.keyInfo.value.lockId!,
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!,
|
||||
roomStatus: 1,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
|
||||
@ -6,7 +6,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import 'package:star_lock/tools/dateUtils.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
@ -14,36 +13,59 @@ import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../tools/NativeInteractionTool.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'authorizedAdmin_logic.dart';
|
||||
|
||||
class AuthorizedAdminPage extends StatefulWidget {
|
||||
final String type;
|
||||
const AuthorizedAdminPage({Key? key, required this.type}) : super(key: key);
|
||||
const AuthorizedAdminPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AuthorizedAdminPage> createState() => _AuthorizedAdminPageState();
|
||||
}
|
||||
|
||||
class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTickerProviderStateMixin {
|
||||
final logic = Get.put(AuthorizedAdminLogic());
|
||||
final state = Get.find<AuthorizedAdminLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
state.tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: 0);
|
||||
state.tabController.addListener(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
state.seletType.value = state.tabController.index;
|
||||
});
|
||||
|
||||
if (state.tabController.animation!.value == state.tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.type.value = widget.type;
|
||||
Get.log("widget.type:${widget.type}");
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Obx(() => indexChangeWidget()),
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -51,28 +73,32 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
if (state.isSendSuccess.value) {
|
||||
return sendElectronicKeySucceed();
|
||||
} else {
|
||||
switch (int.parse(widget.type)) {
|
||||
switch (state.seletType.value) {
|
||||
case 0:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyTimeWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(
|
||||
TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyTimeWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(
|
||||
TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
default:
|
||||
// 永久
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -345,6 +371,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
],
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: lineIndex == 1
|
||||
? state.emailOrPhoneController
|
||||
: state.keyNameController,
|
||||
@ -561,4 +589,67 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: state.tabController,
|
||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
onTap: (index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
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(
|
||||
// text: item.title,
|
||||
child: Container(
|
||||
width: 1.sw / 4,
|
||||
margin: EdgeInsets.all(10.w),
|
||||
// color: Colors.red,
|
||||
child: Text(
|
||||
item.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: state.tabController,
|
||||
children: _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"),
|
||||
];
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.type});
|
||||
|
||||
final String title;
|
||||
final String type;
|
||||
}
|
||||
|
||||
@ -6,16 +6,14 @@ import 'package:star_lock/tools/dateTool.dart';
|
||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class AuthorizedAdminState {
|
||||
final TextEditingController emailOrPhoneController =
|
||||
TextEditingController(); //邮箱/手机号输入框
|
||||
final TextEditingController keyNameController =
|
||||
TextEditingController(); //钥匙名输入框
|
||||
final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框
|
||||
final TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||
late TabController tabController;
|
||||
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
|
||||
var type = ''.obs;
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final lockMainEntity = LockMainEntity().obs;
|
||||
final isAuthentication = false.obs; //是否可以实名认证
|
||||
final onlyManageYouCreatesUser = false.obs; // 只能管理自己创建的用户
|
||||
@ -29,13 +27,13 @@ class AuthorizedAdminState {
|
||||
var weekdaysList = [].obs;
|
||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||
|
||||
final widgetType = 0.obs;
|
||||
var seletType = 0.obs;
|
||||
String pwdShareStr = '您好,您的授权管理员生成成功';
|
||||
|
||||
var addUserId = ''.obs;
|
||||
AuthorizedAdminState() {
|
||||
Map map = Get.arguments;
|
||||
// lockMainEntity.value = map["lockMainEntity"];
|
||||
keyInfo.value = map["keyInfo"];
|
||||
}
|
||||
// AuthorizedAdminState() {
|
||||
// Map map = Get.arguments;
|
||||
// // lockMainEntity.value = map["lockMainEntity"];
|
||||
// keyInfo.value = map["keyInfo"];
|
||||
// }
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/au
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
|
||||
@ -14,10 +15,10 @@ class AuthorizedAdminListLogic extends BaseGetXController {
|
||||
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||
endDate: '0',
|
||||
keyId: state.keyInfo.value.keyId.toString(),
|
||||
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
keyStatus: '',
|
||||
keyRight: '1',
|
||||
lockId: state.keyInfo.value.lockId.toString(),
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize.toString(),
|
||||
startDate: '0',
|
||||
|
||||
@ -73,11 +73,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminManagePage,
|
||||
arguments: {
|
||||
// "lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminPage).then((val) {
|
||||
if (val != null) {
|
||||
logic.pageNo = 1;
|
||||
mockRequest();
|
||||
@ -140,7 +136,6 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage, arguments: {
|
||||
"itemData": indexEntity,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
|
||||
@ -4,15 +4,15 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity
|
||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class AuthorizedAdminListState {
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final lockMainEntity = LockMainEntity().obs;
|
||||
|
||||
final itemDataList = <ElectronicKeyListItem>[].obs;
|
||||
final searchStr = ''.obs;
|
||||
|
||||
AuthorizedAdminListState() {
|
||||
Map map = Get.arguments;
|
||||
// lockMainEntity.value = map["lockMainEntity"];
|
||||
keyInfo.value = map["keyInfo"];
|
||||
}
|
||||
// AuthorizedAdminListState() {
|
||||
// Map map = Get.arguments;
|
||||
// // lockMainEntity.value = map["lockMainEntity"];
|
||||
// keyInfo.value = map["keyInfo"];
|
||||
// }
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/elec
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import '../../../../../tools/commonDataManage.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/showTFView.dart';
|
||||
@ -164,7 +165,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
child: _onlyManageYouCreatesUserSwitch())),
|
||||
),
|
||||
Visibility(// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
|
||||
visible: state.keyInfo.value.lockSetting!.remoteUnlock == 1 && state.itemData.value.keyRight != 1 ? true:false,
|
||||
visible: CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1 && state.itemData.value.keyRight != 1 ? true:false,
|
||||
child: CommonItem(
|
||||
leftTitel: "远程开锁".tr,
|
||||
rightTitle: "",
|
||||
|
||||
@ -6,7 +6,7 @@ import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class ElectronicKeyDetailState {
|
||||
final itemData = ElectronicKeyListItem().obs;
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final keyInfo = LockListInfoItemEntity().obs;
|
||||
|
||||
final keyName = "".obs;
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
@ -24,9 +24,9 @@ class ElectronicKeyDetailState {
|
||||
ElectronicKeyDetailState() {
|
||||
Map map = Get.arguments;
|
||||
itemData.value = map["itemData"];
|
||||
if(map["keyInfo"]!=null){
|
||||
keyInfo.value = map["keyInfo"];
|
||||
}
|
||||
// if(map["keyInfo"]!=null){
|
||||
// keyInfo.value = map["keyInfo"];
|
||||
// }
|
||||
changeNameController.text = itemData.value.keyName!;
|
||||
keyName.value = itemData.value.keyName!;
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electr
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
@ -16,10 +17,10 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||
endDate: '0',
|
||||
keyId: state.keyInfo.value.keyId.toString(),
|
||||
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
keyStatus: '',
|
||||
keyRight: '0',
|
||||
lockId: state.keyInfo.value.lockId.toString(),
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize.toString(),
|
||||
startDate: '0',
|
||||
@ -41,7 +42,7 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
//电子钥匙重置请求
|
||||
Future<void> resetElectronicKeyListRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||
.resetElectronicKey(state.keyInfo.value.lockId.toString(), '0');
|
||||
.resetElectronicKey(CommonDataManage().currentKeyInfo.lockId.toString(), '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("重置成功".tr, something: (){
|
||||
pageNo = 1;
|
||||
|
||||
@ -102,12 +102,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.sendElectronicKeyManagePage,
|
||||
arguments: {
|
||||
// "lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
Navigator.pushNamed(context, Routers.sendElectronicKeyPage).then((val) {
|
||||
if (val != null) {
|
||||
logic.pageNo = 1;
|
||||
mockRequest();
|
||||
@ -182,7 +177,6 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
context, Routers.electronicKeyDetailPage,
|
||||
arguments: {
|
||||
"itemData": indexEntity,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
|
||||
@ -6,15 +6,15 @@ import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class ElectronicKeyListState {
|
||||
TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final lockMainEntity = LockMainEntity().obs;
|
||||
var pageNum = 1.obs; //请求页码
|
||||
final pageSize = 20.obs; //请求每页数据条数
|
||||
final itemDataList = <ElectronicKeyListItem>[].obs;
|
||||
|
||||
ElectronicKeyListState() {
|
||||
Map map = Get.arguments;
|
||||
// lockMainEntity.value = map["lockMainEntity"];
|
||||
keyInfo.value = map["keyInfo"];
|
||||
}
|
||||
// ElectronicKeyListState() {
|
||||
// Map map = Get.arguments;
|
||||
// // lockMainEntity.value = map["lockMainEntity"];
|
||||
// keyInfo.value = map["keyInfo"];
|
||||
// }
|
||||
}
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.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/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
import '../../../../../tools/showTipView.dart';
|
||||
|
||||
@ -33,26 +30,25 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
var endDate = "0";
|
||||
var startTime = "0";
|
||||
var endTime = "0";
|
||||
String lockID = state.keyInfo.value.lockId.toString();
|
||||
int typeValue = int.parse(state.type.value);
|
||||
int typeValue = state.seletType.value;
|
||||
switch (typeValue) {
|
||||
case 0:
|
||||
{
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择开始时间".tr);
|
||||
return;
|
||||
}
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择结束时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
typeValue = XSConstantMacro.keyTypeTime;
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
|
||||
if (startDate.isEmpty) {
|
||||
showToast("请选择开始时间".tr);
|
||||
return;
|
||||
}
|
||||
if (endDate.isEmpty) {
|
||||
showToast("请选择结束时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
// if(DateTime.now().millisecondsSinceEpoch > int.parse(state.beginTimeTimestamp.value)){
|
||||
// Toast.show(msg: "生效时间要大于当前时间");
|
||||
// return;
|
||||
@ -100,7 +96,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
keyNameForAdmin: state.keyNameController.text,
|
||||
keyRight: '0',
|
||||
keyType: getKeyType,
|
||||
lockId: lockID,
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
|
||||
operatorUid: '',
|
||||
receiverUsername: state.emailOrPhoneController.text,
|
||||
remarks: '',
|
||||
@ -111,7 +107,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
isOnlyManageSelf: 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = int.parse(state.type.value);
|
||||
state.sendSucceedType.value = state.seletType.value;
|
||||
resetData();
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
} else {
|
||||
@ -221,7 +217,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
void resetData() {
|
||||
state.emailOrPhoneController.text = "";
|
||||
state.keyNameController.text = "";
|
||||
if(state.type.value == "0"){
|
||||
if(state.seletType.value == 0){
|
||||
state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||
state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());//默认为当前时间
|
||||
}else{
|
||||
|
||||
@ -15,102 +15,131 @@ import 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../tools/NativeInteractionTool.dart';
|
||||
import '../../../../../tools/commonDataManage.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
class SendElectronicKeyPage extends StatefulWidget {
|
||||
final String type;
|
||||
|
||||
const SendElectronicKeyPage({Key? key, required this.type}) : super(key: key);
|
||||
const SendElectronicKeyPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SendElectronicKeyPage> createState() => _SendElectronicKeyPageState();
|
||||
}
|
||||
|
||||
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with SingleTickerProviderStateMixin {
|
||||
final logic = Get.put(SendElectronicKeyLogic());
|
||||
final state = Get.find<SendElectronicKeyLogic>().state;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
getDemoMode();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
logic.resetData();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> getDemoMode() async {
|
||||
state.isDemoMode = (await Storage.getBool(ifIsDemoModeOrNot))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.type.value = widget.type;
|
||||
Get.log('state.type.value:${state.type.value}');
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
||||
getDemoMode();
|
||||
|
||||
state.tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: 0);
|
||||
state.tabController.addListener(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
state.seletType.value = state.tabController.index;
|
||||
});
|
||||
|
||||
if (state.tabController.animation!.value == state.tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
if (state.isSendSuccess.value == true &&
|
||||
state.sendSucceedType.value.toString() == widget.type) {
|
||||
state.sendSucceedType.value == state.seletType.value) {
|
||||
return sendElectronicKeySucceed();
|
||||
} else {
|
||||
switch (int.parse(widget.type)) {
|
||||
switch (state.seletType.value) {
|
||||
case 0:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyTimeWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(state.timeLimitTips)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyTimeWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(state.timeLimitTips)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// 永久
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(state.permanentTips)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(state.permanentTips)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// 单次
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(state.onceLimitTips)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(state.onceLimitTips)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
// 循环
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyPeriodValidityWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(state.cycleLimitTips)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyPeriodValidityWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(state.cycleLimitTips)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
default:
|
||||
@ -441,7 +470,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
// }
|
||||
|
||||
var entity = await ApiRepository.to.setRoomStatusData(
|
||||
lockId: state.keyInfo.value.lockId!,
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!,
|
||||
roomStatus: 1,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -542,7 +571,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
return Visibility(
|
||||
visible: state.isDemoMode
|
||||
? false
|
||||
: (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false),
|
||||
: (CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1 ? true : false),
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
@ -618,6 +647,65 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
});
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: state.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(
|
||||
// text: item.title,
|
||||
child: Container(
|
||||
// width: 1.sw / 8,
|
||||
margin: EdgeInsets.all(10.w),
|
||||
// color: Colors.red,
|
||||
child: Text(
|
||||
item.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: state.tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "3"),
|
||||
];
|
||||
|
||||
List<Widget> initBottomSheetList() {
|
||||
List<Widget> widgetList = [];
|
||||
|
||||
@ -694,3 +782,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.type});
|
||||
|
||||
final String title;
|
||||
final String type;
|
||||
}
|
||||
|
||||
@ -9,9 +9,11 @@ class SendElectronicKeyState {
|
||||
TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框
|
||||
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||
|
||||
late TabController tabController;
|
||||
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final keyInfo = LockListInfoItemEntity().obs;
|
||||
|
||||
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||
final isAuthentication = false.obs; //是否可以实名认证
|
||||
@ -22,7 +24,7 @@ class SendElectronicKeyState {
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
|
||||
var type = ''.obs;// 限时、永久、单次、循环
|
||||
var seletType = 0.obs;// 限时、永久、单次、循环
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.tr.obs;
|
||||
var countryCode = '86'.obs;
|
||||
@ -37,9 +39,9 @@ class SendElectronicKeyState {
|
||||
final cycleLimitTips = '接收者可以在有效期内的固定时间段里,不限次数使用'; //循环
|
||||
|
||||
SendElectronicKeyState() {
|
||||
Map map = Get.arguments;
|
||||
if ((map["keyInfo"] != null)) {
|
||||
keyInfo.value = map["keyInfo"];
|
||||
}
|
||||
// Map map = Get.arguments;
|
||||
// if ((map["keyInfo"] != null)) {
|
||||
// keyInfo.value = map["keyInfo"];
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'sendElectronicKeyManage_tabbar.dart';
|
||||
|
||||
class SendElectronicKeyManagePage extends StatefulWidget {
|
||||
const SendElectronicKeyManagePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SendElectronicKeyManagePage> createState() => _SendElectronicKeyManagePageState();
|
||||
}
|
||||
|
||||
class _SendElectronicKeyManagePageState extends State<SendElectronicKeyManagePage> {
|
||||
var index=0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.sendKey!.tr, haveBack:true, backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
SendElectronicKeyManageTabbar(initialIndex: index,),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,122 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../sendElectronicKey/sendElectronicKey_page.dart';
|
||||
|
||||
class SendElectronicKeyManageTabbar extends StatefulWidget {
|
||||
var initialIndex = 1;
|
||||
|
||||
SendElectronicKeyManageTabbar({Key? key, required this.initialIndex})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<SendElectronicKeyManageTabbar> createState() =>
|
||||
_SendElectronicKeyManageTabbarState();
|
||||
}
|
||||
|
||||
class _SendElectronicKeyManageTabbarState
|
||||
extends State<SendElectronicKeyManageTabbar>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "3"),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
_tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
|
||||
_tabController.addListener(() {
|
||||
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
|
||||
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(
|
||||
// text: item.title,
|
||||
child: Container(
|
||||
// width: 1.sw / 8,
|
||||
margin: EdgeInsets.all(10.w),
|
||||
// color: Colors.red,
|
||||
child: Text(
|
||||
item.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => SendElectronicKeyPage(
|
||||
type: item.type,
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.type});
|
||||
|
||||
final String title;
|
||||
final String type;
|
||||
}
|
||||
@ -21,6 +21,7 @@ import '../../../blue/sender_manage.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
import '../../../permission/permission_dialog.dart';
|
||||
import '../../../tools/baseGetXController.dart';
|
||||
import '../../../tools/commonDataManage.dart';
|
||||
import '../../../tools/eventBusEventManage.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
@ -600,6 +601,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
state.keyInfos.value.lockSetting!.remoteUnlock =
|
||||
int.parse(event.setResult);
|
||||
}
|
||||
CommonDataManage().currentKeyInfo = state.keyInfos.value;
|
||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||
});
|
||||
}
|
||||
|
||||
@ -522,7 +522,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
onTap: () {
|
||||
// logic.getStarLockStatus();
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
|
||||
"${"锁电量更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
@ -923,8 +923,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
TranslationLoader.lanKeys!.electronicKey!.tr,
|
||||
state.openDoorBtnisUneable.value,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.electronicKeyListPage,
|
||||
arguments: {"keyInfo": state.keyInfos.value});
|
||||
Get.toNamed(Routers.electronicKeyListPage);
|
||||
}));
|
||||
|
||||
// 密码
|
||||
|
||||
@ -57,6 +57,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
isBeforeAddUser: false,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
@ -112,6 +113,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
isBeforeAddUser: false,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
break;
|
||||
|
||||
@ -66,6 +66,7 @@ class LockTimeLogic extends BaseGetXController{
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
isBeforeAddUser: false,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
break;
|
||||
@ -157,6 +158,7 @@ class LockTimeLogic extends BaseGetXController{
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
isBeforeAddUser: false,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
|
||||
@ -14,7 +14,6 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_modelVendor.dart';
|
||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../tools/NativeInteractionTool.dart';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user