MORankListCell.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. //
  2. // MORankListCell.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/11/30.
  6. //
  7. #import "MORankListCell.h"
  8. @implementation MORankListCell
  9. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  10. {
  11. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
  12. {
  13. self.selectionStyle = UITableViewCellSelectionStyleNone;
  14. self.backgroundColor = [UIColor clearColor];
  15. [self setupUI];
  16. }
  17. return self;
  18. }
  19. - (void)setupUI{
  20. [self.contentView addSubview:self.bgView];
  21. [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  22. make.edges.equalTo(self.contentView);
  23. }];
  24. UIView *superView = self.bgView;
  25. [superView addSubview:self.numLab];
  26. [self.numLab mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.left.equalTo(superView).offset(8);
  28. make.centerY.equalTo(superView);
  29. make.height.equalTo(@30.0);
  30. make.width.equalTo(@30.0);
  31. make.width.greaterThanOrEqualTo(@13.0);
  32. }];
  33. [superView addSubview:self.numImgView];
  34. [self.numImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.edges.equalTo(self.numLab);
  36. }];
  37. [superView addSubview:self.iconImg];
  38. [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.centerY.equalTo(superView);
  40. make.width.height.equalTo(@40.0);
  41. make.left.equalTo(superView).offset(52.0);
  42. }];
  43. self.iconImg.layer.cornerRadius = 40.0 / 2.0;
  44. self.iconImg.layer.masksToBounds = YES;
  45. [superView addSubview:self.headBgView];
  46. [self.headBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.centerX.equalTo(self.iconImg);
  48. make.centerY.equalTo(self.iconImg);
  49. make.width.height.equalTo(@40.0);
  50. }];
  51. self.headBgView.headImgWidth = 40.0;
  52. [superView addSubview:self.headBtn];
  53. [self.headBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  54. make.width.height.equalTo(@40.0);
  55. make.center.equalTo(self.iconImg);
  56. }];
  57. [superView addSubview:self.nameLab];
  58. [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.left.equalTo(self.iconImg.mas_right).offset(20.0);
  60. make.top.equalTo(self.iconImg.mas_top).offset(0.0);
  61. make.height.equalTo(@19.0);
  62. make.width.greaterThanOrEqualTo(@20.0);
  63. }];
  64. [superView addSubview:self.levelImgView];
  65. [self.levelImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.left.equalTo(self.nameLab.mas_right).offset(4.0);
  67. make.centerY.equalTo(self.nameLab);
  68. make.width.equalTo(@(KLevelWidth));
  69. make.height.equalTo(@(MOLevelNormalHeight));
  70. }];
  71. [superView addSubview:self.vipImgView];
  72. [self.vipImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  73. make.left.equalTo(self.levelImgView.mas_right).offset(2.0);
  74. make.centerY.equalTo(self.levelImgView.mas_centerY);
  75. make.width.equalTo(@(MOLevelNormalHeight));
  76. make.height.equalTo(@(MOLevelNormalHeight));
  77. }];
  78. [superView addSubview:self.genderImg];
  79. [self.genderImg mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.centerY.equalTo(self.nameLab.mas_centerY);
  81. make.left.equalTo(self.nameLab.mas_right).offset(10.0);
  82. make.width.height.equalTo(@15.0);
  83. }];
  84. [superView addSubview:self.contentLab];
  85. [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
  86. make.bottom.equalTo(self.iconImg.mas_bottom).offset(-3.0);
  87. make.left.equalTo(self.iconImg.mas_right).offset(20.0);
  88. make.width.equalTo(@35.0);
  89. }];
  90. [superView addSubview:self.goldNumBtn];
  91. [self.goldNumBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  92. // make.left.equalTo(self.contentLab.mas_right).offset(0.0);
  93. make.left.equalTo(self.iconImg.mas_right).offset(16.0);
  94. make.width.equalTo(@90.0);
  95. make.height.equalTo(@18.0);
  96. make.bottom.equalTo(self.iconImg.mas_bottom);
  97. }];
  98. [superView addSubview:self.upImgView];
  99. [self.upImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  100. make.centerY.equalTo(self.contentLab.mas_centerY).offset(-1.0);
  101. make.left.equalTo(self.goldNumBtn.mas_right).offset(-5.0);
  102. make.width.equalTo(@10.0);
  103. make.height.equalTo(@12.0);
  104. }];
  105. [superView addSubview:self.followBtn];
  106. [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  107. make.right.equalTo(superView).offset(-23.0);
  108. make.width.equalTo(@60.0);
  109. make.height.equalTo(@20.0);
  110. make.centerY.equalTo(superView);
  111. }];
  112. // NSArray *colorArr = @[[MOTools colorWithHexString:@"#FF62EE" alpha:1.0],[MOTools colorWithHexString:@"#9923FF" alpha:1.0]];
  113. // UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 60.0, 24.0) Colors:colorArr GradientType:0];
  114. UIImage *image = [MOTools createImageWithColor:kBaseBtnBgColor];
  115. UIImage *grayImg = [MOTools createImageWithColor:[UIColor grayColor]];
  116. [self.followBtn setBackgroundImage:image forState:UIControlStateNormal];
  117. [self.followBtn setBackgroundImage:grayImg forState:UIControlStateSelected];
  118. self.followBtn.layer.cornerRadius = 20.0 / 2.0;
  119. self.followBtn.layer.masksToBounds = YES;
  120. }
  121. - (void)awakeFromNib {
  122. [super awakeFromNib];
  123. // Initialization code
  124. }
  125. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  126. [super setSelected:selected animated:animated];
  127. // Configure the view for the selected state
  128. }
  129. - (void)setCellModel:(MORanklist *)cellModel{
  130. _cellModel = cellModel;
  131. // CGFloat numWidth = [MOTools getWidthWithString:self.numLab.text font:[MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalContentFontStr]];
  132. // CGFloat iconLeftSpac = numWidth + 22.0 * 2.0;
  133. //
  134. // [self.iconImg mas_updateConstraints:^(MASConstraintMaker *make) {
  135. // make.left.equalTo(self.bgView).offset(iconLeftSpac);
  136. // }];
  137. [self.iconImg sd_setImageWithURL:[NSURL URLWithString:cellModel.userBase.userProfile.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  138. if(cellModel.userBase.vipType == 0){
  139. ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  140. config.shimmerStyle = ShimmerStyleNone;
  141. self.nameLab.textColor = [MOTools colorWithHexString:@"#282828" alpha:1.0];
  142. [self.nameLab startShimmerWithConfig:config];
  143. }
  144. else{
  145. // if(cellModel.userBase.vipType == 1 || cellModel.userBase.vipType == 5 || cellModel.userBase.vipType == 6){
  146. // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  147. // config.shimmerStyle = ShimmerStyleColorsFlow;
  148. // config.shimmerColorArray = VipNameColorArr_white_1;
  149. // config.shimmerSpeed = 20;
  150. // [self.nameLab startShimmerWithConfig:config];
  151. // }
  152. // else if (cellModel.userBase.vipType == 2){
  153. // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  154. // config.shimmerStyle = ShimmerStyleColorsFlow;
  155. // config.shimmerColorArray = VipNameColorArr_white_2;
  156. // config.shimmerSpeed = 20;
  157. // [self.nameLab startShimmerWithConfig:config];
  158. // }
  159. // else if (cellModel.userBase.vipType == 3){
  160. // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  161. // config.shimmerStyle = ShimmerStyleGradient;
  162. // config.shimmerColorArray = VipNameColorArr_3;
  163. // [self.nameLab startShimmerWithConfig:config];
  164. // }
  165. // else if (cellModel.userBase.vipType == 4){
  166. // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  167. // config.shimmerStyle = ShimmerStyleNone;
  168. // self.nameLab.textColor = VipNameColor_White_4;
  169. // [self.nameLab startShimmerWithConfig:config];
  170. // }
  171. }
  172. NSString *goldNumStr = [MOTextTools numberToStringWith:cellModel.total];
  173. [self.goldNumBtn setTitle:goldNumStr forState:UIControlStateNormal];
  174. if(self.typeNum == 1 || self.typeNum == 2){//直播间贡献榜 or 总贡献榜
  175. [self.goldNumBtn setImage:[UIImage imageNamed:@"icon_rank_zuan"] forState:UIControlStateNormal];
  176. }
  177. CGFloat goldNumWidth = [MOTools getWidthWithString:goldNumStr font:[UIFont systemFontOfSize:12.0]] + 30.0;
  178. if(goldNumWidth > 150.0){
  179. goldNumWidth = 150.0;
  180. }
  181. if(goldNumWidth < 30.0){
  182. goldNumWidth = 30.0;
  183. }
  184. [self.goldNumBtn mas_updateConstraints:^(MASConstraintMaker *make) {
  185. make.width.equalTo(@(goldNumWidth));
  186. }];
  187. self.genderImg.hidden = YES;
  188. if(cellModel.userBase.userProfile.gender == 1){
  189. [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_man"]];
  190. }
  191. else if (cellModel.userBase.userProfile.gender == 2){
  192. [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_woman"]];
  193. }
  194. else{
  195. self.genderImg.hidden = YES;
  196. }
  197. self.followBtn.selected = cellModel.userBase.follow;
  198. self.headBgView.hidden = YES;
  199. if(self.isShowLiving){
  200. //是否展示直播中
  201. if(cellModel.userBase.liveRoomId.length != 0){
  202. self.headBgView.hidden = NO;
  203. self.headBgView.isLiving = YES;
  204. [self.headBgView updataViewStatus];
  205. self.headBgView.imgUrlStr = @"";
  206. }
  207. // else{
  208. // if(cellModel.userBase.userProfile.adornment.headgearRes.length > 0){
  209. // self.headBgView.hidden = NO;
  210. // self.headBgView.isLiving = NO;
  211. // self.headBgView.effectType = cellModel.userBase.userProfile.adornment.headgearType;
  212. // self.headBgView.imgUrlStr = cellModel.userBase.userProfile.adornment.headgearRes;
  213. // }
  214. // else{
  215. // self.headBgView.hidden = YES;
  216. // }
  217. // }
  218. }
  219. // else{
  220. // //不展示直播中, 仅展示头像框逻辑
  221. // if(cellModel.userBase.userProfile.adornment.headgearRes.length > 0){
  222. // self.headBgView.hidden = NO;
  223. // self.headBgView.isLiving = NO;
  224. // self.headBgView.effectType = cellModel.userBase.userProfile.adornment.headgearType;
  225. // self.headBgView.imgUrlStr = cellModel.userBase.userProfile.adornment.headgearRes;
  226. // }
  227. // else{
  228. // self.headBgView.hidden = YES;
  229. // }
  230. // }
  231. self.levelImgView.levelNum = cellModel.userBase.level;
  232. if(cellModel.userBase.level >= 100){
  233. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  234. make.width.equalTo(@(MOLevelMaxWidth));
  235. }];
  236. }
  237. else{
  238. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  239. make.width.equalTo(@(MOLevelNormalWidth));
  240. }];
  241. }
  242. MOBaseVips *vipObject = [[MOSvgaSourceManage shareManager] toGetTheVipObjectWith:cellModel.userBase.vipType];
  243. if(vipObject.thumbnail.length > 0){
  244. [self.vipImgView sd_setImageWithURL:[NSURL URLWithString:vipObject.thumbnail] placeholderImage:nil];
  245. if(cellModel.userBase.remark.length > 0){
  246. self.nameLab.text = [self handleRankNameLabel:cellModel.userBase.remark vip:YES];
  247. }
  248. else{
  249. self.nameLab.text = [self handleRankNameLabel:cellModel.userBase.userProfile.nickname vip:YES];
  250. }
  251. }
  252. else{
  253. [self.vipImgView setImage:nil];
  254. if(cellModel.userBase.remark.length > 0){
  255. self.nameLab.text = [self handleRankNameLabel:cellModel.userBase.remark vip:NO];
  256. }
  257. else{
  258. self.nameLab.text = [self handleRankNameLabel:cellModel.userBase.userProfile.nickname vip:NO];
  259. }
  260. }
  261. }
  262. //设置热度数据
  263. - (void)setHeatModel:(MOHeatRankItem *)heatModel {
  264. _heatModel = heatModel;
  265. // CGFloat numWidth = [MOTools getWidthWithString:self.numLab.text font:[MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalContentFontStr]];
  266. // CGFloat iconLeftSpac = numWidth + 22.0 * 2.0;
  267. //
  268. // [self.iconImg mas_updateConstraints:^(MASConstraintMaker *make) {
  269. // make.left.equalTo(self.bgView).offset(iconLeftSpac);
  270. // }];
  271. [self.iconImg sd_setImageWithURL:[NSURL URLWithString:heatModel.user.userProfile.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  272. if(heatModel.user.vipType == 0){
  273. ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  274. config.shimmerStyle = ShimmerStyleNone;
  275. self.nameLab.textColor = [MOTools colorWithHexString:@"#282828" alpha:1.0];
  276. [self.nameLab startShimmerWithConfig:config];
  277. }
  278. else{
  279. // if(cellModel.userBase.vipType == 1 || cellModel.userBase.vipType == 5 || cellModel.userBase.vipType == 6){
  280. // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  281. // config.shimmerStyle = ShimmerStyleColorsFlow;
  282. // config.shimmerColorArray = VipNameColorArr_white_1;
  283. // config.shimmerSpeed = 20;
  284. // [self.nameLab startShimmerWithConfig:config];
  285. // }
  286. // else if (cellModel.userBase.vipType == 2){
  287. // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  288. // config.shimmerStyle = ShimmerStyleColorsFlow;
  289. // config.shimmerColorArray = VipNameColorArr_white_2;
  290. // config.shimmerSpeed = 20;
  291. // [self.nameLab startShimmerWithConfig:config];
  292. // }
  293. // else if (cellModel.userBase.vipType == 3){
  294. // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  295. // config.shimmerStyle = ShimmerStyleGradient;
  296. // config.shimmerColorArray = VipNameColorArr_3;
  297. // [self.nameLab startShimmerWithConfig:config];
  298. // }
  299. // else if (cellModel.userBase.vipType == 4){
  300. // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  301. // config.shimmerStyle = ShimmerStyleNone;
  302. // self.nameLab.textColor = VipNameColor_White_4;
  303. // [self.nameLab startShimmerWithConfig:config];
  304. // }
  305. }
  306. NSString *goldNumStr = [MOTextTools numberToStringAboutTwoWith:heatModel.heat];
  307. [self.goldNumBtn setTitle:goldNumStr forState:UIControlStateNormal];
  308. [self.goldNumBtn setImage:[UIImage imageNamed:@"icon_rank_heat"] forState:UIControlStateNormal];
  309. CGFloat goldNumWidth = [MOTools getWidthWithString:goldNumStr font:[UIFont systemFontOfSize:12.0]] + 30.0;
  310. if(goldNumWidth > 150.0){
  311. goldNumWidth = 150.0;
  312. }
  313. if(goldNumWidth < 30.0){
  314. goldNumWidth = 30.0;
  315. }
  316. [self.goldNumBtn mas_updateConstraints:^(MASConstraintMaker *make) {
  317. make.width.equalTo(@(goldNumWidth));
  318. }];
  319. self.genderImg.hidden = YES;
  320. if(heatModel.user.userProfile.gender == 1){
  321. [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_man"]];
  322. }
  323. else if (heatModel.user.userProfile.gender == 2){
  324. [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_woman"]];
  325. }
  326. else{
  327. self.genderImg.hidden = YES;
  328. }
  329. self.followBtn.selected = heatModel.user.follow;
  330. self.headBgView.hidden = YES;
  331. if(self.isShowLiving){
  332. //是否展示直播中
  333. if(heatModel.user.liveRoomId.length != 0){
  334. self.headBgView.hidden = NO;
  335. self.headBgView.isLiving = YES;
  336. [self.headBgView updataViewStatus];
  337. self.headBgView.imgUrlStr = @"";
  338. }
  339. // else{
  340. // if(heatModel.user.userProfile.adornment.headgearRes.length > 0){
  341. // self.headBgView.hidden = NO;
  342. // self.headBgView.isLiving = NO;
  343. // self.headBgView.effectType = heatModel.user.userProfile.adornment.headgearType;
  344. // self.headBgView.imgUrlStr = heatModel.user.userProfile.adornment.headgearRes;
  345. // }
  346. // else{
  347. // self.headBgView.hidden = YES;
  348. // }
  349. // }
  350. }
  351. // else{
  352. // //不展示直播中, 仅展示头像框逻辑
  353. // if(heatModel.user.userProfile.adornment.headgearRes.length > 0){
  354. // self.headBgView.hidden = NO;
  355. // self.headBgView.isLiving = NO;
  356. // self.headBgView.effectType = heatModel.user.userProfile.adornment.headgearType;
  357. // self.headBgView.imgUrlStr = heatModel.user.userProfile.adornment.headgearRes;
  358. // }
  359. // else{
  360. // self.headBgView.hidden = YES;
  361. // }
  362. // }
  363. self.levelImgView.levelNum = heatModel.user.level;
  364. if(heatModel.user.level >= 100){
  365. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  366. make.width.equalTo(@(MOLevelMaxWidth));
  367. }];
  368. }
  369. else{
  370. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  371. make.width.equalTo(@(MOLevelNormalWidth));
  372. }];
  373. }
  374. MOBaseVips *vipObject = [[MOSvgaSourceManage shareManager] toGetTheVipObjectWith:heatModel.user.vipType];
  375. if(vipObject.thumbnail.length > 0){
  376. [self.vipImgView sd_setImageWithURL:[NSURL URLWithString:vipObject.thumbnail] placeholderImage:nil];
  377. if(heatModel.user.remark.length > 0){
  378. self.nameLab.text = [self handleRankNameLabel:heatModel.user.remark vip:YES];
  379. }
  380. else{
  381. self.nameLab.text = [self handleRankNameLabel:heatModel.user.userProfile.nickname vip:YES];
  382. }
  383. }
  384. else{
  385. [self.vipImgView setImage:nil];
  386. if(heatModel.user.remark.length > 0){
  387. self.nameLab.text = [self handleRankNameLabel:heatModel.user.remark vip:NO];
  388. }
  389. else{
  390. self.nameLab.text = [self handleRankNameLabel:heatModel.user.userProfile.nickname vip:NO];
  391. }
  392. }
  393. }
  394. - (NSString *)handleRankNameLabel:(NSString *)name vip:(BOOL)vip {
  395. if (SCREENWIDTH < 400.0 || vip) {
  396. return [MOTools trimString:name maxLength:12];
  397. } else {
  398. return [MOTools trimString:name maxLength:13];
  399. }
  400. }
  401. #pragma mark - Lazy
  402. - (UIView *)bgView{
  403. if(!_bgView){
  404. _bgView = [[UIView alloc] init];
  405. _bgView.backgroundColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0];
  406. }
  407. return _bgView;
  408. }
  409. - (UIImageView *)iconImg{
  410. if (!_iconImg)
  411. {
  412. _iconImg = [[UIImageView alloc] init];
  413. _iconImg.clipsToBounds = YES;
  414. _iconImg.userInteractionEnabled = NO;
  415. _iconImg.contentMode = UIViewContentModeScaleAspectFill;
  416. [_iconImg setImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  417. }
  418. return _iconImg;
  419. }
  420. - (UILabel *)numLab{
  421. if (!_numLab)
  422. {
  423. _numLab = [[UILabel alloc] init];
  424. _numLab.text = @"0";
  425. _numLab.font = [MOTextTools poppinsBoldFont:15];
  426. _numLab.textColor = [MOTools colorWithHexString:@"#CDCFD9"];
  427. _numLab.textAlignment = NSTextAlignmentCenter;
  428. _numLab.numberOfLines = 1;
  429. }
  430. return _numLab;
  431. }
  432. - (UIImageView *)numImgView {
  433. if (!_numImgView) {
  434. _numImgView = [[UIImageView alloc] init];
  435. _numImgView.hidden = YES;
  436. }
  437. return _numImgView;
  438. }
  439. - (MOShimmerLabel *)nameLab{
  440. if (!_nameLab)
  441. {
  442. _nameLab = [[MOShimmerLabel alloc] init];
  443. _nameLab.text = @"MiMo LiveWe";
  444. _nameLab.font = [MOTextTools poppinsMediumFont:16];
  445. _nameLab.textColor = kBaseTextColor_1;
  446. _nameLab.textAlignment = NSTextAlignmentLeft;
  447. _nameLab.numberOfLines = 1;
  448. }
  449. return _nameLab;
  450. }
  451. - (UILabel *)contentLab{
  452. if (!_contentLab)
  453. {
  454. _contentLab = [[UILabel alloc] init];
  455. _contentLab.text = @"NEED";
  456. _contentLab.font = [MOTextTools getTheFontWithSize:12.0 AndFontName:kNormalContentFontStr];
  457. _contentLab.textColor = [MOTools colorWithHexString:@"#ABABAB" alpha:1.0];
  458. _contentLab.textAlignment = NSTextAlignmentLeft;
  459. _contentLab.numberOfLines = 1;
  460. _contentLab.hidden = YES;
  461. }
  462. return _contentLab;
  463. }
  464. - (UIImageView *)genderImg{
  465. if (!_genderImg)
  466. {
  467. _genderImg = [[UIImageView alloc] init];
  468. _genderImg.clipsToBounds = YES;
  469. _genderImg.userInteractionEnabled = NO;
  470. _genderImg.contentMode = UIViewContentModeScaleAspectFill;
  471. _genderImg.hidden = YES;
  472. }
  473. return _genderImg;
  474. }
  475. - (UIImageView *)upImgView{
  476. if (!_upImgView)
  477. {
  478. _upImgView = [[UIImageView alloc] init];
  479. _upImgView.clipsToBounds = YES;
  480. _upImgView.userInteractionEnabled = NO;
  481. [_upImgView setImage:[UIImage imageNamed:@"icon_live_center_lv_up"]];
  482. _upImgView.contentMode = UIViewContentModeScaleAspectFit;
  483. _upImgView.hidden = YES;
  484. }
  485. return _upImgView;
  486. }
  487. - (BigBtn *)followBtn{
  488. if (!_followBtn)
  489. {
  490. _followBtn = [BigBtn buttonWithType:UIButtonTypeCustom];
  491. [_followBtn setTitle:NSLocalString(@"mimo_room_user_info_follow") forState:UIControlStateNormal];
  492. [_followBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  493. _followBtn.titleLabel.font = [MOTextTools getTheFontWithSize:12.0 AndFontName:kNormalContentFontStr];
  494. [_followBtn addTarget:self action:@selector(followBtnClick) forControlEvents:UIControlEventTouchUpInside];
  495. _followBtn.hidden = YES;
  496. }
  497. return _followBtn;
  498. }
  499. - (UIButton *)goldNumBtn{
  500. if (!_goldNumBtn)
  501. {
  502. _goldNumBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  503. _goldNumBtn.backgroundColor = [UIColor clearColor];
  504. [_goldNumBtn setImage:[UIImage imageNamed:@"icon_rank_gold_bean"] forState:UIControlStateNormal];
  505. [_goldNumBtn setTitle:@"0" forState:UIControlStateNormal];
  506. _goldNumBtn.titleLabel.font = [MOTextTools mediumFont:12];
  507. _goldNumBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 3.0, 0, 0);
  508. [_goldNumBtn setTitleColor:[MOTools colorWithHexString:@"#5C5E66"] forState:UIControlStateNormal];
  509. _goldNumBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  510. }
  511. return _goldNumBtn;
  512. }
  513. - (void)followBtnClick{
  514. if(self.followBtn.selected){
  515. return;
  516. }
  517. else{
  518. [self followSomeOneWith:self.cellModel.userBase.userProfile.id];
  519. }
  520. }
  521. - (void)followSomeOneWith:(NSString *)targetId{
  522. WEAKSELF
  523. if(targetId.length == 0){
  524. return;
  525. }
  526. if([targetId isEqualToString:GetUserId]){
  527. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  528. return;
  529. }
  530. NSArray *targetArr = @[targetId];
  531. NSDictionary *dict;
  532. if(self.roomId.length > 0){
  533. dict = @{@"type":@"1",
  534. @"target":targetArr,
  535. @"roomId":self.roomId};
  536. }
  537. else{
  538. dict = @{@"type":@"1",
  539. @"target":targetArr};
  540. }
  541. [kHttpManager toSubmitForFollowWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  542. if(kCode_Success){
  543. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_Tip_Follow_Success")];
  544. weakSelf.followBtnBlock ? weakSelf.followBtnBlock(weakSelf.cellModel,weakSelf.cellIndexPath) : nil;
  545. }
  546. else{
  547. kShowNetError(data)
  548. }
  549. }];
  550. }
  551. - (MOHeadCustomView *)headBgView{
  552. if(!_headBgView){
  553. _headBgView = [[MOHeadCustomView alloc] init];
  554. }
  555. return _headBgView;
  556. }
  557. - (UIButton *)headBtn{
  558. if(!_headBtn){
  559. _headBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  560. _headBtn.backgroundColor = [UIColor clearColor];
  561. [_headBtn setTitle:@"" forState:UIControlStateNormal];
  562. [_headBtn addTarget:self action:@selector(headBtnClick) forControlEvents:UIControlEventTouchUpInside];
  563. }
  564. return _headBtn;
  565. }
  566. - (void)headBtnClick{
  567. if (self.cellModel) {
  568. self.headBtnBlock ? self.headBtnBlock(self.cellModel) : nil;
  569. }
  570. if (self.heatModel) {
  571. self.heatRankHeadBtnBlock ? self.heatRankHeadBtnBlock(self.heatModel) : nil;
  572. }
  573. }
  574. - (UIImageView *)vipImgView{
  575. if(!_vipImgView){
  576. _vipImgView = [[UIImageView alloc] init];
  577. _vipImgView.contentMode = UIViewContentModeScaleAspectFit;
  578. }
  579. return _vipImgView;
  580. }
  581. - (MOBaseLevelView *)levelImgView{
  582. if(!_levelImgView){
  583. _levelImgView = [[MOBaseLevelView alloc] init];
  584. }
  585. return _levelImgView;
  586. }
  587. @end