885 lines
31 KiB
Objective-C
885 lines
31 KiB
Objective-C
//
|
||
// XPMineHeaderView.m
|
||
// xplan-ios
|
||
//
|
||
// Created by 冯硕 on 2021/9/22.
|
||
//
|
||
|
||
#import "XPMineUserInfoHeaderView.h"
|
||
///Third
|
||
#import <Masonry/Masonry.h>
|
||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||
#import "SDPhotoBrowser.h"
|
||
#import <ReactiveObjC/ReactiveObjC.h>
|
||
#import <YYText/YYText.h>
|
||
///Tool
|
||
#import "ThemeColor.h"
|
||
#import "XPMacro.h"
|
||
#import "UIImage+ImageEffects.h"
|
||
#import "UIImage+Utils.h"
|
||
#import "NetImageView.h"
|
||
#import "NSArray+Safe.h"
|
||
#import "XCHUDTool.h"
|
||
#import "StatisticsServiceHelper.h"
|
||
#import "XPNoteView.h"
|
||
#import "XPButton.h"
|
||
///Model
|
||
#import "UserInfoModel.h"
|
||
#import "ClanDetailInfoModel.h"
|
||
|
||
@interface XPMineUserInfoHeaderView ()<SDCycleScrollViewDelegate, SDPhotoBrowserDelegate>
|
||
///轮播图
|
||
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
|
||
///覆盖的view
|
||
@property (nonatomic,strong) UIImageView * coverImageView;
|
||
///显示当前的页数
|
||
@property (nonatomic,strong) UIButton *pageButton;
|
||
///审核中图标
|
||
@property (nonatomic,strong) UIImageView *reviewIcon;
|
||
///图片数组
|
||
@property (nonatomic,strong) NSArray *imageUrls;
|
||
///用户的头像和相册
|
||
@property (nonatomic,strong) NSMutableArray<UserPhoto *> *userPhtotArray;
|
||
///用户信息
|
||
@property (nonatomic,strong) UIView * userInfoView;
|
||
///贵族等级icon
|
||
@property (nonatomic,strong) NetImageView *nobleImageView;
|
||
@property (nonatomic,strong) UIStackView *nickStackView;
|
||
///头像
|
||
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||
///名字
|
||
@property (nonatomic,strong) UILabel *nameLabel;
|
||
///sex
|
||
@property (nonatomic,strong) UIImageView *sexImageView;
|
||
///星座
|
||
@property (nonatomic,strong) UIButton *constellationBtn;
|
||
///正在直播中
|
||
@property (nonatomic,strong) UIView *onlineView;
|
||
///音符
|
||
@property (nonatomic,strong) XPNoteView *noteView;
|
||
///
|
||
@property (nonatomic,strong) UIStackView *idStackView;
|
||
///靓号
|
||
@property (nonatomic,strong) UIImageView *beautifulImageViw;
|
||
///id
|
||
@property (nonatomic,strong) UILabel *idLabel;
|
||
///复制id
|
||
@property (nonatomic,strong) UIImageView *copysIdImageView;
|
||
///粉丝数
|
||
@property (nonatomic,strong) UILabel *fansNumLabel;
|
||
///魅力等级 等级 铭牌
|
||
@property (nonatomic,strong) UIStackView *tagStackView;
|
||
///魅力等级
|
||
@property (nonatomic,strong) NetImageView *charmImageView;
|
||
///等级
|
||
@property (nonatomic,strong) NetImageView *experImageView;
|
||
///铭牌的容器
|
||
@property (nonatomic,strong) UIView * namePlateView;
|
||
///铭牌图片
|
||
@property (nonatomic,strong) NetImageView *nameplateImageView;
|
||
///铭牌文字
|
||
@property (nonatomic,strong) UILabel *nameplateLabel;
|
||
///新用户
|
||
@property (nonatomic,strong) UIImageView *newUserImageView;
|
||
///官方的
|
||
@property (nonatomic,strong) UIImageView *officalImageView;
|
||
/// 工会
|
||
@property (nonatomic,strong) XPButton *clanBtn;
|
||
///签名的背景
|
||
@property (nonatomic,strong) UIView * signBackView;
|
||
///签名
|
||
@property (nonatomic,strong) UILabel *signLabel;
|
||
///分割线
|
||
@property (nonatomic,strong) UIView * lineView;
|
||
///头像的
|
||
@property (nonatomic,strong) UserPhoto *avatarPhoto;
|
||
///关注
|
||
@property(nonatomic,strong) XPButton *attentionButton;
|
||
@end
|
||
|
||
@implementation XPMineUserInfoHeaderView
|
||
|
||
- (instancetype)initWithFrame:(CGRect)frame {
|
||
self = [super initWithFrame:frame];
|
||
if (self) {
|
||
[self initSubViews];
|
||
[self initSubViewConstraints];
|
||
}
|
||
return self;
|
||
}
|
||
|
||
#pragma mark - Private Method
|
||
- (void)initSubViews {
|
||
[self addSubview:self.cycleScrollView];
|
||
[self addSubview:self.coverImageView];
|
||
[self addSubview:self.reviewIcon];
|
||
[self addSubview:self.userInfoView];
|
||
[self addSubview:self.pageButton];
|
||
[self addSubview:self.avatarImageView];
|
||
[self addSubview:self.onlineView];
|
||
|
||
[self.userInfoView addSubview:self.lineView];
|
||
[self.userInfoView addSubview:self.fansNumLabel];
|
||
[self.userInfoView addSubview:self.signBackView];
|
||
[self.userInfoView addSubview:self.nickStackView];
|
||
[self.userInfoView addSubview:self.idStackView];
|
||
[self.userInfoView addSubview:self.tagStackView];
|
||
[self.userInfoView addSubview:self.attentionButton];
|
||
|
||
[self.onlineView addSubview:self.noteView];
|
||
|
||
[self.nickStackView addArrangedSubview:self.nobleImageView];
|
||
[self.nickStackView addArrangedSubview:self.nameLabel];
|
||
[self.nickStackView addArrangedSubview:self.sexImageView];
|
||
[self.nickStackView addArrangedSubview:self.constellationBtn];
|
||
|
||
[self.idStackView addArrangedSubview:self.beautifulImageViw];
|
||
[self.idStackView addArrangedSubview:self.idLabel];
|
||
[self.idStackView addArrangedSubview:self.copysIdImageView];
|
||
|
||
///用户信息中的标签
|
||
[self.tagStackView addArrangedSubview:self.clanBtn];
|
||
[self.tagStackView addArrangedSubview:self.newUserImageView];
|
||
[self.tagStackView addArrangedSubview:self.officalImageView];
|
||
[self.tagStackView addArrangedSubview:self.experImageView];
|
||
[self.tagStackView addArrangedSubview:self.charmImageView];
|
||
[self.tagStackView addArrangedSubview:self.namePlateView];
|
||
///铭牌
|
||
[self.namePlateView addSubview:self.nameplateImageView];
|
||
[self.namePlateView addSubview:self.nameplateLabel];
|
||
|
||
[self.signBackView addSubview:self.signLabel];
|
||
}
|
||
|
||
- (void)initSubViewConstraints {
|
||
[self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.top.mas_equalTo(self);
|
||
make.height.mas_equalTo(237);
|
||
}];
|
||
|
||
[self.coverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.edges.mas_equalTo(self.cycleScrollView);
|
||
}];
|
||
|
||
[self.reviewIcon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.right.mas_equalTo(self);
|
||
make.width.mas_equalTo(85);
|
||
make.height.mas_equalTo(50);
|
||
}];
|
||
|
||
[self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.mas_equalTo(self);
|
||
make.bottom.mas_equalTo(self);
|
||
make.height.mas_equalTo(170);
|
||
}];
|
||
|
||
|
||
[self.pageButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.right.mas_equalTo(-15);
|
||
make.width.mas_equalTo(42);
|
||
make.height.mas_equalTo(22);
|
||
make.bottom.mas_equalTo(self.userInfoView.mas_top).offset(-8);
|
||
}];
|
||
|
||
[self.signBackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.height.mas_equalTo(self.signLabel.mas_height).offset(22);
|
||
make.left.mas_equalTo(15);
|
||
make.right.mas_equalTo(-15);
|
||
make.top.mas_equalTo(self.tagStackView.mas_bottom).offset(10);
|
||
}];
|
||
|
||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.mas_equalTo(self.userInfoView).inset(0);
|
||
make.bottom.mas_equalTo(self.userInfoView);
|
||
make.height.mas_equalTo(20);
|
||
}];
|
||
|
||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.mas_equalTo(self.userInfoView.mas_left).offset(22);
|
||
make.centerY.mas_equalTo(self.userInfoView.mas_top);
|
||
make.width.height.mas_equalTo(72);
|
||
}];
|
||
[self.fansNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(12);
|
||
make.top.mas_equalTo(10);
|
||
}];
|
||
|
||
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.width.height.mas_equalTo(20);
|
||
}];
|
||
[self.attentionButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.right.mas_equalTo(-16);
|
||
make.width.mas_equalTo(68);
|
||
make.height.mas_equalTo(28);
|
||
make.centerY.equalTo(self.nickStackView);
|
||
}];
|
||
[self.nickStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.mas_equalTo(18);
|
||
make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(10);
|
||
make.right.mas_lessThanOrEqualTo(-89);
|
||
}];
|
||
|
||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.height.mas_equalTo(20);
|
||
}];
|
||
|
||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.size.mas_equalTo(CGSizeMake(15, 15));
|
||
}];
|
||
|
||
[self.constellationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.size.mas_equalTo(CGSizeMake(40, 14));
|
||
}];
|
||
|
||
[self.onlineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.size.mas_equalTo(CGSizeMake(20, 20));
|
||
make.right.mas_equalTo(self.avatarImageView.mas_right).offset(-2);
|
||
make.bottom.mas_equalTo(self.avatarImageView.mas_bottom).offset(-2);
|
||
}];
|
||
|
||
[self.noteView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(0);
|
||
make.width.height.mas_equalTo(10);
|
||
}];
|
||
|
||
[self.idStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.mas_equalTo(self.nickStackView);
|
||
make.top.mas_equalTo(self.nickStackView.mas_bottom).offset(5);
|
||
}];
|
||
|
||
[self.beautifulImageViw mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.size.mas_equalTo(CGSizeMake(15, 15));
|
||
}];
|
||
|
||
[self.copysIdImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.size.mas_equalTo(CGSizeMake(10, 10));
|
||
}];
|
||
|
||
[self.tagStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.mas_equalTo(self.nickStackView);
|
||
make.top.mas_equalTo(self.idStackView.mas_bottom).offset(5);
|
||
make.height.mas_equalTo(22);
|
||
}];
|
||
|
||
[self.clanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.height.mas_equalTo(22);
|
||
|
||
}];
|
||
|
||
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.width.height.mas_equalTo(22);
|
||
}];
|
||
|
||
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.width.height.mas_equalTo(22);
|
||
}];
|
||
|
||
[self.newUserImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.width.height.mas_equalTo(18);
|
||
}];
|
||
|
||
[self.officalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.width.height.mas_equalTo(18);
|
||
}];
|
||
|
||
[self.namePlateView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.height.mas_equalTo(18);
|
||
make.width.mas_equalTo(self.nameplateImageView.mas_width);
|
||
}];
|
||
|
||
|
||
[self.nameplateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.height.mas_equalTo(18);
|
||
make.width.mas_equalTo(60);
|
||
make.left.top.mas_equalTo(self.namePlateView);
|
||
}];
|
||
|
||
[self.nameplateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.bottom.mas_equalTo(self.nameplateImageView);
|
||
make.right.mas_equalTo(self.namePlateView).offset(-2);
|
||
}];
|
||
|
||
[self.signLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.mas_equalTo(10);
|
||
make.right.mas_equalTo(-10);
|
||
make.centerY.mas_equalTo(0);
|
||
}];
|
||
}
|
||
|
||
#pragma mark - SDPhotoBrowserDelegate
|
||
- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index {
|
||
NSString * photoUrl = [self.imageUrls safeObjectAtIndex1:index];
|
||
return [NSURL URLWithString:photoUrl];
|
||
}
|
||
|
||
- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index {
|
||
return [UIImageConstant defalutBannerPlaceholder];
|
||
}
|
||
|
||
#pragma mark - SDCycleScrollViewDelegate
|
||
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {
|
||
[self.pageButton setTitle:[NSString stringWithFormat:@"%ld/%lu",(index + 1), (unsigned long)self.imageUrls.count] forState:UIControlStateNormal];
|
||
UserPhoto * photo = [self.userPhtotArray safeObjectAtIndex1:index];
|
||
self.reviewIcon.hidden = !photo.isReview;
|
||
}
|
||
|
||
// 轮播图点击
|
||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
|
||
NSInteger count = self.imageUrls.count;
|
||
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
|
||
browser.sourceImagesContainerView = self.cycleScrollView;
|
||
browser.delegate = self;
|
||
browser.imageCount = count;
|
||
browser.currentImageIndex = index;
|
||
browser.isMe = NO;
|
||
[browser show];
|
||
}
|
||
|
||
#pragma mark - Event Response
|
||
- (void)didTapAvatarGuest {
|
||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineUserInfoHeaderView:didClickGoToRoom:)]) {
|
||
[self.delegate xPMineUserInfoHeaderView:self didClickGoToRoom:self.roomUid];
|
||
}
|
||
}
|
||
|
||
- (void)copysIdRecognizer {
|
||
[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"%ld", self.userInfo.erbanNo];
|
||
[XCHUDTool showSuccessWithMessage:@"复制成功"];
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventID_mycenter_copyid_click];
|
||
}
|
||
|
||
/// 点击工会
|
||
- (void)clanBtnAction {
|
||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineUserInfoHeaderViewDidClickClan:)]) {
|
||
[self.delegate xPMineUserInfoHeaderViewDidClickClan:self.clanDetailInfo];
|
||
}
|
||
}
|
||
|
||
#pragma mark - 计算星座
|
||
-(NSInteger) getMonth:(long )time
|
||
{
|
||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:time/1000];
|
||
NSCalendar* calendar = [NSCalendar currentCalendar];
|
||
NSDateComponents* components = [calendar components:NSCalendarUnitMonth fromDate:date];
|
||
NSInteger month = components.month;
|
||
return month;
|
||
}
|
||
|
||
- (NSInteger) getDay:(long) time
|
||
{
|
||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:time/1000];
|
||
NSCalendar* calendar = [NSCalendar currentCalendar];
|
||
NSDateComponents* components = [calendar components:NSCalendarUnitDay fromDate:date];
|
||
NSInteger day = components.day;
|
||
return day;
|
||
}
|
||
|
||
- (NSString *)calculateConstellationWithMonth:(long)time
|
||
{
|
||
NSString *astroString = @"魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯";
|
||
NSString *astroFormat = @"102123444543";
|
||
NSString *result;
|
||
|
||
NSInteger month = [self getMonth:time];
|
||
NSInteger day = [self getDay:time];
|
||
|
||
if (month<1 || month>12 || day<1 || day>31){
|
||
return @"错误日期格式!";
|
||
}
|
||
|
||
if(month==2 && day>29)
|
||
{
|
||
return @"错误日期格式!!";
|
||
}else if(month==4 || month==6 || month==9 || month==11) {
|
||
if (day>30) {
|
||
return @"错误日期格式!!!";
|
||
}
|
||
}
|
||
|
||
result=[NSString stringWithFormat:@"%@",[astroString substringWithRange:NSMakeRange(month*2-(day < [[astroFormat substringWithRange:NSMakeRange((month-1), 1)] intValue] - (-19))*2,2)]];
|
||
|
||
return [NSString stringWithFormat:@"%@座",result];
|
||
}
|
||
|
||
#pragma mark - Getters And Setters
|
||
|
||
- (CGFloat)getHeaderHeight:(UserInfoModel *)userInfo {
|
||
CGSize size = [self.signLabel.text boundingRectWithSize:CGSizeMake(self.signLabel.bounds.size.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:self.signLabel.font} context:nil].size;
|
||
return 366+size.height;
|
||
}
|
||
|
||
- (void)setUserInfo:(UserInfoModel *)userInfo {
|
||
_userInfo = userInfo;
|
||
if (_userInfo) {
|
||
self.avatarImageView.imageUrl = _userInfo.avatar;
|
||
self.nameLabel.text = _userInfo.nick;
|
||
if (_userInfo.birth) {
|
||
[self.constellationBtn setTitle:[self calculateConstellationWithMonth:userInfo.birth] forState:UIControlStateNormal];
|
||
self.constellationBtn.hidden = NO;
|
||
}
|
||
self.idLabel.text = [NSString stringWithFormat:@"ID:%ld", (long)_userInfo.erbanNo];
|
||
self.copysIdImageView.hidden = NO;
|
||
self.signLabel.text = _userInfo.userDesc.length > 0 ? _userInfo.userDesc : @"我是个默认签名";
|
||
CGSize size = [self.signLabel.text boundingRectWithSize:CGSizeMake(self.signLabel.bounds.size.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:self.signLabel.font} context:nil].size;
|
||
[self.userInfoView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||
make.height.mas_equalTo(153+size.height);
|
||
}];
|
||
|
||
NSString *fansNum = [NSString stringWithFormat:@"%ld",_userInfo.fansNum];
|
||
NSString *fansStr = [NSString stringWithFormat:@"粉丝 %@", fansNum];
|
||
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:fansStr];
|
||
NSRange fansNumRange = NSMakeRange(attrStr.length - fansNum.length, fansNum.length);
|
||
[attrStr addAttribute:NSForegroundColorAttributeName value:[ThemeColor mainTextColor] range:fansNumRange];
|
||
self.fansNumLabel.attributedText = attrStr;
|
||
self.sexImageView.image = userInfo.gender == GenderType_Female ? [UIImage imageNamed:@"common_female"] : [UIImage imageNamed:@"common_male"];
|
||
self.officalImageView.hidden = userInfo.defUser != UserLevelType_Offical;
|
||
self.beautifulImageViw.hidden = !userInfo.hasPrettyErbanNo;
|
||
self.newUserImageView.hidden = !userInfo.newUser;
|
||
|
||
[self.nobleImageView loadImageWithUrl:userInfo.userVipInfoVO.vipIcon completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||
if (image) {
|
||
CGFloat scale = image.size.width / image.size.height;
|
||
[self.nobleImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||
make.size.mas_equalTo(CGSizeMake(20* scale, 20));
|
||
}];
|
||
self.nobleImageView.hidden = NO;
|
||
}else{
|
||
self.nobleImageView.hidden = YES;
|
||
}
|
||
}];
|
||
|
||
if (userInfo.userLevelVo.experUrl) {
|
||
self.experImageView.imageUrl = userInfo.userLevelVo.experUrl;
|
||
}
|
||
self.experImageView.hidden = userInfo.userLevelVo.experUrl.length <= 0;
|
||
|
||
if (userInfo.userLevelVo.charmUrl) {
|
||
self.charmImageView.imageUrl = userInfo.userLevelVo.charmUrl;
|
||
}
|
||
self.charmImageView.hidden = userInfo.userLevelVo.charmUrl.length <= 0;
|
||
|
||
if (userInfo.nameplateWord.length>0 && userInfo.nameplatePic.length>0) {
|
||
self.nameplateImageView.imageUrl = userInfo.nameplatePic;
|
||
self.nameplateLabel.text = userInfo.nameplateWord;
|
||
self.namePlateView.hidden = NO;
|
||
} else {
|
||
self.namePlateView.hidden = YES;
|
||
}
|
||
[self.userPhtotArray removeAllObjects];
|
||
// 轮播图
|
||
NSMutableArray * imageUrls = [NSMutableArray array];
|
||
if (userInfo.avatar) {
|
||
[imageUrls addObject:userInfo.avatar];
|
||
if (![self.userPhtotArray containsObject:self.avatarPhoto]) {
|
||
[self.userPhtotArray addObject:self.avatarPhoto];
|
||
}
|
||
self.avatarPhoto.isReview = userInfo.isReview;
|
||
self.avatarPhoto.photoUrl = userInfo.avatar;
|
||
}
|
||
if (self.userInfo.privatePhoto.count > 0) {
|
||
for (int i = 0; i < self.userInfo.privatePhoto.count; i++) {
|
||
UserPhoto * photo = [self.userInfo.privatePhoto safeObjectAtIndex1:i];
|
||
if (photo.photoUrl.length > 0) {
|
||
[self.userPhtotArray addObject:photo];
|
||
[imageUrls addObject:photo.photoUrl];
|
||
}
|
||
}
|
||
}
|
||
|
||
if (imageUrls.count > 0) {
|
||
self.imageUrls = imageUrls;
|
||
self.cycleScrollView.imageURLStringsGroup = imageUrls;
|
||
[self.pageButton setTitle:[NSString stringWithFormat:@"1/%lu",(unsigned long)imageUrls.count] forState:UIControlStateNormal];;
|
||
// 要初始化一下当前的审核状态
|
||
self.reviewIcon.hidden = ![self.userPhtotArray objectAtIndex:0].isReview;
|
||
}
|
||
}
|
||
}
|
||
- (void)attentionButtonAction:(XPButton *)sender {
|
||
if(self.delegate && [self.delegate respondsToSelector:@selector(attentionUserHandleWithBtn:)]){
|
||
[self.delegate attentionUserHandleWithBtn:self.attentionButton];
|
||
}
|
||
}
|
||
- (void)setRoomUid:(NSString *)roomUid {
|
||
_roomUid = roomUid;
|
||
if (_roomUid.length <= 0) {
|
||
self.onlineView.hidden = YES;
|
||
self.avatarImageView.layer.borderColor = UIColor.whiteColor.CGColor;
|
||
self.avatarImageView.userInteractionEnabled = NO;
|
||
}else{
|
||
self.onlineView.hidden = NO;
|
||
self.avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||
self.avatarImageView.userInteractionEnabled = YES;
|
||
}
|
||
|
||
}
|
||
|
||
- (void)setClanDetailInfo:(ClanDetailInfoModel *)clanDetailInfo {
|
||
_clanDetailInfo = clanDetailInfo;
|
||
if (_clanDetailInfo.clan.elderUid) {
|
||
|
||
self.clanBtn.hidden = NO;
|
||
}else{
|
||
self.clanBtn.hidden = YES;
|
||
}
|
||
}
|
||
|
||
|
||
- (UIImageView *)coverImageView {
|
||
if (!_coverImageView) {
|
||
_coverImageView = [[UIImageView alloc] init];
|
||
_coverImageView.userInteractionEnabled = NO;
|
||
_coverImageView.image = [UIImage imageNamed:@"mine_userinfo_header_shadow_bg"];
|
||
}
|
||
return _coverImageView;
|
||
}
|
||
|
||
- (UIView *)userInfoView {
|
||
if (!_userInfoView) {
|
||
_userInfoView = [[UIView alloc] init];
|
||
_userInfoView.backgroundColor = [UIColor whiteColor];
|
||
// _userInfoView.layer.masksToBounds = YES;
|
||
_userInfoView.layer.cornerRadius = 20;
|
||
}
|
||
return _userInfoView;
|
||
}
|
||
|
||
- (NetImageView *)nobleImageView {
|
||
if (!_nobleImageView) {
|
||
_nobleImageView = [[NetImageView alloc] init];
|
||
_nobleImageView.hidden = YES;
|
||
}
|
||
return _nobleImageView;
|
||
}
|
||
|
||
- (UIStackView *)nickStackView {
|
||
if (!_nickStackView) {
|
||
_nickStackView = [[UIStackView alloc] init];
|
||
_nickStackView.axis = UILayoutConstraintAxisHorizontal;
|
||
_nickStackView.distribution = UIStackViewDistributionFill;
|
||
_nickStackView.alignment = UIStackViewAlignmentCenter;
|
||
_nickStackView.spacing = 6;
|
||
}
|
||
return _nickStackView;
|
||
}
|
||
|
||
- (UILabel *)nameLabel {
|
||
if (!_nameLabel) {
|
||
_nameLabel = [[UILabel alloc] init];
|
||
_nameLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
|
||
_nameLabel.textColor = [ThemeColor mainTextColor];
|
||
}
|
||
return _nameLabel;
|
||
}
|
||
|
||
- (UIImageView *)sexImageView {
|
||
if (!_sexImageView) {
|
||
_sexImageView = [[UIImageView alloc] init];
|
||
_sexImageView.userInteractionEnabled = YES;
|
||
}
|
||
return _sexImageView;
|
||
}
|
||
|
||
- (UIStackView *)idStackView {
|
||
if (!_idStackView) {
|
||
_idStackView = [[UIStackView alloc] init];
|
||
_idStackView.axis = UILayoutConstraintAxisHorizontal;
|
||
_idStackView.distribution = UIStackViewDistributionFill;
|
||
_idStackView.alignment = UIStackViewAlignmentCenter;
|
||
_idStackView.spacing = 5;
|
||
|
||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copysIdRecognizer)];
|
||
[_idStackView addGestureRecognizer:tap];
|
||
}
|
||
return _idStackView;
|
||
}
|
||
|
||
- (UIImageView *)beautifulImageViw {
|
||
if (!_beautifulImageViw) {
|
||
_beautifulImageViw = [[UIImageView alloc] init];
|
||
_beautifulImageViw.userInteractionEnabled = YES;
|
||
_beautifulImageViw.image = [UIImage imageNamed:@"common_icon_beautiful"];
|
||
_beautifulImageViw.hidden = YES;
|
||
}
|
||
return _beautifulImageViw;
|
||
}
|
||
|
||
- (UILabel *)fansNumLabel {
|
||
if (!_fansNumLabel) {
|
||
_fansNumLabel = [[UILabel alloc] init];
|
||
_fansNumLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
|
||
_fansNumLabel.textColor = [ThemeColor secondTextColor];
|
||
}
|
||
return _fansNumLabel;
|
||
}
|
||
|
||
- (UILabel *)idLabel {
|
||
if (!_idLabel) {
|
||
_idLabel = [[UILabel alloc] init];
|
||
_idLabel.font = [UIFont systemFontOfSize:12];
|
||
_idLabel.textColor = [ThemeColor textThirdColor];
|
||
}
|
||
return _idLabel;
|
||
}
|
||
|
||
- (UIView *)onlineView {
|
||
if (!_onlineView) {
|
||
_onlineView = [[UIView alloc] init];
|
||
_onlineView.backgroundColor = [ThemeColor appMainColor];
|
||
_onlineView.layer.cornerRadius = 10;
|
||
_onlineView.clipsToBounds = YES;
|
||
_onlineView.hidden = YES;
|
||
}
|
||
return _onlineView;
|
||
}
|
||
|
||
- (XPNoteView *)noteView {
|
||
if (!_noteView) {
|
||
_noteView = [[XPNoteView alloc] init];
|
||
_noteView.pillarColor = [UIColor blackColor];
|
||
_noteView.pillarWidth = 1.5;
|
||
[_noteView startAnimation];
|
||
}
|
||
return _noteView;
|
||
}
|
||
|
||
- (SDCycleScrollView *)cycleScrollView {
|
||
if (!_cycleScrollView) {
|
||
_cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:[UIImageConstant defalutBannerPlaceholder]];
|
||
_cycleScrollView.backgroundColor = [UIColor clearColor];
|
||
_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||
_cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
|
||
_cycleScrollView.autoScroll = NO;
|
||
}
|
||
return _cycleScrollView;
|
||
}
|
||
|
||
- (UIButton *)pageButton {
|
||
if (!_pageButton) {
|
||
_pageButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[_pageButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||
_pageButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||
_pageButton.backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:0.2];
|
||
_pageButton.layer.cornerRadius = 11;
|
||
_pageButton.clipsToBounds = YES;
|
||
}
|
||
return _pageButton;
|
||
}
|
||
|
||
|
||
- (UIImageView *)reviewIcon {
|
||
if (!_reviewIcon) {
|
||
_reviewIcon = [[UIImageView alloc] init];
|
||
_reviewIcon.image = [UIImage imageNamed:@"mine_album_reviewing"];
|
||
_reviewIcon.hidden = YES;
|
||
}
|
||
return _reviewIcon;
|
||
}
|
||
|
||
- (UIStackView *)tagStackView {
|
||
if (!_tagStackView) {
|
||
_tagStackView = [[UIStackView alloc] init];
|
||
_tagStackView.axis = UILayoutConstraintAxisHorizontal;
|
||
_tagStackView.distribution = UIStackViewDistributionFill;
|
||
_tagStackView.alignment = UIStackViewAlignmentCenter;
|
||
_tagStackView.spacing = 2;
|
||
}
|
||
return _tagStackView;
|
||
}
|
||
- (NetImageView *)experImageView {
|
||
if (!_experImageView) {
|
||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||
config.imageType = ImageTypeUserCardLevel;
|
||
_experImageView = [[NetImageView alloc] initWithConfig:config];
|
||
_experImageView.userInteractionEnabled = YES;
|
||
_experImageView.hidden = YES;
|
||
_experImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||
}
|
||
return _experImageView;
|
||
}
|
||
|
||
- (NetImageView *)charmImageView {
|
||
if (!_charmImageView) {
|
||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||
config.imageType = ImageTypeUserCardLevel;
|
||
_charmImageView = [[NetImageView alloc] initWithConfig:config];
|
||
_charmImageView.userInteractionEnabled = YES;
|
||
_charmImageView.hidden = YES;
|
||
_charmImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||
}
|
||
return _charmImageView;
|
||
}
|
||
|
||
|
||
- (UIView *)namePlateView {
|
||
if (!_namePlateView) {
|
||
_namePlateView = [[UIView alloc] init];
|
||
_namePlateView.backgroundColor = [UIColor clearColor];
|
||
_namePlateView.hidden = YES;
|
||
}
|
||
return _namePlateView;
|
||
}
|
||
|
||
- (NetImageView *)nameplateImageView {
|
||
if (!_nameplateImageView) {
|
||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||
config.imageType = ImageTypeUserCardLevel;
|
||
_nameplateImageView = [[NetImageView alloc] initWithConfig:config];
|
||
_nameplateImageView.userInteractionEnabled = YES;
|
||
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||
}
|
||
return _nameplateImageView;
|
||
}
|
||
|
||
- (UILabel *)nameplateLabel {
|
||
if (!_nameplateLabel) {
|
||
_nameplateLabel = [[UILabel alloc] init];
|
||
_nameplateLabel.font = [UIFont systemFontOfSize:10];
|
||
_nameplateLabel.textAlignment = NSTextAlignmentCenter;
|
||
_nameplateLabel.textColor = [UIColor whiteColor];
|
||
}
|
||
return _nameplateLabel;
|
||
}
|
||
|
||
- (UIImageView *)newUserImageView {
|
||
if (!_newUserImageView) {
|
||
_newUserImageView = [[UIImageView alloc] init];
|
||
_newUserImageView.userInteractionEnabled = YES;
|
||
_newUserImageView.image = [UIImage imageNamed:@"common_new_user"];
|
||
_newUserImageView.hidden = YES;
|
||
}
|
||
return _newUserImageView;
|
||
}
|
||
|
||
- (UIImageView *)officalImageView {
|
||
if (!_officalImageView) {
|
||
_officalImageView = [[UIImageView alloc] init];
|
||
_officalImageView.userInteractionEnabled = YES;
|
||
_officalImageView.image = [UIImage imageNamed:@"common_offical"];
|
||
_officalImageView.hidden = YES;
|
||
}
|
||
return _officalImageView;
|
||
}
|
||
|
||
- (UIView *)signBackView {
|
||
if (!_signBackView) {
|
||
_signBackView = [[UIView alloc] init];
|
||
_signBackView.backgroundColor = [ThemeColor appBackgroundColor];
|
||
_signBackView.layer.cornerRadius = 4;
|
||
}
|
||
return _signBackView;
|
||
}
|
||
|
||
- (UIView *)lineView {
|
||
if (!_lineView) {
|
||
_lineView = [[UIView alloc] init];
|
||
_lineView.backgroundColor = UIColor.whiteColor;
|
||
}
|
||
return _lineView;
|
||
}
|
||
|
||
- (UILabel *)signLabel {
|
||
if (!_signLabel) {
|
||
_signLabel = [[UILabel alloc] init];
|
||
_signLabel.font = [UIFont systemFontOfSize:12];;
|
||
_signLabel.textColor = [ThemeColor secondTextColor];
|
||
_signLabel.numberOfLines = 0;
|
||
}
|
||
return _signLabel;
|
||
}
|
||
|
||
|
||
- (NSMutableArray *)userPhtotArray {
|
||
if (!_userPhtotArray) {
|
||
_userPhtotArray = [NSMutableArray array];
|
||
}
|
||
return _userPhtotArray;
|
||
}
|
||
|
||
- (UserPhoto *)avatarPhoto {
|
||
if (!_avatarPhoto) {
|
||
_avatarPhoto = [[UserPhoto alloc] init];
|
||
}
|
||
return _avatarPhoto;
|
||
}
|
||
|
||
- (NetImageView *)avatarImageView {
|
||
if (!_avatarImageView) {
|
||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||
config.imageType = ImageTypeUserIcon;
|
||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||
_avatarImageView.layer.masksToBounds = YES;
|
||
_avatarImageView.layer.cornerRadius = 36;
|
||
_avatarImageView.layer.borderWidth = 1;
|
||
_avatarImageView.layer.borderColor = UIColor.whiteColor.CGColor;
|
||
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||
_avatarImageView.userInteractionEnabled = NO;
|
||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapAvatarGuest)];
|
||
[_avatarImageView addGestureRecognizer:tap];
|
||
}
|
||
return _avatarImageView;
|
||
}
|
||
|
||
- (UIImageView *)copysIdImageView {
|
||
if (!_copysIdImageView) {
|
||
_copysIdImageView = [[UIImageView alloc] init];
|
||
_copysIdImageView.userInteractionEnabled = YES;
|
||
_copysIdImageView.image = [UIImage imageNamed:@"mine_user_id_copy"];
|
||
_copysIdImageView.hidden = YES;
|
||
}
|
||
return _copysIdImageView;
|
||
}
|
||
|
||
- (XPButton *)clanBtn {
|
||
if (!_clanBtn) {
|
||
_clanBtn = [XPButton buttonWithType:UIButtonTypeCustom];
|
||
[_clanBtn setImage:[UIImage imageNamed:@"mine_user_clan_icon"] forState:UIControlStateNormal];
|
||
[_clanBtn setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||
_clanBtn.titleLabel.font = [UIFont systemFontOfSize:13];
|
||
[_clanBtn addTarget:self action:@selector(clanBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||
_clanBtn.imageTitleSpace = 4;
|
||
_clanBtn.hidden = YES;
|
||
[_clanBtn setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
||
}
|
||
return _clanBtn;
|
||
}
|
||
|
||
- (UIButton *)constellationBtn {
|
||
if (!_constellationBtn) {
|
||
_constellationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[_constellationBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||
_constellationBtn.titleLabel.font = [UIFont systemFontOfSize:9 weight:UIFontWeightRegular];
|
||
[_constellationBtn setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFA34E"], [ThemeColor colorWithHexString:@"#FFD390"]] gradientType:GradientTypeUpleftToLowright imgSize:CGSizeMake(40, 14)] forState:UIControlStateNormal];
|
||
_constellationBtn.layer.cornerRadius = 7;
|
||
_constellationBtn.clipsToBounds = YES;
|
||
_constellationBtn.userInteractionEnabled = NO;
|
||
_constellationBtn.hidden = YES;
|
||
}
|
||
return _constellationBtn;
|
||
}
|
||
- (XPButton *)attentionButton {
|
||
if (!_attentionButton) {
|
||
_attentionButton = [XPButton buttonWithType:UIButtonTypeCustom];
|
||
[_attentionButton setTitle:@"关注" forState:UIControlStateNormal];
|
||
[_attentionButton setTitle:@"已关注" forState:UIControlStateSelected];
|
||
[_attentionButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
|
||
[_attentionButton setTitleColor:UIColorRGBAlpha(0x2B2D33, 0.6) forState:UIControlStateSelected];
|
||
[_attentionButton setImage:[UIImage imageNamed:@"mine_user_info_bottom_attention_normal"] forState:UIControlStateNormal];
|
||
[_attentionButton setImage:[UIImage imageNamed:@"mine_user_info_bottom_new_attention_select"] forState:UIControlStateSelected];
|
||
_attentionButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||
_attentionButton.backgroundColor = [ThemeColor appMainColor];
|
||
_attentionButton.layer.masksToBounds = YES;
|
||
_attentionButton.hidden = YES;
|
||
_attentionButton.layer.cornerRadius = 6;
|
||
[_attentionButton addTarget:self action:@selector(attentionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||
_attentionButton.imageTitleSpace = 2;
|
||
|
||
}
|
||
return _attentionButton;
|
||
}
|
||
@end
|