MOLiveUserInfoView.m 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194
  1. //
  2. // MOLiveUserInfoView.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/11/27.
  6. //
  7. #import "MOLiveUserInfoView.h"
  8. #import "MOUserListData.h"
  9. #import "MOImageTitleAlertView.h"
  10. #import "MOChooseTimeAlertView.h"
  11. #import "MOReportSomeOneView.h"
  12. #import "MOLiveCell.h"
  13. #import "MOFanClubNameplateView.h"
  14. #import <UIImageView+YYWebImage.h>
  15. #import "MOAddBlackAlertView.h"
  16. #import "MOTopsUserView.h"//贡献榜view
  17. @interface MOLiveUserInfoView ()
  18. @property (weak, nonatomic) IBOutlet UIImageView *headImg;
  19. @property (weak, nonatomic) IBOutlet UIImageView *headBgImgView;
  20. /** svga 播放 管理类 */
  21. @property (nonatomic, strong) MOSVGACustomPlayer *aPlayer;
  22. @property (nonatomic, strong) SVGAParser *aParser;
  23. @property (weak, nonatomic) IBOutlet UIImageView *topBgImgView;
  24. @property (weak, nonatomic) IBOutlet UIView *bgImgBgView;
  25. @property (weak, nonatomic) IBOutlet UIImageView *bgImgView;
  26. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bgImgViewHeight;
  27. @property (weak, nonatomic) IBOutlet UIImageView *cardFrameBgImg;
  28. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *cardBgHeight;
  29. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *cardBgTop;
  30. @property (weak, nonatomic) IBOutlet BigBtn *reportBtn;
  31. @property (weak, nonatomic) IBOutlet BigBtn *adminBtn;
  32. @property (weak, nonatomic) IBOutlet MOShimmerLabel *nickNameLab;
  33. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *nickNameWidth;
  34. @property (weak, nonatomic) IBOutlet UIImageView *genderImg;
  35. @property (weak, nonatomic) IBOutlet UIButton *idBtn;
  36. @property (nonatomic, strong) MOStarNumView *startView;
  37. @property (weak, nonatomic) IBOutlet UIImageView *locationImgView;
  38. @property (weak, nonatomic) IBOutlet UILabel *locationLab;
  39. @property (weak, nonatomic) IBOutlet UIImageView *fanClubMedalImgView;
  40. @property (weak, nonatomic) IBOutlet UILabel *introduLab;
  41. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *introduLabTop;
  42. @property (weak, nonatomic) IBOutlet UIStackView *numStackView;
  43. @property (weak, nonatomic) IBOutlet UILabel *numFocusLab;
  44. @property (weak, nonatomic) IBOutlet UILabel *tipFocusLab;
  45. @property (weak, nonatomic) IBOutlet UILabel *numFanLab;
  46. @property (weak, nonatomic) IBOutlet UILabel *tipFanLab;
  47. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *stackViewTop;
  48. @property (weak, nonatomic) IBOutlet UIView *familyBgView;
  49. @property (weak, nonatomic) IBOutlet UIImageView *familyBgImg;
  50. @property (weak, nonatomic) IBOutlet UILabel *familyTitleLab;
  51. @property (weak, nonatomic) IBOutlet UILabel *familyContentLab;
  52. @property (weak, nonatomic) IBOutlet UILabel *familyNoTip;
  53. @property (weak, nonatomic) IBOutlet UIView *familyImgView;
  54. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *familyImgWidth;
  55. @property (weak, nonatomic) IBOutlet UIImageView *familyImgBg;
  56. @property (weak, nonatomic) IBOutlet UILabel *familyImgTitleLab;
  57. @property (weak, nonatomic) IBOutlet UIImageView *familyImgIcon;
  58. @property (weak, nonatomic) IBOutlet UIView *contributionBgView;
  59. @property (weak, nonatomic) IBOutlet UIImageView *contributionBgImg;
  60. @property (weak, nonatomic) IBOutlet UILabel *contributionTitleLab;
  61. @property (weak, nonatomic) IBOutlet UILabel *contributionNoTip;
  62. /** 铭牌 */
  63. @property (nonatomic, strong) MOFanClubNameplateView *nameplateView;
  64. @property (weak, nonatomic) IBOutlet UIView *fanClubBgView;
  65. @property (weak, nonatomic) IBOutlet UIImageView *fanClubBgImg;
  66. @property (weak, nonatomic) IBOutlet UILabel *fanClubTitleLab;
  67. @property (weak, nonatomic) IBOutlet UILabel *fanClubContentLab;
  68. @property (weak, nonatomic) IBOutlet UILabel *fanClubNoTip;
  69. @property (weak, nonatomic) IBOutlet UIButton *fanClubBtn;
  70. @property (weak, nonatomic) IBOutlet UIView *bgView;
  71. @property (weak, nonatomic) IBOutlet UIStackView *menuStackView;
  72. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *menuStackViewBottom;
  73. @property (weak, nonatomic) IBOutlet BigBtn *followBtn;
  74. @property (weak, nonatomic) IBOutlet UIButton *atBtn;
  75. @property (weak, nonatomic) IBOutlet BigBtn *chatBtn;
  76. @property (weak, nonatomic) IBOutlet UIView *inviteBgView;
  77. @property (weak, nonatomic) IBOutlet UIButton *inviteBtn;
  78. @property (weak, nonatomic) IBOutlet UIButton *followBtnTwo;
  79. @property (weak, nonatomic) IBOutlet UIView *manageVoiceView;
  80. @property (weak, nonatomic) IBOutlet UIView *selectBtnBgView;
  81. @property (weak, nonatomic) IBOutlet UIView *selectBtnView;
  82. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *selectBtnCenterX;
  83. @property (weak, nonatomic) IBOutlet UIButton *voiceTypeBtn;
  84. @property (weak, nonatomic) IBOutlet UIButton *videoTypeBtn;
  85. @property (weak, nonatomic) IBOutlet UIButton *voiceBtn;
  86. @property (weak, nonatomic) IBOutlet UIButton *hangUpBtn;
  87. @property (nonatomic, strong) MOReportSomeOneView *reportView;
  88. @property (nonatomic, strong) UIImageView *vipImgView;
  89. @property (nonatomic, strong) MOBaseLevelView *levelImgView;
  90. @property (nonatomic, strong) UIImageView *videoImgView;
  91. @property (nonatomic, strong) UIImageView *audioImgView;
  92. @property (nonatomic, strong) MOFansLevelView *fansLevelView;
  93. /** 勋章View */
  94. @property (nonatomic, strong) MOMsgContentTextView *medalView;
  95. @property (nonatomic, strong) MOMsgContentTextView *infoImgView;
  96. /** 状态 */
  97. @property (nonatomic, strong) MOStatusButton *statusBtn;
  98. @property (weak, nonatomic) IBOutlet UIButton *headBtn;
  99. @property (nonatomic, assign) BOOL isShowReport;
  100. @property (nonatomic, strong) MOTopsUserView *topsView;
  101. @property (nonatomic, strong) NSArray *outcomeArr;
  102. @property (nonatomic, strong) MOLiveGoBtnView *liveGoBtnView;//去对方直播间View
  103. @end
  104. @implementation MOLiveUserInfoView
  105. + (instancetype)moLiveUserInfoView{
  106. return [[[NSBundle mainBundle] loadNibNamed:@"MOLiveUserInfoView" owner:self options:nil] firstObject];
  107. }
  108. - (void)awakeFromNib{
  109. [super awakeFromNib];
  110. CGFloat height = SCREENWIDTH * 125 / 750;
  111. self.cardBgHeight.constant = height;
  112. self.cardBgTop.constant = - SCREENWIDTH * 432.0 / 1125.0;
  113. self.bgView.layer.cornerRadius = 16.0;
  114. self.bgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  115. self.headImg.layer.cornerRadius = 90.0 / 2.0;
  116. self.headImg.layer.masksToBounds = YES;
  117. self.numStackView.layer.cornerRadius = 10.0;
  118. self.numStackView.layer.masksToBounds = YES;
  119. self.familyBgView.layer.cornerRadius = 14.0;
  120. self.familyBgView.layer.masksToBounds = YES;
  121. self.fanClubBgView.layer.cornerRadius = 14.0;
  122. self.fanClubBgView.layer.masksToBounds = YES;
  123. self.contributionBgView.layer.cornerRadius = 14.0;
  124. self.contributionBgView.layer.masksToBounds = YES;
  125. self.idBtn.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
  126. self.familyImgView.layer.cornerRadius = 20.0 / 2.0;
  127. self.familyImgView.layer.masksToBounds = YES;
  128. self.bgImgBgView.layer.cornerRadius = 16.0;
  129. self.bgImgBgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  130. self.bgImgBgView.layer.masksToBounds = YES;
  131. self.bgImgBgView.backgroundColor = [MOTools colorWithHexString:@"#FAFBFF"];
  132. self.bgImgViewHeight.constant = kScaleWidth(375.0);
  133. [self.bgImgView setImage:[UIImage imageNamed:@"v_2_user_bg"]];
  134. self.bgImgView.clipsToBounds = YES;
  135. [self.followBtn setTitleColor:[MOTools colorWithHexString:@"#4363FF"] forState:UIControlStateNormal];
  136. [self.followBtn setTitle:NSLocalString(@"mimo_2_live_user_follow") forState:UIControlStateNormal];
  137. [self.followBtn setFont:[MOTextTools poppinsMediumFont:16.0]];
  138. [self.atBtn setFont:[MOTextTools poppinsMediumFont:16.0]];
  139. [self.chatBtn setFont:[MOTextTools poppinsMediumFont:16.0]];
  140. [self.chatBtn setTitle:NSLocalString(@"mimo_2_live_user_chat") forState:UIControlStateNormal];
  141. NSArray *fanColorArr = @[[MOTools colorWithHexString:@"#FF4DA6" alpha:1.0],[MOTools colorWithHexString:@"#FF84D2" alpha:1.0]];
  142. UIImage *fanImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 112, 62.0) Colors:fanColorArr GradientType:1];
  143. [self.fanClubBgImg setImage:fanImage];
  144. NSArray *familyColorArr = @[[MOTools colorWithHexString:@"#A759FF" alpha:1.0],[MOTools colorWithHexString:@"#D392FF" alpha:1.0]];
  145. UIImage *familyImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 112, 62.0) Colors:familyColorArr GradientType:1];
  146. [self.familyBgImg setImage:familyImage];
  147. NSArray *contriColorArr = @[[MOTools colorWithHexString:@"#4363FF" alpha:1.0],[MOTools colorWithHexString:@"#789CFF" alpha:1.0]];
  148. UIImage *contriImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 112, 62.0) Colors:contriColorArr GradientType:1];
  149. [self.contributionBgImg setImage:contriImage];
  150. NSArray *topColorArr = @[[MOTools colorWithHexString:@"#E8DFFF" alpha:1.0],[MOTools colorWithHexString:@"#E9E6FF" alpha:1.0],[MOTools colorWithHexString:@"#F0DEFF" alpha:1.0],[MOTools colorWithHexString:@"#EFDEFF" alpha:1.0]];
  151. UIImage *topImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 96.0, 96.0) Colors:topColorArr GradientType:1];
  152. [self.topBgImgView setImage:topImage];
  153. self.topBgImgView.layer.cornerRadius = 96.0 / 2.0;
  154. self.topBgImgView.layer.masksToBounds = YES;
  155. UIImage *inviteNormalImg = [MOTools createImageWithColor:[MOTools colorWithHexString:@"#17CBEA" alpha:1.0]];
  156. UIImage *inviteGrayImg = [MOTools createImageWithColor:[UIColor grayColor]];
  157. [self.inviteBtn setBackgroundImage:inviteNormalImg forState:UIControlStateNormal];
  158. [self.inviteBtn setBackgroundImage:inviteGrayImg forState:UIControlStateSelected];
  159. self.inviteBtn.selected = NO;
  160. self.inviteBtn.layer.cornerRadius = 36.0 / 2.0;
  161. self.inviteBtn.layer.masksToBounds = YES;
  162. [self.followBtnTwo setImage:[UIImage imageNamed:@"icon_live_user_jia"] forState:UIControlStateNormal];
  163. [self.followBtnTwo setImage:[UIImage imageNamed:@"icon_live_user_jian"] forState:UIControlStateSelected];
  164. self.inviteBgView.hidden = YES;
  165. self.viewType = MOLiveUserInfoViewTypeNormal;
  166. [self.bgView addSubview:self.aPlayer];
  167. [self.aPlayer mas_makeConstraints:^(MASConstraintMaker *make) {
  168. make.height.width.equalTo(@130.0);
  169. make.centerX.equalTo(self.headImg.mas_centerX);
  170. make.centerY.equalTo(self.headImg.mas_centerY);
  171. }];
  172. [self.fanClubBgView insertSubview:self.nameplateView belowSubview:self.fanClubBtn];
  173. [self.nameplateView mas_makeConstraints:^(MASConstraintMaker *make) {
  174. make.centerY.equalTo(self.fanClubNoTip.mas_centerY);
  175. make.left.equalTo(self.fanClubBgView).mas_offset(12.0);
  176. make.height.equalTo(@15.0);
  177. make.width.equalTo(@60.0);
  178. }];
  179. [self.bgView addSubview:self.levelImgView];
  180. [self.levelImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  181. make.width.equalTo(@(MOLevelNormalWidth));
  182. make.height.equalTo(@(MOLevelNormalHeight));
  183. make.top.equalTo(self.nickNameLab.mas_bottom).offset(12.0);
  184. make.centerX.equalTo(self.bgView).offset(0);
  185. }];
  186. [self.bgView addSubview:self.vipImgView];
  187. [self.vipImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  188. make.width.equalTo(@25.0);
  189. make.height.equalTo(@21.0);
  190. make.right.equalTo(self.levelImgView.mas_left).offset(-5.0);
  191. make.centerY.equalTo(self.levelImgView.mas_centerY);
  192. }];
  193. [self.bgView addSubview:self.audioImgView];
  194. [self.audioImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  195. make.width.height.equalTo(@15.0);
  196. make.left.equalTo(self.levelImgView.mas_right).offset(5.0);
  197. make.centerY.equalTo(self.levelImgView.mas_centerY);
  198. }];
  199. [self.bgView addSubview:self.videoImgView];
  200. [self.videoImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  201. make.width.height.equalTo(@15.0);
  202. make.left.equalTo(self.levelImgView.mas_right).offset(5.0);
  203. make.centerY.equalTo(self.levelImgView.mas_centerY);
  204. }];
  205. [self.bgView addSubview:self.fansLevelView];
  206. [self.fansLevelView mas_makeConstraints:^(MASConstraintMaker *make) {
  207. make.centerY.equalTo(self.levelImgView.mas_centerY);
  208. make.left.equalTo(self.audioImgView.mas_right).offset(5.0);
  209. make.width.equalTo(@50.0);
  210. make.height.equalTo(@20.0);
  211. }];
  212. [self.bgView addSubview:self.infoImgView];
  213. [self.infoImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  214. make.height.equalTo(@20.0);
  215. make.centerY.equalTo(self.levelImgView.mas_centerY);
  216. make.left.equalTo(self.bgView).offset(20.0);
  217. make.right.equalTo(self.bgView).offset(-20.0);
  218. }];
  219. [self.bgView addSubview:self.statusBtn];
  220. [self.statusBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  221. make.centerY.equalTo(self.levelImgView.mas_centerY);
  222. make.left.equalTo(self.audioImgView.mas_right).offset(5.0);
  223. make.width.equalTo(@50.0);
  224. make.height.equalTo(@19.0);
  225. }];
  226. self.statusBtn.layer.cornerRadius = 19.0 / 2.0;
  227. self.statusBtn.layer.masksToBounds = YES;
  228. [self.contributionBgView addSubview:self.topsView];
  229. [self.topsView mas_makeConstraints:^(MASConstraintMaker *make) {
  230. make.left.equalTo(self.contributionNoTip.mas_left).offset(0.0);
  231. make.height.equalTo(@(MOTopsUserViewHeight));
  232. make.width.equalTo(@(MOTopsUserViewWidth));
  233. make.centerY.equalTo(self.contributionNoTip.mas_centerY);
  234. }];
  235. self.topsView.hidden = YES;
  236. self.selectBtnBgView.layer.cornerRadius = 40.0 / 2.0;
  237. self.selectBtnBgView.layer.masksToBounds = YES;
  238. self.selectBtnView.layer.cornerRadius = 34.0 / 2.0;
  239. self.selectBtnView.layer.masksToBounds = YES;
  240. self.manageVoiceView.hidden = YES;
  241. self.startView.viewHeight = MOStarNumViewNormalHeight;
  242. CGFloat startWidth = [self.startView getTheViewWidth];
  243. [self.bgView addSubview:self.startView];
  244. [self.startView mas_makeConstraints:^(MASConstraintMaker *make) {
  245. make.centerY.equalTo(self.idBtn.mas_centerY);
  246. make.right.equalTo(self.idBtn.mas_right);
  247. make.height.equalTo(@(MOStarNumViewNormalHeight));
  248. make.width.equalTo(@(startWidth));
  249. }];
  250. [self.bgView addSubview:self.medalView];
  251. [self.medalView mas_makeConstraints:^(MASConstraintMaker *make) {
  252. make.centerY.equalTo(self.fanClubMedalImgView.mas_centerY);
  253. make.left.equalTo(self.bgView).offset(30.0);
  254. make.right.equalTo(self.bgView).offset(-30.0);
  255. make.height.equalTo(@48.0);
  256. }];
  257. self.nickNameLab.font = [MOTextTools poppinsBoldFont:18.0];
  258. self.fanClubTitleLab.font = [MOTextTools poppinsSemiBoldFont:13.0];
  259. self.familyTitleLab.font = [MOTextTools poppinsSemiBoldFont:13.0];
  260. self.contributionTitleLab.font = [MOTextTools poppinsSemiBoldFont:13.0];
  261. self.numFanLab.font = [MOTextTools poppinsRegularFont:13.0];
  262. self.tipFanLab.font = [MOTextTools poppinsRegularFont:13.0];
  263. self.numFocusLab.font = [MOTextTools poppinsRegularFont:13.0];
  264. self.tipFocusLab.font = [MOTextTools poppinsRegularFont:13.0];
  265. [self.inviteBtn setFont: [MOTextTools getTheFontWithSize:15.0 AndFontName:kNormalContentFontStr]];
  266. [self.idBtn setFont:[MOTextTools poppinsRegularFont:13.0]];
  267. self.locationLab.font = [MOTextTools regularFont:13.0];
  268. self.fanClubNoTip.font = [MOTextTools poppinsRegularFont:12.0];
  269. self.familyNoTip.font = [MOTextTools poppinsRegularFont:12.0];
  270. self.contributionNoTip.font = [MOTextTools poppinsRegularFont:12.0];
  271. self.tipFanLab.text = NSLocalString(@"mimo_2_user_info_fans");
  272. self.tipFocusLab.text = NSLocalString(@"mimo_2_user_info_follow");
  273. [self.bgView addSubview:self.liveGoBtnView];
  274. [self.liveGoBtnView mas_makeConstraints:^(MASConstraintMaker *make) {
  275. make.width.equalTo(@65.0);
  276. make.height.equalTo(@24.0);
  277. make.trailing.equalTo(self.bgView).offset(-12.0);
  278. make.centerY.equalTo(self.adminBtn);
  279. }];
  280. self.liveGoBtnView.hidden = YES;
  281. }
  282. - (void)getUserInfo{
  283. if(self.userId.length == 0 ||
  284. self.roomId.length == 0){
  285. return;
  286. }
  287. WEAKSELF
  288. NSDictionary *dict = @{@"roomId":self.roomId,
  289. @"userId":self.userId};
  290. [kHttpManager toGetTheUserInfoInLiveRoomWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  291. if(kCode_Success){
  292. // MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  293. MOUserBase *baseModel = [MOUserBase modelObjectWithDictionary:data[@"data"]];
  294. weakSelf.userModel = baseModel;
  295. }
  296. else{
  297. kShowNetError(data)
  298. }
  299. }];
  300. }
  301. - (void)getUserContributionData{
  302. if(self.userId.length == 0){
  303. return;
  304. }
  305. NSDictionary *dict = @{@"id":self.userId};
  306. WEAKSELF
  307. [kHttpManager toGetUserOutcomeTopsWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  308. if(kCode_Success){
  309. MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  310. MOUserListData *baseModel = [MOUserListData modelObjectWithDictionary:data[@"data"]];
  311. weakSelf.outcomeArr = [baseModel.userBase copy];
  312. [weakSelf updateTheContriView];
  313. }
  314. else{
  315. MOLogV(@"getUserContributionData 接口报错了");
  316. }
  317. }];
  318. }
  319. - (void)updateTheContriView{
  320. if(self.outcomeArr.count > 0){
  321. self.topsView.hidden = NO;
  322. self.contributionNoTip.hidden = YES;
  323. self.topsView.dataArr = self.outcomeArr;
  324. CGFloat baseWidth = MOTopsUserViewWidth / 3.0;
  325. CGFloat num = self.outcomeArr.count;
  326. if(num > 3){
  327. num = 3;
  328. }
  329. CGFloat width = baseWidth * num;
  330. [self.topsView mas_updateConstraints:^(MASConstraintMaker *make) {
  331. make.width.equalTo(@(width));
  332. }];
  333. }
  334. else{
  335. self.topsView.hidden = YES;
  336. self.contributionNoTip.hidden = NO;
  337. }
  338. }
  339. #pragma mark - Set
  340. - (void)setIsManager:(BOOL)isManager{
  341. _isManager = isManager;
  342. if(isManager){
  343. self.viewType = MOLiveUserInfoViewTypeManager;
  344. }
  345. }
  346. - (void)setIsCreatLive:(BOOL)isCreatLive{
  347. _isCreatLive = isCreatLive;
  348. if(isCreatLive){
  349. self.viewType = MOLiveUserInfoViewTypeAnchor;
  350. }
  351. }
  352. - (void)setUserModel:(MOUserBase *)userModel{
  353. _userModel = userModel;
  354. self.genderImg.hidden = NO;
  355. if([self.userId isEqualToString:GetUserId]){
  356. self.reportBtn.hidden = YES;
  357. self.adminBtn.hidden = YES;
  358. }
  359. else{
  360. self.reportBtn.hidden = NO;
  361. self.adminBtn.hidden = NO;
  362. }
  363. [self.headImg sd_setImageWithURL:[NSURL URLWithString:userModel.userProfile.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  364. [self.cardFrameBgImg sd_setImageWithURL:[NSURL URLWithString:userModel.userProfile.adornment.cardFrameRes]];
  365. WEAKSELF
  366. [self.cardFrameBgImg sd_setImageWithURL:[NSURL URLWithString:userModel.userProfile.adornment.cardFrameRes] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  367. if(image){
  368. CGFloat theImageHeight = 120.0;
  369. if(image.size.width > 0){
  370. theImageHeight = image.size.height * SCREENWIDTH / image.size.width;
  371. }
  372. weakSelf.cardBgHeight.constant = theImageHeight;
  373. }
  374. }];
  375. if(userModel.remark.length > 0){
  376. self.nickNameLab.text = userModel.remark;
  377. }
  378. else{
  379. self.nickNameLab.text = userModel.userProfile.nickname;
  380. }
  381. CGFloat nameWidth = [MOTools getWidthWithString:self.nickNameLab.text font:[MOTextTools poppinsBoldFont:18.0]] + 5.0;
  382. if(nameWidth > 200.0){
  383. nameWidth = 200;
  384. }
  385. self.nickNameWidth.constant = nameWidth;
  386. if(userModel.userProfile.gender == 1){
  387. [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_man"]];
  388. }
  389. else if (userModel.userProfile.gender == 2){
  390. [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_woman"]];
  391. }
  392. else{
  393. self.genderImg.hidden = YES;
  394. }
  395. NSMutableAttributedString *infoImgAttri = [[NSMutableAttributedString alloc] initWithString:@" "];
  396. self.vipImgView.hidden = YES;
  397. if(userModel.vipType == 0){
  398. //非会员
  399. ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
  400. config.shimmerStyle = ShimmerStyleNone;
  401. self.nickNameLab.textColor = [MOTools colorWithHexString:@"#000000" alpha:1.0];
  402. [self.nickNameLab startShimmerWithConfig:config];
  403. }
  404. else{
  405. self.vipImgView.hidden = NO;
  406. UIImage *placeImg = [UIImage imageNamed:@"v_2_vip_1_282"];
  407. MOBaseVips *vipObject = [[MOSvgaSourceManage shareManager] toGetTheVipObjectWith:userModel.vipType];
  408. if(vipObject.thumbnail.length > 0){
  409. [self.vipImgView sd_setImageWithURL:[NSURL URLWithString:vipObject.thumbnail] placeholderImage:placeImg];
  410. }
  411. else{
  412. [self.vipImgView setImage:placeImg];
  413. }
  414. infoImgAttri = [MOTextTools toAddVipInfoWith:infoImgAttri And:userModel.vipType];
  415. }
  416. self.levelImgView.levelNum = userModel.level;
  417. if(userModel.level >= 100){
  418. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  419. make.width.equalTo(@(MOLevelMaxWidth));
  420. }];
  421. }
  422. infoImgAttri = [MOTextTools toAddLevelInfoWith:infoImgAttri And:userModel.level];
  423. CGFloat audioLeftSpac = 5.0;
  424. if(userModel.anchorType == 1){
  425. self.videoImgView.hidden = NO;
  426. self.audioImgView.hidden = YES;
  427. infoImgAttri = [self toAddTheIconWith:infoImgAttri AndNewImg:[UIImage imageNamed:@"icon_mine_video"]];
  428. }
  429. else if (userModel.anchorType == 2){
  430. self.videoImgView.hidden = YES;
  431. self.audioImgView.hidden = NO;
  432. infoImgAttri = [self toAddTheIconWith:infoImgAttri AndNewImg:[UIImage imageNamed:@"icon_mine_audio"]];
  433. }
  434. else if (userModel.anchorType == 3){
  435. self.videoImgView.hidden = NO;
  436. self.audioImgView.hidden = NO;
  437. infoImgAttri = [self toAddTheIconWith:infoImgAttri AndNewImg:[UIImage imageNamed:@"icon_mine_video"]];
  438. infoImgAttri = [self toAddTheIconWith:infoImgAttri AndNewImg:[UIImage imageNamed:@"icon_mine_audio"]];
  439. audioLeftSpac = 25.0;
  440. }
  441. else{
  442. self.videoImgView.hidden = YES;
  443. self.audioImgView.hidden = YES;
  444. }
  445. infoImgAttri = [self toAddStatusWith:infoImgAttri TheUserModel:userModel];
  446. NSMutableParagraphStyle *infoStyle = [[NSMutableParagraphStyle alloc] init];
  447. infoStyle.alignment = NSTextAlignmentCenter; // 设置居中对齐
  448. [infoImgAttri addAttribute:NSParagraphStyleAttributeName value:infoStyle range:NSMakeRange(0, infoImgAttri.length)];
  449. self.infoImgView.attributedText = infoImgAttri;
  450. self.videoImgView.hidden = YES;
  451. self.audioImgView.hidden = YES;
  452. self.levelImgView.hidden = YES;
  453. self.vipImgView.hidden = YES;
  454. [self.audioImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  455. make.left.equalTo(self.levelImgView.mas_right).offset(audioLeftSpac);
  456. }];
  457. CGFloat maxWidth = (SCREENWIDTH - 12.0 * 2.0 - 8.0 * 2.0) / 3.0 - 12.0 * 2;
  458. self.introduLabTop.constant = 13.0;
  459. CGFloat statusBtnLeftSpacing = 5.0;
  460. CGFloat levelImgCenterOff = 0.0;
  461. self.fansLevelView.hidden = YES;
  462. if(userModel.userAnchorClub.nameplate.length > 0){
  463. CGFloat fansTitleWidth = [MOTools getWidthWithString:userModel.userAnchorClub.nameplate font:[UIFont systemFontOfSize:10.0]] + 10.0 + 26.0;
  464. self.nameplateView.grade = userModel.userAnchorClub.level;
  465. self.nameplateView.titleLab.text = userModel.userAnchorClub.nameplate;
  466. CGFloat gradeWidth = [self.nameplateView getNameplateWidth];
  467. if(gradeWidth >= maxWidth){
  468. gradeWidth = maxWidth;
  469. }
  470. if(gradeWidth < 54.0){
  471. gradeWidth = 54;
  472. }
  473. [self.nameplateView mas_updateConstraints:^(MASConstraintMaker *make) {
  474. make.width.equalTo(@(gradeWidth));
  475. }];
  476. self.nameplateView.hidden = NO;
  477. if(userModel.userAnchorClub.level >= 30){
  478. UIImage *fanClubMedalImg = [MOTextTools getTheFanClubMedalWith:userModel.userAnchorClub.level];
  479. [self.fanClubMedalImgView setImage:fanClubMedalImg];
  480. self.fanClubMedalImgView.hidden = NO;
  481. self.stackViewTop.constant = 60.0;
  482. }
  483. else{
  484. self.fanClubMedalImgView.hidden = YES;
  485. self.stackViewTop.constant = 20.0;
  486. }
  487. }
  488. else{
  489. self.fanClubMedalImgView.hidden = YES;
  490. self.stackViewTop.constant = 20.0;
  491. self.nameplateView.hidden = YES;
  492. }
  493. //是否有 勋章
  494. BOOL isHaveMedalView = NO;
  495. if(userModel.userAnchorClub.level >= 30 || userModel.userProfile.medalList.count > 0){
  496. isHaveMedalView = YES;
  497. self.fanClubMedalImgView.hidden = YES;
  498. self.stackViewTop.constant = 60.0;
  499. }
  500. else{
  501. self.fanClubMedalImgView.hidden = YES;
  502. self.stackViewTop.constant = 20.0;
  503. }
  504. self.statusBtn.hidden = YES;
  505. if(userModel.liveBadge.type == 1){
  506. [self.statusBtn sd_setImageWithURL:[NSURL URLWithString:userModel.liveBadge.icon] forState:UIControlStateNormal];
  507. [self.statusBtn setTitle:userModel.liveBadge.name forState:UIControlStateNormal];
  508. [self.statusBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:@""] forState:UIControlStateNormal];
  509. if(userModel.liveBadge.bgColor.length > 0){
  510. self.statusBtn.backgroundColor = [MOTools colorWithHexString:userModel.liveBadge.bgColor alpha:1.0];
  511. }
  512. else{
  513. self.statusBtn.backgroundColor = [MOTools colorWithHexString:@"#120817" alpha:0.6];
  514. }
  515. CGFloat statusBtnWidth = [MOTools getWidthWithString:userModel.liveBadge.name font:[MOTextTools getTheFontWithSize:StatusFont AndFontName:kNormalContentFontStr]] + 10.0 + 30.0;
  516. CGFloat maxWidth = SCREENWIDTH - 15.0 * 2 - 30.0 - 100.0;
  517. if(statusBtnWidth > maxWidth){
  518. statusBtnWidth = maxWidth;
  519. }
  520. [self.statusBtn mas_updateConstraints:^(MASConstraintMaker *make) {
  521. make.left.equalTo(self.audioImgView.mas_right).offset(statusBtnLeftSpacing);
  522. make.width.equalTo(@(statusBtnWidth));
  523. }];
  524. levelImgCenterOff = levelImgCenterOff + statusBtnWidth / 2.0;
  525. }
  526. else if (userModel.liveBadge.type == 2){
  527. self.statusBtn.backgroundColor = [UIColor clearColor];
  528. [self.statusBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:userModel.liveBadge.bgImg] forState:UIControlStateNormal];
  529. [self.statusBtn setTitle:@"" forState:UIControlStateNormal];
  530. [self.statusBtn sd_setImageWithURL:[NSURL URLWithString:userModel.liveBadge.icon] forState:UIControlStateNormal];
  531. [self.statusBtn mas_updateConstraints:^(MASConstraintMaker *make) {
  532. make.left.equalTo(self.audioImgView.mas_right).offset(statusBtnLeftSpacing);
  533. make.width.equalTo(@(90.0));
  534. }];
  535. levelImgCenterOff = levelImgCenterOff + 90.0 / 2.0;
  536. }
  537. else{
  538. self.statusBtn.hidden = YES;
  539. levelImgCenterOff = 0.0;
  540. }
  541. if(isHaveMedalView){
  542. //勋章
  543. NSMutableArray *medalNumArr = [NSMutableArray array];
  544. NSInteger medalMaxNum = 0;
  545. if(userModel.userProfile.medalList.count > 5){
  546. medalMaxNum = 5;
  547. }
  548. else{
  549. medalMaxNum = userModel.userProfile.medalList.count;
  550. }
  551. for (int x = 0; x < medalMaxNum; x ++) {
  552. MOMedalResources *medalObject = userModel.userProfile.medalList[x];
  553. [medalNumArr addObject:@(medalObject.code)];
  554. }
  555. NSMutableAttributedString *medalStr = [[NSMutableAttributedString alloc] initWithString:@" "];
  556. if(userModel.userProfile.medalList.count > 0){
  557. medalStr = [MOTextTools toCreateMedalInfoWithMedalListAnd:medalNumArr AndMedalWidth:48.0 AndUserBigImage:YES AndSpaingStr:@" "];
  558. }
  559. if(userModel.userAnchorClub.level >= 30){
  560. medalStr = [self toAddTheFanClubIconWith:medalStr AndFanClubLevel:userModel.userAnchorClub.level];
  561. }
  562. // 创建段落样式
  563. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  564. paragraphStyle.alignment = NSTextAlignmentCenter; // 设置居中对齐
  565. [medalStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, medalStr.length)];
  566. self.medalView.attributedText = medalStr;
  567. }
  568. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  569. make.centerX.equalTo(self.bgView).offset(-levelImgCenterOff);
  570. }];
  571. if(userModel.userProfile.mysterious){//神秘人
  572. [self.idBtn setTitle:@"ID 99999999" forState:UIControlStateNormal];
  573. self.idBtn.hidden = NO;
  574. self.startView.hidden = YES;
  575. }
  576. else{
  577. [self.idBtn setTitle:[NSString stringWithFormat:@"ID %@",userModel.userProfile.userNo] forState:UIControlStateNormal];
  578. self.startView.idNumStr = [NSString stringWithFormat:@"%@",userModel.userProfile.userNo];
  579. self.startView.levelNum = (NSInteger)userModel.userProfile.beautifulLevel;
  580. if(userModel.userProfile.beautifulLevel == 0){
  581. self.idBtn.hidden = NO;
  582. self.startView.hidden = YES;
  583. }
  584. else{
  585. self.idBtn.hidden = YES;
  586. self.startView.hidden = NO;
  587. }
  588. self.followBtn.hidden = NO;
  589. }
  590. MOCountryList *countryModel;
  591. if(userModel.userProfile.country.length != 0){
  592. countryModel = (MOCountryList *)[[MODataCache sharedYYCache] objectForKey:[NSString stringWithFormat:@"%@_%@",kCountryArrInfo,userModel.userProfile.country]];
  593. }
  594. if(countryModel){
  595. self.locationLab.text = countryModel.name;
  596. [self.locationImgView sd_setImageWithURL:[NSURL URLWithString:countryModel.icon]];
  597. }
  598. else{
  599. self.locationLab.text = userModel.userProfile.country;
  600. }
  601. self.introduLab.text = userModel.userProfile.intro;
  602. if(userModel.userProfile.mysterious){
  603. self.followBtn.selected = NO;
  604. [self showFollowUI:NO];
  605. self.numFocusLab.text = @"999";
  606. self.numFanLab.text = @"999";
  607. }
  608. else{
  609. self.followBtn.selected = userModel.follow;
  610. [self showFollowUI:userModel.follow];
  611. self.numFocusLab.text = [NSString stringWithFormat:@"%.f",userModel.follows];
  612. self.numFanLab.text = [NSString stringWithFormat:@"%.f",userModel.fans];
  613. }
  614. self.followBtnTwo.selected = userModel.follow;
  615. if(self.multiple){
  616. [self updataMutipleView];
  617. }
  618. NSString *contentStr = userModel.userFamily.name;
  619. if(contentStr.length > 0){
  620. self.familyImgTitleLab.text = contentStr;
  621. CGFloat width = [MOTools getWidthWithString:contentStr font:[UIFont systemFontOfSize:10.0]] + 10.0 + 26.0;
  622. if(width >= maxWidth){
  623. width = maxWidth;
  624. }
  625. if(width < 54.0){
  626. width = 54;
  627. }
  628. self.familyImgWidth.constant = width;
  629. }
  630. else{
  631. self.familyImgWidth.constant = 80.0;
  632. }
  633. NSInteger familyLevel = userModel.userFamily.level;
  634. if(familyLevel == 0){
  635. familyLevel = 1;
  636. }
  637. if(familyLevel > 6){
  638. familyLevel = 6;
  639. }
  640. UIImage *familyImg = [UIImage imageNamed:[NSString stringWithFormat:@"icon_family_level_%zd",familyLevel]];
  641. [self.familyImgIcon setImage:familyImg];
  642. if(familyLevel <= 4){
  643. self.familyImgView.backgroundColor = [MOTools colorWithHexString:@"#F4A563" alpha:1.0];
  644. self.familyImgBg.hidden = YES;
  645. }
  646. else{
  647. [self.familyImgBg setImage:[UIImage imageNamed:@"icon_family_level_5_bg"]];
  648. self.familyImgBg.hidden = NO;
  649. self.familyImgView.backgroundColor = [UIColor clearColor];;
  650. }
  651. self.familyImgView.hidden = NO;
  652. if(contentStr.length == 0){
  653. self.familyImgView.hidden = YES;
  654. }
  655. if(userModel.userFamily.id.length == 0){
  656. }
  657. else{
  658. self.familyNoTip.text = userModel.userFamily.name;
  659. self.familyNoTip.hidden = YES;
  660. }
  661. self.fanClubNoTip.hidden = NO;
  662. if(userModel.userAnchorClub.id.length == 0){
  663. }
  664. else{
  665. self.fanClubNoTip.text = userModel.userAnchorClub.clubName;
  666. self.fanClubNoTip.hidden = YES;
  667. }
  668. if(userModel.userProfile.adornment.headgearRes.length > 0){
  669. if(userModel.userProfile.adornment.headgearType == 2){
  670. self.headBgImgView.hidden = YES;
  671. self.aPlayer.hidden = NO;
  672. [self.aPlayer clear];
  673. WEAKSELF
  674. [self.aParser parseWithURL:[NSURL URLWithString:userModel.userProfile.adornment.headgearRes] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
  675. if (videoItem) {
  676. weakSelf.aPlayer.videoItem = videoItem;
  677. [weakSelf.aPlayer startAnimation];
  678. }
  679. } failureBlock:^(NSError * _Nullable error) {
  680. MOLogV(@"播放失败~~~~~~~~");
  681. }];
  682. }
  683. else if (userModel.userProfile.adornment.headgearType == 0 || userModel.userProfile.adornment.headgearType == 1){
  684. self.headBgImgView.hidden = NO;
  685. self.aPlayer.hidden = YES;
  686. [self.headBgImgView sd_setImageWithURL:[NSURL URLWithString:userModel.userProfile.adornment.headgearRes]];
  687. }
  688. }
  689. else{
  690. self.headBgImgView.hidden = YES;
  691. self.aPlayer.hidden = YES;
  692. }
  693. }
  694. - (void)showFollowUI:(BOOL)follow {
  695. if (follow) {
  696. [self.followBtn setTitleColor:[MOTools colorWithHexString:@"#878A99" alpha:0.5] forState:UIControlStateNormal];
  697. [self.followBtn setTitle:NSLocalString(@"mimo_2_live_user_follow_no") forState:UIControlStateNormal];
  698. } else {
  699. [self.followBtn setTitleColor:[MOTools colorWithHexString:@"#4363FF"] forState:UIControlStateNormal];
  700. [self.followBtn setTitle:NSLocalString(@"mimo_2_live_user_follow") forState:UIControlStateNormal];
  701. }
  702. }
  703. - (NSMutableAttributedString *)toAddStatusWith:(NSMutableAttributedString *)contentStr TheUserModel:(MOUserBase *)userModel{
  704. [contentStr appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
  705. if(userModel.liveBadge.type == 1){
  706. CGFloat statusBtnWidth = [MOTools getWidthWithString:userModel.liveBadge.name font:[MOTextTools getTheFontWithSize:StatusFont AndFontName:kNormalContentFontStr]] + 10.0 + 30.0;
  707. UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, statusBtnWidth, 19.0)];
  708. MOStatusButton *statusBtn = [MOStatusButton buttonWithType:UIButtonTypeCustom];
  709. statusBtn.frame = CGRectMake(0.0, 0.0, statusBtnWidth, 19.0);
  710. statusBtn.userInteractionEnabled = NO;
  711. statusBtn.titleLabel.font = [MOTextTools getTheFontWithSize:StatusFont AndFontName:kNormalContentFontStr];
  712. [statusBtn sd_setImageWithURL:[NSURL URLWithString:userModel.liveBadge.icon] forState:UIControlStateNormal];
  713. [statusBtn setTitle:userModel.liveBadge.name forState:UIControlStateNormal];
  714. [statusBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:@""] forState:UIControlStateNormal];
  715. statusBtn.layer.cornerRadius = 5.0;
  716. statusBtn.layer.masksToBounds = YES;
  717. statusBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
  718. statusBtn.contentMode = UIViewContentModeScaleAspectFill;
  719. if(userModel.liveBadge.bgColor.length > 0){
  720. statusBtn.backgroundColor = [MOTools colorWithHexString:userModel.liveBadge.bgColor alpha:1.0];
  721. }
  722. else{
  723. statusBtn.backgroundColor = [MOTools colorWithHexString:@"#120817" alpha:0.6];
  724. }
  725. [bgView addSubview:statusBtn];
  726. NSMutableAttributedString *medalImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(statusBtnWidth, 19.0) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter];
  727. [medalImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
  728. [contentStr appendAttributedString:[medalImgAttri copy]];
  729. }
  730. else if (userModel.liveBadge.type == 2){
  731. UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 90.0, 19.0)];
  732. MOStatusButton *statusBtn = [MOStatusButton buttonWithType:UIButtonTypeCustom];
  733. statusBtn.frame = CGRectMake(0.0, 0.0, 90.0, 19.0);
  734. statusBtn.userInteractionEnabled = NO;
  735. statusBtn.backgroundColor = [UIColor clearColor];
  736. [statusBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:userModel.liveBadge.bgImg] forState:UIControlStateNormal];
  737. [statusBtn setTitle:@"" forState:UIControlStateNormal];
  738. [statusBtn sd_setImageWithURL:[NSURL URLWithString:userModel.liveBadge.icon] forState:UIControlStateNormal];
  739. [bgView addSubview:statusBtn];
  740. NSMutableAttributedString *medalImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(90.0, 19.0) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter];
  741. [medalImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
  742. [contentStr appendAttributedString:[medalImgAttri copy]];
  743. }
  744. return contentStr;
  745. }
  746. - (NSMutableAttributedString *)toAddTheFanClubIconWith:(NSMutableAttributedString *)contentStr AndFanClubLevel:(CGFloat)fanClubLevel{
  747. UIImage *fanClubMedalImg = [MOTextTools getTheFanClubMedalWith:fanClubLevel];
  748. UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 48.0, 48.0)];
  749. bgView.backgroundColor = [UIColor clearColor];
  750. UIImageView *medalImg = [[UIImageView alloc] init];
  751. medalImg.frame = CGRectMake(0.0, 0.0, 48.0, 48.0);
  752. medalImg.contentMode = UIViewContentModeScaleAspectFit;
  753. [medalImg setImage:fanClubMedalImg];
  754. [bgView addSubview:medalImg];
  755. NSMutableAttributedString *medalImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(48.0, 48.0) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter];
  756. [medalImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
  757. [contentStr appendAttributedString:[medalImgAttri copy]];
  758. return contentStr;
  759. }
  760. - (NSMutableAttributedString *)toAddTheIconWith:(NSMutableAttributedString *)contentStr AndNewImg:(UIImage *)theImg{
  761. UIImage *fanClubMedalImg = theImg;
  762. UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 22.0, 16.0)];
  763. bgView.backgroundColor = [UIColor clearColor];
  764. UIImageView *medalImg = [[UIImageView alloc] init];
  765. medalImg.frame = CGRectMake(0.0, 1.0, 22.0, 16.0);
  766. medalImg.contentMode = UIViewContentModeScaleAspectFit;
  767. [medalImg setImage:fanClubMedalImg];
  768. [bgView addSubview:medalImg];
  769. NSMutableAttributedString *medalImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(22.0, 16.0) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter];
  770. [medalImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
  771. [contentStr appendAttributedString:[medalImgAttri copy]];
  772. return contentStr;
  773. }
  774. - (void)updataMutipleView{
  775. BOOL isHaveTheUser = NO;
  776. MOLinkMic *theLinkMic;
  777. for (MOLinkMic *object in self.linkMics) {
  778. if([object.profile.id isEqualToString:self.userModel.userProfile.id]){
  779. isHaveTheUser = YES;
  780. theLinkMic = object;
  781. break;
  782. }
  783. }
  784. if(self.isCreatLive || self.isManager){
  785. if(isHaveTheUser){
  786. //多人操作
  787. self.manageVoiceView.hidden = NO;
  788. self.inviteBgView.hidden = YES;
  789. self.menuStackView.hidden = NO;
  790. if(theLinkMic.video2){
  791. self.selectBtnCenterX.constant = 30.0;
  792. }
  793. else{
  794. self.selectBtnCenterX.constant = -30.0;
  795. }
  796. self.voiceBtn.selected = !theLinkMic.audio2;
  797. self.inviteBgView.hidden = YES;
  798. self.menuStackViewBottom.constant = 5.0;
  799. }
  800. else{
  801. if([self.anchorProfile.id isEqualToString:self.userModel.userProfile.id]){
  802. //主播
  803. self.inviteBgView.hidden = YES;
  804. self.manageVoiceView.hidden = YES;
  805. self.menuStackView.hidden = NO;
  806. self.menuStackViewBottom.constant = 40.0;
  807. }
  808. else{
  809. //邀请
  810. self.inviteBgView.hidden = NO;
  811. self.menuStackView.hidden = YES;
  812. self.manageVoiceView.hidden = YES;
  813. self.menuStackViewBottom.constant = 40.0;
  814. }
  815. }
  816. }
  817. else{
  818. self.inviteBgView.hidden = YES;
  819. self.manageVoiceView.hidden = YES;
  820. self.menuStackView.hidden = NO;
  821. self.menuStackViewBottom.constant = 40.0;
  822. }
  823. }
  824. + (CGFloat)theViewHeight{
  825. return 445.0;
  826. }
  827. - (IBAction)dismissBtnClick:(id)sender {
  828. [self dismissLiveUserInfoView];
  829. }
  830. - (IBAction)reportBtnClick:(id)sender {
  831. if([self.userId isEqualToString:GetUserId]){
  832. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  833. return;
  834. }
  835. //举报按钮点击事件
  836. self.reportBtnBlock ? self.reportBtnBlock() : nil;
  837. [self showReportView];
  838. }
  839. - (void)showReportView{
  840. WEAKSELF
  841. self.isShowReport = YES;
  842. [self addSubview:self.reportView];
  843. [self.reportView mas_makeConstraints:^(MASConstraintMaker *make) {
  844. make.left.equalTo(self).offset(0);
  845. make.width.equalTo(@(SCREENWIDTH));
  846. make.height.equalTo(@445.0);
  847. make.bottom.equalTo(self);
  848. }];
  849. self.reportView.userId = self.userId;
  850. [self.reportView showReportSomeOneView];
  851. self.reportView.dismissReportViewBlock = ^{
  852. weakSelf.isShowReport = NO;
  853. };
  854. }
  855. - (IBAction)editBtnClick:(id)sender {
  856. if([self.userId isEqualToString:GetUserId]){
  857. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  858. return;
  859. }
  860. [self showAlertView];
  861. //编辑按钮点击事件
  862. self.editBtnBlock ? self.editBtnBlock() : nil;
  863. }
  864. - (void)showAlertView{
  865. NSMutableArray *dataArr = [NSMutableArray array];
  866. if(self.viewType == MOLiveUserInfoViewTypeAnchor){
  867. if(self.userModel.manage){
  868. NSDictionary *adminDict = @{@"title":NSLocalString(@"mimo_room_manager_cancel")};
  869. [dataArr addObject:adminDict];
  870. }
  871. else{
  872. NSDictionary *adminDict = @{@"title":NSLocalString(@"mimo_room_manager_add")};
  873. [dataArr addObject:adminDict];
  874. }
  875. if(self.userModel.blacklist){
  876. NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_remove")};
  877. [dataArr addObject:blackDict];
  878. }
  879. else{
  880. NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_add")};
  881. [dataArr addObject:blackDict];
  882. }
  883. if(self.userModel.silence){
  884. NSDictionary *silenceDict = @{@"title":NSLocalString(@"mimo_room_silence_cancel")};
  885. [dataArr addObject:silenceDict];
  886. }
  887. else{
  888. NSDictionary *silenceDict = @{@"title":NSLocalString(@"mimo_room_silence_add")};
  889. [dataArr addObject:silenceDict];
  890. }
  891. NSDictionary *kickDict = @{@"title":NSLocalString(@"mimo_room_user_kick")};
  892. [dataArr addObject:kickDict];
  893. }
  894. else if (self.viewType == MOLiveUserInfoViewTypeManager){
  895. if(self.userModel.blacklist){
  896. NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_remove")};
  897. [dataArr addObject:blackDict];
  898. }
  899. else{
  900. NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_add")};
  901. [dataArr addObject:blackDict];
  902. }
  903. if(self.userModel.manage){
  904. }
  905. else
  906. {
  907. if(self.userModel.silence){
  908. NSDictionary *silenceDict = @{@"title":NSLocalString(@"mimo_room_silence_cancel")};
  909. [dataArr addObject:silenceDict];
  910. }
  911. else{
  912. NSDictionary *silenceDict = @{@"title":NSLocalString(@"mimo_room_silence_add")};
  913. [dataArr addObject:silenceDict];
  914. }
  915. NSDictionary *kickDict = @{@"title":NSLocalString(@"mimo_room_user_kick")};
  916. [dataArr addObject:kickDict];
  917. }
  918. }
  919. else{
  920. if(self.userModel.blacklist){
  921. NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_remove")};
  922. [dataArr addObject:blackDict];
  923. }
  924. else{
  925. NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_add")};
  926. [dataArr addObject:blackDict];
  927. }
  928. }
  929. MOImageTitleAlertView *alertView = [[MOImageTitleAlertView alloc] initForOperateSuccessWithFrame:CGRectMake(0.0, 0.0, SCREENWIDTH, SCREENHEIGHT) ViewType:MOOnlyTextCellType DataArray:dataArr];
  930. WEAKSELF
  931. alertView.cellClickBlock = ^(NSInteger index) {
  932. if(weakSelf.viewType == MOLiveUserInfoViewTypeAnchor){
  933. //主播
  934. if(index == 0){
  935. //管理员
  936. if(self.userModel.manage){
  937. //取消管理员
  938. [weakSelf toSetOrDeleteManagerWith:NO];
  939. }
  940. else{
  941. //增加管理员
  942. [weakSelf toSetOrDeleteManagerWith:YES];
  943. }
  944. }
  945. else if (index == 1){
  946. //黑名单
  947. if(self.userModel.blacklist){
  948. [weakSelf toDeleteBlackList];
  949. }
  950. else{
  951. [weakSelf showBlackConfirmAlertView];
  952. }
  953. }
  954. else if (index == 2){
  955. //禁言
  956. if(self.userModel.silence){
  957. [weakSelf toSetOrDeleteSilenceWith:NO];
  958. }
  959. else{
  960. [weakSelf toSetOrDeleteSilenceWith:YES];
  961. }
  962. }
  963. else{
  964. //踢出房间
  965. [weakSelf toShowKickView];
  966. }
  967. }
  968. else if (weakSelf.viewType == MOLiveUserInfoViewTypeManager){
  969. //管理员
  970. if(index == 0){
  971. //黑名单
  972. if(self.userModel.blacklist){
  973. [weakSelf toDeleteBlackList];
  974. }
  975. else{
  976. [weakSelf showBlackConfirmAlertView];
  977. }
  978. }
  979. else if (index == 1){
  980. //禁言
  981. if(self.userModel.silence){
  982. [weakSelf toSetOrDeleteSilenceWith:NO];
  983. }
  984. else{
  985. [weakSelf toSetOrDeleteSilenceWith:YES];
  986. }
  987. }
  988. else {
  989. //踢出房间
  990. [weakSelf toShowKickView];
  991. }
  992. }
  993. else{
  994. //普通用户
  995. if(index == 0){
  996. //Blacklist
  997. if(self.userModel.blacklist){
  998. [weakSelf toDeleteBlackList];
  999. }
  1000. else{
  1001. [weakSelf showBlackConfirmAlertView];
  1002. }
  1003. }
  1004. }
  1005. };
  1006. [alertView show];
  1007. }
  1008. - (void)toShowKickView{
  1009. // NSArray *dataArr = @[@"30Min",@"24H",@"3Day",@"7Day"];
  1010. NSArray *dataArr = @[@"30Min",@"24H"];
  1011. WEAKSELF
  1012. MOChooseTimeAlertView *view = [MOChooseTimeAlertView moChooseTimeAlertView];
  1013. view.topTipText = [NSString stringWithFormat:NSLocalString(@"mimo_room_kick_tip1"),self.userModel.userProfile.nickname];
  1014. view.bottomTipText = NSLocalString(@"mimo_room_kick_tip2");
  1015. view.dataArr = dataArr;
  1016. [view showChooseTimeAlertView];
  1017. view.confirmBtnBlock = ^(NSInteger index) {
  1018. [weakSelf toKickSomeOneWith:index];
  1019. };
  1020. }
  1021. - (void)toKickSomeOneWith:(NSInteger)index{
  1022. if(self.roomId.length == 0){
  1023. return;
  1024. }
  1025. NSString *userId = self.userId;
  1026. if(userId.length == 0){
  1027. return;
  1028. }
  1029. WEAKSELF
  1030. //时长(1=30分钟,2=24小时,3=3天,4=7天)
  1031. NSDictionary *dict = @{@"kickType":@(index + 1),
  1032. @"roomId":self.roomId,
  1033. @"userId":self.userId};
  1034. [kHttpManager theManageToKickOutSomeOneWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1035. if(kCode_Success){
  1036. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
  1037. MORtmEntity *entity = [MORtmEntity prepareRtmAboutKickSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId];
  1038. NSString *entityJsomString = entity.modelToJSONString;
  1039. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  1040. if(isSuccess){
  1041. }
  1042. }];
  1043. [weakSelf dismissLiveUserInfoView];
  1044. }
  1045. else{
  1046. MOLogV(@"toAddSilenceListWith 接口报错了");
  1047. kShowNetError(data)
  1048. }
  1049. }];
  1050. }
  1051. - (void)toSetOrDeleteSilenceWith:(BOOL)status{
  1052. if(self.roomId.length == 0){
  1053. return;
  1054. }
  1055. if(self.userId == 0){
  1056. return;
  1057. }
  1058. WEAKSELF
  1059. if(status == YES){
  1060. NSArray *dataArr = @[@"30Min",@"24H",@"3Day",@"7Day"];
  1061. MOChooseTimeAlertView *view = [MOChooseTimeAlertView moChooseTimeAlertView];
  1062. view.topTipText = [NSString stringWithFormat:NSLocalString(@"mimo_room_silence_tip1"),self.userModel.userProfile.nickname];
  1063. view.bottomTipText = NSLocalString(@"mimo_room_silence_tip2");
  1064. view.dataArr = dataArr;
  1065. [view showChooseTimeAlertView];
  1066. view.confirmBtnBlock = ^(NSInteger index) {
  1067. [weakSelf toAddSilenceListWith:index];
  1068. };
  1069. }
  1070. else{
  1071. NSDictionary *dict = @{@"silence":@(NO),
  1072. @"roomId":self.roomId,
  1073. @"userId":self.userId};
  1074. [kHttpManager toSetLiveSilenceWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1075. if(kCode_Success){
  1076. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
  1077. MORtmEntity *entity = [MORtmEntity prepareRtmAboutSilenceSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId And:NO];
  1078. NSString *entityJsomString = entity.modelToJSONString;
  1079. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  1080. if(isSuccess){
  1081. }
  1082. }];
  1083. weakSelf.silenceChangeBlock ? weakSelf.silenceChangeBlock(weakSelf.userModel.userProfile.nickname,NO) : nil;
  1084. [weakSelf dismissLiveUserInfoView];
  1085. }
  1086. else{
  1087. MOLogV(@"toAddSilenceListWith 接口报错了");
  1088. kShowNetError(data)
  1089. }
  1090. }];
  1091. }
  1092. }
  1093. - (void)toAddSilenceListWith:(NSInteger)index{
  1094. if(self.roomId.length == 0){
  1095. return;
  1096. }
  1097. NSString *userId = self.userId;
  1098. if(userId.length == 0){
  1099. return;
  1100. }
  1101. WEAKSELF
  1102. //时长(1=30分钟,2=24小时,3=3天,4=7天)
  1103. NSDictionary *dict = @{@"silenceType":@(index + 1),
  1104. @"silence":@(YES),
  1105. @"roomId":self.roomId,
  1106. @"userId":self.userId};
  1107. [kHttpManager toSetLiveSilenceWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1108. if(kCode_Success){
  1109. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
  1110. weakSelf.silenceChangeBlock ? weakSelf.silenceChangeBlock(weakSelf.userModel.userProfile.nickname,YES) : nil;
  1111. MORtmEntity *entity = [MORtmEntity prepareRtmAboutSilenceSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId And:YES];
  1112. NSString *entityJsomString = entity.modelToJSONString;
  1113. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  1114. if(isSuccess){
  1115. }
  1116. }];
  1117. [weakSelf dismissLiveUserInfoView];
  1118. }
  1119. else{
  1120. MOLogV(@"toAddSilenceListWith 接口报错了");
  1121. kShowNetError(data)
  1122. }
  1123. }];
  1124. }
  1125. - (void)toSetOrDeleteManagerWith:(BOOL)status{
  1126. if(self.roomId.length == 0){
  1127. return;
  1128. }
  1129. if(self.userId == 0){
  1130. return;
  1131. }
  1132. WEAKSELF
  1133. NSDictionary *dict = @{@"roomId":self.roomId,
  1134. @"userIds":@[self.userId],
  1135. @"add":@(status)};
  1136. [kHttpManager toSetLiveManagerWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1137. if(kCode_Success){
  1138. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
  1139. MORtmEntity *entity = [MORtmEntity prepareRtmAboutManageSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId And:status];
  1140. NSString *entityJsomString = entity.modelToJSONString;
  1141. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  1142. if(isSuccess){
  1143. }
  1144. }];
  1145. if(status){
  1146. //发送房间提示
  1147. MORtmEntity *entity = [MORtmEntity prepareRoomTipTwoMessage:1 AndUserName:weakSelf.userModel.userProfile.nickname AndRoomId:weakSelf.roomId AndTipNormalNum:0];
  1148. NSString *entityJsomString = entity.modelToJSONString;
  1149. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  1150. if(isSuccess){
  1151. }
  1152. }];
  1153. weakSelf.needShowMsgBlock ? weakSelf.needShowMsgBlock(entity) : nil;
  1154. }
  1155. [weakSelf dismissLiveUserInfoView];
  1156. }
  1157. else{
  1158. MOLogV(@"toSetOrDeleteManagerWith 接口报错了");
  1159. kShowNetError(data)
  1160. }
  1161. }];
  1162. }
  1163. - (void)showBlackConfirmAlertView{
  1164. // NSArray *dataArr = @[@"30Min",@"24H",@"3Day",@"7Day",@"forever"];
  1165. //
  1166. // WEAKSELF
  1167. // MOChooseTimeAlertView *view = [MOChooseTimeAlertView moChooseTimeAlertView];
  1168. // view.topTipText = [NSString stringWithFormat:NSLocalString(@"mimo_blacklist_set_time"),self.userModel.userProfile.nickname];
  1169. // view.bottomTipText = NSLocalString(@"mimo_blacklist_set_black_result");
  1170. // view.dataArr = dataArr;
  1171. // [view showChooseTimeAlertView];
  1172. // view.confirmBtnBlock = ^(NSInteger index) {
  1173. // [weakSelf toAddBlackListWith:index];
  1174. // };
  1175. MOAddBlackAlertView *alertView = [[MOAddBlackAlertView alloc] init];
  1176. WEAKSELF
  1177. alertView.addBlackConfirmBlock = ^(NSInteger timeIndex) {
  1178. [weakSelf toAddBlackListWith:timeIndex];
  1179. };
  1180. [alertView show];
  1181. }
  1182. - (void)toDeleteBlackList{
  1183. NSString *userId = self.userId;
  1184. if(userId.length == 0){
  1185. return;
  1186. }
  1187. WEAKSELF
  1188. NSDictionary *dict = @{@"duration":@(5),
  1189. @"target":userId};
  1190. [kHttpManager toRemoveBlockWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1191. if(kCode_Success){
  1192. MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  1193. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
  1194. [weakSelf dismissLiveUserInfoView];
  1195. }
  1196. else{
  1197. MOLogV(@"toDeleteBlackList 接口报错了");
  1198. kShowNetError(data)
  1199. }
  1200. }];
  1201. }
  1202. - (void)toAddBlackListWith:(NSInteger)index{
  1203. NSString *userId = self.userId;
  1204. if(userId.length == 0){
  1205. return;
  1206. }
  1207. WEAKSELF
  1208. //时长(1=30分钟,2=24小时,3=3天,4=7天,5=永久) ps:新增黑名单时,字段非空
  1209. NSDictionary *dict = @{@"duration":@(index),
  1210. @"target":userId};
  1211. [kHttpManager toAddSomeOneForBlockWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1212. if(kCode_Success){
  1213. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
  1214. //主播或者管理员拉黑别人, 是有踢人消息发送的
  1215. if(weakSelf.viewType == MOLiveUserInfoViewTypeManager || weakSelf.viewType == MOLiveUserInfoViewTypeAnchor){
  1216. if(weakSelf.viewType == MOLiveUserInfoViewTypeManager && weakSelf.userModel.manage){
  1217. //如果自己是管理员, 而这个人也是管理员, 则不发送踢人消息
  1218. }
  1219. else{
  1220. MORtmEntity *entity = [MORtmEntity prepareRtmAboutKickSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId];
  1221. NSString *entityJsomString = entity.modelToJSONString;
  1222. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  1223. if(isSuccess){
  1224. }
  1225. }];
  1226. }
  1227. }
  1228. [weakSelf dismissLiveUserInfoView];
  1229. }
  1230. else{
  1231. kShowNetError(data)
  1232. }
  1233. }];
  1234. }
  1235. - (IBAction)familyBtnClick:(id)sender {
  1236. //家族按钮点击
  1237. self.familyBtnBlock ? self.familyBtnBlock() : nil;
  1238. }
  1239. - (IBAction)fanClubBtnClick:(id)sender {
  1240. //粉丝团按钮点击
  1241. self.fanClubBtnBlock ? self.fanClubBtnBlock() : nil;
  1242. }
  1243. - (IBAction)contributionBtnClick:(id)sender {
  1244. //贡献榜按钮点击
  1245. }
  1246. - (IBAction)headBtnClick:(id)sender {
  1247. BOOL isMySterious = GetIsMysterious;
  1248. if(self.userModel.userProfile.mysterious || isMySterious){//神秘人
  1249. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_vip_mystery_man_tip_1")];
  1250. return;
  1251. }
  1252. self.headBtnBlock ? self.headBtnBlock(self.userModel) : nil;
  1253. [self dismissLiveUserInfoView];
  1254. }
  1255. - (IBAction)focusBtnClick:(UIButton *)sender {
  1256. BOOL isMySterious = GetIsMysterious;
  1257. if(self.userModel.userProfile.mysterious || isMySterious){//神秘人
  1258. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_vip_mystery_man_tip_1")];
  1259. return;
  1260. }
  1261. if([self.userId isEqualToString:GetUserId]){
  1262. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  1263. return;
  1264. }
  1265. if(sender == self.followBtn){
  1266. if(self.followBtn.selected){
  1267. WEAKSELF
  1268. MOTitleNormalAlertView *alertView = [[MOTitleNormalAlertView alloc] init];
  1269. alertView.titleLabel.text = NSLocalString(@"mimo_alert_normal_tip");
  1270. alertView.subTitleLabel.text = NSLocalString(@"mimo_un_follow_tip");
  1271. [alertView.cancelBtn setTitle:NSLocalString(@"mimo_Cancel") forState:UIControlStateNormal];
  1272. [alertView.confirmBtn setTitle:NSLocalString(@"mimo_TipConfirm") forState:UIControlStateNormal];
  1273. alertView.confirmBlock = ^{
  1274. //已关注 - 触发取关
  1275. [weakSelf toFollowSomeOneWith:2];
  1276. };
  1277. [alertView show];
  1278. }
  1279. else{
  1280. //未关注 - 触发关注
  1281. [self toFollowSomeOneWith:1];
  1282. }
  1283. }
  1284. else{
  1285. if(self.followBtnTwo.selected){
  1286. WEAKSELF
  1287. MOTitleNormalAlertView *alertView = [[MOTitleNormalAlertView alloc] init];
  1288. alertView.titleLabel.text = NSLocalString(@"mimo_alert_normal_tip");
  1289. alertView.subTitleLabel.text = NSLocalString(@"mimo_un_follow_tip");
  1290. [alertView.cancelBtn setTitle:NSLocalString(@"mimo_Cancel") forState:UIControlStateNormal];
  1291. [alertView.confirmBtn setTitle:NSLocalString(@"mimo_TipConfirm") forState:UIControlStateNormal];
  1292. alertView.confirmBlock = ^{
  1293. //已关注 - 触发取关
  1294. [weakSelf toFollowSomeOneWith:2];
  1295. };
  1296. [alertView show];
  1297. }
  1298. else{
  1299. //未关注 - 触发关注
  1300. [self toFollowSomeOneWith:1];
  1301. }
  1302. }
  1303. //关注按钮点击
  1304. self.focusBtnBlock ? self.focusBtnBlock() : nil;
  1305. }
  1306. //类型(1=关注,2=取关)
  1307. - (void)toFollowSomeOneWith:(NSInteger)type{
  1308. if(self.userId.length == 0){
  1309. return;
  1310. }
  1311. if([self.userId isEqualToString:GetUserId]){
  1312. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  1313. return;
  1314. }
  1315. NSArray *targetArr = @[self.userId];
  1316. NSDictionary *dict;
  1317. if(self.roomId.length == 0){
  1318. dict = @{@"type":@(type),
  1319. @"target":targetArr};
  1320. }
  1321. else{
  1322. dict = @{@"type":@(type),
  1323. @"roomId":self.roomId,
  1324. @"target":targetArr};
  1325. }
  1326. WEAKSELF
  1327. [kHttpManager toSubmitForFollowWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1328. if(kCode_Success){
  1329. MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  1330. BOOL isFollow = (type == 1) ? YES : NO;
  1331. weakSelf.userModel.follow = isFollow;
  1332. weakSelf.followBtn.selected = isFollow;
  1333. [weakSelf showFollowUI:isFollow];
  1334. weakSelf.followBtnTwo.selected = isFollow;
  1335. weakSelf.followChangeBlock ? weakSelf.followChangeBlock(weakSelf.userModel) : nil;
  1336. if(isFollow){
  1337. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_Tip_Follow_Success")];
  1338. SendNotification(@"kNotification_FollowSuccess")
  1339. }
  1340. else{
  1341. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_Tip_Unsullowed_Success")];
  1342. }
  1343. }
  1344. else{
  1345. kShowNetError(data)
  1346. }
  1347. }];
  1348. }
  1349. - (IBAction)giftBtnClick:(id)sender {
  1350. if([self.userId isEqualToString:GetUserId]){
  1351. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  1352. return;
  1353. }
  1354. //礼物按钮点击
  1355. self.giftBtnBlock ? self.giftBtnBlock() : nil;
  1356. }
  1357. - (IBAction)aiteBtnClick:(id)sender {
  1358. if([self.userId isEqualToString:GetUserId]){
  1359. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  1360. return;
  1361. }
  1362. self.aiteActionBlock ? self.aiteActionBlock(self.userModel) : nil;
  1363. [self dismissLiveUserInfoView];
  1364. }
  1365. - (IBAction)chatBtnClick:(id)sender {
  1366. if([self.userId isEqualToString:GetUserId]){
  1367. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  1368. return;
  1369. }
  1370. if(self.userModel.userProfile.id.length == 0){
  1371. return;
  1372. }
  1373. BOOL isMySterious = GetIsMysterious;
  1374. if(self.userModel.userProfile.mysterious || isMySterious){//神秘人
  1375. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_vip_mystery_man_tip_1")];
  1376. return;
  1377. }
  1378. //聊天按钮点击
  1379. self.chatBtnBlock ? self.chatBtnBlock(self.userModel) : nil;
  1380. [self dismissLiveUserInfoView];
  1381. }
  1382. - (IBAction)copyUserIdBtnClick:(id)sender {
  1383. return;
  1384. UIPasteboard *pab = [UIPasteboard generalPasteboard];
  1385. [pab setString:self.userModel.userProfile.userNo];
  1386. if (pab == nil)
  1387. {
  1388. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_money_Failed")];
  1389. }
  1390. else
  1391. {
  1392. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_copy_tip")];
  1393. }
  1394. }
  1395. - (IBAction)inviteBtnClick:(id)sender {
  1396. WEAKSELF
  1397. if(self.userId.length == 0 || self.roomId.length == 0){
  1398. return;
  1399. }
  1400. if([self.userId isEqualToString:GetUserId]){
  1401. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
  1402. return;
  1403. }
  1404. if(self.inviteBtn.selected){
  1405. return;
  1406. }
  1407. NSDictionary *dict = @{@"roomId":self.roomId,
  1408. @"userId":self.userId};
  1409. [kHttpManager toGetTheUserLinkStrWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1410. if(kCode_Success){
  1411. MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  1412. weakSelf.inviteBtn.selected = YES;
  1413. NSString *linkStr = [MODataManager objectOrNilForKey:@"result" fromDictionary:data[@"data"]];
  1414. if(linkStr.length > 0){
  1415. MOUserProfile *profile = [[MOUserProfile alloc] init];
  1416. profile.id = weakSelf.userId;
  1417. MOLinkMic *linkMic = [[MOLinkMic alloc] init];
  1418. linkMic.profile = profile;
  1419. linkMic.invite = linkStr;
  1420. linkMic.camera = weakSelf.camera;
  1421. MORtmEntity *entity = [MORtmEntity prepareRtmManageAgreeLianMaiMessageAndLinkMicType:3 AndStatus:6 AndRoomId:weakSelf.roomId AndMOLinkMic:linkMic AndSeatNum:1];
  1422. NSString *entityJsomString = entity.modelToJSONString;
  1423. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  1424. if(isSuccess){
  1425. }
  1426. }];
  1427. }
  1428. }
  1429. else{
  1430. MOLogV(@"toGetTheUserLinkStrWithParams 接口报错了");
  1431. kShowNetError(data)
  1432. }
  1433. }];
  1434. }
  1435. - (IBAction)voiceTypeChangeBtnClick:(UIButton *)sender {
  1436. WEAKSELF
  1437. if(sender == self.voiceTypeBtn){
  1438. //音频模式
  1439. NSInteger seatNum = [self getTheUserSeatNum];
  1440. [self toSwitchTheVoiceTypeWith:seatNum Type:1 Lock:YES andBlock:^(BOOL isSuccess) {
  1441. if(isSuccess){
  1442. weakSelf.selectBtnCenterX.constant = -28.0;
  1443. [UIView animateWithDuration:0.3 animations:^{
  1444. [weakSelf layoutIfNeeded];
  1445. }];
  1446. }
  1447. }];
  1448. }
  1449. else{
  1450. //视频模式
  1451. NSInteger seatNum = [self getTheUserSeatNum];
  1452. [self toSwitchTheVoiceTypeWith:seatNum Type:1 Lock:NO andBlock:^(BOOL isSuccess) {
  1453. if(isSuccess){
  1454. weakSelf.selectBtnCenterX.constant = 28.0;
  1455. [UIView animateWithDuration:0.3 animations:^{
  1456. [weakSelf layoutIfNeeded];
  1457. }];
  1458. }
  1459. }];
  1460. }
  1461. }
  1462. - (NSInteger)getTheUserSeatNum{
  1463. NSInteger seatNum = 1;
  1464. BOOL isHave = NO;
  1465. for (MOLinkMic *object in self.linkMics) {
  1466. if([object.profile.id isEqualToString:self.userId]){
  1467. isHave = YES;
  1468. break;
  1469. }
  1470. seatNum ++;
  1471. }
  1472. if(isHave){
  1473. return seatNum;
  1474. }
  1475. else{
  1476. return 0;
  1477. }
  1478. }
  1479. //type麦位类型(1=视频,2=音频,3=麦位)
  1480. //lock锁定状态(true=锁定,false=解锁)
  1481. - (void)toSwitchTheVoiceTypeWith:(NSInteger)positions Type:(NSInteger)type Lock:(BOOL)lock andBlock:(void (^)(BOOL isSuccess))block{
  1482. WEAKSELF
  1483. if(positions == 0){
  1484. //麦位无此用户
  1485. return;
  1486. }
  1487. if(self.roomId.length == 0){
  1488. return;
  1489. }
  1490. NSDictionary *dict = @{@"roomId":self.roomId,
  1491. @"positions":@[@(positions)],
  1492. @"type":@(type),
  1493. @"lock":@(lock)};
  1494. [kHttpManager toSwitchTheLinkMicDataWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1495. if(kCode_Success){
  1496. MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  1497. MORoomStatus *roomStatusData = [MORoomStatus modelObjectWithDictionary:data[@"data"]];
  1498. weakSelf.roomStatusChangeBlock ? weakSelf.roomStatusChangeBlock(roomStatusData) : nil;
  1499. block(YES);
  1500. }
  1501. else{
  1502. MOLogV(@"toSwitchTheLinkMicDataWithParams 接口报错了");
  1503. kShowNetError(data)
  1504. block(NO);
  1505. }
  1506. }];
  1507. }
  1508. - (IBAction)closeOrOpenTheVoiceBtnClick:(id)sender {
  1509. WEAKSELF
  1510. if(self.voiceBtn.selected){
  1511. //开麦
  1512. NSInteger seatNum = [self getTheUserSeatNum];
  1513. [self toSwitchTheVoiceTypeWith:seatNum Type:2 Lock:NO andBlock:^(BOOL isSuccess) {
  1514. if(isSuccess){
  1515. weakSelf.voiceBtn.selected = NO;
  1516. }
  1517. }];
  1518. }
  1519. else{
  1520. //闭麦
  1521. NSInteger seatNum = [self getTheUserSeatNum];
  1522. [self toSwitchTheVoiceTypeWith:seatNum Type:2 Lock:YES andBlock:^(BOOL isSuccess) {
  1523. if(isSuccess){
  1524. weakSelf.voiceBtn.selected = YES;
  1525. }
  1526. }];
  1527. }
  1528. }
  1529. - (IBAction)hangUpBtnClick:(id)sender {
  1530. //挂断
  1531. WEAKSELF
  1532. NSString *roomId = self.roomId;
  1533. NSString *targetUserId = self.userId;
  1534. NSInteger seatNum = [self getTheUserSeatNum];
  1535. MOLinkMic *linkMic;
  1536. for (MOLinkMic *object in self.linkMics) {
  1537. if([object.profile.id isEqualToString:self.userId]){
  1538. linkMic = [object copy];
  1539. break;
  1540. }
  1541. }
  1542. if(!linkMic){
  1543. //连麦列表中没有这个人
  1544. return;
  1545. }
  1546. if(roomId.length == 0 || targetUserId.length == 0){
  1547. return;
  1548. }
  1549. NSDictionary *dict = @{@"roomId":roomId,
  1550. @"userId":targetUserId};
  1551. [kHttpManager theManageToRemoveLinkMicWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  1552. if(kCode_Success){
  1553. MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  1554. //发送挂断连麦Rtm
  1555. MORtmEntity *entity = [MORtmEntity prepareRtmManageAgreeLianMaiMessageAndLinkMicType:3 AndStatus:4 AndRoomId:weakSelf.roomId AndMOLinkMic:linkMic AndSeatNum:seatNum];
  1556. NSString *entityJsomString = entity.modelToJSONString;
  1557. [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
  1558. if(isSuccess){
  1559. }
  1560. }];
  1561. weakSelf.hangUpBlock ? weakSelf.hangUpBlock(linkMic) : nil;
  1562. [weakSelf dismissLiveUserInfoView];
  1563. }
  1564. else{
  1565. kShowNetError(data)
  1566. }
  1567. }];
  1568. }
  1569. - (void)showLiveUserInfoView{
  1570. self.frame = CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT);
  1571. CGRect actionViewRect = self.bgView.frame;
  1572. actionViewRect.origin.y = SCREENHEIGHT;
  1573. self.bgView.frame = actionViewRect;
  1574. WEAKSELF
  1575. [UIView animateWithDuration:0.3 animations:^{
  1576. CGRect actionViewRect = weakSelf.bgView.frame;
  1577. actionViewRect.origin.y = SCREENHEIGHT - [MOLiveUserInfoView theViewHeight];
  1578. weakSelf.bgView.frame = actionViewRect;
  1579. }];
  1580. [self getUserContributionData];//请求贡献榜数据
  1581. //不能滑动
  1582. SendNotification(@"MOShowLivePagesVCCannotScroll")
  1583. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardHideOrShow:) name:UIKeyboardWillShowNotification object:nil];
  1584. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardHideOrShow:) name:UIKeyboardWillHideNotification object:nil];
  1585. //如果不是当前直播间
  1586. if(self.isNoCurrentRoom){
  1587. self.viewType = MOLiveUserInfoViewTypeNormal;
  1588. }
  1589. if(self.isOtherAnchorView){
  1590. self.adminBtn.hidden = YES;
  1591. if(!self.isCreateOpen){
  1592. self.liveGoBtnView.hidden = NO;
  1593. }
  1594. }
  1595. }
  1596. - (void)dismissLiveUserInfoView{
  1597. [[NSNotificationCenter defaultCenter] removeObserver:self];
  1598. //完成下移动画
  1599. WEAKSELF
  1600. [UIView animateWithDuration:0.3 animations:^
  1601. {
  1602. CGRect actionSheetViewRect = weakSelf.bgView.frame;
  1603. actionSheetViewRect.origin.y = SCREENHEIGHT;
  1604. weakSelf.bgView.frame = actionSheetViewRect;
  1605. } completion:^(BOOL finished)
  1606. {
  1607. [self removeFromSuperview];
  1608. if (self.dismissViewBlock) {
  1609. self.dismissViewBlock(self.userId);
  1610. }
  1611. }];
  1612. //可以滑动
  1613. SendNotification(@"MOShowLivePagesVCCanScroll")
  1614. }
  1615. #pragma mark - MsgSendView
  1616. - (void)keyboardHideOrShow:(NSNotification *)notification{
  1617. WEAKSELF
  1618. NSString *notificationName = notification.name;
  1619. if ([notificationName isEqualToString:UIKeyboardWillShowNotification] == YES) {
  1620. //展示
  1621. CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
  1622. [UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:1 options:UIViewAnimationOptionCurveLinear animations:^
  1623. {
  1624. if(weakSelf.isShowReport){
  1625. [weakSelf.reportView mas_updateConstraints:^(MASConstraintMaker *make)
  1626. {
  1627. make.bottom.equalTo(self).offset(-keyboardFrame.size.height);
  1628. }];
  1629. [weakSelf layoutIfNeeded];
  1630. }
  1631. } completion:^(BOOL finished)
  1632. {
  1633. }];
  1634. }
  1635. else if ([notificationName isEqualToString:UIKeyboardWillHideNotification] == YES){
  1636. //隐藏
  1637. [UIView animateWithDuration:0.2 animations:^
  1638. {
  1639. if(weakSelf.isShowReport){
  1640. [weakSelf.reportView mas_updateConstraints:^(MASConstraintMaker *make)
  1641. {
  1642. make.bottom.equalTo(self).offset(0);
  1643. }];
  1644. [weakSelf layoutIfNeeded];
  1645. }
  1646. }];
  1647. }
  1648. }
  1649. - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
  1650. {
  1651. if (self.clipsToBounds || self.hidden || (self.alpha == 0.f))
  1652. {
  1653. return nil;
  1654. }
  1655. UIView *result = [super hitTest:point withEvent:event];
  1656. // 把这个坐标从tabbar的坐标系转为subview的坐标系
  1657. CGPoint subPoint = [self.headBtn convertPoint:point fromView:self];
  1658. if([self.headBtn pointInside:subPoint withEvent:event]){
  1659. return self.headBtn;
  1660. }
  1661. // 如果事件发生在tabbar里面直接返回
  1662. return result;
  1663. }
  1664. - (MOReportSomeOneView *)reportView{
  1665. if(!_reportView){
  1666. _reportView = [MOReportSomeOneView moReportSomeOneView];
  1667. }
  1668. return _reportView;
  1669. }
  1670. - (MOSVGACustomPlayer *)aPlayer{
  1671. if (_aPlayer == nil) {
  1672. _aPlayer = [[MOSVGACustomPlayer alloc] init];
  1673. _aPlayer.contentMode = UIViewContentModeScaleAspectFill;
  1674. _aPlayer.loops = 0;
  1675. _aPlayer.clearsAfterStop = NO;
  1676. }
  1677. return _aPlayer;
  1678. }
  1679. - (SVGAParser *)aParser{
  1680. if (_aParser == nil) {
  1681. _aParser = [[SVGAParser alloc] init];
  1682. }
  1683. return _aParser;
  1684. }
  1685. - (UIImageView *)vipImgView{
  1686. if(!_vipImgView){
  1687. _vipImgView = [[UIImageView alloc] init];
  1688. _vipImgView.contentMode = UIViewContentModeScaleAspectFit;
  1689. }
  1690. return _vipImgView;
  1691. }
  1692. - (MOBaseLevelView *)levelImgView{
  1693. if(!_levelImgView){
  1694. _levelImgView = [[MOBaseLevelView alloc] init];
  1695. }
  1696. return _levelImgView;
  1697. }
  1698. - (UIImageView *)videoImgView{
  1699. if(!_videoImgView){
  1700. _videoImgView = [[UIImageView alloc] init];
  1701. [_videoImgView setImage:[UIImage imageNamed:@"icon_mine_video"]];
  1702. }
  1703. return _videoImgView;
  1704. }
  1705. - (UIImageView *)audioImgView{
  1706. if(!_audioImgView){
  1707. _audioImgView = [[UIImageView alloc] init];
  1708. [_audioImgView setImage:[UIImage imageNamed:@"icon_mine_audio"]];
  1709. }
  1710. return _audioImgView;
  1711. }
  1712. - (MOFansLevelView *)fansLevelView{
  1713. if(!_fansLevelView){
  1714. _fansLevelView = [MOFansLevelView moFansLevelView];
  1715. }
  1716. return _fansLevelView;
  1717. }
  1718. - (MOStatusButton *)statusBtn
  1719. {
  1720. if (!_statusBtn)
  1721. {
  1722. _statusBtn = [MOStatusButton buttonWithType:UIButtonTypeCustom];
  1723. _statusBtn.frame = CGRectMake(0, 0, 100, 19.0);
  1724. _statusBtn.backgroundColor = [MOTools colorWithHexString:@"#120817" alpha:0.6];
  1725. _statusBtn.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
  1726. _statusBtn.userInteractionEnabled = NO;
  1727. [_statusBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  1728. _statusBtn.titleLabel.font = [MOTextTools getTheFontWithSize:StatusFont AndFontName:kNormalContentFontStr];
  1729. _statusBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
  1730. _statusBtn.contentMode = UIViewContentModeScaleAspectFill;
  1731. }
  1732. return _statusBtn;
  1733. }
  1734. - (MOFanClubNameplateView *)nameplateView{
  1735. if(!_nameplateView){
  1736. _nameplateView = [[MOFanClubNameplateView alloc] init];
  1737. }
  1738. return _nameplateView;
  1739. }
  1740. - (MOStarNumView *)startView{
  1741. if(!_startView){
  1742. _startView = [[MOStarNumView alloc] init];
  1743. }
  1744. return _startView;
  1745. }
  1746. - (MOMsgContentTextView *)infoImgView{
  1747. if(!_infoImgView){
  1748. _infoImgView = [MOMsgContentTextView new];
  1749. _infoImgView.backgroundColor = [UIColor clearColor];
  1750. _infoImgView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0);//UITextView原本文字距离左右有间距,设置负数消除边距
  1751. _infoImgView.editable = NO;
  1752. _infoImgView.scrollEnabled = NO;//防止滑出屏幕又滑入时有时单行文字消失
  1753. _infoImgView.userInteractionEnabled = NO;
  1754. _infoImgView.textColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0];
  1755. _infoImgView.textAlignment = NSTextAlignmentCenter;
  1756. }
  1757. return _infoImgView;
  1758. }
  1759. - (MOMsgContentTextView *)medalView{
  1760. if(!_medalView){
  1761. _medalView = [MOMsgContentTextView new];
  1762. _medalView.backgroundColor = [UIColor clearColor];
  1763. _medalView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 5);//UITextView原本文字距离左右有间距,设置负数消除边距
  1764. _medalView.editable = NO;
  1765. _medalView.scrollEnabled = NO;//防止滑出屏幕又滑入时有时单行文字消失
  1766. _medalView.userInteractionEnabled = NO;
  1767. _medalView.textColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0];
  1768. _medalView.textAlignment = NSTextAlignmentCenter;
  1769. }
  1770. return _medalView;
  1771. }
  1772. - (MOTopsUserView *)topsView{
  1773. if(!_topsView){
  1774. _topsView = [MOTopsUserView moTopsUserView];
  1775. }
  1776. return _topsView;
  1777. }
  1778. - (MOLiveGoBtnView *)liveGoBtnView{
  1779. if(!_liveGoBtnView){
  1780. WEAKSELF
  1781. _liveGoBtnView = [[MOLiveGoBtnView alloc] init];
  1782. _liveGoBtnView.btnClickBlock = ^{
  1783. weakSelf.liveGoBtnClickBlock ? weakSelf.liveGoBtnClickBlock() : nil;
  1784. [weakSelf dismissLiveUserInfoView];
  1785. };
  1786. }
  1787. return _liveGoBtnView;
  1788. }
  1789. @end