Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release
# Conflicts: # lib/network/api.dart 冲突合并
This commit is contained in:
commit
15dd47d2f0
@ -10,8 +10,8 @@ import 'package:star_lock/tools/dateTool.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_reply.dart';
|
||||
import '../../../../blue/io_protocol/io_transferPermissions.dart';
|
||||
import '../../../../blue/io_reply.dart';
|
||||
import '../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
@ -31,8 +32,8 @@ class AuthorizedAdminPage extends StatefulWidget {
|
||||
|
||||
class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
final logic = Get.put(AuthorizedAdminLogic());
|
||||
final state = Get.find<AuthorizedAdminLogic>().state;
|
||||
final AuthorizedAdminLogic logic = Get.put(AuthorizedAdminLogic());
|
||||
final AuthorizedAdminState state = Get.find<AuthorizedAdminLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -60,7 +61,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
@ -78,7 +79,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
// 限时
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
keyInfoWidget(),
|
||||
keyTimeWidget(),
|
||||
keyOnlyManageWidget(),
|
||||
@ -92,7 +93,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
// 永久
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
keyInfoWidget(),
|
||||
keyOnlyManageWidget(),
|
||||
keyBottomWidget(
|
||||
@ -107,17 +108,17 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
// 顶部钥匙信息widget
|
||||
Widget keyInfoWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: getTFWidget(true,
|
||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, 1)),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
@ -128,7 +129,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
final Object? result = await Navigator.pushNamed(
|
||||
context, Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
@ -140,7 +141,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: getTFWidget(
|
||||
false, TranslationLoader.lanKeys!.enterYourName!.tr, 2)),
|
||||
@ -152,17 +153,18 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
// 生效失效时间
|
||||
Widget keyTimeWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.beginDate.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
PDuration selectDate =
|
||||
final PDuration selectDate =
|
||||
PDuration.parse(DateTime.tryParse(state.beginDate.value));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
selectDate: selectDate,
|
||||
mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||
setState(() {
|
||||
state.beginDate.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
@ -173,10 +175,11 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
rightTitle: state.endDate.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
PDuration selectDate =
|
||||
final PDuration selectDate =
|
||||
PDuration.parse(DateTime.tryParse(state.endDate.value));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
selectDate: selectDate,
|
||||
mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||
setState(() {
|
||||
state.endDate.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
@ -190,14 +193,14 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
// 实名认证
|
||||
Widget keyOnlyManageWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
leftTitel: "仅管理自己创建的用户",
|
||||
rightTitle: "",
|
||||
leftTitel: '仅管理自己创建的用户',
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
isTipsImg: true,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog("授权管理员只能查看和管理自己下发的钥匙、密码等权限");
|
||||
ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限');
|
||||
},
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
@ -212,11 +215,11 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
|
||||
Widget keyBottomWidget(String tipStr) {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.w),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
tipStr,
|
||||
@ -233,26 +236,27 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||
onClick: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
//发送钥匙请求
|
||||
logic.sendElectronicKeyRequest();
|
||||
} else {
|
||||
logic.showToast("演示模式");
|
||||
logic.showToast('演示模式');
|
||||
}
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 30.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
final bool? isDemoMode =
|
||||
await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
Get.toNamed(Routers.volumeAuthorizationLockManagePage);
|
||||
} else {
|
||||
logic.showToast("演示模式");
|
||||
logic.showToast('演示模式');
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
@ -270,16 +274,15 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
// 实名认证
|
||||
Widget keyRealNameWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isTipsImg: true,
|
||||
isHaveLine:
|
||||
logic.state.isRequireAuth.value == true ? true : false,
|
||||
isHaveLine: logic.state.isRequireAuth.value == true,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。".tr);
|
||||
'人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。'.tr);
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
@ -289,7 +292,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
visible: logic.state.isRequireAuth.value,
|
||||
child: CommonItem(
|
||||
leftTitel: '真实姓名'.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
isHaveLine: true,
|
||||
rightWidget: getTFWidget(false, '请输入真实姓名'.tr, 3)))),
|
||||
@ -297,7 +300,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
visible: logic.state.isRequireAuth.value,
|
||||
child: CommonItem(
|
||||
leftTitel: '身份证号'.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: getTFWidget(false, '请输入身份证号'.tr, 4)))),
|
||||
],
|
||||
@ -307,13 +310,13 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
// 发送电子钥匙成功
|
||||
Widget sendElectronicKeySucceed() {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 250.h,
|
||||
width: 1.sw,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
@ -327,9 +330,9 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"发送成功",
|
||||
'发送成功',
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp,
|
||||
color: Colors.black,
|
||||
@ -354,9 +357,9 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName:
|
||||
state.emailOrPhoneController.text.contains("@") ? '邮件通知' : "短信通知",
|
||||
state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知',
|
||||
onClick: () {
|
||||
if (state.emailOrPhoneController.text.contains("@")) {
|
||||
if (state.emailOrPhoneController.text.contains('@')) {
|
||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||
} else {
|
||||
NativeInteractionTool()
|
||||
@ -387,7 +390,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
height: 65.h,
|
||||
width: 300.w,
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
@ -425,38 +428,37 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
isHaveBtn
|
||||
? Container(
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
image: DecorationImage(
|
||||
image: AssetImage('images/icon_addressBook.png'),
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
Contact? currentContact =
|
||||
await state.contactPicker.selectContact();
|
||||
setState(() {
|
||||
state.contact = currentContact!;
|
||||
if (currentContact.phoneNumbers!.isNotEmpty) {
|
||||
state.emailOrPhoneController.text = currentContact
|
||||
.phoneNumbers![0]
|
||||
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
||||
}
|
||||
|
||||
if (currentContact.fullName!.isNotEmpty) {
|
||||
state.keyNameController.text =
|
||||
currentContact.fullName!;
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
)
|
||||
: Container()
|
||||
if (isHaveBtn)
|
||||
Container(
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
image: DecorationImage(
|
||||
image: AssetImage('images/icon_addressBook.png'),
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final Contact? currentContact =
|
||||
await state.contactPicker.selectContact();
|
||||
setState(() {
|
||||
state.contact = currentContact!;
|
||||
if (currentContact.phoneNumbers!.isNotEmpty) {
|
||||
state.emailOrPhoneController.text = currentContact
|
||||
.phoneNumbers![0]
|
||||
.replaceAll(RegExp(r'\s+\b|\b\s'), '');
|
||||
}
|
||||
if (currentContact.fullName!.isNotEmpty) {
|
||||
state.keyNameController.text = currentContact.fullName!;
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
)
|
||||
else
|
||||
Container()
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -469,7 +471,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isAuthentication.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
if (logic.state.isAuthentication.value == false) {
|
||||
logic.keyCheckFace();
|
||||
@ -489,7 +491,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.onlyManageYouCreatesUser.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
state.onlyManageYouCreatesUser.value =
|
||||
!state.onlyManageYouCreatesUser.value;
|
||||
@ -498,7 +500,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
);
|
||||
}
|
||||
|
||||
Future _openModalBottomSheet() async {
|
||||
void _openModalBottomSheet() {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
@ -506,7 +508,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
constraints: BoxConstraints(maxHeight: 270.h),
|
||||
builder: (BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 180.h,
|
||||
@ -537,7 +539,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
}
|
||||
|
||||
List<Widget> initBottomSheetList() {
|
||||
List<Widget> widgetList = [];
|
||||
final List<Widget> widgetList = <Widget>[];
|
||||
|
||||
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
|
||||
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
|
||||
@ -557,7 +559,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
imageName,
|
||||
width: 50.w,
|
||||
@ -579,7 +581,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
}
|
||||
|
||||
//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}
|
||||
_jumpSmartDeviceRoute(int itemIndex) {
|
||||
dynamic _jumpSmartDeviceRoute(int itemIndex) {
|
||||
Get.back();
|
||||
switch (itemIndex) {
|
||||
case 0:
|
||||
@ -613,8 +615,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: state.tabController,
|
||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
onTap: (index) {
|
||||
tabs: _itemTabs.map(_tab).toList(),
|
||||
onTap: (int index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
isScrollable: true,
|
||||
@ -655,14 +657,14 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
child: TabBarView(
|
||||
controller: state.tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => Obx(() => indexChangeWidget()))
|
||||
.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!.timeLimit!.tr, type: '0'),
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: '1'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
@ -25,8 +26,8 @@ class AuthorizedAdminListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
final logic = Get.put(AuthorizedAdminListLogic());
|
||||
final state = Get.find<AuthorizedAdminListLogic>().state;
|
||||
final AuthorizedAdminListLogic logic = Get.put(AuthorizedAdminListLogic());
|
||||
final AuthorizedAdminListState state = Get.find<AuthorizedAdminListLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -37,7 +38,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
|
||||
Future<void> mockRequest() async {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value) {
|
||||
setState(() {});
|
||||
@ -63,7 +64,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
mockRequest();
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(child: _buildMainUI()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
@ -72,7 +73,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminPage)
|
||||
.then((val) {
|
||||
.then((Object? val) {
|
||||
if (val != null) {
|
||||
logic.pageNo = 1;
|
||||
mockRequest();
|
||||
@ -89,14 +90,14 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return Obx(() => state.itemDataList.value.isEmpty
|
||||
return Obx(() => state.itemDataList.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - 90)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
ElectronicKeyListItem indexEntity =
|
||||
state.itemDataList.value[index];
|
||||
itemCount: state.itemDataList.length,
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
final ElectronicKeyListItem indexEntity =
|
||||
state.itemDataList[index];
|
||||
String useDateStr = ''; //使用期限
|
||||
String keyStatus = ''; //钥匙状态
|
||||
|
||||
@ -116,16 +117,16 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
}
|
||||
|
||||
return Slidable(
|
||||
key: ValueKey(indexEntity.keyId),
|
||||
key: ValueKey<int?>(indexEntity.keyId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context) {
|
||||
ShowTipView()
|
||||
.showDeleteAdministratorIsHaveAllDataDialog(
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复', (bool isAllData) {
|
||||
logic.deleteKeyRequest(indexEntity.keyId.toString(),
|
||||
isAllData ? 1 : 0);
|
||||
});
|
||||
@ -145,9 +146,9 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
isAdminKey, () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyDetailPage,
|
||||
arguments: {
|
||||
"itemData": indexEntity,
|
||||
}).then((val) {
|
||||
arguments: <String, ElectronicKeyListItem>{
|
||||
'itemData': indexEntity,
|
||||
}).then((Object? val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
@ -172,14 +173,14 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
DateTime startDateStr =
|
||||
final DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
DateTime endDateStr =
|
||||
final DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
useDateStr = "永久";
|
||||
useDateStr = '永久';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
@ -192,7 +193,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
color: Colors.white,
|
||||
height: 100.h,
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(width: 30.w),
|
||||
Image.asset(
|
||||
avatarURL,
|
||||
@ -203,13 +204,13 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 1.sw - 110.w - 100.w,
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Text(receiveUser,
|
||||
maxLines: 1,
|
||||
@ -231,7 +232,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
useDate,
|
||||
style: TextStyle(
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
class NoticeTemplateEntity {
|
||||
NoticeTemplateEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
NoticeTemplateEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
if (json['data'] is Map) {
|
||||
data = Data.fromJson(json['data']);
|
||||
}
|
||||
}
|
||||
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['errorCode'] = errorCode;
|
||||
data['description'] = description;
|
||||
data['errorMsg'] = errorMsg;
|
||||
data['data'] = this.data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] is List) {
|
||||
json['list'].forEach((dynamic element) {
|
||||
list?.add(Item.fromJson(element));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
List<Item>? list = [];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['list'] = list;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Item {
|
||||
Item.fromJson(Map<String, dynamic> json) {
|
||||
type = json['type'];
|
||||
name = json['name'];
|
||||
template = json['template'];
|
||||
isUse = json['isUse'];
|
||||
fee = json['fee'];
|
||||
}
|
||||
|
||||
String? type;
|
||||
String? name;
|
||||
String? template;
|
||||
int? isUse;
|
||||
int? fee;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['type'] = type;
|
||||
data['name'] = name;
|
||||
data['template'] = template;
|
||||
data['isUse'] = isUse;
|
||||
data['fee'] = fee;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -2,19 +2,22 @@ import 'dart:ffi';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/notice_template_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
|
||||
import 'volumeAuthorizationLock_state.dart';
|
||||
|
||||
class VolumeAuthorizationLockLogic extends BaseGetXController {
|
||||
final state = VolumeAuthorizationLockState();
|
||||
final VolumeAuthorizationLockState state = VolumeAuthorizationLockState();
|
||||
|
||||
//发送批量授权管理员
|
||||
Future<void> addAuthorizedAdminRequest() async {
|
||||
String getFailureDateTime = '0';
|
||||
String getEffectiveDateTime = '0';
|
||||
if (state.selectWidgetType == '1') {
|
||||
if (state.selectWidgetType.value == '1') {
|
||||
getFailureDateTime =
|
||||
state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime =
|
||||
@ -25,11 +28,11 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
|
||||
showToast('请选择锁'.tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
||||
final KeyDetailEntity entity = await ApiRepository.to.addAuthorizedAdmin(
|
||||
createUser: state.isCreateUser.value ? '1' : '0',
|
||||
endDate: getFailureDateTime,
|
||||
isRemoteUnlock: '0',
|
||||
keyGroupIdList: [],
|
||||
keyGroupIdList: <dynamic>[],
|
||||
lockIdList: state.lockIdList.value,
|
||||
name: state.keyNameController.text,
|
||||
startDate: getEffectiveDateTime,
|
||||
@ -49,4 +52,5 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ class _VolumeAuthorizationLockPageState
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||
rightTitle: state.lockIdList.value.isEmpty
|
||||
rightTitle: state.lockIdList.isEmpty
|
||||
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
||||
: state.lockIdList.length.toString(),
|
||||
isHaveDirection: true,
|
||||
@ -190,11 +190,13 @@ class _VolumeAuthorizationLockPageState
|
||||
arguments: <String, String>{'keyLimits': '1'})
|
||||
.then((Object? value) {
|
||||
//得到选中的锁ID列表
|
||||
if (value != null) {
|
||||
value as Map<String, dynamic>;
|
||||
state.lockIdList.value = value['selectLockIdList'];
|
||||
|
||||
// setState(() {});
|
||||
if (value is Map<String, dynamic> &&
|
||||
value['selectLockIdList'] is List) {
|
||||
state.lockIdList.clear();
|
||||
value['selectLockIdList'].forEach((element) {
|
||||
state.lockIdList.add(element);
|
||||
});
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}),
|
||||
@ -211,13 +213,6 @@ class _VolumeAuthorizationLockPageState
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: _onlyManageYouCreatesUserSwitch())),
|
||||
|
||||
// CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
||||
// rightTitle: '',
|
||||
// isHaveRightWidget: true,
|
||||
// rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
||||
// action: () {}),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
);
|
||||
@ -359,47 +354,10 @@ class _VolumeAuthorizationLockPageState
|
||||
state.isSendSuccess.value = false;
|
||||
Navigator.pop(context, true);
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '邮件通知',
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '微信通知',
|
||||
onClick: () {},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '标记为已入住',
|
||||
onClick: () {},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// CupertinoSwitch _switch() {
|
||||
// return CupertinoSwitch(
|
||||
// activeColor: CupertinoColors.activeBlue,
|
||||
// trackColor: CupertinoColors.systemGrey5,
|
||||
// thumbColor: CupertinoColors.white,
|
||||
// value: state.isRemoteUnlock.value,
|
||||
// onChanged: (bool value) {
|
||||
// setState(() {
|
||||
// _isRemoteUnlock = !_isRemoteUnlock;
|
||||
// });
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
//仅管理自己创建的用户
|
||||
CupertinoSwitch _onlyManageYouCreatesUserSwitch() {
|
||||
return CupertinoSwitch(
|
||||
@ -407,7 +365,7 @@ class _VolumeAuthorizationLockPageState
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.onlyManageYouCreatesUser.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
state.onlyManageYouCreatesUser.value =
|
||||
!state.onlyManageYouCreatesUser.value;
|
||||
|
||||
@ -236,4 +236,6 @@ abstract class Api {
|
||||
final String deleteLockCloudStorageURL = '/lockCloudStorage/delete'; //删除云存
|
||||
|
||||
final String getUserNoList = '/key/getUserNoList'; //获取指定锁下所有userNo
|
||||
|
||||
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //获取短信或者邮箱模板
|
||||
}
|
||||
|
||||
@ -2085,6 +2085,17 @@ class ApiProvider extends BaseProvider {
|
||||
// 获取指定锁下所有userNo
|
||||
Future<Response> getLockUserNoList(int lockId) =>
|
||||
post(getUserNoList.toUrl, jsonEncode({'lockId': lockId}));
|
||||
|
||||
// 获取短信或者邮箱模板
|
||||
Future<Response<dynamic>> getNoticeTemplate(
|
||||
int lockId, int keyId, int channelType) =>
|
||||
post(
|
||||
getNoticeTemplateURL.toUrl,
|
||||
jsonEncode(<String, int>{
|
||||
'lockId': lockId,
|
||||
'keyId': keyId,
|
||||
'channelType': channelType,
|
||||
}));
|
||||
}
|
||||
|
||||
extension ExtensionString on String {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/entity/lock_user_no_list_entity.dart';
|
||||
import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/notice_template_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
||||
@ -2119,4 +2120,15 @@ class ApiRepository {
|
||||
final res = await apiProvider.getLockUserNoList(lockId);
|
||||
return LockUserNoListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 电子钥匙获取短信模板
|
||||
Future<NoticeTemplateEntity> getNoticeTemplate({
|
||||
required int lockId,
|
||||
required int keyId,
|
||||
required int channelType,
|
||||
}) async {
|
||||
final Response<dynamic> res =
|
||||
await apiProvider.getNoticeTemplate(lockId, keyId, channelType);
|
||||
return NoticeTemplateEntity.fromJson(res.body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import 'package:get/get_connect/http/src/request/request.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
|
||||
FutureOr<dynamic> responseLogInterceptor(Request request, Response response) {
|
||||
// AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers}
|
||||
AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers}
|
||||
EasyLoading.dismiss(animation: true);
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -55,8 +55,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# 1.0.45+2024052003:打包给公司测试
|
||||
# 1.0.46+2024052004:打包给公司测试
|
||||
# 1.0.47+2024052101:打包给欧阳回归测试
|
||||
# 1.0.48+2024052201:打包给欧阳回归测试
|
||||
|
||||
version: 1.0.47+2024052101
|
||||
version: 1.0.48+2024052201
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user