Ver código fonte

刷新优化

桂欢 2 anos atrás
pai
commit
f6ccbb2f39
30 arquivos alterados com 616 adições e 161 exclusões
  1. 30 0
      SLAiELTS/SLAiELTS.xcodeproj/project.pbxproj
  2. 4 0
      SLAiELTS/SLAiELTS/AppDelegate.h
  3. 17 2
      SLAiELTS/SLAiELTS/AppDelegate.mm
  4. 3 1
      SLAiELTS/SLAiELTS/AppMarcos/PrefixHeader.pch
  5. 13 0
      SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/CYLTableViewPlaceHolder.h
  6. 26 0
      SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/CYLTableViewPlaceHolderDelegate.h
  7. 20 0
      SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/TTTableViewPlaceView.h
  8. 72 0
      SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/TTTableViewPlaceView.m
  9. 19 0
      SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/UITableView+CYLTableViewPlaceHolder.h
  10. 112 0
      SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/UITableView+CYLTableViewPlaceHolder.m
  11. 31 0
      SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/UITableView+Refresh.h
  12. 88 0
      SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/UITableView+Refresh.m
  13. 2 1
      SLAiELTS/SLAiELTS/ViewControllers/AddressBookVC/Model/SLFriendsModel.h
  14. 4 1
      SLAiELTS/SLAiELTS/ViewControllers/AddressBookVC/SLAddressBookVc.m
  15. 2 0
      SLAiELTS/SLAiELTS/ViewControllers/BaseVC/SLBaseViewController.h
  16. 2 1
      SLAiELTS/SLAiELTS/ViewControllers/LoginVC/SLLoginVCViewController.m
  17. 1 1
      SLAiELTS/SLAiELTS/ViewControllers/LoginVC/SLLoginVCViewController.xib
  18. 20 8
      SLAiELTS/SLAiELTS/ViewControllers/MessageVC/SLMessageViewController.m
  19. 2 0
      SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/IMMessageView/YMIMMessageCollectionView.h
  20. 0 1
      SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/IMMessageView/YMIMMessageCollectionView.m
  21. 2 1
      SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLUserCenterViewController.m
  22. 15 11
      SLAiELTS/SLAiELTS/ViewControllers/MyVC/Views/Cells/SLMeHeaderCollectionViewCell.m
  23. 5 1
      SLAiELTS/SLAiELTS/ViewControllers/RoleLabelVC/SLRoleLabelViewController.m
  24. 2 2
      SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Model/SDTimeLineCellModel.h
  25. 78 121
      SLAiELTS/SLAiELTS/ViewControllers/TimeLine/TimeLineController/SDTimeLineTableViewController.m
  26. 15 1
      SLAiELTS/SLAiELTS/ViewControllers/TimeLine/TimeLineController/SLCreatMomentsVc.m
  27. 6 0
      SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/Cell/SDTimeLineCell.m
  28. 3 1
      SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/CommentView/SDTimeLineCellCommentView.h
  29. 21 6
      SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/CommentView/SDTimeLineCellCommentView.m
  30. 1 1
      SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/TimeLineRefreshFooter/SDTimeLineRefreshFooter.m

+ 30 - 0
SLAiELTS/SLAiELTS.xcodeproj/project.pbxproj

@@ -9,6 +9,9 @@
 /* Begin PBXBuildFile section */
 		3D19CBEA29E6480E0041A6B8 /* SLFriendsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D19CBE929E6480E0041A6B8 /* SLFriendsModel.m */; };
 		3D19CBEE29E682C20041A6B8 /* SLChatListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D19CBED29E682C20041A6B8 /* SLChatListModel.m */; };
+		3D19CBF829E7ABFD0041A6B8 /* UITableView+CYLTableViewPlaceHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D19CBF229E7ABFD0041A6B8 /* UITableView+CYLTableViewPlaceHolder.m */; };
+		3D19CBF929E7ABFD0041A6B8 /* UITableView+Refresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D19CBF329E7ABFD0041A6B8 /* UITableView+Refresh.m */; };
+		3D19CBFA29E7ABFD0041A6B8 /* TTTableViewPlaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D19CBF629E7ABFD0041A6B8 /* TTTableViewPlaceView.m */; };
 		3D1B986529BEAF2F0008D01A /* SLHorScrBtns.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D1B986429BEAF2F0008D01A /* SLHorScrBtns.m */; };
 		3D1B986929BEAFEB0008D01A /* SLHorScrBtns.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D1B986829BEAFEB0008D01A /* SLHorScrBtns.xib */; };
 		3D1B987229BEB35B0008D01A /* SLHorScrBtnsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D1B987029BEB35B0008D01A /* SLHorScrBtnsCell.m */; };
