Commit 8d8999a5 cgx

安睡准备新增建议文案提示

1 个父辈 26389133
......@@ -56,6 +56,7 @@
if (requestModel.resCode == DSResCodeSuccess) {
self.adjustedItems = requestModel.relax_items;
[self.startReadyView updateAdjustView:self.adjustedItems];
[self.startReadyView updateAdviceMessage:requestModel.advice_message];
}
}];
}
......@@ -172,6 +173,7 @@
if (!_tipsBtn) {
WS(weakSelf);
_tipsBtn = [UIButton new];
_tipsBtn.showsTouchWhenHighlighted = YES;
[_tipsBtn dk_setImage:DKImagePickerWithNames(@"ic_zhunbei_zhushi", @"dk_ic_zhunbei_zhushi", @"ic_zhunbei_zhushi") forState:UIControlStateNormal];
[_tipsBtn addTouchUpInsideHandler:^(NSInteger tag) {
[weakSelf.sRTipsView showTipsAlertView];
......@@ -184,6 +186,7 @@
if (!_setBtn) {
WS(weakSelf);
_setBtn = [UIButton new];
_setBtn.showsTouchWhenHighlighted = YES;
[_setBtn dk_setImage:DKImagePickerWithNames(@"ic_zhunbei_set", @"dk_ic_zhunbei_set", @"ic_zhunbei_set") forState:UIControlStateNormal];
[_setBtn addTouchUpInsideHandler:^(NSInteger tag) {
ReadyListController *setListVC = [[ReadyListController alloc] initWithDelegate:weakSelf];
......
......@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface SleepReadyRequestModel : DSNetworkTool
/// 放松准备顶部背景图
@property (nonatomic, copy) NSString *relax_bg;
/// 建议
@property (nonatomic, copy) NSString *advice_message;
/// 任务总时长
@property (nonatomic, assign) int relax_time;
/// 睡前规划任务项数据
......
......@@ -19,6 +19,7 @@
requestModel.resCode = DSResCodeSuccess;
NSDictionary *resultDic = apiDic[@"result"];
requestModel.relax_bg = resultDic[@"relax_bg"];
requestModel.advice_message = resultDic[@"advice_message"];
NSArray *relax_items = resultDic[@"relax_items"];
NSMutableArray *tmp_relax_items = [NSMutableArray array];
for (int i = 0; i < relax_items.count; i++) {
......
......@@ -105,7 +105,7 @@
- (UILabel *)descLab {
if (!_descLab) {
_descLab = [UILabel labWithFont:SysFont(12.0)];
_descLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHexA(0xFFFFFF, .3));
_descLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHexA(0xFFFFFF, .3), DSWhite);
}
return _descLab;
}
......
......@@ -56,7 +56,7 @@
if (!_timeLab) {
_timeLab = [UILabel labWithFont:SysFont(12.0)];
_timeLab.textAlignment = NSTextAlignmentCenter;
_timeLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, ColorFromHexA(0xFFFFFF, .3));
_timeLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, ColorFromHexA(0xFFFFFF, .3), DSWhite);
}
return _timeLab;
}
......
......@@ -25,6 +25,9 @@ NS_ASSUME_NONNULL_BEGIN
/// @param adjustedItems adjustedItems
- (void)updateAdjustView:(NSArray *)adjustedItems;
/// 更新建议文案
/// @param adviceMessage 建议
- (void)updateAdviceMessage:(NSString *)adviceMessage;
@end
NS_ASSUME_NONNULL_END
......@@ -12,7 +12,6 @@
@end
@implementation LineView
- (instancetype)initWithFrame:(CGRect)frame {
if (self == [super initWithFrame:frame]) {
UILabel *lineLab = [UILabel labWithText:@"- - - - - - - - - - - - - - - -" font:SysFont(10) fit:YES];
......@@ -46,7 +45,6 @@
}
return self;
}
@end
@interface ItemCell : UIView
......@@ -112,7 +110,7 @@
if (!_timeLab) {
_timeLab = [UILabel labWithFont:SysFont(12.0)];
_timeLab.textAlignment = NSTextAlignmentCenter;
_timeLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, ColorFromHexA(0xFFFFFF, .3));
_timeLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, ColorFromHexA(0xFFFFFF, .3), DSWhite);
}
return _timeLab;
}
......@@ -124,6 +122,7 @@
@property (nonatomic, strong) NSArray *adjustedItems;
@property (nonatomic, strong) NSMutableArray *adjustedCells;
@property (nonatomic, strong) NSMutableArray *sepLines;
@property (nonatomic, strong) UILabel *adviceMessageLab;
@end
@implementation StartReadyView
......@@ -138,7 +137,8 @@
[self addSubview:self.headIV];
[self addSubview:self.startBtn];
[self addSubview:self.adviceMessageLab];
[self.headIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self);
}];
......@@ -147,6 +147,12 @@
make.centerX.equalTo(self);
make.bottom.equalTo(self).offset(-94-Bottom_SafeArea_Height);
}];
[self.adviceMessageLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.left.equalTo(self).offset(5);
make.right.equalTo(self).offset(-5);
make.top.equalTo(self.startBtn.mas_bottom).offset(10);
}];
}
return self;
}
......@@ -196,6 +202,10 @@
}
}
- (void)updateAdviceMessage:(NSString *)adviceMessage {
self.adviceMessageLab.text = adviceMessage;
}
#pragma mark - lazy
- (UIImageView *)headIV {
if (!_headIV) {
......@@ -221,4 +231,13 @@
return _startBtn;
}
- (UILabel *)adviceMessageLab {
if (!_adviceMessageLab) {
_adviceMessageLab = [UILabel labWithFont:SysFont(12.0)];
_adviceMessageLab.textAlignment = NSTextAlignmentCenter;
_adviceMessageLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, ColorFromHexA(0xFFFFFF, .3), DSWhite);
}
return _adviceMessageLab;
}
@end
......@@ -90,12 +90,13 @@ static CGFloat endPointMargin = 8.0f;
- (void)updateEndPoint {
// 转成弧度
CGFloat angle = M_PI*2*_progress;
float radius = (self.bounds.size.width-_lineWidth)/2.0;
float radius = (self.bounds.size.width - _lineWidth)/2.0;
// 用户区分在第几象限内
int index = (angle)/M_PI_2;
// 用于计算正弦/余弦的角度
float needAngle = angle - index*M_PI_2;
float x = 0, y = 0;//用于保存_dotView的frame
// 用于保存_dotView的frame
float x = 0, y = 0;
switch (index) {
case 0: // 第一象限
x = radius + sinf(needAngle)*radius;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!