151 lines
5.5 KiB
Objective-C
Executable File
151 lines
5.5 KiB
Objective-C
Executable File
//
|
|
// SPHomepageHeader.m
|
|
// SweetParty
|
|
//
|
|
// Created by bj_szd on 2022/6/2.
|
|
//
|
|
|
|
#import "SPHomepageHeader.h"
|
|
#import "LMGonghuiDetailsViewController.h"
|
|
|
|
@interface SPHomepageHeader () <JXCategoryViewDelegate>
|
|
|
|
@property (nonatomic, strong) NSArray *titles;
|
|
@property (nonatomic, strong) JXCategoryTitleView *categoryView;
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *roomCoverHeight;
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *guideCoverHerght;
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *titleCoverTopLayout;
|
|
@property (weak, nonatomic) IBOutlet UIView *guildCover;
|
|
|
|
@end
|
|
|
|
@implementation SPHomepageHeader
|
|
|
|
- (void)awakeFromNib {
|
|
[super awakeFromNib];
|
|
|
|
self.titles = @[@"资料", @"动态", @"礼物墙"];
|
|
|
|
[self createUI];
|
|
}
|
|
|
|
- (void)createUI {
|
|
// [self.inRoomBtn setJianBianWithCGSize:CGSizeMake(57, 27)];
|
|
|
|
[self.titleBgView addSubview:self.categoryView];
|
|
[self.categoryView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(self.titleBgView);
|
|
}];
|
|
}
|
|
|
|
- (void)setModel:(SPHomepageModel *)model {
|
|
_model = model;
|
|
|
|
if (model.user_albums_list.count > 0) {
|
|
SPHomepageAlbumModel *obj = model.user_albums_list[0];
|
|
[self.bgImgV sd_setImageWithURL:[NSURL URLWithString:obj.image] placeholderImage:kDefaultUserIcon];
|
|
}else {
|
|
[self.bgImgV sd_setImageWithURL:[NSURL URLWithString:model.head_pic] placeholderImage:kDefaultUserIcon];
|
|
}
|
|
[self.avatarImgV sd_setImageWithURL:[NSURL URLWithString:model.head_pic] placeholderImage:kDefaultUserIcon];
|
|
self.nicknameLab.text = model.nick_name;
|
|
self.sexImgV.image = model.sex == 1 ? ImageNamed(@"sex_nan") : ImageNamed(@"sex_nv");
|
|
[self.gxImgV sd_setImageWithURL:[NSURL URLWithString:model.user_charm_contribution_info.contribution_level_image]];
|
|
[self.mlImgV sd_setImageWithURL:[NSURL URLWithString:model.user_charm_contribution_info.charm_level_image]];
|
|
[self.jueweiImgV sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]];
|
|
self.TARoomBtn.hidden = [model.user_room_rid integerValue] <= 0;
|
|
if ([model.special_uid integerValue] > 0) {
|
|
self.IDLab.text = [NSString stringWithFormat:@"%@", model.special_uid];
|
|
}else {
|
|
self.IDLab.text = [NSString stringWithFormat:@"%@", model.uid];
|
|
}
|
|
self.signLab.text = model.autograph;
|
|
|
|
self.focusLab.text = model.follow_num;
|
|
self.fansLab.text = model.fans_num;
|
|
self.collectLab.text = model.room_collect_num;
|
|
self.CPLab.text = model.cp_num;
|
|
|
|
|
|
if ([model.user_room_visitor.rid integerValue] > 0) {
|
|
self.inRoomView.hidden = NO;
|
|
self.titleCoverTopLayout.constant = 110;
|
|
|
|
self.inRoomLab.text = [NSString stringWithFormat:@"当前正在:%@", model.user_room_visitor.room_name];
|
|
[self.roomCover sd_setImageWithURL:[NSURL URLWithString:model.user_room_visitor.room_cover] placeholderImage:kDefaultUserIcon];
|
|
self.roomCoverHeight.constant = 44;
|
|
}else {
|
|
self.inRoomView.hidden = YES;
|
|
self.roomCoverHeight.constant = 0;
|
|
self.titleCoverTopLayout.constant = 50;
|
|
}
|
|
|
|
if (model.is_online == 1){
|
|
self.onlineStatus.image = ImageNamed(@"msg_online");
|
|
}else{
|
|
self.onlineStatus.image = ImageNamed(@"msg_offline");
|
|
}
|
|
}
|
|
- (IBAction)onBack:(id)sender {
|
|
[[UIViewController currentViewController].navigationController popViewControllerAnimated:YES];
|
|
}
|
|
- (IBAction)onTARoom:(id)sender {
|
|
[UIViewController goMicRoomWithRid:C_string(self.model.user_room_rid) withPwd:nil];
|
|
}
|
|
|
|
- (IBAction)onInRoom:(id)sender {
|
|
[UIViewController goMicRoomWithRid:C_string(self.model.user_room_visitor.rid) withPwd:nil];
|
|
}
|
|
|
|
- (IBAction)onDuplicateID:(id)sender {
|
|
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
|
if ([self.model.special_uid integerValue] > 0) {
|
|
pasteboard.string = self.model.special_uid;
|
|
}else {
|
|
pasteboard.string = self.model.uid;
|
|
}
|
|
|
|
[HelpPageDefine showMessage:@"ID已复制"];
|
|
}
|
|
|
|
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
|
if (self.onSelectIndexBlock) {
|
|
self.onSelectIndexBlock(index);
|
|
}
|
|
}
|
|
|
|
- (JXCategoryTitleView *)categoryView {
|
|
if (!_categoryView) {
|
|
_categoryView = [[JXCategoryTitleView alloc] init];
|
|
_categoryView.delegate = self;
|
|
_categoryView.titleFont = YBMediumFont(18);
|
|
_categoryView.titleSelectedFont = YBBoldFont(20);
|
|
_categoryView.titleColor = HEXCOLOR(0x999999);
|
|
_categoryView.titleSelectedColor = HEXCOLOR(0x333333);
|
|
_categoryView.contentEdgeInsetLeft = 15;
|
|
_categoryView.cellSpacing = 30;
|
|
_categoryView.averageCellSpacingEnabled = NO;
|
|
|
|
_categoryView.titles = self.titles;
|
|
|
|
// JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
|
|
// lineView.indicatorImageViewSize = CGSizeMake(16, 16);
|
|
// lineView.indicatorImageView.image = ImageNamed(@"common_zhishi");
|
|
// lineView.verticalMargin = 28;
|
|
// lineView.horizontalMargin = 20;
|
|
// _categoryView.indicators = @[lineView];
|
|
|
|
// JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
|
|
// lineView.indicatorWidth = 20;
|
|
// lineView.indicatorHeight = 3;
|
|
// lineView.indicatorCornerRadius = 1.5;
|
|
// lineView.indicatorColor = mainDeepColor;
|
|
// lineView.verticalMargin = 0;
|
|
// lineView.lineStyle = JXCategoryIndicatorLineStyle_Lengthen;
|
|
// _categoryView.indicators = @[lineView];
|
|
}
|
|
return _categoryView;
|
|
}
|
|
|
|
@end
|