@@ -250,6 +253,14 @@
 		3D19CBE929E6480E0041A6B8 /* SLFriendsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLFriendsModel.m; sourceTree = "<group>"; };
 		3D19CBEC29E682C20041A6B8 /* SLChatListModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLChatListModel.h; sourceTree = "<group>"; };
 		3D19CBED29E682C20041A6B8 /* SLChatListModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLChatListModel.m; sourceTree = "<group>"; };
+		3D19CBF029E7ABFD0041A6B8 /* UITableView+Refresh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+Refresh.h"; sourceTree = "<group>"; };
+		3D19CBF129E7ABFD0041A6B8 /* TTTableViewPlaceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTTableViewPlaceView.h; sourceTree = "<group>"; };
+		3D19CBF229E7ABFD0041A6B8 /* UITableView+CYLTableViewPlaceHolder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+CYLTableViewPlaceHolder.m"; sourceTree = "<group>"; };
+		3D19CBF329E7ABFD0041A6B8 /* UITableView+Refresh.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+Refresh.m"; sourceTree = "<group>"; };
+		3D19CBF429E7ABFD0041A6B8 /* CYLTableViewPlaceHolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CYLTableViewPlaceHolder.h; sourceTree = "<group>"; };
+		3D19CBF529E7ABFD0041A6B8 /* CYLTableViewPlaceHolderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CYLTableViewPlaceHolderDelegate.h; sourceTree = "<group>"; };
+		3D19CBF629E7ABFD0041A6B8 /* TTTableViewPlaceView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTTableViewPlaceView.m; sourceTree = "<group>"; };
+		3D19CBF729E7ABFD0041A6B8 /* UITableView+CYLTableViewPlaceHolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+CYLTableViewPlaceHolder.h"; sourceTree = "<group>"; };
 		3D1B986329BEAF2F0008D01A /* SLHorScrBtns.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLHorScrBtns.h; sourceTree = "<group>"; };
 		3D1B986429BEAF2F0008D01A /* SLHorScrBtns.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLHorScrBtns.m; sourceTree = "<group>"; };
 		3D1B986829BEAFEB0008D01A /* SLHorScrBtns.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SLHorScrBtns.xib; sourceTree = "<group>"; };
@@ -682,6 +693,21 @@
 			path = Model;
 			sourceTree = "<group>";
 		};
+		3D19CBEF29E7ABFD0041A6B8 /* CYLTableViewPlaceHolder */ = {
+			isa = PBXGroup;
+			children = (
+				3D19CBF029E7ABFD0041A6B8 /* UITableView+Refresh.h */,
+				3D19CBF329E7ABFD0041A6B8 /* UITableView+Refresh.m */,
+				3D19CBF129E7ABFD0041A6B8 /* TTTableViewPlaceView.h */,
+				3D19CBF629E7ABFD0041A6B8 /* TTTableViewPlaceView.m */,
+				3D19CBF529E7ABFD0041A6B8 /* CYLTableViewPlaceHolderDelegate.h */,
+				3D19CBF729E7ABFD0041A6B8 /* UITableView+CYLTableViewPlaceHolder.h */,
+				3D19CBF229E7ABFD0041A6B8 /* UITableView+CYLTableViewPlaceHolder.m */,
+				3D19CBF429E7ABFD0041A6B8 /* CYLTableViewPlaceHolder.h */,
+			);
+			path = CYLTableViewPlaceHolder;
+			sourceTree = "<group>";
+		};
 		3D1B987429BEE6350008D01A /* Views */ = {
 			isa = PBXGroup;
 			children = (
@@ -944,6 +970,7 @@
 		3D2510AF29AF1943000AE530 /* Tool */ = {
 			isa = PBXGroup;
 			children = (
+				3D19CBEF29E7ABFD0041A6B8 /* CYLTableViewPlaceHolder */,
 				3D2D8BF129DE5AE4009392DA /* SCIndexView */,
 				3D2D8C0429DE7404009392DA /* TextFieldCategory */,
 				3D2D8BDA29DE55A9009392DA /* PinYin4Objc */,
@@ -1923,6 +1950,7 @@
 				3D24986C29AC72E2003C3AFA /* SLLoginVCViewController.m in Sources */,
 				3DF3DAF129BB131100CAD3AB /* RDVTabBarController.m in Sources */,
 				3DF3DAF529BB170F00CAD3AB /* SLHomeView.m in Sources */,
+				3D19CBFA29E7ABFD0041A6B8 /* TTTableViewPlaceView.m in Sources */,
 				3DB97DA029D6ABF000B12754 /* MLTextAttachment.m in Sources */,
 				3D1B9CF029C03B8B0008D01A /* SLDatePickView.m in Sources */,
 				3DF3DAC329B9C6E000CAD3AB /* YMBarItem.m in Sources */,
@@ -1949,6 +1977,7 @@
 				3DB97D4229D6A86E00B12754 /* SDTimeLineTableHeaderView.m in Sources */,
 				3D2510C729AF1D29000AE530 /* NSString+Category.m in Sources */,
 				3D2DC3E729B099C90041A729 /* YMChatServiceView.m in Sources */,
+				3D19CBF829E7ABFD0041A6B8 /* UITableView+CYLTableViewPlaceHolder.m in Sources */,
 				3DA5AF5C29B8843C009E4925 /* SLBaseTabBarController.m in Sources */,
 				3D2DC3E029B0991E0041A729 /* YMIMMessageCollectionView.m in Sources */,
 				3DB97D6D29D6ABC100B12754 /* UIView+SDExtension.m in Sources */,
@@ -2001,6 +2030,7 @@
 				3DB97D5F29D6AB6400B12754 /* SDBaseTableViewController.m in Sources */,
 				3D25106F29AD8AA9000AE530 /* SLRoleLabelViewController.m in Sources */,
 				3D24D67B29DFA1F100014D1C /* SLRemidLookView.m in Sources */,
+				3D19CBF929E7ABFD0041A6B8 /* UITableView+Refresh.m in Sources */,
 				3DA5AF7829B96B33009E4925 /* SLBaseMainView.m in Sources */,
 				3DB97D9829D6ABF000B12754 /* MLEmojiLabel.m in Sources */,
 				3D24D40729DEAF3200014D1C /* SLCreatMomentsVc.m in Sources */,

+ 4 - 0
SLAiELTS/SLAiELTS/AppDelegate.h

@@ -11,5 +11,9 @@
 
 @property (strong, nonatomic) UIWindow *window;
 
+- (void)setTabWithRootWindow;
+
+- (void)setLoginVcWithRootWindow;
+
 @end
 

+ 17 - 2
SLAiELTS/SLAiELTS/AppDelegate.mm

@@ -22,14 +22,29 @@
     self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
     self.window.backgroundColor = [UIColor whiteColor];
     [SLHttpCenter SharedInstance].serverUrl = @"http://115.238.47.235:8995";
-    SLBaseTabBarController *baseVc = [[SLBaseTabBarController alloc] init];
+//    [SLHttpCenter SharedInstance].serverUrl = @"http://10.0.0.14:8088";
+//    SLBaseTabBarController *baseVc = [[SLBaseTabBarController alloc] init];
     UIViewController *vc = [SLLoginVCViewController loadViewControllewWithNib];
-    self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:baseVc];
+    self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:vc];
     [self.window makeKeyAndVisible];
     [self buildIQkeyBoard];
     return YES;
 }
 
+- (void)setTabWithRootWindow {
+    SLBaseTabBarController *tabBarContr = [[SLBaseTabBarController alloc] init];
+    self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:tabBarContr];;
+    [self.window makeKeyAndVisible];
+}
+
+- (void)setLoginVcWithRootWindow {
+    UIViewController *vc = [SLLoginVCViewController loadViewControllewWithNib];
+    self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:vc];;
+    [self.window makeKeyAndVisible];
+}
+
+
+
 #pragma MARK- IQ键盘初始化
 -(void)buildIQkeyBoard
 {

+ 3 - 1
SLAiELTS/SLAiELTS/AppMarcos/PrefixHeader.pch

@@ -11,6 +11,8 @@
 #ifdef __OBJC__
 #import <UIKit/UIKit.h>
 #import <Foundation/Foundation.h>
+#import "AppDelegate.h"
+#import "SLBaseTabBarController.h"
 
 #import "YMConstMacro.h"
 #import "SLDefaultMacro.h"
@@ -23,7 +25,7 @@
 #import "NSObject+FBKVOController.h"
 #import "UIImageView+WebCache.h"
 #import "WZLBadgeImport.h"
-
+#import "CYLTableViewPlaceHolder.h"
 
 #import "UIColor+YMAdditions.h"
 #import "UIView+Extension.h"

+ 13 - 0
SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/CYLTableViewPlaceHolder.h

@@ -0,0 +1,13 @@
+//
+//  CYLTableViewPlaceHolder.h
+//  CYLNoResultTableViewController
+//
+//  Created by 微博@iOS程序犭袁 ( http://weibo.com/luohanchenyilong/ ) on 15/12/23.
+//  Copyright © 2015年 https://github.com/ChenYilong . All rights reserved.
+//
+
+#import "UITableView+CYLTableViewPlaceHolder.h"
+#import "CYLTableViewPlaceHolderDelegate.h"
+#import "TTTableViewPlaceView.h"
+#import "UITableView+Refresh.h"
+

+ 26 - 0
SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/CYLTableViewPlaceHolderDelegate.h

@@ -0,0 +1,26 @@
+//
+//  CYLTableViewPlaceHolderDelegate.h
+//  CYLNoResultTableViewController
+//
+//  Created by 微博@iOS程序犭袁 ( http://weibo.com/luohanchenyilong/ ) on 15/12/23.
+//  Copyright © 2015年 https://github.com/ChenYilong . All rights reserved.
+//
+
+@protocol CYLTableViewPlaceHolderDelegate <NSObject>
+
+@required
+/*!
+ @brief  make an empty overlay view when the tableView is empty
+ @return an empty overlay view
+ */
+- (UIView *)makePlaceHolderView;
+
+@optional
+/*!
+ @brief enable tableView scroll when place holder view is showing, it is disabled by default.
+ @attention There is no need to return  NO, it will be NO by default
+ @return enable tableView scroll, you can only return YES
+ */
+- (BOOL)enableScrollWhenPlaceHolderViewShowing;
+
+@end

+ 20 - 0
SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/TTTableViewPlaceView.h

@@ -0,0 +1,20 @@
+//
+//  TTTableViewPlaceView.h
+//  TTLife
+//
+//  Created by gui_huan on 2017/12/7.
+//  Copyright © 2017年 tangshuanghui. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+typedef void(^PlaceImageViewTap)(void);
+
+@interface TTTableViewPlaceView : UIView
+
+
+@property(nonatomic, strong)UIImageView *placeImageView;
+@property(nonatomic, strong)UILabel *titleLabel;
+
+@property (nonatomic, copy)PlaceImageViewTap placeImageViewTap;
+@end

+ 72 - 0
SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/TTTableViewPlaceView.m

@@ -0,0 +1,72 @@
+//
+//  TTTableViewPlaceView.m
+//  TTLife
+//
+//  Created by gui_huan on 2017/12/7.
+//  Copyright © 2017年 tangshuanghui. All rights reserved.
+//
+
+#import "TTTableViewPlaceView.h"
+@interface TTTableViewPlaceView()
+
+@end
+@implementation TTTableViewPlaceView
+
+- (instancetype)initWithFrame:(CGRect)frame{
+    self = [super initWithFrame:frame];
+    if (self) {
+        [self confignUI];
+    }
+    return self;
+}
+- (void)confignUI{
+    [self addSubview:self.placeImageView];
+    [self addSubview:self.titleLabel];
+    [self.placeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.center.equalTo(self);
+//        make.width.equalTo(@60);
+//        make.height.equalTo(@(60*0.88));
+    }];
+    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerX.equalTo(self);
+        make.top.equalTo(self.placeImageView.mas_bottom).offset(16);
+    }];
+}
+
+/**
+ 会遮盖试图导致不能响应事件,透过上层试图,
+ */
+- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
+    // 1.这是当前点击的视图,如果没有找到合适的响应操作的视图,则直接返回这个
+    UIView *hitView = [super hitTest:point withEvent:event];
+    if(hitView == self){
+        return nil;
+    }
+    return hitView;
+}
+
+- (UIImageView *)placeImageView{
+    if (!_placeImageView) {
+        _placeImageView = [[UIImageView alloc]init];
+        _placeImageView.image = ImageName(@"icon_blank");
+        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(placeImageViwTap)];
+        _placeImageView.userInteractionEnabled = YES;
+        [_placeImageView addGestureRecognizer:tap];
+    }
+    return _placeImageView;
+}
+- (UILabel *)titleLabel{
+    if (!_titleLabel) {
+        _titleLabel = [[UILabel alloc]initWithFrame:CGRectZero];
+        _titleLabel.text = @"没有数据";
+        _titleLabel.textColor = [UIColor darkGrayColor];
+    }
+    return _titleLabel;
+}
+
+- (void)placeImageViwTap{
+    if (self.placeImageViewTap) {
+        self.placeImageViewTap();
+    }
+}
+@end

