From ef946fa66c2239a8b9b4f974e369b5b4530bb0a1 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Fri, 13 Oct 2023 15:01:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_zh.json | 2 +- star_lock/ios/Podfile.lock | 6 + .../checkingInAddStaff_logic.dart | 4 +- .../electronicKeyList_page.dart | 1 + .../wirelessKeyboard_page.dart | 4 +- .../passwordKeyDetail_page.dart | 152 ++++++++++++++++-- .../passwordKeyList/passwordKeyList_page.dart | 1 + .../passwordKey_perpetual_page.dart | 71 +++++--- star_lock/lib/network/api_provider.dart | 25 +-- star_lock/lib/network/api_repository.dart | 25 +-- star_lock/pubspec.yaml | 1 + 11 files changed, 237 insertions(+), 55 deletions(-) diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 6ba9b604..b25cd712 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -58,7 +58,7 @@ "pleaseNameYourPassword":"请给密码命名", "pleaseEnterDigitsNumber":"请输入6-9位数字", "getPasswordTip1":"密码在24小时内至少要使用过一次,否则将无效", - "getPasswordTip2":"限时密码可以再有下期内不限次数使用 \\n密码在生效后的24小时内至少要使用过一次,否则将失效", + "getPasswordTip2":"限时密码可以再有下期内不限次数使用 \n密码在生效后的24小时内至少要使用过一次,否则将失效", "getPasswordTip3":"密码有限期为6个小时,只能使用一次", "getPasswordTip4":"可在锁旁边通过手机蓝牙添加,也可以通过网关远程添加", "getPasswordTip5":"密码在生效后的24小时内至少要使用过一次,否则将失效", diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock index 5581c519..41fc3084 100644 --- a/star_lock/ios/Podfile.lock +++ b/star_lock/ios/Podfile.lock @@ -22,6 +22,8 @@ PODS: - fluttertoast (0.0.2): - Flutter - Toast + - fluwx_no_pay_rz (0.0.1): + - Flutter - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) @@ -71,6 +73,7 @@ DEPENDENCIES: - Flutter (from `Flutter`) - flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) + - fluwx_no_pay_rz (from `.symlinks/plugins/fluwx_no_pay_rz/ios`) - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - network_info_plus (from `.symlinks/plugins/network_info_plus/ios`) @@ -111,6 +114,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_native_contact_picker/ios" fluttertoast: :path: ".symlinks/plugins/fluttertoast/ios" + fluwx_no_pay_rz: + :path: ".symlinks/plugins/fluwx_no_pay_rz/ios" google_maps_flutter_ios: :path: ".symlinks/plugins/google_maps_flutter_ios/ios" image_picker_ios: @@ -146,6 +151,7 @@ SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907 fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c + fluwx_no_pay_rz: afc11aac65505182bd887798fcdc4bbc9e35cd36 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693 diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart index 6a9355ab..df18f1c9 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart @@ -163,7 +163,9 @@ class CheckingInAddStaffLogic extends BaseGetXController{ state.getKeyInfosData.value.lockId.toString(), '0', "0", - '0'); + '0', + 0, + 0); if (entity.errorCode!.codeIsSuccessful) { print('获取密码成功'); if (entity.data != null) { diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 7013a21d..720c3315 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -361,6 +361,7 @@ class _ElectronicKeyListPageState extends State { CupertinoDialogAction( child: Text(TranslationLoader.lanKeys!.reset!.tr), onPressed: () { + Navigator.of(context).pop(); logic.resetElectronicKeyListRequest(); setState(() {}); }, diff --git a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart index 34eecdf6..6c5df03b 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart @@ -147,7 +147,9 @@ class _WirelessKeyboardPageState extends State { ), CupertinoDialogAction( child: Text(TranslationLoader.lanKeys!.reset!.tr), - onPressed: () {}, + onPressed: () { + Navigator.of(context).pop(); + }, ), ], ); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index e63cf37f..d17c854c 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/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_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -8,6 +7,7 @@ import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/showTFView.dart'; import 'package:star_lock/tools/toast.dart'; +import 'package:fluwx_no_pay_rz/fluwx_no_pay_rz.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; @@ -34,6 +34,13 @@ class _PasswordKeyDetailPageState extends State { _inputPwdController = TextEditingController(); _inputNameController = TextEditingController(); + + // _initFluwx(); + } + + _initFluwx() async { + await registerWxApi( + appId: "", doOnAndroid: true, doOnIOS: true, universalLink: ""); } @override @@ -42,6 +49,26 @@ class _PasswordKeyDetailPageState extends State { if (obj != null && (obj["itemData"] != null)) { itemData = obj["itemData"]; } + List nameItems = [ + '微信', + '朋友圈', + 'QQ', + 'QQ空间', + '微博', + 'FaceBook', + '邮件', + '链接' + ]; + List urlItems = [ + 'icon_wechat.png', + 'icon_wechat_moments.png', + 'icon_qq.png', + 'icon_qzone.png', + 'icon_sina.png', + 'icon_facebook.png', + 'icon_email.png', + 'icon_copylink.png' + ]; return Scaffold( backgroundColor: AppColors.mainBackgroundColor, @@ -56,18 +83,33 @@ class _PasswordKeyDetailPageState extends State { height: 30.h, width: 30.w, ), - onPressed: () {}, + onPressed: () { + /* + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (context) { + return Container( + decoration: const BoxDecoration( + color: Colors.white, + ), + constraints: const BoxConstraints(maxHeight: 700), + child: Row( + children: [ + Image.asset( + 'images/icon_wechat.png', + width: 50.0, + height: 50.0, + fit: BoxFit.fill, + ) + ], + ), + ); //设置maxHeight为你想要的数字就行 + }); + */ + }, ), ], - // actionsList: [ - // TextButton( - // child: Text( - // "分享", - // style: TextStyle(color: Colors.white, fontSize: 24.sp), - // ), - // onPressed: () {}, - // ), - // ], ), body: SingleChildScrollView( child: Column( @@ -329,4 +371,92 @@ class _PasswordKeyDetailPageState extends State { }, ); } + + Widget _shareWidget(BuildContext context) { + List nameItems = [ + '微信', + '朋友圈', + 'QQ', + 'QQ空间', + '微博', + 'FaceBook', + '邮件', + '链接' + ]; + List urlItems = [ + 'icon_wechat.png', + 'icon_wechat_moments.png', + 'icon_qq.png', + 'icon_qzone.png', + 'icon_sina.png', + 'icon_facebook.png', + 'icon_email.png', + 'icon_copylink.png' + ]; + + return Container( + color: Colors.red, + height: 250.0, + child: GridView.builder( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, mainAxisSpacing: 5.0, childAspectRatio: 1.0), + itemBuilder: (BuildContext context, int index) { + return Image.asset( + 'images/${urlItems[index]}', + width: 50.0, + height: 50.0, + fit: BoxFit.fill, + ); + }, + itemCount: nameItems.length, + ), + /* + child: Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0), + child: SizedBox( + height: 190.0, + child: GridView.builder( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + mainAxisSpacing: 5.0, + childAspectRatio: 1.0), + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + Padding( + padding: + const EdgeInsets.fromLTRB(0.0, 6.0, 0.0, 6.0), + child: Image.asset( + 'images/${urlItems[index]}', + width: 50.0, + height: 50.0, + fit: BoxFit.fill, + )), + Text(nameItems[index]) + ], + ); + }, + itemCount: nameItems.length, + ), + ), + ), + Container( + height: 0.5, + color: Colors.blueGrey, + ), + const Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0), + child: Text( + '取 消', + style: TextStyle(fontSize: 18.0, color: Colors.blueGrey), + )), + ) + ], + ), + */ + ); + } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index c74404c3..2697fa90 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -334,6 +334,7 @@ class _PasswordKeyListPageState extends State { CupertinoDialogAction( child: Text(TranslationLoader.lanKeys!.reset!.tr), onPressed: () { + Navigator.of(context).pop(); logic.resetPasswordKeyListRequest(); setState(() {}); }, diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index ce30b1e2..f2fa3b17 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -48,6 +48,8 @@ class _PasswordKeyPerpetualPageState extends State { late String cyclicModeStr; //循环模式 late String effectiveHourStr; late String failureHourStr; + int startHours = 0; + int endHours = 0; @override Widget build(BuildContext context) { @@ -70,6 +72,8 @@ class _PasswordKeyPerpetualPageState extends State { _selectEffectiveDate = formatDate(dateTime, [HH, ':', nn]); //默认为当前时间 _selectFailureDate = formatDate(dateTime, [HH, ':', nn]); //默认为当前时间 + startHours = _effectiveDateTime.hour; + endHours = _failureDateTime.hour; } else { _selectEffectiveDate = formatDate( dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间 @@ -264,7 +268,7 @@ class _PasswordKeyPerpetualPageState extends State { children: [ CommonItem( leftTitel: TranslationLoader.lanKeys!.recursiveDevice!.tr, - rightTitle: "周末", + rightTitle: cyclicModeStr, isHaveLine: true, isHaveDirection: true, action: () { @@ -292,9 +296,10 @@ class _PasswordKeyPerpetualPageState extends State { onConfirm: (p) { setState(() { _effectiveDateTime = DateTime.parse( - '${intToStr(p.hour!)}:${intToStr(p.minute!)}'); + '${_effectiveDateTime.year}-${intToStr(_effectiveDateTime.month)}-${intToStr(_effectiveDateTime.day)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'); _selectEffectiveDate = formatDate(_effectiveDateTime, [HH, ':', nn]); + startHours = p.hour!; }); }); }), @@ -307,9 +312,10 @@ class _PasswordKeyPerpetualPageState extends State { onConfirm: (p) { setState(() { _failureDateTime = DateTime.parse( - '${intToStr(p.hour!)}:${intToStr(p.minute!)}'); + '${_failureDateTime.year}-${intToStr(_failureDateTime.month)}-${intToStr(_failureDateTime.day)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'); _selectFailureDate = - formatDate(_effectiveDateTime, [HH, ':', nn]); + formatDate(_failureDateTime, [HH, ':', nn]); + endHours = p.hour!; }); }); }), @@ -323,7 +329,9 @@ class _PasswordKeyPerpetualPageState extends State { Pickers.showSinglePicker(context, data: dataList, pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) { - setState(() {}); + setState(() { + cyclicModeStr = p; + }); }, onChanged: (p, position) { setState(() {}); }); @@ -374,14 +382,21 @@ class _PasswordKeyPerpetualPageState extends State { } } */ - - logic.getStartDate(_effectiveDateTime); - int passwordType = int.parse(widget.type); - if (passwordType == 3) { - //自定义密码 - addKeyboardPwdRequest(); + if (_nameController.text.isNotEmpty) { + logic.getStartDate(_effectiveDateTime); + int passwordType = int.parse(widget.type); + if (passwordType == 3) { + if (_pwdController.text.isNotEmpty) { + //自定义密码 + addKeyboardPwdRequest(); + } else { + Toast.show(msg: '请输入密码'); + } + } else { + getKeyboardPwdRequest(); + } } else { - getKeyboardPwdRequest(); + Toast.show(msg: '请给密码命名'); } }), ], @@ -424,17 +439,33 @@ class _PasswordKeyPerpetualPageState extends State { //自定义 } else if (passwordType == 4) { //循环 - getKeyType = '6'; + if (cyclicModeStr == '每日') { + getKeyType = '6'; + } else if (cyclicModeStr == '工作日') { + getKeyType = '7'; + } else if (cyclicModeStr == '星期一') { + getKeyType = '8'; + } else if (cyclicModeStr == '星期二') { + getKeyType = '9'; + } else if (cyclicModeStr == '星期三') { + getKeyType = '10'; + } else if (cyclicModeStr == '星期四') { + getKeyType = '11'; + } else if (cyclicModeStr == '星期五') { + getKeyType = '12'; + } else if (cyclicModeStr == '星期六') { + getKeyType = '13'; + } else if (cyclicModeStr == '星期日') { + getKeyType = '14'; + } } else if (passwordType == 5) { //清空码 getKeyType = '4'; } if (widget.type != '0' && widget.type != '2' && widget.type != '5') { - getFailureDateTime = - DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString(); - getEffectiveDateTime = DateTime.parse(_selectEffectiveDate) - .millisecondsSinceEpoch - .toString(); + getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString(); + getEffectiveDateTime = + _effectiveDateTime.millisecondsSinceEpoch.toString(); } var entity = await ApiRepository.to.getPasswordKey( getFailureDateTime, @@ -445,7 +476,9 @@ class _PasswordKeyPerpetualPageState extends State { lockId, '0', getEffectiveDateTime, - '0'); + '0', + startHours, + endHours); if (entity.errorCode!.codeIsSuccessful) { print('获取密码成功'); _isSendSuccess = true; diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 622f041d..e46b8470 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -337,16 +337,17 @@ class ApiProvider extends BaseProvider { jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); Future getKeyboardPwd( - String endDate, - String isExclusive, - String keyboardPwdName, - String keyboardPwdType, - String keyboardPwdVersion, - String lockId, - String operatorUid, - String startDate, - String timezoneRawOffSet, - ) => + String endDate, + String isExclusive, + String keyboardPwdName, + String keyboardPwdType, + String keyboardPwdVersion, + String lockId, + String operatorUid, + String startDate, + String timezoneRawOffSet, + int startHours, + int endHours) => post( passwordKeyGetURL.toUrl, jsonEncode({ @@ -358,7 +359,9 @@ class ApiProvider extends BaseProvider { 'lockId': lockId, 'operatorUid': operatorUid, 'startDate': startDate, - 'timezoneRawOffSet': timezoneRawOffSet + 'timezoneRawOffSet': timezoneRawOffSet, + 'hoursStart': startHours, + 'hoursEnd': endHours })); Future addKeyboardPwd( diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index e04bd44f..0041a007 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -334,16 +334,17 @@ class ApiRepository { //获取密码 Future getPasswordKey( - String endDate, - String isExclusive, - String keyboardPwdName, - String keyboardPwdType, - String keyboardPwdVersion, - String lockId, - String operatorUid, - String startDate, - String timezoneRawOffSet, - ) async { + String endDate, + String isExclusive, + String keyboardPwdName, + String keyboardPwdType, + String keyboardPwdVersion, + String lockId, + String operatorUid, + String startDate, + String timezoneRawOffSet, + int startHours, + int endHours) async { final res = await apiProvider.getKeyboardPwd( endDate, isExclusive, @@ -353,7 +354,9 @@ class ApiRepository { lockId, operatorUid, startDate, - timezoneRawOffSet); + timezoneRawOffSet, + startHours, + endHours); return PasswordKeyEntity.fromJson(res.body); } diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index dfea4c56..f0a0984a 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -111,6 +111,7 @@ dependencies: #网络图片缓存 cached_network_image: ^3.2.0 webview_flutter: ^4.2.3 + fluwx_no_pay_rz: ^3.4.4+1 dev_dependencies: flutter_test: