YOUPAIBBProfileHeaderView.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. //
  2. // YOUPAIBBProfileHeaderView.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/10/19.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIBBProfileHeaderView.h"
  9. //#import "YOUPAILCEditUserMsgVC.h"
  10. #import "YOUPAILCFollowVC.h"
  11. #import "YOUPAILCFansVC.h"
  12. #import "YOUPAILCSeenVC.h"
  13. #import "YOUPAILCVisitVC.h"
  14. #import "YOUPAILZProfitVC.h"
  15. #import "YOUPAIZYVideoLikesVC.h"
  16. #import "YOUPAIXRWalletVC.h"
  17. #import "LZAlertWindow.h"
  18. #import "UIViewController+TFPresent.h"
  19. #import "YOUPAILZLevelView.h"
  20. #import "YOUPAILZAvatarView.h"
  21. #import "YOUPAIBBSettingVC.h"
  22. #import "YOUPAILZUserShowVC.h"
  23. #import "MSYMineinfoEditVC.h"
  24. @interface BBProfileBadgeButton : UIButton
  25. @property (nonatomic, assign) NSInteger youpaipbadgeValue;
  26. @property (nonatomic, assign) NSInteger youpaipcount;
  27. @property (nonatomic, strong) NSString *youpaiptitleStr;
  28. @property (nonatomic, weak) UILabel *youpaipcountL;
  29. @property (nonatomic, weak) UILabel *youpaiptitleL;
  30. @property (nonatomic, weak) UILabel *youpaipbadgeL;
  31. @property (nonatomic, weak) UIView *youpaipbadgeBgV;
  32. @end
  33. @implementation BBProfileBadgeButton
  34. - (instancetype)init{
  35. if (self = [super init]) {
  36. [self youpaifinitUI];
  37. }
  38. return self;
  39. }
  40. - (void)youpaifinitUI{
  41. UILabel *youpaipcountL = [[UILabel alloc] init];
  42. youpaipcountL.font = LCFont(16.0f);
  43. youpaipcountL.textColor = LZ273145Color;
  44. [self addSubview:youpaipcountL];
  45. self.youpaipcountL = youpaipcountL;
  46. [youpaipcountL mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.centerX.equalTo(self);
  48. make.top.offset(0.0f);
  49. }];
  50. UILabel *youpaiptitleL = [[UILabel alloc] init];
  51. youpaiptitleL.font = LCFont(12.0f);
  52. youpaiptitleL.textColor = LZA3AABEColor;
  53. youpaiptitleL.textAlignment = NSTextAlignmentCenter;
  54. [self addSubview:youpaiptitleL];
  55. self.youpaiptitleL = youpaiptitleL;
  56. [youpaiptitleL mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.bottom.left.right.offset(0.0f);
  58. }];
  59. UIView *youpaipbadgeBgV = [[UIView alloc] init];
  60. youpaipbadgeBgV.backgroundColor = HexColorFromRGB(0xF4003F);
  61. youpaipbadgeBgV.layer.cornerRadius = 7.0f;
  62. youpaipbadgeBgV.clipsToBounds = YES;
  63. youpaipbadgeBgV.hidden = YES;
  64. [self addSubview:youpaipbadgeBgV];
  65. self.youpaipbadgeBgV = youpaipbadgeBgV;
  66. [youpaipbadgeBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  67. make.left.equalTo(youpaipcountL.mas_right).offset(-5.0f);
  68. make.bottom.equalTo(youpaipcountL.mas_top).offset(5.0f);
  69. make.height.offset(14.0f);
  70. make.width.greaterThanOrEqualTo(14.0f);
  71. }];
  72. UILabel *youpaipbadgeL = [[UILabel alloc] init];
  73. youpaipbadgeL.font = LCFont(10.0f);
  74. youpaipbadgeL.textColor = [UIColor whiteColor];
  75. youpaipbadgeL.textAlignment = NSTextAlignmentCenter;
  76. [youpaipbadgeBgV addSubview:youpaipbadgeL];
  77. self.youpaipbadgeL = youpaipbadgeL;
  78. [youpaipbadgeL mas_makeConstraints:^(MASConstraintMaker *make) {
  79. make.left.offset(2.0f);
  80. make.right.offset(-2.0f);
  81. make.top.bottom.offset(0.0f);
  82. }];
  83. }
  84. -(void)setYoupaipbadgeValue:(NSInteger)youpaipbadgeValue
  85. {
  86. _youpaipbadgeValue = youpaipbadgeValue;
  87. self.youpaipbadgeBgV.hidden = youpaipbadgeValue <= 0;
  88. self.youpaipbadgeL.text = [NSString stringWithFormat:@"%ld",youpaipbadgeValue];
  89. if (youpaipbadgeValue > 99) {
  90. self.youpaipbadgeL.text = @"99+";
  91. }
  92. }
  93. - (void)setYoupaiptitleStr:(NSString *)youpaiptitleStr{
  94. _youpaiptitleStr = youpaiptitleStr;
  95. self.youpaiptitleL.text = youpaiptitleStr;
  96. }
  97. -(void)setYoupaipcount:(NSInteger)youpaipcount
  98. {
  99. _youpaipcount= youpaipcount;
  100. self.youpaipcountL.text = [NSString stringWithFormat:@"%@",@(youpaipcount)];
  101. }
  102. @end
  103. @interface YOUPAIBBProfileHeaderView()
  104. @property (nonatomic, weak) YOUPAILZAvatarView *youpaipavatarImgV; // 头像
  105. @property (nonatomic,weak) UIImageView *youpaipanchorTagImgV;
  106. @property (nonatomic, weak) UILabel *youpaipnicknameL; // 昵称
  107. @property (nonatomic, weak) UIButton *youpaipidBtn; // id
  108. @property (nonatomic, weak) BBProfileBadgeButton *youpaipfollowBtn; // 关注
  109. @property (nonatomic, weak) BBProfileBadgeButton *youpaipfansBtn; // 粉丝
  110. @property (nonatomic, weak) BBProfileBadgeButton *youpaipvisitBtn; // 访客
  111. @property (nonatomic, weak) BBProfileBadgeButton *youpaipliveBtn; // 获赞
  112. @property (nonatomic, weak) UILabel *youpaipbalanceL; // 余额
  113. @property (nonatomic, weak) UILabel *youpaipprofitL; // 收益
  114. @property (nonatomic, strong) YOUPAILCUserModel *youpaipuserModel;
  115. @property (nonatomic, strong) YOUPAILZLiveCardModel *youpaipcardModel;
  116. @property (nonatomic, weak) UIImageView *youpaipvipV;
  117. @property (nonatomic, weak) UIImageView *youpaipbadgeImgV;
  118. @property (nonatomic, weak) YOUPAILZLevelView *youpaiplevelView;
  119. @end
  120. @implementation YOUPAIBBProfileHeaderView
  121. - (instancetype)initWithFrame:(CGRect)frame{
  122. if (self = [super initWithFrame:frame]) {
  123. [self youpaifinitUI];
  124. }
  125. return self;
  126. }
  127. - (void)youpaifinitUI{
  128. UIButton *editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  129. editBtn.frame = CGRectMake(0.0f, 0.0f, 64.0f, 20.0f);
  130. [editBtn setImage:[UIImage imageNamed:@"vqu_images_mine_arrow"] forState:UIControlStateNormal];
  131. [editBtn setImage:[UIImage imageNamed:@"vqu_images_mine_arrow"] forState:UIControlStateHighlighted];
  132. [editBtn setTitle:@"编辑资料" forState:UIControlStateNormal];
  133. [editBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  134. editBtn.titleLabel.font = LCFont(12.0f);
  135. [editBtn addTarget:self action:@selector(youpaifeditBtnClick) forControlEvents:UIControlEventTouchUpInside];
  136. CGFloat btnImageWidth = editBtn.imageView.bounds.size.width;
  137. CGFloat btnLabelWidth = editBtn.titleLabel.bounds.size.width;
  138. [editBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -btnImageWidth, 0, btnImageWidth)];
  139. [editBtn setImageEdgeInsets:UIEdgeInsetsMake(0, btnLabelWidth, 0, -btnLabelWidth)];
  140. [self addSubview:editBtn];
  141. [editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  142. make.right.offset(-20.0f);
  143. make.top.offset(34.0f + StatusBarHeight);
  144. make.height.offset(20.0f);
  145. make.width.offset(64.0f);
  146. }];
  147. //设置
  148. // UIButton *setMineBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  149. // [self addSubview:setMineBtn];
  150. // [setMineBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  151. // make.right.offset(-23.0f);
  152. // make.top.offset(15.0f + StatusBarHeight);
  153. // make.size.mas_equalTo(CGSizeMake(30, 18));
  154. // }];
  155. // [setMineBtn setImage:[UIImage imageNamed:@"vqu_images_setMine"] forState:UIControlStateNormal];
  156. // [setMineBtn addTarget:self action:@selector(youpaifsetMineBtnClick) forControlEvents:UIControlEventTouchUpInside];
  157. UIButton *userBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  158. [userBtn addTarget:self action:@selector(youpaifuserBtnClick) forControlEvents:UIControlEventTouchUpInside];
  159. [self addSubview:userBtn];
  160. [userBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  161. make.left.offset(20.0f);
  162. make.centerY.equalTo(editBtn).offset(-10.0f);
  163. make.height.offset(49.0f);
  164. make.right.equalTo(editBtn.mas_left).offset(-10.0f);
  165. }];
  166. YOUPAILZAvatarView *youpaipavatarImgV = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0.0f, 0.0f, 49.0f, 49.0f) avatarURL:nil personalityBoxURL:nil];
  167. youpaipavatarImgV.userInteractionEnabled = NO;
  168. [userBtn addSubview:youpaipavatarImgV];
  169. self.youpaipavatarImgV = youpaipavatarImgV;
  170. [youpaipavatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  171. make.left.top.bottom.offset(0.0f);
  172. make.width.offset(49.0f);
  173. }];
  174. UIImageView *youpaipanchorTagImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_anchor_vlog"]];
  175. youpaipanchorTagImgV.hidden = YES;
  176. [userBtn addSubview:youpaipanchorTagImgV];
  177. self.youpaipanchorTagImgV = youpaipanchorTagImgV;
  178. [youpaipanchorTagImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  179. make.right.equalTo(self.youpaipavatarImgV.youpaipavatarImgV.mas_right).offset(0.0f);
  180. make.bottom.equalTo(self.youpaipavatarImgV.youpaipavatarImgV.mas_bottom).offset(0.0f);
  181. make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
  182. }];
  183. UILabel *youpaipnicknameL = [[UILabel alloc] init];
  184. youpaipnicknameL.font = LCFont(19.0f);
  185. youpaipnicknameL.textColor = [UIColor blackColor];
  186. youpaipnicknameL.text = [LCSaveModel getUserModel].youpaipuserinfo.youpaipnickname;
  187. [userBtn addSubview:youpaipnicknameL];
  188. self.youpaipnicknameL = youpaipnicknameL;
  189. [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  190. make.left.equalTo(youpaipavatarImgV.mas_right).offset(10.0f);
  191. make.top.offset(0.0f);
  192. make.height.offset(24.5f);
  193. }];
  194. UIImageView *youpaipvipV = [[UIImageView alloc] init];
  195. [self addSubview:youpaipvipV];
  196. self.youpaipvipV = youpaipvipV;
  197. youpaipvipV.hidden = YES;
  198. [youpaipvipV mas_makeConstraints:^(MASConstraintMaker *make) {
  199. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  200. make.centerY.equalTo(youpaipnicknameL);
  201. }];
  202. UIImageView *youpaipbadgeImgV = [[UIImageView alloc] init];
  203. [self addSubview:youpaipbadgeImgV];
  204. self.youpaipbadgeImgV = youpaipbadgeImgV;
  205. youpaipbadgeImgV.hidden = YES;
  206. [youpaipbadgeImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  207. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  208. make.centerY.equalTo(youpaipnicknameL);
  209. }];
  210. YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init];
  211. [self addSubview:youpaiplevelView];
  212. self.youpaiplevelView = youpaiplevelView;
  213. youpaiplevelView.hidden = YES;
  214. [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) {
  215. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  216. make.centerY.equalTo(youpaipnicknameL);
  217. }];
  218. // UITapGestureRecognizer *tapGest = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(youpaiftouchUserLevel)];
  219. // [youpaiplevelView addGestureRecognizer:tapGest];
  220. UIButton *youpaipidBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  221. youpaipidBtn.titleLabel.font = LCFont12;
  222. [youpaipidBtn setTitleColor:LZA3AABEColor forState:UIControlStateNormal];
  223. [youpaipidBtn setTitle:[NSString stringWithFormat:@"ID:%@",[LCSaveModel getUserModel].youpaipuserinfo.youpaipusercode] forState:UIControlStateNormal];
  224. [youpaipidBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
  225. [userBtn addSubview:youpaipidBtn];
  226. self.youpaipidBtn = youpaipidBtn;
  227. [youpaipidBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  228. make.left.equalTo(youpaipavatarImgV.mas_right).offset(10.0f);
  229. make.bottom.offset(0.0f);
  230. make.top.equalTo(youpaipnicknameL.mas_bottom);
  231. }];
  232. UIButton *copyIDBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  233. [copyIDBtn setImage:[UIImage imageNamed:@"vqu_images_ic_profile_copy_code1"] forState:UIControlStateNormal];
  234. [copyIDBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
  235. [userBtn addSubview:copyIDBtn];
  236. [copyIDBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  237. make.left.equalTo(youpaipidBtn.mas_right).offset(3.0f);
  238. make.centerY.equalTo(youpaipidBtn.mas_centerY);
  239. make.size.mas_offset(CGSizeMake(12.0f, 12.0f));
  240. }];
  241. UIView *countBtnBgV = [[UIView alloc] init];
  242. [self addSubview:countBtnBgV];
  243. [countBtnBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  244. make.left.offset(12.0f);
  245. make.right.offset(-12.0f);
  246. make.top.equalTo(userBtn.mas_bottom).offset(21.0f);
  247. make.height.offset(35.0f);
  248. }];
  249. NSArray *btnContents = @[
  250. @{@"title":@"关注",@"count":@"0"},
  251. @{@"title":@"粉丝",@"count":@"0"},
  252. @{@"title":[LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0 ? @"获赞" : @"足迹",@"count":@"0"},
  253. @{@"title":@"访客",@"count":@"0"},
  254. ];
  255. NSArray *sels = @[
  256. @"youpaiffollowBtnClick",
  257. @"youpaiffansBtnClick",
  258. [LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0 ? @"youpaifliveBtnClick" : @"youpaifvisitClick",
  259. @"youpaifvisitBtnClick",
  260. ];
  261. NSMutableArray <BBProfileBadgeButton *> *btns = [NSMutableArray array];
  262. for (NSInteger i = 0; i < btnContents.count; i ++) {
  263. NSDictionary *youpaipdict = btnContents[i];
  264. BBProfileBadgeButton *badgeBtn = [[BBProfileBadgeButton alloc] init];
  265. badgeBtn.youpaipcount = [youpaipdict[@"count"] integerValue];
  266. badgeBtn.youpaiptitleStr = youpaipdict[@"title"];
  267. [countBtnBgV addSubview:badgeBtn];
  268. [badgeBtn addTarget:self action:NSSelectorFromString(sels[i]) forControlEvents:UIControlEventTouchUpInside];
  269. [btns addObject:badgeBtn];
  270. if (i == 0) {
  271. self.youpaipfollowBtn = badgeBtn;
  272. }else if (i == 1){
  273. self.youpaipfansBtn = badgeBtn;
  274. }else if (i == 2){
  275. self.youpaipliveBtn = badgeBtn;
  276. }else{
  277. self.youpaipvisitBtn = badgeBtn;
  278. }
  279. }
  280. [btns mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:0 leadSpacing:0 tailSpacing:0];
  281. [btns mas_makeConstraints:^(MASConstraintMaker *make) {
  282. make.top.bottom.offset(0.0f);
  283. }];
  284. for (NSInteger i = 1; i < btns.count; i ++) {
  285. BBProfileBadgeButton *badgeBtn = btns[i];
  286. UIView *line = [[UIView alloc] init];
  287. line.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.22f];
  288. [countBtnBgV addSubview:line];
  289. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  290. make.right.equalTo(badgeBtn.mas_left);
  291. make.centerY.equalTo(badgeBtn);
  292. make.size.mas_offset(CGSizeMake(1.0f, 10.0f));
  293. }];
  294. }
  295. UIView *walletBgV = [[UIView alloc] init];
  296. walletBgV.backgroundColor = HexColorFromRGB(0xffffff);
  297. walletBgV.layer.cornerRadius = 5.0f;
  298. walletBgV.clipsToBounds = YES;
  299. [self addSubview:walletBgV];
  300. [walletBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  301. make.left.offset(20.0f);
  302. make.right.bottom.offset(-20.0f);
  303. make.height.offset(86.0f);
  304. }];
  305. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(youpaifbalanceBtnClick)];
  306. [walletBgV addGestureRecognizer:tap];
  307. UIImageView *imgV = [[UIImageView alloc] init];
  308. imgV.image =[UIImage imageNamed:@"vqu_images_ic_profile_balance"];
  309. [walletBgV addSubview:imgV];
  310. [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  311. make.left.offset(ScaleSize(30.0f));
  312. make.centerY.equalTo(walletBgV);
  313. make.size.mas_offset(CGSizeMake(50.0f, 64.0f));
  314. }];
  315. UILabel *numberL = [[UILabel alloc] init];
  316. numberL.text = [NSString stringWithFormat:@"%@",@"0"];
  317. numberL.font = LCBoldFont(16.0f);
  318. [walletBgV addSubview:numberL];
  319. [numberL mas_makeConstraints:^(MASConstraintMaker *make) {
  320. make.left.equalTo(imgV.mas_right).offset(10.0f);
  321. make.top.offset(0.0f);
  322. make.right.offset(-80.0f);
  323. make.bottom.offset(0.0f);
  324. }];
  325. self.youpaipbalanceL = numberL;
  326. UIButton *detailsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  327. detailsBtn.userInteractionEnabled = NO;
  328. detailsBtn.frame = CGRectMake(0.0f, 0.0f, 40.0f, 16.0f);
  329. [detailsBtn setImage:[UIImage imageNamed:@"vqu_images_mine_arrow"] forState:UIControlStateNormal];
  330. [detailsBtn setImage:[UIImage imageNamed:@"vqu_images_mine_arrow"] forState:UIControlStateHighlighted];
  331. [detailsBtn setTitle:@"充值" forState:UIControlStateNormal];
  332. [detailsBtn setTitleColor:HexColorFromRGB(0x9F9DA5) forState:UIControlStateNormal];
  333. detailsBtn.titleLabel.font = LCFont(12.0f);
  334. CGFloat bImageWidth = detailsBtn.imageView.bounds.size.width;
  335. CGFloat bLabelWidth = detailsBtn.titleLabel.bounds.size.width;
  336. [detailsBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -bImageWidth, 0, bImageWidth)];
  337. [detailsBtn setImageEdgeInsets:UIEdgeInsetsMake(0, bLabelWidth, 0, -bLabelWidth)];
  338. [walletBgV addSubview:detailsBtn];
  339. [detailsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  340. make.right.offset(-20.0f);
  341. make.centerY.equalTo(walletBgV);
  342. make.height.offset(16.0f);
  343. make.width.offset(40.0f);
  344. }];
  345. }
  346. - (void)youpaiftouchUserLevel{
  347. LZAlertAction *action = [LZAlertAction actionWithTitle:@"好的" handler:^(LZAlertAction *action) {
  348. }];
  349. action.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(KScreenWidth - 128.0f, 48.0f) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:GradientLeftToRight]];
  350. LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"" content:@"在视频中或直播中送礼即可提升等级" action:@[action]];
  351. alert.contentFont = LCFont16;
  352. alert.contentHorizontalSpace = 32.0f;
  353. [[LCTools getCurrentVC] TFPresentVC:alert completion:^{}];
  354. }
  355. /// 更新用户信息
  356. - (void)youpaifreloadUserInfoWithModel:(YOUPAILCUserModel *)youpaipuserModel{
  357. self.youpaipuserModel = youpaipuserModel;
  358. self.youpaipavatarImgV.youpaipavatarURL = [LCTools getImageUrlWithAddress:youpaipuserModel.youpaipuserinfo.youpaipavatar];
  359. self.youpaipavatarImgV.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:youpaipuserModel.youpaipuserinfo.youpaipavatar_frame];
  360. // [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipuserModel.userinfo.avatar]];
  361. self.youpaipnicknameL.text = youpaipuserModel.youpaipuserinfo.youpaipnickname;
  362. [self.youpaipidBtn setTitle:[NSString stringWithFormat:@"ID:%@",youpaipuserModel.youpaipuserinfo.youpaipusercode] forState:UIControlStateNormal];
  363. //self.youpaipanchorTagImgV.hidden = youpaipuserModel.userinfo.is_live != 1;
  364. [self youpaifreloadTags];
  365. }
  366. /// 更新数量信息
  367. - (void)youpaifreloadCountWithModel:(YOUPAILCUserCountModel *)model{
  368. self.youpaipfollowBtn.youpaipcount = model.youpaipfollow_count;
  369. self.youpaipfansBtn.youpaipcount = model.youpaipfans_count;
  370. self.youpaipfansBtn.youpaipbadgeValue = model.youpaipnew_fans_count;
  371. self.youpaipvisitBtn.youpaipcount = model.youpaipvisitor_count;
  372. self.youpaipvisitBtn.youpaipbadgeValue = model.youpaipnew_visitor_count;
  373. if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0) {
  374. self.youpaipliveBtn.youpaipbadgeValue = model.youpaipnew_videoTrendsLike_count;
  375. self.youpaipliveBtn.youpaipcount = model.youpaipvideoTrendsLike_count;
  376. }else{
  377. self.youpaipliveBtn.youpaipbadgeValue = 0;
  378. self.youpaipliveBtn.youpaipcount = model.youpaipviewer_count;
  379. }
  380. }
  381. /// 更新用户等级
  382. - (void)youpaifreloadUserLevelModel:(YOUPAILZLiveCardModel *)model{
  383. self.youpaipcardModel = model;
  384. [self youpaifreloadTags];
  385. }
  386. //
  387. //
  388. - (void)youpaifreloadTags{
  389. self.youpaipvipV.hidden = YES;
  390. self.youpaipbadgeImgV.hidden = YES;
  391. self.youpaiplevelView.hidden = YES;
  392. UIView *frontV;
  393. if (self.youpaipuserModel.youpaipuserinfo.youpaipvip_icon.length != 0) {
  394. self.youpaipvipV.hidden = NO;
  395. [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipuserModel.youpaipuserinfo.youpaipvip_icon]];
  396. [self.youpaipvipV mas_remakeConstraints:^(MASConstraintMaker *make) {
  397. if (frontV == nil) {
  398. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  399. }else{
  400. make.left.equalTo(frontV.mas_right).offset(3.0f);
  401. }
  402. make.centerY.equalTo(self.youpaipnicknameL);
  403. make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  404. }];
  405. frontV = self.youpaipvipV;
  406. }
  407. if (self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipfile.length != 0) {
  408. self.youpaipbadgeImgV.hidden = NO;
  409. [self.youpaipbadgeImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipfile]];
  410. [self.youpaipbadgeImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
  411. if (frontV == nil) {
  412. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  413. }else{
  414. make.left.equalTo(frontV.mas_right).offset(3.0f);
  415. }
  416. make.centerY.equalTo(self.youpaipnicknameL);
  417. make.size.mas_offset(CGSizeMake(self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipwidth, 17.0f));
  418. }];
  419. frontV = self.youpaipbadgeImgV;
  420. }
  421. self.youpaiplevelView.hidden = NO;
  422. [self.youpaiplevelView youpaifreloadWithIcon:self.youpaipcardModel.youpaipgrade.youpaipimg1 iconWidth:self.youpaipcardModel.youpaipgrade.youpaipicon_width bgImg:self.youpaipcardModel.youpaipgrade.youpaipimg2 bgImgWidth:self.youpaipcardModel.youpaipgrade.youpaipicon1_width levelName:self.youpaipcardModel.youpaipgrade.youpaipgrade_name level:self.youpaipcardModel.youpaipgrade.youpaipgrade];
  423. [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
  424. if (frontV == nil) {
  425. make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
  426. }else{
  427. make.left.equalTo(frontV.mas_right).offset(3.0f);
  428. }
  429. make.centerY.equalTo(self.youpaipnicknameL);
  430. make.size.mas_offset(self.youpaiplevelView.mj_size);
  431. }];
  432. }
  433. /// 更新账户资产信息
  434. /// balance 余额
  435. /// profit 收益
  436. - (void)youpaifreloadAccountWithBalance:(NSInteger)balance profit:(NSString *)profit{
  437. self.youpaipbalanceL.text = [NSString stringWithFormat:@"%@",@(balance)];
  438. self.youpaipprofitL.text = [NSString stringWithFormat:@"%@",profit];
  439. }
  440. // 设置点击事件
  441. -(void)youpaifsetMineBtnClick{
  442. YOUPAIBBSettingVC* setting = [[YOUPAIBBSettingVC alloc]init];
  443. setting.youpaipinfoModel = self.youpaipinfoModel;
  444. [[LCTools getCurrentVC].navigationController pushViewController:setting animated:YES];
  445. }
  446. // 编辑点击事件
  447. - (void)youpaifeditBtnClick{
  448. MSYMineinfoEditVC * editvc = [MSYMineinfoEditVC new];
  449. [[LCTools getCurrentVC].navigationController pushViewController:editvc animated:true];
  450. // YOUPAILCEditUserMsgVC* editMsg = [[YOUPAILCEditUserMsgVC alloc]init];
  451. // [[LCTools getCurrentVC].navigationController pushViewController:editMsg animated:YES];
  452. }
  453. // 用户信息点击事件
  454. - (void)youpaifuserBtnClick{
  455. YOUPAILZUserShowVC *showVC = [[YOUPAILZUserShowVC alloc]init];
  456. showVC.youpaipuserId = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
  457. [[LCTools getCurrentVC].navigationController pushViewController:showVC animated:YES];
  458. }
  459. // 复制ID点击事件
  460. - (void)youpaifcopyBtnClick{
  461. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
  462. pasteboard.string = self.youpaipuserModel.youpaipuserinfo.youpaipusercode;
  463. [ZCHUDHelper showTitle:@"复制成功"];
  464. }
  465. // 关注点击事件
  466. - (void)youpaiffollowBtnClick{
  467. YOUPAILCFollowVC* follow = [[YOUPAILCFollowVC alloc]init];
  468. [[LCTools getCurrentVC].navigationController pushViewController:follow animated:YES];
  469. }
  470. // 粉丝点击事件
  471. - (void)youpaiffansBtnClick{
  472. YOUPAILCFansVC* fan = [[YOUPAILCFansVC alloc]init];
  473. [[LCTools getCurrentVC].navigationController pushViewController:fan animated:YES];
  474. }
  475. // 访客点击事件
  476. - (void)youpaifvisitBtnClick{
  477. YOUPAILCSeenVC* seen = [[YOUPAILCSeenVC alloc]init];
  478. [[LCTools getCurrentVC].navigationController pushViewController:seen animated:YES];
  479. }
  480. // 获赞点击事件
  481. - (void)youpaifliveBtnClick{
  482. YOUPAIZYVideoLikesVC* fan = [[YOUPAIZYVideoLikesVC alloc]init];
  483. [[LCTools getCurrentVC].navigationController pushViewController:fan animated:YES];
  484. }
  485. // 足迹点击事件
  486. - (void)youpaifvisitClick{
  487. YOUPAILCVisitVC* visitVC = [[YOUPAILCVisitVC alloc]init];
  488. [[LCTools getCurrentVC].navigationController pushViewController:visitVC animated:YES];
  489. }
  490. // 账户余额
  491. - (void)youpaifbalanceBtnClick{
  492. YOUPAIXRWalletVC *wallet = [[YOUPAIXRWalletVC alloc]init];
  493. [[LCTools getCurrentVC].navigationController pushViewController:wallet animated:YES];
  494. }
  495. // 我的收益
  496. - (void)youpaifprofitBtnClick{
  497. YOUPAILZProfitVC *rechargeVC = [[YOUPAILZProfitVC alloc]init];
  498. [[LCTools getCurrentVC].navigationController pushViewController:rechargeVC animated:YES];
  499. }
  500. @end