+ 19 - 0
SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/UITableView+CYLTableViewPlaceHolder.h

@@ -0,0 +1,19 @@
+//
+//  UITableViewController+CYLTableViewPlaceHolder.h
+//  CYLNoResultTableViewController
+//
+//  Created by 微博@iOS程序犭袁 ( http://weibo.com/luohanchenyilong/ ) on 15/12/23.
+//  Copyright © 2015年 https://github.com/ChenYilong . All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface UITableView (CYLTableViewPlaceHolder)
+
+/*!
+ @brief just use this method to replace `reloadData` ,and it can help you to add or remove place holder view automatically
+ @attention this method has already reload the tableView,so do not reload tableView any more.
+ */
+- (void)cyl_reloadData;
+
+@end

+ 112 - 0
SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/UITableView+CYLTableViewPlaceHolder.m

@@ -0,0 +1,112 @@
+//
+//  UITableViewController+CYLEmptyReloader.m
+//  CYLNoResultTableViewController
+//
+//  Created by 微博@iOS程序犭袁 ( http://weibo.com/luohanchenyilong/ ) on 15/12/23.
+//  Copyright © 2015年 https://github.com/ChenYilong . All rights reserved.
+//
+
+#import "UITableView+CYLTableViewPlaceHolder.h"
+#import "CYLTableViewPlaceHolderDelegate.h"
+
+#import <objc/runtime.h>
+
+@interface UITableView ()
+
+@property (nonatomic, assign) BOOL scrollWasEnabled;
+@property (nonatomic, strong) UIView *placeHolderView;
+
+@end
+
+@implementation UITableView (CYLTableViewPlaceHolder)
+
+- (BOOL)scrollWasEnabled {
+//    SEL sel = @selector(scrollWasEnabled);
+    
+    NSNumber *scrollWasEnabledObject = objc_getAssociatedObject(self, _cmd);
+    return [scrollWasEnabledObject boolValue];
+}
+
+- (void)setScrollWasEnabled:(BOOL)scrollWasEnabled {
+    NSNumber *scrollWasEnabledObject = [NSNumber numberWithBool:scrollWasEnabled];
+    objc_setAssociatedObject(self, @selector(scrollWasEnabled), scrollWasEnabledObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (UIView *)placeHolderView {
+    return objc_getAssociatedObject(self, @selector(placeHolderView));
+}
+
+- (void)setPlaceHolderView:(UIView *)placeHolderView {
+    objc_setAssociatedObject(self, @selector(placeHolderView), placeHolderView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (void)cyl_reloadData {
+    [self reloadData];
+    [self cyl_checkEmpty];
+}
+
+- (void)cyl_checkEmpty {
+    BOOL isEmpty = YES;
+    
+    id<UITableViewDataSource> src = self.dataSource;
+    NSInteger sections = 1;
+    if ([src respondsToSelector: @selector(numberOfSectionsInTableView:)]) {
+        sections = [src numberOfSectionsInTableView:self];
+    }
+    for (int i = 0; i<sections; ++i) {
+        NSInteger rows = [src tableView:self numberOfRowsInSection:i];
+        if (rows) {
+            isEmpty = NO;
+        }
+        
+    }
+    // isEmpty为空即数据不为空
+    if (!isEmpty != !self.placeHolderView) {
+        if (isEmpty) {
+            self.scrollWasEnabled = self.scrollEnabled;
+            BOOL scrollEnabled = NO;
+            if ([self respondsToSelector:@selector(enableScrollWhenPlaceHolderViewShowing)]) {
+                 scrollEnabled = (BOOL)[self performSelector:@selector(enableScrollWhenPlaceHolderViewShowing)];
+                if (!scrollEnabled) {
+                    NSString *reason = @"There is no need to return  NO for `-enableScrollWhenPlaceHolderViewShowing`, it will be NO by default";
+                    @throw [NSException exceptionWithName:NSGenericException
+                                                   reason:reason
+                                                 userInfo:nil];
+                }
+            } else if ([self.delegate respondsToSelector:@selector(enableScrollWhenPlaceHolderViewShowing)]) {
+                scrollEnabled = (BOOL)[self.delegate performSelector:@selector(enableScrollWhenPlaceHolderViewShowing)];
+                if (!scrollEnabled) {
+                    NSString *reason = @"There is no need to return  NO for `-enableScrollWhenPlaceHolderViewShowing`, it will be NO by default";
+                    @throw [NSException exceptionWithName:NSGenericException
+                                                   reason:reason
+                                                 userInfo:nil];
+                }
+            }
+            self.scrollEnabled = scrollEnabled;
+            if ([self respondsToSelector:@selector(makePlaceHolderView)]) {
+                self.placeHolderView = [self performSelector:@selector(makePlaceHolderView)];
+            } else if ( [self.delegate respondsToSelector:@selector(makePlaceHolderView)]) {
+                self.placeHolderView = [self.delegate performSelector:@selector(makePlaceHolderView)];
+            } else {
+                NSString *selectorName = NSStringFromSelector(_cmd);
+                NSString *reason = [NSString stringWithFormat:@"You must implement makePlaceHolderView method in your custom tableView or its delegate class if you want to use %@", selectorName];
+                @throw [NSException exceptionWithName:NSGenericException
+                                               reason:reason
+                                             userInfo:nil];
+            }
+            self.placeHolderView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
+            [self addSubview:self.placeHolderView];
+        } else {
+            self.scrollEnabled = self.scrollWasEnabled;
+            [self.placeHolderView removeFromSuperview];
+            self.placeHolderView = nil;
+        }
+    }
+    else if (isEmpty) {
+        // Make sure it is still above all siblings.
+        [self.placeHolderView removeFromSuperview];
+        [self addSubview:self.placeHolderView];
+    }
+}
+
+@end

+ 31 - 0
SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/UITableView+Refresh.h

@@ -0,0 +1,31 @@
+//
+//  UITableView+Refresh.h
+//  SharedParking
+//
+//  Created by gui_huan on 2018/5/22.
+//  Copyright © 2018年 tangshuanghui. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "MJRefresh.h"
+
+#define SLPageSize 3
+
+typedef void(^TableListCount)(NSInteger listCount);
+
+typedef void(^TableViewRefresh)(NSInteger pageNo, TableListCount listCount);
+
+@interface UITableView (Refresh)
+
+
+/**
+ 通过回调ListCount,设置刷新状态
+
+ @param dataArray <#dataArray description#>
+ @param tableViewRefresh <#tableViewRefresh description#>
+ */
+- (void)tableviewRefresh:(NSMutableArray *)dataArray TableViewRefresh:(TableViewRefresh)tableViewRefresh;
+
+@property(nonatomic, copy)TableListCount listCount;
+
+@end

+ 88 - 0
SLAiELTS/SLAiELTS/Tool/CYLTableViewPlaceHolder/UITableView+Refresh.m

@@ -0,0 +1,88 @@
+//
+//  UITableView+Refresh.m
+//  SharedParking
+//
+//  Created by gui_huan on 2018/5/22.
+//  Copyright © 2018年 tangshuanghui. All rights reserved.
+//
+
+#import "UITableView+Refresh.h"
+#import "UITableView+CYLTableViewPlaceHolder.h"
+#import "CYLTableViewPlaceHolderDelegate.h"
+#import "TTTableViewPlaceView.h"
+#import <objc/runtime.h>
+@interface UITableView (MJRefresh)<CYLTableViewPlaceHolderDelegate>
+@property (nonatomic, strong) TTTableViewPlaceView *tablePlaceView;
+
+@end
+@implementation UITableView (Refresh)
+static char *count = "listCount";
+
+- (void)tableviewRefresh:(NSMutableArray *)dataArray TableViewRefresh:(TableViewRefresh)tableViewRefresh{
+    WEAKSELF;
+    __block NSInteger pageNo = 1;
+    self.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
+        [dataArray removeAllObjects];
+        pageNo = 1;
+        tableViewRefresh(pageNo, wkSelf.listCount);
+    }];
+    
+    self.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
+        pageNo++;
+        tableViewRefresh(pageNo, wkSelf.listCount);
+    }];
+    [self.mj_header beginRefreshing];
+    self.listCount = ^(NSInteger listCount) {
+        [wkSelf tableviewRefreshpostListCount:listCount];
+    };
+    
+}
+- (void)tableviewRefreshpostListCount:(NSInteger)listCount{
+    [self endRefreshing];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        self.mj_footer.state = listCount != SLPageSize ? MJRefreshStateNoMoreData : MJRefreshStateIdle;
+        if (!self.tablePlaceView && listCount <= 0) {
+            self.tablePlaceView = [[TTTableViewPlaceView alloc]initWithFrame:self.frame];
+            WEAKSELF;
+            self.tablePlaceView.placeImageViewTap = ^{
+                [wkSelf.mj_header beginRefreshing];
+            };
+        }
+        self.tablePlaceView.placeImageView.image = listCount < 0 ? ImageName(@"bd_wangluoyichang") : ImageName(@"icon_blank");
+        self.tablePlaceView.placeImageView.userInteractionEnabled = listCount < 0 ? YES : NO;
+        self.tablePlaceView.titleLabel.hidden = listCount < 0 ? YES : NO;
+        [self cyl_reloadData];
+    });
+}
+- (void)endRefreshing{
+    if([self.mj_header isRefreshing]) {
+        [self.mj_header endRefreshing];
+    }
+}
+
+- (TableListCount)listCount{
+    return objc_getAssociatedObject(self, count);
+}
+- (void)setListCount:(TableListCount)listCount{
+    objc_setAssociatedObject(self, count, listCount, OBJC_ASSOCIATION_COPY_NONATOMIC);
+}
+#pragma mark - CYLTableViewPlaceHolderDelegate
+- (UIView *)makePlaceHolderView
+{
+    return self.tablePlaceView;
+}
+
+- (void)placeImageTap{
+    
+}
+- (TTTableViewPlaceView *)tablePlaceView{
+    return objc_getAssociatedObject(self, @selector(tablePlaceView));
+}
+- (void)setTablePlaceView:(TTTableViewPlaceView *)tablePlaceView{
+    objc_setAssociatedObject(self, @selector(tablePlaceView), tablePlaceView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (void)dealloc{
+    CheckRunWhere;
+}
+@end

+ 2 - 1
SLAiELTS/SLAiELTS/ViewControllers/AddressBookVC/Model/SLFriendsModel.h

@@ -10,8 +10,9 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface SLFriendsModel : NSObject
-
+//主
 @property (nonatomic, copy) NSString *userId;
+//客
 @property (nonatomic, copy) NSString *contactsId;
 @property (nonatomic, copy) NSString *name;
 @property (nonatomic, copy) NSString *head;

+ 4 - 1
SLAiELTS/SLAiELTS/ViewControllers/AddressBookVC/SLAddressBookVc.m

@@ -38,6 +38,7 @@
                 obj.isEdit = self.isSelFriend;
             }];
             [self handleLettersArray:friendsModel];
