Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 59be051d
由
cgx
编写于
2022-07-11 17:06:07 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
整理项目
1 个父辈
29f857b2
全部展开
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
0 行增加
和
546 行删除
DreamSleep/DreamSleep/Class/AISleepModule/Controller/AISleepCoach.storyboard
DreamSleep/DreamSleep/Class/AISleepModule/Controller/AISleepCoachController.h
DreamSleep/DreamSleep/Class/AISleepModule/Controller/RelaxTrainController.h
DreamSleep/DreamSleep/Class/AISleepModule/Controller/RelaxTrainController.m
DreamSleep/DreamSleep/Class/AISleepModule/Model/RelaxTrainModel.h
DreamSleep/DreamSleep/Class/AISleepModule/Model/RelaxTrainModel.m
DreamSleep/DreamSleep/Class/AISleepModule/RequestModel/RelaxTrainRequestModel.h
DreamSleep/DreamSleep/Class/AISleepModule/RequestModel/RelaxTrainRequestModel.m
DreamSleep/DreamSleep/Class/AISleepModule/View/RelaxBodyView.h
DreamSleep/DreamSleep/Class/AISleepModule/View/RelaxBodyView.m
DreamSleep/DreamSleep/Class/AISleepModule/View/RelaxTrainCell.h
DreamSleep/DreamSleep/Class/AISleepModule/View/RelaxTrainCell.m
DreamSleep/DreamSleep/Class/AISleepModule/Controller/AISleepCoach.storyboard
deleted
100644 → 0
查看文件 @
29f857b
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"20037"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
initialViewController=
"JOD-MV-Pim"
>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"20020"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"System colors in document resources"
minToolsVersion=
"11.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<scenes>
<!--Sleep Coach Controller-->
<scene
sceneID=
"mSr-VG-EoP"
>
<objects>
<viewController
id=
"dDK-KA-sPQ"
customClass=
"AISleepCoachController"
sceneMemberID=
"viewController"
>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"1eu-Nn-5E0"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"896"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<viewLayoutGuide
key=
"safeArea"
id=
"Pf1-fh-l6V"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
</view>
<navigationItem
key=
"navigationItem"
id=
"05K-ik-z2W"
/>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"8JB-OR-j2U"
userLabel=
"First Responder"
customClass=
"UIResponder"
sceneMemberID=
"firstResponder"
/>
</objects>
<point
key=
"canvasLocation"
x=
"2786"
y=
"201"
/>
</scene>
<!--AI睡眠教练-->
<scene
sceneID=
"zZV-8x-0UY"
>
<objects>
<navigationController
automaticallyAdjustsScrollViewInsets=
"NO"
id=
"JOD-MV-Pim"
customClass=
"BaseNaviController"
sceneMemberID=
"viewController"
>
<tabBarItem
key=
"tabBarItem"
title=
"AI睡眠教练"
image=
"aisleep"
selectedImage=
"aisleep_selected"
id=
"Il3-d5-iMT"
/>
<toolbarItems/>
<navigationBar
key=
"navigationBar"
contentMode=
"scaleToFill"
id=
"IbM-gj-oZu"
>
<rect
key=
"frame"
x=
"0.0"
y=
"44"
width=
"414"
height=
"44"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
</navigationBar>
<nil
name=
"viewControllers"
/>
<connections>
<segue
destination=
"dDK-KA-sPQ"
kind=
"relationship"
relationship=
"rootViewController"
id=
"ACD-cx-BP7"
/>
</connections>
</navigationController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"hMf-jH-a0Q"
userLabel=
"First Responder"
customClass=
"UIResponder"
sceneMemberID=
"firstResponder"
/>
</objects>
<point
key=
"canvasLocation"
x=
"2021.7391304347827"
y=
"200.89285714285714"
/>
</scene>
</scenes>
<resources>
<image
name=
"aisleep"
width=
"25"
height=
"25"
/>
<image
name=
"aisleep_selected"
width=
"25"
height=
"25"
/>
<systemColor
name=
"systemBackgroundColor"
>
<color
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
</systemColor>
</resources>
</document>
DreamSleep/DreamSleep/Class/AISleepModule/Controller/AISleepCoachController.h
deleted
100644 → 0
查看文件 @
29f857b
//
// AISleepCoachController.h
// DreamSleep
//
// Created by peter on 2022/4/1.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
AISleepCoachController
:
UIViewController
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/Controller/RelaxTrainController.h
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxTrainController.h
// DreamSleep
//
// Created by peter on 2022/6/1.
//
#import "DSBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@protocol
RelaxTrainControllerDelegate
<
NSObject
>
/// 刷新AI睡眠教练页面
-
(
void
)
reloadAIPage
;
@end
/// 放松训练、腹式呼吸法页面
@interface
RelaxTrainController
:
DSBaseViewController
@property
(
nonatomic
,
weak
)
id
<
RelaxTrainControllerDelegate
>
refreshDelegate
;
/// title和step参数
@property
(
nonatomic
,
strong
)
NSDictionary
*
params
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/Controller/RelaxTrainController.m
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxTrainController.m
// DreamSleep
//
// Created by peter on 2022/6/1.
//
#import "RelaxTrainController.h"
#import "RelaxTrainRequestModel.h"
#import "RelaxBodyView.h"
@interface
RelaxTrainController
()
<
RelaxBodyViewDelegate
,
UIScrollViewDelegate
>
@property
(
nonatomic
,
strong
)
UIImageView
*
bgIV
;
@property
(
nonatomic
,
strong
)
UILabel
*
cusTitleLab
;
@property
(
nonatomic
,
strong
)
NSArray
*
listArr
;
@property
(
nonatomic
,
strong
)
UIScrollView
*
lucencyView
;
@property
(
nonatomic
,
strong
)
RelaxBodyView
*
bodyView
;
@end
@implementation
RelaxTrainController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
view
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
[
self
.
view
addSubview
:
self
.
bgIV
];
[
self
.
view
addSubview
:
self
.
lucencyView
];
[
self
.
lucencyView
addSubview
:
self
.
bodyView
];
[
self
.
view
addSubview
:
self
.
dsNaviBar
];
[
self
.
view
addSubview
:
self
.
dkBackBtn
];
[
self
.
dkBackBtn
dk_setImage
:
DKImagePickerWithNames
(
@"cus_back_icon"
,
@"cus_back_icon"
,
@"dk_cus_back_icon"
)
forState
:
UIControlStateNormal
];
[
self
.
view
addSubview
:
self
.
cusTitleLab
];
CGFloat
iv_h
=
kScreenWidth
*
1233
/
1125
.
0
;
[
self
.
bgIV
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
left
.
right
.
equalTo
(
self
.
view
);
make
.
height
.
equalTo
(
@
(
iv_h
));
}];
[
self
.
cusTitleLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
.
dsNaviBar
);
make
.
bottom
.
equalTo
(
self
.
dsNaviBar
).
offset
(
-
9
);
}];
[
self
.
lucencyView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
left
.
right
.
bottom
.
equalTo
(
self
.
view
);
}];
[
RelaxTrainRequestModel
queryRelaxAudioListWithCompletion
:
^
(
RelaxTrainRequestModel
*
_Nonnull
requestModel
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
if
(
requestModel
.
trainAudioList
.
count
)
{
self
.
listArr
=
requestModel
.
trainAudioList
;
if
(
self
.
listArr
&&
self
.
listArr
.
count
>
0
)
{
NSInteger
currentIndex
=
[
self
getIndexWithListData
:
self
.
listArr
];
[
self
.
bodyView
refreshData
:
self
.
listArr
currentIndex
:
currentIndex
];
}
}
}
}];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
NeedPauseAllNoise
object
:
nil
];
[
DataStatisticsUtil
event
:
RelaxTrain
attributes
:@{
@"data"
:
@"腹式放松法页面"
}];
}
#pragma mark - 根据title匹配下标索引
-
(
NSInteger
)
getIndexWithListData
:
(
NSArray
*
)
listData
{
__block
NSInteger
currentIndex
=
0
;
NSString
*
title
=
self
.
params
[
@"title"
];
// 放松音频随机选一个
if
([
title
isEqualToString
:
@"练习放松训练"
])
{
currentIndex
=
arc4random
()
%
listData
.
count
;
}
else
{
[
listData
enumerateObjectsUsingBlock
:
^
(
RelaxTrainModel
*
obj
,
NSUInteger
idx
,
BOOL
*
_Nonnull
stop
)
{
if
([
obj
.
audio_name
containsString
:
title
])
{
currentIndex
=
idx
;
*
stop
=
YES
;
}
}];
}
return
currentIndex
;
}
#pragma mark - Actions
-
(
void
)
backAction
{
[
super
backAction
];
[
self
.
bodyView
stopAudio
];
if
(
self
.
refreshDelegate
&&
[
self
.
refreshDelegate
respondsToSelector
:
@selector
(
reloadAIPage
)])
{
[
self
.
refreshDelegate
reloadAIPage
];
}
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
#pragma mark - RelaxBodyViewDelegate
-
(
void
)
updateNaviTitleAndBgImg
:
(
RelaxTrainModel
*
)
trainModel
{
[
self
.
bgIV
setImageWithURL
:[
NSURL
URLWithString
:
trainModel
.
bg_url
]
placeholderImage
:[
UIImage
imageNamed
:
@"basicPlaceholder"
]];
self
.
cusTitleLab
.
text
=
trainModel
.
audio_name
;
self
.
titleLab
.
text
=
trainModel
.
audio_name
;
}
#pragma mark - UIScrollViewDelegate
-
(
void
)
scrollViewDidScroll
:
(
UIScrollView
*
)
scrollView
{
CGFloat
offset
=
scrollView
.
contentOffset
.
y
;
if
(
offset
>=
self
.
lucencyView
.
contentSize
.
height
-
kScreenHeight
)
{
self
.
dkBackBtn
.
hidden
=
YES
;
self
.
dsNaviBar
.
alpha
=
1
;
self
.
titleLab
.
hidden
=
NO
;
self
.
cusTitleLab
.
hidden
=
YES
;
self
.
isNeedUpdateStatusBarStyle
=
YES
;
}
if
(
offset
<=
0
)
{
self
.
dkBackBtn
.
hidden
=
NO
;
self
.
dsNaviBar
.
alpha
=
0
;
self
.
titleLab
.
hidden
=
YES
;
self
.
cusTitleLab
.
hidden
=
NO
;
self
.
isNeedUpdateStatusBarStyle
=
NO
;
}
}
#pragma mark - lazy
-
(
UIImageView
*
)
bgIV
{
if
(
!
_bgIV
)
{
_bgIV
=
[
UIImageView
new
];
}
return
_bgIV
;
}
-
(
UILabel
*
)
cusTitleLab
{
if
(
!
_cusTitleLab
)
{
_cusTitleLab
=
[
UILabel
labWithTextColor
:
MainTextColor
font
:
BoldFont
(
18
)];
_cusTitleLab
.
textAlignment
=
NSTextAlignmentCenter
;
}
return
_cusTitleLab
;
}
-
(
NSArray
*
)
listArr
{
if
(
!
_listArr
)
{
_listArr
=
[
NSArray
array
];
}
return
_listArr
;
}
-
(
UIScrollView
*
)
lucencyView
{
if
(
!
_lucencyView
)
{
_lucencyView
=
[
UIScrollView
new
];
_lucencyView
.
showsVerticalScrollIndicator
=
NO
;
_lucencyView
.
delegate
=
self
;
CGFloat
bodyTopMargin
=
351
;
CGFloat
bodyH
=
420
+
Bottom_SafeArea_Height
;
_lucencyView
.
contentSize
=
CGSizeMake
(
kScreenWidth
,
bodyH
+
bodyTopMargin
);
_lucencyView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
}
return
_lucencyView
;
}
-
(
RelaxBodyView
*
)
bodyView
{
if
(
!
_bodyView
)
{
_bodyView
=
[[
RelaxBodyView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
351
,
kScreenWidth
,
420
+
Bottom_SafeArea_Height
)];
_bodyView
.
delegate
=
self
;
_bodyView
.
updateParams
=
self
.
params
;
}
return
_bodyView
;
}
#pragma mark - 设置状态栏文字颜色(重写父类)
-
(
UIStatusBarStyle
)
preferredStatusBarStyle
{
if
(
self
.
isNeedUpdateStatusBarStyle
)
{
return
UIStatusBarStyleLightContent
;
}
return
UIStatusBarStyleDefault
;
}
@end
DreamSleep/DreamSleep/Class/AISleepModule/Model/RelaxTrainModel.h
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxTrainModel.h
// DreamSleep
//
// Created by peter on 2022/6/2.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 放松训练数据model
@interface
RelaxTrainModel
:
NSObject
/// 音频id
@property
(
nonatomic
,
assign
)
int
audio_id
;
/// 播放背景图
@property
(
nonatomic
,
copy
)
NSString
*
bg_url
;
/// 音频封面
@property
(
nonatomic
,
copy
)
NSString
*
audio_img
;
/// 音频名称
@property
(
nonatomic
,
copy
)
NSString
*
audio_name
;
/// 音频播放链接
@property
(
nonatomic
,
copy
)
NSString
*
audio_url
;
/// 是否推荐(1:推荐,0:不推荐)
@property
(
nonatomic
,
copy
)
NSString
*
is_recommend
;
/// 描述信息
@property
(
nonatomic
,
copy
)
NSString
*
audio_desc
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/Model/RelaxTrainModel.m
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxTrainModel.m
// DreamSleep
//
// Created by peter on 2022/6/2.
//
#import "RelaxTrainModel.h"
@implementation
RelaxTrainModel
+
(
nullable
NSDictionary
<
NSString
*
,
id
>
*
)
modelCustomPropertyMapper
{
return
@{
@"audio_id"
:
@"id"
};
}
@end
DreamSleep/DreamSleep/Class/AISleepModule/RequestModel/RelaxTrainRequestModel.h
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxTrainRequestModel.h
// DreamSleep
//
// Created by peter on 2022/6/2.
//
#import "DSNetworkTool.h"
#import "RelaxTrainModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface
RelaxTrainRequestModel
:
DSNetworkTool
/// 训练音频列表
@property
(
nonatomic
,
strong
)
NSArray
*
trainAudioList
;
/// 获取放松音频列表数据
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
queryRelaxAudioListWithCompletion
:(
void
(
^
)(
RelaxTrainRequestModel
*
requestModel
))
completion
;
/// 睡眠-AI教练任务更新操作步骤接口
/// @param params @{@"title":xxx, @"step":xxx}
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
userCurTaskStateWithParams
:(
NSDictionary
*
)
params
completion
:(
void
(
^
)(
RelaxTrainRequestModel
*
requestModel
))
completion
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/RequestModel/RelaxTrainRequestModel.m
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxTrainRequestModel.m
// DreamSleep
//
// Created by peter on 2022/6/2.
//
#import "RelaxTrainRequestModel.h"
@implementation
RelaxTrainRequestModel
+
(
NSURLSessionDataTask
*
)
queryRelaxAudioListWithCompletion
:(
void
(
^
)(
RelaxTrainRequestModel
*
requestModel
))
completion
{
RelaxTrainRequestModel
*
requestModel
=
[[
RelaxTrainRequestModel
alloc
]
init
];
NSString
*
api
=
@"query_relax_audio_list"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"query{%@}"
,
api
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
YES
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"获取放松音频列表数据接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
NSArray
*
resultArr
=
apiDic
[
@"result"
];
NSMutableArray
*
tmpArr
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
audioDic
in
resultArr
)
{
RelaxTrainModel
*
trainModel
=
[
RelaxTrainModel
yy_modelWithDictionary
:
audioDic
];
[
tmpArr
addObject
:
trainModel
];
}
requestModel
.
trainAudioList
=
[
tmpArr
copy
];
completion
(
requestModel
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
requestModel
.
errMessage
=
failureInfo
[
@"errMessage"
];
completion
(
requestModel
);
}];
}
+
(
NSURLSessionDataTask
*
)
userCurTaskStateWithParams
:(
NSDictionary
*
)
params
completion
:(
void
(
^
)(
RelaxTrainRequestModel
*
requestModel
))
completion
{
RelaxTrainRequestModel
*
requestModel
=
[[
RelaxTrainRequestModel
alloc
]
init
];
NSString
*
api
=
@"user_cur_task_state"
;
NSString
*
title
=
params
[
@"title"
];
int
step
=
[
params
[
@"step"
]
intValue
];
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"mutation{%@(title:
\"
%@
\"
,step:%d)}"
,
api
,
title
,
step
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
YES
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"睡眠-AI教练任务更新操作步骤接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
completion
(
requestModel
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
requestModel
.
errMessage
=
failureInfo
[
@"errMessage"
];
completion
(
requestModel
);
}];
}
@end
DreamSleep/DreamSleep/Class/AISleepModule/View/RelaxBodyView.h
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxBodyView.h
// DreamSleep
//
// Created by peter on 2022/6/6.
//
#import <UIKit/UIKit.h>
#import "RelaxTrainModel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol
RelaxBodyViewDelegate
<
NSObject
>
-
(
void
)
updateNaviTitleAndBgImg
:
(
RelaxTrainModel
*
)
trainModel
;
@end
/// 放松body主视图
@interface
RelaxBodyView
:
UIView
@property
(
nonatomic
,
weak
)
id
<
RelaxBodyViewDelegate
>
delegate
;
-
(
void
)
refreshData
:(
NSArray
*
)
listArr
currentIndex
:(
NSInteger
)
index
;
/// title和step参数
@property
(
nonatomic
,
strong
)
NSDictionary
*
updateParams
;
/// 页面退出时停止音频播放
-
(
void
)
stopAudio
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/View/RelaxBodyView.m
deleted
100644 → 0
查看文件 @
29f857b
此文件的差异被折叠,
点击展开。
DreamSleep/DreamSleep/Class/AISleepModule/View/RelaxTrainCell.h
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxTrainCell.h
// DreamSleep
//
// Created by peter on 2022/6/6.
//
#import <UIKit/UIKit.h>
#import "RelaxTrainModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 放松训练音频cell
@interface
RelaxTrainCell
:
UICollectionViewCell
-
(
void
)
updateRelaxCell
:(
RelaxTrainModel
*
)
trainModel
isShowPlayIcon
:(
BOOL
)
isShowPlayIcon
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/View/RelaxTrainCell.m
deleted
100644 → 0
查看文件 @
29f857b
//
// RelaxTrainCell.m
// DreamSleep
//
// Created by peter on 2022/6/6.
//
#import "RelaxTrainCell.h"
@interface
RelaxTrainCell
()
// 主圆角图片
@property
(
nonatomic
,
strong
)
UIImageView
*
homeIV
;
// 音频名标签
@property
(
nonatomic
,
strong
)
UILabel
*
audioNameLab
;
@property
(
nonatomic
,
strong
)
UIImageView
*
recIcon
;
@property
(
nonatomic
,
strong
)
UILabel
*
recLab
;
@property
(
nonatomic
,
strong
)
UIImageView
*
playIcon
;
@end
@implementation
RelaxTrainCell
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
[
self
.
contentView
addSubview
:
self
.
homeIV
];
[
self
.
contentView
addSubview
:
self
.
audioNameLab
];
[
self
.
contentView
addSubview
:
self
.
recIcon
];
[
self
.
contentView
addSubview
:
self
.
recLab
];
[
self
.
contentView
addSubview
:
self
.
playIcon
];
[
self
.
homeIV
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
contentView
);
make
.
left
.
equalTo
(
self
.
contentView
);
make
.
width
.
height
.
equalTo
(
@
(
120
));
}];
[
self
.
audioNameLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
homeIV
);
make
.
top
.
equalTo
(
self
.
homeIV
.
mas_bottom
).
offset
(
8
);
}];
[
self
.
recIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
homeIV
);
make
.
left
.
equalTo
(
self
.
homeIV
).
offset
(
11
);
}];
[
self
.
recLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
top
.
right
.
equalTo
(
self
.
recIcon
);
}];
[
self
.
playIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
center
.
equalTo
(
self
.
homeIV
);
}];
}
return
self
;
}
-
(
void
)
updateRelaxCell
:(
RelaxTrainModel
*
)
trainModel
isShowPlayIcon
:(
BOOL
)
isShowPlayIcon
{
[
self
.
homeIV
yy_setImageWithURL
:[
NSURL
URLWithString
:
trainModel
.
bg_url
]
placeholder
:[
UIImage
imageNamed
:
@"basicPlaceholder"
]];
self
.
audioNameLab
.
text
=
trainModel
.
audio_name
;
self
.
recIcon
.
hidden
=
[
trainModel
.
is_recommend
isEqualToString
:
@"0"
];
self
.
recLab
.
hidden
=
[
trainModel
.
is_recommend
isEqualToString
:
@"0"
];
self
.
playIcon
.
hidden
=
!
isShowPlayIcon
;
}
#pragma mark - lazy
-
(
UIImageView
*
)
homeIV
{
if
(
!
_homeIV
)
{
_homeIV
=
[
UIImageView
new
];
_homeIV
.
contentMode
=
UIViewContentModeScaleAspectFill
;
[
_homeIV
cornerRadius
:
12
.
0
];
_homeIV
.
dk_alphaPicker
=
DKAlphaPickerWithAlphas
(
1
.
0
,
.
5
,
.
5
);
}
return
_homeIV
;
}
-
(
UILabel
*
)
audioNameLab
{
if
(
!
_audioNameLab
)
{
_audioNameLab
=
[
UILabel
labWithFont
:
SysFont
(
15
)];
_audioNameLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
DkTitleColor
,
DSWhite
);
}
return
_audioNameLab
;
}
-
(
UIImageView
*
)
recIcon
{
if
(
!
_recIcon
)
{
_recIcon
=
[[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"relax_rec_icon"
]];
}
return
_recIcon
;
}
-
(
UILabel
*
)
recLab
{
if
(
!
_recLab
)
{
_recLab
=
[
UILabel
labWithText
:
@"优选"
textColor
:
DSWhite
font
:
SysFont
(
12
.
0
)];
_recLab
.
textAlignment
=
NSTextAlignmentCenter
;
}
return
_recLab
;
}
-
(
UIImageView
*
)
playIcon
{
if
(
!
_playIcon
)
{
_playIcon
=
[[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"relax_play_show"
]];
}
return
_playIcon
;
}
@end
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论