Pārlūkot izejas kodu

修改地址和个人主页

hjx 1 gadu atpakaļ
vecāks
revīzija
a39dbdc311
27 mainītis faili ar 379 papildinājumiem un 152 dzēšanām
  1. 6 0
      TOKTOK/TOKTOK.xcodeproj/project.pbxproj
  2. 3 3
      TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewCell.h
  3. 18 47
      TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewCell.m
  4. 0 3
      TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewController.h
  5. 1 42
      TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewController.m
  6. 0 24
      TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListViewController.m
  7. 39 1
      TOKTOK/TOKTOK/Mine/Address/EditAddress/XSTTEditAddressViewController.m
  8. 3 1
      TOKTOK/TOKTOK/Mine/MineView/XSTTMineTableViewController.m
  9. 4 0
      TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageHeaderViewController.h
  10. 83 11
      TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageHeaderViewController.m
  11. 24 0
      TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageModel.h
  12. 12 0
      TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageModel.m
  13. 1 1
      TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageViewController.h
  14. 38 3
      TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageViewController.m
  15. 1 1
      TOKTOK/TOKTOK/Public/Category/View/UITableView+XSTTDefault.h
  16. 2 1
      TOKTOK/TOKTOK/Public/Category/View/UITableView+XSTTDefault.m
  17. 1 1
      TOKTOK/TOKTOK/Public/Category/View/UIView+XSTTDefault.m
  18. 5 0
      TOKTOK/TOKTOK/Public/Profile/XSTTURLApiProfile.h
  19. 5 0
      TOKTOK/TOKTOK/Public/Profile/XSTTURLApiProfile.m
  20. 3 1
      TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleCommentTableViewCell.h
  21. 27 8
      TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleCommentTableViewCell.m
  22. 26 0
      TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleCommentTableViewController.m
  23. 17 1
      TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleDetialsViewController.m
  24. 1 0
      TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewCell.h
  25. 14 0
      TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewCell.m
  26. 2 0
      TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewController.h
  27. 43 3
      TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewController.m

+ 6 - 0
TOKTOK/TOKTOK.xcodeproj/project.pbxproj

@@ -76,6 +76,7 @@
 		84685AED269C3FBF002AA521 /* XSTTBeerCentreFiltrateTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84685AEC269C3FBF002AA521 /* XSTTBeerCentreFiltrateTableViewController.m */; };
 		84685AEF269D723E002AA521 /* BeerCentre.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84685AEE269D723E002AA521 /* BeerCentre.xcassets */; };
 		8472450127152CE400CDA5DE /* XSTTBeerCentreFiltrateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8472450027152CE400CDA5DE /* XSTTBeerCentreFiltrateModel.m */; };
+		8479805E2A274A250099D03E /* XSTTPersonalPageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8479805D2A274A250099D03E /* XSTTPersonalPageModel.m */; };
 		847C877F2694387F00BEBD03 /* XSTTTabBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 847C877E2694387F00BEBD03 /* XSTTTabBarView.m */; };
 		847C8788269441C300BEBD03 /* XSTTHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 847C8787269441C300BEBD03 /* XSTTHomeViewController.m */; };
 		847C878B269441DE00BEBD03 /* XSTTMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 847C878A269441DE00BEBD03 /* XSTTMineViewController.m */; };
@@ -314,6 +315,8 @@
 		84685AEE269D723E002AA521 /* BeerCentre.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = BeerCentre.xcassets; sourceTree = "<group>"; };
 		847244FF27152CE400CDA5DE /* XSTTBeerCentreFiltrateModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSTTBeerCentreFiltrateModel.h; sourceTree = "<group>"; };
 		8472450027152CE400CDA5DE /* XSTTBeerCentreFiltrateModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XSTTBeerCentreFiltrateModel.m; sourceTree = "<group>"; };
+		8479805C2A274A250099D03E /* XSTTPersonalPageModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSTTPersonalPageModel.h; sourceTree = "<group>"; };
+		8479805D2A274A250099D03E /* XSTTPersonalPageModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XSTTPersonalPageModel.m; sourceTree = "<group>"; };
 		847C877D2694387F00BEBD03 /* XSTTTabBarView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSTTTabBarView.h; sourceTree = "<group>"; };
 		847C877E2694387F00BEBD03 /* XSTTTabBarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XSTTTabBarView.m; sourceTree = "<group>"; };
 		847C8786269441C300BEBD03 /* XSTTHomeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSTTHomeViewController.h; sourceTree = "<group>"; };
@@ -637,6 +640,8 @@
 			children = (
 				84287A9E29E92E110037FD51 /* XSTTPersonalPageViewController.h */,
 				84287A9F29E92E110037FD51 /* XSTTPersonalPageViewController.m */,
+				8479805C2A274A250099D03E /* XSTTPersonalPageModel.h */,
+				8479805D2A274A250099D03E /* XSTTPersonalPageModel.m */,
 				84287AA129E92EBF0037FD51 /* XSTTPersonalPageHeaderViewController.h */,
 				84287AA229E92EBF0037FD51 /* XSTTPersonalPageHeaderViewController.m */,
 			);
@@ -1566,6 +1571,7 @@
 				84D748EF268422D400AD7C92 /* YYKeychain.m in Sources */,
 				84685AE7269C2A31002AA521 /* XSTTCornerImageTransformer.m in Sources */,
 				849C70C528C9956300BE760C /* XSTTConfirmAlertViewController.m in Sources */,
+				8479805E2A274A250099D03E /* XSTTPersonalPageModel.m in Sources */,
 				84D748D326833EBE00AD7C92 /* UITableViewCell+XSTTInitialization.m in Sources */,
 				849C70D128C9CB0100BE760C /* XSTTPublishSocialCircleChooseTagTableViewController.m in Sources */,
 				84D748CD26833D3400AD7C92 /* UIView+XSTTLoadingTipsView.m in Sources */,

+ 3 - 3
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewCell.h

@@ -11,15 +11,15 @@
 NS_ASSUME_NONNULL_BEGIN
 
 typedef NS_ENUM(NSUInteger, XSTTAddressListTableViewCellActionType) {
-    XSTTAddressListTableViewCellActionTypeEdit,
-    XSTTAddressListTableViewCellActionTypeDelete
+    XSTTAddressListTableViewCellActionTypeEdit
+    
 };
 
 @interface XSTTAddressListTableViewCell : UITableViewCell
 
 @property (nonatomic, strong) void (^xstt_cellAction)(XSTTAddressListTableViewCellActionType type, XSTTAddressListTableViewCell *cell);
 
-- (void)reloadData:(XSTTAddressModel *)data status:(bool)del;
+- (void)reloadData:(XSTTAddressModel *)data;
 
 @end
 

+ 18 - 47
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewCell.m

@@ -12,9 +12,8 @@
     UILabel *_icon;
     UILabel *_name;
     UILabel *_phone;
+    UILabel *_default;
     UILabel *_address;
-    UIButton *_deleteButton;
-    UIView *_placeView;
 }
 
 @end
