diff --git a/LekangGuard.xcodeproj/project.pbxproj b/LekangGuard.xcodeproj/project.pbxproj index fbb22f8..3e6b8ce 100644 --- a/LekangGuard.xcodeproj/project.pbxproj +++ b/LekangGuard.xcodeproj/project.pbxproj @@ -255,6 +255,14 @@ 61AB7ACA28F9478D00EEAF3F /* HomeTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 61AB7AC928F9478D00EEAF3F /* HomeTableViewCell.m */; }; 61AB7ACD28F951EB00EEAF3F /* ZZBadgeButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 61AB7ACB28F951EB00EEAF3F /* ZZBadgeButton.m */; }; 61ABA5602A3BEC3100AAC713 /* FamilyModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 61ABA55F2A3BEC3100AAC713 /* FamilyModel.m */; }; + 61B195882A9844B90083A0C3 /* UIView+Effects.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B195872A9844B90083A0C3 /* UIView+Effects.m */; }; + 61B1958E2A9879600083A0C3 /* MyTableViewHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B1958A2A9879600083A0C3 /* MyTableViewHeaderView.m */; }; + 61B1958F2A9879600083A0C3 /* MyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B1958C2A9879600083A0C3 /* MyTableViewCell.m */; }; + 61B1F7982A95E8F20022E458 /* ProtectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B1F7972A95E8F10022E458 /* ProtectionViewController.m */; }; + 61B1F7A22A95EDC30022E458 /* SLMarqueeControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B1F7A02A95EDC20022E458 /* SLMarqueeControl.m */; }; + 61B1F7AB2A96F2910022E458 /* DeviceSwitchover.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B1F7AA2A96F2910022E458 /* DeviceSwitchover.m */; }; + 61B1F7BA2A972AE10022E458 /* DeviceMsgHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B1F7B92A972AE10022E458 /* DeviceMsgHeaderView.m */; }; + 61B1F7BD2A975E850022E458 /* MapBtnTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B1F7BC2A975E840022E458 /* MapBtnTableViewCell.m */; }; 61B440BD2924E98600BB9EC7 /* BannerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B440BC2924E98600BB9EC7 /* BannerModel.m */; }; 61B440C02925CC7F00BB9EC7 /* FunctionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B440BF2925CC7F00BB9EC7 /* FunctionView.m */; }; 61B440C32925D68900BB9EC7 /* DeviceSetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B440C22925D68900BB9EC7 /* DeviceSetView.m */; }; @@ -937,6 +945,22 @@ 61AB7ACC28F951EB00EEAF3F /* ZZBadgeButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZZBadgeButton.h; sourceTree = ""; }; 61ABA55E2A3BEC3000AAC713 /* FamilyModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FamilyModel.h; sourceTree = ""; }; 61ABA55F2A3BEC3100AAC713 /* FamilyModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FamilyModel.m; sourceTree = ""; }; + 61B195862A9844B90083A0C3 /* UIView+Effects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Effects.h"; sourceTree = ""; }; + 61B195872A9844B90083A0C3 /* UIView+Effects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Effects.m"; sourceTree = ""; }; + 61B1958A2A9879600083A0C3 /* MyTableViewHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyTableViewHeaderView.m; sourceTree = ""; }; + 61B1958B2A9879600083A0C3 /* MyTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyTableViewCell.h; sourceTree = ""; }; + 61B1958C2A9879600083A0C3 /* MyTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyTableViewCell.m; sourceTree = ""; }; + 61B1958D2A9879600083A0C3 /* MyTableViewHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyTableViewHeaderView.h; sourceTree = ""; }; + 61B1F7962A95E8F10022E458 /* ProtectionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProtectionViewController.h; sourceTree = ""; }; + 61B1F7972A95E8F10022E458 /* ProtectionViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProtectionViewController.m; sourceTree = ""; }; + 61B1F7A02A95EDC20022E458 /* SLMarqueeControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SLMarqueeControl.m; sourceTree = ""; }; + 61B1F7A12A95EDC20022E458 /* SLMarqueeControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SLMarqueeControl.h; sourceTree = ""; }; + 61B1F7A92A96F2900022E458 /* DeviceSwitchover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceSwitchover.h; sourceTree = ""; }; + 61B1F7AA2A96F2910022E458 /* DeviceSwitchover.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeviceSwitchover.m; sourceTree = ""; }; + 61B1F7B82A972AE10022E458 /* DeviceMsgHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceMsgHeaderView.h; sourceTree = ""; }; + 61B1F7B92A972AE10022E458 /* DeviceMsgHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DeviceMsgHeaderView.m; sourceTree = ""; }; + 61B1F7BB2A975E840022E458 /* MapBtnTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapBtnTableViewCell.h; sourceTree = ""; }; + 61B1F7BC2A975E840022E458 /* MapBtnTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapBtnTableViewCell.m; sourceTree = ""; }; 61B440BB2924E98600BB9EC7 /* BannerModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BannerModel.h; sourceTree = ""; }; 61B440BC2924E98600BB9EC7 /* BannerModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BannerModel.m; sourceTree = ""; }; 61B440BE2925CC7F00BB9EC7 /* FunctionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FunctionView.h; sourceTree = ""; }; @@ -1346,31 +1370,24 @@ path = LKNotificationSerExtension; sourceTree = ""; }; - 6115514B2A3022F600F451E5 /* TabMessage */ = { + 6115514B2A3022F600F451E5 /* Protection(守护星) */ = { isa = PBXGroup; children = ( 6115514C2A30231600F451E5 /* VC */, 6115514E2A30232C00F451E5 /* View */, 6115514D2A30232300F451E5 /* Model */, ); - path = TabMessage; + path = "Protection(守护星)"; sourceTree = ""; }; 6115514C2A30231600F451E5 /* VC */ = { isa = PBXGroup; children = ( - 6115514F2A30234000F451E5 /* TabMessageViewController.h */, - 611551502A30234000F451E5 /* TabMessageViewController.m */, - 611551552A3060F000F451E5 /* SchAndJobMessageViewController.h */, - 611551562A3060F100F451E5 /* SchAndJobMessageViewController.m */, - 6115516B2A3071A300F451E5 /* CommMessageDetailsViewController.h */, - 6115516C2A3071A300F451E5 /* CommMessageDetailsViewController.m */, - 6172BFFD2A7245A000B3247F /* ReadFlowerViewController.h */, - 6172BFFE2A7245A000B3247F /* ReadFlowerViewController.m */, - 6172C0002A72465B00B3247F /* MyChildViewController.h */, - 6172C0012A72465B00B3247F /* MyChildViewController.m */, - 6172C0032A72467500B3247F /* OtherChildViewController.h */, - 6172C0042A72467500B3247F /* OtherChildViewController.m */, + 61B1F7962A95E8F10022E458 /* ProtectionViewController.h */, + 61B1F7972A95E8F10022E458 /* ProtectionViewController.m */, + 61B1F7A92A96F2900022E458 /* DeviceSwitchover.h */, + 61B1F7AA2A96F2910022E458 /* DeviceSwitchover.m */, + 61B1F7992A95E9C10022E458 /* ms */, ); path = VC; sourceTree = ""; @@ -1395,6 +1412,8 @@ 611551532A30275A00F451E5 /* TabMessageTableViewCell.m */, 611551642A3062BA00F451E5 /* CommMessageTableViewCell.h */, 611551652A3062BA00F451E5 /* CommMessageTableViewCell.m */, + 61B1F7B82A972AE10022E458 /* DeviceMsgHeaderView.h */, + 61B1F7B92A972AE10022E458 /* DeviceMsgHeaderView.m */, ); path = View; sourceTree = ""; @@ -1506,6 +1525,8 @@ 6133631C28E2EB3F00BF4A14 /* Common */ = { isa = PBXGroup; children = ( + 61B195862A9844B90083A0C3 /* UIView+Effects.h */, + 61B195872A9844B90083A0C3 /* UIView+Effects.m */, 61D7AB012987A2B700E982AA /* BairuiUtil */, 61D7AA5F2987A28900E982AA /* QMUIKit */, 61BE9D142963BF2800962512 /* VoiceConvert */, @@ -1636,6 +1657,7 @@ 61D6D3B3296AAF9B0010F59C /* ModifyDataViewController.m */, 61D6D3B0296A938B0010F59C /* DPClearCacheTool.h */, 61D6D3AF296A938A0010F59C /* DPClearCacheTool.m */, + 61B195892A98791D0083A0C3 /* View */, 61D6D3B9296AC1160010F59C /* Model */, ); path = VC; @@ -2167,7 +2189,7 @@ 6133631928E2EAFC00BF4A14 /* Login */, 6133631A28E2EB1D00BF4A14 /* Home */, 6133635E28E2EC3F00BF4A14 /* Map */, - 6115514B2A3022F600F451E5 /* TabMessage */, + 6115514B2A3022F600F451E5 /* Protection(守护星) */, 6133635F28E2EC4B00BF4A14 /* My */, 6175597628DAE1C1008E5954 /* AppDelegate.h */, 6175597728DAE1C1008E5954 /* AppDelegate.m */, @@ -2322,6 +2344,8 @@ 61AB7A9F28F7A36F00EEAF3F /* View */ = { isa = PBXGroup; children = ( + 61B1F7A12A95EDC20022E458 /* SLMarqueeControl.h */, + 61B1F7A02A95EDC20022E458 /* SLMarqueeControl.m */, 61AB7AA028F7A38600EEAF3F /* SelectContactCollectionViewCell.h */, 61AB7AA128F7A38600EEAF3F /* SelectContactCollectionViewCell.m */, 61AB7AC528F9466B00EEAF3F /* HomeHeaderView.h */, @@ -2379,6 +2403,36 @@ path = KJBannerView; sourceTree = ""; }; + 61B195892A98791D0083A0C3 /* View */ = { + isa = PBXGroup; + children = ( + 61B1958B2A9879600083A0C3 /* MyTableViewCell.h */, + 61B1958C2A9879600083A0C3 /* MyTableViewCell.m */, + 61B1958D2A9879600083A0C3 /* MyTableViewHeaderView.h */, + 61B1958A2A9879600083A0C3 /* MyTableViewHeaderView.m */, + ); + path = View; + sourceTree = ""; + }; + 61B1F7992A95E9C10022E458 /* ms */ = { + isa = PBXGroup; + children = ( + 6115514F2A30234000F451E5 /* TabMessageViewController.h */, + 611551502A30234000F451E5 /* TabMessageViewController.m */, + 611551552A3060F000F451E5 /* SchAndJobMessageViewController.h */, + 611551562A3060F100F451E5 /* SchAndJobMessageViewController.m */, + 6115516B2A3071A300F451E5 /* CommMessageDetailsViewController.h */, + 6115516C2A3071A300F451E5 /* CommMessageDetailsViewController.m */, + 6172BFFD2A7245A000B3247F /* ReadFlowerViewController.h */, + 6172BFFE2A7245A000B3247F /* ReadFlowerViewController.m */, + 6172C0002A72465B00B3247F /* MyChildViewController.h */, + 6172C0012A72465B00B3247F /* MyChildViewController.m */, + 6172C0032A72467500B3247F /* OtherChildViewController.h */, + 6172C0042A72467500B3247F /* OtherChildViewController.m */, + ); + path = ms; + sourceTree = ""; + }; 61B440CA2927254C00BB9EC7 /* View */ = { isa = PBXGroup; children = ( @@ -2388,6 +2442,8 @@ 61B440CF292725A400BB9EC7 /* GoogleMapView.m */, 61B440D72927655600BB9EC7 /* MapMessageView.h */, 61B440D82927655600BB9EC7 /* MapMessageView.m */, + 61B1F7BB2A975E840022E458 /* MapBtnTableViewCell.h */, + 61B1F7BC2A975E840022E458 /* MapBtnTableViewCell.m */, 61B440D42927637100BB9EC7 /* CustomAnnotationView.h */, 61B440D22927637100BB9EC7 /* CustomAnnotationView.m */, 61B440D12927637000BB9EC7 /* UserAnnotationView.h */, @@ -3538,6 +3594,9 @@ 613363A828F2A5F100BF4A14 /* EmailLoginViewController.m in Sources */, 61D7AAE32987A28900E982AA /* UILabel+QMUI.m in Sources */, 61CA2BE8293DEF2500605022 /* AlarmModel.m in Sources */, + 61B1F7A22A95EDC30022E458 /* SLMarqueeControl.m in Sources */, + 61B1958E2A9879600083A0C3 /* MyTableViewHeaderView.m in Sources */, + 61B1F7BD2A975E850022E458 /* MapBtnTableViewCell.m in Sources */, 61CA2BD32935A34300605022 /* PPAddressBookHandle.m in Sources */, 61D7AAE12987A28900E982AA /* UICollectionView+QMUI.m in Sources */, 618E9D742947173F0038735F /* AddRailViewController.m in Sources */, @@ -3573,6 +3632,7 @@ 614F0D21296571F0007A912A /* UIImage+Resize.m in Sources */, 61D7AADC2987A28900E982AA /* UIControl+QMUI.m in Sources */, 6172C0082A72485B00B3247F /* RedFlowerModel.m in Sources */, + 61B1F7AB2A96F2910022E458 /* DeviceSwitchover.m in Sources */, 6172C0052A72467500B3247F /* OtherChildViewController.m in Sources */, 614F0D08296571F0007A912A /* XHMessageTextView.m in Sources */, 61D7AAD92987A28900E982AA /* UINavigationBar+QMUI.m in Sources */, @@ -3599,6 +3659,7 @@ 6133635328E2EB7800BF4A14 /* NSTimer+YYAdd.m in Sources */, 61BE99B3295D686100962512 /* SystermModel.m in Sources */, 614F0D03296571F0007A912A /* XHEmotionCollectionViewFlowLayout.m in Sources */, + 61B1F7BA2A972AE10022E458 /* DeviceMsgHeaderView.m in Sources */, 614F0CFD296571F0007A912A /* XHMessageTableViewController.m in Sources */, 61BE9D132963BED500962512 /* CJFileUtility.m in Sources */, 61AB7AA228F7A38600EEAF3F /* SelectContactCollectionViewCell.m in Sources */, @@ -3681,6 +3742,7 @@ 614F0CF2296571F0007A912A /* XHLocationHelper.m in Sources */, 61D7AAE22987A28900E982AA /* UITraitCollection+QMUI.m in Sources */, 61D478CC295C3371002FC2D4 /* DLUtility.m in Sources */, + 61B195882A9844B90083A0C3 /* UIView+Effects.m in Sources */, 6133637328E2ECD200BF4A14 /* TabBarViewController.m in Sources */, 61B440D52927637100BB9EC7 /* CustomAnnotationView.m in Sources */, 61D7AAFC2987A28900E982AA /* UINavigationController+QMUI.m in Sources */, @@ -3733,6 +3795,7 @@ 61AB7AA628F81B1400EEAF3F /* ScanCodeModel.m in Sources */, 6133636328E2EC8E00BF4A14 /* MyViewController.m in Sources */, 614F0D0F296571F0007A912A /* SETextGeometry.m in Sources */, + 61B1958F2A9879600083A0C3 /* MyTableViewCell.m in Sources */, 6133634C28E2EB7800BF4A14 /* NSArray+YYAdd.m in Sources */, 618E9DA2294AADE50038735F /* TrackInfoModel.m in Sources */, 61AB7AC028F9463800EEAF3F /* KJBannerTool.m in Sources */, @@ -3825,6 +3888,7 @@ 61A0967B28F402DC00421957 /* LoginModel.m in Sources */, 61D7AAF62987A28900E982AA /* UIFont+QMUI.m in Sources */, 614F0CFC296571F0007A912A /* XHDisplayTextViewController.m in Sources */, + 61B1F7982A95E8F20022E458 /* ProtectionViewController.m in Sources */, 61D7AAF32987A28900E982AA /* UITableViewCell+QMUI.m in Sources */, 61AB7ABE28F9463800EEAF3F /* KJLoadImageView.m in Sources */, 61D7AA5329875F4400E982AA /* ACBaseViewController.m in Sources */, diff --git a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate index 8e23a40..ad6edc3 100644 Binary files a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate and b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 257c69d..c7e3554 100644 --- a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -407,38 +407,6 @@ - - - - - - - - + +typedef UIView *(^ConrnerCorner) (UIRectCorner corner ); +typedef UIView *(^ConrnerRadius) (CGFloat radius ); + +typedef UIView *(^BorderColor ) (UIColor *color ); +typedef UIView *(^BorderWidth ) (CGFloat width ); + +typedef UIView *(^ShadowColor ) (UIColor *color ); +typedef UIView *(^ShadowOffset ) (CGSize size ); +typedef UIView *(^ShadowRadius ) (CGFloat radius ); +typedef UIView *(^ShadowOpacity) (CGFloat opacity); + +typedef UIView *(^BezierPath) (UIBezierPath *path ); +typedef UIView *(^ViewBounds) (CGRect rect ); + +typedef UIView *(^ShowVisual) (void); +typedef UIView *(^ClerVisual) (void); + +/** + 注意:在设置圆角和阴影时会去获取视图控件的bounds,所以在视图控件的bounds变化后,需要重新设置 + */ +@interface UIView (Effects) + +// 圆角 +@property(nonatomic, strong, readonly)ConrnerCorner conrnerCorner; // UIRectCorner 默认 UIRectCornerAllCorners +@property(nonatomic, strong, readonly)ConrnerRadius conrnerRadius; // 圆角半径 默认 0.0 + +// 边框 +@property(nonatomic, strong, readonly)BorderColor borderColor; // 边框颜色 默认 black +@property(nonatomic, strong, readonly)BorderWidth borderWidth; // 边框宽度 默认 0.0 + +// 阴影 +@property(nonatomic, strong, readonly)ShadowColor shadowColor; // 阴影颜色 默认 black +@property(nonatomic, strong, readonly)ShadowOffset shadowOffset; // 阴影偏移方向和距离 默认 {0.0,0.0} +@property(nonatomic, strong, readonly)ShadowRadius shadowRadius; // 阴影模糊度 默认 0.0 +@property(nonatomic, strong, readonly)ShadowOpacity shadowOpacity; // (0~1] 默认 0.0 + +// 路径 +@property(nonatomic, strong, readonly)BezierPath bezierPath; // 贝塞尔路径 默认 nil (有值时,radius属性将失效) +@property(nonatomic, strong, readonly)ViewBounds viewBounds; // 设置圆角时,会去获取视图的bounds属性,如果此时获取不到,则需要传入该参数,默认为 nil,如果传入该参数,则不会去回去视图的bounds属性了 + +// 调用 +@property(nonatomic, strong, readonly)ShowVisual showVisual; // 展示 +@property(nonatomic, strong, readonly)ClerVisual clerVisual; // 隐藏 + +@end diff --git a/LekangGuard/Common/UIView+Effects.m b/LekangGuard/Common/UIView+Effects.m new file mode 100644 index 0000000..9e9c78c --- /dev/null +++ b/LekangGuard/Common/UIView+Effects.m @@ -0,0 +1,391 @@ +// +// UIView+Effects.m +// CCViewEffects +// +// Created by 佰道聚合 on 2017/9/8. +// Copyright © 2017年 cyd. All rights reserved. +// + +#import "UIView+Effects.h" +#import + +#define kConrnerCorner "UIView.privateConrnerCorner" +#define kConrnerBounds "UIView.privateConrnerBounds" +#define kConrnerRadius "UIView.privateConrnerRadius" + +#define kBorderColor "UIView.privateBorderColor" +#define kBorderWidth "UIView.privateBorderWidth" + +#define kShadowOpacity "UIView.privateShadowOpacity" +#define kShadowRadius "UIView.privateShadowRadius" +#define kShadowOffset "UIView.privateShadowOffset" +#define kShadowColor "UIView.privateShadowColor" + +#define kBezierPath "UIView.privateBezierPath" +#define kViewBounds "UIView.privateViewBounds" + +#define kBackgroundView "UIView.BackgroundView" + +@implementation UIView (Effects) +@dynamic conrnerCorner, + conrnerRadius, + borderColor, + borderWidth, + shadowColor, + shadowOffset, + shadowRadius, + shadowOpacity, + showVisual, + clerVisual, + bezierPath, + viewBounds; + +#pragma mark - 添加私有属性 +// mark - 圆角 矩形 默认 AllCorners +- (void)setPrivateConrnerCorner:(UIRectCorner)corner { + objc_setAssociatedObject(self, kConrnerCorner, [NSNumber numberWithInteger:corner], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIRectCorner)privateConrnerCorner { + id corner = objc_getAssociatedObject(self, kConrnerCorner); + return corner ? [corner integerValue] : UIRectCornerAllCorners; +} + +// mark - 圆角 半径 默认 0.0 +- (void)setPrivateConrnerRadius:(CGFloat)radius { + objc_setAssociatedObject(self, kConrnerRadius, [NSNumber numberWithFloat:radius], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGFloat)privateConrnerRadius { + id radius = objc_getAssociatedObject(self, kConrnerRadius); + return radius ? [radius floatValue] : 0.0; +} + +// mark - 边框 宽度 默认 0.0 +- (void)setPrivateBorderWidth:(CGFloat)width { + objc_setAssociatedObject(self, kBorderWidth, [NSNumber numberWithFloat:width], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGFloat)privateBorderWidth { + id width = objc_getAssociatedObject(self, kBorderWidth); + return width ? [width floatValue] : 0.0; +} + +// mark - 边框 颜色 默认 黑色 +- (void)setPrivateBorderColor:(UIColor *)color { + objc_setAssociatedObject(self, kBorderColor, color, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIColor *)privateBorderColor { + id color = objc_getAssociatedObject(self, kBorderColor); + return color ? color : [UIColor blackColor]; +} + +// mark - 阴影 半径 默认 0.0 +- (void)setPrivateShadowRadius:(CGFloat)opacity { + objc_setAssociatedObject(self, kShadowOpacity, [NSNumber numberWithFloat:opacity], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGFloat)privateShadowRadius { + id radius = objc_getAssociatedObject(self, kShadowOpacity); + return radius ? [radius floatValue] : 0.0; +} + +// mark - 阴影 模糊度 默认 0.0 +- (void)setPrivateShadowOpacity:(CGFloat)radius { + objc_setAssociatedObject(self, kShadowRadius, [NSNumber numberWithFloat:radius], OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGFloat)privateShadowOpacity { + id opacity = objc_getAssociatedObject(self, kShadowRadius); + return opacity ? [opacity floatValue] : 0.0; +} + +// mark - 阴影 偏移方向和距离 默认 {0.0,0.0} +- (void)setPrivateShadowOffset:(CGSize)offset { + objc_setAssociatedObject(self, kShadowOffset, NSStringFromCGSize(offset), OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGSize)privateShadowOffset { + id offset = objc_getAssociatedObject(self, kShadowOffset); + return offset ? CGSizeFromString(offset) : CGSizeZero; +} + +// mark - 阴影 颜色 默认 black +- (void)setPrivateShadowColor:(UIColor *)color { + objc_setAssociatedObject(self, kShadowColor, color, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIColor *)privateShadowColor { + id color = objc_getAssociatedObject(self, kShadowColor); + return color ? color : [UIColor blackColor]; +} + +// mark - 路径 默认 nil +- (void)setPrivateBezierPath:(UIBezierPath *)path { + objc_setAssociatedObject(self, kBezierPath, path, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (UIBezierPath *)privateBezierPath { + id path = objc_getAssociatedObject(self, kBezierPath); + return path ? path : nil; +} + +// mark - 视图 大小 默认 nil +- (void)setPrivateViewBounds:(CGRect)rect { + objc_setAssociatedObject(self, kViewBounds, NSStringFromCGRect(rect), OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (CGRect)privateViewBounds { + id path = objc_getAssociatedObject(self, kViewBounds); + return path ? CGRectFromString(path) : CGRectZero; +} + +// 阴影空视图,只在有圆角的时候使用 +- (UIView *)shadowBackgroundView { + return objc_getAssociatedObject(self, kBackgroundView); +} + +- (void)setShadowBackgroundView:(UIView *)backgroundView { + objc_setAssociatedObject(self, kBackgroundView, backgroundView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - 链式属性实现 +- (ConrnerCorner)conrnerCorner { + return ^(UIRectCorner corner) { + self.privateConrnerCorner = corner; + return self; + }; +} + +- (ConrnerRadius)conrnerRadius { + return ^(CGFloat radius) { + self.privateConrnerRadius = radius; + return self; + }; +} + +- (BorderColor)borderColor { + return ^(UIColor *color) { + self.privateBorderColor = color; + return self; + }; +} + +- (BorderWidth)borderWidth { + return ^(CGFloat width) { + self.privateBorderWidth = width; + return self; + }; +} + +- (ShadowOpacity)shadowOpacity { + return ^(CGFloat opacity) { + self.privateShadowOpacity = opacity; + return self; + }; +} + +- (ShadowRadius)shadowRadius { + return ^(CGFloat radius) { + self.privateShadowRadius = radius; + return self; + }; +} + +- (ShadowOffset)shadowOffset { + return ^(CGSize size) { + self.privateShadowOffset = size; + return self; + }; +} + +- (ShadowColor)shadowColor { + return ^(UIColor *color) { + self.privateShadowColor = color; + return self; + }; +} + +- (BezierPath)bezierPath { + return ^(UIBezierPath *path) { + self.privateBezierPath = path; + return self; + }; +} + +- (ViewBounds)viewBounds { + return ^(CGRect rect) { + self.privateViewBounds = rect; + return self; + }; +} + +#pragma mark - 方法实现 +- (ClerVisual)clerVisual { + return ^{ + // 阴影 + if (self.shadowBackgroundView) { + [self.shadowBackgroundView removeFromSuperview]; + self.shadowBackgroundView = nil; + } + + // 圆角、边框 + for (CALayer *layer in self.layer.sublayers) { + if ([layer.name isEqualToString:@"CCViewEffects"]) { + [layer removeFromSuperlayer]; + } + } + + // 恢复默认设置 + self.privateConrnerCorner = UIRectCornerAllCorners; + self.privateConrnerRadius = 0.0; + self.privateBorderColor = [UIColor blackColor]; + self.privateBorderWidth = 0.0; + self.privateShadowOpacity = 0.0; + self.privateShadowRadius = 0.0; + self.privateShadowOffset = CGSizeZero; + self.privateViewBounds = CGRectZero; + self.privateShadowColor = [UIColor blackColor]; + self.shadowBackgroundView = nil; + + self.layer.masksToBounds = NO; + self.layer.cornerRadius = 0.0; + self.layer.borderWidth = 0.0; + self.layer.borderColor = [UIColor blackColor].CGColor; + self.layer.shadowOpacity = 0.0; + self.layer.shadowPath = nil; + self.layer.shadowRadius = 0.0; + self.layer.shadowColor = [UIColor blackColor].CGColor; + self.layer.shadowOffset = CGSizeZero; + self.layer.mask = nil; + return self; + }; +} + +- (ShowVisual)showVisual { + return ^{ + // 阴影 + [self addShadow]; + // 边框、圆角 + [self addBorderAndRadius]; + return self; + }; +} + +#pragma mark - Private methods +-(CGRect)drawBounds { + // 1.如果传入了大小,则直接返回 + if (!CGRectEqualToRect(self.privateViewBounds, CGRectZero)) { + return self.privateViewBounds; + } + // 2.获取在自动布局时的视图大小 + if (self.superview != nil) { + [self.superview layoutIfNeeded]; + } + return self.bounds; +} + +-(UIBezierPath *)drawBezierPath { + if (self.privateBezierPath != nil) { + return self.privateBezierPath; + } + return [UIBezierPath bezierPathWithRoundedRect:[self drawBounds] + byRoundingCorners:self.privateConrnerCorner + cornerRadii:CGSizeMake(self.privateConrnerRadius, self.privateConrnerRadius)]; +} + +// 添加阴影 +-(void)addShadow { + UIView *shadowView = self; + // 同时存在阴影和圆角 + if ((self.privateShadowOpacity > 0 && self.privateConrnerRadius > 0) || self.privateBezierPath) { + if (self.shadowBackgroundView) { + [self.shadowBackgroundView removeFromSuperview]; + self.shadowBackgroundView = nil; + } + NSAssert(self.superview, @"添加阴影和圆角时,请先将view加到父视图上"); + shadowView = [[UIView alloc] initWithFrame:self.frame]; + shadowView.translatesAutoresizingMaskIntoConstraints = NO; + [self.superview insertSubview:shadowView belowSubview:self]; + [self.superview addConstraints:@[[NSLayoutConstraint constraintWithItem:shadowView + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeTop + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:shadowView + attribute:NSLayoutAttributeLeft + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeLeft + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:shadowView + attribute:NSLayoutAttributeRight + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeRight + multiplier:1.0 + constant:0], + [NSLayoutConstraint constraintWithItem:shadowView + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0]]]; + self.shadowBackgroundView = shadowView; + } + // 圆角 + if (self.privateConrnerRadius > 0 || self.privateBezierPath) { + UIBezierPath *shadowPath = [self drawBezierPath]; + shadowView.layer.shadowPath = shadowPath.CGPath; + } + // 阴影 + shadowView.layer.masksToBounds = NO; + shadowView.layer.shadowOpacity = self.privateShadowOpacity; + shadowView.layer.shadowRadius = self.privateShadowRadius; + shadowView.layer.shadowOffset = self.privateShadowOffset; + shadowView.layer.shadowColor = self.privateShadowColor.CGColor; +} + +// 添加圆角和边框 +-(void)addBorderAndRadius { + // 圆角或阴影或自定义曲线 + if (self.privateConrnerRadius > 0 || self.privateShadowOpacity > 0 || self.privateBezierPath) { + // 圆角 + if (self.privateConrnerRadius > 0 || self.privateBezierPath) { + UIBezierPath *path = [self drawBezierPath]; + CAShapeLayer *maskLayer = [CAShapeLayer layer]; + maskLayer.frame = self.bounds; + maskLayer.path = path.CGPath; + self.layer.mask = maskLayer; + } + // 边框 + if (self.privateBorderWidth > 0 || self.privateBezierPath) { + for (CALayer *layer in self.layer.sublayers) { + if ([layer.name isEqualToString:@"CCViewEffects"]) { + [layer removeFromSuperlayer]; + } + } + UIBezierPath *path = [self drawBezierPath]; + CAShapeLayer *layer = [[CAShapeLayer alloc]init]; + layer.name = @"CCViewEffects"; + layer.frame = self.bounds; + layer.path = path.CGPath; + layer.lineWidth = self.privateBorderWidth; + layer.strokeColor = self.privateBorderColor.CGColor; + layer.fillColor = [UIColor clearColor].CGColor; + [self.layer addSublayer:layer]; + } + } else { + // 只有边框 + self.layer.masksToBounds = true; + self.layer.borderWidth = self.privateBorderWidth; + self.layer.borderColor = self.privateBorderColor.CGColor; + } +} + +@end diff --git a/LekangGuard/Common/YBPopupMenu/YBPopupMenu/YBPopupMenu.m b/LekangGuard/Common/YBPopupMenu/YBPopupMenu/YBPopupMenu.m index 60e4285..68978d4 100644 --- a/LekangGuard/Common/YBPopupMenu/YBPopupMenu/YBPopupMenu.m +++ b/LekangGuard/Common/YBPopupMenu/YBPopupMenu/YBPopupMenu.m @@ -235,7 +235,7 @@ UITableViewDataSource if(_images){ if (_images.count >= indexPath.row + 1) { if ([_images[indexPath.row] isKindOfClass:[NSString class]]) { - [cell.headerImageView sd_setImageWithURL:[NSURL URLWithString:_images[indexPath.row]] placeholderImage:[UIImage imageNamed:_images[indexPath.row]]]; + [cell.headerImageView sd_setImageWithURL:[NSURL URLWithString:_images[indexPath.row]] placeholderImage:[UIImage imageNamed:@"icon_home_head"]]; //cell.headerImageView.image = [UIImage imageNamed:_images[indexPath.row]]; }else if ([_images[indexPath.row] isKindOfClass:[UIImage class]]){ cell.headerImageView.image = _images[indexPath.row]; diff --git a/LekangGuard/Common/tabBar/TabBarViewController.m b/LekangGuard/Common/tabBar/TabBarViewController.m index 58e5de3..21b64c7 100644 --- a/LekangGuard/Common/tabBar/TabBarViewController.m +++ b/LekangGuard/Common/tabBar/TabBarViewController.m @@ -11,7 +11,7 @@ #import "AppDelegate.h" #import "ScanCodeViewController.h" #import "JCManager.h" -#import "TabMessageViewController.h" +#import "ProtectionViewController.h" @interface TabBarViewController () @@ -73,17 +73,17 @@ { ZXNavigationBarNavigationController *homeVC = [[ZXNavigationBarNavigationController alloc] initWithRootViewController:[HomeViewController new]]; + + ZXNavigationBarNavigationController *msgVC = [[ZXNavigationBarNavigationController alloc] initWithRootViewController:[ProtectionViewController new]]; ZXNavigationBarNavigationController *mapVC = [[ZXNavigationBarNavigationController alloc] initWithRootViewController:[MapViewController new]]; - - ZXNavigationBarNavigationController *msgVC = [[ZXNavigationBarNavigationController alloc] initWithRootViewController:[TabMessageViewController new]]; ZXNavigationBarNavigationController *myVC = [[ZXNavigationBarNavigationController alloc] initWithRootViewController:[MyViewController new]]; self.viewControllers = @[homeVC, - mapVC, msgVC, + mapVC, myVC]; self.tabBar.tintColor = KKMainColor; @@ -92,18 +92,18 @@ - (void)addTabarItems { NSArray *titleNames = @[GJText(@"首页"), + GJText(@"守护星"), GJText(@"定位"), - GJText(@"消息"), GJText(@"我的")]; NSArray *normalImages = @[@"tabBar_home_normal", + @"tabBar_protection_normal", @"tabBar_map_normal", - @"tabBar_msg_normal", @"tabBar_my_normal"]; NSArray *selectedImages = @[@"tabBar_home_selected", + @"tabBar_protection_selected", @"tabBar_map_selected", - @"tabBar_msg_selected", @"tabBar_my_selected"]; //SNJJSELF diff --git a/LekangGuard/Home/Family(亲情号)/AddFamilyNumberViewController.m b/LekangGuard/Home/Family(亲情号)/AddFamilyNumberViewController.m index ea777ef..91c9dd2 100644 --- a/LekangGuard/Home/Family(亲情号)/AddFamilyNumberViewController.m +++ b/LekangGuard/Home/Family(亲情号)/AddFamilyNumberViewController.m @@ -10,7 +10,7 @@ @interface AddFamilyNumberViewController () -@property (nonatomic ,weak) UIView *bgView; +@property (nonatomic ,weak) UILabel *titleLabel; @property (nonatomic ,weak) UIView *bgView1; @property (nonatomic ,weak) UIButton *typeBtn; @@ -26,6 +26,7 @@ @property (nonatomic ,strong) NSString *typeStr; + @end @implementation AddFamilyNumberViewController @@ -34,7 +35,6 @@ [super viewDidLoad]; self.typeStr = @""; // Do any additional setup after loading the view. - self.view.backgroundColor = KKWhiteColorColor; self.zx_navTitle = self.isRedact == 1 ? GJText(@"添加亲情号") : GJText(@"修改亲情号"); [self zx_setRightBtnWithText:GJText(@"保存") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) { [UICommon resignKeyboard]; @@ -42,44 +42,68 @@ [self setFamilyDataModel]; }]; - for (int i = 0; i < 2; i++) + UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKClearColor]; + bgView.frame = CGRectMake(10, iPhoneX_NavHeight+10, SCREEN_WIDTH-20, 180); + [self.view addSubview:bgView]; + + for (int i = 0; i < 3; i++) { - UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKLineColor cornerRadius:5 borderWidth:0 borderColor:KKClearColor]; - bgView.frame = CGRectMake(15, iPhoneX_NavHeight+30+Adapted(50)*i+i*15, SCREEN_WIDTH, Adapted(50)); - if (i == 1) - self.bgView = bgView; - [self.view addSubview:bgView]; -// [bgView mas_makeConstraints:^(MASConstraintMaker *make) { -// make.left.right.equalTo(self.view).inset(15); -// make.top.equalTo(self.view).offset(iPhoneX_NavHeight+30+Adapted(50)*i+i*15); -// make.height.mas_equalTo(Adapted(50)); -// }]; - - UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(14) textColor:KKTextBlackColor text:i == 0 ? GJText(@"联系人") : GJText(@"电话号码") Radius:0]; + UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontBoldADA_(14) textColor:KKMainColor text:i == 0 ? GJText(@"关系:") : i == 1 ? GJText(@"电话:") : @"拨号快捷键:" Radius:0]; + titleLabel.frame = CGRectMake(15, i*55, 100, i == 2 ? 65 : 55); [bgView addSubview:titleLabel]; - [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(bgView).offset(15); - make.centerY.equalTo(bgView); - }]; +// [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// make.left.equalTo(bgView).offset(15); +// make.top.equalTo(bgView).offset(i*55); +// make.height.mas_equalTo(i == 2 ? 65 : 55); +// }]; + if (i == 2) + self.titleLabel = titleLabel; - UITextField *textfield = [UICommon ui_textField:CGRectZero textColor:KKTextBlackColor backColor:KKClearColor font:FontADA_(14) maxTextNum:13 placeholderColor:KKGrey143 placeholder:i == 0 ? GJText(@"请输入联系人") : GJText(@"请输入电话号码") toMaxNum:^(UITextField *textField) { - - } change:^(UITextField *textField) { - self.typeBtn.selected = NO; - [self dismiss11]; - }]; - if (i == 0) self.nameField = textfield; - else self.phoneField = textfield; - [bgView addSubview:textfield]; - [textfield mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(bgView.mas_right).inset(15); - make.left.equalTo(bgView).offset(100); - make.centerY.equalTo(bgView); - make.height.mas_equalTo(Adapted(44)); - }]; + if (i < 2) + { + UITextField *textfield = [UICommon ui_textField:CGRectZero textColor:KKTextBlackColor backColor:KKClearColor font:FontADA_(14) maxTextNum:13 placeholderColor:KKGrey133 placeholder:i == 0 ? GJText(@"请输入与孩子的关系") : GJText(@"请输入或从通讯录导入") toMaxNum:^(UITextField *textField) { + + } change:^(UITextField *textField) { + self.typeBtn.selected = NO; + [self dismiss11]; + }]; + if (i == 0) self.nameField = textfield; + else self.phoneField = textfield; + [bgView addSubview:textfield]; + [textfield mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(bgView.mas_right).inset(i == 0 ? 28 : 53); + make.left.equalTo(bgView).offset(61); + make.centerY.equalTo(titleLabel); + make.height.mas_equalTo(Adapted(44)); + }]; + + UILabel *line = [UILabel new]; + line.backgroundColor = i == 0 ? KKMainColor : KKLineColor; + [bgView addSubview:line]; + [line mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(titleLabel.mas_bottom); + make.left.equalTo(bgView).offset(61); + make.right.equalTo(bgView.mas_right).inset(28); + make.height.mas_equalTo(0.5); + }]; + + if (i == 1) + { + UIButton *tongBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(0) normalColor:KKWhiteColorColor normalText:@"" click:^(id x) { + + }]; + [tongBtn setImage:ImageName_(@"icon_contacts") forState:0]; + [bgView addSubview:tongBtn]; + [tongBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(bgView.mas_right).inset(28); + make.centerY.equalTo(titleLabel); + make.size.mas_equalTo(CGSizeMake(15, 17)); + }]; + } + } } - UIButton *typeBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(14) normalColor:KKWhiteColorColor normalText:GJText(@"选择快捷键") click:^(UIButton *btn) { + UIButton *typeBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(14) normalColor:KKTextBlackColor normalText:GJText(@"快捷键") click:^(UIButton *btn) { [UICommon resignKeyboard]; self.typeBtn.selected = !self.typeBtn.selected; if (self.typeBtn.selected) @@ -87,59 +111,58 @@ else [self dismiss11]; }]; - typeBtn.frame = CGRectMake(100, self.bgView.bottom+20, SCREEN_WIDTH-115, Adapted(40)); - typeBtn.backgroundColor = KKMainColor; - typeBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; - [typeBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 15, 0, 0)]; + [typeBtn setImage:ImageName_(@"icon_arrow_down") forState:0]; + [typeBtn setImage:ImageName_(@"icon_arrow_up") forState:UIControlStateSelected]; + [self setButtonsTi:typeBtn]; self.typeBtn = typeBtn; [self.view addSubview:typeBtn]; -// [typeBtn mas_makeConstraints:^(MASConstraintMaker *make) { -// make.left.equalTo(self.view).offset(100); -// make.right.equalTo(self.view).inset(15); -// make.top.equalTo(self.bgView.mas_bottom).offset(20); -// make.height.mas_equalTo(Adapted(40)); -// }]; - - UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(14) textColor:KKTextBlackColor text:GJText(@"快捷键") Radius:0]; - [self.view addSubview:titleLabel]; - [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.view).offset(30); - make.centerY.equalTo(typeBtn); + [typeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(bgView).offset(150); + make.right.equalTo(bgView.mas_right).inset(10); + make.centerY.equalTo(self.titleLabel.mas_centerY); + make.height.mas_equalTo(50); }]; + + - NSArray *titleArr = @[@"1",@"2",@"3",@"4"]; + NSArray *titleArr = @[@"快捷键 1",@"快捷键 2",@"快捷键 3",@"快捷键 4"]; - UIView *bgView1 = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:0 borderWidth:0 borderColor:KKClearColor]; - bgView1.frame = CGRectMake(100, typeBtn.bottom+3, typeBtn.width, 0); + UIView *bgView1 = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:8 borderWidth:0 borderColor:KKClearColor]; + bgView1.frame = CGRectMake(120, bgView.bottom-20, 118, 0); self.bgView1 = bgView1; [self.view addSubview:bgView1]; -// [bgView1 mas_makeConstraints:^(MASConstraintMaker *make) { -// make.left.equalTo(typeBtn.mas_left); -// make.right.equalTo(typeBtn.mas_right); -// make.top.equalTo(typeBtn.mas_bottom).offset(3); -// make.height.mas_equalTo(titleArr.count*Adapted(30)+(titleArr.count-1)*3); -// }]; self.btnArr = [NSMutableArray new]; for (int i = 0; i< titleArr.count; i++) { - UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(14) normalColor:KKWhiteColorColor normalText:titleArr[i] click:^(UIButton *btn) { + UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(14) normalColor:KKTextBlackColor normalText:titleArr[i] click:^(UIButton *btn) { [self dismiss11]; + self.typeBtn.selected = NO; self.typeStr = F(@"%ld", btn.tag); - [self.typeBtn setTitle:F(@"快捷键:%ld", btn.tag) forState:0]; + [self.typeBtn setTitle:F(@"快捷键 %ld", btn.tag) forState:0]; + [self setButtonsTi:self.typeBtn]; }]; btn.hidden = YES; - btn.backgroundColor = KKMainColor; - btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; - [btn setTitleEdgeInsets:UIEdgeInsetsMake(0, 15, 0, 0)]; btn.tag = i+1; [bgView1 addSubview:btn]; [btn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(bgView1); - make.top.equalTo(bgView1).offset(Adapted(30)*i+i*1); - make.height.mas_equalTo(Adapted(30)); + make.top.equalTo(bgView1).offset(Adapted(40)*i+i*1); + make.height.mas_equalTo(Adapted(40)); }]; [self.btnArr addObject:btn]; + + if (i -@property (nonatomic ,strong) NSMutableArray *menuTitles; -@property (nonatomic ,strong) NSMutableArray *menuIcons; - @property (nonatomic ,strong) CommonTableView *homeTable; @property (nonatomic ,strong) HomeHeaderView *headerView; @@ -32,13 +29,17 @@ @property (nonatomic ,strong) LatestLocationModel *laloModel; + @end @implementation HomeViewController - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view. + + self.zx_navStatusBarStyle = ZXNavStatusBarStyleDefault; + self.zx_navLeftBtn.titleLabel.font = FontBoldADA_(18); + [self.zx_navLeftBtn setTitleColor:KKWhiteColorColor forState:0]; UIImageView *bgImg = [UICommon ui_imageView:self.view.frame fileName:@"home_bg"]; self.ImgType = HomeNoWhat; self.emptyTitle = GJText(@"您还没有绑定设备"); @@ -47,16 +48,18 @@ self.buttonImg = ImageName_(@"home_addBtn"); [self.view addSubview:bgImg]; - self.zx_navTitle = GJText(@"首页"); self.zx_navRightBtn.zx_fixImageSize = ImageName_(@"home_icon_add").size; self.zx_navRightBtn.zx_fixWidth = 40; self.zx_navRightBtn.zx_fixHeight = 40; [self zx_setRightBtnWithImg:ImageName_(@"home_icon_add") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) { [self isShowMenu]; }]; + [self zx_setSubRightBtnWithImgName:@"home_nav_sign" clickedBlock:^(ZXNavItemBtn * _Nonnull btn) { +// SingViewController *vc = [[SingViewController alloc] init]; +// [self.navigationController pushViewController:vc animated:YES]; + }]; [self setTotal]; [self QueryMsg]; - [self GetDeviceList]; [self GetBannerList]; [[[NSNotificationCenter defaultCenter] rac_addObserverForName:UPDATA_DeviceList object:nil] subscribeNext:^(NSNotification *x) { [self GetDeviceList]; @@ -69,6 +72,10 @@ { [self GetLatest:APIManager.sharedManager.deviceModel.imei]; }]; + [[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"XIAOHONGHUA" object:nil] subscribeNext:^(NSNotification *x) { + [self getHomeWorkCount]; + [self getReadFlowerCount]; + }]; [self.view addSubview:self.homeTable]; [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { @@ -91,7 +98,7 @@ if (!_homeTable) { kWeakSelf(self) - _homeTable = [[CommonTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain cellHeight:100 cellRow:0 isAdaptive:NO isLine:NO commonCell:HomeTableViewCell.class createCell:^(ZZTableViewCell * _Nonnull cells, NSIndexPath * _Nonnull indexPath) { + _homeTable = [[CommonTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain cellHeight:0 cellRow:0 isAdaptive:NO isLine:NO commonCell:HomeTableViewCell.class createCell:^(ZZTableViewCell * _Nonnull cells, NSIndexPath * _Nonnull indexPath) { HomeTableViewCell *cell = (HomeTableViewCell *)cells; if (indexPath.row < weakself.cellMenuArr.count) @@ -110,7 +117,7 @@ }]; _homeTable.tableHeaderView = self.headerView; - _homeTable.tableHeaderView.height = Adapted(320)+35; + _homeTable.tableHeaderView.height = Adapted(170)+230+25+28; _homeTable.backgroundColor = KKClearColor; [_homeTable bindHeadRefreshHandler:^{ [self GetDeviceList]; @@ -125,7 +132,7 @@ if (!_headerView) { _headerView = [HomeHeaderView new]; - _headerView.frame = CGRectMake(0, 0, SCREEN_WIDTH, Adapted(320)+35); + _headerView.frame = CGRectMake(0, 0, SCREEN_WIDTH, Adapted(170)+230+25+28); } return _headerView; } @@ -133,64 +140,40 @@ - (void)isShowMenu { - CGPoint p = CGPointMake(SCREEN_WIDTH - 30, iPhoneX_NavHeight - 10); - [YBPopupMenu showAtPoint:p titles:self.menuTitles icons:self.menuIcons menuWidth:120*(SCREEN_WIDTH/320) otherSettings:^(YBPopupMenu *popupMenu) { - popupMenu.textColor = KKWhiteColorColor; - popupMenu.fontSize = 15; - popupMenu.cornerRadius = 4.0f; - popupMenu.dismissOnSelected = NO; - popupMenu.delegate = self; - popupMenu.offset = 5; - popupMenu.type = YBPopupMenuTypeDark; + kWeakSelf(self) + [DeviceSwitchover.sharedManager showMenuViewWithAdd:YES]; + [DeviceSwitchover.sharedManager setSwitchDevice:^(NSInteger index) { + if (index == 0) + { + ScanCodeViewController *vc = [ScanCodeViewController new]; + [weakself.navigationController pushViewController:vc animated:YES]; + } + else + { + DeviceModel *model = weakself.deviceListArr[index-1]; + [weakself GetDeviceMenu:model]; + } }]; } -#pragma mark - YBPopupMenuDelegate 代理方法 -- (void)ybPopupMenuDidSelectedAtIndex:(NSInteger)index ybPopupMenu:(YBPopupMenu *)ybPopupMenu -{ - [ybPopupMenu dismiss]; - if(index == 0) - { - ScanCodeViewController *vc = [ScanCodeViewController new]; - [self.navigationController pushViewController:vc animated:YES]; - } - else - { - DeviceModel *model = self.deviceListArr[index-1]; - [self GetDeviceMenu:model]; - } -} + #pragma mark 获取设备列表 /// 获取设备列表 - (void)GetDeviceList { kWeakSelf(self) - self.menuTitles = [NSMutableArray new]; - self.menuIcons = [NSMutableArray new]; - [self.menuTitles insertObject:GJText(@"添加手表") atIndex:0]; - [self.menuIcons insertObject:@"home_icon_add_watch" atIndex:0]; [UICommon MessageUpload:@"加载中"]; NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; [[[APIManager sharedManager] APGET:BindDevice_URL parameters:parameters resultClass:nil] subscribeNext:^(NSArray *arr) { [UICommon HidenLoading]; [self.homeTable.headRefreshControl endRefreshing]; [self.deviceListArr removeAllObjects]; - for (NSDictionary *dic in arr) - { - DeviceModel *model = [DeviceModel yy_modelWithJSON:dic]; - if (model.image.length <= 0) - [self.menuIcons addObject:model.sex == 2 ? @"icon_girl_head_portrait" : @"icon_boy_head_portrait"]; - else - [self.menuIcons addObject:model.image]; - [self.menuTitles addObject:model.name]; - [self.deviceListArr addObject:model]; - } + self.deviceListArr = APIManager.sharedManager.deviceList; if (arr.count > 0) { - weakself.homeTable.emptyDataSetSource = nil; weakself.homeTable.emptyDataSetDelegate = nil; if (STRINGHASVALUE(APIManager.sharedManager.deviceModel.imei)) @@ -212,7 +195,7 @@ weakself.homeTable.emptyDataSetSource = self; weakself.homeTable.emptyDataSetDelegate = self; } - self.homeTable.tableHeaderView.height = arr.count == 0 ? Adapted(190) : Adapted(320)+35; + self.homeTable.tableHeaderView.height = arr.count == 0 ? Adapted(170) : Adapted(170)+230+25+28; self.headerView.isDev = arr.count == 0 ? YES : NO; } error:^(NSError * _Nullable error) { NSDictionary *dic = error.userInfo; @@ -228,16 +211,11 @@ APIManager.sharedManager.deviceModel = model; [APIManager.sharedManager.cache setObject:model forKey:sDeviceKey]; + [self.zx_navLeftBtn setTitle:model.name forState:0]; self.headerView.devicemodel = model; [self GetLatest:model.imei]; [self GetLatestInstructions:model.imei]; - - [self.cellMenuArr removeAllObjects]; - if (model.heartRate) - [self.cellMenuArr addObject:GJText(@"心率")]; - if (model.temperature) - [self.cellMenuArr addObject:GJText(@"体温")]; - self.homeTable.cellRow = self.cellMenuArr.count; + [self.homeTable reloadData]; /// 视频类型名称(0.不支持,1.菊风,2.声网,3.佰锐,4.鹈鹕) if (model.videoModelName == 1) @@ -383,6 +361,38 @@ // }]; } +#pragma mark 查询未读作业总数 +/// 查询未读作业总数 +- (void)getHomeWorkCount +{ + kWeakSelf(self) + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [[[APIManager sharedManager] APGET:HomeWorkCount_GET_URL parameters:parameters resultClass:nil] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; +// NSNumber *campusCount = x[@"campusCount"]; + self.headerView.homeWokeCount = x[@"homeWokeCount"]; + [weakself.homeTable reloadData]; + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + +#pragma mark 查询小红花未读总数 +/// 查询小红花未读总数 +- (void)getReadFlowerCount +{ + kWeakSelf(self) + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [[[APIManager sharedManager] APGET:ReadFlowerCount_GET_URL parameters:parameters resultClass:nil] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + weakself.headerView.redTotalCount = x[@"totalCount"]; + [weakself.homeTable reloadData]; + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} - (NSMutableArray *)deviceListArr @@ -397,6 +407,14 @@ return _cellMenuArr; } +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + [self GetDeviceList]; + [self getHomeWorkCount]; + [self getReadFlowerCount]; +} + - (void)updateAllMessage { [self GetDeviceList]; diff --git a/LekangGuard/Home/Homes/Model/DeviceModel.h b/LekangGuard/Home/Homes/Model/DeviceModel.h index 7b0b9fb..3591144 100644 --- a/LekangGuard/Home/Homes/Model/DeviceModel.h +++ b/LekangGuard/Home/Homes/Model/DeviceModel.h @@ -124,6 +124,9 @@ NS_ASSUME_NONNULL_BEGIN /// 佰瑞Id @property (nonatomic ,copy) NSString *baiRuiId; + +/// 是否在线 +@property (nonatomic ,assign) BOOL onlineStatus; @end NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Home/Homes/View/HomeHeaderView.h b/LekangGuard/Home/Homes/View/HomeHeaderView.h index f36ee27..51f1f18 100644 --- a/LekangGuard/Home/Homes/View/HomeHeaderView.h +++ b/LekangGuard/Home/Homes/View/HomeHeaderView.h @@ -25,6 +25,12 @@ NS_ASSUME_NONNULL_BEGIN /// 微聊消息未读数 - (void)GetUnreadTotal; +/// 班级作业未读条数 +@property (nonatomic ,strong) NSNumber *homeWokeCount; + +/// 小红花未读条数 +@property (nonatomic ,strong) NSNumber *redTotalCount; + @end NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Home/Homes/View/HomeHeaderView.m b/LekangGuard/Home/Homes/View/HomeHeaderView.m index 50067b1..e0cafc8 100644 --- a/LekangGuard/Home/Homes/View/HomeHeaderView.m +++ b/LekangGuard/Home/Homes/View/HomeHeaderView.m @@ -7,13 +7,14 @@ #import "HomeHeaderView.h" #import - +#import "SLMarqueeControl.h" #import "KJBannerView.h" #import "MoreServiceViewController.h" #import "ContactsViewController.h" #import "EditDeviceViewController.h" #import "ChatViewController.h" #import "VideoChatViewController.h" +#import "ReadFlowerViewController.h" @interface HomeHeaderView () @@ -26,26 +27,18 @@ /// 按钮菜单View @property (nonatomic ,weak) UIView *btnView; -/// 头像 -@property (nonatomic ,weak) UIButton *iconBtn; +/// 设备头像 +@property (nonatomic ,weak) UIImageView *iconImg; -/// 名称 +/// 设备名称 @property (nonatomic ,weak) UILabel *nameLabel; -/// 电量图片 -@property (nonatomic ,weak) UIImageView *electricityImg; - -/// 电量Label -@property (nonatomic ,weak) UILabel *electricityLabel; - -/// 定位时间Label -@property (nonatomic ,weak) UILabel *timeLabel; +@property (nonatomic ,weak) UILabel *idLabel; -/// 位置未知提示 -@property (nonatomic ,weak) UILabel *addLabel; +@property (nonatomic, weak) SLMarqueeControl *marqueeControl; -/// 定位图片 -@property (nonatomic ,weak) UIImageView *mapImg; +/// 位置图片 +@property (nonatomic, weak) UIImageView *positionImg; @property (nonatomic ,strong) NSMutableArray *btnArr; @@ -64,20 +57,36 @@ } return self; } + +- (void)setHomeWokeCount:(NSNumber *)homeWokeCount +{ + _homeWokeCount = homeWokeCount; + ZZBadgeButton *button = self.btnArr[0]; + button.badge = homeWokeCount.integerValue; +} + +- (void)setRedTotalCount:(NSNumber *)redTotalCount +{ + _redTotalCount = redTotalCount; + ZZBadgeButton *button = self.btnArr[3]; + button.badge = redTotalCount.integerValue; +} + - (void)setDevicemodel:(DeviceModel *)devicemodel { _devicemodel = devicemodel; self.nameLabel.text = devicemodel.name; if (devicemodel.image.length <= 0) - [self.iconBtn setBackgroundImage:ImageName_(devicemodel.sex == 2 ? @"icon_head_girl" : @"icon_head_boy") forState:0]; + [self.iconImg setImage:ImageName_(devicemodel.sex == 2 ? @"icon_head_girl" : @"icon_head_boy")]; else - [self.iconBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:devicemodel.image] forState:0 placeholderImage:ImageName_(@"icon_head_boy")]; - [self subBtnView]; + [self.iconImg sd_setImageWithURL:[NSURL URLWithString:devicemodel.image] placeholderImage:ImageName_(@"icon_head_boy")]; + + self.idLabel.text = [NSString stringWithFormat:@"账号:%@",devicemodel.imei]; +// [self subBtnView]; } - - (void)setBannerArr:(NSArray *)bannerArr { _bannerArr = bannerArr; @@ -87,37 +96,16 @@ - (void)setLaLoModel:(LatestLocationModel *)laLoModel { _laLoModel = laLoModel; - self.electricityLabel.text = F(@"%ld%%", laLoModel.battery); - self.electricityImg.image = [UICommon GetElectricityImg:laLoModel.battery]; - - - if (STRINGHASVALUE(laLoModel.updateTime)) + if (STRINGHASVALUE(laLoModel.addr)) { - self.timeLabel.text = laLoModel.updateTime; - CGSize titlesize = [laLoModel.updateTime sizeWithFont:FontADA_(9) constrainedToSize:CGSizeMake(MAXFLOAT, 15)]; - [self.timeLabel mas_remakeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.electricityImg.mas_left).inset(10); - make.centerY.equalTo(self.electricityImg); - make.size.mas_equalTo(CGSizeMake(Adapted(titlesize.width), 15)); - }]; + self.positionImg.image = ImageName_(@"home_icon_gps"); + self.marqueeControl.marqueeLabel.text = laLoModel.addr; + } + else + { + self.positionImg.image = ImageName_(@"home_icon_gps_inaccurate"); + self.marqueeControl.marqueeLabel.text = @"当前位置未知,请确保设备开机且能够联网,再点击定位按钮进行定位"; } - - if (STRINGHASVALUE(laLoModel.addr)) - self.addLabel.text = laLoModel.addr; - - /// 定位类型 LBS GPS,WIFI - if ([laLoModel.locationType isEqualToString:@"LBS"]) - self.mapImg.image = ImageName_(@"icon_home_base_station"); - else if ([laLoModel.locationType isEqualToString:@"GPS"]) - self.mapImg.image = ImageName_(@"icon_histroy_g"); - else if ([laLoModel.locationType isEqualToString:@"WIFI"]) - self.mapImg.image = ImageName_(@"icon_home_wifi"); - - [self.mapImg mas_remakeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.iconBtn.mas_right).offset(10); - make.bottom.equalTo(self.iconBtn.mas_bottom).inset(6); - make.size.mas_equalTo(self.mapImg.image.size); - }]; } - (void)setIsDev:(BOOL)isDev @@ -129,7 +117,7 @@ - (void)subHeaderView { - KJBannerView *bannerView = [[KJBannerView alloc]initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH-20, Adapted(160))]; + KJBannerView *bannerView = [[KJBannerView alloc]initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH-20, Adapted(170))]; //bannerView.imgCornerRadius = 5; bannerView.autoScrollTimeInterval = 8; //bannerView.isZoom = YES; @@ -141,131 +129,39 @@ self.bannerView = bannerView; [self addSubview:bannerView]; - UIView *msgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:5 borderWidth:0 borderColor:KKWhiteColorColor]; - msgView.hidden = YES; - self.msgView = msgView; - [self addSubview:msgView]; - [msgView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self).inset(10); - make.top.equalTo(bannerView.mas_bottom).offset(10); - make.height.mas_equalTo(Adapted(80)); - }]; - - /// 头像 - UIButton *iconBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(0) normalColor:KKClearColor normalText:@"" click:^(id x) { - EditDeviceViewController *vc = [EditDeviceViewController new]; - [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; - }]; - //[iconBtn setBackgroundImage:ImageName_(@"icon_head_girl") forState:0]; - iconBtn.layer.cornerRadius = Adapted(25); - iconBtn.layer.masksToBounds = YES; - self.iconBtn = iconBtn; - [msgView addSubview:iconBtn]; - [iconBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(msgView).offset(10); - make.centerY.equalTo(msgView); - make.size.mas_equalTo(CGSizeMake(Adapted(50), Adapted(50))); - }]; - - /// 修改图片 - UIImageView *img = [UICommon ui_imageView:CGRectZero fileName:@"home_editor_icon"]; - [msgView addSubview:img]; - [img mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(iconBtn.mas_right); - make.bottom.equalTo(iconBtn.mas_bottom); - make.size.mas_equalTo(img.image.size); - }]; - - /// 名称 - UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(14) textColor:KKTextBlackColor text:@"--" Radius:0]; - self.nameLabel = nameLabel; - [msgView addSubview:nameLabel]; - [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(iconBtn.mas_right).offset(10); - make.top.equalTo(iconBtn); - }]; - - /// 电量Label - UILabel *electricityLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(11) textColor:KKGrey102 text:@"" Radius:0]; - self.electricityLabel = electricityLabel; - [msgView addSubview:electricityLabel]; - [electricityLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(msgView.mas_right).inset(10); - make.centerY.equalTo(nameLabel); - }]; - - /// 电池图片 - UIImage *imgs = ImageName_(@"icon_home_electricity_100"); - UIImageView *electricityImg = [UICommon ui_imageView:CGRectZero fileName:@""]; - self.electricityImg = electricityImg; - [msgView addSubview:electricityImg]; - [electricityImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(electricityLabel.mas_left).inset(2); - make.centerY.equalTo(electricityLabel); - make.size.mas_equalTo(imgs.size); + UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(14) textColor:KKTextBlackColor text:@"设备信息" Radius:0]; + [self addSubview:titleLabel]; + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self).offset(10); + make.top.equalTo(bannerView.mas_bottom).offset(20); }]; - /// 定位时间Label - UILabel *timeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(9) textColor:KKMainColor text:@"" Radius:3]; - timeLabel.backgroundColor = RGBA(88, 157, 245, .2); - self.timeLabel = timeLabel; - [msgView addSubview:timeLabel]; - [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(electricityImg.mas_left).inset(10); - make.centerY.equalTo(electricityImg); - }]; - - /// 定位图片 - UIImageView *mapImg = [UICommon ui_imageView:CGRectZero fileName:@"home_gps_icon"]; - self.mapImg = mapImg; - [msgView addSubview:mapImg]; - [mapImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(iconBtn.mas_right).offset(10); - make.bottom.equalTo(iconBtn.mas_bottom).inset(6); - make.size.mas_equalTo(mapImg.image.size); - }]; - - /// 定位图片后面分割线 - UILabel *line = [UILabel new]; - line.backgroundColor = KKGrey143; - [msgView addSubview:line]; - [line mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(mapImg.mas_right).offset(5); - make.centerY.equalTo(mapImg); - make.size.mas_equalTo(CGSizeMake(0.5, 15)); - }]; - /// 位置未知提示 - UILabel *addLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(12) textColor:KKTextBlackColor text:GJText(@"当前位置未知,点击进行定位") Radius:0]; - self.addLabel = addLabel; - [msgView addSubview:addLabel]; - [addLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(line.mas_left).offset(5); - make.right.equalTo(msgView.mas_right).inset(10); - make.centerY.equalTo(line); - }]; - - - UIButton *locationBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(0) normalColor:KKWhiteColorColor normalText:@"" click:^(id x) { - [UICommon currentVC].tabBarController.selectedIndex = 1; + [self addSubview:self.msgView]; + [self.msgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self).inset(10); + make.top.equalTo(titleLabel.mas_bottom).offset(10); + make.height.mas_equalTo(105); }]; - [msgView addSubview:locationBtn]; - [locationBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(nameLabel.mas_left); - make.right.equalTo(msgView.mas_right); - make.top.equalTo(msgView); - make.bottom.equalTo(msgView.mas_bottom); + + UILabel *titleLabel1 = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(14) textColor:KKTextBlackColor text:@"常用功能" Radius:0]; + [self addSubview:titleLabel1]; + [titleLabel1 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(titleLabel); + make.top.equalTo(self.msgView.mas_bottom).offset(10); }]; - UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:5 borderWidth:0 borderColor:KKWhiteColorColor]; - bgView.hidden = YES; - self.btnView = bgView; - [self addSubview:bgView]; - [bgView mas_makeConstraints:^(MASConstraintMaker *make) { + /// 按钮背景View + UIView *btnView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor]; + btnView.height = YES; + self.btnView = btnView; + [self addSubview:btnView]; + [btnView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self).inset(10); - make.top.equalTo(msgView.mas_bottom).offset(10); - make.bottom.equalTo(self.mas_bottom).inset(15); + make.top.equalTo(titleLabel1.mas_bottom).offset(10); + make.height.mas_equalTo(85); }]; + [self subBtnView]; } - (void)subBtnView @@ -276,32 +172,10 @@ } self.btnArr = [NSMutableArray new]; - NSMutableArray *titleArray = [NSMutableArray new]; - NSMutableArray *imageArray = [NSMutableArray new]; - if (self.devicemodel.videoModelName > 0) - { - [titleArray addObject:GJText(@"视频")]; - [imageArray addObject:@"home_icon_more_video_call"]; - } - else - { - [titleArray addObject:GJText(@"电话本")]; - [imageArray addObject:@"home_phone_book_icon"]; - } - if (self.devicemodel.chatFun) - { - [titleArray addObject:GJText(@"微聊")]; - [imageArray addObject:@"home_small_talk_icon"]; - } - if (self.devicemodel.phoneCall) - { - [titleArray addObject:GJText(@"打电话")]; - [imageArray addObject:@"home_call_up_icon"]; - } - [titleArray addObject:GJText(@"更多")]; - [imageArray addObject:@"home_more_icon"]; - + NSArray *titleArray = @[@"班级作业",@"电话本",@"打电话",@"小红花"]; + NSArray *imageArray = @[@"icon_homework",@"icon_phonebook",@"icon_call_up",@"icon_red_flower"]; + CGFloat masx = (SCREEN_WIDTH-44)/titleArray.count; for (int i = 0; i < titleArray.count; i++) { @@ -335,17 +209,13 @@ ContactsViewController *vc = [ContactsViewController new]; [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; } - else if ([btn.currentTitle isEqualToString:GJText(@"视频")]) + else if ([btn.currentTitle isEqualToString:GJText(@"班级作业")]) { - VideoChatViewController *vc = [VideoChatViewController new]; - [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; + } - else if ([btn.currentTitle isEqualToString:GJText(@"微聊")]) + else if ([btn.currentTitle isEqualToString:GJText(@"小红花")]) { - ChatViewController *vc = [ChatViewController new]; - vc.messageCoutnUpdata = ^{ - [self GetUnreadTotal]; - }; + ReadFlowerViewController *vc = [[ReadFlowerViewController alloc] init]; [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; } else if ([btn.currentTitle isEqualToString:GJText(@"打电话")]) @@ -370,6 +240,96 @@ } +- (UIView *)msgView +{ + if (!_msgView) + { + _msgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor]; + _msgView.hidden = YES; + + /// 设备头像 + UIImageView *iconImg = [UIImageView new]; + iconImg.layer.cornerRadius = 25; + iconImg.layer.masksToBounds = YES; + self.iconImg = iconImg; + [_msgView addSubview:iconImg]; + [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(_msgView.mas_left).offset(18); + make.centerY.equalTo(_msgView); + make.size.mas_equalTo(CGSizeMake(50, 50)); + }]; + + UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:Font_(0) normalColor:KKClearColor normalText:@"" click:^(id x) { + EditDeviceViewController *vc = [[EditDeviceViewController alloc] init]; + [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; + }]; + [_msgView addSubview:btn]; + [btn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(_msgView); + make.top.equalTo(_msgView); + make.bottom.equalTo(iconImg.mas_bottom); + }]; + + + + /// 设备名称 + UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(14) textColor:KKTextBlackColor text:@"" Radius:0]; + self.nameLabel = nameLabel; + [_msgView addSubview:nameLabel]; + [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(iconImg.mas_right).offset(18); + make.top.equalTo(_msgView).offset(19.5); + }]; + + UILabel *idLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:RGB(133, 133, 133) text:@"" Radius:0]; + self.idLabel = idLabel; + [_msgView addSubview:idLabel]; + [idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(nameLabel.mas_left); + make.centerY.equalTo(_msgView); + }]; + + + /// 右箭头图片 + UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; + [_msgView addSubview:rightImg]; + [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(_msgView.mas_right).inset(18); + make.top.equalTo(_msgView).offset(30.5); + make.size.mas_equalTo(CGSizeMake(8, 15)); + }]; + + + UILabel *ttLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:RGB(133, 133, 133) text:@"编辑资料" Radius:0]; + [_msgView addSubview:ttLabel]; + [ttLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(rightImg.mas_left).inset(10); + make.centerY.equalTo(rightImg.mas_centerY); + }]; + + + /// 位置跑马灯 + SLMarqueeControl *control = [[SLMarqueeControl alloc] initWithFrame:CGRectMake(111, 73.5, SCREEN_WIDTH-20-111-15, 12)]; + control.backgroundColor = KKClearColor; + control.marqueeLabel.text = @"当前位置未知,请确保设备开机且能够联网,再点击定位按钮进行定位"; + self.marqueeControl = control; + [_msgView addSubview:control]; + + /// 位置图片 + UIImageView *positionImg = [UIImageView new]; + self.positionImg = positionImg; + [_msgView addSubview:positionImg]; + [positionImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(nameLabel); + make.centerY.equalTo(control); + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + } + return _msgView; +} + + + - (ZZBadgeButton *)createButtonWithTitle:(NSString *)title image:(NSString *)image { ZZBadgeButton *customButton = [[ZZBadgeButton alloc] init]; diff --git a/LekangGuard/Home/Homes/View/SLMarqueeControl.h b/LekangGuard/Home/Homes/View/SLMarqueeControl.h new file mode 100644 index 0000000..803c643 --- /dev/null +++ b/LekangGuard/Home/Homes/View/SLMarqueeControl.h @@ -0,0 +1,19 @@ +// +// SLMarqueeControl.h +// SLMarqueeControl +// +// Created by sl on 2018/10/24. +// Copyright © 2018年 WSonglin. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SLMarqueeControl : UIView + +@property (nonatomic, readonly) UILabel *marqueeLabel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Home/Homes/View/SLMarqueeControl.m b/LekangGuard/Home/Homes/View/SLMarqueeControl.m new file mode 100644 index 0000000..e440d04 --- /dev/null +++ b/LekangGuard/Home/Homes/View/SLMarqueeControl.m @@ -0,0 +1,164 @@ +// +// SLMarqueeControl.m +// SLMarqueeControl +// +// Created by sl on 2018/10/24. +// Copyright © 2018年 WSonglin. All rights reserved. +// + +#import "SLMarqueeControl.h" + +static CGFloat const kLabelOffset = 20.f; + +@interface SLMarqueeControl () + +@property (nonatomic, weak) UIView *innerContainer; +@property (nonatomic, weak) UILabel *label; + +@end + +@implementation SLMarqueeControl + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + self.clipsToBounds = YES; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appBecomeActive:) + name:UIApplicationDidBecomeActiveNotification + object:nil + ]; + + [self.marqueeLabel addObserver:self + forKeyPath:@"text" + options:NSKeyValueObservingOptionNew + context:nil + ]; + + [self.marqueeLabel addObserver:self + forKeyPath:@"attributedText" + options:NSKeyValueObservingOptionNew + context:nil + ]; + } + + return self; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void)willMoveToWindow:(UIWindow *)newWindow { + if (newWindow) { + [self startAnimation]; + } + + [super willMoveToWindow:newWindow]; +} + ++ (BOOL)accessInstanceVariablesDirectly { + return NO; +} + +#pragma mark - NSNotification +- (void)appBecomeActive:(NSNotification *)note { + [self startAnimation]; +} + +#pragma mark - KVO +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + [self startAnimation]; +} + +#pragma mark - Private method +- (void)startAnimation { + if (0 == CGRectGetWidth(self.bounds) + || 0 == CGRectGetHeight(self.bounds)) { + return; + } + + [self.innerContainer.layer removeAnimationForKey:@"Marquee"]; + [self bringSubviewToFront:self.innerContainer]; + CGSize size = [self evaluateMarqueeLabelContentSize]; + + for (UIView *view in self.innerContainer.subviews) { + if ([view isKindOfClass:[UILabel class]]) { + [view removeFromSuperview]; + } + } + + CGRect rect = CGRectMake(0.f, 0.f, size.width + kLabelOffset, CGRectGetHeight(self.bounds)); + + UILabel *label = [[UILabel alloc] initWithFrame:rect]; + label.backgroundColor = [UIColor clearColor]; + label.text = self.marqueeLabel.text; + label.attributedText = self.marqueeLabel.attributedText; + + [self.innerContainer addSubview:label]; + + if (size.width > CGRectGetWidth(self.bounds)) { + CGRect nextRect = rect; + nextRect.origin.x = size.width + kLabelOffset; + + UILabel *nextLabel = [[UILabel alloc] initWithFrame:nextRect]; + nextLabel.backgroundColor = [UIColor clearColor]; + nextLabel.text = self.marqueeLabel.text; + nextLabel.attributedText = self.marqueeLabel.attributedText; + + [self.innerContainer addSubview:nextLabel]; + + CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.x"]; + animation.keyTimes = @[@0.f, @1.f]; + animation.duration = size.width / 50.f; + animation.values = @[@0, @(-(size.width + kLabelOffset))]; + animation.repeatCount = INT16_MAX; + animation.timingFunction = [CAMediaTimingFunction functionWithName:@"linear"]; + [self.innerContainer.layer addAnimation:animation forKey:@"Marquee"]; + } else { + label.frame = self.bounds; + } +} + +- (CGSize)evaluateMarqueeLabelContentSize { + CGSize size = CGSizeZero; + if (self.marqueeLabel && self.marqueeLabel.text.length > 0) { + size = [self.marqueeLabel.text sizeWithAttributes:@{NSFontAttributeName:self.marqueeLabel.font}]; + } + + return size; +} + +#pragma mark - Getter +- (UILabel *)marqueeLabel { + return self.label; +} + +- (UIView *)innerContainer { + if (!_innerContainer) { + UIView *view = [[UIView alloc] initWithFrame:self.bounds]; + view.backgroundColor = [UIColor clearColor]; + view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; + [self addSubview:view]; + _innerContainer = view; + } + + return _innerContainer; +} + +- (UILabel *)label { + if (!_label) { + UILabel *label = [[UILabel alloc] init]; + label.backgroundColor = [UIColor clearColor]; + label.font = Font_(12); + label.textColor = RGB(133, 133, 133); + [self addSubview:label]; + + _label = label; + } + + return _label; +} + +@end diff --git a/LekangGuard/Home/MoreService (更多功能)/View/DeviceSetView.h b/LekangGuard/Home/MoreService (更多功能)/View/DeviceSetView.h index 0286ac3..25e845e 100644 --- a/LekangGuard/Home/MoreService (更多功能)/View/DeviceSetView.h +++ b/LekangGuard/Home/MoreService (更多功能)/View/DeviceSetView.h @@ -13,7 +13,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic ,strong) void(^isOpenState)(void); -#pragma mark 查询定位模式 +- (void)subHeaderView; + /// 查询定位模式 - (void)DevicePosition; diff --git a/LekangGuard/Home/MoreService (更多功能)/View/DeviceSetView.m b/LekangGuard/Home/MoreService (更多功能)/View/DeviceSetView.m index 325533b..53177b4 100644 --- a/LekangGuard/Home/MoreService (更多功能)/View/DeviceSetView.m +++ b/LekangGuard/Home/MoreService (更多功能)/View/DeviceSetView.m @@ -38,6 +38,11 @@ - (void)subHeaderView { + for (UIView *views in self.subviews) + { + [views removeFromSuperview]; + } + [self DevicePosition]; UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:8 borderWidth:0 borderColor:KKWhiteColorColor]; [self addSubview:bgView]; diff --git a/LekangGuard/Home/MoreService (更多功能)/View/FunctionView.m b/LekangGuard/Home/MoreService (更多功能)/View/FunctionView.m index 2467195..eb2f187 100644 --- a/LekangGuard/Home/MoreService (更多功能)/View/FunctionView.m +++ b/LekangGuard/Home/MoreService (更多功能)/View/FunctionView.m @@ -78,7 +78,7 @@ //返回每个item大小 - (CGSize)waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { - return CGSizeMake((SCREEN_WIDTH-65)/4, (SCREEN_WIDTH-65)/4); + return CGSizeMake((SCREEN_WIDTH-20)/4, (SCREEN_WIDTH-20)/4.5); } /** 头视图Size */ @@ -95,17 +95,17 @@ /** 列间距*/ -(CGFloat)columnMarginInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout { - return 10; + return 0; } /** 行间距*/ -(CGFloat)rowMarginInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout { - return 10; + return 0; } /** 边缘之间的间距*/ -(UIEdgeInsets)edgeInsetInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout { - return UIEdgeInsetsMake(5, 10, 5, 10); + return UIEdgeInsetsMake(0, 0, 0, 0); } #pragma mark - UICollectionView数据源 @@ -139,6 +139,20 @@ -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { NSString *title = self.titleArr[indexPath.row]; + if ([title isEqualToString:GJText(@"打电话")]) + { + if(APIManager.sharedManager.deviceModel.phone.length == 0) + { + + } + else + { + NSString * string = [[NSMutableString alloc] initWithFormat:@"tel:%@",APIManager.sharedManager.deviceModel.phone]; + if(APIManager.sharedManager.deviceModel.phone.length == 11) + string = [NSString stringWithFormat:@"tel:+86-%@", APIManager.sharedManager.deviceModel.phone]; + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string] options:@{} completionHandler:nil]; + } + } if ([title isEqualToString:GJText(@"电话本")] || [title isEqualToString:GJText(@"管理员")]) { ContactsViewController *vc = [ContactsViewController new]; diff --git a/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.m b/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.m index 971e8ec..692ea10 100644 --- a/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.m +++ b/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.m @@ -40,7 +40,7 @@ - (void)subMenuCell { - UIImage *img = ImageName_(@"icon_home_phone_book"); + UIImage *img = ImageName_(@"icon_watch_data"); UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@""]; self.iconImg = iconImg; [self.contentView addSubview:iconImg]; @@ -54,18 +54,18 @@ self.titleLabel = titleLabel; [self.contentView addSubview:titleLabel]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.bottom.equalTo(self.mas_bottom).inset(Adapted(10)); + make.bottom.equalTo(self.contentView.mas_bottom).inset(Adapted(10)); make.centerX.equalTo(self.contentView); }]; - UILabel *line = [UILabel new]; - line.backgroundColor = KKLineColor; - [self.contentView addSubview:line]; - [line mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self.contentView); - make.bottom.equalTo(self.contentView.mas_bottom); - make.height.mas_equalTo(0.5); - }]; +// UILabel *line = [UILabel new]; +// line.backgroundColor = KKLineColor; +// [self.contentView addSubview:line]; +// [line mas_makeConstraints:^(MASConstraintMaker *make) { +// make.left.right.equalTo(self.contentView); +// make.bottom.equalTo(self.contentView.mas_bottom); +// make.height.mas_equalTo(0.5); +// }]; } @end diff --git a/LekangGuard/Home/MoreService (更多功能)/View/MoreMenuTitleView.m b/LekangGuard/Home/MoreService (更多功能)/View/MoreMenuTitleView.m index b69a0f0..3f5fa55 100644 --- a/LekangGuard/Home/MoreService (更多功能)/View/MoreMenuTitleView.m +++ b/LekangGuard/Home/MoreService (更多功能)/View/MoreMenuTitleView.m @@ -35,20 +35,11 @@ - (void)subheadView { - UILabel *line = [UILabel new]; - line.backgroundColor = KKMainColor; - [self addSubview:line]; - [line mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerY.equalTo(self); - make.left.equalTo(self).offset(10); - make.size.mas_equalTo(CGSizeMake(3, 15)); - }]; - - UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(14) textColor:KKTextBlackColor text:@"" Radius:0]; + UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBoldADA_(14) textColor:KKTextBlackColor text:@"" Radius:0]; self.titleLabel = titleLabel; [self addSubview:titleLabel]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(line.mas_right).offset(5); + make.left.equalTo(self).offset(10); make.centerY.equalTo(self); }]; } diff --git a/LekangGuard/LekangGuard.pch b/LekangGuard/LekangGuard.pch index 6ef2354..56c08ec 100644 --- a/LekangGuard/LekangGuard.pch +++ b/LekangGuard/LekangGuard.pch @@ -66,7 +66,8 @@ #import "UIView+ViewController.h" #import "JX_GCDTimerManager.h" #import "APHandleManager.h" - +#import "DeviceSwitchover.h" +#import "UIView+Effects.h" #define WXAPPID @"wxc0ca3e7f672ac786" #define WXAPPSecret @"009bbe40ee4b6a6f8a1b413a2989167a" @@ -79,7 +80,7 @@ #define HEXCOLOR(c) [UIColor colorWithRed:((c>>16)&0xFF)/255.0 green:((c>>8)&0xFF)/255.0 blue:(c&0xFF)/255.0 alpha:1.0] // 背景灰 -#define KKBackgroundGrey RGB(239, 239, 244) +#define KKBackgroundGrey RGB(245, 248, 255) /// 透明 #define KKClearColor [UIColor clearColor] @@ -87,10 +88,10 @@ #define KKWhiteColorColor [UIColor whiteColor] /// 字体黑 14 -#define KKTextBlackColor RGBA(14, 14, 0, 1) +#define KKTextBlackColor RGB(42, 42, 42) -/// 主题蓝 88, 157, 245 -#define KKMainColor RGB(88, 157, 245) +/// 主题蓝59, 161, 245 +#define KKMainColor RGB(59, 161, 245) /// 浅灰219 #define KKGrey219 RGB(219, 219, 219) @@ -104,8 +105,11 @@ /// 灰102 #define KKGrey102 RGB(102, 102, 102) +/// 灰133 +#define KKGrey133 RGB(133, 133, 133) + /// 间隔线浅灰 -#define KKLineColor RGB(238, 238, 238) +#define KKLineColor RGB(235, 235, 235) // 字体 #define Font_(x) [UIFont fontWithName:@"HelveticaNeue" size: x] diff --git a/LekangGuard/Login/EmailLoginViewController.m b/LekangGuard/Login/EmailLoginViewController.m index 82615c5..5b8a39a 100644 --- a/LekangGuard/Login/EmailLoginViewController.m +++ b/LekangGuard/Login/EmailLoginViewController.m @@ -254,6 +254,12 @@ [UICommon MessageErrorText:GJText(@"密码为6~16位字符内")]; return; } +// if (!self.agreementBtn.selected) +// { +// [UICommon MessageErrorText:GJText(@"请同意用户服务协议和隐私政策")]; +// return; +// } + self.loginBtn.enabled = NO; [UICommon MessageUpload:@"登录中"]; NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; diff --git a/LekangGuard/Login/LoginViewController.m b/LekangGuard/Login/LoginViewController.m index 19a0afd..741ff44 100644 --- a/LekangGuard/Login/LoginViewController.m +++ b/LekangGuard/Login/LoginViewController.m @@ -18,8 +18,26 @@ @property (nonatomic ,strong) UIScrollView *scrollView; @property (nonatomic ,strong) UIPageControl *pageControl; -/// 其他方式登录 -@property (nonatomic ,weak) UIButton *otherBtn; +/// 用户协议按钮 +@property (nonatomic ,weak) UIButton *agreementBtn; + +/// 密码View +@property (nonatomic ,weak) UIView *passView; + +/// 手机号TextField +@property (nonatomic ,weak) UITextField *phoneField; + +/// 密码TextField +@property (nonatomic ,weak) UITextField *passField; + +/// 记住密码按钮 +@property (nonatomic ,weak) UIButton *rememberPassBtn; + +/// 是否记得密码 +@property (nonatomic ,assign) BOOL isRememberPWD; + +/// 登录 +@property (nonatomic ,weak) UIButton *loginBtn; @end @@ -31,21 +49,211 @@ self.view.backgroundColor = KKWhiteColorColor; self.zx_navBarBackgroundColor = KKClearColor; + UIImageView *logoBgImg = [UICommon ui_imageView:CGRectZero fileName:@"login_bg"]; + [self.view addSubview:logoBgImg]; + [logoBgImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.view); + make.left.right.equalTo(self.view); + make.height.mas_equalTo(logoBgImg.image.size.height); + }]; + UIImageView *logoImg = [UICommon ui_imageView:CGRectZero fileName:@"login_logo"]; [self.view addSubview:logoImg]; [logoImg mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.view); - make.top.equalTo(self.view).offset(Adapted(180)); - make.height.width.mas_equalTo(Adapted(90)); + make.top.equalTo(self.view).offset(Adapted(97)); + make.size.mas_equalTo(logoImg.image.size); + }]; + + for (int i = 0; i < 2; i++) + { + UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKClearColor cornerRadius:0 borderWidth:0 borderColor:KKClearColor]; + if (i == 1) self.passView = bgView; + [self.view addSubview:bgView]; + [bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.view).inset(35); + make.top.equalTo(logoImg.mas_bottom).offset(189+i*Adapted(62)); + make.height.mas_equalTo(Adapted(62)); + + }]; + + UIImageView *leftImg = [UICommon ui_imageView:CGRectZero fileName:i == 0 ? @"login_phone_icon" : @"login_password_icon"]; + [bgView addSubview:leftImg]; + [leftImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(bgView).offset(0); + make.centerY.equalTo(bgView); + make.size.mas_equalTo(CGSizeMake(Adapted(leftImg.image.size.width), Adapted(leftImg.image.size.height))); + }]; + + /// 密码可视或不可视按钮 + UIButton *rightBtn; + if (i == 1) + { + rightBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(0) normalColor:KKClearColor normalText:@"" click:^(UIButton *sender) { + [sender setSelected:!sender.isSelected]; + self.passField.secureTextEntry = !sender.isSelected; + }]; + [rightBtn setImage:[UIImage imageNamed:@"login_password_icon_hidden"] forState:UIControlStateNormal]; + [rightBtn setImage:[UIImage imageNamed:@"login_password_icon_show"] forState:UIControlStateSelected]; + [bgView addSubview:rightBtn]; + [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(bgView); + make.right.equalTo(bgView.mas_right); + make.size.mas_equalTo(CGSizeMake(Adapted(22), Adapted(22))); + }]; + } + + + UITextField *textfield = [UICommon ui_textField:CGRectZero textColor:KKTextBlackColor backColor:KKClearColor font:FontADA_(15) maxTextNum:i == 0 ? 11 : 16 placeholderColor:KKGrey143 placeholder:i == 0 ? GJText(@"请输入手机号") : GJText(@"请输入密码") toMaxNum:^(UITextField *textField) { + + } change:^(UITextField *textField) { + + }]; + if (i == 0) + { + textfield.keyboardType = UIKeyboardTypePhonePad; + self.phoneField = textfield; + } + else + { + textfield.secureTextEntry = YES; + self.passField = textfield; + } + [bgView addSubview:textfield]; + + [textfield mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(leftImg.mas_right).offset(15); + if (i == 0) + make.right.equalTo(bgView).inset(15); + else + make.right.equalTo(rightBtn.mas_left).inset(15); + make.centerY.equalTo(bgView); + make.height.mas_equalTo(Adapted(44)); + }]; + + UIImageView *line = [UIImageView new]; + line.backgroundColor = KKLineColor; + [bgView addSubview:line]; + [line mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(bgView); + make.bottom.equalTo(bgView.mas_bottom); + make.height.mas_equalTo(0.5); + }]; + } + + /// 登录 + UIButton *loginBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(16) normalColor:KKWhiteColorColor normalText:GJText(@"登录") click:^(UIButton *btn) { + // btn.selected = !btn.selected; + [self UserLogin]; + }]; + [loginBtn setBackgroundImage:ImageName_(@"login_button_bg_no") forState:UIControlStateNormal]; + [loginBtn setBackgroundImage:ImageName_(@"login_button_bg_select") forState:UIControlStateSelected]; + [loginBtn setTitle:@"登录中" forState:UIControlStateSelected]; + self.loginBtn = loginBtn; + [self.view addSubview:loginBtn]; + [loginBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.passView.mas_bottom).offset(Adapted(40)); + make.centerX.equalTo(self.view); + make.size.mas_equalTo(CGSizeMake(Adapted(230), Adapted(45))); }]; - UILabel *logoName = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(17) textColor:KKTextBlackColor text:GJText(@"智慧校园") Radius:0]; - [self.view addSubview:logoName]; - [logoName mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(logoImg.mas_bottom).offset(Adapted(15)); + UIImageView *line = [UIImageView new]; + line.backgroundColor = KKMainColor; + [self.view addSubview:line]; + [line mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.view); + make.top.equalTo(loginBtn.mas_bottom).offset(Adapted(25)); + make.size.mas_equalTo(CGSizeMake(1, 16)); }]; + /// 立即注册 + UIButton *registerBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(16) normalColor:KKMainColor normalText:GJText(@"注册账号") click:^(UIButton *sender) { + + RegisterViewController *vc = [RegisterViewController new]; + vc.navTitle = @"注册"; + vc.isViewType = 0; + vc.isRegisterSuccess = ^{ + //[self aucnTexg]; + }; + [self.navigationController pushViewController:vc animated:YES]; + }]; + [self.view addSubview:registerBtn]; + + CGRect rect1 = [UICommon GetTextWidth:registerBtn.currentTitle ViewHeight:30 fontSize:FontADA_(16) type:@"w"]; + [registerBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(line.mas_right).offset(3); + make.centerY.equalTo(line); + make.size.mas_equalTo(CGSizeMake(Adapted(rect1.size.width+5), 16.5)); + }]; + + /// 忘记密码 + UIButton *forgetBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(16) normalColor:KKMainColor normalText:GJText(@"忘记密码") click:^(UIButton *sender) { + RegisterViewController *vc = [RegisterViewController new]; + vc.navTitle = @"忘记密码"; + vc.isViewType = 1; + [self.navigationController pushViewController:vc animated:YES]; + }]; + [self.view addSubview:forgetBtn]; + CGRect rect = [UICommon GetTextWidth:forgetBtn.currentTitle ViewHeight:30 fontSize:FontADA_(16) type:@"w"]; + [forgetBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(line.mas_left).inset(3); + make.centerY.equalTo(line); + make.size.mas_equalTo(CGSizeMake(Adapted(rect.size.width+5), 16.5)); + }]; + + + UIImageView *line1 = [UIImageView new]; + line1.backgroundColor = KKLineColor; + [self.view addSubview:line1]; + [line1 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.view).inset(35); + make.top.equalTo(line.mas_bottom).offset(Adapted(65)); + make.height.mas_equalTo(1); + }]; + + UILabel *otherLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(10) textColor:KKGrey133 text:@"其他方式登录" Radius:0]; + otherLabel.backgroundColor = KKWhiteColorColor; + [self.view addSubview:otherLabel]; + [otherLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.view); + make.centerY.equalTo(line1); + make.size.mas_equalTo(CGSizeMake(104.5, 14)); + }]; + + NSArray *btnTitleArr = [WXApi isWXAppInstalled] ? @[@"微信",@"验证码"] : @[@"验证码"]; + NSArray *btnImageArr = [WXApi isWXAppInstalled] ? @[@"login_wechatBtn",@"login_codeBtn"] : @[@"login_codeBtn"]; + for (int i = 0; i < btnTitleArr.count; i++) + { + UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(10) normalColor:KKGrey133 normalText:btnTitleArr[i] click:^(UIButton *b) { + if ([b.currentTitle isEqualToString:@"微信"]) + { + [self WXAccredit]; + } + else + { + + } + }]; + btn.size = CGSizeMake(50, 75); + [btn setImage:ImageName_(btnImageArr[i]) forState:UIControlStateNormal]; + [UICommon setTitleAndImage:btn :1.2]; + [self.view addSubview:btn]; + [btn mas_makeConstraints:^(MASConstraintMaker *make) { + if (btnTitleArr.count == 1) + make.centerX.equalTo(self.view); + else + { + if (i == 0) + make.right.equalTo(self.view.mas_centerX).inset(Adapted(21)); + else + make.left.equalTo(self.view.mas_centerX).offset(Adapted(21)); + } + make.top.equalTo(otherLabel.mas_bottom).offset(Adapted(25)); + make.size.mas_equalTo(CGSizeMake(50, 75)); + }]; + } + + UITextView *agreementView = [[UITextView alloc] init]; agreementView.backgroundColor = [UIColor clearColor]; @@ -55,69 +263,47 @@ //去除配置 可自定义链接样式 agreementView.linkTextAttributes = @{}; // lable.text = @"点击“注册”即表示你同意《用户服务协议》"; - NSString * userAgreement = GJText(@"用户服务协议"); - NSString * privacyPolicy = GJText(@"隐私政策"); - NSString * allStr = [NSString stringWithFormat:GJText(@"点击登录即表示您同意%@和%@"),userAgreement,privacyPolicy]; + NSString * userAgreement = GJText(@"《用户服务协议》"); + NSString * privacyPolicy = GJText(@"《隐私政策》"); + NSString * allStr = [NSString stringWithFormat:GJText(@"登录即代表同意%@和%@并使用本机号码登录"),userAgreement,privacyPolicy]; NSMutableAttributedString * attributedStr = [[NSMutableAttributedString alloc] initWithString:allStr]; - + [attributedStr addAttribute:NSForegroundColorAttributeName value:KKMainColor range:[allStr rangeOfString:userAgreement]]; [attributedStr addAttribute:NSLinkAttributeName value:AccoutXieYiURLStr range:[allStr rangeOfString:userAgreement]]; - + [attributedStr addAttribute:NSForegroundColorAttributeName value:KKMainColor range:[allStr rangeOfString:privacyPolicy]]; [attributedStr addAttribute:NSLinkAttributeName value:PrivacyPolicyURLStr range:[allStr rangeOfString:privacyPolicy]]; - - [attributedStr addAttribute:NSForegroundColorAttributeName value:KKGrey121 range:[allStr rangeOfString:GJText(@"点击登录即表示您同意")]]; + + [attributedStr addAttribute:NSForegroundColorAttributeName value:KKGrey121 range:[allStr rangeOfString:GJText(@"登录即代表同意")]]; [attributedStr addAttribute:NSForegroundColorAttributeName value:KKGrey121 range:[allStr rangeOfString:GJText(@"和")]]; - + [attributedStr addAttribute:NSForegroundColorAttributeName value:KKGrey121 range:[allStr rangeOfString:GJText(@"并使用本机号码登录")]]; + agreementView.attributedText = attributedStr; - agreementView.textAlignment = NSTextAlignmentCenter; - agreementView.font =FontADA_(10); + agreementView.textAlignment = NSTextAlignmentLeft; + agreementView.font = FontADA_(10); [self.view addSubview:agreementView]; [agreementView mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerX.equalTo(self.view.mas_centerX); + make.left.equalTo(self.view).offset(60.5); make.bottom.equalTo(self.view.mas_bottom).inset(iPhoneX_TabbarSafeBottomMargin > 0 ? iPhoneX_TabbarSafeBottomMargin : 34); - make.height.offset(30); - make.width.offset(SCREEN_WIDTH-28); + make.height.offset(38); + make.width.offset(SCREEN_WIDTH-60.5-22); }]; - - /// 邮箱登录 - UIButton *weChatBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(15) normalColor:KKWhiteColorColor normalText:[WXApi isWXAppInstalled] ? GJText(@" 微信登录") : GJText(@"手机号登录") click:^(id x) { - if ([WXApi isWXAppInstalled]) - { - [self WXAccredit]; - } - else - { - EmailLoginViewController *vc = [EmailLoginViewController new]; - [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; - } + UIButton *agreementBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(16) normalColor:KKWhiteColorColor normalText:@"" click:^(UIButton *btn) { + btn.selected = !btn.selected; }]; - if ([WXApi isWXAppInstalled]) - [weChatBtn setImage:ImageName_(@"login_wechatBtn") forState:0]; - weChatBtn.backgroundColor = RGB(255, 173, 1); - weChatBtn.layer.cornerRadius = 5; - weChatBtn.layer.masksToBounds = YES; - [self.view addSubview:weChatBtn]; - [weChatBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.bottom.equalTo(agreementView.mas_top).inset(Adapted(60)); - make.left.right.equalTo(self.view).inset(Adapted(20)); - make.height.mas_equalTo(Adapted(44)); + [agreementBtn setImage:ImageName_(@"login_no_the_selected_icon") forState:UIControlStateNormal]; + [agreementBtn setImage:ImageName_(@"login_the_selected_icon") forState:UIControlStateSelected]; + self.agreementBtn = agreementBtn; + [self.view addSubview:agreementBtn]; + [agreementBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(agreementView.mas_centerY); + make.left.equalTo(self.view).offset(40); + make.size.mas_equalTo(CGSizeMake(Adapted(13), Adapted(13))); }]; - - UIButton *otherBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(13) normalColor:KKGrey143 normalText:@"其他方式登录" click:^(id x) { - EmailLoginViewController *vc = [EmailLoginViewController new]; - [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; - }]; - otherBtn.hidden = [WXApi isWXAppInstalled] ? NO : YES; - self.otherBtn = otherBtn; - [self.view addSubview:otherBtn]; - [otherBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerX.equalTo(self.view); - make.top.equalTo(weChatBtn.mas_bottom).offset(20); - make.size.mas_equalTo(CGSizeMake(200, 30)); - }]; + [self aucnTexg]; + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; if (![userDefaults objectForKey:@"启动次数"]) @@ -228,6 +414,57 @@ }]; } +#pragma mark 登录 +/// 登录 +- (void)UserLogin +{ + self.loginBtn.selected = NO; + if (!self.phoneField.text || self.phoneField.text.length != 11) + { + [UICommon MessageErrorText:GJText(@"请输入正确的手机号")]; + return; + } + else if (self.passField.text.length < 6) + { + [UICommon MessageErrorText:GJText(@"密码为6~16位字符内")]; + return; + } + if (!self.agreementBtn.selected) + { + [UICommon MessageErrorText:GJText(@"请同意用户服务协议和隐私政策")]; + return; + } + self.loginBtn.selected = YES; + self.loginBtn.enabled = NO; + [UICommon MessageUpload:@"登录中"]; + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [parameters setValue:self.phoneField.text forKey:@"phone"]; + [parameters setValue:self.passField.text forKey:@"password"]; + [[[APIManager sharedManager] APPOST:UserLogin_URL parameters:parameters isJson:YES resultClass:LoginModel.class] subscribeNext:^(id _Nullable x) { + NSMutableDictionary *userDic = [NSMutableDictionary dictionary]; + [userDic setValue:self.phoneField.text forKey:@"phone"]; + [userDic setValue:self.isRememberPWD ? self.passField.text : @"" forKey:@"password"]; + [userDic setValue:self.isRememberPWD ? @"1" : @"0" forKey:@"isRememberPWD"]; +// [userDic setValue:self.countryCodeLabel.text forKey:@"code"]; +// [userDic setValue:self.countryTitleLabel.text forKey:@"gj"]; + YYCache *userCache = [YYCache cacheWithName:UserCacheName]; + [userCache setObject:userDic forKey:UserCacheKey]; + + AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate; + [app showRootViewController]; + self.loginBtn.enabled = YES; + self.loginBtn.selected = NO; + + } error:^(NSError * _Nullable error) { + self.loginBtn.enabled = YES; + self.loginBtn.selected = NO; + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + + + #pragma mark UITextViewDelegate - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange { @@ -276,6 +513,25 @@ } +/// 如果有账号缓存,填充账号密码 +- (void)aucnTexg +{ + kWeakSelf(self) + YYCache *yyCache = [YYCache cacheWithName:UserCacheName]; + BOOL isContains = [yyCache containsObjectForKey:UserCacheKey]; + if (isContains) + { + NSDictionary *dic = (NSDictionary *)[yyCache objectForKey:UserCacheKey]; + weakself.phoneField.text = dic[@"phone"]; + weakself.passField.text = dic[@"password"]; +// weakself.countryCodeLabel.text = dic[@"code"]; +// weakself.countryTitleLabel.text = dic[@"gj"]; + NSString *is = dic[@"isRememberPWD"]; + [weakself.rememberPassBtn setSelected:[is isEqualToString:@"1"] ? YES : NO]; + weakself.isRememberPWD = [is isEqualToString:@"1"] ? YES : NO; + } +} + /* #pragma mark - Navigation diff --git a/LekangGuard/Managers/APIManager.h b/LekangGuard/Managers/APIManager.h index 11a9af9..ff6018d 100644 --- a/LekangGuard/Managers/APIManager.h +++ b/LekangGuard/Managers/APIManager.h @@ -24,6 +24,8 @@ extern NSString *const sDeviceKey; @property (nonatomic ,strong) MyUserMsgModel *userModel; +@property (nonatomic ,strong) NSMutableArray *deviceList; + /** * 获取单例 */ diff --git a/LekangGuard/Managers/APIManager.m b/LekangGuard/Managers/APIManager.m index e7bacf1..47ec8e6 100644 --- a/LekangGuard/Managers/APIManager.m +++ b/LekangGuard/Managers/APIManager.m @@ -24,6 +24,7 @@ NSString *const sRelogin = @"sRelogin"; NSString *const sLoginKey = @"sLoginModel"; NSString *const sDeviceKey = @"sDeviceModel"; NSString *const sUserKey = @"sUserModel"; +NSString *const sDeviceListKey = @"sDeviceListKey"; NSString *const kErrorDomain = @"kErrorDomain"; NSInteger const kErrorException = 500; @@ -62,6 +63,14 @@ NSInteger const kErrorException = 500; apitance.userModel = object; } } + if ([apitance.cache containsObjectForKey:sDeviceListKey]) + { + id object = [apitance.cache objectForKey:sDeviceListKey]; + if ([object isKindOfClass:NSMutableArray.class]) + { + apitance.deviceList = object; + } + } }); return apitance; } @@ -147,6 +156,20 @@ NSInteger const kErrorException = 500; [self.cache setObject:model forKey:sUserKey]; }]; } + else if ([URL isEqualToString:BindDevice_URL]) + { + return [[self APHTTPWithMethod:MSRequestMethodGET URL:URL isJson:NO parameters:parameters resultClass:resultClass] doNext:^(NSArray *arr) { + [self.deviceList removeAllObjects]; + NSMutableArray *devArr = [NSMutableArray new]; + for (NSDictionary *dic in arr) + { + DeviceModel *model = [DeviceModel yy_modelWithJSON:dic]; + [devArr addObject:model]; + } + self.deviceList = devArr; + [self.cache setObject:devArr forKey:sDeviceListKey]; + }]; + } else return [self APHTTPWithMethod:MSRequestMethodGET URL:URL isJson:NO parameters:parameters resultClass:resultClass]; } @@ -721,6 +744,12 @@ NSInteger const kErrorException = 500; return request; } +- (NSMutableArray *)deviceList +{ + if (!_deviceList)_deviceList = [NSMutableArray new]; + return _deviceList; +} + @end diff --git a/LekangGuard/Map/Fence(电子围栏)/View/ElectronicFenceTableViewCell.m b/LekangGuard/Map/Fence(电子围栏)/View/ElectronicFenceTableViewCell.m index b638c00..72f7258 100644 --- a/LekangGuard/Map/Fence(电子围栏)/View/ElectronicFenceTableViewCell.m +++ b/LekangGuard/Map/Fence(电子围栏)/View/ElectronicFenceTableViewCell.m @@ -144,7 +144,7 @@ [deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView.mas_right).inset(10); make.centerY.equalTo(openBtn); - make.size.mas_equalTo(CGSizeMake(Adapted(rect.size.width)+deleteBtn.currentImage.size.width, 17)); + make.size.mas_equalTo(CGSizeMake(Adapted(rect.size.width)+deleteBtn.currentImage.size.width+5, 17)); }]; /// 编辑 diff --git a/LekangGuard/Map/VC/MapViewController.m b/LekangGuard/Map/VC/MapViewController.m index bc7d514..9a80e43 100644 --- a/LekangGuard/Map/VC/MapViewController.m +++ b/LekangGuard/Map/VC/MapViewController.m @@ -11,22 +11,35 @@ #import "MarkExplainViewController.h" #import "ElectronicFenceViewController.h" #import "TrackViewController.h" +#import "SLMarqueeControl.h" +#import "MapBtnTableViewCell.h" @interface MapViewController () @property (nonatomic ,strong) UIView *topView; -/// 定位图片 -@property (nonatomic ,weak) UIImageView *mapImg; -/// 定位时间Label -@property (nonatomic ,weak) UILabel *timeLabel; +@property (nonatomic ,strong) UIView *bottomView; -/// 电量图片 -@property (nonatomic ,weak) UIImageView *electricityImg; +/// 设备名称 +@property (nonatomic ,weak) UILabel *nameLabel; + +/// 电量Img +@property (nonatomic ,weak) UIImageView *batteryImg; /// 电量Label -@property (nonatomic ,weak) UILabel *electricityLabel; +@property (nonatomic ,weak) UILabel *batteryLabel; + +/// 状态Img +@property (nonatomic ,weak) UIImageView *statusImg; + +/// 状态Label +@property (nonatomic ,weak) UILabel *statusLabel; + +/// 定位图片 +@property (nonatomic ,weak) UIImageView *mapImg; +// 定位地址内容标题 +@property (weak, nonatomic) SLMarqueeControl *marqueeControl; /// 位置 @property (nonatomic ,weak) UILabel *addLabel; @@ -37,6 +50,14 @@ /// 谷歌地图 @property (nonatomic ,strong) GoogleMapView *googleMapView; +/// 地图模式切换View +@property (nonatomic ,strong) UIView *mapSwitchView; + +@property (nonatomic ,strong) CommonTableView *btnTableView; + +@property (nonatomic ,strong) NSMutableArray *cellTitleArr; +@property (nonatomic ,strong) NSMutableArray *cellImageArr; + @end @implementation MapViewController @@ -44,13 +65,41 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - self.zx_navTitle = GJText(@"定位"); self.view.backgroundColor = KKBackgroundGrey; - [self.view addSubview:self.topView]; + + self.zx_navLeftBtn.titleLabel.font = FontBoldADA_(18); + [self.zx_navLeftBtn setTitleColor:KKWhiteColorColor forState:0]; + + [self zx_setRightBtnWithImg:ImageName_(@"icon_switch_devices") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) { + [self isMapShowMenu]; + }]; + //[self.cellTitleArr addObject:@"手表短信"]; + [self.cellTitleArr addObject:@"定位模式"]; + [self.cellTitleArr addObject:@"定位说明"]; + //[self.cellTitleArr addObject:@"定位纠偏"]; + // [self.cellImageArr addObject:@"icon_watch_sms"]; + [self.cellImageArr addObject:@"icon_map_mode"]; + [self.cellImageArr addObject:@"icon_explain"]; + // [self.cellImageArr addObject:@"icon_correction"]; + [self.view addSubview:self.gdMapView]; + [self.view addSubview:self.topView]; + [self.view addSubview:self.bottomView]; + [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.view).inset(10); + make.bottom.equalTo(self.view.mas_bottom).inset(10); + make.height.mas_equalTo(136); + }]; + + [self.view addSubview:self.btnTableView]; + [self.view addSubview:self.mapSwitchView]; + [self.mapSwitchView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.view.mas_right).inset(85); + make.bottom.equalTo(self.bottomView.mas_top).inset(5); + make.size.mas_equalTo(CGSizeMake(80, 90)); + }]; - [self rightBtns]; [[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"updateBatteryAndLocation" object:nil] subscribeNext:^(NSNotification *x){ [self UpdataLatestlocation:APIManager.sharedManager.deviceModel.imei]; @@ -59,67 +108,30 @@ { [self UpdataLatestlocation:APIManager.sharedManager.deviceModel.imei]; }]; -} + +} -- (void)rightBtns +/// 点击切换设备 +- (void)isMapShowMenu { - NSMutableArray *btnsTitleArr = [NSMutableArray new]; - NSMutableArray *btnsImgArr = [NSMutableArray new]; - - [btnsTitleArr addObject:GJText(@"定位")]; - [btnsImgArr addObject:@"icon_location_positioning"]; - [btnsTitleArr addObject:GJText(@"历史轨迹")]; - [btnsImgArr addObject:@"icon_location_history"]; - if (APIManager.sharedManager.deviceModel.electronicFence) - { - [btnsTitleArr addObject:GJText(@"电子围栏")]; - [btnsImgArr addObject:@"icon_location_security_fence"]; - } - [btnsTitleArr addObject:GJText(@"定位说明")]; - [btnsImgArr addObject:@"icon_histroy_g"]; - - for (int i = 0; i < btnsImgArr.count; i++) - { - NSString *title = [btnsTitleArr objectAtIndex:i]; - NSString *image = [btnsImgArr objectAtIndex:i]; - UIButton *button = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(8) normalColor:RGB(153, 153, 153) normalText:title click:^(UIButton *btn) { - if ([btn.currentTitle isEqualToString:GJText(@"定位")]) - { - [self GetLatest]; - } - else if ([btn.currentTitle isEqualToString:GJText(@"历史轨迹")]) - { - TrackViewController *vc = [TrackViewController new]; - [self.navigationController pushViewController:vc animated:YES]; - } - else if ([btn.currentTitle isEqualToString:GJText(@"电子围栏")]) - { - ElectronicFenceViewController *vc = [ElectronicFenceViewController new]; - [self.navigationController pushViewController:vc animated:YES]; - } - else if ([btn.currentTitle isEqualToString:GJText(@"定位说明")]) - { - MarkExplainViewController *vc = [MarkExplainViewController new]; - [self.navigationController pushViewController:vc animated:YES]; - } - }]; - [button setImage:ImageName_(image) forState:0]; - button.frame = CGRectMake(SCREEN_WIDTH-Adapted(40)-15, self.topView.bottom+Adapted(30)+Adapted(40)*i+15*i, Adapted(40), Adapted(40)); - button.backgroundColor = KKWhiteColorColor; - [UICommon setBtnUpImageDownTitle:button]; - button.layer.cornerRadius = 5; - button.layer.masksToBounds = YES; - button.tag = i; - [self.view addSubview:button]; - } + WeakSelf + [DeviceSwitchover.sharedManager showMenuViewWithAdd:NO ]; + [DeviceSwitchover.sharedManager setSwitchDevice:^(NSInteger index) { + DeviceModel *model = APIManager.sharedManager.deviceList[index]; + APIManager.sharedManager.deviceModel = model; + [APIManager.sharedManager.cache setObject:model forKey:sDeviceKey]; + [weakSelf UpdataLatestlocation:model.imei]; + }]; } + + - (GDMapView *)gdMapView { if (!_gdMapView) { - _gdMapView = [[GDMapView alloc] initWithFrame:CGRectMake(0, self.topView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.topView.bottom)]; + _gdMapView = [[GDMapView alloc] initWithFrame:CGRectMake(0, iPhoneX_NavHeight, SCREEN_WIDTH, SCREEN_HEIGHT-iPhoneX_NavHeight)]; } return _gdMapView; } @@ -138,61 +150,30 @@ { if (!_topView) { - _topView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:0 borderWidth:0 borderColor:KKWhiteColorColor]; - _topView.frame = CGRectMake(0, iPhoneX_NavHeight, SCREEN_WIDTH, Adapted(70)); + _topView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:Adapted(12.5) borderWidth:0 borderColor:KKWhiteColorColor]; + _topView.frame = CGRectMake(10, iPhoneX_NavHeight+6, SCREEN_WIDTH-20, Adapted(25)); - /// 定位图片 - UIImageView *mapImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_home_base_station"]; - self.mapImg = mapImg; - [_topView addSubview:mapImg]; - [mapImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(_topView).offset(10); + UIImageView *locationTypeImageView = [UIImageView new]; + self.mapImg = locationTypeImageView; + [_topView addSubview:locationTypeImageView]; + [locationTypeImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(_topView).offset(13); make.centerY.equalTo(_topView); - make.size.mas_equalTo(CGSizeMake(30, 30)); - }]; - - /// 定位时间Label - UILabel *timeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(11) textColor:KKTextBlackColor text:@"" Radius:3]; - self.timeLabel = timeLabel; - [_topView addSubview:timeLabel]; - [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(mapImg.mas_right).inset(15); - make.top.equalTo(_topView).offset(15); - }]; - - /// 电量Label - UILabel *electricityLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(11) textColor:KKGrey102 text:@"" Radius:0]; - self.electricityLabel = electricityLabel; - [_topView addSubview:electricityLabel]; - [electricityLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(_topView.mas_right).inset(10); - make.centerY.equalTo(timeLabel); - }]; - - /// 电池图片 - UIImage *imgs = ImageName_(@"icon_home_electricity_100"); - UIImageView *electricityImg = [UICommon ui_imageView:CGRectZero fileName:@""]; - self.electricityImg = electricityImg; - [_topView addSubview:electricityImg]; - [electricityImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(electricityLabel.mas_left).inset(2); - make.centerY.equalTo(electricityLabel); - make.size.mas_equalTo(imgs.size); + make.size.mas_equalTo(CGSizeMake(15, 15)); }]; + - /// 位置 - UILabel *addLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(12) textColor:KKTextBlackColor text:GJText(@"当前位置未知,请确保设备开机且能够联网,再点击定位按钮进行定位") Radius:0]; - self.addLabel = addLabel; - [_topView addSubview:addLabel]; - [addLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(timeLabel.mas_left); - make.right.equalTo(_topView.mas_right).inset(15); - make.centerY.equalTo(_topView.mas_centerY); - }]; + /// 位置跑马灯 + SLMarqueeControl *control = [[SLMarqueeControl alloc] initWithFrame:CGRectMake(38, 5, SCREEN_WIDTH-20-38-15, 15)]; + control.backgroundColor = KKClearColor; + control.marqueeLabel.text = @"当前位置未知,请确保设备开机且能够联网,再点击定位按钮进行定位"; + self.marqueeControl = control; + [_topView addSubview:control]; } return _topView; } + - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; @@ -226,10 +207,7 @@ NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; [[[APIManager sharedManager] APGET:F(@"%@/%@", Latest_location_app_URL,imei) parameters:parameters resultClass:LatestLocationModel.class] subscribeNext:^(LatestLocationModel *model) { [UICommon HidenLoading]; - if (model != nil) - { - [self UpdataMapViewLocation:model]; - } + [self UpdataMapViewLocation:model]; NSLog(@"-->%@",model); } error:^(NSError * _Nullable error) { NSDictionary *dic = error.userInfo; @@ -240,35 +218,294 @@ - (void)UpdataMapViewLocation:(LatestLocationModel *)model { + self.gdMapView.laloModel = model; if(model) { - self.gdMapView.laloModel = model; - self.timeLabel.text = model.updateTime; - self.addLabel.text = model.addr; - self.electricityLabel.text = F(@"%ld%%", model.battery); - self.electricityImg.image = [UICommon GetElectricityImg:model.battery]; - /// 定位类型 LBS GPS,WIFI - if ([model.locationType isEqualToString:@"LBS"]) - self.mapImg.image = ImageName_(@"icon_home_base_station"); - else if ([model.locationType isEqualToString:@"GPS"]) - self.mapImg.image = ImageName_(@"icon_histroy_g"); - else if ([model.locationType isEqualToString:@"WIFI"]) - self.mapImg.image = ImageName_(@"icon_home_wifi"); + self.mapImg.image = ImageName_(@"home_icon_gps"); + self.marqueeControl.marqueeLabel.text = model.addr; + self.marqueeControl.marqueeLabel.textColor = KKGrey133; + } + else + { + self.mapImg.image = ImageName_(@"home_icon_gps_inaccurate"); + self.marqueeControl.marqueeLabel.text = @"当前位置未知,请确保设备开机且能够联网,再点击定位按钮进行定位"; + self.marqueeControl.marqueeLabel.textColor = RGB(249, 107, 87); + } + self.nameLabel.text = APIManager.sharedManager.deviceModel.name; + [self.zx_navLeftBtn setTitle:APIManager.sharedManager.deviceModel.name forState:0]; + self.statusImg.image = APIManager.sharedManager.deviceModel.onlineStatus ? ImageName_(@"icon_device_connected") : ImageName_(@"icon_device_unconnected"); + self.statusLabel.text = APIManager.sharedManager.deviceModel.onlineStatus ? @"已连接" : @"未连接"; + NSInteger battery = model.battery; + NSString *imageName = @""; + if(battery == 0) + imageName = @"battery_0"; + else if (battery < 10) + imageName = @"battery_low"; + else if (battery < 20) + imageName = @"battery_1"; + else if (battery < 30) + imageName = @"battery_2"; + else if (battery < 40) + imageName = @"battery_3"; + else if (battery < 50) + imageName = @"battery_4"; + else if (battery < 60) + imageName = @"battery_4"; + else if (battery < 70) + imageName = @"battery_6"; + else if (battery < 80) + imageName = @"battery_7"; + else if (battery < 90) + imageName = @"battery_8"; + else if (battery < 100) + imageName = @"battery_9"; + else + imageName = @"battery_10"; + + self.batteryImg.image = ImageName_(imageName); + self.batteryLabel.text = [NSString stringWithFormat:@"%ld%%",battery]; +} + + +- (UIView *)bottomView +{ + if (!_bottomView) + { + _bottomView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor]; - [self.mapImg mas_remakeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.topView).offset(10); - make.centerY.equalTo(self.topView); - make.size.mas_equalTo(CGSizeMake(AdaptedHeight(self.mapImg.image.size.width), AdaptedHeight(self.mapImg.image.size.height))); + UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBoldADA_(14) textColor:KKTextBlackColor text:@"" Radius:0]; + self.nameLabel = nameLabel; + [_bottomView addSubview:nameLabel]; + [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(_bottomView).offset(20); + make.top.equalTo(_bottomView).offset(19); }]; - [self.addLabel mas_remakeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.timeLabel.mas_left); - make.right.equalTo(self.topView.mas_right).inset(15); - make.top.equalTo(self.topView.mas_centerY); + + /// 电量图片 + UIImageView *batteryImg = [UIImageView new]; + self.batteryImg = batteryImg; + [_bottomView addSubview:batteryImg]; + [batteryImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(nameLabel.mas_left); + make.top.equalTo(nameLabel.mas_bottom).offset(15); + make.size.mas_equalTo(CGSizeMake(24.5, 10)); }]; + + /// 电量 + UILabel *batteryLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:KKTextBlackColor text:@"" Radius:0]; + self.batteryLabel = batteryLabel; + [_bottomView addSubview:batteryLabel]; + [batteryLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(batteryImg.mas_right).offset(10); + make.centerY.equalTo(batteryImg.mas_centerY); + }]; + + /// 状态图片 + UIImageView *statusImg = [UIImageView new]; + self.statusImg = statusImg; + [_bottomView addSubview:statusImg]; + [statusImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(batteryLabel.mas_right).offset(35); + make.centerY.equalTo(batteryImg.mas_centerY); + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + + /// 状态 + UILabel *statusLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:KKTextBlackColor text:@"" Radius:0]; + self.statusLabel = statusLabel; + [_bottomView addSubview:statusLabel]; + [statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(statusImg.mas_right).offset(10); + make.centerY.equalTo(batteryImg.mas_centerY); + }]; + + CGFloat ww = (SCREEN_WIDTH-40-20-100)/2; + + CGFloat wws = SCREEN_WIDTH-90-(ww*2); + NSArray *titleArr = @[@"历史轨迹",@"电子围栏",@""]; + NSArray *imageArr = @[@"icon_history",@"icon_fence",@"icon_more"]; + + for (int i = 0; i < titleArr.count; i++) + { + UIButton *button = [UICommon ui_buttonSimple:CGRectZero font:FontBoldADA_(12) normalColor:KKTextBlackColor normalText:titleArr[i] click:^(UIButton *btn) { + if (btn.tag == 0) + { + TrackViewController *vc = [TrackViewController new]; + [self.navigationController pushViewController:vc animated:YES]; + } + else if (btn.tag == 1) + { + ElectronicFenceViewController *vc = [ElectronicFenceViewController new]; + [self.navigationController pushViewController:vc animated:YES]; + } + else + { + btn.selected = !btn.selected; + if (btn.selected) + [self showView]; + else + [self dismiss]; + } + + }]; + button.tag = i; + button.layer.cornerRadius = 5; + button.layer.masksToBounds = YES; + button.backgroundColor = RGB(232, 245, 255); + [button setImage:ImageName_(imageArr[i]) forState:0]; + [_bottomView addSubview:button]; + [button mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(_bottomView).offset(20+i*ww+15*i); + make.bottom.equalTo(_bottomView.mas_bottom).inset(20); + make.size.mas_equalTo(CGSizeMake(i == 2 ? wws : ww, 35)); + }]; + } + + /// 定位 + UIButton *button = [UICommon ui_buttonSimple:CGRectZero font:FontBoldADA_(12) normalColor:KKTextBlackColor normalText:@"" click:^(UIButton *btn) { + + [self GetLatest]; + }]; + [button setImage:ImageName_(@"map_button_gps") forState:0]; + [_bottomView addSubview:button]; + [button mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(_bottomView.mas_right).inset(20); + make.top.equalTo(_bottomView).offset(15); + make.size.mas_equalTo(CGSizeMake(40, 40)); + }]; + } + return _bottomView; } +- (CommonTableView *)btnTableView +{ + if (!_btnTableView) + { + _btnTableView = [[CommonTableView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-30-50, SCREEN_HEIGHT-TabBarHeight-95, 50, 0.000001) style:UITableViewStylePlain cellHeight:71 cellRow:self.cellTitleArr.count isAdaptive:NO isLine:YES commonCell:MapBtnTableViewCell.class createCell:^(ZZTableViewCell * _Nonnull cells, NSIndexPath * _Nonnull indexPath) { + MapBtnTableViewCell *cell = (MapBtnTableViewCell *)cells; + cell.imageName = self.cellImageArr[indexPath.row]; + cell.titleName = self.cellTitleArr[indexPath.row]; + + } selectedCell:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) { + NSString *title = self.cellTitleArr[indexPath.row]; + if ([title isEqualToString:@"标准模式"] || [title isEqualToString:@"卫星模式"] || [title isEqualToString:@"3D模式"] || [title isEqualToString:@"定位模式"]) + { + BOOL ish = self.mapSwitchView.hidden; + self.mapSwitchView.hidden = !ish; + } + else if ([title isEqualToString:@"定位说明"]) + { + /// 定位说明 + MarkExplainViewController *vc = [MarkExplainViewController new]; + [self.navigationController pushViewController:vc animated:YES]; + } + else if ([title isEqualToString:@"位置纠偏"]) + { +// MapReviseViewController *vc = [[MapReviseViewController alloc] init]; +// [self.navigationController pushViewController:vc animated:YES]; + } + + } DidscrollView:^(UIScrollView * _Nonnull scrollView) {}]; + _btnTableView.layer.cornerRadius = 10; + _btnTableView.layer.masksToBounds = YES; + _btnTableView.hidden = YES; + [UICommon setTavleViewlink:_btnTableView distance:0]; + [UICommon setExtraCellLineHidden:_btnTableView]; + + } + return _btnTableView; +} + +- (void)showView +{ + self.btnTableView.hidden = NO; + self.btnTableView.size = CGSizeMake(50, self.cellTitleArr.count*71); + [UIView animateWithDuration:0.25f + delay:0.0f + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + CGRect frame = self.btnTableView.frame; + frame.origin.y = frame.origin.y - frame.size.height-10; + self.btnTableView.frame = frame; + }completion:^(BOOL finished) { + self.btnTableView.conrnerRadius(10).shadowColor(KKMainColor).shadowOffset(CGSizeMake(3, 3)).shadowRadius(5).shadowOpacity(0.1).showVisual(); + }]; +} + +- (void)dismiss +{ + self.btnTableView.conrnerRadius(10).shadowColor(KKClearColor).shadowOffset(CGSizeMake(3, 3)).shadowRadius(5).shadowOpacity(0.1).showVisual(); + self.btnTableView.clerVisual(); + self.mapSwitchView.hidden = YES; + [UIView animateWithDuration:0.25f + delay:0.0f + options:UIViewAnimationOptionCurveEaseIn + animations:^{ + CGRect frame = self.btnTableView.frame; + frame.origin.y = frame.origin.y + frame.size.height+10; + self.btnTableView.frame = frame; + }completion:^(BOOL finished) { + self.btnTableView.hidden = YES; + }]; +} +- (UIView *)mapSwitchView +{ + if (!_mapSwitchView) + { + NSArray *arr = @[@"标准模式",@"卫星模式"]; + _mapSwitchView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKClearColor]; + _mapSwitchView.hidden = YES; + for (int i = 0; i < arr.count; i++) + { + UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:Font_(14) normalColor:KKTextBlackColor normalText:arr[i] click:^(UIButton *button) { + self.mapSwitchView.hidden = YES; + [self.cellTitleArr replaceObjectAtIndex:0 withObject:button.currentTitle]; + [self.btnTableView reloadData]; + if([button.currentTitle isEqualToString:@"标准模式"]) + self.gdMapView.mapView.mapType = MKMapTypeStandard; + else if([button.currentTitle isEqualToString:@"卫星模式"]) + self.gdMapView.mapView.mapType = MKMapTypeSatellite; + else + { + + } + + }]; + [_mapSwitchView addSubview:btn]; + [btn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(_mapSwitchView); + make.top.equalTo(_mapSwitchView).offset(i*45); + make.height.mas_equalTo(45); + }]; + if (i < arr.count-1) + { + UILabel *line = [UILabel new]; + line.backgroundColor = RGB(235, 235, 235); + [_mapSwitchView addSubview:line]; + [line mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(_mapSwitchView); + make.bottom.equalTo(btn.mas_bottom); + make.height.mas_equalTo(0.5); + }]; + } + } + } + return _mapSwitchView; +} + +- (NSMutableArray *)cellTitleArr +{ + if (!_cellTitleArr) _cellTitleArr = [NSMutableArray new]; + return _cellTitleArr; +} + +- (NSMutableArray *)cellImageArr +{ + if (!_cellImageArr) _cellImageArr = [NSMutableArray new]; + return _cellImageArr; +} /* #pragma mark - Navigation diff --git a/LekangGuard/Map/VC/View/GDMapView.h b/LekangGuard/Map/VC/View/GDMapView.h index a924c03..c570853 100644 --- a/LekangGuard/Map/VC/View/GDMapView.h +++ b/LekangGuard/Map/VC/View/GDMapView.h @@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic ,strong) LatestLocationModel *laloModel; +@property (nonatomic ,strong) MKMapView *mapView; + @end NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Map/VC/View/GDMapView.m b/LekangGuard/Map/VC/View/GDMapView.m index 4e707f2..5833ba8 100644 --- a/LekangGuard/Map/VC/View/GDMapView.m +++ b/LekangGuard/Map/VC/View/GDMapView.m @@ -13,7 +13,7 @@ #define DefineLocate CLLocationCoordinate2DMake(39.9086828351,116.3980865479) @interface GDMapView () -@property (nonatomic ,strong) MKMapView *mapView; + @property (strong, nonatomic) CLLocationManager *locationManager; @@ -52,6 +52,7 @@ self.curPointAnnotation.coordinate = CLLocationCoordinate2DMake([laloModel.latitude doubleValue], [laloModel.longitude doubleValue]); [self setMapZoom:CLLocationCoordinate2DMake([laloModel.latitude doubleValue], [laloModel.longitude doubleValue])]; + [self mapView:self.mapView didSelectAnnotationView:[CustomAnnotationView new]]; } } diff --git a/LekangGuard/Map/VC/View/MapBtnTableViewCell.h b/LekangGuard/Map/VC/View/MapBtnTableViewCell.h new file mode 100644 index 0000000..9c152c3 --- /dev/null +++ b/LekangGuard/Map/VC/View/MapBtnTableViewCell.h @@ -0,0 +1,20 @@ +// +// MapBtnTableViewCell.h +// tongxin +// +// Created by ecell on 2023/8/9. +// Copyright © 2023 xTT. All rights reserved. +// + +#import "ZZTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MapBtnTableViewCell : ZZTableViewCell + +@property (nonatomic ,strong) NSString *imageName; +@property (nonatomic ,strong) NSString *titleName; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Map/VC/View/MapBtnTableViewCell.m b/LekangGuard/Map/VC/View/MapBtnTableViewCell.m new file mode 100644 index 0000000..4476a5b --- /dev/null +++ b/LekangGuard/Map/VC/View/MapBtnTableViewCell.m @@ -0,0 +1,76 @@ +// +// MapBtnTableViewCell.m +// tongxin +// +// Created by ecell on 2023/8/9. +// Copyright © 2023 xTT. All rights reserved. +// + +#import "MapBtnTableViewCell.h" + +@interface MapBtnTableViewCell () + +@property (nonatomic ,weak) UIImageView *iconImg; +@property (nonatomic ,weak) UILabel *titleLabel; + +@end + +@implementation MapBtnTableViewCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) + { + self.selectionStyle = UITableViewCellSelectionStyleNone; + self.backgroundColor = KKClearColor; + [self subCellView]; + } + + return self; +} + +- (void)setImageName:(NSString *)imageName +{ + _imageName = imageName; + self.iconImg.image = ImageName_(imageName); +} + +- (void)setTitleName:(NSString *)titleName +{ + _titleName = titleName; + self.titleLabel.text = titleName; +} + +- (void)subCellView +{ + UIImageView *iconImg = [UIImageView new]; + self.iconImg = iconImg; + [self.contentView addSubview:iconImg]; + [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.contentView); + make.top.equalTo(self.contentView).offset(10); + make.height.width.mas_equalTo(30); + }]; + + UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(10) textColor:KKTextBlackColor text:@"" Radius:0]; + self.titleLabel = titleLabel; + [self.contentView addSubview:titleLabel]; + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.contentView); + make.top.equalTo(iconImg.mas_bottom).offset(5); + }]; +} + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/LekangGuard/My/VC/MyViewController.m b/LekangGuard/My/VC/MyViewController.m index c761b1f..05fd935 100644 --- a/LekangGuard/My/VC/MyViewController.m +++ b/LekangGuard/My/VC/MyViewController.m @@ -11,19 +11,20 @@ #import "AboutViewController.h" #import "DPClearCacheTool.h" #import "ModifyDataViewController.h" +#import "MyTableViewHeaderView.h" +#import "MyTableViewCell.h" -@interface MyViewController () -@property (nonatomic ,strong) UIScrollView *myScroll; +@interface MyViewController () -@property (nonatomic ,weak) UIView *headerView; -@property (nonatomic ,weak) UIView *bgView; -@property (nonatomic ,weak) UILabel *cacheLabel; +@property (strong, nonatomic)NSMutableArray * iconImageArr; +@property (strong, nonatomic)NSMutableArray * myDataSource; -@property (nonatomic ,assign) UILabel *nameLabel; -@property (nonatomic ,assign) UILabel *phoneLabel; -@property (nonatomic ,assign) UIButton *iconImg; +@property (nonatomic ,strong) UITableView *moreTableView; -@property (nonatomic ,weak) UILabel *newsMeg; +@property (nonatomic ,strong) MyTableViewHeaderView *headerView; + + +@property (nonatomic ,strong) NSNumber *messageCount; @property (nonatomic ,strong) MyUserMsgModel *userModel; @@ -35,162 +36,15 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - self.zx_navTitle = GJText(@"我的"); - self.view.backgroundColor = KKBackgroundGrey; - [self.view addSubview:self.myScroll]; - [self.myScroll mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self.view); - make.top.equalTo(self.view).offset(iPhoneX_NavHeight); - make.bottom.equalTo(self.view.mas_bottom); - }]; - //[self QueryMsg]; - - NSArray *titleArr = @[@[@""], - @[GJText(@"消息中心"),GJText(@"清除缓存")], - @[GJText(@"关于我们"),GJText(@"常见问题")], - //@[GJText(@"地图切换")] - ]; - NSArray *imgeArr = @[@[@""], - @[@"icon_my_message_center",@"icon_my_clear_the_cache"], - @[@"icon_my_about_us",@"icon_my_common_problems"], - //@[@"icon_common_map"] - ]; - for (int i = 0; i < titleArr.count; i++) - { - CGFloat hh = Adapted(100); - //if (i == titleArr.count-1) hh = Adapted(50); - UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:8 borderWidth:0 borderColor:KKWhiteColorColor]; - bgView.frame = CGRectMake(10, 10+i*10+Adapted(100)*i, SCREEN_WIDTH-20, hh); - if(i == 0) self.headerView = bgView; - else if(i == titleArr.count-1) self.bgView = bgView; - [self.myScroll addSubview:bgView]; - - if (i > 0) - { - NSArray *tArr = titleArr[i]; - NSArray *iarr = imgeArr[i]; - for (int j = 0; j < tArr.count; j++) - { - UIImageView *leftImg = [UICommon ui_imageView:CGRectZero fileName:iarr[j]]; - [bgView addSubview:leftImg]; - - UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(14) normalColor:KKTextBlackColor normalText:tArr[j] click:^(UIButton *button) { - if ([button.currentTitle isEqualToString:GJText(@"消息中心")]) - { - MessageViewController *vc = [MessageViewController new]; - vc.selectedIndex = 0; - [self.navigationController pushViewController:vc animated:YES]; - } - else if ([button.currentTitle isEqualToString:GJText(@"常见问题")]) - { - ProblemViewController *vc = [ProblemViewController new]; - [self.navigationController pushViewController:vc animated:YES]; - } - else if ([button.currentTitle isEqualToString:GJText(@"关于我们")]) - { - AboutViewController *vc = [AboutViewController new]; - [self.navigationController pushViewController:vc animated:YES]; - } - else if ([button.currentTitle isEqualToString:GJText(@"清除缓存")]) - { - EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"提示") subtitle:GJText(@"确定要清除缓存吗?") AlertViewType:AlertViewTypeSystemAlert config:nil]; - [alertV addAlertItem:^EasyAlertItem *{ - return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:nil]; - }]; - [alertV addAlertItem:^EasyAlertItem *{ - return [EasyAlertItem itemWithTitle:GJText(@"确定") type:AlertItemTypeSystemDefault callback:^(EasyAlertView *showview, long index) { - //[UICommon MessageUpload:@"清除缓存中"]; - [DPClearCacheTool clearCaches]; - AfterDispatch(1, ^{ - //[UICommon HidenLoading]; - self.cacheLabel.text = [DPClearCacheTool getCacheSize]; - }); - }]; - }]; - [alertV showAlertView]; - } - }]; - btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; - [bgView addSubview:btn]; - [btn mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(bgView).offset(Adapted(50)*j); - make.left.equalTo(bgView).offset(Adapted(leftImg.image.size.width)+20); - make.right.equalTo(bgView.mas_right); - make.height.mas_equalTo(Adapted(50)); - }]; - - [leftImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(bgView).offset(10); - make.centerY.equalTo(btn); - make.size.mas_equalTo(CGSizeMake(Adapted(leftImg.image.size.width), Adapted(leftImg.image.size.height))); - }]; - - UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; - [bgView addSubview:rightImg]; - [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(bgView.mas_right).inset(10); - make.centerY.equalTo(btn); - make.size.mas_equalTo(rightImg.image.size); - }]; - if (i == 1 && j == 0) - { - /// 未读消息展示红点 - UILabel *newsMeg = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKGrey121 text:@"" Radius:5]; - newsMeg.backgroundColor = UIColor.redColor; - newsMeg.hidden = YES; - self.newsMeg = newsMeg; - [bgView addSubview:newsMeg]; - [newsMeg mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(rightImg.mas_left).inset(15); - make.centerY.equalTo(btn); - make.width.height.mas_equalTo(10); - }]; - } - - if (i == 1 && j == 1) - { - ///缓存显示 - UILabel *cacheLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKGrey121 text:[DPClearCacheTool getCacheSize] Radius:0]; - self.cacheLabel = cacheLabel; - [bgView addSubview:cacheLabel]; - [cacheLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(rightImg.mas_left).inset(15); - make.centerY.equalTo(btn); - }]; - } - - if (tArr.count > 1) - { - UILabel *line = [UILabel new]; - line.backgroundColor = KKLineColor; - [bgView addSubview:line]; - [line mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(bgView); - make.centerY.equalTo(bgView); - make.height.mas_equalTo(0.5); - }]; - } - } - } - else - { - UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(0) normalColor:KKTextBlackColor normalText:@"" click:^(UIButton *button) { - ModifyDataViewController *vc = [ModifyDataViewController new]; - vc.model = self.userModel; - [self.navigationController pushViewController:vc animated:YES]; - }]; - [bgView addSubview:btn]; - [btn mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(bgView); - make.left.right.equalTo(bgView); - make.height.mas_equalTo(hh); - }]; - } - } + self.view.backgroundColor = RGB(245, 248, 255); + self.zx_navBarBackgroundColor = KKClearColor; + self.zx_navLeftBtn.titleLabel.font = FontBoldADA_(18); + [self.zx_navLeftBtn setZx_tintColor:KKTextBlackColor]; + [self.zx_navLeftBtn setTitle:@"我的" forState:0]; + [self.zx_navRightBtn setZx_imageColor:KKTextBlackColor]; - UIButton *outLoginBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(15) normalColor:KKWhiteColorColor normalText:GJText(@"退出登录") click:^(id x) { - + [self zx_setRightBtnWithImg:ImageName_(@"icon_exit") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) { EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:nil subtitle:GJText(@"确定退出登录吗") AlertViewType:AlertViewTypeSystemActionSheet config:nil]; [alertV addAlertItem:^EasyAlertItem *{ return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:nil]; @@ -201,74 +55,140 @@ [alertV showAlertView]; }]; - outLoginBtn.backgroundColor = KKMainColor; - outLoginBtn.layer.cornerRadius = 8; - outLoginBtn.layer.masksToBounds = YES; - [self.view addSubview:outLoginBtn]; - [outLoginBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self.view).inset(10); - make.top.equalTo(self.bgView.mas_bottom).offset(Adapted(50)); - make.height.mas_equalTo(Adapted(45)); - }]; - UIButton *cancelBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(15) normalColor:UIColor.redColor normalText:GJText(@"注销用户(谨慎)") click:^(id x) { - EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"警告:注销用户信息将被清空无法恢复,请确认是否注销!") subtitle:nil AlertViewType:AlertViewTypeSystemAlert config:nil]; + self.myDataSource = [[NSMutableArray alloc] initWithObjects:@"消息中心",@"校园通知",@"关于我们",@"常见问题",@"清除缓存",@"意见反馈", nil]; + self.iconImageArr = [[NSMutableArray alloc] initWithObjects:@"icon_message_center",@"icon_campus_news",@"icon_aboutus",@"icon_question",@"icon_cleanup",@"icon_feedback", nil]; + + [self.view addSubview:self.moreTableView]; + +} + +- (UITableView *)moreTableView +{ + if (!_moreTableView) + { + _moreTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, iPhoneX_NavHeight, SCREEN_WIDTH, SCREEN_HEIGHT-iPhoneX_NavHeight-TabBarHeight) style:UITableViewStylePlain]; + _moreTableView.delegate = self; + _moreTableView.dataSource = self; + _moreTableView.backgroundColor = KKClearColor; + _moreTableView.tableHeaderView = self.headerView; + _moreTableView.tableHeaderView.height = 185; + [_moreTableView registerClass:MyTableViewCell.class forCellReuseIdentifier:NSStringFromClass(MyTableViewCell.class)]; + [UICommon setTavleViewlink:_moreTableView distance:10]; + } + return _moreTableView; +} + +- (MyTableViewHeaderView *)headerView +{ + if (!_headerView) + { + _headerView = [[MyTableViewHeaderView alloc] init]; + _headerView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 185); + [_headerView seCellModel]; + } + return _headerView; +} + + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return self.myDataSource.count; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + + return 55; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + MyTableViewCell *cell = [MyTableViewCell cellWithTableView:tableView indexPath:indexPath]; + cell.imageName = self.iconImageArr[indexPath.row]; + cell.titleName = self.myDataSource[indexPath.row]; + cell.messageCount = self.messageCount; + [UICommon tableView:tableView willDisplayCell:cell forRowAtIndexPath:indexPath cellCoutn:self.myDataSource.count sizeH:10]; + return cell; +} + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + kWeakSelf(self) + NSString *title = self.myDataSource[indexPath.row]; + if ([title isEqualToString:@"消息中心"]) + { + MessageViewController *vc = [MessageViewController new]; + vc.selectedIndex = 0; + [self.navigationController pushViewController:vc animated:YES]; + } + else if ([title isEqualToString:@"意见反馈"]) + { + NSString *string = [NSString stringWithFormat:@"mailto://support@ecellsz.com ?subject=%@意见反馈",APPName]; + string = [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + NSURL *emailURL = [NSURL URLWithString:string]; + [[UIApplication sharedApplication] openURL:emailURL options:[NSDictionary new] completionHandler:nil]; + } + else if ([title isEqualToString:@"清除缓存"]) + { + EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"提示") subtitle:GJText(@"确定要清除缓存吗?") AlertViewType:AlertViewTypeSystemAlert config:nil]; [alertV addAlertItem:^EasyAlertItem *{ - return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:^(EasyAlertView *showview, long index) { - - }]; + return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:nil]; }]; [alertV addAlertItem:^EasyAlertItem *{ return [EasyAlertItem itemWithTitle:GJText(@"确定") type:AlertItemTypeSystemDefault callback:^(EasyAlertView *showview, long index) { - [self UserCancel]; + [DPClearCacheTool clearCaches]; + AfterDispatch(1, ^{ + [self.moreTableView reloadData]; + }); }]; }]; [alertV showAlertView]; - - }]; - cancelBtn.layer.borderWidth = 1; - cancelBtn.layer.borderColor = UIColor.redColor.CGColor; - cancelBtn.layer.cornerRadius = 8; - [self.view addSubview:cancelBtn]; - [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self.view).inset(10); - make.top.equalTo(outLoginBtn.mas_bottom).offset(Adapted(20)); - make.height.mas_equalTo(Adapted(45)); - }]; - - /// 头像 - UIButton *iconImg = [UICommon ui_buttonSimple:CGRectZero font:0 normalColor:KKWhiteColorColor normalText:@"" click:^(id x) { - ModifyDataViewController *vc = [ModifyDataViewController new]; - vc.model = self.userModel; + } + else if ([title isEqualToString:@"关于我们"]) + { + AboutViewController *vc = [AboutViewController new]; [self.navigationController pushViewController:vc animated:YES]; - }]; - iconImg.layer.cornerRadius = Adapted(33); - iconImg.layer.masksToBounds = YES; - iconImg.backgroundColor = KKWhiteColorColor; - self.iconImg = iconImg; - [self.headerView addSubview:iconImg]; - [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.headerView).offset(15); - make.centerY.equalTo(self.headerView); - make.width.height.mas_equalTo(Adapted(66)); - }]; - - UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBoldADA_(18) textColor:KKTextBlackColor text:@"" Radius:0]; - self.nameLabel = nameLabel; - [self.headerView addSubview:nameLabel]; - [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(iconImg.mas_right).offset(10); - make.top.equalTo(iconImg).offset(5); - }]; - - UILabel *phoneLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(15) textColor:KKGrey219 text:@"" Radius:0]; - self.phoneLabel = phoneLabel; - [self.headerView addSubview:phoneLabel]; - [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(nameLabel.mas_left); - make.bottom.equalTo(iconImg.mas_bottom).inset(5); - }]; - + } + else if ([title isEqualToString:@"修改密码"]) + { + } + else if ([title isEqualToString:@"常见问题"]) + { + ProblemViewController *vc = [ProblemViewController new]; + [self.navigationController pushViewController:vc animated:YES]; + } +} + + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ + if (section == 0) { + return 130; + } + return 0.01; +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ + UIView *view = [[UIView alloc] initWithFrame:CGRectZero]; + if (section == 0) + { + UIButton *btn2 = [UICommon ui_buttonSimple:CGRectMake(20, 50,SCREEN_WIDTH-40, 50) font:FontBold_(18) normalColor:KKWhiteColorColor normalText:@"注销用户(谨慎)" click:^(id x) { + EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"警告:注销用户信息将被清空无法恢复,请确认是否注销!") subtitle:nil AlertViewType:AlertViewTypeSystemAlert config:nil]; + [alertV addAlertItem:^EasyAlertItem *{ + return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:^(EasyAlertView *showview, long index) {}]; + }]; + [alertV addAlertItem:^EasyAlertItem *{ + return [EasyAlertItem itemWithTitle:GJText(@"确定") type:AlertItemTypeSystemDefault callback:^(EasyAlertView *showview, long index) { + [self UserCancel]; + }]; + }]; + [alertV showAlertView]; + }]; + [btn2 setBackgroundColor:KKMainColor]; + btn2.layer.cornerRadius = 25; + btn2.layer.masksToBounds = YES; + [view addSubview:btn2]; + + } + return view; } - (void)viewWillAppear:(BOOL)animated @@ -290,9 +210,8 @@ if (model != nil) { self.userModel = model; - [self.iconImg sd_setImageWithURL:[NSURL URLWithString:model.image] forState:0 placeholderImage:ImageName_(@"icon_adults_occupies_the_head")]; - self.nameLabel.text = model.name; - self.phoneLabel.text = F(@"%@:%@",GJText(@"号码"), model.phone.length > 0 ? model.phone : @"--"); + [self.headerView seCellModel]; + [self.moreTableView reloadData]; } } error:^(NSError * _Nullable error) { @@ -349,7 +268,7 @@ { [arr enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) { NSInteger total = [obj[@"total"] integerValue]; - weakself.newsMeg.hidden = total > 0 ? NO : YES; +// weakself.newsMeg.hidden = total > 0 ? NO : YES; }]; } @@ -361,15 +280,7 @@ } -- (UIScrollView *)myScroll -{ - if (!_myScroll) - { - _myScroll = [UIScrollView new]; - _myScroll.backgroundColor = KKClearColor; - } - return _myScroll; -} + /* #pragma mark - Navigation diff --git a/LekangGuard/My/VC/View/MyTableViewCell.h b/LekangGuard/My/VC/View/MyTableViewCell.h new file mode 100644 index 0000000..9bcd9ac --- /dev/null +++ b/LekangGuard/My/VC/View/MyTableViewCell.h @@ -0,0 +1,22 @@ +// +// MyTableViewCell.h +// tongxin +// +// Created by ecell on 2023/6/21. +// Copyright © 2023 xTT. All rights reserved. +// + +#import "ZZTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MyTableViewCell : ZZTableViewCell + +@property (nonatomic ,strong) NSString *imageName; +@property (nonatomic ,strong) NSString *titleName; + +@property (nonatomic ,strong) NSNumber *messageCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/My/VC/View/MyTableViewCell.m b/LekangGuard/My/VC/View/MyTableViewCell.m new file mode 100644 index 0000000..5533c87 --- /dev/null +++ b/LekangGuard/My/VC/View/MyTableViewCell.m @@ -0,0 +1,126 @@ +// +// MyTableViewCell.m +// tongxin +// +// Created by ecell on 2023/6/21. +// Copyright © 2023 xTT. All rights reserved. +// + +#import "MyTableViewCell.h" +#import "DPClearCacheTool.h" + +@interface MyTableViewCell () + +@property (nonatomic ,weak) UIImageView *iconImg; + +@property (nonatomic ,weak) UILabel *titleLabel; + +/// 未读消息展示红点 +@property (nonatomic ,weak) UILabel *newsMeg; + +///缓存显示 +@property (nonatomic ,weak) UILabel *cacheLabel; + +@end + +@implementation MyTableViewCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) + { + self.selectionStyle = UITableViewCellSelectionStyleNone; + self.backgroundColor = KKWhiteColorColor; + [self subCellView]; + } + + return self; +} + +- (void)setImageName:(NSString *)imageName +{ + _imageName = imageName; + self.iconImg.image = ImageName_(imageName); +} + +- (void)setTitleName:(NSString *)titleName +{ + _titleName = titleName; + self.titleLabel.text = titleName; + if ([titleName isEqualToString:@"清除缓存"]) + self.cacheLabel.text = [DPClearCacheTool getCacheSize]; + self.cacheLabel.hidden = [titleName isEqualToString:@"清除缓存"] ? NO : YES; +} + +- (void)setMessageCount:(NSNumber *)messageCount +{ + _messageCount = messageCount; +} + +- (void)subCellView +{ + + + UIImageView *iconImg = [UIImageView new]; + self.iconImg = iconImg; + [self.contentView addSubview:iconImg]; + [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.contentView).offset(15); + make.centerY.equalTo(self.contentView); + make.size.mas_equalTo(CGSizeMake(22, 22)); + }]; + + UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(16) textColor:KKTextBlackColor text:@"" Radius:0]; + self.titleLabel = titleLabel; + [self.contentView addSubview:titleLabel]; + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(iconImg.mas_right).offset(29); + make.centerY.equalTo(self.contentView); + }]; + + UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; + [self.contentView addSubview:rightImg]; + [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.contentView.mas_right).inset(29); + make.centerY.equalTo(self.contentView); + make.size.mas_equalTo(rightImg.image.size); + }]; + + /// 未读消息展示红点 + UILabel *newsMeg = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKGrey121 text:@"" Radius:5]; + newsMeg.backgroundColor = UIColor.redColor; + newsMeg.hidden = YES; + self.newsMeg = newsMeg; + [self.contentView addSubview:newsMeg]; + [newsMeg mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(rightImg.mas_left).inset(15); + make.centerY.equalTo(self.contentView); + make.width.height.mas_equalTo(10); + }]; + + ///缓存显示 + UILabel *cacheLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKGrey121 text:[DPClearCacheTool getCacheSize] Radius:0]; + cacheLabel.hidden = YES; + self.cacheLabel = cacheLabel; + [self.contentView addSubview:cacheLabel]; + [cacheLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(rightImg.mas_left).inset(15); + make.centerY.equalTo(self.contentView); + }]; + +} + + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/LekangGuard/My/VC/View/MyTableViewHeaderView.h b/LekangGuard/My/VC/View/MyTableViewHeaderView.h new file mode 100644 index 0000000..c4e20b8 --- /dev/null +++ b/LekangGuard/My/VC/View/MyTableViewHeaderView.h @@ -0,0 +1,20 @@ +// +// MyTableViewHeaderView.h +// tongxin +// +// Created by ecell on 2023/6/21. +// Copyright © 2023 xTT. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MyTableViewHeaderView : UIView + + +- (void)seCellModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/My/VC/View/MyTableViewHeaderView.m b/LekangGuard/My/VC/View/MyTableViewHeaderView.m new file mode 100644 index 0000000..f781b78 --- /dev/null +++ b/LekangGuard/My/VC/View/MyTableViewHeaderView.m @@ -0,0 +1,125 @@ +// +// MyTableViewHeaderView.m +// tongxin +// +// Created by ecell on 2023/6/21. +// Copyright © 2023 xTT. All rights reserved. +// + +#import "MyTableViewHeaderView.h" +#import "ModifyDataViewController.h" + +@interface MyTableViewHeaderView () +/// 设备头像 +@property (nonatomic ,weak) UIImageView *iconImg; + +/// 设备名称 +@property (nonatomic ,weak) UILabel *nameLabel; + +@property (nonatomic ,weak) UILabel *idLabel; + +@property (nonatomic ,weak) UILabel *line; + + +@end + +@implementation MyTableViewHeaderView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) + { + self.frame = [UIScreen mainScreen].bounds; + [self subHeadView]; + } + return self; +} + +- (void)subHeadView +{ + UIView *bgView = [UICommon ui_imageView:CGRectZero fileName:@"bg_device_info"]; + [self addSubview:bgView]; + [bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self).inset(10); + make.top.equalTo(self.mas_top).offset(10); + make.height.mas_equalTo(165); + }]; + + /// 设备头像 + UIImageView *iconImg = [UIImageView new]; + iconImg.layer.cornerRadius = 25; + iconImg.layer.masksToBounds = YES; + self.iconImg = iconImg; + [self addSubview:iconImg]; + [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(bgView.mas_left).offset(18); + make.top.equalTo(bgView.mas_top).offset(28); + make.size.mas_equalTo(CGSizeMake(50, 50)); + }]; + + UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:Font_(0) normalColor:KKClearColor normalText:@"" click:^(id x) { + ModifyDataViewController *vc = [ModifyDataViewController new]; + vc.model = APIManager.sharedManager.userModel; + [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; + }]; + [self addSubview:btn]; + [btn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(bgView); + make.top.equalTo(bgView); + make.bottom.equalTo(bgView.mas_bottom); + }]; + + + + /// 设备名称 + UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(20) textColor:KKWhiteColorColor text:@"" Radius:0]; + self.nameLabel = nameLabel; + [self addSubview:nameLabel]; + [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(iconImg.mas_right).offset(15); + make.centerY.equalTo(iconImg.mas_centerY); + }]; + + UILabel *idLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(16) textColor:KKTextBlackColor text:@"" Radius:0]; + self.idLabel = idLabel; + [bgView addSubview:idLabel]; + [idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(bgView.mas_left).offset(15); + make.bottom.equalTo(bgView.mas_bottom).inset(14); + }]; + + +// /// 右箭头图片 +// UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"comm_right_icon"]; +// [bgView addSubview:rightImg]; +// [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { +// make.right.equalTo(bgView.mas_right).inset(36); +// make.centerY.equalTo(iconImg.mas_centerY); +// make.size.mas_equalTo(CGSizeMake(8, 15)); +// }]; +// + UILabel *ttLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(14) textColor:RGB(59, 161, 245) text:@"修改资料" Radius:0]; + [bgView addSubview:ttLabel]; + [ttLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(bgView.mas_right).inset(15); + make.centerY.equalTo(idLabel.mas_centerY); + }]; + +} + +- (void)seCellModel +{ + [self.iconImg sd_setImageWithURL:[NSURL URLWithString:APIManager.sharedManager.userModel.image] placeholderImage:ImageName_(@"icon_user")]; + self.nameLabel.text = APIManager.sharedManager.userModel.name; + self.idLabel.text = F(@"%@:%@",GJText(@"号码"), APIManager.sharedManager.userModel.phone.length > 0 ? APIManager.sharedManager.userModel.phone : @"--"); +} +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/LekangGuard/TabMessage/Model/JobModel.h b/LekangGuard/Protection(守护星)/Model/JobModel.h similarity index 100% rename from LekangGuard/TabMessage/Model/JobModel.h rename to LekangGuard/Protection(守护星)/Model/JobModel.h diff --git a/LekangGuard/TabMessage/Model/JobModel.m b/LekangGuard/Protection(守护星)/Model/JobModel.m similarity index 100% rename from LekangGuard/TabMessage/Model/JobModel.m rename to LekangGuard/Protection(守护星)/Model/JobModel.m diff --git a/LekangGuard/TabMessage/Model/RedFlowerModel.h b/LekangGuard/Protection(守护星)/Model/RedFlowerModel.h similarity index 100% rename from LekangGuard/TabMessage/Model/RedFlowerModel.h rename to LekangGuard/Protection(守护星)/Model/RedFlowerModel.h diff --git a/LekangGuard/TabMessage/Model/RedFlowerModel.m b/LekangGuard/Protection(守护星)/Model/RedFlowerModel.m similarity index 100% rename from LekangGuard/TabMessage/Model/RedFlowerModel.m rename to LekangGuard/Protection(守护星)/Model/RedFlowerModel.m diff --git a/LekangGuard/TabMessage/Model/SchModel.h b/LekangGuard/Protection(守护星)/Model/SchModel.h similarity index 100% rename from LekangGuard/TabMessage/Model/SchModel.h rename to LekangGuard/Protection(守护星)/Model/SchModel.h diff --git a/LekangGuard/TabMessage/Model/SchModel.m b/LekangGuard/Protection(守护星)/Model/SchModel.m similarity index 100% rename from LekangGuard/TabMessage/Model/SchModel.m rename to LekangGuard/Protection(守护星)/Model/SchModel.m diff --git a/LekangGuard/Protection(守护星)/VC/DeviceSwitchover.h b/LekangGuard/Protection(守护星)/VC/DeviceSwitchover.h new file mode 100644 index 0000000..f66db13 --- /dev/null +++ b/LekangGuard/Protection(守护星)/VC/DeviceSwitchover.h @@ -0,0 +1,24 @@ +// +// DeviceSwitchover.h +// tongxin +// +// Created by ecell on 2023/7/7. +// Copyright © 2023 xTT. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DeviceSwitchover : NSObject + ++ (instancetype)sharedManager; + +- (void)showMenuViewWithAdd:(BOOL)add; + +@property (nonatomic ,strong) void(^switchDevice)(NSInteger index); + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Protection(守护星)/VC/DeviceSwitchover.m b/LekangGuard/Protection(守护星)/VC/DeviceSwitchover.m new file mode 100644 index 0000000..71247fb --- /dev/null +++ b/LekangGuard/Protection(守护星)/VC/DeviceSwitchover.m @@ -0,0 +1,75 @@ +// +// DeviceSwitchover.m +// tongxin +// +// Created by ecell on 2023/7/7. +// Copyright © 2023 xTT. All rights reserved. +// + +#import "DeviceSwitchover.h" + +@interface DeviceSwitchover () + +/// 是否有添加 +@property (nonatomic ,assign) BOOL isAdd; + +@end + +@implementation DeviceSwitchover + ++ (instancetype)sharedManager +{ + static dispatch_once_t onceToken; + static DeviceSwitchover *apitance; + dispatch_once(&onceToken, ^{ + apitance = [[DeviceSwitchover alloc] init]; + }); + return apitance; +} + + +- (void)showMenuViewWithAdd:(BOOL)add +{ + self.isAdd = add; + CGPoint point = CGPointMake(SCREEN_WIDTH - 30, iPhoneX_NavHeight-5); + NSMutableArray *titles = [NSMutableArray new]; + NSMutableArray *icons = [NSMutableArray new]; + // 显示切换列表 + + //添加 --- 添加设备 + if(add) + { + [titles addObject:@"添加设备"]; + [icons addObject:ImageName_(@"home_icon_add_watch")]; + } + if(APIManager.sharedManager.deviceList.count != 0) + { + for (DeviceModel *model in APIManager.sharedManager.deviceList) + { + if (model.image.length <= 0) + [icons addObject:model.sex == 2 ? @"icon_girl_head_portrait" : @"icon_boy_head_portrait"]; + else + [icons addObject:model.image]; + [titles addObject:model.name]; + } + + } + [YBPopupMenu showAtPoint:point titles:titles icons:nil menuWidth:120*(SCREEN_WIDTH/320) otherSettings:^(YBPopupMenu *popupMenu) { + popupMenu.textColor = KKTextBlackColor; + popupMenu.fontSize = 15; + popupMenu.cornerRadius = 4.0f; + popupMenu.dismissOnSelected = YES; + popupMenu.delegate = self; + popupMenu.offset = 5; + popupMenu.type = YBPopupMenuTypeDefault; + }]; +} + +#pragma mark - YBPopupMenuDelegate 代理方法 +- (void)ybPopupMenuDidSelectedAtIndex:(NSInteger)index ybPopupMenu:(YBPopupMenu *)ybPopupMenu { + [ybPopupMenu dismiss]; + self.switchDevice(index); +} + + +@end diff --git a/LekangGuard/Protection(守护星)/VC/ProtectionViewController.h b/LekangGuard/Protection(守护星)/VC/ProtectionViewController.h new file mode 100644 index 0000000..443f08a --- /dev/null +++ b/LekangGuard/Protection(守护星)/VC/ProtectionViewController.h @@ -0,0 +1,16 @@ +// +// ProtectionViewController.h +// LekangGuard +// +// Created by ecell on 2023/8/23. +// + +#import "BaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface ProtectionViewController : BaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Protection(守护星)/VC/ProtectionViewController.m b/LekangGuard/Protection(守护星)/VC/ProtectionViewController.m new file mode 100644 index 0000000..a925327 --- /dev/null +++ b/LekangGuard/Protection(守护星)/VC/ProtectionViewController.m @@ -0,0 +1,363 @@ +// +// ProtectionViewController.m +// LekangGuard +// +// Created by ecell on 2023/8/23. +// + +#import "ProtectionViewController.h" +#import "MoreMenuTitleView.h" +#import "FunctionView.h" +#import "DeviceSetView.h" +#import "DeviceMsgHeaderView.h" + +@interface ProtectionViewController () + +@property (nonatomic ,strong) UIScrollView *menuScroll; + +@property (nonatomic ,strong) NSMutableArray *menuArr; + +@property (nonatomic ,strong) NSMutableArray *menuImgArr; + +@property (nonatomic ,weak) DeviceMsgHeaderView *devMsgView; + +@property (nonatomic ,weak) FunctionView *fastView; + +@property (nonatomic ,weak) FunctionView *funView; + +@property (nonatomic ,weak) DeviceSetView *setView; + +/// 解绑按钮 +@property (nonatomic ,weak) UIButton *unbundleBtn; + + +@end + + +@implementation ProtectionViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.view.backgroundColor = KKBackgroundGrey; + + self.zx_navLeftBtn.titleLabel.font = FontBoldADA_(18); + [self.zx_navLeftBtn setTitleColor:KKWhiteColorColor forState:0]; + + [self zx_setRightBtnWithImg:ImageName_(@"icon_switch_devices") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) { + [self isDevShowMenu]; + }]; + + [self setMenu]; + [self.view addSubview:self.menuScroll]; + [self.menuScroll mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.view); + make.top.equalTo(self.view).offset(iPhoneX_NavHeight); + make.bottom.equalTo(self.view.mas_bottom); + }]; + [self SubOneView]; +} + +- (void)SubOneView +{ + DeviceMsgHeaderView *devMsgView = [[DeviceMsgHeaderView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, 140)]; + self.devMsgView = devMsgView; + [self.menuScroll addSubview:devMsgView]; + [devMsgView setModel]; + + MoreMenuTitleView *titleView1 = [[MoreMenuTitleView alloc] initWithFrame:CGRectMake(0, devMsgView.bottom+10, SCREEN_WIDTH, 30)]; + titleView1.titleStr = GJText(@"快捷功能"); + [self.menuScroll addSubview:titleView1]; + + FunctionView *fastView = [[FunctionView alloc] initWithFrame:CGRectMake(0, titleView1.bottom+5, SCREEN_WIDTH, (SCREEN_WIDTH-20)/4.5)]; + self.fastView = fastView; + fastView.imgArr = @[@"icon_member",@"icon_phonebook",@"icon_alarm",@"icon_class_disable"]; + fastView.titleArr = @[@"成员管理",@"电话本",@"设备闹钟",@"上课禁用"]; + [self.menuScroll addSubview:fastView]; + + + MoreMenuTitleView *titleView = [[MoreMenuTitleView alloc] initWithFrame:CGRectMake(0, fastView.bottom+10, SCREEN_WIDTH, 30)]; + titleView.titleStr = GJText(@"基础功能"); + [self.menuScroll addSubview:titleView]; + + FunctionView *funView = [[FunctionView alloc] initWithFrame:CGRectMake(0, titleView.bottom+5, SCREEN_WIDTH, [self getViewsHeight])]; + self.funView = funView; + funView.imgArr = self.menuImgArr; + funView.titleArr = self.menuArr; + [self.menuScroll addSubview:funView]; + + [self subTwoView:funView]; +} + +- (void)subTwoView:(UIView *)views +{ + MoreMenuTitleView *titleView = [[MoreMenuTitleView alloc] initWithFrame:CGRectMake(0, views.bottom+10, SCREEN_WIDTH, 30)]; + titleView.titleStr = GJText(@"设备设置"); + [self.menuScroll addSubview:titleView]; + + + DeviceSetView *setView = [[DeviceSetView alloc] initWithFrame:CGRectMake(0, titleView.bottom+5, SCREEN_WIDTH, [APIManager sharedManager].deviceModel.dial ? Adapted(165) : Adapted(110))]; + self.setView = setView; + [self.menuScroll addSubview:setView]; + setView.isOpenState = ^{ + [super updataNotificat]; + }; + [setView DevicePosition]; + + /// 远程关机 + UIButton *shutdownBtn = [UICommon ui_buttonSimple:CGRectMake(10, setView.bottom+Adapted(60), SCREEN_WIDTH-20, Adapted(44)) font:FontADA_(15) normalColor:KKWhiteColorColor normalText:GJText(@"远程关机") click:^(id x) { + + EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"远程关机") subtitle:GJText(@"\n设备将会远程关机,”是否“确认") AlertViewType:AlertViewTypeSystemAlert config:nil]; + [alertV addAlertItem:^EasyAlertItem *{ + return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:nil]; + }]; + [alertV addAlertItem:^EasyAlertItem *{ + return [EasyAlertItem itemWithTitle:GJText(@"确定") type:AlertItemTypeSystemDefault callback:^(EasyAlertView *showview, long index) { + [self DeviceShutDown]; + }]; + }]; + [alertV showAlertView]; + + }]; + shutdownBtn.backgroundColor = KKMainColor; + shutdownBtn.layer.cornerRadius = Adapted(22); + shutdownBtn.layer.masksToBounds = YES; + [self.menuScroll addSubview:shutdownBtn]; + + NSString *msg = GJText(@"\n解除绑定后,将无法对设备进行监护,设备将重启,其他绑定该设备的用户,将自动解绑"); + if(APIManager.sharedManager.deviceModel.identity == 2) + msg = GJText(@"\n您是设备的管理员,如果您进行解绑,其他绑定该设备的用户,将自动解绑,确认解除绑定吗?"); + + /// 解除与设备的绑定 + UIButton *unbundleBtn = [UICommon ui_buttonSimple:CGRectMake(10, shutdownBtn.bottom+Adapted(15), SCREEN_WIDTH-20, Adapted(44)) font:FontADA_(15) normalColor:KKMainColor normalText:GJText(@"解除与设备的绑定") click:^(id x) { + + EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"设备解绑") subtitle:GJText(msg) AlertViewType:AlertViewTypeSystemAlert config:nil]; + [alertV addAlertItem:^EasyAlertItem *{ + return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:nil]; + }]; + [alertV addAlertItem:^EasyAlertItem *{ + return [EasyAlertItem itemWithTitle:GJText(@"确定") type:AlertItemTypeSystemDefault callback:^(EasyAlertView *showview, long index) { + [self DeviceUnbind]; + }]; + }]; + [alertV showAlertView]; + }]; + unbundleBtn.backgroundColor = KKClearColor; + unbundleBtn.layer.cornerRadius = Adapted(22); + unbundleBtn.layer.borderWidth = 1; + unbundleBtn.layer.borderColor = KKMainColor.CGColor; + unbundleBtn.layer.masksToBounds = YES; + self.unbundleBtn = unbundleBtn; + [self.menuScroll addSubview:unbundleBtn]; + + [self.menuScroll setContentSize:CGSizeMake(SCREEN_WIDTH, unbundleBtn.bottom+iPhoneX_TabbarSafeBottomMargin)]; + +} + +- (UIScrollView *)menuScroll +{ + if (!_menuScroll) + { + _menuScroll = [UIScrollView new]; + _menuScroll.backgroundColor = KKClearColor; + } + return _menuScroll; +} + +/// 菜单设置 +- (void)setMenu +{ + self.menuArr = [NSMutableArray new]; + self.menuImgArr = [NSMutableArray new]; + + +// if ([APIManager sharedManager].deviceModel.identity == 2) +// [self.menuArr addObject:GJText(@"管理员")]; +// else + +// [self.menuArr addObject:GJText(@"打电话")]; +// [self.menuImgArr addObject:@"icon_call_up"]; +// +// [self.menuArr addObject:GJText(@"电话本")]; +// [self.menuImgArr addObject:@"icon_phonebook"]; + + +// if([APIManager sharedManager].deviceModel.videoModelName != 0) +// { +// [self.menuArr addObject:GJText(@"视频通话")]; +// [self.menuImgArr addObject:@"icon_more_video_call"]; +// } +// if ([APIManager sharedManager].deviceModel.watchAlarmClock ) +// { +// [self.menuArr addObject:GJText(@"设备闹钟")]; +// [self.menuImgArr addObject:@"icon_alarm"]; +// } +// if ([APIManager sharedManager].deviceModel.classDisable ) +// { +// [self.menuArr addObject:GJText(@"上课禁用")]; +// [self.menuImgArr addObject:@"icon_class_disable"]; +// } + if([APIManager sharedManager].deviceModel.lookupFun) + { + [self.menuArr addObject:GJText(@"查找设备")]; + [self.menuImgArr addObject:@"icon_find_devices"]; + } + if ([APIManager sharedManager].deviceModel.sosPhone) + { + [self.menuArr addObject:GJText(@"SOS号码")]; + [self.menuImgArr addObject:@"icon_sos"]; + } +// if([APIManager sharedManager].deviceModel.watchWiff) +// { +// [self.menuArr addObject:GJText(@"设备WIFI")]; +// [self.menuImgArr addObject:@"icon_watch_wifi"]; +// } + + if([APIManager sharedManager].deviceModel.timingSwitch) + { + [self.menuArr addObject:GJText(@"定时开关机")]; + [self.menuImgArr addObject:@"icon_on_off"]; + } + + + if([APIManager sharedManager].deviceModel.stepRecorder) + { + [self.menuArr addObject:GJText(@"计步")]; + [self.menuImgArr addObject:@"icon_step"]; + } + // 学生卡 + //if([APIManager sharedManager].deviceModel.familyPhone) + { + [self.menuArr addObject:GJText(@"亲情号")]; + [self.menuImgArr addObject:@"icon_family"]; + } + +// // 学生资料 +// if([APIManager sharedManager].deviceModel.deviceType == 2) +// { +// [self.menuArr addObject:GJText(@"学生资料")]; +// [self.menuImgArr addObject:@"icon_more_watch_data"]; +// } + +// if ([APIManager sharedManager].deviceModel.whiteList) +// { +// [self.menuArr addObject:GJText(@"通讯录")]; +// [self.menuImgArr addObject:@"icon_home_phone_book"]; +// } + + + [self.menuArr addObject:GJText(@"设备资料")]; + [self.menuImgArr addObject:@"icon_watch_data"]; +} + + + +#pragma mark 设备远程关机 +/// 设备远程关机 +- (void)DeviceShutDown +{ + [UICommon MessageUpload:@"加载中"]; + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [parameters setValue:APIManager.sharedManager.deviceModel.imei forKey:@"imei"]; + [[[APIManager sharedManager] APGET:DeviceShutDown_URL parameters:parameters resultClass:nil] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + [super updataNotificat]; + [UICommon MessageSuccessText:@"远程关机成功"]; + + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + + + +#pragma mark 解除与设备绑定 +/// 解除与设备绑定 +- (void)DeviceUnbind +{ + [UICommon MessageUpload:@"加载中"]; + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [parameters setValue:APIManager.sharedManager.deviceModel.imei forKey:@"imei"]; + [parameters setValue:APIManager.sharedManager.loginModel.openid forKey:@"userId"]; + [[[APIManager sharedManager] APPOST:DeviceUnbind_URL parameters:parameters isJson:YES resultClass:nil] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + [APIManager.sharedManager cleardeviceInfo]; + [UICommon MessageSuccessText:@"解绑成功"]; + [[NSNotificationCenter defaultCenter] postNotificationName:UPDATA_DeviceList object:nil]; + AfterDispatch(0.5, ^{ + [self.navigationController popViewControllerAnimated:YES]; + }); + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + +- (void)updateAllMessage +{ + AfterDispatch(1, ^{ + [self.setView DevicePosition]; + }); +} + +/// 切换设备弹出框 +- (void)isDevShowMenu +{ + WeakSelf + [DeviceSwitchover.sharedManager showMenuViewWithAdd:NO ]; + [DeviceSwitchover.sharedManager setSwitchDevice:^(NSInteger index) { + DeviceModel *model = APIManager.sharedManager.deviceList[index]; + APIManager.sharedManager.deviceModel = model; + [APIManager.sharedManager.cache setObject:model forKey:sDeviceKey]; + [weakSelf realTimeUpadteMsg]; + }]; +} +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + [self realTimeUpadteMsg]; +} + + +/// 切换设备或者其他页面切换设备刷新界面 +- (void)realTimeUpadteMsg +{ + [self.zx_navLeftBtn setTitle:APIManager.sharedManager.deviceModel.name forState:0]; + WeakSelf + [weakSelf setMenu]; + [weakSelf.devMsgView setModel]; + weakSelf.funView.size = CGSizeMake(SCREEN_WIDTH, [self getViewsHeight]); + weakSelf.funView.imgArr = weakSelf.menuImgArr; + weakSelf.funView.titleArr = weakSelf.menuArr; + weakSelf.setView.size = CGSizeMake(SCREEN_WIDTH, [APIManager sharedManager].deviceModel.dial ? Adapted(165) : Adapted(110)); + [weakSelf.setView subHeaderView]; + [weakSelf.menuScroll setContentSize:CGSizeMake(SCREEN_WIDTH, weakSelf.unbundleBtn.bottom+iPhoneX_TabbarSafeBottomMargin)]; +} + + +- (CGFloat)getViewsHeight +{ + CGFloat hh = (SCREEN_WIDTH-20)/4.5; + NSInteger count = self.menuArr.count; + if (count < 5) return hh; + if (count < 9) return hh*2; + if (count < 13) return hh*3; + if (count < 17) return hh*4; + if (count < 21) return hh*5; + if (count > 20) return hh*6; + return hh; +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/LekangGuard/TabMessage/VC/CommMessageDetailsViewController.h b/LekangGuard/Protection(守护星)/VC/ms/CommMessageDetailsViewController.h similarity index 100% rename from LekangGuard/TabMessage/VC/CommMessageDetailsViewController.h rename to LekangGuard/Protection(守护星)/VC/ms/CommMessageDetailsViewController.h diff --git a/LekangGuard/TabMessage/VC/CommMessageDetailsViewController.m b/LekangGuard/Protection(守护星)/VC/ms/CommMessageDetailsViewController.m similarity index 100% rename from LekangGuard/TabMessage/VC/CommMessageDetailsViewController.m rename to LekangGuard/Protection(守护星)/VC/ms/CommMessageDetailsViewController.m diff --git a/LekangGuard/TabMessage/VC/MyChildViewController.h b/LekangGuard/Protection(守护星)/VC/ms/MyChildViewController.h similarity index 100% rename from LekangGuard/TabMessage/VC/MyChildViewController.h rename to LekangGuard/Protection(守护星)/VC/ms/MyChildViewController.h diff --git a/LekangGuard/TabMessage/VC/MyChildViewController.m b/LekangGuard/Protection(守护星)/VC/ms/MyChildViewController.m similarity index 100% rename from LekangGuard/TabMessage/VC/MyChildViewController.m rename to LekangGuard/Protection(守护星)/VC/ms/MyChildViewController.m diff --git a/LekangGuard/TabMessage/VC/OtherChildViewController.h b/LekangGuard/Protection(守护星)/VC/ms/OtherChildViewController.h similarity index 100% rename from LekangGuard/TabMessage/VC/OtherChildViewController.h rename to LekangGuard/Protection(守护星)/VC/ms/OtherChildViewController.h diff --git a/LekangGuard/TabMessage/VC/OtherChildViewController.m b/LekangGuard/Protection(守护星)/VC/ms/OtherChildViewController.m similarity index 100% rename from LekangGuard/TabMessage/VC/OtherChildViewController.m rename to LekangGuard/Protection(守护星)/VC/ms/OtherChildViewController.m diff --git a/LekangGuard/TabMessage/VC/ReadFlowerViewController.h b/LekangGuard/Protection(守护星)/VC/ms/ReadFlowerViewController.h similarity index 100% rename from LekangGuard/TabMessage/VC/ReadFlowerViewController.h rename to LekangGuard/Protection(守护星)/VC/ms/ReadFlowerViewController.h diff --git a/LekangGuard/TabMessage/VC/ReadFlowerViewController.m b/LekangGuard/Protection(守护星)/VC/ms/ReadFlowerViewController.m similarity index 100% rename from LekangGuard/TabMessage/VC/ReadFlowerViewController.m rename to LekangGuard/Protection(守护星)/VC/ms/ReadFlowerViewController.m diff --git a/LekangGuard/TabMessage/VC/SchAndJobMessageViewController.h b/LekangGuard/Protection(守护星)/VC/ms/SchAndJobMessageViewController.h similarity index 100% rename from LekangGuard/TabMessage/VC/SchAndJobMessageViewController.h rename to LekangGuard/Protection(守护星)/VC/ms/SchAndJobMessageViewController.h diff --git a/LekangGuard/TabMessage/VC/SchAndJobMessageViewController.m b/LekangGuard/Protection(守护星)/VC/ms/SchAndJobMessageViewController.m similarity index 100% rename from LekangGuard/TabMessage/VC/SchAndJobMessageViewController.m rename to LekangGuard/Protection(守护星)/VC/ms/SchAndJobMessageViewController.m diff --git a/LekangGuard/TabMessage/VC/TabMessageViewController.h b/LekangGuard/Protection(守护星)/VC/ms/TabMessageViewController.h similarity index 100% rename from LekangGuard/TabMessage/VC/TabMessageViewController.h rename to LekangGuard/Protection(守护星)/VC/ms/TabMessageViewController.h diff --git a/LekangGuard/TabMessage/VC/TabMessageViewController.m b/LekangGuard/Protection(守护星)/VC/ms/TabMessageViewController.m similarity index 100% rename from LekangGuard/TabMessage/VC/TabMessageViewController.m rename to LekangGuard/Protection(守护星)/VC/ms/TabMessageViewController.m diff --git a/LekangGuard/TabMessage/View/CommMessageTableViewCell.h b/LekangGuard/Protection(守护星)/View/CommMessageTableViewCell.h similarity index 100% rename from LekangGuard/TabMessage/View/CommMessageTableViewCell.h rename to LekangGuard/Protection(守护星)/View/CommMessageTableViewCell.h diff --git a/LekangGuard/TabMessage/View/CommMessageTableViewCell.m b/LekangGuard/Protection(守护星)/View/CommMessageTableViewCell.m similarity index 100% rename from LekangGuard/TabMessage/View/CommMessageTableViewCell.m rename to LekangGuard/Protection(守护星)/View/CommMessageTableViewCell.m diff --git a/LekangGuard/Protection(守护星)/View/DeviceMsgHeaderView.h b/LekangGuard/Protection(守护星)/View/DeviceMsgHeaderView.h new file mode 100644 index 0000000..7dbe97a --- /dev/null +++ b/LekangGuard/Protection(守护星)/View/DeviceMsgHeaderView.h @@ -0,0 +1,18 @@ +// +// DeviceMsgHeaderView.h +// LekangGuard +// +// Created by ecell on 2023/8/24. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DeviceMsgHeaderView : UIView + +- (void)setModel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Protection(守护星)/View/DeviceMsgHeaderView.m b/LekangGuard/Protection(守护星)/View/DeviceMsgHeaderView.m new file mode 100644 index 0000000..1e3174e --- /dev/null +++ b/LekangGuard/Protection(守护星)/View/DeviceMsgHeaderView.m @@ -0,0 +1,237 @@ +// +// DeviceMsgHeaderView.m +// LekangGuard +// +// Created by ecell on 2023/8/24. +// + +#import "DeviceMsgHeaderView.h" +#import "EditDeviceViewController.h" + +@interface DeviceMsgHeaderView () + +/// 设备头像 +@property (nonatomic ,weak) UIImageView *iconImg; + +/// 设备名称 +@property (nonatomic ,weak) UILabel *nameLabel; + + +/// 设备电量图片 +@property (nonatomic ,weak) UIImageView *batteryImg; + +/// 设备电量 +@property (nonatomic ,weak) UILabel *batteryLabel; + + +/// 运营商 +@property (nonatomic ,weak) UIImageView *operatorImg; + +@property (nonatomic ,weak) UILabel *line; + +/// 是否在线图标 +@property (nonatomic ,weak) UIImageView *signalImg; + +@property (nonatomic ,weak) UILabel *titleLabel; + +@property (nonatomic ,weak) UILabel *IdLabel; + +@end + +@implementation DeviceMsgHeaderView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) + { + self.backgroundColor = KKClearColor; + [self subHeaderView]; + } + return self; +} + +- (void)subHeaderView +{ + UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:8 borderWidth:0 borderColor:KKWhiteColorColor]; + [self addSubview:bgView]; + [bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self).inset(10); + make.top.equalTo(self); + make.bottom.equalTo(self.mas_bottom); + }]; + + /// 设备头像 + UIImageView *iconImg = [UIImageView new]; + iconImg.layer.cornerRadius = 25; + iconImg.layer.masksToBounds = YES; + self.iconImg = iconImg; + [bgView addSubview:iconImg]; + [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(bgView.mas_left).offset(15); + make.top.equalTo(bgView.mas_top).offset(13); + make.size.mas_equalTo(CGSizeMake(50, 50)); + }]; + + UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:Font_(0) normalColor:KKClearColor normalText:@"" click:^(id x) { + EditDeviceViewController *vc = [[EditDeviceViewController alloc] init]; + [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; + }]; + [bgView addSubview:btn]; + [btn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(bgView); + make.top.equalTo(bgView); + make.bottom.equalTo(iconImg.mas_bottom); + }]; + + + + /// 设备名称 + UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(16) textColor:KKTextBlackColor text:@"" Radius:0]; + self.nameLabel = nameLabel; + [bgView addSubview:nameLabel]; + [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(iconImg.mas_right).offset(20); + make.top.equalTo(iconImg.mas_top).offset(6.5); + }]; + + + UILabel *IdLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:KKGrey133 text:@"" Radius:0]; + self.IdLabel = IdLabel; + [bgView addSubview:IdLabel]; + [IdLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(nameLabel); + make.top.equalTo(nameLabel.mas_bottom).offset(10); + }]; + + + /// 右箭头图片 + UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; + [bgView addSubview:rightImg]; + [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(bgView.mas_right).inset(18); + make.centerY.equalTo(iconImg.mas_centerY); + make.size.mas_equalTo(CGSizeMake(8, 15)); + }]; + + UILabel *ttLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:KKGrey133 text:@"编辑资料" Radius:0]; + [bgView addSubview:ttLabel]; + [ttLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(rightImg.mas_left).inset(10); + make.centerY.equalTo(rightImg.mas_centerY); + }]; + + NSArray *titleArr = @[@"当前电量",@"未连接",]; + CGFloat ww = (SCREEN_WIDTH-30)/titleArr.count; + + for (int i = 1; i < titleArr.count; i++) + { + UILabel *line = [UILabel new]; + line.backgroundColor = KKLineColor; + self.line = line; + [self addSubview:line]; + [line mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.mas_left).offset(i*ww); + make.top.equalTo(iconImg.mas_bottom).offset(17); + //make.bottom.equalTo(bgView.mas_bottom).inset(26); + make.size.mas_equalTo(CGSizeMake(1, 45)); + }]; + } + + for (int i = 0; i < titleArr.count; i++) + { + UILabel *label = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(10) textColor:KKGrey133 text:titleArr[i] Radius:0]; + if (i == 0) self.batteryLabel = label; + if (i == 1) self.titleLabel = label; + [self addSubview:label]; + [label mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.mas_left).offset(i*ww); + make.top.equalTo(self.line.mas_centerY).offset(5); + make.width.mas_equalTo(ww); + }]; + + /// 当前电量 + UIImageView *signalImg = [UICommon ui_imageView:CGRectZero fileName:@""]; + [self addSubview:signalImg]; + + if (i == 0) + { + self.batteryImg = signalImg; + [signalImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(label.mas_centerX); + make.bottom.equalTo(self.line.mas_centerY).inset(5); + make.size.mas_equalTo(CGSizeMake(25, 10)); + }]; + } + else if (i == 1) + { + self.signalImg = signalImg; + [signalImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(label.mas_centerX); + make.centerY.equalTo(self.batteryImg); + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + } + else if (i == 2) + { + [signalImg mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(label.mas_centerX); + make.centerY.equalTo(self.batteryImg); + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + } + } +} + +- (void)setModel +{ + UIImage *defaImage; + self.nameLabel.text = APIManager.sharedManager.deviceModel.name; + self.IdLabel.text = [NSString stringWithFormat:@"IMEI:%@",APIManager.sharedManager.deviceModel.imei]; + if (APIManager.sharedManager.deviceModel.image.length <= 0) + [self.iconImg setImage:ImageName_(APIManager.sharedManager.deviceModel.sex == 2 ? @"icon_head_girl" : @"icon_head_boy")]; + else + [self.iconImg sd_setImageWithURL:[NSURL URLWithString:APIManager.sharedManager.deviceModel.image] placeholderImage:ImageName_(@"icon_head_boy")]; + self.signalImg.image = APIManager.sharedManager.deviceModel.onlineStatus ? ImageName_(@"icon_device_connected") : ImageName_(@"icon_device_unconnected"); + self.titleLabel.text = APIManager.sharedManager.deviceModel.onlineStatus ? @"已连接" : @"未连接"; + NSInteger battery = APIManager.sharedManager.laloModel.battery; + NSString *imageName = @""; + if(battery == 0) + imageName = @"battery_0"; + else if (battery < 10) + imageName = @"battery_low"; + else if (battery < 20) + imageName = @"battery_1"; + else if (battery < 30) + imageName = @"battery_2"; + else if (battery < 40) + imageName = @"battery_3"; + else if (battery < 50) + imageName = @"battery_4"; + else if (battery < 60) + imageName = @"battery_4"; + else if (battery < 70) + imageName = @"battery_6"; + else if (battery < 80) + imageName = @"battery_7"; + else if (battery < 90) + imageName = @"battery_8"; + else if (battery < 100) + imageName = @"battery_9"; + else + imageName = @"battery_10"; + + self.batteryImg.image = ImageName_(imageName); + self.batteryLabel.text = [NSString stringWithFormat:@"当前电量:%ld%%",battery]; +} + + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/LekangGuard/TabMessage/View/TabMessageTableViewCell.h b/LekangGuard/Protection(守护星)/View/TabMessageTableViewCell.h similarity index 100% rename from LekangGuard/TabMessage/View/TabMessageTableViewCell.h rename to LekangGuard/Protection(守护星)/View/TabMessageTableViewCell.h diff --git a/LekangGuard/TabMessage/View/TabMessageTableViewCell.m b/LekangGuard/Protection(守护星)/View/TabMessageTableViewCell.m similarity index 100% rename from LekangGuard/TabMessage/View/TabMessageTableViewCell.m rename to LekangGuard/Protection(守护星)/View/TabMessageTableViewCell.m