You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
3.9 KiB
118 lines
3.9 KiB
![]()
2 years ago
|
//
|
||
|
// MenuCollectionViewCell.m
|
||
|
// tongxin
|
||
|
//
|
||
|
// Created by ecell on 2023/6/20.
|
||
|
// Copyright © 2023 xTT. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "MenuCollectionViewCell.h"
|
||
|
#import "User.h"
|
||
|
#import "Device.h"
|
||
|
|
||
|
@interface MenuCollectionViewCell ()
|
||
|
|
||
|
@property (nonatomic ,weak) UIImageView *bgImg;
|
||
|
@property (nonatomic ,weak) UILabel *titleLabel;
|
||
|
|
||
|
@property (nonatomic ,weak) UILabel *textsLabel;
|
||
|
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation MenuCollectionViewCell
|
||
|
- (instancetype)initWithFrame:(CGRect)frame
|
||
|
{
|
||
|
self = [super initWithFrame:frame];
|
||
|
if (self)
|
||
|
{
|
||
|
self.backgroundColor = KKClearColor;
|
||
|
[self subhomeCell];
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)setImageStr:(NSString *)imageStr
|
||
|
{
|
||
|
_imageStr = imageStr;
|
||
|
self.bgImg.image = ImageName_(imageStr);
|
||
|
}
|
||
|
|
||
|
- (void)setTitleStr:(NSString *)titleStr
|
||
|
{
|
||
|
_titleStr = titleStr;
|
||
|
self.titleLabel.text = titleStr;
|
||
|
}
|
||
|
|
||
|
- (void)setDataModel:(lastDataModel *)dataModel
|
||
|
{
|
||
|
_dataModel = dataModel;
|
||
|
if ([self.titleStr isEqualToString:@"心率"])
|
||
|
{
|
||
|
self.textsLabel.textColor = RGB(255, 109, 109);
|
||
|
NSString *heart = F(@"%@", dataModel.heartData[@"data"]);
|
||
|
self.textsLabel.attributedText = [UICommon labelFontSize:[NSString stringWithFormat:@"%@ bpm",heart.integerValue > 0 ? heart : @"0"] :@""];
|
||
|
}
|
||
|
if ([self.titleStr isEqualToString:@"体温"])
|
||
|
{
|
||
|
self.textsLabel.textColor = mainColor;
|
||
|
NSString *temp = [dataModel.tempData[@"data"] doubleValue] > 0 ? F(@"%@", dataModel.tempData[@"data"]) : @"0";
|
||
|
self.textsLabel.attributedText = [UICommon labelFontSize:[NSString stringWithFormat:@"%@ ℃",temp] :@""];
|
||
|
}
|
||
|
// if ([self.titleStr isEqualToString:@"睡眠"])
|
||
|
// {
|
||
|
// self.textsLabel.textColor = KKTextColor;
|
||
|
// NSString *temp = [dataModel.tempData[@"data"] length] > 0 ? F(@"%@", dataModel.tempData[@"data"]) : @"0";
|
||
|
// self.textsLabel.attributedText = [UICommon labelFontSize:F(@"%@\n小时", dataModel.tempData[@"data"]) :@""];
|
||
|
// }
|
||
|
if ([self.titleStr isEqualToString:@"血压"])
|
||
|
{
|
||
|
self.textsLabel.textColor = RGB(72,192,203);
|
||
|
NSString *dalastDiaBloodta = [dataModel.bloodData[@"lastDiaBlood"] doubleValue] > 0 ? F(@"%@", dataModel.bloodData[@"lastDiaBlood"]) : @"0";
|
||
|
NSString *lastSysBlood = [dataModel.bloodData[@"lastSysBlood"] doubleValue] > 0 ? F(@"%@", dataModel.bloodData[@"lastSysBlood"]) : @"0";
|
||
|
self.textsLabel.attributedText = [UICommon labelFontSize:F(@"%@/%@\nmmHg", dalastDiaBloodta,lastSysBlood) :F(@"/%@", lastSysBlood)];
|
||
|
}
|
||
|
if ([self.titleStr isEqualToString:@"血氧"])
|
||
|
{
|
||
|
self.textsLabel.textColor = RGB(247,77,78);
|
||
|
NSString *oxygen = [dataModel.oxygenData[@"data"] doubleValue] > 0 ? F(@"%@", dataModel.oxygenData[@"data"]) : @"0";
|
||
|
self.textsLabel.attributedText = [UICommon labelFontSize:F(@"%@%%\nSpO2", oxygen) :@"%"];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- (void)subhomeCell
|
||
|
{
|
||
|
UIImageView *bgImg = [UIImageView new];
|
||
|
self.bgImg = bgImg;
|
||
|
[self.contentView addSubview:bgImg];
|
||
|
[bgImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.edges.equalTo(self.contentView);
|
||
|
}];
|
||
|
|
||
|
UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(18) textColor:KKTextColor text:@"" Radius:0];
|
||
|
self.titleLabel = titleLabel;
|
||
|
[self.contentView addSubview:titleLabel];
|
||
|
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.equalTo(self.contentView).offset(17);
|
||
|
make.top.equalTo(self.contentView).offset(12);
|
||
|
}];
|
||
|
|
||
|
|
||
|
UILabel *textsLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(32) textColor:KKGrey102 text:@"" Radius:0];
|
||
|
self.textsLabel = textsLabel;
|
||
|
[self.contentView addSubview:textsLabel];
|
||
|
[textsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.equalTo(titleLabel.mas_left).offset(5);
|
||
|
make.top.equalTo(titleLabel.mas_bottom).offset(5);
|
||
|
}];
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
@end
|
||
|
|