// // YOUPAIHRChatRoomManageCell.m // VQU // // Created by xiaohaoran on 2021/11/8. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIHRChatRoomManageCell.h" #import "YOUPAIHROperationRecordVC.h" #import "YOUPAIHRChatRoomEditInfoVC.h" #import "YOUPAIHRPersonnelManagementVC.h" @interface YOUPAIHRChatRoomManageCell () @property(nonatomic,strong)UIButton *youpaipmyHomeBtn; @property(nonatomic,strong)UIImageView *youpaipavtarImageView; @property(nonatomic,strong)UILabel *youpaipnickLabel; @property(nonatomic,strong)UILabel *youpaipidLabel; @property(nonatomic,strong)UIImageView *youpaiproomImageView; @property(nonatomic,strong)UILabel *youpaiproomNickLabel; @property(nonatomic,strong)UIButton *youpaipthreeIconBtn; @property(nonatomic,strong)UIButton *youpaipthreeIconBtn2; @property(nonatomic,strong)UIButton *youpaipthreeIconBtn3; @property(nonatomic,strong)UIImageView *youpaiprightImageView; @end @implementation YOUPAIHRChatRoomManageCell -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self youpaifsetSubView]; } return self; } -(void)youpaifsetSubView{ //头像 UIImageView *youpaipavtarImageView = [UIImageView new]; self.youpaipavtarImageView = youpaipavtarImageView; [self.contentView addSubview:youpaipavtarImageView]; [youpaipavtarImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14.5); make.centerY.mas_equalTo(0); make.size.mas_equalTo(CGSizeMake(84, 84)); }]; youpaipavtarImageView.contentMode = UIViewContentModeScaleAspectFill; youpaipavtarImageView.clipsToBounds = YES; // youpaipavtarImageView.image = [UIImage imageNamed:@"AppIcon"]; youpaipavtarImageView.layer.cornerRadius = 6; UIImageView *youpaiprightImageView = [UIImageView new]; self.youpaiprightImageView = youpaiprightImageView; [youpaipavtarImageView addSubview:youpaiprightImageView]; [youpaiprightImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(0); make.top.mas_equalTo(0); make.size.mas_equalTo(CGSizeMake(25, 25)); }]; youpaiprightImageView.contentMode = UIViewContentModeScaleAspectFill; youpaiprightImageView.clipsToBounds = YES; youpaiprightImageView.image = [UIImage imageNamed:@"vqu_images_chatroom_manager_lock"]; youpaiprightImageView.layer.cornerRadius = 6; //类型 UIButton *youpaipmyHomeBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 32, 18)]; self.youpaipmyHomeBtn = youpaipmyHomeBtn; [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerBottomRight View:youpaipmyHomeBtn size:CGSizeMake(4, 4)]; [youpaipavtarImageView addSubview:youpaipmyHomeBtn]; [youpaipmyHomeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; youpaipmyHomeBtn.titleLabel.font = [UIFont systemFontOfSize:10]; [youpaipmyHomeBtn setBackgroundColor:HexColorFromRGBA(0x000000, 0.38)]; //昵称 UILabel *youpaipnickLabel = [UILabel new]; self.youpaipnickLabel = youpaipnickLabel; [self.contentView addSubview:youpaipnickLabel]; [youpaipnickLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipavtarImageView.mas_right).offset(12); make.top.mas_equalTo(youpaipavtarImageView).offset(5); }]; youpaipnickLabel.font = LCBoldFont(16); youpaipnickLabel.textColor = [UIColor whiteColor]; //id UILabel *youpaipidLabel = [UILabel new]; self.youpaipidLabel = youpaipidLabel; [self.contentView addSubview:youpaipidLabel]; [youpaipidLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipnickLabel); make.top.mas_equalTo(youpaipnickLabel.mas_bottom).offset(10); }]; youpaipidLabel.font = [UIFont systemFontOfSize:12]; youpaipidLabel.textColor = HexColorFromRGB(0x9F9DA5); //房主头像 UIImageView *youpaiproomImageView = [UIImageView new]; self.youpaiproomImageView =youpaiproomImageView; [self.contentView addSubview:youpaiproomImageView]; [youpaiproomImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipidLabel.mas_right).offset(8); make.centerY.mas_equalTo(youpaipidLabel); make.size.mas_equalTo(CGSizeMake(16, 16)); }]; youpaiproomImageView.contentMode = UIViewContentModeScaleAspectFill; youpaiproomImageView.clipsToBounds = YES; youpaiproomImageView.layer.cornerRadius = 8; //房主昵称 UILabel *youpaiproomNickLabel = [UILabel new]; self.youpaiproomNickLabel = youpaiproomNickLabel; [self.contentView addSubview:youpaiproomNickLabel]; [youpaiproomNickLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaiproomImageView.mas_right).offset(6); make.centerY.mas_equalTo(youpaiproomImageView); }]; youpaiproomNickLabel.font = [UIFont systemFontOfSize:12]; youpaiproomNickLabel.textColor = HexColorFromRGB(0x9F9DA5); //操作记录 修改资料 人员管理 UIButton *youpaipthreeIconBtn = [UIButton new]; self.youpaipthreeIconBtn = youpaipthreeIconBtn; [self.contentView addSubview:youpaipthreeIconBtn]; [youpaipthreeIconBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipavtarImageView.mas_right).offset(12); make.top.mas_equalTo(youpaipidLabel.mas_bottom).offset(15); make.size.mas_equalTo(CGSizeMake(64, 22)); }]; youpaipthreeIconBtn.backgroundColor = HexColorFromRGB(0x4F4B5B); youpaipthreeIconBtn.contentMode = UIViewContentModeScaleAspectFill; youpaipthreeIconBtn.clipsToBounds = YES; youpaipthreeIconBtn.layer.cornerRadius = 12; [youpaipthreeIconBtn setTitle:@"操作记录" forState:UIControlStateNormal]; [youpaipthreeIconBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; youpaipthreeIconBtn.titleLabel.font = [UIFont systemFontOfSize:12]; [youpaipthreeIconBtn addTarget:self action:@selector(youpaifthreeIconBtnClick) forControlEvents:UIControlEventTouchUpInside]; youpaipthreeIconBtn.hidden = YES; UIButton *threeIconBtn2 = [UIButton new]; self.youpaipthreeIconBtn2 = threeIconBtn2; [self.contentView addSubview:threeIconBtn2]; [threeIconBtn2 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipavtarImageView.mas_right).offset(12); make.top.mas_equalTo(youpaipidLabel.mas_bottom).offset(15); make.size.mas_equalTo(CGSizeMake(64, 22)); }]; threeIconBtn2.backgroundColor = HexColorFromRGB(0x4F4B5B); threeIconBtn2.contentMode = UIViewContentModeScaleAspectFill; threeIconBtn2.clipsToBounds = YES; threeIconBtn2.layer.cornerRadius = 12; [threeIconBtn2 setTitle:@"修改资料" forState:UIControlStateNormal]; [threeIconBtn2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; threeIconBtn2.titleLabel.font = [UIFont systemFontOfSize:12]; [threeIconBtn2 addTarget:self action:@selector(youpaifthreeIconBtnChangeClick) forControlEvents:UIControlEventTouchUpInside]; threeIconBtn2.hidden = YES; UIButton *threeIconBtn3 = [UIButton new]; self.youpaipthreeIconBtn3 = threeIconBtn3; [self.contentView addSubview:threeIconBtn3]; [threeIconBtn3 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipavtarImageView.mas_right).offset(12); make.top.mas_equalTo(youpaipidLabel.mas_bottom).offset(15); make.size.mas_equalTo(CGSizeMake(64, 22)); }]; threeIconBtn3.backgroundColor = HexColorFromRGB(0x4F4B5B); threeIconBtn3.contentMode = UIViewContentModeScaleAspectFill; threeIconBtn3.clipsToBounds = YES; threeIconBtn3.layer.cornerRadius = 12; [threeIconBtn3 setTitle:@"人员管理" forState:UIControlStateNormal]; [threeIconBtn3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; threeIconBtn3.titleLabel.font = [UIFont systemFontOfSize:12]; [threeIconBtn3 addTarget:self action:@selector(youpaifthreeIconBtnManagerClick) forControlEvents:UIControlEventTouchUpInside]; threeIconBtn3.hidden = YES; //分割线 UIView *lineView = [UIView new]; [self.contentView addSubview:lineView]; [lineView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14); make.right.mas_equalTo(-14); make.bottom.mas_equalTo(0); make.height.mas_equalTo(0.5); }]; lineView.backgroundColor = HexColorFromRGB(0x28262D); } -(void)setYoupaipmodel:(YOUPAIHRChatRoomManageModel *)youpaipmodel { _youpaipmodel = youpaipmodel; [self.youpaipavtarImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipcover_img] placeholderImage:nil]; [self.youpaipmyHomeBtn setTitle:youpaipmodel.youpaipcate_name forState:UIControlStateNormal]; self.youpaipnickLabel.text = youpaipmodel.youpaiptitle; self.youpaipidLabel.text = [NSString stringWithFormat:@"ID:%ld",(long)youpaipmodel.youpaiproom_id]; [self.youpaiproomImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipavatar] placeholderImage:nil]; self.youpaiproomNickLabel.text = youpaipmodel.youpaipnickname; if (youpaipmodel.youpaippwd == 0) { self.youpaiprightImageView.hidden = YES; }else{ self.youpaiprightImageView.hidden = NO; } UIView *frontV; //修改资料权限:主持人|管理|房主=====操作记录权限:管理|房主======人员管理权限:房主 if ([youpaipmodel.youpaipidentity isEqualToString:@"homeowner"]||[youpaipmodel.youpaipidentity isEqualToString:@"manager"]) {//房间身份:homeowner=房主,host=主持,manager=管理员) self.youpaipthreeIconBtn.hidden = NO; [self.youpaipthreeIconBtn mas_remakeConstraints:^(MASConstraintMaker *make) { if (frontV == nil) { make.left.equalTo(self.youpaipavtarImageView.mas_right).offset(12); }else{ make.left.equalTo(frontV.mas_right).offset(6.0f); } make.top.mas_equalTo(self.youpaipidLabel.mas_bottom).offset(15); make.size.mas_equalTo(CGSizeMake(64, 22)); }]; frontV = self.youpaipthreeIconBtn; }else{ self.youpaipthreeIconBtn.hidden = YES; } if([youpaipmodel.youpaipidentity isEqualToString:@"homeowner"]||[youpaipmodel.youpaipidentity isEqualToString:@"manager"]||[youpaipmodel.youpaipidentity isEqualToString:@"host"]){ self.youpaipthreeIconBtn2.hidden = NO; [self.youpaipthreeIconBtn2 mas_remakeConstraints:^(MASConstraintMaker *make) { if (frontV == nil) { make.left.equalTo(self.youpaipavtarImageView.mas_right).offset(12); }else{ make.left.equalTo(frontV.mas_right).offset(6.0f); } make.top.mas_equalTo(self.youpaipidLabel.mas_bottom).offset(15); make.size.mas_equalTo(CGSizeMake(64, 22)); }]; frontV = self.youpaipthreeIconBtn2; } if ([youpaipmodel.youpaipidentity isEqualToString:@"homeowner"]){ self.youpaipthreeIconBtn3.hidden = NO; [self.youpaipthreeIconBtn3 mas_remakeConstraints:^(MASConstraintMaker *make) { if (frontV == nil) { make.left.equalTo(self.youpaipavtarImageView.mas_right).offset(12); }else{ make.left.equalTo(frontV.mas_right).offset(6.0f); } make.top.mas_equalTo(self.youpaipidLabel.mas_bottom).offset(15); make.size.mas_equalTo(CGSizeMake(64, 22)); }]; } } -(void)youpaifthreeIconBtnClick{ YOUPAIHROperationRecordVC *vc = [YOUPAIHROperationRecordVC new]; vc.youpaiproom_id = self.youpaipmodel.youpaiproom_id; [[LCTools getCurrentVC].navigationController pushViewController:vc animated:YES]; } -(void)youpaifthreeIconBtnChangeClick{ YOUPAIHRChatRoomEditInfoVC *vc = [YOUPAIHRChatRoomEditInfoVC new]; vc.youpaiproom_id = self.youpaipmodel.youpaiproom_id; [[LCTools getCurrentVC].navigationController pushViewController:vc animated:YES]; } -(void)youpaifthreeIconBtnManagerClick{ YOUPAIHRPersonnelManagementVC *vc = [YOUPAIHRPersonnelManagementVC new]; vc.youpaiproom_id = self.youpaipmodel.youpaiproom_id; [[LCTools getCurrentVC].navigationController pushViewController:vc animated:YES]; } @end