123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- //
- // YMGuildManagementMyEarningsInfoView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/3/26.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMGuildManagementMyEarningsInfoView.h"
- @interface YMGuildManagementMyEarningsInfoView ()
- @property (nonatomic, strong) UIView *bgView;
- @property (nonatomic, strong) UIImageView *bgImgv;
- @property (nonatomic, strong) UILabel *imgvMask;
- @property (nonatomic, strong) UILabel *timeMidLab;
- @property (nonatomic, strong) UILabel *coinLab;
- @property (nonatomic, strong) UILabel *contentLab;
- @property (nonatomic, strong) UIView *bottomView;
- @property (nonatomic, strong) UILabel *earnCountLab;
- @property (nonatomic, strong) UIButton *memberBtn;
- @property (nonatomic, strong) YMGuildManagementViewModel *viewModel;
- @end
- @implementation YMGuildManagementMyEarningsInfoView
- -(void)ym_setupViews{
- [self addSubview:self.bgView];
- [self.bgView addSubview:self.bgImgv];
- [self.bgImgv addSubview:self.imgvMask];
- [self.bgView addSubview:self.btnView];
- [self.btnView addSubview:self.timeMidLab];
- [self.btnView addSubview:self.timeBtn1];
- [self.btnView addSubview:self.timeBtn2];
-
- [self.bgView addSubview:self.coinLab];
- [self.bgView addSubview:self.contentLab];
-
- [self addSubview:self.bottomView];
- [self.bottomView addSubview:self.earnCountLab];
- [self.bottomView addSubview:self.memberBtn];
- [self.bottomView addSubview:self.sortBtn];
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
-
- }
- - (void)updateConstraints{
-
- [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.right.equalTo(self);
- make.height.mas_equalTo(adapt(256));
- }];
- [self.bgImgv mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.bgView);
- }];
- [self.imgvMask mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.bgImgv);
- }];
- [self.btnView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.bgView);
- make.top.equalTo(self.bgView).offset(adapt(102));
- make.width.equalTo(adapt(204));
- make.height.mas_equalTo(adapt(26));
- }];
-
- [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.bgView.mas_bottom);
- make.left.right.equalTo(self);
- make.height.mas_equalTo(adapt(60));
- }];
-
- [self.timeMidLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(self.btnView);
- make.width.mas_equalTo(adapt(20));
- }];
-
- [self.timeBtn1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.leading.bottom.equalTo(self.btnView);
- make.trailing.equalTo(self.timeMidLab.leading);
- }];
-
- [self.timeBtn2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.trailing.bottom.equalTo(self.btnView);
- make.leading.equalTo(self.timeMidLab.trailing);
- }];
-
- [self.coinLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.btnView.mas_bottom).offset(adapt(10));
- make.centerX.equalTo(self.bgView);
- }];
-
- [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.bgView);
- make.top.equalTo(self.coinLab.mas_bottom).offset(adapt(10));
- }];
-
- [self.earnCountLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.bottomView);
- make.left.equalTo(self.bottomView).offset(15);
- }];
-
- [self.memberBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.bottomView);
- make.left.equalTo(self.earnCountLab.mas_right).offset(15);
- }];
-
- [self.sortBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.bottomView);
- make.right.equalTo(self.bottomView).offset(-15);
- make.width.mas_equalTo(adapt(60));
- make.height.mas_equalTo(adapt(30));
- }];
-
- [super updateConstraints];
- }
- - (void)ym_bindViewModel:(YMGuildManagementViewModel *)viewModel{
- if (!viewModel) {
- return;
- }
- _viewModel = viewModel;
-
- @weakify(self)
- [[[[RACObserve(self.viewModel, startTime) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * startTime) {
- @strongify(self)
- [self.timeBtn1 setTitle:startTime forState:UIControlStateNormal];
- }];
- [[[[RACObserve(self.viewModel, endTime) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * endTime) {
- @strongify(self)
- [self.timeBtn2 setTitle:endTime forState:UIControlStateNormal];
- }];
- [[[[RACObserve(self.viewModel, myEarnStr) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * myEarnStr) {
- @strongify(self)
- self.coinLab.text = myEarnStr;
- }];
-
- [[[[RACObserve(self.viewModel, peopleStr) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * peopleStr) {
- @strongify(self)
- self.earnCountLab.text = [NSString stringWithFormat:@"产生收益(%@)人",peopleStr];
- }];
-
- }
- - (UIView *)bgView{
- if (!_bgView) {
- _bgView = [[UIView alloc]init];
- _bgView.backgroundColor = UIColor.whiteColor;
- }
- return _bgView;
- }
- - (UIImageView *)bgImgv {
- if (!_bgImgv) {
- _bgImgv = [[UIImageView alloc] init];
- _bgImgv.image = [UIImage imageNamed:@"gonghui_nav_bg"];
- }
- return _bgImgv;
- }
- - (UILabel *)imgvMask {
- if (!_imgvMask) {
- _imgvMask = [[UILabel alloc] init];
- }
- return _imgvMask;
- }
- - (UIView *)bottomView{
- if (!_bottomView) {
- _bottomView = [[UIView alloc]init];
- _bottomView.backgroundColor = UIColor.whiteColor;
- }
- return _bottomView;
- }
- - (UIButton *)btnView{
- if (!_btnView) {
- _btnView = [[UIButton alloc]init];
- _btnView.layer.cornerRadius = adapt(13);
- _btnView.layer.borderWidth = 0.5;
- _btnView.layer.borderColor = UIColor.whiteColor.CGColor;
- }
- return _btnView;
- }
- - (UILabel *)timeMidLab{
- if (!_timeMidLab) {
- _timeMidLab = [[UILabel alloc]init];
- _timeMidLab.textAlignment = NSTextAlignmentCenter;
- _timeMidLab.font = LCFont(15);
- _timeMidLab.textColor = UIColor.whiteColor;
- _timeMidLab.text = @"至";
- }
- return _timeMidLab;
- }
- - (UIButton *)timeBtn1{
- if (!_timeBtn1) {
- _timeBtn1 = [UIButton buttonWithType:UIButtonTypeCustom];
- _timeBtn1.contentHorizontalAlignment = UIControlContentHorizontalAlignmentTrailing;
- _timeBtn1.titleLabel.font = LCFont(15);
- _timeBtn1.userInteractionEnabled = NO;
- [_timeBtn1 setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
- }
- return _timeBtn1;
- }
- - (UIButton *)timeBtn2{
- if (!_timeBtn2) {
- _timeBtn2 = [UIButton buttonWithType:UIButtonTypeCustom];
- _timeBtn2.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
- _timeBtn2.titleLabel.font = LCFont(15);
- _timeBtn2.userInteractionEnabled = NO;
- [_timeBtn2 setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
- }
- return _timeBtn2;
- }
- - (UILabel *)coinLab{
- if (!_coinLab) {
- _coinLab = [[UILabel alloc]init];
- _coinLab.textAlignment = NSTextAlignmentCenter;
- _coinLab.font = LCBoldFont(20);
- _coinLab.textColor = UIColor.whiteColor;
- }
- return _coinLab;
- }
- - (UILabel *)contentLab{
- if (!_contentLab) {
- _contentLab = [[UILabel alloc]init];
- _contentLab.textAlignment = NSTextAlignmentCenter;
- _contentLab.font = LCFont(15);
- _contentLab.textColor = UIColor.whiteColor;
- _contentLab.text = @"我的收益(金币)";
- }
- return _contentLab;
- }
- - (UILabel *)earnCountLab{
- if (!_earnCountLab) {
- _earnCountLab = [[UILabel alloc]init];
- _earnCountLab.font = LCFont(15);
- _earnCountLab.textColor = [UIColor secondaryLabelColor];
- _earnCountLab.text = @"产生收益(*)人";
- }
- return _earnCountLab;
- }
- - (UIButton *)memberBtn{
- if (!_memberBtn) {
- _memberBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _memberBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
- _memberBtn.titleLabel.font = LCFont(15);
- [_memberBtn setTitleColor:HexColorFromRGBA(0xFF76C0, 1) forState:UIControlStateNormal];
- [_memberBtn setTitle:@"公会成员列表" forState:UIControlStateNormal];
- WS(weakSelf)
- [[[_memberBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel gotoMember];
- }];
- }
- return _memberBtn;
- }
- - (UIButton *)sortBtn{
- if (!_sortBtn) {
- _sortBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _sortBtn.titleLabel.font = LCFont(13);
- [_sortBtn setTitle:@"排序" forState:UIControlStateNormal];
- [_sortBtn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:UIControlStateNormal];
- _sortBtn.backgroundColor = HexColorFromRGBA(0xFF76C0, 1);
- _sortBtn.layer.cornerRadius = 5;
- _sortBtn.layer.masksToBounds = true;
- }
- return _sortBtn;
- }
- @end
|