YOUPAIHRChatRoomManageCell.m 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. //
  2. // YOUPAIHRChatRoomManageCell.m
  3. // VQU
  4. //
  5. // Created by xiaohaoran on 2021/11/8.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIHRChatRoomManageCell.h"
  9. #import "YOUPAIHROperationRecordVC.h"
  10. #import "YOUPAIHRChatRoomEditInfoVC.h"
  11. #import "YOUPAIHRPersonnelManagementVC.h"
  12. @interface YOUPAIHRChatRoomManageCell ()
  13. @property(nonatomic,strong)UIButton *youpaipmyHomeBtn;
  14. @property(nonatomic,strong)UIImageView *youpaipavtarImageView;
  15. @property(nonatomic,strong)UILabel *youpaipnickLabel;
  16. @property(nonatomic,strong)UILabel *youpaipidLabel;
  17. @property(nonatomic,strong)UIImageView *youpaiproomImageView;
  18. @property(nonatomic,strong)UILabel *youpaiproomNickLabel;
  19. @property(nonatomic,strong)UIButton *youpaipthreeIconBtn;
  20. @property(nonatomic,strong)UIButton *youpaipthreeIconBtn2;
  21. @property(nonatomic,strong)UIButton *youpaipthreeIconBtn3;
  22. @property(nonatomic,strong)UIImageView *youpaiprightImageView;
  23. @end
  24. @implementation YOUPAIHRChatRoomManageCell
  25. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  26. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  27. [self youpaifsetSubView];
  28. }
  29. return self;
  30. }
  31. -(void)youpaifsetSubView{
  32. //头像
  33. UIImageView *youpaipavtarImageView = [UIImageView new];
  34. self.youpaipavtarImageView = youpaipavtarImageView;
  35. [self.contentView addSubview:youpaipavtarImageView];
  36. [youpaipavtarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.left.mas_equalTo(14.5);
  38. make.centerY.mas_equalTo(0);
  39. make.size.mas_equalTo(CGSizeMake(84, 84));
  40. }];
  41. youpaipavtarImageView.contentMode = UIViewContentModeScaleAspectFill;
  42. youpaipavtarImageView.clipsToBounds = YES;
  43. // youpaipavtarImageView.image = [UIImage imageNamed:@"AppIcon"];
  44. youpaipavtarImageView.layer.cornerRadius = 6;
  45. UIImageView *youpaiprightImageView = [UIImageView new];
  46. self.youpaiprightImageView = youpaiprightImageView;
  47. [youpaipavtarImageView addSubview:youpaiprightImageView];
  48. [youpaiprightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.right.mas_equalTo(0);
  50. make.top.mas_equalTo(0);
  51. make.size.mas_equalTo(CGSizeMake(25, 25));
  52. }];
  53. youpaiprightImageView.contentMode = UIViewContentModeScaleAspectFill;
  54. youpaiprightImageView.clipsToBounds = YES;
  55. youpaiprightImageView.image = [UIImage imageNamed:@"vqu_images_chatroom_manager_lock"];
  56. youpaiprightImageView.layer.cornerRadius = 6;
  57. //类型
  58. UIButton *youpaipmyHomeBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 32, 18)];
  59. self.youpaipmyHomeBtn = youpaipmyHomeBtn;
  60. [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerBottomRight View:youpaipmyHomeBtn size:CGSizeMake(4, 4)];
  61. [youpaipavtarImageView addSubview:youpaipmyHomeBtn];
  62. [youpaipmyHomeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  63. youpaipmyHomeBtn.titleLabel.font = [UIFont systemFontOfSize:10];
  64. [youpaipmyHomeBtn setBackgroundColor:HexColorFromRGBA(0x000000, 0.38)];
  65. //昵称
  66. UILabel *youpaipnickLabel = [UILabel new];
  67. self.youpaipnickLabel = youpaipnickLabel;
  68. [self.contentView addSubview:youpaipnickLabel];
  69. [youpaipnickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.left.mas_equalTo(youpaipavtarImageView.mas_right).offset(12);
  71. make.top.mas_equalTo(youpaipavtarImageView).offset(5);
  72. }];
  73. youpaipnickLabel.font = LCBoldFont(16);
  74. youpaipnickLabel.textColor = [UIColor whiteColor];
  75. //id
  76. UILabel *youpaipidLabel = [UILabel new];
  77. self.youpaipidLabel = youpaipidLabel;
  78. [self.contentView addSubview:youpaipidLabel];
  79. [youpaipidLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.left.mas_equalTo(youpaipnickLabel);
  81. make.top.mas_equalTo(youpaipnickLabel.mas_bottom).offset(10);
  82. }];
  83. youpaipidLabel.font = [UIFont systemFontOfSize:12];
  84. youpaipidLabel.textColor = HexColorFromRGB(0x9F9DA5);
  85. //房主头像
  86. UIImageView *youpaiproomImageView = [UIImageView new];
  87. self.youpaiproomImageView =youpaiproomImageView;
  88. [self.contentView addSubview:youpaiproomImageView];
  89. [youpaiproomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  90. make.left.mas_equalTo(youpaipidLabel.mas_right).offset(8);
  91. make.centerY.mas_equalTo(youpaipidLabel);
  92. make.size.mas_equalTo(CGSizeMake(16, 16));
  93. }];
  94. youpaiproomImageView.contentMode = UIViewContentModeScaleAspectFill;
  95. youpaiproomImageView.clipsToBounds = YES;
  96. youpaiproomImageView.layer.cornerRadius = 8;
  97. //房主昵称
  98. UILabel *youpaiproomNickLabel = [UILabel new];
  99. self.youpaiproomNickLabel = youpaiproomNickLabel;
  100. [self.contentView addSubview:youpaiproomNickLabel];
  101. [youpaiproomNickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.left.mas_equalTo(youpaiproomImageView.mas_right).offset(6);
  103. make.centerY.mas_equalTo(youpaiproomImageView);
  104. }];
  105. youpaiproomNickLabel.font = [UIFont systemFontOfSize:12];
  106. youpaiproomNickLabel.textColor = HexColorFromRGB(0x9F9DA5);
  107. //操作记录 修改资料 人员管理
  108. UIButton *youpaipthreeIconBtn = [UIButton new];
  109. self.youpaipthreeIconBtn = youpaipthreeIconBtn;
  110. [self.contentView addSubview:youpaipthreeIconBtn];
  111. [youpaipthreeIconBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  112. make.left.mas_equalTo(youpaipavtarImageView.mas_right).offset(12);
  113. make.top.mas_equalTo(youpaipidLabel.mas_bottom).offset(15);
  114. make.size.mas_equalTo(CGSizeMake(64, 22));
  115. }];
  116. youpaipthreeIconBtn.backgroundColor = HexColorFromRGB(0x4F4B5B);
  117. youpaipthreeIconBtn.contentMode = UIViewContentModeScaleAspectFill;
  118. youpaipthreeIconBtn.clipsToBounds = YES;
  119. youpaipthreeIconBtn.layer.cornerRadius = 12;
  120. [youpaipthreeIconBtn setTitle:@"操作记录" forState:UIControlStateNormal];
  121. [youpaipthreeIconBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  122. youpaipthreeIconBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  123. [youpaipthreeIconBtn addTarget:self action:@selector(youpaifthreeIconBtnClick) forControlEvents:UIControlEventTouchUpInside];
  124. youpaipthreeIconBtn.hidden = YES;
  125. UIButton *threeIconBtn2 = [UIButton new];
  126. self.youpaipthreeIconBtn2 = threeIconBtn2;
  127. [self.contentView addSubview:threeIconBtn2];
  128. [threeIconBtn2 mas_makeConstraints:^(MASConstraintMaker *make) {
  129. make.left.mas_equalTo(youpaipavtarImageView.mas_right).offset(12);
  130. make.top.mas_equalTo(youpaipidLabel.mas_bottom).offset(15);
  131. make.size.mas_equalTo(CGSizeMake(64, 22));
  132. }];
  133. threeIconBtn2.backgroundColor = HexColorFromRGB(0x4F4B5B);
  134. threeIconBtn2.contentMode = UIViewContentModeScaleAspectFill;
  135. threeIconBtn2.clipsToBounds = YES;
  136. threeIconBtn2.layer.cornerRadius = 12;
  137. [threeIconBtn2 setTitle:@"修改资料" forState:UIControlStateNormal];
  138. [threeIconBtn2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  139. threeIconBtn2.titleLabel.font = [UIFont systemFontOfSize:12];
  140. [threeIconBtn2 addTarget:self action:@selector(youpaifthreeIconBtnChangeClick) forControlEvents:UIControlEventTouchUpInside];
  141. threeIconBtn2.hidden = YES;
  142. UIButton *threeIconBtn3 = [UIButton new];
  143. self.youpaipthreeIconBtn3 = threeIconBtn3;
  144. [self.contentView addSubview:threeIconBtn3];
  145. [threeIconBtn3 mas_makeConstraints:^(MASConstraintMaker *make) {
  146. make.left.mas_equalTo(youpaipavtarImageView.mas_right).offset(12);
  147. make.top.mas_equalTo(youpaipidLabel.mas_bottom).offset(15);
  148. make.size.mas_equalTo(CGSizeMake(64, 22));
  149. }];
  150. threeIconBtn3.backgroundColor = HexColorFromRGB(0x4F4B5B);
  151. threeIconBtn3.contentMode = UIViewContentModeScaleAspectFill;
  152. threeIconBtn3.clipsToBounds = YES;
  153. threeIconBtn3.layer.cornerRadius = 12;
  154. [threeIconBtn3 setTitle:@"人员管理" forState:UIControlStateNormal];
  155. [threeIconBtn3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  156. threeIconBtn3.titleLabel.font = [UIFont systemFontOfSize:12];
  157. [threeIconBtn3 addTarget:self action:@selector(youpaifthreeIconBtnManagerClick) forControlEvents:UIControlEventTouchUpInside];
  158. threeIconBtn3.hidden = YES;
  159. //分割线
  160. UIView *lineView = [UIView new];
  161. [self.contentView addSubview:lineView];
  162. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  163. make.left.mas_equalTo(14);
  164. make.right.mas_equalTo(-14);
  165. make.bottom.mas_equalTo(0);
  166. make.height.mas_equalTo(0.5);
  167. }];
  168. lineView.backgroundColor = HexColorFromRGB(0x28262D);
  169. }
  170. -(void)setYoupaipmodel:(YOUPAIHRChatRoomManageModel *)youpaipmodel
  171. {
  172. _youpaipmodel = youpaipmodel;
  173. [self.youpaipavtarImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipcover_img] placeholderImage:nil];
  174. [self.youpaipmyHomeBtn setTitle:youpaipmodel.youpaipcate_name forState:UIControlStateNormal];
  175. self.youpaipnickLabel.text = youpaipmodel.youpaiptitle;
  176. self.youpaipidLabel.text = [NSString stringWithFormat:@"ID:%ld",(long)youpaipmodel.youpaiproom_id];
  177. [self.youpaiproomImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipavatar] placeholderImage:nil];
  178. self.youpaiproomNickLabel.text = youpaipmodel.youpaipnickname;
  179. if (youpaipmodel.youpaippwd == 0) {
  180. self.youpaiprightImageView.hidden = YES;
  181. }else{
  182. self.youpaiprightImageView.hidden = NO;
  183. }
  184. UIView *frontV;
  185. //修改资料权限:主持人|管理|房主=====操作记录权限:管理|房主======人员管理权限:房主
  186. if ([youpaipmodel.youpaipidentity isEqualToString:@"homeowner"]||[youpaipmodel.youpaipidentity isEqualToString:@"manager"]) {//房间身份:homeowner=房主,host=主持,manager=管理员)
  187. self.youpaipthreeIconBtn.hidden = NO;
  188. [self.youpaipthreeIconBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  189. if (frontV == nil) {
  190. make.left.equalTo(self.youpaipavtarImageView.mas_right).offset(12);
  191. }else{
  192. make.left.equalTo(frontV.mas_right).offset(6.0f);
  193. }
  194. make.top.mas_equalTo(self.youpaipidLabel.mas_bottom).offset(15);
  195. make.size.mas_equalTo(CGSizeMake(64, 22));
  196. }];
  197. frontV = self.youpaipthreeIconBtn;
  198. }else{
  199. self.youpaipthreeIconBtn.hidden = YES;
  200. }
  201. if([youpaipmodel.youpaipidentity isEqualToString:@"homeowner"]||[youpaipmodel.youpaipidentity isEqualToString:@"manager"]||[youpaipmodel.youpaipidentity isEqualToString:@"host"]){
  202. self.youpaipthreeIconBtn2.hidden = NO;
  203. [self.youpaipthreeIconBtn2 mas_remakeConstraints:^(MASConstraintMaker *make) {
  204. if (frontV == nil) {
  205. make.left.equalTo(self.youpaipavtarImageView.mas_right).offset(12);
  206. }else{
  207. make.left.equalTo(frontV.mas_right).offset(6.0f);
  208. }
  209. make.top.mas_equalTo(self.youpaipidLabel.mas_bottom).offset(15);
  210. make.size.mas_equalTo(CGSizeMake(64, 22));
  211. }];
  212. frontV = self.youpaipthreeIconBtn2;
  213. }
  214. if ([youpaipmodel.youpaipidentity isEqualToString:@"homeowner"]){
  215. self.youpaipthreeIconBtn3.hidden = NO;
  216. [self.youpaipthreeIconBtn3 mas_remakeConstraints:^(MASConstraintMaker *make) {
  217. if (frontV == nil) {
  218. make.left.equalTo(self.youpaipavtarImageView.mas_right).offset(12);
  219. }else{
  220. make.left.equalTo(frontV.mas_right).offset(6.0f);
  221. }
  222. make.top.mas_equalTo(self.youpaipidLabel.mas_bottom).offset(15);
  223. make.size.mas_equalTo(CGSizeMake(64, 22));
  224. }];
  225. }
  226. }
  227. -(void)youpaifthreeIconBtnClick{
  228. YOUPAIHROperationRecordVC *vc = [YOUPAIHROperationRecordVC new];
  229. vc.youpaiproom_id = self.youpaipmodel.youpaiproom_id;
  230. [[LCTools getCurrentVC].navigationController pushViewController:vc animated:YES];
  231. }
  232. -(void)youpaifthreeIconBtnChangeClick{
  233. YOUPAIHRChatRoomEditInfoVC *vc = [YOUPAIHRChatRoomEditInfoVC new];
  234. vc.youpaiproom_id = self.youpaipmodel.youpaiproom_id;
  235. [[LCTools getCurrentVC].navigationController pushViewController:vc animated:YES];
  236. }
  237. -(void)youpaifthreeIconBtnManagerClick{
  238. YOUPAIHRPersonnelManagementVC *vc = [YOUPAIHRPersonnelManagementVC new];
  239. vc.youpaiproom_id = self.youpaipmodel.youpaiproom_id;
  240. [[LCTools getCurrentVC].navigationController pushViewController:vc animated:YES];
  241. }
  242. @end