1,修复密码详情分享报错问题
2,完成密码模块系统邮件通知、短信通知发送的对接及兼容
This commit is contained in:
parent
17b5a76d2d
commit
4c9dd152ca
@ -429,7 +429,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
|||||||
Get.toNamed(Routers.sendEmailNotificationPage,
|
Get.toNamed(Routers.sendEmailNotificationPage,
|
||||||
arguments: <String, Object?>{
|
arguments: <String, Object?>{
|
||||||
'receiver': logic.emailOrPhone,
|
'receiver': logic.emailOrPhone,
|
||||||
'userNameType': logic.state.userNameType.value,
|
'channelType': logic.state.userNameType.value,
|
||||||
'keyId': logic.keyId
|
'keyId': logic.keyId
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -20,17 +20,25 @@ class SendEmailNotificationLogic extends BaseGetXController {
|
|||||||
state.emailTemplateList.value =
|
state.emailTemplateList.value =
|
||||||
entity.data?.list ?? <EmailNotificationItem>[];
|
entity.data?.list ?? <EmailNotificationItem>[];
|
||||||
state.currentNotifyItem.value = state.emailTemplateList.first;
|
state.currentNotifyItem.value = state.emailTemplateList.first;
|
||||||
state.emailController.text = state.currentNotifyItem.value.template ?? '';
|
state.templateContentController.text =
|
||||||
|
state.currentNotifyItem.value.template ?? '';
|
||||||
state.emailTemplateList.refresh();
|
state.emailTemplateList.refresh();
|
||||||
state.currentNotifyItem.refresh();
|
state.currentNotifyItem.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送短信、邮件通知 channelType--1短信 2邮件 openDoorType--1电子钥匙 2密码
|
//发送短信、邮件通知 channelType--1短信 2邮件 opisAPKFileName
|
||||||
Future<void> keyNoticeSubmitRequest() async {
|
Future<void> keyNoticeSubmitRequest() async {
|
||||||
|
if (state.receiverController.text.isEmpty &&
|
||||||
|
state.getReceiver.value.isEmpty) {
|
||||||
|
showToast('请输入接收者');
|
||||||
|
return;
|
||||||
|
}
|
||||||
final SendEmailNotificationEntity entity =
|
final SendEmailNotificationEntity entity =
|
||||||
await ApiRepository.to.keyNoticeSubmit(
|
await ApiRepository.to.keyNoticeSubmit(
|
||||||
receiverName: state.getReceiver.value,
|
receiverName: state.getReceiver.value.isEmpty
|
||||||
|
? state.receiverController.text
|
||||||
|
: state.getReceiver.value,
|
||||||
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
|
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
|
||||||
keyId: state.getKeyId.value,
|
keyId: state.getKeyId.value,
|
||||||
channelType: state.channelType.value,
|
channelType: state.channelType.value,
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.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/main/lockDetail/electronicKey/sendEmailNotification/SendEmailNotification_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/SendEmailNotification_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart';
|
||||||
import 'package:star_lock/tools/emailNotifyTypeSelectAlert.dart';
|
import 'package:star_lock/tools/emailNotifyTypeSelectAlert.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/style/default_style.dart';
|
import 'package:star_lock/tools/pickers/style/default_style.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
@ -46,11 +47,17 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => state.getReceiver.value.isNotEmpty
|
||||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
? CommonItem(
|
||||||
rightTitle: state.getReceiver.value,
|
leftTitel: '接收者'.tr,
|
||||||
isHaveLine: true,
|
rightTitle: state.getReceiver.value,
|
||||||
)),
|
isHaveLine: true,
|
||||||
|
)
|
||||||
|
: CommonItem(
|
||||||
|
leftTitel: '接收者'.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: _buildReceiverItemWidget())),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '类型',
|
leftTitel: '类型',
|
||||||
rightTitle: state.getNotifyTypeText.value,
|
rightTitle: state.getNotifyTypeText.value,
|
||||||
@ -60,6 +67,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
isEmail: state.channelType.value == 2,
|
isEmail: state.channelType.value == 2,
|
||||||
onSelected: (int value) {
|
onSelected: (int value) {
|
||||||
state.notifyTypeSelect.value = value;
|
state.notifyTypeSelect.value = value;
|
||||||
|
state.updateNotifyTypeText();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
@ -82,7 +90,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
maxLines: 8,
|
maxLines: 8,
|
||||||
maxLength: 1000,
|
maxLength: 1000,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
controller: state.emailController,
|
controller: state.templateContentController,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
@ -127,7 +135,9 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
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: () {
|
||||||
logic.keyNoticeSubmitRequest();
|
if (state.notifyTypeSelect.value == 1) {
|
||||||
|
logic.keyNoticeSubmitRequest();
|
||||||
|
} else {}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -135,6 +145,103 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildReceiverItemWidget() {
|
||||||
|
return Container(
|
||||||
|
constraints: BoxConstraints(maxWidth: 400.w), // 设置父组件的宽度约束
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min, // 设置 Row 的 mainAxisSize 属性
|
||||||
|
children: <Widget>[
|
||||||
|
Flexible(
|
||||||
|
fit: FlexFit.loose, // 使用 Flexible 并设置ting fit 属性
|
||||||
|
child: SizedBox(width: 10.w),
|
||||||
|
),
|
||||||
|
if (state.channelType.value == 1)
|
||||||
|
GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
width: 90.w,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
Obx(() => Text(
|
||||||
|
'+${state.countryCode.value}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor,
|
||||||
|
fontSize: 20.sp),
|
||||||
|
)),
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_grayPullDown.png',
|
||||||
|
width: 20.w,
|
||||||
|
height: 20.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
final result =
|
||||||
|
await Get.toNamed(Routers.selectCountryRegionPage);
|
||||||
|
if (result != null) {
|
||||||
|
result as Map<String, dynamic>;
|
||||||
|
state.countryCode.value = result['code'];
|
||||||
|
state.countryName.value = result['countryName'];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Container(),
|
||||||
|
getReceiverTFWidget(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接受者信息输入框
|
||||||
|
Widget getReceiverTFWidget() {
|
||||||
|
return SizedBox(
|
||||||
|
height: 65.h,
|
||||||
|
width: 200.w,
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller: state.receiverController,
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
inputFormatters: <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
|
LengthLimitingTextInputFormatter(30),
|
||||||
|
],
|
||||||
|
autofocus: false,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: '请输入'.tr,
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
|
focusedBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
disabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
enabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
|
||||||
|
onChanged: (String value) {
|
||||||
|
// 处理接收者输入改变事件
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 底部选择pickerView
|
// 底部选择pickerView
|
||||||
void openBottomItemSheet(BuildContext context) {
|
void openBottomItemSheet(BuildContext context) {
|
||||||
final List nameList = state.emailTemplateList
|
final List nameList = state.emailTemplateList
|
||||||
@ -145,7 +252,8 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
data: nameList,
|
data: nameList,
|
||||||
pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) {
|
pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) {
|
||||||
state.currentNotifyItem.value = state.emailTemplateList[position];
|
state.currentNotifyItem.value = state.emailTemplateList[position];
|
||||||
state.emailController.text = state.emailTemplateList[position].template!;
|
state.templateContentController.text =
|
||||||
|
state.emailTemplateList[position].template!;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,26 +12,29 @@ class SendEmailNotificationState {
|
|||||||
getKeyId.value = Get.arguments['keyId'];
|
getKeyId.value = Get.arguments['keyId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Get.arguments['userNameType'] != null) {
|
if (Get.arguments['channelType'] != null) {
|
||||||
channelType.value = Get.arguments['userNameType'];
|
channelType.value = Get.arguments['channelType'];
|
||||||
if (channelType.value == 1) {
|
updateNotifyTypeText();
|
||||||
if (notifyTypeSelect.value == 1) {
|
// if (channelType.value == 1) {
|
||||||
getNotifyTypeText.value = '系统短信';
|
// if (notifyTypeSelect.value == 1) {
|
||||||
} else {
|
// getNotifyTypeText.value = '系统短信';
|
||||||
getNotifyTypeText.value = '个人短信';
|
// } else {
|
||||||
}
|
// getNotifyTypeText.value = '个人短信';
|
||||||
} else {
|
// }
|
||||||
if (notifyTypeSelect.value == 1) {
|
// } else {
|
||||||
getNotifyTypeText.value = '系统邮件';
|
// if (notifyTypeSelect.value == 1) {
|
||||||
} else {
|
// getNotifyTypeText.value = '系统邮件';
|
||||||
getNotifyTypeText.value = '个人邮件';
|
// } else {
|
||||||
}
|
// getNotifyTypeText.value = '个人邮件';
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RxString getReceiver = ''.obs;
|
RxString getReceiver = ''.obs;
|
||||||
final TextEditingController emailController = TextEditingController();
|
final TextEditingController templateContentController =
|
||||||
|
TextEditingController();
|
||||||
|
final TextEditingController receiverController = TextEditingController();
|
||||||
RxInt notifyTypeSelect = 1.obs; //1 代表系统,2 代表个人
|
RxInt notifyTypeSelect = 1.obs; //1 代表系统,2 代表个人
|
||||||
RxInt channelType = 0.obs; //1 代表短信,2 代表邮件
|
RxInt channelType = 0.obs; //1 代表短信,2 代表邮件
|
||||||
RxString getNotifyTypeText = ''.obs;
|
RxString getNotifyTypeText = ''.obs;
|
||||||
@ -39,4 +42,22 @@ class SendEmailNotificationState {
|
|||||||
<EmailNotificationItem>[].obs;
|
<EmailNotificationItem>[].obs;
|
||||||
Rx<EmailNotificationItem> currentNotifyItem = EmailNotificationItem().obs;
|
Rx<EmailNotificationItem> currentNotifyItem = EmailNotificationItem().obs;
|
||||||
RxInt getKeyId = 0.obs; //获取钥匙成功得到的keyId
|
RxInt getKeyId = 0.obs; //获取钥匙成功得到的keyId
|
||||||
|
RxString countryCode = '86'.obs;
|
||||||
|
RxString countryName = '中国'.obs;
|
||||||
|
|
||||||
|
Future<void> updateNotifyTypeText() async {
|
||||||
|
if (channelType.value == 1) {
|
||||||
|
if (notifyTypeSelect.value == 1) {
|
||||||
|
getNotifyTypeText.value = '系统短信';
|
||||||
|
} else {
|
||||||
|
getNotifyTypeText.value = '个人短信';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (notifyTypeSelect.value == 1) {
|
||||||
|
getNotifyTypeText.value = '系统邮件';
|
||||||
|
} else {
|
||||||
|
getNotifyTypeText.value = '个人邮件';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
import 'package:star_lock/tools/showTFView.dart';
|
import 'package:star_lock/tools/showTFView.dart';
|
||||||
import 'package:star_lock/tools/showTipView.dart';
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
@ -25,7 +26,8 @@ class PasswordKeyDetailPage extends StatefulWidget {
|
|||||||
State<PasswordKeyDetailPage> createState() => _PasswordKeyDetailPageState();
|
State<PasswordKeyDetailPage> createState() => _PasswordKeyDetailPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with RouteAware {
|
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
|
||||||
|
with RouteAware {
|
||||||
final PasswordKeyDetailLogic logic = Get.put(PasswordKeyDetailLogic());
|
final PasswordKeyDetailLogic logic = Get.put(PasswordKeyDetailLogic());
|
||||||
final PasswordKeyDetailState state = Get.find<PasswordKeyDetailLogic>().state;
|
final PasswordKeyDetailState state = Get.find<PasswordKeyDetailLogic>().state;
|
||||||
|
|
||||||
@ -44,7 +46,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
height: 30.h,
|
height: 30.h,
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
),
|
),
|
||||||
onPressed: _openModalBottomSheet,
|
onPressed: openModalBottomSheet,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -52,13 +54,14 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.itemData.value.isCustom! == 1,
|
visible: state.itemData.value.isCustom! == 1,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: "${"密码".tr}${TranslationLoader.lanKeys!.number!.tr}",
|
leftTitel:
|
||||||
rightTitle: state.itemData.value.pwdUserNo.toString(),
|
"${"密码".tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||||
isHaveDirection: false,
|
rightTitle: state.itemData.value.pwdUserNo.toString(),
|
||||||
isHaveLine: true),
|
isHaveDirection: false,
|
||||||
)),
|
isHaveLine: true),
|
||||||
|
)),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||||
rightTitle: state.keyboardPwd.value,
|
rightTitle: state.keyboardPwd.value,
|
||||||
@ -145,16 +148,18 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
rightTitle: '',
|
rightTitle: '',
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
|
Get.toNamed(Routers.lockOperatingRecordPage,
|
||||||
|
arguments: <String, Object?>{
|
||||||
'type': 1,
|
'type': 1,
|
||||||
'id': state.itemData.value.keyboardPwdId.toString(),
|
'id': state.itemData.value.keyboardPwdId.toString(),
|
||||||
'recordName': state.itemData.value.keyboardPwdName
|
'recordName': state.itemData.value.keyboardPwdName
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: state.itemData.value.isCustom == 0 && state.itemData.value.keyboardPwdType != 1 && state.itemData.value.keyboardPwdType != 4,
|
visible: state.itemData.value.isCustom == 0 &&
|
||||||
child:bottomTip()
|
state.itemData.value.keyboardPwdType != 1 &&
|
||||||
),
|
state.itemData.value.keyboardPwdType != 4,
|
||||||
|
child: bottomTip()),
|
||||||
Container(height: 40.h),
|
Container(height: 40.h),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: ScreenUtil().screenWidth - 40.w,
|
width: ScreenUtil().screenWidth - 40.w,
|
||||||
@ -241,7 +246,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bottomTip(){
|
Widget bottomTip() {
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
@ -251,10 +256,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。'.tr,
|
'密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。'.tr,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: TextStyle(fontSize: 20.sp),
|
style: TextStyle(fontSize: 20.sp),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -280,13 +285,14 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
//发送时间
|
//发送时间
|
||||||
String getSenderDate(PasswordKeyListItem indexEntity) {
|
String getSenderDate(PasswordKeyListItem indexEntity) {
|
||||||
String senderDate = '';
|
String senderDate = '';
|
||||||
DateTime dateStr =
|
final DateTime dateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||||
return senderDate;
|
return senderDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context, TextEditingController inputController) {
|
void showCupertinoAlertDialog(
|
||||||
|
BuildContext context, TextEditingController inputController) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -334,7 +340,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _openModalBottomSheet() async {
|
Future<void> openModalBottomSheet() async {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@ -345,7 +351,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: ScreenUtil().screenWidth,
|
width: ScreenUtil().screenWidth,
|
||||||
height: 180.h,
|
height: 160.h,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
scrollDirection: Axis.horizontal, //横向滚动
|
scrollDirection: Axis.horizontal, //横向滚动
|
||||||
children: initBottomSheetList()),
|
children: initBottomSheetList()),
|
||||||
@ -373,7 +379,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> initBottomSheetList() {
|
List<Widget> initBottomSheetList() {
|
||||||
List<Widget> widgetList = <Widget>[];
|
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));
|
||||||
@ -410,37 +416,28 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () => _jumpSmartDeviceRoute(itemIndex),
|
onTap: () => jumpSmartDeviceRoute(itemIndex),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_jumpSmartDeviceRoute(int itemIndex) {
|
Future<void> jumpSmartDeviceRoute(int itemIndex) async {
|
||||||
Get.back();
|
Get.back();
|
||||||
String pwdShareStr = logic.getShareContentStr();
|
final String pwdShareStr = logic.getShareContentStr();
|
||||||
switch (itemIndex) {
|
switch (itemIndex) {
|
||||||
case 0:
|
case 0: //微信好友
|
||||||
//微信好友
|
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||||
{
|
|
||||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: //短信
|
||||||
//短信
|
case 2: //邮件
|
||||||
{
|
Get.toNamed(Routers.sendEmailNotificationPage,
|
||||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
arguments: <String, Object?>{
|
||||||
}
|
'receiver': '',
|
||||||
|
'channelType': itemIndex == 1 ? 1 : 2,
|
||||||
|
'keyId': CommonDataManage().currentKeyInfo.keyId,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3: //更多
|
||||||
//邮件
|
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||||
{
|
|
||||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
//更多
|
|
||||||
{
|
|
||||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
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';
|
||||||
@ -39,7 +38,8 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
|
|||||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||||
with RouteAware, SingleTickerProviderStateMixin {
|
with RouteAware, SingleTickerProviderStateMixin {
|
||||||
final PasswordKeyPerpetualLogic logic = Get.put(PasswordKeyPerpetualLogic());
|
final PasswordKeyPerpetualLogic logic = Get.put(PasswordKeyPerpetualLogic());
|
||||||
final PasswordKeyPerpetualState state = Get.find<PasswordKeyPerpetualLogic>().state;
|
final PasswordKeyPerpetualState state =
|
||||||
|
Get.find<PasswordKeyPerpetualLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -93,7 +93,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
state.nameController),
|
state.nameController),
|
||||||
keyBottomWidget(
|
keyBottomWidget(
|
||||||
'密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。'.tr)
|
'密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。'
|
||||||
|
.tr)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -141,7 +142,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
keyIfPerpetualWidget(),
|
keyIfPerpetualWidget(),
|
||||||
if (state.isPermanent.value == false) keyCustomTimeLimitWidget() else Container(),
|
if (state.isPermanent.value == false)
|
||||||
|
keyCustomTimeLimitWidget()
|
||||||
|
else
|
||||||
|
Container(),
|
||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
false,
|
false,
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
@ -189,8 +193,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
state.nameController),
|
state.nameController),
|
||||||
keyBottomWidget(
|
keyBottomWidget('清空密码底部提示'.tr)
|
||||||
'清空密码底部提示'.tr)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -322,7 +325,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
rightTitle: '',
|
rightTitle: '',
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch())),
|
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch())),
|
||||||
if (state.isPermanent.value == true) Container(height: 10.h) else Container(height: 1.h),
|
if (state.isPermanent.value == true)
|
||||||
|
Container(height: 10.h)
|
||||||
|
else
|
||||||
|
Container(height: 1.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -330,8 +336,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
// 自定义是管理员密码
|
// 自定义是管理员密码
|
||||||
Widget keyIfAdministratorWidget() {
|
Widget keyIfAdministratorWidget() {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible:
|
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1,
|
||||||
CommonDataManage().currentKeyInfo.isLockOwner == 1,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
// SizedBox(height: 10.h),
|
// SizedBox(height: 10.h),
|
||||||
@ -374,11 +379,11 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
}),
|
}),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: CommonDataManage().currentKeyInfo.vendor ==
|
visible: CommonDataManage().currentKeyInfo.vendor ==
|
||||||
IoModelVendor.vendor_XL &&
|
IoModelVendor.vendor_XL &&
|
||||||
(CommonDataManage().currentKeyInfo.model ==
|
(CommonDataManage().currentKeyInfo.model ==
|
||||||
IoModelVendor.model_XL_BLE ||
|
IoModelVendor.model_XL_BLE ||
|
||||||
CommonDataManage().currentKeyInfo.model ==
|
CommonDataManage().currentKeyInfo.model ==
|
||||||
IoModelVendor.model_XL_WIFI),
|
IoModelVendor.model_XL_WIFI),
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: '结束日期',
|
leftTitel: '结束日期',
|
||||||
rightTitle: state.endTime.value,
|
rightTitle: state.endTime.value,
|
||||||
@ -403,7 +408,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
final PDuration selectDate = PDuration.parse(
|
final PDuration selectDate = PDuration.parse(
|
||||||
DateTool().dateToDateTime(state.loopEffectiveDate.value, 0));
|
DateTool().dateToDateTime(state.loopEffectiveDate.value, 0));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.H, onConfirm: (PDuration p) {
|
selectDate: selectDate,
|
||||||
|
mode: DateMode.H, onConfirm: (PDuration p) {
|
||||||
state.loopEffectiveDate.value =
|
state.loopEffectiveDate.value =
|
||||||
DateTool().getYMDHNDateString(p, 5);
|
DateTool().getYMDHNDateString(p, 5);
|
||||||
state.loopStartHours.value = p.hour!;
|
state.loopStartHours.value = p.hour!;
|
||||||
@ -417,7 +423,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
final PDuration selectDate = PDuration.parse(
|
final PDuration selectDate = PDuration.parse(
|
||||||
DateTool().dateToDateTime(state.loopFailureDate.value, 0));
|
DateTool().dateToDateTime(state.loopFailureDate.value, 0));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.H, onConfirm: (PDuration p) {
|
selectDate: selectDate,
|
||||||
|
mode: DateMode.H, onConfirm: (PDuration p) {
|
||||||
state.loopFailureDate.value =
|
state.loopFailureDate.value =
|
||||||
DateTool().getYMDHNDateString(p, 5);
|
DateTool().getYMDHNDateString(p, 5);
|
||||||
state.loopEndHours.value = p.hour!;
|
state.loopEndHours.value = p.hour!;
|
||||||
@ -563,14 +570,16 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
inputFormatters: editController == state.pwdController ? <TextInputFormatter>[
|
inputFormatters: editController == state.pwdController
|
||||||
FilteringTextInputFormatter.deny('\n'),
|
? <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(9),
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
|
LengthLimitingTextInputFormatter(9),
|
||||||
]:<TextInputFormatter>[
|
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
|
||||||
FilteringTextInputFormatter.deny('\n'),
|
]
|
||||||
LengthLimitingTextInputFormatter(50),
|
: <TextInputFormatter>[
|
||||||
],
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
|
LengthLimitingTextInputFormatter(50),
|
||||||
|
],
|
||||||
keyboardType: editController == state.nameController
|
keyboardType: editController == state.nameController
|
||||||
? TextInputType.text
|
? TextInputType.text
|
||||||
: TextInputType.number,
|
: TextInputType.number,
|
||||||
@ -657,7 +666,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: ScreenUtil().screenWidth,
|
width: ScreenUtil().screenWidth,
|
||||||
height: 180.h,
|
height: 160.h,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
scrollDirection: Axis.horizontal, //横向滚动
|
scrollDirection: Axis.horizontal, //横向滚动
|
||||||
children: initBottomSheetList()),
|
children: initBottomSheetList()),
|
||||||
@ -725,9 +734,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
return Expanded(
|
return Expanded(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
controller: state.tabController,
|
controller: state.tabController,
|
||||||
children: _itemTabs
|
children:
|
||||||
.map((ItemView item) => Obx(indexChangeWidget))
|
_itemTabs.map((ItemView item) => Obx(indexChangeWidget)).toList(),
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -779,38 +787,29 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () => _jumpSmartDeviceRoute(itemIndex),
|
onTap: () => jumpSmartDeviceRoute(itemIndex),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}
|
//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}
|
||||||
_jumpSmartDeviceRoute(int itemIndex) {
|
Future<void> jumpSmartDeviceRoute(int itemIndex) async {
|
||||||
Get.back();
|
Get.back();
|
||||||
final String pwdShareStr = logic.getShareContentStr();
|
final String pwdShareStr = logic.getShareContentStr();
|
||||||
switch (itemIndex) {
|
switch (itemIndex) {
|
||||||
case 0:
|
case 0: //微信好友
|
||||||
//微信好友
|
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||||
{
|
|
||||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: //短信
|
||||||
//短信
|
case 2: //邮件
|
||||||
{
|
Get.toNamed(Routers.sendEmailNotificationPage,
|
||||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
arguments: <String, Object?>{
|
||||||
}
|
'receiver': '',
|
||||||
|
'channelType': itemIndex == 1 ? 1 : 2,
|
||||||
|
'keyId': CommonDataManage().currentKeyInfo.keyId,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3: //更多
|
||||||
//邮件
|
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||||
{
|
|
||||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
//更多
|
|
||||||
{
|
|
||||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user