diff --git a/xplan-ios/Main/Room/View/AnchorView/FansTeam/Model/XPAnchorFansTaskDetailModel.h b/xplan-ios/Main/Room/View/AnchorView/FansTeam/Model/XPAnchorFansTaskDetailModel.h index dcd91d30..25dbee48 100644 --- a/xplan-ios/Main/Room/View/AnchorView/FansTeam/Model/XPAnchorFansTaskDetailModel.h +++ b/xplan-ios/Main/Room/View/AnchorView/FansTeam/Model/XPAnchorFansTaskDetailModel.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy) NSString *taskDesc; @property (nonatomic, assign) NSInteger awardVal; @property (nonatomic, assign) NSInteger totalNum; -@property (nonatomic, assign) BOOL isFinish; +@property (nonatomic, assign) BOOL isFinished; @end diff --git a/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTaskTableViewCell.m b/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTaskTableViewCell.m index 40fbdce0..c850d67e 100644 --- a/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTaskTableViewCell.m +++ b/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTaskTableViewCell.m @@ -86,14 +86,18 @@ self.nameplateImageView.imageUrl = model.icon; self.nameplateLabel.text = model.taskName; self.nameplateDescLabel.text = model.taskDesc; - if (model.isFinish) { + if (model.isFinished) { [self.doneButton setTitle:@"已完成" forState:UIControlStateNormal]; [self.doneButton setBackgroundColor:[ThemeColor appBackgroundColor]]; [self.doneButton setTitleColor:[ThemeColor textThirdColor] forState:UIControlStateNormal]; - } else { + } else if(model.awardVal > 0){ [self.doneButton setTitle:[NSString stringWithFormat:@"%ld/%ld", model.awardVal, model.totalNum] forState:UIControlStateNormal]; [self.doneButton setBackgroundColor:UIColorFromRGB(0xFF4E7F)]; [self.doneButton setTitleColor:[ThemeColor appCellBackgroundColor] forState:UIControlStateNormal]; + } else { + [self.doneButton setTitle:[NSString stringWithFormat:@"%ld/%ld", model.awardVal, model.totalNum] forState:UIControlStateNormal]; + [self.doneButton setBackgroundColor:[ThemeColor appBackgroundColor]]; + [self.doneButton setTitleColor:[ThemeColor textThirdColor] forState:UIControlStateNormal]; } } diff --git a/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTaskViewController.m b/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTaskViewController.m index d5df0f60..9caa5693 100644 --- a/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTaskViewController.m +++ b/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTaskViewController.m @@ -39,8 +39,10 @@ @property (nonatomic, strong) NetImageView *avatarImageView; ///粉丝团名称 @property (nonatomic, strong) UILabel *nameLabel; -///粉丝团人数 -@property (nonatomic, strong) UIButton *countButton; +///人数背景 +@property (nonatomic, strong) UIView *countContentView; +///粉丝团人 +@property (nonatomic, strong) UILabel *countLabel; @property (nonatomic, strong) UIView *stackView; ///排行榜 @@ -107,7 +109,8 @@ [self.contentView addSubview:self.helpButton]; [self.contentView addSubview:self.avatarImageView]; [self.contentView addSubview:self.nameLabel]; - [self.contentView addSubview:self.countButton]; + [self.contentView addSubview:self.countContentView]; + [self.countContentView addSubview:self.countLabel]; [self.contentView addSubview:self.stackView]; [self.stackView addSubview:self.rankImageView]; [self.contentView addSubview:self.privilegeTitleImageView]; @@ -158,20 +161,30 @@ make.height.mas_equalTo(21); make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(8); make.top.mas_equalTo(self.avatarImageView).offset(6); - make.right.mas_equalTo(self.countButton.mas_left).mas_offset(-4); + make.right.mas_equalTo(self.countContentView.mas_left).mas_offset(-4); }]; - [self.countButton mas_makeConstraints:^(MASConstraintMaker *make) { + [self.countContentView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(self.nameLabel); - make.right.mas_equalTo(-26); + make.right.mas_lessThanOrEqualTo(-26); make.height.mas_equalTo(15); + make.left.mas_equalTo(self.nameLabel.mas_right).mas_offset(4); }]; + [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.bottom.mas_equalTo(self.countContentView); + make.left.mas_equalTo(self.countContentView).mas_offset(5); + make.right.mas_equalTo(self.countContentView).mas_offset(-5); + }]; + + [self.countLabel setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal]; + [self.nameLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal]; + [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(8); make.bottom.mas_equalTo(self.avatarImageView).mas_offset(-3); make.height.mas_equalTo(28); - make.width.mas_equalTo(34); + make.width.mas_equalTo(3 * (20 + 8) + 34); }]; [self.rankImageView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -280,14 +293,20 @@ if (self.model) { self.avatarImageView.imageUrl = self.model.anchorAvatar; self.nameLabel.text = self.model.anchorNick; - [self.countButton setTitle:[NSString stringWithFormat:@"·%ld人", self.model.teamNum] forState:UIControlStateNormal]; + self.countLabel.text = [NSString stringWithFormat:@"·%ld人", self.model.teamNum]; CGFloat margin = 8; - for (int i = 0; i < self.model.avatarList.count; i++) { - NSString *str = self.model.avatarList[i]; + for (int i = 0; i < 3; i++) { + NSString *str; + if (self.model.avatarList.count > i) { + str = self.model.avatarList[i]; + } NetImageConfig *config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; NetImageView *imageView = [[NetImageView alloc] initWithConfig:config]; - imageView.imageUrl = str; + if (str) { + imageView.imageUrl = str; + } imageView.layer.cornerRadius = 10; imageView.layer.masksToBounds = YES; [self.stackView addSubview:imageView]; @@ -297,9 +316,6 @@ make.left.mas_equalTo(i * 27 + 25 + margin); }]; } - [self.stackView mas_updateConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(self.model.avatarList.count * (20 + margin) + 34); - }]; float progress = self.model.levelExper * 1.0 / self.model.nextLevelExper; [self.progressView mas_remakeConstraints:^(MASConstraintMaker *make) { @@ -408,16 +424,23 @@ return _nameLabel; } -- (UIButton *)countButton { - if (!_countButton) { - _countButton = [[UIButton alloc] init]; - [_countButton setTitleColor:UIColorFromRGB(0xFE3478) forState:UIControlStateNormal]; - _countButton.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium]; - _countButton.layer.cornerRadius = 7.5; - _countButton.layer.masksToBounds = YES; - [_countButton setBackgroundColor:[UIColor whiteColor]]; +- (UIView *)countContentView { + if (!_countContentView) { + _countContentView = [[UIView alloc] init]; + _countContentView.backgroundColor = [UIColor whiteColor]; + _countContentView.layer.cornerRadius = 7.5; + _countContentView.layer.masksToBounds = YES; } - return _countButton; + return _countContentView; +} + +- (UILabel *)countLabel { + if (!_countLabel) { + _countLabel = [[UILabel alloc] init]; + _countLabel.textColor = UIColorFromRGB(0xFE3478); + _countLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium]; + } + return _countLabel; } - (UIView *)stackView { @@ -515,7 +538,7 @@ - (UIView *)progressBgView { if (!_progressBgView) { _progressBgView = [[UIView alloc] init]; - _progressBgView.backgroundColor = [ThemeColor appBackgroundColor]; + _progressBgView.backgroundColor = UIColorFromRGB(0xE4E4E4); _progressBgView.layer.cornerRadius = 8; _progressBgView.layer.masksToBounds = YES; } diff --git a/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTeamEntranceView.m b/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTeamEntranceView.m index c4b26d9e..55e3f240 100644 --- a/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTeamEntranceView.m +++ b/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTeamEntranceView.m @@ -123,7 +123,7 @@ - (UIImageView *)bgImageView { if (_bgImageView == nil) { _bgImageView = [[UIImageView alloc] init]; - _bgImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFF2D7C), UIColorFromRGB(0xFF8BB2)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(20, 50)]; + _bgImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFF1ED7), UIColorFromRGB(0xFE70DB)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(92, 22)]; _bgImageView.userInteractionEnabled = YES; _bgImageView.layer.cornerRadius = 11; _bgImageView.layer.masksToBounds = YES; diff --git a/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTeamViewController.m b/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTeamViewController.m index af45d348..1e982c1b 100644 --- a/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTeamViewController.m +++ b/xplan-ios/Main/Room/View/AnchorView/FansTeam/View/XPAnchorFansTeamViewController.m @@ -39,8 +39,10 @@ @property (nonatomic, strong) NetImageView *avatarImageView; ///粉丝团名称 @property (nonatomic, strong) UILabel *nameLabel; -///粉丝团人数 -@property (nonatomic, strong) UIButton *countButton; +///人数背景 +@property (nonatomic, strong) UIView *countContentView; +///粉丝团人 +@property (nonatomic, strong) UILabel *countLabel; @property (nonatomic, strong) UIView *stackView; ///排行榜 @@ -108,7 +110,8 @@ [self.contentView addSubview:self.helpButton]; [self.contentView addSubview:self.avatarImageView]; [self.contentView addSubview:self.nameLabel]; - [self.contentView addSubview:self.countButton]; + [self.contentView addSubview:self.countContentView]; + [self.countContentView addSubview:self.countLabel]; [self.contentView addSubview:self.stackView]; [self.stackView addSubview:self.rankImageView]; @@ -160,20 +163,29 @@ make.height.mas_equalTo(21); make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(8); make.top.mas_equalTo(self.avatarImageView).offset(6); - make.right.mas_equalTo(self.countButton.mas_left).mas_offset(-4); + make.right.mas_equalTo(self.countContentView.mas_left).mas_offset(-4); }]; - [self.countButton mas_makeConstraints:^(MASConstraintMaker *make) { + [self.countContentView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(self.nameLabel); - make.right.mas_equalTo(-26); + make.right.mas_lessThanOrEqualTo(-26); make.height.mas_equalTo(15); + make.left.mas_equalTo(self.nameLabel.mas_right).mas_offset(4); }]; + [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.bottom.mas_equalTo(self.countContentView); + make.left.mas_equalTo(self.countContentView).mas_offset(5); + make.right.mas_equalTo(self.countContentView).mas_offset(-5); + }]; + + [self.countLabel setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal]; + [self.nameLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal]; [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(8); make.bottom.mas_equalTo(self.avatarImageView).mas_offset(-3); make.height.mas_equalTo(28); - make.width.mas_equalTo(34); + make.width.mas_equalTo(3 * (20 + 8) + 34); }]; [self.rankImageView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -259,7 +271,7 @@ if (self.model) { self.avatarImageView.imageUrl = self.model.anchorAvatar; self.nameLabel.text = self.model.anchorNick; - [self.countButton setTitle:[NSString stringWithFormat:@"·%ld人", self.model.teamNum] forState:UIControlStateNormal]; + self.countLabel.text = [NSString stringWithFormat:@"·%ld人", self.model.teamNum]; XPAnchorFansPrivilegeModel *nameplateModel = self.model.privilegeConfigVos[0]; self.nameplateImageView.imageUrl = nameplateModel.icon; @@ -275,13 +287,19 @@ self.iconImageView.imageUrl = joinModel.icon; CGFloat margin = 8; - for (int i = 0; i < self.model.avatarList.count; i++) { - NSString *str = self.model.avatarList[i]; + for (int i = 0; i < 3; i++) { + NSString *str; + if (self.model.avatarList.count > i) { + str = self.model.avatarList[i]; + } NetImageConfig *config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; NetImageView *imageView = [[NetImageView alloc] initWithConfig:config]; imageView.layer.cornerRadius = 10; imageView.layer.masksToBounds = YES; - imageView.imageUrl = str; + if (str) { + imageView.imageUrl = str; + } [self.stackView addSubview:imageView]; [imageView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(self.stackView); @@ -289,9 +307,6 @@ make.left.mas_equalTo(i * 27 + 25 + margin); }]; } - [self.stackView mas_updateConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(self.model.avatarList.count * (20 + margin) + 34); - }]; } } @@ -379,16 +394,23 @@ return _nameLabel; } -- (UIButton *)countButton { - if (!_countButton) { - _countButton = [[UIButton alloc] init]; - [_countButton setTitleColor:UIColorFromRGB(0xFE3478) forState:UIControlStateNormal]; - _countButton.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium]; - _countButton.layer.cornerRadius = 7.5; - _countButton.layer.masksToBounds = YES; - [_countButton setBackgroundColor:[UIColor whiteColor]]; +- (UIView *)countContentView { + if (!_countContentView) { + _countContentView = [[UIView alloc] init]; + _countContentView.backgroundColor = [UIColor whiteColor]; + _countContentView.layer.cornerRadius = 7.5; + _countContentView.layer.masksToBounds = YES; } - return _countButton; + return _countContentView; +} + +- (UILabel *)countLabel { + if (!_countLabel) { + _countLabel = [[UILabel alloc] init]; + _countLabel.textColor = UIColorFromRGB(0xFE3478); + _countLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium]; + } + return _countLabel; } - (UIView *)stackView { diff --git a/xplan-ios/Main/XPWebViewController.m b/xplan-ios/Main/XPWebViewController.m index ea66aae0..445b57b3 100644 --- a/xplan-ios/Main/XPWebViewController.m +++ b/xplan-ios/Main/XPWebViewController.m @@ -471,7 +471,7 @@ NSString * const kCloseWebView = @"closeWebView"; } }]; - + _webview.scrollView.bounces = NO; } return _webview; }