| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- //
- // MainPageView.m
- // BuguLive
- //
- // Created by fanwe2014 on 16/6/13.
- // Copyright © 2016年 xfg. All rights reserved.
- //
- #import "MainPageView.h"
- @interface MainPageView()
- @end
- @implementation MainPageView
- - (void)awakeFromNib
- {
- [super awakeFromNib];
- // [self.followButton setTitleColor:kAppGrayColor1 forState:UIControlStateNormal];
- // [self.defriendButton setTitleColor:kAppGrayColor1 forState:UIControlStateNormal];
- // [self.personLetterButton setTitleColor:kAppGrayColor1 forState:UIControlStateNormal];
-
- self.HLineView.backgroundColor = self.VLineView1.backgroundColor = self.VLineView2.backgroundColor = kAppSpaceColor4;
- self.backGroundView.backgroundColor = kWhiteColor;
- for (UIView *subView in self.subviews) {
- [subView setLocalizedString];
- }
-
- [_followButton setTitle:ASLocalizedString(@"已关注") forState:UIControlStateSelected];
- }
- - (void)changeState
- {
- //关注
- if (self.has_focus == 1)
- {
- // [self.followButton setTitle:ASLocalizedString(@"已关注")forState:0];
- // [_followButton setImage:nil forState:UIControlStateNormal];
- _followButton.selected = YES;
- }else
- {
- // [self.followButton setTitle:ASLocalizedString(@"关注")forState:0];
- _followButton.selected = NO;
- // [_followButton setImage:[UIImage imageNamed:@"fw_me_noFollow"] forState:UIControlStateNormal];
- }
- //拉黑
- // if (self.has_black == 1)
- // {
- // [self.defriendButton setTitle:ASLocalizedString(@"解除拉黑")forState:0];
- //
- // }else
- // {
- // [self.defriendButton setTitle:ASLocalizedString(@"拉黑")forState:0];
- // }
- }
- //关注
- - (IBAction)followButton:(UIButton *)sender
- {
- NSMutableDictionary *dictM = [[NSMutableDictionary alloc]init];
- [dictM setObject:@"user" forKey:@"ctl"];
- [dictM setObject:@"follow" forKey:@"act"];
- [dictM setObject:[NSString stringWithFormat:@"%@",self.user_id] forKey:@"to_user_id"];
-
- [self.httpsManager POSTWithParameters:dictM SuccessBlock:^(NSDictionary *responseJson)
- {
- if ([responseJson toInt:@"status"] == 1)
- {
- NSMutableDictionary *mDict = [[NSMutableDictionary alloc]init];
- _has_focus = [responseJson toInt:@"has_focus"];
- if ([responseJson toInt:@"status"] == 1)
- {
- if (_has_focus == 1)//已关注
- {
- [mDict setObject:@"0" forKey:@"isShowFollow"];
- // [_followButton setTitle:ASLocalizedString(@"已关注")forState:0];
- // [_followButton setImage:nil forState:UIControlStateNormal];
- _followButton.selected = YES;
-
- // if (self.has_black == 1)//解除拉黑
- // {
- // [self.defriendButton setTitle:ASLocalizedString(@"拉黑")forState:0];
- // }
-
- }else if (_has_focus == 0)//关注
- {
- // [_followButton setTitle:ASLocalizedString(@"关注")forState:0];
- _followButton.selected = NO;
- // [_followButton setImage:[UIImage imageNamed:@"fw_me_noFollow"] forState:UIControlStateNormal];
- [mDict setObject:@"1" forKey:@"isShowFollow"];
- }
- [mDict setObject:[responseJson toString:@"follow_msg"] forKey:@"follow_msg"];
- if (self.user_id.length)
- {
- [mDict setObject:self.user_id forKey:@"userId"];
- }
- [[NSNotificationCenter defaultCenter]postNotificationName:@"liveIsShowFollow" object:mDict];
- }
- }
-
- } FailureBlock:^(NSError *error)
- {
-
- }];
- }
- //私信
- - (IBAction)privateLetter:(UIButton *)sender
- {
- if (self.delegate)
- {
- if ([self.delegate respondsToSelector:@selector(sentPersonLetter:)])
- {
- [self.delegate sentPersonLetter:self.user_id];
- }
- }
- }
- //拉黑
- - (IBAction)defriend:(UIButton *)sender
- {
- self.defriendButton.userInteractionEnabled = NO;
- NSMutableDictionary *dictM = [[NSMutableDictionary alloc]init];
- [dictM setObject:@"user" forKey:@"ctl"];
- [dictM setObject:@"set_black" forKey:@"act"];
- [dictM setObject:[NSString stringWithFormat:@"%@",self.user_id] forKey:@"to_user_id"];
-
- [self.httpsManager POSTWithParameters:dictM SuccessBlock:^(NSDictionary *responseJson)
- {
- NSMutableDictionary *mDict = [[NSMutableDictionary alloc]init];
- if ([responseJson toInt:@"status"] == 1)
- {
- _has_black = [responseJson toInt:@"has_black"];
- if (self.has_black == 1)//未拉黑
- {
- [_defriendButton setTitle:ASLocalizedString(@"解除拉黑")forState:0];
- [mDict setObject:@"0" forKey:@"isShowFollow"];
-
- }else if (self.has_black == 0)//已拉黑
- {
- [_defriendButton setTitle:ASLocalizedString(@"拉黑")forState:0];
- [mDict setObject:@"1" forKey:@"isShowFollow"];
- }
- self.defriendButton.userInteractionEnabled = YES;
- if (self.user_id.length)
- {
- [mDict setObject:self.user_id forKey:@"userId"];
- }
- [[NSNotificationCenter defaultCenter]postNotificationName:@"liveIsShowFollow" object:mDict];
- }
-
- } FailureBlock:^(NSError *error)
- {
-
- }];
- }
- @end
|