+            self.tableView.sc_indexViewDataSource = self.lettersArray;
             [self.tableView reloadData];
         } failure:^(SPRequestError *error) {
             
@@ -109,7 +110,6 @@
     
     self.tableView.sc_indexViewConfiguration = configuration;
     self.tableView.sc_translucentForTableViewInNavigationBar = YES;
-    self.tableView.sc_indexViewDataSource = self.lettersArray;
     self.tableView.sc_startSection = 1;
     self.tableView.backgroundColor = [UIColor clearColor];
 }
@@ -176,6 +176,9 @@
 }
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    if (self.isSelFriend) {
+        return;
+    }
     SLFriendsModel *frends = [[self.nameDic objectForKey:self.lettersArray[indexPath.section]] objectAtIndex:indexPath.row];
     SLFriensInfoVc *vc = [SLFriensInfoVc loadViewControllewWithNib];
     vc.friendModel = frends;

+ 2 - 0
SLAiELTS/SLAiELTS/ViewControllers/BaseVC/SLBaseViewController.h

@@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property(nonatomic,assign) BOOL hideBackBtn;
 
+- (void)backBarButtonPressed:(id)pressed;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 2 - 1
SLAiELTS/SLAiELTS/ViewControllers/LoginVC/SLLoginVCViewController.m