@@ -68,7 +67,17 @@
     [_phone makeConstraints:^(JXHConstraintMaker *make) {
         make.top.equalTo(14);
         make.leading.equalTo(self->_name.trailing).offset(16);
-        make.trailing.lessThanOrEqualTo(-52);
+        make.trailing.lessThanOrEqualTo(-48);
+    }];
+    
+    _default = [UILabel convenienceWithFont:xstt_mediumFont(10) text:@"默认" textColor:xstt_FF5700_color() textAlignment:NSTextAlignmentCenter];
+    [_default setLayerBorderWidth:1 borderColor:xstt_FF5700_color()];
+    [_default setLayerCornerRadius:2 clipToBounds:false];
+    [bgView addSubview:_default];
+    [_default makeConstraints:^(JXHConstraintMaker *make) {
+        make.centerY.equalTo(self->_phone);
+        make.leading.equalTo(self->_phone.trailing).offset(8);
+        make.size.equalTo((CGSize){28, 14});
     }];
     
     _address = [UILabel convenienceWithFont:xstt_font(13) textColor:xstt_000000_color(0.4) limitWidth:jxh_screenWidth() - 12 * 2 - 48 - 52];
@@ -80,50 +89,24 @@
         make.trailing.equalTo(-52);
     }];
     
-    UIStackView *rightView = [UIStackView convenienceWithAxis:UILayoutConstraintAxisVertical alignment:UIStackViewAlignmentTrailing distribution:UIStackViewDistributionEqualSpacing spacing:0];
-    [bgView addSubview:rightView];
-    [rightView makeConstraints:^(JXHConstraintMaker *make) {
-        make.centerY.equalTo(0);
-        make.trailing.equalTo(0);
-        make.width.equalTo(50);
-    }];
-    
-    _deleteButton = [UIButton convenienceWithFont:xstt_font(13) target:self action:@selector(deleteAction:)];
-    _deleteButton.hidden = true;
-    [_deleteButton setTitle:@"删除" titleColor:xstt_000000_color(0.6) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
-    [rightView addArrangedSubview:_deleteButton];
-    [_deleteButton makeConstraints:^(JXHConstraintMaker *make) {
-        make.width.equalTo(50);
-        make.height.equalTo(22);
-    }];
-    
-    _placeView = UIView.new;
-    [rightView addArrangedSubview:_placeView];
-    [_placeView makeConstraints:^(JXHConstraintMaker *make) {
-        make.width.equalTo(50);
-        make.height.equalTo(12);
-    }];
-    
     UIButton *editButton = [UIButton convenienceWithTarget:self action:@selector(editAction:)];
     [editButton setImage:jxh_getImage(address_list_edit) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
-    [rightView addArrangedSubview:editButton];
+    [bgView addSubview:editButton];
     [editButton makeConstraints:^(JXHConstraintMaker *make) {
-        make.width.equalTo(48);
-        make.height.equalTo(24);
+        make.bottom.equalTo(-28);
+        make.trailing.equalTo(0);
+        make.size.equalTo((CGSize){48, 24});
     }];
     
     return self;
 }
 
-- (void)deleteAction:(UIButton *)sender {
-    _xstt_cellAction(XSTTAddressListTableViewCellActionTypeDelete, self);
-}
-
 - (void)editAction:(UIButton *)sender {
     _xstt_cellAction(XSTTAddressListTableViewCellActionTypeEdit, self);
 }
 
-- (void)reloadData:(XSTTAddressModel *)data status:(bool)del {
+- (void)reloadData:(XSTTAddressModel *)data {
+    _default.hidden = !data.xstt_defaultAddress.boolValue;
     _name.text = data.xstt_name;
     if (data.xstt_name.length > 0) {
         _icon.text = [data.xstt_name substringWithRange:NSMakeRange(0, 1)];
@@ -132,18 +115,6 @@
     }
     _phone.text = data.xstta_showPhone;
     [_address setAttributedStringWithText:data.xstt_fullAddress lineSpacing:2.5];
-    
-    if (del) {
-        _deleteButton.hidden = false;
-        [_placeView makeConstraints:^(JXHConstraintMaker *make) {
-            make.height.update(12);
-        }];
-    } else {
-        _deleteButton.hidden = true;
-        [_placeView makeConstraints:^(JXHConstraintMaker *make) {
-            make.height.update(18);
-        }];
-    }
 }
 
 @end

+ 0 - 3
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewController.h

@@ -11,9 +11,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface XSTTAddressListTableViewController : XSTTTableViewController
 
-@property (nonatomic, strong) void (^xstt_dataChange)(NSInteger dataCount);
-
-- (void)changeStatus:(bool)del;
 - (void)getList;
 
 @end

+ 1 - 42
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewController.m

@@ -14,7 +14,6 @@
 #import "XSTTAddressModel.h"
 
 @interface XSTTAddressListTableViewController () {
-    bool _delete;
     NSMutableArray<XSTTAddressModel *> *_dataArray;
 }
 
@@ -37,35 +36,9 @@
 
 - (void)initData {
     _dataArray = NSMutableArray.new;
-    _delete = false;
 }
 
 #pragma mark - Action
-- (void)changeStatus:(bool)del {
-    _delete = del;
-    [self.tableView reloadData];
-}
-
-- (void)deleteAction:(XSTTAddressListTableViewCell *)cell {
-    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
-    if (indexPath.row >= _dataArray.count) return;
-    XSTTConfirmAlertViewController *vc = [XSTTConfirmAlertViewController alertWithTitle:@"确定要删除该地址吗?" content:nil];
-    @weakify(self)
-    [vc setConfirmButtonTitle:@"确认" titleColor:nil action:^{
-        @strongify(self)
-        [self deleteAddressWithId:self->_dataArray[indexPath.row].xstt_userAddressId];
-        [self->_dataArray removeObjectAtIndex:indexPath.row];
-        [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationBottom];
-        if (self->_dataArray.count == 0) {
-            self.tableView.backgroundColor = xstt_FFFFFF_color(1.f);
-            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(address_list_default) tips:@"你还未添加收货地址" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
-        }
-    }];
-    [vc setCancelButtonTitle:@"取消" titleColor:nil action:^{
-        
-    }];
-    [self presentViewController:vc animated:false completion:nil];
-}
 
 - (void)editAction:(XSTTAddressListTableViewCell *)cell {
     NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
@@ -101,7 +74,6 @@
         self.tableView.backgroundColor = xstt_F7F7F7_color();
         [self.tableView removeDefaultFootView];
     }
-    _xstt_dataChange(_dataArray.count);
 }
 
 - (void)getListFailure:(NSError *)error {
@@ -115,16 +87,6 @@
     }
 }
 
-- (void)deleteAddressWithId:(NSString *)addressId {
-    [self networkUseMethod:XSTTNetworkMethodPOST loadingTips:nil isLogin:true signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(XSTTURLDeleteAddress) urlParameters:nil parameters:^NSDictionary * _Nonnull{
-        return @{@"userAddressId": addressId};
-    } success:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
-        return nil;
-    } failure:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
-        return nil;
-    }];
-}
-
 #pragma mark - Delegate & DataSource
 
 static NSString * const reuseIdentifier = @"XSTTAddressListTableViewCell";
