Commit 1bed1b3e cgx

完成首页舒眠课程和助眠音乐(到时候需要调整)

1 个父辈 1765b8bf
正在显示 24 个修改的文件 包含 424 行增加320 行删除
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D00A63562824C42300AFFEAA /* DSNetworkCache.m */; }; D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D00A63562824C42300AFFEAA /* DSNetworkCache.m */; };
D01814D127FFCBAF00583D4E /* CWCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814CB27FFCBAF00583D4E /* CWCarousel.m */; }; D01814D127FFCBAF00583D4E /* CWCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814CB27FFCBAF00583D4E /* CWCarousel.m */; };
D01814D227FFCBAF00583D4E /* CWFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814CD27FFCBAF00583D4E /* CWFlowLayout.m */; }; D01814D227FFCBAF00583D4E /* CWFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814CD27FFCBAF00583D4E /* CWFlowLayout.m */; };
D01814D527FFCCFA00583D4E /* HomeTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814D427FFCCFA00583D4E /* HomeTableView.m */; };
D01814DC27FFD92200583D4E /* DSDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814DB27FFD92200583D4E /* DSDataSource.m */; }; D01814DC27FFD92200583D4E /* DSDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814DB27FFD92200583D4E /* DSDataSource.m */; };
D01814E227FFDBB800583D4E /* HomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814E127FFDBB800583D4E /* HomeHeaderView.m */; }; D01814E227FFDBB800583D4E /* HomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814E127FFDBB800583D4E /* HomeHeaderView.m */; };
D01814E8280020F900583D4E /* CWPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814E6280020F800583D4E /* CWPageControl.m */; }; D01814E8280020F900583D4E /* CWPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814E6280020F800583D4E /* CWPageControl.m */; };
...@@ -111,6 +110,10 @@ ...@@ -111,6 +110,10 @@
D09D0E96280D3FE9008DEDAB /* NSDate+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E95280D3FE9008DEDAB /* NSDate+Extras.m */; }; D09D0E96280D3FE9008DEDAB /* NSDate+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E95280D3FE9008DEDAB /* NSDate+Extras.m */; };
D09D0E9A280D507F008DEDAB /* ProfileAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E99280D507F008DEDAB /* ProfileAlertView.m */; }; D09D0E9A280D507F008DEDAB /* ProfileAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E99280D507F008DEDAB /* ProfileAlertView.m */; };
D09D0E9D280D73B6008DEDAB /* InviteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E9C280D73B6008DEDAB /* InviteController.m */; }; D09D0E9D280D73B6008DEDAB /* InviteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E9C280D73B6008DEDAB /* InviteController.m */; };
D0A72E39282B566200EED7BE /* HomeBasicCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E38282B566200EED7BE /* HomeBasicCell.m */; };
D0A72E3C282B56E600EED7BE /* GoodSleepSoundCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E3B282B56E600EED7BE /* GoodSleepSoundCell.m */; };
D0A72E3F282B89AD00EED7BE /* DSHomeView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E3E282B89AD00EED7BE /* DSHomeView.m */; };
D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */; };
D0AE1E3528281B6F008CEF27 /* TimerProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AE1E3428281B6F008CEF27 /* TimerProxy.m */; }; D0AE1E3528281B6F008CEF27 /* TimerProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AE1E3428281B6F008CEF27 /* TimerProxy.m */; };
D0AEFE79281781CF00230DC6 /* MyFeedModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE78281781CF00230DC6 /* MyFeedModel.m */; }; D0AEFE79281781CF00230DC6 /* MyFeedModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE78281781CF00230DC6 /* MyFeedModel.m */; };
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE7A2817D13400230DC6 /* UITableViewCell+CardRadius.m */; }; D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE7A2817D13400230DC6 /* UITableViewCell+CardRadius.m */; };
...@@ -158,7 +161,6 @@ ...@@ -158,7 +161,6 @@
D0E6F1FD28290128004150E5 /* TimingView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E6F1FC28290128004150E5 /* TimingView.m */; }; D0E6F1FD28290128004150E5 /* TimingView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E6F1FC28290128004150E5 /* TimingView.m */; };
D0F808F52803D4E70097899F /* Track.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808F32803D4E70097899F /* Track.m */; }; D0F808F52803D4E70097899F /* Track.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808F32803D4E70097899F /* Track.m */; };
D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808FD280421C20097899F /* ThreeMinuteController.m */; }; D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808FD280421C20097899F /* ThreeMinuteController.m */; };
D0F8090428042A0B0097899F /* SafeSleepCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F8090328042A0B0097899F /* SafeSleepCell.m */; };
D0F80907280431100097899F /* UILabel+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F80906280431100097899F /* UILabel+Extras.m */; }; D0F80907280431100097899F /* UILabel+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F80906280431100097899F /* UILabel+Extras.m */; };
D0F82286280C44D10039F586 /* SetTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F82285280C44D10039F586 /* SetTableView.m */; }; D0F82286280C44D10039F586 /* SetTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F82285280C44D10039F586 /* SetTableView.m */; };
D0F9AC542826563400FD7A3B /* MusicPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F9AC532826563400FD7A3B /* MusicPlayerController.m */; }; D0F9AC542826563400FD7A3B /* MusicPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F9AC532826563400FD7A3B /* MusicPlayerController.m */; };
...@@ -190,8 +192,6 @@ ...@@ -190,8 +192,6 @@
D01814CE27FFCBAF00583D4E /* CWCarouselProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWCarouselProtocol.h; sourceTree = "<group>"; }; D01814CE27FFCBAF00583D4E /* CWCarouselProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWCarouselProtocol.h; sourceTree = "<group>"; };
D01814CF27FFCBAF00583D4E /* CWCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWCarousel.h; sourceTree = "<group>"; }; D01814CF27FFCBAF00583D4E /* CWCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWCarousel.h; sourceTree = "<group>"; };
D01814D027FFCBAF00583D4E /* CWFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWFlowLayout.h; sourceTree = "<group>"; }; D01814D027FFCBAF00583D4E /* CWFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWFlowLayout.h; sourceTree = "<group>"; };
D01814D327FFCCFA00583D4E /* HomeTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeTableView.h; sourceTree = "<group>"; };
D01814D427FFCCFA00583D4E /* HomeTableView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeTableView.m; sourceTree = "<group>"; };
D01814DA27FFD92200583D4E /* DSDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DSDataSource.h; sourceTree = "<group>"; }; D01814DA27FFD92200583D4E /* DSDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DSDataSource.h; sourceTree = "<group>"; };
D01814DB27FFD92200583D4E /* DSDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSDataSource.m; sourceTree = "<group>"; }; D01814DB27FFD92200583D4E /* DSDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSDataSource.m; sourceTree = "<group>"; };
D01814E027FFDBB800583D4E /* HomeHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeHeaderView.h; sourceTree = "<group>"; }; D01814E027FFDBB800583D4E /* HomeHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeHeaderView.h; sourceTree = "<group>"; };
...@@ -375,6 +375,14 @@ ...@@ -375,6 +375,14 @@
D09D0E99280D507F008DEDAB /* ProfileAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProfileAlertView.m; sourceTree = "<group>"; }; D09D0E99280D507F008DEDAB /* ProfileAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProfileAlertView.m; sourceTree = "<group>"; };
D09D0E9B280D73B6008DEDAB /* InviteController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InviteController.h; sourceTree = "<group>"; }; D09D0E9B280D73B6008DEDAB /* InviteController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InviteController.h; sourceTree = "<group>"; };
D09D0E9C280D73B6008DEDAB /* InviteController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InviteController.m; sourceTree = "<group>"; }; D09D0E9C280D73B6008DEDAB /* InviteController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InviteController.m; sourceTree = "<group>"; };
D0A72E37282B566200EED7BE /* HomeBasicCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeBasicCell.h; sourceTree = "<group>"; };
D0A72E38282B566200EED7BE /* HomeBasicCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeBasicCell.m; sourceTree = "<group>"; };
D0A72E3A282B56E600EED7BE /* GoodSleepSoundCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GoodSleepSoundCell.h; sourceTree = "<group>"; };
D0A72E3B282B56E600EED7BE /* GoodSleepSoundCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoodSleepSoundCell.m; sourceTree = "<group>"; };
D0A72E3D282B89AD00EED7BE /* DSHomeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DSHomeView.h; sourceTree = "<group>"; };
D0A72E3E282B89AD00EED7BE /* DSHomeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSHomeView.m; sourceTree = "<group>"; };
D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourseMusicCell.h; sourceTree = "<group>"; };
D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CourseMusicCell.m; sourceTree = "<group>"; };
D0AE1E3328281B6F008CEF27 /* TimerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TimerProxy.h; sourceTree = "<group>"; }; D0AE1E3328281B6F008CEF27 /* TimerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TimerProxy.h; sourceTree = "<group>"; };
D0AE1E3428281B6F008CEF27 /* TimerProxy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TimerProxy.m; sourceTree = "<group>"; }; D0AE1E3428281B6F008CEF27 /* TimerProxy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TimerProxy.m; sourceTree = "<group>"; };
D0AEFE77281781CF00230DC6 /* MyFeedModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyFeedModel.h; sourceTree = "<group>"; }; D0AEFE77281781CF00230DC6 /* MyFeedModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyFeedModel.h; sourceTree = "<group>"; };
...@@ -467,8 +475,6 @@ ...@@ -467,8 +475,6 @@
D0F808F42803D4E70097899F /* Track.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Track.h; sourceTree = "<group>"; }; D0F808F42803D4E70097899F /* Track.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Track.h; sourceTree = "<group>"; };
D0F808FC280421C20097899F /* ThreeMinuteController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreeMinuteController.h; sourceTree = "<group>"; }; D0F808FC280421C20097899F /* ThreeMinuteController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreeMinuteController.h; sourceTree = "<group>"; };
D0F808FD280421C20097899F /* ThreeMinuteController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ThreeMinuteController.m; sourceTree = "<group>"; }; D0F808FD280421C20097899F /* ThreeMinuteController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ThreeMinuteController.m; sourceTree = "<group>"; };
D0F8090228042A0B0097899F /* SafeSleepCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafeSleepCell.h; sourceTree = "<group>"; };
D0F8090328042A0B0097899F /* SafeSleepCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeSleepCell.m; sourceTree = "<group>"; };
D0F80905280431100097899F /* UILabel+Extras.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UILabel+Extras.h"; sourceTree = "<group>"; }; D0F80905280431100097899F /* UILabel+Extras.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UILabel+Extras.h"; sourceTree = "<group>"; };
D0F80906280431100097899F /* UILabel+Extras.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Extras.m"; sourceTree = "<group>"; }; D0F80906280431100097899F /* UILabel+Extras.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Extras.m"; sourceTree = "<group>"; };
D0F82284280C44D10039F586 /* SetTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SetTableView.h; sourceTree = "<group>"; }; D0F82284280C44D10039F586 /* SetTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SetTableView.h; sourceTree = "<group>"; };
...@@ -660,6 +666,7 @@ ...@@ -660,6 +666,7 @@
D0F808F72804204B0097899F /* Home */, D0F808F72804204B0097899F /* Home */,
D0A72E30282B4FE300EED7BE /* Course */, D0A72E30282B4FE300EED7BE /* Course */,
D0F808FB280421160097899F /* FallAsleep */, D0F808FB280421160097899F /* FallAsleep */,
D0A72E36282B539200EED7BE /* WhiteNoise */,
D0F808F628041FB60097899F /* BreathingMethod */, D0F808F628041FB60097899F /* BreathingMethod */,
); );
path = HomeModule; path = HomeModule;
...@@ -970,6 +977,13 @@ ...@@ -970,6 +977,13 @@
path = RequestModel; path = RequestModel;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
D0A72E36282B539200EED7BE /* WhiteNoise */ = {
isa = PBXGroup;
children = (
);
path = WhiteNoise;
sourceTree = "<group>";
};
D0B5EC9827F2D9DE003EDFE3 = { D0B5EC9827F2D9DE003EDFE3 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -1150,14 +1164,18 @@ ...@@ -1150,14 +1164,18 @@
children = ( children = (
D0E6F1FB28290128004150E5 /* TimingView.h */, D0E6F1FB28290128004150E5 /* TimingView.h */,
D0E6F1FC28290128004150E5 /* TimingView.m */, D0E6F1FC28290128004150E5 /* TimingView.m */,
D01814D327FFCCFA00583D4E /* HomeTableView.h */,
D01814D427FFCCFA00583D4E /* HomeTableView.m */,
D01814E027FFDBB800583D4E /* HomeHeaderView.h */, D01814E027FFDBB800583D4E /* HomeHeaderView.h */,
D01814E127FFDBB800583D4E /* HomeHeaderView.m */, D01814E127FFDBB800583D4E /* HomeHeaderView.m */,
D01814E928002A8200583D4E /* DsMiddleView.h */, D01814E928002A8200583D4E /* DsMiddleView.h */,
D01814EA28002A8200583D4E /* DsMiddleView.m */, D01814EA28002A8200583D4E /* DsMiddleView.m */,
D0F8090228042A0B0097899F /* SafeSleepCell.h */, D0A72E3D282B89AD00EED7BE /* DSHomeView.h */,
D0F8090328042A0B0097899F /* SafeSleepCell.m */, D0A72E3E282B89AD00EED7BE /* DSHomeView.m */,
D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */,
D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */,
D0A72E37282B566200EED7BE /* HomeBasicCell.h */,
D0A72E38282B566200EED7BE /* HomeBasicCell.m */,
D0A72E3A282B56E600EED7BE /* GoodSleepSoundCell.h */,
D0A72E3B282B56E600EED7BE /* GoodSleepSoundCell.m */,
D0506B1628054ECD00229278 /* SafeHelperCollectionView.h */, D0506B1628054ECD00229278 /* SafeHelperCollectionView.h */,
D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */, D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */,
D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */, D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */,
...@@ -1521,7 +1539,6 @@ ...@@ -1521,7 +1539,6 @@
D0DB33A528204E7C00E15914 /* FirstLeadAlertView.m in Sources */, D0DB33A528204E7C00E15914 /* FirstLeadAlertView.m in Sources */,
D0C50B3027FD1BEB00DC68F0 /* PrivacyView.m in Sources */, D0C50B3027FD1BEB00DC68F0 /* PrivacyView.m in Sources */,
D0B5ECD527F2F0B2003EDFE3 /* AdaptationUtil.m in Sources */, D0B5ECD527F2F0B2003EDFE3 /* AdaptationUtil.m in Sources */,
D0F8090428042A0B0097899F /* SafeSleepCell.m in Sources */,
D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */, D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */,
D01814D127FFCBAF00583D4E /* CWCarousel.m in Sources */, D01814D127FFCBAF00583D4E /* CWCarousel.m in Sources */,
D0B5ECB727F2D9E0003EDFE3 /* main.m in Sources */, D0B5ECB727F2D9E0003EDFE3 /* main.m in Sources */,
...@@ -1571,10 +1588,10 @@ ...@@ -1571,10 +1588,10 @@
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */, D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */, D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */,
D0F9AC542826563400FD7A3B /* MusicPlayerController.m in Sources */, D0F9AC542826563400FD7A3B /* MusicPlayerController.m in Sources */,
D0A72E3C282B56E600EED7BE /* GoodSleepSoundCell.m in Sources */,
D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */, D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */,
D0874BBF2816E61000CECB3C /* RescuePlanView.m in Sources */, D0874BBF2816E61000CECB3C /* RescuePlanView.m in Sources */,
D07DACA42810557D0067A1BF /* CGGeometry+RSKImageCropper.m in Sources */, D07DACA42810557D0067A1BF /* CGGeometry+RSKImageCropper.m in Sources */,
D01814D527FFCCFA00583D4E /* HomeTableView.m in Sources */,
D09D0E96280D3FE9008DEDAB /* NSDate+Extras.m in Sources */, D09D0E96280D3FE9008DEDAB /* NSDate+Extras.m in Sources */,
D0878F4C280BEFF9005F1B7F /* UILabel+YBAttributeTextTapAction.m in Sources */, D0878F4C280BEFF9005F1B7F /* UILabel+YBAttributeTextTapAction.m in Sources */,
D0F80907280431100097899F /* UILabel+Extras.m in Sources */, D0F80907280431100097899F /* UILabel+Extras.m in Sources */,
...@@ -1594,6 +1611,8 @@ ...@@ -1594,6 +1611,8 @@
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */, D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */,
D0FAC421281B817D00D4B859 /* GKPhotoView.m in Sources */, D0FAC421281B817D00D4B859 /* GKPhotoView.m in Sources */,
D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */, D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */,
D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */,
D0A72E39282B566200EED7BE /* HomeBasicCell.m in Sources */,
D08F79DA281A1838000D99DD /* TZPhotoPreviewController.m in Sources */, D08F79DA281A1838000D99DD /* TZPhotoPreviewController.m in Sources */,
D01814EE28002DC700583D4E /* HeaderDataModel.m in Sources */, D01814EE28002DC700583D4E /* HeaderDataModel.m in Sources */,
D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */, D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */,
...@@ -1625,6 +1644,7 @@ ...@@ -1625,6 +1644,7 @@
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */, D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */, D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */,
D08F79D5281A1838000D99DD /* TZAssetCell.m in Sources */, D08F79D5281A1838000D99DD /* TZAssetCell.m in Sources */,
D0A72E3F282B89AD00EED7BE /* DSHomeView.m in Sources */,
D01814E8280020F900583D4E /* CWPageControl.m in Sources */, D01814E8280020F900583D4E /* CWPageControl.m in Sources */,
D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */, D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */,
D08F79DD281A1838000D99DD /* TZImageManager.m in Sources */, D08F79DD281A1838000D99DD /* TZImageManager.m in Sources */,
......
...@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 查看全部控制器 /// 查看全部控制器
@interface LookAllController : UIViewController @interface LookAllController : UIViewController
- (instancetype)initWithIndexPath:(NSIndexPath *)indexPath; - (instancetype)initWithDefaultIndex:(NSInteger)defaultIndex;
@end @end
......
...@@ -14,17 +14,17 @@ ...@@ -14,17 +14,17 @@
@end @end
@implementation LookAllController { @implementation LookAllController {
NSIndexPath *_indexPath; NSInteger _defaultIndex;
UIView *_indicatorView; UIView *_indicatorView;
NSArray *_btns; NSArray *_btns;
NSInteger _selectedIndex; NSInteger _selectedIndex;
} }
- (instancetype)initWithIndexPath:(NSIndexPath *)indexPath { - (instancetype)initWithDefaultIndex:(NSInteger)defaultIndex {
if (self = [super init]) { if (self = [super init]) {
_indexPath = indexPath; _defaultIndex = defaultIndex;
_selectedIndex = _indexPath.row; _selectedIndex = defaultIndex;
self.navigationItem.title = indexPath.row == 0 ? @"舒眠课程" : @"助眠音乐"; self.navigationItem.title = _defaultIndex == 0 ? @"舒眠课程" : @"助眠音乐";
} }
return self; return self;
} }
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
}]; }];
[_indicatorView mas_makeConstraints:^(MASConstraintMaker *make) { [_indicatorView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(btn1); make.width.equalTo(btn1);
make.centerX.equalTo(_indexPath.row == 0 ? btn1 : btn2); make.centerX.equalTo(_defaultIndex == 0 ? btn1 : btn2);
make.height.equalTo(@4); make.height.equalTo(@4);
make.bottom.equalTo(_headView); make.bottom.equalTo(_headView);
}]; }];
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
*/ */
typedef enum { typedef enum {
CourseTypeSafe, // 舒眠课程 CourseTypeSafe, // 舒眠课程
CourseTypeRelax // 发送音乐 CourseTypeRelax // 放松音乐
} CourseType; } CourseType;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
...@@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *bg_url; @property (nonatomic, copy) NSString *bg_url;
// 主页显示图标 // 主页显示图标
@property (nonatomic, copy) NSString *home_img; @property (nonatomic, copy) NSString *home_img;
// 课程数量
@property (nonatomic, assign) int count;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -7,16 +7,23 @@ ...@@ -7,16 +7,23 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
// Cell类型
typedef NS_ENUM(NSInteger, CellType) {
CellTypeCourse, // 舒眠课程
CellTypeMusic, // 助眠音乐
CellTypeGood // 好眠声音
};
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 舒眠课程、助眠音乐、好眠声音数据 model /// 舒眠课程、助眠音乐、好眠声音数据通用数据 model
@interface SafeSleepModel : NSObject @interface SafeSleepModel : NSObject
/// cell标题 /// cell标题
@property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSString *title;
/// 课程列表数据 /// cell类型
@property (nonatomic, copy) NSArray *courseListDatas; @property (nonatomic, assign) CellType type;
/// 获取所有cell数据
+ (NSArray *)getDatas; + (NSArray *)getDatas;
@end @end
......
...@@ -11,11 +11,12 @@ ...@@ -11,11 +11,12 @@
+ (NSArray *)getDatas { + (NSArray *)getDatas {
NSArray *titles = @[@"舒眠课程", @"助眠音乐", @"好眠声音"]; NSArray *titles = @[@"舒眠课程", @"助眠音乐", @"好眠声音"];
NSArray *types = @[@(CellTypeCourse), @(CellTypeMusic), @(CellTypeGood)];
NSMutableArray *tmpDatas = [NSMutableArray array]; NSMutableArray *tmpDatas = [NSMutableArray array];
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
SafeSleepModel *m = [SafeSleepModel new]; SafeSleepModel *m = [SafeSleepModel new];
m.type = [types[i] integerValue];
m.title = titles[i]; m.title = titles[i];
m.courseListDatas = @[];
[tmpDatas addObject:m]; [tmpDatas addObject:m];
} }
return [tmpDatas copy]; return [tmpDatas copy];
......
...@@ -6,15 +6,16 @@ ...@@ -6,15 +6,16 @@
// //
#import "HomeViewController.h" #import "HomeViewController.h"
#import "HomeTableView.h" #import "DSHomeView.h"
#import "RescuePlanView.h" #import "RescuePlanView.h"
#import "FirstLeadAlertView.h" #import "FirstLeadAlertView.h"
#import "UserRequestModel.h" #import "UserRequestModel.h"
#import "HomeRequestModel.h" #import "HomeRequestModel.h"
#import "ThreeMinuteController.h" #import "ThreeMinuteController.h"
#import "SafeSleepRequestModel.h"
@interface HomeViewController () @interface HomeViewController ()
@property (nonatomic, strong) HomeTableView *homeTV; @property (nonatomic, strong) DSHomeView *homeTV;
@property (nonatomic, strong) RescuePlanView *rescuePlanView; @property (nonatomic, strong) RescuePlanView *rescuePlanView;
@end @end
...@@ -34,14 +35,43 @@ ...@@ -34,14 +35,43 @@
if ([LoginUtils getUserLoginData]) { if ([LoginUtils getUserLoginData]) {
// 自动登录请求(调用时机) // 自动登录请求(调用时机)
[UserRequestModel autoLoginRequestWithCompletion:^(UserRequestModel * _Nonnull requestModel) { [UserRequestModel autoLoginRequestWithCompletion:^(UserRequestModel * _Nonnull requestModel) {}];
}];
} }
// 活动运营弹框(首次启动不弹框,后面每隔24个小时请求后台接口) // 活动运营弹框(首次启动不弹框,后面每隔24个小时请求后台接口)
[self promotionAlert]; [self promotionAlert];
// APP首次启动弹框(只出现一次) // APP首次启动弹框(只出现一次)
[self showFirstLeadAlertView]; [self showFirstLeadAlertView];
[self requestHomeData];
}
#pragma mark - banner、舒眠课程、助眠音乐数据获取
- (void)requestHomeData {
self.homeTV.mj_header = [DSGifHeader headerWithRefreshingBlock:^{
// 获取首页banner数据
[HomeRequestModel queryBannerListWithCompletion:^(HomeRequestModel * _Nonnull requestModel) {
[self.homeTV.mj_header endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
[self.homeTV refreshBarnner:requestModel.bannerListData];
}
}];
// 获取首页舒眠课程数据
[SafeSleepRequestModel getCourseListDataWithSubID:6 isHome:YES completion:^(SafeSleepRequestModel * _Nonnull requestModel) {
[self.homeTV.mj_header endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
[self.homeTV updateCourseMusicCell:CellTypeCourse data:requestModel.courseListData];
}
}];
// 获取首页助眠音乐数据
[SafeSleepRequestModel getCourseListDataWithSubID:18 isHome:YES completion:^(SafeSleepRequestModel * _Nonnull requestModel) {
[self.homeTV.mj_header endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
[self.homeTV updateCourseMusicCell:CellTypeMusic data:requestModel.courseListData];
}
}];
}];
[self.homeTV.mj_header beginRefreshing];
} }
#pragma mark - APP首次启动弹框 #pragma mark - APP首次启动弹框
...@@ -137,9 +167,9 @@ ...@@ -137,9 +167,9 @@
} }
#pragma mark - lazy #pragma mark - lazy
- (HomeTableView *)homeTV { - (DSHomeView *)homeTV {
if (!_homeTV) { if (!_homeTV) {
_homeTV = [[HomeTableView alloc] init]; _homeTV = [[DSHomeView alloc] init];
} }
return _homeTV; return _homeTV;
} }
......
//
// CourseMusicCell.h
// DreamSleep
//
// Created by peter on 2022/5/11.
//
#import "HomeBasicCell.h"
NS_ASSUME_NONNULL_BEGIN
/// 舒眠课程、助眠音乐Cell
@interface CourseMusicCell : HomeBasicCell
/// 刷新首页舒眠课程、助眠音乐列表数据
/// @param dataArr dataArr
/// @param cellIndex cellIndex
- (void)updateCourseMusicListWithData:(NSArray *)dataArr cellIndex:(NSInteger)cellIndex;
@end
NS_ASSUME_NONNULL_END
//
// CourseMusicCell.m
// DreamSleep
//
// Created by peter on 2022/5/11.
//
#import "CourseMusicCell.h"
#import "LookAllController.h"
#import "SafeHelperCollectionView.h"
@interface CourseMusicCell ()
@property (nonatomic, strong) UIButton *moreBtn;
@property (nonatomic, strong) SafeHelperCollectionView *shCollectionView;
@end
@implementation CourseMusicCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self.contentView addSubview:self.moreBtn];
[self.contentView addSubview:self.shCollectionView];
[self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-5);
make.width.equalTo(@100);
make.height.equalTo(@30);
make.centerY.equalTo(self.verticalView.mas_centerY);
}];
[self.shCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLab.mas_bottom).offset(17);
make.left.equalTo(self.verticalView);
make.right.equalTo(self.contentView);
make.bottom.equalTo(self.contentView).offset(0);
}];
}
return self;
}
- (void)updateCourseMusicListWithData:(NSArray *)dataArr cellIndex:(NSInteger)cellIndex {
[self.shCollectionView reloadWithData:dataArr cellIndex:cellIndex];
}
- (void)lookAllAction {
NSInteger defaultIndex = self.model.type == CellTypeCourse ? 0 : 1;
LookAllController *lookAllVC = [[LookAllController alloc] initWithDefaultIndex:defaultIndex];
[self.ds_viewController.navigationController pushViewController:lookAllVC animated:YES];
}
#pragma mark - lazy
- (UIButton *)moreBtn {
if (!_moreBtn) {
_moreBtn = [UIButton dkBtnWithSubTitle:@"查看全部" imgName:@"rightRow" font:SysFont(12)];
_moreBtn.frame = CGRectMake(0, 0, 100, 40);
[_moreBtn adjustLayoutWithType:UIButtonLayoutTypeLeftTitleRightImage midSpace:4 sizeToFit:NO];
[_moreBtn addTarget:self action:@selector(lookAllAction) forControlEvents:UIControlEventTouchUpInside];
}
return _moreBtn;
}
- (SafeHelperCollectionView *)shCollectionView {
if (!_shCollectionView) {
_shCollectionView = [[SafeHelperCollectionView alloc] initWithCellIndex:self.cellIndex];
}
return _shCollectionView;
}
@end
//
// DSHomeView.h
// DreamSleep
//
// Created by peter on 2022/5/11.
//
#import <UIKit/UIKit.h>
#import "SafeSleepModel.h"
NS_ASSUME_NONNULL_BEGIN
/// APP首页自定义视图
@interface DSHomeView : UITableView
/// 刷新banner
/// @param bannerListData bannerListData
- (void)refreshBarnner:(NSArray *)bannerListData;
/// 刷新舒眠课程或者助眠音乐cell
/// @param type type
/// @param dataArr dataArr
- (void)updateCourseMusicCell:(CellType)type data:(NSArray *)dataArr;
@end
NS_ASSUME_NONNULL_END
// //
// HomeTableView.m // DSHomeView.m
// DreamSleep // DreamSleep
// //
// Created by peter on 2022/4/8. // Created by peter on 2022/5/11.
// //
#import "HomeTableView.h" #import "DSHomeView.h"
#import "HomeHeaderView.h" #import "HomeHeaderView.h"
#import "SafeSleepCell.h" #import "CourseMusicCell.h"
#import "HomeRequestModel.h" #import "GoodSleepSoundCell.h"
#import "SafeSleepRequestModel.h"
@interface HomeTableView () <UITableViewDelegate> @interface DSHomeView () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) HomeHeaderView *headerView; @property (nonatomic, strong) HomeHeaderView *headerView;
@property (nonatomic, strong) DSDataSource *homeDataSource; @property (nonatomic, strong) NSArray *courseMusicArr;
@property (nonatomic, strong) NSArray *dataArr;
@end @end
@implementation HomeTableView { @implementation DSHomeView
// 舒眠课程数据
NSArray *_courseSafeArr;
// 助眠音乐数据
NSArray *_courseHelpArr;
}
- (instancetype)init { - (instancetype)init {
if (self = [super initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:UITableViewStylePlain]) { if (self = [super initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:UITableViewStylePlain]) {
_courseSafeArr = @[];
_courseHelpArr = @[];
self.dataArr = [SafeSleepModel getDatas];
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG); self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.separatorStyle = UITableViewCellSeparatorStyleNone; self.separatorStyle = UITableViewCellSeparatorStyleNone;
self.showsVerticalScrollIndicator = NO; self.showsVerticalScrollIndicator = NO;
self.delegate = self;
[self.homeDataSource addDataArray:self.dataArr]; self.dataSource = self;
[self registerClass:[CourseMusicCell class] forCellReuseIdentifier:NSStringFromClass([CourseMusicCell class])];
self.mj_header = [DSGifHeader headerWithRefreshingBlock:^{ [self registerClass:[GoodSleepSoundCell class] forCellReuseIdentifier:NSStringFromClass([GoodSleepSoundCell class])];
// 获取首页banner数据 self.tableHeaderView = self.headerView;
[HomeRequestModel queryBannerListWithCompletion:^(HomeRequestModel * _Nonnull requestModel) {
[self.mj_header endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
[self.headerView updateBannerWithListData:requestModel.bannerListData];
}
}];
// 获取首页舒眠课程数据
[SafeSleepRequestModel getCourseListDataWithSubID:6 isHome:YES completion:^(SafeSleepRequestModel * _Nonnull requestModel) {
[self.mj_header endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
self->_courseSafeArr = requestModel.courseListData;
}
}];
// 获取首页助眠音乐数据
[SafeSleepRequestModel getCourseListDataWithSubID:18 isHome:YES completion:^(SafeSleepRequestModel * _Nonnull requestModel) {
[self.mj_header endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
self->_courseHelpArr = requestModel.courseListData;
}
}];
}];
[self.mj_header beginRefreshing];
} }
return self; return self;
} }
#pragma mark - lazy - (void)refreshBarnner:(NSArray *)bannerListData {
- (DSDataSource *)homeDataSource { [self.headerView updateBannerWithListData:bannerListData];
if (!_homeDataSource) {
CellConfigureBlock cellBlock = ^(SafeSleepCell * cell, SafeSleepModel * model, NSIndexPath * indexPath) {
[cell configureCellWithModel:model indexPath:indexPath];
};
NSString * const safeSleepCellID = @"safeSleepCellID";
_homeDataSource = [[DSDataSource alloc] initWithIdentifier:safeSleepCellID datas:@[] isSection:NO configureBlock:cellBlock];
self.dataSource = _homeDataSource;
self.delegate = self;
[self registerClass:[SafeSleepCell class] forCellReuseIdentifier:safeSleepCellID];
self.tableHeaderView = self.headerView;
}
return _homeDataSource;
} }
- (HomeHeaderView *)headerView { - (void)updateCourseMusicCell:(CellType)type data:(NSArray *)dataArr {
if (!_headerView) { NSInteger index = type == CellTypeCourse ? 0 : 1;
// banner高度 CourseMusicCell *cell = (CourseMusicCell *)[self cellForRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]];
CGFloat bannerH = 2*(kScreenWidth - 48)/5.0; [cell updateCourseMusicListWithData:dataArr cellIndex:index];
// 三分钟即刻入睡按钮宽度 }
CGFloat width = (kScreenWidth - 2*15 - 14)/2;
CGFloat height = 15 + bannerH + 24 + 133*width/165.0; - (NSString *)cellIdentiferAtIndexPath:(NSIndexPath *)indexPath {
_headerView = [[HomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)]; SafeSleepModel *item = self.courseMusicArr[indexPath.row];
_headerView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG); if (item.type == CellTypeGood) {
return NSStringFromClass([GoodSleepSoundCell class]);
} else {
return NSStringFromClass([CourseMusicCell class]);
} }
return _headerView;
} }
#pragma mark - UITableViewDelegate #pragma mark - UITableViewDelegate && UITableViewDataSource
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
HomeBasicCell *cell = [tableView dequeueReusableCellWithIdentifier:[self cellIdentiferAtIndexPath:indexPath] forIndexPath:indexPath];
[cell configBasicData:self.courseMusicArr[indexPath.row] cellIndex:indexPath.row];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.courseMusicArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGFloat height = 300; CGFloat height = 300;
if (indexPath.row == 0) { if (indexPath.row == 0) {
...@@ -119,4 +87,25 @@ ...@@ -119,4 +87,25 @@
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 0.001)]; return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 0.001)];
} }
#pragma mark - lazy
- (HomeHeaderView *)headerView {
if (!_headerView) {
// banner高度
CGFloat bannerH = 2*(kScreenWidth - 48)/5.0;
// 三分钟即刻入睡按钮宽度
CGFloat width = (kScreenWidth - 2*15 - 14)/2;
CGFloat height = 15 + bannerH + 24 + 133*width/165.0;
_headerView = [[HomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)];
_headerView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
}
return _headerView;
}
- (NSArray *)courseMusicArr {
if (!_courseMusicArr) {
_courseMusicArr = [SafeSleepModel getDatas];
}
return _courseMusicArr;
}
@end @end
// //
// HomeTableView.h // GoodSleepSoundCell.h
// DreamSleep // DreamSleep
// //
// Created by peter on 2022/4/8. // Created by peter on 2022/5/11.
// //
#import <UIKit/UIKit.h> #import "HomeBasicCell.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 自定义首页tableView /// 好眠声音cell
@interface HomeTableView : UITableView @interface GoodSleepSoundCell : HomeBasicCell
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
//
// GoodSleepSoundCell.m
// DreamSleep
//
// Created by peter on 2022/5/11.
//
#import "GoodSleepSoundCell.h"
@interface GoodSleepSoundCell ()
@property (nonatomic, strong) UIButton *timerBtn;
@end
@implementation GoodSleepSoundCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self.contentView addSubview:self.timerBtn];
[self.timerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-5);
make.width.equalTo(@100);
make.height.equalTo(@30);
make.centerY.equalTo(self.verticalView.mas_centerY);
}];
}
return self;
}
#pragma mark - Actions
- (void)timerSetting:(UIButton *)sender {
DSLog(@"66666:%ld", self.model.type);
DSLog(@"timerSetting");
}
#pragma mark - lazy
- (UIButton *)timerBtn {
if (!_timerBtn) {
_timerBtn = [UIButton new];
[_timerBtn dk_setImage:DKImagePickerWithNames(@"timerIcon", @"timerIcon_dk", @"timerIcon_dk") forState:UIControlStateNormal];
[_timerBtn addTarget:self action:@selector(timerSetting:) forControlEvents:UIControlEventTouchUpInside];
}
return _timerBtn;
}
@end
// //
// SafeSleepCell.h // HomeBasicCell.h
// DreamSleep // DreamSleep
// //
// Created by peter on 2022/4/11. // Created by peter on 2022/5/11.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
...@@ -10,14 +10,19 @@ ...@@ -10,14 +10,19 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 舒眠课程、助眠音乐、好眠声音静态Cell /// 首页基础Cell
@interface SafeSleepCell : UITableViewCell @interface HomeBasicCell : UITableViewCell
/// 左边竖条视图
@property (nonatomic, strong) UIView *verticalView;
/// 标题标签
@property (nonatomic, strong) UILabel *titleLab;
/// 通用数据项
@property (nonatomic, strong) SafeSleepModel *model; @property (nonatomic, strong) SafeSleepModel *model;
@property (nonatomic, strong) NSIndexPath *indexPath; /// cellIndex
@property (nonatomic, assign) NSInteger cellIndex;
- (void)configureCellWithModel:(SafeSleepModel *)model indexPath:(NSIndexPath *)indexPath;
- (void)configBasicData:(SafeSleepModel *)model cellIndex:(NSInteger)cellIndex;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
//
// HomeBasicCell.m
// DreamSleep
//
// Created by peter on 2022/5/11.
//
#import "HomeBasicCell.h"
@interface HomeBasicCell ()
@end
@implementation HomeBasicCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.contentView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self.contentView addSubview:self.verticalView];
[self.contentView addSubview:self.titleLab];
[self.verticalView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10);
make.top.equalTo(self.contentView.mas_top).offset(33);
make.width.equalTo(@4);
make.height.equalTo(@16);
}];
}
return self;
}
- (void)configBasicData:(SafeSleepModel *)model cellIndex:(NSInteger)cellIndex {
_model = model;
_cellIndex = cellIndex;
self.titleLab.text = model.title;
[self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.verticalView.mas_right).offset(10);
make.centerY.equalTo(self.verticalView.mas_centerY);
}];
}
#pragma mark - lazy
- (UIView *)verticalView {
if (!_verticalView) {
_verticalView = [UIView new];
_verticalView.backgroundColor = BrandColor;
[_verticalView cornerRadius:3];
}
return _verticalView;
}
- (UILabel *)titleLab {
if (!_titleLab) {
_titleLab = [UILabel dkLabWithFont:BoldFont(16.0)];
}
return _titleLab;
}
@end
...@@ -12,9 +12,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -12,9 +12,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 舒眠课程、助眠音乐集合视图 /// 舒眠课程、助眠音乐集合视图
@interface SafeHelperCollectionView : UICollectionView @interface SafeHelperCollectionView : UICollectionView
- (instancetype)initCollectionViewWithIndexPath:(NSIndexPath *)indexPath; - (instancetype)initWithCellIndex:(NSInteger)cellIndex;
- (instancetype)initWithIndexPath:(NSIndexPath *)indexPath courseListDatas:(NSArray *)courseListDatas; - (void)reloadWithData:(NSArray *)dataArr cellIndex:(NSInteger)cellIndex;
@end @end
......
...@@ -7,20 +7,22 @@ ...@@ -7,20 +7,22 @@
#import "SafeHelperCollectionView.h" #import "SafeHelperCollectionView.h"
#import "SafeHelperCollectionViewCell.h" #import "SafeHelperCollectionViewCell.h"
#import "CourseDetailController.h"
@interface SafeHelperCollectionView () <UICollectionViewDelegate, UICollectionViewDataSource> @interface SafeHelperCollectionView () <UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, strong) NSIndexPath *cellIndexPath; /// 首页传递过来的cell下标
@property (nonatomic, assign) NSInteger cellIndex;
/// 首页舒眠课程和助眠音乐课程列表数据 /// 首页舒眠课程和助眠音乐课程列表数据
@property (nonatomic, strong) NSArray *courseListData; @property (nonatomic, strong) NSArray *courseListData;
@end @end
@implementation SafeHelperCollectionView @implementation SafeHelperCollectionView
- (instancetype)initWithIndexPath:(NSIndexPath *)indexPath courseListDatas:(NSArray *)courseListDatas { - (instancetype)initWithCellIndex:(NSInteger)cellIndex {
self.courseListData = courseListDatas; self.cellIndex = cellIndex;
self.cellIndexPath = indexPath; self.courseListData = @[];
CGFloat width = indexPath.row == 0 ? 100 : 90; CGFloat width = cellIndex == 0 ? 100 : 90;
CGFloat height = indexPath.row == 0 ? 130 : 120; CGFloat height = cellIndex == 0 ? 130 : 120;
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 10); layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 10);
layout.itemSize = CGSizeMake(width, height); layout.itemSize = CGSizeMake(width, height);
...@@ -37,6 +39,12 @@ ...@@ -37,6 +39,12 @@
return self; return self;
} }
- (void)reloadWithData:(NSArray *)dataArr cellIndex:(NSInteger)cellIndex {
self.cellIndex = cellIndex;
self.courseListData = dataArr;
[self reloadData];
}
#pragma mark - UICollectionViewDelegate && UICollectionViewDataSource #pragma mark - UICollectionViewDelegate && UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.courseListData.count; return self.courseListData.count;
...@@ -44,12 +52,16 @@ ...@@ -44,12 +52,16 @@
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
SafeHelperCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"shCollectionViewCell" forIndexPath:indexPath]; SafeHelperCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"shCollectionViewCell" forIndexPath:indexPath];
cell.courseModel = self.courseListData[indexPath.row]; [cell updateCellWithCellIndex:self.cellIndex model:self.courseListData[indexPath.row]];
return cell; return cell;
} }
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
DSLog(@"row:%ld", indexPath.row); CourseModel *model = [self.courseListData objectAtIndex:indexPath.row];
CourseDetailController *coureDetailVC = [[CourseDetailController alloc] init];
coureDetailVC.courseModel = model;
coureDetailVC.courseType = self.cellIndex == 0 ? CourseTypeSafe : CourseTypeRelax;
[self.ds_viewController.navigationController pushViewController:coureDetailVC animated:YES];
} }
@end @end
...@@ -12,9 +12,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -12,9 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface SafeHelperCollectionViewCell : UICollectionViewCell @interface SafeHelperCollectionViewCell : UICollectionViewCell
@property (nonatomic, strong) CourseModel *courseModel; - (void)updateCellWithCellIndex:(NSInteger)cellIndex model:(CourseModel *)model;
- (void)mockDatas:(NSIndexPath *)cellIndexPath;
@end @end
......
...@@ -30,23 +30,17 @@ ...@@ -30,23 +30,17 @@
return self; return self;
} }
- (void)setCourseModel:(CourseModel *)courseModel { - (void)updateCellWithCellIndex:(NSInteger)cellIndex model:(CourseModel *)model {
_courseModel = courseModel; [self.homeIV yy_setImageWithURL:[NSURL URLWithString:model.home_img] placeholder:[UIImage imageNamed:@"basicPlaceholder"]];
self.audioTypeLab.text = model.audio_name;
[self.homeIV yy_setImageWithURL:[NSURL URLWithString:courseModel.home_img] placeholder:[UIImage imageNamed:@"basicPlaceholder"]];
}
- (void)mockDatas:(NSIndexPath *)cellIndexPath {
self.homeIV.image = [UIImage imageNamed:cellIndexPath.row == 0 ? @"test0" : @"test1"];
self.audioTypeLab.text = @"都会浪漫";
[self.audioTypeLab sizeToFit]; [self.audioTypeLab sizeToFit];
if (cellIndexPath.row == 0) { // 舒眠课程 if (cellIndex == 0) { // 舒眠课程
[self insertSubview:self.roundedView belowSubview:self.homeIV]; [self insertSubview:self.roundedView belowSubview:self.homeIV];
[self addSubview:self.courseIcon]; [self addSubview:self.courseIcon];
[self addSubview:self.courseLab]; [self addSubview:self.courseLab];
self.courseLab.text = @"10课时"; self.courseLab.text = [NSString stringWithFormat:@"%d", model.count];
[self.courseLab sizeToFit]; [self.courseLab sizeToFit];
[self.roundedView mas_makeConstraints:^(MASConstraintMaker *make) { [self.roundedView mas_makeConstraints:^(MASConstraintMaker *make) {
...@@ -64,9 +58,10 @@ ...@@ -64,9 +58,10 @@
make.centerY.equalTo(self.courseIcon); make.centerY.equalTo(self.courseIcon);
}]; }];
} }
CGFloat width = cellIndexPath.row == 0 ? 100 : 90;
CGFloat bottomSpace = cellIndexPath.row == 0 ? 0 : -3; CGFloat width = cellIndex == 0 ? 100 : 90;
CGFloat topSpacing = cellIndexPath.row == 0 ? 4 : 0; CGFloat bottomSpace = cellIndex == 0 ? 0 : -3;
CGFloat topSpacing = cellIndex == 0 ? 4 : 0;
[self.homeIV mas_makeConstraints:^(MASConstraintMaker *make) { [self.homeIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self).offset(topSpacing); make.top.equalTo(self).offset(topSpacing);
make.left.equalTo(self); make.left.equalTo(self);
......
//
// SafeSleepCell.m
// DreamSleep
//
// Created by peter on 2022/4/11.
//
#import "SafeSleepCell.h"
#import "SafeHelperCollectionView.h"
#import "SafeHelperCollectionViewCell.h"
#import "LookAllController.h"
@interface SafeSleepCell ()
@property (nonatomic, strong) UIView *leftIV;
@property (nonatomic, strong) UILabel *recommandLb;
@property (nonatomic, strong) UIButton *moreBtn;
@property (nonatomic, strong) UIButton *timerBtn;
@property (nonatomic, strong) SafeHelperCollectionView *shCollectionView;
@end
@implementation SafeSleepCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.contentView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self.contentView addSubview:self.leftIV];
[self.contentView addSubview:self.recommandLb];
}
return self;
}
// 隐藏选中Cell时的分割线
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame];
self.selectedBackgroundView.backgroundColor = DSClearColor;
[super setSelected:selected animated:animated];
}
- (void)configureCellWithModel:(SafeSleepModel *)model indexPath:(NSIndexPath *)indexPath {
_model = model;
_indexPath = indexPath;
self.recommandLb.text = model.title;
[self.leftIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10);
make.top.equalTo(self.contentView.mas_top).offset(33);
make.width.equalTo(@4);
make.height.equalTo(@16);
}];
[self.recommandLb mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.leftIV.mas_right).offset(10);
make.centerY.equalTo(self.leftIV.mas_centerY);
}];
if (indexPath.row == 2) { // 好眠声音区域
[self.contentView addSubview:self.timerBtn];
[self.timerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-5);
make.width.equalTo(@100);
make.height.equalTo(@30);
make.centerY.equalTo(self.leftIV.mas_centerY);
}];
} else { // 舒眠课程和助眠音乐
[self.contentView addSubview:self.moreBtn];
[self.contentView addSubview:self.shCollectionView];
[self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-5);
make.width.equalTo(@100);
make.height.equalTo(@30);
make.centerY.equalTo(self.leftIV.mas_centerY);
}];
[self.shCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.recommandLb.mas_bottom).offset(17);
make.left.equalTo(self.leftIV);
make.right.equalTo(self.contentView);
make.bottom.equalTo(self.contentView).offset(0);
}];
}
}
#pragma mark - lazy
- (UIView *)leftIV {
if (!_leftIV) {
_leftIV = [UIView new];
_leftIV.backgroundColor = BrandColor;
_leftIV.layer.cornerRadius = 3;
_leftIV.layer.masksToBounds = YES;
}
return _leftIV;
}
- (UILabel *)recommandLb {
if (!_recommandLb) {
_recommandLb = [UILabel dkLabWithText:@"助眠音乐" font:BoldFont(16.0)];
}
return _recommandLb;
}
- (UIButton *)moreBtn {
if (!_moreBtn) {
_moreBtn = [UIButton dkBtnWithSubTitle:@"查看全部" imgName:@"rightRow" font:SysFont(12)];
_moreBtn.frame = CGRectMake(0, 0, 100, 40);
[_moreBtn adjustLayoutWithType:UIButtonLayoutTypeLeftTitleRightImage midSpace:4 sizeToFit:NO];
[_moreBtn addTarget:self action:@selector(lookMore:) forControlEvents:UIControlEventTouchUpInside];
}
return _moreBtn;
}
- (UIButton *)timerBtn {
if (!_timerBtn) {
_timerBtn = [UIButton new];
[_timerBtn dk_setImage:DKImagePickerWithNames(@"timerIcon", @"timerIcon_dk", @"timerIcon_dk") forState:UIControlStateNormal];
[_timerBtn addTarget:self action:@selector(timerSetting:) forControlEvents:UIControlEventTouchUpInside];
}
return _timerBtn;
}
- (SafeHelperCollectionView *)shCollectionView {
if (!_shCollectionView) {
_shCollectionView = [[SafeHelperCollectionView alloc] initWithIndexPath:self.indexPath courseListDatas:@[]];
}
return _shCollectionView;
}
#pragma mark - Actions
- (void)timerSetting:(UIButton *)sender {
DSLog(@"timerSetting");
}
- (void)lookMore:(UIButton *)sender {
LookAllController *lookAllVC = [[LookAllController alloc] initWithIndexPath:self.indexPath];
[self.ds_viewController.navigationController pushViewController:lookAllVC animated:YES];
}
@end
{
"images" : [
{
"filename" : "test0.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "test1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!