@@ -97,7 +97,8 @@
             SLRoleLabelViewController *vc = [SLRoleLabelViewController loadViewControllewWithNib];
             [self navPushViewController:vc animated:YES];
         }else {
-            [self backBtnClick:nil];
+            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+            [appDelegate setTabWithRootWindow];
         }
     } failure:^(SPRequestError *error) {
         

+ 1 - 1
SLAiELTS/SLAiELTS/ViewControllers/LoginVC/SLLoginVCViewController.xib

@@ -32,7 +32,7 @@
                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_login_logo" translatesAutoresizingMaskIntoConstraints="NO" id="4LG-Wy-1id">
                     <rect key="frame" x="238.66666666666663" y="80.333333333333329" width="136.33333333333337" height="136.33333333333337"/>
                 </imageView>
-                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="scX-bl-vmW">
+                <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="scX-bl-vmW">
                     <rect key="frame" x="22" y="56.999999999999993" width="30" height="30.666666666666664"/>
                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                     <state key="normal" backgroundImage="icon_lg_close"/>

+ 20 - 8
SLAiELTS/SLAiELTS/ViewControllers/MessageVC/SLMessageViewController.m

@@ -24,6 +24,12 @@
     [super viewDidLoad];
     // Do any additional setup after loading the view from its nib.
     self.title = @"自由畅聊";
+    NSString *key = [NSString stringWithFormat:@"%@--to--%@",self.friendModel.userId, self.friendModel.contactsId];
+    NSArray *arr = [[NSUserDefaults standardUserDefaults] objectForKey:key];
+    if (arr) {
+        NSArray *models = [MessageModel mj_objectArrayWithKeyValuesArray:arr];
+        self.chatServiceView.messageView.chatDataManager = [NSMutableArray arrayWithArray:models];
+    }
     self.chatServiceView.friendModel = self.friendModel;
     [self.chatServiceView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(kNavBarHeight);
@@ -56,19 +62,25 @@
             }];
         }
     };
-    [[SLHttpCenter SharedInstance] getWithUrl:@"/api/Chat/GetChatRecord" parameter:@{@"friendId" : self.friendModel.contactsId} success:^(id responseObject) {
-//        NSArray *chatList = [responseObject objectForKey:@"data"];
-//        self.chatList = [SLChatListModel mj_objectArrayWithKeyValuesArray:chatList];
-//        self.homeView.viewModels = [SLPageViewModel homePageViewModelsWith:self.chatList];
-//        [self.homeView.mainCollectionView reloadData];
-    } failure:^(SPRequestError *error) {
-        
-    }];
+//    [[SLHttpCenter SharedInstance] getWithUrl:@"/api/Chat/GetChatRecord" parameter:@{@"friendId" : self.friendModel.contactsId} success:^(id responseObject) {
+//
+//    } failure:^(SPRequestError *error) {
+//        
+//    }];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillShowNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardWillHideNotification object:nil];
 }
 
+- (void)backBarButtonPressed:(id)pressed {
+    NSString *key = [NSString stringWithFormat:@"%@--to--%@",self.friendModel.userId, self.friendModel.contactsId];
+    NSArray *dictArr = [NSObject mj_keyValuesArrayWithObjectArray:self.chatServiceView.messageView.chatDataManager];
+    [[NSUserDefaults standardUserDefaults] setObject:dictArr forKey:key];
+    [[NSUserDefaults standardUserDefaults] synchronize];
+    [self.navigationController popViewControllerAnimated:YES];
+    
+}
+
 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
     if (self.hiddenMikeSegment) {
         [self.view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {

+ 2 - 0
SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/IMMessageView/YMIMMessageCollectionView.h

@@ -24,6 +24,8 @@ typedef void(^SLMikeInputBroadcastBlock)(MessageModel *msgModel);
 
 @property (nonatomic, copy) SLMikeInputBroadcastBlock broadcastBlock;
 
+@property (nonatomic, strong) NSMutableArray<MessageModel *> *chatDataManager;
+
 - (void)appendMessage:(MessageModel *)message;
 
 - (void)removeAllMessages;

+ 0 - 1
SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/IMMessageView/YMIMMessageCollectionView.m

@@ -12,7 +12,6 @@
 
 @interface YMIMMessageCollectionView()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate>
 
-@property (nonatomic, strong) NSMutableArray<MessageModel *> *chatDataManager;
 
 @end
 

+ 2 - 1
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLUserCenterViewController.m

@@ -75,7 +75,8 @@
     if ([detail.title isEqualToString:@"退出登录"]) {
         [SLCustomizeAlert showAletrWithTitle:@"退出确认" message:@"是否确认退出登录?" sureBtnTitle:@"确定" cancelBtnTitle:@"取消" sureBtnAction:^{
             [[SLGlobalInfo SharedInstance] userLogout];
-            [self.navigationController popToRootViewControllerAnimated:YES];
+            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+            [appDelegate setLoginVcWithRootWindow];
         } cancelBtnAction:^{
             
         }];

+ 15 - 11
SLAiELTS/SLAiELTS/ViewControllers/MyVC/Views/Cells/SLMeHeaderCollectionViewCell.m

@@ -91,18 +91,9 @@ static const NSInteger btnTag = 888888;
     
     WS(weakSelf);
     [self.KVOController observe:[SLGlobalInfo SharedInstance] keyPath:@"loginInfo" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld block:^(id  _Nullable observer, id  _Nonnull object, NSDictionary<NSKeyValueChangeKey,id> * _Nonnull change) {
-        SLLoginInfo *targetModel = [SLGlobalInfo SharedInstance].loginInfo;
-        if (targetModel) {
-            weakSelf.nameLabel.text = [NSString stringWithFormat:@"Hi,%@",targetModel.user.name];
-            weakSelf.loginTimeLabel.text = [NSString stringWithFormat:@"账号:%@",targetModel.user.phone];
-            NSString *headUrl = [NSString stringWithFormat:@"%@%@",[SLHttpCenter SharedInstance].serverUrl, [SLGlobalInfo SharedInstance].loginInfo.user.head];
-            [weakSelf.headView sd_setImageWithURL:[NSURL URLWithString:headUrl] placeholderImage:ImageName(@"icon_ellipse")];
-        }else {
-            weakSelf.nameLabel.text = @"尊敬的客户,您好!";
-            weakSelf.loginTimeLabel.text = @"未登录";
-            weakSelf.headView .image = ImageName(@"icon_ellipse");
-        }
+        [weakSelf setHeaderWithLoginInfo];
     }];
+    [self setHeaderWithLoginInfo];
     
     _interestcrollView = [[UIScrollView alloc] initWithFrame:CGRectZero];
     _interestcrollView.bounces = NO;
@@ -142,7 +133,20 @@ static const NSInteger btnTag = 888888;
         make.height.width.mas_equalTo(32);
         make.centerY.equalTo(_interestcrollView);
     }];
+}
 
+- (void)setHeaderWithLoginInfo {
+    SLLoginInfo *targetModel = [SLGlobalInfo SharedInstance].loginInfo;
+    if (targetModel) {
+        self.nameLabel.text = [NSString stringWithFormat:@"Hi,%@",targetModel.user.name];
+        self.loginTimeLabel.text = [NSString stringWithFormat:@"账号:%@",targetModel.user.phone];
+        NSString *headUrl = [NSString stringWithFormat:@"%@%@",[SLHttpCenter SharedInstance].serverUrl, [SLGlobalInfo SharedInstance].loginInfo.user.head];
+        [self.headView sd_setImageWithURL:[NSURL URLWithString:headUrl] placeholderImage:ImageName(@"icon_ellipse")];
+    }else {
+        self.nameLabel.text = @"尊敬的客户,您好!";
+        self.loginTimeLabel.text = @"未登录";
+        self.headView .image = ImageName(@"icon_ellipse");
+    }
 }
 
 - (void)confignCellWithModel:(SLPageModel *)pageModel {

+ 5 - 1
SLAiELTS/SLAiELTS/ViewControllers/RoleLabelVC/SLRoleLabelViewController.m

@@ -156,11 +156,15 @@
             SLRoleCreatSucView *roleCreatSucView = [[SLRoleCreatSucView alloc] initWithFrame:self.view.frame];
             WS(weakSelf);
             roleCreatSucView.sucBlock = ^{
-                [weakSelf.navigationController popToRootViewControllerAnimated:YES];
+//                [weakSelf.navigationController popToRootViewControllerAnimated:YES];
+                AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+                [appDelegate setTabWithRootWindow];
             };
             [roleCreatSucView alertShow];
         } failure:^(SPRequestError *error) {
             self.curSelIndex --;
+            AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+            [appDelegate setTabWithRootWindow];
         }];
     }
 }

