Commit 0537e42c cgx

课程音频列表界面自定义导航栏

1 个父辈 7a52bcf4
正在显示 33 个修改的文件 包含 598 行增加9 行删除
......@@ -55,6 +55,11 @@
D053BEE9280F9E310028CCFC /* CloseAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D053BEE8280F9E310028CCFC /* CloseAlertView.m */; };
D055BEB928250D3400BC11A4 /* CourseCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEB828250D3400BC11A4 /* CourseCollectionCell.m */; };
D055BEBC28250E8F00BC11A4 /* CourseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEBB28250E8F00BC11A4 /* CourseModel.m */; };
D055BEBF2825267C00BC11A4 /* DSBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEBE2825267C00BC11A4 /* DSBaseViewController.m */; };
D055BEC2282526B700BC11A4 /* CourseDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEC1282526B700BC11A4 /* CourseDetailController.m */; };
D055BEC528252B8900BC11A4 /* AudioDetailHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEC428252B8900BC11A4 /* AudioDetailHeaderView.m */; };
D055BEC828252D8200BC11A4 /* AudioCourseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEC728252D8200BC11A4 /* AudioCourseCell.m */; };
D055BECB28252E4000BC11A4 /* SubAudioModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BECA28252E4000BC11A4 /* SubAudioModel.m */; };
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A09D281838B800B4F48A /* FeedbackRequestModel.m */; };
D062A0A128183FE000B4F48A /* FeedbackDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A0A028183FE000B4F48A /* FeedbackDetailController.m */; };
D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D070509928071BAF006D72E1 /* DSNetworkTool.m */; };
......@@ -251,6 +256,16 @@
D055BEB828250D3400BC11A4 /* CourseCollectionCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CourseCollectionCell.m; sourceTree = "<group>"; };
D055BEBA28250E8F00BC11A4 /* CourseModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourseModel.h; sourceTree = "<group>"; };
D055BEBB28250E8F00BC11A4 /* CourseModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CourseModel.m; sourceTree = "<group>"; };
D055BEBD2825267C00BC11A4 /* DSBaseViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DSBaseViewController.h; sourceTree = "<group>"; };
D055BEBE2825267C00BC11A4 /* DSBaseViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSBaseViewController.m; sourceTree = "<group>"; };
D055BEC0282526B700BC11A4 /* CourseDetailController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourseDetailController.h; sourceTree = "<group>"; };
D055BEC1282526B700BC11A4 /* CourseDetailController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CourseDetailController.m; sourceTree = "<group>"; };
D055BEC328252B8900BC11A4 /* AudioDetailHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AudioDetailHeaderView.h; sourceTree = "<group>"; };
D055BEC428252B8900BC11A4 /* AudioDetailHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AudioDetailHeaderView.m; sourceTree = "<group>"; };
D055BEC628252D8200BC11A4 /* AudioCourseCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AudioCourseCell.h; sourceTree = "<group>"; };
D055BEC728252D8200BC11A4 /* AudioCourseCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AudioCourseCell.m; sourceTree = "<group>"; };
D055BEC928252E4000BC11A4 /* SubAudioModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SubAudioModel.h; sourceTree = "<group>"; };
D055BECA28252E4000BC11A4 /* SubAudioModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SubAudioModel.m; sourceTree = "<group>"; };
D062A09C281838B800B4F48A /* FeedbackRequestModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FeedbackRequestModel.h; sourceTree = "<group>"; };
D062A09D281838B800B4F48A /* FeedbackRequestModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedbackRequestModel.m; sourceTree = "<group>"; };
D062A09F28183FE000B4F48A /* FeedbackDetailController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FeedbackDetailController.h; sourceTree = "<group>"; };
......@@ -1022,10 +1037,18 @@
D0D69ED2282360F100A0D5EB /* LookAllController.m */,
D0D69ED428236E0800A0D5EB /* SafeSleepListController.h */,
D0D69ED528236E0800A0D5EB /* SafeSleepListController.m */,
D055BEC0282526B700BC11A4 /* CourseDetailController.h */,
D055BEC1282526B700BC11A4 /* CourseDetailController.m */,
D055BEB728250D3400BC11A4 /* CourseCollectionCell.h */,
D055BEB828250D3400BC11A4 /* CourseCollectionCell.m */,
D055BEBA28250E8F00BC11A4 /* CourseModel.h */,
D055BEBB28250E8F00BC11A4 /* CourseModel.m */,
D055BEC328252B8900BC11A4 /* AudioDetailHeaderView.h */,
D055BEC428252B8900BC11A4 /* AudioDetailHeaderView.m */,
D055BEC628252D8200BC11A4 /* AudioCourseCell.h */,
D055BEC728252D8200BC11A4 /* AudioCourseCell.m */,
D055BEC928252E4000BC11A4 /* SubAudioModel.h */,
D055BECA28252E4000BC11A4 /* SubAudioModel.m */,
);
path = Home;
sourceTree = "<group>";
......@@ -1164,6 +1187,8 @@
D0930F112801124E006B497A /* BaseNaviController.m */,
D04B3DA927F6EEB40022F8DF /* DSTabBarController.h */,
D04B3DAA27F6EEB40022F8DF /* DSTabBarController.m */,
D055BEBD2825267C00BC11A4 /* DSBaseViewController.h */,
D055BEBE2825267C00BC11A4 /* DSBaseViewController.m */,
);
path = Root;
sourceTree = "<group>";
......@@ -1414,6 +1439,7 @@
D0D69ED628236E0800A0D5EB /* SafeSleepListController.m in Sources */,
D09D0E9A280D507F008DEDAB /* ProfileAlertView.m in Sources */,
D0FAC41F281B817D00D4B859 /* UIScrollView+GKPhotoBrowser.m in Sources */,
D055BEC2282526B700BC11A4 /* CourseDetailController.m in Sources */,
D0AEFE79281781CF00230DC6 /* MyFeedModel.m in Sources */,
D0506B0C280503A800229278 /* UIButton+Extras.m in Sources */,
D0C50B3F27FD381000DC68F0 /* UIView+Extras.m in Sources */,
......@@ -1429,6 +1455,7 @@
D08F79E1281A1838000D99DD /* TZLocationManager.m in Sources */,
D04B3DBB27F6F7940022F8DF /* AISleepCoachController.m in Sources */,
D07A65832815911D00C15AF6 /* DsMaskView.m in Sources */,
D055BEBF2825267C00BC11A4 /* DSBaseViewController.m in Sources */,
D0FAC41C281B817D00D4B859 /* GKLoadingView.m in Sources */,
D0BE32E62814D42B006539BE /* HomeRequestModel.m in Sources */,
D0D3826728124E8A005BB219 /* FeedbackController.m in Sources */,
......@@ -1462,6 +1489,7 @@
D0F80907280431100097899F /* UILabel+Extras.m in Sources */,
D04B3DAC27F6EEB50022F8DF /* DSTabBarController.m in Sources */,
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */,
D055BEC828252D8200BC11A4 /* AudioCourseCell.m in Sources */,
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */,
D09BF331280E570D00E5F06C /* UserModel.m in Sources */,
D0C50B4F27FD832300DC68F0 /* LeadView.m in Sources */,
......@@ -1470,6 +1498,7 @@
D01814EB28002A8200583D4E /* DsMiddleView.m in Sources */,
D0C50B4227FD39C800DC68F0 /* UIViewController+FullScreenModal.m in Sources */,
D09BF337280E605900E5F06C /* NSObject+Extras.m in Sources */,
D055BEC528252B8900BC11A4 /* AudioDetailHeaderView.m in Sources */,
D07DACA72810557D0067A1BF /* UIApplication+RSKImageCropper.m in Sources */,
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */,
D0FAC421281B817D00D4B859 /* GKPhotoView.m in Sources */,
......@@ -1478,6 +1507,7 @@
D01814EE28002DC700583D4E /* HeaderDataModel.m in Sources */,
D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */,
D0DB33A828224D5100E15914 /* PromotionModel.m in Sources */,
D055BECB28252E4000BC11A4 /* SubAudioModel.m in Sources */,
D01814DC27FFD92200583D4E /* DSDataSource.m in Sources */,
D07DACA92810557D0067A1BF /* UIImage+RSKImageCropper.m in Sources */,
D0B5ECC827F2E97A003EDFE3 /* MacroFuncUtil.m in Sources */,
......
//
// AudioCourseCell.h
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 音频课程列表cell
@interface AudioCourseCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END
//
// AudioCourseCell.m
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import "AudioCourseCell.h"
@implementation AudioCourseCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
return self;
}
@end
//
// AudioDetailHeaderView.h
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import <UIKit/UIKit.h>
#import "CourseModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 音频详情播放列表页头部视图
@interface AudioDetailHeaderView : UIView
- (instancetype)initWithModel:(CourseModel *)model;
@end
NS_ASSUME_NONNULL_END
//
// AudioDetailHeaderView.m
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import "AudioDetailHeaderView.h"
@interface AudioDetailHeaderView ()
@property (nonatomic, strong) UIImageView *bgIV;
@property (nonatomic, strong) UIImageView *audioIV;
@property (nonatomic, strong) UILabel *audioNameLab;
@property (nonatomic, strong) UILabel *audioDescLab;
@property (nonatomic, strong) UIView *cornerView;
@end
@implementation AudioDetailHeaderView
- (instancetype)initWithModel:(CourseModel *)model {
if (self = [super initWithFrame:CGRectMake(0, 0, kScreenWidth, 250)]) {
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self debugViewShowBorder];
[self addSubview:self.bgIV];
[self addSubview:self.audioIV];
[self addSubview:self.audioNameLab];
[self addSubview:self.audioDescLab];
[self addSubview:self.cornerView];
[self.bgIV yy_setImageWithURL:[NSURL URLWithString:model.bg_url] placeholder:[UIImage imageNamed:@"bannerPlaceholder"]];
[self.audioIV yy_setImageWithURL:[NSURL URLWithString:model.audio_img] placeholder:[UIImage imageNamed:@"basicPlaceholder"]];
self.audioNameLab.text = model.audio_name;
self.audioDescLab.text = model.audio_desc;
[self.bgIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.audioIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(17);
make.top.equalTo(self).offset(105);
make.width.height.equalTo(@100);
}];
[self.audioNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.audioIV.mas_right).offset(30);
make.top.equalTo(self.audioIV);
}];
[self.audioDescLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.audioNameLab);
make.top.equalTo(self.audioNameLab.mas_bottom).offset(10);
}];
[self.cornerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.bottom.equalTo(self).offset(20);
make.height.equalTo(@35);
}];
}
return self;
}
- (void)updateHeadView:(CourseModel *)model {
}
#pragma mark - lazy
- (UIImageView *)bgIV {
if (!_bgIV) {
_bgIV = [UIImageView new];
_bgIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1.0, .3, .5);
}
return _bgIV;
}
- (UIImageView *)audioIV {
if (!_audioIV) {
_audioIV = [UIImageView new];
_audioIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1.0, .3, .5);
}
return _audioIV;
}
- (UILabel *)audioNameLab {
if (!_audioNameLab) {
_audioNameLab = [UILabel labWithFont:BoldFont(16.0)];
_audioNameLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, ColorFromHex(0xE8E9E9), DSWhite);
}
return _audioNameLab;
}
- (UILabel *)audioDescLab {
if (!_audioDescLab) {
_audioDescLab = [UILabel labWithFont:SysFont(14.0)];
_audioDescLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, ColorFromHex(0xCAC9CD), DSWhite);
}
return _audioDescLab;
}
- (UIView *)cornerView {
if (!_cornerView) {
_cornerView = [UIView new];
_cornerView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[_cornerView cornerRadius:24.0];
}
return _cornerView;
}
@end
//
// CourseDetailController.h
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import "DSBaseViewController.h"
#import "CourseModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 课程详情页(音频列表)
@interface CourseDetailController : DSBaseViewController
@property (nonatomic, strong) CourseModel *courseModel;
@end
NS_ASSUME_NONNULL_END
//
// CourseDetailController.m
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import "CourseDetailController.h"
#import "SafeSleepRequestModel.h"
#import "AudioDetailHeaderView.h"
#import "AudioCourseCell.h"
@interface CourseDetailController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *audioListView;
@property (nonatomic,strong) NSMutableArray *subAudioArr;
@property (nonatomic,strong) UIButton *unlockBtn;
@end
@implementation CourseDetailController
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addSubview:self.audioListView];
[self.view addSubview:self.dsNaviBar];
[self.view addSubview:self.dkBackBtn];
[self.view addSubview:self.unlockBtn];
[self.unlockBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.bottom.equalTo(self.view).offset(-52);
make.size.mas_equalTo(CGSizeMake(155, 40));
}];
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.titleLab.text = self.courseModel.audio_name;
[SafeSleepRequestModel queryRelaxMeditationAudiosWithTypeID:self.courseModel.course_id completion:^(SafeSleepRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
[self.subAudioArr addObjectsFromArray:requestModel.subAudioListData];
[self.audioListView reloadData];
}
}];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
[self.unlockBtn setTitle:[LoginUtils getUserLoginData] ? @"开始第一节" : @"登录解锁全部章节" forState:UIControlStateNormal];
}
#pragma mark - 设置状态栏文字颜色
- (UIStatusBarStyle)preferredStatusBarStyle {
return [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent;
}
#pragma mark - 关闭侧滑
- (BOOL)enableInteractivePopGestureRecognizer {
return NO;
}
- (void)backAction {
[super backAction];
[self.navigationController popViewControllerAnimated:YES];
}
- (void)unlockAction {
// 判断是否登录成功
if ([LoginUtils getUserLoginData]) {
} else {
// 跳转到登录页面
[LoginUtils jumpToLoginControllerWithTarget:self];
}
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.subAudioArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"AudioCourseCellID";
AudioCourseCell *cell = (AudioCourseCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[AudioCourseCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
// cell.delegate = self;
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// subAudioModel *model;
// if(self.subAudioArr.count > indexPath.row){
//
// model = [self.subAudioArr objectAtIndex:indexPath.row];
// cell.numberLb.text = [NSString stringWithFormat:@"%ld",indexPath.row + 1];
// cell.timeLb.text = model.play_time;
// cell.titleLb.text = model.audio_name;
// cell.titleLb.textColor = [UIColor colorWithHexString:@"#333333"];
// cell.playVedioImgV.hidden = YES;
// }
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 100;
}
- (void)scrollViewDidScroll:(UIScrollView*)scrollView {
CGFloat offset = scrollView.contentOffset.y;
if (offset >= kTopHeight(0)) {
self.dkBackBtn.hidden = YES;
self.titleLab.hidden = NO;
[self preferredStatusBarStyle];
} else if (offset == 0) {
self.dkBackBtn.hidden = NO;
}
self.dsNaviBar.alpha = offset/kTopHeight(0);
}
#pragma mark - lazy
- (NSMutableArray *)subAudioArr {
if(!_subAudioArr) {
_subAudioArr = [NSMutableArray array];
}
return _subAudioArr;
}
- (UITableView *)audioListView {
if (!_audioListView) {
_audioListView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
_audioListView.delegate = self;
_audioListView.dataSource = self;
_audioListView.bounces = NO;
[_audioListView debugViewShowBorder];
_audioListView.showsVerticalScrollIndicator = NO;
_audioListView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
_audioListView.separatorStyle = UITableViewCellSeparatorStyleNone;
_audioListView.tableHeaderView = [[AudioDetailHeaderView alloc] initWithModel:self.courseModel];
_audioListView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
return _audioListView;
}
- (UIButton *)unlockBtn {
if (!_unlockBtn) {
_unlockBtn = [UIButton btnWithTitle:@"" titleColor:DSWhite font:BoldFont(16) bgColor:BrandColor];
[_unlockBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside];
[_unlockBtn cornerRadius:20];
}
return _unlockBtn;
}
@end
......@@ -11,8 +11,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 舒眠课程和助眠音乐课程数据model
@interface CourseModel : NSObject
/// 课程id
@property (nonatomic, assign) int course_id;
// 名称
/// 名称
@property (nonatomic, copy) NSString *audio_name;
// 音频描述信息
@property (nonatomic, copy) NSString *audio_desc;
......
......@@ -14,12 +14,19 @@ NS_ASSUME_NONNULL_BEGIN
/// 舒眠课程和助眠音乐课程列表数据
@property (nonatomic, strong) NSArray *courseListData;
/// 音频列表数据
@property (nonatomic, strong) NSArray *subAudioListData;
/// 获取舒眠课程、助眠音乐列表数据
/// @param subID 6:舒眠课程,18:助眠音乐
/// @isHome isHome YES:主页横向列表数据,NO:查看所有列表数据
/// @isHome isHome YES:主页横向列表数据,NO:查看所有课程列表数据
/// @param completion SafeSleepRequestModel
+ (NSURLSessionDataTask *)getCourseListDataWithSubID:(int)subID isHome:(BOOL)isHome completion:(void (^)(SafeSleepRequestModel *requestModel))completion;
/// 冥想分类详情
/// @param type_id 课程ID
/// @param completion SafeSleepRequestModel
+ (NSURLSessionDataTask *)queryRelaxMeditationAudiosWithTypeID:(int)type_id completion:(void (^)(SafeSleepRequestModel *requestModel))completion;
@end
NS_ASSUME_NONNULL_END
......@@ -7,6 +7,7 @@
#import "SafeSleepRequestModel.h"
#import "CourseModel.h"
#import "SubAudioModel.h"
@implementation SafeSleepRequestModel
......@@ -32,4 +33,27 @@
}];
}
+ (NSURLSessionDataTask *)queryRelaxMeditationAudiosWithTypeID:(int)type_id completion:(void (^)(SafeSleepRequestModel *requestModel))completion {
NSString *api = @"query_relax_meditation_audios";
NSString *argStr = [NSString stringWithFormat:@"query{%@(type_id:%d)}", api, type_id];
SafeSleepRequestModel * requestModel = [[SafeSleepRequestModel alloc] init];
return [self httpPostBodyRequestWithAPI:api params:@{@"query" : argStr} view:nil hasNetActivity:YES loadingInfo:nil hasFailInfo:YES success:^(NSDictionary *apiDic) {
requestModel.resCode = DSResCodeSuccess;
DSLog(@"睡眠-放松训练-冥想分类详情数据接口dataDic:%@", apiDic);
NSDictionary *resultDic = apiDic[@"result"];
NSArray *sub_audios = resultDic[@"sub_audios"];
NSMutableArray *tmpArr = [NSMutableArray array];
for (NSDictionary *subAudioDic in sub_audios) {
SubAudioModel *model = [SubAudioModel yy_modelWithDictionary:subAudioDic];
[tmpArr addObject:model];
}
requestModel.subAudioListData = [tmpArr copy];
completion(requestModel);
} failure:^(id failure) {
requestModel.resCode = DSResCodeNetFail;
requestModel.errorInfo = failure;
completion(requestModel);
}];
}
@end
......@@ -9,6 +9,7 @@
#import "SafeSleepRequestModel.h"
#import "CourseCollectionCell.h"
#import "CourseModel.h"
#import "CourseDetailController.h"
@interface SafeSleepListController () <UICollectionViewDataSource, UICollectionViewDelegate>
@property (nonatomic, strong) UICollectionView *courseListView;
......@@ -89,10 +90,9 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
if (self.listArr.count > indexPath.row) {
CourseModel *model = [self.listArr objectAtIndex:indexPath.row];
// MusicCourseDetailVC *coureDetailVC = [[MusicCourseDetailVC alloc] init];
// coureDetailVC.typeId = model.identify;
// coureDetailVC.hidesBottomBarWhenPushed = YES;
// [self.navigationController pushViewController:coureDetailVC animated:YES];
CourseDetailController *coureDetailVC = [[CourseDetailController alloc] init];
coureDetailVC.courseModel = model;
[self.navigationController pushViewController:coureDetailVC animated:YES];
}
}
......
//
// SubAudioModel.h
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 音频数据model
@interface SubAudioModel : NSObject
// 类别id
@property (nonatomic,assign) int type_id;
// 音频id
@property (nonatomic,assign) int audio_id;
// 音频播放图片
@property (nonatomic,copy) NSString *audio_pic;
// 音频描述
@property (nonatomic,copy) NSString *audio_desc;
// 音频名称
@property (nonatomic,copy) NSString *audio_name;
// 音频播放url
@property (nonatomic,copy) NSString *audio_url;
// 播放时长
@property (nonatomic,copy) NSString *play_time;
// 加锁标记
@property (nonatomic,assign) int is_lock;
@end
NS_ASSUME_NONNULL_END
//
// SubAudioModel.m
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import "SubAudioModel.h"
@implementation SubAudioModel
+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper {
return @{@"audio_id" : @"id"};
}
@end
......@@ -12,6 +12,9 @@
+ (UserModel *)getUserLoginData {
UserModel *userModel = [NSKeyedUnarchiver unarchiveObjectWithData:kGetUserDefaultsObj(UserBasicInfo)];
DSLog(@"获取用户信息:%@", userModel.debugDescription);
return userModel;
}
......@@ -73,6 +76,8 @@
kUserDefaultsSynchronize;
// 发送更新用户数据显示UI通知
[[NSNotificationCenter defaultCenter] postNotificationName:HasUpdateUserDataNoti object:nil];
DSLog(@"保存用户信息:%@", model.debugDescription);
}
+ (void)clearUserLoginData {
......
//
// DSBaseViewController.h
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DSBaseViewController : UIViewController
/// 自定义导航栏
@property (nonatomic, strong) UIView *dsNaviBar;
/// 导航栏title
@property (nonatomic, strong) UILabel *titleLab;
/// 导航栏返回按钮
@property (nonatomic, strong) UIButton *cusBackBtn;
/// 白天/夜间模式导航栏返回按钮
@property (nonatomic, strong) UIButton *dkBackBtn;
/// 返回事件,由子类去实现
- (void)backAction;
@end
NS_ASSUME_NONNULL_END
//
// DSBaseViewController.m
// DreamSleep
//
// Created by peter on 2022/5/6.
//
#import "DSBaseViewController.h"
@interface DSBaseViewController ()
@end
@implementation DSBaseViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)backAction {
}
#pragma mark - lazy
- (UIView *)dsNaviBar {
if (!_dsNaviBar) {
_dsNaviBar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kTopHeight(0))];
_dsNaviBar.alpha = 0;
_dsNaviBar.backgroundColor = BrandColor;
[_dsNaviBar addSubview:self.titleLab];
[_dsNaviBar addSubview:self.cusBackBtn];
[_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.dsNaviBar);
make.bottom.equalTo(self.dsNaviBar).offset(-9);
}];
}
return _dsNaviBar;
}
- (UILabel *)titleLab {
if (!_titleLab) {
_titleLab = [UILabel labWithTextColor:DSWhite font:BoldFont(18)];
_titleLab.textAlignment = NSTextAlignmentCenter;
_titleLab.hidden = YES;
}
return _titleLab;
}
- (UIButton *)cusBackBtn {
if (!_cusBackBtn) {
_cusBackBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, 40, 40)];
[_cusBackBtn setImage:[UIImage imageNamed:@"sys_back_icon"] forState:UIControlStateNormal];
[_cusBackBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
}
return _cusBackBtn;
}
- (UIButton *)dkBackBtn {
if (!_dkBackBtn) {
_dkBackBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, 40, 40)];
[_dkBackBtn dk_setImage:DKImagePickerWithNames(@"cus_back_icon", @"dk_cus_back_icon", @"dk_cus_back_icon") forState:UIControlStateNormal];
[_dkBackBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
}
return _dkBackBtn;
}
@end
{
"images" : [
{
"filename" : "naviBack.png",
"filename" : "cus_back_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "naviBack@2x.png",
"filename" : "cus_back_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "naviBack@3x.png",
"filename" : "cus_back_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
{
"images" : [
{
"filename" : "dk_cus_back_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_cus_back_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_cus_back_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sys_back_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sys_back_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sys_back_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!