123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- //
- // YMAudioVideoMatchingInfoPopupView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/3/18.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMAudioVideoMatchingInfoPopupView.h"
- @interface YMAudioVideoMatchingInfoPopupView ()
- /// 用户头像视图
- @property (nonatomic, strong) UIImageView *userAvatarView;
- /// 用户昵称标签
- @property (nonatomic, strong) UILabel *userNicknameLb;
- /// 用户匹配提示标签
- @property (nonatomic, strong) UILabel *userMatchingTipsLb;
- /// 用户收益提示标签
- @property (nonatomic, strong) UILabel *userEarningsTipsLb;
- /** 取消按钮*/
- @property (nonatomic, strong) UIButton *cancelBtn;
- /** 确认按钮*/
- @property (nonatomic, strong) UIButton *confirmBtn;
- @property (nonatomic, strong) YMAudioVideoMatchingInfoModel *model;
- @end
- @implementation YMAudioVideoMatchingInfoPopupView
- - (void)ym_setupViews{
-
- self.backgroundColor = HexColorFromRGB(0xfd7bc5);
-
- self.frame = CGRectMake(0, 0, kFrameWidth, adapt(20) + adapt(60) + adapt(20));
-
- [self addSubview:self.userAvatarView];
- [self addSubview:self.userNicknameLb];
- [self addSubview:self.userMatchingTipsLb];
- [self addSubview:self.userEarningsTipsLb];
- [self addSubview:self.cancelBtn];
- [self addSubview:self.confirmBtn];
-
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
- }
- - (void)updateConstraints{
-
- [self.userAvatarView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(adapt(20));
- make.left.equalTo(self).offset(adapt(20));
- make.bottom.equalTo(self).offset(adapt(-20));
- make.width.height.mas_equalTo(adapt(60));
- }];
-
- [self.userNicknameLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.userAvatarView.mas_top).offset(adapt(5));
- make.left.equalTo(self.userAvatarView.mas_right).offset(adapt(10));
- make.right.equalTo(self.cancelBtn.mas_left).offset(adapt(-10));
- }];
-
- [self.userMatchingTipsLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.userNicknameLb.mas_bottom).offset(adapt(5));
- make.left.equalTo(self.userAvatarView.mas_right).offset(adapt(10));
- make.right.equalTo(self.cancelBtn.mas_left).offset(adapt(-10));
- }];
-
- [self.userEarningsTipsLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.userMatchingTipsLb.mas_bottom).offset(adapt(5));
- make.left.equalTo(self.userAvatarView.mas_right).offset(adapt(10));
- make.right.equalTo(self.cancelBtn.mas_left).offset(adapt(-10));
- }];
-
- [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.userAvatarView.mas_centerY);
- make.right.equalTo(self.confirmBtn.mas_left).offset(adapt(-15));
- make.width.height.mas_equalTo(adapt(40));
- }];
-
- [self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.userAvatarView.mas_centerY);
- make.right.equalTo(self).offset(adapt(-20));
- make.width.height.mas_equalTo(adapt(40));
- }];
- [super updateConstraints];
- }
- - (void)configutationWithDictionary:(NSDictionary*)dic{
-
- self.model = [YMAudioVideoMatchingInfoModel yy_modelWithJSON:dic];
-
- [self.userAvatarView sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.model.avatar?:@""]];
-
- self.userNicknameLb.text = self.model.nickname?:@"";
-
- self.userMatchingTipsLb.text = stringFormat(@"邀你%@速配",[self.model.type isEqualToString:@"video"] ? @"视频" : @"语音");
-
- self.userEarningsTipsLb.text = stringFormat(@"获得%@",self.model.price?:@"");
- }
- - (UIImageView *)userAvatarView{
- if (!_userAvatarView) {
- _userAvatarView = [[UIImageView alloc]init];
- _userAvatarView.contentMode = UIViewContentModeScaleAspectFill;
- _userAvatarView.clipsToBounds = YES;
- _userAvatarView.layer.cornerRadius = adapt(10);
- _userAvatarView.layer.masksToBounds = YES;
- }
- return _userAvatarView;
- }
- - (UILabel *)userNicknameLb{
- if (!_userNicknameLb) {
- _userNicknameLb = [[UILabel alloc]init];
- _userNicknameLb.font = LCBoldFont(15);
- _userNicknameLb.textColor = HexColorFromRGB(0xFFFFFF);
- _userNicknameLb.textAlignment = NSTextAlignmentLeft;
- _userNicknameLb.text = @"******";
- }
- return _userNicknameLb;
- }
- - (UILabel *)userMatchingTipsLb{
- if (!_userMatchingTipsLb) {
- _userMatchingTipsLb = [[UILabel alloc]init];
- _userMatchingTipsLb.font = LCFont(12);
- _userMatchingTipsLb.textColor = HexColorFromRGB(0xFFFFFF);
- _userMatchingTipsLb.textAlignment = NSTextAlignmentLeft;
- _userMatchingTipsLb.text = @"邀请你速配";
- }
- return _userMatchingTipsLb;
- }
- - (UILabel *)userEarningsTipsLb{
- if (!_userEarningsTipsLb) {
- _userEarningsTipsLb = [[UILabel alloc]init];
- _userEarningsTipsLb.font = LCFont(12);
- _userEarningsTipsLb.textColor = HexColorFromRGB(0xffd881);
- _userEarningsTipsLb.textAlignment = NSTextAlignmentLeft;
- _userEarningsTipsLb.text = @"******";
- }
- return _userEarningsTipsLb;
- }
- - (UIButton *)cancelBtn {
- if(!_cancelBtn){
- _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_cancelBtn setBackgroundImage:ImageByName(@"ym_audio_video_matching_rejecting_icon") forState:UIControlStateNormal];
- WS(weakSelf)
- [[[_cancelBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- if (weakSelf.buttonBlock) {
- weakSelf.buttonBlock(NO,@"",@"");
- }
- }];
- }
- return _cancelBtn;
- }
- - (UIButton *)confirmBtn {
- if(!_confirmBtn){
- _confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_confirmBtn setBackgroundImage:ImageByName(@"ym_audio_video_matching_answering_icon") forState:UIControlStateNormal];
- WS(weakSelf)
- [[[_confirmBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- if (weakSelf.buttonBlock) {
- weakSelf.buttonBlock(YES,self.model.match_id,self.model.from_uid);
- }
- }];
- }
- return _confirmBtn;
- }
- @end
- @implementation YMAudioVideoMatchingInfoModel
- + (NSDictionary *)modelCustomPropertyMapper {
- return @{@"nim_id":@"id",};
- }
- @end
|