diff --git a/.DS_Store b/.DS_Store index c406a585..f2fb2aab 100755 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/ios/.DS_Store b/ios/.DS_Store index e746db5a..bc9ad5a5 100755 Binary files a/ios/.DS_Store and b/ios/.DS_Store differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 641cff53..1b0b0834 100755 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -337,12 +337,12 @@ SPEC CHECKSUMS: flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907 flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82 - fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c + fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db fluwx: c18fd6c16b03a2187cd07d6e48e32a7801962849 google_maps_flutter_ios: f135b968a67c05679e0a53538e900b5c174b0d99 GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb - image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 + image_picker_ios: b545a5f16c0fa88e3ecbbce3ed4de45567a8ec18 ios-voice-processor: 8e32d7f980a06d392d128ef1cd19cf6ddcaca3c1 JCore: 05f0f3489672ea3fa55338bae4866224bc092b1f JPush: 76668b765fcfd7c15f86b05ca0e5cdc01945ce23 @@ -367,4 +367,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc -COCOAPODS: 1.15.2 +COCOAPODS: 1.14.3 diff --git a/lib/appRouters.dart b/lib/appRouters.dart index e4568f10..7e63d7d8 100755 --- a/lib/appRouters.dart +++ b/lib/appRouters.dart @@ -188,9 +188,6 @@ import 'mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.d import 'mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart'; import 'mine/supportStaff/supportStaff_page.dart'; import 'mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart'; -import 'mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_page.dart'; -import 'mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart'; -import 'mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart'; import 'mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart'; import 'mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart'; import 'mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart'; @@ -367,8 +364,6 @@ abstract class Routers { '/NewSMSTemplatePage'; // 增值服务-自定义短信模版 static const String valueAddedServicesListEmailTemplatePage = '/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表 - static const String valueAddedServicesAddEmailTemplatePage = - '/ValueAddedServicesAddEmailTemplatePage'; // 增值服务-自定义邮箱模版 static const String valueAddedServicesBuyAndUseRecordManagePage = '/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录 @@ -889,18 +884,6 @@ abstract class AppRouters { name: Routers.newSMSTemplatePage, page: () => const NewSMSTemplatePage(), ), - GetPage( - name: Routers.valueAddedServicesListEmailTemplatePage, - page: () => const ValueAddedServicesListEmailTemplatePage(), - ), - GetPage( - name: Routers.valueAddedServicesAddEmailTemplatePage, - page: () => const ValueAddedServicesAddEmailTemplatePage(), - ), - GetPage( - name: Routers.valueAddedServicesBuyAndUseRecordManagePage, - page: () => const ValueAddedServicesBuyAndUseRecordManagePage(), - ), GetPage( name: Routers.lockScreenPage, page: () => const LockScreenPage(), diff --git a/lib/blue/io_protocol/io_otaUpgrade.dart b/lib/blue/io_protocol/io_otaUpgrade.dart index 05c30b1c..e8341347 100755 --- a/lib/blue/io_protocol/io_otaUpgrade.dart +++ b/lib/blue/io_protocol/io_otaUpgrade.dart @@ -65,67 +65,62 @@ class OTAUpgradeCommand extends SenderProtocol { @override List messageDetail() { - List data = []; - List ebcData = []; + List data = []; + List ebcData = []; // 指令类型 - int type = commandType!.typeValue; - double typeDouble = type / 256; - int type1 = typeDouble.toInt(); - int type2 = type % 256; + final int type = commandType!.typeValue; + final double typeDouble = type / 256; + final int type1 = typeDouble.toInt(); + final int type2 = type % 256; data.add(type1); data.add(type2); - // 锁id 40 - int lockIDLength = utf8.encode(lockID!).length; + final int lockIDLength = utf8.encode(lockID!).length; data.addAll(utf8.encode(lockID!)); data = getFixedLengthList(data, 40 - lockIDLength); - //userID 20 - int userIDLength = utf8.encode(userID!).length; + final int userIDLength = utf8.encode(userID!).length; data.addAll(utf8.encode(userID!)); data = getFixedLengthList(data, 20 - userIDLength); - //platform 2 - int platform0 = (platform! & 0xFF00) >> 8; - int platform1 = platform! & 0xFF; + final int platform0 = (platform! & 0xFF00) >> 8; + final int platform1 = platform! & 0xFF; data.add(platform0); data.add(platform1); - //product 2 // int product0 = (product! & 0xFF00) >> 8; // int product1 = product! & 0xFF; // data.add(product0); // data.add(product1); - data.addAll([0, 1]); //先默认是 01 - + data.addAll([0, 1]); //先默认是 01 //HwVersion 20 - int hwVersionLength = utf8.encode(hwVersion!).length; + final int hwVersionLength = utf8.encode(hwVersion!).length; data.addAll(utf8.encode(hwVersion!)); data = getFixedLengthList(data, 20 - hwVersionLength); //FwVersion 20 - int fwVersionLength = utf8.encode(fwVersion!).length; + final int fwVersionLength = utf8.encode(fwVersion!).length; data.addAll(utf8.encode(fwVersion!)); data = getFixedLengthList(data, 20 - fwVersionLength); //fwSize 4 - ByteData bytes = ByteData(4); // 创建一个长度为4的字节数据 + final ByteData bytes = ByteData(4); // 创建一个长度为4的字节数据 bytes.setInt32(0, fwSize!); - List byteList = bytes.buffer.asUint8List(); + final List byteList = bytes.buffer.asUint8List(); data.addAll(byteList); // 创建一个16字节的字节数组 - Uint8List result = Uint8List(16); + final Uint8List result = Uint8List(16); // 将每个十六进制字符转换为4位二进制数据,并将其存储到结果字节数组中 for (int i = 0; i < fwMD5!.length; i += 2) { - String hex = fwMD5!.substring(i, i + 2); - int byteValue = int.parse(hex, radix: 16); + final String hex = fwMD5!.substring(i, i + 2); + final int byteValue = int.parse(hex, radix: 16); result[i ~/ 2] = byteValue; } data.addAll(result); @@ -135,7 +130,7 @@ class OTAUpgradeCommand extends SenderProtocol { //AuthCodeLen 1 data.add(0); } else { - List authCodeData = []; + final List authCodeData = []; //KeyID authCodeData.addAll(utf8.encode(keyID!)); @@ -144,19 +139,19 @@ class OTAUpgradeCommand extends SenderProtocol { authCodeData.addAll(utf8.encode(userID!)); //token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 - authCodeData.addAll(token??[]); + authCodeData.addAll(token ?? []); - authCodeData.addAll(signKey??[]); + authCodeData.addAll(signKey ?? []); // 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode - var authCode = crypto.md5.convert(authCodeData); + final crypto.Digest authCode = crypto.md5.convert(authCodeData); data.add(authCode.bytes.length); data.addAll(authCode.bytes); } if ((data.length % 16) != 0) { - int add = (16 - data.length % 16); + final int add = 16 - data.length % 16; for (int i = 0; i < add; i++) { data.add(0); } @@ -164,7 +159,6 @@ class OTAUpgradeCommand extends SenderProtocol { printLog(data); if (encrypt) { - // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864 ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB); return ebcData; @@ -176,7 +170,7 @@ class OTAUpgradeCommand extends SenderProtocol { } class OTAUpgradeReply extends Reply { - List token = []; + List token = []; OTAUpgradeReply.parseData(CommandType commandType, List dataDetail) : super.parseData(commandType, dataDetail) { diff --git a/lib/login/forgetPassword/starLock_forgetPassword_page.dart b/lib/login/forgetPassword/starLock_forgetPassword_page.dart index 27e22275..f71c5186 100755 --- a/lib/login/forgetPassword/starLock_forgetPassword_page.dart +++ b/lib/login/forgetPassword/starLock_forgetPassword_page.dart @@ -231,16 +231,17 @@ class _StarLockForgetPasswordPageState Obx(() { return SubmitBtn( btnName: - "${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}", + '${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}', // backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey], fontSize: 30.sp, borderRadius: 20.w, padding: EdgeInsets.only(top: 25.w, bottom: 25.w), isDisabled: state.canSub.value, onClick: state.canSub.value - ? () { + ? () async { final bool isNetWork = - LockMainLogic.to()?.judgeTheNetwork() ?? false; + await LockMainLogic.to()?.judgeTheNetwork() ?? + false; if (!isNetWork) { return; } diff --git a/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart b/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart index ae08975b..307d6feb 100755 --- a/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart +++ b/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart @@ -188,9 +188,10 @@ class _StarLockForgetPasswordPageState padding: EdgeInsets.only(top: 25.w, bottom: 25.w), isDisabled: state.canSub.value, onClick: state.canSub.value - ? () { + ? () async { final bool isNetWork = - LockMainLogic.to()?.judgeTheNetwork() ?? false; + await LockMainLogic.to()?.judgeTheNetwork() ?? + false; if (!isNetWork) { return; } diff --git a/lib/login/login/starLock_login_page.dart b/lib/login/login/starLock_login_page.dart index edf5acfd..671b746f 100755 --- a/lib/login/login/starLock_login_page.dart +++ b/lib/login/login/starLock_login_page.dart @@ -146,7 +146,7 @@ class _StarLockLoginPageState extends State { ), ), hintText: - "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}", + '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}', inputFormatters: [ LengthLimitingTextInputFormatter(20), ]), diff --git a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index 47a682c4..5fa6bac4 100755 --- a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -5,11 +5,10 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_settings.dart'; -import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart'; -import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart'; import 'package:star_lock/tools/NativeInteractionTool.dart'; import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/showCupertinoAlertView.dart'; @@ -244,7 +243,7 @@ class AuthorizedAdminLogic extends BaseGetXController { //检测实名认证是否支持开启 Future keyCheckFace() async { - final AdvancedFunctionRecordEntity entity = + final ValueAddedServicesHighFunctionEntity entity = await ApiRepository.to.keyCheckFace( lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, ); diff --git a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart index 27ce36ff..d34eec38 100755 --- a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -364,7 +364,8 @@ class _AuthorizedAdminPageState extends State 'receiver': state.emailOrPhoneController.text, 'channelType': state.emailOrPhoneController.text.contains('@') ? 2 : 1, - 'keyId': logic.keyId + 'keyId': logic.keyId, + 'unlockType': 1, }); }, ), @@ -501,18 +502,37 @@ class _AuthorizedAdminPageState extends State ); } - void _openModalBottomSheet() { + Future _openModalBottomSheet() async { showModalBottomSheet( context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 270.h), + constraints: BoxConstraints(maxHeight: 323.h), builder: (BuildContext context) { return Column( children: [ - SizedBox( + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), width: ScreenUtil().screenWidth, - height: 180.h, + child: Center( + child: Text( + '分享', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.w500), + ), + ), + ), + const Divider( + height: 1, + color: AppColors.greyLineColor, + ), + Container( + width: ScreenUtil().screenWidth, + height: 160.h, + color: Colors.white, child: ListView( scrollDirection: Axis.horizontal, //横向滚动 children: initBottomSheetList()), @@ -521,18 +541,23 @@ class _AuthorizedAdminPageState extends State height: 8.h, color: AppColors.greyBackgroundColor, ), - TextButton( - style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.white)), - child: Text( - '取消'.tr, - style: TextStyle( - color: Colors.black, fontSize: ScreenUtil().setSp(24)), + Container( + color: Colors.white, + margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0), + width: ScreenUtil().screenWidth, + child: TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消'.tr, + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, ), - onPressed: () { - Navigator.pop(context); - }, ) ], ); @@ -600,7 +625,14 @@ class _AuthorizedAdminPageState extends State case 2: //邮件 { - Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + Get.toNamed(Routers.sendEmailNotificationPage, + arguments: { + 'receiver': state.emailOrPhoneController.text, + 'channelType': + state.emailOrPhoneController.text.contains('@') ? 2 : 1, + 'keyId': logic.keyId, + 'unlockType': 1, + }); } break; case 3: diff --git a/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart b/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart index d6d951ca..08b2b7e9 100755 --- a/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart +++ b/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -43,11 +42,13 @@ class _CardDetailPageState extends State with RouteAware { children: [ Obx(() => CommonItem( leftTitel: - '${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}', + '${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}', rightTitle: state.typeNumber.value, isHaveDirection: false, isHaveLine: true)), - Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr,state.typeName.value, () { + Obx(() => lockDataListItem( + TranslationLoader.lanKeys!.name!.tr, state.typeName.value, + () { ShowTipView().showTFViewAlertDialog( state.changeNameController, '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}', @@ -63,12 +64,11 @@ class _CardDetailPageState extends State with RouteAware { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(50), ]); - })), Obx(() => Visibility( visible: state.keyType.value == 4 || - state.keyType.value == 2 || - state.keyType.value == 1, + state.keyType.value == 2 || + state.keyType.value == 1, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, allHeight: 70.h, @@ -76,26 +76,32 @@ class _CardDetailPageState extends State with RouteAware { isHaveDirection: true, isHaveLine: true, action: () async { - if(state.keyType.value == 2 || state.keyType.value == 1){ + if (state.keyType.value == 2 || state.keyType.value == 1) { // 限时 - var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: { - 'pushType': 0, - 'fingerprintItemData': state.fingerprintItemData.value, - }); - if(data != null) { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeDatePage, + arguments: { + 'pushType': 0, + 'fingerprintItemData': + state.fingerprintItemData.value, + }); + if (data != null) { setState(() { state.startDate.value = data['beginTimeTimestamp']; state.endDate.value = data['endTimeTimestamp']; state.keyType.value = 2; }); } - }else if(state.keyType.value == 4){ + } else if (state.keyType.value == 4) { // 循环 - var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: { - 'pushType': 0, - 'fingerprintItemData': state.fingerprintItemData.value, - }); - if(data != null) { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + 'pushType': 0, + 'fingerprintItemData': + state.fingerprintItemData.value, + }); + if (data != null) { setState(() { state.startDate.value = data['starDate']; state.endDate.value = data['endDate']; @@ -114,11 +120,14 @@ class _CardDetailPageState extends State with RouteAware { isHaveDirection: true, isHaveLine: true, action: () async { - var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: { - 'pushType': 0, - 'fingerprintItemData': state.fingerprintItemData.value, - }); - if(data != null) { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + 'pushType': 0, + 'fingerprintItemData': + state.fingerprintItemData.value, + }); + if (data != null) { setState(() { state.startDate.value = data['starDate']; state.endDate.value = data['endDate']; @@ -132,14 +141,18 @@ class _CardDetailPageState extends State with RouteAware { visible: state.keyType.value == 4, child: Obx(() => CommonItem( leftTitel: '有效时间'.tr, - rightTitle: '${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}', + rightTitle: + '${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}', isHaveDirection: true, action: () async { - var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: { - 'pushType': 0, - 'fingerprintItemData': state.fingerprintItemData.value, - }); - if(data != null) { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + 'pushType': 0, + 'fingerprintItemData': + state.fingerprintItemData.value, + }); + if (data != null) { setState(() { state.startDate.value = data['starDate']; state.endDate.value = data['endDate']; @@ -182,11 +195,12 @@ class _CardDetailPageState extends State with RouteAware { rightTitle: '', isHaveDirection: true, action: () { - Get.toNamed(Routers.lockOperatingRecordPage, arguments: { - 'type': 2, - 'id': state.fingerprintItemData.value.cardId.toString(), - 'recordName': state.fingerprintItemData.value.cardName - }); + Get.toNamed(Routers.lockOperatingRecordPage, + arguments: { + 'type': 2, + 'id': state.fingerprintItemData.value.cardId.toString(), + 'recordName': state.fingerprintItemData.value.cardName + }); }), // SizedBox(height: 40.h), // addControlsBtn(type), @@ -195,15 +209,18 @@ class _CardDetailPageState extends State with RouteAware { btnName: TranslationLoader.lanKeys!.delete!.tr, isDelete: true, borderRadius: 20.w, - margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), + 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: () { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + onClick: () async { + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } - ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async { + ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, + () async { state.isDeletCard.value = true; logic.senderAddICCard(); }); @@ -213,12 +230,14 @@ class _CardDetailPageState extends State with RouteAware { ); } - Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){ + Widget lockDataListItem( + String leftTitle, String conentStr, Function()? action) { return GestureDetector( onTap: action, child: Container( // height: 70.h, - padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h), + padding: + EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h), decoration: BoxDecoration( color: Colors.white, border: Border( @@ -226,15 +245,17 @@ class _CardDetailPageState extends State with RouteAware { color: AppColors.greyLineColor, // 设置边框颜色 width: 2.0.h, // 设置边框宽度 ), - ) - ), + )), child: Row( children: [ Text(leftTitle, style: TextStyle(fontSize: 22.sp)), SizedBox(width: 10.w), Expanded( - child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, )) - ), + child: Text(conentStr, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 22.sp, + ))), SizedBox(width: 10.w), Image.asset( 'images/icon_right_grey.png', @@ -282,6 +303,7 @@ class _CardDetailPageState extends State with RouteAware { @override void didChangeDependencies() { super.didChangeDependencies(); + /// 路由订阅 AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); } diff --git a/lib/main/lockDetail/card/cardList/cardList_page.dart b/lib/main/lockDetail/card/cardList/cardList_page.dart index 6731b623..ae3558d7 100755 --- a/lib/main/lockDetail/card/cardList/cardList_page.dart +++ b/lib/main/lockDetail/card/cardList/cardList_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -70,7 +69,8 @@ class _CardListPageState extends State with RouteAware { onPressed: () async { final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } @@ -145,8 +145,10 @@ class _CardListPageState extends State with RouteAware { motion: const ScrollMotion(), children: [ SlidableAction( - onPressed: (BuildContext context) { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + onPressed: (BuildContext context) async { + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? + false; if (!isNetWork) { return; } diff --git a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart index 1a939a7a..a04a16ab 100755 --- a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart +++ b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart @@ -6,7 +6,6 @@ import '../checkingInSetStaffList/checkingInStaffList_entity.dart'; import 'checkingInAddStaffSelectKey_entity.dart'; class CheckingInAddStaffState { - CheckingInAddStaffState() { final Map map = Get.arguments; getKeyInfosData.value = map['getKeyInfosData']; @@ -43,8 +42,15 @@ class CheckingInAddStaffState { } else { appUnHaveAccount.value = true; } + + if ((staffListItemData.value.cardStatus ?? 0) == 1) { + //打卡方式是否是正常状态 + appUnHaveAccount.value = true; + attendanceWayNumber.value = ''; + } } } + final Rx getKeyInfosData = LockListInfoItemEntity().obs; final RxString companyId = ''.obs; diff --git a/lib/main/lockDetail/doorLockLog/doorLockLog_entity.dart b/lib/main/lockDetail/doorLockLog/doorLockLog_entity.dart index e043b762..74395fbf 100755 --- a/lib/main/lockDetail/doorLockLog/doorLockLog_entity.dart +++ b/lib/main/lockDetail/doorLockLog/doorLockLog_entity.dart @@ -72,7 +72,8 @@ class DoorLockLogDataItem { this.videoUrl, this.headUrl, this.userid, - this.keyboardPwd}); + this.keyboardPwd, + this.recordStr}); DoorLockLogDataItem.fromJson(Map json) { recordId = json['recordId']; @@ -87,6 +88,7 @@ class DoorLockLogDataItem { headUrl = json['headUrl']; userid = json['userid']; keyboardPwd = json['keyboardPwd']; + recordStr = json['recordStr']; } int? recordId; int? lockId; @@ -100,6 +102,7 @@ class DoorLockLogDataItem { String? headUrl; String? userid; String? keyboardPwd; + String? recordStr; Map toJson() { final Map data = {}; @@ -115,6 +118,7 @@ class DoorLockLogDataItem { data['headUrl'] = headUrl; data['userid'] = userid; data['keyboardPwd'] = keyboardPwd; + data['recordStr'] = recordStr; return data; } } diff --git a/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart b/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart index 63c87ed3..7c076e8e 100755 --- a/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart +++ b/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart @@ -281,7 +281,8 @@ class _DoorLockLogPageState extends State with RouteAware { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - '$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}操作" : ""}${timelineData.recordTypeName}', + // '$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}操作" : ""}${timelineData.recordTypeName}', + timelineData.recordStr ?? '', textAlign: TextAlign.left, style: TextStyle( color: Colors.black, diff --git a/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index e48c8f0f..bb24a222 100755 --- a/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; @@ -6,7 +5,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; -import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/showCupertinoAlertView.dart'; @@ -148,7 +147,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController { Future checkRealNameStatus(int realNameAuthStatus) async { //打开实名认证 必须输入身份证号和真实姓名 if (realNameAuthStatus == 1) { - final AdvancedFunctionRecordEntity entity = + final ValueAddedServicesHighFunctionEntity entity = await ApiRepository.to.keyCheckFace( lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, ); @@ -397,7 +396,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController { //检测实名认证是否支持开启 Future keyCheckFace() async { - final AdvancedFunctionRecordEntity entity = + final ValueAddedServicesHighFunctionEntity entity = await ApiRepository.to.keyCheckFace( lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, ); diff --git a/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index df183855..c3ca83fd 100755 --- a/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -69,7 +69,7 @@ class _ElectronicKeyListPageState extends State { await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { final bool isNetWork = - LockMainLogic.to()?.judgeTheNetwork() ?? false; + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart index c0317682..0f5ef873 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart @@ -5,7 +5,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.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/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/NativeInteractionTool.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -205,7 +205,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController { //检测实名认证是否支持开启 Future keyCheckFace() async { - final AdvancedFunctionRecordEntity entity = + final ValueAddedServicesHighFunctionEntity entity = await ApiRepository.to.keyCheckFace( lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, ); diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart index 3ee28f49..36c12a05 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart @@ -424,7 +424,8 @@ class _SendElectronicKeyViewState extends State arguments: { 'receiver': logic.emailOrPhone, 'channelType': logic.state.userNameType.value, - 'keyId': logic.keyId + 'keyId': logic.keyId, + 'unlockType': 1 }); }, ), @@ -582,18 +583,37 @@ class _SendElectronicKeyViewState extends State ); } - Future _openModalBottomSheet() async { + Future _openModalBottomSheet() async { showModalBottomSheet( context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 270.h), + constraints: BoxConstraints(maxHeight: 323.h), builder: (BuildContext context) { return Column( - children: [ - SizedBox( + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), width: ScreenUtil().screenWidth, - height: 180.h, + child: Center( + child: Text( + '分享', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.w500), + ), + ), + ), + const Divider( + height: 1, + color: AppColors.greyLineColor, + ), + Container( + width: ScreenUtil().screenWidth, + height: 160.h, + color: Colors.white, child: ListView( scrollDirection: Axis.horizontal, //横向滚动 children: initBottomSheetList()), @@ -602,18 +622,23 @@ class _SendElectronicKeyViewState extends State height: 8.h, color: AppColors.greyBackgroundColor, ), - TextButton( - style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.white)), - child: Text( - '取消'.tr, - style: TextStyle( - color: Colors.black, fontSize: ScreenUtil().setSp(24)), + Container( + color: Colors.white, + margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0), + width: ScreenUtil().screenWidth, + child: TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消'.tr, + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, ), - onPressed: () { - Navigator.pop(context); - }, ) ], ); @@ -675,7 +700,8 @@ class _SendElectronicKeyViewState extends State break; case 2: //邮件 - Get.toNamed(Routers.sendEmailNotificationPage); + Get.toNamed(Routers.sendEmailNotificationPage, + arguments: {'unlockType': 1}); break; case 3: //更多 diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart index d35e5e71..2fdfe8d9 100644 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart @@ -13,12 +13,18 @@ class SendEmailNotificationLogic extends BaseGetXController { //获取电子钥匙通知模板 渠道:1短信 2邮箱 Future getKeyNoticeTemplate() async { - final SendEmailNotificationEntity entity = - await ApiRepository.to.getKeyNoticeTemplate( - lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, - keyId: state.getKeyId.value, - channelType: state.channelType.value, - ); + final SendEmailNotificationEntity entity; + if (state.unlockType.value == 1) { + entity = await ApiRepository.to.getKeyNoticeTemplate( + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + keyId: state.getKeyId.value, + channelType: state.channelType.value); + } else { + entity = await ApiRepository.to.getPwdNoticeTemplate( + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + keyboardPwdId: state.getKeyId.value, + channelType: state.channelType.value); + } if (entity.errorCode!.codeIsSuccessful) { state.emailTemplateList.value = entity.data?.list ?? []; @@ -37,17 +43,32 @@ class SendEmailNotificationLogic extends BaseGetXController { showToast('请输入接收者'); return; } - final SendEmailNotificationEntity entity = - await ApiRepository.to.keyNoticeSubmit( - receiverName: state.getReceiver.value.isEmpty - ? state.receiverController.text - : state.getReceiver.value, - lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, - keyId: state.getKeyId.value, - channelType: state.channelType.value, - openDoorType: 1, - templateType: state.currentNotifyItem.value.type ?? '', - ); + final SendEmailNotificationEntity entity; + if (state.unlockType.value == 1) { + entity = await ApiRepository.to.keyNoticeSubmit( + receiverName: state.getReceiver.value.isEmpty + ? state.receiverController.text + : state.getReceiver.value, + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + keyId: state.getKeyId.value, + channelType: state.channelType.value, + openDoorType: state.unlockType.value, + templateType: state.currentNotifyItem.value.type ?? '', + countryCode: state.countryCode.value, + ); + } else { + entity = await ApiRepository.to.pwdNoticeSubmit( + receiverName: state.getReceiver.value.isEmpty + ? state.receiverController.text + : state.getReceiver.value, + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + keyboardPwdId: state.getKeyId.value, + channelType: state.channelType.value, + openDoorType: state.unlockType.value, + templateType: state.currentNotifyItem.value.type ?? '', + countryCode: state.countryCode.value, + ); + } if (entity.errorCode!.codeIsSuccessful) { showToast('发送成功'); Get.back(); diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart index fe5b42dd..efd97a26 100755 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.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_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; @@ -82,52 +84,77 @@ class _SendEmailNotificationPageState extends State { }, )), Container( - height: 360.h, + // height: 360.h, color: Colors.white, padding: EdgeInsets.only( left: 20.w, right: 20.w, top: 20.h, bottom: 20.h), - child: TextField( - maxLines: 8, - maxLength: 1000, - textAlign: TextAlign.start, - controller: state.templateContentController, - style: TextStyle( - color: Colors.black, - fontSize: 22.sp, - ), - decoration: InputDecoration( - border: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), + child: Column( + children: [ + TextField( + maxLines: 8, + maxLength: 1000, + textAlign: TextAlign.start, + controller: state.templateContentController, + style: TextStyle( + color: Colors.black, + fontSize: 22.sp, + ), + decoration: InputDecoration( + border: OutlineInputBorder( + ///设置边框四个角的弧度 + borderRadius: BorderRadius.all(Radius.circular(20.h)), - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), + ///用来配置边框的样式 + borderSide: const BorderSide( + ///设置边框的颜色 + color: Color(0xffB2B2B2), - ///设置边框的粗细 - width: 0.5, + ///设置边框的粗细 + width: 0.5, + ), + ), + + ///用来配置输入框获取焦点时的颜色 + focusedBorder: OutlineInputBorder( + ///设置边框四个角的弧度 + borderRadius: BorderRadius.all(Radius.circular(20.h)), + + ///用来配置边框的样式 + borderSide: const BorderSide( + ///设置边框的颜色 + color: Color(0xffB2B2B2), + + ///设置边框的粗细 + width: 1, + ), + ), ), ), - - ///用来配置输入框获取焦点时的颜色 - focusedBorder: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), - - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), - - ///设置边框的粗细 - width: 1, - ), - ), - ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + GestureDetector( + onTap: () { + Clipboard.setData(ClipboardData( + text: state.templateContentController.text)); + EasyLoading.showToast('复制成功'.tr); + }, + child: Container( + margin: EdgeInsets.only(left: 20.w, top: 0), + child: const Icon( + Icons.copy, + color: Colors.blue, + ), + ), + ) + ], + ) + ], ), ), - Container(height: 40.h), + _buildNewTemplateBtn(), + SizedBox(height: 40.h), SubmitBtn( btnName: '发送'.tr, fontSize: 28.sp, @@ -144,7 +171,42 @@ class _SendEmailNotificationPageState extends State { ], ), ), - ); } + ); + } + + Widget _buildNewTemplateBtn() { + return GestureDetector( + child: Container( + height: 60.h, + margin: EdgeInsets.only(left: 0.w, right: 0.w), + color: Colors.white, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'images/icon_btn_add.png', + width: 28.w, + height: 28.w, + ), + SizedBox( + width: 6.w, + ), + Text( + '新建模版', + style: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold), + ) + ], + ), + ), + onTap: () { + Get.toNamed(Routers.newSMSTemplatePage); + }, + ); + } Widget _buildReceiverItemWidget() { return Container( @@ -165,7 +227,7 @@ class _SendEmailNotificationPageState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ Obx(() => Text( - '+${state.countryCode.value}', + '+${state.countryCode.value.toString()}', style: TextStyle( color: AppColors.darkGrayTextColor, fontSize: 20.sp), @@ -183,7 +245,7 @@ class _SendEmailNotificationPageState extends State { await Get.toNamed(Routers.selectCountryRegionPage); if (result != null) { result as Map; - state.countryCode.value = result['code']; + state.countryCode.value = int.parse(result['code']); state.countryName.value = result['countryName']; } }, @@ -191,6 +253,32 @@ class _SendEmailNotificationPageState extends State { else Container(), getReceiverTFWidget(), + Container( + width: 32.w, + height: 32.w, + decoration: const BoxDecoration( + color: Colors.white, + image: DecorationImage( + image: AssetImage('images/icon_addressBook.png'), + fit: BoxFit.fill), + ), + alignment: Alignment.center, + child: InkWell( + onTap: () async { + final Contact? currentContact = + await logic.state.contactPicker.selectContact(); + logic.state.contact = currentContact!; + if (currentContact.phoneNumbers!.isNotEmpty) { + logic.state.receiverController.text = currentContact + .phoneNumbers![0] + .replaceAll(RegExp(r'\s+\b|\b\s'), ''); + } + // if (currentContact.fullName!.isNotEmpty) { + // logic.state.keyNameController.text = currentContact.fullName!; + // } + }, + ), + ) ], ), ); @@ -210,7 +298,7 @@ class _SendEmailNotificationPageState extends State { maxLines: 1, inputFormatters: [ FilteringTextInputFormatter.deny('\n'), - LengthLimitingTextInputFormatter(30), + LengthLimitingTextInputFormatter(50), ], autofocus: false, textAlign: TextAlign.end, diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart index c8ee4630..f253f513 100644 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart'; @@ -12,6 +13,10 @@ class SendEmailNotificationState { getKeyId.value = Get.arguments['keyId']; } + if (Get.arguments['unlockType'] != null) { + unlockType.value = Get.arguments['unlockType']; + } + if (Get.arguments['channelType'] != null) { channelType.value = Get.arguments['channelType']; updateNotifyTypeText(); @@ -29,8 +34,11 @@ class SendEmailNotificationState { [].obs; Rx currentNotifyItem = EmailNotificationItem().obs; RxInt getKeyId = 0.obs; //获取钥匙成功得到的keyId - RxString countryCode = '86'.obs; + RxInt countryCode = 86.obs; RxString countryName = '中国'.obs; + late Contact contact; + final FlutterContactPicker contactPicker = FlutterContactPicker(); + RxInt unlockType = 0.obs; //开锁方式 1:电子钥匙 2:密码 Future updateNotifyTypeText() async { if (channelType.value == 1) { diff --git a/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart b/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart index 8ba6a825..4556f2bf 100755 --- a/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart +++ b/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -207,8 +206,9 @@ class _FaceDetailPageState extends State with RouteAware { 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: () { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + onClick: () async { + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } diff --git a/lib/main/lockDetail/face/faceList/faceList_page.dart b/lib/main/lockDetail/face/faceList/faceList_page.dart index e923b267..825af7f2 100755 --- a/lib/main/lockDetail/face/faceList/faceList_page.dart +++ b/lib/main/lockDetail/face/faceList/faceList_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -68,7 +67,8 @@ class _FaceListPageState extends State with RouteAware { onPressed: () async { final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } @@ -115,11 +115,11 @@ class _FaceListPageState extends State with RouteAware { btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}', onClick: () async { - final data = - await Get.toNamed(Routers.addFaceTypePage, arguments: { - 'lockId': state.lockId.value, - 'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入 - }); + final data = await Get.toNamed(Routers.addFaceTypePage, + arguments: { + 'lockId': state.lockId.value, + 'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + }); if (data != null) { logic.pageNo = 1; getHttpData(); @@ -158,10 +158,10 @@ class _FaceListPageState extends State with RouteAware { getFaceItemData.faceName!, logic.getKeyType(getFaceItemData), logic.getKeyDateType(getFaceItemData), () async { - final data = - await Get.toNamed(Routers.faceDetailPage, arguments: { - 'faceItemData': getFaceItemData, - }); + final data = await Get.toNamed(Routers.faceDetailPage, + arguments: { + 'faceItemData': getFaceItemData, + }); if (data != null) { logic.pageNo = 1; getHttpData(); @@ -184,8 +184,9 @@ class _FaceListPageState extends State with RouteAware { Widget _buildDeleteBtn(FingerprintItemData faceItemData) { return GestureDetector( - onTap: () { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + onTap: () async { + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } diff --git a/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart b/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart index 358b4712..096c7c3a 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart @@ -43,11 +43,13 @@ class _FingerprintDetailPageState extends State children: [ Obx(() => CommonItem( leftTitel: - '${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}', + '${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}', rightTitle: state.typeNumber.value, isHaveDirection: false, isHaveLine: true)), - Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, state.typeName.value, () { + Obx(() => lockDataListItem( + TranslationLoader.lanKeys!.name!.tr, state.typeName.value, + () { ShowTipView().showTFViewAlertDialog( state.changeNameController, '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}', @@ -66,8 +68,8 @@ class _FingerprintDetailPageState extends State })), Obx(() => Visibility( visible: state.keyType.value == 4 || - state.keyType.value == 2 || - state.keyType.value == 1, + state.keyType.value == 2 || + state.keyType.value == 1, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, allHeight: 70.h, @@ -149,7 +151,8 @@ class _FingerprintDetailPageState extends State Routers.otherTypeKeyChangeValidityDatePage, arguments: { 'pushType': 1, - 'fingerprintItemData': state.fingerprintItemData.value, + 'fingerprintItemData': + state.fingerprintItemData.value, }); if (data != null) { setState(() { @@ -195,11 +198,14 @@ class _FingerprintDetailPageState extends State isHaveDirection: true, action: () { // 指纹 - Get.toNamed(Routers.lockOperatingRecordPage, arguments: { - 'type': 3, - 'id': state.fingerprintItemData.value.fingerprintId.toString(), - 'recordName': state.fingerprintItemData.value.fingerprintName - }); + Get.toNamed(Routers.lockOperatingRecordPage, + arguments: { + 'type': 3, + 'id': state.fingerprintItemData.value.fingerprintId + .toString(), + 'recordName': + state.fingerprintItemData.value.fingerprintName + }); }), // SizedBox(height: 40.h), // addControlsBtn(type), @@ -211,8 +217,9 @@ class _FingerprintDetailPageState extends State 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: () { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + onClick: () async { + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } @@ -228,12 +235,14 @@ class _FingerprintDetailPageState extends State ); } - Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){ + Widget lockDataListItem( + String leftTitle, String conentStr, Function()? action) { return GestureDetector( onTap: action, child: Container( // height: 70.h, - padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h), + padding: + EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h), decoration: BoxDecoration( color: Colors.white, border: Border( @@ -241,15 +250,17 @@ class _FingerprintDetailPageState extends State color: AppColors.greyLineColor, // 设置边框颜色 width: 2.0.h, // 设置边框宽度 ), - ) - ), + )), child: Row( children: [ Text(leftTitle, style: TextStyle(fontSize: 22.sp)), SizedBox(width: 10.w), Expanded( - child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, )) - ), + child: Text(conentStr, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 22.sp, + ))), SizedBox(width: 10.w), Image.asset( 'images/icon_right_grey.png', diff --git a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart index f3e80240..c3ba3bb0 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart @@ -70,7 +70,8 @@ class _FingerprintListPageState extends State onPressed: () async { final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } @@ -144,11 +145,14 @@ class _FingerprintListPageState extends State extentRatio: 0.2, motion: const ScrollMotion(), children: [ - SlidableAction(onPressed: (BuildContext context) { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; - if (!isNetWork) { - return; - } + SlidableAction( + onPressed: (BuildContext context) async { + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? + false; + if (!isNetWork) { + return; + } ShowTipView().showIosTipWithContentDialog( '确定要删除吗?'.tr, () async { state.isDeletAll = false; diff --git a/lib/main/lockDetail/iris/irisList/irisList_page.dart b/lib/main/lockDetail/iris/irisList/irisList_page.dart index bc4f4fe8..1be0a00f 100755 --- a/lib/main/lockDetail/iris/irisList/irisList_page.dart +++ b/lib/main/lockDetail/iris/irisList/irisList_page.dart @@ -46,7 +46,7 @@ class _IrisListPageState extends State { final isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { final bool isNetWork = - LockMainLogic.to()?.judgeTheNetwork() ?? false; + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart index b49677af..32c64d23 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1345,7 +1345,8 @@ class _LockDetailPageState extends State final double textSizeWidth = textPainter.size.width; // 获取文本的尺寸 if (textSizeWidth > 358.w * 2 - 20) { - lockAlias = '${lockAlias.substring(0, 25)}...'; + lockAlias = + '${lockAlias.substring(0, lockAlias.length > 25 ? 25 : lockAlias.length)}...'; } return Center( child: Stack( @@ -1430,11 +1431,11 @@ class _LockDetailPageState extends State } } - void startOpenLock() { + Future startOpenLock() async { if (state.openLockBtnState.value == 1) { return; } - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + final bool isNetWork = await LockMainLogic.to()?.judgeTheNetwork() ?? false; final bool isOpenLockNeedOnline = state.isOpenLockNeedOnline.value == 0; if (!isOpenLockNeedOnline && !isNetWork) { return; diff --git a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart index 47e04211..c820e949 100755 --- a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart +++ b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart @@ -76,7 +76,7 @@ class LockEscalationLogic extends BaseGetXController { } //蓝牙操作 ota 升级 - void blueOTAUpgrade(Map data, List token) { + void blueOTAUpgrade(Map data, List token) { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { @@ -92,8 +92,8 @@ class LockEscalationLogic extends BaseGetXController { lockID: BlueManage().connectDeviceName, userID: uid, keyID: BlueManage().connectDeviceName, - platform: int.tryParse(data['platform']) ?? 0, - product: int.tryParse(data['product']) ?? 0, + platform: int.tryParse(data['platform'] ?? '0') ?? 0, + product: int.tryParse(data['product'] ?? '0') ?? 0, hwVersion: data['hwVersion'], fwVersion: data['fwVersion'], fwSize: data['fwSize'], diff --git a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_page.dart b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_page.dart index cb8ffcb9..f9895168 100755 --- a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_page.dart +++ b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_page.dart @@ -182,17 +182,7 @@ class _LockEscalationPageState extends State { height: 20.h, ), Text( - '${'机型'.tr}:${logic.headJson?['platform']}-${logic.headJson?['product']}', - style: TextStyle( - color: AppColors.blackColor, - fontSize: 22.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 10.h, - ), - Text( - '${'硬件版本'.tr}:${logic.headJson?['hwVersion']}', + '${'机型'.tr}:${logic.headJson?['platform']}', style: TextStyle( color: AppColors.blackColor, fontSize: 22.sp, diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index 411ce532..5258cf72 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -158,13 +158,13 @@ class _LockSetPageState extends State with RouteAware { child: SubmitBtn( btnName: TranslationLoader.lanKeys!.delete!.tr, isDelete: true, - onClick: () { + onClick: () async { // logic.deletUserAction(); // logic.deletLockInfoData(); // showDeletAlertDialog(context); // showDeletPasswordAlertDialog(context); final bool isNetWork = - LockMainLogic.to()?.judgeTheNetwork() ?? false; + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } diff --git a/lib/main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart b/lib/main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart index ca725531..c833785f 100755 --- a/lib/main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart +++ b/lib/main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart @@ -35,9 +35,9 @@ class _WirelessKeyboardPageState extends State { TranslationLoader.lanKeys!.reset!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), ), - onPressed: () { + onPressed: () async { final bool isNetWork = - LockMainLogic.to()?.judgeTheNetwork() ?? false; + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } diff --git a/lib/main/lockDetail/palm/palmList/palmList_page.dart b/lib/main/lockDetail/palm/palmList/palmList_page.dart index 18e153a0..df52b2cc 100755 --- a/lib/main/lockDetail/palm/palmList/palmList_page.dart +++ b/lib/main/lockDetail/palm/palmList/palmList_page.dart @@ -46,7 +46,7 @@ class _PalmListPageState extends State { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { final bool isNetWork = - LockMainLogic.to()?.judgeTheNetwork() ?? false; + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } @@ -106,7 +106,7 @@ class _PalmListPageState extends State { // 人脸 if (index < state.faceItemListData.value.length) { return LeftSlideActions( - tag:getFaceItemData.faceName!, + tag: getFaceItemData.faceName!, key: Key(getFaceItemData.faceName!), actionsWidth: 60, actions: [ diff --git a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 81ff813e..10976c4b 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -48,7 +47,7 @@ class _PasswordKeyDetailPageState extends State height: 30.h, width: 30.w, ), - onPressed: openModalBottomSheet, + onPressed: _openModalBottomSheet, ), ], ), @@ -86,9 +85,11 @@ class _PasswordKeyDetailPageState extends State // showCupertinoAlertDialog( // context, state.inputNameController); // })), - Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, state.keyboardPwdName.value, (){ - showCupertinoAlertDialog(context, state.inputNameController); - })), + Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, + state.keyboardPwdName.value, () { + showCupertinoAlertDialog( + context, state.inputNameController); + })), Obx(() => CommonItem( leftTitel: '有效期', rightTitle: logic.getUseDateStr(), @@ -243,8 +244,9 @@ class _PasswordKeyDetailPageState extends State 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: () { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + onClick: () async { + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } @@ -295,12 +297,14 @@ class _PasswordKeyDetailPageState extends State ); } - Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){ + Widget lockDataListItem( + String leftTitle, String conentStr, Function()? action) { return GestureDetector( onTap: action, child: Container( // height: 70.h, - padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h), + padding: + EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h), decoration: BoxDecoration( color: Colors.white, border: Border( @@ -308,15 +312,17 @@ class _PasswordKeyDetailPageState extends State color: AppColors.greyLineColor, // 设置边框颜色 width: 2.0.h, // 设置边框宽度 ), - ) - ), + )), child: Row( children: [ Text(leftTitle, style: TextStyle(fontSize: 22.sp)), SizedBox(width: 10.w), Expanded( - child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, )) - ), + child: Text(conentStr, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 22.sp, + ))), SizedBox(width: 10.w), Image.asset( 'images/icon_right_grey.png', @@ -387,18 +393,37 @@ class _PasswordKeyDetailPageState extends State ); } - Future openModalBottomSheet() async { + Future _openModalBottomSheet() async { showModalBottomSheet( context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 270.h), + constraints: BoxConstraints(maxHeight: 323.h), builder: (BuildContext context) { return Column( children: [ - SizedBox( + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), + width: ScreenUtil().screenWidth, + child: Center( + child: Text( + '分享', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.w500), + ), + ), + ), + const Divider( + height: 1, + color: AppColors.greyLineColor, + ), + Container( width: ScreenUtil().screenWidth, height: 160.h, + color: Colors.white, child: ListView( scrollDirection: Axis.horizontal, //横向滚动 children: initBottomSheetList()), @@ -407,18 +432,23 @@ class _PasswordKeyDetailPageState extends State height: 8.h, color: AppColors.greyBackgroundColor, ), - TextButton( - style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.white)), - child: Text( - '取消'.tr, - style: TextStyle( - color: Colors.black, fontSize: ScreenUtil().setSp(24)), + Container( + color: Colors.white, + margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0), + width: ScreenUtil().screenWidth, + child: TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消'.tr, + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, ), - onPressed: () { - Navigator.pop(context); - }, ) ], ); @@ -480,7 +510,8 @@ class _PasswordKeyDetailPageState extends State arguments: { 'receiver': '', 'channelType': itemIndex == 1 ? 1 : 2, - 'keyId': CommonDataManage().currentKeyInfo.keyId, + 'keyId': state.itemData.value.keyboardPwdId, + 'unlockType': 2 }); break; case 3: //更多 diff --git a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index 33ccdc4d..ccc90b5b 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -68,7 +68,8 @@ class _PasswordKeyListPageState extends State final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } @@ -154,8 +155,10 @@ class _PasswordKeyListPageState extends State motion: const ScrollMotion(), children: [ SlidableAction( - onPressed: (BuildContext context) { - final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false; + onPressed: (BuildContext context) async { + final bool isNetWork = + await LockMainLogic.to()?.judgeTheNetwork() ?? + false; if (!isNetWork) { return; } diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index e7e632c1..4b1357b2 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -146,6 +146,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { state.pwdController.text = ''; if (entity.data != null) { state.getPwdStr.value = entity.data!.keyboardPwd!; + state.getPwdID.value = entity.data!.keyboardPwdId!; } eventBus.fire(GetPasswordListRefreshUI()); } diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index e39af607..aa13b173 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -660,13 +661,32 @@ class _PasswordKeyPerpetualPageState extends State context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 270.h), + constraints: BoxConstraints(maxHeight: 323.h), builder: (BuildContext context) { return Column( children: [ - SizedBox( + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), + width: ScreenUtil().screenWidth, + child: Center( + child: Text( + '分享', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.w500), + ), + ), + ), + const Divider( + height: 1, + color: AppColors.greyLineColor, + ), + Container( width: ScreenUtil().screenWidth, height: 160.h, + color: Colors.white, child: ListView( scrollDirection: Axis.horizontal, //横向滚动 children: initBottomSheetList()), @@ -675,18 +695,23 @@ class _PasswordKeyPerpetualPageState extends State height: 8.h, color: AppColors.greyBackgroundColor, ), - TextButton( - style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.white)), - child: Text( - '取消'.tr, - style: TextStyle( - color: Colors.black, fontSize: ScreenUtil().setSp(24)), + Container( + color: Colors.white, + margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0), + width: ScreenUtil().screenWidth, + child: TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消'.tr, + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, ), - onPressed: () { - Navigator.pop(context); - }, ) ], ); @@ -805,7 +830,8 @@ class _PasswordKeyPerpetualPageState extends State arguments: { 'receiver': '', 'channelType': itemIndex == 1 ? 1 : 2, - 'keyId': CommonDataManage().currentKeyInfo.keyId, + 'keyId': state.getPwdID.value, + 'unlockType': 2 }); break; case 3: //更多 diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart index bf798e78..3e4d1162 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart @@ -4,7 +4,6 @@ import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; import 'package:star_lock/tools/dateTool.dart'; class PasswordKeyPerpetualState { - PasswordKeyPerpetualState() { Map map = Get.arguments; if (map['keyInfo'] != null) { @@ -30,7 +29,8 @@ class PasswordKeyPerpetualState { RxInt loopEndHours = DateTime.now().hour.obs; RxString loopModeStr = '周末'.obs; //循环模式 - RxString customBeginTime = DateTool().getNowDateWithType(2).obs; //默认为当前时间 开始时间 + RxString customBeginTime = + DateTool().getNowDateWithType(2).obs; //默认为当前时间 开始时间 RxString customEndTime = DateTool().getNowDateWithType(2).obs; //默认为当前时间 结束时间 final RxInt widgetType = 0.obs; @@ -42,4 +42,5 @@ class PasswordKeyPerpetualState { RxInt pwdNumber = 0.obs; // 密码编号 late TabController tabController; + RxInt getPwdID = 0.obs; // 获取密码ID } diff --git a/lib/main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart b/lib/main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart index 5f193cd1..6ab01f50 100755 --- a/lib/main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart +++ b/lib/main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart @@ -46,7 +46,7 @@ class _RemoteControlListPageState extends State { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { final bool isNetWork = - LockMainLogic.to()?.judgeTheNetwork() ?? false; + await LockMainLogic.to()?.judgeTheNetwork() ?? false; if (!isNetWork) { return; } diff --git a/lib/main/lockMian/lockList/lockListGroup_view.dart b/lib/main/lockMian/lockList/lockListGroup_view.dart index 40ee97e3..258fed31 100755 --- a/lib/main/lockMian/lockList/lockListGroup_view.dart +++ b/lib/main/lockMian/lockList/lockListGroup_view.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:star_lock/flavors.dart'; import '../../../app_settings/app_colors.dart'; import '../entity/lockListInfo_entity.dart'; @@ -34,7 +35,7 @@ class _LockListGroupViewState extends State { Widget build(BuildContext context) { return Column( mainAxisSize: MainAxisSize.min, - children: [ + children: [ Container( color: widget.backgroundColor ?? Colors.white, height: 80.h, @@ -54,23 +55,34 @@ class _LockListGroupViewState extends State { } List _buildExpandRowList() { - List widgetList = []; + final List widgetList = []; widgetList.add(GestureDetector( child: Container( width: ScreenUtil().screenWidth, color: widget.backgroundColor ?? Colors.white, child: Row( - children: [ + children: [ SizedBox(width: 40.w), - Text( - widget.groupItem.groupName ?? '', - style: widget.textStyle ?? - TextStyle(color: AppColors.blackColor, fontSize: 22.sp), - ), - Expanded( - child: SizedBox( + F.sw( + skyCall: () => Text( + widget.groupItem.groupName ?? '', + style: widget.textStyle ?? + TextStyle( + color: AppColors.blackColor, fontSize: 22.sp), + ), + xhjCall: () => Expanded( + child: Text( + widget.groupItem.groupName ?? '', + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: widget.textStyle ?? + TextStyle( + color: AppColors.blackColor, fontSize: 22.sp), + ), + )), + SizedBox( width: 10.w, - )), + ), AnimatedRotation( turns: _isExpanded ? -0.5 : 0, duration: _animationDuration, diff --git a/lib/main/lockMian/lockMain/lockMain_logic.dart b/lib/main/lockMian/lockMain/lockMain_logic.dart index 6bd0b1ee..32852a77 100755 --- a/lib/main/lockMian/lockMain/lockMain_logic.dart +++ b/lib/main/lockMian/lockMain/lockMain_logic.dart @@ -110,15 +110,15 @@ class LockMainLogic extends BaseGetXController { // 从无网络到有网络 state.networkConnectionStatus.value = 1; getStarLockInfo(isUnShowLoading: true); - }else if(result == ConnectivityResult.none){ + } else if (result == ConnectivityResult.none) { state.networkConnectionStatus.value = 0; } }); } /// 判断是否有网络 - bool judgeTheNetwork() { - final bool isNetwork = state.networkConnectionStatus.value == 1; + Future judgeTheNetwork() async { + final bool isNetwork = await isConnected(); if (!isNetwork) { EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr); } diff --git a/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart b/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart index 87232bd4..32aa6cf9 100755 --- a/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart +++ b/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart @@ -45,12 +45,13 @@ class _StarLockMainXHJPageState extends State showAppBar: false, showDrawer: false, ), - SafeArea( - bottom: false, - child: LockMallPage( - allowReturn: false, - ), - ), + // xhj 不需要显示商城 + // SafeArea( + // bottom: false, + // child: LockMallPage( + // allowReturn: false, + // ), + // ), SafeArea( bottom: false, child: MessageListXHJPage( @@ -84,9 +85,10 @@ class _StarLockMainXHJPageState extends State child: Row( children: [ navigationBarItem(logic, Icons.key, '设备'.tr, 0), - navigationBarItem(logic, Icons.shopping_cart, '商城'.tr, 1), - navigationBarItem(logic, Icons.message, '消息'.tr, 2), - navigationBarItem(logic, Icons.account_circle, '我的'.tr, 3), + // xhj 不需要显示商城 + // navigationBarItem(logic, Icons.shopping_cart, '商城'.tr, 1), + navigationBarItem(logic, Icons.message, '消息'.tr, 1), + navigationBarItem(logic, Icons.account_circle, '我的'.tr, 2), ], ), ), diff --git a/lib/mine/addLock/addLock/addLock_logic.dart b/lib/mine/addLock/addLock/addLock_logic.dart index 6a8f6d71..e36079bf 100755 --- a/lib/mine/addLock/addLock/addLock_logic.dart +++ b/lib/mine/addLock/addLock/addLock_logic.dart @@ -7,22 +7,19 @@ import 'package:star_lock/mine/addLock/addLock/addLock_state.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/widget/permission/permission_dialog.dart'; - class AddLockLogic extends BaseGetXController { final AddLockState state = AddLockState(); - //跳转到附近的锁页面先判断权限 Future getNearByLimits() async { if (!Platform.isIOS) { - bool bluetoothRequest = await PermissionDialog.requestBluetooth(); - bool locationRequest = await PermissionDialog.request(Permission.location); + final bool locationRequest = await PermissionDialog.request(Permission.location); + final bool bluetoothRequest = await PermissionDialog.requestBluetooth(); if (!bluetoothRequest || !locationRequest) { return; } } + Get.toNamed(Routers.nearbyLockPage); } - - } diff --git a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index 751c0e9c..2477cb87 100755 --- a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -1,4 +1,3 @@ - import 'dart:async'; import 'dart:convert'; import 'dart:io'; @@ -9,6 +8,7 @@ import 'package:date_format/date_format.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/blue/io_protocol/io_getPrivateKey.dart'; import 'package:star_lock/blue/io_protocol/io_getPublicKey.dart'; import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart'; @@ -45,15 +45,8 @@ class NearbyLockLogic extends BaseGetXController { // 点击连接设备 void connect(String deviceName) { showTitleEasyLoading('获取锁信息 1/3'); - // if(state.sureBtnState.value == 1){ - // return; - // } - // state.sureBtnState.value = 1; - - // showEasyLoading(); showBlueConnetctToastTimer(action: () { dismissEasyLoading(); - // state.sureBtnState.value = 0; }); BlueManage().blueSendData(deviceName, (BluetoothConnectionState state) async { @@ -71,7 +64,7 @@ class NearbyLockLogic extends BaseGetXController { _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { if (reply is GetPublicKeyReply) { - _replyGetPublicKey(reply); + _replyGetPublicKey(reply); } if (reply is GetPrivateKeyReply) { @@ -103,8 +96,6 @@ class NearbyLockLogic extends BaseGetXController { } Future _replyGetPublicKey(Reply reply) async { - // dismissEasyLoading(); - // 获取公钥 switch (reply.status) { case 0x00: @@ -127,7 +118,6 @@ class NearbyLockLogic extends BaseGetXController { needAuthor: 1); break; default: - // state.sureBtnState.value = 0; AppLog.log('获取公钥失败'); break; } @@ -142,7 +132,8 @@ class NearbyLockLogic extends BaseGetXController { // 私钥 final List privateKey = reply.data.sublist(0, 16); - final List savePrivateKeyList = changeIntListToStringList(privateKey); + final List savePrivateKeyList = + changeIntListToStringList(privateKey); Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); // signKey @@ -160,7 +151,6 @@ class NearbyLockLogic extends BaseGetXController { _getStarLockStatus(); break; default: - // state.sureBtnState.value = 0; break; } } @@ -170,7 +160,7 @@ class NearbyLockLogic extends BaseGetXController { final int status = reply.data[2]; switch (status) { case 0x00: - //成功 + //成功 AppLog.log('获取锁状态成功'); // 厂商名称 int index = 3; @@ -196,14 +186,14 @@ class NearbyLockLogic extends BaseGetXController { AppLog.log('产品名称 mmodelStr:$modelStr'); // 软件版本 - final List fwVersion = reply.data.sublist(index, index+20); + final List fwVersion = reply.data.sublist(index, index + 20); final String fwVersionStr = utf8String(fwVersion); state.lockInfo['fwVersion'] = fwVersionStr; index = index + 20; AppLog.log('软件版本 fwVersionStr:$fwVersionStr'); // 硬件版本 - final List hwVersion = reply.data.sublist(index, index+20); + final List hwVersion = reply.data.sublist(index, index + 20); final String hwVersionStr = utf8String(hwVersion); state.lockInfo['hwVersion'] = hwVersionStr; index = index + 20; @@ -245,16 +235,18 @@ class NearbyLockLogic extends BaseGetXController { // 重置次数 final List restoreCounter = reply.data.sublist(index, index + 2); - state.lockInfo['restoreCount'] = restoreCounter[0] * 256 + restoreCounter[1]; + state.lockInfo['restoreCount'] = + restoreCounter[0] * 256 + restoreCounter[1]; index = index + 2; - AppLog.log('重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}'); + AppLog.log( + '重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}'); // 重置时间 final List restoreDate = reply.data.sublist(index, index + 4); final int restoreDateValue = (0xff & restoreDate[0]) << 24 | - (0xff & restoreDate[1]) << 16 | - (0xff & restoreDate[2]) << 8 | - (0xFF & restoreDate[3]); + (0xff & restoreDate[1]) << 16 | + (0xff & restoreDate[2]) << 8 | + (0xFF & restoreDate[3]); // String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString()); state.lockInfo['restoreDate'] = restoreDateValue * 1000; index = index + 4; @@ -270,9 +262,9 @@ class NearbyLockLogic extends BaseGetXController { // 有效时间 final List indate = reply.data.sublist(index, index + 4); final int indateValue = (0xff & indate[0]) << 24 | - (0xff & indate[1]) << 16 | - (0xff & indate[2]) << 8 | - (0xFF & indate[3]); + (0xff & indate[1]) << 16 | + (0xff & indate[2]) << 8 | + (0xFF & indate[3]); // String indateStr = DateTool().dateToYMDHNSString("$indateValue"); state.lockInfo['indate'] = indateValue * 1000; index = index + 4; @@ -286,7 +278,8 @@ class NearbyLockLogic extends BaseGetXController { AppLog.log('mac地址 macAddressStr:$macAddressStr'); //时区偏移 - state.lockInfo['timezoneOffset'] = DateTime.now().timeZoneOffset.inSeconds; + state.lockInfo['timezoneOffset'] = + DateTime.now().timeZoneOffset.inSeconds; // 锁特征值字符串长度 final int featureValueLength = reply.data[index]; @@ -300,7 +293,8 @@ class NearbyLockLogic extends BaseGetXController { showToast('锁数据异常,请重试'); return; } - final List featureValue = reply.data.sublist(index, index + featureValueLength); + final List featureValue = + reply.data.sublist(index, index + featureValueLength); final String featureValueStr = asciiString(featureValue); state.featureValue = featureValueStr; // List allFeatureValueTwoList = charListChangeIntList(featureValue); @@ -319,7 +313,8 @@ class NearbyLockLogic extends BaseGetXController { showToast('锁数据异常,请重试'); return; } - final List featureEnVal = reply.data.sublist(index, index + featureEnValLength); + final List featureEnVal = + reply.data.sublist(index, index + featureEnValLength); final String featureEnValStr = asciiString(featureEnVal); state.featureSettingValue = featureEnValStr; // List allFeatureEnValTwoList = charListChangeIntList(featureEnVal); @@ -344,14 +339,11 @@ class NearbyLockLogic extends BaseGetXController { break; case 0x06: - //无权限 - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = changeStringListToIntList(privateKey!); - // IoSenderManage.senderGetLockStatu( - // lockID:BlueManage().connectDeviceName, - // userID:await Storage.getUid(), - // privateKey:getPrivateKeyList, - // ); + //无权限 + final List? privateKey = + await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = + changeStringListToIntList(privateKey!); IoSenderManage.senderGetStarLockStatuInfo( lockID: BlueManage().connectDeviceName, userID: await Storage.getUid(), @@ -362,8 +354,7 @@ class NearbyLockLogic extends BaseGetXController { ); break; default: - //失败 - // state.sureBtnState.value = 0; + //失败 break; } } @@ -376,12 +367,16 @@ class NearbyLockLogic extends BaseGetXController { // dismissEasyLoading(); AppLog.log('开始获取锁状态'); - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = + await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); - - final String getUTCDate = formatDate(DateTime.fromMillisecondsSinceEpoch(state.serverTime*1000), [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]); - final String getLocalDate = formatDate(DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000), [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]); + final String getUTCDate = formatDate( + DateTime.fromMillisecondsSinceEpoch(state.serverTime * 1000), + [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]); + final String getLocalDate = formatDate( + DateTime.fromMillisecondsSinceEpoch(getLocalTime() * 1000), + [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]); AppLog.log('state.serverTime:${state.serverTime} getUTCDate:$getUTCDate ' 'getLocalTime:${getLocalTime()} getLocalDate:$getLocalDate ' @@ -394,10 +389,6 @@ class NearbyLockLogic extends BaseGetXController { isBeforeAddUser: true, privateKey: getPrivateKeyList, ); - // } else if (state == BluetoothConnectionState.disconnected) { - // dismissEasyLoading(); - // } - // }, isAddEquipment: true); } void startScanBlueList() { @@ -490,7 +481,7 @@ class NearbyLockLogic extends BaseGetXController { ).packageData()); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {} - },isAddEquipment: true); + }, isAddEquipment: true); } //循环传输升级固件包 @@ -536,7 +527,7 @@ class NearbyLockLogic extends BaseGetXController { logic: this, ), barrierDismissible: false) - .then((value) => state.oTAProgressDialog = false); + .then((dynamic value) => state.oTAProgressDialog = false); } //清楚 ata 安装文件 @@ -632,9 +623,10 @@ class NearbyLockLogic extends BaseGetXController { } // 从服务器获取锁的时间 开锁时传入 - Future getServerDatetime() async{ - final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:false); - if(entity.errorCode!.codeIsSuccessful){ + Future getServerDatetime() async { + final GetServerDatetimeEntity entity = + await ApiRepository.to.getServerDatetimeData(isUnShowLoading: false); + if (entity.errorCode!.codeIsSuccessful) { state.serverTime = entity.data!.date! ~/ 1000; if (state.otaState.value) { @@ -642,12 +634,10 @@ class NearbyLockLogic extends BaseGetXController { } else { connect(state.selectLockName.value); } - // state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000; - // AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}"); } } - int getLocalTime(){ + int getLocalTime() { final DateTime now = DateTime.now(); final Duration timeZoneOffset = now.timeZoneOffset; AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds'); @@ -657,9 +647,7 @@ class NearbyLockLogic extends BaseGetXController { @override void onReady() { super.onReady(); - _initReplySubscription(); - state.ifCurrentScreen.value = true; - startScanBlueList(); + getNearByLimits(); } @override @@ -672,4 +660,18 @@ class NearbyLockLogic extends BaseGetXController { super.onClose(); _replySubscription?.cancel(); } + + Future getNearByLimits() async { + if (!Platform.isIOS) { + final bool bluetoothRequest = await PermissionDialog.requestBluetooth(); + final bool locationRequest = + await PermissionDialog.request(Permission.location); + if (!bluetoothRequest || !locationRequest) { + return; + } + } + _initReplySubscription(); + state.ifCurrentScreen.value = true; + startScanBlueList(); + } } diff --git a/lib/mine/addLock/nearbyLock/nearbyLock_page.dart b/lib/mine/addLock/nearbyLock/nearbyLock_page.dart index d891b53a..25af5c88 100755 --- a/lib/mine/addLock/nearbyLock/nearbyLock_page.dart +++ b/lib/mine/addLock/nearbyLock/nearbyLock_page.dart @@ -6,7 +6,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/flavors.dart'; import '../../../app_settings/app_colors.dart'; -import '../../../blue/blue_manage.dart'; import '../../../tools/appRouteObserver.dart'; import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; diff --git a/lib/mine/mine/starLockMine_page.dart b/lib/mine/mine/starLockMine_page.dart index 55ea2ce8..13aba2be 100755 --- a/lib/mine/mine/starLockMine_page.dart +++ b/lib/mine/mine/starLockMine_page.dart @@ -1,10 +1,11 @@ - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/mine/mine/starLockMine_state.dart'; +import 'package:star_lock/tools/commonItem.dart'; +import 'package:star_lock/tools/customer_tool.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; @@ -204,6 +205,12 @@ class StarLockMinePageState extends State with BaseWidget { Get.back(); Get.toNamed(Routers.lockMallPage); }), + if (F.isSKY) + mineItem('images/mine/icon_mine_main_shoppingcart.png', + TranslationLoader.lanKeys!.supportStaff!.tr, () { + Get.back(); + CustomerTool.openCustomerService(); + }), mineItem('images/mine/icon_mine_main_about.png', TranslationLoader.lanKeys!.about!.tr, () { Get.back(); diff --git a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart index 25a34e80..21d8d2d7 100755 --- a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart +++ b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart @@ -70,7 +70,8 @@ class _AddAuthorizedAdministratorPageState : state.lockIdList.value.length.toString(), isHaveDirection: true, action: () async { - final result = await Get.toNamed(Routers.massSendLockGroupListPage, + final result = await Get.toNamed( + Routers.massSendLockGroupListPage, arguments: { 'keyLimits': '1', 'lockIdList': state.lockIdList.value @@ -94,7 +95,8 @@ class _AddAuthorizedAdministratorPageState isHaveRightWidget: true, isTipsImg: true, tipsImgAction: () { - ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); + ShowTipView() + .showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); }, rightWidget: SizedBox( width: 60.w, @@ -128,7 +130,8 @@ class _AddAuthorizedAdministratorPageState : state.lockIdList.value.length.toString(), isHaveDirection: true, action: () async { - final result = await Get.toNamed(Routers.massSendLockGroupListPage, + final result = await Get.toNamed( + Routers.massSendLockGroupListPage, arguments: { 'keyLimits': '1', 'lockIdList': state.lockIdList.value @@ -153,7 +156,8 @@ class _AddAuthorizedAdministratorPageState isHaveRightWidget: true, isTipsImg: true, tipsImgAction: () { - ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); + ShowTipView() + .showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); }, rightWidget: SizedBox( width: 60.w, @@ -217,7 +221,8 @@ class _AddAuthorizedAdministratorPageState } // 接受者信息输入框 - Widget getTFWidget(bool isHaveBtn, String tfStr, TextEditingController editController) { + Widget getTFWidget( + bool isHaveBtn, String tfStr, TextEditingController editController) { return SizedBox( height: 65.h, width: 300.w, @@ -487,7 +492,8 @@ class _AddAuthorizedAdministratorPageState 'receiver': state.emailOrPhoneController.text, 'channelType': state.emailOrPhoneController.text.contains('@') ? 2 : 1, - 'keyId': state.getKeyId.value + 'keyId': state.getKeyId.value, + 'unlockType': 1 }); }, ), @@ -576,7 +582,13 @@ class _AddAuthorizedAdministratorPageState case 2: //邮件 { - Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + Navigator.pushNamed(context, Routers.sendEmailNotificationPage, + arguments: { + 'receiver': state.emailOrPhoneController.text, + 'channelType': 2, + 'keyId': state.getKeyId.value, + 'unlockType': 1 + }); } break; case 3: diff --git a/lib/mine/mineSet/mineSet/mineSet_page.dart b/lib/mine/mineSet/mineSet/mineSet_page.dart index 90a37a5a..496729f2 100755 --- a/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -313,7 +313,6 @@ class _MineSetPageState extends State Navigator.pushNamed( context, Routers.aPPUnlockNeedMobileNetworkingLockPage); }), - // if (!F.isLite) CommonItem( leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr, isHaveLine: true, @@ -354,12 +353,13 @@ class _MineSetPageState extends State action: () { logic.showToast('功能暂未开放'.tr); }), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.supportStaff!.tr, - isHaveLine: widget.showAbout, - isHaveDirection: true, - action: CustomerTool.openCustomerService, - ), + if (F.isXHJ) + CommonItem( + leftTitel: TranslationLoader.lanKeys!.supportStaff!.tr, + isHaveLine: widget.showAbout, + isHaveDirection: true, + action: CustomerTool.openCustomerService, + ), if (widget.showAbout) CommonItem( leftTitel: TranslationLoader.lanKeys!.about!.tr, diff --git a/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_page.dart b/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_page.dart index 7763bd07..7caee3a9 100755 --- a/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_page.dart +++ b/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_page.dart @@ -16,9 +16,6 @@ class AdvancedFeaturesWebPage extends StatefulWidget { } class _AdvancedFeaturesWebPageState extends State { - final AdvancedFeaturesWebLogic logic = Get.put(AdvancedFeaturesWebLogic()); - final AdvancedFeaturesWebState state = - Get.find().state; @override Widget build(BuildContext context) { @@ -32,18 +29,13 @@ class _AdvancedFeaturesWebPageState extends State { resizeToAvoidBottomInset: false, backgroundColor: const Color(0xFFFFFFFF), appBar: TitleAppBar( - barTitle: state.webBuyTitle.value, + barTitle: logic.state.webBuyTitle.value, haveBack: true, backgroundColor: AppColors.mainColor, backAction: () => logic.canGoBack(false), ), body: Obx(() => Column( children: [ - PopScope( - onPopInvoked: logic.canGoBack, - canPop: false, - child: const SizedBox(), - ), Container( padding: EdgeInsets.only(bottom: 10.w), child: LinearProgressIndicator( diff --git a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart deleted file mode 100755 index 5d36ca71..00000000 --- a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart +++ /dev/null @@ -1,132 +0,0 @@ -class AdvancedFunctionRecordEntity { - int? errorCode; - String? description; - String? errorMsg; - Data? data; - - AdvancedFunctionRecordEntity( - {this.errorCode, this.description, this.errorMsg, this.data}); - - AdvancedFunctionRecordEntity.fromJson(Map json) { - errorCode = json['errorCode']; - description = json['description']; - errorMsg = json['errorMsg']; - data = json['data'] != null ? Data.fromJson(json['data']) : null; - } - - Map toJson() { - final Map data = {}; - data['errorCode'] = errorCode; - data['description'] = description; - data['errorMsg'] = errorMsg; - if (this.data != null) { - data['data'] = this.data!.toJson(); - } - return data; - } -} - -class Data { - int? pageNo; - int? pageSize; - int? total; - List? recordList; - - Data({this.pageNo, this.pageSize, this.total, this.recordList}); - - Data.fromJson(Map json) { - pageNo = json['pageNo']; - pageSize = json['pageSize']; - total = json['total']; - if (json['list'] != null) { - recordList = []; - json['list'].forEach((v) { - recordList!.add(RecordItem.fromJson(v)); - }); - } - } - - Map toJson() { - final Map data = {}; - data['pageNo'] = pageNo; - data['pageSize'] = pageSize; - data['total'] = total; - if (recordList != null) { - data['list'] = recordList!.map((v) => v.toJson()).toList(); - } - return data; - } -} - -class RecordItem { - int? id; - int? userId; - String? orderNumber; - String? type; - int? recordType; - int? smsCount; - int? emailCount; - int? cloudauthCount; - int? vipLockCount; - int? vipYear; - String? amount; - String? createdAt; - String? updatedAt; - String? useDate; - String? buyDate; - - RecordItem( - {this.id, - this.userId, - this.orderNumber, - this.type, - this.recordType, - this.smsCount, - this.emailCount, - this.cloudauthCount, - this.vipLockCount, - this.vipYear, - this.amount, - this.createdAt, - this.updatedAt, - this.useDate, - this.buyDate}); - - RecordItem.fromJson(Map json) { - id = json['id']; - userId = json['user_id']; - orderNumber = json['order_number']; - type = json['type']; - recordType = json['record_type']; - smsCount = json['sms_count']; - emailCount = json['email_count']; - cloudauthCount = json['cloudauth_count']; - vipLockCount = json['vip_lock_count']; - vipYear = json['vip_year']; - amount = json['amount']; - createdAt = json['created_at']; - updatedAt = json['updated_at']; - useDate = json['useDate']; - buyDate = json['buyDate']; - } - - Map toJson() { - final Map data = {}; - data['id'] = id; - data['user_id'] = userId; - data['order_number'] = orderNumber; - data['type'] = type; - data['record_type'] = recordType; - data['sms_count'] = smsCount; - data['email_count'] = emailCount; - data['cloudauth_count'] = cloudauthCount; - data['vip_lock_count'] = vipLockCount; - data['vip_year'] = vipYear; - data['amount'] = amount; - data['created_at'] = createdAt; - data['updated_at'] = updatedAt; - data['useDate'] = useDate; - data['buyDate'] = buyDate; - return data; - } -} diff --git a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart index 0a45a484..0135735d 100755 --- a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart +++ b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'package:get/get.dart'; -import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_state.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import '../../../../network/api_repository.dart'; import '../../../../tools/baseGetXController.dart'; @@ -28,8 +28,7 @@ class AdvancedFunctionRecordLogic extends BaseGetXController { if (!load) { buyPageNo = 1; } - AdvancedFunctionRecordEntity entity = - await ApiRepository.to.getBuyRecordList( + UseRecordListEntity entity = await ApiRepository.to.getBuyRecordList( type: type, recordType: 10, pageNo: buyPageNo, diff --git a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_page.dart b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_page.dart index 915dc299..6da02664 100755 --- a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_page.dart +++ b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_page.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; -import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import 'package:star_lock/tools/noData.dart'; import '../../../tools/titleAppBar.dart'; @@ -44,7 +44,7 @@ class _AdvancedFunctionRecordPageState )); } - Widget _recordKeyItem(RecordItem itemData) { + Widget _recordKeyItem(UseItemData itemData) { return Container( color: Colors.white, margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), diff --git a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_state.dart b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_state.dart index 99e52e5b..d3dc0036 100755 --- a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_state.dart +++ b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_state.dart @@ -1,6 +1,6 @@ import 'package:get/get.dart'; -import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; class AdvancedFunctionRecordState { - var buyRecordList = [].obs; + var buyRecordList = [].obs; } diff --git a/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_page.dart b/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_page.dart deleted file mode 100755 index a14e1343..00000000 --- a/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_page.dart +++ /dev/null @@ -1,32 +0,0 @@ - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import '../../../../app_settings/app_colors.dart'; -import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; -import 'valueAddedServicesBuyAndUseRecordManage_tabbar.dart'; - -class ValueAddedServicesBuyAndUseRecordManagePage extends StatefulWidget { - const ValueAddedServicesBuyAndUseRecordManagePage({Key? key}) : super(key: key); - - @override - State createState() => _ValueAddedServicesBuyAndUseRecordManagePageState(); -} - -class _ValueAddedServicesBuyAndUseRecordManagePageState extends State { - var index=0; - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.white, - appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.sendKey!.tr, haveBack:true, backgroundColor: AppColors.mainColor), - body: Column( - children: [ - ValueAddedServicesBuyAndUseRecordManageTabbar(initialIndex: index,), - ], - ), - ); - } -} diff --git a/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_tabbar.dart b/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_tabbar.dart deleted file mode 100755 index 981ddf27..00000000 --- a/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_tabbar.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; - -import '../../../../app_settings/app_colors.dart'; -import '../../../../tools/CustomUnderlineTabIndicator.dart'; -import '../valueAddedServicesBuyAndUseRecord_page.dart'; - -class ValueAddedServicesBuyAndUseRecordManageTabbar extends StatefulWidget { - var initialIndex = 1; - - ValueAddedServicesBuyAndUseRecordManageTabbar( - {Key? key, required this.initialIndex}) - : super(key: key); - - @override - State createState() => - _ValueAddedServicesBuyAndUseRecordManageTabbarState(); -} - -class _ValueAddedServicesBuyAndUseRecordManageTabbarState - extends State - with SingleTickerProviderStateMixin { - late TabController _tabController; - - final List _itemTabs = [ - ItemView(title: "购买记录", type: "0"), - ItemView(title: "使用记录", type: "1") - // ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"), - // ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "3"), - ]; - - @override - void initState() { - // TODO: implement initState - super.initState(); - _tabController = TabController( - vsync: this, - length: _itemTabs.length, - initialIndex: widget.initialIndex); - } - - @override - Widget build(BuildContext context) { - return Expanded( - child: Column( - children: [ - _tabBar(), - _pageWidget(), - ], - )); - } - - TabBar _tabBar() { - return TabBar( - controller: _tabController, - tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), - isScrollable: true, - indicatorColor: Colors.red, - unselectedLabelColor: Colors.black, - unselectedLabelStyle: TextStyle( - color: AppColors.mainColor, - fontSize: 24.sp, - ), - automaticIndicatorColorAdjustment: true, - labelColor: AppColors.mainColor, - labelStyle: TextStyle( - color: AppColors.mainColor, - fontSize: 24.sp, - fontWeight: FontWeight.w600), - indicator: CustomUnderlineTabIndicator( - borderSide: BorderSide(color: AppColors.mainColor, width: 4.w), - strokeCap: StrokeCap.round, - width: 30.w), - ); - } - - Tab _tab(ItemView item) { - return Tab( - // text: item.title, - child: Container( - width: 1.sw / 4, - margin: EdgeInsets.all(10.w), - // color: Colors.red, - child: Text( - item.title, - textAlign: TextAlign.center, - ), - ), - ); - } - - Widget _pageWidget() { - return Expanded( - child: TabBarView( - controller: _tabController, - children: _itemTabs - .map((ItemView item) => ValueAddedServicesBuyAndUseRecordPage( - type: item.type, - )) - .toList(), - ), - ); - } -} - -class ItemView { - const ItemView({required this.title, required this.type}); - - final String title; - final String type; -} diff --git a/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecord_page.dart b/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecord_page.dart deleted file mode 100755 index c939af17..00000000 --- a/lib/mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecord_page.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:star_lock/app_settings/app_colors.dart'; - -class ValueAddedServicesBuyAndUseRecordPage extends StatefulWidget { - final String type; - - const ValueAddedServicesBuyAndUseRecordPage({Key? key, required this.type}) - : super(key: key); - - @override - State createState() => - _ValueAddedServicesBuyAndUseRecordPageState(); -} - -class _ValueAddedServicesBuyAndUseRecordPageState - extends State { - @override - Widget build(BuildContext context) { - return ListView.builder( - itemCount: 20, - itemBuilder: (c, index) { - if (index % 2 == 0) { - return _dateItem("2023-06-29"); - } else { - return _operatingRecordItem('images/controls_user.png', "张三", - "2023.6.21 11.15", "2023.6.21 11.15", () { - // Navigator.pushNamed(context, Routers.electronicKeyDetailPage); - }); - } - }); - } - - Widget _dateItem(String lockDate) { - return Container( - height: 60.h, - color: AppColors.mainBackgroundColor, - padding: EdgeInsets.only(left: 20.h, right: 20.h), - child: Row( - children: [ - Text( - lockDate, - style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), - ), - ], - ), - ); - } - - Widget _operatingRecordItem(String lockTypeIcon, String lockTypeTitle, - String beginTime, String endTime, Function() action) { - return GestureDetector( - onTap: action, - child: Container( - height: 90.h, - // padding: EdgeInsets.only(left: 20.w, right: 20.w), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10.w), - ), - child: Row( - children: [ - SizedBox( - width: 30.w, - ), - Image.asset( - lockTypeIcon, - width: 50.w, - height: 50.w, - ), - SizedBox( - width: 20.w, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - children: [ - Text( - lockTypeTitle, - style: TextStyle( - fontSize: 24.sp, color: AppColors.blackColor), - ), - ], - ), - SizedBox(height: 10.h), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "2023.6.21 11.15", - style: TextStyle( - fontSize: 20.sp, - color: AppColors.darkGrayTextColor), - ), - ], - ), - ), - SizedBox(width: 20.h), - ], - ), - ), - SizedBox(width: 20.h), - ], - ), - ), - ); - } -} diff --git a/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart deleted file mode 100755 index 1102058a..00000000 --- a/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart +++ /dev/null @@ -1,329 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../../app_settings/app_colors.dart'; -import '../../../../tools/commonItem.dart'; -import '../../../../tools/showBottomSheetTool.dart'; -import '../../../../tools/submitBtn.dart'; -import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; - -//高亮样式 -final TextStyle highStyle = - TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp); - -//默认样式 -final TextStyle defaultStyle = TextStyle(color: Colors.black, fontSize: 20.sp); - -//预览样式封装-密码 -InlineSpan emailPasswardSpan = TextSpan(children: [ - TextSpan( - text: - '${TranslationLoader.lanKeys!.hello!.tr},${TranslationLoader.lanKeys!.yourRoomIs!.tr}:', - style: defaultStyle), - TextSpan( - text: '{${TranslationLoader.lanKeys!.roomName!.tr}', style: highStyle), - TextSpan( - text: ',${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}:', - style: defaultStyle), - TextSpan( - text: '{${TranslationLoader.lanKeys!.password!.tr}}', style: highStyle), - TextSpan( - text: '。${TranslationLoader.lanKeys!.periodValidity!.tr}:', - style: defaultStyle), - TextSpan( - text: '{${TranslationLoader.lanKeys!.periodValidity!.tr}}', - style: highStyle), - TextSpan( - text: '。${TranslationLoader.lanKeys!.templateTip1!.tr}。', - style: defaultStyle), -]); - -//预览样式封装-密码提示 -InlineSpan emailPasswardTipSpan = TextSpan(children: [ - TextSpan( - text: TranslationLoader.lanKeys!.templateTip4!.tr, style: defaultStyle), - TextSpan( - text: '{${TranslationLoader.lanKeys!.roomName!.tr}}', style: highStyle), - TextSpan(text: '、', style: defaultStyle), - TextSpan( - text: '{${TranslationLoader.lanKeys!.password!.tr}}', style: highStyle), - TextSpan(text: TranslationLoader.lanKeys!.and!.tr, style: defaultStyle), - TextSpan( - text: '{${TranslationLoader.lanKeys!.periodValidity!.tr}}', - style: highStyle), - TextSpan( - text: TranslationLoader.lanKeys!.willBeReplacedWithTheActualValue!.tr, - style: defaultStyle), -]); - -String emaiPasswardStr = - "${TranslationLoader.lanKeys!.hello!.tr},${TranslationLoader.lanKeys!.yourRoomIs!.tr}:{${TranslationLoader.lanKeys!.roomName!.tr}},${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}:{${TranslationLoader.lanKeys!.password!.tr}}。${TranslationLoader.lanKeys!.periodValidity!.tr}:{${TranslationLoader.lanKeys!.periodValidity!.tr}}。${TranslationLoader.lanKeys!.templateTip1!.tr}"; - -//预览样式封装-电子钥匙 -InlineSpan emailElectronicKeySpan = TextSpan(children: [ - TextSpan( - text: TranslationLoader.lanKeys!.templateTip2!.tr, style: defaultStyle), - TextSpan(text: 'https://abc.com/bcd', style: highStyle) -]); - -//预览样式封装-电子钥匙提示 -InlineSpan emailElectronicKeyTipSpan = TextSpan(children: [ - TextSpan( - text: TranslationLoader.lanKeys!.templateTip4!.tr, style: defaultStyle), - TextSpan( - text: '{${TranslationLoader.lanKeys!.downloadLink!.tr}', - style: highStyle), - TextSpan( - text: TranslationLoader.lanKeys!.willBeReplacedWithTheActualValue!.tr, - style: defaultStyle), -]); - -String emailElectronicKeyStr = - "${TranslationLoader.lanKeys!.templateTip2!.tr}\n{${TranslationLoader.lanKeys!.downloadLink!.tr}}"; - -class ValueAddedServicesAddEmailTemplatePage extends StatefulWidget { - const ValueAddedServicesAddEmailTemplatePage({Key? key}) : super(key: key); - - @override - State createState() => - _ValueAddedServicesAddEmailTemplatePageState(); -} - -class _ValueAddedServicesAddEmailTemplatePageState - extends State { - final _templateOneTf = TextEditingController(); - final _templateNameTf = TextEditingController(); - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - _templateOneTf.text = emailElectronicKeyStr; - - return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.customMailTemplate!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor), - body: ListView( - children: [ - _buildEditTopInfo(), - SizedBox( - height: 10.h, - ), - _buildEditTemplate(), - SizedBox( - height: 10.h, - ), - _buildpreview(), - SizedBox(height: 42.h), - SubmitBtn( - btnName: TranslationLoader.lanKeys!.save!.tr, - borderRadius: 10.w, - 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: () { - // Navigator.pushNamed(context, Routers.sendElectronicKeyManagePage); - }), - ], - )); - } - - Widget _buildEditTopInfo() { - return Column( - children: [ - CommonItem( - leftTitel: TranslationLoader.lanKeys!.name!.tr, - rightTitle: "", - isHaveLine: true, - isHaveRightWidget: true, - rightWidget: getTFWidget( - _templateNameTf, TranslationLoader.lanKeys!.pleaseEnter!.tr)), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.type!.tr, - rightTitle: TranslationLoader.lanKeys!.password!.tr, - isHaveLine: false, - action: () { - _showSelectTemplateType(); - }), - ], - ); - } - - Widget _buildEditTemplate() { - return Container( - color: Colors.white, - child: Column( - children: [ - Row( - children: [ - Padding( - padding: EdgeInsets.only( - left: 25.w, top: 25.h, bottom: 25.h, right: 25.w), - child: Text( - TranslationLoader.lanKeys!.templateContent!.tr, - style: - TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w600), - ), - ), - ], - ), - Container( - margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h), - height: 100, - child: TextField( - maxLines: 8, - // maxLength:1000, - textAlign: TextAlign.start, - controller: _templateOneTf, - style: TextStyle( - color: Colors.black, - fontSize: 28.sp, - ), - decoration: InputDecoration( - contentPadding: EdgeInsets.only( - top: 20.h, left: 20.w, right: 20.w, bottom: 20.h), - border: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), - - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), - - ///设置边框的粗细 - width: 0.5, - ), - ), - - ///用来配置输入框获取焦点时的颜色 - focusedBorder: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), - - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), - - ///设置边框的粗细 - width: 1, - ), - ), - ), - ), - ), - Container( - padding: EdgeInsets.only( - top: 20.h, left: 20.w, right: 20.w, bottom: 20.h), - margin: EdgeInsets.only(left: 15.w, right: 15.w, bottom: 15.h), - decoration: BoxDecoration( - color: const Color(0xFFFbF9EC), - borderRadius: BorderRadius.circular(10.h)), - child: RichText(text: emailElectronicKeyTipSpan), - ) - ], - ), - ); - } - - Widget _buildpreview() { - return Column( - // mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - color: Colors.white, - margin: EdgeInsets.only(bottom: 20.h), - child: Column( - children: [ - Column( - children: [ - Row( - children: [ - Padding( - padding: EdgeInsets.only( - left: 25.w, - top: 25.h, - bottom: 25.h, - right: 25.w), - child: Text( - TranslationLoader.lanKeys!.preview!.tr, - style: TextStyle(fontSize: 20.sp), - ), - ), - ], - ), - Container( - margin: EdgeInsets.only( - left: 25.w, right: 25.w, bottom: 20.h), - padding: EdgeInsets.only( - left: 20.w, top: 20.h, right: 20.w, bottom: 20.h), - decoration: BoxDecoration( - color: const Color(0xFFF5F5F5), - borderRadius: BorderRadius.circular(10.h), - ), - child: RichText(text: emailElectronicKeySpan), - ) - ], - ), - ], - )) - ]); - } - - Widget getTFWidget(TextEditingController tfController, String tfStr) { - return Container( - height: 50.h, - width: 500.w, - child: Row( - children: [ - Expanded( - child: TextField( - //输入框一行 - maxLines: 1, - controller: tfController, - autofocus: false, - textAlign: TextAlign.end, - decoration: InputDecoration( - //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), - hintText: tfStr, - //不需要输入框下划线 - border: InputBorder.none, - ), - ), - ), - ], - ), - ); - } - - void _showSelectTemplateType() { - var list = [ - TranslationLoader.lanKeys!.electronicKey!.tr, - TranslationLoader.lanKeys!.password!.tr - ]; - ShowBottomSheetTool().showSingleRowPicker( - //上下文 - context, - //默认的索引 - normalIndex: 0, - title: TranslationLoader.lanKeys!.type!.tr, - cancelTitle: TranslationLoader.lanKeys!.cancel!.tr, - sureTitle: TranslationLoader.lanKeys!.sure!.tr, - //要显示的列表 - //可自定义数据适配器 - //adapter: PickerAdapter(), - data: list, - //选择事件的回调 - clickCallBack: (int index, var str) {}); - } -} diff --git a/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart deleted file mode 100755 index 52db8831..00000000 --- a/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart +++ /dev/null @@ -1,164 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../../appRouters.dart'; -import '../../../../app_settings/app_colors.dart'; -import '../../../../tools/submitBtn.dart'; -import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; -import '../valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart'; - -class ValueAddedServicesListEmailTemplatePage extends StatefulWidget { - const ValueAddedServicesListEmailTemplatePage({Key? key}) : super(key: key); - - @override - State createState() => - _ValueAddedServicesListEmailTemplatePageState(); -} - -class _ValueAddedServicesListEmailTemplatePageState - extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: '自定义邮件模版'.tr, - haveBack: true, - backgroundColor: AppColors.mainColor), - body: Column( - children: [ - _topTipWidget(), - Expanded(child: _buildMainUI()), - SubmitBtn( - btnName: TranslationLoader.lanKeys!.creatingANewTemplate!.tr, - borderRadius: 20.w, - 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: () { - Navigator.pushNamed( - context, Routers.valueAddedServicesAddEmailTemplatePage); - }), - SizedBox( - height: 64.h, - ) - ], - ), - ); - } - - Widget _topTipWidget() { - return Container( - margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 20.w), - padding: - EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w, bottom: 20.h), - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(5)), - child: Column( - children: [ - Text(TranslationLoader.lanKeys!.customTemplatesTip!.tr), - SizedBox( - height: 15.h, - ), - Container( - padding: EdgeInsets.only( - top: 15.h, left: 15.w, right: 15.w, bottom: 15.h), - decoration: BoxDecoration( - color: const Color(0xFFFbF9EC), - borderRadius: BorderRadius.circular(10.h)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 1.sw - 15.w * 2 - 40.w * 2 - 140.w, - // margin: EdgeInsets.only(top:15.h, left: 15.w, right: 15.w, bottom: 15.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${TranslationLoader.lanKeys!.currentState!.tr}:${TranslationLoader.lanKeys!.onTrial!.tr}", - style: TextStyle( - fontSize: 20.sp, fontWeight: FontWeight.w600), - ), - Text(TranslationLoader.lanKeys!.unHaveOpenedTip2!.tr, - style: TextStyle( - fontSize: 20.sp, fontWeight: FontWeight.w600)) - ], - ), - ), - GestureDetector( - onTap: () { - Navigator.pushNamed( - context, Routers.valueAddedServicesHighFunctionPage); - }, - child: Container( - width: 100.w, - height: 50.h, - decoration: BoxDecoration( - color: const Color(0xFFCAB68D), - borderRadius: BorderRadius.circular(35.h)), - child: Center( - child: Text( - TranslationLoader.lanKeys!.goToTheOpen!.tr, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, fontSize: 20.sp)))), - ), - ], - ), - ) - ], - )); - } - - Widget _buildMainUI() { - return ListView.builder( - itemCount: 10, - itemBuilder: (c, index) { - return _valueAddedServicesListSMSTemplateItem( - 'images/icon_lock.png', "张三", () { - // Navigator.pushNamed(context, Routers.valueAddedServicesAddSMSTemplatePage); - }); - }); - } - - Widget _valueAddedServicesListSMSTemplateItem( - String title, String content, Function() action) { - return GestureDetector( - onTap: action, - child: Container( - // height: 100.h, - margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10.w), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 30.h, top: 30.h, bottom: 20.h), - child: Text( - "101", - style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w500), - ), - ), - Container( - margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h), - decoration: BoxDecoration( - color: const Color(0xFFF5F5F5), - borderRadius: BorderRadius.circular(10.h), - ), - child: Padding( - padding: EdgeInsets.only( - left: 20.w, top: 20.h, right: 20.w, bottom: 20.h), - child: RichText(text: emailElectronicKeySpan)), - ), - ], - ), - ), - ); - } -} diff --git a/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart b/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart index bc254cae..1edf9c7f 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_logic.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_state.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart'; import '../../../appRouters.dart'; @@ -20,8 +21,10 @@ class ValueAddedServicesHighFunctionPage extends StatefulWidget { class _ValueAddedServicesHighFunctionPageState extends State { - final logic = Get.put(ValueAddedServicesHighFunctionLogic()); - final state = Get.find().state; + final ValueAddedServicesHighFunctionLogic logic = + Get.put(ValueAddedServicesHighFunctionLogic()); + final ValueAddedServicesHighFunctionState state = + Get.find().state; @override initState() { @@ -35,16 +38,16 @@ class _ValueAddedServicesHighFunctionPageState return Scaffold( backgroundColor: Colors.white, appBar: TitleAppBar( - barTitle: "高级功能".tr, + barTitle: '高级功能'.tr, haveBack: true, iconColor: Colors.black, titleColor: Colors.black, backgroundColor: Colors.white), body: Column( - children: [ + children: [ Expanded( child: ListView( - children: [ + children: [ _topShowState(), _benefitsContent(), Container(height: 20.h, color: const Color(0xFFF5F5F5)), @@ -69,60 +72,89 @@ class _ValueAddedServicesHighFunctionPageState topRight: Radius.circular(30.h), ), ), - child: GestureDetector( - onTap: () { - Get.toNamed(Routers.advancedFunctionRecordPage, - arguments: UseRecordListArg.vip); - }, - child: Container( - color: Colors.transparent, - child: Stack( - alignment: AlignmentDirectional.centerStart, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "当前状态:已开通".tr, - style: TextStyle( - fontSize: 24.sp, fontWeight: FontWeight.w600), - ), - SizedBox(height: 5.h), - Obx(() => Text( - "${TranslationLoader.lanKeys!.periodValidity!.tr}:${state.vipExpireDate.value}", - style: TextStyle( - fontSize: 20.sp, fontWeight: FontWeight.w600), - )), - ], // - ), - ], - ), - Positioned( - bottom: 0.h, - right: 0.w, - child: Container( - width: 90.w, - height: 50.h, - decoration: BoxDecoration( - color: const Color(0xFFBDCDDF), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30.h), - bottomLeft: Radius.circular(30.h), + child: Container( + color: Colors.transparent, + child: Stack( + alignment: AlignmentDirectional.centerStart, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '当前状态:已开通'.tr, + style: TextStyle( + fontSize: 24.sp, fontWeight: FontWeight.w600), + ), + SizedBox(height: 5.h), + Obx(() => Text( + '${TranslationLoader.lanKeys!.periodValidity!.tr}:${state.vipExpireDate.value}', + style: TextStyle( + fontSize: 20.sp, fontWeight: FontWeight.w600), + )), + ], // + ), + ], + ), + Positioned( + bottom: 0.h, + right: 0.w, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + GestureDetector( + onTap: () { + Get.toNamed(Routers.advancedFeaturesWebPage, + arguments: { + 'webBuyType': XSConstantMacro.webBuyTypeVip, + }); + }, + child: Container( + width: 110.w, + height: 50.h, + decoration: BoxDecoration( + color: const Color(0xFFBDCDDF), + borderRadius: BorderRadius.all(Radius.circular(30.h)), + ), + child: Center( + child: Text( + TranslationLoader.lanKeys!.buy!.tr, + style: TextStyle(fontSize: 22.sp), + )), ), ), - child: Center( - child: Text( - TranslationLoader.lanKeys!.record!.tr, - style: TextStyle(fontSize: 22.sp), - )), - )), - ], - ), + SizedBox( + width: 10.w, + ), + GestureDetector( + onTap: () { + Get.toNamed(Routers.advancedFunctionRecordPage, + arguments: UseRecordListArg.vip); + }, + child: Container( + width: 90.w, + height: 50.h, + decoration: BoxDecoration( + color: const Color(0xFFBDCDDF), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30.h), + bottomLeft: Radius.circular(30.h), + ), + ), + child: Center( + child: Text( + TranslationLoader.lanKeys!.record!.tr, + style: TextStyle(fontSize: 22.sp), + )), + ), + ), + ], + )), + ], ), ), ); @@ -130,35 +162,42 @@ class _ValueAddedServicesHighFunctionPageState Widget _benefitsContent() { return Column( - children: [ + children: [ Container( // color: Colors.red, margin: EdgeInsets.only(left: 130.w, top: 50.h, right: 130.w), padding: EdgeInsets.only(left: 30.w), - child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Image.asset('images/mine/icon_mine_highFunctionContent_left.png', - width: 30.w, height: 30.w), - Expanded( - child: Text( - TranslationLoader - .lanKeys!.advancedFeaturesAndBenefitsContent!.tr, - textAlign: TextAlign.center, - style: - TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600)), - ), - Image.asset('images/mine/icon_mine_highFunctionContent_right.png', - width: 30.w, height: 30.w) - ]), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'images/mine/icon_mine_highFunctionContent_left.png', + width: 30.w, + height: 30.w), + Expanded( + child: Text( + TranslationLoader + .lanKeys!.advancedFeaturesAndBenefitsContent!.tr, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 24.sp, fontWeight: FontWeight.w600)), + ), + Image.asset( + 'images/mine/icon_mine_highFunctionContent_right.png', + width: 30.w, + height: 30.w) + ]), ), SizedBox( height: 10.h, ), GestureDetector( onTap: () { - Navigator.pushNamed(context, Routers.webviewShowPage, arguments: { - "url": XSConstantMacro.vipServiceDetailURL, - "title": '权益内容'.tr - }); + Navigator.pushNamed(context, Routers.webviewShowPage, + arguments: { + 'url': XSConstantMacro.vipServiceDetailURL, + 'title': '权益内容'.tr + }); }, child: Container( margin: EdgeInsets.only(left: 20.w, right: 20.w), @@ -184,25 +223,25 @@ class _ValueAddedServicesHighFunctionPageState crossAxisSpacing: 8.h, // childAspectRatio: 1 / 0.5, physics: const NeverScrollableScrollPhysics(), - children: [ - _buildItem("images/mine/icon_mine_highFunctionContent_dxmb.png", + children: [ + _buildItem('images/mine/icon_mine_highFunctionContent_dxmb.png', TranslationLoader.lanKeys!.smsTemplate!.tr), - _buildItem("images/mine/icon_mine_highFunctionContent_yjmb.png", + _buildItem('images/mine/icon_mine_highFunctionContent_yjmb.png', TranslationLoader.lanKeys!.emailTemplate!.tr), - _buildItem("images/mine/icon_mine_highFunctionContent_sqgly.png", + _buildItem('images/mine/icon_mine_highFunctionContent_sqgly.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr), - _buildItem("images/mine/icon_mine_highFunctionContent_sfz.png", + _buildItem('images/mine/icon_mine_highFunctionContent_sfz.png', TranslationLoader.lanKeys!.lockGroup!.tr), - _buildItem("images/mine/icon_mine_highFunctionContent_bjft.png", + _buildItem('images/mine/icon_mine_highFunctionContent_bjft.png', TranslationLoader.lanKeys!.sendGroupKey!.tr), // _buildItem("images/mine/icon_mine_highFunctionContent_bjft.png", // TranslationLoader.lanKeys!.markedHouseState!.tr), - _buildItem("images/mine/icon_mine_highFunctionContent_fkgj.png", + _buildItem('images/mine/icon_mine_highFunctionContent_fkgj.png', TranslationLoader.lanKeys!.cardIssuingtool!.tr), _buildItem( - "images/mine/icon_mine_highFunctionContent_fkgj.png", '推送'), + 'images/mine/icon_mine_highFunctionContent_fkgj.png', '推送'), _buildItem( - "images/mine/icon_mine_highFunctionContent_fkgj.png", '考勤'), + 'images/mine/icon_mine_highFunctionContent_fkgj.png', '考勤'), ], ), ), @@ -221,7 +260,7 @@ class _ValueAddedServicesHighFunctionPageState ), child: Column( // crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Image.asset( img, width: 70.w, @@ -231,7 +270,7 @@ class _ValueAddedServicesHighFunctionPageState height: 10.h, ), Column( - children: [ + children: [ Text( title, style: TextStyle(fontSize: 22.sp), @@ -246,30 +285,36 @@ class _ValueAddedServicesHighFunctionPageState Widget _buyNotes() { return Column( - children: [ + children: [ Container( // color: Colors.red, margin: EdgeInsets.only(left: 110.w, top: 50.h, right: 110.w), padding: EdgeInsets.only(left: 30.w), - child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Image.asset('images/mine/icon_mine_highFunctionContent_left.png', - width: 40.w, height: 40.w), - SizedBox( - width: 10.w, - ), - Expanded( - child: Text( - TranslationLoader - .lanKeys!.titleForBuyingAdvancedFeatures!.tr, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 24.sp, fontWeight: FontWeight.w600))), - SizedBox( - width: 10.w, - ), - Image.asset('images/mine/icon_mine_highFunctionContent_right.png', - width: 40.w, height: 40.w) - ]), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'images/mine/icon_mine_highFunctionContent_left.png', + width: 40.w, + height: 40.w), + SizedBox( + width: 10.w, + ), + Expanded( + child: Text( + TranslationLoader + .lanKeys!.titleForBuyingAdvancedFeatures!.tr, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 24.sp, fontWeight: FontWeight.w600))), + SizedBox( + width: 10.w, + ), + Image.asset( + 'images/mine/icon_mine_highFunctionContent_right.png', + width: 40.w, + height: 40.w) + ]), ), SizedBox(height: 20.h), Container( @@ -295,7 +340,7 @@ class _ValueAddedServicesHighFunctionPageState return Container( margin: EdgeInsets.only(top: 30.h, bottom: 30.h), child: Row( - children: [ + children: [ Visibility( child: Container( height: 70.h, diff --git a/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart b/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart index a5d2c715..1462f56e 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart @@ -49,13 +49,13 @@ class _ValueAddedServicesPageListState Image.asset('images/mine/icon_mine_valueAddedServices_note.png'), TranslationLoader.lanKeys!.note!.tr, () { Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage, - arguments: {'type': 1}); + arguments: {'type': 1}); }), _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_email.png'), TranslationLoader.lanKeys!.mail!.tr, () { Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage, - arguments: {'type': 2}); + arguments: {'type': 2}); }), _valueAddedServicesItem( Image.asset( diff --git a/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart b/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart index 77a59cc9..0cfea926 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart @@ -114,7 +114,7 @@ class _ValueAddedServicesNoteAndEmailDetailPageState onTap: () { Navigator.pushNamed( context, Routers.customSMSTemplateListPage, - arguments: {'type': type}); + arguments: {'channelType': type}); }, child: Row( children: [ diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/buy_record_list_entity.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/buy_record_list_entity.dart index c3fcbe3e..02efffc7 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/buy_record_list_entity.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/buy_record_list_entity.dart @@ -1,9 +1,4 @@ class BuyRecordListEntity { - int? errorCode; - String? description; - String? errorMsg; - BuyRecordListData? data; - BuyRecordListEntity( {this.errorCode, this.description, this.errorMsg, this.data}); @@ -14,6 +9,10 @@ class BuyRecordListEntity { data = json['data'] != null ? BuyRecordListData.fromJson(json['data']) : null; } + int? errorCode; + String? description; + String? errorMsg; + BuyRecordListData? data; Map toJson() { final Map data = {}; @@ -28,11 +27,6 @@ class BuyRecordListEntity { } class BuyRecordListData { - int? pageNo; - int? pageSize; - int? total; - List? buyRecordlist; - BuyRecordListData( {this.pageNo, this.pageSize, this.total, this.buyRecordlist}); @@ -47,6 +41,10 @@ class BuyRecordListData { }); } } + int? pageNo; + int? pageSize; + int? total; + List? buyRecordlist; Map toJson() { final Map data = {}; @@ -61,21 +59,6 @@ class BuyRecordListData { } class BuyRecordItem { - int? id; - int? userId; - String? orderNumber; - String? type; - int? recordType; - int? smsCount; - int? emailCount; - int? cloudauthCount; - int? vipLockCount; - int? vipYear; - int? isApply; - String? money; - String? createdAt; - String? updatedAt; - BuyRecordItem( {this.id, this.userId, @@ -108,6 +91,20 @@ class BuyRecordItem { createdAt = json['created_at']; updatedAt = json['updated_at']; } + int? id; + int? userId; + String? orderNumber; + String? type; + int? recordType; + int? smsCount; + int? emailCount; + int? cloudauthCount; + int? vipLockCount; + int? vipYear; + int? isApply; + String? money; + String? createdAt; + String? updatedAt; Map toJson() { final Map data = {}; diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart index 2635ffb6..8db95640 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart @@ -1,14 +1,14 @@ class UseRecordListArg { - static Map sms = { + static Map sms = { 'type': 'sms', }; - static Map vip = { + static Map vip = { 'type': 'vip', }; - static Map email = { + static Map email = { 'type': 'email', }; - static Map cloudauth = { + static Map cloudauth = { 'type': 'cloudauth', }; } diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart index d0d6092a..b1e77696 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart @@ -1,9 +1,4 @@ class UseRecordListEntity { - int? errorCode; - String? description; - String? errorMsg; - Data? data; - UseRecordListEntity( {this.errorCode, this.description, this.errorMsg, this.data}); @@ -13,6 +8,10 @@ class UseRecordListEntity { errorMsg = json['errorMsg']; data = json['data'] != null ? Data.fromJson(json['data']) : null; } + int? errorCode; + String? description; + String? errorMsg; + Data? data; Map toJson() { final Map data = {}; @@ -27,51 +26,37 @@ class UseRecordListEntity { } class Data { - int? pageNo; - int? pageSize; - int? total; - List? useRecordList; - - Data({this.pageNo, this.pageSize, this.total, this.useRecordList}); + Data({this.pageNo, this.pageSize, this.total, this.recordList}); Data.fromJson(Map json) { pageNo = json['pageNo']; pageSize = json['pageSize']; total = json['total']; if (json['list'] != null) { - useRecordList = []; + recordList = []; json['list'].forEach((v) { - useRecordList!.add(UseItemData.fromJson(v)); + recordList!.add(UseItemData.fromJson(v)); }); } } + int? pageNo; + int? pageSize; + int? total; + List? recordList; Map toJson() { final Map data = {}; data['pageNo'] = pageNo; data['pageSize'] = pageSize; data['total'] = total; - if (useRecordList != null) { - data['list'] = useRecordList!.map((v) => v.toJson()).toList(); + if (recordList != null) { + data['list'] = recordList!.map((v) => v.toJson()).toList(); } return data; } } class UseItemData { - int? id; - int? userId; - String? type; - String? receiverAccount; - String? realName; - int? authStatus; - int? lockId; - String? lockName; - int? consCount; - String? createdAt; - String? updatedAt; - String? useDate; - UseItemData( {this.id, this.userId, @@ -83,7 +68,17 @@ class UseItemData { this.lockName, this.consCount, this.createdAt, - this.updatedAt}); + this.updatedAt, + this.useDate, + this.orderNumber, + this.recordType, + this.smsCount, + this.emailCount, + this.cloudauthCount, + this.vipLockCount, + this.vipYear, + this.amount, + this.buyDate}); UseItemData.fromJson(Map json) { id = json['id']; @@ -98,7 +93,37 @@ class UseItemData { createdAt = json['created_at']; updatedAt = json['updated_at']; useDate = json['useDate']; + orderNumber = json['order_number']; + recordType = json['record_type']; + smsCount = json['sms_count']; + emailCount = json['email_count']; + cloudauthCount = json['cloudauth_count']; + vipLockCount = json['vip_lock_count']; + vipYear = json['vip_year']; + amount = json['amount']; + buyDate = json['buyDate']; } + int? id; + int? userId; + String? type; + String? receiverAccount; + String? realName; + int? authStatus; + int? lockId; + String? lockName; + int? consCount; + String? createdAt; + String? updatedAt; + String? useDate; + String? orderNumber; + int? recordType; + int? smsCount; + int? emailCount; + int? cloudauthCount; + int? vipLockCount; + int? vipYear; + String? amount; + String? buyDate; Map toJson() { final Map data = {}; @@ -114,6 +139,15 @@ class UseItemData { data['created_at'] = createdAt; data['updated_at'] = updatedAt; data['useDate'] = useDate; + data['order_number'] = orderNumber; + data['record_type'] = recordType; + data['sms_count'] = smsCount; + data['email_count'] = emailCount; + data['cloudauth_count'] = cloudauthCount; + data['vip_lock_count'] = vipLockCount; + data['vip_year'] = vipYear; + data['amount'] = amount; + data['buyDate'] = buyDate; return data; } } diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart index 1f7bed72..2fe278ae 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart @@ -1,12 +1,9 @@ -import 'dart:async'; - import 'package:get/get.dart'; -import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart'; +import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; -import '../../../network/api_repository.dart'; class ValueAddedServicesRecordLogic extends BaseGetXController { ValueAddedServicesRecordLogic(); @@ -25,6 +22,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { return; } type = data['type']; + loadBuyRecordList(false); } //请求购买记录列表 @@ -32,16 +30,21 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { if (!load) { buyPageNo = 1; } - final AdvancedFunctionRecordEntity entity = - await ApiRepository.to.getBuyRecordList( + final UseRecordListEntity entity = await ApiRepository.to.getBuyRecordList( type: type, recordType: 10, pageNo: buyPageNo, ); if (entity.errorCode!.codeIsSuccessful) { - state.buyRecordList.value = entity.data!.recordList!; + if (load) { + state.buyRecordList.addAll(entity.data!.recordList!); + } else { + state.buyRecordList.value = entity.data!.recordList!; + } state.buyRecordList.refresh(); } + + loadUseRecordList(false); } //请求使用记录列表 @@ -54,27 +57,34 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { pageNo: buyPageNo, ); if (entity.errorCode!.codeIsSuccessful) { - state.useRecordList.value = entity.data!.useRecordList!; + if (load) { + state.useRecordList.addAll(entity.data!.recordList!); + } else { + state.useRecordList.value = entity.data!.recordList!; + } state.useRecordList.refresh(); } } - String getBuyRecordListTitle(RecordItem itemData) { + void getBuyAndUserInfoStr(UseItemData itemData) { if (itemData.type == UseRecordListArg.sms['type']) { - return '${itemData.smsCount}条'; + state.buyCountStr.value = '${itemData.smsCount}条'; + state.useCountStr.value = + '${itemData.receiverAccount ?? ""} ${itemData.consCount}条'; + state.buyAmountStr.value = '¥${itemData.amount}'; } else if (itemData.type == UseRecordListArg.email['type']) { - return '${itemData.emailCount}封'; + state.buyCountStr.value = '${itemData.emailCount}封'; + state.useCountStr.value = + '${itemData.receiverAccount ?? ""} ${itemData.consCount}封'; + state.buyAmountStr.value = '¥${itemData.amount}'; } else if (itemData.type == UseRecordListArg.cloudauth['type']) { - return '实名认证/${itemData.cloudauthCount}次'; + state.buyCountStr.value = '实名认证/${itemData.cloudauthCount}次'; + state.useCountStr.value = + '${itemData.lockName ?? ""} ${itemData.realName ?? ""}'; + state.buyAmountStr.value = '¥${itemData.amount}'; } - return ''; - } - - @override - void onReady() { - super.onReady(); - - loadBuyRecordList(false); - loadUseRecordList(false); + state.buyCountStr.refresh(); + state.useCountStr.refresh(); + state.buyAmountStr.refresh(); } } diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart index dc641f9d..629bcc3f 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart @@ -2,7 +2,6 @@ import 'package:easy_refresh/easy_refresh.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart'; import 'package:star_lock/tools/noData.dart'; @@ -19,85 +18,84 @@ class ValueAddedServicesRecordPage extends StatefulWidget { class _ValueAddedServicesRecordPageState extends State { + final ValueAddedServicesRecordLogic logic = + Get.put(ValueAddedServicesRecordLogic()); + @override Widget build(BuildContext context) { - return GetBuilder( - init: ValueAddedServicesRecordLogic(), - builder: (ValueAddedServicesRecordLogic logic) { - return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: '记录'.tr, - haveBack: true, - backgroundColor: AppColors.mainColor), - body: DefaultTabController( - length: 2, - child: Column( - children: [ - TabBar( - tabs: [tabTextItem('购买记录'.tr), tabTextItem('使用记录'.tr)], - indicatorColor: AppColors.mainColor, - indicatorSize: TabBarIndicatorSize.label, - labelColor: AppColors.mainColor, - unselectedLabelColor: AppColors.darkGrayTextColor, - ), - Expanded( - child: Obx(() => TabBarView(children: [ - _PurchaseRecords( - buyRecordList: logic.state.buyRecordList.value, - ), - _UseRecordsTable( - useRecordList: logic.state.useRecordList.value, - ), - ])), - ), - ], - ), + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '记录'.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: DefaultTabController( + length: 2, + child: Column( + children: [ + TabBar( + tabs: [tabTextItem('购买记录'.tr), tabTextItem('使用记录'.tr)], + indicatorColor: AppColors.mainColor, + indicatorSize: TabBarIndicatorSize.label, + labelColor: AppColors.mainColor, + unselectedLabelColor: AppColors.darkGrayTextColor, ), - ); - }); + Expanded( + child: TabBarView( + children: [ + _PurchaseRecords( + buyRecordList: logic.state.buyRecordList, logic: logic), + _UseRecordsTable( + useRecordList: logic.state.useRecordList, logic: logic), + ], + )), + ], + ), + ), + ); } -} -Widget tabTextItem(String tabText) { - return Container( - margin: EdgeInsets.symmetric(vertical: 16.h), - child: Text( - tabText, - style: TextStyle(fontSize: 24.sp), - ), - ); + Widget tabTextItem(String tabText) { + return Container( + margin: EdgeInsets.symmetric(vertical: 16.h), + child: Text( + tabText, + style: TextStyle(fontSize: 24.sp), + ), + ); + } } // 购买记录 class _PurchaseRecords extends StatelessWidget { - const _PurchaseRecords({required this.buyRecordList}); - final List buyRecordList; + const _PurchaseRecords({required this.buyRecordList, required this.logic}); + final List buyRecordList; + final ValueAddedServicesRecordLogic logic; @override Widget build(BuildContext context) { - return GetBuilder( - builder: (ValueAddedServicesRecordLogic logic) { - return EasyRefresh( + return EasyRefresh( onRefresh: () async { logic.loadBuyRecordList(false); }, onLoad: () async { logic.loadBuyRecordList(true); }, - child: buyRecordList.isNotEmpty - ? ListView.builder( - itemCount: buyRecordList.length, - itemBuilder: (BuildContext context, int index) { - return _recordKeyItem(buyRecordList[index], logic); - }) - : NoData(), - ); - }); + child: Obx( + () => buyRecordList.isNotEmpty + ? ListView.builder( + itemCount: buyRecordList.length, + itemBuilder: (BuildContext context, int index) { + logic.getBuyAndUserInfoStr(buyRecordList[index]); + return _recordKeyItem(buyRecordList[index], logic); + }) + : NoData(), + )); } Widget _recordKeyItem( - RecordItem itemData, ValueAddedServicesRecordLogic logic) { + UseItemData itemData, ValueAddedServicesRecordLogic logic) { return Container( color: Colors.white, margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h), @@ -115,7 +113,7 @@ class _PurchaseRecords extends StatelessWidget { fontWeight: FontWeight.bold), ), Expanded(child: Container()), - Text('¥${itemData.amount}', + Text(logic.state.buyAmountStr.value, style: TextStyle( fontSize: 24.sp, color: AppColors.blackColor, @@ -123,7 +121,7 @@ class _PurchaseRecords extends StatelessWidget { ], ), SizedBox(height: 8.h), - Text(logic.getBuyRecordListTitle(itemData), + Text(logic.state.buyCountStr.value, style: TextStyle( fontSize: 22.sp, color: AppColors.darkGrayTextColor)), ], @@ -134,32 +132,33 @@ class _PurchaseRecords extends StatelessWidget { // 使用记录 class _UseRecordsTable extends StatelessWidget { - const _UseRecordsTable({required this.useRecordList}); - final List useRecordList; + const _UseRecordsTable({required this.useRecordList, required this.logic}); + final List useRecordList; + final ValueAddedServicesRecordLogic logic; @override Widget build(BuildContext context) { - return GetBuilder( - builder: (ValueAddedServicesRecordLogic logic) { - return EasyRefresh( + return EasyRefresh( onRefresh: () async { logic.loadUseRecordList(false); }, onLoad: () async { logic.loadUseRecordList(true); }, - child: useRecordList.isNotEmpty - ? ListView.builder( - itemCount: useRecordList.length, - itemBuilder: (BuildContext context, int index) { - return _recordKeyItem(useRecordList[index]); - }) - : NoData(), - ); - }); + child: Obx( + () => useRecordList.isNotEmpty + ? ListView.builder( + itemCount: useRecordList.length, + itemBuilder: (BuildContext context, int index) { + logic.getBuyAndUserInfoStr(useRecordList[index]); + return _recordKeyItem(useRecordList[index], logic); + }) + : NoData(), + )); } - Widget _recordKeyItem(UseItemData itemData) { + Widget _recordKeyItem( + UseItemData itemData, ValueAddedServicesRecordLogic logic) { return Container( color: Colors.white, margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h), @@ -170,7 +169,7 @@ class _UseRecordsTable extends StatelessWidget { Row( children: [ Text( - '${itemData.lockName ?? ""} ${itemData.realName ?? ""}', + logic.state.useCountStr.value, style: TextStyle( fontSize: 24.sp, color: AppColors.blackColor, diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart index 30b6f477..1dbb4612 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart @@ -1,7 +1,12 @@ import 'package:get/get.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; class ValueAddedServicesRecordState { int index = 0; - var buyRecordList = [].obs; //购买记录列表 - var useRecordList = [].obs; //使用记录列表 + RxList buyRecordList = [].obs; //购买记录列表 + RxList useRecordList = [].obs; //使用记录列表 + RxString buyCountStr = ''.obs; + RxString useCountStr = ''.obs; + RxString receiverUserStr = ''.obs; + RxString buyAmountStr = ''.obs; } diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart index 780f4f2f..4bdadf39 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart @@ -1,6 +1,153 @@ +import 'dart:convert'; + class NewSMSTemplateEntity { - NewSMSTemplateEntity( - {this.errorCode, this.description, this.errorMsg, this.dataList}); + NewSMSTemplateEntity({ + this.errorCode, + this.description, + this.errorMsg, + this.dataList, + }); + + NewSMSTemplateEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + if (json['data'] != null) { + dataList = []; + json['data'].forEach((v) { + dataList!.add(LangData.fromJson(v)); + }); + } + } + + int? errorCode; + String? description; + String? errorMsg; + List? dataList; + + Map toJson() { + final Map data = {}; + data['errorCode'] = errorCode; + data['description'] = description; + data['errorMsg'] = errorMsg; + if (dataList != null) { + data['data'] = dataList!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LangData { + LangData({ + this.langType, + this.langName, + this.templates, + }); + + LangData.fromJson(Map json) { + langType = json['langType']; + langName = json['langName']; + if (json['templates'] != null) { + templates = []; + json['templates'].forEach((v) { + templates!.add(TemplateData.fromJson(v)); + }); + } + } + + int? langType; + String? langName; + List? templates; + + Map toJson() { + final Map data = {}; + data['langType'] = langType; + data['langName'] = langName; + if (templates != null) { + data['templates'] = templates!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class TemplateData { + TemplateData({ + this.langType, + this.langName, + this.templateType, + this.templateName, + this.template, + this.templatePreviewCode, + }); + + TemplateData.fromJson(Map json) { + langType = json['langType']; + langName = json['langName']; + templateType = json['templateType']; + templateName = json['templateName']; + template = json['template']; + templatePreviewCode = json['templatePreviewCode'] != null + ? jsonEncode(json['templatePreviewCode']) + : null; + } + + int? langType; + String? langName; + int? templateType; + String? templateName; + String? template; + String? fixedKey; + String? templatePreviewCode; // Changed to String + String? regards = ''; + String? tips = ''; + int? id; + String? name; + int? channelType; + bool? isUpdate = false; + + Map toJson() { + final Map data = {}; + data['langType'] = langType; + data['langName'] = langName; + data['templateType'] = templateType; + data['templateName'] = templateName; + data['template'] = template; + if (templatePreviewCode != null) { + data['templatePreviewCode'] = jsonDecode(templatePreviewCode!); + } + return data; + } + + // New method to replace template variables with values from templatePreviewCode + String generatePreview() { + if (template == null || templatePreviewCode == null) { + return ''; + } + + // Decode the templatePreviewCode string back to a map + final Map previewCodeMap = + Map.from(jsonDecode(templatePreviewCode!)); + + String previewTemplate = template!; + previewCodeMap.forEach((String key, String value) { + previewTemplate = previewTemplate.replaceAll( + key, value + (value.length > 2 ? '\n' : '')); + }); + + return previewTemplate; + } +} + + +/* +class NewSMSTemplateEntity { + NewSMSTemplateEntity({ + this.errorCode, + this.description, + this.errorMsg, + this.dataList, + }); + NewSMSTemplateEntity.fromJson(Map json) { errorCode = json['errorCode']; description = json['description']; @@ -12,6 +159,7 @@ class NewSMSTemplateEntity { }); } } + int? errorCode; String? description; String? errorMsg; @@ -30,18 +178,29 @@ class NewSMSTemplateEntity { } class SMSTemplateData { - SMSTemplateData( - {this.contentType, this.typeName, this.template, this.fixedKey}); + SMSTemplateData({ + this.contentType, + this.typeName, + this.template, + this.fixedKey, + this.templatePreviewCode, + }); + SMSTemplateData.fromJson(Map json) { contentType = json['content_type']; typeName = json['typeName']; template = json['template']; fixedKey = json['fixed_key']; + templatePreviewCode = json['template_preview_code'] != null + ? jsonEncode(json['template_preview_code']) + : null; } + int? contentType; String? typeName; String? template; String? fixedKey; + String? templatePreviewCode; // Changed to String String? regards = ''; String? tips = ''; int? id; @@ -55,6 +214,29 @@ class SMSTemplateData { data['typeName'] = typeName; data['template'] = template; data['fixed_key'] = fixedKey; + if (templatePreviewCode != null) { + data['template_preview_code'] = jsonDecode(templatePreviewCode!); + } return data; } + + // New method to replace template variables with values from templatePreviewCode + String generatePreview() { + if (template == null || templatePreviewCode == null) { + return ''; + } + + // Decode the templatePreviewCode string back to a map + final Map previewCodeMap = + Map.from(jsonDecode(templatePreviewCode!)); + + String previewTemplate = template!; + previewCodeMap.forEach((String key, String value) { + previewTemplate = previewTemplate.replaceAll( + key, value + (value.length > 2 ? '\n' : '')); + }); + + return previewTemplate; + } } +*/ diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart index 0c149a5d..55f7a3d1 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart @@ -14,14 +14,19 @@ class NewSMSTemplateLogic extends BaseGetXController { //获取默认模板-- 1:电子钥匙 2:密码 Future getDefaultTemplate() async { - final NewSMSTemplateEntity entity = await ApiRepository.to - .getDefaultTemplate(type: state.templateType.value); + final NewSMSTemplateEntity entity = + await ApiRepository.to.getDefaultTemplate(); if (entity.errorCode!.codeIsSuccessful) { - state.templateList.value = entity.dataList ?? []; + state.langTemplateList.value = entity.dataList ?? []; + + state.templateList.value = + entity.dataList![state.selectedLangIndex.value].templates ?? + []; if (state.templateList.isNotEmpty) { state.currentTemplate.value = state.templateList.firstWhere( - (SMSTemplateData element) => - element.name == state.templateList[0].name, + (TemplateData element) => + element.name == + state.templateList[state.selectedTemplateIndex.value].name, ); state.currentTemplate.refresh(); } @@ -35,12 +40,13 @@ class NewSMSTemplateLogic extends BaseGetXController { return; } final LoginEntity entity = await ApiRepository.to.addTemplateService( - type: state.templateType.value, - name: state.templateNameTf.text, - fixedKey: state.currentTemplate.value.fixedKey ?? '', - contentType: state.currentTemplate.value.contentType ?? 0, - regards: state.templateOneTf.text, - tips: state.templateTwoTf.text); + channelType: state.channelType.value, + name: state.templateNameTf.text, + langType: state.currentTemplate.value.langType ?? 0, + regards: state.templateOneTf.text, + tips: state.templateTwoTf.text, + templateType: state.currentTemplate.value.templateType ?? 0, + ); if (entity.errorCode!.codeIsSuccessful) { showToast('添加成功'); Get.back(result: true); @@ -60,12 +66,10 @@ class NewSMSTemplateLogic extends BaseGetXController { } // 更新短信条数的函数 - void updateSmsCost(String template) { - state.smsCost.value = calculateSmsCost(template); - } - - int calculateSmsCost(String template) { - final int smsCount = template.length; + int calculateSmsCost() { + final String smsText = + '${state.templateOneTf.text}\n${state.currentTemplate.value.template}\n${state.templateTwoTf.text}'; + final int smsCount = smsText.length; if (smsCount <= 70) { return 1; } else { @@ -75,15 +79,6 @@ class NewSMSTemplateLogic extends BaseGetXController { //构建电子钥匙模板 List buildElectronicKeySpan({required bool isPreview}) { - //短信模版 - if (state.templateType.value == 1) { - return _buildSMSElectronicKey(isPreview); - } else { - return _buildEmailElectronicKey(isPreview); - } - } - - List _buildSMSElectronicKey(bool isPreview) { final List textSpans = []; // 如果是预览模式,添加预览模板的文本 if (isPreview) { @@ -94,6 +89,36 @@ class NewSMSTemplateLogic extends BaseGetXController { ), ); } + + if (isPreview) { + if (state.currentTemplate.value.generatePreview().isNotEmpty) { + textSpans.add( + TextSpan( + text: state.currentTemplate.value.generatePreview(), + style: state.defaultStyle, + ), + ); + } else { + textSpans.addAll(_buildDefaultTemplate(isPreview)); + } + } else { + textSpans.addAll(_buildDefaultTemplate(isPreview)); + } + + if (isPreview) { + textSpans.add( + TextSpan( + text: '\n${state.templateTwoTf.text}\n', + style: state.defaultStyle, + ), + ); + } + + return textSpans; + } + + List _buildDefaultTemplate(bool isPreview) { + final List textSpans = []; // 将模板分割为文本片段 final List textFragments = state.currentTemplate.value.template ?.split(RegularExpression.urlRegExp) ?? @@ -129,71 +154,6 @@ class NewSMSTemplateLogic extends BaseGetXController { } } - // 如果是预览模式,添加预览模板的文本 - if (isPreview) { - textSpans.add( - TextSpan( - text: '\n${state.templateTwoTf.text}', - style: state.defaultStyle, - ), - ); - } - return textSpans; - } - - List _buildEmailElectronicKey(bool isPreview) { - final List textSpans = []; - - //邮件模版 - // 如果是预览模式,添加预览模板的文本 - if (isPreview) { - textSpans.add( - TextSpan( - text: '${state.templateOneTf.text}\n', - style: state.defaultStyle, - ), - ); - } else { - String template = state.currentTemplate.value.template ?? ''; - template = template.replaceAll(',', ',\n'); - - // 定义匹配 ${} 包围的变量的正则表达式 - final RegExp variableRegExp = RegExp(r'\{([^}]+)\}'); - final Iterable matches = variableRegExp.allMatches(template); - - int start = 0; - for (final Match match in matches) { - // 添加非变量文本 - if (match.start > start) { - textSpans.add( - TextSpan( - text: template.substring(start, match.start), - style: state.defaultStyle, - ), - ); - } - - // 添加变量文本 - textSpans.add( - TextSpan( - text: match.group(0), - style: state.highStyle, - ), - ); - - start = match.end; - } - - // 添加剩余的非变量文本 - if (start < template.length) { - textSpans.add( - TextSpan( - text: template.substring(start), - style: state.defaultStyle, - ), - ); - } - } return textSpans; } @@ -209,69 +169,85 @@ class NewSMSTemplateLogic extends BaseGetXController { ), ); } - - //短信模版才需要加默认模版 - if (state.templateType == 1 || - (state.templateType == 2 && isPreview == false)) { - // 定义匹配 ${} 包围的变量的正则表达式 - final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}'); - - final String template = state.currentTemplate.value.template ?? ''; - - // 对模板进行处理 - int startIndex = 0; - for (final Match match in variableRegExp.allMatches(template)) { - // 处理变量之前的文本 - final String nonVariableText = - template.substring(startIndex, match.start); - // 替换非变量文本中的字符 - final String replacedNonVariableText = - nonVariableText.replaceAllMapped(RegExp(r',|。'), (Match match) { - return '${match.group(0)}\n'; - }); + if (isPreview) { + if (state.currentTemplate.value.generatePreview().isNotEmpty) { textSpans.add( TextSpan( - text: replacedNonVariableText, + text: state.currentTemplate.value.generatePreview(), style: state.defaultStyle, ), ); - // 处理变量 - final String variableText = match.group(0) ?? ''; - textSpans.add( - TextSpan( - text: variableText, - style: state.highStyle, - ), - ); - - // 更新起始索引 - startIndex = match.end; + // 在预览模式下,添加预览模板的文本 + if (isPreview) { + textSpans.add( + TextSpan( + text: '\n${state.templateTwoTf.text}', + style: state.defaultStyle, + ), + ); + } } + return textSpans; + } - // 添加最后一个变量之后的文本 - final String remainingText = template.substring(startIndex); + // 定义匹配 ${} 包围的变量的正则表达式 + final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}'); + final String template = state.currentTemplate.value.template ?? ''; + + // 对模板进行处理 + int startIndex = 0; + for (final Match match in variableRegExp.allMatches(template)) { + // 处理变量之前的文本 + final String nonVariableText = + template.substring(startIndex, match.start); // 替换非变量文本中的字符 - final String replacedRemainingText = - remainingText.replaceAllMapped(RegExp(r',|。'), (Match match) { + final String replacedNonVariableText = + nonVariableText.replaceAllMapped(RegExp(r',|。'), (Match match) { return '${match.group(0)}\n'; }); textSpans.add( TextSpan( - text: replacedRemainingText, + text: replacedNonVariableText, style: state.defaultStyle, ), ); - // 在预览模式下,添加预览模板的文本 - if (isPreview) { - textSpans.add( - TextSpan( - text: '\n${state.templateTwoTf.text}', - style: state.defaultStyle, - ), - ); - } + // 处理变量 + final String variableText = match.group(0) ?? ''; + textSpans.add( + TextSpan( + text: variableText, + style: state.highStyle, + ), + ); + + // 更新起始索引 + startIndex = match.end; + } + + // 添加最后一个变量之后的文本 + final String remainingText = template.substring(startIndex); + // 替换非变量文本中的字符 + final String replacedRemainingText = + remainingText.replaceAllMapped(RegExp(r',|。'), (Match match) { + return '${match.group(0)}\n'; + }); + textSpans.add( + TextSpan( + text: replacedRemainingText, + style: state.defaultStyle, + ), + ); + + // 在预览模式下,添加预览模板的文本 + if (isPreview) { + textSpans.add( + TextSpan( + text: '\n${state.templateTwoTf.text}', + style: state.defaultStyle, + ), + ); } return textSpans; @@ -281,8 +257,8 @@ class NewSMSTemplateLogic extends BaseGetXController { Future onReady() async { super.onReady(); - if (state.currentTemplate.value.isUpdate == false) { - getDefaultTemplate(); - } + // if (state.currentTemplate.value.isUpdate == false) { + getDefaultTemplate(); + // } } } diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart index afee8c2f..6d6fa748 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; @@ -28,7 +29,13 @@ class _NewSMSTemplatePageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: state.templateType == 1 ? '新建短信模版'.tr : '新建邮件模版'.tr, + barTitle: state.isUpdate.value == false + ? state.channelType.value == 1 + ? '新建短信模版'.tr + : '新建邮件模版'.tr + : state.channelType.value == 1 + ? '编辑短信模版'.tr + : '编辑邮件模版'.tr, haveBack: true, backgroundColor: AppColors.mainColor, ), @@ -74,15 +81,24 @@ class _NewSMSTemplatePageState extends State { TranslationLoader.lanKeys!.pleaseEnter!.tr, ), ), - Obx( - () => CommonItem( - leftTitel: TranslationLoader.lanKeys!.type!.tr, - rightTitle: state.currentTemplate.value.typeName ?? '', - isHaveLine: false, - isHaveDirection: true, - action: _showSelectTemplateType, - ), - ), + Obx(() => state.isUpdate.value == false + ? CommonItem( + leftTitel: TranslationLoader.lanKeys!.type!.tr, + rightTitle: state.currentTemplate.value.templateName ?? '', + isHaveLine: true, + isHaveDirection: true, + action: _showSelectTemplateType, + ) + : Container()), + Obx(() => state.isUpdate.value == false + ? CommonItem( + leftTitel: '模版类型', + rightTitle: state.currentTemplate.value.langName ?? '', + isHaveLine: false, + isHaveDirection: true, + action: _showSelectLangType, + ) + : Container()), ], ); } @@ -112,21 +128,20 @@ class _NewSMSTemplatePageState extends State { Obx(() => Container( width: 1.sw - 50.w, margin: EdgeInsets.only(left: 25.w, right: 25.w), + padding: EdgeInsets.only(bottom: 20.h), child: _buildTemplateWithType(isPreview: false), )), SizedBox(height: 10.h), - Obx(() => Visibility( - visible: state.templateType.value == 1, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h), - height: 100, - child: Stack( - alignment: Alignment.bottomRight, - children: [ - _buildTextField(state.templateTwoTf), - ], - ), - ))), + Container( + margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h), + height: 100, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + _buildTextField(state.templateTwoTf), + ], + ), + ) ], ), ); @@ -151,6 +166,8 @@ class _NewSMSTemplatePageState extends State { ), Obx(() => Container( width: 1.sw - 50.w, + // margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 20.h), + // padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h), margin: EdgeInsets.only(left: 25.w, right: 25.w), padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), decoration: BoxDecoration( @@ -159,20 +176,25 @@ class _NewSMSTemplatePageState extends State { ), child: _buildTemplateWithType(isPreview: true), )), - Padding( - padding: EdgeInsets.only( - left: 25.w, - top: 25.h, - bottom: 25.h, - ), - child: Text( - '预计产生短信条数:${state.smsCost.value}', - style: TextStyle( - color: Colors.grey, - fontSize: 20.sp, + if (state.channelType.value == 1) + Padding( + padding: EdgeInsets.only( + left: 25.w, + top: 25.h, + bottom: 25.h, ), - ), - ), + child: Text( + '预计产生短信条数:${logic.calculateSmsCost()}', + style: TextStyle( + color: Colors.grey, + fontSize: 20.sp, + ), + ), + ) + else + SizedBox( + height: 20.h, + ) ], ), ); @@ -186,7 +208,7 @@ class _NewSMSTemplatePageState extends State { } else { return RichText( text: TextSpan( - children: state.currentTemplate.value.typeName == '电子钥匙' + children: state.currentTemplate.value.templateName == '电子钥匙' ? logic.buildElectronicKeySpan(isPreview: isPreview) : logic.buildPasswordSpan(isPreview: isPreview), ), @@ -212,43 +234,46 @@ class _NewSMSTemplatePageState extends State { ), ), onChanged: (String value) { - setState(() { - controller.text = value; - logic.updateSmsCost(value); // 更新短信条数 - }); + setState(logic.calculateSmsCost); }, ); } Widget getTFWidget(TextEditingController tfController, String tfStr) { return SizedBox( - height: 50.h, - width: 300.w, - child: Row( - children: [ - Expanded( - child: TextField( - maxLines: 1, - controller: tfController, - autofocus: false, - textAlign: TextAlign.end, - style: TextStyle(fontSize: 22.sp), - decoration: InputDecoration( - contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), - hintText: tfStr, - hintStyle: TextStyle(fontSize: 22.sp), - border: InputBorder.none, - ), - ), - ), + height: 65.h, + width: 320.w, + child: TextField( + controller: tfController, //输入框一行 + maxLines: 3, + inputFormatters: [ + FilteringTextInputFormatter.deny('\n'), + LengthLimitingTextInputFormatter(50), ], + autofocus: false, + textAlign: TextAlign.end, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + hintText: tfStr, + 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: EdgeInsets.only(top: 20.h, bottom: 0)), + style: + TextStyle(fontSize: 22.sp, textBaseline: TextBaseline.alphabetic), ), ); } void _showSelectTemplateType() { final List titleList = state.templateList - .map((SMSTemplateData template) => template.typeName ?? '') + .map((TemplateData template) => template.templateName ?? '') .toList(); ShowBottomSheetTool().showSingleRowPicker( context, @@ -258,8 +283,35 @@ class _NewSMSTemplatePageState extends State { sureTitle: TranslationLoader.lanKeys!.sure!.tr, data: titleList, clickCallBack: (int index, Object str) { + state.selectedTemplateIndex.value = index; state.currentTemplate.value = state.templateList[index]; - state.currentTemplate.value.typeName = str.toString(); + state.currentTemplate.value.templateName = str.toString(); + state.selectedTemplateIndex.refresh(); + state.currentTemplate.refresh(); + }, + ); + } + + void _showSelectLangType() { + // 提取 langName 列表 + final List langNames = state.langTemplateList + .map((LangData langData) => langData.langName ?? '') + .toList(); + + ShowBottomSheetTool().showSingleRowPicker( + context, + normalIndex: 0, + title: TranslationLoader.lanKeys!.type!.tr, + cancelTitle: TranslationLoader.lanKeys!.cancel!.tr, + sureTitle: TranslationLoader.lanKeys!.sure!.tr, + data: langNames, + clickCallBack: (int index, Object str) { + state.selectedLangIndex.value = index; + state.currentTemplate.value = state + .langTemplateList[state.selectedLangIndex.value] + .templates![state.selectedTemplateIndex.value]; + state.currentTemplate.value.langName = str.toString(); + state.selectedLangIndex.refresh(); state.currentTemplate.refresh(); }, ); diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart index d2b540d2..f3536b4c 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart @@ -12,7 +12,8 @@ class NewSMSTemplateState { templateNameTf.text = currentTemplate.value.name ?? ''; templateOneTf.text = currentTemplate.value.regards ?? ''; templateTwoTf.text = currentTemplate.value.tips ?? ''; - templateType.value = currentTemplate.value.type ?? 0; + channelType.value = currentTemplate.value.channelType ?? 0; + isUpdate.value = map['isUpdate']; } } @@ -29,9 +30,13 @@ class NewSMSTemplateState { final TextEditingController templateNameTf = TextEditingController(); RxBool isVip = false.obs; - RxList templateList = [].obs; - Rx currentTemplate = SMSTemplateData().obs; //当前模板信息 + RxList templateList = [].obs; + Rx currentTemplate = TemplateData().obs; //当前模板信息 + RxList langTemplateList = [].obs; //语言模板列表 + RxInt selectedLangIndex = 0.obs; //选中的语言模板 + RxInt selectedTemplateIndex = 0.obs; //选中的模板 RxBool isShowDate = false.obs; //是否显示日期 - RxInt templateType = 0.obs; //1:短信 2:邮件 - RxInt smsCost = 0.obs; //短信条数 + RxInt channelType = 0.obs; //1:短信 2:邮件 + RxString preContent = ''.obs; //预览内容 + RxBool isUpdate = false.obs; //是否是修改模板 } diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart index 89e01d9d..bc1e5694 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart @@ -29,7 +29,7 @@ class CustomSMSTemplateListEntity { class CustomSMSTemplateListData { CustomSMSTemplateListData( - {this.type, + {this.channelType, this.list, this.pageNo, this.pageSize, @@ -37,7 +37,7 @@ class CustomSMSTemplateListData { this.total}); CustomSMSTemplateListData.fromJson(Map json) { - type = json['type']; + channelType = json['channelType']; if (json['list'] != null) { list = []; json['list'].forEach((v) { @@ -49,7 +49,7 @@ class CustomSMSTemplateListData { pages = json['pages']; total = json['total']; } - int? type; + int? channelType; List? list; int? pageNo; int? pageSize; @@ -58,7 +58,7 @@ class CustomSMSTemplateListData { Map toJson() { final Map data = {}; - data['type'] = type; + data['channelType'] = channelType; if (list != null) { data['list'] = list!.map((v) => v.toJson()).toList(); } @@ -73,58 +73,51 @@ class CustomSMSTemplateListData { class CustomSMSTemplateItem { CustomSMSTemplateItem( {this.id, - this.userId, - this.type, - this.contentType, + this.channelType, + this.templateType, this.name, this.regards, this.tips, - this.fixedKey, this.createdAt, this.updatedAt, - this.template, - this.fixedTemplate}); + this.langType, + this.template}); + CustomSMSTemplateItem.fromJson(Map json) { id = json['id']; - userId = json['user_id']; - type = json['type']; - contentType = json['content_type']; + channelType = json['channelType']; + templateType = json['templateType']; name = json['name']; regards = json['regards']; tips = json['tips']; - fixedKey = json['fixed_key']; createdAt = json['created_at']; updatedAt = json['updated_at']; + langType = json['langType']; template = json['template']; - fixedTemplate = json['fixed_template']; } int? id; - int? userId; - int? type; - int? contentType; + int? channelType; + int? templateType; String? name; String? regards; String? tips; - String? fixedKey; String? createdAt; String? updatedAt; + int? langType; String? template; - String? fixedTemplate; Map toJson() { final Map data = {}; data['id'] = id; - data['user_id'] = userId; - data['type'] = type; - data['content_type'] = contentType; + data['channelType'] = channelType; + data['templateType'] = templateType; data['name'] = name; data['regards'] = regards; data['tips'] = tips; - data['fixed_key'] = fixedKey; data['created_at'] = createdAt; data['updated_at'] = updatedAt; + data['langType'] = langType; data['template'] = template; - data['fixed_template'] = fixedTemplate; return data; } } diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart index 68776f5e..2d6ba6d1 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart @@ -20,7 +20,7 @@ class CustomSMSTemplateListLogic extends BaseGetXController { } final CustomSMSTemplateListEntity entity = await ApiRepository.to .getSMSTemplateList( - type: state.type.value, + channelType: state.channelType.value, pageNo: pageNo, pageSize: int.parse(pageSize)); if (entity.errorCode!.codeIsSuccessful) { diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart index a6842aec..bc85004b 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart @@ -42,7 +42,7 @@ class _CustomSMSTemplateListPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: state.type.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr, + barTitle: state.channelType.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: EasyRefreshTool( @@ -66,14 +66,15 @@ class _CustomSMSTemplateListPageState extends State { left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), onClick: () async { - final SMSTemplateData templateData = SMSTemplateData(); - templateData.type = state.type.value; + final TemplateData templateData = TemplateData(); + templateData.channelType = state.channelType.value; templateData.isUpdate = false; - templateData.typeName = - templateData.contentType == 1 ? '电子钥匙' : '密码'; + templateData.templateName = + templateData.templateType == 1 ? '电子钥匙' : '密码'; final result = await Get.toNamed(Routers.newSMSTemplatePage, - arguments: { - 'currentTemplate': templateData + arguments: { + 'currentTemplate': templateData, + 'isUpdate': false }); if (result != null) { logic.getSMSTemplateListRequest(isRefresh: true); @@ -196,20 +197,19 @@ class _CustomSMSTemplateListPageState extends State { CustomSMSTemplateItem itemData) { return GestureDetector( onTap: () async { - final SMSTemplateData templateData = SMSTemplateData(); + final TemplateData templateData = TemplateData(); templateData.name = itemData.name; templateData.regards = itemData.regards; templateData.tips = itemData.tips; templateData.id = itemData.id; templateData.template = itemData.template; - templateData.contentType = itemData.contentType; - templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码'; - templateData.type = itemData.type; + templateData.templateType = itemData.templateType; + templateData.templateName = + templateData.templateName == 1 ? '电子钥匙' : '密码'; + templateData.channelType = itemData.channelType; templateData.isUpdate = true; final result = await Get.toNamed(Routers.newSMSTemplatePage, - arguments: { - 'currentTemplate': templateData - }); + arguments: {'currentTemplate': templateData, 'isUpdate': true}); if (result != null) { logic.getSMSTemplateListRequest(isRefresh: true); } @@ -241,7 +241,7 @@ class _CustomSMSTemplateListPageState extends State { padding: EdgeInsets.only(left: 20.w, top: 20.h, bottom: 20.h), child: RichText( text: TextSpan( - children: itemData.contentType == 1 + children: itemData.templateType == 1 ? logic.buildElectronicKeySpan(templateData: itemData) : logic.buildPasswordSpan(templateData: itemData), ), diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart index 89f65961..ea4cf697 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart @@ -6,7 +6,7 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/ class CustomSMSTemplateListState { CustomSMSTemplateListState() { if (Get.arguments != null) { - type.value = Get.arguments['type']; + channelType.value = Get.arguments['channelType']; } } //高亮样式 @@ -19,5 +19,5 @@ class CustomSMSTemplateListState { RxBool isVip = false.obs; RxList smsTemplateList = [].obs; - RxInt type = 0.obs; + RxInt channelType = 0.obs; } diff --git a/lib/network/api.dart b/lib/network/api.dart index 0d7f2d05..65b57f2c 100755 --- a/lib/network/api.dart +++ b/lib/network/api.dart @@ -243,9 +243,7 @@ abstract class Api { final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //获取短信或者邮箱模板 final String appGetAppInfoURL = '/app/getAppInfo'; //获取APP基本信息 final String appGetFwVersionURL = '/app/getFwVersion'; //获取固件信息 - final String smsTemplateListURL = '/v2/service/listTemplate'; //获取短信模板列表 - final String emailTemplateListURL = - '/v2/service/listEmailTemplate'; //获取邮件模板列表 + final String haveTemplateListURL = '/v2/service/listTemplate'; //获取已添加模板列表 final String getDefaultTemplateURL = '/v2/service/getDefaultTemplate'; //获取默认模板 final String addTemplateServiceURL = '/v2/service/addTemplate'; //添加短信模板 @@ -255,7 +253,7 @@ abstract class Api { final String checkIpURL = '/checkIp/ip'; final String keyNoticeTemplateURL = '/key/getNoticeTemplate'; //获取电子钥匙通知模板 - final String keyNoticeSubmitURL = '/key/noticeSubmit'; //发送短信、邮件通知 + final String keyNoticeSubmitURL = '/v2/key/noticeSubmit'; //发送短信、邮件通知 final String lockUpdateLockInfo = '/lock/updateLockInfo'; //更新锁固件版本 final String exportLockRecordsURL = '/lockRecords/export'; //导出锁操作记录 } diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index 2f4688d9..0c897578 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -2191,19 +2191,19 @@ class ApiProvider extends BaseProvider { ); // 获取默认模板 - Future> getDefaultTemplate(int type) => post( + Future> getDefaultTemplate() => post( getDefaultTemplateURL.toUrl, - jsonEncode({'type': type}), + jsonEncode({}), isUnShowLoading: true, ); // 获取短信模板列表 Future> getSMSTemplateList( - int type, int pageNo, int pageSize) => + int channelType, int pageNo, int pageSize) => post( - smsTemplateListURL.toUrl, + haveTemplateListURL.toUrl, jsonEncode({ - 'type': type, + 'channelType': channelType, 'pageNo': pageNo, 'pageSize': pageSize }), @@ -2211,17 +2211,17 @@ class ApiProvider extends BaseProvider { ); // 添加短信模板 - Future> addTemplateService(int type, String name, - int contentType, String regards, String tips, String fixedKey) => + Future> addTemplateService(int channelType, String name, + int langType, String regards, String tips, int templateType) => post( addTemplateServiceURL.toUrl, jsonEncode({ - 'type': type, + 'channelType': channelType, 'name': name, - 'content_type': contentType, + 'langType': langType, 'regards': regards, 'tips': tips, - 'fixed_key': fixedKey + 'templateType': templateType }), isUnShowLoading: true, ); @@ -2258,13 +2258,31 @@ class ApiProvider extends BaseProvider { jsonEncode({ 'lockId': lockId, 'keyId': keyId, - 'channelType': channelType + 'channelType': channelType, }), isUnShowLoading: true, ); - Future> keyNoticeSubmit(String receiverName, int lockId, - int keyId, int channelType, int openDoorType, String templateType) => + Future> getPwdNoticeTemplate( + int lockId, int keyboardPwdId, int channelType) => + post( + keyNoticeTemplateURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'keyboardPwdId': keyboardPwdId, + 'channelType': channelType, + }), + isUnShowLoading: true, + ); + + Future> keyNoticeSubmit( + String receiverName, + int lockId, + int keyId, + int channelType, + int openDoorType, + String templateType, + int countryCode) => post( keyNoticeSubmitURL.toUrl, jsonEncode({ @@ -2274,6 +2292,29 @@ class ApiProvider extends BaseProvider { 'channelType': channelType, 'openDoorType': openDoorType, 'templateType': templateType, + 'countryCode': countryCode + }), + isUnShowLoading: true, + ); + + Future> pwdNoticeSubmit( + String receiverName, + int lockId, + int keyboardPwdId, + int channelType, + int openDoorType, + String templateType, + int countryCode) => + post( + keyNoticeSubmitURL.toUrl, + jsonEncode({ + 'receiverName': receiverName, + 'lockId': lockId, + 'keyboardPwdId': keyboardPwdId, + 'channelType': channelType, + 'openDoorType': openDoorType, + 'templateType': templateType, + 'countryCode': countryCode }), isUnShowLoading: true, ); diff --git a/lib/network/api_repository.dart b/lib/network/api_repository.dart index 3065627b..31836cb6 100755 --- a/lib/network/api_repository.dart +++ b/lib/network/api_repository.dart @@ -36,10 +36,8 @@ import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyList import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart'; import 'package:star_lock/mine/mineSet/mineSet/weChatQRCodeEntity.dart'; import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_entity.dart'; -import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/face_authentication_entity.dart'; -import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/buy_record_list_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart'; @@ -1001,8 +999,7 @@ class ApiRepository { required int endTime, required int remoteUnlockSwitch, required int keyRight, - required bool isShowNetworkErrorMsg - }) async { + required bool isShowNetworkErrorMsg}) async { final res = await apiProvider.batchSendKey( lockIds, createUser, @@ -1017,8 +1014,7 @@ class ApiRepository { endTime, remoteUnlockSwitch, keyRight, - isShowNetworkErrorMsg - ); + isShowNetworkErrorMsg); return KeyDetailEntity.fromJson(res.body); } @@ -2114,7 +2110,7 @@ class ApiRepository { } // 获取购买记录 - Future getBuyRecordList({ + Future getBuyRecordList({ required String type, required int pageNo, required int recordType, @@ -2122,7 +2118,7 @@ class ApiRepository { }) async { final res = await apiProvider.getBuyRecordList(type, recordType, pageNo, pageSize); - return AdvancedFunctionRecordEntity.fromJson(res.body); + return UseRecordListEntity.fromJson(res.body); } // 获取使用记录 @@ -2148,11 +2144,11 @@ class ApiRepository { } // 检测实名认证是否支持开启 - Future keyCheckFace({ + Future keyCheckFace({ required int lockId, }) async { final res = await apiProvider.keyCheckFace(lockId); - return AdvancedFunctionRecordEntity.fromJson(res.body); + return ValueAddedServicesHighFunctionEntity.fromJson(res.body); } // 获取人脸认证certifyId @@ -2221,29 +2217,31 @@ class ApiRepository { } // 获取默认模板 - Future getDefaultTemplate({required int type}) async { - final Response res = await apiProvider.getDefaultTemplate(type); + Future getDefaultTemplate() async { + final Response res = await apiProvider.getDefaultTemplate(); return NewSMSTemplateEntity.fromJson(res.body); } // 获取短信模板列表 Future getSMSTemplateList( - {required int type, required int pageNo, required int pageSize}) async { + {required int channelType, + required int pageNo, + required int pageSize}) async { final Response res = - await apiProvider.getSMSTemplateList(type, pageNo, pageSize); + await apiProvider.getSMSTemplateList(channelType, pageNo, pageSize); return CustomSMSTemplateListEntity.fromJson(res.body); } // 添加短信模板 Future addTemplateService( - {required int type, + {required int channelType, required String name, - required int contentType, + required int langType, required String regards, required String tips, - required String fixedKey}) async { + required int templateType}) async { final Response res = await apiProvider.addTemplateService( - type, name, contentType, regards, tips, fixedKey); + channelType, name, langType, regards, tips, templateType); return LoginEntity.fromJson(res.body); } @@ -2281,17 +2279,54 @@ class ApiRepository { return SendEmailNotificationEntity.fromJson(res.body); } - // 发送短信、邮件通知 - Future keyNoticeSubmit({ - required String receiverName, + // 获取密码通知模板 + Future getPwdNoticeTemplate({ required int lockId, - required int keyId, + required int keyboardPwdId, required int channelType, - required int openDoorType, - required String templateType, }) async { + final Response res = await apiProvider.getPwdNoticeTemplate( + lockId, keyboardPwdId, channelType); + return SendEmailNotificationEntity.fromJson(res.body); + } + + // 电子钥匙发送短信、邮件通知 + Future keyNoticeSubmit( + {required String receiverName, + required int lockId, + required int keyId, + required int channelType, + required int openDoorType, + required String templateType, + required int countryCode}) async { final Response res = await apiProvider.keyNoticeSubmit( - receiverName, lockId, keyId, channelType, openDoorType, templateType); + receiverName, + lockId, + keyId, + channelType, + openDoorType, + templateType, + countryCode); + return SendEmailNotificationEntity.fromJson(res.body); + } + + // 密码发送短信、邮件通知 + Future pwdNoticeSubmit( + {required String receiverName, + required int lockId, + required int keyboardPwdId, + required int channelType, + required int openDoorType, + required String templateType, + required int countryCode}) async { + final Response res = await apiProvider.pwdNoticeSubmit( + receiverName, + lockId, + keyboardPwdId, + channelType, + openDoorType, + templateType, + countryCode); return SendEmailNotificationEntity.fromJson(res.body); } diff --git a/lib/tools/emailNotifyTypeSelectAlert.dart b/lib/tools/emailNotifyTypeSelectAlert.dart index c7c1afec..70a202e3 100644 --- a/lib/tools/emailNotifyTypeSelectAlert.dart +++ b/lib/tools/emailNotifyTypeSelectAlert.dart @@ -68,8 +68,8 @@ class EmailNotifyTypeSelectAlert extends StatelessWidget { alignment: Alignment.centerLeft, child: Text( isEmail - ? '邮件将从软件平台直接发给用户,请根据需要在软件那里购买邮件数量' - : '短信将从软件平台直接发给用户,请根据需要在软件那里购买短信数量', + ? '邮件将从软件平台直接发给用户,请根据需要在软件里购买邮件数量。' + : '短信将从软件平台直接发给用户,请根据需要在软件里购买短信数量。', style: TextStyle(fontSize: 18.sp), textAlign: TextAlign.left, ), diff --git a/lib/tools/tf_loginInput.dart b/lib/tools/tf_loginInput.dart index b98da00f..c4f45c2b 100755 --- a/lib/tools/tf_loginInput.dart +++ b/lib/tools/tf_loginInput.dart @@ -66,13 +66,14 @@ class _LoginInputState extends State { border: Border(bottom: BorderSide(width: 0.5.h, color: Colors.grey)), ), child: Row( - children: [ - widget.isHaveLeftWidget == true - ? widget.leftWidget ?? const SizedBox() - : SizedBox( - width: 20.w, - height: 40.w, - ), + children: [ + if (widget.isHaveLeftWidget == true) + widget.leftWidget ?? const SizedBox() + else + SizedBox( + width: 20.w, + height: 40.w, + ), Expanded( child: Stack( children: [ @@ -122,8 +123,7 @@ class _LoginInputState extends State { if (isPwd) Padding( padding: EdgeInsets.only( - top: - F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)), + top: F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)), child: Text( pwd, style: TextStyle( diff --git a/lib/widget/permission/permission_dialog.dart b/lib/widget/permission/permission_dialog.dart index 50d7fab2..2a01642b 100755 --- a/lib/widget/permission/permission_dialog.dart +++ b/lib/widget/permission/permission_dialog.dart @@ -3,7 +3,6 @@ import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/tools/storage.dart'; -import 'package:star_lock/translations/trans_lib.dart'; class PermissionDialog { static Map titles = { diff --git a/pre_build.sh b/pre_build.sh index 738aff96..4fb0373f 100644 --- a/pre_build.sh +++ b/pre_build.sh @@ -10,7 +10,7 @@ # 设置 environment="xhj" main_file="lib/main_xhj_full.dart" -version_string="1.0.67" +version_string="1.0.69" file_path="lib/network/api.dart" ############################################################### diff --git a/pubspec.yaml b/pubspec.yaml index 068ea3ea..f36ec4e2 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -75,8 +75,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.65+2024061801:xhj 线上环境,提交测试:回归 bug # 1.0.66+2024061802:xhj 线上环境,提交测试:回归 bug # 1.0.67+2024062501:xhj 线上环境,提交测试:回归 测试部门bug +# 1.0.69+2024070301:xhj 线上环境,提交测试:周常 bug 修复 +# 1.0.69+2024070302:xhj 线上环境,提交测试:周常 bug 修复 -version: 1.0.68+2024062601 +version: 1.0.69+2024070302 environment: sdk: '>=2.12.0 <3.0.0'