diff --git a/star_lock/images/icon_about.png b/star_lock/images/icon_about.png new file mode 100644 index 00000000..fa5d299e Binary files /dev/null and b/star_lock/images/icon_about.png differ diff --git a/star_lock/images/icon_email.png b/star_lock/images/icon_email.png new file mode 100644 index 00000000..f8f66993 Binary files /dev/null and b/star_lock/images/icon_email.png differ diff --git a/star_lock/images/icon_main_1024.png b/star_lock/images/icon_main_1024.png index aa0093ef..e8cdae88 100644 Binary files a/star_lock/images/icon_main_1024.png and b/star_lock/images/icon_main_1024.png differ diff --git a/star_lock/images/icon_message.png b/star_lock/images/icon_message.png new file mode 100644 index 00000000..39971655 Binary files /dev/null and b/star_lock/images/icon_message.png differ diff --git a/star_lock/images/icon_more.png b/star_lock/images/icon_more.png new file mode 100644 index 00000000..e08747b0 Binary files /dev/null and b/star_lock/images/icon_more.png differ diff --git a/star_lock/images/icon_noData.png b/star_lock/images/icon_noData.png new file mode 100644 index 00000000..2283ab1b Binary files /dev/null and b/star_lock/images/icon_noData.png differ diff --git a/star_lock/images/icon_wechat.png b/star_lock/images/icon_wechat.png new file mode 100644 index 00000000..2efccd6f Binary files /dev/null and b/star_lock/images/icon_wechat.png differ diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index b25cd712..567fc529 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -212,7 +212,7 @@ "pushNotification":"消息推送", "lockUserManagement":"锁用户管理", "ownedKey":"拥有的钥匙", - "authorityManagement":"权限管理", + "authorityManagement":"批量授权", "associatedDevice":"关联设备", "associatedName":"关联姓名", "device":"设备", diff --git a/star_lock/images/lockType/addLock_entranceGuardBg.png b/star_lock/images/lockType/addLock_entranceGuardBg.png new file mode 100644 index 00000000..ccc23b1b Binary files /dev/null and b/star_lock/images/lockType/addLock_entranceGuardBg.png differ diff --git a/star_lock/images/lockType/addLock_parkingBg.png b/star_lock/images/lockType/addLock_parkingBg.png new file mode 100644 index 00000000..ad13578c Binary files /dev/null and b/star_lock/images/lockType/addLock_parkingBg.png differ diff --git a/star_lock/images/lockType/addLock_safeBg.png b/star_lock/images/lockType/addLock_safeBg.png new file mode 100644 index 00000000..546c1d91 Binary files /dev/null and b/star_lock/images/lockType/addLock_safeBg.png differ diff --git a/star_lock/ios/Runner.xcodeproj/project.pbxproj b/star_lock/ios/Runner.xcodeproj/project.pbxproj index 9f133cf6..75888984 100644 --- a/star_lock/ios/Runner.xcodeproj/project.pbxproj +++ b/star_lock/ios/Runner.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3EF1E85D6F1EE0C0DCF8449F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09D8B2FA2B26BA5BFF31AB2A /* Pods_Runner.framework */; }; + 82BD91202ADA6FBB0018E523 /* XSFlutterManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 82BD911F2ADA6FBB0018E523 /* XSFlutterManager.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -39,6 +40,9 @@ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 82BD911E2ADA6FBB0018E523 /* XSFlutterManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSFlutterManager.h; sourceTree = ""; }; + 82BD911F2ADA6FBB0018E523 /* XSFlutterManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XSFlutterManager.m; sourceTree = ""; }; + 82BD91212ADA72360018E523 /* CommonDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommonDefine.h; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -74,6 +78,15 @@ path = Pods; sourceTree = ""; }; + 826570C02ADCDD0200A92776 /* XSController */ = { + isa = PBXGroup; + children = ( + 82BD911E2ADA6FBB0018E523 /* XSFlutterManager.h */, + 82BD911F2ADA6FBB0018E523 /* XSFlutterManager.m */, + ); + name = XSController; + sourceTree = ""; + }; 9304F75C378DB3447BB2408C /* Frameworks */ = { isa = PBXGroup; children = ( @@ -115,6 +128,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 826570C02ADCDD0200A92776 /* XSController */, 33BF41252A96174D009D92E2 /* Runner.entitlements */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, @@ -125,6 +139,7 @@ 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 82BD91212ADA72360018E523 /* CommonDefine.h */, ); path = Runner; sourceTree = ""; @@ -173,6 +188,7 @@ TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1430; }; }; }; @@ -287,6 +303,7 @@ buildActionMask = 2147483647; files = ( 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, + 82BD91202ADA6FBB0018E523 /* XSFlutterManager.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); @@ -371,6 +388,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; @@ -385,6 +403,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -502,6 +522,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; @@ -516,6 +537,9 @@ PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -526,6 +550,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; @@ -540,6 +565,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/star_lock/ios/Runner/AppDelegate.m b/star_lock/ios/Runner/AppDelegate.m index 70e83933..9156fe49 100644 --- a/star_lock/ios/Runner/AppDelegate.m +++ b/star_lock/ios/Runner/AppDelegate.m @@ -1,13 +1,16 @@ #import "AppDelegate.h" #import "GeneratedPluginRegistrant.h" +#import "XSFlutterManager.h" +#import "CommonDefine.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [GeneratedPluginRegistrant registerWithRegistry:self]; - // Override point for customization after application launch. - return [super application:application didFinishLaunchingWithOptions:launchOptions]; + XSFlutterManager * VC = [[XSFlutterManager alloc]init]; + self.window.rootViewController = VC; + [self.window makeKeyAndVisible]; + return YES; } @end diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d36b1fab..77cf5ba4 100644 --- a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,122 +1,121 @@ { "images" : [ { - "size" : "20x20", + "filename" : "icon-20@2x.png", "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { - "size" : "20x20", + "filename" : "icon-20@3x.png", "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" + "scale" : "3x", + "size" : "20x20" }, { - "size" : "29x29", "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" + "scale" : "1x", + "size" : "29x29" }, { - "size" : "29x29", + "filename" : "icon-29@2x.png", "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { - "size" : "29x29", + "filename" : "icon-29@3x.png", "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" + "scale" : "3x", + "size" : "29x29" }, { - "size" : "40x40", + "filename" : "icon-40@2x.png", "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { - "size" : "40x40", + "filename" : "icon-40@3x.png", "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" + "scale" : "3x", + "size" : "40x40" }, { - "size" : "60x60", + "filename" : "icon-60@2x.png", "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "60x60" }, { - "size" : "60x60", + "filename" : "icon-60@3x.png", "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" + "scale" : "3x", + "size" : "60x60" }, { - "size" : "20x20", - "idiom" : "ipad", "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" }, { - "size" : "20x20", - "idiom" : "ipad", "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" }, { - "size" : "29x29", - "idiom" : "ipad", "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" }, { - "size" : "29x29", - "idiom" : "ipad", "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" }, { - "size" : "40x40", - "idiom" : "ipad", "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" }, { - "size" : "40x40", - "idiom" : "ipad", "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" }, { - "size" : "76x76", - "idiom" : "ipad", "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" }, { - "size" : "76x76", - "idiom" : "ipad", "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-83.5x83.5@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" }, { - "size" : "1024x1024", - "idiom" : "ios-marketing", "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } } diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index f091b6b0..00000000 Binary files a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index dcdc2306..00000000 Binary files a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 75b2d164..00000000 Binary files a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png new file mode 100644 index 00000000..acce7ba6 Binary files /dev/null and b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png new file mode 100644 index 00000000..820fb5e9 Binary files /dev/null and b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png new file mode 100644 index 00000000..58d0d204 Binary files /dev/null and b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png new file mode 100644 index 00000000..3e64f3be Binary files /dev/null and b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png new file mode 100644 index 00000000..267db673 Binary files /dev/null and b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png new file mode 100644 index 00000000..cc9a1c77 Binary files /dev/null and b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png new file mode 100644 index 00000000..cc9a1c77 Binary files /dev/null and b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png differ diff --git a/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png new file mode 100644 index 00000000..3c4fdd30 Binary files /dev/null and b/star_lock/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png differ diff --git a/star_lock/ios/Runner/Base.lproj/Main.storyboard b/star_lock/ios/Runner/Base.lproj/Main.storyboard index f3c28516..69ea5b4d 100644 --- a/star_lock/ios/Runner/Base.lproj/Main.storyboard +++ b/star_lock/ios/Runner/Base.lproj/Main.storyboard @@ -1,8 +1,10 @@ - - + + + - + + @@ -14,13 +16,14 @@ - + - + + diff --git a/star_lock/ios/Runner/CommonDefine.h b/star_lock/ios/Runner/CommonDefine.h new file mode 100644 index 00000000..08bcda1d --- /dev/null +++ b/star_lock/ios/Runner/CommonDefine.h @@ -0,0 +1,20 @@ +// +// CommonDefine.h +// Runner +// +// Created by DaisyWu on 2023/10/14. +// + +#ifndef CommonDefine_h +#define CommonDefine_h + + +/** 信号通道,须与flutter里一致*/ +#define flutterMethodChannel @"flutter_native_ios" +/** 交互方法字段名,须与flutter里一致*/ +#define flutterMethodSharePassword @"flutter_sharePassword_to_ios" +#define flutterMethodPresent @"flutter_present_to_ios" + + +#endif /* CommonDefine_h */ + diff --git a/star_lock/ios/Runner/Info.plist b/star_lock/ios/Runner/Info.plist index d317c6fe..dda1720c 100644 --- a/star_lock/ios/Runner/Info.plist +++ b/star_lock/ios/Runner/Info.plist @@ -7,7 +7,7 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName - Star Lock + 星锁 CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -15,7 +15,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - star_lock + 星锁 CFBundlePackageType APPL CFBundleShortVersionString @@ -57,6 +57,11 @@ UILaunchStoryboardName LaunchScreen + UIApplicationSceneManifest + + UISceneConfigurations + + UIMainStoryboardFile Main UISupportedInterfaceOrientations diff --git a/star_lock/ios/Runner/XSFlutterManager.h b/star_lock/ios/Runner/XSFlutterManager.h new file mode 100644 index 00000000..2be71177 --- /dev/null +++ b/star_lock/ios/Runner/XSFlutterManager.h @@ -0,0 +1,16 @@ +// +// SharePasswordViewController.h +// Runner +// +// Created by DaisyWu on 2023/10/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XSFlutterManager : FlutterViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/star_lock/ios/Runner/XSFlutterManager.m b/star_lock/ios/Runner/XSFlutterManager.m new file mode 100644 index 00000000..8d037ec6 --- /dev/null +++ b/star_lock/ios/Runner/XSFlutterManager.m @@ -0,0 +1,104 @@ +// +// XSFlutterManager.m +// Runner +// +// Created by DaisyWu on 2023/10/14. +// + +#import "XSFlutterManager.h" +#include "GeneratedPluginRegistrant.h" +#import "CommonDefine.h" + + +@interface XSFlutterManager () + +@property(nonatomic,strong) FlutterMethodChannel* methodChannel; +@property (nonatomic, copy) NSString *textToShare; + +@end + +@implementation XSFlutterManager + +- (void)viewDidLoad { + [super viewDidLoad]; + self.textToShare = [[NSString alloc] init]; + + [self methodChannelFunction]; +} +- (void)methodChannelFunction { + + //创建 FlutterMethodChannel + self.methodChannel = [FlutterMethodChannel + methodChannelWithName:flutterMethodChannel binaryMessenger:self]; + //设置监听 + [self.methodChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { + // TODO + NSString *method=call.method; + //调用系统分享 + if ([method isEqualToString:flutterMethodSharePassword]) { + id params = call.arguments; + self.textToShare = @"您好,您的密码是:"; + if ([params isKindOfClass:[NSDictionary class]]) { + NSDictionary *paramDic = (NSDictionary *)params; + //分享的标题 + self.textToShare = paramDic[@"pwdShareStr"]; + } + //分享的url + NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"]; + + //在这里呢 如果想分享图片 就把图片添加进去 文字什么的通上 + NSArray *activityItems = @[self.textToShare,urlToShare]; + + UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil]; + + //不出现在活动项目 + activityVC.excludedActivityTypes = @[UIActivityTypePrint]; + [self presentViewController:activityVC animated:YES completion:nil]; + + // 分享之后的回调 + activityVC.completionWithItemsHandler = ^(UIActivityType _Nullable activityType, BOOL completed, NSArray * _Nullable returnedItems, NSError * _Nullable activityError) { + if (completed) { + + NSLog(@"completed"); + + //分享 成功 + + } else { + + NSLog(@"cancled"); + + //分享 取消 + + } + + }; + + result(@"push返回到flutter"); + } + + }]; + [GeneratedPluginRegistrant registerWithRegistry:self]; +} + +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:YES]; +} + +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + [self.navigationController setNavigationBarHidden:NO]; +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 93c9549a..581eece6 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -12,7 +12,7 @@ import 'package:star_lock/mine/about/webviewShow_page.dart'; import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart'; -import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart'; +import 'package:star_lock/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart'; import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart'; import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart'; import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart'; @@ -320,7 +320,7 @@ abstract class Routers { static const getDeviceListPage = '/getDeviceListPage'; //设备列表 static const getNameListPage = '/getNameListPage'; //姓名列表 - static const authorityManagementPage = '/authorityManagementPage'; //权限管理 + static const authorityManagementPage = '/authorityManagementPage'; //批量授权 static const massSendLockGroupPage = '/massSendLockGroupPage'; //群发锁分组列表 static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人 static const lockUserListPage = '/lockUserListPage'; //锁用户列表 diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart index 9079f6f9..c0768789 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart @@ -27,7 +27,7 @@ class AuthorizedAdminSendEntity { } class Data { - String? receiverUid; + int? receiverUid; ReceiverUser? receiverUser; int? keyId; @@ -105,7 +105,7 @@ class Phone { int? userId; String? phoneNumberHash; String? phoneNumberEncrypt; - String? countryCode; + int? countryCode; String? phoneNumberVerifiedAt; String? updatedAt; String? createdAt; @@ -149,7 +149,7 @@ class Phone { class Cloud { String? username; String? password; - String? cloudUid; + int? cloudUid; int? userId; String? updatedAt; String? createdAt; diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index 38ca6395..c489ea16 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -1,7 +1,11 @@ import 'dart:async'; +import 'package:flutter/cupertino.dart'; import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; import 'package:star_lock/blue/io_type.dart'; +import 'package:star_lock/translations/trans_lib.dart'; import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_protocol/io_addUser.dart'; @@ -23,7 +27,8 @@ class AuthorizedAdminLogic extends BaseGetXController { // 监听设备返回的数据 late StreamSubscription _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) async { + _replySubscription = + EventBusManager().eventBus!.on().listen((reply) async { // 转移权限 if (reply is TransferPermissionsReply) { var token = reply.data.sublist(2, 6); @@ -73,7 +78,7 @@ class AuthorizedAdminLogic extends BaseGetXController { break; case 0x14: - // 权限校验错误 + // 权限校验错误 print("${reply.commandType!.typeValue} 用户已存在"); break; @@ -85,7 +90,7 @@ class AuthorizedAdminLogic extends BaseGetXController { } } - if(reply is AddUserReply) { + if (reply is AddUserReply) { _replyAddUserKey(reply); } }); @@ -105,16 +110,16 @@ class AuthorizedAdminLogic extends BaseGetXController { // userNo = reply.data[46]; // print("status:$status"); - switch(status){ + switch (status) { case 0x00: - //成功 + //成功 print("添加用户数据解析成功"); state.isSendSuccess.value = true; Toast.show(msg: "添加成功"); // bindBlueAdmin(); break; case 0x06: - //无权限 + //无权限 print("需要鉴权"); var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -124,33 +129,32 @@ class AuthorizedAdminLogic extends BaseGetXController { IoSenderManage.senderAddUser( lockID: BlueManage().connectDeviceName, - authUserID:await Storage.getUid(), - keyID:"1", - userID:state.addUserId.value, - openMode:1, - keyType:(state.type.value == "1") ? 0 : 1, - startDate:state.effectiveDateTime.value.millisecondsSinceEpoch, - expireDate:state.failureDateTime.value.millisecondsSinceEpoch, - role:0, - password:"123456", - needAuthor:1, - publicKey:publicKeyDataList, - privateKey:getPrivateKeyList, - token: token - ); + authUserID: await Storage.getUid(), + keyID: "1", + userID: state.addUserId.value, + openMode: 1, + keyType: (state.type.value == "1") ? 0 : 1, + startDate: state.effectiveDateTime.value.millisecondsSinceEpoch, + expireDate: state.failureDateTime.value.millisecondsSinceEpoch, + role: 0, + password: "123456", + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + token: token); break; case 0x07: - //无权限 + //无权限 print("用户无权限"); break; case 0x09: - // 权限校验错误 + // 权限校验错误 print("添加用户权限校验错误"); break; default: - //失败 + //失败 print("领锁失败"); break; @@ -190,8 +194,10 @@ class AuthorizedAdminLogic extends BaseGetXController { // 添加用户 Future addUserConnectBlue(String receiveId) async { // 进来之后首先连接 - BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connecteState) async { - if (connecteState == DeviceConnectionState.connected){ + BlueManage().judgeReconnect( + BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, + (DeviceConnectionState connecteState) async { + if (connecteState == DeviceConnectionState.connected) { // 私钥 var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -200,59 +206,60 @@ class AuthorizedAdminLogic extends BaseGetXController { List publicKeyDataList = changeStringListToIntList(publicKey!); var token = await Storage.getStringList(saveBlueToken); - List getTokenList = [0,0,0,0]; - if(token != null){ + List getTokenList = [0, 0, 0, 0]; + if (token != null) { getTokenList = changeStringListToIntList(token); } IoSenderManage.senderAddUser( lockID: BlueManage().connectDeviceName, - authUserID:await Storage.getUid(), - keyID:"1", - userID:receiveId, - openMode:1, - keyType:(state.type.value == "1") ? 0 : 1, - startDate:state.effectiveDateTime.value.millisecondsSinceEpoch, - expireDate:state.failureDateTime.value.millisecondsSinceEpoch, - role:0, - password:"123456", - needAuthor:1, - publicKey:publicKeyDataList, - privateKey:getPrivateKeyList, - token: getTokenList - ); + authUserID: await Storage.getUid(), + keyID: "1", + userID: receiveId, + openMode: 1, + keyType: (state.type.value == "1") ? 0 : 1, + startDate: state.effectiveDateTime.value.millisecondsSinceEpoch, + expireDate: state.failureDateTime.value.millisecondsSinceEpoch, + role: 0, + password: "123456", + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + token: getTokenList); } }); } //发送授权管理员列表请求 - Future sendElectronicKeyRequest() async { + Future sendElectronicKeyRequest(BuildContext widgetContext) async { String getFailureDateTime = '0'; String getEffectiveDateTime = '0'; String lockID = state.keyInfo.value.lockId.toString(); String getKeyType = (int.parse(state.type.value) + 1).toString(); if (state.type.value == '0') { - getFailureDateTime = state.failureDateTime.value.millisecondsSinceEpoch.toString(); + getFailureDateTime = + state.failureDateTime.value.millisecondsSinceEpoch.toString(); getEffectiveDateTime = state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); } + var entity = await ApiRepository.to.sendElectronicKey( - state.isCreateUser.value ? "1" : "0", - state.countryCode.value, - '1', - getFailureDateTime, - state.isAuthentication.value == true ? '1' : '2', - '2', - '2', - state.keyNameController.text, - '1', - getKeyType, - lockID, - '', - state.emailOrPhoneController.text, - '', - getEffectiveDateTime, - state.weekdaysList); + createUser: state.isCreateUser.value ? "1" : "0", + countryCode: state.countryCode.value, + usernameType: '1', + endDate: getFailureDateTime, + faceAuthentication: state.isAuthentication.value == true ? '1' : '2', + isCameraEnable: '2', + isRemoteUnlock: '2', + keyNameForAdmin: state.keyNameController.text, + keyRight: '1', + keyType: getKeyType, + lockId: lockID, + operatorUid: '', + receiverUsername: state.emailOrPhoneController.text, + remarks: '', + startDate: getEffectiveDateTime, + weekDays: state.weekdaysList); if (entity.errorCode!.codeIsSuccessful) { print('发送电子钥匙成功'); state.isSendSuccess.value = true; @@ -260,15 +267,48 @@ class AuthorizedAdminLogic extends BaseGetXController { state.addUserId.value = entity.data!.receiverUser!.id.toString(); addUserConnectBlue(state.addUserId.value); } else { - // Toast.show(msg: '${entity.errorMsg}'); if (entity.errorCode == 425) { //用户未注册 - state.isCreateUser.value = true; - sendElectronicKeyRequest(); + _showDialog(widgetContext, '${entity.errorMsg}'); } } } + //用户未注册确认弹窗 + void _showDialog(widgetContext, String errMsg) { + showCupertinoDialog( + context: widgetContext, + builder: (context) { + return CupertinoAlertDialog( + title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'), + actions: [ + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.cancel!.tr), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.selet!.tr), + onPressed: () async { + //选择国家代码 + state.isCreateUser.value = true; + Navigator.of(context).pop(); + + var result = await Get.toNamed(Routers.seletCountryRegionPage); + if (result != null) { + result as Map; + state.countryCode.value = result['code']; + state.countryName.value = result['countryName']; + } + }, + ), + ], + ); + }, + ); + } + @override void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart index 85e53505..ba059f08 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -202,7 +202,7 @@ class _AuthorizedAdminPageState extends State { if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.value.text.isNotEmpty) { // logic.addUserConnectBlue(); - logic.sendElectronicKeyRequest(); + logic.sendElectronicKeyRequest(context); } }), Container( @@ -358,11 +358,15 @@ class _AuthorizedAdminPageState extends State { alignment: Alignment.center, child: InkWell( onTap: () async { - Contact? contact = + Contact? currentContact = await state.contactPicker.selectContact(); setState(() { - state.contact = contact!; - // print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}"); + state.contact = currentContact!; + if (currentContact.phoneNumbers!.isNotEmpty) { + state.emailOrPhoneController.text = currentContact + .phoneNumbers![0] + .replaceAll(RegExp(r"\s+\b|\b\s"), ""); + } }); }, ), diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index 79024fb1..19c2a8f2 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -5,6 +5,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; @@ -116,32 +117,34 @@ class _AuthorizedAdminListPageState extends State { Widget _buildMainUI(itemData) { List getItemData = itemData; - return ListView.builder( - itemCount: getItemData.length, - itemBuilder: (c, index) { - ElectronicKeyListItem indexEntity = getItemData[index]; - String useDateStr = ''; //使用期限 - String keyStatus = ''; //钥匙状态 + return getItemData.isEmpty + ? const NoData() + : ListView.builder( + itemCount: getItemData.length, + itemBuilder: (c, index) { + ElectronicKeyListItem indexEntity = getItemData[index]; + String useDateStr = ''; //使用期限 + String keyStatus = ''; //钥匙状态 - //使用期限 - useDateStr = getUseDateStr(indexEntity); + //使用期限 + useDateStr = getUseDateStr(indexEntity); - //钥匙状态 - keyStatus = getKeyStatus(indexEntity.keyStatus); + //钥匙状态 + keyStatus = getKeyStatus(indexEntity.keyStatus); - //是否为管理钥匙 - bool isAdminKey = false; - if (indexEntity.keyRight == 1) { - isAdminKey = true; - } else { - isAdminKey = false; - } - return _electronicKeyItem('images/controls_user.png', - indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { - Navigator.pushNamed(context, Routers.electronicKeyDetailPage, - arguments: {'itemData': indexEntity}); - }); - }); + //是否为管理钥匙 + bool isAdminKey = false; + if (indexEntity.keyRight == 1) { + isAdminKey = true; + } else { + isAdminKey = false; + } + return _electronicKeyItem('images/controls_user.png', + indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { + Navigator.pushNamed(context, Routers.electronicKeyDetailPage, + arguments: {'itemData': indexEntity}); + }); + }); } //使用期限 diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart index 049f00dc..b5fafa4e 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart @@ -26,6 +26,7 @@ class VolumeAuthorizationLockPage extends StatefulWidget { _VolumeAuthorizationLockPageState(); } +//批量授权锁页面 class _VolumeAuthorizationLockPageState extends State { final FlutterContactPicker _contactPicker = FlutterContactPicker(); diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_state.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart index 7220a588..46738132 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart @@ -5,6 +5,7 @@ import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/translations/trans_lib.dart'; @@ -56,16 +57,19 @@ class _LockUserListPageState extends State { height: 20.h, ), Expanded( - child: ListView.separated( - itemBuilder: (context, index) { - LockUserData indexEntity = dataList[index]; - return _electronicKeyItem(indexEntity); - }, - itemCount: dataList.length, - separatorBuilder: (context, index) { - return const Divider(height: 1, color: AppColors.greyLineColor); - }, - )), + child: dataList.isEmpty + ? const NoData() + : ListView.separated( + itemBuilder: (context, index) { + LockUserData indexEntity = dataList[index]; + return _electronicKeyItem(indexEntity); + }, + itemCount: dataList.length, + separatorBuilder: (context, index) { + return const Divider( + height: 1, color: AppColors.greyLineColor); + }, + )), Container( height: 120.h, padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 0.h), diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart index b2cf104b..99a2bbda 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart @@ -122,6 +122,11 @@ class _MassSendLockGroupListPageState extends State { onTap: () { selectGroupIdList.add(index); clickIndex = index; + //是否选中组 + if (itemData.isChecked) { + // lockItemList[selectIndex] = + } + print('选中了么0'); }, typeImgList: const [], groupItem: itemData, diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart index 507674c6..ff2d1e9f 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_utils/get_utils.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart'; @@ -9,6 +10,8 @@ class MassSendReceiverCell extends StatelessWidget { final int currentIndex; LockUserData userData; final VoidCallback clickDeleteUser; + final FlutterContactPicker contactPicker = FlutterContactPicker(); + late Contact contact; MassSendReceiverCell(int index, {Key? key, @@ -138,10 +141,14 @@ class MassSendReceiverCell extends StatelessWidget { child: InkWell( onTap: () async { // Contact? currentContact = - // await _contactPicker.selectContact(); + // await contactPicker.selectContact(); // setState(() { - // _contact = currentContact!; - // // print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}"); + // state.contact = currentContact!; + // if (currentContact.phoneNumbers!.isNotEmpty) { + // state.emailOrPhoneController.text = currentContact + // .phoneNumbers![0] + // .replaceAll(RegExp(r"\s+\b|\b\s"), ""); + // } // }); }, ), diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart index c5f0ade9..71b58301 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart @@ -1,13 +1,18 @@ +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; +import 'package:get/get_utils/get_utils.dart'; +import 'package:star_lock/appRouters.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/toast.dart'; +import 'package:star_lock/translations/trans_lib.dart'; class SendElectronicKeyLogic extends BaseGetXController { final SendElectronicKeyState state = SendElectronicKeyState(); //发送钥匙请求 - Future sendElectronicKeyRequest() async { + Future sendElectronicKeyRequest(BuildContext widgetContext) async { String getFailureDateTime = '0'; String getEffectiveDateTime = '0'; String lockID = state.keyInfo.value.lockId.toString(); @@ -18,33 +23,67 @@ class SendElectronicKeyLogic extends BaseGetXController { getEffectiveDateTime = state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); } + var entity = await ApiRepository.to.sendElectronicKey( - state.isCreateUser.value ? "1" : "0", - state.countryCode.value, - '1', - getFailureDateTime, - state.isAuthentication.value == true ? '1' : '2', - '2', - state.isRemoteUnlock.value == true ? '1' : '2', - state.keyNameController.text, - '0', - getKeyType, - lockID, - '', - state.emailOrPhoneController.text, - '', - getEffectiveDateTime, - state.weekdaysList); + createUser: state.isCreateUser.value ? "1" : "0", + countryCode: state.countryCode.value, + usernameType: '1', + endDate: getFailureDateTime, + faceAuthentication: state.isAuthentication.value == true ? '1' : '2', + isCameraEnable: '2', + isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2', + keyNameForAdmin: state.keyNameController.text, + keyRight: '0', + keyType: getKeyType, + lockId: lockID, + operatorUid: '', + receiverUsername: state.emailOrPhoneController.text, + remarks: '', + startDate: getEffectiveDateTime, + weekDays: state.weekdaysList); if (entity.errorCode!.codeIsSuccessful) { print('发送电子钥匙成功'); state.isSendSuccess.value = true; } else { - Toast.show(msg: '${entity.errorMsg}'); if (entity.errorCode == 425) { //用户未注册 - state.isCreateUser.value = true; - sendElectronicKeyRequest(); + _showDialog(widgetContext, '${entity.errorMsg}'); } } } + + //用户未注册确认弹窗 + void _showDialog(widgetContext, String errMsg) { + showCupertinoDialog( + context: widgetContext, + builder: (context) { + return CupertinoAlertDialog( + title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'), + actions: [ + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.cancel!.tr), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.selet!.tr), + onPressed: () async { + //选择国家代码 + state.isCreateUser.value = true; + Navigator.of(context).pop(); + + var result = await Get.toNamed(Routers.seletCountryRegionPage); + if (result != null) { + result as Map; + state.countryCode.value = result['code']; + state.countryName.value = result['countryName']; + } + }, + ), + ], + ); + }, + ); + } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart index abfdff73..41d19843 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart @@ -201,7 +201,9 @@ class _SendElectronicKeyPageState extends State { isHaveRightWidget: true, rightWidget: SizedBox( width: 60.w, height: 50.h, child: _remoteSwitch(false)), - action: () {}), + action: () { + // Toast.show(msg: '此功能暂未开放'); + }), ], ); } @@ -260,12 +262,12 @@ class _SendElectronicKeyPageState extends State { if (state.failureDateTime.value .compareTo(state.effectiveDateTime.value) == 1) { - logic.sendElectronicKeyRequest(); + logic.sendElectronicKeyRequest(context); } else { Toast.show(msg: '失效时间需大于生效时间'); } } else { - logic.sendElectronicKeyRequest(); + logic.sendElectronicKeyRequest(context); } } else { Toast.show(msg: '请完善信息'); @@ -428,7 +430,11 @@ class _SendElectronicKeyPageState extends State { await state.contactPicker.selectContact(); setState(() { state.contact = currentContact!; - // print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}"); + if (currentContact.phoneNumbers!.isNotEmpty) { + state.emailOrPhoneController.text = currentContact + .phoneNumbers![0] + .replaceAll(RegExp(r"\s+\b|\b\s"), ""); + } }); }, ), diff --git a/star_lock/lib/main/lockDetail/lcokSet/doorMagnetic/nearbyDoorMagnetic/nearbyDoorMagnetic_page.dart b/star_lock/lib/main/lockDetail/lcokSet/doorMagnetic/nearbyDoorMagnetic/nearbyDoorMagnetic_page.dart index 96931fcc..db766ed6 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/doorMagnetic/nearbyDoorMagnetic/nearbyDoorMagnetic_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/doorMagnetic/nearbyDoorMagnetic/nearbyDoorMagnetic_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/titleAppBar.dart'; @@ -14,6 +15,7 @@ class NearbyDoorMagneticPage extends StatefulWidget { } class _NearbyDoorMagneticPageState extends State { + List dataList = []; @override Widget build(BuildContext context) { return Scaffold( @@ -22,13 +24,16 @@ class _NearbyDoorMagneticPageState extends State { barTitle: TranslationLoader.lanKeys!.nearbyEquipment!.tr, haveBack: true, backgroundColor: AppColors.mainColor), - body: ListView.builder( - itemCount: 20, - itemBuilder: (c, index) { - return nearbyLockItem('images/icon_lock.png', "MCBN01-ea9240", () { - // Navigator.pushNamed(context, Routers.saveLockPage); - }); - }), + body: dataList.isEmpty + ? const NoData() + : ListView.builder( + itemCount: dataList.length, + itemBuilder: (c, index) { + return nearbyLockItem('images/icon_lock.png', "MCBN01-ea9240", + () { + // Navigator.pushNamed(context, Routers.saveLockPage); + }); + }), ); } diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index b9b666c3..22ebb02b 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -66,42 +66,65 @@ class _LockSetPageState extends State with RouteAware { 'keyInfo': state.getKeyInfosData.value }); }), - SizedBox(height: 10.h,), + SizedBox( + height: 10.h, + ), // 门磁 Visibility( visible: true, - child:CommonItem( - leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr, + child: CommonItem( + leftTitel: + TranslationLoader.lanKeys!.doorMagnetic!.tr, rightTitle: "", isHaveLine: true, isHaveDirection: true, action: () { - // Get.toNamed(Routers.doorMagneticPage); - Toast.show(msg: "功能暂未开放"); - }) - ), + Get.toNamed(Routers.doorMagneticPage); + // Toast.show(msg: "功能暂未开放"); + })), // 无线键盘 Visibility( visible: true, child: CommonItem( leftTitel: - TranslationLoader.lanKeys!.wirelessKeyboard!.tr, + TranslationLoader.lanKeys!.wirelessKeyboard!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.wirelessKeyboardPage); + // Toast.show(msg: "功能暂未开放"); + })), + Visibility( + visible: true, + child: CommonItem( + leftTitel: '照明', + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Toast.show(msg: "功能暂未开放"); + })), + Visibility( + visible: true, + child: CommonItem( + leftTitel: '开门器', rightTitle: "", isHaveLine: false, isHaveDirection: true, action: () { - // Get.toNamed(Routers.wirelessKeyboardPage); Toast.show(msg: "功能暂未开放"); - }) - ), + })), SizedBox(height: 10.h), // 自动闭锁 Obx(() => Visibility( visible: true, child: CommonItem( leftTitel: - TranslationLoader.lanKeys!.automaticBlocking!.tr, - rightTitle: state.getKeyInfosData.value.autoLockTime! > -1 + TranslationLoader.lanKeys!.automaticBlocking!.tr, + rightTitle: state + .getKeyInfosData.value.autoLockTime! > + -1 ? "${state.getKeyInfosData.value.autoLockTime!.toString()}s" : TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, @@ -109,8 +132,7 @@ class _LockSetPageState extends State with RouteAware { action: () { Get.toNamed(Routers.automaticBlockingPage, arguments: state.getKeyInfosData.value); - })) - ), + }))), // 锁声音 Obx(() { var titleStr = ""; @@ -145,144 +167,144 @@ class _LockSetPageState extends State with RouteAware { action: () { Get.toNamed(Routers.lockSoundSetPage, arguments: state.getKeyInfosData.value); - }) - ); + })); }), // 防撬报警 Obx(() => Visibility( visible: true, child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr, - rightTitle: state.getKeyInfosData.value.tamperAlert == 1 - ? TranslationLoader.lanKeys!.opened!.tr - : TranslationLoader.lanKeys!.closed!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.burglarAlarmPage, - arguments: state.getKeyInfosData.value); - }))), + leftTitel: + TranslationLoader.lanKeys!.burglarAlarm!.tr, + rightTitle: + state.getKeyInfosData.value.tamperAlert == 1 + ? TranslationLoader.lanKeys!.opened!.tr + : TranslationLoader.lanKeys!.closed!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.burglarAlarmPage, + arguments: state.getKeyInfosData.value); + }))), SizedBox(height: 10.h), // 常开模式 Obx(() => Visibility( - visible: true, + visible: true, child: CommonItem( - leftTitel: - TranslationLoader.lanKeys!.normallyOpenMode!.tr, - rightTitle: state.getKeyInfosData.value.passageMode == 1 - ? TranslationLoader.lanKeys!.opened!.tr - : TranslationLoader.lanKeys!.closed!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.normallyOpenModePage, - arguments: state.getKeyInfosData.value); - })) - ), + leftTitel: + TranslationLoader.lanKeys!.normallyOpenMode!.tr, + rightTitle: + state.getKeyInfosData.value.passageMode == 1 + ? TranslationLoader.lanKeys!.opened!.tr + : TranslationLoader.lanKeys!.closed!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.normallyOpenModePage, + arguments: state.getKeyInfosData.value); + }))), // 远程开锁 Obx(() => Visibility( - visible:true, + visible: true, child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr, - rightTitle: state.getKeyInfosData.value.remoteEnable == 1 - ? TranslationLoader.lanKeys!.opened!.tr - : TranslationLoader.lanKeys!.closed!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.remoteUnlockingPage, - arguments: state.getKeyInfosData.value); - })) - ), + leftTitel: + TranslationLoader.lanKeys!.remoteUnlocking!.tr, + rightTitle: + state.getKeyInfosData.value.remoteEnable == 1 + ? TranslationLoader.lanKeys!.opened!.tr + : TranslationLoader.lanKeys!.closed!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.remoteUnlockingPage, + arguments: state.getKeyInfosData.value); + }))), // 重置键 Obx(() => Visibility( visible: true, child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.resetButton!.tr, - rightTitle: state.getKeyInfosData.value.resetButton == 1 - ? TranslationLoader.lanKeys!.opened!.tr - : TranslationLoader.lanKeys!.closed!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.resetButtonPage, - arguments: state.getKeyInfosData.value); - })) - ), + leftTitel: TranslationLoader.lanKeys!.resetButton!.tr, + rightTitle: + state.getKeyInfosData.value.resetButton == 1 + ? TranslationLoader.lanKeys!.opened!.tr + : TranslationLoader.lanKeys!.closed!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.resetButtonPage, + arguments: state.getKeyInfosData.value); + }))), SizedBox(height: 10.h), //---田总新增展示 // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( - leftTitel: '面容开锁', - rightTitle: "", - isHaveLine: true, - isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, child: _otherUnHaveDoneSwitch()))), + leftTitel: '面容开锁', + rightTitle: "", + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: SizedBox( + width: 60.w, child: _otherUnHaveDoneSwitch()))), // ), // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: '感应距离', - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Toast.show(msg: "功能暂未开放"); - } - )), + Visibility( + visible: true, + child: CommonItem( + leftTitel: '感应距离', + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Toast.show(msg: "功能暂未开放"); + })), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( leftTitel: '自动亮屏', rightTitle: "", isHaveLine: true, isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, child: _otherUnHaveDoneSwitch()))), + rightWidget: SizedBox( + width: 60.w, child: _otherUnHaveDoneSwitch()))), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( leftTitel: '逗留警告', rightTitle: "", isHaveLine: true, isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, child: _otherUnHaveDoneSwitch()))), + rightWidget: SizedBox( + width: 60.w, child: _otherUnHaveDoneSwitch()))), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( leftTitel: '异常警告', rightTitle: "", isHaveLine: true, isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, child: _otherUnHaveDoneSwitch()))), + rightWidget: SizedBox( + width: 60.w, child: _otherUnHaveDoneSwitch()))), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( - leftTitel: '开门方向设置', - rightTitle: "", - isHaveDirection: true, - isHaveLine: true, + leftTitel: '开门方向设置', + rightTitle: "", + isHaveDirection: true, + isHaveLine: true, action: () { Toast.show(msg: "功能暂未开放"); - } - )), + })), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( leftTitel: '电机功率设置', @@ -291,8 +313,7 @@ class _LockSetPageState extends State with RouteAware { isHaveDirection: true, action: () { Toast.show(msg: "功能暂未开放"); - } - )), + })), // ), SizedBox(height: 10.h), //-----新增至此 @@ -307,42 +328,41 @@ class _LockSetPageState extends State with RouteAware { visible: true, child: CommonItem( leftTitel: - TranslationLoader.lanKeys!.markedHouseState!.tr, + TranslationLoader.lanKeys!.markedHouseState!.tr, rightTitle: title, isHaveLine: true, isHaveDirection: true, action: () { Get.toNamed(Routers.markedHouseStatePage, arguments: state.getKeyInfosData.value); - }) - ); + })); }), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr, rightTitle: "", isHaveLine: true, isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, child: _openCheckInSwitch()) - )), + rightWidget: SizedBox( + width: 60.w, child: _openCheckInSwitch()))), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr, + leftTitel: + TranslationLoader.lanKeys!.unlockReminder!.tr, rightTitle: "", isHaveLine: false, isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, child: _lockRemindSwitch()))), + rightWidget: SizedBox( + width: 60.w, child: _lockRemindSwitch()))), // ), SizedBox(height: 10.h), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( leftTitel: TranslationLoader @@ -355,20 +375,20 @@ class _LockSetPageState extends State with RouteAware { })), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.lockTime!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.lockTimePage, - arguments: state.getKeyInfosData.value); - })), + leftTitel: TranslationLoader.lanKeys!.lockTime!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.lockTimePage, + arguments: state.getKeyInfosData.value); + })), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.diagnose!.tr, @@ -381,7 +401,7 @@ class _LockSetPageState extends State with RouteAware { })), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.uploadData!.tr, @@ -393,11 +413,11 @@ class _LockSetPageState extends State with RouteAware { })), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( - leftTitel: - TranslationLoader.lanKeys!.importOtherLockData!.tr, + leftTitel: TranslationLoader + .lanKeys!.importOtherLockData!.tr, rightTitle: "", isHaveLine: true, isHaveDirection: true, @@ -406,10 +426,11 @@ class _LockSetPageState extends State with RouteAware { })), // ), // Obx(() => - Visibility( + Visibility( visible: true, child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.lockEscalation!.tr, + leftTitel: + TranslationLoader.lanKeys!.lockEscalation!.tr, rightTitle: "", isHaveLine: false, isHaveDirection: true, @@ -419,7 +440,8 @@ class _LockSetPageState extends State with RouteAware { // ), SizedBox(height: 30.h), Container( - padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 30.h), + padding: + EdgeInsets.only(left: 20.w, right: 20.w, bottom: 30.h), child: SubmitBtn( btnName: TranslationLoader.lanKeys!.delete!.tr, isDelete: true, diff --git a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/addWirelessKeyboard/addWirelessKeyboard_page.dart b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/addWirelessKeyboard/addWirelessKeyboard_page.dart index 9c10986a..1a702446 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/addWirelessKeyboard/addWirelessKeyboard_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/addWirelessKeyboard/addWirelessKeyboard_page.dart @@ -78,15 +78,15 @@ class _AddWirelessKeyboardPageState extends State { SizedBox( height: 20.h, ), - Container( - margin: EdgeInsets.only(left: 20.w, right: 20.w), - child: SubmitBtn( - btnName: TranslationLoader.lanKeys!.theScreenNeverFlickered!.tr, - onClick: () { - Navigator.pushNamed( - context, Routers.addWirelessKeyboardScreenNotLightOnPage); - }), - ), + // Container( + // margin: EdgeInsets.only(left: 20.w, right: 20.w), + // child: SubmitBtn( + // btnName: TranslationLoader.lanKeys!.theScreenNeverFlickered!.tr, + // onClick: () { + // Navigator.pushNamed( + // context, Routers.addWirelessKeyboardScreenNotLightOnPage); + // }), + // ), ], ), ); diff --git a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/seletWirelessKeyboard/seletWirelessKeyboard_page.dart b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/seletWirelessKeyboard/seletWirelessKeyboard_page.dart index cb8f7d8e..e283a5c4 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/seletWirelessKeyboard/seletWirelessKeyboard_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/seletWirelessKeyboard/seletWirelessKeyboard_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/titleAppBar.dart'; @@ -15,6 +16,7 @@ class SeletWirelessKeyboardPage extends StatefulWidget { } class _SeletWirelessKeyboardPageState extends State { + List dataList = []; @override Widget build(BuildContext context) { return Scaffold( @@ -24,13 +26,16 @@ class _SeletWirelessKeyboardPageState extends State { "${TranslationLoader.lanKeys!.selet!.tr}${TranslationLoader.lanKeys!.wirelessKeyboard!.tr}", haveBack: true, backgroundColor: AppColors.mainColor), - body: ListView.builder( - itemCount: 20, - itemBuilder: (c, index) { - return nearbyLockItem('images/icon_lock.png', "MCBN01-ea9240", () { - // Navigator.pushNamed(context, Routers.saveLockPage); - }); - }), + body: dataList.isEmpty + ? const NoData() + : ListView.builder( + itemCount: 20, + itemBuilder: (c, index) { + return nearbyLockItem('images/icon_lock.png', "MCBN01-ea9240", + () { + // Navigator.pushNamed(context, Routers.saveLockPage); + }); + }), ); } 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 6c5df03b..73b58c0f 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 @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; @@ -17,6 +18,7 @@ class WirelessKeyboardPage extends StatefulWidget { } class _WirelessKeyboardPageState extends State { + List dataList = []; @override Widget build(BuildContext context) { return Scaffold( @@ -55,14 +57,16 @@ class _WirelessKeyboardPageState extends State { } Widget _buildMainUI() { - return ListView.builder( - itemCount: 10, - itemBuilder: (c, index) { - return _electronicKeyItem('images/icon_password.png', "张三", - "2023.6.21 11.15", "2023.6.21 11.15", () { - // Navigator.pushNamed(context, Routers.electronicKeyDetailPage); - }); - }); + return dataList.isEmpty + ? const NoData() + : ListView.builder( + itemCount: 10, + itemBuilder: (c, index) { + return _electronicKeyItem('images/icon_password.png', "张三", + "2023.6.21 11.15", "2023.6.21 11.15", () { + // Navigator.pushNamed(context, Routers.electronicKeyDetailPage); + }); + }); } Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle, diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 4343dd43..3b486de7 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -86,7 +86,7 @@ class _LockDetailPageState extends State with RouteAware { // KeyInfos keyInfo = widget.lockMainEntity.data!.keyInfos![0]; return Column( children: [ - SizedBox(height: 30.h), + SizedBox(height: 50.h), Stack( alignment: Alignment.centerRight, children: [ @@ -120,7 +120,7 @@ class _LockDetailPageState extends State with RouteAware { Container( // width: 1.sw, color: Colors.white, - height: 280.w, + height: 330.w, child: Stack( children: [ Center( @@ -131,8 +131,11 @@ class _LockDetailPageState extends State with RouteAware { // logic.editLockUserAction(); // logic.factoryDataResetAction(); }, - child: Image.asset('images/main/icon_main_openLockBtn.png', - width: 268.w, height: 268.w), + child: Image.asset( + 'images/main/icon_main_openLockBtn.png', + width: 330.w, + height: 330.w, + ), )), // Visibility( // visible: @@ -150,21 +153,21 @@ class _LockDetailPageState extends State with RouteAware { SizedBox( height: 30.h, ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '门已上锁', - style: TextStyle( - fontSize: 26.sp, - color: Colors.black, - fontWeight: FontWeight.w500), - ), - ], - ), - SizedBox( - height: 6.h, - ), + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Text( + // '门已上锁', + // style: TextStyle( + // fontSize: 26.sp, + // color: Colors.black, + // fontWeight: FontWeight.w500), + // ), + // ], + // ), + // SizedBox( + // height: 6.h, + // ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -187,14 +190,15 @@ class _LockDetailPageState extends State with RouteAware { 'images/icon_electronicKey_admin.png', width: 24.w, height: 20.w, + color: AppColors.mainColor, //应根据状态显示(当前角色为超级管理员 应显示蓝色图标) ), SizedBox( width: 6.w, ), Text( '超级管理员', - style: - TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor), + style: TextStyle( + fontSize: 20.sp, color: AppColors.darkGrayTextColor), ), SizedBox( width: 80.w, @@ -265,10 +269,10 @@ class _LockDetailPageState extends State with RouteAware { bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, () { Get.toNamed(Routers.electronicKeyListPage, arguments: { - "lockMainEntity": widget.lockMainEntity, - "keyInfo": widget.keyInfo - }); - }), + "lockMainEntity": widget.lockMainEntity, + "keyInfo": widget.keyInfo + }); + }), // 密码 bottomItem('images/main/icon_main_password.png', @@ -280,28 +284,24 @@ class _LockDetailPageState extends State with RouteAware { }), // ic卡 - bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () { - Get.toNamed(Routers.otherTypeKeyListPage, arguments: { - "lockId": widget.keyInfo.lockId, - "fromType": 0 - }); - }), + bottomItem('images/main/icon_main_icCard.png', + TranslationLoader.lanKeys!.card!.tr, () { + Get.toNamed(Routers.otherTypeKeyListPage, + arguments: {"lockId": widget.keyInfo.lockId, "fromType": 0}); + }), // 指纹 - bottomItem('images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, () { - Get.toNamed(Routers.otherTypeKeyListPage, arguments: { - "lockId": widget.keyInfo.lockId, - "fromType": 1 - }); + bottomItem('images/main/icon_main_fingerprint.png', + TranslationLoader.lanKeys!.fingerprint!.tr, () { + Get.toNamed(Routers.otherTypeKeyListPage, + arguments: {"lockId": widget.keyInfo.lockId, "fromType": 1}); }), // 遥控 - bottomItem('images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, () { - // Get.toNamed(Routers.otherTypeKeyListPage, arguments: { - // "lockId": widget.keyInfo.lockId, - // "fromType": 2 - // }); - Toast.show(msg: "功能暂未开放"); + bottomItem('images/main/icon_main_remoteControl.png', + TranslationLoader.lanKeys!.remoteControl!.tr, () { + Get.toNamed(Routers.otherTypeKeyListPage, + arguments: {"lockId": widget.keyInfo.lockId, "fromType": 2}); }), ]; showWidgetArr.addAll(defaultWidgetArr); @@ -345,7 +345,7 @@ class _LockDetailPageState extends State with RouteAware { bottomItem( 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () { - BlueManage().stopScan(); + BlueManage().stopScan(); Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo); }), ]; diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart index 4d35223a..2371827b 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart @@ -1,4 +1,3 @@ - import 'dart:math'; import 'package:get/get.dart'; @@ -13,19 +12,19 @@ class OtherTypeAddKeyLogic extends BaseGetXController { OtherTypeAddKeyState state = OtherTypeAddKeyState(); // 添加指纹 - void addFingerprintsData() async{ - var fingerprintType = 0;// 永久:1;限时2,单次3,循环:4 + void addFingerprintsData() async { + var fingerprintType = 0; // 永久:1;限时2,单次3,循环:4 var startDate = ""; var endDate = ""; - if(state.seletType.value == "0"){ + if (state.seletType.value == "0") { fingerprintType = 1; - }else if(state.seletType.value == "1"){ + } else if (state.seletType.value == "1") { fingerprintType = 2; - if(state.beginTimeTimestamp.value.isEmpty){ + if (state.beginTimeTimestamp.value.isEmpty) { Toast.show(msg: "请选择开始时间"); return; } - if(state.endTimeTimestamp.value.isEmpty){ + if (state.endTimeTimestamp.value.isEmpty) { Toast.show(msg: "请选择开始时间"); return; } @@ -35,25 +34,27 @@ class OtherTypeAddKeyLogic extends BaseGetXController { // return; // } - print("fasdfasdfasdf:${int.parse(state.beginTimeTimestamp.value)} == ${int.parse(state.endTimeTimestamp.value)}"); - if(int.parse(state.beginTimeTimestamp.value) >= int.parse(state.endTimeTimestamp.value)){ + print( + "fasdfasdfasdf:${int.parse(state.beginTimeTimestamp.value)} == ${int.parse(state.endTimeTimestamp.value)}"); + if (int.parse(state.beginTimeTimestamp.value) >= + int.parse(state.endTimeTimestamp.value)) { Toast.show(msg: "失效时间要大于生效时间"); return; } startDate = state.beginTimeTimestamp.value; endDate = state.endTimeTimestamp.value; - }else if(state.seletType.value == "2"){ - if(state.effectiveDateTime.value <= 0){ + } else if (state.seletType.value == "2") { + if (state.effectiveDateTime.value <= 0) { Toast.show(msg: "请选择生效时间"); return; } - if(state.failureDateTime.value <= 0){ + if (state.failureDateTime.value <= 0) { Toast.show(msg: "请选择失效时间"); return; } - if(state.weekdaysList.value.isEmpty){ + if (state.weekdaysList.value.isEmpty) { Toast.show(msg: "请选择有效日"); return; } @@ -63,7 +64,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController { // return; // } - if(state.effectiveDateTime.value >= state.failureDateTime.value){ + if (state.effectiveDateTime.value >= state.failureDateTime.value) { Toast.show(msg: "失效时间要大于生效时间"); return; } @@ -81,7 +82,8 @@ class OtherTypeAddKeyLogic extends BaseGetXController { "endDate": endDate, "addType": "1", "cardName": state.nameController.text, - "cardNumber": (Random().nextInt(100000000) + 10000000).floor().toString(), + "cardNumber": + (Random().nextInt(100000000) + 10000000).floor().toString(), "cardType": fingerprintType.toString(), "isCoerced": state.isStressFingerprint.value ? "1" : "2", "startDate": startDate, @@ -108,6 +110,20 @@ class OtherTypeAddKeyLogic extends BaseGetXController { break; case 1: // 指纹 + Get.toNamed(Routers.addFingerprintPage, arguments: { + "lockId": state.lockId.value, + "endDate": endDate, + "addType": "1", + "fingerprintName": state.nameController.text, + "fingerprintNumber": "123456", + "fingerprintType": fingerprintType.toString(), + "isCoerced": state.isStressFingerprint.value ? "1" : "2", + "startDate": startDate, + "weekDay": state.weekdaysList.value, + "fromType": state.fromType.value, + }); + + /* 根据田总需求 无需tips页面 直接跳转到添加页面 Get.toNamed(Routers.addFingerprintTipPage, arguments: { "lockId": state.lockId.value, "endDate": endDate, @@ -120,6 +136,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController { "weekDay": state.weekdaysList.value, "fromType": state.fromType.value, }); + */ // var entity = await ApiRepository.to.addFingerprintsData( // lockId: state.lockId.value.toString(), @@ -138,34 +155,28 @@ class OtherTypeAddKeyLogic extends BaseGetXController { // } break; case 2: - // 遥控 + // 遥控 break; default: break; } - } @override void onReady() { // TODO: implement onReady super.onReady(); - - } @override void onInit() { // TODO: implement onInit super.onInit(); - } @override void onClose() { // TODO: implement onClose - } - -} \ No newline at end of file +} 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 9b663928..d82bd6fa 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,6 @@ +import 'package:date_format/date_format.dart'; 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/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; @@ -26,6 +28,7 @@ class _PasswordKeyDetailPageState extends State { PasswordKeyListItem itemData = PasswordKeyListItem(); late TextEditingController _inputPwdController; late TextEditingController _inputNameController; + static const methodChannel = MethodChannel('flutter_native_ios'); @override void initState() { @@ -33,42 +36,14 @@ class _PasswordKeyDetailPageState extends State { _inputPwdController = TextEditingController(); _inputNameController = TextEditingController(); - - // _initFluwx(); } - // _initFluwx() async { - // await registerWxApi( - // appId: "", doOnAndroid: true, doOnIOS: true, universalLink: ""); - // } - @override Widget build(BuildContext context) { dynamic obj = ModalRoute.of(context)?.settings.arguments; 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, appBar: TitleAppBar( @@ -83,29 +58,7 @@ class _PasswordKeyDetailPageState extends State { width: 30.w, ), 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为你想要的数字就行 - }); - */ + _openModalBottomSheet(); }, ), ], @@ -371,91 +324,124 @@ 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, + Future _openModalBottomSheet() async { + showModalBottomSheet( + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadiusDirectional.circular(10)), + constraints: BoxConstraints(maxHeight: 260.h), + builder: (BuildContext context) { + return Column( + children: [ + SizedBox( + width: ScreenUtil().screenWidth, + height: 180.h, + child: ListView( + scrollDirection: Axis.horizontal, //横向滚动 + children: initBottomSheetList()), ), - ), - ), - Container( - height: 0.5, - color: Colors.blueGrey, - ), - const Center( - child: Padding( - padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0), + Container( + height: 8.h, + color: AppColors.greyBackgroundColor, + ), + TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), child: Text( - '取 消', - style: TextStyle(fontSize: 18.0, color: Colors.blueGrey), - )), - ) - ], + '取消', + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + ); + }); + } + + List initBottomSheetList() { + List widgetList = []; + + widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0)); + widgetList.add(buildCenter3('images/icon_message.png', '短信', 1)); + widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2)); + widgetList.add(buildCenter3('images/icon_more.png', '更多', 3)); + + return widgetList; + } + + GestureDetector buildCenter3( + String imageName, String titleStr, int itemIndex) { + return GestureDetector( + child: Container( + width: 120.w, + // height: 64.h, + margin: + EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + imageName, + width: 50.w, + height: 50.h, + ), + SizedBox( + height: 16.w, + ), + Text( + titleStr, + style: TextStyle( + fontSize: ScreenUtil().setSp(20), color: Colors.black), + ), + ], + ), ), - */ + onTap: () => _jumpSmartDeviceRoute(itemIndex), ); } + + _jumpSmartDeviceRoute(int itemIndex) { + switch (itemIndex) { + case 0: + //微信好友 + { + String pwdShareStr = + '您好,您的密码是:${itemData.keyboardPwd}\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}'; + tokNative('flutter_sharePassword_to_ios', + arguments: {'pwdShareStr': pwdShareStr}).then((result) { + print('$result'); + }); + print('与原生交互'); + } + break; + case 1: + //短信 + {} + break; + case 2: + //邮件 + { + Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + } + break; + case 3: + //更多 + {} + break; + default: + } + } + + static Future tokNative(String method, + {required Map arguments}) async { + if (arguments == null) { + return await methodChannel.invokeMethod(method); + } else { + return await methodChannel.invokeMethod(method, arguments); + } + } } 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 239af336..fcfbfc1b 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 @@ -1,11 +1,13 @@ import 'package:date_format/date_format.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_pickers/pickers.dart'; import 'package:flutter_pickers/style/default_style.dart'; import 'package:flutter_pickers/time_picker/model/date_mode.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/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart'; import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -37,6 +39,7 @@ class _PasswordKeyPerpetualPageState extends State { final TextEditingController _nameController = TextEditingController(); final TextEditingController _pwdController = TextEditingController(); final logic = Get.put(PasswordKeyPerpetualLogic()); + static const methodChannel = MethodChannel('flutter_native_ios'); late bool _isSendSuccess; //是否发送成功 late bool _isPermanent; //是否永久 @@ -581,7 +584,7 @@ class _PasswordKeyPerpetualPageState extends State { OutLineBtn( btnName: '分享', onClick: () { - Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + _openModalBottomSheet(); }, ), SizedBox( @@ -644,4 +647,125 @@ class _PasswordKeyPerpetualPageState extends State { String intToStr(int v) { return (v < 10) ? "0$v" : "$v"; } + + Future _openModalBottomSheet() async { + showModalBottomSheet( + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadiusDirectional.circular(10)), + constraints: BoxConstraints(maxHeight: 260.h), + builder: (BuildContext context) { + return Column( + children: [ + SizedBox( + width: ScreenUtil().screenWidth, + height: 180.h, + child: ListView( + scrollDirection: Axis.horizontal, //横向滚动 + children: initBottomSheetList()), + ), + Container( + height: 8.h, + color: AppColors.greyBackgroundColor, + ), + TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消', + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + ); + }); + } + + List initBottomSheetList() { + List widgetList = []; + + widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0)); + widgetList.add(buildCenter3('images/icon_message.png', '短信', 1)); + widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2)); + widgetList.add(buildCenter3('images/icon_more.png', '更多', 3)); + + return widgetList; + } + + GestureDetector buildCenter3( + String imageName, String titleStr, int itemIndex) { + return GestureDetector( + child: Container( + width: 120.w, + // height: 64.h, + margin: + EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + imageName, + width: 50.w, + height: 50.h, + ), + SizedBox( + height: 16.w, + ), + Text( + titleStr, + style: TextStyle( + fontSize: ScreenUtil().setSp(20), color: Colors.black), + ), + ], + ), + ), + onTap: () => _jumpSmartDeviceRoute(itemIndex), + ); + } + +//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName} + _jumpSmartDeviceRoute(int itemIndex) { + switch (itemIndex) { + case 0: + //微信好友 + { + String pwdShareStr = '您好,您的密码是:$_getPwdStr'; + tokNative('flutter_sharePassword_to_ios', + arguments: {'pwdShareStr': pwdShareStr}).then((result) { + print('$result'); + }); + print('与原生交互'); + } + break; + case 1: + //短信 + {} + break; + case 2: + //邮件 + { + Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + } + break; + case 3: + //更多 + {} + break; + default: + } + } + + static Future tokNative(String method, + {required Map arguments}) async { + if (arguments == null) { + return await methodChannel.invokeMethod(method); + } else { + return await methodChannel.invokeMethod(method, arguments); + } + } } diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart index 7daef4ed..5e2106b7 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart @@ -3,6 +3,7 @@ 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/tools/submitBtn.dart'; import '../../../appRouters.dart'; import '../../../baseWidget.dart'; @@ -97,7 +98,7 @@ class _StarLockMainPageState extends State with BaseWidget { Widget unHaveData() { return Column( - mainAxisAlignment: MainAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, @@ -105,6 +106,7 @@ class _StarLockMainPageState extends State with BaseWidget { Container( width: 330.w, height: 330.w, + margin: EdgeInsets.only(top: 180.h), // decoration: BoxDecoration( // border: Border.all(width: 4.w, color: AppColors.mainColor), // borderRadius: BorderRadius.circular(110.w), @@ -131,11 +133,8 @@ class _StarLockMainPageState extends State with BaseWidget { )), ], ), - SizedBox( - height: h(50.h), - ), Container( - padding: EdgeInsets.all(30.w), + padding: EdgeInsets.only(top: 10.h), child: Text( TranslationLoader .lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr, @@ -143,7 +142,11 @@ class _StarLockMainPageState extends State with BaseWidget { fontSize: 26.sp, // fontWeight: FontWeight.w800, color: Colors.black), - )) + )), + SizedBox( + height: 200.h, + ), + SubmitBtn(btnName: '演示模式') ], ); } diff --git a/star_lock/lib/mine/about/about_page.dart b/star_lock/lib/mine/about/about_page.dart index 63074596..db300f55 100644 --- a/star_lock/lib/mine/about/about_page.dart +++ b/star_lock/lib/mine/about/about_page.dart @@ -12,10 +12,14 @@ import '../../translations/trans_lib.dart'; // 网页的宏定义网址 class XSWebviewURLMacro { static const baseWebURL = 'https://pre.lock.star-lock.cn:8093'; //baseURL - static const userAgreementURL = - '$baseWebURL/page/detail?pageId=1&lang=cn'; //1用户协议 - static const privacyPolicyURL = - '$baseWebURL/page/detail?pageId=2&lang=cn'; //2隐私政策 + static const userAgreementURL = '$baseWebURL/app/userAgreement'; //用户协议 + static const privacyPolicyURL = '$baseWebURL/app/privacy'; //隐私政策 + static const collectionListURL = + '$baseWebURL/app/personalInformationCollectionList'; //个人信息收集清单 + static const thirdPartyInfShareListURL = + '$baseWebURL/app/thirdPartyInformationSharingList'; //第三方信息共享清单 + static const appPermissionDescURL = + '$baseWebURL/app/applicationPermissionDescription'; //应用权限说明 } class AbountPage extends StatefulWidget { @@ -66,7 +70,11 @@ class _AbountPageState extends State { isHaveLine: false, isHaveDirection: true, action: () { - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.webviewShowPage, + arguments: { + "url": XSWebviewURLMacro.userAgreementURL, + "title": '介绍' + }); }), Divider( height: 1, @@ -117,7 +125,11 @@ class _AbountPageState extends State { isHaveLine: false, isHaveDirection: true, action: () { - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.webviewShowPage, + arguments: { + "url": XSWebviewURLMacro.collectionListURL, + "title": '个人信息收集清单' + }); }), Divider( height: 1, @@ -132,7 +144,11 @@ class _AbountPageState extends State { isHaveLine: false, isHaveDirection: true, action: () { - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.webviewShowPage, + arguments: { + "url": XSWebviewURLMacro.appPermissionDescURL, + "title": '应用权限说明' + }); }), Divider( height: 1, @@ -147,7 +163,11 @@ class _AbountPageState extends State { isHaveLine: false, isHaveDirection: true, action: () { - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.webviewShowPage, + arguments: { + "url": XSWebviewURLMacro.thirdPartyInfShareListURL, + "title": '第三方信息共享清单' + }); }), ], ), diff --git a/star_lock/lib/mine/addLock/addLock/addLock_logic.dart b/star_lock/lib/mine/addLock/addLock/addLock_logic.dart new file mode 100644 index 00000000..081cfd3c --- /dev/null +++ b/star_lock/lib/mine/addLock/addLock/addLock_logic.dart @@ -0,0 +1,23 @@ +import 'package:star_lock/mine/addLock/addLock/addLock_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class AddLockLogic extends BaseGetXController { + final AddLockState state = AddLockState(); + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + } + + @override + void onClose() { + // TODO: implement onClose + } +} diff --git a/star_lock/lib/mine/addLock/addLock/addLock_page.dart b/star_lock/lib/mine/addLock/addLock/addLock_page.dart index 5b434fac..bd19da74 100644 --- a/star_lock/lib/mine/addLock/addLock/addLock_page.dart +++ b/star_lock/lib/mine/addLock/addLock/addLock_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:star_lock/mine/addLock/addLock/addLock_logic.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; @@ -20,6 +21,9 @@ class AddLockPage extends StatefulWidget { } class _AddLockPageState extends State with BaseWidget { + final logic = Get.put(AddLockLogic()); + final state = Get.find().state; + @override Widget build(BuildContext context) { return Scaffold( @@ -49,11 +53,11 @@ class _AddLockPageState extends State with BaseWidget { SizedBox( height: 120.h, ), - Image.asset( - 'images/lockType/addLock_touchScreen.png', - width: 278.w, - height: 278.w, - ), + Obx(() => Image.asset( + state.lockTypeImg.value, + width: 278.w, + height: 278.w, + )), SizedBox( height: 120.h, ), @@ -73,17 +77,16 @@ class _AddLockPageState extends State with BaseWidget { btnName: TranslationLoader.lanKeys!.next!.tr, borderRadius: 20.w, onClick: () { - if(Platform.isIOS){ + if (Platform.isIOS) { Navigator.pushNamed(context, Routers.nearbyLockPage); - }else { - getMicrophonePermission() - .then((value) { + } else { + getMicrophonePermission().then((value) { if (value) { // 有权限 Navigator.pushNamed(context, Routers.nearbyLockPage); - }else{ + } else { //没有权限 - openAppSettings();//打开app系统设置 + openAppSettings(); //打开app系统设置 } }); } diff --git a/star_lock/lib/mine/addLock/addLock/addLock_state.dart b/star_lock/lib/mine/addLock/addLock/addLock_state.dart new file mode 100644 index 00000000..04184a8b --- /dev/null +++ b/star_lock/lib/mine/addLock/addLock/addLock_state.dart @@ -0,0 +1,29 @@ +import 'package:get/get.dart'; + +class AddLockState { + var getLockType = 1.obs; //0-所有锁;1-门锁;2-NFC无源锁;3-挂锁;4-保险箱锁;5-车位锁;6-智能门禁;7-网关 + var lockTypeImg = 'images/lockType/addLock_touchScreen.png'.obs; //不同类型锁图片更换 + + AddLockState() { + Map map = Get.arguments; + if (map.isNotEmpty) { + if (map["getLockType"] != null) { + getLockType.value = map["getLockType"]; + //保险箱锁 + if (getLockType.value == 4) { + lockTypeImg.value = "images/lockType/addLock_safeBg.png"; + } else if (getLockType.value == 5) { + //车位锁 + lockTypeImg.value = "images/lockType/addLock_parkingBg.png"; + } else if (getLockType.value == 6) { + //智能门禁 + lockTypeImg.value = "images/lockType/addLock_entranceGuardBg.png"; + } + } else { + lockTypeImg.value = 'images/lockType/addLock_touchScreen.png'; + } + } else { + lockTypeImg.value = 'images/lockType/addLock_touchScreen.png'; + } + } +} diff --git a/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart b/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart index 8b1d4e09..1bacdff5 100644 --- a/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart +++ b/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart @@ -1,6 +1,9 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:permission_handler/permission_handler.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; @@ -40,33 +43,34 @@ class _SeletLockTypePageState extends State with BaseWidget { children: [ lockTypeItem('images/lockType/lockType_doorLock.png', TranslationLoader.lanKeys!.doorLock!.tr, () { - Navigator.pushNamed(context, Routers.addLockPage); + Navigator.pushNamed(context, Routers.addLockPage, + arguments: {'getLockType': 1}); }), lockTypeItem('images/lockType/lockType_NFCLock.png', TranslationLoader.lanKeys!.NFCPassiveLock!.tr, () { // Navigator.pushNamed(context, Routers.addLockPage); - Toast.show(msg: "功能暂未开放"); + getNearByLimits(); }), lockTypeItem('images/lockType/lockType_padlock.png', TranslationLoader.lanKeys!.padlock!.tr, () { // Navigator.pushNamed(context, Routers.addLockPage); - Toast.show(msg: "功能暂未开放"); + getNearByLimits(); }), lockTypeItem('images/lockType/lockType_safeLock.png', TranslationLoader.lanKeys!.safeLock!.tr, () { - // Navigator.pushNamed(context, Routers.addLockPage); - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.addLockPage, + arguments: {'getLockType': 4}); }), lockTypeItem('images/lockType/lockType_parkingLock.png', TranslationLoader.lanKeys!.parkingLock!.tr, () { - // Navigator.pushNamed(context, Routers.addLockPage); - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.addLockPage, + arguments: {'getLockType': 5}); }), lockTypeItem('images/lockType/lockType_entranceGuardLock.png', TranslationLoader.lanKeys!.itelligentAccessControl!.tr, () { - // Navigator.pushNamed(context, Routers.addLockPage); - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.addLockPage, + arguments: {'getLockType': 6}); }), // lockTypeItem('images/lockType/lockType_bicycleLock.png', @@ -76,7 +80,7 @@ class _SeletLockTypePageState extends State with BaseWidget { lockTypeItem('images/lockType/lockType_gatewayLock.png', TranslationLoader.lanKeys!.gateway!.tr, () { // Navigator.pushNamed(context, Routers.gatewayListPage); - Toast.show(msg: "功能暂未开放"); + getNearByLimits(); }), ], ), @@ -90,7 +94,8 @@ class _SeletLockTypePageState extends State with BaseWidget { Widget allLock() { return GestureDetector( onTap: () { - Navigator.pushNamed(context, Routers.addLockPage); + Navigator.pushNamed(context, Routers.addLockPage, + arguments: {'getLockType': 0}); }, child: Container( height: 150.h, @@ -174,6 +179,41 @@ class _SeletLockTypePageState extends State with BaseWidget { ); } +//跳转到附近的锁页面先判断权限 + void getNearByLimits() { + if (Platform.isIOS) { + Navigator.pushNamed(context, Routers.nearbyLockPage); + } else { + getMicrophonePermission().then((value) { + if (value) { + // 有权限 + Navigator.pushNamed(context, Routers.nearbyLockPage); + } else { + //没有权限 + openAppSettings(); //打开app系统设置 + } + }); + } + } + + ///请求权限 + Future getMicrophonePermission() async { + // You can request multiple permissions at once. + Map statuses = await [ + Permission.bluetoothScan, + Permission.bluetoothConnect, + Permission.location, + ].request(); + + //granted 通过,denied 被拒绝,permanentlyDenied 拒绝且不在提示 + if (statuses[Permission.bluetoothScan]!.isGranted && + statuses[Permission.bluetoothConnect]!.isGranted && + statuses[Permission.location]!.isGranted) { + return true; + } + return false; + } + void onShow() {} void onHide() {} diff --git a/star_lock/lib/mine/message/messageList_page.dart b/star_lock/lib/mine/message/messageList_page.dart index af201f3d..98135ee4 100644 --- a/star_lock/lib/mine/message/messageList_page.dart +++ b/star_lock/lib/mine/message/messageList_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; @@ -15,6 +16,7 @@ class MessageListPage extends StatefulWidget { } class _MessageListPageState extends State { + List dataList = []; @override Widget build(BuildContext context) { return Scaffold( @@ -23,14 +25,17 @@ class _MessageListPageState extends State { barTitle: TranslationLoader.lanKeys!.message!.tr, haveBack: true, backgroundColor: AppColors.mainColor), - body: ListView.builder( - itemCount: 10, - itemBuilder: (c, index) { - return _seletGatewayListListItem( - 'images/controls_user.png', "您的钥匙已发送成功", "2023.6.21 11.15", () { - // Navigator.pushNamed(context, Routers.gatewayConfigurationWifiPage); - }); - }), + body: dataList.isEmpty + ? const NoData() + : ListView.builder( + itemCount: 10, + itemBuilder: (c, index) { + return _seletGatewayListListItem( + 'images/controls_user.png', "您的钥匙已发送成功", "2023.6.21 11.15", + () { + // Navigator.pushNamed(context, Routers.gatewayConfigurationWifiPage); + }); + }), ); } diff --git a/star_lock/lib/mine/mine/starLockMine_page.dart b/star_lock/lib/mine/mine/starLockMine_page.dart index f0064a48..8ed2988b 100644 --- a/star_lock/lib/mine/mine/starLockMine_page.dart +++ b/star_lock/lib/mine/mine/starLockMine_page.dart @@ -136,8 +136,8 @@ class _StarLockMinePageState extends State with BaseWidget { // }), mineItem('images/mine/icon_mine_main_message.png', TranslationLoader.lanKeys!.message!.tr, () { - // Navigator.pushNamed(context, Routers.messageListPage); - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.messageListPage); + // Toast.show(msg: "功能暂未开放"); }), //删除“客服”行 // mineItem('images/mine/icon_mine_main_supportStaff.png', diff --git a/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_logic.dart b/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_logic.dart new file mode 100644 index 00000000..549f7ccf --- /dev/null +++ b/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_logic.dart @@ -0,0 +1,124 @@ +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/mine/mineSet/addAuthorizedAdministrator/AddAuthorizedAdministrator_state.dart'; +import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/toast.dart'; +import 'package:star_lock/translations/trans_lib.dart'; + +class AddAuthorizedAdministratorLogic extends BaseGetXController { + final AddAuthorizedAdministratorState state = + AddAuthorizedAdministratorState(); + + //发送批量授权管理员 + Future addAuthorizedAdminRequest() async { + String getFailureDateTime = '0'; + String getEffectiveDateTime = '0'; + if (state.tabController!.index == 1) { + getFailureDateTime = + state.failureDateTime.value.millisecondsSinceEpoch.toString(); + getEffectiveDateTime = + state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); + } + var entity = await ApiRepository.to.addAuthorizedAdmin( + state.isCreateUser.value ? "1" : "0", + getFailureDateTime, + state.isRemoteUnlock.value == true ? '1' : '2', + [], + state.lockIdList, + state.keyNameController.text, + getEffectiveDateTime, + state.emailOrPhoneController.text, + state.countryCode.value, + '1', + ); + if (entity.errorCode!.codeIsSuccessful) { + print('发送电子钥匙成功'); + state.isSendSuccess.value = true; + } else { + Toast.show(msg: '${entity.errorMsg}'); + if (entity.errorCode == 425) { + //用户未注册 + state.isCreateUser.value = true; + addAuthorizedAdminRequest(); + } + } + } + + //发送钥匙请求 + Future sendElectronicKeyRequest(BuildContext widgetContext) async { + String getFailureDateTime = '0'; + String getEffectiveDateTime = '0'; + String lockID = state.keyInfo.value.lockId.toString(); + String getKeyType = (int.parse(state.type.value) + 1).toString(); + if (state.type.value == '0') { + getFailureDateTime = + state.failureDateTime.value.millisecondsSinceEpoch.toString(); + getEffectiveDateTime = + state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); + } + + var entity = await ApiRepository.to.sendElectronicKey( + createUser: state.isCreateUser.value ? "1" : "0", + countryCode: state.countryCode.value, + usernameType: '1', + endDate: getFailureDateTime, + faceAuthentication: state.isAuthentication.value == true ? '1' : '2', + isCameraEnable: '2', + isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2', + keyNameForAdmin: state.keyNameController.text, + keyRight: '0', + keyType: getKeyType, + lockId: lockID, + operatorUid: '', + receiverUsername: state.emailOrPhoneController.text, + remarks: '', + startDate: getEffectiveDateTime, + weekDays: state.weekdaysList); + if (entity.errorCode!.codeIsSuccessful) { + print('发送电子钥匙成功'); + state.isSendSuccess.value = true; + } else { + if (entity.errorCode == 425) { + //用户未注册 + _showDialog(widgetContext, '${entity.errorMsg}'); + } + } + } + + //用户未注册确认弹窗 + void _showDialog(widgetContext, String errMsg) { + showCupertinoDialog( + context: widgetContext, + builder: (context) { + return CupertinoAlertDialog( + title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'), + actions: [ + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.cancel!.tr), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.selet!.tr), + onPressed: () async { + //选择国家代码 + state.isCreateUser.value = true; + Navigator.of(context).pop(); + + var result = await Get.toNamed(Routers.seletCountryRegionPage); + if (result != null) { + result as Map; + state.countryCode.value = result['code']; + state.countryName.value = result['countryName']; + } + }, + ), + ], + ); + }, + ); + } +} diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart b/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart similarity index 100% rename from star_lock/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart rename to star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart diff --git a/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart b/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart new file mode 100644 index 00000000..bc4c0763 --- /dev/null +++ b/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart @@ -0,0 +1,39 @@ +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/lockMian/entity/lockInfoEntity.dart'; + +class AddAuthorizedAdministratorState { + late TabController? tabController; + TextEditingController emailOrPhoneController = + TextEditingController(); //邮箱/手机号输入框 + TextEditingController keyNameController = TextEditingController(); //钥匙名输入框 + + final FlutterContactPicker contactPicker = FlutterContactPicker(); + late Contact contact; + var type = ''.obs; + var lockIdList = [].obs; + var weekdaysList = [].obs; + var isCreateUser = false.obs; //用户未注册时传1 已注册传0 + var selectEffectiveDate = + '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}' + .obs; //默认为当前时间 + var selectFailureDate = + '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}' + .obs; //默认为当前时间 + final effectiveDateTime = DateTime.now().obs; + final failureDateTime = DateTime.now().obs; + var countryName = '中国'.obs; + var countryCode = '86'.obs; + var isSendSuccess = false.obs; + final isRemoteUnlock = false.obs; //是否允许远程开锁 + final isAuthentication = false.obs; //是否允许实名认证 + final keyInfo = KeyInfos().obs; + final lockMainEntity = LockMainEntity().obs; + + AddAuthorizedAdministratorState() { + Map map = Get.arguments; + lockMainEntity.value = map["lockMainEntity"]; + keyInfo.value = map["keyInfo"]; + } +} diff --git a/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart b/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart index bd4896dd..92ce0192 100644 --- a/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart +++ b/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart @@ -6,6 +6,7 @@ import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; import 'package:star_lock/tools/ExpandedListView.dart'; +import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/translations/trans_lib.dart'; @@ -28,6 +29,7 @@ class _AuthorityManagementPageState extends State bool isDeviceSelect = false; int selectDeviceIndex = 0; int selectNameIndex = 0; + List dataList = []; List tabs = [ TranslationLoader.lanKeys!.name!.tr, @@ -83,9 +85,10 @@ class _AuthorityManagementPageState extends State )), ), ), - body: TabBarView( - controller: _tabController, - children: [_permissionNameList(), _permissionDeviceList()]))); + body: TabBarView(controller: _tabController, children: [ + dataList.isEmpty ? const NoData() : _permissionNameList(), + dataList.isEmpty ? const NoData() : _permissionDeviceList() + ]))); } //姓名列表 diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart index 9da69699..379bba0b 100644 --- a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart +++ b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart @@ -4,6 +4,7 @@ import 'package:get/get.dart'; import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; @@ -131,12 +132,14 @@ class _AuthorizedAdministratorListPageState } Widget _buildMainUI(List itemList) { - return ListView.builder( - itemCount: itemList.length, - itemBuilder: (c, index) { - AuthorizedAdminListItem itemData = itemList[index]; - return _electronicKeyItem(itemData); - }); + return itemList.isEmpty + ? const NoData() + : ListView.builder( + itemCount: itemList.length, + itemBuilder: (c, index) { + AuthorizedAdminListItem itemData = itemList[index]; + return _electronicKeyItem(itemData); + }); } Widget _electronicKeyItem(AuthorizedAdminListItem itemData) { diff --git a/star_lock/lib/mine/mineSet/lockGroup/lockItemList_page.dart b/star_lock/lib/mine/mineSet/lockGroup/lockItemList_page.dart index ac7e2f66..0389e961 100644 --- a/star_lock/lib/mine/mineSet/lockGroup/lockItemList_page.dart +++ b/star_lock/lib/mine/mineSet/lockGroup/lockItemList_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/titleAppBar.dart'; @@ -55,7 +56,7 @@ class _LockItemListPageState extends State { ); }, ) - : Container(), + : const NoData(), ); } diff --git a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList_page.dart b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList_page.dart index dfd5e047..2c313057 100644 --- a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList_page.dart +++ b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList_page.dart @@ -4,6 +4,7 @@ import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; @@ -119,19 +120,21 @@ class _LockUserManageListPageState extends State { } Widget _buildMainUI() { - return ListView.separated( - itemCount: dataList.length, - itemBuilder: (c, index) { - LockUserData indexEntity = dataList[index]; - return _electronicKeyItem(indexEntity); - }, - separatorBuilder: (BuildContext context, int index) { - return const Divider( - height: 1, - color: AppColors.greyLineColor, - ); - }, - ); + return dataList.isEmpty + ? const NoData() + : ListView.separated( + itemCount: dataList.length, + itemBuilder: (c, index) { + LockUserData indexEntity = dataList[index]; + return _electronicKeyItem(indexEntity); + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ); } //请求锁用户列表 diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart index ca1d4ba4..644d3471 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -93,15 +93,15 @@ class _MineSetPageState extends State { Navigator.pushNamed( context, Routers.authorizedAdministratorListPage); }), - //by DaisyWu 新增--权限管理 + //by DaisyWu 新增--批量授权 CommonItem( leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr, rightTitle: "", isHaveLine: true, isHaveDirection: true, action: () { - // Navigator.pushNamed(context, Routers.authorityManagementPage); - Toast.show(msg: "功能暂未开放"); + Navigator.pushNamed(context, Routers.authorityManagementPage); + // Toast.show(msg: "功能暂未开放"); }), CommonItem( leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr, diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart index 108a78f0..845d4fa0 100644 --- a/star_lock/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart @@ -31,59 +31,51 @@ class _ValueAddedServicesPageListState _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_note.png'), TranslationLoader.lanKeys!.note!.tr, () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed( - // context, Routers.valueAddedServicesNoteAndEmailDetailPage, - // arguments: 1); + Navigator.pushNamed( + context, Routers.valueAddedServicesNoteAndEmailDetailPage, + arguments: 1); }), _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_email.png'), TranslationLoader.lanKeys!.mail!.tr, () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed( - // context, Routers.valueAddedServicesNoteAndEmailDetailPage, - // arguments: 2); + Navigator.pushNamed( + context, Routers.valueAddedServicesNoteAndEmailDetailPage, + arguments: 2); }), _valueAddedServicesItem( Image.asset( 'images/mine/icon_mine_valueAddedServices_realName.png'), TranslationLoader.lanKeys!.realNameAuthentication!.tr, () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed( - // context, Routers.valueAddedServicesRealNamePage); + Navigator.pushNamed( + context, Routers.valueAddedServicesRealNamePage); }), _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_vip.png'), TranslationLoader.lanKeys!.advancedFunction!.tr, () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed( - // context, Routers.valueAddedServicesHighFunctionPage); + Navigator.pushNamed( + context, Routers.valueAddedServicesHighFunctionPage); }), _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_push.png'), TranslationLoader.lanKeys!.pushMessage!.tr, () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed(context, Routers.gatewayDetailPage); + Navigator.pushNamed(context, Routers.gatewayDetailPage); }), _valueAddedServicesItem( Image.asset( 'images/mine/icon_mine_valueAddedServices_checkIn.png'), TranslationLoader.lanKeys!.checkingIn!.tr, () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed(context, Routers.gatewayDetailPage); + Navigator.pushNamed(context, Routers.gatewayDetailPage); }), _valueAddedServicesItem( Image.asset( 'images/mine/icon_mine_valueAddedServices_storage.png'), TranslationLoader.lanKeys!.recordsRetention!.tr, () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed(context, Routers.gatewayDetailPage); + Navigator.pushNamed(context, Routers.gatewayDetailPage); }), _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_vip.png'), '可视对讲', () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed(context, Routers.gatewayDetailPage); + Navigator.pushNamed(context, Routers.gatewayDetailPage); }), _valueAddedServicesItem( Text( @@ -94,8 +86,7 @@ class _ValueAddedServicesPageListState fontWeight: FontWeight.w600), ), "Amazon Alexa", () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed(context, Routers.gatewayDetailPage); + Navigator.pushNamed(context, Routers.gatewayDetailPage); }), _valueAddedServicesItem( Text( @@ -106,8 +97,7 @@ class _ValueAddedServicesPageListState fontWeight: FontWeight.w600), ), "Google Home", () { - Toast.show(msg: "功能暂未开放"); - // Navigator.pushNamed(context, Routers.gatewayDetailPage); + Navigator.pushNamed(context, Routers.gatewayDetailPage); }), ], ), diff --git a/star_lock/lib/network/api_provider_base.dart b/star_lock/lib/network/api_provider_base.dart index 648e868d..f8ebd259 100644 --- a/star_lock/lib/network/api_provider_base.dart +++ b/star_lock/lib/network/api_provider_base.dart @@ -74,9 +74,10 @@ class BaseProvider extends GetConnect with Api { case 430: //与葛工约定弹出ErrorMsg Toast.show(msg: T["errorMsg"]); break; - case 425: - Toast.show(msg: "用户不存在"); - break; + //已单独处理,暂不做全局弹窗 + // case 425: + // Toast.show(msg: "用户不存在"); + // break; case 10001: Toast.show(msg: "数据不存在"); break; diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index 2ffb9866..f3424af2 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -136,22 +136,22 @@ class ApiRepository { //发送电子钥匙 Future sendElectronicKey( - String createUser, - String countryCode, - String usernameType, - String endDate, - String faceAuthentication, - String isCameraEnable, - String isRemoteUnlock, - String keyNameForAdmin, - String keyRight, - String keyType, - String lockId, - String operatorUid, - String receiverUsername, - String remarks, - String startDate, - List weekDays) async { + {required String createUser, + required String countryCode, + required String usernameType, + required String endDate, + required String faceAuthentication, + required String isCameraEnable, + required String isRemoteUnlock, + required String keyNameForAdmin, + required String keyRight, + required String keyType, + required String lockId, + required String operatorUid, + required String receiverUsername, + required String remarks, + required String startDate, + required List weekDays}) async { final res = await apiProvider.sendElectronicKey( createUser, countryCode, diff --git a/star_lock/lib/tools/ExpandedListView.dart b/star_lock/lib/tools/ExpandedListView.dart index cee2311a..0c4247e4 100644 --- a/star_lock/lib/tools/ExpandedListView.dart +++ b/star_lock/lib/tools/ExpandedListView.dart @@ -107,7 +107,7 @@ class _ExpandedListTileState extends State { width: 10.w, )), AnimatedRotation( - turns: _isExpanded ? 0 : -0.5, + turns: _isExpanded ? -0.5 : 0, duration: _animationDuration, child: const Icon(Icons.keyboard_arrow_down), ), diff --git a/star_lock/lib/tools/noData.dart b/star_lock/lib/tools/noData.dart index 11829f91..062dc3e9 100644 --- a/star_lock/lib/tools/noData.dart +++ b/star_lock/lib/tools/noData.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; class NoData extends StatelessWidget { const NoData({Key? key}) : super(key: key); @@ -10,8 +11,22 @@ class NoData extends StatelessWidget { width: 1.sw, height: 1.sh - ScreenUtil().statusBarHeight, child: Center( - child: Image.asset('images/icon_unHaveData.png',width: 300.w,height: 240.w), - ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + 'images/icon_noData.png', + width: 160.w, + height: 180.h, + ), + Text( + '暂无数据', + style: + TextStyle(color: AppColors.darkGrayTextColor, fontSize: 22.sp), + ) + ], + )), ); } }