570 lines
25 KiB
Objective-C
570 lines
25 KiB
Objective-C
//
|
|
// DDMyInformationViewController.m
|
|
// DingDangApp
|
|
//
|
|
// Created by apple on 2023/5/29.
|
|
//
|
|
|
|
#import "DDMyInformationViewController.h"
|
|
#import "DDEditMyInfoViewController.h"
|
|
#import "DDMyInformationHeaderView.h"
|
|
#import "DDMyInformationGiftWallViewController.h"
|
|
#import "DDMyInformationDynamicViewController.h"
|
|
#import "RoomUserInfoModel.h"
|
|
#import <LSTPopView.h>
|
|
#import "RoomUserManagementView.h"
|
|
#import "DDMyInfoReportViewController.h"
|
|
#import "DDMyInformationProfileViewController.h"
|
|
#import "DDDynamicSendViewController.h"
|
|
@interface DDMyInformationViewController ()<UIGestureRecognizerDelegate>
|
|
@property (nonatomic, strong) UIImageView * topBgImageView;
|
|
@property (nonatomic, strong) UIView * topNavView;
|
|
@property (nonatomic, strong) UIButton *leftButton;
|
|
@property (nonatomic, strong) UIButton * moreButton;
|
|
@property (nonatomic, strong) UILabel * titLabel;
|
|
@property (nonatomic, assign) CGFloat scrollOffSetY;
|
|
@property (nonatomic, strong) DDMyInformationHeaderView * headerView;
|
|
@property (nonatomic, strong) NSMutableArray *titleArr;
|
|
@property (nonatomic, strong) UIButton * followBtn;
|
|
@property (nonatomic, strong) UIButton * chatBtn;
|
|
@property (nonatomic, strong) UIButton * editBtn;
|
|
@property (nonatomic, strong) AppUserModel * personModel;
|
|
@property (nonatomic, strong) DDMyInformationProfileViewController * profileVC;
|
|
@end
|
|
|
|
@implementation DDMyInformationViewController
|
|
- (DDMyInformationProfileViewController *)profileVC{
|
|
if (!_profileVC) {
|
|
_profileVC = [[DDMyInformationProfileViewController alloc] init];
|
|
}
|
|
return _profileVC;
|
|
}
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
|
|
[self initContentView];
|
|
}
|
|
|
|
- (void)initContentView {
|
|
CGFloat liveOrDynamicHeight = 0;
|
|
AppUserModel * myModel = [ToolsObject getUserModel];
|
|
if ([ToolsObject IsNullWithObject:self.user_id] || [self.user_id isEqualToString:myModel.user_id]) {
|
|
liveOrDynamicHeight = 20;
|
|
self.moreButton.hidden = YES;
|
|
}else{
|
|
self.moreButton.hidden = NO;
|
|
}
|
|
|
|
self.JXTableHeaderViewHeight = DDStatusHeight()+DDNavigationBarHeight()+312 + liveOrDynamicHeight;
|
|
self.pagerView.pinSectionHeaderVerticalOffset = liveOrDynamicHeight>0 ?DDNavigationBarHeight()+60:DDNavigationBarHeight();
|
|
self.pagerView.backgroundColor = UIColor.clearColor;
|
|
self.categoryView.frame = CGRectMake(0, 0, kWidth, 44);
|
|
self.categoryView.cellSpacing = 20;
|
|
self.categoryView.contentEdgeInsetLeft = 15;
|
|
self.pagerView.mainTableView.backgroundColor = UIColor.clearColor;
|
|
self.categoryView.titleSelectedColor = [UIColor jk_colorWithHexString:@"#333333"];
|
|
self.categoryView.titleColor = [UIColor jk_colorWithHexString:@"#666666"];
|
|
self.categoryView.titleSelectedFont = [UIFont systemFontOfSize:16];
|
|
self.categoryView.titleFont = [UIFont systemFontOfSize:14];
|
|
self.categoryView.titleColorGradientEnabled = YES;
|
|
[self.titlesArray addObject:@"资料"];
|
|
[self.titlesArray addObject:@"动态"];
|
|
[self.titlesArray addObject:@"礼物墙"];
|
|
self.categoryView.titles = self.titlesArray;
|
|
[self.view addSubview:self.topBgImageView];
|
|
[self.view addSubview:self.pagerView];
|
|
[self.view addSubview:self.topNavView];
|
|
[self.topNavView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.top.equalTo(self.view);
|
|
make.height.mas_equalTo(DDNavigationBarHeight());
|
|
}];
|
|
[self.topNavView addSubview:self.leftButton];
|
|
[self.topNavView addSubview:self.titLabel];
|
|
[self.topNavView addSubview:self.moreButton];
|
|
|
|
[self.leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.topNavView).inset(DDStatusTopHeight());
|
|
make.height.mas_equalTo(40);
|
|
make.width.mas_equalTo(40);
|
|
make.left.equalTo(self.topNavView).offset(5);
|
|
}];
|
|
[self.titLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.equalTo(self.leftButton);
|
|
make.centerX.equalTo(self.topNavView);
|
|
make.height.mas_equalTo(25);
|
|
}];
|
|
[self.moreButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.equalTo(self.leftButton);
|
|
make.right.equalTo(self.topNavView).offset(-5);
|
|
make.height.mas_equalTo(40);
|
|
make.width.mas_equalTo(40);
|
|
}];
|
|
|
|
[self.pagerView reloadData];
|
|
WeakSelf(weakSelf)
|
|
self.pagerView.mainTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
|
[weakSelf getUserInfo];
|
|
[weakSelf.categoryView reloadData];
|
|
[weakSelf.pagerView reloadData];
|
|
[weakSelf.pagerView.mainTableView.mj_header endRefreshing];
|
|
}];
|
|
|
|
[self changeNavBarWhite:NO];
|
|
|
|
}
|
|
|
|
- (void)viewWillAppear:(BOOL)animated
|
|
{
|
|
[super viewWillAppear:animated];
|
|
[self getUserInfo];
|
|
|
|
}
|
|
-(void)getUserInfo
|
|
{
|
|
WeakSelf(weakSelf)
|
|
NSMutableDictionary *requestDict = [NSMutableDictionary dictionary];
|
|
if (![ToolsObject IsNullWithObject:self.user_id]) {
|
|
[requestDict setObject:self.user_id forKey:@"user_id"];
|
|
}
|
|
[NetworkRequest requestPOST:@"/user/info" parameters:requestDict block:^(BaseResponse * _Nonnull response) {
|
|
if (response.code == 200){
|
|
if ([ToolsObject IsNullWithObject:response.data]) {
|
|
return;
|
|
}
|
|
AppUserModel * myModel = [ToolsObject getUserModel];
|
|
weakSelf.personModel = [AppUserModel yy_modelWithJSON:response.data];
|
|
if (weakSelf.profileVC) {
|
|
weakSelf.profileVC.user_id = self.user_id;
|
|
weakSelf.profileVC.personModel = self.personModel;
|
|
}
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[weakSelf.headerView updataPersonInfoWithModel:weakSelf.personModel];
|
|
weakSelf.titLabel.text = weakSelf.personModel.nickname;
|
|
|
|
if ([weakSelf.personModel.user_id isEqualToString:myModel.user_id]) {
|
|
[weakSelf.view addSubview:weakSelf.editBtn];
|
|
}else{
|
|
[weakSelf.view addSubview:weakSelf.followBtn];
|
|
weakSelf.followBtn.selected = weakSelf.personModel.is_attention;
|
|
[weakSelf.view addSubview:weakSelf.chatBtn];
|
|
if (weakSelf.personModel.is_attention) {
|
|
[weakSelf.followBtn setTitle:@" 已关注" forState:(UIControlStateNormal)];
|
|
[weakSelf.followBtn setTitleColor:[UIColor jk_colorWithHexString:@"#A739FE"] forState:(UIControlStateNormal)];
|
|
weakSelf.followBtn.backgroundColor = [UIColor jk_colorWithHexString:@"#ECDEFF"];
|
|
[weakSelf.followBtn setImage:[UIImage imageNamed:@"myinfo_76"] forState:UIControlStateNormal];
|
|
}else{
|
|
[weakSelf.followBtn setTitle:@"关注" forState:(UIControlStateNormal)];
|
|
weakSelf.followBtn.backgroundColor = [UIColor jk_colorWithHexString:@"#ECDEFF"];
|
|
[weakSelf.followBtn setTitleColor:[UIColor jk_colorWithHexString:@"#A739FE"] forState:(UIControlStateNormal)];
|
|
[weakSelf.followBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
|
|
}
|
|
}
|
|
[weakSelf reloadHeaderHeight];
|
|
});
|
|
}else{
|
|
if (weakSelf.navigationController.viewControllers.count>1) {
|
|
[weakSelf.navigationController popViewControllerAnimated:YES];
|
|
}else{
|
|
[weakSelf.navigationController dismissViewControllerAnimated:YES completion:^{}];
|
|
}
|
|
}
|
|
}];
|
|
|
|
}
|
|
- (void)changeNavBarWhite:(BOOL)change{
|
|
if (change) {
|
|
self.topNavView.backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:1];
|
|
[self.headerView.bottomView roundCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) radius:0];
|
|
}else{
|
|
self.topNavView.backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:0];
|
|
[self.headerView.bottomView roundCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) radius:16];
|
|
}
|
|
self.titLabel.hidden = !change;
|
|
}
|
|
-(void)reloadHeaderHeight
|
|
{
|
|
if ([ToolsObject IsNullWithObject:self.personModel.signature]) {
|
|
self.personModel.signature = @"高冷的TA不喜欢留签名";
|
|
}
|
|
CGFloat liveOrDynamicHeight = 0;
|
|
AppUserModel * myModel = [ToolsObject getUserModel];
|
|
if ([ToolsObject IsNullWithObject:self.user_id]|| [self.user_id isEqualToString:myModel.user_id]) {
|
|
liveOrDynamicHeight = 20;
|
|
}else{
|
|
if (self.personModel.in_live) {
|
|
liveOrDynamicHeight = 20;
|
|
}else{
|
|
liveOrDynamicHeight = 0;
|
|
}
|
|
}
|
|
self.JXTableHeaderViewHeight = DDStatusHeight()+DDNavigationBarHeight()+312 + liveOrDynamicHeight;
|
|
self.headerView.height = self.JXTableHeaderViewHeight;
|
|
self.pagerView.pinSectionHeaderVerticalOffset = liveOrDynamicHeight>0 ?DDNavigationBarHeight()+60:DDNavigationBarHeight();
|
|
// [self.pagerView refreshTableHeaderView];
|
|
|
|
[[NSNotificationCenter defaultCenter]postNotificationName:@"userBlackNotification" object:self.personModel];
|
|
|
|
}
|
|
- (void)pagerView:(JXPagerView *)pagerView mainTableViewDidScroll:(UIScrollView *)scrollView
|
|
{
|
|
if (scrollView.contentOffset.y >= 0) {
|
|
if (!self.topBgImageView.isHidden) {
|
|
self.topBgImageView.frame = CGRectMake(0, 0, kWidth, DDNavigationBarHeight() + 250 -scrollView.contentOffset.y);
|
|
}
|
|
self.scrollOffSetY = scrollView.contentOffset.y ;
|
|
if (self.scrollOffSetY<= 50) {
|
|
self.topBgImageView.hidden = NO;
|
|
[self changeNavBarWhite:NO];
|
|
return;
|
|
}
|
|
self.topBgImageView.hidden = YES;
|
|
[self changeNavBarWhite:YES];
|
|
}else{
|
|
self.topBgImageView.frame = CGRectMake(0, 0, kWidth, DDNavigationBarHeight() + 250 + (-scrollView.contentOffset.y));
|
|
}
|
|
}
|
|
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
|
|
return self.headerView;
|
|
}
|
|
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
|
|
return self.JXTableHeaderViewHeight;
|
|
}
|
|
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
|
return 44;
|
|
}
|
|
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
|
return self.categoryView;
|
|
}
|
|
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
|
return self.categoryView.titles.count;
|
|
}
|
|
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
|
|
if (index ==0){
|
|
return self.profileVC;
|
|
}else if (index ==1){
|
|
DDMyInformationDynamicViewController *listVC = [[DDMyInformationDynamicViewController alloc] init];
|
|
listVC.user_id = self.user_id;
|
|
listVC.model = self.personModel;
|
|
return listVC;
|
|
}else{
|
|
DDMyInformationGiftWallViewController *list = [[DDMyInformationGiftWallViewController alloc] init];
|
|
list.user_id = self.user_id;
|
|
return list;
|
|
}
|
|
}
|
|
- (JXPagerView *)preferredPagingView {
|
|
return [[JXPagerView alloc] initWithDelegate:self];
|
|
}
|
|
- (void)viewDidLayoutSubviews {
|
|
[super viewDidLayoutSubviews];
|
|
self.pagerView.frame = CGRectMake(0, 0, kWidth, kHeight- DDBottomHeight() - 62);
|
|
}
|
|
|
|
-(NSMutableArray *)titleArr
|
|
{
|
|
if (!_titleArr) {
|
|
_titleArr = @[].mutableCopy;
|
|
}
|
|
return _titleArr;
|
|
}
|
|
-(UIButton *)leftButton{
|
|
if (!_leftButton){
|
|
_leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_leftButton setImage:[UIImage imageNamed:@"myinfo_6"] forState:UIControlStateNormal];
|
|
WeakSelf(weakSelf)
|
|
[_leftButton jk_addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
|
|
if ([ToolsObject isCurrentVC_Present:weakSelf]) {
|
|
[weakSelf dismissViewControllerAnimated:YES completion:nil];
|
|
} else {
|
|
[weakSelf.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
}];
|
|
}
|
|
return _leftButton;
|
|
}
|
|
-(UIButton *)moreButton{
|
|
if (!_moreButton){
|
|
_moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_moreButton setImage:[UIImage imageNamed:@"com_2"] forState:UIControlStateNormal];
|
|
WeakSelf(weakSelf);
|
|
[_moreButton jk_addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
|
|
[weakSelf alertMore];
|
|
}];
|
|
}
|
|
return _moreButton;
|
|
}
|
|
- (void)alertMore{
|
|
RoomUserManagementView *userManagementView ;
|
|
if ([ToolsObject getUserModel].is_super_admin){
|
|
userManagementView = [[RoomUserManagementView alloc] initWithFrame:CGRectMake(0, 0, kWidth,50*5+KSAFEAREA_BOTTOM_HEIHGHT+50+30)];
|
|
userManagementView.dataSource = [NSMutableArray arrayWithArray:@[self.personModel.is_attention?@"取消关注":@"关注",self.personModel.is_blacklist?@"拉黑":@"取消拉黑",@"举报",@"封禁",@"冻结账户"]];
|
|
}else{
|
|
userManagementView = [[RoomUserManagementView alloc] initWithFrame:CGRectMake(0, 0, kWidth,50*3+KSAFEAREA_BOTTOM_HEIHGHT+50+30)];
|
|
userManagementView.dataSource = [NSMutableArray arrayWithArray:@[self.personModel.is_attention?@"取消关注":@"关注",self.personModel.is_blacklist?@"拉黑":@"取消拉黑",@"举报"]];
|
|
}
|
|
[userManagementView roundTopCornersRadius:12];
|
|
WeakSelf(weakSelf)
|
|
userManagementView.backSelectMuenStr = ^(NSString * _Nonnull menuStr) {
|
|
if([menuStr isEqualToString:@"取消关注"]){
|
|
[weakSelf requestcancelFollow:weakSelf.personModel.user_id withIndexPath:nil];
|
|
}else if([menuStr isEqualToString:@"关注"]){
|
|
[weakSelf requestAddFollow:weakSelf.personModel.user_id withIndexPath:nil];
|
|
}else if([menuStr isEqualToString:@"拉黑"]||[menuStr isEqualToString:@"取消拉黑"]){
|
|
[weakSelf requestBlackUser:weakSelf.personModel];
|
|
}else if([menuStr isEqualToString:@"举报"]){
|
|
if ([ToolsObject isCurrentVC_Present:weakSelf]) {
|
|
|
|
DDMyInfoReportViewController * vc = [[DDMyInfoReportViewController alloc] init];
|
|
vc.isSmallMessage = YES;
|
|
vc.juBaoType = 2;
|
|
vc.jubao_id = weakSelf.personModel.user_id;
|
|
XPSemiModalConfiguration *config = [XPSemiModalConfiguration defaultConfiguration];
|
|
config.backgroundOpacity = 0.5;
|
|
config.enableBackgroundAnimation = NO;
|
|
config.enableShadow = NO;
|
|
config.shouldDismissModal = NO;
|
|
[weakSelf presentSemiModalViewController:vc contentHeight:kHeight configuration:config completion:nil dismissClickBlock:nil];
|
|
} else {
|
|
DDMyInfoReportViewController * jubaoVC = [[DDMyInfoReportViewController alloc] init];
|
|
jubaoVC.juBaoType = 2;
|
|
jubaoVC.jubao_id = weakSelf.personModel.user_id;
|
|
[weakSelf.navigationController pushViewController:jubaoVC animated:YES];
|
|
}
|
|
}else if([menuStr isEqualToString:@"封禁"]){
|
|
[weakSelf showBanUser];
|
|
}else if([menuStr isEqualToString:@"冻结账户"]){
|
|
[NetworkRequest requestPOST:@"/room/frozen/user" parameters:@{@"operated_user_id":weakSelf.personModel.user_id} block:^(BaseResponse * _Nonnull response) {
|
|
if (response.code == 200){
|
|
[weakSelf.view jk_makeToast:@"封禁成功"];
|
|
if (weakSelf.navigationController.viewControllers.count>1) {
|
|
[weakSelf.navigationController popViewControllerAnimated:YES];
|
|
}else{
|
|
[weakSelf.navigationController dismissViewControllerAnimated:YES completion:^{}];
|
|
}
|
|
}
|
|
}];
|
|
}
|
|
};
|
|
LSTPopView *popView = [LSTPopView initWithCustomView:userManagementView
|
|
parentView:kKeyWindow
|
|
popStyle:LSTPopStyleSmoothFromBottom
|
|
dismissStyle:LSTDismissStyleSmoothToBottom];
|
|
//弹窗位置: 居中 贴顶 贴左 贴底 贴右
|
|
popView.hemStyle = LSTHemStyleBottom;
|
|
LSTPopViewWK(popView)
|
|
//点击背景触发
|
|
popView.bgClickBlock = ^{
|
|
[wk_popView dismiss];
|
|
};
|
|
userManagementView.backDismissBlock = ^{
|
|
[wk_popView dismiss];
|
|
};
|
|
//弹窗显示
|
|
[popView pop];
|
|
}
|
|
-(void)showBanUser{
|
|
WeakSelf(weakSelf)
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
DDCustomAlertView * alertView = [[DDCustomAlertView alloc] init:@[@"取消",@"封禁"] title:[NSString stringWithFormat:@"是否封禁 ID:%@ %@",weakSelf.personModel.user_number,weakSelf.personModel.nickname] content:@"" alertType:0];
|
|
alertView.alertViewClickBlock = ^(NSInteger index, NSString * _Nonnull title) {
|
|
if ([title isEqualToString:@"封禁"]) {
|
|
[NetworkRequest requestPOST:@"/room/ban/user" parameters:@{@"operated_user_id":weakSelf.personModel.user_id}.mutableCopy block:^(BaseResponse * _Nonnull response) {
|
|
if (response.code == 200){
|
|
[weakSelf.view jk_makeToast:@"封禁成功"];
|
|
if (weakSelf.navigationController.viewControllers.count>1) {
|
|
[weakSelf.navigationController popViewControllerAnimated:YES];
|
|
}else{
|
|
[weakSelf.navigationController dismissViewControllerAnimated:YES completion:^{}];
|
|
}
|
|
}
|
|
}];
|
|
}
|
|
};
|
|
[alertView showAlertView];
|
|
});
|
|
}
|
|
-(void)requestBlackUser:(AppUserModel *)model
|
|
{
|
|
if ([ToolsObject IsNullWithObject:model.user_id]) {
|
|
[self.view jk_makeToast:@"未获取到该用户信息,请刷新重试"];
|
|
return;
|
|
}
|
|
NSMutableDictionary *requestDict = [NSMutableDictionary dictionary];
|
|
[requestDict setObject:model.user_id forKey:@"user_id"];
|
|
[requestDict setObject:model.is_blacklist?@"0":@"1" forKey:@"status"];
|
|
[SVProgressHUD showProgress:1];
|
|
WeakSelf(weakSelf)
|
|
[NetworkRequest requestPOST:@"/my/set/blacklist" parameters:requestDict block:^(BaseResponse * _Nonnull response) {
|
|
if (response.code == 200) {
|
|
[SVProgressHUD showInfoWithStatus:model.is_blacklist?@"拉黑成功":@"取消拉黑成功"];
|
|
[weakSelf getUserInfo];
|
|
}
|
|
}];
|
|
|
|
}
|
|
-(UIView *)topNavView{
|
|
if (!_topNavView){
|
|
_topNavView = [UIView new];
|
|
}
|
|
return _topNavView;
|
|
}
|
|
|
|
-(UILabel *)titLabel{
|
|
if (!_titLabel){
|
|
_titLabel = [[UILabel alloc] init];
|
|
_titLabel.font = [UIFont systemFontOfSize:18];
|
|
_titLabel.textColor = [UIColor whiteColor];
|
|
_titLabel.textAlignment = NSTextAlignmentCenter;
|
|
_titLabel.hidden = YES;
|
|
_titLabel.textColor = [UIColor jk_colorWithHexString:@"#333333"];
|
|
}
|
|
return _titLabel;
|
|
}
|
|
-(DDMyInformationHeaderView *)headerView
|
|
{
|
|
if (!_headerView) {
|
|
_headerView = [[DDMyInformationHeaderView alloc]initWithFrame:CGRectMake(0, 0, kWidth, self.JXTableHeaderViewHeight)];
|
|
WeakSelf(weakSelf)
|
|
_headerView.didReleaseDynamic = ^{
|
|
AppUserModel * myModel = [ToolsObject getUserModel];
|
|
if ([weakSelf.personModel.user_id isEqualToString:myModel.user_id]) {
|
|
DDDynamicSendViewController *vc = [[DDDynamicSendViewController alloc] init];
|
|
[weakSelf.navigationController pushViewController:vc animated:YES];
|
|
}else{
|
|
if (weakSelf.personModel.in_live) {
|
|
if (weakSelf.navigationController.viewControllers.count>1) {
|
|
RoomUserInfoModel *userModel = [[RoomUserInfoModel alloc]init];
|
|
userModel.user_id = weakSelf.personModel.user_id;
|
|
[[ToolsObject shareTools] jumpToRoomVC:weakSelf.personModel.in_live_room_id followUser:userModel];
|
|
}else{
|
|
[weakSelf.navigationController dismissViewControllerAnimated:YES completion:^{
|
|
if (weakSelf.inliveClickBlock) {
|
|
weakSelf.inliveClickBlock();
|
|
}
|
|
}];
|
|
}
|
|
}else{
|
|
[ToolsObject pushMyInformationViewController:weakSelf.personModel.user_id];
|
|
}
|
|
}
|
|
|
|
};
|
|
}
|
|
return _headerView;
|
|
}
|
|
-(UIButton *)editBtn
|
|
{
|
|
if (!_editBtn) {
|
|
_editBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
|
|
_editBtn.frame = CGRectMake(44, kHeight-DDBottomHeight()-52, kWidth-88, 44);
|
|
[_editBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
|
_editBtn.titleLabel.font = [UIFont systemFontOfSize:16];
|
|
[_editBtn setTitle:@"编辑资料" forState:(UIControlStateNormal)];
|
|
WeakSelf(weakSelf)
|
|
[_editBtn jk_addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
|
|
DDEditMyInfoViewController *vc = [[DDEditMyInfoViewController alloc]init];
|
|
vc.personModel = weakSelf.personModel;
|
|
[weakSelf.navigationController pushViewController:vc animated:YES];
|
|
}];
|
|
[ToolsObject getGradientLayerWithView:_editBtn colors:@[(__bridge id)[UIColor jk_colorWithHexString:@"#5188FF"].CGColor,(__bridge id)[UIColor jk_colorWithHexString:@"#A739FE"].CGColor] start:CGPointMake(1, 0.78) end:CGPointMake(0.11, 0.25)];
|
|
[_editBtn roundCorners:UIRectCornerAllCorners radius:_editBtn.height/2];
|
|
}
|
|
return _editBtn;
|
|
}
|
|
-(UIButton *)followBtn
|
|
{
|
|
if (!_followBtn) {
|
|
_followBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
|
|
_followBtn.frame = CGRectMake(20, kHeight-DDBottomHeight()-52, 116, 44);
|
|
[_followBtn setTitle:@"关注" forState:(UIControlStateNormal)];
|
|
[_followBtn roundCorners:UIRectCornerAllCorners radius:22];
|
|
WeakSelf(weakSelf)
|
|
[_followBtn jk_addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
|
|
if (weakSelf.personModel.is_attention) {
|
|
[weakSelf requestcancelFollow:weakSelf.personModel.user_id withIndexPath:nil];
|
|
}else{
|
|
[weakSelf requestAddFollow:weakSelf.personModel.user_id withIndexPath:nil];
|
|
}
|
|
}];
|
|
}
|
|
return _followBtn;
|
|
}
|
|
- (void)requestAddFollow:(NSString *)user_id withIndexPath:(NSIndexPath *)index{
|
|
|
|
if ([ToolsObject IsNullWithObject:user_id]) {
|
|
[ToolsObject addPopVieToText:@"没有获取到该用户信息"];
|
|
return;
|
|
}
|
|
[ToolsObject ShowSVProgressHUD:@""];
|
|
NSMutableDictionary *parameter =@{@"followed_user_id":user_id}.mutableCopy;
|
|
WeakSelf(weakSelf)
|
|
[NetworkRequest requestPOST:@"/dynamic/attention" parameters:parameter block:^(BaseResponse * _Nonnull response) {
|
|
[ToolsObject DismissSVProgressHUD];
|
|
if (response.code == 200) {
|
|
[ToolsObject addPopVieToText:@"关注成功"];
|
|
[weakSelf getUserInfo];
|
|
|
|
}
|
|
}];
|
|
}
|
|
- (void)requestcancelFollow:(NSString *)user_id withIndexPath:(NSIndexPath *)index{
|
|
|
|
if ([ToolsObject IsNullWithObject:user_id]) {
|
|
[ToolsObject addPopVieToText:@"没有获取到该用户信息"];
|
|
return;
|
|
}
|
|
[ToolsObject ShowSVProgressHUD:@""];
|
|
NSMutableDictionary *parameter =@{@"followed_user_id":user_id}.mutableCopy;
|
|
WeakSelf(weakSelf)
|
|
[NetworkRequest requestPOST:@"/dynamic/cancel/attention" parameters:parameter block:^(BaseResponse * _Nonnull response) {
|
|
[ToolsObject DismissSVProgressHUD];
|
|
if (response.code == 200) {
|
|
[weakSelf getUserInfo];
|
|
}
|
|
}];
|
|
}
|
|
-(UIButton *)chatBtn
|
|
{
|
|
if (!_chatBtn) {
|
|
_chatBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
|
|
_chatBtn.frame = CGRectMake(self.followBtn.right+20, kHeight-DDBottomHeight()-52,kWidth-self.followBtn.right-20-20, 44);
|
|
[_chatBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
|
_chatBtn.titleLabel.font = [UIFont systemFontOfSize:16];
|
|
[_chatBtn setTitle:@"聊一聊" forState:(UIControlStateNormal)];
|
|
[ToolsObject getGradientLayerWithView:_chatBtn colors:@[(__bridge id)[UIColor jk_colorWithHexString:@"#5188FF"].CGColor,(__bridge id)[UIColor jk_colorWithHexString:@"#A739FE"].CGColor] start:CGPointMake(0.5, 0) end:CGPointMake(0.5, 1)];
|
|
[_chatBtn roundCorners:UIRectCornerAllCorners radius:_chatBtn.height/2];
|
|
WeakSelf(weakSelf)
|
|
[_chatBtn jk_addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
|
|
if ([weakSelf.user_id integerValue] <= 0) {
|
|
[ToolsObject addPopVieToText:@"未获取到用户信息,请返回重试"];
|
|
return;
|
|
}
|
|
if (!weakSelf.personModel.is_blacklist) {
|
|
[ToolsObject addPopVieToText:@"您已拉黑该用户"];
|
|
return;
|
|
}
|
|
DDMUserModel * userModel = [[DDMUserModel alloc]init];
|
|
userModel.uid = self.personModel.user_id;
|
|
userModel.avatar = self.personModel.avatar;
|
|
userModel.nickName = self.personModel.nickname;
|
|
userModel.sex = [NSString stringWithFormat:@"%ld",self.personModel.sex];
|
|
userModel.age = [NSString stringWithFormat:@"%ld",self.personModel.age];
|
|
userModel.isGroup = NO;
|
|
[DDMTool pulsChat:userModel];
|
|
}];
|
|
}
|
|
return _chatBtn;
|
|
}
|
|
/*
|
|
#pragma mark - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
// Get the new view controller using [segue destinationViewController].
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
@end
|