YOUPAILZChatRoomUpSeatApplyCell.m 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. //
  2. // YOUPAILZChatRoomUpSeatApplyCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/11/6.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZChatRoomUpSeatApplyCell.h"
  9. #import "YOUPAILZAvatarView.h"
  10. #import "YOUPAILZLevelView.h"
  11. @interface YOUPAILZChatRoomUpSeatApplyCell ()
  12. @property (nonatomic, weak) UILabel *youpaiprankL; /// 排名
  13. @property (nonatomic, weak) YOUPAILZAvatarView *youpaipavatarView; // 头像
  14. @property (nonatomic, weak) UILabel *youpaipnicknameL; // 昵称
  15. //@property (nonatomic, weak) UIImageView *youpaipvipImgV; // 贵族
  16. //@property (nonatomic, weak) UIImageView *youpaipboardImgV; // 榜单
  17. //@property (nonatomic, weak) YOUPAILZLevelView *youpaiplevelView; // 等级
  18. @property (nonatomic, weak) UILabel *youpaipcontributionL; // 贡献值
  19. @property (nonatomic, weak) UIButton *youpaipupseatBtn; // 抱上麦
  20. @property (nonatomic, weak) UIButton *youpaipignoreBtn; // 忽略
  21. @property (nonatomic, strong) YOUPAILZChatRoomMemberModel *youpaipmodel;
  22. @property (nonatomic, assign) NSInteger youpaipindex;
  23. @end
  24. @implementation YOUPAILZChatRoomUpSeatApplyCell
  25. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  26. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  27. self.selectionStyle = UITableViewCellSelectionStyleNone;
  28. self.backgroundColor = [UIColor clearColor];
  29. [self youpaifinitUI];
  30. }
  31. return self;
  32. }
  33. - (void)youpaifinitUI{
  34. UILabel *youpaiprankL = [[UILabel alloc] init];
  35. youpaiprankL.textColor = HexColorFromRGB(0x9F9DA5);
  36. youpaiprankL.textAlignment = NSTextAlignmentCenter;
  37. youpaiprankL.font = LCBoldFont(12.0f);
  38. [self.contentView addSubview:youpaiprankL];
  39. self.youpaiprankL = youpaiprankL;
  40. [youpaiprankL mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.left.offset(7.0f);
  42. make.centerY.equalTo(self.centerY);
  43. make.size.mas_offset(CGSizeMake(38.0f, 28.0f));
  44. }];
  45. YOUPAILZAvatarView *youpaipavatarView = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0, 0, 40, 40) avatarURL:nil personalityBoxURL:nil];
  46. [self.contentView addSubview:youpaipavatarView];
  47. self.youpaipavatarView = youpaipavatarView;
  48. [youpaipavatarView mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.left.offset(52.0f);
  50. make.centerY.equalTo(self.contentView.mas_centerY);
  51. make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
  52. }];
  53. UILabel *youpaipnicknameL = [[UILabel alloc] init];
  54. youpaipnicknameL.font = LCBoldFont(14.0f);
  55. youpaipnicknameL.textColor = [UIColor whiteColor];
  56. [self.contentView addSubview:youpaipnicknameL];
  57. self.youpaipnicknameL = youpaipnicknameL;
  58. [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
  60. make.top.offset(15.0f);
  61. }];
  62. // UIImageView *youpaipvipImgV = [[UIImageView alloc] init];
  63. // [self.contentView addSubview:youpaipvipImgV];
  64. // self.youpaipvipImgV = youpaipvipImgV;
  65. // [youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  66. // make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  67. // make.centerY.equalTo(youpaipnicknameL);
  68. // }];
  69. //
  70. // UIImageView *youpaipboardImgV = [[UIImageView alloc] init];
  71. // [self.contentView addSubview:youpaipboardImgV];
  72. // self.youpaipboardImgV = youpaipboardImgV;
  73. // [youpaipboardImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  74. // make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  75. // make.centerY.equalTo(youpaipnicknameL);
  76. // }];
  77. //
  78. // YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init];
  79. // [self.contentView addSubview:youpaiplevelView];
  80. // self.youpaiplevelView = youpaiplevelView;
  81. // [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) {
  82. // make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  83. // make.centerY.equalTo(youpaipnicknameL);
  84. // }];
  85. UILabel *youpaipcontributionL = [[UILabel alloc] init];
  86. youpaipcontributionL.font = LCFont(10.0f);
  87. youpaipcontributionL.textColor = [UIColor whiteColor];
  88. [self.contentView addSubview:youpaipcontributionL];
  89. self.youpaipcontributionL = youpaipcontributionL;
  90. [youpaipcontributionL mas_makeConstraints:^(MASConstraintMaker *make) {
  91. make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
  92. make.top.equalTo(youpaipnicknameL.mas_bottom).offset(5.0f);
  93. }];
  94. UIButton *youpaipignoreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  95. youpaipignoreBtn.layer.cornerRadius = 11.0f;
  96. youpaipignoreBtn.clipsToBounds = YES;
  97. [youpaipignoreBtn setTitle:@"忽略" forState:UIControlStateNormal];
  98. [youpaipignoreBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  99. [youpaipignoreBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56.0f, 22.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
  100. youpaipignoreBtn.titleLabel.font = LCFont12;
  101. [youpaipignoreBtn addTarget:self action:@selector(youpaifignoreBtnClick) forControlEvents:UIControlEventTouchUpInside];
  102. [self.contentView addSubview:youpaipignoreBtn];
  103. self.youpaipignoreBtn = youpaipignoreBtn;
  104. [youpaipignoreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  105. make.centerY.equalTo(self.contentView);
  106. make.right.offset(-14.0f);
  107. make.size.mas_offset(CGSizeMake(56.0f, 22.0f));
  108. }];
  109. UIButton *youpaipupseatBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  110. youpaipupseatBtn.layer.cornerRadius = 11.0f;
  111. youpaipupseatBtn.clipsToBounds = YES;
  112. [youpaipupseatBtn setTitle:@"抱上麦" forState:UIControlStateNormal];
  113. [youpaipupseatBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  114. [youpaipupseatBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56.0f, 22.0f) FromColors:@[HexColorFromRGB(0xFFC551),HexColorFromRGB(0xFF4004)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
  115. youpaipupseatBtn.titleLabel.font = LCFont12;
  116. [youpaipupseatBtn addTarget:self action:@selector(youpaifupseatBtnClick) forControlEvents:UIControlEventTouchUpInside];
  117. [self.contentView addSubview:youpaipupseatBtn];
  118. self.youpaipupseatBtn = youpaipupseatBtn;
  119. [youpaipupseatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  120. make.centerY.equalTo(self.contentView);
  121. make.right.equalTo(youpaipignoreBtn.mas_left).offset(-10.0f);
  122. make.size.mas_offset(CGSizeMake(56.0f, 22.0f));
  123. }];
  124. }
  125. - (void)youpaifreloadWithModel:(YOUPAILZChatRoomMemberModel *)model index:(NSInteger)index playType:(NSInteger)playType{
  126. self.youpaipmodel = model;
  127. self.youpaipindex = index;
  128. self.youpaiprankL.text = [NSString stringWithFormat:@"%@",@(index + 1)];
  129. self.youpaipavatarView.youpaipavatarURL = [LCTools getImageUrlWithAddress:model.youpaipavatar];
  130. self.youpaipavatarView.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:model.youpaipavatar_frame];
  131. self.youpaipnicknameL.text = model.youpaipnickname;
  132. if (playType == 2) {
  133. [self.youpaipupseatBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56.0f, 22.0f) FromColors:@[HexColorFromRGB(0xFF7FDA),HexColorFromRGB(0xFF48B3)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
  134. }else{
  135. [self.youpaipupseatBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56.0f, 22.0f) FromColors:@[HexColorFromRGB(0xFFC551),HexColorFromRGB(0xFF4004)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
  136. }
  137. // self.youpaipvipImgV.hidden = YES;
  138. // self.youpaipboardImgV.hidden = YES;
  139. // self.youpaiplevelView.hidden = YES;
  140. //
  141. // UIView *frontV;
  142. //
  143. // if (model.vip_icon.length != 0) {
  144. // self.youpaipvipImgV.hidden = NO;
  145. // [self.youpaipvipImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.vip_icon]];
  146. // [self.youpaipvipImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
  147. // if (frontV == nil) {
  148. // make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  149. // }else{
  150. // make.left.equalTo(frontV.mas_right).offset(3.0f);
  151. // }
  152. // make.centerY.equalTo(self.youpaipnicknameL);
  153. // make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  154. // }];
  155. // frontV = self.youpaipvipImgV;
  156. // }
  157. //
  158. // if (model.rankInfo.img.length != 0) {
  159. // self.youpaipboardImgV.hidden = NO;
  160. // [self.youpaipboardImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.rankInfo.img]];
  161. // [self.youpaipboardImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
  162. // if (frontV == nil) {
  163. // make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  164. // }else{
  165. // make.left.equalTo(frontV.mas_right).offset(3.0f);
  166. // }
  167. // make.centerY.equalTo(self.youpaipnicknameL);
  168. // make.size.mas_offset(CGSizeMake(21.0f, 18.0f));
  169. // }];
  170. // frontV = self.youpaipboardImgV;
  171. // }
  172. //
  173. // self.youpaiplevelView.hidden = NO;
  174. // [self.youpaiplevelView youpaifreloadWithIcon:model.grade.img1 iconWidth:model.grade.icon_width bgImg:model.grade.img2 bgImgWidth:model.grade.icon1_width levelName:model.grade.grade_name level:model.grade.grade];
  175. // [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
  176. // if (frontV == nil) {
  177. // make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  178. // }else{
  179. // make.left.equalTo(frontV.mas_right).offset(3.0f);
  180. // }
  181. // make.centerY.equalTo(self.youpaipnicknameL);
  182. // make.size.mas_offset(self.youpaiplevelView.mj_size);
  183. // }];
  184. self.youpaipcontributionL.attributedText = [LCTools setRichTextWithTitle:@"贡献值:" subTitle:[NSString stringWithFormat:@"%@",model.youpaipscore] titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFDD8D) titleFontSize:10.0f subTitleFontSize:10.0f];
  185. }
  186. - (void)youpaifignoreBtnClick{
  187. if (self.youpaipignoreBtnClickBlock != nil) {
  188. self.youpaipignoreBtnClickBlock(self.youpaipmodel,self.youpaipindex);
  189. }
  190. }
  191. - (void)youpaifupseatBtnClick{
  192. if (self.youpaipupseatBtnClickBlock != nil) {
  193. self.youpaipupseatBtnClickBlock(self.youpaipmodel,self.youpaipindex);
  194. }
  195. }
  196. @end