+ 2 - 2
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Model/SDTimeLineCellModel.h

@@ -67,7 +67,7 @@
 @interface SDTimeLineCellCommentItemModel : NSObject
 
 @property (nonatomic, copy) NSString *userName;
-
+//当前
 @property (nonatomic, copy) NSString *userId;
 @property (nonatomic, copy) NSString *commendId;
 
@@ -76,7 +76,7 @@
 
 @property (nonatomic, copy) NSString *content;
 @property (nonatomic, copy) NSString *time;
-
+//回复
 @property (nonatomic, copy) NSString *replyUserName;
 
 @property (nonatomic, copy) NSString *level;

+ 78 - 121
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/TimeLineController/SDTimeLineTableViewController.m

@@ -28,11 +28,8 @@
 
 #import "SDTimeLineTableViewController.h"
 
-#import "SDRefresh.h"
-
 #import "SDTimeLineTableHeaderView.h"
 #import "SDTimeLineRefreshHeader.h"
-#import "SDTimeLineRefreshFooter.h"
 #import "SDTimeLineCell.h"
 #import "SDTimeLineCellModel.h"
 
@@ -55,13 +52,17 @@ static CGFloat textFieldH = 56;
 @property (nonatomic, copy) NSString *commentToUser;
 
 @property (nonatomic, strong) SLMoentsChatView *moentsChatView;
+
+@property (nonatomic, strong) SDTimeLineCellCommentItemModel *currentCommentItemModel;
+
+@property (nonatomic, assign) NSInteger currentPageIndex;
 @end
 
 @implementation SDTimeLineTableViewController
 
 {
-    SDTimeLineRefreshFooter *_refreshFooter;
-    SDTimeLineRefreshHeader *_refreshHeader;
+//    SDTimeLineRefreshFooter *_refreshFooter;
+//    SDTimeLineRefreshHeader *_refreshHeader;
     CGFloat _lastScrollViewOffsetY;
     CGFloat _totalKeybordHeight;
 }
@@ -74,16 +75,6 @@ static CGFloat textFieldH = 56;
     
     UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"日间" style:UIBarButtonItemStyleDone target:self action:@selector(rightBarButtonItemAction:)];
     
-    rightBarButtonItem.lee_theme
-    .LeeAddCustomConfig(DAY , ^(UIBarButtonItem *item){
-        
-        item.title = @"夜间";
-        
-    }).LeeAddCustomConfig(NIGHT , ^(UIBarButtonItem *item){
-        
-        item.title = @"日间";
-    });
-    
     //为self.view 添加背景颜色设置
     
     self.view.lee_theme
@@ -92,33 +83,15 @@ static CGFloat textFieldH = 56;
     
     self.navigationItem.rightBarButtonItem = rightBarButtonItem;
     
-    self.automaticallyAdjustsScrollViewInsets = NO;
-    
+    if (@available(iOS 11.0, *)) {
+        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+    } else {
+        self.automaticallyAdjustsScrollViewInsets = NO;
+    }
     self.edgesForExtendedLayout = UIRectEdgeTop;
     
     
-    __weak typeof(self) weakSelf = self;
-    
-    
-    // 上拉加载
-    _refreshFooter = [SDTimeLineRefreshFooter refreshFooterWithRefreshingText:@"正在加载数据..."];
-    __weak typeof(_refreshFooter) weakRefreshFooter = _refreshFooter;
-    [_refreshFooter addToScrollView:self.tableView refreshOpration:^{
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [weakSelf creatModelsWithCount:10];
-            
-            /**
-             [weakSelf.tableView reloadDataWithExistedHeightCache]
-             作用等同于
-             [weakSelf.tableView reloadData]
-             只是“reloadDataWithExistedHeightCache”刷新tableView但不清空之前已经计算好的高度缓存,用于直接将新数据拼接在旧数据之后的tableView刷新
-             */
-            [weakSelf.tableView reloadDataWithExistedHeightCache];
-            
-            [weakRefreshFooter endRefreshing];
-        });
-    }];
-    
+    self.currentPageIndex = 1;
     SDTimeLineTableHeaderView *headerView = [SDTimeLineTableHeaderView new];
     headerView.frame = CGRectMake(0, 0, 0, 260);
     self.tableView.tableHeaderView = headerView;
@@ -127,34 +100,17 @@ static CGFloat textFieldH = 56;
     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
 
     [self.tableView registerClass:[SDTimeLineCell class] forCellReuseIdentifier:kTimeLineTableViewCellId];
-
     
 
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardNotification:) name:UIKeyboardWillChangeFrameNotification object:nil];
+    [self creatModelsWithCount:self.currentPageIndex];
+    
 }
 
 - (void)viewDidAppear:(BOOL)animated
 {
     [super viewDidAppear:animated];
     [self setupTextField];
-    if (!_refreshHeader.superview) {
-        
-        _refreshHeader = [SDTimeLineRefreshHeader refreshHeaderWithCenter:CGPointMake(40, 45)];
-        _refreshHeader.scrollView = self.tableView;
-        __weak typeof(_refreshHeader) weakHeader = _refreshHeader;
-        __weak typeof(self) weakSelf = self;
-        [_refreshHeader setRefreshingBlock:^{
-            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                [weakSelf.dataArray removeAllObjects];
-                [weakSelf creatModelsWithCount:10];
-                [weakHeader endRefreshing];
-            });
-        }];
-        [self.tableView.superview addSubview:_refreshHeader];
-    } else {
-        [self.tableView.superview bringSubviewToFront:_refreshHeader];
-    }
-    [_refreshHeader setRefreshState:SDWXRefreshViewStateRefreshing];
 }
 
 - (void)viewWillDisappear:(BOOL)animated
@@ -169,9 +125,6 @@ static CGFloat textFieldH = 56;
 
 - (void)dealloc
 {
-    [_refreshHeader removeFromSuperview];
-    [_refreshFooter removeFromSuperview];
-    
     [_textField removeFromSuperview];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 }
@@ -199,27 +152,24 @@ static CGFloat textFieldH = 56;
                                     @"content" : text ?: @"",
                                     @"level" : @"0",
         };
