Commit 2f094e91 cgx

暂时隐藏积分任务

1 个父辈 bfc2f088
......@@ -136,11 +136,11 @@
break;
case 2: // 登录点击开启-开启我的页面里面的AI睡眠教练
{
[UserRequestModel autoLoginRequestWithCompletion:^(UserRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateStartAI object:nil];
}
}];
// [UserRequestModel autoLoginRequestWithCompletion:^(UserRequestModel * _Nonnull requestModel) {
// if (requestModel.resCode == DSResCodeSuccess) {
// [[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateStartAI object:nil];
// }
// }];
}
break;
case 3: // 轻拍哄睡
......
......@@ -32,7 +32,8 @@
// leftItem
UILabel *leftLab = [UILabel dkLabWithText:@"小梦睡眠" font:BoldFont(24.0)];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftLab];
// rightItem
/* rightItem
UIButton *dailyTaskBtn = [UIButton new];
[dailyTaskBtn addTarget:self action:@selector(jumpToDailyTaskPage) forControlEvents:UIControlEventTouchUpInside];
[dailyTaskBtn dk_setImage:DKImagePickerWithNames(@"ic_home_meirirw", @"dk_ic_home_meirirw", @"ic_home_meirirw") forState:UIControlStateNormal];
......@@ -40,7 +41,8 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self addScaleAnimtaionWithView:dailyTaskBtn];
});
*/
[self.view addSubview:self.homeTV];
[self.view addSubview:self.noisePlayBar];
[self.noisePlayBar mas_makeConstraints:^(MASConstraintMaker *make) {
......
......@@ -14,10 +14,10 @@
@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UIImageView *levelIV;
@property (nonatomic, strong) UIButton *modifyBtn;
@property (nonatomic, strong) UIView *scoreTaskEvaluateView;
@property (nonatomic, strong) UILabel *scoreCountLab;
@property (nonatomic, strong) UIButton *openAIBtn;
@property (nonatomic, strong) UIView *reportReviewsView;
//@property (nonatomic, strong) UIView *scoreTaskEvaluateView;
//@property (nonatomic, strong) UILabel *scoreCountLab;
//@property (nonatomic, strong) UIButton *openAIBtn;
//@property (nonatomic, strong) UIView *reportReviewsView;
@end
@implementation ProfileHeaderView
......@@ -29,11 +29,11 @@
}
}
- (void)monitorAIStartNoti {
UserModel *usrModel = [LoginUtils getUserLoginData];
self.openAIBtn.hidden = usrModel.is_access == 1;
self.reportReviewsView.hidden = !self.openAIBtn.hidden;
}
//- (void)monitorAIStartNoti {
// UserModel *usrModel = [LoginUtils getUserLoginData];
// self.openAIBtn.hidden = usrModel.is_access == 1;
// self.reportReviewsView.hidden = !self.openAIBtn.hidden;
//}
- (void)updateUserView {
UserModel *model = [LoginUtils getUserLoginData];
......@@ -46,16 +46,21 @@
[self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.portraitIV.mas_right).offset(20);
make.top.equalTo(self.portraitIV).offset(4);
}];
[self.levelIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLab).offset(-8);
make.top.equalTo(self.titleLab.mas_bottom).offset(4);
make.size.mas_equalTo(CGSizeMake(95, 35));
make.centerY.equalTo(self.portraitIV);
}];
self.openAIBtn.hidden = model.is_access == 1;
self.reportReviewsView.hidden = !self.openAIBtn.hidden;
self.scoreCountLab.text = [NSString stringWithFormat:@"我的积分:%d", model.total_points];
// [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.portraitIV.mas_right).offset(20);
// make.top.equalTo(self.portraitIV).offset(4);
// }];
// [self.levelIV mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.titleLab).offset(-8);
// make.top.equalTo(self.titleLab.mas_bottom).offset(4);
// make.size.mas_equalTo(CGSizeMake(95, 35));
// }];
// self.openAIBtn.hidden = model.is_access == 1;
// self.reportReviewsView.hidden = !self.openAIBtn.hidden;
// self.scoreCountLab.text = [NSString stringWithFormat:@"我的积分:%d", model.total_points];
} else {
self.portraitIV.image = [UIImage imageNamed:@"basicPlaceholder"];
self.titleLab.text = @"注册/登录";
......@@ -67,9 +72,9 @@
make.centerY.equalTo(self.portraitIV);
}];
self.openAIBtn.hidden = NO;
self.reportReviewsView.hidden = YES;
self.scoreCountLab.text = @"我的积分";
// self.openAIBtn.hidden = NO;
// self.reportReviewsView.hidden = YES;
// self.scoreCountLab.text = @"我的积分";
}
}
......@@ -84,8 +89,12 @@
if (self = [super initWithFrame:CGRectMake(0, 0, 0, 0)]) {
_delegate = delegate;
// [self mas_makeConstraints:^(MASConstraintMaker *make) {
// make.height.greaterThanOrEqualTo(@338);
// make.width.equalTo(@(kScreenWidth));
// }];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.greaterThanOrEqualTo(@338);
make.height.greaterThanOrEqualTo(@196);
make.width.equalTo(@(kScreenWidth));
}];
......@@ -93,18 +102,21 @@
[self addSubview:userInfoView];
self.userInfoView = userInfoView;
/*
UIView *scoreTaskEvaluateView = [UIView new];
[self addSubview:scoreTaskEvaluateView];
self.scoreTaskEvaluateView = scoreTaskEvaluateView;
[scoreTaskEvaluateView debugViewShowBorder];
UIButton *dailyTaskBtn = [self btnWithDKImagePicker:DKImagePickerWithNames(@"btn_person_meirirenwu", @"dk_btn_person_meirirenwu", @"btn_person_meirirenwu") tag:1];
UIButton *myScoreBtn = [self btnWithDKImagePicker:DKImagePickerWithNames(@"btn_person_wodejifen", @"dk_btn_person_wodejifen", @"btn_person_wodejifen") tag:2];
*/
[self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(self);
make.height.equalTo(@172);
make.top.left.right.equalTo(self);
}];
/*
[self.scoreTaskEvaluateView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(self);
make.top.equalTo(self.userInfoView.mas_bottom);
......@@ -137,6 +149,7 @@
[self.reportReviewsView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.openAIBtn);
}];
*/
UILabel *meLab = [UILabel dkLabWithText:@"我的" font:BoldFont(24.0)];
[self.userInfoView addSubview:meLab];
......@@ -181,7 +194,7 @@
}];
// 更新布局
[self.scoreTaskEvaluateView layoutIfNeeded];
// [self.scoreTaskEvaluateView layoutIfNeeded];
[self layoutIfNeeded];
[self updateUserView];
......@@ -189,141 +202,141 @@
// 监听用户数据更新通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateUserView) name:HasUpdateUserDataNoti object:nil];
// 监听用户开启AI睡眠教练
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(monitorAIStartNoti) name:NeedUpdateStartAI object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(monitorAIStartNoti) name:NeedUpdateStartAI object:nil];
}
return self;
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:HasUpdateUserDataNoti object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NeedUpdateStartAI object:nil];
// [[NSNotificationCenter defaultCenter] removeObserver:self name:NeedUpdateStartAI object:nil];
}
#pragma mark - lazy
- (UIButton *)openAIBtn {
if (!_openAIBtn) {
_openAIBtn = [UIButton new];
_openAIBtn.hidden = YES;
[_openAIBtn dk_setImage:DKImagePickerWithNames(@"btn_person_kaitong", @"dk_btn_person_kaitong", @"btn_person_kaitong") forState:UIControlStateNormal];
[_openAIBtn.imageView setContentMode:UIViewContentModeScaleAspectFill];
_openAIBtn.contentHorizontalAlignment= UIControlContentHorizontalAlignmentFill;
_openAIBtn.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;
_openAIBtn.tag = 3;
[_openAIBtn addTarget:self action:@selector(scoreTaskAction:) forControlEvents:UIControlEventTouchUpInside];
[self.scoreTaskEvaluateView addSubview:_openAIBtn];
UILabel *titleLab = [UILabel labWithText:@"开通AI睡眠教练享专业报告与测评" font:BoldFont(14.0) fit:YES];
titleLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite);
[_openAIBtn addSubview:titleLab];
[titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(_openAIBtn).offset(12);
make.centerY.equalTo(_openAIBtn);
}];
UILabel *openLab = [UILabel labWithText:@"去开通" textColor:DSWhite font:BoldFont(12.0)];
openLab.textAlignment = NSTextAlignmentCenter;
[openLab cornerRadius:12.0];
openLab.backgroundColor = BrandColor;
[_openAIBtn addSubview:openLab];
[openLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(_openAIBtn).offset(-12);
make.centerY.equalTo(_openAIBtn);
make.size.mas_equalTo(CGSizeMake(76, 24));
}];
}
return _openAIBtn;
}
- (UIView *)reportReviewsView {
if (!_reportReviewsView) {
_reportReviewsView = [UIView new];
_reportReviewsView.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, ColorFromHex(0x2A314B), DSWhite);
[_reportReviewsView cornerRadius:12.0];
[self.scoreTaskEvaluateView addSubview:_reportReviewsView];
UIButton *reportBtn = [UIButton btnWithTitle:@"我的睡眠报告" font:BoldFont(15.0)];
reportBtn.tag = 4;
reportBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 0);
[reportBtn addTarget:self action:@selector(scoreTaskAction:) forControlEvents:UIControlEventTouchUpInside];
[reportBtn dk_setTitleColorPicker:DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite) forState:UIControlStateNormal];
[reportBtn dk_setImage:DKImagePickerWithNames(@"sleep_report", @"dk_sleep_report", @"sleep_report") forState:UIControlStateNormal];
[_reportReviewsView addSubview:reportBtn];
UIView *line = [UIView new];
line.dk_backgroundColorPicker = DKColorPickerWithColors(DivideLineColor, DarkColor, DSWhite);
[_reportReviewsView addSubview:line];
UIButton *reviewBtn = [UIButton btnWithTitle:@"我的睡眠测评" font:BoldFont(15.0)];
reviewBtn.tag = 5;
reviewBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 0);
[reviewBtn addTarget:self action:@selector(scoreTaskAction:) forControlEvents:UIControlEventTouchUpInside];
[reviewBtn dk_setTitleColorPicker:DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite) forState:UIControlStateNormal];
[reviewBtn dk_setImage:DKImagePickerWithNames(@"sleep_review", @"dk_sleep_review", @"sleep_review") forState:UIControlStateNormal];
[_reportReviewsView addSubview:reviewBtn];
[reportBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.bottom.equalTo(_reportReviewsView);
make.right.equalTo(reviewBtn.mas_left);
}];
[reviewBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.bottom.equalTo(_reportReviewsView);
make.size.equalTo(reportBtn);
}];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_reportReviewsView).offset(11);
make.bottom.equalTo(_reportReviewsView).offset(-11);
make.width.equalTo(@1);
make.center.equalTo(_reportReviewsView);
}];
}
return _reportReviewsView;
}
//- (UIButton *)openAIBtn {
// if (!_openAIBtn) {
// _openAIBtn = [UIButton new];
// _openAIBtn.hidden = YES;
// [_openAIBtn dk_setImage:DKImagePickerWithNames(@"btn_person_kaitong", @"dk_btn_person_kaitong", @"btn_person_kaitong") forState:UIControlStateNormal];
// [_openAIBtn.imageView setContentMode:UIViewContentModeScaleAspectFill];
// _openAIBtn.contentHorizontalAlignment= UIControlContentHorizontalAlignmentFill;
// _openAIBtn.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;
// _openAIBtn.tag = 3;
// [_openAIBtn addTarget:self action:@selector(scoreTaskAction:) forControlEvents:UIControlEventTouchUpInside];
// [self.scoreTaskEvaluateView addSubview:_openAIBtn];
//
// UILabel *titleLab = [UILabel labWithText:@"开通AI睡眠教练享专业报告与测评" font:BoldFont(14.0) fit:YES];
// titleLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite);
// [_openAIBtn addSubview:titleLab];
// [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(_openAIBtn).offset(12);
// make.centerY.equalTo(_openAIBtn);
// }];
//
// UILabel *openLab = [UILabel labWithText:@"去开通" textColor:DSWhite font:BoldFont(12.0)];
// openLab.textAlignment = NSTextAlignmentCenter;
// [openLab cornerRadius:12.0];
// openLab.backgroundColor = BrandColor;
// [_openAIBtn addSubview:openLab];
// [openLab mas_makeConstraints:^(MASConstraintMaker *make) {
// make.right.equalTo(_openAIBtn).offset(-12);
// make.centerY.equalTo(_openAIBtn);
// make.size.mas_equalTo(CGSizeMake(76, 24));
// }];
// }
// return _openAIBtn;
//}
//
//- (UIView *)reportReviewsView {
// if (!_reportReviewsView) {
// _reportReviewsView = [UIView new];
// _reportReviewsView.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, ColorFromHex(0x2A314B), DSWhite);
// [_reportReviewsView cornerRadius:12.0];
// [self.scoreTaskEvaluateView addSubview:_reportReviewsView];
//
// UIButton *reportBtn = [UIButton btnWithTitle:@"我的睡眠报告" font:BoldFont(15.0)];
// reportBtn.tag = 4;
// reportBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 0);
// [reportBtn addTarget:self action:@selector(scoreTaskAction:) forControlEvents:UIControlEventTouchUpInside];
// [reportBtn dk_setTitleColorPicker:DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite) forState:UIControlStateNormal];
// [reportBtn dk_setImage:DKImagePickerWithNames(@"sleep_report", @"dk_sleep_report", @"sleep_report") forState:UIControlStateNormal];
// [_reportReviewsView addSubview:reportBtn];
//
// UIView *line = [UIView new];
// line.dk_backgroundColorPicker = DKColorPickerWithColors(DivideLineColor, DarkColor, DSWhite);
// [_reportReviewsView addSubview:line];
//
// UIButton *reviewBtn = [UIButton btnWithTitle:@"我的睡眠测评" font:BoldFont(15.0)];
// reviewBtn.tag = 5;
// reviewBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 0);
// [reviewBtn addTarget:self action:@selector(scoreTaskAction:) forControlEvents:UIControlEventTouchUpInside];
// [reviewBtn dk_setTitleColorPicker:DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite) forState:UIControlStateNormal];
// [reviewBtn dk_setImage:DKImagePickerWithNames(@"sleep_review", @"dk_sleep_review", @"sleep_review") forState:UIControlStateNormal];
// [_reportReviewsView addSubview:reviewBtn];
//
// [reportBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.left.bottom.equalTo(_reportReviewsView);
// make.right.equalTo(reviewBtn.mas_left);
// }];
// [reviewBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.right.bottom.equalTo(_reportReviewsView);
// make.size.equalTo(reportBtn);
// }];
// [line mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(_reportReviewsView).offset(11);
// make.bottom.equalTo(_reportReviewsView).offset(-11);
// make.width.equalTo(@1);
// make.center.equalTo(_reportReviewsView);
// }];
// }
// return _reportReviewsView;
//}
#pragma mark - builders
- (UIButton *)btnWithDKImagePicker:(DKImagePicker)imgPicker tag:(NSInteger)tag {
UIButton *btn = [UIButton new];
btn.tag = tag;
[btn dk_setImage:imgPicker forState:UIControlStateNormal];
[btn.imageView setContentMode:UIViewContentModeScaleAspectFill];
btn.contentHorizontalAlignment= UIControlContentHorizontalAlignmentFill;
btn.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;
[btn addTarget:self action:@selector(scoreTaskAction:) forControlEvents:UIControlEventTouchUpInside];
[self.scoreTaskEvaluateView addSubview:btn];
UILabel *titleLab = [UILabel labWithText:(tag == 1 ? @"每日任务" : @"我的积分") font:BoldFont(15.0) fit:YES];
titleLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite);
[btn addSubview:titleLab];
[titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(btn).offset(12);
make.top.equalTo(btn).offset(10);
}];
if (tag == 1) {
UILabel *tipsLab = [UILabel labWithText:@"做任务攒积分 >" textColor:BrandColor font:SysFont(8.0)];
tipsLab.textAlignment = NSTextAlignmentCenter;
[tipsLab cornerRadius:8.0];
tipsLab.layer.borderWidth = .5;
tipsLab.layer.borderColor = BrandColor.CGColor;
[btn addSubview:tipsLab];
[tipsLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(titleLab);
make.bottom.equalTo(btn).offset(-10);
make.size.mas_equalTo(CGSizeMake(65, 15));
}];
} else {
UILabel *scoreCountLab = [UILabel labWithFont:SysFont(12.0)];
scoreCountLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, DkTitleColor, DSWhite);
[btn addSubview:scoreCountLab];
self.scoreCountLab = scoreCountLab;
[scoreCountLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(titleLab);
make.bottom.equalTo(btn).offset(-10);
make.right.equalTo(btn).offset(-79);
}];
}
return btn;
}
//- (UIButton *)btnWithDKImagePicker:(DKImagePicker)imgPicker tag:(NSInteger)tag {
// UIButton *btn = [UIButton new];
// btn.tag = tag;
// [btn dk_setImage:imgPicker forState:UIControlStateNormal];
// [btn.imageView setContentMode:UIViewContentModeScaleAspectFill];
// btn.contentHorizontalAlignment= UIControlContentHorizontalAlignmentFill;
// btn.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;
// [btn addTarget:self action:@selector(scoreTaskAction:) forControlEvents:UIControlEventTouchUpInside];
// [self.scoreTaskEvaluateView addSubview:btn];
//
// UILabel *titleLab = [UILabel labWithText:(tag == 1 ? @"每日任务" : @"我的积分") font:BoldFont(15.0) fit:YES];
// titleLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite);
// [btn addSubview:titleLab];
//
// [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(btn).offset(12);
// make.top.equalTo(btn).offset(10);
// }];
//
// if (tag == 1) {
// UILabel *tipsLab = [UILabel labWithText:@"做任务攒积分 >" textColor:BrandColor font:SysFont(8.0)];
// tipsLab.textAlignment = NSTextAlignmentCenter;
// [tipsLab cornerRadius:8.0];
// tipsLab.layer.borderWidth = .5;
// tipsLab.layer.borderColor = BrandColor.CGColor;
// [btn addSubview:tipsLab];
// [tipsLab mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(titleLab);
// make.bottom.equalTo(btn).offset(-10);
// make.size.mas_equalTo(CGSizeMake(65, 15));
// }];
// } else {
// UILabel *scoreCountLab = [UILabel labWithFont:SysFont(12.0)];
// scoreCountLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, DkTitleColor, DSWhite);
// [btn addSubview:scoreCountLab];
// self.scoreCountLab = scoreCountLab;
// [scoreCountLab mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(titleLab);
// make.bottom.equalTo(btn).offset(-10);
// make.right.equalTo(btn).offset(-79);
// }];
// }
//
// return btn;
//}
@end
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!