1,新增公用正则判断文件
2,设置/更新授权管理员接口修改及对接 3,发送授权管理员/详情新增仅管理自己创建的用户及相关逻辑处理 4,批量授权管理员模块代码重构 5,部分模块代码风格优化
This commit is contained in:
parent
af04296143
commit
63e963b3e0
@ -753,7 +753,7 @@
|
|||||||
"当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网": "当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网",
|
"当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网": "当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网",
|
||||||
"胁迫指纹": "胁迫指纹",
|
"胁迫指纹": "胁迫指纹",
|
||||||
"指纹列表": "指纹列表",
|
"指纹列表": "指纹列表",
|
||||||
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网": "经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网",
|
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网": "经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网。",
|
||||||
"打开提醒后,当锁电量低于20%、10%和5%,系统会给指定对象发送提醒消息。电量读取方式:网关读取或APP读取。": "打开提醒后,当锁电量低于20%、10%和5%,系统会给指定对象发送提醒消息。电量读取方式:网关读取或APP读取。",
|
"打开提醒后,当锁电量低于20%、10%和5%,系统会给指定对象发送提醒消息。电量读取方式:网关读取或APP读取。": "打开提醒后,当锁电量低于20%、10%和5%,系统会给指定对象发送提醒消息。电量读取方式:网关读取或APP读取。",
|
||||||
"门未开时间": "门未开时间",
|
"门未开时间": "门未开时间",
|
||||||
"添加和使用面容开锁时:": "添加和使用面容开锁时:",
|
"添加和使用面容开锁时:": "添加和使用面容开锁时:",
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import 'volumeAuthorizationLock_state.dart';
|
import 'volumeAuthorizationLock_state.dart';
|
||||||
@ -7,4 +10,43 @@ import 'volumeAuthorizationLock_state.dart';
|
|||||||
class VolumeAuthorizationLockLogic extends BaseGetXController {
|
class VolumeAuthorizationLockLogic extends BaseGetXController {
|
||||||
final state = VolumeAuthorizationLockState();
|
final state = VolumeAuthorizationLockState();
|
||||||
|
|
||||||
}
|
//发送批量授权管理员
|
||||||
|
Future<void> addAuthorizedAdminRequest() async {
|
||||||
|
String getFailureDateTime = '0';
|
||||||
|
String getEffectiveDateTime = '0';
|
||||||
|
if (state.selectWidgetType == '1') {
|
||||||
|
getFailureDateTime =
|
||||||
|
state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||||
|
getEffectiveDateTime =
|
||||||
|
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.lockIdList.isEmpty) {
|
||||||
|
showToast('请选择锁'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
||||||
|
createUser: state.isCreateUser.value ? '1' : '0',
|
||||||
|
endDate: getFailureDateTime,
|
||||||
|
isRemoteUnlock: '0',
|
||||||
|
keyGroupIdList: [],
|
||||||
|
lockIdList: state.lockIdList.value,
|
||||||
|
name: state.keyNameController.text,
|
||||||
|
startDate: getEffectiveDateTime,
|
||||||
|
userid: state.emailOrPhoneController.text,
|
||||||
|
countryCode: state.countryCode.value,
|
||||||
|
usernameType: '1',
|
||||||
|
isOnlyManageSelf: state.onlyManageYouCreatesUser.value == true ? 1 : 2,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.isSendSuccess.value = true;
|
||||||
|
} else {
|
||||||
|
EasyLoading.showToast('${entity.errorMsg}', duration: 2000.milliseconds);
|
||||||
|
if (entity.errorCode == 425) {
|
||||||
|
//用户未注册
|
||||||
|
state.isCreateUser.value = true;
|
||||||
|
addAuthorizedAdminRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,19 +1,16 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
|
|
||||||
// import 'package:flutter_pickers/pickers.dart';
|
|
||||||
// import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_state.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/pickers.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/pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
@ -22,10 +19,9 @@ import '../../../../translations/trans_lib.dart';
|
|||||||
import 'volumeAuthorizationLock_logic.dart';
|
import 'volumeAuthorizationLock_logic.dart';
|
||||||
|
|
||||||
class VolumeAuthorizationLockPage extends StatefulWidget {
|
class VolumeAuthorizationLockPage extends StatefulWidget {
|
||||||
final String type;
|
const VolumeAuthorizationLockPage({required this.type, Key? key})
|
||||||
|
|
||||||
const VolumeAuthorizationLockPage({Key? key, required this.type})
|
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
final String type;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<VolumeAuthorizationLockPage> createState() =>
|
State<VolumeAuthorizationLockPage> createState() =>
|
||||||
@ -33,53 +29,23 @@ class VolumeAuthorizationLockPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//批量授权锁页面
|
//批量授权锁页面
|
||||||
class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPage> {
|
class _VolumeAuthorizationLockPageState
|
||||||
final logic = Get.put(VolumeAuthorizationLockLogic());
|
extends State<VolumeAuthorizationLockPage> {
|
||||||
final state = Get.find<VolumeAuthorizationLockLogic>().state;
|
final VolumeAuthorizationLockLogic logic =
|
||||||
|
Get.put(VolumeAuthorizationLockLogic());
|
||||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
final VolumeAuthorizationLockState state =
|
||||||
final TextEditingController _emailOrPhoneController =
|
Get.find<VolumeAuthorizationLockLogic>().state;
|
||||||
TextEditingController(); //邮箱/手机号输入框
|
|
||||||
final TextEditingController _keyNameController =
|
|
||||||
TextEditingController(); //钥匙名输入框
|
|
||||||
late Contact _contact;
|
|
||||||
late List _lockIdList;
|
|
||||||
late bool _isSendSuccess;
|
|
||||||
late bool _isCreateUser; //是否需要创建用户
|
|
||||||
late bool _isRemoteUnlock; //是否远程开锁
|
|
||||||
var _selectEffectiveDate = ''; //生效时间
|
|
||||||
var _selectFailureDate = ''; //失效时间
|
|
||||||
late DateTime _effectiveDateTime;
|
|
||||||
late DateTime _failureDateTime;
|
|
||||||
String countryName = '中国';
|
|
||||||
String countryCode = '86';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
state.selectWidgetType.value = widget.type;
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: indexChangeWidget(),
|
child: Obx(indexChangeWidget),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
_lockIdList = [];
|
|
||||||
_isRemoteUnlock = false;
|
|
||||||
_isSendSuccess = false;
|
|
||||||
_isCreateUser = false;
|
|
||||||
DateTime dateTime = DateTime.now();
|
|
||||||
_effectiveDateTime = dateTime;
|
|
||||||
_failureDateTime = dateTime;
|
|
||||||
_selectEffectiveDate =
|
|
||||||
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
|
||||||
_selectFailureDate =
|
|
||||||
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
if (_isSendSuccess) {
|
if (state.isSendSuccess.value) {
|
||||||
return sendElectronicKeySucceed();
|
return sendElectronicKeySucceed();
|
||||||
} else {
|
} else {
|
||||||
switch (int.parse(widget.type)) {
|
switch (int.parse(widget.type)) {
|
||||||
@ -87,7 +53,7 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
{
|
{
|
||||||
// 永久
|
// 永久
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
keyInfoWidget(),
|
keyInfoWidget(),
|
||||||
remoteUnlockingWidget(),
|
remoteUnlockingWidget(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -100,7 +66,7 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
default:
|
default:
|
||||||
// 限时
|
// 限时
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
keyInfoWidget(),
|
keyInfoWidget(),
|
||||||
keyTimeWidget(),
|
keyTimeWidget(),
|
||||||
remoteUnlockingWidget(),
|
remoteUnlockingWidget(),
|
||||||
@ -117,47 +83,47 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
// 顶部钥匙信息widget
|
// 顶部钥匙信息widget
|
||||||
Widget keyInfoWidget() {
|
Widget keyInfoWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
true,
|
true,
|
||||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
_emailOrPhoneController)),
|
state.emailOrPhoneController)),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
rightWidget: Text(
|
rightWidget: Text(
|
||||||
'$countryName +$countryCode',
|
'${state.countryName.value} +${state.countryCode.value}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
),
|
),
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
final Object? result = await Navigator.pushNamed(
|
||||||
context, Routers.selectCountryRegionPage);
|
context, Routers.selectCountryRegionPage);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
countryCode = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
countryName = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
setState(() {});
|
// setState(() {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
false,
|
false,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
_keyNameController)),
|
state.keyNameController)),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -166,36 +132,42 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
// 生效失效时间
|
// 生效失效时间
|
||||||
Widget keyTimeWidget() {
|
Widget keyTimeWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: _selectEffectiveDate,
|
rightTitle: state.selectEffectiveDate.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate = PDuration.parse(_effectiveDateTime);
|
final PDuration selectDate =
|
||||||
|
PDuration.parse(state.effectiveDateTime.value);
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
selectDate: selectDate,
|
||||||
setState(() {
|
mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
_selectEffectiveDate =
|
// setState(() {
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
state.selectEffectiveDate.value =
|
||||||
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
});
|
state.effectiveDateTime.value =
|
||||||
|
DateTime.parse(state.selectEffectiveDate.value);
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: _selectFailureDate,
|
rightTitle: state.selectFailureDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate = PDuration.parse(_failureDateTime);
|
final PDuration selectDate =
|
||||||
|
PDuration.parse(state.failureDateTime.value);
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
selectDate: selectDate,
|
||||||
setState(() {
|
mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
_selectFailureDate =
|
// setState(() {
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
state.selectFailureDate.value =
|
||||||
_failureDateTime = DateTime.parse(_selectFailureDate);
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
});
|
state.failureDateTime.value =
|
||||||
|
DateTime.parse(state.selectFailureDate.value);
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -206,33 +178,46 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
// 远程开锁
|
// 远程开锁
|
||||||
Widget remoteUnlockingWidget() {
|
Widget remoteUnlockingWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
rightTitle: _lockIdList.isEmpty
|
rightTitle: state.lockIdList.value.isEmpty
|
||||||
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
||||||
: _lockIdList.length.toString(),
|
: state.lockIdList.length.toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.massSendLockGroupListPage, arguments: {
|
Navigator.pushNamed(context, Routers.massSendLockGroupListPage,
|
||||||
"keyLimits":"1"
|
arguments: <String, String>{'keyLimits': '1'})
|
||||||
}).then((value) {
|
.then((Object? value) {
|
||||||
//得到选中的锁ID列表
|
//得到选中的锁ID列表
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
_lockIdList = value['selectLockIdList'];
|
state.lockIdList.value = value['selectLockIdList'];
|
||||||
|
|
||||||
setState(() {});
|
// setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
leftTitel: '仅管理自己创建的用户',
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
isTipsImg: true,
|
||||||
action: () {}),
|
tipsImgAction: () {
|
||||||
|
ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限');
|
||||||
|
},
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
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),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -240,14 +225,14 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
|
|
||||||
Widget keyBottomWidget() {
|
Widget keyBottomWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
borderRadius: 20.w,
|
borderRadius: 20.w,
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
addAuthorizedAdminRequest();
|
logic.addAuthorizedAdminRequest();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -260,7 +245,7 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
height: 50.h,
|
height: 50.h,
|
||||||
width: 300.w,
|
width: 300.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: editController,
|
controller: editController,
|
||||||
@ -294,89 +279,51 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
isHaveBtn
|
if (isHaveBtn)
|
||||||
? Container(
|
Container(
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
height: 30.w,
|
height: 30.w,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('images/icon_addressBook.png'),
|
image: AssetImage('images/icon_addressBook.png'),
|
||||||
fit: BoxFit.fill),
|
fit: BoxFit.fill),
|
||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Contact? currentContact =
|
final Contact? currentContact =
|
||||||
await _contactPicker.selectContact();
|
await state.contactPicker.selectContact();
|
||||||
setState(() {
|
// setState(() {
|
||||||
if (currentContact!.phoneNumbers!.isNotEmpty) {
|
if (currentContact!.phoneNumbers!.isNotEmpty) {
|
||||||
_emailOrPhoneController.text = currentContact
|
state.emailOrPhoneController.text = currentContact
|
||||||
.phoneNumbers![0]
|
.phoneNumbers![0]
|
||||||
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
.replaceAll(RegExp(r'\s+\b|\b\s'), '');
|
||||||
}
|
}
|
||||||
if (currentContact.fullName!.isNotEmpty) {
|
if (currentContact.fullName!.isNotEmpty) {
|
||||||
_keyNameController.text = currentContact.fullName!;
|
state.keyNameController.text = currentContact.fullName!;
|
||||||
}
|
}
|
||||||
});
|
// });
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container()
|
else
|
||||||
|
Container()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送批量授权管理员
|
|
||||||
Future<void> addAuthorizedAdminRequest() async {
|
|
||||||
String getFailureDateTime = '0';
|
|
||||||
String getEffectiveDateTime = '0';
|
|
||||||
if (widget.type == '1') {
|
|
||||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
|
||||||
getEffectiveDateTime =
|
|
||||||
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_lockIdList.isEmpty) {
|
|
||||||
logic.showToast("请选择锁".tr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
|
||||||
createUser: _isCreateUser ? "1" : "0",
|
|
||||||
endDate: getFailureDateTime,
|
|
||||||
isRemoteUnlock: _isRemoteUnlock == true ? '1' : '2',
|
|
||||||
keyGroupIdList: [],
|
|
||||||
lockIdList: _lockIdList,
|
|
||||||
name: _keyNameController.text,
|
|
||||||
startDate: getEffectiveDateTime,
|
|
||||||
userid: _emailOrPhoneController.text,
|
|
||||||
countryCode: countryCode,
|
|
||||||
usernameType: '1',
|
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
_isSendSuccess = true;
|
|
||||||
setState(() {});
|
|
||||||
} else {
|
|
||||||
EasyLoading.showToast('${entity.errorMsg}', duration: 2000.milliseconds);
|
|
||||||
if (entity.errorCode == 425) {
|
|
||||||
//用户未注册
|
|
||||||
_isCreateUser = true;
|
|
||||||
addAuthorizedAdminRequest();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
// 发送电子钥匙成功
|
||||||
Widget sendElectronicKeySucceed() {
|
Widget sendElectronicKeySucceed() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
height: 250.h,
|
height: 250.h,
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
@ -390,9 +337,9 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"发送成功",
|
'发送成功',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 26.sp,
|
fontSize: 26.sp,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
@ -409,7 +356,7 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '完成'.tr,
|
btnName: '完成'.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
_isSendSuccess = false;
|
state.isSendSuccess.value = false;
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -439,21 +386,37 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CupertinoSwitch _switch() {
|
// 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(
|
return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: _isRemoteUnlock,
|
value: state.onlyManageYouCreatesUser.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isRemoteUnlock = !_isRemoteUnlock;
|
state.onlyManageYouCreatesUser.value =
|
||||||
|
!state.onlyManageYouCreatesUser.value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
String intToStr(int v) {
|
||||||
return (v < 10) ? "0$v" : "$v";
|
return (v < 10) ? '0$v' : '$v';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,26 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class VolumeAuthorizationLockState {
|
||||||
class VolumeAuthorizationLockState{
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||||
|
final TextEditingController emailOrPhoneController =
|
||||||
}
|
TextEditingController(); //邮箱/手机号输入框
|
||||||
|
final TextEditingController keyNameController =
|
||||||
|
TextEditingController(); //钥匙名输入框
|
||||||
|
late Contact contact;
|
||||||
|
RxList<int> lockIdList = <int>[].obs;
|
||||||
|
RxBool isSendSuccess = false.obs;
|
||||||
|
RxBool isCreateUser = false.obs; //是否需要创建用户
|
||||||
|
RxBool sRemoteUnlock = false.obs; //是否远程开锁
|
||||||
|
RxBool onlyManageYouCreatesUser = false.obs; //只能管理您创建的用户
|
||||||
|
RxString selectEffectiveDate =
|
||||||
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||||
|
.obs; //生效时间
|
||||||
|
RxString selectFailureDate = ''.obs; //失效时间
|
||||||
|
Rx<DateTime> effectiveDateTime = DateTime.now().obs;
|
||||||
|
Rx<DateTime> failureDateTime = DateTime.now().obs;
|
||||||
|
RxString countryName = '中国'.obs;
|
||||||
|
RxString countryCode = '86'.obs;
|
||||||
|
RxString selectWidgetType = '0'.obs;
|
||||||
|
}
|
||||||
|
|||||||
@ -125,7 +125,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"发送成功".tr,
|
'发送成功'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 26.sp,
|
fontSize: 26.sp,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
@ -201,9 +201,10 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
: state.lockIdList.length.toString(),
|
: state.lockIdList.length.toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.massSendLockGroupListPage, arguments:{
|
Navigator.pushNamed(context, Routers.massSendLockGroupListPage,
|
||||||
"keyLimits":"2",
|
arguments: {
|
||||||
}).then((value) {
|
'keyLimits': '2',
|
||||||
|
}).then((Object? value) {
|
||||||
//得到选中的锁ID列表
|
//得到选中的锁ID列表
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
|
||||||
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/regularExpression.dart';
|
||||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
@ -139,7 +140,9 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
|||||||
var entity = await ApiRepository.to.sendElectronicKey(
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
createUser: state.isCreateUser == true ? "1" : "0",
|
createUser: state.isCreateUser == true ? "1" : "0",
|
||||||
countryCode: state.countryCode,
|
countryCode: state.countryCode,
|
||||||
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
usernameType: RegularExpression()
|
||||||
|
.isPhoneNumber(state.emailOrPhoneController.text) ==
|
||||||
|
true
|
||||||
? '1'
|
? '1'
|
||||||
: '2',
|
: '2',
|
||||||
endDate: int.parse(endDate),
|
endDate: int.parse(endDate),
|
||||||
@ -184,7 +187,8 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//检测实名认证是否支持开启
|
//检测实名认证是否支持开启
|
||||||
Future<void> keyCheckFace() async {
|
Future<void> keyCheckFace() async {
|
||||||
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
|
final AdvancedFunctionRecordEntity entity =
|
||||||
|
await ApiRepository.to.keyCheckFace(
|
||||||
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
|
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
@ -205,19 +209,6 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPhoneNumber(String input) {
|
|
||||||
// 手机号正则表达式,这里简化为11位数字
|
|
||||||
final RegExp phoneRegExp = RegExp(r'^\d{11}$');
|
|
||||||
return phoneRegExp.hasMatch(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEmail(String input) {
|
|
||||||
// 邮箱正则表达式,这里简化为常见格式
|
|
||||||
final RegExp emailRegExp =
|
|
||||||
RegExp(r'^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$');
|
|
||||||
return emailRegExp.hasMatch(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextEditingController getCurrentController(int lineIndex) {
|
TextEditingController getCurrentController(int lineIndex) {
|
||||||
TextEditingController currentController = TextEditingController();
|
TextEditingController currentController = TextEditingController();
|
||||||
switch (lineIndex) {
|
switch (lineIndex) {
|
||||||
|
|||||||
@ -5,7 +5,9 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
|
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_logic.dart';
|
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_logic.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_state.dart';
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
|
import 'package:star_lock/tools/regularExpression.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -20,8 +22,8 @@ class NotificationModePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _NotificationModePageState extends State<NotificationModePage> {
|
class _NotificationModePageState extends State<NotificationModePage> {
|
||||||
final logic = Get.put(NotificationModeLogic());
|
final NotificationModeLogic logic = Get.put(NotificationModeLogic());
|
||||||
final state = Get.find<NotificationModeLogic>().state;
|
final NotificationModeState state = Get.find<NotificationModeLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -43,7 +45,7 @@ class _NotificationModePageState extends State<NotificationModePage> {
|
|||||||
|
|
||||||
Widget _buildMainView() {
|
Widget _buildMainView() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: 'APP推送'.tr,
|
leftTitel: 'APP推送'.tr,
|
||||||
rightTitle: '管理员'.tr,
|
rightTitle: '管理员'.tr,
|
||||||
@ -66,7 +68,7 @@ class _NotificationModePageState extends State<NotificationModePage> {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '确定'.tr,
|
btnName: '确定'.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Get.back(result: {
|
Get.back(result: <String, List>{
|
||||||
'emailReceiverList': state.emailReceiverList.value,
|
'emailReceiverList': state.emailReceiverList.value,
|
||||||
'phoneReceiverList': state.phoneReceiverList.value
|
'phoneReceiverList': state.phoneReceiverList.value
|
||||||
});
|
});
|
||||||
@ -135,9 +137,9 @@ class _NotificationModePageState extends State<NotificationModePage> {
|
|||||||
height: 62.h,
|
height: 62.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: (() {
|
onTap: () {
|
||||||
if (isEmail) {
|
if (isEmail) {
|
||||||
state.emailReceiverList.value.removeAt(index);
|
state.emailReceiverList.value.removeAt(index);
|
||||||
state.emailReceiverList.refresh();
|
state.emailReceiverList.refresh();
|
||||||
@ -145,7 +147,7 @@ class _NotificationModePageState extends State<NotificationModePage> {
|
|||||||
state.phoneReceiverList.value.removeAt(index);
|
state.phoneReceiverList.value.removeAt(index);
|
||||||
state.phoneReceiverList.refresh();
|
state.phoneReceiverList.refresh();
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
@ -163,39 +165,40 @@ class _NotificationModePageState extends State<NotificationModePage> {
|
|||||||
style: TextStyle(fontSize: 22.sp),
|
style: TextStyle(fontSize: 22.sp),
|
||||||
),
|
),
|
||||||
Expanded(child: SizedBox(width: 10.w)),
|
Expanded(child: SizedBox(width: 10.w)),
|
||||||
!isEmail
|
if (!isEmail)
|
||||||
? GestureDetector(
|
GestureDetector(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 90.w,
|
width: 90.w,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => Text(
|
Obx(() => Text(
|
||||||
'+${state.countryCode}',
|
'+${state.countryCode}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.darkGrayTextColor,
|
color: AppColors.darkGrayTextColor,
|
||||||
fontSize: 20.sp),
|
fontSize: 20.sp),
|
||||||
)),
|
)),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/icon_grayPullDown.png',
|
'images/icon_grayPullDown.png',
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
height: 20.w,
|
height: 20.w,
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
onTap: () async {
|
),
|
||||||
var result =
|
),
|
||||||
await Get.toNamed(Routers.selectCountryRegionPage);
|
onTap: () async {
|
||||||
if (result != null) {
|
final result =
|
||||||
result as Map<String, dynamic>;
|
await Get.toNamed(Routers.selectCountryRegionPage);
|
||||||
state.countryCode.value = result['code'];
|
if (result != null) {
|
||||||
state.countryName.value = result['countryName'];
|
result as Map<String, dynamic>;
|
||||||
}
|
state.countryCode.value = result['code'];
|
||||||
},
|
state.countryName.value = result['countryName'];
|
||||||
)
|
}
|
||||||
: Container(),
|
},
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Container(),
|
||||||
getReceiverTFWidget(isEmail ? '请输入Email'.tr : '请输入手机号'.tr, index,
|
getReceiverTFWidget(isEmail ? '请输入Email'.tr : '请输入手机号'.tr, index,
|
||||||
isEmail: isEmail)
|
isEmail: isEmail)
|
||||||
],
|
],
|
||||||
@ -206,7 +209,7 @@ class _NotificationModePageState extends State<NotificationModePage> {
|
|||||||
// 接受者信息输入框
|
// 接受者信息输入框
|
||||||
Widget getReceiverTFWidget(String tfStr, int lineIndex,
|
Widget getReceiverTFWidget(String tfStr, int lineIndex,
|
||||||
{required bool isEmail}) {
|
{required bool isEmail}) {
|
||||||
MsgNoticeModeData msgData = isEmail
|
final MsgNoticeModeData msgData = isEmail
|
||||||
? state.emailReceiverList.value[lineIndex]
|
? state.emailReceiverList.value[lineIndex]
|
||||||
: state.phoneReceiverList.value[lineIndex];
|
: state.phoneReceiverList.value[lineIndex];
|
||||||
msgData.countryCode = state.countryCode.value;
|
msgData.countryCode = state.countryCode.value;
|
||||||
@ -216,7 +219,7 @@ class _NotificationModePageState extends State<NotificationModePage> {
|
|||||||
height: 65.h,
|
height: 65.h,
|
||||||
width: 200.w,
|
width: 200.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: msgData.receiverTF,
|
controller: msgData.receiverTF,
|
||||||
@ -247,7 +250,7 @@ class _NotificationModePageState extends State<NotificationModePage> {
|
|||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
|
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
|
||||||
onChanged: (value) {
|
onChanged: (String value) {
|
||||||
if (isEmail) {
|
if (isEmail) {
|
||||||
msgData.receiveEmail = value;
|
msgData.receiveEmail = value;
|
||||||
state.emailReceiverList.value[lineIndex] = msgData;
|
state.emailReceiverList.value[lineIndex] = msgData;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class StarLockMineLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//用户信息
|
//用户信息
|
||||||
Future<void> getUserInfoRequest() async {
|
Future<void> getUserInfoRequest() async {
|
||||||
MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo();
|
final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.mineInfoData.value = entity.data!;
|
state.mineInfoData.value = entity.data!;
|
||||||
state.isVip.value = state.mineInfoData.value.isVip! == 0 ? false : true;
|
state.isVip.value = state.mineInfoData.value.isVip! == 0 ? false : true;
|
||||||
@ -24,7 +24,7 @@ class StarLockMineLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//删除账号请求
|
//删除账号请求
|
||||||
Future<void> userLogoutRequest() async {
|
Future<void> userLogoutRequest() async {
|
||||||
LoginEntity entity = await ApiRepository.to.userLogout(deviceld: '');
|
final LoginEntity entity = await ApiRepository.to.userLogout(deviceld: '');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {}
|
if (entity.errorCode!.codeIsSuccessful) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,14 +32,15 @@ class StarLockMineLogic extends BaseGetXController {
|
|||||||
StreamSubscription? _mineInfoChangeRefreshUIEvent;
|
StreamSubscription? _mineInfoChangeRefreshUIEvent;
|
||||||
void _mineInfoChangeRefreshUIAction() {
|
void _mineInfoChangeRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_mineInfoChangeRefreshUIEvent =
|
_mineInfoChangeRefreshUIEvent = eventBus
|
||||||
eventBus.on<MineInfoChangeRefreshUI>().listen((event) {
|
.on<MineInfoChangeRefreshUI>()
|
||||||
|
.listen((MineInfoChangeRefreshUI event) {
|
||||||
getMineInfoData();
|
getMineInfoData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getMineInfoData() async {
|
getMineInfoData() async {
|
||||||
final data = await Storage.getString(saveUserLoginData);
|
final String? data = await Storage.getString(saveUserLoginData);
|
||||||
if (data != null && data.isNotEmpty) {
|
if (data != null && data.isNotEmpty) {
|
||||||
state.userNickName.value = (await Storage.getNickname())!;
|
state.userNickName.value = (await Storage.getNickname())!;
|
||||||
state.userMobile.value = (await Storage.getMobile())! ?? '';
|
state.userMobile.value = (await Storage.getMobile())! ?? '';
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
|
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
|
|
||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
@ -22,8 +23,8 @@ class StarLockMinePage extends StatefulWidget {
|
|||||||
GlobalKey<StarLockMinePageState> starLockMineKey = GlobalKey();
|
GlobalKey<StarLockMinePageState> starLockMineKey = GlobalKey();
|
||||||
|
|
||||||
class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||||
final logic = Get.put(StarLockMineLogic());
|
final StarLockMineLogic logic = Get.put(StarLockMineLogic());
|
||||||
final state = Get.find<StarLockMineLogic>().state;
|
final StarLockMineState state = Get.find<StarLockMineLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
@ -36,7 +37,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: const Color(0xFFFFFFFF),
|
backgroundColor: const Color(0xFFFFFFFF),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
topWidget(),
|
topWidget(),
|
||||||
bottomListWidget(),
|
bottomListWidget(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -54,7 +55,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/mine/icon_mine_topBg.png',
|
'images/mine/icon_mine_topBg.png',
|
||||||
width: 400.w,
|
width: 400.w,
|
||||||
@ -63,7 +64,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
),
|
),
|
||||||
Center(
|
Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 120.h,
|
height: 120.h,
|
||||||
),
|
),
|
||||||
@ -97,7 +98,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
logic.showToast('请先添加锁');
|
logic.showToast('请先添加锁');
|
||||||
} else {
|
} else {
|
||||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||||
arguments: {'isShop': true});
|
arguments: <String, bool>{'isShop': true});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
@ -108,7 +109,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
state.userNickName.value.isNotEmpty
|
state.userNickName.value.isNotEmpty
|
||||||
? state.userNickName.value
|
? state.userNickName.value
|
||||||
@ -122,17 +123,18 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5.w,
|
width: 5.w,
|
||||||
),
|
),
|
||||||
!state.isVip.value
|
if (!state.isVip.value)
|
||||||
? Image.asset(
|
Image.asset(
|
||||||
'images/mine/icon_mine_noPlus.png',
|
'images/mine/icon_mine_noPlus.png',
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
height: 20.w,
|
height: 20.w,
|
||||||
)
|
)
|
||||||
: Image.asset(
|
else
|
||||||
'images/mine/icon_mine_isPlus.png',
|
Image.asset(
|
||||||
width: 20.w,
|
'images/mine/icon_mine_isPlus.png',
|
||||||
height: 20.w,
|
width: 20.w,
|
||||||
),
|
height: 20.w,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -183,20 +185,22 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
Get.toNamed(Routers.mineSetPage);
|
Get.toNamed(Routers.mineSetPage);
|
||||||
}),
|
}),
|
||||||
//上架审核
|
//上架审核
|
||||||
F.isLite
|
if (F.isLite)
|
||||||
? Container()
|
Container()
|
||||||
: mineItem('images/mine/icon_mine_main_vip.png',
|
else
|
||||||
TranslationLoader.lanKeys!.valueAddedServices!.tr, () {
|
mineItem('images/mine/icon_mine_main_vip.png',
|
||||||
Get.back();
|
TranslationLoader.lanKeys!.valueAddedServices!.tr, () {
|
||||||
Get.toNamed(Routers.valueAddedServicesPage);
|
Get.back();
|
||||||
}),
|
Get.toNamed(Routers.valueAddedServicesPage);
|
||||||
F.isLite
|
}),
|
||||||
? Container()
|
if (F.isLite)
|
||||||
: mineItem(
|
Container()
|
||||||
'images/mine/icon_mine_main_shoppingcart.png', "配件商城".tr, () {
|
else
|
||||||
Get.back();
|
mineItem('images/mine/icon_mine_main_shoppingcart.png', '配件商城'.tr,
|
||||||
Get.toNamed(Routers.lockMallPage);
|
() {
|
||||||
}),
|
Get.back();
|
||||||
|
Get.toNamed(Routers.lockMallPage);
|
||||||
|
}),
|
||||||
mineItem('images/mine/icon_mine_main_about.png',
|
mineItem('images/mine/icon_mine_main_about.png',
|
||||||
TranslationLoader.lanKeys!.about!.tr, () {
|
TranslationLoader.lanKeys!.about!.tr, () {
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -209,7 +213,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
|
|
||||||
Widget keyBottomWidget() {
|
Widget keyBottomWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.logout!.tr,
|
btnName: TranslationLoader.lanKeys!.logout!.tr,
|
||||||
borderRadius: 20.w,
|
borderRadius: 20.w,
|
||||||
@ -222,7 +226,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.deleteAccount!.tr,
|
TranslationLoader.lanKeys!.deleteAccount!.tr,
|
||||||
@ -246,7 +250,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 80.h,
|
// height: 80.h,
|
||||||
@ -254,7 +258,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
padding: EdgeInsets.all(20.h),
|
padding: EdgeInsets.all(20.h),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
lockTypeIcon,
|
lockTypeIcon,
|
||||||
width: 28.w,
|
width: 28.w,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
@ -16,44 +17,46 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
|||||||
final RegExp phoneRegExp = RegExp(r'^\d{11}$');
|
final RegExp phoneRegExp = RegExp(r'^\d{11}$');
|
||||||
return phoneRegExp.hasMatch(input);
|
return phoneRegExp.hasMatch(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送批量授权管理员
|
//发送批量授权管理员
|
||||||
Future<void> addAuthorizedAdminRequest() async {
|
Future<void> addAuthorizedAdminRequest() async {
|
||||||
if (state.emailOrPhoneController.text.isEmpty) {
|
if (state.emailOrPhoneController.text.isEmpty) {
|
||||||
showToast("请输入接收者账号");
|
showToast('请输入接收者账号');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.keyNameController.text.isEmpty) {
|
if (state.keyNameController.text.isEmpty) {
|
||||||
showToast("请输入接收者姓名");
|
showToast('请输入接收者姓名');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.lockIdList.isEmpty){
|
if (state.lockIdList.isEmpty) {
|
||||||
showToast("请选择锁".tr);
|
showToast('请选择锁'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var startDate = "0";
|
String startDate = '0';
|
||||||
var endDate = "0";
|
String endDate = '0';
|
||||||
if (state.type.value == '0') {
|
if (state.type.value == '0') {
|
||||||
startDate = DateTool().dateToTimestamp(state.beginDate.value, 1).toString();
|
startDate =
|
||||||
|
DateTool().dateToTimestamp(state.beginDate.value, 1).toString();
|
||||||
endDate = DateTool().dateToTimestamp(state.endDate.value, 1).toString();
|
endDate = DateTool().dateToTimestamp(state.endDate.value, 1).toString();
|
||||||
|
|
||||||
if (startDate.isEmpty) {
|
if (startDate.isEmpty) {
|
||||||
showToast("请选择开始时间");
|
showToast('请选择开始时间');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (endDate.isEmpty) {
|
if (endDate.isEmpty) {
|
||||||
showToast("请选择结束时间");
|
showToast('请选择结束时间');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
showToast("失效时间要大于生效时间");
|
showToast('失效时间要大于生效时间');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
final KeyDetailEntity entity = await ApiRepository.to.addAuthorizedAdmin(
|
||||||
createUser: state.isCreateUser.value ? "1" : "0",
|
createUser: state.isCreateUser.value ? '1' : '0',
|
||||||
endDate: endDate,
|
endDate: endDate,
|
||||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||||
keyGroupIdList: [],
|
keyGroupIdList: [],
|
||||||
@ -62,9 +65,9 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
|||||||
startDate: startDate,
|
startDate: startDate,
|
||||||
userid: state.emailOrPhoneController.text,
|
userid: state.emailOrPhoneController.text,
|
||||||
countryCode: state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
usernameType:
|
||||||
? '1'
|
isPhoneNumber(state.emailOrPhoneController.text) == true ? '1' : '2',
|
||||||
: '2',
|
isOnlyManageSelf: state.onlyManageYouCreatesUser.value == true ? 1 : 2,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
@ -77,7 +80,7 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode == 425) {
|
if (entity.errorCode == 425) {
|
||||||
//用户未注册
|
//用户未注册
|
||||||
state.isCreateUser.value = true;
|
state.isCreateUser.value = true;
|
||||||
_showDialog("${entity.errorMsg}");
|
_showDialog('${entity.errorMsg}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,15 +89,13 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
|||||||
void _showDialog(String errMsg) {
|
void _showDialog(String errMsg) {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
title: const Text('接收者号码未注册,请重新发送'),
|
title: const Text('接收者号码未注册,请重新发送'),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
onPressed: () {
|
onPressed: Get.back,
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
|
|||||||
@ -6,10 +6,12 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart';
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.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/pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -18,10 +20,9 @@ import '../../../../tools/dateTool.dart';
|
|||||||
import 'addAuthorizedAdministrator_logic.dart';
|
import 'addAuthorizedAdministrator_logic.dart';
|
||||||
|
|
||||||
class AddAuthorizedAdministratorPage extends StatefulWidget {
|
class AddAuthorizedAdministratorPage extends StatefulWidget {
|
||||||
String type;
|
AddAuthorizedAdministratorPage({required this.type, Key? key})
|
||||||
|
|
||||||
AddAuthorizedAdministratorPage({Key? key, required this.type})
|
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
String type;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
@ -32,8 +33,10 @@ class AddAuthorizedAdministratorPage extends StatefulWidget {
|
|||||||
class _AddAuthorizedAdministratorPageState
|
class _AddAuthorizedAdministratorPageState
|
||||||
extends State<AddAuthorizedAdministratorPage>
|
extends State<AddAuthorizedAdministratorPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
final logic = Get.put(AddAuthorizedAdministratorLogic());
|
final AddAuthorizedAdministratorLogic logic =
|
||||||
final state = Get.find<AddAuthorizedAdministratorLogic>().state;
|
Get.put(AddAuthorizedAdministratorLogic());
|
||||||
|
final AddAuthorizedAdministratorState state =
|
||||||
|
Get.find<AddAuthorizedAdministratorLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -67,9 +70,9 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
: state.lockIdList.value.length.toString(),
|
: state.lockIdList.value.length.toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.massSendLockGroupListPage, arguments: {
|
Navigator.pushNamed(context, Routers.massSendLockGroupListPage,
|
||||||
"keyLimits":"1"
|
arguments: <String, String>{'keyLimits': '1'})
|
||||||
}).then((value) {
|
.then((Object? value) {
|
||||||
//得到选中的锁ID列表
|
//得到选中的锁ID列表
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
@ -82,7 +85,19 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
remoteUnlockingWidget(),
|
CommonItem(
|
||||||
|
leftTitel: '仅管理自己创建的用户',
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
isTipsImg: true,
|
||||||
|
tipsImgAction: () {
|
||||||
|
ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限');
|
||||||
|
},
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
height: 50.h,
|
||||||
|
child: _onlyManageYouCreatesUserSwitch())),
|
||||||
|
// remoteUnlockingWidget(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
@ -110,9 +125,10 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
: state.lockIdList.value.length.toString(),
|
: state.lockIdList.value.length.toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.massSendLockGroupListPage,arguments:{
|
Navigator.pushNamed(context, Routers.massSendLockGroupListPage,
|
||||||
"keyLimits":"1",
|
arguments: {
|
||||||
}).then((value) {
|
'keyLimits': '1',
|
||||||
|
}).then((Object? value) {
|
||||||
//得到选中的锁ID列表
|
//得到选中的锁ID列表
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
@ -125,7 +141,19 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
remoteUnlockingWidget(),
|
// remoteUnlockingWidget(),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '仅管理自己创建的用户',
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
isTipsImg: true,
|
||||||
|
tipsImgAction: () {
|
||||||
|
ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限');
|
||||||
|
},
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
height: 50.h,
|
||||||
|
child: _onlyManageYouCreatesUserSwitch())),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
@ -141,7 +169,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
@ -150,7 +178,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
state.emailOrPhoneController)),
|
state.emailOrPhoneController)),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
@ -173,7 +201,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
false,
|
false,
|
||||||
@ -228,50 +256,67 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
isHaveBtn
|
if (isHaveBtn)
|
||||||
? Container(
|
Container(
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
height: 30.w,
|
height: 30.w,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('images/icon_addressBook.png'),
|
image: AssetImage('images/icon_addressBook.png'),
|
||||||
fit: BoxFit.fill),
|
fit: BoxFit.fill),
|
||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Contact? currentContact =
|
final Contact? currentContact =
|
||||||
await state.contactPicker.selectContact();
|
await state.contactPicker.selectContact();
|
||||||
setState(() {
|
setState(() {
|
||||||
if (currentContact!.phoneNumbers!.isNotEmpty) {
|
if (currentContact!.phoneNumbers!.isNotEmpty) {
|
||||||
state.emailOrPhoneController.text = currentContact
|
state.emailOrPhoneController.text = currentContact
|
||||||
.phoneNumbers![0]
|
.phoneNumbers![0]
|
||||||
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
.replaceAll(RegExp(r'\s+\b|\b\s'), '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container()
|
else
|
||||||
|
Container()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 远程开锁
|
// 远程开锁
|
||||||
Widget remoteUnlockingWidget() {
|
// Widget remoteUnlockingWidget() {
|
||||||
return Column(
|
// return Column(
|
||||||
children: [
|
// children: [
|
||||||
CommonItem(
|
// CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
// leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
||||||
rightTitle: "",
|
// rightTitle: '',
|
||||||
isHaveRightWidget: true,
|
// isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
// rightWidget:
|
||||||
width: 60.w, height: 50.h, child: Obx(() => _switch())),
|
// SizedBox(width: 60.w, height: 50.h, child: Obx(_switch)),
|
||||||
action: () {}),
|
// action: () {}),
|
||||||
Container(height: 40.h),
|
// Container(height: 40.h),
|
||||||
],
|
// ],
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
//仅管理自己创建的用户
|
||||||
|
CupertinoSwitch _onlyManageYouCreatesUserSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.onlyManageYouCreatesUser.value,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
state.onlyManageYouCreatesUser.value =
|
||||||
|
!state.onlyManageYouCreatesUser.value;
|
||||||
|
});
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +330,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate =
|
final PDuration selectDate =
|
||||||
PDuration.parse(DateTime.tryParse(state.beginDate.value));
|
PDuration.parse(DateTime.tryParse(state.beginDate.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
@ -299,7 +344,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
rightTitle: state.endDate.value,
|
rightTitle: state.endDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate =
|
final PDuration selectDate =
|
||||||
PDuration.parse(DateTime.tryParse(state.endDate.value));
|
PDuration.parse(DateTime.tryParse(state.endDate.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
@ -314,12 +359,12 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
|
|
||||||
Widget keyBottomWidget(String tipStr) {
|
Widget keyBottomWidget(String tipStr) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(20.w),
|
padding: EdgeInsets.all(20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
tipStr,
|
tipStr,
|
||||||
@ -341,7 +386,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
@ -366,7 +411,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: state.isRemoteUnlock.value,
|
value: state.isRemoteUnlock.value,
|
||||||
onChanged: (value) {
|
onChanged: (bool value) {
|
||||||
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -390,7 +435,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
@ -406,7 +451,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"发送成功",
|
'发送成功',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 26.sp,
|
fontSize: 26.sp,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
@ -431,9 +476,9 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
),
|
),
|
||||||
OutLineBtn(
|
OutLineBtn(
|
||||||
btnName:
|
btnName:
|
||||||
state.emailOrPhoneController.text.contains("@") ? '邮件通知' : "短信通知",
|
state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (state.emailOrPhoneController.text.contains("@")) {
|
if (state.emailOrPhoneController.text.contains('@')) {
|
||||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||||
} else {
|
} else {
|
||||||
// _openModalBottomSheet();
|
// _openModalBottomSheet();
|
||||||
@ -468,7 +513,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> initBottomSheetList() {
|
List<Widget> initBottomSheetList() {
|
||||||
List<Widget> widgetList = [];
|
final List<Widget> widgetList = <Widget>[];
|
||||||
|
|
||||||
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
|
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
|
||||||
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
|
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
|
||||||
@ -510,7 +555,7 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
}
|
}
|
||||||
|
|
||||||
//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}
|
//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}
|
||||||
_jumpSmartDeviceRoute(int itemIndex) {
|
void _jumpSmartDeviceRoute(int itemIndex) {
|
||||||
Get.back();
|
Get.back();
|
||||||
switch (itemIndex) {
|
switch (itemIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -14,26 +13,25 @@ class AddAuthorizedAdministratorState {
|
|||||||
|
|
||||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||||
late Contact contact;
|
late Contact contact;
|
||||||
var type = ''.obs;
|
RxString type = ''.obs;
|
||||||
var lockIdList = [].obs;
|
var lockIdList = [].obs;
|
||||||
var weekdaysList = [].obs;
|
var weekdaysList = [].obs;
|
||||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
RxBool isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||||
|
|
||||||
var beginDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs; //默认为当前时间 开始时间
|
RxString beginDate = DateTool()
|
||||||
var endDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
|
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||||
|
.obs; //默认为当前时间 开始时间
|
||||||
|
RxString endDate = DateTool()
|
||||||
|
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||||
|
.obs; //
|
||||||
|
|
||||||
var countryName = '中国'.obs;
|
RxString countryName = '中国'.obs;
|
||||||
var countryCode = '86'.obs;
|
RxString countryCode = '86'.obs;
|
||||||
var isSendSuccess = false.obs;
|
RxBool isSendSuccess = false.obs;
|
||||||
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
final RxBool isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||||
final isAuthentication = false.obs; //是否允许实名认证
|
final RxBool isAuthentication = false.obs; //是否允许实名认证
|
||||||
final keyInfo = LockListInfoItemEntity().obs;
|
final RxBool onlyManageYouCreatesUser = false.obs; //只能管理您创建的用户
|
||||||
|
final Rx<LockListInfoItemEntity> keyInfo = LockListInfoItemEntity().obs;
|
||||||
|
|
||||||
String pwdShareStr = '您好,您的授权管理员生成成功';
|
String pwdShareStr = '您好,您的授权管理员生成成功';
|
||||||
AddAuthorizedAdministratorState() {
|
|
||||||
// Map map = Get.arguments;
|
|
||||||
// if ((map["keyInfo"] != null)) {
|
|
||||||
// keyInfo.value = map["keyInfo"];
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,8 @@ class _AdminDetailChangeDatePage extends State<AdminDetailChangeDatePage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
if (obj != null && (obj["itemData"] != null)) {
|
if (obj != null && (obj['itemData'] != null)) {
|
||||||
itemData = obj["itemData"];
|
itemData = obj['itemData'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -101,14 +101,16 @@ class _AdminDetailChangeDatePage extends State<AdminDetailChangeDatePage> {
|
|||||||
|
|
||||||
//更新管理员信息请求
|
//更新管理员信息请求
|
||||||
Future<void> updateAdministratorRequest() async {
|
Future<void> updateAdministratorRequest() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
|
final ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
itemData.uid.toString(),
|
.updateAdministrator(
|
||||||
'',
|
uid: itemData.uid.toString(),
|
||||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
endDate: _failureDateTime.millisecondsSinceEpoch.toString(),
|
||||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
startDate: _effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||||
'');
|
keyName: '',
|
||||||
|
isOnlyManageSelf:
|
||||||
|
itemData.onlyManageYouCreatesUser == true ? 1 : 2);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
EasyLoading.showToast("修改成功", duration: 2000.milliseconds);
|
EasyLoading.showToast('修改成功', duration: 2000.milliseconds);
|
||||||
setState(() {
|
setState(() {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
});
|
});
|
||||||
@ -116,6 +118,6 @@ class _AdminDetailChangeDatePage extends State<AdminDetailChangeDatePage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
String intToStr(int v) {
|
||||||
return (v < 10) ? "0$v" : "$v";
|
return (v < 10) ? '0$v' : '$v';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@ class Data {
|
|||||||
int? endDate;
|
int? endDate;
|
||||||
int? startDate;
|
int? startDate;
|
||||||
int? isRemoteUnlock;
|
int? isRemoteUnlock;
|
||||||
|
int? isOnlyManageSelf;
|
||||||
String? name;
|
String? name;
|
||||||
String? userid;
|
String? userid;
|
||||||
List<LockListItem>? lockList;
|
List<LockListItem>? lockList;
|
||||||
@ -46,6 +47,7 @@ class Data {
|
|||||||
this.endDate,
|
this.endDate,
|
||||||
this.startDate,
|
this.startDate,
|
||||||
this.isRemoteUnlock,
|
this.isRemoteUnlock,
|
||||||
|
this.isOnlyManageSelf,
|
||||||
this.name,
|
this.name,
|
||||||
this.userid,
|
this.userid,
|
||||||
this.lockList});
|
this.lockList});
|
||||||
@ -57,6 +59,7 @@ class Data {
|
|||||||
endDate = json['endDate'];
|
endDate = json['endDate'];
|
||||||
startDate = json['startDate'];
|
startDate = json['startDate'];
|
||||||
isRemoteUnlock = json['isRemoteUnlock'];
|
isRemoteUnlock = json['isRemoteUnlock'];
|
||||||
|
isOnlyManageSelf = json['isOnlyManageSelf'];
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
userid = json['userid'];
|
userid = json['userid'];
|
||||||
if (json['lockList'] != null) {
|
if (json['lockList'] != null) {
|
||||||
@ -75,6 +78,7 @@ class Data {
|
|||||||
data['endDate'] = endDate;
|
data['endDate'] = endDate;
|
||||||
data['startDate'] = startDate;
|
data['startDate'] = startDate;
|
||||||
data['isRemoteUnlock'] = isRemoteUnlock;
|
data['isRemoteUnlock'] = isRemoteUnlock;
|
||||||
|
data['isOnlyManageSelf'] = isOnlyManageSelf;
|
||||||
data['name'] = name;
|
data['name'] = name;
|
||||||
data['userid'] = userid;
|
data['userid'] = userid;
|
||||||
if (lockList != null) {
|
if (lockList != null) {
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
@ -7,48 +6,59 @@ import '../../../../main/lockDetail/electronicKey/electronicKeyList/entity/Elect
|
|||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/custom_bottom_sheet.dart';
|
import '../../../../tools/custom_bottom_sheet.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/jh_pop_menus.dart';
|
|
||||||
import '../../../../tools/showTipView.dart';
|
import '../../../../tools/showTipView.dart';
|
||||||
import '../authorizedAdministrator/authorizedAdminListEntity.dart';
|
import '../authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
import 'administratorDetailEntity.dart';
|
import 'administratorDetailEntity.dart';
|
||||||
import 'administratorDetails_state.dart';
|
import 'administratorDetails_state.dart';
|
||||||
|
|
||||||
class AdministratorDetailsLogic extends BaseGetXController{
|
class AdministratorDetailsLogic extends BaseGetXController {
|
||||||
AdministratorDetailsState state = AdministratorDetailsState();
|
AdministratorDetailsState state = AdministratorDetailsState();
|
||||||
|
|
||||||
|
|
||||||
//管理员详情请求
|
//管理员详情请求
|
||||||
Future<void> administratorDetailRequest() async {
|
Future<void> administratorDetailRequest() async {
|
||||||
AdministratorDetailEntity entity = await ApiRepository.to.authorizedAdminDetail(state.itemData.value.uid ?? 0);
|
final AdministratorDetailEntity entity = await ApiRepository.to
|
||||||
|
.authorizedAdminDetail(state.itemData.value.uid ?? 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockItemList.value = entity.data!.lockList!;
|
state.lockItemList.value = entity.data!.lockList!;
|
||||||
|
state.onlyManageYouCreatesUser.value =
|
||||||
|
entity.data!.isOnlyManageSelf == 1 ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新管理员信息请求
|
//更新管理员信息请求
|
||||||
Future<void> updateAdministratorRequest(bool isRemote) async {
|
Future<void> updateAdministratorRequest({required bool isChangeName}) async {
|
||||||
String isRemoteUnlock = state.isOnRemote.value == true ? '1' : '2';
|
int isManageCreateUser = 0;
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
|
if (!isChangeName) {
|
||||||
state.itemData.value.uid.toString(),
|
isManageCreateUser = state.onlyManageYouCreatesUser.value == true ? 2 : 1;
|
||||||
state.changeNameController.text,
|
}
|
||||||
'',
|
final ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
'',
|
.updateAdministrator(
|
||||||
isRemoteUnlock);
|
uid: state.itemData.value.uid.toString(),
|
||||||
|
keyName: isChangeName
|
||||||
|
? state.changeNameController.text
|
||||||
|
: state.itemData.value.name ?? '',
|
||||||
|
endDate: '',
|
||||||
|
startDate: '',
|
||||||
|
isOnlyManageSelf: isChangeName
|
||||||
|
? state.itemData.value.onlyManageYouCreatesUser ?? 0
|
||||||
|
: isManageCreateUser);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("修改成功".tr);
|
if (!isChangeName) {
|
||||||
}else{
|
state.onlyManageYouCreatesUser.value =
|
||||||
state.isOnRemote.value = !state.isOnRemote.value;
|
!state.onlyManageYouCreatesUser.value;
|
||||||
|
}
|
||||||
|
showToast('修改成功'.tr);
|
||||||
|
administratorDetailRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
||||||
Future<void> deleteAdministratorRequest(int includeUnderlings) async {
|
Future<void> deleteAdministratorRequest(int includeUnderlings) async {
|
||||||
AuthorizedAdminListEntity entity = await ApiRepository.to.deleteAuthorizedAdmin(
|
final AuthorizedAdminListEntity entity = await ApiRepository.to
|
||||||
state.itemData.value.uid.toString(),
|
.deleteAuthorizedAdmin(
|
||||||
includeUnderlings.toString()
|
state.itemData.value.uid.toString(), includeUnderlings.toString());
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功".tr, something: (){
|
showToast('删除成功'.tr, something: () {
|
||||||
// eventBus.fire(AuthorizedAdministratorListPageRefreshUI());
|
// eventBus.fire(AuthorizedAdministratorListPageRefreshUI());
|
||||||
Get.back();
|
Get.back();
|
||||||
});
|
});
|
||||||
@ -57,12 +67,11 @@ class AdministratorDetailsLogic extends BaseGetXController{
|
|||||||
|
|
||||||
//冻结
|
//冻结
|
||||||
Future<void> freezeKey(int includeUnderlings) async {
|
Future<void> freezeKey(int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
|
final ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
includeUnderlings: includeUnderlings
|
includeUnderlings: includeUnderlings);
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功".tr, something: () {
|
showToast('设置成功'.tr, something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
});
|
});
|
||||||
@ -71,12 +80,11 @@ class AdministratorDetailsLogic extends BaseGetXController{
|
|||||||
|
|
||||||
//取消冻结
|
//取消冻结
|
||||||
Future<void> cancelFreeze(int includeUnderlings) async {
|
Future<void> cancelFreeze(int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
|
final ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
includeUnderlings: includeUnderlings
|
includeUnderlings: includeUnderlings);
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功".tr, something: () {
|
showToast('设置成功'.tr, something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
});
|
});
|
||||||
@ -85,11 +93,12 @@ class AdministratorDetailsLogic extends BaseGetXController{
|
|||||||
|
|
||||||
//取消授权管理员
|
//取消授权管理员
|
||||||
Future<void> cancelAdministrator() async {
|
Future<void> cancelAdministrator() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.cancelAdministrator(
|
final ElectronicKeyListEntity entity =
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
await ApiRepository.to.cancelAdministrator(
|
||||||
|
keyId: state.itemData.value.keyId.toString(),
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功".tr, something: () {
|
showToast('设置成功'.tr, something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -97,8 +106,11 @@ class AdministratorDetailsLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future openModalBottomSheet() async {
|
Future<void> openModalBottomSheet() async {
|
||||||
var textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr, '取消授权'.tr];
|
final List<String> textList = <String>[
|
||||||
|
if (state.itemData.value.keyStatus == 110405) '取消冻结'.tr else '冻结'.tr,
|
||||||
|
'取消授权'.tr
|
||||||
|
];
|
||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
@ -109,24 +121,25 @@ class AdministratorDetailsLogic extends BaseGetXController{
|
|||||||
topTitle: '',
|
topTitle: '',
|
||||||
items: textList,
|
items: textList,
|
||||||
chooseCallback: (value) {
|
chooseCallback: (value) {
|
||||||
int index = value;
|
final int index = value;
|
||||||
if(index == 0){
|
if (index == 0) {
|
||||||
if(state.itemData.value.keyStatus == 110405){
|
if (state.itemData.value.keyStatus == 110405) {
|
||||||
// 取消冻结
|
// 取消冻结
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙'.tr, (isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||||
|
'同时解冻其发送的钥匙'.tr, (isAllData) {
|
||||||
cancelFreeze(isAllData ? 1 : 0);
|
cancelFreeze(isAllData ? 1 : 0);
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时冻结其发送的钥匙'.tr, (isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||||
|
'同时冻结其发送的钥匙'.tr, (isAllData) {
|
||||||
freezeKey(isAllData ? 1 : 0);
|
freezeKey(isAllData ? 1 : 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
// 取消/授权管理员
|
// 取消/授权管理员
|
||||||
// 管理员
|
// 管理员
|
||||||
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效".tr, (){
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
cancelAdministrator();
|
'取消授权会在用户APP连网后生效'.tr, cancelAdministrator);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -138,20 +151,24 @@ class AdministratorDetailsLogic extends BaseGetXController{
|
|||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||||
//限期
|
//限期
|
||||||
DateTime startDateStr =
|
final DateTime startDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
DateTime endDateStr =
|
final DateTime endDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
useDateStr =
|
useDateStr =
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||||
//永久
|
//永久
|
||||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
final DateTime dateStr =
|
||||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n${"永久".tr}';
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
|
useDateStr =
|
||||||
|
'${dateStr.toLocal().toString().substring(0, 16)}\n${"永久".tr}';
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||||
//单次
|
//单次
|
||||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
final DateTime dateStr =
|
||||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n${"单次".tr}';
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
|
useDateStr =
|
||||||
|
'${dateStr.toLocal().toString().substring(0, 16)} \n${"单次".tr}';
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||||
//循环
|
//循环
|
||||||
useDateStr = '循环'.tr;
|
useDateStr = '循环'.tr;
|
||||||
@ -177,7 +194,5 @@ class AdministratorDetailsLogic extends BaseGetXController{
|
|||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -2,7 +2,8 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/tools/jh_pop_menus.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_state.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -23,8 +24,9 @@ class AdministratorDetailsPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||||
final logic = Get.put(AdministratorDetailsLogic());
|
final AdministratorDetailsLogic logic = Get.put(AdministratorDetailsLogic());
|
||||||
final state = Get.find<AdministratorDetailsLogic>().state;
|
final AdministratorDetailsState state =
|
||||||
|
Get.find<AdministratorDetailsLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -33,79 +35,100 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: '管理员详情'.tr,
|
barTitle: '管理员详情'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'images/icon_bar_more.png',
|
'images/icon_bar_more.png',
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: logic.openModalBottomSheet,
|
||||||
logic.openModalBottomSheet();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Obx(()=>Column(
|
body: Obx(() => Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: state.changeNameController.text.isNotEmpty
|
rightTitle: state.changeNameController.text.isNotEmpty
|
||||||
? state.changeNameController.text
|
? state.changeNameController.text
|
||||||
: state.itemData.value.name,
|
: state.itemData.value.name,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context);
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
allHeight: 90.h,
|
allHeight: 90.h,
|
||||||
rightTitle: logic.getUseDateStr(state.itemData.value),
|
rightTitle: logic.getUseDateStr(state.itemData.value),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.adminDetailChangeDatePage,
|
Navigator.pushNamed(
|
||||||
arguments: {"itemData": state.itemData.value});
|
context, Routers.adminDetailChangeDatePage,
|
||||||
}),
|
arguments: <String, AuthorizedAdminListItem>{
|
||||||
Container(height: 10.h),
|
'itemData': state.itemData.value
|
||||||
CommonItem(
|
});
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
}),
|
||||||
rightTitle: state.itemData.value.lockNum.toString(),
|
Container(height: 10.h),
|
||||||
isHaveDirection: false,
|
CommonItem(
|
||||||
action: () {
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
// //锁列表页面
|
rightTitle: state.itemData.value.lockNum.toString(),
|
||||||
// Navigator.pushNamed(context, Routers.lockItemListPage,
|
isHaveDirection: false,
|
||||||
// arguments: {'lockList': state.lockItemList});
|
action: () {
|
||||||
}),
|
// //锁列表页面
|
||||||
Container(height: 10.h),
|
// Navigator.pushNamed(context, Routers.lockItemListPage,
|
||||||
CommonItem(
|
// arguments: {'lockList': state.lockItemList});
|
||||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
|
}),
|
||||||
rightTitle: "",
|
Container(height: 10.h),
|
||||||
isHaveRightWidget: true,
|
CommonItem(
|
||||||
rightWidget: SizedBox(width: 60.w, child: _switch()),
|
leftTitel: '仅管理自己创建的用户',
|
||||||
action: () {}),
|
rightTitle: '',
|
||||||
Container(height: 40.h),
|
isHaveRightWidget: true,
|
||||||
SubmitBtn(
|
isTipsImg: true,
|
||||||
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
tipsImgAction: () {
|
||||||
borderRadius: 20.w,
|
ShowTipView()
|
||||||
isDelete: true,
|
.showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限');
|
||||||
margin: EdgeInsets.only(
|
},
|
||||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
rightWidget: SizedBox(
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
width: 60.w,
|
||||||
onClick: () {
|
height: 50.h,
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
|
child: _onlyManageYouCreatesUserSwitch())),
|
||||||
logic.deleteAdministratorRequest(isAllData ? 1 : 0);
|
Container(height: 40.h),
|
||||||
});
|
SubmitBtn(
|
||||||
}),
|
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
||||||
],
|
borderRadius: 20.w,
|
||||||
)),
|
isDelete: true,
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
|
onClick: () {
|
||||||
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||||
|
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool isAllData) {
|
||||||
|
logic.deleteAdministratorRequest(isAllData ? 1 : 0);
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//仅管理自己创建的用户
|
||||||
|
CupertinoSwitch _onlyManageYouCreatesUserSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.onlyManageYouCreatesUser.value,
|
||||||
|
onChanged: (value) {
|
||||||
|
logic.updateAdministratorRequest(isChangeName: false);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,14 +142,14 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
onTap: action,
|
onTap: action,
|
||||||
child: Column(
|
child: Column(
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
// height: 80.h,
|
// height: 80.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Text(
|
Text(
|
||||||
leftTitle,
|
leftTitle,
|
||||||
@ -137,69 +160,57 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
isHaveRightWidget
|
if (isHaveRightWidget)
|
||||||
? rightWidget!
|
rightWidget!
|
||||||
: Text(
|
else
|
||||||
rightTitle,
|
Text(
|
||||||
textAlign: TextAlign.end,
|
rightTitle,
|
||||||
style: TextStyle(
|
textAlign: TextAlign.end,
|
||||||
fontSize: 28.sp, fontWeight: FontWeight.w500),
|
style: TextStyle(
|
||||||
)
|
fontSize: 28.sp, fontWeight: FontWeight.w500),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
isHaveDirection
|
if (isHaveDirection)
|
||||||
? Image.asset(
|
Image.asset(
|
||||||
'images/icon_right.png',
|
'images/icon_right.png',
|
||||||
width: 50.w,
|
width: 50.w,
|
||||||
height: 50.w,
|
height: 50.w,
|
||||||
)
|
)
|
||||||
: SizedBox(width: 10.w),
|
else
|
||||||
|
SizedBox(width: 10.w),
|
||||||
// SizedBox(width:10.w),
|
// SizedBox(width:10.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
isHaveLine
|
if (isHaveLine)
|
||||||
? Container(
|
Container(
|
||||||
height: 0.5.h,
|
height: 0.5.h,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
)
|
)
|
||||||
: Container()
|
else
|
||||||
|
Container()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CupertinoSwitch _switch() {
|
|
||||||
return CupertinoSwitch(
|
|
||||||
activeColor: CupertinoColors.activeBlue,
|
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
|
||||||
thumbColor: CupertinoColors.white,
|
|
||||||
value: state.isOnRemote.value,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
state.isOnRemote.value = !state.isOnRemote.value;
|
|
||||||
logic.updateAdministratorRequest(true);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title:
|
title:
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
'${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}',
|
||||||
tipTitle: "请输入".tr,
|
tipTitle: '请输入'.tr,
|
||||||
controller: state.changeNameController,
|
controller: state.changeNameController,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
//发送编辑钥匙名称请求
|
||||||
if (state.changeNameController.text.isNotEmpty) {
|
if (state.changeNameController.text.isNotEmpty) {
|
||||||
logic.updateAdministratorRequest(false);
|
logic.updateAdministratorRequest(isChangeName: true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
|
|||||||
@ -1,22 +1,20 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
import '../authorizedAdministrator/authorizedAdminListEntity.dart';
|
import '../authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
|
|
||||||
class AdministratorDetailsState{
|
class AdministratorDetailsState {
|
||||||
final TextEditingController changeNameController = TextEditingController();
|
AdministratorDetailsState() {
|
||||||
final itemData = AuthorizedAdminListItem().obs;
|
final Map map = Get.arguments;
|
||||||
var isOnRemote = false.obs;
|
if (map['itemData'] != null) {
|
||||||
var lockItemList = <LockListItem>[].obs;
|
itemData.value = map['itemData'];
|
||||||
|
onlyManageYouCreatesUser.value =
|
||||||
AdministratorDetailsState(){
|
itemData.value.onlyManageYouCreatesUser == 1 ? true : false;
|
||||||
Map map = Get.arguments;
|
|
||||||
if (map != null && (map["itemData"] != null)) {
|
|
||||||
itemData.value = map["itemData"];
|
|
||||||
isOnRemote.value = itemData.value.isRemoteUnlock == 1 ? true : false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
final Rx<AuthorizedAdminListItem> itemData = AuthorizedAdminListItem().obs;
|
||||||
|
RxBool onlyManageYouCreatesUser = false.obs;
|
||||||
|
RxList<LockListItem> lockItemList = <LockListItem>[].obs;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,12 +1,6 @@
|
|||||||
class AuthorizedAdminListEntity {
|
class AuthorizedAdminListEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
AuthorizedAdminListData? data;
|
|
||||||
|
|
||||||
AuthorizedAdminListEntity(
|
AuthorizedAdminListEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
AuthorizedAdminListEntity.fromJson(Map<String, dynamic> json) {
|
AuthorizedAdminListEntity.fromJson(Map<String, dynamic> json) {
|
||||||
errorCode = json['errorCode'];
|
errorCode = json['errorCode'];
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
@ -15,6 +9,10 @@ class AuthorizedAdminListEntity {
|
|||||||
? AuthorizedAdminListData.fromJson(json['data'])
|
? AuthorizedAdminListData.fromJson(json['data'])
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
AuthorizedAdminListData? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -29,15 +27,8 @@ class AuthorizedAdminListEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AuthorizedAdminListData {
|
class AuthorizedAdminListData {
|
||||||
List<AuthorizedAdminListItem>? itemList;
|
|
||||||
int? pageNo;
|
|
||||||
int? pageSize;
|
|
||||||
int? pages;
|
|
||||||
int? total;
|
|
||||||
|
|
||||||
AuthorizedAdminListData(
|
AuthorizedAdminListData(
|
||||||
{this.itemList, this.pageNo, this.pageSize, this.pages, this.total});
|
{this.itemList, this.pageNo, this.pageSize, this.pages, this.total});
|
||||||
|
|
||||||
AuthorizedAdminListData.fromJson(Map<String, dynamic> json) {
|
AuthorizedAdminListData.fromJson(Map<String, dynamic> json) {
|
||||||
if (json['list'] != null) {
|
if (json['list'] != null) {
|
||||||
itemList = <AuthorizedAdminListItem>[];
|
itemList = <AuthorizedAdminListItem>[];
|
||||||
@ -50,6 +41,11 @@ class AuthorizedAdminListData {
|
|||||||
pages = json['pages'];
|
pages = json['pages'];
|
||||||
total = json['total'];
|
total = json['total'];
|
||||||
}
|
}
|
||||||
|
List<AuthorizedAdminListItem>? itemList;
|
||||||
|
int? pageNo;
|
||||||
|
int? pageSize;
|
||||||
|
int? pages;
|
||||||
|
int? total;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -65,19 +61,6 @@ class AuthorizedAdminListData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AuthorizedAdminListItem {
|
class AuthorizedAdminListItem {
|
||||||
int? uid;
|
|
||||||
int? keyStatus;
|
|
||||||
int? lockNum;
|
|
||||||
int? endDate;
|
|
||||||
int? startDate;
|
|
||||||
String? name;
|
|
||||||
String? headUrl;
|
|
||||||
String? userid;
|
|
||||||
int? keyType;
|
|
||||||
int? date;
|
|
||||||
int? isRemoteUnlock;
|
|
||||||
int? keyId;
|
|
||||||
|
|
||||||
AuthorizedAdminListItem(
|
AuthorizedAdminListItem(
|
||||||
{this.uid,
|
{this.uid,
|
||||||
this.keyStatus,
|
this.keyStatus,
|
||||||
@ -90,8 +73,8 @@ class AuthorizedAdminListItem {
|
|||||||
this.keyType,
|
this.keyType,
|
||||||
this.date,
|
this.date,
|
||||||
this.isRemoteUnlock,
|
this.isRemoteUnlock,
|
||||||
this.keyId});
|
this.keyId,
|
||||||
|
this.onlyManageYouCreatesUser});
|
||||||
AuthorizedAdminListItem.fromJson(Map<String, dynamic> json) {
|
AuthorizedAdminListItem.fromJson(Map<String, dynamic> json) {
|
||||||
uid = json['uid'];
|
uid = json['uid'];
|
||||||
keyStatus = json['keyStatus'];
|
keyStatus = json['keyStatus'];
|
||||||
@ -105,7 +88,21 @@ class AuthorizedAdminListItem {
|
|||||||
date = json['date'];
|
date = json['date'];
|
||||||
isRemoteUnlock = json['isRemoteUnlock'];
|
isRemoteUnlock = json['isRemoteUnlock'];
|
||||||
keyId = json['keyId'];
|
keyId = json['keyId'];
|
||||||
|
onlyManageYouCreatesUser = json['onlyManageYouCreatesUser'];
|
||||||
}
|
}
|
||||||
|
int? uid;
|
||||||
|
int? keyStatus;
|
||||||
|
int? lockNum;
|
||||||
|
int? endDate;
|
||||||
|
int? startDate;
|
||||||
|
String? name;
|
||||||
|
String? headUrl;
|
||||||
|
String? userid;
|
||||||
|
int? keyType;
|
||||||
|
int? date;
|
||||||
|
int? isRemoteUnlock;
|
||||||
|
int? keyId;
|
||||||
|
int? onlyManageYouCreatesUser;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -121,6 +118,7 @@ class AuthorizedAdminListItem {
|
|||||||
data['date'] = date;
|
data['date'] = date;
|
||||||
data['isRemoteUnlock'] = isRemoteUnlock;
|
data['isRemoteUnlock'] = isRemoteUnlock;
|
||||||
data['keyId'] = keyId;
|
data['keyId'] = keyId;
|
||||||
|
data['onlyManageYouCreatesUser'] = onlyManageYouCreatesUser;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -9,15 +8,13 @@ import '../../../../tools/eventBusEventManage.dart';
|
|||||||
import 'authorizedAdminListEntity.dart';
|
import 'authorizedAdminListEntity.dart';
|
||||||
import 'authorizedAdministratorList_state.dart';
|
import 'authorizedAdministratorList_state.dart';
|
||||||
|
|
||||||
class AuthorizedAdministratorListLogic extends BaseGetXController{
|
class AuthorizedAdministratorListLogic extends BaseGetXController {
|
||||||
AuthorizedAdministratorListState state = AuthorizedAdministratorListState();
|
AuthorizedAdministratorListState state = AuthorizedAdministratorListState();
|
||||||
|
|
||||||
//请求授权管理员列表
|
//请求授权管理员列表
|
||||||
Future<AuthorizedAdminListEntity> mockNetworkDataRequest() async {
|
Future<AuthorizedAdminListEntity> mockNetworkDataRequest() async {
|
||||||
AuthorizedAdminListEntity entity = await ApiRepository.to.authorizedAdminList(
|
final AuthorizedAdminListEntity entity = await ApiRepository.to
|
||||||
pageNo.toString(),
|
.authorizedAdminList(pageNo.toString(), pageSize.toString());
|
||||||
pageSize.toString()
|
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
if (pageNo == 1) {
|
||||||
state.itemDataList.value = entity.data!.itemList!;
|
state.itemDataList.value = entity.data!.itemList!;
|
||||||
@ -34,11 +31,12 @@ class AuthorizedAdministratorListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
||||||
Future<void> deleteAdministratorRequest(String uid, int includeUnderlings) async {
|
Future<void> deleteAdministratorRequest(
|
||||||
AuthorizedAdminListEntity entity = await ApiRepository.to
|
String uid, int includeUnderlings) async {
|
||||||
|
final AuthorizedAdminListEntity entity = await ApiRepository.to
|
||||||
.deleteAuthorizedAdmin(uid, includeUnderlings.toString());
|
.deleteAuthorizedAdmin(uid, includeUnderlings.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功", something: (){
|
showToast('删除成功', something: () {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
});
|
});
|
||||||
@ -51,12 +49,12 @@ class AuthorizedAdministratorListLogic extends BaseGetXController{
|
|||||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||||
//限期
|
//限期
|
||||||
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
||||||
DateTime startDateStr =
|
final DateTime startDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
DateTime endDateStr =
|
final DateTime endDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
useDateStr =
|
useDateStr =
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
} else {
|
} else {
|
||||||
useDateStr = '限期';
|
useDateStr = '限期';
|
||||||
}
|
}
|
||||||
@ -77,7 +75,8 @@ class AuthorizedAdministratorListLogic extends BaseGetXController{
|
|||||||
StreamSubscription? _authorizedAdministratorListPageRefreshUIEvent;
|
StreamSubscription? _authorizedAdministratorListPageRefreshUIEvent;
|
||||||
void _authorizedAdministratorListPageRefreshUIAction() {
|
void _authorizedAdministratorListPageRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_authorizedAdministratorListPageRefreshUIEvent = eventBus.on<AuthorizedAdministratorListPageRefreshUI>().listen((event) {
|
_authorizedAdministratorListPageRefreshUIEvent =
|
||||||
|
eventBus.on<AuthorizedAdministratorListPageRefreshUI>().listen((event) {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
});
|
});
|
||||||
@ -102,5 +101,4 @@ class AuthorizedAdministratorListLogic extends BaseGetXController{
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
_authorizedAdministratorListPageRefreshUIEvent?.cancel();
|
_authorizedAdministratorListPageRefreshUIEvent?.cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_state.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
@ -27,11 +28,13 @@ class AuthorizedAdministratorListPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _AuthorizedAdministratorListPageState
|
class _AuthorizedAdministratorListPageState
|
||||||
extends State<AuthorizedAdministratorListPage> {
|
extends State<AuthorizedAdministratorListPage> {
|
||||||
final logic = Get.put(AuthorizedAdministratorListLogic());
|
final AuthorizedAdministratorListLogic logic =
|
||||||
final state = Get.find<AuthorizedAdministratorListLogic>().state;
|
Get.put(AuthorizedAdministratorListLogic());
|
||||||
|
final AuthorizedAdministratorListState state =
|
||||||
|
Get.find<AuthorizedAdministratorListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData() async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic.mockNetworkDataRequest().then((AuthorizedAdminListEntity value) {
|
logic.mockNetworkDataRequest().then((AuthorizedAdminListEntity value) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -54,7 +57,7 @@ class _AuthorizedAdministratorListPageState
|
|||||||
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'images/icon_add_white.png',
|
'images/icon_add_white.png',
|
||||||
@ -65,7 +68,7 @@ class _AuthorizedAdministratorListPageState
|
|||||||
// 处理操作按钮的点击事件
|
// 处理操作按钮的点击事件
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.addAuthorizedAdministratorPage)
|
context, Routers.addAuthorizedAdministratorPage)
|
||||||
.then((value) {
|
.then((Object? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
@ -84,7 +87,7 @@ class _AuthorizedAdministratorListPageState
|
|||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
// _searchWidget(),
|
// _searchWidget(),
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
],
|
],
|
||||||
@ -95,7 +98,7 @@ class _AuthorizedAdministratorListPageState
|
|||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return Obx(() => state.itemDataList.isEmpty
|
return Obx(() => state.itemDataList.isEmpty
|
||||||
? Stack(
|
? Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
NoData(
|
NoData(
|
||||||
noDataHeight: 1.sh -
|
noDataHeight: 1.sh -
|
||||||
ScreenUtil().statusBarHeight -
|
ScreenUtil().statusBarHeight -
|
||||||
@ -111,7 +114,7 @@ class _AuthorizedAdministratorListPageState
|
|||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.addAuthorizedAdministratorPage)
|
context, Routers.addAuthorizedAdministratorPage)
|
||||||
.then((value) {
|
.then((Object? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
@ -125,8 +128,8 @@ class _AuthorizedAdministratorListPageState
|
|||||||
: SlidableAutoCloseBehavior(
|
: SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.itemDataList.value.length,
|
itemCount: state.itemDataList.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
AuthorizedAdminListItem authorizedAdminListItem =
|
final AuthorizedAdminListItem authorizedAdminListItem =
|
||||||
state.itemDataList.value[index];
|
state.itemDataList.value[index];
|
||||||
|
|
||||||
return Slidable(
|
return Slidable(
|
||||||
@ -134,12 +137,12 @@ class _AuthorizedAdministratorListPageState
|
|||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: 0.2,
|
extentRatio: 0.2,
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: [
|
children: <Widget>[
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView()
|
ShowTipView()
|
||||||
.showDeleteAdministratorIsHaveAllDataDialog(
|
.showDeleteAdministratorIsHaveAllDataDialog(
|
||||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
'同时删除其发送的所有钥匙,钥匙删除后不能恢复', (bool isAllData) {
|
||||||
logic.deleteAdministratorRequest(
|
logic.deleteAdministratorRequest(
|
||||||
authorizedAdminListItem.uid.toString(),
|
authorizedAdminListItem.uid.toString(),
|
||||||
isAllData ? 1 : 0);
|
isAllData ? 1 : 0);
|
||||||
@ -169,10 +172,12 @@ class _AuthorizedAdministratorListPageState
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
//高级功能
|
//高级功能
|
||||||
var isVip = await Storage.getBool(saveIsVip);
|
final bool? isVip = await Storage.getBool(saveIsVip);
|
||||||
if (isVip == true) {
|
if (isVip == true) {
|
||||||
Get.toNamed(Routers.administratorDetailsPage,
|
Get.toNamed(Routers.administratorDetailsPage,
|
||||||
arguments: {'itemData': itemData})?.then((value) {
|
arguments: <String, AuthorizedAdminListItem>{
|
||||||
|
'itemData': itemData
|
||||||
|
})?.then((value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
@ -186,7 +191,7 @@ class _AuthorizedAdministratorListPageState
|
|||||||
height: 100.h,
|
height: 100.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
),
|
),
|
||||||
@ -195,14 +200,14 @@ class _AuthorizedAdministratorListPageState
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 1.sw - 110.w - 100.w,
|
width: 1.sw - 110.w - 100.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(itemData.name ?? '',
|
child: Text(itemData.name ?? '',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
@ -224,7 +229,7 @@ class _AuthorizedAdministratorListPageState
|
|||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
logic.getUseDateStr(itemData),
|
logic.getUseDateStr(itemData),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|||||||
@ -591,7 +591,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
|
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
|
||||||
|
|
||||||
Future<Response> updateAdministrator(String uid, String keyName,
|
Future<Response> updateAdministrator(String uid, String keyName,
|
||||||
String endDate, String startDate, String remoteEnable) =>
|
String endDate, String startDate, int isOnlyManageSelf) =>
|
||||||
post(
|
post(
|
||||||
updateAdministratorURL.toUrl,
|
updateAdministratorURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -599,7 +599,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
'keyName': keyName,
|
'keyName': keyName,
|
||||||
'endDate': endDate,
|
'endDate': endDate,
|
||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'remoteEnable': remoteEnable
|
'isOnlyManageSelf': isOnlyManageSelf
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 设置授权管理员
|
// 设置授权管理员
|
||||||
@ -1575,7 +1575,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
String startDate,
|
String startDate,
|
||||||
String userid,
|
String userid,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
String usernameType) =>
|
String usernameType,
|
||||||
|
int isOnlyManageSelf) =>
|
||||||
post(
|
post(
|
||||||
addAuthorizedAdminURL.toUrl,
|
addAuthorizedAdminURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -1588,7 +1589,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'userid': userid,
|
'userid': userid,
|
||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
'usernameType': usernameType
|
'usernameType': usernameType,
|
||||||
|
'isOnlyManageSelf': isOnlyManageSelf
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//退出登录
|
//退出登录
|
||||||
|
|||||||
@ -618,13 +618,13 @@ class ApiRepository {
|
|||||||
|
|
||||||
//更新授权管理员
|
//更新授权管理员
|
||||||
Future<ElectronicKeyListEntity> updateAdministrator(
|
Future<ElectronicKeyListEntity> updateAdministrator(
|
||||||
String uid,
|
{required String uid,
|
||||||
String keyName,
|
required String keyName,
|
||||||
String endDate,
|
required String endDate,
|
||||||
String startDate,
|
required String startDate,
|
||||||
String remoteEnable) async {
|
required int isOnlyManageSelf}) async {
|
||||||
final res = await apiProvider.updateAdministrator(
|
final res = await apiProvider.updateAdministrator(
|
||||||
uid, keyName, endDate, startDate, remoteEnable);
|
uid, keyName, endDate, startDate, isOnlyManageSelf);
|
||||||
return ElectronicKeyListEntity.fromJson(res.body);
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -979,7 +979,8 @@ class ApiRepository {
|
|||||||
required String startDate,
|
required String startDate,
|
||||||
required String userid,
|
required String userid,
|
||||||
required String countryCode,
|
required String countryCode,
|
||||||
required String usernameType}) async {
|
required String usernameType,
|
||||||
|
required int isOnlyManageSelf}) async {
|
||||||
final res = await apiProvider.addAuthorizedAdmin(
|
final res = await apiProvider.addAuthorizedAdmin(
|
||||||
createUser,
|
createUser,
|
||||||
endDate,
|
endDate,
|
||||||
@ -990,7 +991,8 @@ class ApiRepository {
|
|||||||
startDate,
|
startDate,
|
||||||
userid,
|
userid,
|
||||||
countryCode,
|
countryCode,
|
||||||
usernameType);
|
usernameType,
|
||||||
|
isOnlyManageSelf);
|
||||||
return KeyDetailEntity.fromJson(res.body);
|
return KeyDetailEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
lib/tools/regularExpression.dart
Normal file
14
lib/tools/regularExpression.dart
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
class RegularExpression {
|
||||||
|
bool isPhoneNumber(String input) {
|
||||||
|
// 手机号正则表达式,这里简化为11位数字
|
||||||
|
final RegExp phoneRegExp = RegExp(r'^\d{11}$');
|
||||||
|
return phoneRegExp.hasMatch(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEmail(String input) {
|
||||||
|
// 邮箱正则表达式,这里简化为常见格式
|
||||||
|
final RegExp emailRegExp =
|
||||||
|
RegExp(r'^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$');
|
||||||
|
return emailRegExp.hasMatch(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user