@@ -137,9 +99,6 @@ static NSString * const reuseIdentifier = @"XSTTAddressListTableViewCell";
         cell.xstt_cellAction = ^(XSTTAddressListTableViewCellActionType type, XSTTAddressListTableViewCell * _Nonnull cell) {
             @strongify(self)
             switch (type) {
-                case XSTTAddressListTableViewCellActionTypeDelete:
-                    [self deleteAction:cell];
-                    break;
                 case XSTTAddressListTableViewCellActionTypeEdit:
                     [self editAction:cell];
                     break;
@@ -149,7 +108,7 @@ static NSString * const reuseIdentifier = @"XSTTAddressListTableViewCell";
             }
         };
     }
-    [cell reloadData:_dataArray[indexPath.row] status:_delete];
+    [cell reloadData:_dataArray[indexPath.row]];
     return cell;
 }
 

+ 0 - 24
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListViewController.m

@@ -12,7 +12,6 @@
 
 @interface XSTTAddressListViewController () {
     XSTTAddressListTableViewController *_tableVC;
-    UIButton *_manageButton;
 }
 
 @end
@@ -25,16 +24,6 @@
 }
 
 #pragma mark - Action
-- (void)manageAction:(UIButton *)sender {
-    sender.selected = !sender.selected;
-    [_tableVC changeStatus:sender.selected];
-}
-
-- (void)tableViewDataChange:(NSInteger)dataCount {
-    _manageButton.hidden = dataCount == 0;
-    _manageButton.selected = false;
-    [_tableVC changeStatus:_manageButton.selected];
-}
 
 - (void)newAction {
     XSTTEditAddressViewController *vc = XSTTEditAddressViewController.new;
@@ -50,18 +39,12 @@
 #pragma mark - UI
 - (void)setupUI {
     self.title = @"收货地址";
-    [self setupNavigationBar];
     [self createBottomView];
     [self createTableVC];
 }
 
 - (void)createTableVC {
     _tableVC = XSTTAddressListTableViewController.new;
-    @weakify(self)
-    _tableVC.xstt_dataChange = ^(NSInteger dataCount) {
-        @strongify(self)
-        [self tableViewDataChange:dataCount];
-    };
     [self addChildViewController:_tableVC];
     [self.view addSubview:_tableVC.tableView];
     [_tableVC.tableView makeConstraints:^(JXHConstraintMaker *make) {
@@ -92,11 +75,4 @@
     }];
 }
 
-- (void)setupNavigationBar {
-    _manageButton = [UIButton convenienceWithFont:xstt_font(17) target:self action:@selector(manageAction:)];
-    [_manageButton setTitle:@"管理" titleColor:xstt_000000_color(0.87) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
-    [_manageButton setTitle:@"完成" titleColor:xstt_000000_color(0.87) state:JXHButtonControlStateSelected | JXHButtonControlStateSelectedAndHighlighted];
-    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_manageButton];
-}
-
 @end

+ 39 - 1
TOKTOK/TOKTOK/Mine/Address/EditAddress/XSTTEditAddressViewController.m

@@ -17,6 +17,7 @@
 #import "XSTTAddressModel.h"
 #import "UIView+XSTTLoadingTipsView.h"
 #import "UIViewController+XSTTNetworkManager.h"
+#import "XSTTConfirmAlertViewController.h"
 
 @interface XSTTEditAddressViewController ()<UITextViewDelegate, UITextFieldDelegate, UIScrollViewDelegate, XSTTPickerViewDelegate> {
     UIScrollView *_bgView;
@@ -69,6 +70,20 @@
 }
 
 #pragma mark - Action
+- (void)deleteAction {
+    if (_xstt_addressId == nil) return;
+    XSTTConfirmAlertViewController *vc = [XSTTConfirmAlertViewController alertWithTitle:@"确定要删除该地址吗?" content:nil];
+    @weakify(self)
+    [vc setConfirmButtonTitle:@"确认" titleColor:nil action:^{
+        @strongify(self)
+        [self deleteAddressWithId:_xstt_addressId];
+    }];
+    [vc setCancelButtonTitle:@"取消" titleColor:nil action:^{
+        
+    }];
+    [self presentViewController:vc animated:false completion:nil];
+}
+
 - (void)saveAction {
     if (_name.text.length < XSTTNameMinWords) {
         [self.view showToastWithTitle:@"请正确输入收货人"];
@@ -223,6 +238,18 @@
 }
 
 #pragma mark - Network Action
+- (void)deleteAddressWithId:(NSString *)addressId {
+    [self networkUseMethod:XSTTNetworkMethodPOST loadingTips:@"正在删除" isLogin:true signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(XSTTURLDeleteAddress) urlParameters:nil parameters:^NSDictionary * _Nonnull{
+        return @{@"userAddressId": addressId};
+    } success:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        self->_xstt_finishEdit();
+        [self.navigationController popViewControllerAnimated:true];
+        return @"删除成功";
+    } failure:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        return @"删除失败";
+    }];
+}
+
 - (void)getData {
     [self networkUseMethod:XSTTNetworkMethodGET loadingTips:XSTTGetDataLoadingCommonTips isLogin:true signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(XSTTURLGetAddressDetails) urlParameters:nil parameters:^NSDictionary * _Nonnull{
         return @{@"userAddressId": self->_xstt_addressId};
@@ -403,12 +430,23 @@
 
 #pragma mark - UI
 - (void)setupUI {
-    self.title = _xstt_addressId == nil ? @"添加收货地址" : @"编辑收货地址";
+    if (_xstt_addressId == nil) {
+        self.title = @"添加收货地址";
+    } else {
+        self.title = @"编辑收货地址";
+        [self setupNavigationBar];
+    }
     [self createBgView];
     [self createContentView];
     [self createBottomButton];
 }
 
+- (void)setupNavigationBar {
+    UIButton *deleteButton = [UIButton convenienceWithFont:xstt_font(17) target:self action:@selector(deleteAction)];
+    [deleteButton setTitle:@"删除" titleColor:xstt_000000_color(0.87) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
+    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:deleteButton];
+}
+
 - (void)createBgView {
     _bgView = [UIScrollView convenienceWithBackgroundColor:xstt_F7F7F7_color()];
     _bgView.delegate = self;

+ 3 - 1
TOKTOK/TOKTOK/Mine/MineView/XSTTMineTableViewController.m

@@ -17,6 +17,8 @@
 #import "XSTTPersonalPageViewController.h"
 #import "XSTTAddressListViewController.h"
 #import "XSTTOrderListViewController.h"
+#import "XSTTBusinessManager.h"
+#import "XSTTPersonalInformationModel.h"
 
 typedef NS_ENUM(NSUInteger, XSTTMineTableViewItemType) {
     XSTTMineTableViewItemTypeMessage,
@@ -149,7 +151,7 @@ static NSString * const reuseIdentifier = @"XSTTMineTableViewCell";
         case XSTTMineTableViewItemTypePublished: {
             xstt_needLogin(^{
                 XSTTPersonalPageViewController *vc = XSTTPersonalPageViewController.new;
-                vc.xstt_isMine = true;
+                vc.xstt_userId = xstt_personalInformation().xstt_userId;
                 [self.navigationController pushViewController:vc animated:true];
             });
         }

+ 4 - 0
TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageHeaderViewController.h

@@ -6,11 +6,15 @@
 //
 
 #import "JXHFixHeaderViewHeaderController.h"
+@class XSTTPersonalPageModel;
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface XSTTPersonalPageHeaderViewController : JXHFixHeaderViewHeaderController
 
+@property (nonatomic, strong) XSTTPersonalPageModel *xstt_data;
+@property (nonatomic, strong) NSString *xstt_userId;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 83 - 11
TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageHeaderViewController.m

@@ -8,9 +8,18 @@
 #import "XSTTPersonalPageHeaderViewController.h"
 #import "XSTTUIGeneralHeader.h"
 #import <JXHCornerView.h>
+#import "XSTTPersonalPageModel.h"
+#import <UIImageView+WebCache.h>
+#import <JXHGeneralTools.h>
+#import "XSTTBusinessManager.h"
+#import "XSTTNotificationDelegateManager.h"
+#import "UIViewController+XSTTNetworkManager.h"
+#import "XSTTBusinessManager.h"
 
-@interface XSTTPersonalPageHeaderViewController () {
+@interface XSTTPersonalPageHeaderViewController ()<XSTTNotificationDelegate> {
     UIImageView *_backgroundImageView;
+    UIButton *_rightButton;
+    bool _isMine;
 }
 
 @end
@@ -18,12 +27,54 @@
 @implementation XSTTPersonalPageHeaderViewController
 
 - (void)viewDidLoad {
+    _isMine = xstt_userId().userIDValue == _xstt_userId.userIDValue;
     [super viewDidLoad];
-    // Do any additional setup after loading the view.
+    xstt_setNotificationKey(XSTTLoggingNotificationKey);
+}
+
+- (void)dealloc {
+    xstt_removeNotificationKey(XSTTLoggingNotificationKey);
+}
+
+#pragma mark - XSTTLoggingNotificationKey
+- (void)xstt_loggingStatusChanged:(XSTTLoggingStatus)status {
+    _isMine = xstt_userId().userIDValue == _xstt_userId.userIDValue;
+    if (_rightButton) {
+        [self setRightButton];
+        [_rightButton makeConstraints:^(JXHConstraintMaker *make) {
+            make.size.update((CGSize){self->_isMine ? 84 : 76, 36});
+        }];
+    }
 }
 
 #pragma mark - Action
+- (void)rightButtonAction:(UIButton *)sender {
+    if (_isMine) {
+        xstt_needLogin(^{
+            xstt_publishSocialCircleAction(self, nil);
+        });
+        return;
+    }
+    xstt_needLogin(^{
+        [self followAction];
+    });
+}
+
 #pragma mark - Network Action
+- (void)followAction {
+    bool isFollow = _xstt_data.xstt_focus.boolValue;
+    [self networkUseMethod:XSTTNetworkMethodPOST loadingTips:isFollow ? @"正在取消关注" : @"正在关注" isLogin:true signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(isFollow ? XSTTURLUnfollow : XSTTURLFollow) urlParameters:nil parameters:^NSDictionary * _Nonnull{
+        if (isFollow) return @{@"unfocusUserId": self->_xstt_userId};
+        return @{@"focusUserId": self->_xstt_userId};
+    } success:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        self->_xstt_data.xstt_focus = [NSString stringWithFormat:@"%d", !isFollow];
+        self->_rightButton.selected = !isFollow;
+        return @"";
+    } failure:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        return isFollow ? @"取消关注失败" : @"关注失败";
+    }];
+}
+
 #pragma mark - Overwrite
 - (void)setUI {
     [super setUI];
@@ -50,6 +101,16 @@
     }
 }
 
+- (void)setRightButton {
+    if (_isMine) {
+        [_rightButton setTitle:@"发布动态" titleColor:xstt_FFFFFF_color(1.f) image:nil backgroundImage:jxh_createImage(xstt_FF5700_color(), (CGSize){10, 10}) state:JXHButtonControlStateNormal];
+    } else {
+        [_rightButton setTitle:@"关注" titleColor:xstt_FFFFFF_color(1.f) image:nil backgroundImage:jxh_createImage(xstt_FF5700_color(), (CGSize){10, 10}) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
+        [_rightButton setTitle:@"已关注" titleColor:xstt_000000_color(0.4) image:nil backgroundImage:jxh_createImage(xstt_F5F6F9_color(), (CGSize){10, 10}) state:JXHButtonControlStateSelected | JXHButtonControlStateSelectedAndHighlighted];
+        _rightButton.selected = _xstt_data.xstt_focus.boolValue;
+    }
+}
+
 - (void)createContentView {
     JXHCornerView *contentView = JXHCornerView.new;
     [contentView setCornerWithRadius:12 position:JXHCornerPositionMake(true, true, false, false) backgroundColor:xstt_FFFFFF_color(1.f)];
@@ -71,15 +132,26 @@
     }];
     
     UIImageView *avatar = UIImageView.new;
-    avatar.image = jxh_getImage(默认头像);
+    [avatar sd_setImageWithURL:[NSURL URLWithString:_xstt_data.xstt_headImg]];
     [avatarBG addSubview:avatar];
-    [avatar setLayerCornerRadius:40 clipToBounds:false];
+    [avatar setLayerCornerRadius:40 clipToBounds:true];
     [avatar makeConstraints:^(JXHConstraintMaker *make) {
         make.center.equalTo(0);
         make.size.equalTo(80);
     }];
     
-    UILabel *name = [UILabel convenienceWithFont:xstt_mediumFont(19) text:@"和酒做朋友" textColor:xstt_000000_color(0.87)];
+    _rightButton = [UIButton convenienceWithFont:xstt_semiboldFont(14) target:self action:@selector(rightButtonAction:)];
+    [self setRightButton];
+    [_rightButton setLayerCornerRadius:18 clipToBounds:true];
+    [contentView addSubview:_rightButton];
+    [_rightButton makeConstraints:^(JXHConstraintMaker *make) {
+        make.trailing.equalTo(-16);
+        make.top.equalTo(16);
+        make.size.equalTo((CGSize){self->_isMine ? 84 : 76, 36});
+    }];
+    
+    
+    UILabel *name = [UILabel convenienceWithFont:xstt_mediumFont(19) text:_xstt_data.xstt_nickName textColor:xstt_000000_color(0.87)];
     [contentView addSubview:name];
     [name makeConstraints:^(JXHConstraintMaker *make) {
         make.leading.equalTo(XSTTMargin);
@@ -87,10 +159,10 @@
         make.trailing.lessThanOrEqualTo(-XSTTMargin);
     }];
     
-    NSArray *data = @[@"粉丝", @"关注", @"转评赞"];
+    NSArray *data = @[@"粉丝", @"关注", @"转评赞", _xstt_data.xstt_fansNum, _xstt_data.xstt_focusNum, _xstt_data.xstt_commAndLike];
     UIView *tempView = nil;
-    for (NSInteger i = 0; i < data.count; i ++) {
-        UILabel *num = [UILabel convenienceWithFont:xstt_mediumFont(15) text:@"8080" textColor:xstt_000000_color(0.8)];
+    for (NSInteger i = 0; i < data.count / 2; i ++) {
+        UILabel *num = [UILabel convenienceWithFont:xstt_mediumFont(15) text:data[i + 3] textColor:xstt_000000_color(0.8)];
         [contentView addSubview:num];
         [num makeConstraints:^(JXHConstraintMaker *make) {
             if (tempView) {
@@ -105,11 +177,11 @@
         [contentView addSubview:title];
         [title makeConstraints:^(JXHConstraintMaker *make) {
             make.leading.equalTo(num.trailing).offset(4);
-            make.bottom.equalTo(-22);
+            make.centerY.equalTo(num);
         }];
         
         tempView = title;
-        if (i < data.count - 1) {
+        if (i < data.count / 2 - 1) {
             UIView *line = UIView.new;
             line.backgroundColor = xstt_000000_color(0.12);
             [contentView addSubview:line];
@@ -128,7 +200,7 @@
     _backgroundImageView = UIImageView.new;
     _backgroundImageView.backgroundColor = xstt_F7F7F7_color();
     _backgroundImageView.contentMode = UIViewContentModeScaleAspectFill;
-    _backgroundImageView.image = jxh_getImage(默认头像);
+    [_backgroundImageView sd_setImageWithURL:[NSURL URLWithString:_xstt_data.xstt_bg]];
 //    _backgroundImageView.clipsToBounds = true;
     [self.jxh_contentView addSubview:_backgroundImageView];
     [_backgroundImageView makeConstraints:^(JXHConstraintMaker *make) {

+ 24 - 0
TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageModel.h

@@ -0,0 +1,24 @@
+//
+//  XSTTPersonalPageModel.h
+//  TOKTOK
+//
+//  Created by shanp on 2023/5/31.
+//
+
+#import "XSTTBaseNetworkModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface XSTTPersonalPageModel : XSTTBaseNetworkModel
+
+@property (nonatomic, strong) NSString *xstt_bg;
+@property (nonatomic, strong) NSString *xstt_headImg;
+@property (nonatomic, strong) NSString *xstt_nickName;
+@property (nonatomic, strong) NSString *xstt_focus;
+@property (nonatomic, strong) NSString *xstt_fansNum;
+@property (nonatomic, strong) NSString *xstt_focusNum;
+@property (nonatomic, strong) NSString *xstt_commAndLike;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 12 - 0
TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageModel.m

@@ -0,0 +1,12 @@
+//
+//  XSTTPersonalPageModel.m
+//  TOKTOK
+//
+//  Created by shanp on 2023/5/31.
+//
+
+#import "XSTTPersonalPageModel.h"
+
+@implementation XSTTPersonalPageModel
+
+@end

+ 1 - 1
TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageViewController.h

@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface XSTTPersonalPageViewController : UIViewController
 
-@property (nonatomic, assign) bool xstt_isMine;
+@property (nonatomic, strong) NSString *xstt_userId;
 
 @end
 

+ 38 - 3
TOKTOK/TOKTOK/Mine/PersonalPage/XSTTPersonalPageViewController.m

@@ -13,10 +13,17 @@
 #import "UIViewController+XSTTNavigationBar.h"
 #import "UIViewController+XSTTInitialization.h"
 #import <JXHClassifyView.h>
+#import "UIViewController+XSTTNetworkManager.h"
+#import "XSTTBusinessManager.h"
+#import "XSTTPersonalPageModel.h"
+#import "XSTTPersonalInformationModel.h"
 
 @interface XSTTPersonalPageViewController () {
     JXHFixHeaderViewController *_contentVC;
     XSTTPersonalPageHeaderViewController *_headerVC;
+    XSTTPersonalPageModel *_data;
+    
+    bool _isMine;
 }
 
 @end
@@ -25,7 +32,10 @@
 
 - (void)viewDidLoad {
     [super viewDidLoad];
-    [self setupUI];
+    _isMine = _xstt_userId.userIDValue == xstt_userId().userIDValue;
+    self.xstt_isHiddenNavigationBar = true;
+    [self createNavigationBar];
+    [self getData];
 }
 
 - (UIStatusBarStyle)preferredStatusBarStyle {
@@ -41,12 +51,34 @@
     self.xstt_isLightContent = contentOffset <= 0;
 }
 #pragma mark - Network Action
+- (void)getData {
+    [self networkUseMethod:XSTTNetworkMethodGET loadingTips:XSTTGetDataLoadingCommonTips isLogin:xstt_isLogin() signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(XSTTURLGetPersonalPage) urlParameters:nil parameters:^NSDictionary * _Nonnull{
+        return @{@"beVisitedUserId": self->_xstt_userId};
+    } success:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        [self getDataSuccess:data];
+        return @"";
+    } failure:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        [self getDataFailure:error];
+        return XSTTGetDataFailureCommonTips;
+    }];
+}
+
+- (void)getDataSuccess:(id)data {
+    _data = [XSTTPersonalPageModel getModelWithDictionary:data[@"data"]];
+    [self setupUI];
+}
 
+- (void)getDataFailure:(NSError *)error {
+    @weakify(self)
+    [self setDefaultViewWithError:error image:nil tips:nil action:^{
+        @strongify(self)
+        [self getData];
+    }];
+}
 
 #pragma mark - UI
 - (void)setupUI {
-    self.xstt_isHiddenNavigationBar = true;
-    [self createNavigationBar];
+    
     [self createHeader];
     [self createContentView];
     [self createClassifyView];
@@ -56,6 +88,8 @@
 
 - (void)createHeader {
     _headerVC = XSTTPersonalPageHeaderViewController.new;
+    _headerVC.xstt_data = _data;
+    _headerVC.xstt_userId = _xstt_userId;
 }
 
 - (void)createContentView {
@@ -78,6 +112,7 @@
     
     XSTTSocialCircleTableViewController *tableVC = XSTTSocialCircleTableViewController.new;
     tableVC.xstt_isPersonalPage = true;
+    tableVC.xstt_userId = _xstt_userId;
     tableVC.tableView.clipsToBounds = false;
     [_contentVC setListViews:@[tableVC]];
     [_contentVC.jxh_bgScrollView.panGestureRecognizer requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer];

+ 1 - 1
TOKTOK/TOKTOK/Public/Category/View/UITableView+XSTTDefault.h

@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface UITableView (XSTTDefault)
 
-- (void)setDefaultFootViewWithError:(nullable NSError *)error image:(nullable UIImage *)image tips:(nullable NSString *)tips height:(CGFloat)height action:(void(^_Nullable)(void))action;
+- (UIView *)setDefaultFootViewWithError:(nullable NSError *)error image:(nullable UIImage *)image tips:(nullable NSString *)tips height:(CGFloat)height action:(void(^_Nullable)(void))action;
 
 - (void)removeDefaultFootView;
 

+ 2 - 1
TOKTOK/TOKTOK/Public/Category/View/UITableView+XSTTDefault.m

@@ -14,7 +14,7 @@
 
 @implementation UITableView (XSTTDefault)
 
-- (void)setDefaultFootViewWithError:(nullable NSError *)error image:(nullable UIImage *)image tips:(nullable NSString *)tips height:(CGFloat)height action:(void(^_Nullable)(void))action {
+- (UIView *)setDefaultFootViewWithError:(nullable NSError *)error image:(nullable UIImage *)image tips:(nullable NSString *)tips height:(CGFloat)height action:(void(^_Nullable)(void))action {
     XSTTNetworkDataDefault type;
     if (error) {
         if (error.code == XSTTNetworkErrorCodeNetwrokMiss) {
@@ -41,6 +41,7 @@
     
     
     self.tableFooterView = footView;
+    return defaultView;
 }
 
 - (void)removeDefaultFootView {

+ 1 - 1
TOKTOK/TOKTOK/Public/Category/View/UIView+XSTTDefault.m

@@ -46,7 +46,7 @@
     [tipsLabel setAttributedStringWithText:tips textAlignment:NSTextAlignmentCenter lineSpacing:8 lineHeight:0 paragraphSpacing:0 lineBreakMode:0 lines:lines];
     [defaultView addSubview:tipsLabel];
     [tipsLabel makeConstraints:^(JXHConstraintMaker *make) {
-        make.top.equalTo(icon.bottom).offset(24);
+        make.top.equalTo(icon.bottom).offset(16);
         make.centerX.equalTo(defaultView).priorityRequired();
         make.leading.greaterThanOrEqualTo(0);
         make.trailing.lessThanOrEqualTo(0);

+ 5 - 0
TOKTOK/TOKTOK/Public/Profile/XSTTURLApiProfile.h

@@ -82,6 +82,11 @@ CONST_STRING_INTERFACE XSTTURLGetAddressList;//地址列表
 CONST_STRING_INTERFACE XSTTURLDeleteAddress;//删除地址
 CONST_STRING_INTERFACE XSTTURLUpdateAddress;//更新地址
 
+#pragma mark - 用户主页相关
+CONST_STRING_INTERFACE XSTTURLGetPersonalPage;//用户主页
+CONST_STRING_INTERFACE XSTTURLFollow;//关注
+CONST_STRING_INTERFACE XSTTURLUnfollow;//取消关注
+
 #pragma mark - 气泡相关
 CONST_STRING_INTERFACE XSTTURLGetCircleContentList;//获取气泡列表
 CONST_STRING_INTERFACE XSTTURLGetMineCircleContentList;//获取我发表气泡列表

+ 5 - 0
TOKTOK/TOKTOK/Public/Profile/XSTTURLApiProfile.m

@@ -118,6 +118,11 @@ CONST_STRING XSTTURLGetAddressList = @"/user/address/list";//地址列表
 CONST_STRING XSTTURLDeleteAddress = @"/user/address/remove";//删除地址
 CONST_STRING XSTTURLUpdateAddress = @"/user/address/update";//更新地址
 
+#pragma mark - 用户主页相关
+CONST_STRING XSTTURLGetPersonalPage = @"/user/home/info";//用户主页
+CONST_STRING XSTTURLFollow = @"/user/home/focus";//关注
+CONST_STRING XSTTURLUnfollow = @"/user/home/unfocus";//取消关注
+
 #pragma mark - 气泡相关
 CONST_STRING XSTTURLGetCircleContentList = @"/cont/content/list";//获取气泡列表
 CONST_STRING XSTTURLGetMineCircleContentList = @"/cont/content/mine";//获取我发表气泡列表

+ 3 - 1
TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleCommentTableViewCell.h

@@ -10,7 +10,9 @@
 
 typedef NS_ENUM(NSUInteger, XSTTSocialCircleCommentTableViewCellActionType) {
     XSTTSocialCircleCommentTableViewCellActionTypeLike,
-    XSTTSocialCircleCommentTableViewCellActionTypeLongPress
+    XSTTSocialCircleCommentTableViewCellActionTypeLongPress,
+    XSTTSocialCircleCommentTableViewCellActionTypeAvatarAndName,
+    XSTTSocialCircleCommentTableViewCellActionTypeAtUser
 };
 
 NS_ASSUME_NONNULL_BEGIN

+ 27 - 8
TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleCommentTableViewCell.m

@@ -7,7 +7,7 @@
 
 #import "XSTTSocialCircleCommentTableViewCell.h"
 #import "XSTTUIGeneralHeader.h"
-#import <JXHCoreText.h>
+#import <JXHClickTextView.h>
 #import "XSTTSocialCircleDetailsCommentListModel.h"
 #import <UIImageView+WebCache.h>
 #import "XSTTURLApiProfile.h"
@@ -17,8 +17,7 @@
 @interface XSTTSocialCircleCommentTableViewCell () {
     UIImageView *_avatar;
     UILabel *_name;
-    JXHCoreTextLabel *_content;
-    JXHCTFrameParserConfig *_config;
+    JXHClickTextView *_content;
     UILabel *_time;
     UILabel *_ip;
     UILabel *_likeCount;
@@ -43,6 +42,8 @@
         make.top.equalTo(16);
         make.size.equalTo(32);
     }];
+    _avatar.userInteractionEnabled = true;
+    [_avatar addGestureRecognizer: [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarAndNameAction)]];
     
     _likeIcon = [[UIImageView alloc] initWithImage:jxh_getImage(social_circle_like_n)];
     [self.contentView addSubview:_likeIcon];
@@ -77,8 +78,10 @@
         make.trailing.lessThanOrEqualTo(self->_likeCount.leading).offset(-20);
     }];
     
-    _config = [[JXHCTFrameParserConfig alloc] initWithMaxWidth:jxh_screenWidth() - 64 - 20 font:xstt_font(14) lineSpace:3 color:xstt_000000_color(0.87)];
-    _content = JXHCoreTextLabel.new;
+    _name.userInteractionEnabled = true;
+    [_name addGestureRecognizer: [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarAndNameAction)]];
+    
+    _content = [[JXHClickTextView alloc] initWithFont:xstt_font(14) titleColor:xstt_000000_color(0.87) tag:0 textAlignment:NSTextAlignmentLeft lineSpacing:3 width:jxh_screenWidth() - 64 - 20 numberOfLines:0];
     _content.backgroundColor = UIColor.clearColor;
     [self.contentView addSubview:_content];
     [_content makeConstraints:^(JXHConstraintMaker *make) {
@@ -119,14 +122,20 @@
     _likeIcon.image = data.xstt_like.boolValue ? jxh_getImage(social_circle_like_s) : jxh_getImage(social_circle_like_n);
     _name.text = data.xstt_nickName;
     if (data.xstt_atUserId.userIDValue > 0) {
-        _content.jxh_coreTextData = [JXHCTFrameParser getAttributsDataWithArray:@[[JXHCoreTextModel getContent:[NSString stringWithFormat:@"@%@ ", data.xstt_atUserNickName] font:xstt_mediumFont(14) color:xstt_3A51A6_color()], [JXHCoreTextModel getContent:data.xstt_comment font:nil color:nil]] config:_config];
+        @weakify(self)
+        [_content setText:[NSString stringWithFormat:@"@%@ %@",data.xstt_atUserNickName, data.xstt_comment] newFonts:@[xstt_mediumFont(14)] clickRanges:@[[NSValue valueWithRange:NSMakeRange(0, data.xstt_atUserNickName.length + 1)]] color:xstt_3A51A6_color() highlightColor:xstt_3A51A6_color() clickCoverColor:nil clickBlock:^(NSString *clickText, JXHClickTextView *clickTextView, NSUInteger clickActionTag) {
+            @strongify(self)
+            [self clickAtUser];
+        }];
         
     } else {
-        _content.jxh_coreTextData = [JXHCTFrameParser getAttributsDataWithArray:@[[JXHCoreTextModel getContent:data.xstt_comment font:nil color:nil]] config:_config];
+        [_content setText:data.xstt_comment newFonts:@[] clickRanges:@[] color:nil highlightColor:nil clickCoverColor:nil clickBlock:^(NSString *clickText, JXHClickTextView *clickTextView, NSUInteger clickActionTag) {
+            
+        }];
     }
     [_content setNeedsDisplay];
     [_content makeConstraints:^(JXHConstraintMaker *make) {
-        make.height.update(self->_content.jxh_coreTextData.jxh_height);
+        make.height.update(self->_content.jxh_height);
     }];
     _time.text = data.xstt_createTime;
     if (data.xstt_ipAddress.length > 0) {
@@ -147,4 +156,14 @@
     _xstt_action(XSTTSocialCircleCommentTableViewCellActionTypeLike);
 }
 
+- (void)avatarAndNameAction {
+    if (!_xstt_action) return;
+    _xstt_action(XSTTSocialCircleCommentTableViewCellActionTypeAvatarAndName);
+}
+
+- (void)clickAtUser {
+    if (!_xstt_action) return;
+    _xstt_action(XSTTSocialCircleCommentTableViewCellActionTypeAtUser);
+}
+
 @end

+ 26 - 0
TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleCommentTableViewController.m

@@ -16,6 +16,7 @@
 #import "UITableViewController+XSTTLoadDataStatus.h"
 #import "XSTTNotificationDelegateManager.h"
 #import "XSTTActionSheetViewController.h"
+#import "XSTTPersonalPageViewController.h"
 
 @interface XSTTSocialCircleCommentTableViewController ()<XSTTNotificationDelegate> {
     NSMutableArray<XSTTSocialCircleDetailsCommentListModel *> *_data;
@@ -107,6 +108,25 @@
     
 }
 
+- (void)atUserAction:(XSTTSocialCircleCommentTableViewCell *)cell {
+    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
+    if (nil == indexPath || indexPath.row >= _data.count) return;
+    XSTTSocialCircleDetailsCommentListModel *model = _data[indexPath.row];
+    if (model.xstt_atUserId.userIDValue <= 0) return;
+    XSTTPersonalPageViewController *vc = XSTTPersonalPageViewController.new;
+    vc.xstt_userId = model.xstt_atUserId;
+    [self.navigationController pushViewController:vc animated:true];
+}
+
+- (void)avatarAndNameAction:(XSTTSocialCircleCommentTableViewCell *)cell {
+    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
+    if (nil == indexPath || indexPath.row >= _data.count) return;
+    XSTTSocialCircleDetailsCommentListModel *model = _data[indexPath.row];
+    XSTTPersonalPageViewController *vc = XSTTPersonalPageViewController.new;
+    vc.xstt_userId = model.xstt_userId;
+    [self.navigationController pushViewController:vc animated:true];
+}
+
 - (void)longPressAction:(XSTTSocialCircleCommentTableViewCell *)cell {
     NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
     if (nil == indexPath || indexPath.row >= _data.count) return;
@@ -235,6 +255,12 @@ static NSString * const reuseIdentifier = @"XSTTSocialCircleCommentTableViewCell
                 case XSTTSocialCircleCommentTableViewCellActionTypeLike:
                     [self likeAction:weak_cell];
                     break;
+                case XSTTSocialCircleCommentTableViewCellActionTypeAvatarAndName:
+                    [self avatarAndNameAction:weak_cell];
+                    break;
+                case XSTTSocialCircleCommentTableViewCellActionTypeAtUser:
+                    [self atUserAction:weak_cell];
+                    break;
                     
                 default:
                     break;

+ 17 - 1
TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleDetialsViewController.m

@@ -25,6 +25,7 @@
 #import "XSTTPreviewViewController.h"
 #import "XSTTHomePageModel.h"
 #import "XSTTSocialCircleMenuViewController.h"
+#import "XSTTPersonalPageViewController.h"
 
 @interface XSTTSocialCircleDetialsViewController ()<XSTTNotificationDelegate, XSTTBannerViewPorotocol> {
     UIImageView *_likeIcon;
@@ -117,6 +118,12 @@
 }
 
 #pragma mark - Action
+- (void)avatarAndNameAction {
+    XSTTPersonalPageViewController *vc = XSTTPersonalPageViewController.new;
+    vc.xstt_userId = _data.xstt_userId;
+    [self.navigationController pushViewController:vc animated:true];
+}
+
 - (void)likeAction {
     xstt_needLogin(^{
         xstt_likeAction(!self->_data.xstt_like.boolValue, self->_data.xstt_contentId, XSTTLikeTypeContent);
@@ -392,7 +399,7 @@
 - (void)setNavigationBar {
     UIImageView *avatar = UIImageView.new;
     [avatar sd_setImageWithURL:xstt_fileURL(_data.xstt_headImg)];
-    avatar.contentMode = UIViewContentModeScaleAspectFill;
+//    avatar.contentMode = UIViewContentModeScaleAspectFill;
     [avatar setLayerCornerRadius:14 clipToBounds:true];
     [self.xstt_navigationBar addSubview:avatar];
     [avatar makeConstraints:^(JXHConstraintMaker *make) {
@@ -409,6 +416,15 @@
         make.centerY.equalTo(avatar);
     }];
     
+    UIButton *avatarAndNameButton = [UIButton convenienceWithTarget:self action:@selector(avatarAndNameAction)];
+    [self.xstt_navigationBar addSubview:avatarAndNameButton];
+    [avatarAndNameButton makeConstraints:^(JXHConstraintMaker *make) {
+        make.leading.equalTo(avatar);
+        make.trailing.equalTo(name);
+        make.height.equalTo(jxh_navigationViewHeight());
+        make.centerY.equalTo(avatar);
+    }];
+    
     UIButton *shareButton = [UIButton convenienceWithTarget:self action:@selector(shareAction)];
     [shareButton setImage:jxh_getImage(social_circle_share) state:JXHButtonControlStateNormal];
     [self.xstt_navigationBar addSubview:shareButton];

+ 1 - 0
TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewCell.h

@@ -12,6 +12,7 @@ typedef NS_ENUM(NSUInteger, XSTTSocialCircleTableViewCellActionType) {
     XSTTSocialCircleTableViewCellActionTypeMore,
     XSTTSocialCircleTableViewCellActionTypeShare,
     XSTTSocialCircleTableViewCellActionTypeLike,
+    XSTTSocialCircleTableViewCellActionTypeAvatarAndName,
 };
 
 NS_ASSUME_NONNULL_BEGIN

+ 14 - 0
TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewCell.m

@@ -66,6 +66,15 @@
         make.centerY.equalTo(self->_avatar);
     }];
     
+    UIButton *avatarAndNameButton = [UIButton convenienceWithTarget:self action:@selector(avatarAndNameAction)];
+    [contentView addSubview:avatarAndNameButton];
+    [avatarAndNameButton makeConstraints:^(JXHConstraintMaker *make) {
+        make.leading.equalTo(self->_avatar);
+        make.trailing.equalTo(self->_name);
+        make.height.equalTo(self->_avatar);
+        make.centerY.equalTo(self->_avatar);
+    }];
+    
     UIButton *moreButton = [UIButton convenienceWithTarget:self action:@selector(moreAction)];
     [moreButton setImage:jxh_getImage(social_circle_more) state:JXHButtonControlStateNormal];
     [contentView addSubview:moreButton];
@@ -163,6 +172,11 @@
 }
 
 #pragma mark - Action
+- (void)avatarAndNameAction {
+    if (!_xstt_action) return;
+    _xstt_action(XSTTSocialCircleTableViewCellActionTypeAvatarAndName);
+}
+
 - (void)likeAction {
     if (!_xstt_action) return;
     _xstt_action(XSTTSocialCircleTableViewCellActionTypeLike);

+ 2 - 0
TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewController.h

@@ -19,6 +19,8 @@ CONST_STRING_INTERFACE XSTTSocialCircleViewTypeHot;
 @property (nonatomic, strong) NSString *xstt_type;
 @property (nonatomic, strong, nullable) NSString *xstt_productId;
 @property (nonatomic, assign) bool xstt_isPersonalPage;
+@property (nonatomic, strong, nullable) NSString *xstt_userId;//个人主页用
+
 
 @end
 

+ 43 - 3
TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewController.m

@@ -18,6 +18,7 @@
 #import "XSTTNotificationDelegateManager.h"
 #import "XSTTActionSheetViewController.h"
 #import "XSTTSocialCircleMenuViewController.h"
+#import "XSTTPersonalPageViewController.h"
 
 CONST_STRING XSTTSocialCircleViewTypeAll = @"All";
 CONST_STRING XSTTSocialCircleViewTypeValuation = @"Review";
@@ -129,6 +130,22 @@ CONST_STRING XSTTSocialCircleViewTypeHot = @"Hot";
 }
 
 #pragma mark - Action
+- (void)publishAction {
+    xstt_needLogin(^{
+        xstt_publishSocialCircleAction(self, nil);
+    });
+}
+
+- (void)avatarAndNameAction:(XSTTSocialCircleTableViewCell *)cell {
+    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
+    if (nil == indexPath || indexPath.row >= _data.count) return;
+    XSTTSocialCircleListModel *model = _data[indexPath.row];
+    if (_xstt_userId.userIDValue == model.xstt_userId.userIDValue) return;
+    XSTTPersonalPageViewController *vc = XSTTPersonalPageViewController.new;
+    vc.xstt_userId = model.xstt_userId;
+    [self.navigationController pushViewController:vc animated:true];
+}
+
 - (void)likeAction:(XSTTSocialCircleTableViewCell *)cell {
     NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
     if (nil == indexPath || indexPath.row >= _data.count) return;
@@ -164,9 +181,9 @@ CONST_STRING XSTTSocialCircleViewTypeHot = @"Hot";
         lastContentId = _lastContentId;
     }
     @weakify(self)
-    [self networkUseMethod:XSTTNetworkMethodGET loadingTips:nil isLogin:_xstt_isPersonalPage ? true : xstt_isLogin() signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(url) filtrationKey:lastContentId urlParameters:nil parameters:^NSDictionary * _Nonnull{
+    [self networkUseMethod:XSTTNetworkMethodGET loadingTips:nil isLogin:xstt_isLogin() signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(url) filtrationKey:lastContentId urlParameters:nil parameters:^NSDictionary * _Nonnull{
         if (self->_xstt_isPersonalPage) {
-            return @{@"lastContentId": lastContentId};
+            return @{@"lastContentId": lastContentId, @"beVisitedUserId": self->_xstt_userId};
         }
         NSMutableDictionary *dic = @{@"lastContentId": lastContentId, @"contListType": self->_xstt_type}.mutableCopy;
         if (self->_xstt_productId) {
@@ -192,7 +209,27 @@ CONST_STRING XSTTSocialCircleViewTypeHot = @"Hot";
     if (array.count == 0) {
         [self.tableView reloadData];
         if (_data.count == 0) {
-            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
+            if (_xstt_isPersonalPage) {
+                bool isMine = xstt_userId().userIDValue == _xstt_userId.userIDValue;
+                if (isMine) {
+                    UIView *view = [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"TA选择了躺平,还未发布任何动态" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom - 258 - XSTTPersoalHomepageClassifyViewHeight - 48 action:nil];
+                    UIButton *button = [UIButton convenienceWithTarget:self action:@selector(publishAction)];
+                    [button setTitle:@"去发布动态" titleColor:xstt_000000_color(0.87) state:JXHButtonControlStateNormal];
+                    [button setStatusType:XSTTButtonStatusTypeLineBorder  font:xstt_font(13) size:(CGSize){104, 32}];
+                    [view.superview addSubview:button];
+                    [button makeConstraints:^(JXHConstraintMaker *make) {
+                        make.centerX.equalTo(0);
+                        make.top.equalTo(view.bottom).offset(16);
+                        make.size.equalTo((CGSize){104, 32});
+                    }];
+                    
+                } else {
+                    [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"TA选择了躺平,还未发布任何动态" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom - 258 - XSTTPersoalHomepageClassifyViewHeight action:nil];
+                }
+                
+            } else {
+                [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
+            }
 //            self.tableView.tableFooterView.backgroundColor = xstt_background_color();
         }
         [self endLoadDataStatusWithCanRefresh:true canLoad:false];
@@ -242,6 +279,9 @@ static NSString * const reuseIdentifier = @"XSTTSocialCircleTableViewCell";
                 case XSTTSocialCircleTableViewCellActionTypeShare:
                     [self shareAction:weak_cell];
                     break;
+                case XSTTSocialCircleTableViewCellActionTypeAvatarAndName:
+                    [self avatarAndNameAction:weak_cell];
+                    break;
                     
                 default:
                     break;