+        if (weakSelf.isReplayingComment) {
+            parameter = @{@"commendId" : weakSelf.currentCommentItemModel.commendId ?: @"",
+                          @"friendId" : weakSelf.currentCommentItemModel.friendId ?: @"",
+                          @"replyUserId" : weakSelf.currentCommentItemModel.userId ?: @"",
+                          @"content" : text ?: @"",
+                          @"level" : @"0",
+            };
+            weakSelf.isReplayingComment = NO;
+        }
         [[SLHttpCenter SharedInstance] postWithUrl:@"/api/Friend/InsertComment" parameter:parameter success:^(id responseObject) {
             SDTimeLineCellCommentItemModel *commentItemModel = [SDTimeLineCellCommentItemModel new];
             SLLoginInfo *targetModel = [SLGlobalInfo SharedInstance].loginInfo;
-//            if (weakSelf.isReplayingComment) {
-//                commentItemModel.firstUserName = @"GSD_iOS";
-//                commentItemModel.firstUserId = @"GSD_iOS";
-//                commentItemModel.secondUserName = weakSelf.commentToUser;
-//                commentItemModel.secondUserId = weakSelf.commentToUser;
-//                commentItemModel.commentString = text;
-//
-//                weakSelf.isReplayingComment = NO;
-//            } else {
-//                commentItemModel.firstUserName = targetModel.user.name;
-//                commentItemModel.commentString = text;
-//                commentItemModel.firstUserId = targetModel.user.userId;
-//            }
             commentItemModel.userName = targetModel.user.name;
             commentItemModel.userId = targetModel.user.userId;
-            commentItemModel.replyUserName = model.userName;
+            commentItemModel.replyUserName = weakSelf.currentCommentItemModel.userName;
             commentItemModel.content = text;
             commentItemModel.friendId = model.friendId;
+            commentItemModel.level = [parameter objectForKey:@"level"];
             [temp addObject:commentItemModel];
             model.list = [temp copy];
             [weakSelf.tableView reloadRowsAtIndexPaths:@[weakSelf.currentEditingIndexthPath] withRowAnimation:UITableViewRowAnimationNone];
@@ -246,49 +196,49 @@ static CGFloat textFieldH = 56;
 
 - (void)creatModelsWithCount:(NSInteger)count
 {
-    
-    NSDictionary *parameter = @{@"PageIndex": @"0",
-                                @"PageSize": @"10",
-                                @"type" : @"0",
-                                @"Keyword" : @"",
-                                @"DateBegin" : @"",
-                                @"DateEnd" : @"",
-                                @"SkipCount" : @"",
-    };
-    parameter = @{};
-    WS(weakSelf);
-    [[SLHttpCenter SharedInstance] getWithUrl:@"/api/Friend/GetFriendList" parameter:parameter success:^(id responseObject) {
-        NSDictionary *data = [responseObject objectForKey:@"data"];
-        NSArray *items = [data objectForKey:@"items"];
-        if (items.count) {
-            NSMutableArray *marr = [SDTimeLineCellModel mj_objectArrayWithKeyValuesArray:items];
-            [marr enumerateObjectsUsingBlock:^(SDTimeLineCellModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
-                obj.likeItemsArray = [NSMutableArray new];
-                [obj.likeStr enumerateObjectsUsingBlock:^(id  _Nonnull obj1, NSUInteger idx1, BOOL * _Nonnull stop) {
-                    SDTimeLineCellLikeItemModel *model = [[SDTimeLineCellLikeItemModel alloc] init];
-                    model.userName = obj1;
-                    model.userId = @"1111";
-                    [obj.likeItemsArray addObject:model];
-                }];
-            }];
-            [self.dataArray addObjectsFromArray:marr];
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                [self.tableView reloadData];
-            });
-            [self.dataArray enumerateObjectsUsingBlock:^(SDTimeLineCellModel * obj, NSUInteger idx, BOOL * _Nonnull stop) {
-                if ([obj.friendImgUrl componentsSeparatedByString:@","].count == 1) {
-
-                    [weakSelf.KVOController observe:obj keyPath:@"imageSize" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld block:^(id  _Nullable observer, id  _Nonnull object, NSDictionary<NSKeyValueChangeKey,id> * _Nonnull change) {
-                        dispatch_async(dispatch_get_main_queue(), ^{
-                            [weakSelf.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:idx inSection:0], nil] withRowAnimation:UITableViewRowAnimationAutomatic];
-                        });
+    WEAKSELF;
+    [self.tableView tableviewRefresh:self.dataArray TableViewRefresh:^(NSInteger pageNo, TableListCount listCount) {
+        
+        NSDictionary *parameter = @{@"PageIndex": @(pageNo),
+                                    @"PageSize": @(SLPageSize),
+                                    @"type" : @"0",
+        };
+        WS(weakSelf);
+        [[SLHttpCenter SharedInstance] getWithUrl:@"/api/Friend/GetFriendList" parameter:parameter success:^(id responseObject) {
+            NSDictionary *data = [responseObject objectForKey:@"data"];
+            NSArray *items = [data objectForKey:@"items"];
+            if (items.count) {
+                NSMutableArray *marr = [SDTimeLineCellModel mj_objectArrayWithKeyValuesArray:items];
+                [marr enumerateObjectsUsingBlock:^(SDTimeLineCellModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
+                    
+                    obj.likeItemsArray = [NSMutableArray new];
+                    [obj.likeStr enumerateObjectsUsingBlock:^(id  _Nonnull obj1, NSUInteger idx1, BOOL * _Nonnull stop) {
+                        SDTimeLineCellLikeItemModel *model = [[SDTimeLineCellLikeItemModel alloc] init];
+                        model.userName = obj1;
+                        model.userId = @"1111";
+                        [obj.likeItemsArray addObject:model];
                     }];
-                }
-            }];
-        }
-    } failure:^(SPRequestError *error) {
-
+                }];
+                [self.dataArray addObjectsFromArray:marr];
+                
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [self.tableView reloadData];
+                });
+                [self.dataArray enumerateObjectsUsingBlock:^(SDTimeLineCellModel * obj, NSUInteger idx, BOOL * _Nonnull stop) {
+                    if ([obj.friendImgUrl componentsSeparatedByString:@","].count == 1) {
+
+                        [weakSelf.KVOController observe:obj keyPath:@"imageSize" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld block:^(id  _Nullable observer, id  _Nonnull object, NSDictionary<NSKeyValueChangeKey,id> * _Nonnull change) {
+                            dispatch_async(dispatch_get_main_queue(), ^{
+                                [weakSelf.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:idx inSection:0], nil] withRowAnimation:UITableViewRowAnimationAutomatic];
+                            });
+                        }];
+                    }
+                }];
+            }
+            listCount([items count]);
+        } failure:^(SPRequestError *error) {
+            listCount(-1);
+        }];
     }];
 }
 
