公屏消息、资料卡增加贵族icon

This commit is contained in:
chenguilong
2022-01-13 15:47:36 +08:00
committed by fengshuo
parent e06ac0b3dd
commit 384e318cda
4 changed files with 58 additions and 12 deletions

View File

@@ -95,7 +95,7 @@
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(180);
make.width.mas_equalTo(330);
make.bottom.mas_equalTo(self.mainView);
make.bottom.mas_equalTo(self.userCardBackImageView);
make.centerX.mas_equalTo(self.mainView);
}];
}

View File

@@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,copy) NSString *inRoomNameplatePic;
///铭牌的字
@property (nonatomic,copy) NSString *inRoomNameplateWord;
///贵族icon
@property (nonatomic, copy) NSString *vipIcon;
@end

View File

@@ -94,15 +94,22 @@
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
///
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:model.defUser newUser:model.newUser]];
if (model.vipIcon) {//icon
[attribute appendAttributedString:[self createUrlImageAttribute:model.vipIcon]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
if (model.experUrl) {
[attribute appendAttributedString:[self createUrlImageAttribute:model.experUrl]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
if (model.inRoomNameplatePic.length > 0 && model.inRoomNameplateWord.length > 0) {
if (model.inRoomNameplatePic.length > 0 && model.inRoomNameplateWord.length > 0) { //
[attribute appendAttributedString:[self createNameplateAttibute:model.inRoomNameplateWord image:model.inRoomNameplatePic textFont:[UIFont systemFontOfSize:9]]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
} else if (model.inRoomNameplatePic.length > 0) {//
[attribute appendAttributedString:[self createUrlImageAttribute:model.inRoomNameplatePic]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
[attribute appendAttributedString:[self createTextAttribute:nick color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
[attribute appendAttributedString:[self createTextAttribute:message.text color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
@@ -130,6 +137,14 @@
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
NSDictionary * dic = [(NSDictionary *)messageExt.roomExt.toJSONObject objectForKey:message.from];
XPMessageRemoteExtModel * extModel = [XPMessageRemoteExtModel modelWithDictionary:dic];
if (extModel.vipIcon.length > 0) {//icon
[attribute appendAttributedString:[self createUrlImageAttribute:extModel.vipIcon]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
if (extModel.experUrl.length > 0) {//
[attribute appendAttributedString:[self createUrlImageAttribute:extModel.experUrl]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
if (extModel.inRoomNameplatePic.length > 0 && extModel.inRoomNameplateWord.length > 0) {
[attribute appendAttributedString:[self createNameplateAttibute:extModel.inRoomNameplateWord image:extModel.inRoomNameplatePic textFont:[UIFont systemFontOfSize:9]]];
[attribute appendAttributedString:[self createSapceAttribute:2]];

View File

@@ -71,8 +71,10 @@
@property (nonatomic,strong) UIImageView *officalImageView;
///
@property (nonatomic,strong) UIStackView *tagStackView;
///
///
@property (nonatomic,strong) NetImageView *charmImageView;
///icon
@property (nonatomic, strong) NetImageView *nobleIconImageView;
///
@property (nonatomic,strong) NetImageView *experImageView;
///
@@ -152,6 +154,7 @@
[self.userInfoView addSubview:self.effectView];
[self.userInfoView addSubview:self.avatarImageView];
[self.userInfoView addSubview:self.headWearImageView];
[self.userInfoView addSubview:self.nobleIconImageView];
[self.userInfoView addSubview:self.nickLabel];
[self.userInfoView addSubview:self.sexImageView];
[self.userInfoView addSubview:self.tagStackView];
@@ -198,13 +201,12 @@
make.width.mas_equalTo(self.stackView);
make.height.mas_equalTo(110);
}];
// width KScreenWidth - 90;
CGFloat nobleMargin = (KScreenWidth - 45) * 45.0 / (KScreenWidth - 90);
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(180);
make.top.mas_equalTo(self.backView).mas_offset(-70);
make.right.mas_equalTo(self.backView).offset(22.5);
make.left.mas_equalTo(self.backView).mas_offset(-22.5);
make.right.mas_equalTo(self.backView).offset(nobleMargin*0.5);
make.left.mas_equalTo(self.backView).mas_offset(-nobleMargin*0.5);
}];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(self.userInfoView);
@@ -239,9 +241,16 @@
make.width.mas_equalTo(self.avatarImageView.mas_width).multipliedBy(1.2);
make.height.mas_equalTo(self.headWearImageView.mas_width);
}];
[self.nobleIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(5);
make.top.mas_equalTo(self.avatarImageView);
make.height.mas_equalTo(20);
make.width.mas_equalTo(0);
}];
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(5);
make.left.mas_equalTo(self.nobleIconImageView.mas_right);
make.top.mas_equalTo(self.avatarImageView);
}];
@@ -252,13 +261,13 @@
}];
[self.tagStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nickLabel);
make.top.mas_equalTo(self.nickLabel.mas_bottom).offset(3);
make.left.mas_equalTo(self.nobleIconImageView);
make.top.mas_equalTo(self.nobleIconImageView.mas_bottom).offset(3);
make.height.mas_equalTo(20);
}];
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nickLabel);
make.left.mas_equalTo(self.nobleIconImageView);
make.top.mas_equalTo(self.tagStackView.mas_bottom).offset(3);
}];
@@ -455,6 +464,15 @@
self.avatarImageView.imageUrl = userInfo.avatar;
self.backImageView.imageUrl = userInfo.avatar;
self.nobleImageView.imageUrl = userInfo.userInfoCardPic;
self.nobleIconImageView.imageUrl = userInfo.userVipInfoVO.vipIcon;
if (userInfo.userVipInfoVO && userInfo.userVipInfoVO.vipIcon) {//icon
[self.nobleIconImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(20);
}];
[self.nickLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nobleIconImageView.mas_right).mas_offset(2);
}];
}
NSString * nick = userInfo.nick;
if (nick.length > 10) {
nick = [NSString stringWithFormat:@"%@…", [nick substringToIndex:10]];
@@ -946,6 +964,17 @@
return _charmImageView;
}
- (NetImageView *)nobleIconImageView {
if (!_nobleIconImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
config.imageType = ImageTypeUserCardLevel;
_nobleIconImageView = [[NetImageView alloc] initWithConfig:config];
_nobleIconImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _nobleIconImageView;
}
- (UIView *)namePlateView {
if (!_namePlateView) {
_namePlateView = [[UIView alloc] init];