123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- //
- // YOUPAIBBCallRecordCell.m
- // VQU
- //
- // Created by Elaine on 2021/10/22.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAIBBCallRecordCell.h"
- #import "YOUPAILZLevelView.h"
- @interface YOUPAIBBCallRecordCell()
- @property(nonatomic,strong)UIImageView* youpaipavatarImgV;
- @property(nonatomic,strong)UILabel *youpaipnicknameL;
- @property (nonatomic,strong)UIImageView *youpaipsexImgV;
- //@property (nonatomic, weak) UIImageView *youpaipvipImgV;
- //@property (nonatomic, weak) YOUPAILZLevelView *youpaiplevelView;
- @property (nonatomic, strong) UILabel *youpaipdayL;
- @property (nonatomic, strong) UILabel *youpaiptimerL;
- @property (nonatomic, strong) UILabel *youpaipdescL;
- @end
- @implementation YOUPAIBBCallRecordCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- //v1.5.6适配暗黑模式
- [self.contentView setBackgroundColor:LCBkgColor];
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
-
-
- self.youpaipavatarImgV = [[UIImageView alloc]init];
- self.youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill;
- self.youpaipavatarImgV.layer.cornerRadius = 22.0f;
- self.youpaipavatarImgV.layer.masksToBounds = YES;
- [self.contentView addSubview:self.youpaipavatarImgV];
- [self.youpaipavatarImgV makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(14.0f);
- make.centerY.equalTo(self.contentView.centerY);
- make.size.mas_equalTo(CGSizeMake(44.0f, 44.0f));
- }];
-
- self.youpaipnicknameL = [[UILabel alloc] init];
- self.youpaipnicknameL.font = LCFont(14);
- self.youpaipnicknameL.textColor = [UIColor whiteColor];
- [self.contentView addSubview:self.youpaipnicknameL];
- [self.youpaipnicknameL makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.youpaipavatarImgV.mas_right).offset(10.0f);
- make.top.equalTo(self.youpaipavatarImgV.top).offset(5.5f);
- }];
-
- UIImageView *youpaipsexImgV = [[UIImageView alloc] init];
- [youpaipsexImgV setImage:[UIImage imageNamed:@"vqu_images_D_dynamic_woman"]];
- [self.contentView addSubview:youpaipsexImgV];
- self.youpaipsexImgV = youpaipsexImgV;
- [youpaipsexImgV makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.youpaipnicknameL.right).offset(@3);
- make.centerY.equalTo(self.youpaipnicknameL);
- make.size.mas_equalTo(CGSizeMake(14, 14));
- }];
-
- // UIImageView *youpaipvipImgV = [[UIImageView alloc] init];
- // [self.contentView addSubview:youpaipvipImgV];
- // self.youpaipvipImgV = youpaipvipImgV;
- // [youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(youpaipsexImgV.mas_right).offset(3.0f);
- // make.centerY.equalTo(self.youpaipnicknameL);
- // }];
- //
- // YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init];
- // [self.contentView addSubview:youpaiplevelView];
- // self.youpaiplevelView = youpaiplevelView;
- // [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(youpaipsexImgV.mas_right).offset(3.0f);
- // make.centerY.equalTo(self.youpaipnicknameL);
- // }];
- //
- UILabel *youpaipdayL = [[UILabel alloc] init];
- youpaipdayL.font = LCFont(11.0f);
- youpaipdayL.textColor = HexColorFromRGB(0x9F9DA5);
- youpaipdayL.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:youpaipdayL];
- self.youpaipdayL = youpaipdayL;
- [youpaipdayL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-14.0f);
- make.top.equalTo(self.youpaipnicknameL.mas_top);
- }];
-
- UILabel *youpaiptimerL = [[UILabel alloc] init];
- youpaiptimerL.font = LCFont(11.0f);
- youpaiptimerL.textColor = HexColorFromRGB(0x9F9DA5);
- youpaiptimerL.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:youpaiptimerL];
- self.youpaiptimerL = youpaiptimerL;
- [youpaiptimerL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-14.0f);
- make.top.equalTo(self.youpaipdayL.mas_bottom).offset(12.0f);
- }];
-
- UILabel *youpaipdescL = [[UILabel alloc] init];
- youpaipdescL.font = LCFont(12.0f);
- youpaipdescL.textColor = HexColorFromRGB(0x9F9DA5);
- youpaipdescL.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:youpaipdescL];
- self.youpaipdescL = youpaipdescL;
- [youpaipdescL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.youpaipavatarImgV.mas_right).offset(10.0f);
- make.top.equalTo(self.youpaipnicknameL.mas_bottom).offset(8.0f);
- }];
-
- [self.contentView addLineWithColor:HexColorFromRGB(0x28262D) lineRect:CGRectMake(14.0f, 77.5f, KScreenWidth - 28.0f, 0.5f)];
- }
- - (void)setYoupaiprecordModel:(YOUPAILCCallRecordModel *)youpaiprecordModel{
- _youpaiprecordModel = youpaiprecordModel;
- [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaiprecordModel.youpaipavatar]];
- self.youpaipnicknameL.text = youpaiprecordModel.youpaipnickname;
- if (youpaiprecordModel.youpaipstatus==1) {
- if (youpaiprecordModel.youpaiptype==1) {
- self.youpaipdescL.text = @"自己取消了呼叫";
- }else{
- self.youpaipdescL.text = @"对方取消了通话";
- }
- }else if (youpaiprecordModel.youpaipstatus==2){
- if (youpaiprecordModel.youpaiptype==1) {
- self.youpaipdescL.text = @"对方拒绝了通话";
- }else{
- self.youpaipdescL.text = @"自己拒绝接听";
- }
- }else if (youpaiprecordModel.youpaipstatus==3){
- self.youpaipdescL.text = @"超时未接听";
- }else if (youpaiprecordModel.youpaipstatus==4){
- if (youpaiprecordModel.youpaiptype==1) {
- self.youpaipdescL.text = [NSString stringWithFormat:@"本次支出%.0f钻石",youpaiprecordModel.youpaipcall_amount];
- }else{
- self.youpaipdescL.text = [NSString stringWithFormat:@"本次收入%.0f钻石",youpaiprecordModel.youpaipcall_income];
- }
- }
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- //需要设置为和字符串相同的格式
- [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
- NSDate *localDate = [dateFormatter dateFromString:youpaiprecordModel.youpaipcreate_time];
- NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
- NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
-
- NSDate *now = [NSDate date];
- NSDateComponents *comps = [[NSDateComponents alloc] init];
- comps = [calendar components:unitFlags fromDate:now];
-
- NSDateComponents *create_comps = [[NSDateComponents alloc] init];
- create_comps = [calendar components:unitFlags fromDate:localDate];
- // NSLog(@"%ld年%ld月%ld日",(long)[comps year],(long)[comps month],(long)[comps day]);
- // NSLog(@"%ld",(long)[comps weekday]);
-
- NSString *day = @"";
- if ([comps year] == [create_comps year] && [comps month] == [create_comps month] && [comps day] == [create_comps day]) {
- day = @"今天";
- }else{
- day = [NSString stringWithFormat:@"%@月%@日",@([create_comps month]),@([create_comps day])];
- }
-
- self.youpaipdayL.text = day;
- self.youpaiptimerL.text = [NSString stringWithFormat:@"%02ld:%02ld",[create_comps hour],[create_comps minute]];
-
- if (youpaiprecordModel.youpaipgender == 1) {//0未知 1女 2男
- self.youpaipsexImgV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_woman"];
- }else{
- self.youpaipsexImgV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_man"];
- }
- }
- @end
|