@@ -301,6 +251,9 @@ static CGFloat textFieldH = 56;
 {
     SDTimeLineCell *cell = [tableView dequeueReusableCellWithIdentifier:kTimeLineTableViewCellId];
     cell.indexPath = indexPath;
+    NSLog(@"----%ld",indexPath.row);
+    SDTimeLineCellModel *model = self.dataArray[indexPath.row];
+    cell.model = model;
     __weak typeof(self) weakSelf = self;
     if (!cell.moreButtonClickedBlock) {
         [cell setMoreButtonClickedBlock:^(NSIndexPath *indexPath) {
@@ -309,13 +262,17 @@ static CGFloat textFieldH = 56;
             [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
         }];
         
-        [cell setDidClickCommentLabelBlock:^(NSString *commentId, CGRect rectInWindow, NSIndexPath *indexPath) {
+        [cell setDidClickCommentLabelBlock:^(NSString *commentId, CGRect rectInWindow,  NSIndexPath *indexPath1) {
+            NSLog(@"===----%ld",indexPath.row);
+            NSLog(@"===----%ld",indexPath1.row);
 //            weakSelf.textField.placeholder = [NSString stringWithFormat:@"  回复:%@", commentId];
-            weakSelf.currentEditingIndexthPath = indexPath;
+            weakSelf.currentEditingIndexthPath = [NSIndexPath indexPathForRow:indexPath1.row inSection:0];
+            SDTimeLineCellModel *model1 = weakSelf.dataArray[indexPath1.row];
             [weakSelf.textField becomeFirstResponder];
             weakSelf.isReplayingComment = YES;
+            weakSelf.currentCommentItemModel = [model1.list objectAtIndex:indexPath1.section];
             weakSelf.commentToUser = commentId;
-            [weakSelf adjustTableViewToFitKeyboardWithRect:rectInWindow];
+            [weakSelf adjustTableViewToFitKeyboard];
         }];
         
         cell.delegate = self;
@@ -327,7 +284,7 @@ static CGFloat textFieldH = 56;
     
     ///////////////////////////////////////////////////////////////////////
     
-    cell.model = self.dataArray[indexPath.row];
+    
     return cell;
 }
 

+ 15 - 1
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/TimeLineController/SLCreatMomentsVc.m

@@ -24,6 +24,8 @@
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *photoHeightConst;
 
 @property (nonatomic, strong) NSMutableArray *photoBrowerModels;
+
+@property (nonatomic, strong) NSMutableArray<SLFriendsModel *> *selFriendsArr;
 @end
 
 @implementation SLCreatMomentsVc
@@ -60,6 +62,7 @@
         SLAddressBookVc *vc = [SLAddressBookVc loadViewControllewWithNib];
         vc.isSelFriend = YES;
         vc.selFriendsBlock = ^(NSArray *arr) {
+            weakSelf.selFriendsArr = [NSMutableArray arrayWithArray:arr];
             weakSelf.remidLookView.scrollView.contentSize = CGSizeMake(arr.count * 44, 32);
             [arr enumerateObjectsUsingBlock:^(SLFriendsModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
                 UIImageView *imageView = [[UIImageView alloc] init];
@@ -88,7 +91,11 @@
     
     WS(weakSelf);
     void(^InsertFriendCircle)(NSString *imgUrls) = ^(NSString *imgUrls){
-        NSDictionary *parameter = @{@"content":weakSelf.textView.text ?: @"", @"imgUrl" : imgUrls ?: @"", @"remindAis" : @""};
+        __block NSString *remindAis = @"";
+        [weakSelf.selFriendsArr enumerateObjectsUsingBlock:^(SLFriendsModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
+            remindAis = [remindAis stringByAppendingFormat:@"%@,",obj.contactsId];
+        }];
+        NSDictionary *parameter = @{@"content":weakSelf.textView.text ?: @"", @"imgUrl" : imgUrls ?: @"", @"remindAis" : remindAis};
         [[SLHttpCenter SharedInstance] postWithUrl:@"/api/Friend/InsertFriendCircle" parameter:parameter success:^(id responseObject) {
             [ZFToast ShowWithMessage:@"发布成功"];
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -114,4 +121,11 @@
     }
 }
 
+- (NSMutableArray<SLFriendsModel *> *)selFriendsArr {
+    if (!_selFriendsArr) {
+        _selFriendsArr = [NSMutableArray array];
+    }
+    return _selFriendsArr;
+}
+
 @end

+ 6 - 0
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/Cell/SDTimeLineCell.m

@@ -235,6 +235,11 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
     .LeeAddTextColor(NIGHT , SLColor(@"#8E8E93"));
 }
 
+-  (void)setDidClickCommentLabelBlock:(void (^)(NSString *, CGRect, NSIndexPath *))didClickCommentLabelBlock {
+    _didClickCommentLabelBlock = didClickCommentLabelBlock;
+    _commentView.didClickCommentLabelBlock = _didClickCommentLabelBlock;
+}
+
 - (void)dealloc
 {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -286,6 +291,7 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
     
     _timeLabel.text = model.time;
     _operationLikeButton.selected = _model.isLike;
+    _commentView.indexPath = self.indexPath;
 }
 
 - (void)setFrame:(CGRect)frame

+ 3 - 1
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/CommentView/SDTimeLineCellCommentView.h

@@ -32,8 +32,10 @@
 
 @interface SDTimeLineCellCommentView : UIView
 
+@property (nonatomic, strong) NSIndexPath *indexPath;
+
 - (void)setupWithLikeItemsArray:(NSArray *)likeItemsArray commentItemsArray:(NSArray *)commentItemsArray;
 
-@property (nonatomic, copy) void (^didClickCommentLabelBlock)(NSString *commentId, CGRect rectInWindow);
+@property (nonatomic, copy) void (^didClickCommentLabelBlock)(NSString *commentId, CGRect rectInWindow, NSIndexPath *indexPath);
 
 @end

+ 21 - 6
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/CommentView/SDTimeLineCellCommentView.m

@@ -156,7 +156,7 @@
     }
     
     _likeLabel.attributedText = [attributedText copy];
-    _likeLabel.backgroundColor = [UIColor yellowColor];
+//    _likeLabel.backgroundColor = [UIColor yellowColor];
     _likeLabel.userInteractionEnabled = YES;
     [_likeLabel addTapWithBlock:^{
         NSLog(@"------_likeLabel Tap");
@@ -233,17 +233,32 @@
         .topSpaceToView(lastTopView, topMargin)
         .autoHeightRatio(0);
         
-        label.isAttributedContent = YES;
+//        label.isAttributedContent = YES;
         lastTopView = label;
         WS(weakSelf);
-//        [label addTapWithBlock:^{
-//            NSLog(@"---------commentItemsArray");
-//        }];
+        
+        [label addTapWithBlock:^{
+            NSLog(@"%ld---------commentItemsArray",i);
+            if (weakSelf.didClickCommentLabelBlock) {
+                weakSelf.didClickCommentLabelBlock(@"123", CGRectZero, [NSIndexPath indexPathForRow:self.indexPath.row inSection:i]);
+            }
+        }];
     }
     
     [self setupAutoHeightWithBottomView:lastTopView bottomMargin:6];
 }
 
+- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
+    // 1.这是当前点击的视图,如果没有找到合适的响应操作的视图,则直接返回这个
+    UIView *hitView = [super hitTest:point withEvent:event];
+//    NSLog(@"---%@",hitView);
+    if(hitView == self){
+        return nil;
+    }
+    return hitView;
+}
+
+
 - (void)setFrame:(CGRect)frame
 {
     [super setFrame:frame];
@@ -263,7 +278,7 @@
     if (model.replyUserName) {
         [attString setAttributes:@{NSLinkAttributeName : model.friendId} range:[text rangeOfString:model.replyUserName]];
     }
-    [attString setAttributes:@{NSLinkAttributeName : model.content} range:[text rangeOfString:model.content]];
+//    [attString setAttributes:@{NSLinkAttributeName : model.content, NSForegroundColorAttributeName : SLColor(@"#384962"), NSFontAttributeName : [UIFont systemFontOfSize:12]} range:[text rangeOfString:model.content]];
     return attString;
 }
 

+ 1 - 1
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/TimeLineRefreshFooter/SDTimeLineRefreshFooter.m

@@ -31,7 +31,7 @@
 - (void)addToScrollView:(UIScrollView *)scrollView refreshOpration:(void (^)())refrsh
 {
     self.scrollView = scrollView;
-//    self.refreshBlock = refrsh;
+    self.refreshBlock = refrsh;
 }
 
 - (void)setupView