YOUPAILZChatRoomCurrentMemberView.m 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. //
  2. // YOUPAILZChatRoomCurrentMemberView.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/11/8.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZChatRoomCurrentMemberView.h"
  9. @implementation YOUPAILZChatRoomCurrentMemberView
  10. - (instancetype)init{
  11. if (self = [super init]) {
  12. [self youpaifinitUI];
  13. }
  14. return self;
  15. }
  16. - (void)youpaifinitUI{
  17. UILabel *youpaiprankL = [[UILabel alloc] init];
  18. youpaiprankL.textColor = [UIColor whiteColor];
  19. youpaiprankL.textAlignment = NSTextAlignmentCenter;
  20. youpaiprankL.font = LCFont14;
  21. youpaiprankL.numberOfLines = 2;
  22. [self addSubview:youpaiprankL];
  23. self.youpaiprankL = youpaiprankL;
  24. [youpaiprankL mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.offset(7.0f);
  26. make.top.offset(11.0f);
  27. make.size.mas_offset(CGSizeMake(38.0f, 38.0f));
  28. }];
  29. YOUPAILZAvatarView *youpaipavatarView = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0, 0, 40, 40) avatarURL:nil personalityBoxURL:nil];
  30. [self addSubview:youpaipavatarView];
  31. self.youpaipavatarView = youpaipavatarView;
  32. [youpaipavatarView mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.left.offset(52.0f);
  34. make.top.offset(10.0f);
  35. make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
  36. }];
  37. UILabel *youpaipnicknameL = [[UILabel alloc] init];
  38. youpaipnicknameL.font = LCBoldFont(14.0f);
  39. youpaipnicknameL.textColor = [UIColor whiteColor];
  40. [self addSubview:youpaipnicknameL];
  41. self.youpaipnicknameL = youpaipnicknameL;
  42. [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
  44. make.top.offset(15.0f);
  45. }];
  46. UIImageView *youpaipvipImgV = [[UIImageView alloc] init];
  47. [self addSubview:youpaipvipImgV];
  48. self.youpaipvipImgV = youpaipvipImgV;
  49. [youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  51. make.centerY.equalTo(youpaipnicknameL);
  52. }];
  53. UIImageView *youpaipboardImgV = [[UIImageView alloc] init];
  54. [self addSubview:youpaipboardImgV];
  55. self.youpaipboardImgV = youpaipboardImgV;
  56. [youpaipboardImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  58. make.centerY.equalTo(youpaipnicknameL);
  59. }];
  60. YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init];
  61. [self addSubview:youpaiplevelView];
  62. self.youpaiplevelView = youpaiplevelView;
  63. [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  65. make.centerY.equalTo(youpaipnicknameL);
  66. }];
  67. UILabel *youpaipcontributionL = [[UILabel alloc] init];
  68. youpaipcontributionL.font = LCFont(10.0f);
  69. youpaipcontributionL.textColor = [UIColor whiteColor];
  70. [self addSubview:youpaipcontributionL];
  71. self.youpaipcontributionL = youpaipcontributionL;
  72. [youpaipcontributionL mas_makeConstraints:^(MASConstraintMaker *make) {
  73. make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
  74. make.top.equalTo(youpaipnicknameL.mas_bottom).offset(2.0f);
  75. }];
  76. UILabel *youpaiplastDifferenceL = [[UILabel alloc] init];
  77. youpaiplastDifferenceL.font = LCFont(12.0f);
  78. youpaiplastDifferenceL.textColor = [UIColor whiteColor];
  79. youpaiplastDifferenceL.numberOfLines = 0;
  80. youpaiplastDifferenceL.textAlignment = NSTextAlignmentCenter;
  81. [self addSubview:youpaiplastDifferenceL];
  82. self.youpaiplastDifferenceL = youpaiplastDifferenceL;
  83. [youpaiplastDifferenceL mas_makeConstraints:^(MASConstraintMaker *make) {
  84. make.right.offset(-12.0f);
  85. make.centerY.equalTo(youpaipavatarView);
  86. }];
  87. }
  88. - (void)youpaifreloadWithModel:(YOUPAILZChatRoomMemberModel *)member contributionName:(NSString *)contributionName{
  89. self.youpaiprankL.text = member.youpaiprank;
  90. self.youpaipavatarView.youpaipavatarURL = [LCTools getImageUrlWithAddress:member.youpaipavatar];
  91. self.youpaipavatarView.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:member.youpaipavatar_frame];
  92. self.youpaipnicknameL.text = member.youpaipnickname;
  93. self.youpaipvipImgV.hidden = YES;
  94. self.youpaipboardImgV.hidden = YES;
  95. self.youpaiplevelView.hidden = YES;
  96. UIView *frontV;
  97. if (member.youpaipvip_icon.length != 0) {
  98. self.youpaipvipImgV.hidden = NO;
  99. [self.youpaipvipImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:member.youpaipvip_icon]];
  100. [self.youpaipvipImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
  101. if (frontV == nil) {
  102. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  103. }else{
  104. make.left.equalTo(frontV.mas_right).offset(3.0f);
  105. }
  106. make.centerY.equalTo(self.youpaipnicknameL);
  107. make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  108. }];
  109. frontV = self.youpaipvipImgV;
  110. }
  111. if (member.youpaiprankInfo.youpaipimg.length != 0) {
  112. self.youpaipboardImgV.hidden = NO;
  113. [self.youpaipboardImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:member.youpaiprankInfo.youpaipimg]];
  114. [self.youpaipboardImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
  115. if (frontV == nil) {
  116. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  117. }else{
  118. make.left.equalTo(frontV.mas_right).offset(3.0f);
  119. }
  120. make.centerY.equalTo(self.youpaipnicknameL);
  121. make.size.mas_offset(CGSizeMake(21.0f, 18.0f));
  122. }];
  123. frontV = self.youpaipboardImgV;
  124. }
  125. self.youpaiplevelView.hidden = NO;
  126. [self.youpaiplevelView youpaifreloadWithIcon:member.youpaipgrade.youpaipimg1 iconWidth:member.youpaipgrade.youpaipicon_width bgImg:member.youpaipgrade.youpaipimg2 bgImgWidth:member.youpaipgrade.youpaipicon1_width levelName:member.youpaipgrade.youpaipgrade_name level:member.youpaipgrade.youpaipgrade];
  127. [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
  128. if (frontV == nil) {
  129. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  130. }else{
  131. make.left.equalTo(frontV.mas_right).offset(3.0f);
  132. }
  133. make.centerY.equalTo(self.youpaipnicknameL);
  134. make.size.mas_offset(self.youpaiplevelView.mj_size);
  135. }];
  136. self.youpaipcontributionL.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%@:",contributionName] subTitle:[NSString stringWithFormat:@"%@",member.youpaipscore] titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:10.0f subTitleFontSize:12.0f];
  137. self.youpaiplastDifferenceL.text = member.youpaipgapMoney;
  138. }
  139. @end