Commit ade066ff cgx

完成睡眠故事模块

1 个父辈 f06178b8
正在显示 42 个修改的文件 包含 471 行增加20 行删除
......@@ -113,6 +113,9 @@
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 */; };
D0622434290793A900E1C89E /* SleepStoryHomeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0622433290793A900E1C89E /* SleepStoryHomeModel.m */; };
D06224372907C92000E1C89E /* UIColor+Extra.m in Sources */ = {isa = PBXBuildFile; fileRef = D06224362907C92000E1C89E /* UIColor+Extra.m */; };
D062243D2907D3D400E1C89E /* RelaxBubbleView.m in Sources */ = {isa = PBXBuildFile; fileRef = D062243C2907D3D400E1C89E /* RelaxBubbleView.m */; };
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A09D281838B800B4F48A /* FeedbackRequestModel.m */; };
D062A0A128183FE000B4F48A /* FeedbackDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A0A028183FE000B4F48A /* FeedbackDetailController.m */; };
D06381A428D012420074515B /* SleepStoryController.m in Sources */ = {isa = PBXBuildFile; fileRef = D06381A328D012420074515B /* SleepStoryController.m */; };
......@@ -534,6 +537,12 @@
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>"; };
D0622432290793A900E1C89E /* SleepStoryHomeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SleepStoryHomeModel.h; sourceTree = "<group>"; };
D0622433290793A900E1C89E /* SleepStoryHomeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SleepStoryHomeModel.m; sourceTree = "<group>"; };
D06224352907C92000E1C89E /* UIColor+Extra.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIColor+Extra.h"; sourceTree = "<group>"; };
D06224362907C92000E1C89E /* UIColor+Extra.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Extra.m"; sourceTree = "<group>"; };
D062243B2907D3D400E1C89E /* RelaxBubbleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RelaxBubbleView.h; sourceTree = "<group>"; };
D062243C2907D3D400E1C89E /* RelaxBubbleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RelaxBubbleView.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>"; };
......@@ -1254,6 +1263,8 @@
isa = PBXGroup;
children = (
D0930F142801874B006B497A /* DSNavigationTools */,
D06224352907C92000E1C89E /* UIColor+Extra.h */,
D06224362907C92000E1C89E /* UIColor+Extra.m */,
D0C50B3D27FD381000DC68F0 /* UIView+Extras.h */,
D0C50B3E27FD381000DC68F0 /* UIView+Extras.m */,
D027EE2E27FB52DA004BBA61 /* UIImage+Extras.h */,
......@@ -1620,6 +1631,8 @@
D0CCB09C2902A2E800B81141 /* StoryPlayController.m */,
D077AF6429066D1100F41394 /* PlayerManger.h */,
D077AF6529066D1100F41394 /* PlayerManger.m */,
D0622432290793A900E1C89E /* SleepStoryHomeModel.h */,
D0622433290793A900E1C89E /* SleepStoryHomeModel.m */,
);
path = SleepStory;
sourceTree = "<group>";
......@@ -2327,6 +2340,8 @@
D0A72E38282B566200EED7BE /* HomeBasicCell.m */,
D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */,
D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */,
D062243B2907D3D400E1C89E /* RelaxBubbleView.h */,
D062243C2907D3D400E1C89E /* RelaxBubbleView.m */,
D0506B1628054ECD00229278 /* SafeHelperCollectionView.h */,
D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */,
D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */,
......@@ -2823,6 +2838,7 @@
D0D4107C2844B8DB00009638 /* DailyTaskController.m in Sources */,
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */,
D0D96FE52848698F00461839 /* SomeProxy.m in Sources */,
D0622434290793A900E1C89E /* SleepStoryHomeModel.m in Sources */,
D0BDDFFC28618123006558D4 /* DisableAllTextView.m in Sources */,
D091BBB72808F9DA00487A50 /* BreathTextView.m in Sources */,
D04B3DBB27F6F7940022F8DF /* AISleepCoachController.m in Sources */,
......@@ -2874,6 +2890,7 @@
D091E671283F2E6F00D3279E /* ScoreDetailListController.m in Sources */,
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D070A78828DEED640039C5A7 /* DynamicController.m in Sources */,
D06224372907C92000E1C89E /* UIColor+Extra.m in Sources */,
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */,
D0A3BB9228D95A2B00F58781 /* CommunityView.m in Sources */,
D02D082D287BD05D005C3A00 /* ReadyListController.m in Sources */,
......@@ -2995,6 +3012,7 @@
D0A72E3F282B89AD00EED7BE /* DSHomeView.m in Sources */,
D01814E8280020F900583D4E /* CWPageControl.m in Sources */,
D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */,
D062243D2907D3D400E1C89E /* RelaxBubbleView.m in Sources */,
D030796F28E3E32A00ED96BF /* LikeButton.m in Sources */,
D037C49A284F4F0D000F3089 /* DailyTaskCell.m in Sources */,
D043DD55285B11860043A4CE /* VersionUpdateBox.m in Sources */,
......
//
// UIColor+Extra.h
// DreamSleep
//
// Created by peter on 2022/10/25.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIColor (Extra)
/**
* @biref 十六进制颜色值转UIColor
* @param hexStr 十六进制字符(#3C3C3C或者3C3C3C)
* @return UIColor
*/
+ (UIColor *)colorWithHexStr:(NSString *)hexStr;
/**
* @biref 十六进制颜色值转UIColor
* @param hexStr 十六进制字符(#3C3C3C或者3C3C3C)
* @param alpha alpha
* @return UIColor
*/
+ (UIColor *)colorWithHexStr:(NSString *)hexStr alpha:(CGFloat)alpha;
@end
NS_ASSUME_NONNULL_END
//
// UIColor+Extra.m
// DreamSleep
//
// Created by peter on 2022/10/25.
//
#import "UIColor+Extra.h"
@implementation UIColor (Extra)
+ (UIColor *)colorWithHexStr:(NSString *)hexStr
{
return [self colorWithHexStr:hexStr alpha:1.0];
}
+ (UIColor *)colorWithHexStr:(NSString *)hexStr alpha:(CGFloat)alpha
{
NSString *cString = [[hexStr stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
if ([cString hasPrefix:@"#"]) {
cString = [cString substringFromIndex:1];
}
if ([cString length] != 6) {
return UIColor.whiteColor;
}
NSRange range;
range.location = 0;
range.length = 2;
NSString *rString = [cString substringWithRange:range];
range.location = 2;
NSString *gString = [cString substringWithRange:range];
range.location = 4;
NSString *bString = [cString substringWithRange:range];
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
return [UIColor colorWithRed:((float) r / 255.0f)
green:((float) g / 255.0f)
blue:((float) b / 255.0f)
alpha:alpha];
}
@end
......@@ -20,6 +20,7 @@
#import <YYModel/YYModel.h>
#import <YYWebImage/YYWebImage.h>
#import "UIColor+Extra.h"
#import "UIView+Extras.h"
#import "UILabel+Extras.h"
#import "UIButton+Extras.h"
......
......@@ -12,21 +12,30 @@ NS_ASSUME_NONNULL_BEGIN
/// 音频数据model
@interface SubAudioModel : NSObject
// 类别id
@property (nonatomic,assign) int type_id;
@property (nonatomic, assign) int type_id;
// 音频id
@property (nonatomic,assign) int audio_id;
@property (nonatomic, assign) int audio_id;
// 音频播放图片
@property (nonatomic,copy) NSString *audio_pic;
@property (nonatomic, copy) NSString *audio_pic;
// 音频描述
@property (nonatomic,copy) NSString *audio_desc;
@property (nonatomic, copy) NSString *audio_desc;
// 音频名称
@property (nonatomic,copy) NSString *audio_name;
@property (nonatomic, copy) NSString *audio_name;
// 音频播放url
@property (nonatomic,copy) NSString *audio_url;
@property (nonatomic, copy) NSString *audio_url;
// 播放时长
@property (nonatomic,copy) NSString *play_time;
@property (nonatomic, copy) NSString *play_time;
// 加锁标记
@property (nonatomic,assign) int is_lock;
@property (nonatomic, assign) int is_lock;
// 音频封面图
@property (nonatomic, copy) NSString *audio_img;
// 睡眠故事音频播放次数
@property (nonatomic, assign) int play_count;
// 颜色值
@property (nonatomic, copy) NSString *day_bg_color;
@property (nonatomic, copy) NSString *night_bg_color;
@property (nonatomic, copy) NSString *day_title_color;
@property (nonatomic, copy) NSString *night_title_color;
@end
NS_ASSUME_NONNULL_END
......@@ -6,6 +6,7 @@
//
#import "DSNetworkTool.h"
#import "SleepStoryHomeModel.h"
NS_ASSUME_NONNULL_BEGIN
......@@ -27,10 +28,14 @@ NS_ASSUME_NONNULL_BEGIN
/// @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;
/// 获取首页睡眠故事数据
/// @param completion completion
+ (NSURLSessionDataTask *)querySleepAudioStoryWithCompletion:(void (^)(SafeSleepRequestModel *requestModel, SleepStoryHomeModel * sshModel))completion;
@end
NS_ASSUME_NONNULL_END
......@@ -71,4 +71,21 @@
}];
}
+ (NSURLSessionDataTask *)querySleepAudioStoryWithCompletion:(void (^)(SafeSleepRequestModel *requestModel, SleepStoryHomeModel * sshModel))completion {
NSString *api = @"query_sleep_audio_story";
NSString *argStr = [NSString stringWithFormat:@"query{%@}", api];
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"];
SleepStoryHomeModel *homeStoryModel = [SleepStoryHomeModel yy_modelWithDictionary:resultDic];
completion(requestModel, homeStoryModel);
} failure:^(id failureInfo) {
requestModel.resCode = [failureInfo[@"errorCode"] integerValue];
requestModel.errMessage = failureInfo[@"errMessage"];
completion(requestModel, nil);
}];
}
@end
......@@ -30,6 +30,8 @@
@property (nonatomic, strong) NSArray *helpListData;
/// 所有白噪音类型数据
@property (nonatomic, strong) NSArray *noiseTypeArr;
/// 首页睡眠故事数据
@property (nonatomic, strong) SleepStoryHomeModel *sshModel;
/// APP更新弹框
@property (nonatomic, strong) VersionUpdateBox *updateBox;
@property (nonatomic, assign) int update_Way;
......@@ -116,7 +118,6 @@
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, queue, ^{
// 获取首页banner数据
[HomeRequestModel queryBannerListWithCompletion:^(HomeRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
DSLog(@"获取首页banner数据成功...");
......@@ -128,7 +129,6 @@
}];
});
dispatch_group_async(group, queue, ^{
// 获取首页舒眠课程数据
[SafeSleepRequestModel getCourseListDataWithSubID:6 isHome:YES completion:^(SafeSleepRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
DSLog(@"获取首页舒眠课程数据成功...");
......@@ -140,7 +140,6 @@
}];
});
dispatch_group_async(group, queue, ^{
// 获取首页助眠音乐数据
[SafeSleepRequestModel getCourseListDataWithSubID:18 isHome:YES completion:^(SafeSleepRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
DSLog(@"获取首页助眠音乐数据成功...");
......@@ -152,7 +151,6 @@
}];
});
dispatch_group_async(group, queue, ^{
// 获取白噪音类型请求
[WhiteNoiseRequestModel queryRelaxWhiteNoiseTypeWithCompletion:^(WhiteNoiseRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
DSLog(@"获取白噪音类型请求成功...");
......@@ -163,9 +161,21 @@
}
}];
});
dispatch_group_async(group, queue, ^{
[SafeSleepRequestModel querySleepAudioStoryWithCompletion:^(SafeSleepRequestModel * _Nonnull requestModel, SleepStoryHomeModel * _Nonnull sshModel) {
if (requestModel.resCode == DSResCodeSuccess) {
DSLog(@"获取首页睡眠故事数据请求成功...");
dispatch_semaphore_signal(semaphore);
self.sshModel = sshModel;
} else {
[self.homeTV.mj_header endRefreshing];
}
}];
});
dispatch_group_notify(group, queue, ^{
// 四个请求对应四次信号等待
// 5个请求对应5次信号等待
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
......@@ -180,6 +190,7 @@
[self.homeTV updateCourseMusicCell:CellTypeCourse data:self.safeListData];
[self.homeTV updateCourseMusicCell:CellTypeMusic data:self.helpListData];
[self.homeTV updateNoiseAllTypeData:self.noiseTypeArr];
[self.homeTV updateSleepStoryView:self.sshModel];
// 重置白噪音播放
[[NoisePlayerManager sharedNoisePlayerManager] removeAllNoisePlayItem];
......
......@@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 更新白噪音类型数据
/// @param typeDataArr typeDataArr
- (void)updateNoiseAllTypeData:(NSArray *)typeDataArr;
/// 更新首页睡眠故事view
- (void)updateSleepStoryView:(id)model;
@end
NS_ASSUME_NONNULL_END
......@@ -58,6 +58,10 @@
}
}
- (void)updateSleepStoryView:(id)model {
[self.headerView updateStory:model];
}
#pragma mark - UITableViewDelegate && UITableViewDataSource
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
NSString *cellID = [NSString stringWithFormat:@"CourseMusicCell_%zd", indexPath.row];
......@@ -101,9 +105,10 @@
CGFloat bannerH = 2*(kScreenWidth - 48)/5.0;
// 哄睡按钮宽度
CGFloat width = kScreenWidth - 2*15 - 12;
CGFloat coaxH = 170*.3*width/104.0;
// 睡前故事区域高度
CGFloat sleepStoryH = 64;
CGFloat height = 15 + bannerH + 24 + (170*.3*width/104.0) + sleepStoryH;
CGFloat sleepStoryH = 185;
CGFloat height = 15 + bannerH + 24 + coaxH + 26 + sleepStoryH;
_headerView = [[HomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)];
_headerView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
}
......
......@@ -25,10 +25,9 @@
CGFloat width = kScreenWidth - 2*15 - 12;
[self.coaxIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self);
make.top.bottom.equalTo(self);
make.leftMargin.equalTo(self).offset(15);
make.width.equalTo(@(.3*width));
make.height.equalTo(@(170*.3*width/104.0));
}];
[self.mbsrIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.coaxIV);
......@@ -48,7 +47,6 @@
make.top.bottom.equalTo(self.balanceIV);
make.left.equalTo(self.balanceIV.mas_right).offset(13);
}];
self.height = self.coaxIV.height;
}
- (instancetype)initWithFrame:(CGRect)frame {
......
......@@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)controllerWillAppear;
- (void)controllerWillDisAppear;
- (void)updateStory:(id)model;
@end
NS_ASSUME_NONNULL_END
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface RelaxBubbleView : UIView
// 加载网络图片地址
@property (nonatomic, strong) NSArray * dataArr_net;
@end
NS_ASSUME_NONNULL_END
#import "RelaxBubbleView.h"
#define MaxHeadCount 6
#define kHeadWidth 18
#define kOverlapOffset 4
#define kRightMargin 0
@interface RelaxBubbleView ()
@property (nonatomic, strong) UIImageView * activeImg;
@property (nonatomic, strong) NSMutableArray * dataImgArr_net;
@property (nonatomic, assign) int jsh_index;
@property (nonatomic, assign) int jsh_img;
@property (nonatomic, assign) int overlapSpace;
@end
@implementation RelaxBubbleView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.backgroundColor = DSClearColor;
self.overlapSpace = kHeadWidth - kOverlapOffset;
self.dataImgArr_net = [NSMutableArray array];
self.userInteractionEnabled = NO;
[self createUI];
}
return self;
}
- (void)createUI {
for (int i = 0; i < MaxHeadCount; i++) {
UIImageView * imgv = [[UIImageView alloc] initWithFrame:CGRectMake(self.width - kRightMargin - kHeadWidth - self.overlapSpace*i, 0, kHeadWidth, kHeadWidth)];
imgv.tag = 10 + i;
imgv.centerY = self.centerY;
[imgv cornerRadius:kHeadWidth/2];
imgv.layer.dk_borderColorPicker = DKColorPickerWithColors(DSWhite, ColorFromHex(0x263154), DSWhite);
imgv.layer.borderWidth = 1;
imgv.backgroundColor = [UIColor lightGrayColor];
[self addSubview:imgv];
if (i == 0) {
self.jsh_index = 0;
self.activeImg = imgv;
}
}
}
- (void)setDataArr_net:(NSArray *)dataArr_net {
if (_dataArr_net != dataArr_net) {
_dataArr_net = dataArr_net;
}
[self checkData_net];
}
- (void)checkData_net {
WS(weakSelf);
[self.layer removeAllAnimations];
[self.dataImgArr_net removeAllObjects];
if (_dataArr_net.count < MaxHeadCount) {
[DSProgressHUD showToast:[NSString stringWithFormat:@"传入图片个数不能少于%d个", MaxHeadCount]];
return;
}
int __block jsh_dataImg = 0;
for (int i = 0; i < _dataArr_net.count; i++) {
UIImageView *dataImgV = [[UIImageView alloc] init];
NSDictionary *face_img_dic = _dataArr_net[i];
[dataImgV yy_setImageWithURL:[NSURL URLWithString:face_img_dic[@"face_img"]] placeholder:nil options:YYWebImageOptionRefreshImageCache completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
jsh_dataImg = jsh_dataImg + 1;
if (jsh_dataImg == weakSelf.dataImgArr_net.count) {
for (int i = 0; i < MaxHeadCount; i++) {
UIImageView * imgv = [weakSelf viewWithTag:10+i];
UIImageView * dataImgV_net = weakSelf.dataImgArr_net[i];
imgv.image = dataImgV_net.image;
}
self.jsh_img = MaxHeadCount - 1;
[self startAnimation_net];
}
}];
[self.dataImgArr_net addObject:dataImgV];
}
}
- (void)startAnimation_net {
WS(weakSelf);
[UIView animateWithDuration:1 animations:^{
NSInteger activeTag = weakSelf.activeImg.tag;
for (int i = 0; i < MaxHeadCount; i++) {
NSInteger aTag = 10+i;
if (aTag != activeTag) {
UIImageView * imgg = [weakSelf viewWithTag:10+i];
imgg.centerX = imgg.centerX + self.overlapSpace;
}
}
} completion:^(BOOL finished) {
weakSelf.activeImg.centerX = kHeadWidth / 2.0;
weakSelf.activeImg.transform = CGAffineTransformScale(weakSelf.activeImg.transform, 0.1, 0.1);
if (weakSelf.jsh_img < weakSelf.dataArr_net.count - 1) {
weakSelf.jsh_img = weakSelf.jsh_img + 1;
} else {
weakSelf.jsh_img = 0;
}
UIImageView * dataImg_net = weakSelf.dataImgArr_net[weakSelf.jsh_img];
weakSelf.activeImg.image = dataImg_net.image;
[UIView animateWithDuration:1 animations:^{
weakSelf.activeImg.transform = CGAffineTransformScale(weakSelf.activeImg.transform, 10, 10);
} completion:^(BOOL finished) {
[weakSelf bringSubviewToFront:weakSelf.activeImg];
[UIView animateWithDuration:1 animations:^{
weakSelf.activeImg.x = self.width - kRightMargin - kHeadWidth - self.overlapSpace * (MaxHeadCount - 1);
} completion:^(BOOL finished) {
weakSelf.jsh_index = weakSelf.jsh_index + 1;
if (weakSelf.jsh_index > (MaxHeadCount - 1)) {
weakSelf.jsh_index = 0;
}
weakSelf.activeImg = [weakSelf viewWithTag:10+weakSelf.jsh_index];
[weakSelf startAnimation_net];
}];
}];
}];
}
@end
......@@ -62,7 +62,7 @@
- (void)setStoryModel:(SubAudioModel *)storyModel {
_storyModel = storyModel;
[self.audioIV yy_setImageWithURL:[NSURL URLWithString:storyModel.audio_pic] placeholder:[UIImage defaultPlaceholderWithSize:CGSizeMake(76, 90)]];
[self.audioIV yy_setImageWithURL:[NSURL URLWithString:storyModel.audio_img] placeholder:[UIImage defaultPlaceholderWithSize:CGSizeMake(76, 90)]];
self.audioLab.text = storyModel.audio_name;
self.audioDescLab.text = storyModel.audio_desc;
self.playTimeLab.text = storyModel.play_time;
......@@ -74,6 +74,7 @@
_audioIV = [UIImageView new];
_audioIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1, .5, 1);
_audioIV.contentMode = UIViewContentModeScaleAspectFit;
[_audioIV cornerRadius:12];
}
return _audioIV;
}
......
//
// SleepStoryHomeModel.h
// DreamSleep
//
// Created by peter on 2022/10/25.
//
#import <Foundation/Foundation.h>
#import "SubAudioModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 首页睡眠故事数据model
@interface SleepStoryHomeModel : NSObject
@property (nonatomic, strong) SubAudioModel *audio;
@property (nonatomic, strong) NSArray *user_imgs;
@end
NS_ASSUME_NONNULL_END
//
// SleepStoryHomeModel.m
// DreamSleep
//
// Created by peter on 2022/10/25.
//
#import "SleepStoryHomeModel.h"
@implementation SleepStoryHomeModel
@end
{
"images" : [
{
"filename" : "dk_ic_home_shuiqiangushi.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_ic_home_shuiqiangushi@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_ic_home_shuiqiangushi@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "dk_ic_touxiang.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_ic_touxiang@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_ic_touxiang@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "dk_sleep_story_home_time.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_sleep_story_home_time@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_sleep_story_home_time@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_home_shuiqiangushi.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_home_shuiqiangushi@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_home_shuiqiangushi@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_touxiang.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_touxiang@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_touxiang@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "sleep_story_home_time.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "sleep_story_home_time@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "sleep_story_home_time@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!