MOInviteTableViewCell.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // MOInviteTableViewCell.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2024/8/8.
  6. //
  7. #import "MOInviteTableViewCell.h"
  8. @implementation MOInviteTableViewCell
  9. - (void)awakeFromNib {
  10. [super awakeFromNib];
  11. // Initialization code
  12. self.backgroundColor = [UIColor clearColor];
  13. self.selectionStyle = UITableViewCellSelectionStyleNone;
  14. // [self.inviteBtn setTitle:NSLocalString(@"mimo_voice_invite_invited") forState:UIControlStateSelected];
  15. self.headImgView.layer.cornerRadius = 46.0 / 2.0;
  16. self.headImgView.layer.masksToBounds = YES;
  17. [self.contentView addSubview:self.headImgView];
  18. [self.headImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  19. make.centerX.equalTo(self.headImgView);
  20. make.centerY.equalTo(self.headImgView);
  21. make.width.height.equalTo(@46.0);
  22. }];
  23. self.headBgView.headImgWidth = 46.0;
  24. self.startView.viewHeight = MOStarNumViewNormalHeight;
  25. CGFloat startWidth = [self.startView getTheViewWidth];
  26. [self.contentView addSubview:self.startView];
  27. [self.startView mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.centerY.equalTo(self.idLab.mas_centerY).offset(-3);
  29. make.left.equalTo(self.idLab.mas_left).offset(-10.0);
  30. make.height.equalTo(@(MOStarNumViewNormalHeight));
  31. make.width.equalTo(@(startWidth));
  32. }];
  33. [self.inviteBtn setFont:[MOTextTools getTheFontWithSize:14.0 AndFontName:kNormalContentFontStr]];
  34. self.nameLab.font = [MOTextTools getTheFontWithSize:14.0 AndFontName:kNormalContentFontStr];
  35. self.idLab.font = [MOTextTools getTheFontWithSize:14.0 AndFontName:kNormalContentFontStr];
  36. }
  37. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  38. [super setSelected:selected animated:animated];
  39. // Configure the view for the selected state
  40. }
  41. - (void)setCellModel:(MOPkUserList *)cellModel{
  42. _cellModel = cellModel;
  43. [self.headImgView sd_setImageWithURL:[NSURL URLWithString:cellModel.userProfile.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  44. self.nameLab.text = cellModel.userProfile.nickname;
  45. self.idLab.text = [NSString stringWithFormat:@"ID %@",cellModel.userProfile.userNo];
  46. self.startView.idNumStr = [NSString stringWithFormat:@"%@",cellModel.userProfile.userNo];
  47. self.startView.levelNum = (NSInteger)cellModel.userProfile.beautifulLevel;
  48. if(cellModel.userProfile.beautifulLevel == 0){
  49. self.idLab.hidden = NO;
  50. self.startView.hidden = YES;
  51. }
  52. else{
  53. self.idLab.hidden = YES;
  54. self.startView.hidden = NO;
  55. }
  56. if(cellModel.isSelect){
  57. self.inviteBtn.selected = YES;
  58. }
  59. else{
  60. self.inviteBtn.selected = NO;
  61. }
  62. if(cellModel.userProfile.adornment.headgearRes.length > 0){
  63. self.headBgView.hidden = NO;
  64. self.headBgView.isLiving = NO;
  65. self.headBgView.effectType = cellModel.userProfile.adornment.headgearType;
  66. self.headBgView.imgUrlStr = cellModel.userProfile.adornment.headgearRes;
  67. }
  68. else{
  69. self.headBgView.hidden = YES;
  70. }
  71. }
  72. - (IBAction)inviteBtnClick:(id)sender {
  73. //邀请上麦的RTM
  74. if(self.inviteBtn.selected == YES){
  75. return;
  76. }
  77. self.inviteActionBlock ? self.inviteActionBlock(self.cellModel) : nil;
  78. MOUserProfile *profile = [[MOUserProfile alloc] init];
  79. profile.id = self.cellModel.userProfile.id;
  80. MOLinkMic *linkMic = [[MOLinkMic alloc] init];
  81. linkMic.profile = profile;
  82. linkMic.invite = self.cellModel.invite;
  83. linkMic.camera = self.camera;
  84. MORtmEntity *entity = [MORtmEntity prepareRtmManageAgreeLianMaiMessageAndLinkMicType:3 AndStatus:6 AndRoomId:self.roomId AndMOLinkMic:linkMic AndSeatNum:1];
  85. NSString *entityJsomString = entity.modelToJSONString;
  86. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  87. if(isSuccess){
  88. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_voice_hud_normal_tip_host_11")];
  89. }
  90. }];
  91. }
  92. - (MOHeadCustomView *)headBgView{
  93. if(!_headBgView){
  94. _headBgView = [[MOHeadCustomView alloc] init];
  95. }
  96. return _headBgView;
  97. }
  98. - (MOStarNumView *)startView{
  99. if(!_startView){
  100. _startView = [[MOStarNumView alloc] init];
  101. }
  102. return _startView;
  103. }
  104. @end