| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- //
- // MOGuildStartVC.m
- // MiMoLive
- //
- // Created by SuperC on 2023/10/25.
- //
- #import "MOGuildStartVC.h"
- #import "MOGuildApplyView.h"
- #import "MOSquareTopMenuView.h"
- #import "MOGuildStartView.h"
- #import "MOGuildSMSVC.h"
- #import "MOGuildApplyVC.h"
- #import "MOMyGuildInfoView.h"
- #import "MOGuildDataModels.h"
- @interface MOGuildStartVC ()
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *backBtnTop;
- @property (weak, nonatomic) IBOutlet UILabel *leadLab;
- /** 顶部的容器View */
- @property (nonatomic, strong) UIView *topContantView;
- /** 没有工会或者工会在审核中 展示该View */
- @property (nonatomic, strong) MOGuildApplyView *guildStartView;
- /** 有工会则展示该View */
- @property (nonatomic, strong) MOMyGuildInfoView *guildInfoView;
- /** 切换状态栏 */
- @property (nonatomic, strong) MOSquareTopMenuView *guildChangeView;
- /** 底部tableView */
- @property (nonatomic, strong) MOGuildStartView *latestTableView;
- /** 底部tableView */
- @property (nonatomic, strong) MOGuildStartView *powerTableView;
- /** 总数据 */
- @property (nonatomic, strong) MOGuildData *baseData;
- @end
- @implementation MOGuildStartVC
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self.navigationController setNavigationBarHidden:YES animated:animated];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view from its nib.
-
- [self setupUI];
-
- [self getHttpData];
- }
- - (void)setupUI{
-
- self.leadLab.text = NSLocalString(@"mimo_guild_application_to_settle_in");
-
- CGFloat statusBarHeight = STATUS_BAR_HEIGHT;
- self.backBtnTop.constant = statusBarHeight + 12.0;
-
- self.view.backgroundColor = [MOTools colorWithHexString:@"#F4F0F5" alpha:1.0];
-
- CGFloat guildStartHeight = [self.guildStartView getViewHeight];
- [self.view addSubview:self.guildStartView];
- [self.guildStartView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.leadLab.mas_bottom).offset(17.0);
- make.left.equalTo(self.view).offset(15.0);
- make.right.equalTo(self.view).offset(-15.0);
- make.height.equalTo(@(guildStartHeight));
- }];
-
- [self.view addSubview:self.guildChangeView];
- [self.guildChangeView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.guildStartView.mas_bottom).offset(15.0);
- make.left.equalTo(self.view).offset(17.0);
- make.height.equalTo(@30.0);
- make.right.equalTo(self.view).offset(-17.0);
- }];
-
- self.guildChangeView.currentButtonIndex = 0;
-
- [self.view addSubview:self.latestTableView];
- [self.latestTableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.guildChangeView.mas_bottom).offset(10.0);
- make.left.equalTo(self.view).offset(15.0);
- make.right.equalTo(self.view).offset(-15.0);
- make.bottom.equalTo(self.view);
- }];
-
- [self.view addSubview:self.powerTableView];
- [self.powerTableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.guildChangeView.mas_bottom).offset(10.0);
- make.left.equalTo(self.view).offset(15.0);
- make.right.equalTo(self.view).offset(-15.0);
- make.bottom.equalTo(self.view);
- }];
- }
- - (void)setUIWithProperty{
- if(self.baseData.status == 2){
-
- CGFloat newHeight = [MOMyGuildInfoView getViewHeight];
-
- //已有工会
- [self.guildStartView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.equalTo(@(newHeight));
- }];
-
- self.guildStartView.hidden = YES;
-
- [self.view addSubview:self.guildInfoView];
- [self.guildInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.leadLab.mas_bottom).offset(17.0);
- make.left.equalTo(self.view).offset(15.0);
- make.right.equalTo(self.view).offset(-15.0);
- make.height.equalTo(@(newHeight));
- }];
-
- MOGuildBase *meGuildModle = self.baseData.guildBase;
-
- [self.guildInfoView.iconImg sd_setImageWithURL:[NSURL URLWithString:meGuildModle.logo]];
- self.guildInfoView.unionNameLab.text = meGuildModle.name;
- [self.guildInfoView.guildIdBtn setTitle:[NSString stringWithFormat:@"ID %@",meGuildModle.no] forState:UIControlStateNormal];
- [self.guildInfoView.anchorNumBtn setTitle:[NSString stringWithFormat:@"Anchor %.f",meGuildModle.anchor] forState:UIControlStateNormal];
-
- MOCountryList *countryModel;
- if(meGuildModle.country != 0){
- countryModel = (MOCountryList *)[[MODataCache sharedYYCache] objectForKey:[NSString stringWithFormat:@"%@_%@",kCountryArrInfo,meGuildModle.country]];
- }
-
- if(countryModel){
- [self.guildInfoView.countryImg sd_setImageWithURL:[NSURL URLWithString:countryModel.icon]];
- }
- else{
- self.guildInfoView.countryImg.hidden = YES;
- }
-
- self.leadLab.text = NSLocalString(@"mimo_me_guild_center");
- }
- else if (self.baseData.status == 1){
- //申请中
- [self.guildStartView.doneBtn setTitle:NSLocalString(@"mimo_guild_applying") forState:UIControlStateNormal];
- }
- }
- - (IBAction)backBtnClick:(id)sender {
- [self.navigationController popViewControllerAnimated:YES];
- }
- #pragma mark - Http
- - (void)getHttpData{
- WEAKSELF
- [kHttpManager toGetGuildAboutGuideWithParams:nil andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
-
- if(kCode_Success){
- MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
-
- __strong typeof(weakSelf) self = weakSelf;
-
- self.baseData = [MOGuildData modelObjectWithDictionary:data[@"data"]];
-
- self.latestTableView.dataArr = [self.baseData.guidlLatest mutableCopy];
-
- self.powerTableView.dataArr = [self.baseData.guildPower mutableCopy];
-
- [self setUIWithProperty];
- }
- else{
- kShowNetError(data)
- }
- }];
- }
- #pragma mark - Lazy
- - (MOGuildApplyView *)guildStartView{
- if(!_guildStartView){
- _guildStartView = [MOGuildApplyView moGuildApplyView];
-
- WEAKSELF
- //MARK: 申请工会按钮
- _guildStartView.doneBtnBlock = ^{
- //审核中
- if(weakSelf.baseData.status == 1){
- MOGuildApplyVC *vc = [[MOGuildApplyVC alloc] init];
- vc.isApply = YES;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }
- else{
- MOGuildSMSVC *vc = [[MOGuildSMSVC alloc] init];
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }
- };
- }
-
- return _guildStartView;
- }
- - (MOMyGuildInfoView *)guildInfoView{
- if(!_guildInfoView){
- _guildInfoView = [MOMyGuildInfoView moMyGuildInfoView];
- }
-
- return _guildInfoView;
- }
- - (MOSquareTopMenuView *)guildChangeView{
- if(!_guildChangeView){
- CGFloat width = SCREENWIDTH - 20 * 2 - 12.0 - 10.0 - 15.0 - 5.0;
- _guildChangeView = [[MOSquareTopMenuView alloc] initWithFrame:CGRectMake(0.0, 0.0, width, 30.0)];
- _guildChangeView.titleArray = @[NSLocalString(@"mimo_Guild_Recently"),NSLocalString(@"mimo_Guild_Strength")];
-
- }
-
- return _guildChangeView;
- }
- - (void)setGuildChangeBlock{
-
- WEAKSELF
- //顶部直播类别切换回调
- self.guildChangeView.clickBtnBlock = ^(NSInteger index) {
- __strong typeof(weakSelf) self = weakSelf;
-
- if (index == 0){
- self.latestTableView.hidden = NO;
- self.powerTableView.hidden = YES;
- }
- else{
- self.latestTableView.hidden = YES;
- self.powerTableView.hidden = NO;
- }
- };
- }
- - (MOGuildStartView *)latestTableView{
- if(!_latestTableView){
- _latestTableView = [[MOGuildStartView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
- _latestTableView.backgroundColor = [MOTools colorWithHexString:@"#F5F1F6" alpha:1.0];
-
- _latestTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- _latestTableView.separatorInset = UIEdgeInsetsZero;
- _latestTableView.rowHeight = 78.0;
-
-
- }
- return _latestTableView;
- }
- - (MOGuildStartView *)powerTableView{
- if(!_powerTableView){
- _powerTableView = [[MOGuildStartView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
- _powerTableView.backgroundColor = [MOTools colorWithHexString:@"#F5F1F6" alpha:1.0];
-
- _powerTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- _powerTableView.separatorInset = UIEdgeInsetsZero;
- _powerTableView.rowHeight = 78.0;
- _powerTableView.hidden = YES;
-
- }
- return _powerTableView;
- }
- @end
|