fix: 修正首页列表加载逻辑 | 修正部分 UI 效果
This commit is contained in:
@@ -101,6 +101,7 @@ HWDMP4PlayDelegate>
|
||||
|
||||
@implementation XPMineUserInfoViewController
|
||||
- (void)dealloc {
|
||||
[self hideHUD];
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,6 @@
|
||||
if (self) {
|
||||
[self addSubview:self.frameImageView];
|
||||
[self addSubview:self.numLabel];
|
||||
// [self addSubview:self.copiedImageView];
|
||||
|
||||
[self.frameImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.bottom.mas_equalTo(self);
|
||||
@@ -40,11 +39,6 @@
|
||||
}
|
||||
make.centerY.mas_equalTo(self).offset(0.8);
|
||||
}];
|
||||
|
||||
// [self.copiedImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.trailing.centerY.mas_equalTo(self);
|
||||
// make.size.mas_equalTo(CGSizeMake(14, 14));
|
||||
// }];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -53,7 +47,7 @@
|
||||
_num = num;
|
||||
self.numLabel.text = num;
|
||||
|
||||
UIImage *longBackgroundImage = [UIImage imageNamed:@"user_info_id_beatiful_mark_short"];
|
||||
UIImage *longBackgroundImage = kImage(@"user_info_id_beatiful_mark_short");
|
||||
UIEdgeInsets capInsets = UIEdgeInsetsMake(0, 27, 0, 14);
|
||||
UIImage *resizableImage = [longBackgroundImage resizableImageWithCapInsets:capInsets resizingMode:UIImageResizingModeStretch];
|
||||
self.frameImageView.image = resizableImage;
|
||||
@@ -62,7 +56,10 @@
|
||||
- (UIImageView *)frameImageView {
|
||||
if (!_frameImageView) {
|
||||
_frameImageView = [[UIImageView alloc] init];
|
||||
_frameImageView.image = [UIImage imageNamed:@"user_info_id_beatiful_mark_short"];
|
||||
UIImage *longBackgroundImage = kImage(@"user_info_id_beatiful_mark_short");
|
||||
UIEdgeInsets capInsets = UIEdgeInsetsMake(0, 27, 0, 14);
|
||||
UIImage *resizableImage = [longBackgroundImage resizableImageWithCapInsets:capInsets resizingMode:UIImageResizingModeStretch];
|
||||
_frameImageView.image = resizableImage;//Image(@"user_info_id_beatiful_mark_short");
|
||||
}
|
||||
return _frameImageView;
|
||||
}
|
||||
@@ -71,7 +68,7 @@
|
||||
if (!_copiedImageView) {
|
||||
_copiedImageView = [[UIImageView alloc] init];
|
||||
_copiedImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_copiedImageView.image = [UIImage getLanguageImage:@"user_card_copy_id1"];
|
||||
_copiedImageView.image = kImage(@"user_card_copy_id1");
|
||||
}
|
||||
return _copiedImageView;
|
||||
}
|
||||
|
@@ -45,22 +45,22 @@
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self.contentView addSubview:self.imageView];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
// [self.contentView addSubview:self.titleLabel];
|
||||
|
||||
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.contentView);
|
||||
}];
|
||||
// [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.center.mas_equalTo(self.contentView);
|
||||
// }];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)updateCell:(NameplateModel *)model {
|
||||
self.titleLabel.hidden = !model.isCustomWord;
|
||||
self.titleLabel.text = model.word;
|
||||
// self.titleLabel.hidden = !model.isCustomWord;
|
||||
// self.titleLabel.text = model.word;
|
||||
self.imageView.imageUrl = model.nameplateImage;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ UICollectionViewDelegateFlowLayout>
|
||||
CGFloat cellHeight = 20;
|
||||
|
||||
// collectionView 左右边距
|
||||
CGFloat sidePadding = kGetScaleWidth(15) * 2; // 左右各 15
|
||||
CGFloat sidePadding = kGetScaleWidth(15); // 左右各 15
|
||||
CGFloat itemSpacing = 4; // cell 间的水平间距
|
||||
CGFloat lineSpacing = 2; // 行间距
|
||||
|
||||
@@ -204,7 +204,7 @@ UICollectionViewDelegateFlowLayout>
|
||||
NSInteger rows = (list.count + itemsPerRow - 1) / itemsPerRow;
|
||||
|
||||
// 总高度 = 所有 cell 的高度 + 所有行间距
|
||||
namePlateHeight = rows * cellHeight + (rows - 1) * lineSpacing;
|
||||
namePlateHeight = rows * cellHeight + rows * lineSpacing;
|
||||
}
|
||||
|
||||
return namePlateHeight;
|
||||
@@ -235,7 +235,7 @@ UICollectionViewDelegateFlowLayout>
|
||||
}
|
||||
|
||||
// topAlbum + cp + name plate area + line contents + others
|
||||
height = kGetScaleWidth(195) + 170 + [self namePlateHeight:model.userNameplateList] + (lineHeight * numberOfLines) + kGetScaleWidth(220);
|
||||
height = kGetScaleWidth(195) + 160 + [self namePlateHeight:model.userNameplateList] + (lineHeight * numberOfLines) + kGetScaleWidth(220);
|
||||
|
||||
return height;
|
||||
}
|
||||
@@ -418,7 +418,7 @@ UICollectionViewDelegateFlowLayout>
|
||||
|
||||
[self.beautIDView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(24);
|
||||
make.width.mas_greaterThanOrEqualTo(60);
|
||||
make.width.mas_greaterThanOrEqualTo(10);
|
||||
}];
|
||||
|
||||
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -448,7 +448,7 @@ UICollectionViewDelegateFlowLayout>
|
||||
[self.nameplateCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.nickStackView.mas_bottom).offset(30);
|
||||
make.leading.mas_equalTo(self.userInfoView).offset(kGetScaleWidth(15));
|
||||
make.trailing.mas_equalTo(self.userInfoView).offset(kGetScaleWidth(-15));
|
||||
make.trailing.mas_equalTo(self.userInfoView);//.offset(kGetScaleWidth(-15));
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
}
|
||||
@@ -783,7 +783,9 @@ UICollectionViewDelegateFlowLayout>
|
||||
[self.nameplateCollectionView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo([XPMineUserInfoHeaderView namePlateHeight:nameplateList]);
|
||||
}];
|
||||
[self.nameplateCollectionView reloadData];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.nameplateCollectionView reloadData];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)updateNameAndGenderInfo {
|
||||
@@ -1050,7 +1052,6 @@ UICollectionViewDelegateFlowLayout>
|
||||
_pageButton.backgroundColor = UIColorRGBAlpha(0x000000, 0.6);
|
||||
_pageButton.layer.cornerRadius = 9;
|
||||
_pageButton.layer.masksToBounds = YES;
|
||||
|
||||
}
|
||||
return _pageButton;
|
||||
}
|
||||
@@ -1316,7 +1317,7 @@ UICollectionViewDelegateFlowLayout>
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(72, 20);
|
||||
layout.minimumLineSpacing = 2;
|
||||
layout.minimumInteritemSpacing = 2;
|
||||
layout.minimumInteritemSpacing = 4;
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
_nameplateCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_nameplateCollectionView.backgroundColor = [UIColor clearColor];
|
||||
|
@@ -54,7 +54,6 @@
|
||||
|
||||
- (void)getHomeAllTopsData {
|
||||
RACSubject *banner = [RACSubject subject];
|
||||
RACSubject *banner_2 = [RACSubject subject];
|
||||
RACSubject *menu = [RACSubject subject];
|
||||
RACSubject *rank = [RACSubject subject];
|
||||
|
||||
@@ -62,10 +61,6 @@
|
||||
return [RACSignal return:nil];
|
||||
}];
|
||||
|
||||
// RACSignal *bannerSignal_2 = [banner_2 catch:^RACSignal *(NSError *error) {
|
||||
// return [RACSignal return:nil];
|
||||
// }];
|
||||
|
||||
RACSignal *menuSignal = [menu catch:^RACSignal *(NSError *error) {
|
||||
return [RACSignal return:nil];
|
||||
}];
|
||||
@@ -119,15 +114,6 @@
|
||||
[rank sendError:nil];
|
||||
[rank sendCompleted];
|
||||
}]];
|
||||
|
||||
// [Api getHomeSecondBannerCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
// NSArray * array = [HomeBannerInfoModel modelsWithArray:data.data];
|
||||
// [banner_2 sendNext:array];
|
||||
// [banner_2 sendCompleted];
|
||||
// }fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
// [banner_2 sendError:nil];
|
||||
// [banner_2 sendCompleted];
|
||||
// } errorToast:NO] uid:uid type:@"1"];
|
||||
}
|
||||
|
||||
///得到首页轮播图
|
||||
|
@@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// @param pageSize 一页有多少个 - 默认 20
|
||||
- (void)getRecommendRoomList:(NSString *)tabId page:(NSInteger)page;
|
||||
|
||||
- (void)loadSecondBanner;
|
||||
|
||||
/// 获取更多的个播房间
|
||||
- (void)getHomeMoreAnchorRoomList;
|
||||
|
@@ -21,17 +21,11 @@
|
||||
/// @param page 当前的页数
|
||||
|
||||
- (void)getRecommendRoomList:(NSString *)tabId page:(NSInteger)page {
|
||||
|
||||
@kWeakify(self);
|
||||
[Api getHomeTabRoomsCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
NSArray * array = [HomePlayRoomModel modelsWithArray:data.data];
|
||||
[[self getView] getHomeRecommendRoomListSuccess:array];
|
||||
if (page == 1
|
||||
//&& [tabId isEqualToString: @"21"]
|
||||
) {
|
||||
[self loadSecondBanner];
|
||||
}
|
||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
[[self getView] getHomeRecommendRoomListFail:msg ];
|
||||
@@ -39,8 +33,6 @@
|
||||
pageNum:[NSString stringWithFormat:@"%ld", page]
|
||||
pageSize:@"50"
|
||||
tabId:tabId];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)loadSecondBanner {
|
||||
|
@@ -60,7 +60,9 @@
|
||||
NSMutableArray * array = [NSMutableArray array];
|
||||
[_bannerList enumerateObjectsUsingBlock:^(HomeBannerInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.bannerPic.length > 0) {
|
||||
[array addObject:obj.bannerPic];
|
||||
NSCharacterSet *allowedCharacters = [NSCharacterSet URLFragmentAllowedCharacterSet];
|
||||
NSString *encodedURLString = [obj.bannerPic stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters];
|
||||
[array addObject:encodedURLString];
|
||||
} else {
|
||||
[array addObject:@""];
|
||||
}
|
||||
|
@@ -54,7 +54,9 @@
|
||||
NSMutableArray *picArray = @[].mutableCopy;
|
||||
for (HomeBannerInfoModel *model in bannerInfoList) {
|
||||
if (![NSString isEmpty:model.bannerPic]) {
|
||||
[picArray addObject:model.bannerPic];
|
||||
NSCharacterSet *allowedCharacters = [NSCharacterSet URLFragmentAllowedCharacterSet];
|
||||
NSString *encodedURLString = [model.bannerPic stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters];
|
||||
[picArray addObject:encodedURLString];
|
||||
}
|
||||
}
|
||||
self.bannerView.imageURLStringsGroup = picArray.copy;
|
||||
@@ -74,7 +76,7 @@
|
||||
_bannerView.pageControlDotSize = CGSizeMake(3, 3);
|
||||
_bannerView.pageDotColor = [UIColor lightGrayColor];
|
||||
_bannerView.currentPageDotColor = [UIColor darkGrayColor];
|
||||
_bannerView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||||
_bannerView.bannerImageViewContentMode = UIViewContentModeScaleToFill;
|
||||
if (isMSRTL()) {
|
||||
for (UIView *subView in _bannerView.subviews) {
|
||||
subView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;
|
||||
@@ -152,8 +154,7 @@
|
||||
} else if([self.tagModel.id isEqualToString:@"-1"]){
|
||||
[self.presenter getHomePersonalRoomList];
|
||||
} else{
|
||||
[self.presenter getRecommendRoomList:self.tagModel.id
|
||||
page:self.page];
|
||||
[self.presenter loadSecondBanner];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,11 +247,11 @@
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"khomeVCRefreshComplete" object:nil];
|
||||
}
|
||||
|
||||
- (void)sortDataSource {
|
||||
NSMutableArray *mutableArrayA = [self.datasource mutableCopy];
|
||||
NSInteger insertIndex = 5;
|
||||
- (NSMutableArray *)insertBannerData:(NSArray *)firstPageList {
|
||||
NSMutableArray *mutableArrayA = [firstPageList mutableCopy];
|
||||
|
||||
if (self.bannerInfoList.count > 0) {
|
||||
NSInteger insertIndex = 5;
|
||||
if (mutableArrayA.count < insertIndex) {
|
||||
[mutableArrayA addObject:self.bannerInfoList];
|
||||
} else {
|
||||
@@ -258,29 +259,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
self.datasource = mutableArrayA.mutableCopy;
|
||||
|
||||
[self.collectionView reloadData];
|
||||
return mutableArrayA;
|
||||
}
|
||||
|
||||
- (void)getHomeRecommendRoomListSuccess:(NSArray *)list{
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
|
||||
for (HomePlayRoomModel *model in list) {
|
||||
model.width = [UILabel getWidthWithText:@(model.onlineNum).stringValue height:kGetScaleWidth(12) font:kFontBold(10)]+1;
|
||||
}
|
||||
|
||||
if(self.page == 1){
|
||||
self.datasource = [NSMutableArray arrayWithArray:list];
|
||||
self.datasource = [self insertBannerData:list];
|
||||
}else{
|
||||
[self.datasource addObjectsFromArray:list];
|
||||
}
|
||||
[self sortDataSource];
|
||||
|
||||
[self.collectionView reloadData];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"khomeVCRefreshComplete" object:nil];
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
}
|
||||
|
||||
- (void)getHomeSecondBannerSuccess:(NSArray *)banners {
|
||||
self.bannerInfoList = banners;
|
||||
[self sortDataSource];
|
||||
[self.presenter getRecommendRoomList:self.tagModel.id
|
||||
page:self.page];
|
||||
}
|
||||
|
||||
- (void)getHomeRecommendRoomListFail:(NSString *)message{
|
||||
|
@@ -1453,10 +1453,10 @@
|
||||
/// @param imageUrl 网络图片的地址
|
||||
- (NSMutableAttributedString *)createUrlImageAttribute:(NSString *)imageUrl size:(CGSize)size {
|
||||
NetImageConfig *config = [[NetImageConfig alloc]init];
|
||||
///先这样吧
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.autoLoad = YES;
|
||||
NetImageView *imageView = [[NetImageView alloc]initWithUrl:imageUrl config:config];
|
||||
|
||||
NetImageView *imageView = [[NetImageView alloc] initWithUrl:imageUrl config:config];
|
||||
imageView.backgroundColor = [UIColor clearColor];
|
||||
imageView.bounds = CGRectMake(0, 0, size.width, size.height);
|
||||
imageView.layer.masksToBounds = YES;
|
||||
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
|
@@ -263,6 +263,11 @@
|
||||
|
||||
[self updateCollectionViewInsetWith:normalOriginArray.count];
|
||||
[self.giftCollectionView reloadData];
|
||||
if (self.segmentType == GiftSegmentType_WeekStar && isMSRTL()) {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.giftCollectionView reloadData];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setPackOriginArray:(NSArray *)packOriginArray {
|
||||
|
@@ -554,10 +554,12 @@
|
||||
[self.backImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(180);
|
||||
}];
|
||||
self.idLabel.textColor = UIColorFromRGB(0x313131);
|
||||
} else {
|
||||
self.backImageView.layer.masksToBounds = YES;
|
||||
self.backImageView.layer.cornerRadius = 25;
|
||||
self.backImageView.imageUrl = userInfo.avatar;
|
||||
self.idLabel.textColor = [DJDKMIMOMColor textThirdColor];
|
||||
}
|
||||
|
||||
NSString *resourcePath = [userInfo.userInfoCardPic stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
|
@@ -346,8 +346,8 @@ NSString * const kJSOpenPaymentCallback = @"openPaymentCallback";
|
||||
didReceiveScriptMessage:(WKScriptMessage *)message {
|
||||
[self.webview evaluateJavaScript:@"document.location.href"
|
||||
completionHandler:^(id _Nullable response, NSError * _Nullable error) {
|
||||
NSLog(@"%@", response);
|
||||
NSLog(@"-- -- - -- - -%@: %@", message.name, message.body);
|
||||
// NSLog(@"%@", response);
|
||||
// NSLog(@"-- -- - -- - -%@: %@", message.name, message.body);
|
||||
NSString *currentUrl = [NSString stringWithFormat:@"%@", response];
|
||||
///测试环境只要有host就执行,方便h5连接本地调试
|
||||
BOOL condition = currentUrl != nil && [currentUrl containsString:API_HOST_URL];
|
||||
|
Reference in New Issue
Block a user