fix:修复群发所钥匙的添加解锁者逻辑,无法添加,无法第一个删除,删除按钮点击不灵敏。输入手机号或邮箱格式识别
This commit is contained in:
parent
7f0087d153
commit
d5853eaace
@ -52,14 +52,14 @@ android {
|
|||||||
// 这里“debug”不是一个自定义变量,而是一个特定的关键词,凡是使用--debug模式,都会引用到这里
|
// 这里“debug”不是一个自定义变量,而是一个特定的关键词,凡是使用--debug模式,都会引用到这里
|
||||||
// 目前看来,debug模式没办法在buildTypes里面按flavors指定编译签名,所有口味的debug模式只能用同一个签名
|
// 目前看来,debug模式没办法在buildTypes里面按flavors指定编译签名,所有口味的debug模式只能用同一个签名
|
||||||
debug {
|
debug {
|
||||||
// storeFile file("starlock.keystore")
|
storeFile file("starlock.keystore")
|
||||||
// storePassword '123456'
|
storePassword '123456'
|
||||||
// keyAlias = 'starlock'
|
keyAlias = 'starlock'
|
||||||
// keyPassword '123456'
|
keyPassword '123456'
|
||||||
storeFile file("xhj.jks")
|
// storeFile file("xhj.jks")
|
||||||
storePassword 'xhj8872'
|
// storePassword 'xhj8872'
|
||||||
keyAlias = 'upload'
|
// keyAlias = 'upload'
|
||||||
keyPassword 'xhj8872'
|
// keyPassword 'xhj8872'
|
||||||
}
|
}
|
||||||
sky {
|
sky {
|
||||||
// CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
|
// CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
|
||||||
|
|||||||
@ -868,6 +868,9 @@
|
|||||||
"自定义邮件模版":"Custom email template",
|
"自定义邮件模版":"Custom email template",
|
||||||
"名称":"Name",
|
"名称":"Name",
|
||||||
"星星锁": "Star lock",
|
"星星锁": "Star lock",
|
||||||
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "To receive important updates, please click 'OK' and enable notifications in the settings."
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "To receive important updates, please click 'OK' and enable notifications in the settings.",
|
||||||
|
"已有": "Already has",
|
||||||
|
"新增": "New",
|
||||||
|
"账号格式错误": "The account format is incorrect",
|
||||||
|
"接收者信息为空": "The recipient information is empty"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -900,6 +900,9 @@
|
|||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
"星星锁": "星星锁",
|
"星星锁": "星星锁",
|
||||||
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。"
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。",
|
||||||
|
"已有": "已有",
|
||||||
|
"新增": "新增",
|
||||||
|
"账号格式错误": "账号格式错误",
|
||||||
|
"接收者信息为空": "接收者信息为空"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -862,11 +862,15 @@
|
|||||||
"五": "五",
|
"五": "五",
|
||||||
"六": "六",
|
"六": "六",
|
||||||
"日": "日",
|
"日": "日",
|
||||||
"新建短信模版":"新建短信模版",
|
"新建短信模版": "新建短信模版",
|
||||||
"新建邮件模版":"新建邮件模版",
|
"新建邮件模版": "新建邮件模版",
|
||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版": "自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版": "自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称": "名称",
|
||||||
"星星锁": "星星锁",
|
"星星锁": "星星锁",
|
||||||
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。"
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。",
|
||||||
|
"已有": "已有",
|
||||||
|
"新增": "新增",
|
||||||
|
"账号格式错误": "账号格式错误",
|
||||||
|
"接收者信息为空": "接收者信息为空"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,6 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
state.receiverList = value['lockUserList'];
|
state.receiverList = value['lockUserList'];
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.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/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
||||||
|
import 'package:star_lock/tools/regexp_tool.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
import '../../../../../../app_settings/app_colors.dart';
|
import '../../../../../../app_settings/app_colors.dart';
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ class MassSendReceiverCell extends StatefulWidget {
|
|||||||
required this.onDeleteUser,
|
required this.onDeleteUser,
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final int currentIndex;
|
final int currentIndex;
|
||||||
final LockUserItemData userData;
|
final LockUserItemData userData;
|
||||||
final VoidCallback onDeleteUser;
|
final VoidCallback onDeleteUser;
|
||||||
@ -25,6 +27,7 @@ class _MassSendReceiverCellState extends State<MassSendReceiverCell> {
|
|||||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||||
late TextEditingController _receiverController;
|
late TextEditingController _receiverController;
|
||||||
late TextEditingController _nickNameController;
|
late TextEditingController _nickNameController;
|
||||||
|
RxString errorTxt = ''.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -50,50 +53,95 @@ class _MassSendReceiverCellState extends State<MassSendReceiverCell> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Column(
|
||||||
color: Colors.white,
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
Container(
|
||||||
onTap: widget.onDeleteUser,
|
color: Colors.white,
|
||||||
child: Padding(
|
child: Row(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
children: <Widget>[
|
||||||
child: Image.asset(
|
GestureDetector(
|
||||||
'images/icon_massSend_delete.png',
|
onTap: widget.onDeleteUser,
|
||||||
width: 26.w,
|
child: Container(
|
||||||
height: 26.w,
|
color: Colors.transparent,
|
||||||
|
padding: EdgeInsets.all(20.r),
|
||||||
|
child: Image.asset(
|
||||||
|
'images/icon_massSend_delete.png',
|
||||||
|
width: 26.w,
|
||||||
|
height: 26.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
_buildCellWidget(
|
||||||
|
leftTitle: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
|
isInputField: true,
|
||||||
|
inputHint: TranslationLoader
|
||||||
|
.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
|
controller: _receiverController,
|
||||||
|
isContactPickerEnabled: true,
|
||||||
|
onSubmitted: (String text) {
|
||||||
|
final bool isEmail = RegexpTool.isEmail(text);
|
||||||
|
final bool isPhoneNumber =
|
||||||
|
RegexpTool.isPhoneNumber(text);
|
||||||
|
if (text.trim() == '' || isEmail || isPhoneNumber) {
|
||||||
|
errorTxt.value = '';
|
||||||
|
} else {
|
||||||
|
errorTxt.value = '账号格式错误'.tr;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
Divider(
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
indent: 20.w,
|
||||||
|
endIndent: 20.w,
|
||||||
|
height: 1,
|
||||||
|
),
|
||||||
|
_buildCellWidget(
|
||||||
|
leftTitle: TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
isInputField: true,
|
||||||
|
inputHint: TranslationLoader.lanKeys!.enterYourName!.tr,
|
||||||
|
controller: _nickNameController,
|
||||||
|
isContactPickerEnabled: false,
|
||||||
|
onSubmitted: (String text) {
|
||||||
|
final bool isEmail = RegexpTool.isEmail(text);
|
||||||
|
final bool isPhoneNumber =
|
||||||
|
RegexpTool.isPhoneNumber(text);
|
||||||
|
if (text.trim() == '' || isEmail || isPhoneNumber) {
|
||||||
|
errorTxt.value = '';
|
||||||
|
} else {
|
||||||
|
errorTxt.value = '账号格式错误'.tr;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
),
|
||||||
child: Column(
|
Obx(() {
|
||||||
children: [
|
return errorTxt.value.trim() != ''
|
||||||
_buildCellWidget(
|
? Padding(
|
||||||
leftTitle: TranslationLoader.lanKeys!.receiver!.tr,
|
padding: EdgeInsets.only(
|
||||||
isInputField: true,
|
left: 80.w,
|
||||||
inputHint:
|
top: 10.h,
|
||||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
bottom: 10.h,
|
||||||
controller: _receiverController,
|
),
|
||||||
isContactPickerEnabled: true,
|
child: Text(
|
||||||
),
|
errorTxt.value,
|
||||||
Divider(
|
style: TextStyle(
|
||||||
color: AppColors.greyLineColor,
|
color: Colors.red,
|
||||||
indent: 20.w,
|
fontSize: 18.sp,
|
||||||
endIndent: 20.w,
|
),
|
||||||
height: 1,
|
),
|
||||||
),
|
)
|
||||||
_buildCellWidget(
|
: SizedBox(
|
||||||
leftTitle: TranslationLoader.lanKeys!.name!.tr,
|
height: 10.w,
|
||||||
isInputField: true,
|
);
|
||||||
inputHint: TranslationLoader.lanKeys!.enterYourName!.tr,
|
}),
|
||||||
controller: _nickNameController,
|
],
|
||||||
isContactPickerEnabled: false,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,20 +151,22 @@ class _MassSendReceiverCellState extends State<MassSendReceiverCell> {
|
|||||||
required String inputHint,
|
required String inputHint,
|
||||||
required TextEditingController controller,
|
required TextEditingController controller,
|
||||||
required bool isContactPickerEnabled,
|
required bool isContactPickerEnabled,
|
||||||
|
ValueChanged<String>? onSubmitted,
|
||||||
}) {
|
}) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
padding: EdgeInsets.only(right: 20.w),
|
padding: EdgeInsets.only(right: 20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
|
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
|
||||||
Expanded(child: SizedBox(width: 10.w)),
|
Expanded(child: SizedBox(width: 10.w)),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
if (isInputField)
|
if (isInputField)
|
||||||
_buildTextField(controller, inputHint, isContactPickerEnabled)
|
_buildTextField(controller, inputHint, isContactPickerEnabled,
|
||||||
|
onSubmitted: onSubmitted)
|
||||||
else
|
else
|
||||||
Text(
|
Text(
|
||||||
controller.text,
|
controller.text,
|
||||||
@ -132,11 +182,12 @@ class _MassSendReceiverCellState extends State<MassSendReceiverCell> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTextField(TextEditingController controller, String hintText,
|
Widget _buildTextField(TextEditingController controller, String hintText,
|
||||||
bool isContactPickerEnabled) {
|
bool isContactPickerEnabled,
|
||||||
|
{ValueChanged<String>? onSubmitted}) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 380.w,
|
width: 380.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
@ -148,6 +199,7 @@ class _MassSendReceiverCellState extends State<MassSendReceiverCell> {
|
|||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
),
|
),
|
||||||
|
onSubmitted: onSubmitted,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (isContactPickerEnabled)
|
if (isContactPickerEnabled)
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_state.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -6,14 +7,25 @@ import 'package:star_lock/tools/storage.dart';
|
|||||||
class MassSendReceiverLogic extends BaseGetXController {
|
class MassSendReceiverLogic extends BaseGetXController {
|
||||||
MassSendReceiverState state = MassSendReceiverState();
|
MassSendReceiverState state = MassSendReceiverState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
final dynamic data = Get.arguments;
|
||||||
|
if (data is Map && data['lockUserList'] is List) {
|
||||||
|
data['lockUserList'].forEach((dynamic lockUser) {
|
||||||
|
state.lockUserList.add(lockUser);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
LockUserItemData data = LockUserItemData();
|
final LockUserItemData data = LockUserItemData();
|
||||||
state.lockUserList.add(data);
|
state.lockUserList.add(data);
|
||||||
|
|
||||||
var isVip = await Storage.getBool(saveIsVip);
|
final bool? isVip = await Storage.getBool(saveIsVip);
|
||||||
state.isVip.value = isVip ?? false;
|
state.isVip.value = isVip ?? false;
|
||||||
state.isVip.refresh();
|
state.isVip.refresh();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,17 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.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/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/app_settings/app_settings.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_logic.dart';
|
||||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_state.dart';
|
||||||
import 'package:star_lock/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
|
import 'package:star_lock/tools/regexp_tool.dart';
|
||||||
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
class MassSendReceiverPage extends StatefulWidget {
|
class MassSendReceiverPage extends StatefulWidget {
|
||||||
@ -20,8 +24,8 @@ class MassSendReceiverPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
||||||
final logic = Get.put(MassSendReceiverLogic());
|
final MassSendReceiverLogic logic = Get.put(MassSendReceiverLogic());
|
||||||
final state = Get.find<MassSendReceiverLogic>().state;
|
final MassSendReceiverState state = Get.find<MassSendReceiverLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -40,7 +44,7 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.save!.tr,
|
TranslationLoader.lanKeys!.save!.tr,
|
||||||
@ -50,24 +54,37 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
if (!state.isVip.value) {
|
if (!state.isVip.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, dynamic> resultMap = {};
|
if (state.lockUserList.isEmpty) {
|
||||||
resultMap['lockUserList'] = state.lockUserList.value;
|
EasyLoading.showToast('接收者信息为空'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (final LockUserItemData userItem in state.lockUserList) {
|
||||||
|
final bool isEmail = RegexpTool.isEmail(userItem.userid ?? '');
|
||||||
|
final bool isPhoneNumber =
|
||||||
|
RegexpTool.isPhoneNumber(userItem.userid ?? '');
|
||||||
|
if (!isEmail && !isPhoneNumber) {
|
||||||
|
EasyLoading.showToast('账号格式错误'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final Map<String, dynamic> resultMap = <String, dynamic>{};
|
||||||
|
resultMap['lockUserList'] = state.lockUserList;
|
||||||
Navigator.pop(context, resultMap);
|
Navigator.pop(context, resultMap);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? false : true,
|
visible: !state.isVip.value,
|
||||||
child: ShowCupertinoAlertView()
|
child: ShowCupertinoAlertView()
|
||||||
.topTipsAdvancedFeatures('开通高级功能后才可以选择和添加接收者'.tr))),
|
.topTipsAdvancedFeatures('开通高级功能后才可以选择和添加接收者'.tr))),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? true : false,
|
visible: state.isVip.value,
|
||||||
child: CommonItem(
|
child: 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,
|
||||||
@ -78,7 +95,7 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
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>;
|
||||||
@ -88,24 +105,26 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
))),
|
))),
|
||||||
Obx(() => Row(
|
Obx(() => Padding(
|
||||||
children: [controlViewTitle(0), controlViewTitle(1)],
|
padding: EdgeInsets.symmetric(vertical: 20.h),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[controlViewTitle(0), controlViewTitle(1)],
|
||||||
|
),
|
||||||
)),
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 2.h,
|
height: 2.h,
|
||||||
),
|
),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? true : false,
|
visible: state.isVip.value,
|
||||||
child: Expanded(
|
child: Expanded(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
LockUserItemData data = state.lockUserList.value[index];
|
final LockUserItemData data = state.lockUserList[index];
|
||||||
state.emailOrPhoneController.text = data.userid ?? '';
|
state.emailOrPhoneController.text = data.userid ?? '';
|
||||||
state.keyNameController.text = data.nickname ?? '';
|
state.keyNameController.text = data.nickname ?? '';
|
||||||
|
|
||||||
return _itemBuilder(index, data);
|
return _itemBuilder(index, data);
|
||||||
},
|
},
|
||||||
itemCount: state.lockUserList.value.length,
|
itemCount: state.lockUserList.length,
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return Divider(
|
return Divider(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
@ -129,7 +148,7 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
state.isVip.value
|
state.isVip.value
|
||||||
? 'images/icon_btn_add.png'
|
? 'images/icon_btn_add.png'
|
||||||
@ -141,7 +160,7 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
width: 6.w,
|
width: 6.w,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
btnIndex == 0 ? '已有' : '新增',
|
btnIndex == 0 ? '已有'.tr : '新增'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: state.isVip.value
|
color: state.isVip.value
|
||||||
? AppColors.mainColor
|
? AppColors.mainColor
|
||||||
@ -158,17 +177,27 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
}
|
}
|
||||||
if (btnIndex == 0) {
|
if (btnIndex == 0) {
|
||||||
//已有
|
//已有
|
||||||
Navigator.pushNamed(context, Routers.lockUserListPage).then((val) {
|
Navigator.pushNamed(context, Routers.lockUserListPage)
|
||||||
|
.then((Object? val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
val as Map<String, dynamic>;
|
val as Map<String, dynamic>;
|
||||||
state.lockUserList.value = val['lockUserList'];
|
if (val['lockUserList'] is List) {
|
||||||
|
final List<int?> uid = state.lockUserList
|
||||||
|
.where((LockUserItemData e) => e.isCheck ?? false)
|
||||||
|
.map((LockUserItemData e) => e.uid)
|
||||||
|
.toList();
|
||||||
|
val['lockUserList'].forEach((LockUserItemData itemData) {
|
||||||
|
if (!uid.contains(itemData.uid)) {
|
||||||
|
state.lockUserList.add(itemData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (btnIndex == 1) {
|
} else if (btnIndex == 1) {
|
||||||
//新增
|
//新增
|
||||||
state.lockUserList.value.add(LockUserItemData());
|
state.lockUserList.add(LockUserItemData());
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -177,12 +206,11 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
|||||||
|
|
||||||
Widget _itemBuilder(int index, LockUserItemData userData) {
|
Widget _itemBuilder(int index, LockUserItemData userData) {
|
||||||
return MassSendReceiverCell(
|
return MassSendReceiverCell(
|
||||||
currentIndex: index,
|
currentIndex: index,
|
||||||
userData: userData,
|
userData: userData,
|
||||||
onDeleteUser: () {
|
onDeleteUser: () {
|
||||||
state.lockUserList.removeAt(index - 1);
|
state.lockUserList.removeAt(index);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,11 +10,11 @@ class MassSendReceiverState {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var isVip = false.obs;
|
RxBool isVip = false.obs;
|
||||||
var lockUserList = <LockUserItemData>[].obs;
|
RxList<LockUserItemData> lockUserList = <LockUserItemData>[].obs;
|
||||||
TextEditingController emailOrPhoneController = TextEditingController();
|
TextEditingController emailOrPhoneController = TextEditingController();
|
||||||
TextEditingController keyNameController = TextEditingController();
|
TextEditingController keyNameController = TextEditingController();
|
||||||
|
|
||||||
var countryCode = '86'.obs;
|
RxString countryCode = '86'.obs;
|
||||||
var countryName = '中国'.obs;
|
RxString countryName = '中国'.obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,10 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockMian/lockMain/lockMain_page.dart';
|
import 'package:star_lock/main/lockMian/lockMain/lockMain_page.dart';
|
||||||
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_state.dart';
|
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_state.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.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/tools/storage.dart';
|
||||||
|
|
||||||
class LockMainXHJLogic extends BaseGetXController {
|
class LockMainXHJLogic extends BaseGetXController {
|
||||||
final LockMainXHJState state = LockMainXHJState();
|
final LockMainXHJState state = LockMainXHJState();
|
||||||
@ -17,6 +20,14 @@ class LockMainXHJLogic extends BaseGetXController {
|
|||||||
|
|
||||||
bool get isMall => state.index ==1;
|
bool get isMall => state.index ==1;
|
||||||
|
|
||||||
|
//用户信息
|
||||||
|
Future<void> getUserInfoRequest() async {
|
||||||
|
final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo();
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Storage.setBool(saveIsVip, entity.data!.isVip==1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//打开设备弹窗
|
//打开设备弹窗
|
||||||
void openEquipment() {
|
void openEquipment() {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
@ -48,6 +59,7 @@ class LockMainXHJLogic extends BaseGetXController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
getUserInfoRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class StarLockMineLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getMineInfoData() async {
|
Future<void> getMineInfoData() async {
|
||||||
final String? 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())!;
|
||||||
@ -59,7 +59,6 @@ class StarLockMineLogic extends BaseGetXController {
|
|||||||
@override
|
@override
|
||||||
Future<void> onInit() async {
|
Future<void> onInit() async {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
getMineInfoData();
|
getMineInfoData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
final StarLockMineState state = Get.find<StarLockMineLogic>().state;
|
final StarLockMineState state = Get.find<StarLockMineLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
logic.getUserInfoRequest();
|
logic.getUserInfoRequest();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,10 +12,11 @@ import 'lockUserManageList_state.dart';
|
|||||||
|
|
||||||
class LockUserManageListLogic extends BaseGetXController {
|
class LockUserManageListLogic extends BaseGetXController {
|
||||||
final LockUserManageListState state = LockUserManageListState();
|
final LockUserManageListState state = LockUserManageListState();
|
||||||
|
StreamSubscription? _getElectronicKeyListRefreshUIEvent;
|
||||||
|
|
||||||
//请求锁用户列表
|
//请求锁用户列表
|
||||||
Future<LockUserListEntity> lockUserListRequest() async {
|
Future<LockUserListEntity> lockUserListRequest() async {
|
||||||
LockUserListEntity entity =
|
final LockUserListEntity entity =
|
||||||
await ApiRepository.to.lockUserList(pageNo.toString(), pageSize, state.searchController.text);
|
await ApiRepository.to.lockUserList(pageNo.toString(), pageSize, state.searchController.text);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
if (pageNo == 1) {
|
if (pageNo == 1) {
|
||||||
@ -23,7 +24,7 @@ class LockUserManageListLogic extends BaseGetXController {
|
|||||||
pageNo++;
|
pageNo++;
|
||||||
} else {
|
} else {
|
||||||
if (entity.data!.isNotEmpty) {
|
if (entity.data!.isNotEmpty) {
|
||||||
state.dataList.value.addAll(entity.data!);
|
state.dataList.addAll(entity.data!);
|
||||||
pageNo++;
|
pageNo++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,7 +34,7 @@ class LockUserManageListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//删除锁用户管理
|
//删除锁用户管理
|
||||||
Future<void> deletelockUserRequest(int uid) async {
|
Future<void> deletelockUserRequest(int uid) async {
|
||||||
var entity = await ApiRepository.to.deletLockUser(uid);
|
final entity = await ApiRepository.to.deletLockUser(uid);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
EasyLoading.showToast('删除成功',duration: 2000.milliseconds);
|
EasyLoading.showToast('删除成功',duration: 2000.milliseconds);
|
||||||
showToast('删除成功', something: (){
|
showToast('删除成功', something: (){
|
||||||
@ -44,7 +45,6 @@ class LockUserManageListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 刷新电子钥匙列表
|
/// 刷新电子钥匙列表
|
||||||
StreamSubscription? _getElectronicKeyListRefreshUIEvent;
|
|
||||||
void _getElectronicKeyListRefreshUIAction() {
|
void _getElectronicKeyListRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_getElectronicKeyListRefreshUIEvent = eventBus.on<LockUserManageListRefreshUI>().listen((event) {
|
_getElectronicKeyListRefreshUIEvent = eventBus.on<LockUserManageListRefreshUI>().listen((event) {
|
||||||
@ -55,23 +55,18 @@ class LockUserManageListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_getElectronicKeyListRefreshUIAction();
|
_getElectronicKeyListRefreshUIAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
_getElectronicKeyListRefreshUIEvent?.cancel();
|
_getElectronicKeyListRefreshUIEvent?.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +38,6 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
lib/tools/regexp_tool.dart
Normal file
18
lib/tools/regexp_tool.dart
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
///
|
||||||
|
/// 正则判断工具
|
||||||
|
///
|
||||||
|
class RegexpTool {
|
||||||
|
//判断手机号
|
||||||
|
static bool isPhoneNumber(String input) {
|
||||||
|
// 手机号正则表达式
|
||||||
|
final RegExp phoneNumberRegExp = RegExp(r'^1[0-9]{10}$');
|
||||||
|
return phoneNumberRegExp.hasMatch(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断邮箱
|
||||||
|
static bool isEmail(String input) {
|
||||||
|
// 邮箱正则表达式
|
||||||
|
final RegExp emailRegExp = RegExp(r'^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$');
|
||||||
|
return emailRegExp.hasMatch(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user