// // QXFamilyMemberCell.m // QXLive // // Created by 启星 on 2025/11/26. // #import "QXFamilyMemberCell.h" #import "QXUserHomeHeaderView.h" #import "QXCustomAlertView.h" @interface QXFamilyMemberCell() @end @implementation QXFamilyMemberCell +(instancetype)cellWithTableView:(UITableView *)tableView{ static NSString *cellId = @"QXFamilyMemberCell"; QXFamilyMemberCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; if (!cell) { cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject; cell.flowLayout.itemSize = CGSizeMake(UserIconWidth, UserIconHeight); cell.flowLayout.minimumLineSpacing = 7; cell.flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; cell.collectionView.dataSource = cell; cell.collectionView.delegate = cell; cell.collectionView.backgroundColor = UIColor.clearColor; [cell.collectionView registerClass:[QXTagImageCell class] forCellWithReuseIdentifier:@"QXTagImageCell"]; cell.backgroundColor = [UIColor clearColor]; cell.contentView.backgroundColor = [UIColor clearColor]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } return cell; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } -(void)setModel:(QXFamilyMemberModel *)model{ _model = model; [self.headerView setHeadIcon:model.nickname dress:model.dress]; [self.headerView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]]; self.dayLabel.text = [NSString stringWithFormat:@"剩余租期:%@",model.end_day]; self.timesLabel.text = [NSString stringWithFormat:@"免费续约次数:%@",model.free_renewal]; self.nameLabel.text = model.nickname; [self.todayPriceBtn setTitle:model.today_earnings forState:(UIControlStateNormal)]; [self.yestodayPriceBtn setTitle:model.yesterday_earnings forState:(UIControlStateNormal)]; [self.priceBtn setTitle:model.market_value forState:(UIControlStateNormal)]; self.onlineLabel.text = model.is_online==1?@"当前在线":@"当前离线"; self.continueBtn.hidden = model.is_show_sign.intValue==1?NO:YES; } - (IBAction)continueAction:(id)sender { QXCustomAlertView *al = [[QXCustomAlertView alloc] init]; al.title = @"续约提示"; al.message = @"尊敬的用户:  您的徒弟【夏沫】当前为首次签约的 免费续约期。续约后,徒弟合约将延长7天,您剩余的免费续约次数:1次"; al.cancleTitle = @"取消"; al.commitTitle = @"确认续约"; al.isFromController = YES; al.cancelBlock = ^{ [[QXGlobal shareGlobal] hideViewBlock:nil]; }; al.commitBlock = ^{ [[QXGlobal shareGlobal] hideViewBlock:nil]; }; [QXGlobal.shareGlobal showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:nil]; // [al showInView:self.viewController.view title:@"续约提示" message:@"尊敬的用户:  您的徒弟【夏沫】当前为首次签约的 免费续约期。续约后,徒弟合约将延长7天,您剩余的免费续约次数:1次" cancleTitle:@"取消" commitTitle:@"确认续约"]; } -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ if (self.model==nil) { return 0; } return self.model.icon.count; } -(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ QXTagImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXTagImageCell" forIndexPath:indexPath]; cell.imageUrl = self.model.icon[indexPath.row]; return cell; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end