YOUPAIHRGuildCenterDetailCell.m 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. //
  2. // YOUPAIHRGuildCenterDetailCell.m
  3. // VQU
  4. //
  5. // Created by xiaohaoran on 2021/11/4.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIHRGuildCenterDetailCell.h"
  9. #import "YOUPAILZLevelView.h"
  10. @interface YOUPAIHRGuildCenterDetailCell ()
  11. @property(nonatomic,strong)UIImageView *youpaipavatarImgV;
  12. @property(nonatomic,strong)UILabel * youpaipnicknameL;
  13. @property(nonatomic,strong)UIImageView *youpaipvipV;
  14. @property(nonatomic,strong)UIImageView *youpaipbadgeImgV;
  15. @property(nonatomic,strong)YOUPAILZLevelView *youpaiplevelView;
  16. @property(nonatomic,strong)UILabel *youpaipnearLabel;
  17. @property(nonatomic,strong)UILabel *youpaiptimeLabel;
  18. @property(nonatomic,strong)UILabel *youpaipIDLabel;
  19. @property(nonatomic,strong)UILabel *youpaiphuizhangLabel;
  20. @end
  21. @implementation YOUPAIHRGuildCenterDetailCell
  22. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  23. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  24. [self youpaifsetSubView];
  25. }
  26. return self;
  27. }
  28. -(void)youpaifsetSubView{
  29. //头像
  30. UIImageView *youpaipavatarImgV = [[UIImageView alloc]init];
  31. [self.contentView addSubview:youpaipavatarImgV];
  32. self.youpaipavatarImgV = youpaipavatarImgV;
  33. [youpaipavatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.left.offset(14.0f);
  35. make.centerY.mas_equalTo(0);
  36. make.size.mas_equalTo(CGSizeMake(40, 40));;
  37. }];
  38. youpaipavatarImgV.layer.cornerRadius = 20;
  39. youpaipavatarImgV.layer.masksToBounds = YES;
  40. //V
  41. youpaipavatarImgV.userInteractionEnabled = YES;
  42. //会长
  43. UILabel *youpaiphuizhangLabel = [UILabel new];
  44. self.youpaiphuizhangLabel = youpaiphuizhangLabel;
  45. [self.contentView addSubview:youpaiphuizhangLabel];
  46. [youpaiphuizhangLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.left.mas_equalTo(youpaipavatarImgV.mas_right).offset(8);
  48. make.top.mas_equalTo(youpaipavatarImgV).offset(3);
  49. make.size.mas_equalTo(CGSizeMake(32, 15));
  50. }];
  51. youpaiphuizhangLabel.textColor = [UIColor whiteColor];
  52. youpaiphuizhangLabel.text = @"会长";
  53. youpaiphuizhangLabel.font = [UIFont systemFontOfSize:10];
  54. youpaiphuizhangLabel.textAlignment = NSTextAlignmentCenter;
  55. youpaiphuizhangLabel.backgroundColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(32, 15) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1]];
  56. youpaiphuizhangLabel.layer.cornerRadius = 7.5;
  57. youpaiphuizhangLabel.layer.masksToBounds = YES;
  58. youpaiphuizhangLabel.hidden = YES;
  59. //昵称
  60. UILabel *youpaipnicknameL = [[UILabel alloc] init];
  61. youpaipnicknameL.font = LCBoldFont(14);
  62. youpaipnicknameL.textColor = [UIColor whiteColor];
  63. [self.contentView addSubview:youpaipnicknameL];
  64. self.youpaipnicknameL = youpaipnicknameL;
  65. [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.left.equalTo(youpaiphuizhangLabel.mas_right).offset(4.0f);
  67. make.top.offset(10);
  68. make.height.offset(24.5f);
  69. }];
  70. //Vip
  71. UIImageView *youpaipvipV = [[UIImageView alloc] init];
  72. [self addSubview:youpaipvipV];
  73. self.youpaipvipV = youpaipvipV;
  74. [youpaipvipV mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  76. make.centerY.equalTo(youpaipnicknameL);
  77. }];
  78. UIImageView *youpaipbadgeImgV = [[UIImageView alloc] init];
  79. [self addSubview:youpaipbadgeImgV];
  80. self.youpaipbadgeImgV = youpaipbadgeImgV;
  81. [youpaipbadgeImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.left.equalTo(youpaipvipV.mas_right).offset(3.0f);
  83. make.centerY.equalTo(youpaipnicknameL);
  84. }];
  85. //等级
  86. UIImageView *leveImgV = [[UIImageView alloc] init];
  87. [self addSubview:leveImgV];
  88. [leveImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  89. make.left.equalTo(youpaipbadgeImgV.mas_right).offset(3.0f);
  90. make.centerY.equalTo(youpaipnicknameL);
  91. }];
  92. // YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init];
  93. // [self addSubview:youpaiplevelView];
  94. // self.youpaiplevelView = youpaiplevelView;
  95. // youpaiplevelView.hidden = YES;
  96. // [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) {
  97. // make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  98. // make.centerY.equalTo(youpaipnicknameL);
  99. // }];
  100. //年份月份
  101. UILabel *youpaipnearLabel = [UILabel new];
  102. self.youpaipnearLabel = youpaipnearLabel;
  103. [self.contentView addSubview:youpaipnearLabel];
  104. [youpaipnearLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  105. make.right.mas_equalTo(-14);
  106. make.top.mas_equalTo(16.5);
  107. }];
  108. youpaipnearLabel.textColor = HexColorFromRGB(0x9F9DA5);
  109. youpaipnearLabel.font = [UIFont systemFontOfSize:11];
  110. //时分秒
  111. UILabel *youpaiptimeLabel = [UILabel new];
  112. self.youpaiptimeLabel = youpaiptimeLabel;
  113. [self.contentView addSubview:youpaiptimeLabel];
  114. [youpaiptimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  115. make.right.mas_equalTo(youpaipnearLabel);
  116. make.top.mas_equalTo(youpaipnearLabel.mas_bottom).offset(12);
  117. }];
  118. youpaiptimeLabel.textColor = HexColorFromRGB(0x9F9DA5);
  119. youpaiptimeLabel.font = [UIFont systemFontOfSize:11];
  120. //id
  121. UILabel *youpaipIDLabel = [UILabel new];
  122. self.youpaipIDLabel = youpaipIDLabel;
  123. [self.contentView addSubview:youpaipIDLabel];
  124. [youpaipIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  125. make.left.mas_equalTo(youpaipavatarImgV.mas_right).offset(8);
  126. make.top.mas_equalTo(youpaipnicknameL.mas_bottom).offset(6);
  127. }];
  128. youpaipIDLabel.textColor = HexColorFromRGB(0x9F9DA5);
  129. youpaipIDLabel.font = [UIFont systemFontOfSize:12];
  130. //分割线
  131. UIView *lineView = [UIView new];
  132. [self.contentView addSubview:lineView];
  133. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  134. make.left.mas_equalTo(14);
  135. make.right.mas_equalTo(-14);
  136. make.bottom.mas_equalTo(0);
  137. make.height.mas_equalTo(0.5);
  138. }];
  139. lineView.backgroundColor = HexColorFromRGB(0x28262D);
  140. }
  141. -(void)setYoupaipmodel:(GuildMemberList *)youpaipmodel{
  142. _youpaipmodel = youpaipmodel;
  143. [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.avatar] placeholderImage:nil];
  144. self.youpaipnicknameL.text = youpaipmodel.nickname;
  145. self.youpaipIDLabel.text = [NSString stringWithFormat:@"花舞号:%@",youpaipmodel.usercode];
  146. self.youpaipnearLabel.text = youpaipmodel.update_date;
  147. self.youpaiptimeLabel.text = youpaipmodel.update_time;
  148. CGFloat width = 0;
  149. if (youpaipmodel.nickname.length>5) {
  150. NSString *str = [youpaipmodel.nickname substringToIndex:5];
  151. width = [LCTools widthWithString:str withFont:LCBoldFont(14)]+5;
  152. }else{
  153. width = [LCTools widthWithString:youpaipmodel.nickname withFont:LCBoldFont(14)]+5;
  154. }
  155. self.youpaiphuizhangLabel.hidden = YES;
  156. if (youpaipmodel.isHuiZ) {
  157. self.youpaiphuizhangLabel.hidden = NO;
  158. [self.youpaipnicknameL mas_remakeConstraints:^(MASConstraintMaker *make) {
  159. make.left.equalTo(self.youpaiphuizhangLabel.mas_right).offset(4.0f);
  160. make.top.offset(10);
  161. make.height.offset(24.5f);
  162. }];
  163. }else{
  164. [self.youpaipnicknameL mas_remakeConstraints:^(MASConstraintMaker *make) {
  165. make.left.equalTo(self.youpaipavatarImgV.mas_right).offset(8.0f);
  166. make.top.offset(10);
  167. make.height.offset(24.5f);
  168. }];
  169. }
  170. UIView *frontV;
  171. self.youpaiplevelView.hidden = NO;
  172. [self.youpaiplevelView youpaifreloadWithIcon:youpaipmodel.grade.youpaipimg1 iconWidth:youpaipmodel.grade.youpaipicon_width bgImg:youpaipmodel.grade.youpaipimg2 bgImgWidth:youpaipmodel.grade.youpaipicon1_width levelName:youpaipmodel.grade.youpaipgrade_name level:youpaipmodel.grade.youpaipgrade];
  173. [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
  174. if (frontV == nil) {
  175. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  176. }else{
  177. make.left.equalTo(frontV.mas_right).offset(3.0f);
  178. }
  179. make.centerY.equalTo(self.youpaipnicknameL);
  180. make.size.mas_offset(self.youpaiplevelView.mj_size);
  181. }];
  182. frontV = self.youpaiplevelView;
  183. if (self.youpaipmodel.vip_icon.length != 0) {
  184. self.youpaipvipV.hidden = NO;
  185. [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipmodel.vip_icon]];
  186. [self.youpaipvipV mas_remakeConstraints:^(MASConstraintMaker *make) {
  187. if (frontV == nil) {
  188. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  189. }else{
  190. make.left.equalTo(frontV.mas_right).offset(3.0f);
  191. }
  192. make.centerY.equalTo(self.youpaipnicknameL);
  193. make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  194. }];
  195. frontV = self.youpaipvipV;
  196. }
  197. if (self.youpaipmodel.rankInfo.youpaipimg.length != 0) {
  198. self.youpaipbadgeImgV.hidden = NO;
  199. [self.youpaipbadgeImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipmodel.rankInfo.youpaipimg]];
  200. [self.youpaipbadgeImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
  201. if (frontV == nil) {
  202. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  203. }else{
  204. make.left.equalTo(frontV.mas_right).offset(3.0f);
  205. }
  206. make.centerY.equalTo(self.youpaipnicknameL);
  207. make.size.mas_offset(CGSizeMake(20, 17.0f));
  208. }];
  209. }
  210. }
  211. @end