diff --git a/Podfile b/Podfile index 3081641e..4b65d00d 100644 --- a/Podfile +++ b/Podfile @@ -51,6 +51,12 @@ target 'QuickLocation' do pod 'GYSDK' #个推一键登录 pod 'OpenIMSDK' #OpenIM + #支付宝 + pod 'AlipaySDK-iOS' + + #wechat + pod 'WechatOpenSDK-XCFramework' + #高德地图 pod 'AMap3DMap' #3D地图SDK pod 'AMapSearch' #地图SDK搜索功能 diff --git a/Podfile.lock b/Podfile.lock index 94c54054..b5bfe455 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,5 +1,6 @@ PODS: - Alamofire (5.10.1) + - AlipaySDK-iOS (15.8.30) - AMap3DMap (11.1.200): - AMapFoundation (>= 1.8.7) - AMapFoundation (1.8.7) @@ -152,6 +153,7 @@ PODS: - SwiftyUserDefaults (5.3.0) - TagListView (1.4.1) - URLNavigator (2.5.1) + - WechatOpenSDK-XCFramework (2.0.5) - YBImageBrowser (3.0.9): - YBImageBrowser/Core (= 3.0.9) - YBImageBrowser/Core (3.0.9): @@ -167,6 +169,7 @@ PODS: - ZXSDK (3.3.2) DEPENDENCIES: + - AlipaySDK-iOS - AMap3DMap - AMapLocation - AMapSearch @@ -197,6 +200,7 @@ DEPENDENCIES: - SwiftyUserDefaults - TagListView (~> 1.0) - URLNavigator + - WechatOpenSDK-XCFramework - YBImageBrowser - YBImageBrowser/Video - YYImage @@ -205,6 +209,7 @@ DEPENDENCIES: SPEC REPOS: https://gitee.com/mirrors/CocoaPods-Specs.git: - Alamofire + - AlipaySDK-iOS - AMap3DMap - AMapFoundation - AMapLocation @@ -250,6 +255,7 @@ SPEC REPOS: - SwiftyUserDefaults - TagListView - URLNavigator + - WechatOpenSDK-XCFramework - YBImageBrowser - YYImage - ZXSDK @@ -265,6 +271,7 @@ CHECKOUT OPTIONS: SPEC CHECKSUMS: Alamofire: 840d2a1ad82355b536ec6ba5f97e5bfa54600ca3 + AlipaySDK-iOS: 913a1df564c64798903e71cf3d63141d9e1904d2 AMap3DMap: 89c17fdbca2f25e4b46d6a45a8e50346980fc799 AMapFoundation: e99da1cc722528c60b39340b4763a95305f6c55e AMapLocation: 6e44f50b044dc54c6b3dcb1dee5ffd6de2689e41 @@ -311,10 +318,11 @@ SPEC CHECKSUMS: SwiftyUserDefaults: 63f80248cf5bfb3458825d9a78f2eb7e1293a040 TagListView: a1c236d17960a0cf64156725a76ce6d73ebce2be URLNavigator: e9c0426ba6e6ac57f34d018bbf3df840797f984d + WechatOpenSDK-XCFramework: ff342ae616bb86df3d236aca38059dfd4bc4a949 YBImageBrowser: 7ecc8bf33ffa5f3b94c397c29b4f3638dd37f527 YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54 ZXSDK: 786338c0a18e98e03eda00699c3bfd2700b97117 -PODFILE CHECKSUM: 7834e369bb92eca27bfaa0253f39e8e939801cd4 +PODFILE CHECKSUM: 6ba8ada83ccc565c9bdcc418e9a936818640882c COCOAPODS: 1.16.2 diff --git a/QuickLocation.xcodeproj/project.pbxproj b/QuickLocation.xcodeproj/project.pbxproj index 31525563..557f9100 100644 --- a/QuickLocation.xcodeproj/project.pbxproj +++ b/QuickLocation.xcodeproj/project.pbxproj @@ -203,6 +203,23 @@ 30EFF3BB2FD90D7600EB35D4 /* ConfirmPopVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3BA2FD90D7600EB35D4 /* ConfirmPopVC.swift */; }; 30EFF3BE2FD958A100EB35D4 /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3BD2FD958A100EB35D4 /* AccountView.swift */; }; 30EFF3C02FD958AE00EB35D4 /* AccountVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3BF2FD958AE00EB35D4 /* AccountVC.swift */; }; + 30EFF3C22FDA3F7F00EB35D4 /* AppCacheManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3C12FDA3F7F00EB35D4 /* AppCacheManager.swift */; }; + 30EFF3C42FDA431D00EB35D4 /* ChangePhoneVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3C32FDA431D00EB35D4 /* ChangePhoneVC.swift */; }; + 30EFF3C62FDA433E00EB35D4 /* ChangePhoneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3C52FDA433E00EB35D4 /* ChangePhoneView.swift */; }; + 30EFF3CA2FDA575600EB35D4 /* CancellationPopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3C92FDA575600EB35D4 /* CancellationPopView.swift */; }; + 30EFF3CD2FDA668A00EB35D4 /* MyProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3CC2FDA668A00EB35D4 /* MyProfileView.swift */; }; + 30EFF3CF2FDA669800EB35D4 /* MyProfileVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3CE2FDA669800EB35D4 /* MyProfileVC.swift */; }; + 30EFF3D12FDA69EC00EB35D4 /* AvatarIconListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3D02FDA69EC00EB35D4 /* AvatarIconListVC.swift */; }; + 30EFF3D32FDA69F400EB35D4 /* AvatarIconListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3D22FDA69F400EB35D4 /* AvatarIconListView.swift */; }; + 30EFF3D62FDA8F0100EB35D4 /* EmergencyContactView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3D52FDA8F0100EB35D4 /* EmergencyContactView.swift */; }; + 30EFF3D82FDA8F1000EB35D4 /* EmergencyContactVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3D72FDA8F1000EB35D4 /* EmergencyContactVC.swift */; }; + 30EFF3DA2FDA935D00EB35D4 /* EmergencyContactFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3D92FDA935D00EB35D4 /* EmergencyContactFooterView.swift */; }; + 30EFF3DC2FDA981B00EB35D4 /* EmergencyContactAddView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3DB2FDA981B00EB35D4 /* EmergencyContactAddView.swift */; }; + 30EFF3DE2FDA982C00EB35D4 /* EmergencyContactAddVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3DD2FDA982C00EB35D4 /* EmergencyContactAddVC.swift */; }; + 30EFF3E02FDA9CE300EB35D4 /* EmergencyContactModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3DF2FDA9CE300EB35D4 /* EmergencyContactModel.swift */; }; + 30EFF3E22FDA9DEE00EB35D4 /* EmergencyContactVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3E12FDA9DEE00EB35D4 /* EmergencyContactVM.swift */; }; + 30EFF3E52FDAA93400EB35D4 /* PrivacyPolicyVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3E42FDAA93300EB35D4 /* PrivacyPolicyVC.swift */; }; + 30EFF3E72FDAA93D00EB35D4 /* PrivacyPolicyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFF3E62FDAA93D00EB35D4 /* PrivacyPolicyView.swift */; }; C49B37352A45A02C28FF41BA /* Pods_QuickLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D1C77B42994F352054070537 /* Pods_QuickLocation.framework */; }; /* End PBXBuildFile section */ @@ -390,6 +407,7 @@ 30BAB8522FCD337C00C33B5C /* GroupService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupService.swift; sourceTree = ""; }; 30BAB8622FCD716C00C33B5C /* JoinGroupVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinGroupVC.swift; sourceTree = ""; }; 30BAB8642FCD718A00C33B5C /* JoinGroupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinGroupView.swift; sourceTree = ""; }; + 30C4C0112FDABC8C009215C1 /* QuickLocation.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = QuickLocation.entitlements; sourceTree = ""; }; 30DC18512FD009CD0041DCD1 /* VipExpenseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VipExpenseModel.swift; sourceTree = ""; }; 30DC18532FD00C4A0041DCD1 /* VipRechargeVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VipRechargeVM.swift; sourceTree = ""; }; 30DC18552FD11E7A0041DCD1 /* NavigationTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationTitleView.swift; sourceTree = ""; }; @@ -413,6 +431,23 @@ 30EFF3BA2FD90D7600EB35D4 /* ConfirmPopVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmPopVC.swift; sourceTree = ""; }; 30EFF3BD2FD958A100EB35D4 /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = ""; }; 30EFF3BF2FD958AE00EB35D4 /* AccountVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountVC.swift; sourceTree = ""; }; + 30EFF3C12FDA3F7F00EB35D4 /* AppCacheManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCacheManager.swift; sourceTree = ""; }; + 30EFF3C32FDA431D00EB35D4 /* ChangePhoneVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangePhoneVC.swift; sourceTree = ""; }; + 30EFF3C52FDA433E00EB35D4 /* ChangePhoneView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangePhoneView.swift; sourceTree = ""; }; + 30EFF3C92FDA575600EB35D4 /* CancellationPopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CancellationPopView.swift; sourceTree = ""; }; + 30EFF3CC2FDA668A00EB35D4 /* MyProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyProfileView.swift; sourceTree = ""; }; + 30EFF3CE2FDA669800EB35D4 /* MyProfileVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyProfileVC.swift; sourceTree = ""; }; + 30EFF3D02FDA69EC00EB35D4 /* AvatarIconListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarIconListVC.swift; sourceTree = ""; }; + 30EFF3D22FDA69F400EB35D4 /* AvatarIconListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarIconListView.swift; sourceTree = ""; }; + 30EFF3D52FDA8F0100EB35D4 /* EmergencyContactView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmergencyContactView.swift; sourceTree = ""; }; + 30EFF3D72FDA8F1000EB35D4 /* EmergencyContactVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmergencyContactVC.swift; sourceTree = ""; }; + 30EFF3D92FDA935D00EB35D4 /* EmergencyContactFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmergencyContactFooterView.swift; sourceTree = ""; }; + 30EFF3DB2FDA981B00EB35D4 /* EmergencyContactAddView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmergencyContactAddView.swift; sourceTree = ""; }; + 30EFF3DD2FDA982C00EB35D4 /* EmergencyContactAddVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmergencyContactAddVC.swift; sourceTree = ""; }; + 30EFF3DF2FDA9CE300EB35D4 /* EmergencyContactModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmergencyContactModel.swift; sourceTree = ""; }; + 30EFF3E12FDA9DEE00EB35D4 /* EmergencyContactVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmergencyContactVM.swift; sourceTree = ""; }; + 30EFF3E42FDAA93300EB35D4 /* PrivacyPolicyVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyPolicyVC.swift; sourceTree = ""; }; + 30EFF3E62FDAA93D00EB35D4 /* PrivacyPolicyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyPolicyView.swift; sourceTree = ""; }; 3E4359082FC48D26003470A5 /* QuickLocation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QuickLocation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 93647DF3683AA5E71EC2FB1A /* Pods-QuickLocation.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QuickLocation.release.xcconfig"; path = "Target Support Files/Pods-QuickLocation/Pods-QuickLocation.release.xcconfig"; sourceTree = ""; }; D1C77B42994F352054070537 /* Pods_QuickLocation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_QuickLocation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -663,6 +698,7 @@ 305A751F2FCA8C7000227D26 /* FileTools.swift */, 305A75202FCA8C7000227D26 /* Permission.swift */, 305A75212FCA8C7000227D26 /* RouterManager.swift */, + 30EFF3C12FDA3F7F00EB35D4 /* AppCacheManager.swift */, ); path = App; sourceTree = ""; @@ -726,6 +762,7 @@ children = ( 305A752E2FCA8C7000227D26 /* GroupModel.swift */, 305A752F2FCA8C7000227D26 /* SystemResponse.swift */, + 30EFF3DF2FDA9CE300EB35D4 /* EmergencyContactModel.swift */, ); path = Model; sourceTree = ""; @@ -816,9 +853,9 @@ 305A76312FCA8C7000227D26 /* Login */ = { isa = PBXGroup; children = ( - 305A762D2FCA8C7000227D26 /* LoginView.swift */, 305A762E2FCA8C7000227D26 /* LoginViewController.swift */, 305A762F2FCA8C7000227D26 /* LoginViewModel.swift */, + 305A762D2FCA8C7000227D26 /* LoginView.swift */, 305A76302FCA8C7000227D26 /* OneTapLoginView.swift */, ); path = Login; @@ -840,7 +877,10 @@ 305A76372FCA8C7000227D26 /* MineViewController.swift */, 305A76382FCA8C7000227D26 /* MineViewModel.swift */, 305A76362FCA8C7000227D26 /* MineView.swift */, + 30EFF3CB2FDA667A00EB35D4 /* MyProfile */, 30EFF3BC2FD9585200EB35D4 /* Account */, + 30EFF3D42FDA8EF200EB35D4 /* EmergencyContact */, + 30EFF3E32FDAA92200EB35D4 /* PrivacyPolicy */, ); path = Mine; sourceTree = ""; @@ -993,6 +1033,7 @@ 305A76872FCA8C7000227D26 /* QuickLocation */ = { isa = PBXGroup; children = ( + 30C4C0112FDABC8C009215C1 /* QuickLocation.entitlements */, 305A74D02FCA8C7000227D26 /* API */, 305A74D42FCA8C7000227D26 /* Common */, 305A74E72FCA8C7000227D26 /* Component */, @@ -1143,10 +1184,46 @@ children = ( 30EFF3BF2FD958AE00EB35D4 /* AccountVC.swift */, 30EFF3BD2FD958A100EB35D4 /* AccountView.swift */, + 30EFF3C32FDA431D00EB35D4 /* ChangePhoneVC.swift */, + 30EFF3C52FDA433E00EB35D4 /* ChangePhoneView.swift */, + 30EFF3C92FDA575600EB35D4 /* CancellationPopView.swift */, ); path = Account; sourceTree = ""; }; + 30EFF3CB2FDA667A00EB35D4 /* MyProfile */ = { + isa = PBXGroup; + children = ( + 30EFF3CE2FDA669800EB35D4 /* MyProfileVC.swift */, + 30EFF3CC2FDA668A00EB35D4 /* MyProfileView.swift */, + 30EFF3D02FDA69EC00EB35D4 /* AvatarIconListVC.swift */, + 30EFF3D22FDA69F400EB35D4 /* AvatarIconListView.swift */, + ); + path = MyProfile; + sourceTree = ""; + }; + 30EFF3D42FDA8EF200EB35D4 /* EmergencyContact */ = { + isa = PBXGroup; + children = ( + 30EFF3D72FDA8F1000EB35D4 /* EmergencyContactVC.swift */, + 30EFF3E12FDA9DEE00EB35D4 /* EmergencyContactVM.swift */, + 30EFF3D52FDA8F0100EB35D4 /* EmergencyContactView.swift */, + 30EFF3D92FDA935D00EB35D4 /* EmergencyContactFooterView.swift */, + 30EFF3DD2FDA982C00EB35D4 /* EmergencyContactAddVC.swift */, + 30EFF3DB2FDA981B00EB35D4 /* EmergencyContactAddView.swift */, + ); + path = EmergencyContact; + sourceTree = ""; + }; + 30EFF3E32FDAA92200EB35D4 /* PrivacyPolicy */ = { + isa = PBXGroup; + children = ( + 30EFF3E42FDAA93300EB35D4 /* PrivacyPolicyVC.swift */, + 30EFF3E62FDAA93D00EB35D4 /* PrivacyPolicyView.swift */, + ); + path = PrivacyPolicy; + sourceTree = ""; + }; 3E4358FF2FC48D26003470A5 = { isa = PBXGroup; children = ( @@ -1336,9 +1413,11 @@ 305A768E2FCA8C7000227D26 /* SignPlugin.swift in Sources */, 305A768F2FCA8C7000227D26 /* SystemAPI.swift in Sources */, 305A76902FCA8C7000227D26 /* UserAPI.swift in Sources */, + 30EFF3DE2FDA982C00EB35D4 /* EmergencyContactAddVC.swift in Sources */, 305A76912FCA8C7000227D26 /* Constant.swift in Sources */, 305A76922FCA8C7000227D26 /* LogUtils.swift in Sources */, 305A76932FCA8C7000227D26 /* AddImageCell.swift in Sources */, + 30EFF3D82FDA8F1000EB35D4 /* EmergencyContactVC.swift in Sources */, 30DC185E2FD1211D0041DCD1 /* VipRightsVC.swift in Sources */, 305A76942FCA8C7000227D26 /* UploadImageCell.swift in Sources */, 305A76952FCA8C7000227D26 /* CornerRadiusCell.swift in Sources */, @@ -1346,12 +1425,15 @@ 305A76972FCA8C7000227D26 /* CornerRadiusHeaderView.swift in Sources */, 305A76982FCA8C7000227D26 /* ImagePicker.swift in Sources */, 305A76992FCA8C7000227D26 /* ImagePickerPopup.swift in Sources */, + 30EFF3E22FDA9DEE00EB35D4 /* EmergencyContactVM.swift in Sources */, 305A769A2FCA8C7000227D26 /* PopupAnimator.swift in Sources */, 3062E8BE2FCEBD0E00CEF511 /* GroupIconListVC.swift in Sources */, + 30EFF3DA2FDA935D00EB35D4 /* EmergencyContactFooterView.swift in Sources */, 3062E8C22FCFB86800CEF511 /* CreateGroupViewModel.swift in Sources */, 305A769B2FCA8C7000227D26 /* PopupAnimators.swift in Sources */, 305A769C2FCA8C7000227D26 /* PopupViewController.swift in Sources */, 305A769D2FCA8C7000227D26 /* PopupViewController+Extension.swift in Sources */, + 30EFF3C42FDA431D00EB35D4 /* ChangePhoneVC.swift in Sources */, 305A769E2FCA8C7000227D26 /* TextArrowCell.swift in Sources */, 305A769F2FCA8C7000227D26 /* TextContentArrowCell.swift in Sources */, 305A76A02FCA8C7000227D26 /* TextTableViewCell.swift in Sources */, @@ -1363,6 +1445,7 @@ 305A76A42FCA8C7000227D26 /* Date+Extension.swift in Sources */, 305A76A52FCA8C7000227D26 /* Dictionay+Extension.swift in Sources */, 305A76A62FCA8C7000227D26 /* Int+Extension.swift in Sources */, + 30EFF3D62FDA8F0100EB35D4 /* EmergencyContactView.swift in Sources */, 30A7A9112FCAEE3D00105780 /* GroupListPopView.swift in Sources */, 305A76A72FCA8C7000227D26 /* NSAttributedString+Extension.swift in Sources */, 30DC18542FD00C4A0041DCD1 /* VipRechargeVM.swift in Sources */, @@ -1370,7 +1453,9 @@ 305A76A92FCA8C7000227D26 /* Optional+Extension.swift in Sources */, 305A76AA2FCA8C7000227D26 /* Response+ObjectMapper.swift in Sources */, 305A76AB2FCA8C7000227D26 /* ScaleType.swift in Sources */, + 30EFF3E72FDAA93D00EB35D4 /* PrivacyPolicyView.swift in Sources */, 305A76AC2FCA8C7000227D26 /* String+Extension.swift in Sources */, + 30EFF3C62FDA433E00EB35D4 /* ChangePhoneView.swift in Sources */, 305A76AD2FCA8C7000227D26 /* UIApplicationExtension.swift in Sources */, 305A76AE2FCA8C7000227D26 /* UIButton+Extension.swift in Sources */, 305A76AF2FCA8C7000227D26 /* UIColor+Extension.swift in Sources */, @@ -1380,6 +1465,7 @@ 305A76B32FCA8C7000227D26 /* UILabel+Extension.swift in Sources */, 305A76B42FCA8C7000227D26 /* UINavigationController+FDFullscreenPopGesture.m in Sources */, 305A76B52FCA8C7000227D26 /* UITableView+Extension.swift in Sources */, + 30EFF3E02FDA9CE300EB35D4 /* EmergencyContactModel.swift in Sources */, 305A76B62FCA8C7000227D26 /* UITextField+Extensions.swift in Sources */, 30EFF3A82FD7C6A400EB35D4 /* GroupSettingViewModel.swift in Sources */, 305A76B72FCA8C7000227D26 /* UIView+Extension.swift in Sources */, @@ -1401,6 +1487,7 @@ 30DC185B2FD11E7A0041DCD1 /* NavigationTitleView.swift in Sources */, 30DC185C2FD11E7A0041DCD1 /* WebViewController.swift in Sources */, 305A76C32FCA8C7000227D26 /* MainTabBarController.swift in Sources */, + 30EFF3CA2FDA575600EB35D4 /* CancellationPopView.swift in Sources */, 305A76C42FCA8C7000227D26 /* QuickLocationTabBar.swift in Sources */, 305A76C52FCA8C7000227D26 /* Account.swift in Sources */, 305A76C62FCA8C7000227D26 /* AppContextManager.swift in Sources */, @@ -1420,6 +1507,7 @@ 305A76D32FCA8C7000227D26 /* URLManager.swift in Sources */, 305A76D42FCA8C7000227D26 /* GroupModel.swift in Sources */, 305A798C2FCAB99300227D26 /* HomeViewModel.swift in Sources */, + 30EFF3D12FDA69EC00EB35D4 /* AvatarIconListVC.swift in Sources */, 305A76D52FCA8C7000227D26 /* SystemResponse.swift in Sources */, 305A76D62FCA8C7000227D26 /* ImagePlugin.swift in Sources */, 305A76D72FCA8C7000227D26 /* NotEmpty.swift in Sources */, @@ -1440,6 +1528,8 @@ 305A76E12FCA8C7000227D26 /* GroupViewController.swift in Sources */, 30EFF3B52FD8F1D000EB35D4 /* ReviewMemberListVC.swift in Sources */, 30BAB84D2FCD2FDE00C33B5C /* InviteJoinView.swift in Sources */, + 30EFF3CF2FDA669800EB35D4 /* MyProfileVC.swift in Sources */, + 30EFF3E52FDAA93400EB35D4 /* PrivacyPolicyVC.swift in Sources */, 305A76E22FCA8C7000227D26 /* GroupViewModel.swift in Sources */, 305A76E32FCA8C7000227D26 /* GroupMemberView.swift in Sources */, 30BAB84F2FCD2FED00C33B5C /* InviteJoinVC.swift in Sources */, @@ -1449,6 +1539,8 @@ 3062E8B52FCE6BBA00CEF511 /* ScanVC.swift in Sources */, 305A76E72FCA8C7000227D26 /* LoginView.swift in Sources */, 305A76E82FCA8C7000227D26 /* LoginViewController.swift in Sources */, + 30EFF3DC2FDA981B00EB35D4 /* EmergencyContactAddView.swift in Sources */, + 30EFF3C22FDA3F7F00EB35D4 /* AppCacheManager.swift in Sources */, 30EFF3B92FD8FC5200EB35D4 /* VerificationPopView.swift in Sources */, 305A76E92FCA8C7000227D26 /* LoginViewModel.swift in Sources */, 3062E8BC2FCEAC7100CEF511 /* CreateGroupVC.swift in Sources */, @@ -1481,6 +1573,7 @@ 305A76FB2FCA8C7000227D26 /* EmptyDataSet.swift in Sources */, 305A76FC2FCA8C7000227D26 /* EmptyDataSetDelegate.swift in Sources */, 305A76FD2FCA8C7000227D26 /* EmptyDataSetSource.swift in Sources */, + 30EFF3CD2FDA668A00EB35D4 /* MyProfileView.swift in Sources */, 305A76FE2FCA8C7000227D26 /* EmptyDataSetView.swift in Sources */, 305A76FF2FCA8C7000227D26 /* EmptyDataSetView+Extension.swift in Sources */, 305A77002FCA8C7000227D26 /* RefreshStyle.swift in Sources */, @@ -1504,6 +1597,7 @@ 305A770F2FCA8C7000227D26 /* DLCustomPopVC.swift in Sources */, 30EFF29B2FD668C900EB35D4 /* VoiceRecordView.swift in Sources */, 305A77102FCA8C7000227D26 /* DLSheetPopVC.swift in Sources */, + 30EFF3D32FDA69F400EB35D4 /* AvatarIconListView.swift in Sources */, 30EFF3B72FD8F86200EB35D4 /* ReviewMemberListVM.swift in Sources */, 305A77112FCA8C7000227D26 /* DLViewTransition.m in Sources */, 3062E8BA2FCEAC6500CEF511 /* CreateGroupView.swift in Sources */, @@ -1545,10 +1639,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = QuickLocation/QuickLocation.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 7LP48T8ZJE; + DEVELOPMENT_TEAM = 434CGNSJ28; ENABLE_USER_SCRIPT_SANDBOXING = "$(inherited)"; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = QuickLocation/Info.plist; @@ -1569,7 +1664,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = cn.zuom8.jisuloca; + PRODUCT_BUNDLE_IDENTIFIER = cn.zuom8.jisulocation; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; STRING_CATALOG_GENERATE_SYMBOLS = YES; @@ -1593,10 +1688,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = QuickLocation/QuickLocation.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 7LP48T8ZJE; + DEVELOPMENT_TEAM = 434CGNSJ28; ENABLE_USER_SCRIPT_SANDBOXING = "$(inherited)"; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = QuickLocation/Info.plist; @@ -1617,7 +1713,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = cn.zuom8.jisuloca; + PRODUCT_BUNDLE_IDENTIFIER = cn.zuom8.jisulocation; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; STRING_CATALOG_GENERATE_SYMBOLS = YES; diff --git a/QuickLocation.xcworkspace/xcuserdata/yanghong.xcuserdatad/UserInterfaceState.xcuserstate b/QuickLocation.xcworkspace/xcuserdata/yanghong.xcuserdatad/UserInterfaceState.xcuserstate index 829a3544..8c32bec2 100644 Binary files a/QuickLocation.xcworkspace/xcuserdata/yanghong.xcuserdatad/UserInterfaceState.xcuserstate and b/QuickLocation.xcworkspace/xcuserdata/yanghong.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/QuickLocation/API/SystemAPI.swift b/QuickLocation/API/SystemAPI.swift index 753fd952..173d98e4 100644 --- a/QuickLocation/API/SystemAPI.swift +++ b/QuickLocation/API/SystemAPI.swift @@ -22,6 +22,9 @@ enum SystemAPI { /// - Parameters: /// - type: 类型 member case rechargeInfo(type: String) + + /// 微信客服 + case wechatService } extension SystemAPI: MultiTargetProtocol { @@ -34,12 +37,14 @@ extension SystemAPI: MultiTargetProtocol { return "api/user/sms/code" case .rechargeInfo: return "api/order/goods" + case .wechatService: + return "api/weixin/service" } } var method: Moya.Method { switch self { - case .userConfig, .rechargeInfo: + case .userConfig, .rechargeInfo, .wechatService: return .get case .sendCode: return .post @@ -60,6 +65,9 @@ extension SystemAPI: MultiTargetProtocol { var params = Parameters() params["type"] = type return .requestParameters(parameters: params, encoding: URLEncoding()) + + case .wechatService: + return .requestParameters(parameters: parameters, encoding: URLEncoding()) } } } diff --git a/QuickLocation/API/UserAPI.swift b/QuickLocation/API/UserAPI.swift index 8295a980..12ff2c5c 100644 --- a/QuickLocation/API/UserAPI.swift +++ b/QuickLocation/API/UserAPI.swift @@ -25,6 +25,29 @@ enum UserAPI { /// 用户IM Token case imToken + /// 更换手机号 + case changePhone(timestamp: String, phone: String, code: String) + + /// 设置头像 + case setHeadPic(index: Int) + + /// 昵称 + case setNickName(nick: String) + + /// 性别 + /// - Parameters: + /// - sex: 1 男 2 女 + case setGender(sex: Int) + + /// 紧急联系人 + /// - Parameters: + /// - opType: get、add + /// - requestData:[String: Any] 根据操作传入对应的值 + case emergencyContact(opType: String, requestData: [String: Any]) + + /// 删除账号 + case deleteAccount + /// 退出登录 case logout } @@ -39,6 +62,18 @@ extension UserAPI: MultiTargetProtocol { return "api/user" case .imToken: return "mapi/openim/user/token/get" + case .changePhone: + return "api/user" + case .setHeadPic: + return "mapi/user/setheadpic" + case .setNickName: + return "mapi/user/setnick" + case .setGender: + return "api/user" + case .emergencyContact: + return "mapi/user/emergencycontact" + case .deleteAccount: + return "mapi/user/account" case .logout: return "api/user/logout" } @@ -48,6 +83,10 @@ extension UserAPI: MultiTargetProtocol { switch self { case .userInfo: return .get + case .changePhone, .setGender: + return .put + case .deleteAccount: + return .delete default: return .post } @@ -71,6 +110,37 @@ extension UserAPI: MultiTargetProtocol { params["force"] = true return .requestParameters(parameters: params, encoding: JSONEncoding()) + case let .changePhone(timestamp, phone, code): + var params = Parameters() + params["phone_timestamp"] = timestamp + params["phone"] = phone + params["phone_code"] = code + return .requestParameters(parameters: params, encoding: JSONEncoding()) + + case let .setHeadPic(index): + var params = Parameters() + params["head_pic_index"] = index + return .requestParameters(parameters: params, encoding: JSONEncoding()) + + case let .setNickName(nick): + var params = Parameters() + params["nick"] = nick + return .requestParameters(parameters: params, encoding: JSONEncoding()) + + case let .setGender(sex): + var params = Parameters() + params["sex"] = sex + return .requestParameters(parameters: params, encoding: JSONEncoding()) + + case let .emergencyContact(opType, requestData): + var params = Parameters() + params["op_type"] = opType + params.merge(requestData) { _, new in new } + return .requestParameters(parameters: params, encoding: JSONEncoding()) + + case .deleteAccount: + return .requestParameters(parameters: Parameters(), encoding: URLEncoding()) + case .logout: return .requestParameters(parameters: Parameters(), encoding: JSONEncoding()) } diff --git a/QuickLocation/AppDelegate.swift b/QuickLocation/AppDelegate.swift index 8be4f701..662d0cd4 100644 --- a/QuickLocation/AppDelegate.swift +++ b/QuickLocation/AppDelegate.swift @@ -33,6 +33,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { IQKeyboardManager.shared.enableAutoToolbar = false IQKeyboardManager.shared.resignOnTouchOutside = true + // 微信 + WXApi.registerApp(AppSettings.kAppsWXApiAppId, universalLink: AppSettings.kAppsUniversalLink) + + // 高德地图 #if !targetEnvironment(simulator) AMapServices.shared().apiKey = AppSettings.kAppsAMapAppId @@ -62,6 +66,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { + return WXApi.handleOpen(url, delegate: self) + } + func setupLocation() { let manager = AuthorizeManager.manager(type: .locationWhenInUse) if manager?.authorizeStatus() != .authorized { @@ -112,3 +120,24 @@ extension AppDelegate { } } } + +extension AppDelegate: WXApiDelegate { + func onReq(_ req: BaseReq) { + print(req) + } + + func onResp(_ resp: BaseResp) { + if resp.isKind(of: PayResp.self), + let response: PayResp = resp as? PayResp { + print("===================== WxPay =====================") + print(response.errStr) + if response.errCode == 0 { // 支付成功 + DispatchQueue.global().async { + DispatchQueue.main.async { + + } + } + } + } + } +} diff --git a/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Contents.json b/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Contents.json new file mode 100644 index 00000000..a8dd92df --- /dev/null +++ b/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Rectangle 209@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Rectangle 209@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Rectangle 209@2x.png b/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Rectangle 209@2x.png new file mode 100644 index 00000000..b20e4ca1 Binary files /dev/null and b/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Rectangle 209@2x.png differ diff --git a/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Rectangle 209@3x.png b/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Rectangle 209@3x.png new file mode 100644 index 00000000..f985f187 Binary files /dev/null and b/QuickLocation/Assets.xcassets/Common/checkbox.imageset/Rectangle 209@3x.png differ diff --git a/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Contents.json b/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Contents.json new file mode 100644 index 00000000..5c56d9a8 --- /dev/null +++ b/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Group_1476@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Group_1476@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Group_1476@2x.png b/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Group_1476@2x.png new file mode 100644 index 00000000..193115cc Binary files /dev/null and b/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Group_1476@2x.png differ diff --git a/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Group_1476@3x.png b/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Group_1476@3x.png new file mode 100644 index 00000000..dcb90405 Binary files /dev/null and b/QuickLocation/Assets.xcassets/Common/checkbox_on.imageset/Group_1476@3x.png differ diff --git a/QuickLocation/Assets.xcassets/EmergencyContact/Contents.json b/QuickLocation/Assets.xcassets/EmergencyContact/Contents.json new file mode 100644 index 00000000..6e965652 --- /dev/null +++ b/QuickLocation/Assets.xcassets/EmergencyContact/Contents.json @@ -0,0 +1,9 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "provides-namespace" : true + } +} diff --git a/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Contents.json b/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Contents.json new file mode 100644 index 00000000..bc876788 --- /dev/null +++ b/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Group_1532@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Group_1532@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Group_1532@2x.png b/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Group_1532@2x.png new file mode 100644 index 00000000..4bc2fecb Binary files /dev/null and b/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Group_1532@2x.png differ diff --git a/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Group_1532@3x.png b/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Group_1532@3x.png new file mode 100644 index 00000000..19c692d5 Binary files /dev/null and b/QuickLocation/Assets.xcassets/EmergencyContact/add.imageset/Group_1532@3x.png differ diff --git a/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Contents.json b/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Contents.json new file mode 100644 index 00000000..491dc357 --- /dev/null +++ b/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Union@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Union@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Union@2x.png b/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Union@2x.png new file mode 100644 index 00000000..cb159145 Binary files /dev/null and b/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Union@2x.png differ diff --git a/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Union@3x.png b/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Union@3x.png new file mode 100644 index 00000000..8a4e4684 Binary files /dev/null and b/QuickLocation/Assets.xcassets/EmergencyContact/arrow.imageset/Union@3x.png differ diff --git a/QuickLocation/Info.plist b/QuickLocation/Info.plist index 81719890..d5ba1065 100644 --- a/QuickLocation/Info.plist +++ b/QuickLocation/Info.plist @@ -2,6 +2,26 @@ + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + weixin + CFBundleURLSchemes + + wx1e38bba788d55cde + + + + LSApplicationQueriesSchemes + + alipays + weixin + weixinULAPI + weixinURLParamsAPI + NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/QuickLocation/Main/BaseViewController/BaseViewController.swift b/QuickLocation/Main/BaseViewController/BaseViewController.swift index 5c0ee32b..9e86108a 100644 --- a/QuickLocation/Main/BaseViewController/BaseViewController.swift +++ b/QuickLocation/Main/BaseViewController/BaseViewController.swift @@ -33,8 +33,8 @@ class BaseViewController: UIViewController { /// 导航栏标题 var navTitle: String = "" { didSet { - backButton.setTitle(" \(navTitle)", for: .normal) -// navigationItem.title = navTitle +// backButton.setTitle(" \(navTitle)", for: .normal) + navigationItem.title = navTitle } } @@ -51,9 +51,12 @@ class BaseViewController: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - + let className = String(describing: self.classForCoder) print(className) + + // 返回根页面时恢复 tabBar 可见性(UINavigationControllerDelegate 在 pop 时可能漏触发) + (tabBarController as? MainTabBarController)?.updateTabBarVisibility() } override func viewWillDisappear(_ animated: Bool) { diff --git a/QuickLocation/Main/Tabbar/MainTabBarController.swift b/QuickLocation/Main/Tabbar/MainTabBarController.swift index 5c44f333..a36109cb 100644 --- a/QuickLocation/Main/Tabbar/MainTabBarController.swift +++ b/QuickLocation/Main/Tabbar/MainTabBarController.swift @@ -72,6 +72,13 @@ final class MainTabBarController: UITabBarController { super.viewDidLayoutSubviews() view.bringSubviewToFront(customTabBar) } + + /// 更新 tabBar 可见性:当前 tab 的导航栈只有根 VC 时才显示 + /// 在 parent VC 的 viewWillAppear 中回调,比 UINavigationControllerDelegate 更可靠 + func updateTabBarVisibility() { + guard let nav = selectedViewController as? UINavigationController else { return } + customTabBar.isHidden = nav.viewControllers.count > 1 + } } // MARK: - QuickLocationTabBarDelegate @@ -84,6 +91,6 @@ extension MainTabBarController: QuickLocationTabBarDelegate { // MARK: - UINavigationControllerDelegate extension MainTabBarController: UINavigationControllerDelegate { func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { - customTabBar.isHidden = navigationController.viewControllers.count > 1 + updateTabBarVisibility() } } diff --git a/QuickLocation/Manager/Account/AppContextManager.swift b/QuickLocation/Manager/Account/AppContextManager.swift index 43cbed7b..91a92ac0 100644 --- a/QuickLocation/Manager/Account/AppContextManager.swift +++ b/QuickLocation/Manager/Account/AppContextManager.swift @@ -43,8 +43,8 @@ class AppContextManager: NSObject { guard let account = account else { return UIImage() } return UIImage(named: "UserIcon/\(account.head_pic)") ?? UIImage() } - var avater: String { - account?.avater ?? "" + var head_pic: String { + account?.head_pic ?? "" } /// 用户名 var name: String { @@ -54,6 +54,10 @@ class AppContextManager: NSObject { var userPhone: String { return account?.phone ?? "" } + /// 性别 + var sex: Int { + account?.sex ?? -1 + } @discardableResult public func saveAccount(_ account: UserConfigModel) -> Bool { diff --git a/QuickLocation/Manager/Account/UserConfigModel.swift b/QuickLocation/Manager/Account/UserConfigModel.swift index 2cf4323f..b91af9fe 100644 --- a/QuickLocation/Manager/Account/UserConfigModel.swift +++ b/QuickLocation/Manager/Account/UserConfigModel.swift @@ -19,6 +19,8 @@ struct UserConfigModel: Mappable { var userIcon: UIImage { UIImage(named: "UserIcon/\(head_pic)") ?? UIImage() } + /// 性别 + var sex: Int = -1 /// 是否游客 var temp: Bool = true @@ -46,6 +48,7 @@ struct UserConfigModel: Mappable { name <- map["name"] uid <- map["user_id"] avater <- map["avater"] + sex <- map["sex"] head_pic <- (map["head_pic"], kIntTransformStr) config <- map["config"] vip <- map["vip"] diff --git a/QuickLocation/Manager/App/ApiManager.swift b/QuickLocation/Manager/App/ApiManager.swift index 05d772c6..d3a021bc 100644 --- a/QuickLocation/Manager/App/ApiManager.swift +++ b/QuickLocation/Manager/App/ApiManager.swift @@ -45,7 +45,7 @@ extension ApiManager { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - headers["x-package"] = Bundle.main.bundleIdentifier + headers["x-package"] = "cn.zuom8.jisuloca" headers["x-platform"] = "ios" headers["x-channel"] = "ios" headers["x-mobile-brand"] = "ios" diff --git a/QuickLocation/Manager/App/AppCacheManager.swift b/QuickLocation/Manager/App/AppCacheManager.swift new file mode 100644 index 00000000..41165d7e --- /dev/null +++ b/QuickLocation/Manager/App/AppCacheManager.swift @@ -0,0 +1,83 @@ +// +// AppCacheManager.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import Foundation + +final class AppCacheManager { + + // MARK: - 计算单个文件夹大小(字节) + static func folderSize(at path: String) -> Int64 { + guard FileManager.default.fileExists(atPath: path) else { return 0 } + var totalSize: Int64 = 0 + let manager = FileManager.default + + guard let filePaths = try? manager.subpaths(atPath: path) else { + return totalSize + } + + for subPath in filePaths { + let fullPath = path + "/" + subPath + var isDir: ObjCBool = false + if manager.fileExists(atPath: fullPath, isDirectory: &isDir) { + if isDir.boolValue { + totalSize += folderSize(at: fullPath) + } else { + // 读取文件属性,失败则跳过 + if let attrs = try? manager.attributesOfItem(atPath: fullPath) { + totalSize += attrs[.size] as? Int64 ?? 0 + } + } + } + } + return totalSize + } + + // MARK: - 获取 App 总缓存大小(Caches + tmp) + static func totalCacheSize() -> Int64 { + let cachesPath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first ?? "" + let tmpPath = NSTemporaryDirectory() + + let cachesSize = folderSize(at: cachesPath) + let tmpSize = folderSize(at: tmpPath) + return cachesSize + tmpSize + } + + // MARK: - 字节 转 可读字符串(B/KB/MB/GB) + static func formatByte(_ byte: Int64) -> String { + guard byte > 0 else { return "0 B" } + let units: [String] = ["B", "KB", "M", "G"] + var size = Double(byte) + var unitIndex = 0 + while size >= 1024, unitIndex < units.count - 1 { + size /= 1024 + unitIndex += 1 + } + return String(format: "%.2f %@", size, units[unitIndex]) + } + + // MARK: - 清理缓存(Caches + tmp) + static func clearCache(completion: @escaping () -> Void) { + DispatchQueue.global(qos: .background).async { + let manager = FileManager.default + // 清理 Caches + let cachesPath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first ?? "" + try? manager.removeItem(atPath: cachesPath) + try? manager.createDirectory(atPath: cachesPath, withIntermediateDirectories: true) + + // 清理 tmp + let tmpPath = NSTemporaryDirectory() + let tmpFiles = (try? manager.contentsOfDirectory(atPath: tmpPath)) ?? [] + tmpFiles.forEach { file in + try? manager.removeItem(atPath: tmpPath + file) + } + + DispatchQueue.main.async { + completion() + } + } + } +} diff --git a/QuickLocation/Manager/App/AppSettings.swift b/QuickLocation/Manager/App/AppSettings.swift index b157c94d..f8ee7cf7 100644 --- a/QuickLocation/Manager/App/AppSettings.swift +++ b/QuickLocation/Manager/App/AppSettings.swift @@ -35,15 +35,15 @@ class AppSettings: NSObject { var uuid: String = "" /// UniversalLink - public static let kAppsUniversalLink: String = "https://api.xxxx.com/xxxx/" + public static let kAppsUniversalLink: String = "https://smartdrive.zuom8.cn/jisu/" // MARK: - 第三方SDK Key /// 高德 public static let kAppsAMapAppId = "4f6b29cfedc0e117316b88008fa41c07" /// wechat - public static let kAppsWXApiAppId = "wx9c91710269dcd0cf" + public static let kAppsWXApiAppId = "wx1e38bba788d55cde" /// 支付宝 - public static let kAppsAlipayAppId = "2021005110694730" + public static let kAppsAlipayAppId = "" /// 个推 public static let kAppsGeTuiAppId = "cYHNI4KThh6SxZUsf9RiU2" diff --git a/QuickLocation/Manager/App/RouterManager.swift b/QuickLocation/Manager/App/RouterManager.swift index d3db21f1..0b2cde4e 100644 --- a/QuickLocation/Manager/App/RouterManager.swift +++ b/QuickLocation/Manager/App/RouterManager.swift @@ -23,6 +23,8 @@ enum Route: String { case scan = "scan" /// 圈子图标 case groupIconList = "groupIconList" + /// 头像图标 + case avatarIconList = "avatarIconList" /// 会员充值 case vipRecharge = "vipRecharge" /// 权益对比 @@ -33,6 +35,16 @@ enum Route: String { case groupSetting = "groupSetting" /// 账号与安全 case account = "account" + /// 更换手机号 + case changePhone = "changePhone" + /// 编辑资料 + case myProfile = "myProfile" + /// 紧急联系人 + case emergencyContact = "emergencyContact" + /// 添加紧急联系人 + case emergencyContactAdd = "emergencyContactAdd" + /// 隐私与协议 + case privacyPolicy = "privacyPolicy" } extension Route: RouterTarget { @@ -147,6 +159,12 @@ extension AppRouter: AppRouterProtocol { return vc } + // MARK: - 头像图标列表 + AppRouter.register(Route.avatarIconList) { url, parameters in + let vc = AvatarIconListVC(iconIndex: parameters["iconIndex"].safeString) + return vc + } + // MARK: - 充值会员 AppRouter.register(Route.vipRecharge) { url, parameters in VipRechargeVC() @@ -175,6 +193,39 @@ extension AppRouter: AppRouterProtocol { vc.isNeedLogin = true return vc } + + // MARK: - 更换手机号 + AppRouter.register(Route.changePhone) { url, parameters in + let vc = ChangePhoneVC() + vc.isNeedLogin = true + return vc + } + + // MARK: - 编辑资料 + AppRouter.register(Route.myProfile) { url, parameters in + let vc = MyProfileVC() + vc.isNeedLogin = true + return vc + } + + // MARK: - 紧急联系人 + AppRouter.register(Route.emergencyContact) { url, parameters in + let vc = EmergencyContactVC() + vc.isNeedLogin = true + return vc + } + + // MARK: - 紧急联系人 + AppRouter.register(Route.emergencyContactAdd) { url, parameters in + let vc = EmergencyContactAddVC() + vc.isNeedLogin = true + return vc + } + + // MARK: - 隐私与协议 + AppRouter.register(Route.privacyPolicy) { url, parameters in + PrivacyPolicyVC() + } } } diff --git a/QuickLocation/Model/EmergencyContactModel.swift b/QuickLocation/Model/EmergencyContactModel.swift new file mode 100644 index 00000000..920370c6 --- /dev/null +++ b/QuickLocation/Model/EmergencyContactModel.swift @@ -0,0 +1,53 @@ +// +// EmergencyContactModel.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import ObjectMapper +import RxDataSources + +/// 紧急联系人列表 +struct EmergencyContactListResponse: BaseModelProtocol { + // 状态码 + var code: String? + // 消息 + var message: String? + // + var list: [EmergencyContactModel] = [] + + init?(map: Map) {} + + mutating func mapping(map: Map) { + code <- map["code"] + message <- map["msg"] + list <- map["data"] + } +} + +struct EmergencyContactModel: Mappable, Equatable { + var uuid: String = UUID().uuidString + /// + var name: String = "" + var phone: String = "" + var ischecked: Bool = false + + init?(map: Map) { + + } + + mutating func mapping(map: Map) { + name <- map["name"] + phone <- map["phone"] + ischecked <- map["ischecked"] + } +} + +extension EmergencyContactModel: IdentifiableType { + public typealias Identity = String + + public var identity: String { + return uuid + } +} diff --git a/QuickLocation/QuickLocation-Bridging-Header.h b/QuickLocation/QuickLocation-Bridging-Header.h index 045431ad..94ee3694 100644 --- a/QuickLocation/QuickLocation-Bridging-Header.h +++ b/QuickLocation/QuickLocation-Bridging-Header.h @@ -20,5 +20,7 @@ // Pop #import "DLViewTransition.h" +// 微信 +#import #endif /* QuickLocation_Bridging_Header_h */ diff --git a/QuickLocation/QuickLocation.entitlements b/QuickLocation/QuickLocation.entitlements new file mode 100644 index 00000000..9e7e98c4 --- /dev/null +++ b/QuickLocation/QuickLocation.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.developer.associated-domains + + applinks:smartdrive.zuom8.cn + + + diff --git a/QuickLocation/Section/Group/GroupChat/GroupChatVC.swift b/QuickLocation/Section/Group/GroupChat/GroupChatVC.swift index 8cd91801..d27d7622 100644 --- a/QuickLocation/Section/Group/GroupChat/GroupChatVC.swift +++ b/QuickLocation/Section/Group/GroupChat/GroupChatVC.swift @@ -42,27 +42,20 @@ final class GroupChatVC: BaseViewController { super.viewDidLoad() fd_interactivePopDisabled = true bindViewModel() - requestGroupInfoByKey() reactiveAction() setupMessageListener() setupVoiceRecording() setupPanelDismiss() - + setupKeyboard() + // 并行加载:业务接口 + IM SDK 互不依赖,同时发起 + requestGroupInfoByKey() + viewModel.loadMessages() } - + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) IQKeyboardManager.shared.isEnabled = false IQKeyboardManager.shared.resignOnTouchOutside = false - setupKeyboard() - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) -// if !hasScrolledToBottom { -// hasScrolledToBottom = true -// scrollToBottom() -// } } override func viewWillDisappear(_ animated: Bool) { @@ -70,8 +63,6 @@ final class GroupChatVC: BaseViewController { VoicePlayerManager.shared.stop() IQKeyboardManager.shared.isEnabled = true IQKeyboardManager.shared.resignOnTouchOutside = true - - NotificationCenter.default.removeObserver(self) } // MARK: - Keyboard @@ -419,10 +410,10 @@ final class GroupChatVC: BaseViewController { GroupService.groupInfoByKey(viewModel.groupId).subscribe { response in guard let model = response.model else { return } self.viewModel.memberList = response.list + self.viewModel.buildAvatarCache() self.rootView.groupNameLabel.text = model.name self.rootView.groupAvatarView.image = model.groupIcon self.rootView.reviewBtn.isHidden = !model.is_owner - self.viewModel.loadMessages() }.disposed(by: disposeBag) } diff --git a/QuickLocation/Section/Group/GroupChat/GroupChatViewModel.swift b/QuickLocation/Section/Group/GroupChat/GroupChatViewModel.swift index 9b316d9f..f5e515fb 100644 --- a/QuickLocation/Section/Group/GroupChat/GroupChatViewModel.swift +++ b/QuickLocation/Section/Group/GroupChat/GroupChatViewModel.swift @@ -63,13 +63,27 @@ final class GroupChatViewModel { private let disposeBag = DisposeBag() // MARK: - Avatar + private var avatarCache: [String: UIImage] = [:] + + /// memberList 更新后调用,预构建 userID → UIImage 映射,避免 30 条消息逐一遍历 + func buildAvatarCache() { + var cache: [String: UIImage] = [:] + for member in memberList { + cache[member.user_id] = member.userIcon + } + avatarCache = cache + } + func getUserAvatar(id: String) -> UIImage { + if let image = avatarCache[id] { return image } if let member = memberList.first(where: { $0.user_id == id }) { - return member.userIcon + let image = member.userIcon + avatarCache[id] = image + return image } return UIImage(named: "GroupIcon1") ?? UIImage() } - + func getUserNickName(id: String) -> String { memberList.first { id == $0.user_id }?.nick_name ?? "" } diff --git a/QuickLocation/Section/Mine/Account/AccountVC.swift b/QuickLocation/Section/Mine/Account/AccountVC.swift index 0c0d3ebf..77d2e6f2 100644 --- a/QuickLocation/Section/Mine/Account/AccountVC.swift +++ b/QuickLocation/Section/Mine/Account/AccountVC.swift @@ -25,6 +25,15 @@ class AccountVC: BaseViewController { // Do any additional setup after loading the view. reactiveAction() + + DispatchQueue.global(qos: .background).async { + let totalByte = AppCacheManager.totalCacheSize() + let cacheText = AppCacheManager.formatByte(totalByte) + DispatchQueue.main.async { + // 赋值给 Label 展示 + self.rootView.cacheLab.text = "\(cacheText)" + } + } } private func reactiveAction() { @@ -37,16 +46,29 @@ class AccountVC: BaseViewController { self.requestLogout() } }).disposed(by: disposeBag) + + rootView.cancelledBtn.rx.tap.subscribe(onNext: { _ in + CancellationPopView.show { + self.deleteAccount() + } + }).disposed(by: disposeBag) } // MARK: - API private func requestLogout() { DLToast.showLoading() - UserService.logout().subscribe { response in + UserService.logout().subscribe(onNext: { response in DLToast.dismiss() AppContextManager.shared.deleteAccount() GroupIMService.shared.logout() AppDelegate.shared.showMainViewController() - }.disposed(by: disposeBag) + }, onError: { _ in }).disposed(by: disposeBag) + } + + private func deleteAccount() { + DLToast.showLoading() + UserService.deleteAccount().subscribe(onNext: { response in + DLToast.show(text: "申请成功") + }, onError: { _ in }).disposed(by: disposeBag) } } diff --git a/QuickLocation/Section/Mine/Account/AccountView.swift b/QuickLocation/Section/Mine/Account/AccountView.swift index a9558234..80746611 100644 --- a/QuickLocation/Section/Mine/Account/AccountView.swift +++ b/QuickLocation/Section/Mine/Account/AccountView.swift @@ -14,6 +14,10 @@ class AccountView: UIView { var disposeBag = DisposeBag() private func setupRx() { + phoneView.rx.tapGesture.subscribe(onNext: { _ in + AppRouter.push(Route.changePhone) + }).disposed(by: disposeBag) + backBtn.rx.tap.subscribe(onNext: { _ in AppRouter.shared.popOrDismiss() }).disposed(by: disposeBag) @@ -282,10 +286,21 @@ class AccountView: UIView { .height(14) .centerY() + view.addSubview(cacheLab) + cacheLab.layoutChain + .rightToLeftOfView(arrow, offset: -8) + .centerY() return view }() + lazy var cacheLab: UILabel = { + let lab = UILabel() + lab.font = .systemFont(ofSize: 14, weight: .medium) + lab.textColor = UIColor(hexStr: "#1A1A1A") + return lab + }() + lazy var logoutBtn: UIButton = { let btn = UIButton(type: .custom) btn.setTitle("退出登录", for: .normal) diff --git a/QuickLocation/Section/Mine/Account/CancellationPopView.swift b/QuickLocation/Section/Mine/Account/CancellationPopView.swift new file mode 100644 index 00000000..bf446e33 --- /dev/null +++ b/QuickLocation/Section/Mine/Account/CancellationPopView.swift @@ -0,0 +1,261 @@ +// +// CancellationPopView.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class CancellationPopView: UIView { + + private static let shared = CancellationPopView(frame: CGRect(origin: .zero, size: kScreenSize)) + + var disposeBag = DisposeBag() + + private var completion: (() -> Void)? + + static func show(completion: @escaping (() -> Void)) { + guard let superView = kKeyWindow else { + return + } + + if CancellationPopView.shared.superview != nil { + CancellationPopView.shared.removeFromSuperview() + CancellationPopView.shared.bgView.frame = .zero + } + + CancellationPopView.shared.bgView.alpha = 1 + CancellationPopView.shared.bgView.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight) + superView.addSubview(CancellationPopView.shared) + superView.bringSubviewToFront(CancellationPopView.shared) + + UIView.animate(withDuration: 0.25) { + CancellationPopView.shared.bgView.alpha = 1 + } + + CancellationPopView.shared.completion = { + completion() + CancellationPopView.dismiss() + } + } + + /// 关闭 + static func dismiss() { + guard CancellationPopView.shared.superview != nil else { return } + + UIView.animate(withDuration: 0.25, delay: 0, options: [.curveEaseIn]) { + CancellationPopView.shared.bgView.alpha = 0 + } completion: { _ in + CancellationPopView.shared.removeFromSuperview() + } + } + + private func setupRx() { + + checkBox.rx.tap + .subscribe(onNext: { [weak self] in + guard let self = self else { return } + self.checkBox.isSelected = !self.checkBox.isSelected + self.confirmBtn.isEnabled = self.checkBox.isSelected + }) + .disposed(by: disposeBag) + + agreementLab.rx.tapGesture.subscribe { _ in + CancellationPopView.dismiss() + AppRouter.push(Route.web, userInfo: ["url": URLManager.shared.cancellationNoticeUrl]) + }.disposed(by: disposeBag) + + confirmBtn.rx.tap.subscribe(onNext: { _ in + self.completion?() + }).disposed(by: disposeBag) + + closeBtn.rx.tap.subscribe(onNext: { _ in + CancellationPopView.dismiss() + + }).disposed(by: disposeBag) + } + + private lazy var bgView: UIView = { + let view = UIView() + view.backgroundColor = .black.withAlphaComponent(0.5) + return view + }() + + lazy var popView: UIView = { + let view = UIView() + view.backgroundColor = .clear + return view + }() + + lazy var popBgView: UIView = { + let view = UIView() + view.backgroundColor = .white + view.cornerRadius = 30 + return view + }() + + lazy var logoImgView: UIImageView = { + let view = UIImageView(image: UIImage(named: "Popup/bell")) + return view + }() + + lazy var headerBgImg: UIImageView = { + let view = UIImageView(image: UIImage(named: "Popup/header_bg")) + view.contentMode = .scaleAspectFill + return view + }() + + lazy var titleLab: UILabel = { + let label = UILabel() + label.text = "删除账户" + label.font = .systemFont(ofSize: 20, weight: .semibold) + label.textColor = UIColor(hexStr: "#0F2846") + label.textAlignment = .center + label.numberOfLines = 0 + return label + }() + + lazy var contentLab: UILabel = { + let label = UILabel() + label.text = "申请删除账号后,账号将在15日后自动删除,若在15日内登录账号,删除账号申请将被取消!您确定要删除吗?" + label.font = .systemFont(ofSize: 14, weight: .medium) + label.textColor = UIColor(hexStr: "#333333") + label.textAlignment = .center + label.numberOfLines = 0 + return label + }() + + lazy var agreementView: UIView = { + let view = UIView() + view.backgroundColor = .clear + + view.addSubview(checkBox) + checkBox.layoutChain + .left() + .width(12) + .height(12) + .centerY() + + view.addSubview(agreementLab) + agreementLab.layoutChain + .leftToRightOfView(checkBox, offset: 5) + .edgesVertical() + .right() + + return view + }() + + lazy var checkBox: UIButton = { + let btn = UIButton(type: .custom) + btn.setImage(UIImage(named: "Login/checkbox"), for: .normal) + btn.setImage(UIImage(named: "Login/selected"), for: .selected) + btn.extendEdgeInsets = UIEdgeInsets(top: 100, left: 100, bottom: 100, right: 0) + return btn + }() + + lazy var agreementLab: UILabel = { + let label = UILabel() + label.font = .systemFont(ofSize: 10, weight: .medium) + label.textColor = UIColor(hexStr: "#333333") + label.isUserInteractionEnabled = true + + let text = "阅读并同意《账号注销协议》" + let attr = NSMutableAttributedString(string: text) + let range = (text as NSString).range(of: "《账号注销协议》") + attr.addAttribute(.foregroundColor, value: UIColor(hexStr: "#FFC006"), range: range) + label.attributedText = attr + return label + }() + + lazy var confirmBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setTitle("确认", for: .normal) + btn.setTitleColor(UIColor(hexStr: "#16B3FF"), for: .normal) + btn.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) + btn.backgroundColor = .clear + btn.isEnabled = false + return btn + }() + + lazy var closeBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setTitle("取消", for: .normal) + btn.setTitleColor(.white, for: .normal) + btn.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) + btn.setBackgroundImage(UIImage(named: "Common/button_bg_2"), for: .normal) + btn.cornerRadius = 25 + return btn + }() + + // MARK: - Init + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .clear + addSubview(bgView) + bgView.addSubview(popView) + popView.addSubview(popBgView) + popView.addSubview(logoImgView) + popBgView.addSubview(headerBgImg) + popBgView.addSubview(titleLab) + popBgView.addSubview(contentLab) + popBgView.addSubview(agreementView) + popBgView.addSubview(closeBtn) + popBgView.addSubview(confirmBtn) + + popView.layoutChain + .centerY() + .centerX() + .width(315) + + popBgView.layoutChain.edges() + + logoImgView.layoutChain + .left(16) + .top(-45) + .width(109) + .height(109) + + headerBgImg.layoutChain + .edges(excludingEdge: .bottom) + .heightToWidth(100/315) + + titleLab.layoutChain + .top(53) + .centerX() + + contentLab.layoutChain + .topToBottomOfView(titleLab, offset: 10) + .edgesHorzontal(20) + + agreementView.layoutChain + .topToBottomOfView(contentLab, offset: 24) + .centerX() + .height(14) + + closeBtn.layoutChain + .topToBottomOfView(agreementView, offset: 20) + .edgesHorzontal(20) + .height(50) + + confirmBtn.layoutChain + .topToBottomOfView(closeBtn, offset: 10) + .edgesHorzontal(20) + .height(50) + .bottom(10) + + setupRx() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + + } + +} diff --git a/QuickLocation/Section/Mine/Account/ChangePhoneVC.swift b/QuickLocation/Section/Mine/Account/ChangePhoneVC.swift new file mode 100644 index 00000000..d8d7b4e5 --- /dev/null +++ b/QuickLocation/Section/Mine/Account/ChangePhoneVC.swift @@ -0,0 +1,69 @@ +// +// ChangePhoneVC.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class ChangePhoneVC: BaseViewController { + + fileprivate var rootView: ChangePhoneView! + + override func loadView() { + rootView = ChangePhoneView(frame: UIScreen.main.bounds) + view = rootView + } + + private var timestamp: String = "" + private var countDownService = CountDownService(countDownTime: 60) + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + + reactiveAction() + } + + private func reactiveAction() { + rootView.smsCodeBtn.rx.tap.subscribe(onNext: { _ in + self.requestSmsCodeAPI() + }).disposed(by: disposeBag) + + rootView.confirmBtn.rx.tap.subscribe(onNext: { _ in + self.requestChangePhone() + }).disposed(by: disposeBag) + } + + // MARK: - API 验证码 + func requestSmsCodeAPI() { + guard let phone = rootView.phoneTF.text, !phone.isEmpty else { + DLToast.show(text: "请输入手机号") + return + } + DLToast.showLoading() + SystemService.sendSmsCode(phone: phone).subscribe(onNext: { [weak self] response in + DLToast.showSuccess(text: "发送成功") + guard let self = self, let responseData = response.result as? [String : Any] else { return } + self.startCountDown(self.rootView.smsCodeBtn, self.countDownService) + if let timestamp = responseData["timestamp"] as? String { + self.timestamp = timestamp + } + }, onError: { _ in }).disposed(by: disposeBag) + } + + // MARK: - API 更换手机号 + private func requestChangePhone() { + DLToast.showLoading() + guard let phone = rootView.phoneTF.text, let code = rootView.codeTF.text else { return } + UserService.changePhone(timestamp: timestamp, phone: phone, code: code).subscribe(onNext: { response in + DLToast.show(text: "更换成功") { + AppRouter.shared.popToRoot() + } + }, onError: { _ in }).disposed(by: disposeBag) + } +} diff --git a/QuickLocation/Section/Mine/Account/ChangePhoneView.swift b/QuickLocation/Section/Mine/Account/ChangePhoneView.swift new file mode 100644 index 00000000..01930644 --- /dev/null +++ b/QuickLocation/Section/Mine/Account/ChangePhoneView.swift @@ -0,0 +1,267 @@ +// +// ChangePhoneView.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class ChangePhoneView: UIView { + + var disposeBag = DisposeBag() + + private func setupRx() { + phoneTF.rx.text + .map { text -> String? in + guard let text = text else { return nil } + return String(text.prefix(11)) + }.bind(to: phoneTF.rx.text) + .disposed(by: disposeBag) + + phoneTF.rx.text.orEmpty.map { phone -> Bool in + if phone.count == 11 { + return true + } else { + return false + } + } + .bind(to: smsCodeBtn.rx.isEnabled) + .disposed(by: disposeBag) + + codeTF.rx.text + .map { text -> String? in + guard let text = text else { return nil } + return String(text.prefix(6)) + }.bind(to: codeTF.rx.text) + .disposed(by: disposeBag) + + let form = Observable.combineLatest(phoneTF.rx.text.orEmpty, + codeTF.rx.text.orEmpty) + form.map { phone, smsCode -> Bool in + if phone.count == 11 && smsCode.count >= 1 { + return true + } else { + return false + } + } + .bind(to: confirmBtn.rx.isEnabled) + .disposed(by: disposeBag) + + backBtn.rx.tap.subscribe(onNext: { _ in + AppRouter.shared.popOrDismiss() + }).disposed(by: disposeBag) + } + + private func setupUI() { + addSubview(navBgView) + addSubview(navBarView) + navBarView.addSubview(navTitleLabel) + navBarView.addSubview(backBtn) + + addSubview(confirmBtn) + addSubview(infoShadowView) + infoShadowView.addSubview(infoView) + infoView.addSubview(phoneInputView) + infoView.addSubview(codeInputView) + + navBgView.layoutChain + .edges(excludingEdge: .bottom) + .heightToWidth(160/375) + + navBarView.layoutChain + .edges(excludingEdge: .bottom) + .height(kNaviHeight) + + navTitleLabel.layoutChain + .top(kStatusBarHeight + 12) + .centerY(backBtn) + .centerX() + + backBtn.layoutChain + .centerY(navTitleLabel) + .left(15) + .width(24) + .height(24) + + infoShadowView.layoutChain + .topToBottomOfView(navBarView, offset: 18) + .edgesHorzontal(16) + + infoView.layoutChain.edges() + + phoneInputView.layoutChain + .edges(excludingEdge: .bottom) + .height(52) + + codeInputView.layoutChain + .topToBottomOfView(phoneInputView) + .edgesHorzontal() + .bottom() + .height(52) + + confirmBtn.layoutChain + .edgesHorzontal(30) + .bottom(kSafeBottomMargin + 30) + .height(50) + } + + lazy var navBgView: UIImageView = { + let iv = UIImageView() + iv.image = UIImage(named: "Common/navBar_bg_2") + iv.contentMode = .scaleAspectFill + return iv + }() + + lazy var navBarView: UIView = { + let view = UIView() + view.backgroundColor = .clear + return view + }() + + lazy var navTitleLabel: UILabel = { + let label = UILabel() + label.text = "更换手机号" + label.font = .systemFont(ofSize: 18, weight: .medium) + label.textColor = ThemeManager.shared.color.titleAuxColor + label.textAlignment = .center + return label + }() + + lazy var backBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setImage(UIImage(named: "Common/back"), for: .normal) + btn.extendEdgeInsets = UIEdgeInsets(top: 54, left: 15, bottom: 100, right: 100) + return btn + }() + + lazy var infoShadowView: UIView = { + let view = UIView() + view.backgroundColor = .clear + view.layer.shadowColor = UIColor(hexStr: "#0F2846", alpha: 0.1).cgColor + view.layer.shadowOffset = CGSize(width: 0, height: 0) + view.layer.shadowOpacity = 1 + view.layer.shadowRadius = 10 + return view + }() + + lazy var infoView: UIView = { + let view = UIView() + view.backgroundColor = .white + view.cornerRadius = 10 + return view + }() + + // 手机号 + lazy var phoneInputView: UIView = { + let view = UIView() + view.backgroundColor = .clear + + let titleLab = UILabel() + titleLab.text = "手机号" + titleLab.font = .systemFont(ofSize: 14, weight: .medium) + titleLab.textColor = UIColor(hexStr: "#1A1A1A") + view.addSubview(titleLab) + titleLab.layoutChain + .left(15) + .centerY() + + view.addSubview(phoneTF) + phoneTF.layoutChain + .right(15) + .edgesVertical() + .width(200) + + let line = UIView() + line.backgroundColor = ThemeManager.shared.color.lineColor + view.addSubview(line) + line.layoutChain + .bottom() + .height(0.5) + .edgesHorzontal(15) + + return view + }() + + lazy var phoneTF: UITextField = { + let textField = UITextField() + textField.keyboardType = .numberPad + textField.returnKeyType = .done + textField.textAlignment = .right + textField.placeholder = "请输入您要更换的手机号" + textField.font = .systemFont(ofSize: 14, weight: .medium) + return textField + }() + + // 验证码 + lazy var codeInputView: UIView = { + let view = UIView() + view.backgroundColor = .clear + + let titleLab = UILabel() + titleLab.text = "验证码" + titleLab.font = .systemFont(ofSize: 14, weight: .medium) + titleLab.textColor = UIColor(hexStr: "#1A1A1A") + view.addSubview(titleLab) + titleLab.layoutChain + .left(15) + .centerY() + + view.addSubview(smsCodeBtn) + smsCodeBtn.layoutChain + .right(15) + .edgesVertical() + .width(80) + + view.addSubview(codeTF) + codeTF.layoutChain + .rightToLeftOfView(smsCodeBtn, offset: -15) + .edgesVertical() + .width(150) + + return view + }() + + lazy var codeTF: UITextField = { + let textField = UITextField() + textField.keyboardType = .numberPad + textField.returnKeyType = .done + textField.textAlignment = .right + textField.placeholder = "请输入验证码" + textField.font = .systemFont(ofSize: 14, weight: .medium) + return textField + }() + + lazy var smsCodeBtn: UIButton = { + let button = UIButton() + button.setTitle("发送验证码", for: .normal) + button.setTitleColor(UIColor(hexStr: "#16B3FF"), for: .normal) + button.setTitleColor(UIColor(hexStr: "#999999", alpha: 1.0), for: .disabled) + button.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium) + button.backgroundColor = .clear + return button + }() + + lazy var confirmBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setTitle("确认", for: .normal) + btn.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) + btn.setTitleColor(.white, for: .normal) + btn.setBackgroundImage(UIImage(named: "Common/button_bg_2"), for: .normal) + btn.cornerRadius = 25 + return btn + }() + + override init(frame: CGRect) { + super.init(frame: .zero) + backgroundColor = UIColor(hexStr: "#FAFAFA") + setupUI() + setupRx() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactAddVC.swift b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactAddVC.swift new file mode 100644 index 00000000..4a5979f4 --- /dev/null +++ b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactAddVC.swift @@ -0,0 +1,41 @@ +// +// EmergencyContactAddVC.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class EmergencyContactAddVC: BaseViewController { + + fileprivate var rootView: EmergencyContactAddView! + + override func loadView() { + rootView = EmergencyContactAddView(frame: UIScreen.main.bounds) + view = rootView + } + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + + rootView.saveBtn.rx.tap.subscribe(onNext: { _ in + self.requestEmergencyContactAdd() + }).disposed(by: disposeBag) + } + + // MARK: - API 添加紧急联系人 + private func requestEmergencyContactAdd() { + guard let name = rootView.nameTF.text, let phone = rootView.phoneTF.text else { return } + DLToast.showLoading() + UserService.emergencyContactAdd(requestData: ["name": name, "phone": phone]).subscribe(onNext: { response in + DLToast.show(text: "添加成功") { + AppRouter.shared.popOrDismiss() + } + }, onError: { _ in }).disposed(by: disposeBag) + } +} diff --git a/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactAddView.swift b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactAddView.swift new file mode 100644 index 00000000..f0c49199 --- /dev/null +++ b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactAddView.swift @@ -0,0 +1,255 @@ +// +// EmergencyContactAddView.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class EmergencyContactAddView: UIView { + + var disposeBag = DisposeBag() + + private func setupRx() { + nameTF.rx.text + .map { text -> String? in + guard let text = text else { return nil } + return String(text.prefix(10)) + }.bind(to: nameTF.rx.text) + .disposed(by: disposeBag) + + phoneTF.rx.text + .map { text -> String? in + guard let text = text else { return nil } + return String(text.prefix(11)) + }.bind(to: phoneTF.rx.text) + .disposed(by: disposeBag) + + let form = Observable.combineLatest(nameTF.rx.text.orEmpty, + phoneTF.rx.text.orEmpty) + form.map { name, phone -> Bool in + if phone.count == 11 && name.count >= 1 { + return true + } else { + return false + } + } + .bind(to: saveBtn.rx.isEnabled) + .disposed(by: disposeBag) + + backBtn.rx.tap.subscribe(onNext: { _ in + AppRouter.shared.popOrDismiss() + }).disposed(by: disposeBag) + } + + private func setupUI() { + addSubview(navBgView) + addSubview(navBarView) + navBarView.addSubview(navTitleLabel) + navBarView.addSubview(backBtn) + + addSubview(titleLab) + addSubview(infoShadowView) + infoShadowView.addSubview(infoView) + + addSubview(saveBtn) + + navBgView.layoutChain + .edges(excludingEdge: .bottom) + .heightToWidth(160/375) + + navBarView.layoutChain + .edges(excludingEdge: .bottom) + .height(kNaviHeight) + + navTitleLabel.layoutChain + .top(kStatusBarHeight + 12) + .centerY(backBtn) + .centerX() + + backBtn.layoutChain + .centerY(navTitleLabel) + .left(15) + .width(24) + .height(24) + + titleLab.layoutChain + .topToBottomOfView(navBarView, offset: 20) + .left(15) + + infoShadowView.layoutChain + .topToBottomOfView(titleLab, offset: 16) + .edgesHorzontal(15) + + infoView.layoutChain.edges() + + saveBtn.layoutChain + .edgesHorzontal(30) + .bottom(kSafeBottomMargin + 30) + .height(50) + } + + lazy var navBgView: UIImageView = { + let iv = UIImageView() + iv.image = UIImage(named: "Common/navBar_bg_2") + iv.contentMode = .scaleAspectFill + return iv + }() + + lazy var navBarView: UIView = { + let view = UIView() + view.backgroundColor = .clear + return view + }() + + lazy var navTitleLabel: UILabel = { + let label = UILabel() + label.text = "添加紧急联系人" + label.font = .systemFont(ofSize: 18, weight: .medium) + label.textColor = ThemeManager.shared.color.titleAuxColor + label.textAlignment = .center + return label + }() + + lazy var backBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setImage(UIImage(named: "Common/back"), for: .normal) + btn.extendEdgeInsets = UIEdgeInsets(top: 54, left: 15, bottom: 100, right: 100) + return btn + }() + + lazy var titleLab: UILabel = { + let label = UILabel() + label.text = "编辑信息" + label.font = .systemFont(ofSize: 14, weight: .medium) + label.textColor = ThemeManager.shared.color.titleAuxColor + return label + }() + + lazy var infoShadowView: UIView = { + let view = UIView() + view.backgroundColor = .clear + view.layer.shadowColor = UIColor(hexStr: "#0F2846", alpha: 0.1).cgColor + view.layer.shadowOffset = CGSize(width: 0, height: 0) + view.layer.shadowOpacity = 1 + view.layer.shadowRadius = 10 + return view + }() + + lazy var infoView: UIView = { + let view = UIView() + view.backgroundColor = .white + view.cornerRadius = 10 + + view.addSubview(nameInputView) + nameInputView.layoutChain + .edges(excludingEdge: .bottom) + .height(44) + + view.addSubview(phoneInputView) + phoneInputView.layoutChain + .topToBottomOfView(nameInputView) + .edges(excludingEdge: .top) + .height(44) + + return view + }() + + // 姓名 + lazy var nameInputView: UIView = { + let view = UIView() + view.backgroundColor = .clear + + let titleLab = UILabel() + titleLab.text = "姓名" + titleLab.font = .systemFont(ofSize: 14, weight: .medium) + titleLab.textColor = UIColor(hexStr: "#1A1A1A") + view.addSubview(titleLab) + titleLab.layoutChain + .left(15) + .centerY() + + view.addSubview(nameTF) + nameTF.layoutChain + .right(15) + .edgesVertical() + .width(200) + + let line = UIView() + line.backgroundColor = ThemeManager.shared.color.lineColor + view.addSubview(line) + line.layoutChain + .bottom() + .height(0.5) + .edgesHorzontal(15) + + return view + }() + + lazy var nameTF: UITextField = { + let textField = UITextField() + textField.returnKeyType = .done + textField.textAlignment = .right + textField.placeholder = "请输入姓名" + textField.font = .systemFont(ofSize: 14, weight: .medium) + return textField + }() + + // 手机号 + lazy var phoneInputView: UIView = { + let view = UIView() + view.backgroundColor = .clear + + let titleLab = UILabel() + titleLab.text = "手机号" + titleLab.font = .systemFont(ofSize: 14, weight: .medium) + titleLab.textColor = UIColor(hexStr: "#1A1A1A") + view.addSubview(titleLab) + titleLab.layoutChain + .left(15) + .centerY() + + view.addSubview(phoneTF) + phoneTF.layoutChain + .right(15) + .edgesVertical() + .width(150) + + return view + }() + + lazy var phoneTF: UITextField = { + let textField = UITextField() + textField.keyboardType = .numberPad + textField.returnKeyType = .done + textField.textAlignment = .right + textField.placeholder = "请输入手机号码" + textField.font = .systemFont(ofSize: 14, weight: .medium) + return textField + }() + + lazy var saveBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setTitle("保存紧急联系人", for: .normal) + btn.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) + btn.setTitleColor(.white, for: .normal) + btn.setBackgroundImage(UIImage(named: "Common/button_bg_2"), for: .normal) + btn.cornerRadius = 25 + return btn + }() + + override init(frame: CGRect) { + super.init(frame: .zero) + backgroundColor = UIColor(hexStr: "#FAFAFA") + setupUI() + setupRx() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} diff --git a/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactFooterView.swift b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactFooterView.swift new file mode 100644 index 00000000..6dda3d20 --- /dev/null +++ b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactFooterView.swift @@ -0,0 +1,92 @@ +// +// EmergencyContactFooterView.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class EmergencyContactFooterView: UIView { + + var disposeBag = DisposeBag() + + private func setupRx() { + + addView.rx.tapGesture.subscribe(onNext: { _ in + AppRouter.push(Route.emergencyContactAdd) + }).disposed(by: disposeBag) + } + + private func setupUI() { + addSubview(addView) + addSubview(tipsTitleLab) + addSubview(tipsLab) + + addView.layoutChain + .top() + .edgesHorzontal(15) + .height(68) + + tipsTitleLab.layoutChain + .topToBottomOfView(addView, offset: 20) + .leftToView(addView) + + tipsLab.layoutChain + .topToBottomOfView(tipsTitleLab, offset: 6) + .leftToView(addView) + .rightToView(addView) + } + + lazy var addView: UIView = { + let view = UIView() + view.backgroundColor = UIColor(hexStr: "#F5FBFF") + view.cornerRadius = 10 + + let titleLab = UILabel() + titleLab.text = "添加紧急联系人" + titleLab.font = .systemFont(ofSize: 14, weight: .semibold) + titleLab.textColor = ThemeManager.shared.color.titleAuxColor + view.addSubview(titleLab) + titleLab.layoutChain + .centerX().centerY() + + let addIcon = UIImageView(image: UIImage(named: "EmergencyContact/add")) + view.addSubview(addIcon) + addIcon.layoutChain + .rightToLeftOfView(titleLab, offset: -4) + .centerY() + + return view + }() + + lazy var tipsTitleLab: UILabel = { + let label = UILabel() + label.text = "紧急联系人能力:" + label.font = .systemFont(ofSize: 14, weight: .semibold) + label.textColor = ThemeManager.shared.color.titleAuxColor + return label + }() + + lazy var tipsLab: UILabel = { + let label = UILabel() + label.text = "仅在使用SOS功能或紧急情况下,会主动通知紧急联系人" + label.font = .systemFont(ofSize: 12, weight: .regular) + label.textColor = UIColor(hexStr: "#777777") + label.numberOfLines = 0 + return label + }() + + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .white + setupUI() + setupRx() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactVC.swift b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactVC.swift new file mode 100644 index 00000000..f3e86f74 --- /dev/null +++ b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactVC.swift @@ -0,0 +1,65 @@ +// +// EmergencyContactVC.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa +import RxDataSources + +class EmergencyContactVC: BaseViewController { + + fileprivate var rootView: EmergencyContactView! + + override func loadView() { + rootView = EmergencyContactView(frame: UIScreen.main.bounds) + view = rootView + } + + private var viewModel = EmergencyContactViewModel() + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + bindViewModel() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + requestEmergencyContactList() + } + + private func bindViewModel() { + viewModel.output.sectionedItems + .bind(to: rootView.tableView.rx.items(dataSource: dataSource)) + .disposed(by: disposeBag) + } + + // MARK: - UITableViewDataSource + lazy private var dataSource: RxTableViewSectionedReloadDataSource = { + return RxTableViewSectionedReloadDataSource( + configureCell: { (_, tableView, indexPath, model) in + let cell: EmergencyContactCell = tableView.dequeueReusableCell(for: indexPath) + cell.configure(model) + return cell + }) + }() + + // MARK: - API 紧急联系人列表 + private func requestEmergencyContactList() { + DLToast.showLoading() + UserService.emergencyContactList().subscribe(onNext: { response in + self.viewModel.loadData(response.list) + }, onError: { _ in }).disposed(by: disposeBag) + } + +} diff --git a/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactVM.swift b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactVM.swift new file mode 100644 index 00000000..85d9b5a6 --- /dev/null +++ b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactVM.swift @@ -0,0 +1,34 @@ +// +// EmergencyContactVM.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import RxSwift +import RxDataSources + +typealias EmergencyContactListSectionModel = SectionModel + +class EmergencyContactViewModel { + + struct Output { + var sectionedItems: Observable<[EmergencyContactListSectionModel]> + } + + let output: Output + + private var disposeBag = DisposeBag() + private let sectionedItems = PublishSubject<[EmergencyContactListSectionModel]>() + + func loadData(_ list: [EmergencyContactModel]) { + sectionedItems.onNext(list.mapSection()) + } + + // MARK: - Init + init() { + output = Output( + sectionedItems: sectionedItems.asObservable() + ) + } +} diff --git a/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactView.swift b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactView.swift new file mode 100644 index 00000000..f1696b68 --- /dev/null +++ b/QuickLocation/Section/Mine/EmergencyContact/EmergencyContactView.swift @@ -0,0 +1,205 @@ +// +// EmergencyContactView.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class EmergencyContactView: UIView { + + var disposeBag = DisposeBag() + + private let footerView = EmergencyContactFooterView(frame: CGRectMake(0, 0, kScreenWidth, 131)) + + private func setupRx() { + + backBtn.rx.tap.subscribe(onNext: { _ in + AppRouter.shared.popOrDismiss() + }).disposed(by: disposeBag) + } + + private func setupUI() { + addSubview(navBgView) + addSubview(navBarView) + navBarView.addSubview(navTitleLabel) + navBarView.addSubview(backBtn) + + addSubview(titleLab) + addSubview(tableView) + + navBgView.layoutChain + .edges(excludingEdge: .bottom) + .heightToWidth(160/375) + + navBarView.layoutChain + .edges(excludingEdge: .bottom) + .height(kNaviHeight) + + navTitleLabel.layoutChain + .top(kStatusBarHeight + 12) + .centerY(backBtn) + .centerX() + + backBtn.layoutChain + .centerY(navTitleLabel) + .left(15) + .width(24) + .height(24) + + titleLab.layoutChain + .topToBottomOfView(navBarView, offset: 20) + .left(15) + + tableView.layoutChain + .topToBottomOfView(titleLab, offset: 16) + .edgesHorzontal() + .bottom(kSafeBottomMargin) + } + + lazy var navBgView: UIImageView = { + let iv = UIImageView() + iv.image = UIImage(named: "Common/navBar_bg_2") + iv.contentMode = .scaleAspectFill + return iv + }() + + lazy var navBarView: UIView = { + let view = UIView() + view.backgroundColor = .clear + return view + }() + + lazy var navTitleLabel: UILabel = { + let label = UILabel() + label.text = "紧急联系人" + label.font = .systemFont(ofSize: 18, weight: .medium) + label.textColor = ThemeManager.shared.color.titleAuxColor + label.textAlignment = .center + return label + }() + + lazy var backBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setImage(UIImage(named: "Common/back"), for: .normal) + btn.extendEdgeInsets = UIEdgeInsets(top: 54, left: 15, bottom: 100, right: 100) + return btn + }() + + lazy var titleLab: UILabel = { + let label = UILabel() + label.text = "我的紧急联系人(0人)" + label.font = .systemFont(ofSize: 14, weight: .medium) + label.textColor = ThemeManager.shared.color.titleAuxColor + return label + }() + + lazy var tableView: UITableView = { + let tableView = UITableView(frame: .zero, style: .plain) + tableView.backgroundColor = .clear + tableView.separatorStyle = .none + tableView.estimatedRowHeight = 68 + tableView.bounces = false + tableView.register(EmergencyContactCell.self) + tableView.tableFooterView = footerView + return tableView + }() + + override init(frame: CGRect) { + super.init(frame: .zero) + backgroundColor = .white + setupUI() + setupRx() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +// MARK: - EmergencyContactCell +class EmergencyContactCell: UITableViewCell { + + func configure(_ model: EmergencyContactModel) { + nameLab.text = model.name + phoneLab.text = model.phone + } + + override init(style: CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + selectionStyle = .none + backgroundColor = .clear + setupSubviews() + } + + private func setupSubviews() { + contentView.addSubview(bgView) + bgView.addSubview(phoneLab) + bgView.addSubview(nameLab) + bgView.addSubview(arrowIcon) + + bgView.layoutChain + .edgesHorzontal(15) + .edgesVertical() + + nameLab.layoutChain + .top(13) + .left(15) + + phoneLab.layoutChain + .topToBottomOfView(nameLab, offset: 2) + .leftToView(nameLab) + + arrowIcon.layoutChain + .right(15) + .width(13) + .height(13) + .centerY() + } + + lazy var bgView: UIView = { + let view = UIView() + view.backgroundColor = UIColor(hexStr: "#F5FBFF") + view.cornerRadius = 10 + return view + }() + + lazy var nameLab: UILabel = { + let label = UILabel() + label.textColor = ThemeManager.shared.color.titleAuxColor + label.font = .systemFont(ofSize: 14, weight: .semibold) + return label + }() + + lazy var phoneLab: UILabel = { + let label = UILabel() + label.textColor = ThemeManager.shared.color.titleAuxColor + label.font = .systemFont(ofSize: 14, weight: .semibold) + return label + }() + + lazy var arrowIcon: UIImageView = { + let view = UIImageView(image: UIImage(named: "EmergencyContact/arrow")) + + return view + }() + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + // Configure the view for the selected state + } +} diff --git a/QuickLocation/Section/Mine/MineView.swift b/QuickLocation/Section/Mine/MineView.swift index df57f9dc..c5ef7382 100644 --- a/QuickLocation/Section/Mine/MineView.swift +++ b/QuickLocation/Section/Mine/MineView.swift @@ -44,7 +44,7 @@ final class MineView: UIView { private func setupRx() { avatarImageView.rx.tapGesture.subscribe { _ in - AppRouter.push(Route.login) + AppRouter.push(Route.myProfile) }.disposed(by: disposeBag) } diff --git a/QuickLocation/Section/Mine/MineViewController.swift b/QuickLocation/Section/Mine/MineViewController.swift index ae822e77..5415e901 100644 --- a/QuickLocation/Section/Mine/MineViewController.swift +++ b/QuickLocation/Section/Mine/MineViewController.swift @@ -98,6 +98,7 @@ final class MineViewController: BaseViewController { }) }() + // MARK: - API private func requestUserInfo() { UserService.userInfo().subscribe { response in guard let model = response.model else { return } diff --git a/QuickLocation/Section/Mine/MineViewModel.swift b/QuickLocation/Section/Mine/MineViewModel.swift index e1a2a73e..197d7b87 100644 --- a/QuickLocation/Section/Mine/MineViewModel.swift +++ b/QuickLocation/Section/Mine/MineViewModel.swift @@ -38,6 +38,12 @@ class MineViewModel { switch model.title { case "账户与安全": AppRouter.push(Route.account) + case "紧急联系人": + AppRouter.push(Route.emergencyContact) + case "隐私与协议": + AppRouter.push(Route.privacyPolicy) + case "在线客服": + this.requestWechatService() default: break } @@ -49,12 +55,18 @@ class MineViewModel { sectionedItems.onNext(menuItems.mapSection()) } - func loadUserInfo() { - // TODO: Load user info from API - } - - func performLogout() { - // TODO: Logout logic + func requestWechatService() { + DLToast.showLoading() + SystemService.wechatService().subscribe(onNext: { response in + DLToast.dismiss() + guard let responseData = response.data, + let corpid = responseData["corpid"] as? String, + let url = responseData["kf.address"] as? String else { return } + let req = WXOpenCustomerServiceReq() + req.corpid = corpid + req.url = url + WXApi.send(req) + }, onError: { _ in }).disposed(by: disposeBag) } // MARK: - Init diff --git a/QuickLocation/Section/Mine/MyProfile/AvatarIconListVC.swift b/QuickLocation/Section/Mine/MyProfile/AvatarIconListVC.swift new file mode 100644 index 00000000..ef707b06 --- /dev/null +++ b/QuickLocation/Section/Mine/MyProfile/AvatarIconListVC.swift @@ -0,0 +1,55 @@ +// +// AvatarIconListVC.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class AvatarIconListVC: BaseViewController { + + fileprivate var rootView: AvatarIconListView! + + override func loadView() { + rootView = AvatarIconListView(frame: UIScreen.main.bounds) + view = rootView + } + + private var iconIndex: String + var onSelectIcon: ((Int) -> Void)? + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + rootView.selectedIndex = iconIndex.integer + rootView.iconCollectionView.delegate = self + + rootView.doneBtn.rx.tap.subscribe(onNext: { _ in + if let onSelectIcon = self.onSelectIcon { + onSelectIcon(self.rootView.selectedIndex) + AppRouter.shared.popOrDismiss() + } + }).disposed(by: disposeBag) + } + + // MARK: - Init + init(iconIndex: String) { + self.iconIndex = iconIndex + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +extension AvatarIconListVC: UICollectionViewDelegate { + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + rootView.selectedIndex = indexPath.row + 1 + } +} diff --git a/QuickLocation/Section/Mine/MyProfile/AvatarIconListView.swift b/QuickLocation/Section/Mine/MyProfile/AvatarIconListView.swift new file mode 100644 index 00000000..fe77a666 --- /dev/null +++ b/QuickLocation/Section/Mine/MyProfile/AvatarIconListView.swift @@ -0,0 +1,243 @@ +// +// AvatarIconListView.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class AvatarIconListView: UIView { + + var disposeBag = DisposeBag() + + var selectedIndex: Int = 1 { + didSet { + selectedIconView.image = UIImage(named: "UserIcon/\(selectedIndex)") + iconCollectionView.reloadData() + } + } + + private var iconImgList: [UIImage] = [] + + private func setupRx() { + + backBtn.rx.tap.subscribe(onNext: { _ in + AppRouter.shared.popOrDismiss() + }).disposed(by: disposeBag) + } + + private func setupUI() { + addSubview(navBgView) + addSubview(navBarView) + navBarView.addSubview(navTitleLabel) + navBarView.addSubview(backBtn) + navBarView.addSubview(doneBtn) + addSubview(selectedIconView) + addSubview(titleLab) + addSubview(iconCollectionView) + + navBgView.layoutChain + .edges(excludingEdge: .bottom) + .heightToWidth(160/375) + + navBarView.layoutChain + .edges(excludingEdge: .bottom) + .height(kNaviHeight) + + navTitleLabel.layoutChain + .top(kStatusBarHeight + 12) + .centerY(backBtn) + .centerX() + + backBtn.layoutChain + .centerY(navTitleLabel) + .left(15) + .width(24) + .height(24) + + doneBtn.layoutChain + .centerY(navTitleLabel) + .right(15) + + selectedIconView.layoutChain + .topToBottomOfView(navBarView, offset: 30) + .centerX() + .width(80) + .height(80) + + titleLab.layoutChain + .topToBottomOfView(selectedIconView, offset: 39) + .left(40) + + iconCollectionView.layoutChain + .topToBottomOfView(titleLab, offset: 13) + .edgesHorzontal(40) + .bottom(kSafeBottomMargin + 10) + + doneBtn.sizeToFit() + } + + lazy var navBgView: UIImageView = { + let iv = UIImageView() + iv.image = UIImage(named: "Common/navBar_bg_2") + iv.contentMode = .scaleAspectFill + return iv + }() + + lazy var navBarView: UIView = { + let view = UIView() + view.backgroundColor = .clear + return view + }() + + lazy var navTitleLabel: UILabel = { + let label = UILabel() + label.text = "更换图标" + label.font = .systemFont(ofSize: 18, weight: .medium) + label.textColor = ThemeManager.shared.color.titleAuxColor + label.textAlignment = .center + return label + }() + + lazy var backBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setImage(UIImage(named: "Common/back"), for: .normal) + btn.extendEdgeInsets = UIEdgeInsets(top: 54, left: 15, bottom: 100, right: 100) + return btn + }() + + lazy var doneBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setTitle("完成", for: .normal) + btn.setTitleColor(ThemeManager.shared.color.titleAuxColor, for: .normal) + btn.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) + btn.extendEdgeInsets = UIEdgeInsets(top: 54, left: 100, bottom: 100, right: 15) + return btn + }() + + lazy var selectedIconView: UIImageView = { + let view = UIImageView() + view.cornerRadius = 40 + return view + }() + + lazy var titleLab: UILabel = { + let label = UILabel() + label.text = "选择头像" + label.font = .systemFont(ofSize: 16, weight: .bold) + label.textColor = ThemeManager.shared.color.titleAuxColor + return label + }() + + lazy var iconCollectionView: UICollectionView = { + let layout = UICollectionViewFlowLayout() + let cvWidth = kScreenWidth - 80 + let spacing: CGFloat = 18 + let itemW = (cvWidth - spacing * 3) / 4 + layout.itemSize = CGSize(width: itemW, height: itemW) + layout.minimumInteritemSpacing = spacing + layout.minimumLineSpacing = 20 + + let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) + cv.backgroundColor = .clear + cv.isScrollEnabled = false + cv.register(GroupIconCell.self) + cv.delegate = self + cv.dataSource = self + return cv + }() + + override init(frame: CGRect) { + super.init(frame: .zero) + backgroundColor = .white + setupUI() + setupRx() + + for i in 1...15 { + if let img = UIImage(named: "UserIcon/\(i)") { + iconImgList.append(img) + } + } + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +// MARK: - UICollectionViewDelegate, UICollectionViewDataSource +extension AvatarIconListView: UICollectionViewDelegate, UICollectionViewDataSource { + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return iconImgList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(for: indexPath) as GroupIconCell + cell.configure(img: iconImgList[indexPath.row], isSelected: selectedIndex == indexPath.row+1) + return cell + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + selectedIndex = indexPath.row + 1 + } +} + +// MARK: - TagCell +final class AvatarIconCell: UICollectionViewCell { + + func configure(img: UIImage, isSelected: Bool) { + iconImgView.image = img + selectedMaskView.isHidden = !isSelected + selectedIcon.isHidden = !isSelected + } + + private func setupUI() { + contentView.addSubview(iconImgView) + contentView.addSubview(selectedMaskView) + contentView.addSubview(selectedIcon) + + iconImgView.layoutChain.edges() + selectedMaskView.layoutChain.edges() + + selectedIcon.layoutChain + .right(3) + .bottom(4) + } + + lazy var iconImgView: UIImageView = { + let view = UIImageView() + view.backgroundColor = .clear + view.contentMode = .scaleAspectFill + view.cornerRadius = 10 + return view + }() + + lazy var selectedMaskView: UIView = { + let view = UIView() + view.backgroundColor = .black.withAlphaComponent(0.5) + view.cornerRadius = 10 + view.isHidden = true + return view + }() + + lazy var selectedIcon: UIImageView = { + let view = UIImageView() + view.image = UIImage(named: "GroupIcon/selected") + view.isHidden = true + return view + }() + + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/QuickLocation/Section/Mine/MyProfile/MyProfileVC.swift b/QuickLocation/Section/Mine/MyProfile/MyProfileVC.swift new file mode 100644 index 00000000..9726f834 --- /dev/null +++ b/QuickLocation/Section/Mine/MyProfile/MyProfileVC.swift @@ -0,0 +1,109 @@ +// +// MyProfileVC.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class MyProfileVC: BaseViewController { + + fileprivate var rootView: MyProfileView! + + override func loadView() { + rootView = MyProfileView(frame: UIScreen.main.bounds) + view = rootView + } + + private var headPic: Int = AppContextManager.shared.head_pic.integer { + didSet { + self.rootView.avatarImgView.image = UIImage(named: "UserIcon/\(headPic)") + } + } + + private var nickName: String = AppContextManager.shared.name { + didSet { + self.rootView.nickNameLab.text = nickName + } + } + + private var sex: Int = AppContextManager.shared.sex { + didSet { + rootView.maleCheckbox.isSelected = rootView.maleCheckbox.tag == sex + rootView.femaleCheckbox.isSelected = rootView.femaleCheckbox.tag == sex + } + } + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + reactiveAction() + } + + private func reactiveAction() { + // 头像 + rootView.avatarView.rx.tapGesture.subscribe(onNext: { _ in + let vc = AvatarIconListVC(iconIndex: self.headPic.string) + vc.onSelectIcon = { index in + self.requestSetHeadPic(index: index) + } + self.navigationController?.pushViewController(vc, animated: true) + }).disposed(by: disposeBag) + + // 昵称 + rootView.nickNameView.rx.tapGesture.subscribe { _ in + let vc = TextInputViewController(title: "昵称", maxLength: 10, initialText: self.nickName) { text in + self.requestSetNickName(text) + } + self.present(vc, animated: true, completion: nil) + }.disposed(by: disposeBag) + + // 性别 + rootView.maleCheckbox.rx.tap.subscribe(onNext: { [weak self] in + guard let self = self else { return } + self.requestSetGender(1) + }) + .disposed(by: disposeBag) + + rootView.femaleCheckbox.rx.tap.subscribe(onNext: { [weak self] in + guard let self = self else { return } + self.requestSetGender(2) + }) + .disposed(by: disposeBag) + } + + // MARK: - API 设置头像 + private func requestSetHeadPic(index: Int) { + DLToast.showLoading() + UserService.setHeadPic(index: index).subscribe(onNext: { response in + DLToast.show(text: "更换成功") + self.headPic = index + // 通知各页面刷新头像 + NotificationCenter.default.post(name: .RefreshUserConfigNotification, object: nil) + }, onError: { _ in }).disposed(by: disposeBag) + } + + // MARK: - API 设置昵称 + private func requestSetNickName(_ name: String) { + DLToast.showLoading() + UserService.setNickName(nick: name).subscribe(onNext: { response in + DLToast.show(text: "修改成功") + self.nickName = name + + NotificationCenter.default.post(name: .RefreshUserConfigNotification, object: nil) + }, onError: { _ in }).disposed(by: disposeBag) + } + + // MARK: - API 设置性别 + private func requestSetGender(_ sex: Int) { + DLToast.showLoading() + UserService.setGender(sex: sex).subscribe(onNext: { response in + DLToast.show(text: "修改成功") + self.sex = sex + }, onError: { _ in }).disposed(by: disposeBag) + } +} diff --git a/QuickLocation/Section/Mine/MyProfile/MyProfileView.swift b/QuickLocation/Section/Mine/MyProfile/MyProfileView.swift new file mode 100644 index 00000000..4eb9f8f8 --- /dev/null +++ b/QuickLocation/Section/Mine/MyProfile/MyProfileView.swift @@ -0,0 +1,235 @@ +// +// MyProfileView.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class MyProfileView: UIView { + + var disposeBag = DisposeBag() + + private func setupRx() { + + backBtn.rx.tap.subscribe(onNext: { _ in + AppRouter.shared.popOrDismiss() + }).disposed(by: disposeBag) + } + + private func setupUI() { + addSubview(navBgView) + addSubview(navBarView) + navBarView.addSubview(navTitleLabel) + navBarView.addSubview(backBtn) + + addSubview(avatarView) + addSubview(nickNameView) + addSubview(genderView) + + navBgView.layoutChain + .edges(excludingEdge: .bottom) + .heightToWidth(160/375) + + navBarView.layoutChain + .edges(excludingEdge: .bottom) + .height(kNaviHeight) + + navTitleLabel.layoutChain + .top(kStatusBarHeight + 12) + .centerY(backBtn) + .centerX() + + backBtn.layoutChain + .centerY(navTitleLabel) + .left(15) + .width(24) + .height(24) + + avatarView.layoutChain + .topToBottomOfView(navBarView, offset: 30) + .centerX() + + nickNameView.layoutChain + .topToBottomOfView(avatarView, offset: 30) + .edgesHorzontal(15) + .height(60) + + genderView.layoutChain + .topToBottomOfView(nickNameView, offset: 12) + .edgesHorzontal(15) + .height(60) + } + + lazy var navBgView: UIImageView = { + let iv = UIImageView() + iv.image = UIImage(named: "Common/navBar_bg_2") + iv.contentMode = .scaleAspectFill + return iv + }() + + lazy var navBarView: UIView = { + let view = UIView() + view.backgroundColor = .clear + return view + }() + + lazy var navTitleLabel: UILabel = { + let label = UILabel() + label.text = "编辑资料" + label.font = .systemFont(ofSize: 18, weight: .medium) + label.textColor = ThemeManager.shared.color.titleAuxColor + label.textAlignment = .center + return label + }() + + lazy var backBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setImage(UIImage(named: "Common/back"), for: .normal) + btn.extendEdgeInsets = UIEdgeInsets(top: 54, left: 15, bottom: 100, right: 100) + return btn + }() + + lazy var avatarView: UIView = { + let view = UIView() + view.backgroundColor = .clear + view.isUserInteractionEnabled = true + + let label = UILabel() + label.text = "更换头像" + label.textColor = ThemeManager.shared.color.titleAuxColor + label.font = .systemFont(ofSize: 16, weight: .medium) + + view.addSubview(avatarImgView) + view.addSubview(label) + + avatarImgView.layoutChain + .top() + .width(80) + .height(80) + .edgesHorzontal() + + label.layoutChain + .topToBottomOfView(avatarImgView, offset: 12) + .centerX() + .bottom() + + return view + }() + + lazy var avatarImgView: UIImageView = { + let view = UIImageView() + view.cornerRadius = 40 + view.contentMode = .scaleAspectFill + view.image = AppContextManager.shared.avaterIcon + return view + }() + + lazy var nickNameView: UIView = { + let view = UIView() + view.backgroundColor = UIColor(hexStr: "#F5FBFF") + view.cornerRadius = 10 + + let titleLab = UILabel() + titleLab.text = "昵称" + titleLab.font = .systemFont(ofSize: 14, weight: .medium) + titleLab.textColor = UIColor(hexStr: "#1A1A1A") + view.addSubview(titleLab) + titleLab.layoutChain + .left(15) + .centerY() + + let arrow = UIImageView(image: UIImage(named: "Group/arrow")) + view.addSubview(arrow) + arrow.layoutChain + .right(15) + .width(14) + .height(14) + .centerY() + + view.addSubview(nickNameLab) + nickNameLab.layoutChain + .rightToLeftOfView(arrow, offset: -8) + .centerY() + + return view + }() + + lazy var nickNameLab: UILabel = { + let lab = UILabel() + lab.text = AppContextManager.shared.name + lab.font = .systemFont(ofSize: 14, weight: .medium) + lab.textColor = UIColor(hexStr: "#1A1A1A") + return lab + }() + + // 性别 + lazy var genderView: UIView = { + let view = UIView() + view.backgroundColor = UIColor(hexStr: "#F5FBFF") + view.cornerRadius = 10 + + let titleLab = UILabel() + titleLab.text = "性别" + titleLab.font = .systemFont(ofSize: 14, weight: .medium) + titleLab.textColor = UIColor(hexStr: "#1A1A1A") + view.addSubview(titleLab) + titleLab.layoutChain + .left(15) + .centerY() + + view.addSubview(maleCheckbox) + view.addSubview(femaleCheckbox) + + femaleCheckbox.layoutChain + .right() + .edgesVertical() + .width(60) + + maleCheckbox.layoutChain + .rightToLeftOfView(femaleCheckbox) + .edgesVertical() + .width(60) + + return view + }() + + lazy var maleCheckbox: UIButton = { + let btn = UIButton(type: .custom) + btn.setTitle(" 男", for: .normal) + btn.setTitleColor(UIColor(hexStr: "#1A1A1A"), for: .normal) + btn.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium) + btn.setImage(UIImage(named: "Common/checkbox"), for: .normal) + btn.setImage(UIImage(named: "Common/checkbox_on"), for: .selected) + btn.tag = 1 + btn.isSelected = btn.tag == AppContextManager.shared.sex + return btn + }() + + lazy var femaleCheckbox: UIButton = { + let btn = UIButton(type: .custom) + btn.setTitle(" 女", for: .normal) + btn.setTitleColor(UIColor(hexStr: "#1A1A1A"), for: .normal) + btn.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium) + btn.setImage(UIImage(named: "Common/checkbox"), for: .normal) + btn.setImage(UIImage(named: "Common/checkbox_on"), for: .selected) + btn.tag = 2 + btn.isSelected = btn.tag == AppContextManager.shared.sex + return btn + }() + + override init(frame: CGRect) { + super.init(frame: .zero) + backgroundColor = .white + setupUI() + setupRx() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} diff --git a/QuickLocation/Section/Mine/PrivacyPolicy/PrivacyPolicyVC.swift b/QuickLocation/Section/Mine/PrivacyPolicy/PrivacyPolicyVC.swift new file mode 100644 index 00000000..45d074a7 --- /dev/null +++ b/QuickLocation/Section/Mine/PrivacyPolicy/PrivacyPolicyVC.swift @@ -0,0 +1,57 @@ +// +// PrivacyPolicyVC.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa +import RxDataSources + +struct PrivacyPolicyItem { + let name: String + let url: String +} + +class PrivacyPolicyVC: BaseViewController { + + fileprivate var rootView: PrivacyPolicyView! + + override func loadView() { + rootView = PrivacyPolicyView(frame: UIScreen.main.bounds) + view = rootView + } + + private let list: [PrivacyPolicyItem] = [ + PrivacyPolicyItem(name: "用户协议", url: URLManager.shared.userAgreementUrl), + PrivacyPolicyItem(name: "隐私政策", url: URLManager.shared.privacyPolicyUrl), + PrivacyPolicyItem(name: "儿童隐私政策", url: URLManager.shared.kidsPrivacyUrl) + ] + + override func viewDidLoad() { + super.viewDidLoad() + + bindList() + rootView.tableView.layoutChain.height(CGFloat(list.count * 52)) + } + + private func bindList() { + // 绑定数据到 tableView + Observable.just(list) + .bind(to: rootView.tableView.rx.items) { tableView, index, item in + let cell: PrivacyPolicyCell = tableView.dequeueReusableCell(for: IndexPath(row: index, section: 0)) + cell.configure(item) + return cell + } + .disposed(by: disposeBag) + + // 点击跳转 + rootView.tableView.rx.modelSelected(PrivacyPolicyItem.self) + .subscribe(onNext: { item in + AppRouter.push(Route.web, userInfo: ["url": item.url]) + }) + .disposed(by: disposeBag) + } +} diff --git a/QuickLocation/Section/Mine/PrivacyPolicy/PrivacyPolicyView.swift b/QuickLocation/Section/Mine/PrivacyPolicy/PrivacyPolicyView.swift new file mode 100644 index 00000000..b1c5049b --- /dev/null +++ b/QuickLocation/Section/Mine/PrivacyPolicy/PrivacyPolicyView.swift @@ -0,0 +1,185 @@ +// +// PrivacyPolicyView.swift +// QuickLocation +// +// Created by 八条 on 2026/6/11. +// + +import UIKit +import RxSwift +import RxCocoa + +class PrivacyPolicyView: UIView { + + var disposeBag = DisposeBag() + + private func setupRx() { + backBtn.rx.tap.subscribe(onNext: { _ in + AppRouter.shared.popOrDismiss() + }).disposed(by: disposeBag) + } + + private func setupUI() { + addSubview(navBgView) + addSubview(navBarView) + navBarView.addSubview(navTitleLabel) + navBarView.addSubview(backBtn) + + addSubview(infoView) + infoView.addSubview(tableView) + + // 背景图 + navBgView.layoutChain + .edges(excludingEdge: .bottom) + .height(kNaviHeight) + + navBarView.layoutChain + .edges(excludingEdge: .bottom) + .height(kNaviHeight) + + navTitleLabel.layoutChain + .top(kStatusBarHeight + 12) + .centerX() + + backBtn.layoutChain + .centerY(navTitleLabel) + .left(15) + .width(24) + .height(24) + + infoView.layoutChain + .topToBottomOfView(navBarView, offset: 15) + .edgesHorzontal(15) + + // 列表 + tableView.layoutChain + .edges() + } + + lazy var navBgView: UIImageView = { + let iv = UIImageView() + iv.image = UIImage(named: "Common/navBar_bg_2") + iv.contentMode = .scaleAspectFill + return iv + }() + + lazy var navBarView: UIView = { + let view = UIView() + view.backgroundColor = .clear + return view + }() + + lazy var navTitleLabel: UILabel = { + let label = UILabel() + label.text = "隐私与协议" + label.font = .systemFont(ofSize: 18, weight: .medium) + label.textColor = ThemeManager.shared.color.titleAuxColor + label.textAlignment = .center + return label + }() + + lazy var backBtn: UIButton = { + let btn = UIButton(type: .custom) + btn.setImage(UIImage(named: "Common/back"), for: .normal) + btn.extendEdgeInsets = UIEdgeInsets(top: 54, left: 15, bottom: 100, right: 100) + return btn + }() + + lazy var infoView: UIView = { + let view = UIView() + view.backgroundColor = .clear + view.layer.shadowColor = UIColor(hexStr: "#0F2846", alpha: 0.1).cgColor + view.layer.shadowOffset = CGSize(width: 0, height: 0) + view.layer.shadowOpacity = 1 + view.layer.shadowRadius = 10 + return view + }() + + lazy var tableView: UITableView = { + let tableView = UITableView(frame: .zero, style: .plain) + tableView.backgroundColor = .white + tableView.estimatedRowHeight = 52 + tableView.bounces = false + tableView.cornerRadius = 10 + tableView.separatorInset = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15) + tableView.register(PrivacyPolicyCell.self) + return tableView + }() + + override init(frame: CGRect) { + super.init(frame: .zero) + backgroundColor = .white + setupUI() + setupRx() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +// MARK: - PrivacyPolicyCell +class PrivacyPolicyCell: UITableViewCell { + + func configure(_ model: PrivacyPolicyItem) { + nameLab.text = model.name + } + + override init(style: CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + selectionStyle = .none + backgroundColor = .clear + setupSubviews() + } + + private func setupSubviews() { + contentView.addSubview(nameLab) + contentView.addSubview(arrowIcon) + + nameLab.layoutChain + .centerY() + .left(15) + + arrowIcon.layoutChain + .right(15) + .width(14) + .height(14) + .centerY() + } + + lazy var bgView: UIView = { + let view = UIView() + view.backgroundColor = UIColor(hexStr: "#F5FBFF") + view.cornerRadius = 10 + return view + }() + + lazy var nameLab: UILabel = { + let label = UILabel() + label.textColor = ThemeManager.shared.color.titleAuxColor + label.font = .systemFont(ofSize: 14, weight: .medium) + return label + }() + + lazy var arrowIcon: UIImageView = { + let view = UIImageView(image: UIImage(named: "Group/arrow")) + + return view + }() + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + // Configure the view for the selected state + } +} diff --git a/QuickLocation/Service/SystemService.swift b/QuickLocation/Service/SystemService.swift index 1506a9ee..6a7914a1 100644 --- a/QuickLocation/Service/SystemService.swift +++ b/QuickLocation/Service/SystemService.swift @@ -35,4 +35,12 @@ struct SystemService { .map(VipExpenseResponse.self) .asObservable() } + + /// 微信客服 + static func wechatService() -> Observable { + let api = SystemAPI.wechatService.multiTarget + return APIProvider.request(token: api) + .map(ResponseModel.self) + .asObservable() + } } diff --git a/QuickLocation/Service/UserService.swift b/QuickLocation/Service/UserService.swift index a4c55471..2e1659e2 100644 --- a/QuickLocation/Service/UserService.swift +++ b/QuickLocation/Service/UserService.swift @@ -41,6 +41,62 @@ struct UserService { .asObservable() } + /// 更换手机 + static func changePhone(timestamp: String, phone: String, code: String) -> Observable { + let api = UserAPI.changePhone(timestamp: timestamp, phone: phone, code: code).multiTarget + return APIProvider.request(token: api) + .map(ResponseModel.self) + .asObservable() + } + + /// 设置头像 + static func setHeadPic(index: Int) -> Observable { + let api = UserAPI.setHeadPic(index: index).multiTarget + return APIProvider.request(token: api) + .map(ResponseModel.self) + .asObservable() + } + + /// 设置昵称 + static func setNickName(nick: String) -> Observable { + let api = UserAPI.setNickName(nick: nick).multiTarget + return APIProvider.request(token: api) + .map(ResponseModel.self) + .asObservable() + } + + /// 设置性别 + static func setGender(sex: Int) -> Observable { + let api = UserAPI.setGender(sex: sex).multiTarget + return APIProvider.request(token: api) + .map(ResponseModel.self) + .asObservable() + } + + /// 紧急联系人列表 + static func emergencyContactList() -> Observable { + let api = UserAPI.emergencyContact(opType: "get", requestData: [:]).multiTarget + return APIProvider.request(token: api) + .map(EmergencyContactListResponse.self) + .asObservable() + } + + /// 添加紧急联系人 + static func emergencyContactAdd(requestData: [String: Any]) -> Observable { + let api = UserAPI.emergencyContact(opType: "add", requestData: requestData).multiTarget + return APIProvider.request(token: api) + .map(ResponseModel.self) + .asObservable() + } + + /// 删除账号 + static func deleteAccount() -> Observable { + let api = UserAPI.deleteAccount.multiTarget + return APIProvider.request(token: api) + .map(ResponseModel.self) + .asObservable() + } + /// 退出登录 static func logout() -> Observable { let api = UserAPI.logout.multiTarget