YOUPAILZProfileHeaderView.m 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. //
  2. // YOUPAILZProfileHeaderView.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/6/30.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZProfileHeaderView.h"
  9. //#import "YOUPAILCEditUserMsgVC.h"
  10. #import "YOUPAILCFollowVC.h"
  11. #import "YOUPAILCFansVC.h"
  12. #import "YOUPAILCSeenVC.h"
  13. #import "YOUPAILCVisitVC.h"
  14. #import "YOUPAILZUserShowVC.h"
  15. #import "YOUPAILZProfitVC.h"
  16. #import "YOUPAIZYVideoLikesVC.h"
  17. #import "YOUPAIXRWalletVC.h"
  18. #import "LZAlertWindow.h"
  19. #import "UIViewController+TFPresent.h"
  20. #import "YOUPAILZLevelView.h"
  21. #import "YOUPAILZAvatarView.h"
  22. #import "YOUPAILCSettingVC.h"
  23. #import "YOUPAILZPersonalizedDressVC.h"
  24. #import "MSYMineinfoEditVC.h"
  25. #import "WHVipDropView.h"
  26. @interface LZProfileBadgeButton : UIButton
  27. @property (nonatomic, assign) NSInteger youpaipbadgeValue;
  28. @property (nonatomic, assign) NSInteger youpaipcount;
  29. @property (nonatomic, strong) NSString *youpaiptitleStr;
  30. @property (nonatomic, weak) UILabel *youpaipcountL;
  31. @property (nonatomic, weak) UILabel *youpaiptitleL;
  32. @property (nonatomic, weak) UILabel *youpaipbadgeL;
  33. @property (nonatomic, weak) UIView *youpaipbadgeBgV;
  34. @end
  35. @implementation LZProfileBadgeButton
  36. - (instancetype)init{
  37. if (self = [super init]) {
  38. [self youpaifinitUI];
  39. }
  40. return self;
  41. }
  42. - (void)youpaifinitUI{
  43. UILabel *countL = [[UILabel alloc] init];
  44. countL.font = LCBoldFont(16);
  45. countL.textColor = [UIColor whiteColor];
  46. [self addSubview:countL];
  47. self.youpaipcountL = countL;
  48. [countL mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.centerX.equalTo(self);
  50. make.top.offset(0.0f);
  51. }];
  52. UILabel *titleL = [[UILabel alloc] init];
  53. titleL.font = LCFont(12.0f);
  54. titleL.textColor = [UIColor whiteColor];
  55. titleL.textAlignment = NSTextAlignmentCenter;
  56. [self addSubview:titleL];
  57. self.youpaiptitleL = titleL;
  58. [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.bottom.left.right.offset(0.0f);
  60. }];
  61. UIView *badgeBgV = [[UIView alloc] init];
  62. badgeBgV.backgroundColor = HexColorFromRGB(0xF4003F);
  63. badgeBgV.layer.cornerRadius = 7.0f;
  64. badgeBgV.clipsToBounds = YES;
  65. badgeBgV.hidden = YES;
  66. [self addSubview:badgeBgV];
  67. self.youpaipbadgeBgV = badgeBgV;
  68. [badgeBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.left.equalTo(countL.mas_right).offset(-5.0f);
  70. make.bottom.equalTo(countL.mas_top).offset(5.0f);
  71. make.height.offset(14.0f);
  72. make.width.greaterThanOrEqualTo(14.0f);
  73. }];
  74. UILabel *badgeL = [[UILabel alloc] init];
  75. badgeL.font = LCFont(10.0f);
  76. badgeL.textColor = [UIColor whiteColor];
  77. badgeL.textAlignment = NSTextAlignmentCenter;
  78. [badgeBgV addSubview:badgeL];
  79. self.youpaipbadgeL = badgeL;
  80. [badgeL mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.left.offset(2.0f);
  82. make.right.offset(-2.0f);
  83. make.top.bottom.offset(0.0f);
  84. }];
  85. }
  86. - (void)setYoupaipbadgeValue:(NSInteger)badgeValue{
  87. _youpaipbadgeValue = badgeValue;
  88. self.youpaipbadgeBgV.hidden = badgeValue <= 0;
  89. self.youpaipbadgeL.text = [NSString stringWithFormat:@"%ld",badgeValue];
  90. if (badgeValue > 99) {
  91. self.youpaipbadgeL.text = @"99+";
  92. }
  93. }
  94. - (void)setYoupaiptitleStr:(NSString *)titleStr{
  95. _youpaiptitleStr = titleStr;
  96. self.youpaiptitleL.text = titleStr;
  97. }
  98. - (void)setYoupaipcount:(NSInteger)count{
  99. _youpaipcount = count;
  100. self.youpaipcountL.text = [NSString stringWithFormat:@"%@",@(count)];
  101. }
  102. @end
  103. @interface YOUPAILZProfileHeaderView()
  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) UILabel *signLab; // 个性签名
  109. @property (nonatomic, weak) LZProfileBadgeButton *youpaipfollowBtn; // 关注
  110. @property (nonatomic, weak) LZProfileBadgeButton *youpaipfansBtn; // 粉丝
  111. @property (nonatomic, weak) LZProfileBadgeButton *youpaipvisitBtn; // 访客
  112. @property (nonatomic, weak) LZProfileBadgeButton *youpaipliveBtn; // 获赞
  113. @property (nonatomic, weak) UILabel *youpaipbalanceL; // 余额
  114. @property (nonatomic, weak) UILabel *youpaipprofitL; // 收益
  115. @property (nonatomic, strong) YOUPAILCUserModel *youpaipuserModel;
  116. @property (nonatomic, strong) YOUPAILZLiveCardModel *youpaipcardModel;
  117. @property (nonatomic, weak) UIImageView *youpaipvipV;
  118. @property (nonatomic, weak) UIImageView *youpaipbadgeImgV;
  119. @property (nonatomic, weak) YOUPAILZLevelView *youpaiplevelView;
  120. @property (nonatomic, weak) UIView *youpaipredView;//红点
  121. @property(nonatomic,strong)UIButton *finishMessageBtn;
  122. @property(nonatomic,strong)NSTimer *timer;
  123. @property (nonatomic, strong) WHVipDropView *vipDropView;
  124. @end
  125. @implementation YOUPAILZProfileHeaderView
  126. - (instancetype)initWithFrame:(CGRect)frame{
  127. if (self = [super initWithFrame:frame]) {
  128. [self youpaifinitUI];
  129. }
  130. return self;
  131. }
  132. - (void)youpaifinitUI{
  133. UIButton *editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  134. editBtn.frame = CGRectMake(0.0f, 0.0f, WHScreenEqualWidth(80), WHScreenEqualWidth(28));
  135. [editBtn.layer setCornerRadius:WHScreenEqualWidth(14)];
  136. [editBtn.layer setMasksToBounds:YES];
  137. [editBtn setImage:[UIImage imageNamed:@"vqu_images_ic_profile_edit_arrow"] forState:UIControlStateNormal];
  138. [editBtn setImage:[UIImage imageNamed:@"vqu_images_ic_profile_edit_arrow"] forState:UIControlStateHighlighted];
  139. [editBtn setTitle:@"编辑资料" forState:UIControlStateNormal];
  140. [editBtn setBackgroundColor:[UIColor colorWithWhite:0 alpha:0.15]];
  141. [editBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  142. editBtn.titleLabel.font = LCFont(10.0f);
  143. [editBtn addTarget:self action:@selector(youpaifeditBtnClick) forControlEvents:UIControlEventTouchUpInside];
  144. CGFloat btnImageWidth = editBtn.imageView.bounds.size.width;
  145. CGFloat btnLabelWidth = editBtn.titleLabel.bounds.size.width;
  146. [editBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -btnImageWidth, 0, btnImageWidth)];
  147. [editBtn setImageEdgeInsets:UIEdgeInsetsMake(0, btnLabelWidth, 0, -btnLabelWidth)];
  148. [self addSubview:editBtn];
  149. [editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  150. make.right.offset(WHScreenEqualWidth(12));
  151. make.top.offset(37.0f + StatusBarHeight);
  152. make.height.offset(WHScreenEqualWidth(28));
  153. make.width.offset(WHScreenEqualWidth(80));
  154. }];
  155. //完善资料图片
  156. // UIButton *finishMessageBtn = [UIButton new];
  157. // self.finishMessageBtn = finishMessageBtn;
  158. // [self addSubview:finishMessageBtn];
  159. // [finishMessageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  160. // make.right.mas_equalTo(-12);
  161. // make.top.mas_equalTo(editBtn.mas_bottom).offset(0);
  162. // make.size.mas_equalTo(CGSizeMake(97, 29));
  163. // }];
  164. // [finishMessageBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_finish_bg"] forState:UIControlStateNormal];
  165. //
  166. // [finishMessageBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  167. // finishMessageBtn.titleLabel.font = [UIFont systemFontOfSize:11];
  168. //未读红点
  169. UIView *redView = [UIView new];
  170. [self addSubview:redView];
  171. self.youpaipredView = redView;
  172. [redView mas_makeConstraints:^(MASConstraintMaker *make) {
  173. make.right.mas_equalTo(editBtn.mas_left).offset(-4);
  174. make.centerY.mas_equalTo(editBtn).offset(15);
  175. make.size.mas_equalTo(CGSizeMake(4, 4));
  176. }];
  177. redView.layer.cornerRadius = 2;
  178. redView.layer.masksToBounds = YES;
  179. redView.backgroundColor = LCRedColor;
  180. redView.hidden = YES;
  181. UIButton *userBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  182. [userBtn addTarget:self action:@selector(youpaifuserBtnClick) forControlEvents:UIControlEventTouchUpInside];
  183. [self addSubview:userBtn];
  184. [userBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  185. make.left.offset(20.0f);
  186. make.top.equalTo(35.0f + StatusBarHeight);
  187. make.height.offset(65.0f);
  188. make.right.equalTo(editBtn.mas_left).offset(-10.0f);
  189. }];
  190. YOUPAILZAvatarView *avatarImgV = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0.0f, 0.0f, 65.0f, 65.0f) avatarURL:nil personalityBoxURL:nil];
  191. avatarImgV.userInteractionEnabled = NO;
  192. [userBtn addSubview:avatarImgV];
  193. self.youpaipavatarImgV = avatarImgV;
  194. [avatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  195. make.left.top.bottom.offset(0.0f);
  196. make.width.offset(65.0f);
  197. }];
  198. avatarImgV.userInteractionEnabled = YES;
  199. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifdidAvatarClick)];
  200. [avatarImgV addGestureRecognizer:tap];
  201. UIImageView *anchorTagImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_anchor_vlog"]];
  202. anchorTagImgV.hidden = YES;
  203. [userBtn addSubview:anchorTagImgV];
  204. self.youpaipanchorTagImgV = anchorTagImgV;
  205. [anchorTagImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  206. make.right.equalTo(self.youpaipavatarImgV.youpaipavatarImgV.mas_right).offset(0.0f);
  207. make.bottom.equalTo(self.youpaipavatarImgV.youpaipavatarImgV.mas_bottom).offset(0.0f);
  208. make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
  209. }];
  210. UILabel *nicknameL = [[UILabel alloc] init];
  211. nicknameL.font = LCBoldFont(16);
  212. nicknameL.textColor = [UIColor whiteColor];
  213. nicknameL.text = [LCSaveModel getUserModel].youpaipuserinfo.youpaipnickname;
  214. [userBtn addSubview:nicknameL];
  215. self.youpaipnicknameL = nicknameL;
  216. [nicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  217. make.left.equalTo(avatarImgV.mas_right).offset(10.0f);
  218. make.top.offset(0.0f);
  219. make.height.offset(20.5f);
  220. }];
  221. UIImageView *vipV = [[UIImageView alloc] init];
  222. [self addSubview:vipV];
  223. self.youpaipvipV = vipV;
  224. // vipV.hidden = YES;
  225. [vipV mas_makeConstraints:^(MASConstraintMaker *make) {
  226. make.left.equalTo(nicknameL);
  227. make.top.equalTo(nicknameL.mas_bottom).offset(3);
  228. }];
  229. UIImageView *badgeImgV = [[UIImageView alloc] init];
  230. [self addSubview:badgeImgV];
  231. self.youpaipbadgeImgV = badgeImgV;
  232. // badgeImgV.hidden = YES;
  233. [badgeImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  234. make.left.equalTo(nicknameL);
  235. make.top.equalTo(nicknameL.mas_bottom).offset(3);
  236. }];
  237. // 等级 凡人
  238. // YOUPAILZLevelView *levelView = [[YOUPAILZLevelView alloc] init];
  239. // [self addSubview:levelView];
  240. // self.youpaiplevelView = levelView;
  241. // levelView.hidden = YES;
  242. // [levelView mas_makeConstraints:^(MASConstraintMaker *make) {
  243. // make.left.equalTo(nicknameL);
  244. // make.top.equalTo(nicknameL.mas_bottom).offset(3);
  245. // }];
  246. // UITapGestureRecognizer *tapGest = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(youpaiftouchUserLevel)];
  247. // [levelView addGestureRecognizer:tapGest];
  248. UIButton *idBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  249. idBtn.titleLabel.font = LCFont12;
  250. [idBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  251. [idBtn setTitle:[NSString stringWithFormat:@"花舞号:%@",[LCSaveModel getUserModel].youpaipuserinfo.youpaipusercode] forState:UIControlStateNormal];
  252. [idBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
  253. [userBtn addSubview:idBtn];
  254. self.youpaipidBtn = idBtn;
  255. [idBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  256. make.left.equalTo(avatarImgV.mas_right).offset(10.0f);
  257. // make.bottom.offset(0.0f);
  258. make.top.equalTo(nicknameL.mas_bottom).offset(4);
  259. make.height.mas_equalTo(WHScreenEqualWidth(17));
  260. }];
  261. UIButton *copyIDBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  262. [copyIDBtn setImage:[UIImage imageNamed:@"vqu_images_chatroom_copy"] forState:UIControlStateNormal];
  263. [copyIDBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
  264. [userBtn addSubview:copyIDBtn];
  265. [copyIDBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  266. make.left.equalTo(idBtn.mas_right).offset(3.0f);
  267. make.centerY.equalTo(idBtn.mas_centerY);
  268. make.size.mas_offset(CGSizeMake(12.0f, 12.0f));
  269. }];
  270. UIView *countBtnBgV = [[UIView alloc] init];
  271. [self addSubview:countBtnBgV];
  272. [countBtnBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  273. make.left.offset(12.0f);
  274. make.right.offset(-12.0f);
  275. make.top.equalTo(avatarImgV.mas_bottom).offset(10.0f);
  276. make.height.offset(35.0f);
  277. }];
  278. // 个性签名
  279. UILabel *signLab = [[UILabel alloc] init];
  280. signLab.font = [UIFont systemFontOfSize:WHScreenEqualWidth(10)];
  281. signLab.textColor = [UIColor whiteColor];
  282. signLab.text = [LCSaveModel getUserModel].youpaipuserinfo.youpaipsign;
  283. [userBtn addSubview:signLab];
  284. self.signLab = signLab;
  285. [signLab mas_makeConstraints:^(MASConstraintMaker *make) {
  286. make.left.equalTo(avatarImgV.mas_right).offset(10.0f);
  287. make.top.equalTo(self.youpaipidBtn.mas_bottom).offset(WHScreenEqualWidth(5));
  288. make.height.offset(14.5f);
  289. make.width.mas_lessThanOrEqualTo(kFrameWidth/3*2);
  290. }];
  291. NSArray *btnContents = @[
  292. @{@"title":@"关注",@"count":@"0"},
  293. @{@"title":@"粉丝",@"count":@"0"},
  294. @{@"title":[LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0 ? @"获赞" : @"足迹",@"count":@"0"},
  295. @{@"title":@"访客",@"count":@"0"},
  296. ];
  297. NSArray *sels = @[
  298. @"youpaiffollowBtnClick",
  299. @"youpaiffansBtnClick",
  300. [LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0 ? @"youpaifliveBtnClick" : @"youpaifvisitClick",
  301. @"youpaifvisitBtnClick",
  302. ];
  303. NSMutableArray <LZProfileBadgeButton *> *btns = [NSMutableArray array];
  304. for (NSInteger i = 0; i < btnContents.count; i ++) {
  305. NSDictionary *dict = btnContents[i];
  306. LZProfileBadgeButton *badgeBtn = [[LZProfileBadgeButton alloc] init];
  307. badgeBtn.youpaipcount = [dict[@"count"] integerValue];
  308. badgeBtn.youpaiptitleStr = dict[@"title"];
  309. [countBtnBgV addSubview:badgeBtn];
  310. [badgeBtn addTarget:self action:NSSelectorFromString(sels[i]) forControlEvents:UIControlEventTouchUpInside];
  311. [btns addObject:badgeBtn];
  312. if (i == 0) {
  313. self.youpaipfollowBtn = badgeBtn;
  314. }else if (i == 1){
  315. self.youpaipfansBtn = badgeBtn;
  316. }else if (i == 2){
  317. self.youpaipliveBtn = badgeBtn;
  318. }else{
  319. self.youpaipvisitBtn = badgeBtn;
  320. }
  321. }
  322. [btns mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:0 leadSpacing:0 tailSpacing:0];
  323. [btns mas_makeConstraints:^(MASConstraintMaker *make) {
  324. make.top.bottom.offset(0.0f);
  325. }];
  326. [countBtnBgV addSubview:self.vipDropView]; // 会员入口
  327. LZProfileBadgeButton *tmp = btns.firstObject;
  328. [self.vipDropView mas_makeConstraints:^(MASConstraintMaker *make) {
  329. make.left.offset(WHScreenEqualWidth(0));
  330. make.right.offset(WHScreenEqualWidth(0));
  331. make.height.mas_equalTo(WHScreenEqualWidth(45));
  332. make.top.equalTo(tmp.mas_bottom).offset(WHScreenEqualWidth(18));
  333. }];
  334. for (NSInteger i = 1; i < btns.count; i ++) {
  335. LZProfileBadgeButton *badgeBtn = btns[i];
  336. UIView *line = [[UIView alloc] init];
  337. line.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.22f];
  338. [countBtnBgV addSubview:line];
  339. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  340. make.right.equalTo(badgeBtn.mas_left);
  341. make.centerY.equalTo(badgeBtn);
  342. make.size.mas_offset(CGSizeMake(1.0f, 10.0f));
  343. }];
  344. }
  345. UIView *walletBgV = [[UIView alloc] init];
  346. walletBgV.backgroundColor = [UIColor clearColor];
  347. [self addSubview:walletBgV];
  348. [walletBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  349. make.left.offset(12.0f);
  350. make.right.offset(-12.0f);
  351. make.top.equalTo(self.vipDropView.mas_bottom).offset(WHScreenEqualWidth(16));
  352. make.height.offset(64.0f);
  353. }];
  354. UIView *line = [[UIView alloc] init];
  355. line.backgroundColor = [UIColor clearColor];
  356. [walletBgV addSubview:line];
  357. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  358. make.centerY.equalTo(walletBgV);
  359. make.centerX.equalTo(walletBgV);
  360. make.size.mas_offset(CGSizeMake(9.0f, 64.0f));
  361. }];
  362. NSArray *walletContents = @[
  363. @{@"bgImage":[UIImage imageNamed:@"profile_balance_bg"],@"image":[UIImage imageNamed:@"vqu_images_ic_profile_balance"],@"number":@(0),@"details":@"我的钻石",@"arrow":@"vqu_images_mine_arrow"},
  364. @{@"bgImage":[UIImage imageNamed:@"profile_profit_bg"],@"image":[UIImage imageNamed:@"vqu_images_ic_profile_profit"],@"number":@(0),@"details":LCStr(word2),@"arrow":@"vqu_images_mine_arrow"}
  365. ];
  366. NSArray *walletSels = @[
  367. @"youpaifbalanceBtnClick",
  368. @"youpaifprofitBtnClick"
  369. ];
  370. NSMutableArray <UIButton *> *accountBtns = [NSMutableArray array];
  371. for (NSInteger i = 0; i < walletContents.count; i ++) {
  372. NSDictionary *dict = walletContents[i];
  373. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  374. [btn addTarget:self action:NSSelectorFromString(walletSels[i]) forControlEvents:UIControlEventTouchUpInside];
  375. [walletBgV addSubview:btn];
  376. [accountBtns addObject:btn];
  377. btn.layer.cornerRadius = 10;
  378. btn.layer.masksToBounds = YES;
  379. btn.backgroundColor = [UIColor clearColor];
  380. // [btn setBackgroundImage:dict[@"bgImage"] forState:UIControlStateNormal];
  381. // [btn setImage:dict[@"bgImage"] forState:(UIControlStateNormal)];
  382. // [btn.imageView setContentMode:(UIViewContentModeScaleToFill)];
  383. // [btn setContentMode:UIViewContentModeScaleAspectFit];
  384. // 渐变色背景
  385. UIImageView *bgImgV = [[UIImageView alloc] init];
  386. bgImgV.image = dict[@"bgImage"];
  387. [btn addSubview:bgImgV];
  388. [bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  389. make.edges.equalTo(btn);
  390. }];
  391. UIImageView *imgV = [[UIImageView alloc] init];
  392. imgV.image = dict[@"image"];
  393. [btn addSubview:imgV];
  394. [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  395. make.left.offset(WHScreenEqualWidth(15.0f));
  396. make.centerY.equalTo(btn);
  397. make.size.mas_offset(CGSizeMake(WHScreenEqualWidth(38), WHScreenEqualWidth(38)));
  398. }];
  399. UIImageView *arrowImage = [[UIImageView alloc] init];
  400. [btn addSubview:arrowImage];
  401. [arrowImage mas_makeConstraints:^(MASConstraintMaker *make) {
  402. make.right.offset(-ScaleSize(10));
  403. make.centerY.equalTo(0);
  404. make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
  405. }];
  406. arrowImage.image = [UIImage imageNamed:dict[@"arrow"]];
  407. UILabel *numberL = [[UILabel alloc] init];
  408. numberL.text = [NSString stringWithFormat:@"%@",dict[@"number"]];
  409. numberL.font = LCBoldFont(14.0f);
  410. numberL.textColor = HexColorFromRGB(0x1C1D23);
  411. [btn addSubview:numberL];
  412. [numberL mas_makeConstraints:^(MASConstraintMaker *make) {
  413. make.left.equalTo(imgV.mas_right).offset(5.0f);
  414. make.top.offset(17.0f);
  415. make.right.offset(-20.0f);
  416. }];
  417. if (i == 0) {
  418. self.youpaipbalanceL = numberL;
  419. }else{
  420. self.youpaipprofitL = numberL;
  421. }
  422. UIButton *detailsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  423. detailsBtn.userInteractionEnabled = NO;
  424. detailsBtn.frame = CGRectMake(0.0f, 0.0f, 43.0f, 16.0f);
  425. [detailsBtn setTitle:dict[@"details"] forState:UIControlStateNormal];
  426. [detailsBtn setTitleColor:HexColorFromRGB(0xA3AABE) forState:UIControlStateNormal];
  427. detailsBtn.titleLabel.font = LCFont(10.0f);
  428. // CGFloat btnImageWidth = detailsBtn.imageView.bounds.size.width;
  429. // CGFloat btnLabelWidth = detailsBtn.titleLabel.bounds.size.width;
  430. // [detailsBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -btnImageWidth, 0, btnImageWidth)];
  431. // [detailsBtn setImageEdgeInsets:UIEdgeInsetsMake(0, btnLabelWidth, 0, -btnLabelWidth)];
  432. [btn addSubview:detailsBtn];
  433. [detailsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  434. make.left.equalTo(numberL);
  435. make.top.equalTo(numberL.mas_bottom).offset(0.0f);
  436. make.height.offset(16.0f);
  437. make.width.offset(43.0f);
  438. }];
  439. }
  440. /*等间隔排列 - 多个固定大小固定,间隔空隙变化
  441. * axisType 轴线方向 横排还是竖排
  442. * withFixedItemLength 控件的宽或高
  443. * leadSpacing 头部间隔 第一个控件与边缘的间隔
  444. * tailSpacing 尾部间隔 最后一个控件与边缘的间隔
  445. */
  446. [accountBtns mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:9 leadSpacing:0 tailSpacing:0];
  447. [accountBtns mas_makeConstraints:^(MASConstraintMaker *make) {
  448. make.top.bottom.offset(0.0f);
  449. }];
  450. }
  451. - (WHVipDropView *)vipDropView{
  452. if(!_vipDropView){
  453. _vipDropView = [[WHVipDropView alloc] init];
  454. }
  455. return _vipDropView;
  456. }
  457. -(void)setIs_complete_info:(NSInteger)is_complete_info{
  458. _is_complete_info = is_complete_info;
  459. // if (is_complete_info == 1) {
  460. //// self.finishMessageBtn.hidden = NO;
  461. //// self.timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(youpaiftimerAction) userInfo:nil repeats:YES];
  462. //// [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
  463. //
  464. // }else{
  465. // self.finishMessageBtn.hidden = YES;
  466. // }
  467. }
  468. -(void)youpaiftimerAction{
  469. // self.finishMessageBtn.hidden = YES;
  470. [self.timer invalidate];
  471. self.timer = nil;
  472. }
  473. - (void)youpaiftouchUserLevel{
  474. if (self.youpaipmyGrade.length == 0) {
  475. LZAlertAction *action = [LZAlertAction actionWithTitle:@"好的" handler:^(LZAlertAction *action) {
  476. }];
  477. action.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(KScreenWidth - 128.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
  478. LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"" content:@"在视频中或直播中送礼即可提升等级" action:@[action]];
  479. alert.contentFont = LCFont16;
  480. alert.contentHorizontalSpace = 32.0f;
  481. [[LCTools getCurrentVC] TFPresentVC:alert completion:^{}];
  482. }else{
  483. ZCBaseWebVC *webVC = [[ZCBaseWebVC alloc] init];
  484. webVC.contentUrl = self.youpaipmyGrade;
  485. [[LCTools getContainNavigationControllerCurrentVC].navigationController pushViewController:webVC animated:YES];
  486. }
  487. }
  488. /// 更新用户信息
  489. - (void)youpaifreloadUserInfoWithModel:(YOUPAILCUserModel *)userModel{
  490. self.youpaipuserModel = userModel;
  491. self.youpaipavatarImgV.youpaipavatarURL = [LCTools getImageUrlWithAddress:userModel.youpaipuserinfo.youpaipavatar];
  492. self.youpaipavatarImgV.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:userModel.youpaipuserinfo.youpaipavatar_frame];
  493. // [self.avatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:userModel.userinfo.avatar]];
  494. self.youpaipnicknameL.text = userModel.youpaipuserinfo.youpaipnickname;
  495. [self.youpaipidBtn setTitle:[NSString stringWithFormat:@"花舞号:%@",userModel.youpaipuserinfo.youpaipusercode] forState:UIControlStateNormal];
  496. self.youpaipanchorTagImgV.hidden = userModel.youpaipuserinfo.youpaipis_live != 1;
  497. [self youpaifreloadTags];
  498. self.signLab.text = [LCSaveModel getUserModel].youpaipuserinfo.youpaipsign;
  499. }
  500. /// 更新数量信息
  501. - (void)youpaifreloadCountWithModel:(YOUPAILCUserCountModel *)model{
  502. self.youpaipfollowBtn.youpaipcount = model.youpaipfollow_count;
  503. self.youpaipfansBtn.youpaipcount = model.youpaipfans_count;
  504. self.youpaipfansBtn.youpaipbadgeValue = model.youpaipnew_fans_count;
  505. self.youpaipvisitBtn.youpaipcount = model.youpaipvisitor_count;
  506. self.youpaipvisitBtn.youpaipbadgeValue = model.youpaipnew_visitor_count;
  507. if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0) {
  508. self.youpaipliveBtn.youpaipbadgeValue = model.youpaipnew_videoTrendsLike_count;
  509. self.youpaipliveBtn.youpaipcount = model.youpaipnew_videoTrendsLike_count;
  510. }else{
  511. self.youpaipliveBtn.youpaipbadgeValue = 0;
  512. self.youpaipliveBtn.youpaipcount = model.youpaipviewer_count;
  513. }
  514. }
  515. /// 更新用户等级
  516. - (void)youpaifreloadUserLevelModel:(YOUPAILZLiveCardModel *)model{
  517. self.youpaipcardModel = model;
  518. [self youpaifreloadTags];
  519. }
  520. ///红点显示
  521. - (void)youpaifreloadUserRedDotModel:(YOUPAIHRReddotModel *)model{
  522. // if (model.youpaipis_edit == 1) {
  523. // self.youpaipredView.hidden = NO;
  524. // }else{
  525. // self.youpaipredView.hidden = YES;
  526. // }
  527. }
  528. - (void)youpaifreloadTags{
  529. // self.youpaipvipV.hidden = YES;
  530. self.youpaipbadgeImgV.hidden = YES;
  531. self.youpaiplevelView.hidden = YES;
  532. UIView *frontV;
  533. if (self.youpaipuserModel.youpaipuserinfo.youpaipvip_icon.length != 0) {
  534. self.youpaipvipV.hidden = NO;
  535. [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipuserModel.youpaipuserinfo.youpaipvip_icon]];
  536. [self.youpaipvipV mas_remakeConstraints:^(MASConstraintMaker *make) {
  537. if (frontV == nil) {
  538. make.left.equalTo(self.youpaipnicknameL);
  539. }else{
  540. make.left.equalTo(frontV.mas_right).offset(3.0f);
  541. }
  542. make.top.equalTo(self.youpaipnicknameL.mas_bottom).offset(3);
  543. make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  544. }];
  545. frontV = self.youpaipvipV;
  546. }
  547. if (self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipfile.length != 0) {
  548. self.youpaipbadgeImgV.hidden = NO;
  549. [self.youpaipbadgeImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipfile]];
  550. [self.youpaipbadgeImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
  551. if (frontV == nil) {
  552. make.left.equalTo(self.youpaipnicknameL);
  553. }else{
  554. make.left.equalTo(frontV.mas_right).offset(3.0f);
  555. }
  556. make.top.equalTo(self.youpaipnicknameL.mas_bottom).offset(3);
  557. make.size.mas_offset(CGSizeMake(self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipwidth, 17.0f));
  558. }];
  559. frontV = self.youpaipbadgeImgV;
  560. }
  561. // self.youpaiplevelView.hidden = NO;
  562. // [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];
  563. // [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
  564. // if (frontV == nil) {
  565. // make.left.equalTo(self.youpaipnicknameL);
  566. // }else{
  567. // make.left.equalTo(frontV.mas_right).offset(3.0f);
  568. // }
  569. // make.top.equalTo(self.youpaipnicknameL.mas_bottom).offset(3);
  570. // make.size.mas_offset(self.youpaiplevelView.mj_size);
  571. // }];
  572. }
  573. /// 更新账户资产信息
  574. /// balance 余额
  575. /// profit 收益
  576. - (void)youpaifreloadAccountWithBalance:(NSInteger)balance profit:(NSString*)profit{
  577. self.youpaipbalanceL.text = [NSString stringWithFormat:@"%@",@(balance)];
  578. self.youpaipprofitL.text = [NSString stringWithFormat:@"%@",profit];
  579. }
  580. // 个人主页
  581. -(void)youpaifsetMineBtnClick{
  582. YOUPAILZUserShowVC *showVC = [[YOUPAILZUserShowVC alloc]init];
  583. showVC.youpaipuserId = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
  584. [[LCTools getCurrentVC].navigationController pushViewController:showVC animated:YES];
  585. }
  586. //点击进入个人装扮
  587. - (void)youpaifdidAvatarClick{
  588. // YOUPAILZPersonalizedDressVC* vc = [[YOUPAILZPersonalizedDressVC alloc]init];
  589. // [[LCTools getCurrentVC].navigationController pushViewController:vc animated:YES];
  590. YOUPAILZUserShowVC *showVC = [[YOUPAILZUserShowVC alloc]init];
  591. showVC.youpaipuserId = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
  592. [[LCTools getCurrentVC].navigationController pushViewController:showVC animated:YES];
  593. }
  594. //编辑资料
  595. -(void)youpaifeditBtnClick{
  596. // TODO: xiaoqy 2022.3.2 替换原来的
  597. MSYMineinfoEditVC * editvc = [MSYMineinfoEditVC new];
  598. [[LCTools getCurrentVC].navigationController pushViewController:editvc animated:true];
  599. return;
  600. }
  601. // 用户信息点击事件
  602. - (void)youpaifuserBtnClick{
  603. YOUPAILZUserShowVC *showVC = [[YOUPAILZUserShowVC alloc]init];
  604. showVC.youpaipuserId = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
  605. [[LCTools getCurrentVC].navigationController pushViewController:showVC animated:YES];
  606. // YOUPAILCEditUserMsgVC* editMsg = [[YOUPAILCEditUserMsgVC alloc]init];
  607. // [[LCTools getCurrentVC].navigationController pushViewController:editMsg animated:YES];
  608. }
  609. // 复制ID点击事件
  610. - (void)youpaifcopyBtnClick{
  611. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
  612. pasteboard.string = self.youpaipuserModel.youpaipuserinfo.youpaipusercode;
  613. [ZCHUDHelper showTitle:@"复制成功"];
  614. }
  615. // 关注点击事件
  616. - (void)youpaiffollowBtnClick{
  617. YOUPAILCFollowVC* youpaiffollow = [[YOUPAILCFollowVC alloc]init];
  618. [[LCTools getCurrentVC].navigationController pushViewController:youpaiffollow animated:YES];
  619. }
  620. // 粉丝点击事件
  621. - (void)youpaiffansBtnClick{
  622. YOUPAILCFansVC* fan = [[YOUPAILCFansVC alloc]init];
  623. [[LCTools getCurrentVC].navigationController pushViewController:fan animated:YES];
  624. }
  625. // 访客点击事件
  626. - (void)youpaifvisitBtnClick{
  627. YOUPAILCSeenVC* seen = [[YOUPAILCSeenVC alloc]init];
  628. [[LCTools getCurrentVC].navigationController pushViewController:seen animated:YES];
  629. }
  630. // 获赞点击事件
  631. - (void)youpaifliveBtnClick{
  632. YOUPAIZYVideoLikesVC* fan = [[YOUPAIZYVideoLikesVC alloc]init];
  633. [[LCTools getCurrentVC].navigationController pushViewController:fan animated:YES];
  634. }
  635. // 足迹点击事件
  636. - (void)youpaifvisitClick{
  637. YOUPAILCVisitVC* visitVC = [[YOUPAILCVisitVC alloc]init];
  638. [[LCTools getCurrentVC].navigationController pushViewController:visitVC animated:YES];
  639. }
  640. // 账户余额
  641. - (void)youpaifbalanceBtnClick{
  642. YOUPAIXRWalletVC *wallet = [[YOUPAIXRWalletVC alloc]init];
  643. [[LCTools getCurrentVC].navigationController pushViewController:wallet animated:YES];
  644. }
  645. // 我的收益
  646. - (void)youpaifprofitBtnClick{
  647. YOUPAILZProfitVC *rechargeVC = [[YOUPAILZProfitVC alloc]init];
  648. [[LCTools getCurrentVC].navigationController pushViewController:rechargeVC animated:YES];
  649. }
  650. @end