Browse Source

整合工具类功能

Steven 1 year ago
parent
commit
dfe1cfb7da
100 changed files with 136 additions and 11099 deletions
  1. 22 575
      KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj
  2. 7 2
      KulexiuForStudent/KulexiuForStudent/AppDelegate.m
  3. 0 22
      KulexiuForStudent/KulexiuForStudent/Assets.xcassets/Mine/Feedback/sort_down.imageset/Contents.json
  4. BIN
      KulexiuForStudent/KulexiuForStudent/Assets.xcassets/Mine/Feedback/sort_down.imageset/sort_down@2x.png
  5. BIN
      KulexiuForStudent/KulexiuForStudent/Assets.xcassets/Mine/Feedback/sort_down.imageset/sort_down@3x.png
  6. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/BaseViewController.h
  7. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/CustomNavViewController.m
  8. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/CustomTabBarController.m
  9. 0 413
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSAQRecordManager.m
  10. 28 26
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSAccompanyWebViewController.m
  11. 0 17
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseModel.h
  12. 0 13
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseModel.m
  13. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseViewController.h
  14. 4 4
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseViewController.m
  15. 1 3
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseWKWebViewController.h
  16. 15 15
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseWKWebViewController.m
  17. 0 20
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSDocument.m
  18. 0 62
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSDocumentViewController.m
  19. 0 48
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSICloudManager.m
  20. 0 51
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSJXBodyView.m
  21. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSLocalWebViewController.m
  22. 3 24
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h
  23. 7 32
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m
  24. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSPublicAlertView.m
  25. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSTabBarViewController.m
  26. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSTipsAlert.m
  27. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSUpdateAlert.m
  28. 0 274
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSUploadManager.m
  29. 0 539
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSVideoRecordManager.m
  30. 0 23
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebBackButton.h
  31. 0 60
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebBackButton.m
  32. 0 24
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebNavView.h
  33. 0 63
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebNavView.m
  34. 0 290
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebSocketManager.m
  35. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/LoadingManager/KSHudLoagingManager.m
  36. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/KSLoginManager.m
  37. 0 134
      KulexiuForStudent/KulexiuForStudent/Common/Base/RecordCheckManager.m
  38. 0 149
      KulexiuForStudent/KulexiuForStudent/Common/Base/UINavigationController+KSNavigationBar.m
  39. 0 23
      KulexiuForStudent/KulexiuForStudent/Common/Base/UIViewController+KSExtension.m
  40. 0 32
      KulexiuForStudent/KulexiuForStudent/Common/Base/WeakWebViewScriptMessageDelegate.m
  41. BIN
      KulexiuForStudent/KulexiuForStudent/Common/Base/banzou.mp3
  42. 0 48
      KulexiuForStudent/KulexiuForStudent/Common/Base/kSJXCollectionView.m
  43. 17 4
      KulexiuForStudent/KulexiuForStudent/Common/Define/Common.h
  44. 2 0
      KulexiuForStudent/KulexiuForStudent/Common/Define/KSDomain.h
  45. 8 21
      KulexiuForStudent/KulexiuForStudent/Common/Define/PrefixHeader.pch
  46. 11 10
      KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSMediaMergeView.m
  47. 0 327
      KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/MediaEditor/KSMediaEditor.m
  48. 0 97
      KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/MusicPlayer/AVPlayer+KSSeekSmoothly.m
  49. 0 457
      KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/MusicPlayer/kSNewPlayer.m
  50. 0 25
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarCell.h
  51. 0 107
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarCell.m
  52. 0 33
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarCollectionView.h
  53. 0 211
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarCollectionView.m
  54. 0 66
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarConfig.h
  55. 0 13
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarConfig.m
  56. 0 32
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarDate.h
  57. 0 31
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarDate.m
  58. 0 42
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarHeader.h
  59. 0 192
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarHeader.m
  60. 0 39
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarHelper.h
  61. 0 285
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarHelper.m
  62. 0 23
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarManager.h
  63. 0 22
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarManager.m
  64. 0 90
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarPicker.h
  65. 0 453
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarPicker.m
  66. 0 24
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/UIView+ALFrame.h
  67. 0 84
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/UIView+ALFrame.m
  68. 0 206
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/DZSegmentCtrl/DZNSegmentedControl.h
  69. 0 973
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/DZSegmentCtrl/DZNSegmentedControl.m
  70. 0 41
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/KLTAnimateNav/AnimationContoller.h
  71. 0 236
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/KLTAnimateNav/AnimationContoller.m
  72. 0 15
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/KLTAnimateNav/KLTNavigationController.h
  73. 0 317
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/KLTAnimateNav/KLTNavigationController.m
  74. 0 167
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseActionSheet.m
  75. 0 35
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseActionSheetCell.m
  76. 0 416
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseBaseViewController.m
  77. 0 69
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseCollectionViewCell.m
  78. 0 52
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseLoadingImageView.m
  79. 0 62
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseLocalViewController.m
  80. 0 13
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseModel.m
  81. 0 101
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseNetworkViewController.m
  82. 0 73
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseRemindView.m
  83. 0 111
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseZoomScrollView.m
  84. 0 24
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/UIImage+MSSScale.m
  85. 0 76
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/UIView+MSSLayout.m
  86. BIN
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/mss_browseLoading@2x.png
  87. BIN
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/mss_browseLoading@3x.png
  88. 0 560
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SCIndexView/SCIndexView.m
  89. 0 115
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SCIndexView/SCIndexViewConfiguration.m
  90. 0 193
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SCIndexView/UITableView+SCIndexView.m
  91. 0 30
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/PageControl/TAAbstractDotView.m
  92. 0 88
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/PageControl/TAAnimatedDotView.m
  93. 0 63
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/PageControl/TADotView.m
  94. 0 364
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/PageControl/TAPageControl.m
  95. 0 30
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/QWdynamicModel.h
  96. 0 13
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/QWdynamicModel.m
  97. 0 128
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/SDCollectionViewCell.m
  98. 0 811
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/SDCycleScrollView.m
  99. 0 16
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/SDQWMaskCustomModel.h
  100. 0 16
      KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/SDQWMaskCustomModel.m

File diff suppressed because it is too large
+ 22 - 575
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj


+ 7 - 2
KulexiuForStudent/KulexiuForStudent/AppDelegate.m

@@ -11,7 +11,7 @@
 #import <AppTrackingTransparency/AppTrackingTransparency.h>
 #import "KSUpdateManager.h"
 #import "KSUpdateAlert.h"
-#import "KSNetworkAccessibleManager.h"
+#import <KSToolLibrary/KSNetworkAccessibleManager.h>
 #import <Bugly/Bugly.h>
 
 #import <UMCommon/UMCommon.h>
@@ -25,7 +25,7 @@
 #import <UserNotifications/UserNotifications.h>
 #endif
 
-#import "UrlDecode.h"
+#import <KSToolLibrary/UrlDecode.h>
 #import "KSBaseWKWebViewController.h"
 #import "UserInfoManager.h"
 
@@ -84,6 +84,7 @@
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     // Override point for customization after application launch.
+    [self configCertConfig];
     [self networkEnableCheck];
     [self initTXRTCConfig];
     [self registerSDK];
@@ -144,6 +145,10 @@
     return YES;
 }
 
+- (void)configCertConfig {
+    [KSNetworkingManager configCertConfig];
+}
+
 - (void)refreshThemeColorAndConfig {
     // 全局配置光标颜色
     NSLog(@"------ %zd",[UserDefaultObjectForKey(TENANT_ID) integerValue]);

+ 0 - 22
KulexiuForStudent/KulexiuForStudent/Assets.xcassets/Mine/Feedback/sort_down.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "sort_down@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "sort_down@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
KulexiuForStudent/KulexiuForStudent/Assets.xcassets/Mine/Feedback/sort_down.imageset/sort_down@2x.png


BIN
KulexiuForStudent/KulexiuForStudent/Assets.xcassets/Mine/Feedback/sort_down.imageset/sort_down@3x.png


+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/BaseViewController.h

@@ -6,7 +6,7 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "UINavigationController+KSNavigationBar.h"
+#import <KSToolLibrary/UINavigationController+KSNavigationBar.h>
 
 NS_ASSUME_NONNULL_BEGIN
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/CustomNavViewController.m

@@ -6,7 +6,7 @@
 //
 
 #import "CustomNavViewController.h"
-#import "UIImage+Color.h"
+#import <KSToolLibrary/UIImage+Color.h>
 
 @interface CustomNavViewController ()<UIGestureRecognizerDelegate, UINavigationControllerDelegate>
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/CustomTabBarController.m

@@ -8,7 +8,7 @@
 #import "CustomTabBarController.h"
 #import "CustomNavViewController.h"
 #import "KSBaseViewController.h"
-#import "UIImage+Color.h"
+#import <KSToolLibrary/UIImage+Color.h>
 
 @interface CustomTabBarController ()
 

+ 0 - 413
KulexiuForStudent/KulexiuForStudent/Common/Base/KSAQRecordManager.m

@@ -1,413 +0,0 @@
-//
-//  KSAQRecordManager.m
-//  TeacherDaya
-//
-//  Created by Kyle on 2021/6/9.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import "KSAQRecordManager.h"
-#import <AVFoundation/AVFoundation.h>
-#import "NSDate+Extension.h"
-
-static const int kNumberBuffers = 3;
-
-
-@interface KSAQRecordManager ()
-
-@property (nonatomic, assign) SInt64 currPacket;
-@property (nonatomic) dispatch_queue_t queue;
-@property (nonatomic) AudioStreamBasicDescription asBasicDesc;
-@property (nonatomic) AudioQueueRef audioQueue;
-@property (nonatomic) UInt32 bufferSize;
-@property (nonatomic, assign) double sampleTime;
-@property (nonatomic, assign) double sampleRate;
-
-@property (nonatomic, strong) NSMutableData *audioData;
-
-@end
-
-@implementation KSAQRecordManager
-{
-    AudioQueueBufferRef mBuffers[kNumberBuffers];
-}
-
-- (instancetype)init {
-    if (self = [super init]) {
-        [self initFilePath];
-        _queue = dispatch_queue_create("ks.AQRecordManager", DISPATCH_QUEUE_SERIAL);
-        [self getAudioSessionProperty];
-        [self setupAudioFormat];
-        dispatch_async(_queue, ^{
-            [self setupAudioQueue];
-            [self allocateBuffers];
-        });
-    }
-    return self;
-}
-
-- (void)setupAudioFormat {
-    UInt32 mChannelsPerFrame = 1;
-    _asBasicDesc.mFormatID = kAudioFormatLinearPCM;
-    _asBasicDesc.mSampleRate = 44100;
-    _asBasicDesc.mChannelsPerFrame = mChannelsPerFrame;
-    //pcm数据范围(−2^16 + 1) ~ (2^16 - 1)
-    _asBasicDesc.mBitsPerChannel = 16;
-    //16 bit = 2 byte
-    _asBasicDesc.mBytesPerPacket = mChannelsPerFrame * 2;
-    //下面设置的是1 frame per packet, 所以 frame = packet
-    _asBasicDesc.mBytesPerFrame = mChannelsPerFrame * 2;
-    _asBasicDesc.mFramesPerPacket = 1;
-    _asBasicDesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
-}
-
-- (void)setupAudioQueue {
-    void *handle = (__bridge void *)self;
-    OSStatus status = AudioQueueNewInput(&_asBasicDesc, inputCallback, handle, NULL, NULL, 0, &_audioQueue);
-    if (status != noErr) {
-        //    printf("AudioQueueNewInput: %d \n", (int)status);
-    }
-}
-- (void)allocateBuffers {
-//    _bufferSize = _sampleRate * _sampleTime * _asBasicDesc.mBytesPerPacket * 10;
-    _bufferSize = _sampleRate * _sampleTime * _asBasicDesc.mBytesPerPacket;
-    for (int i = 0; i < kNumberBuffers; ++i) {
-        AudioQueueBufferRef buffer;
-        OSStatus status = AudioQueueAllocateBuffer(_audioQueue, _bufferSize, &buffer);
-        if (status != noErr) {
-            //        printf("recorder alloc buffer: %d, _bufferSize:%u \n", (int)status, (unsigned int)_bufferSize);
-        }
-        mBuffers[i] = buffer;
-    }
-}
-- (void)enqueueBuffers {
-    for (int i = 0; i < kNumberBuffers; ++i) {
-        AudioQueueBufferRef buffer = mBuffers[i];
-        //需要将创建好的buffer给audio queue
-        OSStatus status = AudioQueueEnqueueBuffer(_audioQueue, buffer, 0, NULL);
-        if (status != noErr) {
-            //        printf("AudioQueueEnqueueBuffer: %d \n", (int)status);
-        }
-    }
-}
-- (void)getAudioSessionProperty {
-
-    AVAudioSession *audioSession = [AVAudioSession sharedInstance];
-    _sampleTime = audioSession.IOBufferDuration;
-    _sampleRate = 44100;
-}
-
-#pragma mark ----- KSAudioSessionManagerDelegate
-
-- (BOOL)canDeviceOpenMicrophone {
-    //判断应用是否有使用麦克风的权限
-    NSString *mediaType = AVMediaTypeAudio;//读取媒体类型
-    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];//读取设备授权状态
-    BOOL result = NO;
-    switch (authStatus) {
-        case AVAuthorizationStatusRestricted:
-            result = NO;
-            break;
-        case AVAuthorizationStatusDenied:
-            result = NO;
-            break;
-        case AVAuthorizationStatusAuthorized:
-            result = YES;
-            break;
-        default:
-            result = NO;
-            break;
-    }
-    return result;
-}
-
-- (void)checkAudioAuthorization:(void (^)(int code, NSString *message))completeBlock {
-    BOOL result = [self canDeviceOpenMicrophone];
-    if (result) {
-        completeBlock(0, @"可以使用麦克风");
-        return;
-    }
-    dispatch_suspend(_queue);
-    [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted) {
-        if (granted == NO) {
-            completeBlock(-1, @"用户拒绝使用麦克风");
-        }else {
-            completeBlock(0, @"可以使用麦克风");
-        }
-        dispatch_resume(self.queue);
-    }];
-}
-#pragma mark - public
-- (void)startRecord {
-    [self checkAudioAuthorization:^(int code, NSString *message) {
-        NSLog(@"checkAudioAuthorization code: %d, message: %@", code, message);
-    }];
-    dispatch_async(_queue, ^{
-        self.audioData = [NSMutableData data];
-        [self enqueueBuffers];
-        //start audio queue
-        
-        OSStatus status = AudioQueueStart(self.audioQueue, NULL);
-        if (status == noErr) {
-            self.isRunning = YES;
-            NSDate *date = [NSDate date];
-            NSTimeInterval inteveral = [date timeIntervalSince1970];
-            if (self.delegate && [self.delegate respondsToSelector:@selector(recordDidStart:)]) {
-                [self.delegate recordDidStart:inteveral*1000];
-            }
-        }
-    });
-}
-- (void)stopRecord {
-    dispatch_async(_queue, ^{
-        //stop audio queue
-        
-        OSStatus status = AudioQueueStop(self.audioQueue, true);
-        if (status == noErr) {
-            self.isRunning = NO;
-        }
-        AudioQueueDispose(self.audioQueue, true);
-        // 写入文件头
-        [self writeWAVHeader];
-    });
-}
-
-- (void)pauserRecord {
-    dispatch_async(_queue, ^{
-        //pause audio queue
-        OSStatus status = AudioQueuePause(self.audioQueue);
-        if (status == noErr) {
-            self.isRunning = NO;
-        }
-        printf("AudioQueuePause: %d \n", (int)status);
-    });
-}
-
-- (void)resumeRecord {
-    dispatch_async(_queue, ^{
-        //start audio queue
-        OSStatus status = AudioQueueStart(self.audioQueue, NULL);
-        if (status == noErr) {
-            self.isRunning = YES;
-        }
-    });
-}
-
-- (void)freeBuffer {
-    for (int i = 0; i < kNumberBuffers; ++i) {
-        AudioQueueBufferRef buffer = self->mBuffers[i];
-        AudioQueueFreeBuffer(self.audioQueue, buffer);
-    }
-}
-
-- (void)freeAudioQueue {
-    dispatch_async(_queue, ^{
-        if (self.isRunning) {
-            self.isRunning = NO;
-            OSStatus stopStatus = AudioQueueStop(self.audioQueue, true);
-            if (stopStatus != noErr) { // error
-                [self freeBuffer];
-            }
-        }
-        OSStatus status = AudioQueueDispose(self.audioQueue, true);
-        if (status != noErr) { // error
-            //    NSLog(@"AudioQueueDispose:%d", status);
-        }
-    });
-}
-
-#pragma mark - c functions
-static void inputCallback(void * inUserData,
-                          AudioQueueRef inAQ,
-                          AudioQueueBufferRef inBuffer,
-                          const AudioTimeStamp * inStartTime,
-                          UInt32 inNumberPacketDescriptions,
-                          const AudioStreamPacketDescription *inPacketDescs) {
-    
-    KSAQRecordManager *recorder = (__bridge KSAQRecordManager *)inUserData;
-    if (recorder.isRunning == NO) {
-        return;
-    }
-    //    printf("recorder enqueue buffer time: %f \n", inStartTime->mSampleTime / recorder.asBasicDesc.mSampleRate);
-    if (inNumberPacketDescriptions > 0) {
-        // 保存音频数据
-        [recorder handerRecordBuffer:inBuffer withQueue:inAQ];
-        //消费音频数据
-        if ([recorder.delegate respondsToSelector:@selector(audioRecord:didRecordAudioData:length:)]) {
-            [recorder.delegate audioRecord:recorder didRecordAudioData:inBuffer->mAudioData length:inBuffer->mAudioDataByteSize];
-        }
-    }
-    
-    //将buffer给audio queue
-    OSStatus status = AudioQueueEnqueueBuffer(recorder.audioQueue, inBuffer, 0, NULL);
-    if (status != noErr) {
-        //        printf("recorder enqueue buffer: %d \n", (int)status);
-    }
-}
-
-
-- (void)handerRecordBuffer:(AudioQueueBufferRef)inBuffer withQueue:(AudioQueueRef)inAudioQueue {
-    NSData *data = [NSData dataWithBytes:inBuffer->mAudioData length:inBuffer->mAudioDataByteSize];
-    [self.audioData appendData:data];
-}
-
-- (void)initFilePath {
-    NSString *floderPath = [self createAudioSaveFolder];
-    NSFileManager *fileManager = [NSFileManager defaultManager];
-    BOOL isDir = FALSE;
-    BOOL isDirExist = [fileManager fileExistsAtPath:floderPath isDirectory:&isDir];
-    if(!(isDirExist && isDir)) {
-        BOOL bCreateDir = [fileManager createDirectoryAtPath:floderPath withIntermediateDirectories:YES attributes:nil error:nil];
-        if(!bCreateDir){
-            NSLog(@"创建文件夹失败!");
-        }
-        NSLog(@"创建文件夹成功,文件路径%@",floderPath);
-    }
-}
-
-+ (AUDIODEVICE_TYPE)queryAudioOutputDeviceType {
-    
-    return [KSAudioSessionManager queryAudioOutputDevice];
-}
-
-
-- (NSURL *)audioUrl {
-    
-    if (!_audioUrl) {
-        NSString *filePath = [self findFilePath];
-        _audioUrl = [NSURL fileURLWithPath:filePath];
-    }
-    return _audioUrl;
-}
-
-- (NSString *)findFilePath {
-    NSString *folderPath = [self createAudioSaveFolder];
-    NSString *filePath = [folderPath stringByAppendingPathComponent:@"recordAudio.wav"];
-    return filePath;
-}
-
-- (NSString *)createAudioSaveFolder {
-    NSString *folderPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject] stringByAppendingPathComponent:@"AccompanyAudioData"];
-    return folderPath;
-}
-- (void)dealloc {
-    
-    NSLog(@"dealloc -----KSAQRecordManager!!");
-}
-
- 
-- (void)writeWAVHeader {
-    NSString *filePath = [self findFilePath];
-    NSFileManager *manager = [NSFileManager defaultManager];
-
-    if (![manager fileExistsAtPath:filePath]) {
-        [manager removeItemAtPath:filePath error:nil];
-    }
-    [manager createFileAtPath:filePath contents:nil attributes:nil];
-
-    NSData *recordData = self.audioData;
-    short NumChannels = 1;       //录音通道数
-    short BitsPerSample = 16;    //线性采样位数
-    int SamplingRate = 44100;     //录音采样率(Hz)
-    int numOfSamples = (int)recordData.length;
-    
-    int ByteRate = NumChannels*BitsPerSample*SamplingRate/8;
-    short BlockAlign = NumChannels*BitsPerSample/8;
-    int DataSize = NumChannels*numOfSamples*BitsPerSample/8;
-    int chunkSize = 16;
-    int totalSize = 46 + DataSize;
-    short audioFormat = 1;
-    
-    FILE *wavFile = fopen([filePath cStringUsingEncoding:NSASCIIStringEncoding], "wb");
-    if (wavFile) {
-        fwrite("RIFF", sizeof(char), 4,wavFile);
-        fwrite(&totalSize, sizeof(int), 1, wavFile);
-        fwrite("WAVE", sizeof(char), 4, wavFile);
-        fwrite("fmt ", sizeof(char), 4, wavFile);
-        fwrite(&chunkSize, sizeof(int),1,wavFile);
-        fwrite(&audioFormat, sizeof(short), 1, wavFile);
-        fwrite(&NumChannels, sizeof(short),1,wavFile);
-        fwrite(&SamplingRate, sizeof(int), 1, wavFile);
-        fwrite(&ByteRate, sizeof(int), 1, wavFile);
-        fwrite(&BlockAlign, sizeof(short), 1, wavFile);
-        fwrite(&BitsPerSample, sizeof(short), 1, wavFile);
-        fwrite("data", sizeof(char), 4, wavFile);
-        fwrite(&DataSize, sizeof(int), 1, wavFile);
-        
-        fclose(wavFile);
-        NSFileHandle *handle;
-        handle = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
-        [handle seekToEndOfFile];
-        // self.recordedData 为需要保存的pcm数据
-        [handle writeData:recordData];
-        [handle closeFile];
-    }
-}
-
-/*
-- (NSData*)GetWavheadData:(NSInteger)totalAudioLen totalDataLen:(NSInteger)totalDataLen longSampleRate:(NSInteger)longSampleRate channels:(NSInteger)channels byteRate:(NSInteger)byteRate{
-    
-    Byte header[44];
-    //4byte,资源交换文件标志:RIFF
-    header[0] = 'R';  // RIFF/WAVE header
-    header[1] = 'I';
-    header[2] = 'F';
-    header[3] = 'F';
-    //4byte,从下个地址到文件结尾的总字节数
-    header[4] = (Byte) (totalDataLen & 0xff);  //file-size (equals file-size - 8)
-    header[5] = (Byte) ((totalDataLen >> 8) & 0xff);
-    header[6] = (Byte) ((totalDataLen >> 16) & 0xff);
-    header[7] = (Byte) ((totalDataLen >> 24) & 0xff);
-    //4byte,wav文件标志:WAVE
-    header[8] = 'W';  // Mark it as type "WAVE"
-    header[9] = 'A';
-    header[10] = 'V';
-    header[11] = 'E';
-    //4byte,波形文件标志:FMT(最后一位空格符)
-    header[12] = 'f';  // Mark the format section 'fmt ' chunk
-    header[13] = 'm';
-    header[14] = 't';
-    header[15] = ' ';
-    //4byte,音频属性
-    header[16] = 16;   // 4 bytes: size of 'fmt ' chunk, Length of format data.  Always 16
-    header[17] = 0;
-    header[18] = 0;
-    header[19] = 0;
-    //2byte,格式种类(1-线性pcm-WAVE_FORMAT_PCM,WAVEFORMAT_ADPCM)
-    header[20] = 1;  // format = 1 ,Wave type PCM
-    header[21] = 0;
-    //2byte,通道数
-    header[22] = (Byte) channels;  // channels
-    header[23] = 0;
-    //4byte,采样率
-    header[24] = (Byte) (longSampleRate & 0xff);
-    header[25] = (Byte) ((longSampleRate >> 8) & 0xff);
-    header[26] = (Byte) ((longSampleRate >> 16) & 0xff);
-    header[27] = (Byte) ((longSampleRate >> 24) & 0xff);
-    //4byte 传输速率,Byte率=采样频率*音频通道数*每次采样得到的样本位数/8,00005622H,也就是22050Byte/s=11025*1*16/8。
-    header[28] = (Byte) (byteRate & 0xff);
-    header[29] = (Byte) ((byteRate >> 8) & 0xff);
-    header[30] = (Byte) ((byteRate >> 16) & 0xff);
-    header[31] = (Byte) ((byteRate >> 24) & 0xff);
-    //2byte   一个采样多声道数据块大小,块对齐=通道数*每次采样得到的样本位数/8,0002H,也就是2=1*16/8
-    header[32] = (Byte) (channels * 16 / 8);
-    header[33] = 0;
-    //2byte,采样精度-PCM位宽
-    header[34] = 16; // bits per sample
-    header[35] = 0;
-    //4byte,数据标志:data
-    header[36] = 'd'; //"data" marker
-    header[37] = 'a';
-    header[38] = 't';
-    header[39] = 'a';
-    //4byte,从下个地址到文件结尾的总字节数,即除了wav header以外的pcm data length(纯音频数据)
-    header[40] = (Byte) (totalAudioLen & 0xff);  //data-size (equals file-size - 44).
-    header[41] = (Byte) ((totalAudioLen >> 8) & 0xff);
-    header[42] = (Byte) ((totalAudioLen >> 16) & 0xff);
-    header[43] = (Byte) ((totalAudioLen >> 24) & 0xff);
-    
-    return [[NSData alloc] initWithBytes:header length:44];;
-}
-*/
-
-@end

+ 28 - 26
KulexiuForStudent/KulexiuForStudent/Common/Base/KSAccompanyWebViewController.m

@@ -8,23 +8,25 @@
 #import "KSAccompanyWebViewController.h"
 #import "WebViewBaseConfig.h"     // 基础配置
 #import "SwiftImportHeader.h"     // swift 桥接
+#import <KSTunerLibrary/KSTunerLibrary-Swift.h>
 
-#import "KSAudioSessionManager.h" // audio session
-#import "KSAQRecordManager.h"     // 录音
-#import "KSWebSocketManager.h"    // web socket
-#import "KSVideoRecordManager.h"  // 视频录制
-#import "KSCloudBeatView.h"       // 节拍器
-#import "MidiPlayerEngine.h"      // midi 播放
-#import "kSNewPlayer.h"           // mp3 播放器
+#import <KSToolLibrary/KSAudioSessionManager.h> // audio session
+#import <KSToolLibrary/KSAQRecordManager.h>     // 录音
+#import <KSToolLibrary/KSWebSocketManager.h>    // web socket
+#import <CloudAccompanyLibrary/KSVideoRecordManager.h>  // 视频录制
+#import <CloudAccompanyLibrary/KSCloudBeatView.h>      // 节拍器
+#import <KSToolLibrary/MidiPlayerEngine.h>      // midi 播放
+#import <CloudAccompanyLibrary/kSNewPlayer.h>          // mp3 播放器
 
 #import "AccompanyLoadingView.h"
 
 #define KSMidiSongFileKey (@"KSDownloadMidiSong")
 
 // 合成
-#import "KSMediaEditor.h"
+#import <KSToolLibrary/KSMediaEditor.h>
 #import "KSMediaMergeView.h"
 
+
 @interface KSAccompanyWebViewController ()<KSAQRecordManagerDelegate,KSAudioSessionManagerDelegate,PlayerEngineDelegate,TunerDelegate,kSNewPlayerManagerDelegate>
 
 @property (nonatomic, strong) KSAudioSessionManager *audioSessionManager;
@@ -504,7 +506,7 @@
             else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"startEvaluating"]) { // 开始评测
                 [self configRecordManager];
                 self.hasSendStartMessage = NO;
-                PREMISSIONTYPE isOk = [RecordCheckManager checkPermissionShowAlert:NO showInView:nil];
+                PREMISSIONTYPE isOk = [RecordCheckManager checkMicPermissionAvaiable];
                 if (isOk == PREMISSIONTYPE_YES) {
                     self.evaluatParm = [NSMutableDictionary dictionaryWithDictionary:parm];
                     // 如果socket 连上了
@@ -587,8 +589,8 @@
                 [self sendDataToSocketService:sendData];
             }
             else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"openCamera"]) { // 开启摄像头
-                PREMISSIONTYPE canOpenCamera = [RecordCheckManager checkCameraPremissionAvaiable:NO showInView:nil];
-                PREMISSIONTYPE albumEnable =  [RecordCheckManager checkPhotoLibraryPremissionAvaiable:NO showInView:nil];
+                PREMISSIONTYPE canOpenCamera = [RecordCheckManager checkCameraPremissionAvaiable];
+                PREMISSIONTYPE albumEnable = [RecordCheckManager checkPhotoLibraryPremissionAvaiable];
 
                 if (canOpenCamera == PREMISSIONTYPE_YES) {
                     self.isCameraOpen = YES;
@@ -609,7 +611,7 @@
                 [self postMessage:parm];
             }
             else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"startCapture"]) { // 开始录制
-                PREMISSIONTYPE isOk = [RecordCheckManager checkPhotoLibraryPremissionAvaiable:YES showInView:self.view];
+                PREMISSIONTYPE isOk = [RecordCheckManager checkPhotoLibraryPremissionAvaiable];
                 if (isOk == PREMISSIONTYPE_YES) {
                     
                     [self.videoRecordManager setIgnoreAudio:YES];
@@ -992,20 +994,20 @@
 }
 
 - (void)uploadVideoWithParm:(NSMutableDictionary *)contentParm sendParm:(NSMutableDictionary *)sendParm {
-    MJWeakSelf;
-    [self.videoRecordManager uploadRecordVideoSuccess:^(NSString * _Nonnull videoUrl) {
-        [contentParm setValue:@"success" forKey:@"type"];
-        [contentParm setValue:videoUrl forKey:@"filePath"];
-        [contentParm setValue:@"上传成功" forKey:@"message"];
-        [sendParm setValue:contentParm forKey:@"content"];
-        
-        [weakSelf postMessage:sendParm];
-    } failure:^(NSString * _Nonnull desc) {
-        [contentParm setValue:@"error" forKey:@"type"];
-        [contentParm setValue:desc forKey:@"message"];
-        [sendParm setValue:contentParm forKey:@"content"];
-        [weakSelf postMessage:sendParm];
-    }];
+//    MJWeakSelf;
+//    [self.videoRecordManager uploadRecordVideoSuccess:^(NSString * _Nonnull videoUrl) {
+//        [contentParm setValue:@"success" forKey:@"type"];
+//        [contentParm setValue:videoUrl forKey:@"filePath"];
+//        [contentParm setValue:@"上传成功" forKey:@"message"];
+//        [sendParm setValue:contentParm forKey:@"content"];
+//        
+//        [weakSelf postMessage:sendParm];
+//    } failure:^(NSString * _Nonnull desc) {
+//        [contentParm setValue:@"error" forKey:@"type"];
+//        [contentParm setValue:desc forKey:@"message"];
+//        [sendParm setValue:contentParm forKey:@"content"];
+//        [weakSelf postMessage:sendParm];
+//    }];
 }
 - (void)showAlertWithMessage:(NSString *)message type:(CHECKDEVICETYPE)deviceType {
     [KSPremissionAlert shareInstanceDisplayImage:deviceType message:message showInView:self.view cancel:^{

+ 0 - 17
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseModel.h

@@ -1,17 +0,0 @@
-//
-//  KSBaseModel.h
-//  StudentDaya
-//
-//  Created by Kyle on 2019/8/12.
-//  Copyright © 2019 DayaMusic. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface KSBaseModel : NSObject
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 13
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseModel.m

@@ -1,13 +0,0 @@
-//
-//  KSBaseModel.m
-//  StudentDaya
-//
-//  Created by Kyle on 2019/8/12.
-//  Copyright © 2019 DayaMusic. All rights reserved.
-//
-
-#import "KSBaseModel.h"
-
-@implementation KSBaseModel
-
-@end

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseViewController.h

@@ -6,7 +6,7 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "UINavigationController+KSNavigationBar.h"
+#import <KSToolLibrary/UINavigationController+KSNavigationBar.h>
 #import "StateView.h"
 #import "KSStatusView.h"
 

+ 4 - 4
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseViewController.m

@@ -7,11 +7,11 @@
 
 #import "KSBaseViewController.h"
 #import "Reachability.h"
-#import "UIButton+EnlargeEdge.h"
-#import "UIView+Hints.h"
+#import <KSToolLibrary/UIButton+EnlargeEdge.h>
+#import <KSToolLibrary/UIView+Hints.h>
 #import "LoginViewController.h"
 #import "CustomNavViewController.h"
-#import "DiskFreeSpaceManager.h"
+#import <KSToolLibrary/DiskFreeSpaceManager.h>
 #import "KSTabBarViewController.h"
 #import "KSPublicAlertView.h"
 
@@ -260,7 +260,7 @@
         hud.minSize = CGSizeMake(132.f, 108.0f);
         hud.label.textColor = [UIColor whiteColor];
         hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
-        hud.bezelView.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.8];
+        hud.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
         [hud hideAnimated:YES afterDelay:5];
         return NO;
     }

+ 1 - 3
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseWKWebViewController.h

@@ -7,9 +7,7 @@
 
 #import "KSBaseViewController.h"
 #import <WebKit/WebKit.h>
-#import "WeakWebViewScriptMessageDelegate.h"
-#import "KSWebNavView.h"
-#import "KSWebBackButton.h"
+#import <KSToolLibrary/WeakWebViewScriptMessageDelegate.h>
 
 NS_ASSUME_NONNULL_BEGIN
 

+ 15 - 15
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseWKWebViewController.m

@@ -7,7 +7,7 @@
 
 #import "KSBaseWKWebViewController.h"
 #import "WebViewBaseConfig.h" // 基础配置
-#import "UIDevice+TFDevice.h" // 横竖屏
+#import <KSToolLibrary/UIDevice+TFDevice.h> // 横竖屏
 
 // 其他web
 #import "KSLocalWebViewController.h"
@@ -21,8 +21,8 @@
 #import "KSEnterLiveroomManager.h"
 
 // 保存文件
-#import "KSICloudManager.h"
-#import "KSDocumentViewController.h"
+#import <KSToolLibrary/KSICloudManager.h>
+#import <KSToolLibrary/KSDocumentViewController.h>
 
 // 聊天页面
 #import "KSChatConversationViewController.h"
@@ -389,8 +389,8 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     }
     
     else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"openAccompanyWebView"]) { // 打开伴奏
-        PREMISSIONTYPE micEnable = [RecordCheckManager checkPermissionShowAlert:NO showInView:nil];
-        PREMISSIONTYPE cameraEnable = [RecordCheckManager checkCameraPremissionAvaiable:NO showInView:nil];
+        PREMISSIONTYPE micEnable = [RecordCheckManager checkMicPermissionAvaiable];
+        PREMISSIONTYPE cameraEnable = [RecordCheckManager checkCameraPremissionAvaiable];
         if (micEnable == PREMISSIONTYPE_YES && cameraEnable == PREMISSIONTYPE_YES) { // 如果麦克风和摄像头权限都有
             NSDictionary *valueDic = [parm ks_dictionaryValueForKey:@"content"];
             KSAccompanyWebViewController *detailCtrl = [[KSAccompanyWebViewController alloc] init];
@@ -416,7 +416,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     }
     else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"checkAlbum"]) { // 判断权限
         [self postMessage:parm];
-        PREMISSIONTYPE albumEnable = [RecordCheckManager checkPhotoLibraryPremissionAvaiable:NO showInView:nil];
+        PREMISSIONTYPE albumEnable = [RecordCheckManager checkPhotoLibraryPremissionAvaiable];
         if (albumEnable == PREMISSIONTYPE_NO) {
             [self showAlertWithMessage:@"请开启相册访问权限" type:CHECKDEVICETYPE_CAMREA];
         }
@@ -490,7 +490,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     }
     else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"savePicture"]) { // 保存图片到相册
         // 判断相册权限
-        PREMISSIONTYPE albumEnable = [RecordCheckManager checkPhotoLibraryPremissionAvaiable:NO showInView:nil];
+        PREMISSIONTYPE albumEnable = [RecordCheckManager checkPhotoLibraryPremissionAvaiable];
         if (albumEnable == PREMISSIONTYPE_YES) { // 如果有权限
             NSDictionary *valueDic = [parm ks_dictionaryValueForKey:@"content"];
             NSString *base64String = [valueDic ks_stringValueForKey:@"base64"];
@@ -656,7 +656,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     NSString *fileName = @"videoCoverImage";
     
     [LOADING_MANAGER showCustomLoading:@"上传中..."];
-    [UPLOAD_MANAGER configBucketName:@"klx"];
+    [UPLOAD_MANAGER configWithfilePath:@"/user/"];
     [UPLOAD_MANAGER uploadFile:imgData fileName:fileName fileSuffix:[UIImage typeForImageData:imgData] progress:^(int64_t bytesWritten, int64_t totalBytes) {
         // 显示进度
         int progress = (int)(bytesWritten / totalBytes * 100);
@@ -1248,7 +1248,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
             _HUD.label.text = @"正在上传视频...";
             _HUD.contentColor = [UIColor whiteColor];
             _HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
-            _HUD.bezelView.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.8];
+            _HUD.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
             _HUD.removeFromSuperViewOnHide = YES;
             
         }else{
@@ -1268,8 +1268,8 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         NSData *imgData = [UIImage turnsImaegDataByImage:image];
         [imageDataArray addObject:imgData];
     }
-    [[KSUploadManager shareInstance] configBucketName:bucket];
-    [[KSUploadManager shareInstance] mutilUploadImage:imageDataArray fileName:@"complainImg" successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+    [UPLOAD_MANAGER configWithfilePath:@"/user/"];
+    [UPLOAD_MANAGER mutilUploadImage:imageDataArray fileName:@"complainImg" successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
         [LOADING_MANAGER removeHUD];
         NSMutableArray *urlArray = [NSMutableArray array];
         for (NSString *url in fileUrlArray) {
@@ -1296,8 +1296,8 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     if (previewImage) { // 如果有第一帧
         NSData *imgData = [UIImage turnsImaegDataByImage:previewImage];
         NSString *fileName = @"videoPreviewImg";
-        [[KSUploadManager shareInstance] configBucketName:bucket];
-        [[KSUploadManager shareInstance] uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+        [UPLOAD_MANAGER configWithfilePath:@"/user/"];
+        [UPLOAD_MANAGER uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
             NSString *url = [fileUrlArray lastObject];
             imageUrl = url;
             [self submitUrlWith:imageUrl videoUrl:videoUrl];
@@ -1319,7 +1319,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     NSURL *uploadFileUrl = [NSURL fileURLWithPath:videoUrl];
     NSData *fileData = [NSData dataWithContentsOfURL:uploadFileUrl];
     NSString *suffix = [NSString stringWithFormat:@".%@",[uploadFileUrl pathExtension]];
-    [[KSUploadManager shareInstance] videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
+    [UPLOAD_MANAGER videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
         dispatch_main_async_safe(^{
             // 显示进度
             if (self.HUD) {
@@ -1394,7 +1394,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         [LOADING_MANAGER showHUD];
         NSString *suffix = [NSString stringWithFormat:@".%@",[[fileName componentsSeparatedByString:@"."] lastObject]];
         NSData *fileData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:fileUrl]];
-        [UPLOAD_MANAGER configBucketName:self.bucketName];
+        [UPLOAD_MANAGER configWithfilePath:@"/user/"];
         [UPLOAD_MANAGER uploadFile:fileData fileName:@"file" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
             int progress = (int)(bytesWritten / totalBytes * 100);
             __block NSString *tipsMessage = [NSString stringWithFormat:@"上传中 %d%%",progress];

+ 0 - 20
KulexiuForStudent/KulexiuForStudent/Common/Base/KSDocument.m

@@ -1,20 +0,0 @@
-//
-//  KSDocument.m
-//  TeacherDaya
-//
-//  Created by Kyle on 2020/11/26.
-//  Copyright © 2020 DayaMusic. All rights reserved.
-//
-
-#import "KSDocument.h"
-
-@implementation KSDocument
-
-- (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError * _Nullable __autoreleasing *)outError {
-    
-    self.data = contents;
-    
-    return YES;
-}
-
-@end

+ 0 - 62
KulexiuForStudent/KulexiuForStudent/Common/Base/KSDocumentViewController.m

@@ -1,62 +0,0 @@
-//
-//  KSDocumentViewController.m
-//  TeacherDaya
-//
-//  Created by Kyle on 2020/11/26.
-//  Copyright © 2020 DayaMusic. All rights reserved.
-//
-
-#import "KSDocumentViewController.h"
-
-@interface KSDocumentViewController ()
-
-@end
-
-@implementation KSDocumentViewController
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
-    [[UITabBar appearance] setTranslucent:YES];
-}
-
-- (void)viewWillAppear:(BOOL)animated {
-    [super viewWillAppear:animated];
-    [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:THEMECOLOR} forState:UIControlStateNormal];
-    [[UIButton appearance] setTintColor:THEMECOLOR];
-    
-    [UIImageView appearance].tintColor = THEMECOLOR;
-    [[UITabBar appearance] setTintColor:THEMECOLOR];
-    [UIView appearanceWhenContainedInInstancesOfClasses:@[[self class]]].tintColor = THEMECOLOR;
-}
-
--(void)viewWillDisappear:(BOOL)animated
-{
-    [super viewWillDisappear:animated];
-    [[UIButton appearance] setTintColor:HexRGB(0x000000)];
-    [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:HexRGB(0x000000)} forState:UIControlStateNormal];
-    [UIImageView appearance].tintColor = self.view.tintColor;
-    [[UITabBar appearance] setTintColor:self.view.tintColor];
-    [UIView appearanceWhenContainedInInstancesOfClasses:@[[self class]]].tintColor = self.view.tintColor;
-}
-
-- (void)viewDidDisappear:(BOOL)animated {
-    [super viewDidDisappear:animated];
-}
- 
--(void)dealloc
-{
-    [[UITabBar appearance] setTranslucent:NO];
-}
-
-/*
-#pragma mark - Navigation
-
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
-}
-*/
-
-@end

+ 0 - 48
KulexiuForStudent/KulexiuForStudent/Common/Base/KSICloudManager.m

@@ -1,48 +0,0 @@
-//
-//  KSICloudManager.m
-//  TeacherDaya
-//
-//  Created by Kyle on 2020/11/26.
-//  Copyright © 2020 DayaMusic. All rights reserved.
-//
-
-#import "KSICloudManager.h"
-#import "KSDocument.h"
-
-@implementation KSICloudManager
-
-+ (BOOL)iCloudEnable {
-    
-    NSFileManager *manager = [NSFileManager defaultManager];
-    
-    NSURL *url = [manager URLForUbiquityContainerIdentifier:nil];
-
-    if (url != nil) {
-        
-        return YES;
-    }
-    
-    NSLog(@"iCloud 不可用");
-    return NO;
-}
-
-+ (void)downloadWithDocumentURL:(NSURL*)url callBack:(downloadBlock)block {
-    
-    KSDocument *iCloudDoc = [[KSDocument alloc] initWithFileURL:url];
-    
-    [iCloudDoc openWithCompletionHandler:^(BOOL success) {
-        if (success) {
-            
-            [iCloudDoc closeWithCompletionHandler:^(BOOL success) {
-                NSLog(@"关闭成功");
-            }];
-            
-            if (block) {
-                block(iCloudDoc.data);
-            }
-            
-        }
-    }];
-}
-
-@end

+ 0 - 51
KulexiuForStudent/KulexiuForStudent/Common/Base/KSJXBodyView.m

@@ -1,51 +0,0 @@
-//
-//  KSJXBodyView.m
-//  TeacherDaya
-//
-//  Created by Kyle on 2021/8/31.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import "KSJXBodyView.h"
-
-@implementation KSJXBodyView
-
-- (void)beginFirstRefresh {
-    
-}
-
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
-    !self.scrollCallback ?: self.scrollCallback(scrollView);
-}
-#pragma mark - JXPagingViewListViewDelegate
-
-- (UIView *)listView {
-    return self;
-}
-
-- (UIScrollView *)listScrollView {
-    return self.tableView;
-}
-
-- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
-    self.scrollCallback = callback;
-}
-
-- (void)listDidAppear {
-    NSLog(@"listDidAppear");
-}
-
-- (void)listDidDisappear {
-    NSLog(@"listDidDisappear");
-}
-
-
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect {
-    // Drawing code
-}
-*/
-
-@end

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSLocalWebViewController.m

@@ -7,7 +7,7 @@
 //
 
 #import "KSLocalWebViewController.h"
-#import "WeakWebViewScriptMessageDelegate.h"
+#import <KSToolLibrary/WeakWebViewScriptMessageDelegate.h>
 
 
 @interface KSLocalWebViewController ()<WKUIDelegate,WKNavigationDelegate,WKScriptMessageHandler,UIDocumentInteractionControllerDelegate>

+ 3 - 24
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h

@@ -6,13 +6,13 @@
 //
 
 #import <Foundation/Foundation.h>
-#import "VoNetWorking.h"
-#import "UIImage+ResizeImage.h"
-#import "CustomNavViewController.h"
+#import <KSToolLibrary/VoNetWorking.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface KSNetworkingManager : NSObject
+// 认证相关
++ (void)configCertConfig;
 
 + (void)addHeader:(NSString *)headValue forKey:(NSString *)headKey;
 
@@ -46,28 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
 // 获取上传签名
 // /open/getUploadSign
 + (void)getTXCosUploadSignRequest:(NSString *)post fileName:(NSString *)fileName keyName:(NSString *)keyName bucketName:(NSString *)bucketName success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
-#pragma mark ---- 图片上传
-/**
- 图片上传
- 
- @param post post
- @param pics 图片的数组
- @param success 成功
- @param faliure 失败
- */
-+ (void)multiImageUpload:(NSString *)post imgDataArray:(NSArray *)pics success:(void(^)(NSArray *dics))success faliure:(void(^)(NSError *error))faliure;
 
-#pragma mark ----- 视频文件上传
-/**
- 视频文件上传
-
- @param post post
- @param fileData 文件data
- @param progress 进度
- @param success 成功
- @param faliure 失败
- */
-+ (void)videoFileUpload:(NSString *)post fileData:(NSData *)fileData progress:(void(^)(int64_t bytesWritten,int64_t totalBytes))progress success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
 #pragma mark ----- 文件下载
 // 单文件下载

+ 7 - 32
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m

@@ -13,6 +13,10 @@
 #import "UserInfoManager.h"
 
 @implementation KSNetworkingManager
+// 认证相关
++ (void)configCertConfig {
+    [VoNetworking configCertificatePath:CERT_PATH baseHost:hostURL needAuth:SSL_AUTH];
+}
 
 + (void)addHeader:(NSString *)headValue forKey:(NSString *)headKey {
     [[VoNetworking sharedManager] addHttpHeader:headValue forKey:headKey];
@@ -172,7 +176,8 @@
 + (void)logOutWithType:(BOOL)isDisable {
     // 移除所有的loadView
     [[VoNetworking sharedManager] cancleAllRequest];
-    [MBProgressHUD hideHUD];
+    [LOADING_MANAGER removeCustomLoading];
+    [LOADING_MANAGER removeHUD];
     if (isDisable) {
         [self showMessage:@"登录过期,请重新登录"];
     }
@@ -208,7 +213,7 @@
     hud.minSize = CGSizeMake(132.f, 60.0f);
     hud.label.textColor = [UIColor whiteColor];
     hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
-    hud.bezelView.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.8];
+    hud.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
     [hud hideAnimated:YES afterDelay:2];
 }
 
@@ -367,37 +372,7 @@
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
 }
 
-#pragma mark ---- 图片上传
-/**
- 图片上传
- 
- @param post post
- @param pics 图片的数组
- @param success 成功
- @param faliure 失败
- */
-+ (void)multiImageUpload:(NSString *)post imgDataArray:(NSArray *)pics success:(void(^)(NSArray *dics))success faliure:(void(^)(NSError *error))faliure {
-    NSString* url = [NSString stringWithFormat:@"%@%@",hostURL,@"/api-student/uploadFile"];
-    NSString *type = [UIImage typeForImageData:[pics lastObject]];
-    [self uploadMultiFileWithFileArray:pics andWithUrl:url parameters:nil type:type name:@"file" mimeType:[NSString stringWithFormat:@"Image/%@",type] progress:nil success:success faliure:faliure];
-}
 
-#pragma mark ----- 视频文件上传
-/**
- 视频文件上传
-
- @param post post
- @param fileData 文件data
- @param progress 进度
- @param success 成功
- @param faliure 失败
- */
-+ (void)videoFileUpload:(NSString *)post fileData:(NSData *)fileData progress:(void(^)(int64_t bytesWritten,int64_t totalBytes))progress success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure; {
-    [self configRequestMethodJSON];
-    NSString* url = [NSString stringWithFormat:@"%@%@",hostURL,@"/api-student/uploadFile"];
-    
-    [self uploadFileWithFileData:fileData andWithUrl:url parameters:nil type:@".mp4" name:@"file" mimeType:[NSString stringWithFormat:@"Image/.mp4"] progress:progress success:success faliure:faliure];
-}
 
 #pragma mark ---- 文件下载
 + (void)downloadFileRequestWithFileUrl:(NSString *)url progress:(void (^)(int64_t, int64_t))progress success:(void (^)(NSURL * _Nonnull))success faliure:(void (^)(NSError * _Nonnull))faliure {

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSPublicAlertView.m

@@ -6,7 +6,7 @@
 //
 
 #import "KSPublicAlertView.h"
-#import "UIView+Animation.h"
+#import <KSToolLibrary/UIView+Animation.h>
 
 @interface KSPublicAlertView ()
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSTabBarViewController.m

@@ -8,7 +8,7 @@
 #import "KSTabBarViewController.h"
 #import "CustomNavViewController.h"
 #import "KSBaseViewController.h"
-#import "UIImage+Color.h"
+#import <KSToolLibrary/UIImage+Color.h>
 #import "AnimationHelper.h"
 #import "MineWorksViewController.h"
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSTipsAlert.m

@@ -7,7 +7,7 @@
 //
 
 #import "KSTipsAlert.h"
-#import "UIView+Animation.h"
+#import <KSToolLibrary/UIView+Animation.h>
 
 @interface KSTipsAlert ()
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSUpdateAlert.m

@@ -7,7 +7,7 @@
 //
 
 #import "KSUpdateAlert.h"
-#import "UIView+Animation.h"
+#import <KSToolLibrary/UIView+Animation.h>
 
 @interface KSUpdateAlert ()
 

+ 0 - 274
KulexiuForStudent/KulexiuForStudent/Common/Base/KSUploadManager.m

@@ -1,274 +0,0 @@
-//
-//  KSUploadManager.m
-//  KulexiuForTeacher
-//
-//  Created by 王智 on 2022/5/8.
-//
-
-#import "KSUploadManager.h"
-#import "NSDate+Extension.h"
-#import <QCloudCOSXML/QCloudCOSXMLTransfer.h>
-
-@interface KSUploadManager ()<QCloudSignatureProvider>
-
-
-@property (assign, nonatomic) long long fileSize;
-
-// 腾讯cos bucket name
-@property (nonatomic, strong) NSString *cosBucketName;
-
-
-@property (nonatomic, strong) NSString *cosFileName;
-
-@end
-
-@implementation KSUploadManager
-+ (instancetype)shareInstance {
-    static KSUploadManager *manager = nil;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        manager = [[KSUploadManager alloc] init];
-        [manager configCilentBucket];
-        [manager configTXCloud];
-    });
-    return manager;
-}
-
-- (void)configTXCloud {
-    QCloudServiceConfiguration *configuration = [QCloudServiceConfiguration new];
-    QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] initWithLiteralURL:[NSURL URLWithString:@"oss.dayaedu.com"]];
-    endpoint.regionName = @"ap-nanjing";
-    // 适使用HTTPS
-    endpoint.useHTTPS = YES;
-    configuration.endpoint = endpoint;
-    configuration.signatureProvider = self;
-    
-    // 初始化 cos 服务实例
-    [QCloudCOSXMLService registerDefaultCOSXMLWithConfiguration:configuration];
-    [QCloudCOSTransferMangerService registerDefaultCOSTransferMangerWithConfiguration:configuration];
-}
-
-- (void)configBucketName:(NSString *)bucketName {
-
-}
-
-- (void)configCilentBucket {
-    self.cosBucketName = @"daya-online-1303457149";
-}
-
-// 上传改造 添加目录 /yyyyMM/dd/文件名
-- (NSString *)getDayFolder {
-    NSDateFormatter *formatter = [NSObject getDateformatter];
-    [formatter setDateFormat:@"yyyyMM"];
-    NSDate *date = [NSDate date];
-    NSString *month = [formatter stringFromDate:date];
-    [formatter setDateFormat:@"dd"];
-    NSString *dayString = [formatter stringFromDate:date];
-    return [NSString stringWithFormat:@"%@/%@/",month, dayString];
-}
-
-- (void)uploadImage:(NSData *)imageData fileName:(NSString *)fileName successCallback:(KSUploadSuccess)success faliure:(KSUploadFailer)faliure {
-
-    NSString *folderString = [self getDayFolder];
-    NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64], UserDefault(UIDKey), fileName,[UIImage typeForImageData:imageData]];
-
-    [self uploadFileToOssWithSource:uploadFileName fileData:imageData progress:^(int64_t bytesWritten, int64_t totalBytes) {
-        
-    } successCallback:^(NSString *fileUrl) {
-        NSMutableArray *fileUrlArray = [NSMutableArray array];
-        [fileUrlArray addObject:fileUrl];
-        if (success) {
-            success(fileUrlArray);
-        }
-    } faliure:^{
-        if (faliure) {
-            faliure(nil, @"上传文件失败");
-        }
-    }];
-}
-
-- (void)mutilUploadImage:(NSMutableArray *)fileDataArray fileName:(NSString *)fileName successCallback:(KSUploadSuccess)success faliure:(KSUploadFailer)faliure {
-
-    NSString *folderString = [self getDayFolder];
-    NSMutableArray *fileNameArray = [NSMutableArray array];
-    if (fileDataArray.count > 1) {
-        for (NSInteger i = 0 ; i < fileDataArray.count; i++) {
-            NSData *fileData = fileDataArray[i];
-            NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%zd%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64], UserDefault(UIDKey), fileName,i,[UIImage typeForImageData:fileData]];
-            [fileNameArray addObject:uploadFileName];
-        }
-    }
-    else {
-        NSData *fileData = fileDataArray[0];
-        NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64], UserDefault(UIDKey), fileName,[UIImage typeForImageData:fileData]];
-        [fileNameArray addObject:uploadFileName];
-    }
-    [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:[NSMutableArray array] failArray:[NSMutableArray array] fileIndex:0 successCallback:success faliure:faliure];
-}
-
-- (void)MutilUploadFile:(NSMutableArray *)fileNameArray fileDataArray:(NSMutableArray *)fileDataArray successArray:(NSMutableArray *)successArray failArray:(NSMutableArray *)failArray fileIndex:(NSInteger)fileIndex successCallback:(KSUploadSuccess)successCallback faliure:(KSUploadFailer)faliureCallback {
-    if (fileIndex >= fileNameArray.count) {
-        return;
-    }
-    NSString *uploadFileName = fileNameArray[fileIndex];
-    NSData *fileData = fileDataArray[fileIndex];
-    [self uploadFileToOssWithSource:uploadFileName fileData:fileData progress:^(int64_t bytesWritten, int64_t totalBytes) {
-        
-    } successCallback:^(NSString *fileUrl) {
-        
-        NSMutableArray *success = [NSMutableArray arrayWithArray:successArray];
-        [success addObject:fileUrl];
-        if (fileIndex == fileNameArray.count - 1) {
-            [self finishMutilUpload:success failArray:failArray successCallback:successCallback faliure:faliureCallback];
-        }
-        else {
-            [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:success failArray:failArray fileIndex:fileIndex+1 successCallback:successCallback faliure:faliureCallback];
-        }
-        
-    } faliure:^{
-        
-        NSString *desc = [NSString stringWithFormat:@"第%zd次上传文件失败",fileIndex];
-        NSMutableArray *failerArray = [NSMutableArray arrayWithArray:failArray];
-        [failerArray addObject:desc];
-        
-        if (fileIndex == fileNameArray.count - 1) {
-            [self finishMutilUpload:successArray failArray:failerArray successCallback:successCallback faliure:faliureCallback];
-        }
-        else {
-            [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:successArray failArray:failerArray fileIndex:fileIndex+1 successCallback:successCallback faliure:faliureCallback];
-        }
-    }];
-}
-
-- (void)finishMutilUpload:(NSMutableArray *)successArray failArray:(NSMutableArray *)array successCallback:(KSUploadSuccess)successCallback faliure:(KSUploadFailer)faliureCallback {
-    if (successArray.count > 0) {
-        if (successCallback) {
-            successCallback([successArray copy]);
-        }
-    }
-    else {
-        if (faliureCallback) {
-            faliureCallback(nil,@"上传文件失败");
-        }
-    }
-}
-
-
-- (void)videoUpload:(NSData *)fileData fileName:(NSString *)fileName fileSuffix:(NSString *)fileSuffix progress:(KSUploadProgress)uploadProgress successCallback:(KSUploadSuccess)success faliure:(KSUploadFailer)faliure {
-
-    NSString *folderString = [self getDayFolder];
-    NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64], UserDefault(UIDKey),fileName,fileSuffix];
-
-    [self uploadFileToOssWithSource:uploadFileName fileData:fileData progress:^(int64_t bytesWritten, int64_t totalBytes) {
-        if (uploadProgress) {
-            uploadProgress(bytesWritten, totalBytes);
-        }
-    } successCallback:^(NSString *fileUrl) {
-        NSMutableArray *fileUrlArray = [NSMutableArray array];
-        [fileUrlArray addObject:fileUrl];
-        if (success) {
-            success(fileUrlArray);
-        }
-    } faliure:^{
-        if (faliure) {
-            faliure(nil, @"上传文件失败");
-        }
-    }];
-}
-
-- (void)uploadFile:(NSData *)fileData fileName:(NSString *)fileName fileSuffix:(NSString *)fileSuffix progress:(KSUploadProgress)uploadProgress successCallback:(KSUploadSuccess)success faliure:(KSUploadFailer)faliure {
-
-    NSString *folderString = [self getDayFolder];
-    NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64],UserDefault(UIDKey), fileName,fileSuffix];
-    
-    [self uploadFileToOssWithSource:uploadFileName fileData:fileData progress:^(int64_t bytesWritten, int64_t totalBytes) {
-        if (uploadProgress) {
-            uploadProgress(bytesWritten, totalBytes);
-        }
-    } successCallback:^(NSString *fileUrl) {
-        NSMutableArray *fileUrlArray = [NSMutableArray array];
-        [fileUrlArray addObject:fileUrl];
-        if (success) {
-            success(fileUrlArray);
-        }
-    } faliure:^{
-        if (faliure) {
-            faliure(nil, @"上传文件失败");
-        }
-    }];
-}
-
-
-- (void)uploadFileToOssWithSource:(NSString *)fileName fileData:(NSData *)fileData progress:(KSUploadProgress)uploadProgress successCallback:(void(^)(NSString *fileUrl))success faliure:(void(^)(void))faliure {
-    if (fileData == nil) {
-        if (faliure) {
-            dispatch_main_async_safe(^{
-                faliure();
-            });
-        }
-        return;
-    }
-    self.cosFileName = fileName;
-    QCloudCOSXMLUploadObjectRequest *put = [QCloudCOSXMLUploadObjectRequest new];
-    put.bucket = self.cosBucketName;
-    put.object = fileName;
-    put.body = fileData;
-    
-    [put setSendProcessBlock:^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
-            // 进度
-        dispatch_main_async_safe(^{
-            if (uploadProgress) {
-                uploadProgress(totalBytesSent, totalBytesExpectedToSend);
-            }
-        });
-    }];
-    // 监听上传结果
-    [put setFinishBlock:^(QCloudUploadObjectResult * _Nullable result, NSError * _Nullable error) {
-        if (result) {
-            NSString * fileUrl = result.location;
-            if (success) {
-                dispatch_main_async_safe(^{
-                    success(fileUrl);
-                });
-                
-            }
-        }
-        else {
-            if (faliure) {
-                dispatch_main_async_safe(^{
-                    faliure();
-                });
-            }
-        }
-    }];
-    
-    [[QCloudCOSTransferMangerService defaultCOSTransferManager] UploadObject:put];
-}
-
-- (void)signatureWithFields:(QCloudSignatureFields *)fileds request:(QCloudBizHTTPRequest *)request urlRequest:(NSMutableURLRequest *)urlRequst compelete:(QCloudHTTPAuthentationContinueBlock)continueBlock {
-    [KSNetworkingManager getTXCosUploadSignRequest:KS_POST fileName:self.cosFileName keyName:self.cosFileName bucketName:self.cosBucketName success:^(NSDictionary * _Nonnull dic) {
-        if ([dic ks_integerValueForKey:@"code"] == 200) {
-            NSString *signatureString = [[dic ks_dictionaryValueForKey:@"data"] ks_stringValueForKey:@"signature"];
-//            NSString *
-//            QCloudCredential* credential = [QCloudCredential new];
-//            credential.secretID = @"AKIDSo12YszsjQwKdkbFjBThokdO6HI7lFbq";
-//            credential.secretKey = @"5ykLhplZDhLo7E7rQnDSWQ9eyAAyhP0T";
-//            QCloudAuthentationV5Creator* creator = [[QCloudAuthentationV5Creator alloc]
-//                                                    initWithCredential:credential];
-            // 注意 这里不要对urlRequst 进行copy以及mutableCopy操作
-            
-//            NSTimeInterval endTime = [[[dic ks_dictionaryValueForKey:@"data"] ks_stringValueForKey:@"expiration"] longLongValue];
-//            NSDate *expiration = [NSDate dateWithTimeIntervalSince1970:endTime/1000.0];
-            QCloudSignature *signature = [[QCloudSignature alloc] initWithSignature:signatureString expiration:nil];
-//            QCloudSignature *signature = [creator signatureForData:urlRequst];
-            continueBlock(signature, nil);
-        }
-        else {
-            continueBlock(nil, nil);
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        continueBlock(nil, nil);
-    }];
-}
-
-@end

+ 0 - 539
KulexiuForStudent/KulexiuForStudent/Common/Base/KSVideoRecordManager.m

@@ -1,539 +0,0 @@
-//
-//  KSVideoRecordManager.m
-//  TeacherDaya
-//
-//  Created by Kyle on 2021/8/16.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import "KSVideoRecordManager.h"
-#import <AVFoundation/AVFoundation.h>
-#import <AssetsLibrary/AssetsLibrary.h>
-#import "TZImageManager.h"
-#import "KSVideoEditor.h"
-
-@interface KSVideoRecordManager ()<AVCaptureFileOutputRecordingDelegate>
-
-//会话 负责输入和输出设备之间的数据传递
-@property (nonatomic, strong) AVCaptureSession *captureSession;
-
-@property (nonatomic, strong) AVCaptureDeviceInput *videoCaptureDeviceInput;
-
-@property (nonatomic, strong) AVCaptureDeviceInput *audioCaptureDeviceInput;
-
-// 视频流输出
-@property (nonatomic, strong) AVCaptureMovieFileOutput *captureMovieFileOutput;
-
-// 相机拍摄预览图层
-@property (nonatomic, strong) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
-
-@property (nonatomic, strong) NSURL *videoFileURL;
-
-@property (nonatomic, assign) BOOL recordEnable;
-
-// 是否正在录制
-@property (nonatomic, assign) BOOL isRecording;
-
-@property (nonatomic, copy) KSVideoRecordCallback callback;
-
-@property (nonatomic, strong) PHAsset *videoAsset;
-
-@property (nonatomic, strong) NSString *presentName;
-
-@property (strong, nonatomic) MBProgressHUD *HUD;
-
-@property (nonatomic, strong) dispatch_queue_t videoRecordQueue;
-
-@property (nonatomic, assign) BOOL isChangeSession;
-
-@end
-
-@implementation KSVideoRecordManager
-
-- (instancetype)initSessionRecordCallback:(KSVideoRecordCallback)callback {
-    self = [super init];
-    if (self) {
-        if (callback) {
-            self.callback = callback;
-        }
-    }
-    return self;
-}
-
-- (void)setIgnoreAudio:(BOOL)ignoreAudio {
-    _ignoreAudio = ignoreAudio;
-    [self resetSession];
-}
-
-- (BOOL)getSessionStatusisActive {
-    if (self.captureSession && self.captureSession.isRunning) {
-        return YES;
-    }
-    else  {
-        return NO;
-    }
-}
-
-- (void)configSessiondisplayInView:(UIView *)containerView {
-    
-    _captureSession = [[AVCaptureSession alloc] init];
-
-    // 设置YES 播放web伴奏会导致打断
-    _captureSession.automaticallyConfiguresApplicationAudioSession = NO;
-    // 初始化会话对象
-    if ([_captureSession canSetSessionPreset:AVCaptureSessionPresetiFrame1280x720]) {
-        _captureSession.sessionPreset = AVCaptureSessionPresetiFrame1280x720;
-    }
-    else if ([_captureSession canSetSessionPreset:AVCaptureSessionPresetInputPriority]) {
-        _captureSession.sessionPreset = AVCaptureSessionPresetInputPriority;
-    }   
-    NSError *error = nil;
-    
-    // 获取视频输出对象
-    AVCaptureDevice *videoCaptureDevice = [self cameraDeviceWithPosition:(AVCaptureDevicePositionFront)];
-    if (!videoCaptureDevice) {
-        if (self.callback) {
-            self.callback(NO, @"获取摄像头失败!");
-        }
-    }
-    _videoCaptureDeviceInput = [[AVCaptureDeviceInput alloc] initWithDevice:videoCaptureDevice error:&error];
-    if (error) {
-        if (self.callback) {
-            self.callback(NO, @"获取视频设备输入出错!");
-        }
-        return;
-    }
-    if ([_captureSession canAddInput:_videoCaptureDeviceInput]) {
-        [_captureSession addInput:_videoCaptureDeviceInput];
-        // 设置帧率
-        [self setMaxFrameRate:10 forDevice:_videoCaptureDeviceInput.device];
-    }
-    else {
-        if (self.callback) {
-            self.callback(NO, @"摄像头被占用!");
-        }
-    }
-    if (_ignoreAudio == NO) {
-        // 获取音频输入对象
-        AVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
-        _audioCaptureDeviceInput = [[AVCaptureDeviceInput alloc] initWithDevice:audioCaptureDevice error:&error];
-        if (error) {
-            if (self.callback) {
-                self.callback(NO, @"获取音频设备输入出错!");
-            }
-            return;
-        }
-        //将设备输入添加到会话中
-        if ([_captureSession canAddInput:_audioCaptureDeviceInput]) {
-            [_captureSession addInput:_audioCaptureDeviceInput];
-        }
-        else {
-            if (self.callback) {
-                self.callback(NO, @"麦克风被占用!");
-            }
-        }
-    }
-    
-    // 初始化设备输出对象
-    _captureMovieFileOutput = [[AVCaptureMovieFileOutput alloc] init];
-    _captureMovieFileOutput.movieFragmentInterval = kCMTimeInvalid;
-    
-    //将设备输出添加到会话中
-    if ([_captureSession canAddOutput:_captureMovieFileOutput]) {
-        AVCaptureConnection *captureConnection = [_captureMovieFileOutput connectionWithMediaType:AVMediaTypeVideo];
-        //防抖功能
-        if ([captureConnection isVideoStabilizationSupported]) {
-            captureConnection.preferredVideoStabilizationMode = AVCaptureVideoStabilizationModeAuto;
-        }
-        [_captureSession addOutput:_captureMovieFileOutput];
-    }
-    
-    //创建视频预览图层
-    _captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:_captureSession];
-    containerView.layer.masksToBounds = YES;
-    _captureVideoPreviewLayer.frame = containerView.bounds;
-    _captureVideoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
-    _captureVideoPreviewLayer.connection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
-    [containerView.layer addSublayer:_captureVideoPreviewLayer];
-    
-    // 一定要在添加了 input 和 output之后~
-    AVCaptureConnection *captureConnection = [_captureMovieFileOutput connectionWithMediaType:AVMediaTypeVideo];
-    captureConnection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
-    [self startSession];
-}
-
-- (void)removeDisplay {
-    [self stopSession];
-    if (_captureVideoPreviewLayer) {
-        [_captureVideoPreviewLayer removeFromSuperlayer];
-    }
-}
-
-- (void)resetSession {
-    if ([_captureSession isRunning]) {
-        if (_ignoreAudio == NO) {
-            [_captureSession beginConfiguration];
-            self.isChangeSession = YES;
-            if (_audioCaptureDeviceInput) {
-                [_captureSession removeInput:_audioCaptureDeviceInput];
-            }
-            
-            NSError *error = nil;
-            // 获取音频输入对象
-            AVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
-            _audioCaptureDeviceInput = [[AVCaptureDeviceInput alloc] initWithDevice:audioCaptureDevice error:&error];
-            if (error) {
-                if (self.callback) {
-                    self.callback(NO, @"获取音频设备输入出错!");
-                }
-                return;
-            }
-            if ([_captureSession canAddInput:_audioCaptureDeviceInput]) {
-                [_captureSession addInput:_audioCaptureDeviceInput];
-            }
-            else {
-                if (self.callback) {
-                    self.callback(NO, @"麦克风被占用!");
-                }
-            }
-            
-            [_captureSession commitConfiguration];
-            self.isChangeSession = NO;
-        }
-    }
-    else {
-        [self startSession];
-    }
-}
-
-
-- (void)startSession {
-    @weakObj(self);
-    dispatch_async(self.videoRecordQueue, ^{
-        @strongObj(self);
-        if (!self.captureSession.running) {
-            [self.captureSession startRunning];
-        }
-    });
-}
-
-- (void)stopSession {
-    if (_captureSession && _isChangeSession == NO) {
-        @weakObj(self);
-        dispatch_async(self.videoRecordQueue, ^{
-            @strongObj(self);
-            if (self.captureSession.running) {
-                [self.captureSession stopRunning];
-            }
-        });
-        self.captureSession = nil;
-    }
-}
-
-- (void)startRecord {
-    if (_captureMovieFileOutput) {
-        [self clearVideoFile];
-
-        // 开始录制
-        [self.captureMovieFileOutput startRecordingToOutputFileURL:[NSURL fileURLWithPath:[self getRecordFilePath]] recordingDelegate:self];
-    }
-    
-}
-
-- (void)stopRecord {
-    if (_captureMovieFileOutput && _isRecording) {
-        [self.captureMovieFileOutput stopRecording];
-    }
-    else {
-        [self resetSession];
-    }
-}
-
-
-- (void)removeVideoWithPath:(NSString *)videoUrl {
-    NSFileManager *fileMamager = [NSFileManager defaultManager];
-    if ([fileMamager fileExistsAtPath:videoUrl]) {
-        [fileMamager removeItemAtPath:videoUrl error:nil];
-    }
-}
-
-/**取得指定位置的摄像头*/
-- (AVCaptureDevice *)cameraDeviceWithPosition:(AVCaptureDevicePosition)position {
-    NSArray *cameras = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
-    for (AVCaptureDevice *camera in cameras) {
-        if ([camera position] == position) {
-            return camera;
-        }
-    }
-    return nil;
-}
-// 切换摄像头
-- (void)swapCameras {
-    // Assume the session is already running
-    NSArray *inputs =self.captureSession.inputs;
-    for (AVCaptureDeviceInput *input in inputs ) {
-        AVCaptureDevice *device = input.device;
-        if ( [device hasMediaType:AVMediaTypeVideo] ) {
-            AVCaptureDevicePosition position = device.position;
-            AVCaptureDevice *newCamera =nil;
-            AVCaptureDeviceInput *newInput =nil;
-            
-            if (position ==AVCaptureDevicePositionFront)
-                newCamera = [self cameraDeviceWithPosition:AVCaptureDevicePositionBack];
-            else
-                newCamera = [self cameraDeviceWithPosition:AVCaptureDevicePositionFront];
-            newInput = [AVCaptureDeviceInput deviceInputWithDevice:newCamera error:nil];
-            
-            // beginConfiguration ensures that pending changes are not applied immediately
-            [self.captureSession beginConfiguration];
-            
-            [self.captureSession removeInput:input];
-            [self.captureSession addInput:newInput];
-            
-            // Changes take effect once the outermost commitConfiguration is invoked.
-            [self.captureSession commitConfiguration];
-            break;
-        }
-    }
-}
-
-#pragma mark --------  AVCaptureFileOutputRecordingDelegate  ----------
-- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didStartRecordingToOutputFileAtURL:(NSURL *)fileURL fromConnections:(NSArray *)connections {
-    NSLog(@"开始录制");
-    _isRecording = YES;
-}
-
-- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error {
-    if (error) {
-        NSLog(@"error desc :%@", error.description);
-    }
-    NSLog(@"录制结束");
-    _isRecording = NO;
-
-    // 暂时存储文件地址
-    self.videoFileURL = outputFileURL;
-    [self resetSession];
-    self.skipSaveRecord = NO;
-    if (self.callback) {
-        self.callback(YES, @"");
-    }
-}
-
-- (void)saveVideoCallback:(KSVideoRecordCallback)callback {
-    // 保存文件
-    if (self.skipSaveRecord == NO) {
-        if (_ignoreAudio == NO) {
-            [self saveVideoToAsset:self.videoFileURL callback:^(BOOL isSuccess, NSString * _Nullable message) {
-                callback(isSuccess, message);
-            }];
-        }
-        else {
-            [self addBackgroundMuisc:self.audioUrl callback:^(BOOL isSuccess, NSString * _Nullable message) {
-                callback(isSuccess, message);
-            }];
-        }
-    }
-}
-
-// 生成文件 合并音轨
-- (void)addBackgroundMuisc:(NSURL *)audioUrl callback:(KSVideoRecordCallback)callback {
-    AVURLAsset* audioAsset =[AVURLAsset URLAssetWithURL:audioUrl options:nil];
-    
-    CMTime audioDuration = audioAsset.duration;
-    
-    float audioDurationSeconds = CMTimeGetSeconds(audioDuration);
-    
-    NSLog(@"%f",audioDurationSeconds);
-    [KSVideoEditor addBackgroundMiusicWithVideoUrlStr:self.videoFileURL audioUrl:audioUrl bgAudioUrl:self.bgAudioUrl start:0 end:audioDurationSeconds isOriginalSound:NO oriVolume:0 newVolume:100 completion:^(NSString * _Nonnull outPath, BOOL isSuccess) {
-        if (isSuccess) {
-            [self saveVideoToAsset:[NSURL fileURLWithPath:outPath] callback:^(BOOL isSuccess, NSString * _Nullable message) {
-                if (callback) {
-                    callback(isSuccess, message);
-                }
-            }];
-        }
-        else {
-            
-        }
-    }];
-}
-
-
-
-// 保存到相册
-- (void)saveVideoToAsset:(NSURL *)videoUrl callback:(KSVideoRecordCallback)callback {
-    [LOADING_MANAGER MBShowInWindow:@"视频处理中..."];
-    [[TZImageManager manager] saveVideoWithUrl:videoUrl completion:^(PHAsset *asset, NSError *error) {
-        if (!error) {
-            self.videoAsset = asset;
-            dispatch_main_async_safe(^{
-                [LOADING_MANAGER removeHUD];
-                if (callback) {
-                    callback(YES, @"已保存到相册");
-                }
-                else if (self.callback) {
-                    self.callback(YES, @"已保存到相册");
-                }
-                // 重置
-                [self resetSession];
-                
-            });
-        }
-        else {
-            dispatch_main_async_safe(^{
-                [LOADING_MANAGER removeHUD];
-                if (callback) {
-                    callback(NO, @"保存视频错误");
-                }
-                else if (self.callback) {
-                    self.callback(NO, @"保存视频错误");
-                }
-                // 重置
-                [self resetSession];
-                
-            });
-        }
-    }];
-}
-
-- (void)clearVideoFile {
-    if (_isRecording) {
-        return;
-    }
-    NSURL *fileUrl = [NSURL fileURLWithPath:[self getRecordFilePath]];
-    if (fileUrl) {
-        [self removeVideoWithPath:fileUrl.path];
-    }
-    self.videoFileURL = nil;
-}
-
-// 上传视频
-- (void)uploadRecordVideoSuccess:(void (^)(NSString * _Nonnull))success failure:(void (^)(NSString * _Nonnull))faliure {
-    if (self.videoAsset) {
-        
-        [[TZImageManager manager] getVideoOutputPathWithAsset:self.videoAsset presetName:self.presentName success:^(NSString *outputPath) {
-            
-            NSLog(@"视频导出到本地完成,沙盒路径为:%@",outputPath);
-            NSData *outputData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:outputPath]]; //压缩后的视频
-            NSLog(@"导出后的视频:%@",[NSString stringWithFormat:@"%.2fM",(CGFloat)outputData.length/(1024*1024)]);
-            // 上传
-            dispatch_main_async_safe(^{
-                [self sendVideoActionWith:outputPath success:success failure:faliure];
-            });
-            
-        } failure:^(NSString *errorMessage, NSError *error) {
-            dispatch_main_async_safe(^{
-                faliure(@"视频导出失败");
-            });
-            NSLog(@"视频导出失败:%@,error:%@",errorMessage, error);
-        }];
-    }
-    else {
-        faliure(@"未找到视频资源");
-    }
-}
-
-
-- (void)sendVideoActionWith:(NSString *)fileUrl success:(void (^)(NSString * _Nonnull))success failure:(void (^)(NSString * _Nonnull))faliure {
-    [self hudTipWillShow:YES];
-    NSData *fileData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:fileUrl]];
-    NSString *suffix = [NSString stringWithFormat:@".%@",[fileUrl pathExtension]];
-    [[KSUploadManager shareInstance] configBucketName:@"daya"];
-    [[KSUploadManager shareInstance] videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
-        // 显示进度
-        if (self.HUD) {
-            self.HUD.progress = bytesWritten / totalBytes;// progress是回调进度
-        }
-    } successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
-        [self hudTipWillShow:NO];
-        NSString *fileUrl = [fileUrlArray lastObject];
-        success(fileUrl);
-        
-    } faliure:^(NSError * _Nullable error, NSString * _Nullable descMessaeg) {
-        [self hudTipWillShow:NO];
-        faliure(descMessaeg);
-    }];
-}
-
-- (void)hudTipWillShow:(BOOL)willShow{
-    if (willShow) {
-        
-        UIWindow *keyWindow = [NSObject getKeyWindow];
-        if (!_HUD) {
-            _HUD = [MBProgressHUD showHUDAddedTo:keyWindow animated:YES];
-            _HUD.label.textColor = [UIColor whiteColor];
-            _HUD.mode = MBProgressHUDModeDeterminateHorizontalBar;
-            _HUD.label.text = @"正在上传视频...";
-            _HUD.contentColor = [UIColor whiteColor];
-            _HUD.removeFromSuperViewOnHide = YES;
-            _HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
-            _HUD.bezelView.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.8];
-        }else{
-            _HUD.progress = 0;
-            [keyWindow addSubview:_HUD];
-            [_HUD showAnimated:YES];
-        }
-    }else{
-        [_HUD hideAnimated:YES];
-    }
-}
-
-
-#pragma mark ------ 设置录制地址
-- (NSString *)getRecordFilePath {
-    NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject] stringByAppendingPathComponent:@"AccompanyVideoData"];
-    NSFileManager *fileManager = [NSFileManager defaultManager];
-    BOOL isDir = FALSE;
-    BOOL isDirExist = [fileManager fileExistsAtPath:path isDirectory:&isDir];
-    if(!(isDirExist && isDir)) {
-        BOOL bCreateDir = [fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
-        if(!bCreateDir){
-            NSLog(@"创建文件夹失败!");
-        }
-        NSLog(@"创建文件夹成功,文件路径%@",path);
-    }
-    NSString *songName = @"recordSong";
-    NSString *fileName = [NSString stringWithFormat:@"%@.mp4",songName];
-    NSString *filePath = [path stringByAppendingPathComponent:fileName];
-    return filePath;
-}
-
-- (dispatch_queue_t)videoRecordQueue {
-    if (!_videoRecordQueue) {
-        _videoRecordQueue = dispatch_queue_create("com.Colexiu.videoRecord", DISPATCH_QUEUE_SERIAL);
-    }
-    return _videoRecordQueue;
-}
-
-- (void)setMaxFrameRate:(Float64)maxFrameRate forDevice:(AVCaptureDevice *)device {
-    @try
-    {
-        NSError *lockError = nil;
-        if ([device lockForConfiguration:&lockError])
-        {
-            NSArray *videoSupportedFrameRateRanges = device.activeFormat.videoSupportedFrameRateRanges;
-            AVFrameRateRange *minFrameRateRange = videoSupportedFrameRateRanges.firstObject;
-            for (AVFrameRateRange *range in device.activeFormat.videoSupportedFrameRateRanges)
-            {
-                if (range.minFrameRate < minFrameRateRange.minFrameRate)
-                {
-                    minFrameRateRange = range;
-                }
-            }
-            CMTime minFrameDuration = CMTimeMake(1, maxFrameRate);
-            //超出范围就取默认值
-            if (maxFrameRate < minFrameRateRange.minFrameRate || maxFrameRate > minFrameRateRange.maxFrameRate)
-            {
-                minFrameDuration = kCMTimeInvalid;
-            }
-            device.activeVideoMinFrameDuration = minFrameDuration;
-            [device unlockForConfiguration];
-            NSLog(@"OnboardingScan--打印帧数最小: %@, 最大:%@", @((int32_t)device.activeVideoMinFrameDuration.timescale).stringValue, @((int32_t)device.activeVideoMaxFrameDuration.timescale).stringValue);
-        }
-    } @catch (NSException *exception) {
-
-     } @finally {
-
-    }
-}
-@end

+ 0 - 23
KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebBackButton.h

@@ -1,23 +0,0 @@
-//
-//  KSWebBackButton.h
-//  StudentDaya
-//
-//  Created by Kyle on 2022/1/11.
-//  Copyright © 2022 DayaMusic. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-typedef void(^WebNavCallback)(void);
-
-@interface KSWebBackButton : UIView
-
-@property (nonatomic, strong) UIButton *backButton;
-
-- (void)webViewBackAction:(WebNavCallback)callback;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 60
KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebBackButton.m

@@ -1,60 +0,0 @@
-//
-//  KSWebBackButton.m
-//  StudentDaya
-//
-//  Created by Kyle on 2022/1/11.
-//  Copyright © 2022 DayaMusic. All rights reserved.
-//
-
-#import "KSWebBackButton.h"
-
-@interface KSWebBackButton ()
-
-@property (nonatomic, copy) WebNavCallback callback;
-
-@end
-
-@implementation KSWebBackButton
-
-- (instancetype)init {
-    self = [super init];
-    if (self) {
-        [self configUI];
-    }
-    return self;
-}
-
-- (void)configUI {
-    self.backgroundColor = [UIColor clearColor];
-    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
-    [backButton setImage:[UIImage imageNamed:@"back_black"] forState:UIControlStateNormal];
-    [backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
-    self.backButton = backButton;
-    [self addSubview:self.backButton];
-    [self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.bottom.mas_equalTo(self);
-        make.width.height.mas_equalTo(44);
-    }];
-}
-
-- (void)webViewBackAction:(WebNavCallback)callback {
-    if (callback) {
-        self.callback = callback;
-    }
-}
-
-- (void)backAction {
-    if (self.callback) {
-        self.callback();
-    }
-}
-
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect {
-    // Drawing code
-}
-*/
-
-@end

+ 0 - 24
KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebNavView.h

@@ -1,24 +0,0 @@
-//
-//  KSWebNavView.h
-//  StudentDaya
-//
-//  Created by Kyle on 2021/12/27.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface KSWebNavView : UIView
-
-@property (nonatomic, strong) UILabel *topTitleLabel;
-
-
-- (void)createRightButton:(NSString *)imageName target:(id)target action:(SEL)action;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 63
KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebNavView.m

@@ -1,63 +0,0 @@
-//
-//  KSWebNavView.m
-//  StudentDaya
-//
-//  Created by Kyle on 2021/12/27.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import "KSWebNavView.h"
-
-@interface KSWebNavView ()
-
-@end
-
-@implementation KSWebNavView
-
-- (instancetype)init {
-    self = [super init];
-    if (self) {
-        [self configUI];
-    }
-    return self;
-}
-
-- (void)configUI {
-    self.backgroundColor = [UIColor whiteColor];
-    
-    UILabel *headLabel = [[UILabel alloc] init];
-    headLabel.textColor = HexRGB(0x000000);
-    headLabel.font = [UIFont systemFontOfSize:18.0f weight:UIFontWeightMedium];
-    headLabel.textAlignment = NSTextAlignmentCenter;
-    self.topTitleLabel = headLabel;
-    [self addSubview:self.topTitleLabel];
-    [self.topTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.bottom.mas_equalTo(self.mas_bottom);
-        make.centerX.mas_equalTo(self.mas_centerX);
-        make.left.mas_equalTo(self.mas_left).offset(70);
-        make.right.mas_equalTo(self.mas_right).offset(-70);
-        make.height.mas_equalTo(44);
-    }];
-}
-
-- (void)createRightButton:(NSString *)imageName target:(id)target action:(SEL)action {
-    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
-    [rightButton setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
-    [rightButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
-    [self addSubview:rightButton];
-    [rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.right.bottom.mas_equalTo(self);
-        make.width.height.mas_equalTo(44);
-    }];
-}
-
-
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect {
-    // Drawing code
-}
-*/
-
-@end

+ 0 - 290
KulexiuForStudent/KulexiuForStudent/Common/Base/KSWebSocketManager.m

@@ -1,290 +0,0 @@
-//
-//  KSWebSocketManager.m
-//  TeacherDaya
-//
-//  Created by Kyle on 2021/6/16.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import "KSWebSocketManager.h"
-#import <AFNetworkReachabilityManager.h>
-
-/*自定义打印 宏*/
-#ifdef DEBUG
-#define KSNSLog(format, ...) do {                                                                          \
-fprintf(stderr, "<%s : %d> %s\n",                                           \
-[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],  \
-__LINE__, __func__);                                                        \
-(NSLog)((format), ##__VA_ARGS__);                                           \
-fprintf(stderr, "-------\n");                                               \
-} while (0)
-
-#else
-#define KSNSLog( ...)
-
-#endif
-
-typedef NS_ENUM(NSUInteger, SocketDataType) {
-    distributeOrder,
-    cancelCall,
-    orderLost,
-    changeDeviceType,
-};
-
-@interface KSWebSocketManager ()<SRWebSocketDelegate>
-{
-    NSTimer * heartBeat;
-    NSTimeInterval reConnectTime;
-    SocketDataType type;
-}
-
-@property (nonatomic,strong) SRWebSocket *socket;
-
-@end
-
-@implementation KSWebSocketManager
-
-- (instancetype)init {
-    self = [super init];
-    if (self) {
-//        [self registerNetworkNotifications];
-    }
-    return self;
-}
-
-
-- (void)registerNetworkNotifications{
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkChangedNote:) name:AFNetworkingReachabilityDidChangeNotification object:nil];
-}
-- (void)networkChangedNote:(NSNotification *)note{
-    
-    AFNetworkReachabilityStatus status = [note.userInfo[AFNetworkingReachabilityNotificationStatusItem] integerValue];
-    switch (status) {
-        case AFNetworkReachabilityStatusUnknown:
-            NSLog(@"网络类型:未知网络");
-            break;
-        case AFNetworkReachabilityStatusNotReachable:
-            NSLog(@"网络类型:断网");
-            break;
-        case AFNetworkReachabilityStatusReachableViaWWAN:
-            NSLog(@"网络类型:数据流量");
-            [self SRWebSocketOpen];
-            break;
-        case AFNetworkReachabilityStatusReachableViaWiFi:
-            NSLog(@"网络类型:WIFI");
-            [self SRWebSocketOpen];
-            break;
-    }
-}
-
--(void)SRWebSocketOpen {
-    //如果是同一个url return
-    if (self.socket) {
-        if (self.socket.readyState == SR_OPEN) {
-            [self handleConnectionStatus:YES];
-            return;
-        }
-        else {
-            self.socket = nil;
-        }
-    }
-    
-    /** /userId */
-    NSString *connectedUrl = [NSString stringWithFormat:@"%@/%@", SOCKET_URL, UserDefault(UIDKey)];
-    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:connectedUrl]];
-    request.allHTTPHeaderFields = @{@"Authorization":[NSString stringWithFormat:@"%@ %@", UserDefault(Token_type), UserDefault(TokenKey)]};
-    self.socket = [[SRWebSocket alloc] initWithURLRequest:
-                   request];//这里填写你服务器的地址
-    NSLog(@"请求的websocket地址:%@",self.socket.url.absoluteString);
-    self.socket.delegate = self;   //实现这个 SRWebSocketDelegate 协议
-    [self.socket open];     //open 就是直接连接了
-}
-
--(void)SRWebSocketClose {
-    if (self.socket) {
-        [self.socket close];
-        self.socket = nil;
-        //断开连接时销毁心跳
-        [self destoryHeartBeat];
-    }
-}
-
-#pragma mark - socket delegate
-- (void)webSocketDidOpen:(SRWebSocket *)webSocket {
-    
-    //每次正常连接的时候清零重连时间
-    reConnectTime = 0;
-    
-    //开启心跳
-    [self initHeartBeat];
-    if (webSocket == self.socket) {
-        NSLog(@"************************** socket 连接成功************************** ");
-        [self handleConnectionStatus:YES];
-    }
-}
-
-- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error {
-
-    if (webSocket == self.socket) {
-        NSLog(@"************************** socket 连接失败************************** ");
-        _socket = nil;
-        //连接失败就重连
-        [self reConnect];
-    }
-}
-
-- (void)handleConnectionStatus:(BOOL)isSuccess {
-    if (self.connectionStatus) {
-        self.connectionStatus(isSuccess);
-    }
-}
-
-- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean {
-    
-    if (webSocket == self.socket) {
-        NSLog(@"************************** socket连接断开************************** ");
-        NSLog(@"被关闭连接,code:%ld,reason:%@,wasClean:%d",(long)code,reason,wasClean);
-        [self SRWebSocketClose];
-        [self handleConnectionStatus:NO];
-    }
-}
-
-/*该函数是接收服务器发送的pong消息,其中最后一个是接受pong消息的,
- 在这里就要提一下心跳包,一般情况下建立长连接都会建立一个心跳包,
- 用于每隔一段时间通知一次服务端,客户端还是在线,这个心跳包其实就是一个ping消息,
- 我的理解就是建立一个定时器,每隔十秒或者十五秒向服务端发送一个ping消息,这个消息可是是空的
- */
-
--(void)webSocket:(SRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload{
-    NSString *reply = [[NSString alloc] initWithData:pongPayload encoding:NSUTF8StringEncoding];
-    NSLog(@"reply===%@",reply);
-}
-#pragma mark - 收到的回调
-- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message  {
-    
-    if (webSocket == self.socket) {
-        NSLog(@"************************** socket收到数据了************************** ");
-        NSLog(@"message:%@",message);
-        if(!message){
-            return;
-        }
-        [self handleReceivedMessage:message];
-    }
-}
-- (void)handleReceivedMessage:(id)message {
-    
-    if(self.didReceiveMessage){
-        self.didReceiveMessage(message);
-    }
-}
-
-//重连机制
-- (void)reConnect
-{
-    
-   [self SRWebSocketClose];
-    //超过一分钟就不再重连 所以只会重连5次 2^5 = 64
-    NSLog(@"reConnectTime-----%.0f",reConnectTime);
-    if (reConnectTime > 60) {
-        //您的网络状况不是很好,请检查网络后重试
-        [self handleConnectionStatus:NO];
-        return;
-    }
-   
-    
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(reConnectTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        self.socket = nil;
-        [self SRWebSocketOpen];
-        NSLog(@"重连");
-    });
-    
-    //重连时间2的指数级增长
-    if (reConnectTime == 0) {
-        reConnectTime = 2;
-    }else{
-        reConnectTime *= 2;
-    }
-    
-}
-
-//初始化心跳
-- (void)initHeartBeat
-{
-    dispatch_main_async_safe(^{
-        [self destoryHeartBeat];
-       
-        self->heartBeat = [NSTimer timerWithTimeInterval:30 target:self selector:@selector(ping) userInfo:nil repeats:YES];
-        //和服务端约定好发送什么作为心跳标识,尽可能的减小心跳包大小
-        [[NSRunLoop currentRunLoop]addTimer:self->heartBeat forMode:NSRunLoopCommonModes];
-    })
-}
-
-
-//取消心跳
-- (void)destoryHeartBeat
-{
-    dispatch_main_async_safe(^{
-        if (self->heartBeat) {
-            if ([self->heartBeat respondsToSelector:@selector(isValid)]){
-                if ([self->heartBeat isValid]){
-                    [self->heartBeat invalidate];
-                    self->heartBeat = nil;
-                }
-            }
-        }
-    })
-}
-
-//pingPong
-- (void)ping{
-    if (self.socket.readyState == SR_OPEN) {
-        [self.socket sendPing:nil error:nil];
-    }
-}
-
-- (void)sendData:(id)parmData {
-   
-    dispatch_queue_t queue =  dispatch_queue_create("ks_websocket_queue", NULL);
-    dispatch_async(queue, ^{
-        if (self.socket != nil) {
-            // 只有 SR_OPEN 开启状态才能调 send 方法啊,不然要崩
-            if (self.socket.readyState == SR_OPEN) {
-                // 发送数据
-                if ([parmData isKindOfClass:[NSString class]]) {
-                    [self.socket sendString:parmData error:nil];
-                }
-                else if ([parmData isKindOfClass:[NSData class]]) {
-                    [self.socket sendData:parmData error:nil];
-                }
-            }
-            else {
-                [self SRWebSocketClose];
-                [self handleConnectionStatus:NO];
-            }
-            /*else if (weakSelf.socket.readyState == SR_CONNECTING) {
-
-                [weakSelf reConnect];
-            } else if (weakSelf.socket.readyState == SR_CLOSING || weakSelf.socket.readyState == SR_CLOSED) {
-                // websocket 断开了,调用 reConnect 方法重连
-                NSLog(@"重连");
-                [weakSelf reConnect];
-            }*/
-        } else {
-            // 这里要看你的具体业务需求;不过一般情况下,调用发送数据还是希望能把数据发送出去,所以可以再次打开链接;不用担心这里会有多个socketopen;因为如果当前有socket存在,会停止创建哒
-            [self SRWebSocketOpen];
-            [self handleConnectionStatus:NO];
-        }
-    });
-}
-
--(SRReadyState)socketReadyState{
-    return self.socket.readyState;
-}
-
--(void)dealloc{
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-    NSLog(@"SocketRocketUtility dealloced");
-}
-
-
-@end

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/LoadingManager/KSHudLoagingManager.m

@@ -6,7 +6,7 @@
 //
 
 #import "KSHudLoagingManager.h"
-#import "UIView+Hints.h"
+#import <KSToolLibrary/UIView+Hints.h>
 
 #define PROMPT_TIME  1.5f
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/KSLoginManager.m

@@ -11,7 +11,7 @@
 #import "CustomNavViewController.h"
 #import "UserInfoManager.h"
 #import "TXIMLinsenter.h"
-#import "UIDevice+TFDevice.h"
+#import <KSToolLibrary/UIDevice+TFDevice.h>
 #import "AppDelegate+AppService.h"
 
 

+ 0 - 134
KulexiuForStudent/KulexiuForStudent/Common/Base/RecordCheckManager.m

@@ -1,134 +0,0 @@
-//
-//  RecordCheckManager.m
-//  StudentDaya
-//
-//  Created by Kyle on 2019/10/9.
-//  Copyright © 2019 DayaMusic. All rights reserved.
-//
-
-#import "RecordCheckManager.h"
-#import <AVFoundation/AVFoundation.h>
-#import "KSPremissionAlert.h"
-#import "TZImageManager.h"
-
-
-@implementation RecordCheckManager
-
-+ (PREMISSIONTYPE)checkPermissionShowAlert:(BOOL)showAlert showInView:(UIView *)displayView {
-
-    __block PREMISSIONTYPE bCanRecord = PREMISSIONTYPE_NONE;
-    if ([[[UIDevice currentDevice]systemVersion]floatValue] >= 7.0) {
-        AVAuthorizationStatus videoAuthStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
-        if (videoAuthStatus == AVAuthorizationStatusNotDetermined) {// 未询问用户是否授权
-            AVAudioSession *audioSession = [AVAudioSession sharedInstance];
-            if ([audioSession respondsToSelector:@selector(requestRecordPermission:)]) {
-                [audioSession performSelector:@selector(requestRecordPermission:) withObject:^(BOOL granted) {
-                    if (granted) {
-                        bCanRecord = PREMISSIONTYPE_YES;
-                    } else {
-                        bCanRecord = PREMISSIONTYPE_NO;
-                    }
-                }];
-            }
-        } else if(videoAuthStatus == AVAuthorizationStatusRestricted || videoAuthStatus == AVAuthorizationStatusDenied) {
-            // 未授权
-            bCanRecord = PREMISSIONTYPE_NO;
-            if (showAlert && displayView != nil) {
-                [self showSetAlertViewInView:displayView];
-            }
-        } else{
-            // 已授权
-            NSLog(@"已授权");
-            bCanRecord = PREMISSIONTYPE_YES;
-        }
-    }
-    return bCanRecord;
-}
-
-//提示用户进行麦克风使用授权
-+ (void)showSetAlertViewInView:(UIView *)displayView {
-    [KSPremissionAlert shareInstanceDisplayImage:CHECKDEVICETYPE_MIC message:@"请开启麦克风访问权限" showInView:displayView cancel:^{
-        
-    } confirm:^{
-        [self openSettingView];
-    }];
-};
-
-+ (PREMISSIONTYPE)checkCameraPremissionAvaiable:(BOOL)showAlert showInView:(UIView *)displayView {
-    
-    __block PREMISSIONTYPE canRecordVideo = PREMISSIONTYPE_NONE;
-    if ([[[UIDevice currentDevice]systemVersion]floatValue] >= 7.0) {
-        AVAuthorizationStatus videoAuthStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
-        if (videoAuthStatus == AVAuthorizationStatusNotDetermined) {// 未询问用户是否授权
-            [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo
-                                     completionHandler:^(BOOL granted) {
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    if (granted) {
-                        canRecordVideo = PREMISSIONTYPE_YES;
-                    } else {
-                        canRecordVideo = PREMISSIONTYPE_NO;
-                    }
-                });
-            }];
-        } else if(videoAuthStatus == AVAuthorizationStatusRestricted || videoAuthStatus == AVAuthorizationStatusDenied) {
-            // 未授权
-            canRecordVideo = PREMISSIONTYPE_NO;
-            if (showAlert && displayView != nil) {
-                [self showSetCameraAlertViewInView:displayView];
-            }
-        } else{
-            // 已授权
-            canRecordVideo = PREMISSIONTYPE_YES;
-            NSLog(@"已授权");
-        }
-    }
-    return canRecordVideo;
-}
-
-//提示用户进行相机使用授权
-+ (void)showSetCameraAlertViewInView:(UIView *)displayView {
-    [KSPremissionAlert shareInstanceDisplayImage:CHECKDEVICETYPE_CAMREA message:@"请开启相机访问权限" showInView:displayView cancel:^{
-        
-    } confirm:^{
-        [self openSettingView];
-    }];
-};
-
-+ (PREMISSIONTYPE)checkPhotoLibraryPremissionAvaiable:(BOOL)showAlert showInView:(UIView *__nullable)displayView {
-    __block PREMISSIONTYPE cansaveVideo = PREMISSIONTYPE_NONE;
-    if ([PHPhotoLibrary authorizationStatus] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片或视频
-        cansaveVideo = PREMISSIONTYPE_NO;
-    }
-    else if ([PHPhotoLibrary authorizationStatus] == 0) {
-        [[TZImageManager manager] requestAuthorizationWithCompletion:^{
-            [self checkPhotoLibraryPremissionAvaiable:showAlert showInView:displayView];
-        }];
-    }
-    else {
-        cansaveVideo = PREMISSIONTYPE_YES;
-        NSLog(@"已授权");
-    }
-    if (showAlert && displayView != nil && cansaveVideo == PREMISSIONTYPE_NO) {
-        [self showSetAlbumAlertViewInView:displayView];
-    }
-    return cansaveVideo;
-}
-
-//提示用户进行相机使用授权
-+ (void)showSetAlbumAlertViewInView:(UIView *)displayView {
-    [KSPremissionAlert shareInstanceDisplayImage:CHECKDEVICETYPE_CAMREA message:@"请开启相册访问权限" showInView:displayView cancel:^{
-        
-    } confirm:^{
-        [self openSettingView];
-    }];
-};
-
-+ (void)openSettingView {
-    if (@available(iOS 10, *)) {
-        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
-    } else {
-        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
-    }
-}
-
-@end

+ 0 - 149
KulexiuForStudent/KulexiuForStudent/Common/Base/UINavigationController+KSNavigationBar.m

@@ -1,149 +0,0 @@
-//
-//  UINavigationController+KSNavigationBar.m
-//  TeacherDaya
-//
-//  Created by Kyle on 2020/6/28.
-//  Copyright © 2020 DayaMusic. All rights reserved.
-//
-
-#import "UINavigationController+KSNavigationBar.h"
-#import <objc/runtime.h>
-#import "KSBaseViewController.h"
-
-typedef void(^_KSViewControllerWillAppearInjectBlock)(UIViewController *controller, BOOL animated);
-
-@interface UIViewController (HandlerNavigationBarPrivate)
-
-@property(nonatomic, copy) _KSViewControllerWillAppearInjectBlock ks_willAppearInjectBlock;
-
-@end
-
-#pragma mark -- 替换UIViewController的viewWillAppear方法,在此方法中,执行设置导航栏隐藏和显示的代码块。
-
-@implementation UIViewController (HandlerNavigationBarPrivate)
-
-+ (void)load
-{
-    Method orginalMethod = class_getInstanceMethod(self, @selector(viewWillAppear:));
-    Method swizzledMethod = class_getInstanceMethod(self, @selector(ks_viewWillAppear:));
-    method_exchangeImplementations(orginalMethod, swizzledMethod);
-}
-
-- (void)ks_viewWillAppear:(BOOL)animated
-{
-    [self ks_viewWillAppear:animated];
-
-//    if ([self isKindOfClass:[KSBaseViewController class]]) {
-        if (self.ks_willAppearInjectBlock) {
-            self.ks_willAppearInjectBlock(self, animated);
-        }
-//    }
-}
-
-
-- (_KSViewControllerWillAppearInjectBlock)ks_willAppearInjectBlock
-{
-    return objc_getAssociatedObject(self, _cmd);
-}
-
-- (void)setKs_willAppearInjectBlock:(_KSViewControllerWillAppearInjectBlock)block
-{
-    objc_setAssociatedObject(self, @selector(ks_willAppearInjectBlock), block, OBJC_ASSOCIATION_COPY_NONATOMIC);
-}
-
-@end
-
-#pragma mark --  给UIViewController添加lsl_prefersNavigationBarHidden属性
-@implementation UIViewController (KSHanderNavigationBar)
-
-- (BOOL)ks_prefersNavigationBarHidden
-{
-    return [objc_getAssociatedObject(self, _cmd) boolValue];
-}
-
-- (void)setKs_prefersNavigationBarHidden:(BOOL)hidden {
-    objc_setAssociatedObject(self, @selector(ks_prefersNavigationBarHidden), @(hidden), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-@end
-
-#pragma mark ---- 替换UINavigationController的pushViewController:animated:方法,在此方法中去设置导航栏的隐藏和显示
-@implementation UINavigationController (KSNavigationBar)
-
-+ (void)load
-{
-    Method originMethod = class_getInstanceMethod(self, @selector(pushViewController:animated:));
-    Method swizzedMethod = class_getInstanceMethod(self, @selector(ks_pushViewController:animated:));
-    method_exchangeImplementations(originMethod, swizzedMethod);
-
-    Method originSetViewControllersMethod = class_getInstanceMethod(self, @selector(setViewControllers:animated:));
-    Method swizzedSetViewControllersMethod = class_getInstanceMethod(self, @selector(ks_setViewControllers:animated:));
-    method_exchangeImplementations(originSetViewControllersMethod, swizzedSetViewControllersMethod);
-}
-
-- (void)ks_pushViewController:(UIViewController *)viewController animated:(BOOL)animated
-{
-//    if ([viewController isKindOfClass:[KSBaseViewController class]]) {
-        // Handle perferred navigation bar appearance.
-        [self ks_setupViewControllerBasedNavigationBarAppearanceIfNeeded:viewController];
-//    }
-   
-    // Forward to primary implementation.
-    [self ks_pushViewController:viewController animated:animated];
-}
-
-- (void)ks_setViewControllers:(NSArray<UIViewController *> *)viewControllers animated:(BOOL)animated
-{
-    // Handle perferred navigation bar appearance.
-    for (UIViewController *viewController in viewControllers) {
-//        if ([viewController isKindOfClass:[KSBaseViewController class]]) {
-            [self ks_setupViewControllerBasedNavigationBarAppearanceIfNeeded:viewController];
-//        }
-    }
-
-    // Forward to primary implementation.
-    [self ks_setViewControllers:viewControllers animated:animated];
-}
-
-- (void)ks_setupViewControllerBasedNavigationBarAppearanceIfNeeded:(UIViewController *)appearingViewController
-{
-    if (!self.ks_viewControllerBasedNavigationBarAppearanceEnabled) {
-        return;
-    }
-
-    // 即将被调用的代码块
-    __weak typeof(self) weakSelf = self;
-    _KSViewControllerWillAppearInjectBlock block = ^(UIViewController *viewController, BOOL animated){
-        __strong typeof(weakSelf) strongSelf = weakSelf;
-        if (strongSelf) {
-            [strongSelf setNavigationBarHidden:viewController.ks_prefersNavigationBarHidden animated:animated];
-        }
-    };
-
-    // 给即将显示的控制器,注入代码块
-    appearingViewController.ks_willAppearInjectBlock = block;
-
-    // 因为不是所有的都是通过push的方式,把控制器压入stack中,也可能是"-setViewControllers:"的方式,所以需要对栈顶控制器做下判断并赋值。
-    UIViewController *disappearingViewController = self.viewControllers.lastObject;
-    if (disappearingViewController && !disappearingViewController.ks_willAppearInjectBlock) {
-        disappearingViewController.ks_willAppearInjectBlock = block;
-    }
-}
-
-- (BOOL)ks_viewControllerBasedNavigationBarAppearanceEnabled
-{
-    NSNumber *number = objc_getAssociatedObject(self, _cmd);
-    if (number) {
-        return number.boolValue;
-    }
-    self.ks_viewControllerBasedNavigationBarAppearanceEnabled = YES;
-    return YES;
-}
-
-- (void)setKs_viewControllerBasedNavigationBarAppearanceEnabled:(BOOL)enabled {
-    SEL key = @selector(ks_viewControllerBasedNavigationBarAppearanceEnabled);
-    objc_setAssociatedObject(self, key, @(enabled), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-
-@end

+ 0 - 23
KulexiuForStudent/KulexiuForStudent/Common/Base/UIViewController+KSExtension.m

@@ -1,23 +0,0 @@
-//
-//  UIViewController+KSExtension.m
-//  GuanYueTeamManager
-//
-//  Created by 王智 on 2023/3/1.
-//
-
-#import "UIViewController+KSExtension.h"
-#import <objc/runtime.h>
-
-
-@implementation UIViewController (KSExtension)
-
-- (BOOL)ks_landScape {
-    BOOL landScape = [objc_getAssociatedObject(self, _cmd) boolValue];
-    return landScape;
-}
-
-- (void)setKs_landScape:(BOOL)ks_landScape {
-    objc_setAssociatedObject(self, @selector(ks_landScape), @(ks_landScape), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-@end

+ 0 - 32
KulexiuForStudent/KulexiuForStudent/Common/Base/WeakWebViewScriptMessageDelegate.m

@@ -1,32 +0,0 @@
-//
-//  WeakWebViewScriptMessageDelegate.m
-//  StudentDaya
-//
-//  Created by Kyle on 2021/8/10.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import "WeakWebViewScriptMessageDelegate.h"
-
-@implementation WeakWebViewScriptMessageDelegate
-
-- (instancetype)initWithDelegate:(id<WKScriptMessageHandler>)scriptDelegate {
-    self = [super init];
-    if (self) {
-        _scriptDelegate = scriptDelegate;
-    }
-    return self;
-}
-
-#pragma mark - WKScriptMessageHandler
-//遵循WKScriptMessageHandler协议,必须实现如下方法,然后把方法向外传递
-//通过接收JS传出消息的name进行捕捉的回调方法
-- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
-    
-    if ([self.scriptDelegate respondsToSelector:@selector(userContentController:didReceiveScriptMessage:)]) {
-        [self.scriptDelegate userContentController:userContentController didReceiveScriptMessage:message];
-    }
-}
-
-
-@end

BIN
KulexiuForStudent/KulexiuForStudent/Common/Base/banzou.mp3


+ 0 - 48
KulexiuForStudent/KulexiuForStudent/Common/Base/kSJXCollectionView.m

@@ -1,48 +0,0 @@
-//
-//  kSJXCollectionView.m
-//  KulexiuForTeacher
-//
-//  Created by Kyle on 2022/3/29.
-//
-
-#import "kSJXCollectionView.h"
-
-@implementation kSJXCollectionView
-
-- (void)beginFirstRefresh {
-    
-}
-
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
-    !self.scrollCallback ?: self.scrollCallback(scrollView);
-}
-#pragma mark - JXPagingViewListViewDelegate
-
-- (UIView *)listView {
-    return self;
-}
-
-- (UIScrollView *)listScrollView {
-    return self.collectionView;
-}
-
-- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
-    self.scrollCallback = callback;
-}
-
-- (void)listDidAppear {
-    NSLog(@"listDidAppear");
-}
-
-- (void)listDidDisappear {
-    NSLog(@"listDidDisappear");
-}
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect {
-    // Drawing code
-}
-*/
-
-@end

+ 17 - 4
KulexiuForStudent/KulexiuForStudent/Common/Define/Common.h

@@ -14,10 +14,23 @@
 #define Common_h
 
 #import "MJExtension.h"
-#import "NSString+Extension.h"
-#import <UIImageView+WebCache.h>
-#import "MSSBrowseDefine.h"
-#import "NSObject+KeyWindow.h"
+#import <SDWebImage/UIImageView+WebCache.h>
+
+#import <KSToolLibrary/NSString+Extension.h>
+#import <KSToolLibrary/MSSBrowseDefine.h>
+#import <KSToolLibrary/NSObject+KeyWindow.h>
+#import <KSToolLibrary/UIView+KSLayer.h>
+#import <KSToolLibrary/KSSafeObject.h>
+#import <KSToolLibrary/NSDictionary+Extension.h>
+#import <KSToolLibrary/UIControl+ButtonAction.h>
+#import <KSToolLibrary/UIView+KSExtension.h>
+#import <KSToolLibrary/UIViewController+KSExtension.h>
+#import <KSToolLibrary/UIViewController+zhStatusBarStyle.h>
+#import <KSToolLibrary/UIView+SubViewExtension.h>
+#import <KSToolLibrary/NSObject+KSDateFormatter.h>
+#import <KSToolLibrary/NSString+phone.h>
+#import <KSToolLibrary/KSUploadManager.h>
+
 
 #define FONT_COLOR (HexRGB(0x333333))
 

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/Common/Define/KSDomain.h

@@ -12,6 +12,8 @@
 #define AGENT_NAME (@"COLEXIUAPPI")
 #define AGENT_DOMAIN (@"COLEXIUSTUDENT")
 
+#define CERT_PATH ([[NSBundle mainBundle] pathForResource:@"client" ofType:@"p12"])
+
 #define WEBPATH (@"/student")
 
 #define TENANTPATH (@"/tenant")

+ 8 - 21
KulexiuForStudent/KulexiuForStudent/Common/Define/PrefixHeader.pch

@@ -9,35 +9,25 @@
 #ifndef PrefixHeader_pch
 #define PrefixHeader_pch
 
+#import "KSDomain.h"
 #import "Common.h"
-#import "UIColor+Hex.h"
-#import "MBProgressHUD+NJ.h"
-#import "UIViewController+zhStatusBarStyle.h"
-#import "pickBut.h"
-#import "NSDictionary+Extension.h"
-#import "NSString+MD5.h"
-#import "UIView+TZLayout.h"
-#import "UIImageView+WebCache.h"
+#import "UserKeyHeader.h"
+#import "Macro.h"
+
+
+//#import "UIView+TZLayout.h"
 #import "Masonry.h"
 #import "MJRefresh.h"
 #import "KSNetworkingManager.h"
 #import "IQKeyboardManager.h"
-#import "UserKeyHeader.h"
-#import "UIView+ShowProgress.h"
-#import "UIControl+ButtonAction.h"
-#import "UIView+KSExtension.h"
-#import "Macro.h"
+
+
 #import "KSGifRefreshHeader.h"
 #import "KSGifRefreshFooter.h"
 
-#import "KSUploadManager.h"
-
-#import "UIView+SubViewExtension.h"
-#import "NSObject+KSDateFormatter.h"
 #import "KSLoginManager.h"
 #import "KSHudLoagingManager.h"
 
-#import "UIViewController+KSExtension.h"
 
 #define FIRST_LOGIN_KEY (@"FirstLoginKey")
 
@@ -48,8 +38,6 @@
 #define DEFAULT_SALT (@"D5sIlPU2")
 #define APPSECRET (@"QuMCIKICAgIH0sCiAgICAicGxhdGZvcm0tZGV2IjogW10")
 
-#import "KSSafeObject.h"
-
 #define KSKitDispatchDownloadMediaNotification (@"KSKitDispatchDownloadMediaNotification")
 
 #define KObjNull (id)[NSNull null]
@@ -139,6 +127,5 @@ shouldPrevent = NO; \
 // Include any system framework and library headers here that should be included in all compilation units.
 // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
 
-#import "KSDomain.h"
 
 #endif /* PrefixHeader_pch */

+ 11 - 10
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSMediaMergeView.m

@@ -8,10 +8,10 @@
 #import "KSMediaMergeView.h"
 #import "KSMergeAudioControlView.h"
 #import "KSAudioAnimationView.h"
-#import "KSMediaEditor.h"
+#import <KSToolLibrary/KSMediaEditor.h>
 #import "KSPlayerView.h"
 #import "KSPlayerSliderView.h"
-#import "kSNewPlayer.h"
+#import <CloudAccompanyLibrary/kSNewPlayer.h>
 #import "KSVideoPlayerView.h"
 #import "KSAudioPlayAnimationView.h"
 #import "KSNewAlertView.h"
@@ -19,7 +19,7 @@
 #import "KSMediaManager.h"
 #import <RSKImageCropper/RSKImageCropper.h>
 #import "KSVideoCropViewController.h"
-#import "KSAudioSessionManager.h"
+#import <KSToolLibrary/KSAudioSessionManager.h>
 
 
 @interface KSMediaMergeView ()<kSNewPlayerManagerDelegate,KSVideoPlayerViewDelegate,RSKImageCropViewControllerDelegate,RSKImageCropViewControllerDataSource>
@@ -759,8 +759,8 @@
     if (self.settingImage) {
         NSData *imgData = [UIImage turnsImaegDataByImage:self.settingImage];
         NSString *fileName = @"musicCoverImg";
-        [[KSUploadManager shareInstance] configBucketName:@"klx"];
-        [[KSUploadManager shareInstance] uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+        [UPLOAD_MANAGER configWithfilePath:@"/user/"];
+        [UPLOAD_MANAGER uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
             NSString *avatarUrl = [fileUrlArray lastObject];
             self.coverImage = avatarUrl;
             [self uploadVideoCover];
@@ -780,8 +780,8 @@
     if (self.videoCoverImage) {
         NSData *imgData = [UIImage turnsImaegDataByImage:self.videoCoverImage];
         NSString *fileName = @"musicCoverImg";
-        [[KSUploadManager shareInstance] configBucketName:@"klx"];    
-        [[KSUploadManager shareInstance] uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
+        [UPLOAD_MANAGER configWithfilePath:@"/user/"];
+        [UPLOAD_MANAGER uploadImage:imgData fileName:fileName successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
             NSString *avatarUrl = [fileUrlArray lastObject];
             self.videoCoverUrl = avatarUrl;
             [self publishMusic];
@@ -1162,8 +1162,8 @@
     [LOADING_MANAGER showProgressLoading:tips progress:beginProgress];
     NSData *fileData = [NSData dataWithContentsOfURL:fileUrl];
     NSString *suffix = [NSString stringWithFormat:@".%@",[fileUrl pathExtension]];
-    [[KSUploadManager shareInstance] configBucketName:@"klx"];
-    [[KSUploadManager shareInstance] videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
+    [UPLOAD_MANAGER configWithfilePath:@"/user/"];
+    [UPLOAD_MANAGER videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
         // 显示进度
         float progress = (bytesWritten*1.0 / totalBytes) * rate + beginProgress;
         dispatch_main_async_safe(^{
@@ -1195,7 +1195,8 @@
     [LOADING_MANAGER showProgressLoading:tips progress:beginProgress];
     NSData *fileData = [NSData dataWithContentsOfURL:fileUrl];
     NSString *suffix = [NSString stringWithFormat:@".%@",[fileUrl pathExtension]];
-    [[KSUploadManager shareInstance] configBucketName:@"klx"];    [UPLOAD_MANAGER uploadFile:fileData fileName:@"evaluateAudio" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
+    [UPLOAD_MANAGER configWithfilePath:@"/user/"];
+    [UPLOAD_MANAGER uploadFile:fileData fileName:@"evaluateAudio" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
         // 显示进度
         float progress = (bytesWritten*1.0 / totalBytes) * rate + beginProgress;
         dispatch_main_async_safe(^{

+ 0 - 327
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/MediaEditor/KSMediaEditor.m

@@ -1,327 +0,0 @@
-//
-//  KSMediaEditor.m
-//  KulexiuSchoolStudent
-//
-//  Created by 王智 on 2023/8/28.
-//
-
-#import "KSMediaEditor.h"
-#import <AVFoundation/AVFoundation.h>
-
-
-@implementation KSMediaEditor
-
-
-
-/// 音频合成,录音文件添加伴奏
-/// - Parameters:
-///   - recordUrl: 录制文件地址
-///   - recordVolume: 录制文件音量
-///   - bgAudioUrl: 背景音
-///   - bgAudioVolume: 背景音乐音量
-///   - offsetTime: 偏移时间 (录制声音和伴奏声音的偏移  + 伴奏提前 - 伴奏延迟 ms )
-///   - completionHandle: 完成回调
-+ (void)mixRecordAudio:(NSURL *)recordUrl recordVolume:(float)recordVolume bgAudio:(NSURL *)bgAudioUrl bgAudioVolume:(float)bgAudioVolume offsetTime:(NSInteger)offsetTime  completion:(void (^)(NSString *outPath,BOOL isSuccess, NSString *desc))completionHandle {
-    
-    if (recordUrl == nil) {
-        completionHandle(nil, NO, @"未找到录音文件");
-        return;
-    }
-    else if (bgAudioUrl == nil) {
-        completionHandle(nil, NO, @"未找到伴奏文件");
-        return;
-    }
-    AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix];
-
-    //创建可变的音频视频组合
-    AVMutableComposition *mixComposition = [AVMutableComposition composition];
-    
-    // 录音
-    AVURLAsset *recordAsset = [AVURLAsset assetWithURL:recordUrl];
-    float recordDuration = CMTimeGetSeconds(recordAsset.duration);
-    // 音频轨道
-    AVMutableCompositionTrack *recordCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
-    
-    
-    // 伴奏
-    AVURLAsset *bgAudioAssest = [AVURLAsset assetWithURL:bgAudioUrl];
-    float bgAudioDuration = CMTimeGetSeconds(bgAudioAssest.duration);
-    AVMutableCompositionTrack *bgAudioCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
-    
-    CMTime offsetCTTime = CMTimeMake(labs(offsetTime), 1000);
-        
-    
-    AVAssetTrack *recordAssetTrack = [[recordAsset tracksWithMediaType:AVMediaTypeAudio] firstObject];
-    AVAssetTrack *bgAudioAssetTrack = [[bgAudioAssest tracksWithMediaType:AVMediaTypeAudio] firstObject];
-    
-    // 录音文件
-    [recordCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, recordAsset.duration) ofTrack:recordAssetTrack atTime:kCMTimeZero error:nil];
-    // 伴奏文件
-    CMTime bgTime = kCMTimeZero;
-    // 伴奏文件时长
-    if (bgAudioDuration >= offsetTime/1000.0 + recordDuration) {
-        bgTime = recordAsset.duration;
-    }
-    else {
-        bgTime = bgAudioAssest.duration;
-    }
-    if (offsetTime > 0) {
-        [bgAudioCompositionTrack insertTimeRange:CMTimeRangeMake(offsetCTTime, bgTime) ofTrack:bgAudioAssetTrack atTime:kCMTimeZero error:nil];
-    }
-    else {
-        [bgAudioCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, bgTime) ofTrack:bgAudioAssetTrack atTime:offsetCTTime error:nil];
-    }
-    
-    // 合成
-    AVMutableAudioMixInputParameters *newRecordInputParams = [AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:recordCompositionTrack];
-    [newRecordInputParams setTrackID:recordCompositionTrack.trackID];
-    [newRecordInputParams setVolume:recordVolume atTime:kCMTimeZero];
-
-    AVMutableAudioMixInputParameters *newBgInputParams = [AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:bgAudioCompositionTrack];
-    [newBgInputParams setTrackID:bgAudioCompositionTrack.trackID];
-    [newBgInputParams setVolume:bgAudioVolume atTime:kCMTimeZero];
-    
-    audioMix.inputParameters = [NSArray arrayWithObjects:newRecordInputParams,newBgInputParams,nil];
-
-    [self sessionExportAction:mixComposition outputPath:[self getAudioOutputPath] presetName:AVAssetExportPresetAppleM4A outputFileType:@"com.apple.m4a-audio" audioMix:audioMix completion:^(NSString *outPath, BOOL isSuccess, NSString *desc) {
-        completionHandle(outPath, isSuccess, desc);
-    }];
-}
-
-
-+ (void)sessionExportAction:(AVAsset *)asset outputPath:(NSString *)outputPath presetName:(NSString *)presetName outputFileType:(NSString *)outputFileType audioMix:(AVAudioMix *)audioMix completion:(void (^)(NSString *outPath,BOOL isSuccess, NSString *desc))completionHandle {
-    AVAssetExportSession *session = [[AVAssetExportSession alloc] initWithAsset:asset presetName:presetName];
-    
-    if ([[NSFileManager defaultManager] fileExistsAtPath:outputPath]) {
-        [[NSFileManager defaultManager] removeItemAtPath:outputPath error:nil];
-    }
-    
-    session.outputURL = [NSURL fileURLWithPath:outputPath];
-    session.outputFileType = outputFileType;
-    session.shouldOptimizeForNetworkUse = YES;
-    session.audioMix = audioMix;
-    if ([outputFileType isEqualToString:AVFileTypeQuickTimeMovie]) {
-        AVMutableVideoComposition *videoComposition = [AVMutableVideoComposition videoCompositionWithPropertiesOfAsset:asset];
-        videoComposition.frameDuration = CMTimeMake(1, 10);
-        videoComposition.renderSize = CGSizeMake(1280, 720);
-        session.videoComposition = videoComposition;
-    }
-    
-    [session exportAsynchronouslyWithCompletionHandler:^{
-        dispatch_async(dispatch_get_main_queue(), ^{
-            switch ([session status]) {
-                case AVAssetExportSessionStatusFailed:
-                {
-                    NSString *error = [[session error] description];
-                    NSLog(@"合成失败:%@", error);
-                    completionHandle(nil, NO, @"合成失败");
-                }
-                    break;
-                case AVAssetExportSessionStatusCancelled:
-                {
-                    completionHandle(nil, NO, @"取消合成");
-                }
-                    break;
-                case AVAssetExportSessionStatusCompleted:
-                {
-                    completionHandle(outputPath, YES, @"");
-                }
-                    break;
-                default:
-                {
-                    completionHandle(nil, NO, @"");
-                }
-                    break;
-            }
-        });
-    }];
-}
-
-
-// 获取音频输出文件地址
-+ (NSString *)getAudioOutputPath {
-    NSString *documentsDirectory =[NSHomeDirectory()
-                                   stringByAppendingPathComponent:@"Documents"];
-    //最终合成输出路径
-    NSString *outputFilePath =[documentsDirectory stringByAppendingPathComponent:@"outputAudio.m4a"];
-    
-    if([[NSFileManager defaultManager]fileExistsAtPath:outputFilePath])
-        [[NSFileManager defaultManager]removeItemAtPath:outputFilePath error:nil];
-    return outputFilePath;
-}
-
-
-
-/// 音视频合成
-/// - Parameters:
-///   - recordUrl: 录制文件地址
-///   - recordVolume: 录制文件音量
-///   - bgAudioUrl: 背景音
-///   - bgAudioVolume: 背景音乐音量
-///   - offsetTime: 偏移时间 (录制声音和伴奏声音的偏移  + 伴奏提前 - 伴奏延迟 ms )
-///   - videoUrl: 视频地址
-///   - completionHandle: 完成回调
-+ (void)mixVideoWithRecordAudio:(NSURL *)recordUrl
-                   recordVolume:(float)recordVolume
-                        bgAudio:(NSURL *)bgAudioUrl
-                  bgAudioVolume:(float)bgAudioVolume
-                     offsetTime:(NSInteger)offsetTime
-                    videoUrlStr:(NSURL *)videoUrl
-                     completion:(void (^)(NSString *outPath,BOOL isSuccess, NSString *desc))completionHandle {
-    if (recordUrl == nil) {
-        completionHandle(nil, NO, @"未找到录音文件");
-        return;
-    }
-    else if (bgAudioUrl == nil) {
-        completionHandle(nil, NO, @"未找到伴奏文件");
-        return;
-    }
-    
-    
-    //创建可变的音频视频组合
-    AVMutableComposition *mixComposition = [AVMutableComposition composition];
-    //视频采集
-    AVURLAsset* videoAsset =[[AVURLAsset alloc]initWithURL:videoUrl options:nil];
-    CMTimeRange video_timeRange = CMTimeRangeMake(kCMTimeZero,videoAsset.duration);
-    // 视频时长
-    float videoDuration = CMTimeGetSeconds(videoAsset.duration);
-    AVMutableCompositionTrack *a_compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
-    [a_compositionVideoTrack insertTimeRange:video_timeRange
-                                     ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]
-                                      atTime:kCMTimeZero
-                                       error:nil];
-    
-    // 视频需要专设置transform
-    CGAffineTransform videoTransform = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0].preferredTransform;
-    [a_compositionVideoTrack setPreferredTransform:videoTransform];
-    
-    //创建最终混合的音频实例
-    AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix];
-    
-    // 录音
-    AVURLAsset *recordAsset = [AVURLAsset assetWithURL:recordUrl];
-    // 音频轨道
-    AVMutableCompositionTrack *recordCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
-
-    // 伴奏
-    AVURLAsset *bgAudioAssest = [AVURLAsset assetWithURL:bgAudioUrl];
-    AVMutableCompositionTrack *bgAudioCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
-    
-    CMTime offsetCTTime = CMTimeMake(labs(offsetTime), 1000);
-    
-    // 合成
-    AVAssetTrack *recordAssetTrack = [[recordAsset tracksWithMediaType:AVMediaTypeAudio] firstObject];
-    AVAssetTrack *bgAudioAssetTrack = [[bgAudioAssest tracksWithMediaType:AVMediaTypeAudio] firstObject];
-    
-    // 录音文件
-    CMTime recordCMTime = recordAsset.duration.value > videoAsset.duration.value ? videoAsset.duration : recordAsset.duration;
-    [recordCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, recordCMTime) ofTrack:recordAssetTrack atTime:kCMTimeZero error:nil];
-    
-    // 伴奏文件
-    CMTime bgTime = bgAudioAssest.duration.value > videoAsset.duration.value ? videoAsset.duration : bgAudioAssest.duration;
-    
-    if (offsetTime > 0) {
-        if (bgTime.value + offsetCTTime.value > videoAsset.duration.value) {
-            bgTime.value = videoAsset.duration.value - offsetCTTime.value;
-        }
-        [bgAudioCompositionTrack insertTimeRange:CMTimeRangeMake(offsetCTTime, bgTime) ofTrack:bgAudioAssetTrack atTime:kCMTimeZero error:nil];
-    }
-    else {
-        if (bgTime.value + offsetCTTime.value > videoAsset.duration.value) {
-            bgTime.value = videoAsset.duration.value - offsetCTTime.value;
-        }
-        [bgAudioCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, bgTime) ofTrack:bgAudioAssetTrack atTime:offsetCTTime error:nil];
-    }
-    
-    AVMutableAudioMixInputParameters *newRecordInputParams = [AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:recordCompositionTrack];
-    [newRecordInputParams setTrackID:recordCompositionTrack.trackID];
-    [newRecordInputParams setVolume:recordVolume atTime:kCMTimeZero];
-
-    AVMutableAudioMixInputParameters *newBgInputParams = [AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:bgAudioCompositionTrack];
-    [newBgInputParams setTrackID:bgAudioCompositionTrack.trackID];
-    [newBgInputParams setVolume:bgAudioVolume atTime:kCMTimeZero];
-
-    audioMix.inputParameters = [NSArray arrayWithObjects:newRecordInputParams,newBgInputParams,nil];
-
-   
-    //导出
-    [self sessionExportAction:mixComposition outputPath:[self getVideoOutputPath] presetName:AVAssetExportPreset1280x720 outputFileType:AVFileTypeQuickTimeMovie audioMix:audioMix completion:^(NSString *outPath, BOOL isSuccess, NSString *desc) {
-        completionHandle(outPath, isSuccess, desc);
-    }];
-    
-}
-
-/// 视频合成,设置录音文件
-/// - Parameters:
-///   - recordUrl: 录制文件地址
-///   - recordVolume: 录制文件音量 0-1
-///   - videoUrl: 视频地址
-///   - completionHandle: 完成回调
-+ (void)mixRecordVideoWithAudio:(NSURL *)recordUrl
-                   recordVolume:(float)recordVolume
-                    videoUrlStr:(NSURL *)videoUrl
-                     completion:(void (^)(NSString *outPath,BOOL isSuccess, NSString *desc))completionHandle {
-    if (recordUrl == nil) {
-        completionHandle(nil, NO, @"未找到录音文件");
-        return;
-    }
-    
-    //创建可变的音频视频组合
-    AVMutableComposition *mixComposition = [AVMutableComposition composition];
-    //视频采集
-    AVURLAsset* videoAsset =[[AVURLAsset alloc]initWithURL:videoUrl options:nil];
-    CMTimeRange video_timeRange = CMTimeRangeMake(kCMTimeZero,videoAsset.duration);
-    // 视频时长
-    float videoDuration = CMTimeGetSeconds(videoAsset.duration);
-    AVMutableCompositionTrack *a_compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
-    [a_compositionVideoTrack insertTimeRange:video_timeRange
-                                     ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]
-                                      atTime:kCMTimeZero
-                                       error:nil];
-    
-    // 视频需要专设置transform
-    CGAffineTransform videoTransform = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0].preferredTransform;
-    [a_compositionVideoTrack setPreferredTransform:videoTransform];
-    
-    //创建最终混合的音频实例
-    AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix];
-    
-    // 录音
-    AVURLAsset *recordAsset = [AVURLAsset assetWithURL:recordUrl];
-    float recordDuration = CMTimeGetSeconds(recordAsset.duration);
-    // 音频轨道
-    AVMutableCompositionTrack *recordCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
-    
-    // 合成
-    AVAssetTrack *recordAssetTrack = [[recordAsset tracksWithMediaType:AVMediaTypeAudio] firstObject];
-
-    // 如果时长超过视频的时长
-    CMTime duration = recordDuration > videoDuration ? recordAsset.duration : videoAsset.duration;
-    if (recordDuration > videoDuration) {
-        duration = videoAsset.duration;
-    }
-    // 录音文件
-    [recordCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, duration) ofTrack:recordAssetTrack atTime:kCMTimeZero error:nil];
-    
-    AVMutableAudioMixInputParameters *newRecordInputParams = [AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:recordCompositionTrack];
-    [newRecordInputParams setTrackID:recordCompositionTrack.trackID];
-    [newRecordInputParams setVolume:recordVolume atTime:kCMTimeZero];
-    audioMix.inputParameters = [NSArray arrayWithObjects:newRecordInputParams,nil];
-    //导出
-    [self sessionExportAction:mixComposition outputPath:[self getVideoOutputPath] presetName:AVAssetExportPreset1280x720 outputFileType:AVFileTypeQuickTimeMovie audioMix:audioMix completion:^(NSString *outPath, BOOL isSuccess, NSString *desc) {
-        completionHandle(outPath, isSuccess, desc);
-    }];
-}
-
-+ (NSString *)getVideoOutputPath {
-    NSString *documentsDirectory =[NSHomeDirectory()
-                                   stringByAppendingPathComponent:@"Documents"];
-    //最终合成输出路径
-    NSString *outputFilePath =[documentsDirectory stringByAppendingPathComponent:@"outputVideo.mp4"];
-    
-    if([[NSFileManager defaultManager]fileExistsAtPath:outputFilePath])
-        [[NSFileManager defaultManager]removeItemAtPath:outputFilePath error:nil];
-    return outputFilePath;
-}
-
-@end

+ 0 - 97
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/MusicPlayer/AVPlayer+KSSeekSmoothly.m

@@ -1,97 +0,0 @@
-//
-//  AVPlayer+KSSeekSmoothly.m
-//  KulexiuSchoolStudent
-//
-//  Created by 王智 on 2023/11/24.
-//
-
-#import "AVPlayer+KSSeekSmoothly.h"
-#import <objc/runtime.h>
-
-@interface AVPlayerSeeker : NSObject
-{
-    CMTime targetTime;
-    BOOL isSeeking;
-}
-
-@property (weak, nonatomic) AVPlayer *player;
-
-@property (nonatomic, strong) dispatch_queue_t queue;
-
-@end
-
-@implementation AVPlayerSeeker
-
-- (instancetype)initWithPlayer:(AVPlayer *)player {
-    self = [super init];
-    if (self) {
-        self.player = player;
-        _queue = dispatch_queue_create("ks.seekTimeQueue", DISPATCH_QUEUE_SERIAL);
-    }
-    return self;
-}
-
-- (void)seekSmoothlyToTime:(CMTime)time toleranceBefore:(CMTime)toleranceBefore toleranceAfter:(CMTime)toleranceAfter completionHandler:(void (^)(BOOL))completionHandler {
-    targetTime = time;
-    if (!isSeeking) {
-        [self trySeekToTargetTimeWithToleranceBefore:toleranceBefore toleranceAfter:toleranceAfter completionHandler:completionHandler];
-    }
-}
-
-- (void)trySeekToTargetTimeWithToleranceBefore:(CMTime)toleranceBefore toleranceAfter:(CMTime)toleranceAfter completionHandler:(void (^)(BOOL))completionHandler {
-    if (self.player.currentItem.status == AVPlayerItemStatusReadyToPlay) {
-        [self seekToTargetTimeToleranceBefore:toleranceBefore toleranceAfter:toleranceAfter completionHandler:completionHandler];
-    }
-}
-
-- (void)seekToTargetTimeToleranceBefore:(CMTime)toleranceBefore toleranceAfter:(CMTime)toleranceAfter completionHandler:(void (^)(BOOL))completionHandler {
-    isSeeking = YES;
-    CMTime seekingTime = targetTime;
-    
-    dispatch_async(_queue, ^{
-        [self.player seekToTime:seekingTime toleranceBefore:toleranceBefore
-                 toleranceAfter:toleranceAfter completionHandler:
-         ^(BOOL isFinished) {
-            if (CMTIME_COMPARE_INLINE(seekingTime, ==, self->targetTime)) {
-                 // seek completed
-                 self->isSeeking = NO;
-                dispatch_main_async_safe(^{
-                    if (completionHandler) {
-                        completionHandler(isFinished);
-                    }
-                });
-             } else {
-                 // targetTime has changed, seek again
-                 [self trySeekToTargetTimeWithToleranceBefore:toleranceBefore toleranceAfter:toleranceAfter completionHandler:completionHandler];
-             }
-         }];
-    });
-    
-    
-}
-
-@end
-
-static NSString *seekerKey = @"ss_seeker";
-
-@implementation AVPlayer (KSSeekSmoothly)
-
-- (void)ss_seekToTime:(CMTime)time {
-    [self ss_seekToTime:time toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero completionHandler:nil];
-}
-
-- (void)ss_seekToTime:(CMTime)time toleranceBefore:(CMTime)toleranceBefore toleranceAfter:(CMTime)toleranceAfter completionHandler:(void (^)(BOOL))completionHandler {
-
-    AVPlayerSeeker *seeker = objc_getAssociatedObject(self, &seekerKey);
-    if (!seeker) {
-        seeker = [[AVPlayerSeeker alloc] initWithPlayer:self];
-        objc_setAssociatedObject(self, &seekerKey, seeker, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-    }
-
-//    [self pause];
-    [seeker seekSmoothlyToTime:time toleranceBefore:toleranceBefore toleranceAfter:toleranceAfter completionHandler:completionHandler];
-}
-
-
-
-@end

+ 0 - 457
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/MusicPlayer/kSNewPlayer.m

@@ -1,457 +0,0 @@
-//
-//  kSNewPlayer.m
-//  StudentDaya
-//
-//  Created by 王智 on 2023/5/17.
-//  Copyright © 2023 DayaMusic. All rights reserved.
-//
-
-#import "kSNewPlayer.h"
-#import "UrlDecode.h"
-#import "AVPlayer+KSSeekSmoothly.h"
-
-@interface kSNewPlayer ()
-
-@property(nonatomic,strong) AVPlayer *player;
-
-@property(nonatomic,strong) AVPlayerItem *songItem;
-
-@property(nonatomic,retain)id timeObserver;//时间观察
-
-@property (nonatomic, assign) BOOL cacheFinish;
-
-@property (nonatomic, assign) BOOL hasFreeObserver;
-
-@end
-
-@implementation kSNewPlayer
-
-+ (instancetype)shareInstance {
-    kSNewPlayer * manager = [[kSNewPlayer alloc] init];
-    return manager;
-}
-
-- (instancetype)init {
-    self = [super init];
-    if (self) {
-        
-    }
-    return self;
-}
-
-- (void)resetPlayer {
-    self.player = nil;
-}
-
-- (void)preparePlaySongWithUrl:(NSString *)urlStr {
-    self.cacheFinish = NO;
-    urlStr = [urlStr getUrlEndcodeString];
-    AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL URLWithString:urlStr] options:nil];
-    if (_songItem) {
-        [self removeAllNoticeAndObserver];
-        [self resetPlayer];
-    }
-    _songItem = [[AVPlayerItem alloc] initWithAsset:asset];
-    _player = [AVPlayer playerWithPlayerItem:_songItem];
-    if ([_player respondsToSelector:@selector(automaticallyWaitsToMinimizeStalling)]) {
-        _player.automaticallyWaitsToMinimizeStalling = NO;
-    }
-
-    //添加监听
-    [self addNotificationAndObserver];
-    self.volume = 1.0;
-    self.isMute = NO;
-    //    AVAudioPlayer *player = [[AVAudioPlayer alloc] init];
-}
-
-
-// 播放本地文件
-- (void)preparePlayNativeSongWithUrl:(NSString *)urlStr {
-    self.cacheFinish = NO;
-    NSURL *url = [NSURL fileURLWithPath:urlStr];
-    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
-    if (_songItem) {
-        [self removeAllNoticeAndObserver];
-        [self resetPlayer];
-    }
-    _songItem = [AVPlayerItem playerItemWithAsset:asset];
-    _player = [AVPlayer playerWithPlayerItem:_songItem];
-    if ([_player respondsToSelector:@selector(automaticallyWaitsToMinimizeStalling)]) {
-        _player.automaticallyWaitsToMinimizeStalling = NO;
-    }
-    //添加监听
-    [self addNotificationAndObserver];
-    self.volume = 1.0;
-    self.isMute = NO;
-}
-
-- (void)preparePlayNativeSongWithPath:(NSURL *)urlStr {
-    self.cacheFinish = NO;
-    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:urlStr options:nil];
-    if (_songItem) {
-        [self removeAllNoticeAndObserver];
-        [self resetPlayer];
-    }
-    _songItem = [AVPlayerItem playerItemWithAsset:asset];
-    _player = [AVPlayer playerWithPlayerItem:_songItem];
-    if ([_player respondsToSelector:@selector(automaticallyWaitsToMinimizeStalling)]) {
-        _player.automaticallyWaitsToMinimizeStalling = NO;
-    }
-    //添加监听
-    [self addNotificationAndObserver];
-    self.volume = 1.0;
-    self.isMute = NO;
-}
-
-- (void)addNotificationAndObserver {
-    if (self.songItem) {
-        self.hasFreeObserver = NO;
-        //添加播放器状态的监听
-        [self addAVPlayerStatusObserver];
-        //添加数据缓存的监听
-        [self addNetDataStatusObserver];
-        
-        //添加时间的监听
-        [self addTimeObserve];
-        //添加播放完成的通知
-        [self addPlayToEndObserver];
-        // 添加异常通知
-        [self addExceptionObserver];
-    }
-}
-- (void)configPlayerRate:(CGFloat)rate {
-    if (_isPlaying) {
-        if (rate >= 0) {
-            self.player.rate = rate;
-        }
-    }
-}
-
-- (void)startPlay {
-    if (_isPlaying) {
-        [_player pause];
-    }
-    _isPlaying = YES;
-    @weakObj(self);
-    CMTime toleranceTime = CMTimeMake(1, 1000);
-    [self.player ss_seekToTime:kCMTimeZero toleranceBefore:toleranceTime toleranceAfter:toleranceTime completionHandler:^(BOOL finished) {
-        @strongObj(self);
-        [self.player play];
-    }];
-}
-
-- (void)startPlayNoSeek {
-    if (_isPlaying) {
-        [_player pause];
-    }
-    _isPlaying = YES;
-    [self.player play];
-}
-
-- (void)resumePlay {
-    if (_isPlaying) {
-        [_player pause];
-    }
-    _isPlaying = YES;
-    [self.player play];
-}
-
-- (void)puasePlay {
-    if (_isPlaying) {
-        _isPlaying = NO;
-        [_player pause];
-    }
-}
-
-- (void)freePlayer {
-    if (_isPlaying) {
-        _isPlaying = NO;
-        [_player pause];
-    }
-    [self removeAllNoticeAndObserver];
-    [self resetPlayer];
-}
-
-- (void)seekToStart {
-    CMTime toleranceTime = CMTimeMake(1, 1000);
-    [self.player ss_seekToTime:kCMTimeZero toleranceBefore:toleranceTime toleranceAfter:toleranceTime completionHandler:^(BOOL finished) {
-        
-    }];
-}
-
-// 从某个位置开始播放 ms
-- (void)seekToTimePlay:(NSInteger)time {
-    _isPlaying = YES;
-    CMTime offsetCTTime = CMTimeMake(labs(time), 1000);
-    @weakObj(self);
-    CMTime toleranceTime = CMTimeMake(1, 1000);
-    [self.player ss_seekToTime:offsetCTTime toleranceBefore:toleranceTime toleranceAfter:toleranceTime completionHandler:^(BOOL finished) {
-        @strongObj(self);
-        [self.player play];
-    }];
-}
-
-// 调整进度到某个位置
-- (void)seekToTime:(NSInteger)time callback:(void(^)(void))callback {
-    [self.player pause];
-    CMTime offsetCTTime = CMTimeMake(labs(time), 1000);
-    CMTime toleranceTime = CMTimeMake(1, 1000);
-    [self.player ss_seekToTime:offsetCTTime toleranceBefore:toleranceTime toleranceAfter:toleranceTime completionHandler:^(BOOL finished) {
-        callback();
-    }];
-}
-
-- (void)seekOffsetTime:(NSInteger)offsetTime {
-    CMTime newTime = CMTimeMake(offsetTime, 1000);
-    CMTime toleranceTime = CMTimeMake(1, 1000);
-    
-    [self.player pause];
-    @weakObj(self);
-    [self.player ss_seekToTime:newTime toleranceBefore:toleranceTime toleranceAfter:toleranceTime completionHandler:^(BOOL finished) {
-        @strongObj(self);
-        if (self.isPlaying) {
-            [self.player play];
-        }
-    }];
-}
-
-// 调整进度
-- (void)seekOffsetTimeNoPuase:(NSInteger)offsetTime {
-    CMTime newTime = CMTimeMake(offsetTime, 1000);
-    CMTime toleranceTime = CMTimeMake(1, 1000);
-
-    [self.player ss_seekToTime:newTime toleranceBefore:toleranceTime toleranceAfter:toleranceTime completionHandler:^(BOOL finished) {
-
-    }];
-}
-
-- (CMTime)getCurrentPlayTime {
-    return [self.player currentTime];
-}
-
-- (void)setIsMute:(BOOL)isMute {
-    _isMute = isMute;
-    [self.player setMuted:isMute];
-}
-
-- (float)getTotalDuration {
-    float total = CMTimeGetSeconds(self.player.currentItem.asset.duration);
-    return total;
-}
-
-#pragma mark----设置player的volume
-- (void)setVolume:(CGFloat)volume {
-    _volume = volume;
-    _player.volume=_volume;
-}
-
--(void)addTimeObserve
-{
-//    __block typeof(self) bself = self;
-    @weakObj(self);
-    _timeObserver = [_player addPeriodicTimeObserverForInterval:CMTimeMake(1, 100) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {
-        @strongObj(self);
-        //设置player的声音
-        //        [self setPlayerVolume];
-        //当前时间
-        float current = CMTimeGetSeconds(time);
-        //总共时间
-        float total = CMTimeGetSeconds(self.player.currentItem.asset.duration);
-        //进度
-        float progress = current/total;
-        //将值传入知道delegate方法中
-        //        NSLog(@"--current %f -- total %f -----%f", current, total, progress);
-        if (self.delegate && [self.delegate respondsToSelector:@selector(getSongCurrentTime:andTotalTime:andProgress:currentInterval:playTime:inPlayer:)]) {
-            NSDate *date = [NSDate date];
-            NSTimeInterval inteveral = [date timeIntervalSince1970];
-            //            NSLog(@"----- start play %f", inteveral * 1000);
-            [self.delegate getSongCurrentTime:current*1000  andTotalTime:total*1000 andProgress:progress currentInterval:inteveral playTime:current*1000 inPlayer:self];
-        }
-    }];
-}
-
-#pragma mark---移除时间观察者
--(void)removeTimeObserver
-{
-    if (_timeObserver) {
-        [_player removeTimeObserver:_timeObserver];
-        _timeObserver = nil;
-    }
-}
-#pragma mark---float转00:00类型
-- (NSString *)formatTime:(float)num{
-    
-    int sec =(int)num%60;
-    int min =(int)num/60;
-    if (num < 60) {
-        return [NSString stringWithFormat:@"00:%02d",(int)num];
-    }
-    return [NSString stringWithFormat:@"%02d:%02d",min,sec];
-}
-#pragma mark----监听播放器的加载状态
--(void)addAVPlayerStatusObserver
-{
-    [_songItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
-}
-#pragma mark----数据缓冲状态的监听
--(void)addNetDataStatusObserver
-{
-    [_songItem addObserver:self forKeyPath:@"loadedTimeRanges" options:NSKeyValueObservingOptionNew context:nil];
-}
-
-
-#pragma mark----KVO方法
--(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context
-{
-    //播放器缓冲状态
-    if ([keyPath isEqualToString:@"status"]) {
-        switch (_player.status) {
-            case AVPlayerStatusUnknown:{
-                _isPlaying = NO;
-                NSLog(@"未知状态,此时不能播放");
-            }
-                break;
-            case AVPlayerStatusReadyToPlay: {
-                _isReady = YES;
-                NSLog(@"准备完毕,可以播放");
-                dispatch_main_sync_safe(^{
-                    if (self.delegate && [self.delegate respondsToSelector:@selector(playerIsReadyPlay:)]) {
-                        [self.delegate playerIsReadyPlay:self];
-                    }
-                });
-            }
-                break;
-            case AVPlayerStatusFailed:{
-                _isPlaying = NO;
-                NSLog(@"加载失败,网络或者服务器出现问题");
-            }
-                break;
-            default:
-                break;
-        }
-    }
-    //数据缓冲状态
-    if ([keyPath isEqualToString:@"loadedTimeRanges"]) {
-        // 计算缓冲进度
-        NSTimeInterval timeInterval = [self availableDuration];
-        CGFloat totalDuration = CMTimeGetSeconds(self.player.currentItem.asset.duration);
-        if (timeInterval == totalDuration && self.cacheFinish == NO) {
-            self.cacheFinish = YES;
-            dispatch_main_sync_safe(^{
-                if (self.delegate && [self.delegate respondsToSelector:@selector(preparePlay:)]) {
-                    [self.delegate preparePlay:self];
-                }
-            });
-        }
-    }
-}
-
-#pragma mark - 计算缓冲进度
-
-/**
- *  计算缓冲进度
- *
- *  @return 缓冲进度
- */
-- (NSTimeInterval)availableDuration {
-    NSArray *loadedTimeRanges = [[_player currentItem] loadedTimeRanges];
-    CMTimeRange timeRange     = [loadedTimeRanges.firstObject CMTimeRangeValue];// 获取缓冲区域
-    CGFloat startSeconds        = CMTimeGetSeconds(timeRange.start);
-    CGFloat durationSeconds     = CMTimeGetSeconds(timeRange.duration);
-    CGFloat result = startSeconds + durationSeconds;// 计算缓冲总进度
-    return result;
-}
-#pragma mark---移除媒体加载状态的监听
--(void)removeAVPlayerObserver
-{
-    [_songItem removeObserver:self forKeyPath:@"status"];
-}
-#pragma mark---移除数据加载状态的监听
--(void)removeNetDataObserver
-{
-    [_songItem removeObserver:self forKeyPath:@"loadedTimeRanges"];
-}
-#pragma mark----播放完成后发送通知
--(void)addPlayToEndObserver
-{
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playFinished:) name:AVPlayerItemDidPlayToEndTimeNotification object:_songItem];
-}
-#pragma mark ---- 异常通知
-- (void)addExceptionObserver {
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerError:) name:AVPlayerItemFailedToPlayToEndTimeNotification object:_songItem];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerError:) name:AVPlayerItemPlaybackStalledNotification object:_songItem];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerError:) name:AVPlayerItemPlaybackStalledNotification object:_songItem];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerError:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerError:) name:AVAudioSessionRouteChangeNotification object:[AVAudioSession sharedInstance]];
-}
-
--(void)playerError:(NSNotification *)notice {
-    //移除所有监听
-    dispatch_main_sync_safe(^{
-        if ([notice.name isEqualToString:AVAudioSessionRouteChangeNotification]) {
-            NSDictionary *info = notice.userInfo;
-            AVAudioSessionRouteChangeReason routeChangeReason = [[info valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue];
-            if (routeChangeReason == AVAudioSessionRouteChangeReasonCategoryChange) {
-                return;
-            }
-        }
-        if ([self.delegate respondsToSelector:@selector(playerDidError:)]) {
-            [self.delegate playerDidError:self];
-        }
-    });
-}
-
-#pragma mark---通知的方法
--(void)playFinished:(NSNotification *)notice
-{
-    //移除所有监听
-    _isPlaying = NO;
-    dispatch_main_sync_safe(^{
-        if ([notice.name isEqualToString:AVAudioSessionRouteChangeNotification]) {
-            NSDictionary *info = notice.userInfo;
-            AVAudioSessionRouteChangeReason routeChangeReason = [[info valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue];
-            if (routeChangeReason == AVAudioSessionRouteChangeReasonCategoryChange) {
-                return;
-            }
-        }
-        if ([self.delegate respondsToSelector:@selector(playFinished:)]) {
-            [self.delegate playFinished:self];
-        }
-    });
-}
-
-#pragma mark----移除通知
-- (void)removePlayToEndNotice
-{
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-#pragma mark-----移除所有监听
--(void)removeAllNoticeAndObserver
-{
-    if (self.hasFreeObserver) {
-        return;
-    }
-    self.hasFreeObserver = YES;
-    //移除时间进度的监听
-    [self removeTimeObserver];
-    //移除播放完成的通知
-    [self removePlayToEndNotice];
-    //移除播放器状态的监听
-    [self removeAVPlayerObserver];
-    //移除数据缓存的监听
-    [self removeNetDataObserver];
-}
-
-- (void)dealloc {
-    NSLog(@" -------- player dealloc ");
-}
-
-/*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
-
-@end

+ 0 - 25
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarCell.h

@@ -1,25 +0,0 @@
-//
-//  ALCalendarCell.h
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@class ALCalendarDate;
-
-@interface ALCalendarCell : UICollectionViewCell
-
-@property (nonatomic, strong) ALCalendarDate *date;
-
-/** 星期 */
-@property (nonatomic, copy) NSString *weekDay;
-
-@property (nonatomic, strong, readonly) UILabel *dateLabel;
-
-@property (nonatomic, assign) NSInteger cellType; //1星期 2日期
-
-
-@end

+ 0 - 107
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarCell.m

@@ -1,107 +0,0 @@
-//
-//  ALCalendarCell.m
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import "ALCalendarCell.h"
-
-#import "ALCalendarDate.h"
-
-#import <Masonry/Masonry.h>
-
-#define KLightGrayColor (HexRGB(0xAAAAAA))
-
-#define KDarkGrayColor  (HexRGB(0x444444))
-
-#define KcellBackColor (HexRGB(0xFFFFFF));
-
-@interface ALCalendarCell()
-
-@property (nonatomic, strong) UILabel *dateLabel;
-
-@end
-
-@implementation ALCalendarCell
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    
-    if(self = [super initWithFrame:frame]) {
-        [self setupView];
-    }
-    return self;
-}
-
-- (void)setupView
-{
-    [self addSubview:self.dateLabel];
-    
-//    self.layer.cornerRadius = 5.0f;
-    
-    __weak typeof(self) weakSelf = self;
-    [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.centerX.equalTo(weakSelf.mas_centerX);
-        make.centerY.equalTo(weakSelf.mas_centerY);
-    }];
-}
-
-- (void)setDate:(ALCalendarDate *)date
-{
-    _date = date;
-    if (date.notThisMonth) {
-        self.backgroundColor = [UIColor whiteColor];
-        self.dateLabel.textColor = KLightGrayColor;
-//        self.dateLabel.text = date.date;
-        self.dateLabel.text = @"";
-        
-//        self.hidden = YES;
-        self.backgroundColor = [UIColor clearColor];
-    } else {
-//        self.backgroundColor = [UIColor whiteColor];
-//        self.dateLabel.textColor = KDarkGrayColor;
-        self.dateLabel.text = date.date;
-//        self.backgroundColor = [UIColor colorWithHexString:@"#dddddd"];
-
-//        self.hidden = NO;
-    }
-//    self.dateLabel.text = date.date;
-}
-
--(void)setCellType:(NSInteger)cellType{
-    _cellType = cellType;
-    if (cellType == 1) {
-        self.dateLabel.textColor = HexRGB(0x777777);
-        self.dateLabel.font = [UIFont systemFontOfSize:16.0f weight:UIFontWeightMedium];
-        self.backgroundColor = [UIColor clearColor];
-        self.layer.masksToBounds = YES;
-        self.layer.cornerRadius = 0;
-    } else {
-        self.dateLabel.textColor = KLightGrayColor;
-        self.dateLabel.font = [UIFont systemFontOfSize:15.0f weight:UIFontWeightMedium];
-        self.backgroundColor = [UIColor clearColor];
-        self.layer.masksToBounds = YES;
-        self.layer.cornerRadius = ALcellWidth/2;
-    }
-}
-
-- (void)setWeekDay:(NSString *)weekDay
-{
-    _weekDay = weekDay;
-    self.dateLabel.text = weekDay;
-   
-}
-
-- (UILabel *)dateLabel
-{
-    if (!_dateLabel) {
-        _dateLabel = [[UILabel alloc] init];
-        
-    }
-    return _dateLabel;
-}
-
-
-@end

+ 0 - 33
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarCollectionView.h

@@ -1,33 +0,0 @@
-//
-//  ALCalendarCollectionView.h
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@class ALCalendarDate,ALCalendarCollectionView,ALCalendarConfig;
-
-@protocol ALCalendarCollectionViewDelegate <NSObject>
-
-/** 
- * 点击了某个日期
- */
-- (void)calendarView:(ALCalendarCollectionView *)calendarCollectionView didSelectItem:(ALCalendarDate *)date date:(NSDate *)dateObj dateString:(NSString *)dateString;
-
-@end
-
-@interface ALCalendarCollectionView : UICollectionView
-
-/** 当前的年份和月份 yyyy-MM */
-@property (nonatomic, copy) NSString *yearAndMonth;
-
-/** 代理 */
-@property (nonatomic, assign) id<ALCalendarCollectionViewDelegate> collectionViewDelegate;
-
-/** 配置 */
-@property (nonatomic, strong) ALCalendarConfig *config;
-
-@end

+ 0 - 211
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarCollectionView.m

@@ -1,211 +0,0 @@
-//
-//  ALCalendarCollectionView.m
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import "ALCalendarCollectionView.h"
-
-#import "ALCalendarCell.h"
-
-#import "ALCalendarDate.h"
-#import "ALCalendarHelper.h"
-#import "ALCalendarConfig.h"
-
-#import "UIView+ALFrame.h"
-
-#import "ALCalendarManager.h"
-
-#define ALScreenWidth [UIScreen mainScreen].bounds.size.width
-#define ALScreenHeight [UIScreen mainScreen].bounds.size.height
-
-
-@interface ALCalendarCollectionView()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
-
-@property (nonatomic, strong) NSArray *titles;
-
-@property (nonatomic, strong) NSArray *dates;
-
-@end
-
-@implementation ALCalendarCollectionView
-
-static NSString *identifier = @"dateCell";
-
-- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(nonnull UICollectionViewLayout *)layout
-{
-    if (self = [super initWithFrame:frame collectionViewLayout:layout]) {
-        self.dataSource      = self;
-        self.delegate        = self;
-//        self.contentInset    = UIEdgeInsetsMake(5, 20, 0, 20);
-//        self.layer.cornerRadius = 10;
-//        self.layer.masksToBounds = YES;
-        [self registerClass:[ALCalendarCell class] forCellWithReuseIdentifier:identifier];
-    }
-    return self;
-}
-
-#pragma mark - UICollectionDataSource
-- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
-{
-    return 2;
-}
-
-- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
-{
-    if (section == 0) return 7;
-    return self.dates.count;
-}
-
-- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    ALCalendarCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
-    cell.layer.borderColor = [UIColor whiteColor].CGColor;
-
-    
-    if(indexPath.section == 0) {
-        cell.cellType = 1;
-        cell.weekDay = self.titles[indexPath.row];
-    } else {
-        cell.cellType = 2;
-        ALCalendarDate *date = self.dates[indexPath.row];
-        cell.date = date;
-        
-        /** 当前显示的日期 */
-        NSString *dateString;
-        if (date.isLastMonth) { // 上个月
-            dateString = [[ALCalendarHelper lastYearAndMonth:self.yearAndMonth] stringByAppendingFormat:@"-%02zd",date.date.integerValue];
-        } else if (date.isNextMonth) { // 下个月
-            dateString = [[ALCalendarHelper nextYearAndMonth:self.yearAndMonth] stringByAppendingFormat:@"-%02zd",date.date.integerValue];
-        } else { // 这个月
-            dateString = [self.yearAndMonth stringByAppendingFormat:@"-%02zd",date.date.integerValue];
-        }
-        
-        
-        if ([self.config.heightlightDates containsObject:dateString]) {
-            cell.backgroundColor = self.config.hl_backgroundColor;
-            cell.layer.cornerRadius = self.config.hl_backgroundCornerRadius.floatValue;
-            cell.dateLabel.textColor = self.config.hl_textColor;
-        }
-        
-        if ([self.config.TwoheightlightDates containsObject:dateString]) {
-            cell.backgroundColor = self.config.h2_backgroundColor;
-            cell.layer.cornerRadius = self.config.h2_backgroundCornerRadius.floatValue;
-            cell.dateLabel.textColor = self.config.h2_textColor;
-        }
-        
-        if ([self.config.selectedDates containsObject:dateString]) {
-            cell.backgroundColor = self.config.sel_backgroundColor;
-            cell.layer.cornerRadius = self.config.sel_backgroundCornerRadius.floatValue;
-            cell.dateLabel.textColor = self.config.sel_textColor;
-        }
-        
-        
-        if (date.isToday) {
-            
-           /* if ([self.config.heightlightDates containsObject:dateString]  && self.config.hightlightPriority) {
-                
-                cell.backgroundColor = self.config.hl_backgroundColor;
-                cell.layer.cornerRadius = self.config.hl_backgroundCornerRadius.floatValue;
-                cell.dateLabel.textColor = self.config.hl_textColor;
-            }else if ([self.config.TwoheightlightDates containsObject:dateString]  && self.config.hightlightPriority) {
-                cell.backgroundColor = self.config.h2_backgroundColor;
-                cell.layer.cornerRadius = self.config.h2_backgroundCornerRadius.floatValue;
-                cell.dateLabel.textColor = self.config.h2_textColor;
-            }else*/ if ([self.config.selectedDates containsObject:dateString]  && self.config.hightlightPriority) {
-                cell.backgroundColor = self.config.sel_backgroundColor;
-                cell.layer.cornerRadius = self.config.sel_backgroundCornerRadius.floatValue;
-                cell.dateLabel.textColor = self.config.sel_textColor;
-            }
-            else{
-                cell.backgroundColor = [UIColor whiteColor];
-                cell.layer.cornerRadius  = self.config.tod_backgroundCornerRadius.floatValue;
-//                cell.layer.borderColor = self.config.tod_textColor.CGColor;
-//                cell.layer.borderWidth = 1.0f;
-                cell.dateLabel.textColor = self.config.tod_textColor;
-                ALCalendarDate *date = [[ALCalendarDate alloc] init];
-                date.date = @"今";
-                date.isToday = YES;
-                cell.date = date;
-            }
-        }
-        
-        if (date.isToday) {
-            if ([self.config.selectedDates containsObject:dateString]  && self.config.hightlightPriority) {
-                cell.backgroundColor = self.config.sel_backgroundColor;
-                cell.layer.cornerRadius = self.config.sel_backgroundCornerRadius.floatValue;
-                cell.dateLabel.textColor = self.config.sel_textColor;
-            }
-        }
-    }
-    
-    
-    return cell;
-}
-
-#pragma mark - UICollectionDelegate
-
-- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    if ([self.collectionViewDelegate respondsToSelector:@selector(calendarView:didSelectItem:date:dateString:)]) {
-        ALCalendarDate *date = self.dates[indexPath.row];
-        NSString *dateString;
-        if (date.isLastMonth) { // 上个月
-            dateString = [[ALCalendarHelper lastYearAndMonth:self.yearAndMonth] stringByAppendingFormat:@"-%02zd",date.date.integerValue];
-        } else if (date.isNextMonth) { // 下个月
-            dateString = [[ALCalendarHelper nextYearAndMonth:self.yearAndMonth] stringByAppendingFormat:@"-%02zd",date.date.integerValue];
-        } else { // 这个月
-            dateString = [self.yearAndMonth stringByAppendingFormat:@"-%02zd",date.date.integerValue];
-        }
-        NSDate *dateObj = [ALCalendarHelper dateStringToDate:dateString format:@"yyyy-MM-dd"];
-        [self.collectionViewDelegate calendarView:self didSelectItem:date date:dateObj dateString:dateString];
-    }
-}
-
-- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
-{
-//    return CGSizeMake(self.al_width / 10, self.al_width / 10);
-    return CGSizeMake(ALcellWidth, ALcellWidth);
-}
-
-- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
-{
-//{    return ((self.al_width - 40) - (7 * self.al_width / 10)) / 7;
-    return 5;
-}
-
-- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
-{
-//    return ((self.al_width - 40) - (7 * self.al_width / 10)) / 7;
-//    return ((ALScreenWidth - 60) - (7 * 18)) / 6;
-    return ((ALScreenWidth - 60) - (7 * ALcellWidth)) / 6 -1;
-
-}
-
-- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
-{
-    return UIEdgeInsetsMake(10, 20, 0, 20);
-}
-
-#pragma mark - setter & getter
-
-- (NSArray *)titles
-{
-    if (ALCALENDAR_MANAGER.startMonday) {
-        return @[@"一",@"二",@"三",@"四",@"五",@"六",@"日"];
-    }
-    return @[@"日",@"一",@"二",@"三",@"四",@"五",@"六"];
-}
-
-- (void)setYearAndMonth:(NSString *)yearAndMonth
-{
-    _yearAndMonth = yearAndMonth;
-    if (yearAndMonth) {
-        _dates = [ALCalendarHelper datesWithYearAndMonth:yearAndMonth];
-        [self reloadData];
-    }
-}
-
-@end

+ 0 - 66
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarConfig.h

@@ -1,66 +0,0 @@
-//
-//  ALCalendarConfig.h
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/17.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface ALCalendarConfig : NSObject
-
-/** 当前日期优先 */
-@property (nonatomic, assign) BOOL hightlightPriority;
-
-/**** 今天日期 *****/
-
-/** 文字颜色 */
-@property (nonatomic, strong) UIColor *tod_textColor;
-
-/** 背景颜色 */
-@property (nonatomic, strong) UIColor *tod_backgroundColor;
-
-/** 圆角 */
-@property (nonatomic, strong) NSNumber *tod_backgroundCornerRadius;
-
-/** Two高亮日期 */
-@property (nonatomic, strong) NSArray<NSString *> *TwoheightlightDates;
-/** 文字颜色 */
-@property (nonatomic, strong) UIColor *h2_textColor;
-
-/** 背景颜色 */
-@property (nonatomic, strong) UIColor *h2_backgroundColor;
-
-/** 圆角 */
-@property (nonatomic, strong) NSNumber *h2_backgroundCornerRadius;
-
-/**** 高亮日期 ****/
-
-/** 高亮日期 */
-@property (nonatomic, strong) NSArray<NSString *> *heightlightDates;
-
-/** 选择日期 */
-@property (nonatomic, strong) NSArray<NSString *> *selectedDates;
-
-/** 文字颜色 */
-@property (nonatomic, strong) UIColor *hl_textColor;
-
-/** 背景颜色 */
-@property (nonatomic, strong) UIColor *hl_backgroundColor;
-
-/** 圆角 */
-@property (nonatomic, strong) NSNumber *hl_backgroundCornerRadius;
-
-/**** 选中日期 ****/
-
-/** 文字颜色 */
-@property (nonatomic, strong) UIColor *sel_textColor;
-
-/** 背景颜色 */
-@property (nonatomic, strong) UIColor *sel_backgroundColor;
-
-/** 圆角 */
-@property (nonatomic, strong) NSNumber *sel_backgroundCornerRadius;
-
-@end

+ 0 - 13
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarConfig.m

@@ -1,13 +0,0 @@
-//
-//  ALCalendarConfig.m
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/17.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import "ALCalendarConfig.h"
-
-@implementation ALCalendarConfig
-
-@end

+ 0 - 32
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarDate.h

@@ -1,32 +0,0 @@
-//
-//  ALCalendarDate.h
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/17.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface ALCalendarDate : NSObject
-
-/** 日期(号数) */
-@property (nonatomic, copy) NSString *date;
-
-/** 是上个月 */
-@property (nonatomic, assign) BOOL isLastMonth;
-
-/** 是下个月 */
-@property (nonatomic, assign) BOOL isNextMonth;
-
-/** 不是这个月 */
-@property (nonatomic, assign) BOOL notThisMonth;
-
-/** 是今天 */
-@property (nonatomic, assign) BOOL isToday;
-
-+ (instancetype)lastMonthDateWith:(NSString *)dateStr;
-
-+ (instancetype)nextMonthDateWith:(NSString *)dateStr;
-
-@end

+ 0 - 31
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarDate.m

@@ -1,31 +0,0 @@
-//
-//  ALCalendarDate.m
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/17.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import "ALCalendarDate.h"
-
-@implementation ALCalendarDate
-
-+ (instancetype)lastMonthDateWith:(NSString *)dateStr
-{
-    ALCalendarDate *date = [[ALCalendarDate alloc] init];
-    date.date            = dateStr;
-    date.isLastMonth     = YES;
-    date.notThisMonth    = YES;
-    return date;
-}
-
-+ (instancetype)nextMonthDateWith:(NSString *)dateStr
-{
-    ALCalendarDate *date = [[ALCalendarDate alloc] init];
-    date.date            = dateStr;
-    date.isNextMonth     = YES;
-    date.notThisMonth    = YES;
-    return date;
-}
-
-@end

+ 0 - 42
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarHeader.h

@@ -1,42 +0,0 @@
-//
-//  ALCalendarHeader.h
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@class ALCalendarHeader;
-
-@protocol ALCalendarHeaderDelegate <NSObject>
-
-/**
- 点击了左边的按钮
- */
-- (void)header:(ALCalendarHeader *)header didClickLeftBtn:(UIButton *)button;
-
-/**
- 点击了右边的按钮
- */
-- (void)header:(ALCalendarHeader *)header didClickRightBtn:(UIButton *)button;
-
-@end
-
-@interface ALCalendarHeader : UIView
-
-/** 当前年月 yyyy-MM **/
-@property (nonatomic, copy) NSString *title;
-
-/** 起始年月 yyyy-MM */
-@property (nonatomic, copy) NSString *beginYearMonth;
-
-/** 结束年月 yyyy-MM */
-@property (nonatomic, copy) NSString *endYearMonth;
-
-/** 代理 */
-@property (nonatomic, assign) id<ALCalendarHeaderDelegate> delegate;
-
-
-@end

+ 0 - 192
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarHeader.m

@@ -1,192 +0,0 @@
-//
-//  ALCalendarHeader.m
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import "ALCalendarHeader.h"
-
-#import "ALCalendarHelper.h"
-
-#import "UIView+ALFrame.h"
-
-#import <Masonry/Masonry.h>
-
-@interface ALCalendarHeader()
-
-@property (nonatomic, strong) UIButton *leftBtn;
-
-@property (nonatomic, strong) UIButton *rightBtn;
-
-@property (nonatomic, strong) UIView *backView;
-
-@property (nonatomic, strong) UILabel *titleLabel;
-
-@end
-
-@implementation ALCalendarHeader
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    if (self = [super initWithFrame:frame]) {
-        [self setupView];
-    }
-    return self;
-}
-
-- (void)setupView
-{
-    [self addSubview:self.backView];
-    [self.backView addSubview:self.titleLabel];
-    [self.backView addSubview: self.rightBtn];
-    [self.backView addSubview: self.leftBtn];
-    
-    __weak typeof(self) weakSelf = self;
-    
-    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
-        __strong typeof(weakSelf) strongSelf = weakSelf;
-        make.left.equalTo(@0);
-        make.trailing.equalTo(@0);
-        make.top.equalTo(@0);
-        make.height.equalTo(strongSelf.mas_height);
-    }];
-    
-    [self.rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.trailing.equalTo(@-30);
-        make.top.equalTo(@25);
-        make.height.equalTo(@23);
-        make.width.equalTo(@23);
-    }];
-    
-    [self.leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
-        __strong typeof(weakSelf) strongSelf = weakSelf;
-        make.right.equalTo(strongSelf.rightBtn.mas_left).offset(-10);
-        make.top.equalTo(strongSelf.rightBtn.mas_top);
-        make.height.equalTo(strongSelf.rightBtn.mas_height);
-        make.width.equalTo(strongSelf.rightBtn.mas_width);
-    }];
-    
-    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(@15);
-        make.left.equalTo(@25);
-    }];
-}
-
-- (void)leftBtnDidClicked:(UIButton *)button
-{
-    if ([self.delegate respondsToSelector:@selector(header:didClickLeftBtn:)]) {
-        [self.delegate header:self didClickLeftBtn:button];
-    }
-    
-}
-
-- (void)rightBtnDidClicked:(UIButton *)button
-{
-    
-    if ([self.delegate respondsToSelector:@selector(header:didClickRightBtn:)]) {
-        [self.delegate header:self didClickRightBtn:button];
-    }
-    
-}
-
-- (UIImage *)imagesNamedFromCustomBundle:(NSString *)imgName
-{
-    NSString *bundlePath = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:@"ALCalendarPicker.bundle"];
-    NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];
-    NSString *img_path = [bundle pathForResource:imgName ofType:@"png"];
-    return [UIImage imageWithContentsOfFile:img_path];
-}
-
-- (void)verifyBeginAndEnd
-{
-    if ([self.title isEqualToString:self.beginYearMonth]) {
-        self.leftBtn.enabled = NO;
-    } else {
-        self.leftBtn.enabled = YES;
-    }
-    
-    if ([self.title isEqualToString:self.endYearMonth]) {
-        self.rightBtn.enabled = NO;
-    } else {
-        self.rightBtn.enabled = YES;
-    }
-}
-
-
-
-#pragma mark - setter & getter
-
-- (UIButton *)leftBtn
-{
-    if (!_leftBtn) {
-        _leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-        [_leftBtn setImage:[UIImage imageNamed:@"calendar_left"] forState:UIControlStateNormal];
-        [_leftBtn setImage:[UIImage imageNamed:@"calendar_left_highlight"] forState:UIControlStateHighlighted];
-        _leftBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
-        [_leftBtn addTarget:self action:@selector(leftBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside];
-    }
-    return _leftBtn;
-}
-
-- (UIView *)backView
-{
-    if (!_backView) {
-        _backView = [[UIView alloc]init];
-        _backView.backgroundColor = [UIColor whiteColor];
-    }
-    return _backView;
-}
-
-- (UIButton *)rightBtn
-{
-    if (!_rightBtn) {
-        _rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-        [_rightBtn setImage:[UIImage imageNamed:@"calendar_right"] forState:UIControlStateNormal];
-        [_rightBtn setImage:[UIImage imageNamed:@"calendar_right_highlight"] forState:UIControlStateHighlighted];
-        _rightBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
-        [_rightBtn addTarget:self action:@selector(rightBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside];
-    }
-    return _rightBtn;
-}
-
-- (UILabel *)titleLabel {
-    if (!_titleLabel) {
-        _titleLabel = [[UILabel alloc] init];
-        _titleLabel.backgroundColor = [UIColor clearColor];
-    }
-    return _titleLabel;
-}
-
-- (void)setTitle:(NSString *)title
-{
-    _title = title;
-    // 格式化显示日期
-    NSArray *dates = [title componentsSeparatedByString:@"-"];
-    NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@年%@月",dates.firstObject,dates.lastObject] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:24.0f weight:UIFontWeightMedium],NSForegroundColorAttributeName:HexRGB(0x333333)}];
-    
-//    [attributedStr addAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:25.0f]} range:NSMakeRange(0, 3)];
-    [self.titleLabel setAttributedText:attributedStr];
-    
-    // 验证开始时间和结束时间
-    [self verifyBeginAndEnd];
-}
-
-- (void)setBeginYearMonth:(NSString *)beginYearMonth
-{
-    _beginYearMonth = beginYearMonth;
-    
-    // 验证开始时间和结束时间
-    [self verifyBeginAndEnd];
-}
-
-- (void)setEndYearMonth:(NSString *)endYearMonth
-{
-    _endYearMonth = endYearMonth;
-    
-    // 验证开始时间和结束时间
-    [self verifyBeginAndEnd];
-}
-
-@end

+ 0 - 39
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarHelper.h

@@ -1,39 +0,0 @@
-//
-//  ALCalendarHelper.h
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface ALCalendarHelper : NSObject
-
-
-/** 根据当前年月得出日历数组 */
-+ (NSArray *)datesWithYearAndMonth:(NSString *)ym;
-
-/** 今天的年份和月份 yyyy-MM */
-+ (NSString *)currentYearAndMonth;
-
-/** 今天 yyyy-MM-dd */
-+ (NSString *)today;
-
-/** 今天 yyyy-MM-d */
-+ (NSString *)todayTwo;
-
-/** 指定某个年月yyyy-MM 得到下个年月yyyy-MM */
-+ (NSString *)nextYearAndMonth:(NSString *)thisYearAndMonth;
-
-/** 指定某个年月yyyy-MM 得到上个年月yyyy-MM */
-+ (NSString *)lastYearAndMonth:(NSString *)thisYearAndMonth;
-
-/** 字符串转NSDate */
-+ (NSDate *)dateStringToDate:(NSString *)dateString format:(NSString *)format;
-
-/** NSDate转字符串 */
-+ (NSString *)dateToDateString:(NSDate *)date format:(NSString *)format;
-
-+ (NSInteger)getMonthCountMonth:(NSString *)ym;
-@end

+ 0 - 285
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarHelper.m

@@ -1,285 +0,0 @@
-//
-//  ALCalendarHelper.m
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import "ALCalendarHelper.h"
-#import "ALCalendarDate.h"
-#import "ALCalendarManager.h"
-
-@implementation ALCalendarHelper
-
-+ (NSArray *)datesWithYearAndMonth:(NSString *)ym
-{
-    NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
-    NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
-    
-    // 设定一号
-    NSString *dateStr = [ym stringByAppendingString:@"-01"];
-    
-    // 转成NSDate
-    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-    formatter.timeZone = [NSTimeZone systemTimeZone];
-    formatter.dateFormat = @"yyyy-MM-dd";
-    
-    NSDate *date = [self dateStringToDate:dateStr format:@"yyyy-MM-dd"];
-    
-    // 转成日历组件
-    NSDateComponents *comps;
-    comps = [calendar components:unitFlags fromDate:date];
-    
-    // 当前月一号是星期几(注意,周日是“1”,周一是“2”。。。。)
-    NSInteger weekday;
-    if (ALCALENDAR_MANAGER.startMonday) {
-        weekday = comps.weekday - 1;
-        if (weekday == 0) {
-            weekday = 7;
-        }
-    }
-    else {
-        weekday = comps.weekday;
-    }
-
-    // 当前月的天数
-    NSInteger days = [calendar rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:date].length;
-    // 当前月最后一天
-    NSString *thisMonthLastDateStr = [NSString stringWithFormat:@"%@-%zd",ym,days];
-    NSDate   *thisMonthLastDate    = [formatter dateFromString:thisMonthLastDateStr];
-    // 当前月最后一天是星期几
-    comps = [calendar components:unitFlags fromDate:thisMonthLastDate];
-    
-    NSInteger lastDaysWeekDay;
-    if (ALCALENDAR_MANAGER.startMonday) {
-        lastDaysWeekDay = comps.weekday - 1;
-        if (lastDaysWeekDay == 0) {
-            lastDaysWeekDay = 7;
-        }
-    }
-    else {
-        lastDaysWeekDay = comps.weekday;
-    }
-
-    // 上个月的天数
-    [comps setDay:1];
-    [comps setMonth:comps.month - 1];
-    NSDate *lastMonth = [calendar dateFromComponents:comps];
-    NSInteger lastMonthDays = [calendar rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:lastMonth].length;
-    
-    // 上个月
-    NSMutableArray *lastMonthDates = [NSMutableArray array];
-    for (NSInteger i = 0; i < weekday - 1; i++) {
-        NSString *d = [NSString stringWithFormat:@"%zd",lastMonthDays - i];
-        ALCalendarDate *dat = [ALCalendarDate lastMonthDateWith:d];
-        [lastMonthDates addObject:dat];
-    }
-    lastMonthDates = [lastMonthDates reverseObjectEnumerator].allObjects.mutableCopy;
-    
-    // 这个月
-    NSMutableArray *thisMonthDates = [NSMutableArray array];
-    for (NSInteger i = 1 ; i <= days ; i++) {
-        NSString *d = [NSString stringWithFormat:@"%zd",i];
-        ALCalendarDate *dat = [[ALCalendarDate alloc] init];
-        dat.date = d;
-        if ([[ym stringByAppendingFormat:@"-%@",d] isEqualToString:[self today]]||[[ym stringByAppendingFormat:@"-%@",d] isEqualToString:[self todayTwo]]) { // 判断今天
-            dat.isToday = YES;
-        }
-        [thisMonthDates addObject:dat];
-    }
-   
-    // 下个月
-    NSMutableArray<ALCalendarDate *> *nextMonthDates = [NSMutableArray array];
-    for (NSInteger i = 1 ; i <= 7 - lastDaysWeekDay; i++) {
-        NSString *d = [NSString stringWithFormat:@"%zd",i];
-        ALCalendarDate *dat = [ALCalendarDate nextMonthDateWith:d];
-        [nextMonthDates addObject:dat];
-    }
-    
-    NSMutableArray *arr = [NSMutableArray arrayWithArray:lastMonthDates];
-    [arr addObjectsFromArray:thisMonthDates];
-    [arr addObjectsFromArray:nextMonthDates];
-    
-    
-    // 强行补齐成六行
-//    if (arr.count <= 35) {
-//        NSMutableArray *tempArr = [NSMutableArray array];
-//        for (NSInteger i = [nextMonthDates.lastObject.date integerValue] + 1; i <= [nextMonthDates.lastObject.date integerValue] + 7; i++) {
-//            ALCalendarDate *dat =[ALCalendarDate nextMonthDateWith:[NSString stringWithFormat:@"%zd",i]];
-//            [tempArr addObject:dat];
-//        }
-//        [arr addObjectsFromArray:tempArr];
-//    }
-    
-    return arr;
-}
-
-+(NSInteger)getMonthCountMonth:(NSString *)ym{
-    NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
-    NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
-    
-    // 设定一号
-    NSString *dateStr = [ym stringByAppendingString:@"-01"];
-    
-    // 转成NSDate
-    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-    formatter.timeZone = [NSTimeZone systemTimeZone];
-    formatter.dateFormat = @"yyyy-MM-dd";
-    
-    NSDate *date = [self dateStringToDate:dateStr format:@"yyyy-MM-dd"];
-    
-    // 转成日历组件
-    NSDateComponents *comps;
-    comps = [calendar components:unitFlags fromDate:date];
-    
-    // 当前月一号是星期几(注意,周日是“1”,周一是“2”。。。。)
-    NSInteger weekday;
-    if (ALCALENDAR_MANAGER.startMonday) {
-        weekday = comps.weekday - 1;
-        if (weekday == 0) {
-            weekday = 7;
-        }
-    }
-    else {
-        weekday = comps.weekday;
-    }
-    
-    // 当前月的天数
-    NSInteger days = [calendar rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:date].length;
-    // 当前月最后一天
-    NSString *thisMonthLastDateStr = [NSString stringWithFormat:@"%@-%zd",ym,days];
-    NSDate   *thisMonthLastDate    = [formatter dateFromString:thisMonthLastDateStr];
-    // 当前月最后一天是星期几
-    comps = [calendar components:unitFlags fromDate:thisMonthLastDate];
-    NSInteger lastDaysWeekDay;
-    if (ALCALENDAR_MANAGER.startMonday) {
-        lastDaysWeekDay = comps.weekday - 1;
-        if (lastDaysWeekDay == 0) {
-            lastDaysWeekDay = 7;
-        }
-    }
-    else {
-        lastDaysWeekDay = comps.weekday;
-    }
-    
-    // 上个月的天数
-    [comps setDay:1];
-    [comps setMonth:comps.month - 1];
-    NSDate *lastMonth = [calendar dateFromComponents:comps];
-    NSInteger lastMonthDays = [calendar rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:lastMonth].length;
-    
-    // 上个月
-    NSMutableArray *lastMonthDates = [NSMutableArray array];
-    for (NSInteger i = 0; i < weekday - 1; i++) {
-        NSString *d = [NSString stringWithFormat:@"%zd",lastMonthDays - i];
-        ALCalendarDate *dat = [ALCalendarDate lastMonthDateWith:d];
-        [lastMonthDates addObject:dat];
-    }
-    lastMonthDates = [lastMonthDates reverseObjectEnumerator].allObjects.mutableCopy;
-    
-    // 这个月
-    NSMutableArray *thisMonthDates = [NSMutableArray array];
-    for (NSInteger i = 1 ; i <= days ; i++) {
-        NSString *d = [NSString stringWithFormat:@"%zd",i];
-        ALCalendarDate *dat = [[ALCalendarDate alloc] init];
-        dat.date = d;
-        if ([[ym stringByAppendingFormat:@"-%@",d] isEqualToString:[self today]]) { // 判断今天
-            dat.isToday = YES;
-        }
-        [thisMonthDates addObject:dat];
-    }
-    
-    // 下个月
-    NSMutableArray<ALCalendarDate *> *nextMonthDates = [NSMutableArray array];
-    for (NSInteger i = 1 ; i <= 7 - lastDaysWeekDay; i++) {
-        NSString *d = [NSString stringWithFormat:@"%zd",i];
-        ALCalendarDate *dat = [ALCalendarDate nextMonthDateWith:d];
-        [nextMonthDates addObject:dat];
-    }
-    
-    NSMutableArray *arr = [NSMutableArray arrayWithArray:lastMonthDates];
-    [arr addObjectsFromArray:thisMonthDates];
-    [arr addObjectsFromArray:nextMonthDates];
-    
-    
-    // 强行补齐成六行
-    //    if (arr.count <= 35) {
-    //        NSMutableArray *tempArr = [NSMutableArray array];
-    //        for (NSInteger i = [nextMonthDates.lastObject.date integerValue] + 1; i <= [nextMonthDates.lastObject.date integerValue] + 7; i++) {
-    //            ALCalendarDate *dat =[ALCalendarDate nextMonthDateWith:[NSString stringWithFormat:@"%zd",i]];
-    //            [tempArr addObject:dat];
-    //        }
-    //        [arr addObjectsFromArray:tempArr];
-    //    }
-    
-    return arr.count;
-}
-
-+ (NSString *)currentYearAndMonth
-{
-    NSDate *now = [NSDate date];
-    
-    // 转成NSDate
-    NSString *dateStr = [self dateToDateString:now format:@"yyyy-MM"];
-    
-    return dateStr;
-}
-
-+ (NSString *)today
-{
-    NSString *todayDate = [self dateToDateString:[NSDate date] format:@"yyyy-MM-dd"];
-    return todayDate;
-}
-
-+ (NSString *)todayTwo
-{
-    NSString *todayDate = [self dateToDateString:[NSDate date] format:@"yyyy-MM-d"];
-    return todayDate;
-}
-
-+ (NSString *)nextYearAndMonth:(NSString *)thisYearAndMonth
-{
-    NSDate *date = [self dateStringToDate:thisYearAndMonth format:@"yyyy-MM"];
-    NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
-    NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth;
-    NSDateComponents *comps = [calendar components:unitFlags fromDate:date];
-    comps.timeZone = [NSTimeZone systemTimeZone];
-    [comps setMonth: comps.month + 1];
-    NSDate *nextMonth = [calendar dateFromComponents:comps];
-    return [self dateToDateString:nextMonth format:@"yyyy-MM"];
-}
-
-+ (NSString *)lastYearAndMonth:(NSString *)thisYearAndMonth
-{
-    NSDate *date = [self dateStringToDate:thisYearAndMonth format:@"yyyy-MM"];
-    NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
-    NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth;
-    NSDateComponents *comps = [calendar components:unitFlags fromDate:date];
-    comps.timeZone = [NSTimeZone systemTimeZone];
-    [comps setMonth: comps.month - 1];
-    NSDate *lastMonth = [calendar dateFromComponents:comps];
-    return [self dateToDateString:lastMonth format:@"yyyy-MM"];
-}
-
-+ (NSString *)dateToDateString:(NSDate *)date format:(NSString *)format
-{
-    // 转成NSDate
-    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-    formatter.timeZone = [NSTimeZone systemTimeZone];
-    formatter.dateFormat = format;
-    NSString *dateStr = [formatter stringFromDate:date];
-    return dateStr;
-}
-
-+ (NSDate *)dateStringToDate:(NSString *)dateString format:(NSString *)format
-{
-    // 转成NSDate
-    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-    formatter.timeZone = [NSTimeZone systemTimeZone];
-    formatter.dateFormat = format;
-    NSDate *date = [formatter dateFromString:dateString];
-    return date;
-}
-
-@end

+ 0 - 23
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarManager.h

@@ -1,23 +0,0 @@
-//
-//  ALCalendarManager.h
-//  StudentDaya
-//
-//  Created by Kyle on 2019/9/12.
-//  Copyright © 2019 DayaMusic. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-#define ALCALENDAR_MANAGER ([ALCalendarManager shareInstance])
-
-@interface ALCalendarManager : NSObject
-
-+ (instancetype)shareInstance;
-
-@property (nonatomic, assign) BOOL startMonday;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 22
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarManager.m

@@ -1,22 +0,0 @@
-//
-//  ALCalendarManager.m
-//  StudentDaya
-//
-//  Created by Kyle on 2019/9/12.
-//  Copyright © 2019 DayaMusic. All rights reserved.
-//
-
-#import "ALCalendarManager.h"
-
-@implementation ALCalendarManager
-
-+ (instancetype)shareInstance {
-    static ALCalendarManager *manager = nil;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        manager = [[self alloc] init];
-    });
-    return manager;
-}
-
-@end

+ 0 - 90
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarPicker.h

@@ -1,90 +0,0 @@
-//
-//  ALCalendarPicker.h
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-// 当宽度为屏幕宽度时,自动计算高度
-#define ALPickerHeight 45 + (([UIScreen mainScreen].bounds.size.width / 10) * 7) + ((([UIScreen mainScreen].bounds.size.width - 40) - (7 * [UIScreen mainScreen].bounds.size.width / 10)) / 7) * 8
-
-@class ALCalendarPicker,ALCalendarDate;
-
-@protocol ALCalendarPickerDelegate <NSObject>
-
-@optional
-
-/**
- 选择某个日期
- */
-- (void)calendarPicker:(ALCalendarPicker *)picker didSelectItem:(ALCalendarDate *)date date:(NSDate *)dateObj dateString:(NSString *)dateStr;
-
-/**
- 点击按钮即将进入某个月历
- 
- @param yearMonth yyyy-MM格式
- */
-- (void)calendarPicker:(ALCalendarPicker *)picker willClickToYearMonth:(NSString *)yearMonth;
-
-/**
- 进入某个月历
- 
- @param yearMonth yyyy-MM格式
- @param isScroll 判断是点击按钮进入日历或者滑动进入日历
- */
-- (void)calendarPicker:(ALCalendarPicker *)picker didScrollToYearMonth:(NSString *)yearMonth isScroll:(BOOL)isScroll;
-
-@end
-
-@interface ALCalendarPicker : UIView
-
-
-/** 起始年月 yyyy-MM */
-@property (nonatomic, copy) NSString *beginYearMonth;
-
-/** 结束年月 yyyy-MM */
-@property (nonatomic, copy) NSString *endYearMonth;
-
-/** 代理 */
-@property (nonatomic, assign) id<ALCalendarPickerDelegate> delegate;
-
-/** 高亮日期 yyyy-MM-dd 格式 */
-@property (nonatomic, assign) NSArray<NSString *> *hightLightItems;
-
-/** 高亮日期 yyyy-MM-dd 格式 */
-@property (nonatomic, assign) NSArray<NSString *> *TwohightLightItems;
-
-/** 选择日期 yyyy-MM-dd 格式 */
-@property (nonatomic, assign) NSArray<NSString *> *selectedItems;
-
-/** 高亮日期优先 当高亮日期与当日日期的重叠的时候优先使用高亮日期的样式 */
-@property (nonatomic, assign) BOOL hightlightPriority;
-
-/** 重新加载选择器 */
-- (void)reloadPicker;
-
-/** 高亮的日期的样式 */
-- (void)setupHightLightItemStyle:(void(^)(UIColor **backgroundColor,NSNumber **backgroundCornerRadius,UIColor **titleColor))style;
-
-/** 高亮的日期的样式 */
-- (void)setupTwoHightLightItemStyle:(void(^)(UIColor **backgroundColor,NSNumber **backgroundCornerRadius,UIColor **titleColor))style;
-
-/** 当日日期的样式 */
-- (void)setupTodayItemStyle:(void(^)(UIColor **backgroundColor,NSNumber **backgroundCornerRadius,UIColor **titleColor))style;
-
-/** 选择日期的样式 */
-- (void)setupSelectedItemStyle:(void(^)(UIColor **backgroundColor,NSNumber **backgroundCornerRadius,UIColor **titleColor))style;
-
-/** 跳转到某个月历 只需提供日月 */
-- (void)jumpToYearMonth:(NSDate *)date;
-
-/** 字符串yyyy-MM 方式跳转 */
-- (void)jumpToYearMonthByStr:(NSString *)dateStr;
-
-///** 打卡记录 */
-//@property (nonatomic, strong) YYLabel *contentLabel;
-@property (nonatomic, assign) CGFloat radius;
-@end

+ 0 - 453
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/ALCalendarPicker.m

@@ -1,453 +0,0 @@
-//
-//  ALCalendarPicker.m
-//  ALCalendarPickerDemo
-//
-//  Created by Arclin on 2017/6/16.
-//  Copyright © 2017年 arclin. All rights reserved.
-//
-
-#import "ALCalendarPicker.h"
-
-#import "ALCalendarHeader.h"
-#import "ALCalendarCollectionView.h"
-
-#import "ALCalendarHelper.h"
-#import "ALCalendarConfig.h"
-
-#import "UIView+ALFrame.h"
-
-#import <Masonry/Masonry.h>
-
-
-@interface ALCalendarPicker()<UIScrollViewDelegate,ALCalendarHeaderDelegate,ALCalendarCollectionViewDelegate>
-{
-    NSInteger _currentPage;
-}
-@property (nonatomic, strong) ALCalendarHeader         * header;
-
-@property (nonatomic, strong) UIScrollView             * scrollView;
-
-@property (nonatomic, strong) NSMutableArray<ALCalendarCollectionView *> *collectionViews;
-
-/** 配置 */
-@property (nonatomic, strong) ALCalendarConfig *config;
-
-@end
-
-@implementation ALCalendarPicker
-
-
-static CGFloat headerHeight = 65;
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    if(self = [super initWithFrame:frame])
-    {
-        [self setupView];
-    }
-    return self;
-}
-
-- (void)setupView
-{
-    [self addSubview: self.header];
-    [self addSubview: self.scrollView];
-    
-    
-    __weak typeof(self) weakSelf = self;
-    
-    // 头部信息栏
-    [self.header mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.equalTo(@0);
-        make.top.equalTo(@0);
-        make.width.equalTo(weakSelf.mas_width);
-        make.height.equalTo(@(headerHeight));
-    }];
-    
-    // 内容
-    [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
-        __strong typeof(weakSelf) strongSelf = weakSelf;
-        make.left.equalTo(@0);
-        make.top.equalTo(strongSelf.header.mas_bottom);
-        make.bottom.equalTo(@0);
-        make.right.equalTo(@0);
-    }];
-//    [self addSubview:self.contentLabel];
-//    self.contentLabel.hidden = YES;
-}
-
-- (void)reloadPicker
-{
-
-    for (ALCalendarCollectionView *collectionView in self.collectionViews) {
-        CGFloat height = self.al_height - headerHeight;
-        collectionView.height = height;
-        
-        [collectionView reloadData];
-    }
-    
-//    CGFloat labelHeight = self.al_height;
-//    self.contentLabel.frame = CGRectMake(0, labelHeight-30, kScreenWidth-20, 30);
-    
-}
-
-- (void)setupTodayItemStyle:(void(^)(UIColor **backgroundColor,NSNumber **backgroundCornerRadius,UIColor **titleColor))style
-{
-    UIColor *backgroundColor;
-    UIColor *titleColor;
-    NSNumber *backgroundCornerRadius;
-    if (style) {
-        style(&backgroundColor,&backgroundCornerRadius,&titleColor);
-    }
-    // 配置今日日期样式
-    self.config.tod_backgroundColor = backgroundColor;
-    self.config.tod_textColor = titleColor;
-    self.config.tod_backgroundCornerRadius = backgroundCornerRadius;
-    
-    for (ALCalendarCollectionView *collectionView in self.collectionViews) {
-        collectionView.config = self.config;
-        [collectionView reloadData];
-    }
-}
-
-- (void)setupHightLightItemStyle:(void(^)(UIColor **backgroundColor,NSNumber **backgroundCornerRadius,UIColor **titleColor))style
-{
-    UIColor *backgroundColor;
-    UIColor *titleColor;
-    NSNumber *backgroundCornerRadius;
-    if (style) {
-        style(&backgroundColor,&backgroundCornerRadius,&titleColor);
-    }
-    // 配置高亮样式
-    self.config.hl_backgroundColor = backgroundColor;
-    self.config.hl_textColor = titleColor;
-    self.config.hl_backgroundCornerRadius = backgroundCornerRadius;
-    
-    for (ALCalendarCollectionView *collectionView in self.collectionViews) {
-        collectionView.config = self.config;
-        [collectionView reloadData];
-    }
-}
-
-- (void)setupTwoHightLightItemStyle:(void(^)(UIColor **backgroundColor,NSNumber **backgroundCornerRadius,UIColor **titleColor))style
-{
-    UIColor *backgroundColor;
-    UIColor *titleColor;
-    NSNumber *backgroundCornerRadius;
-    if (style) {
-        style(&backgroundColor,&backgroundCornerRadius,&titleColor);
-    }
-    // 配置高亮样式
-    self.config.h2_backgroundColor = backgroundColor;
-    self.config.h2_textColor = titleColor;
-    self.config.h2_backgroundCornerRadius = backgroundCornerRadius;
-    
-    for (ALCalendarCollectionView *collectionView in self.collectionViews) {
-        collectionView.config = self.config;
-        [collectionView reloadData];
-    }
-}
-
-- (void)setupSelectedItemStyle:(void(^)(UIColor **backgroundColor,NSNumber **backgroundCornerRadius,UIColor **titleColor))style
-{
-    UIColor *backgroundColor;
-    UIColor *titleColor;
-    NSNumber *backgroundCornerRadius;
-    if (style) {
-        style(&backgroundColor,&backgroundCornerRadius,&titleColor);
-    }
-    // 配置高亮样式
-    self.config.sel_backgroundColor = backgroundColor;
-    self.config.sel_textColor = titleColor;
-    self.config.sel_backgroundCornerRadius = backgroundCornerRadius;
-    
-    for (ALCalendarCollectionView *collectionView in self.collectionViews) {
-        collectionView.config = self.config;
-        [collectionView reloadData];
-    }
-}
-
-- (void)jumpToYearMonthByStr:(NSString *)dateStr
-{
-    if (self.beginYearMonth && [self compareOneDay:dateStr withAnotherDay:self.beginYearMonth]) {
-        NSLog(@"❗️❗️跳转的时间不能在最早年月之前❗️❗️");
-        return;
-    } else if (self.endYearMonth && [self compareOneDay:self.endYearMonth withAnotherDay:dateStr]) {
-        NSLog(@"❗️❗️跳转的时间不能在最晚年月之后❗️❗️");
-        return;
-    }
-    self.header.title = dateStr;
-    self.collectionViews[1].yearAndMonth = dateStr;
-    
-    [self setupLeftAndRightCalendar];
-}
-
-- (void)jumpToYearMonth:(NSDate *)date
-{
-    NSString *dateStr = [ALCalendarHelper dateToDateString:date format:@"yyyy-MM"];
-    [self jumpToYearMonthByStr:dateStr];
-}
-
-#pragma mark - Private Method
-
-- (void)showLeftCalendar
-{
-    self.header.title = [ALCalendarHelper lastYearAndMonth:self.header.title];
-    [self refreshCollectionView:NO];
-}
-
-- (void)showRightCalendar
-{
-    self.header.title = [ALCalendarHelper nextYearAndMonth:self.header.title];
-    [self refreshCollectionView:YES];
-}
-
-- (void)setupLeftAndRightCalendar
-{
-    // 配置上个月和下个月的数据源
-    self.collectionViews.firstObject.yearAndMonth = [ALCalendarHelper lastYearAndMonth:self.header.title];
-    self.collectionViews.lastObject.yearAndMonth = [ALCalendarHelper nextYearAndMonth:self.header.title];
-}
-
-#pragma mark - UIScrollViewDelegate
-
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView
-{
-    // 到达起始时间不能滚动
-    if ([self.header.title isEqualToString:self.beginYearMonth] && scrollView.contentOffset.x < self.al_width) {
-        [scrollView setContentOffset:CGPointMake(self.al_width, 0) animated:NO];
-    }
-    
-    // 到达结束时间不能滚动
-    if ([self.header.title isEqualToString:self.endYearMonth]  && scrollView.contentOffset.x > self.al_width) {
-        [scrollView setContentOffset:CGPointMake(self.al_width, 0) animated:NO];
-    }
-}
-
-- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
-{
-    [self.scrollView setContentOffset:CGPointMake(self.al_width, 0) animated:NO];
-    
-    [self setupLeftAndRightCalendar];
-    
-    if ([self.delegate respondsToSelector:@selector(calendarPicker:didScrollToYearMonth:isScroll:)]) {
-        [self.delegate calendarPicker:self didScrollToYearMonth:[self.header title] isScroll:NO];
-    }
-}
-
-- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
-{
-    CGFloat offsetX = scrollView.contentOffset.x;
-    CGFloat page    = offsetX / self.al_width;
-    if (page == 2) {
-        [self showRightCalendar];
-    } else if (page == 0) {
-        [self showLeftCalendar];
-    }
-    
-    [self.scrollView setContentOffset:CGPointMake(self.al_width, 0) animated:NO];
-    
-    // 配置上个月和下个月的数据源
-    [self setupLeftAndRightCalendar];
-    
-    if ([self.delegate respondsToSelector:@selector(calendarPicker:didScrollToYearMonth:isScroll:)]) {
-        [self.delegate calendarPicker:self didScrollToYearMonth:[self.header title] isScroll:YES];
-    }
-}
-
-#pragma mark - ALCalendarHeaderDelegate
-
-- (void)header:(ALCalendarHeader *)header didClickLeftBtn:(UIButton *)button
-{
-    if ([self.delegate respondsToSelector:@selector(calendarPicker:willClickToYearMonth:)]) {
-        [self.delegate calendarPicker:self willClickToYearMonth:[ALCalendarHelper lastYearAndMonth:[self.header title]]];
-    }
-    
-    [self showLeftCalendar];
-}
-
-- (void)header:(ALCalendarHeader *)header didClickRightBtn:(UIButton *)button
-{
-    if ([self.delegate respondsToSelector:@selector(calendarPicker:willClickToYearMonth:)]) {
-        [self.delegate calendarPicker:self willClickToYearMonth:[ALCalendarHelper nextYearAndMonth:[self.header title]]];
-    }
-    
-    [self showRightCalendar];
-}
-
-#pragma mark - ALCalendarCollectionViewDelegate
-
-- (void)calendarView:(ALCalendarCollectionView *)calendarCollectionView didSelectItem:(ALCalendarDate *)date date:(NSDate *)dateObj dateString:(NSString *)dateString
-{
-    if ([self.delegate respondsToSelector:@selector(calendarPicker:didSelectItem:date:dateString:)]) {
-        [self.delegate calendarPicker:self didSelectItem:date date:dateObj dateString:dateString];
-    }
-}
-
-#pragma mark - private method
-
-- (void)refreshCollectionView:(BOOL)next
-{
-    if (next) { // 滚到下一页
-        [self.scrollView setContentOffset:CGPointMake(2 * self.al_width , 0) animated:YES];
-    } else { // 滚到上一页
-        [self.scrollView setContentOffset:CGPointMake(0, 0) animated:YES];
-    }
-    self.collectionViews[1].yearAndMonth = self.header.title;
-}
-
-// 比较时间先后
-- (BOOL)compareOneDay:(NSString *)day1 withAnotherDay:(NSString *)day2
-{
-    NSDate *dateA = [ALCalendarHelper dateStringToDate:day1 format:@"yyyy-MM"];
-    NSDate *dateB = [ALCalendarHelper dateStringToDate:day2 format:@"yyyy-MM"];
-    NSComparisonResult result = [dateA compare:dateB];
-    if (result == NSOrderedDescending) {
-        return NO; // Day1 在 Day2 之后
-    }
-    else if (result == NSOrderedAscending) {
-        return YES; // Day1 在 Day2 之前
-    }
-    return YES;
-}
-
-#pragma mark - setter & getter
-
-- (ALCalendarHeader *)header
-{
-    if (!_header) {
-        _header                 = [[ALCalendarHeader alloc] init];
-        // 初始化为当前月份和年份
-        _header.title           = [ALCalendarHelper currentYearAndMonth];
-        _header.backgroundColor = [UIColor colorWithHexString:@"#f3f3f3"];
-        _header.delegate        = self;
-    }
-    return _header;
-}
-
-- (void)setBeginYearMonth:(NSString *)beginYearMonth
-{
-    _beginYearMonth            = beginYearMonth;
-    self.header.beginYearMonth = beginYearMonth;
-    
-    if (![self compareOneDay:beginYearMonth withAnotherDay:[ALCalendarHelper currentYearAndMonth]]) {
-        NSLog(@"❗️❗️开始时间不能比当前年月晚❗️❗️");
-    }
-    if (_endYearMonth && ![self compareOneDay:beginYearMonth withAnotherDay:self.endYearMonth]) {
-        NSLog(@"❗️❗️结束时间不能比开始时间早❗️❗️");
-    }
-}
-
-- (void)setEndYearMonth:(NSString *)endYearMonth
-{
-    _endYearMonth            = endYearMonth;
-    self.header.endYearMonth = endYearMonth;
-    
-    if ([self compareOneDay:endYearMonth withAnotherDay:[ALCalendarHelper currentYearAndMonth]]) {
-        NSLog(@"❗️❗️结束时间不能比当前月早❗️❗️");
-    }
-    if (_beginYearMonth && ![self compareOneDay:_beginYearMonth withAnotherDay:endYearMonth]) {
-       NSLog(@"❗️❗️结束时间不能比开始时间早❗️❗️");
-    }
-}
-
-- (UIScrollView *)scrollView
-{
-    if (!_scrollView) {
-        _scrollView = [[UIScrollView alloc] init];
-        _scrollView.backgroundColor = [UIColor whiteColor];
-//        _scrollView.backgroundColor = [UIColor greenColor];
-        
-        _scrollView.layer.masksToBounds = YES;
-        _scrollView.pagingEnabled = YES;
-        CGFloat height = self.al_height - headerHeight;
-        _scrollView.contentSize = (CGSize){self.al_width * 3,height};
-        _scrollView.delegate = self;
-        for (NSInteger i = 0; i < 3 ; i++) {
-            ALCalendarCollectionView *collectionView = [[ALCalendarCollectionView alloc] initWithFrame:CGRectMake(self.al_width * i, 0, self.al_width,height) collectionViewLayout:[[UICollectionViewFlowLayout alloc] init]];
-//            collectionView.backgroundColor = [UIColor orangeColor];
-            collectionView.backgroundColor = [UIColor whiteColor];
-            collectionView.collectionViewDelegate = self;
-            collectionView.yearAndMonth = nil;
-            if (i == 0) {
-                collectionView.yearAndMonth = [ALCalendarHelper lastYearAndMonth:self.header.title];
-            }else if (i == 1) {
-                collectionView.yearAndMonth = [ALCalendarHelper currentYearAndMonth];
-            } else if (i == 2) {
-                collectionView.yearAndMonth = [ALCalendarHelper nextYearAndMonth:self.header.title];
-            }
-            [self.collectionViews addObject:collectionView];
-            [self.scrollView addSubview:collectionView];
-        }
-        _scrollView.showsHorizontalScrollIndicator = NO;
-//        _scrollView.scrollEnabled = NO;
-        [_scrollView setContentOffset:CGPointMake(self.al_width, 0) animated:NO];
-    }
-    return _scrollView;
-}
-
-//#pragma mark 打卡记录label
-//-(YYLabel *)contentLabel{
-//    CGFloat height = self.al_height;
-//    if (!_contentLabel) {
-//       _contentLabel =[[YYLabel alloc] init];
-//        _contentLabel.numberOfLines = 0;
-//        [_contentLabel sizeToFit];
-//        _contentLabel.frame = CGRectMake(0, height, kScreenWidth-20, 30);
-//    }
-//    return _contentLabel;
-//}
-
-
-- (NSMutableArray<ALCalendarCollectionView *> *)collectionViews
-{
-    if (!_collectionViews) {
-        _collectionViews = [NSMutableArray array];
-    }
-    return _collectionViews;
-}
-
-- (void)setHightLightItems:(NSArray<NSString *> *)hightLightItems
-{
-    _hightLightItems = hightLightItems;
-    self.config.heightlightDates = hightLightItems;
-    [self reloadPicker];
-}
-
--(void)setTwohightLightItems:(NSArray<NSString *> *)TwohightLightItems{
-    _TwohightLightItems = TwohightLightItems;
-    self.config.TwoheightlightDates = TwohightLightItems;
-    [self reloadPicker];
-}
-
-- (void)setSelectedItems:(NSArray<NSString *> *)selectedItems
-{
-    _selectedItems = selectedItems;
-    self.config.selectedDates = selectedItems;
-    [self reloadPicker];
-}
-
-- (void)setHightlightPriority:(BOOL)hightlightPriority
-{
-    _hightlightPriority = hightlightPriority;
-    self.config.hightlightPriority = hightlightPriority;
-}
-
-- (ALCalendarConfig *)config
-{
-    if (!_config) {
-        _config = [[ALCalendarConfig alloc] init];
-    }
-    return _config;
-}
-
-- (void)setRadius:(CGFloat)radius {
-    _radius = radius;
-    if (radius) {
-        self.scrollView.layer.cornerRadius = radius;
-        self.header.layer.cornerRadius = radius;
-        self.header.layer.masksToBounds = YES;
-    }
-}
-
-@end

+ 0 - 24
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/UIView+ALFrame.h

@@ -1,24 +0,0 @@
-//
-//  UIView+Frame.h
-//  ArcBlog
-//
-//  Created by Arclin on 15/11/18.
-//  Copyright © 2015年 sziit. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface UIView (ALFrame)
-
-// 分类不能添加成员属性
-// @property如果在分类里面,只会自动生成get,set方法的声明,不会生成带有下划线的成员属性,和方法的实现
-
-@property (nonatomic,assign) CGFloat al_centerX;
-@property (nonatomic,assign) CGFloat al_centerY;
-@property (nonatomic,assign) CGSize  al_size;
-@property (nonatomic,assign) CGFloat al_x;
-@property (nonatomic,assign) CGFloat al_y;
-@property (nonatomic,assign) CGFloat al_width;
-@property (nonatomic,assign) CGFloat al_height;
-
-@end

+ 0 - 84
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/ALCalendarPicker/UIView+ALFrame.m

@@ -1,84 +0,0 @@
-//
-//  UIView+Frame.m
-//  ArcBlog
-//
-//  Created by Arclin on 15/11/18.
-//  Copyright © 2015年 sziit. All rights reserved.
-//
-
-#import "UIView+ALFrame.h"
-
-@implementation UIView (ALFrame)
-
-- (void)setAl_centerX:(CGFloat)al_centerX {
-    CGPoint center = self.center;
-    center.x = al_centerX;
-    self.center = center;
-}
-
-- (CGFloat)al_centerX {
-    return self.center.x;
-}
-
-- (void)setAl_centerY:(CGFloat)al_centerY {
-    CGPoint center = self.center;
-    center.y = al_centerY;
-    self.center = center;
-}
-
-- (CGFloat)al_centerY {
-    return self.center.y;
-}
-
-- (void)setAl_size:(CGSize)al_size {
-    CGRect frame = self.frame;
-    frame.size = al_size;
-    self.frame = frame;
-}
-
-- (CGSize)al_size {
-    return self.frame.size;
-}
-
-- (void)setAl_x:(CGFloat)al_x {
-    CGRect frame = self.frame;
-    frame.origin.x = al_x;
-    self.frame = frame;
-}
-
-- (CGFloat)al_x {
-    return self.frame.origin.x;
-}
-
-- (void)setAl_y:(CGFloat)al_y {
-    CGRect frame = self.frame;
-    frame.origin.y = al_y;
-    self.frame = frame;
-}
-
-- (CGFloat)al_y {
-    return self.frame.origin.y;
-    
-}
-
-- (void)setAl_width:(CGFloat)al_width {
-    CGRect frame = self.frame;
-    frame.size.width = al_width;
-    self.frame = frame;
-}
-
-- (CGFloat)al_width {
-    return self.frame.size.width;
-}
-
-- (void)setAl_height:(CGFloat)al_height {
-    CGRect frame = self.frame;
-    frame.size.height = al_height;
-    self.frame = frame;
-}
-
-- (CGFloat)al_height {
-    return self.frame.size.height;
-}
-
-@end

+ 0 - 206
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/DZSegmentCtrl/DZNSegmentedControl.h

@@ -1,206 +0,0 @@
-//
-//  DZNSegmentedControl.h
-//  DZNSegmentedControl
-//  https://github.com/dzenbot/DZNSegmentedControl
-//
-//  Created by Ignacio Romero Zurbuchen on 3/4/14.
-//  Copyright (c) 2014 DZN Labs. All rights reserved.
-//  Licence: MIT-Licence
-//
-
-#import <UIKit/UIKit.h>
-
-@protocol DZNSegmentedControlDelegate;
-
-enum {
-    // segment index for no selected segment
-    DZNSegmentedControlNoSegment = -1
-};
-
-/**
- A drop-in replacement for UISegmentedControl showing multiple segment counts, to be used typically on a user profile.
- */
-@interface DZNSegmentedControl : UIControl <UIBarPositioning, UIAppearance>
-
-/** The control's delegate object, conforming to the UIBarPositioning protocol. */
-@property (nonatomic, weak) IBOutlet id <DZNSegmentedControlDelegate> delegate;
-/** The items displayed on the control. */
-@property (nonatomic, retain) NSArray *items;
-/** The index number identifying the selected segment (that is, the last segment touched). */
-@property (nonatomic) NSInteger selectedSegmentIndex;
-/** Returns the number of segments the receiver has. */
-@property (nonatomic, readonly) NSUInteger numberOfSegments;
-/** The height of the control. Default is 56 points, and if not showing counts, default is 30 points. */
-@property (nonatomic, readwrite) CGFloat height UI_APPEARANCE_SELECTOR;
-/** The width of the control. Default is superview's width. */
-@property (nonatomic, readwrite) CGFloat width UI_APPEARANCE_SELECTOR;
-/** The height of the selection indicator. Default is 2 points. */
-@property (nonatomic, readwrite) CGFloat selectionIndicatorHeight UI_APPEARANCE_SELECTOR;
-/** The padding height of the selection indicator from the title of the button. Default is 0 points. */
-@property (nonatomic, readwrite) CGFloat selectionIndicatorPadding UI_APPEARANCE_SELECTOR;
-/** The duration of the indicator's animation. Default is 0.2 sec. */
-@property (nonatomic, readwrite) CGFloat animationDuration UI_APPEARANCE_SELECTOR;
-/** The font family to be used on labels. Default is system font (HelveticaNeue). Font size is managed by the class. */
-@property (nonatomic, retain) UIFont *font UI_APPEARANCE_SELECTOR;
-/** The color of the hairline. Default is light gray. To hide the hairline, just set clipsToBounds to YES, like you would do it for UIToolBar & UINavigationBar. */
-@property (nonatomic, readwrite) UIColor *hairlineColor UI_APPEARANCE_SELECTOR;
-/** The custom number formatter used to format the count values. A default number formatter will be used if this property is nil. If this property is set, it takes precedence over the showsGroupingSeparators flag. */
-@property (nonatomic, strong) NSNumberFormatter *numberFormatter;
-/** YES to display the count number on top of the titles. Default is YES. */
-@property (nonatomic) BOOL showsCount;
-/** YES to adjust the width of the selection indicator on the title width. Default is YES. */
-@property (nonatomic) BOOL autoAdjustSelectionIndicatorWidth;
-/** YES if the title should display on top of the count. Default is NO. */
-@property (nonatomic) BOOL inverseTitles;
-/** YES to make the selection indicator animation bouncy. Default is NO. */
-@property (nonatomic) BOOL bouncySelectionIndicator;
-/** YES to format the counts with grouping separators. Default is NO. */
-@property (nonatomic) BOOL showsGroupingSeparators;
-/** YES if the font size should be reduced in order to fit the title string into the segment's width. Default is NO. */
-@property (nonatomic) BOOL adjustsFontSizeToFitWidth;
-/** YES if the button top inset should be adjusted based on bar position (top or bottom). Default is YES. */
-@property (nonatomic) BOOL adjustsButtonTopInset;
-/** YES if the selected segment is user interaction disabled. NO if touching the segment button should still forward the actions to its targets without animating the selection indicator. Default is YES. */
-@property (nonatomic) BOOL disableSelectedSegment;
-
-/**
- Initializes and returns a segmented control with segments having the given titles or images.
- The returned segmented control is automatically sized to fit its content within the width of its superview.
- If items is nil, the control will still be created but expecting titles and counts or images to be assigned.
- 
- @params items An array of NSString objects only.
- @returns A DZNSegmentedControl object or nil if there was a problem in initializing the object.
- */
-- (instancetype)initWithItems:(NSArray *)items;
-
-/**
- Sets the selected segment index programatically, optionally animated.
- 
- @param segment The new segment to select.
- @param animated YES if the selection should animate the selection indicator's position.
- */
-- (void)setSelectedSegmentIndex:(NSInteger)segment animated:(BOOL)animated;
-
-/**
- Sets the tint color of a segment.
- 
- @param tintColor A color to rendered for the segment's background color.
- @param segment An index number identifying a segment in the control. It must be a number between 0 and the number of segments (numberOfSegments) minus 1; values exceeding this upper range are pinned to it.
- */
-- (void)setTintColor:(UIColor *)tintColor forSegmentAtIndex:(NSUInteger)segment;
-
-/**
- Sets the title of a segment.
- A segment can only have an image or a title; it can’t have both. There is no default title.
- 
- @param title A string to display in the segment as its title.
- @param segment An index number identifying a segment in the control. It must be a number between 0 and the number of segments (numberOfSegments) minus 1; values exceeding this upper range are pinned to it.
- */
-- (void)setTitle:(NSString *)title forSegmentAtIndex:(NSUInteger)segment;
-
-/**
- Sets the title color for a particular state.
- 
- @param color A color to be rendered for each the segment's state.
- @param state The state that uses the styled title. The possible values are described in UIControlState.
- */
-- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;
-
-/**
- Sets the count of a segment.
- 
- @param count A number to display in the segment as its count.
- @param segment An index number identifying a segment in the control. It must be a number between 0 and the number of segments (numberOfSegments) minus 1; values exceeding this upper range are pinned to it.
- */
-- (void)setCount:(NSNumber *)count forSegmentAtIndex:(NSUInteger)segment;
-
-/**
- Sets the content of a segment to a given image.
- A segment can only have an image or a title; it can’t have both. There is no default image.
-
- @param image An image object to display in the segment.
- @param segment An index number identifying a segment in the control. It must be a number between 0 and the number of segments (numberOfSegments) minus 1; values exceeding this upper range are pinned to it.
- */
-- (void)setImage:(UIImage *)image forSegmentAtIndex:(NSUInteger)segment;
-
-/**
- Enables the specified segment.
- 
- @param enabled YES to enable the specified segment or NO to disable the segment. By default, segments are enabled.
- @param segment An index number identifying a segment in the control. It must be a number between 0 and the number of segments (numberOfSegments) minus 1; values exceeding this upper range are pinned to it.
- */
-- (void)setEnabled:(BOOL)enabled forSegmentAtIndex:(NSUInteger)segment;
-
-
-/**
-  Returns whether the given segment is selected or not
- 
- @param segment An index number identifying a segment in the control. It must be a number between 0 and the number of segments (numberOfSegments) minus 1; values exceeding this upper range are pinned to it.
- @returns Returns whether the given segment is selected or not
- */
-- (BOOL)isSegmentAtIndexEnabled:(NSUInteger)segment;
-
-/**
- Sets a contentOffset and contentSize to enable scrollView tracking.
- To be used in combination with UIScrollView+DZNSegmentedControl.
- 
- @param scrollOffset The tracking scrollView's contentOffset
- @param contentSize The tracking scrollView's contentSize
- */
-- (void)setScrollOffset:(CGPoint)scrollOffset contentSize:(CGSize)contentSize;
-
-/**
- Returns the title of the specified segment.
- 
- @param segment An index number identifying a segment in the control. It must be a number between 0 and the number of segments (numberOfSegments) minus 1; values exceeding this upper range are pinned to it.
- @returns Returns the string (title) assigned to the receiver as content. If no title has been set, it returns nil.
- */
-- (NSString *)titleForSegmentAtIndex:(NSUInteger)segment;
-
-/**
- Returns the count of the specified segment.
- 
- @param segment An index number identifying a segment in the control. It must be a number between 0 and the number of segments (numberOfSegments) minus 1; values exceeding this upper range are pinned to it.
- @returns Returns the number (count) assigned to the receiver as content. If no count has been set, it returns 0.
- */
-- (NSNumber *)countForSegmentAtIndex:(NSUInteger)segment;
-
-/**
- Removes all segments of the receiver
- */
-- (void)removeAllSegments;
-
-@end
-
-typedef NS_ENUM(NSInteger, DZNScrollDirection) {
-    DZNScrollDirectionHorizontal,
-    DZNScrollDirectionVertical
-};
-
-@class DZNSegmentedControl;
-
-@interface UIScrollView (DZNSegmentedControl)
-
-/** The scrolling direction of the scrollView. Default is Horizontal. */
-@property (nonatomic) DZNScrollDirection scrollDirection;
-
-/** YES if the scrollview should scroll automatically when a segment changes. Default is YES. */
-@property (nonatomic) BOOL scrollOnSegmentChange;
-
-/** The scrollView reference to observe the content offset updates and interact with. */
-@property (nonatomic, weak) DZNSegmentedControl *segmentedControl;
-
-@end
-
-/**
- This protocol conforms to the UIBarPositioningDelegate protocol to support the any directional decoration drawing accordingly (ie: the hairline and the selection indicator bar).
- */
-@protocol DZNSegmentedControlDelegate <UIBarPositioningDelegate>
-@optional
-
-/**
- Implement this method to position the selector indicator either at the top or bottom of the view. Default is UIBarPositionAny which means the selector indicator will be placed at the bottom. If not implemented, the value for positionForBar: will be used instead.
- */
-- (UIBarPosition)positionForSelectionIndicator:(id<UIBarPositioning>)bar;
-
-@end

+ 0 - 973
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/DZSegmentCtrl/DZNSegmentedControl.m

@@ -1,973 +0,0 @@
-//
-//  DZNSegmentedControl.m
-//  DZNSegmentedControl
-//  https://github.com/dzenbot/DZNSegmentedControl
-//
-//  Created by Ignacio Romero Zurbuchen on 3/4/14.
-//  Copyright (c) 2014 DZN Labs. All rights reserved.
-//  Licence: MIT-Licence
-//
-
-#import "DZNSegmentedControl.h"
-
-@interface DZNSegmentedControl ()
-
-@property (nonatomic) BOOL initializing;
-@property (nonatomic, strong) UIView *selectionIndicator;
-@property (nonatomic, strong) UIView *hairline;
-@property (nonatomic, strong) NSMutableDictionary *colors;
-@property (nonatomic, strong) NSMutableArray *counts; // of NSNumber
-
-@property (nonatomic, assign) CGPoint scrollOffset;
-
-@property (nonatomic, getter = isImageMode) BOOL imageMode; // Default NO
-
-@end
-
-@implementation DZNSegmentedControl
-@synthesize height = _height;
-@synthesize width = _width;
-
-#pragma mark - Initialize Methods
-
-- (id)init
-{
-    if (self = [super init]) {
-        [self commonInit];
-    }
-    return self;
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
-    self = [super initWithCoder:aDecoder];
-    if (self) {
-        [self commonInit];
-    }
-    return self;
-}
-
-- (id)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-    if (self) {
-        _width = CGRectGetWidth(frame);
-        _height = CGRectGetHeight(frame);
-
-        [self commonInit];
-    }
-    return self;
-}
-
-- (instancetype)initWithItems:(NSArray *)items
-{
-    self = [super init];
-    if (self) {
-        [self commonInit];
-        self.items = items;
-    }
-    return self;
-}
-
-- (void)commonInit
-{
-    _initializing = YES;
-    
-    _showsCount = YES;
-    _selectedSegmentIndex = -1;
-    _selectionIndicatorHeight = 2.0f;
-    _animationDuration = 0.2;
-    _autoAdjustSelectionIndicatorWidth = YES;
-    _adjustsButtonTopInset = YES;
-    _disableSelectedSegment = YES;
-    _font = [UIFont systemFontOfSize:15.0f];
-    
-    _selectionIndicator = [UIView new];
-    _selectionIndicator.backgroundColor = self.tintColor;
-    [self addSubview:_selectionIndicator];
-    
-    _hairline = [UIView new];
-    _hairline.backgroundColor = [UIColor lightGrayColor];
-    [self addSubview:_hairline];
-    
-    _colors = [NSMutableDictionary new];
-    _counts = [NSMutableArray array];
-    
-    _initializing = NO;
-}
-
-
-#pragma mark - UIView Methods
-
-- (CGSize)sizeThatFits:(CGSize)size
-{
-    return CGSizeMake((self.width ? self.width : self.superview.bounds.size.width), self.height);
-}
-
-- (void)sizeToFit
-{
-    CGRect rect = self.frame;
-    rect.size = [self sizeThatFits:rect.size];
-    self.frame = rect;
-}
-
-- (void)layoutSubviews
-{
-    [super layoutSubviews];
-    
-    [self sizeToFit];
-    
-    if ([self buttons].count == 0) {
-        _selectedSegmentIndex = -1;
-    }
-    else if (self.selectedSegmentIndex < 0) {
-        _selectedSegmentIndex = 0;
-    }
-    
-    [[self buttons] enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) {
-        
-        CGFloat width = self.bounds.size.width / self.numberOfSegments;
-        CGFloat height = self.bounds.size.height;
-        CGFloat x = width*idx;
-
-        CGRect rect = CGRectMake(x, 0.0f, width, height);
-        
-        [button setFrame:rect];
-        
-        if (_adjustsButtonTopInset) {
-            CGFloat topInset = (self.barPosition > UIBarPositionBottom) ? -4.0f : 4.0f;
-            button.titleEdgeInsets = UIEdgeInsetsMake(0.0f, 0.0f, topInset, 0.0f);
-        }
-        else {
-            button.titleEdgeInsets = UIEdgeInsetsZero;
-        }
-        
-        if (idx == self.selectedSegmentIndex) {
-            button.selected = YES;
-        }
-    }];
-    
-    [self configureAccessoryViews];
-}
-
-- (void)didMoveToWindow
-{
-    [super didMoveToWindow];
-    
-    if (!self.backgroundColor) {
-        self.backgroundColor = [UIColor whiteColor];
-    }
-    
-    [self configureSegments];
-    
-    [self layoutIfNeeded];
-}
-
-- (CGSize)intrinsicContentSize
-{
-    return CGSizeMake(self.width, self.height);
-}
-
-
-#pragma mark - Getter Methods
-
-- (CGFloat)height
-{
-    return (_height ? : self.showsCount ? 56.0f : 30.0f);
-}
-
-- (CGFloat)width
-{
-    return (_width ? : self.superview.bounds.size.width);
-}
-
-- (NSUInteger)numberOfSegments
-{
-    return self.items.count;
-}
-
-- (NSArray *)buttons
-{
-    NSMutableArray *buttons = [NSMutableArray arrayWithCapacity:self.items.count];
-    
-    for (UIView *view in self.subviews) {
-        if ([view isKindOfClass:[UIButton class]]) {
-            [buttons addObject:view];
-        }
-    }
-    return buttons;
-}
-
-- (UIButton *)buttonAtIndex:(NSUInteger)segment
-{
-    if (self.items.count > 0 && segment < [self buttons].count) {
-        return (UIButton *)[[self buttons] objectAtIndex:segment];
-    }
-    return nil;
-}
-
-- (UIButton *)selectedButton
-{
-    if (self.selectedSegmentIndex >= 0) {
-        return [self buttonAtIndex:self.selectedSegmentIndex];
-    }
-    return nil;
-}
-
-- (NSString *)stringForSegmentAtIndex:(NSUInteger)segment
-{
-    if (self.isImageMode) {
-        return nil;
-    }
-    
-    UIButton *button = [self buttonAtIndex:segment];
-    return [[button attributedTitleForState:UIControlStateNormal] string];
-}
-
-- (NSString *)titleForSegmentAtIndex:(NSUInteger)segment
-{
-    if (self.isImageMode) {
-        return nil;
-    }
-    
-    if (self.showsCount) {
-        NSString *title = [self stringForSegmentAtIndex:segment];
-        NSArray *components = [title componentsSeparatedByString:@"\n"];
-        
-        if (components.count == 2) {
-            return components[self.inverseTitles ? 0 : 1];
-        }
-        else return nil;
-    }
-    return self.items[segment];
-}
-
-- (NSNumber *)countForSegmentAtIndex:(NSUInteger)segment
-{
-    if (self.isImageMode) {
-        return nil;
-    }
-    
-    return segment < self.counts.count ? self.counts[segment] : @(0);
-}
-
-- (UIColor *)titleColorForState:(UIControlState)state
-{
-    if (self.isImageMode) {
-        return nil;
-    }
-    
-    NSString *key = [NSString stringWithFormat:@"UIControlState%d", (int)state];
-    UIColor *color = [self.colors objectForKey:key];
-    
-    if (!color) {
-        switch (state) {
-            case UIControlStateNormal:              return [UIColor darkGrayColor];
-            case UIControlStateHighlighted:         return self.tintColor;
-            case UIControlStateDisabled:            return [UIColor lightGrayColor];
-            case UIControlStateSelected:            return self.tintColor;
-            default:                                return self.tintColor;
-        }
-    }
-    
-    return color;
-}
-
-- (BOOL)showsCount
-{
-    if (self.isImageMode) {
-        return NO;
-    }
-    
-    return _showsCount;
-}
-
-- (BOOL)autoAdjustSelectionIndicatorWidth
-{
-    if (self.isImageMode) {
-        return NO;
-    }
-    
-    return _autoAdjustSelectionIndicatorWidth;
-}
-
-- (CGRect)selectionIndicatorRect
-{
-    UIButton *button = [self selectedButton];
-    
-    id item = self.items[button.tag];
-    
-    if ([item isKindOfClass:[NSString class]]) {
-        if ([(NSString *)item length] == 0) {
-            return CGRectZero;
-        }
-    }
-    
-    CGRect frame = CGRectZero;
-    CGFloat appropriateY = button.frame.size.height-self.selectionIndicatorHeight-self.selectionIndicatorPadding;
-    
-    if (self.selectionIndicatorPosition != UIBarPositionAny) {
-        frame.origin.y = (self.selectionIndicatorPosition > UIBarPositionBottom) ? 0.0f : appropriateY;
-    }
-    else {
-        frame.origin.y = (self.barPosition > UIBarPositionBottom) ? 0.0f : appropriateY;
-    }
-    
-    if (self.autoAdjustSelectionIndicatorWidth) {
-        
-        NSAttributedString *attributedString = [button attributedTitleForState:UIControlStateSelected];
-        
-        CGFloat width = [attributedString size].width;
-        
-        // Do not exceed the bounds of the button
-        if (width > button.frame.size.width) {
-            width = button.frame.size.width;
-        }
-        
-        frame.size = CGSizeMake(width, self.selectionIndicatorHeight);
-        frame.origin.x = (button.frame.size.width*(self.selectedSegmentIndex))+(button.frame.size.width-frame.size.width)/2;
-    }
-    else {
-        frame.size = CGSizeMake(button.frame.size.width, self.selectionIndicatorHeight);
-        frame.origin.x = (button.frame.size.width*(self.selectedSegmentIndex));
-    }
-    
-    return frame;
-}
-
-- (UIColor *)hairlineColor
-{
-    return self.hairline.backgroundColor;
-}
-
-- (CGRect)hairlineRect
-{
-    CGRect frame = CGRectMake(0.0f, 0.0f, self.frame.size.width, 0.5f);
-    frame.origin.y = (self.barPosition > UIBarPositionBottom) ? 0.0f : self.frame.size.height;
-    
-    return frame;
-}
-
-// Calculate the most appropriate font size for a button title
-- (CGFloat)appropriateFontSizeForTitle:(NSString *)title
-{
-    CGFloat fontSize = 14.0f;
-    CGFloat minFontSize = 8.0f;
-    
-    if (!self.adjustsFontSizeToFitWidth) {
-        return fontSize;
-    }
-    
-    CGFloat buttonWidth = roundf(self.bounds.size.width/self.numberOfSegments);
-    
-    CGSize constraintSize = CGSizeMake(buttonWidth, MAXFLOAT);
-    
-    do {
-        // Creates a new font instance with the current font size
-        UIFont *font = [UIFont fontWithName:self.font.fontName size:fontSize];
-        
-        CGRect textRect = [title boundingRectWithSize:constraintSize options:0 attributes:@{NSFontAttributeName:font} context:nil];
-        
-        // If the new text rect's width matches the constraint width, return the font size
-        if (textRect.size.width <= constraintSize.width) {
-            return fontSize;
-        }
-        
-        // Decreases the font size and tries again
-        fontSize -= 1.0f;
-        
-    } while (fontSize > minFontSize);
-    
-    return fontSize;
-}
-
-- (UIBarPosition)barPosition
-{
-    if (self.delegate && [self.delegate respondsToSelector:@selector(positionForBar:)]) {
-        return [self.delegate positionForBar:self];
-    }
-    return UIBarPositionAny;
-}
-
-- (UIBarPosition)selectionIndicatorPosition
-{
-    if (self.delegate && [self.delegate respondsToSelector:@selector(positionForSelectionIndicator:)]) {
-        return [self.delegate positionForSelectionIndicator:self];
-    }
-    return UIBarPositionAny;
-}
-
-
-#pragma mark - Setter Methods
-
-- (void)setDelegate:(id<DZNSegmentedControlDelegate>)delegate
-{
-    _delegate = delegate;
-    
-    [self layoutIfNeeded];
-}
-
-- (void)setFrame:(CGRect)frame
-{
-    _width = CGRectGetWidth(frame);
-    _height = CGRectGetHeight(frame);
-    
-    [super setFrame:frame];
-    
-    [self layoutIfNeeded];
-}
-
-- (void)setHeight:(CGFloat)height
-{
-    _height = height;
-    
-    [self layoutSubviews];
-}
-
-- (void)setWidth:(CGFloat)width
-{
-    _width = width;
-    
-    [self layoutSubviews];
-}
-
-- (void)setItems:(NSArray *)items
-{
-    if (_items) {
-        [self removeAllSegments];
-    }
-    
-    if (items.count == 0) {
-        _items = nil;
-        return;
-    }
-    
-    id firstItem = [items firstObject];
-    
-    _imageMode = [firstItem isKindOfClass:[UIImage class]];
-    
-#if DEBUG
-    Class class = _imageMode ? [UIImage class] : [NSString class];
-    
-    // Consider cases where NSCFConstantString can also be used
-    class = [class isSubclassOfClass:[NSString class]] ? [NSString class] : class;
-    
-    __unused NSPredicate *classPredicate = [NSPredicate predicateWithFormat:@"self isKindOfClass: %@", class];
-    NSAssert([items filteredArrayUsingPredicate:classPredicate].count == items.count, @"Cannot include different objects in the array. Please make sure to either pass an array of NSString or UIImage objects.");
-#endif
-    
-    _items = [NSArray arrayWithArray:items];
-    
-    if (!_imageMode) {
-        _counts = [NSMutableArray arrayWithCapacity:items.count];
-        
-        for (int i = 0; i < items.count; i++) {
-            [self.counts addObject:@0];
-        }
-    }
-    
-    [self insertAllSegments];
-}
-
-- (void)setTintColor:(UIColor *)color
-{
-    if (!color || !self.items || self.initializing) {
-        return;
-    }
-    
-    [super setTintColor:color];
-    
-    if (self.isImageMode) {
-
-        for (UIButton *btn in self.buttons) {
-            
-            UIImage *normalImage = [btn imageForState:UIControlStateNormal];
-            UIImage *selectedImage = [normalImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
-            
-            [btn setImage:selectedImage forState:UIControlStateSelected];
-            btn.tintColor = color;
-        }
-    }
-    else {
-        [self setTitleColor:color forState:UIControlStateHighlighted];
-        [self setTitleColor:color forState:UIControlStateSelected];
-    }
-}
-
-- (void)setScrollOffset:(CGPoint)scrollOffset contentSize:(CGSize)contentSize
-{
-    CGFloat offset = 0.0;
-    
-    // Horizontal scroll
-    if (self.scrollOffset.x != scrollOffset.x) {
-        offset = scrollOffset.x/(contentSize.width/self.numberOfSegments);
-    }
-    // Vertical scroll
-    else if (self.scrollOffset.y != scrollOffset.y) {
-        offset = scrollOffset.y/(contentSize.height/self.numberOfSegments);
-    }
-    // Skip
-    else {
-        return;
-    }
-    
-    CGFloat buttonWidth = roundf(self.width/self.numberOfSegments);
-    
-    CGRect indicatorRect = self.selectionIndicator.frame;
-    indicatorRect.origin.x = (buttonWidth * offset) + (buttonWidth - CGRectGetWidth(indicatorRect)) / 2;
-    self.selectionIndicator.frame = indicatorRect;
-    
-    NSUInteger index = (NSUInteger)offset;
-    
-    if (offset == truncf(offset) && self.selectedSegmentIndex != index) {
-        
-        [self unselectAllButtons];
-        [self.buttons[index] setSelected:YES];
-        
-        _selectedSegmentIndex = index;
-        
-        [self sendActionsForControlEvents:UIControlEventValueChanged];
-    }
-    
-    _scrollOffset = scrollOffset;
-}
-
-- (void)setSelectedSegmentIndex:(NSInteger)segment
-{
-    [self setSelectedSegmentIndex:segment animated:NO];
-}
-
-- (void)setSelectedSegmentIndex:(NSInteger)segment animated:(BOOL)animated
-{
-    if (self.numberOfSegments == 0 || self.selectedSegmentIndex == segment) {
-        return;
-    }
-    
-    [self unselectAllButtons];
-    [self enableAllButtonsInteraction:YES];
-    
-    UIButton *targetButton = self.buttons[segment];
-    targetButton.selected = YES;
-    targetButton.userInteractionEnabled = NO;
-    
-    _selectedSegmentIndex = segment;
-    
-    void (^animations)(void) = ^void(){
-        self.selectionIndicator.frame = [self selectionIndicatorRect];
-    };
-    
-    if (animated) {
-        CGFloat duration = (self.selectedSegmentIndex < 0.0f) ? 0.0f : self.animationDuration;
-        CGFloat damping = !self.bouncySelectionIndicator ? : 0.65f;
-        CGFloat velocity = !self.bouncySelectionIndicator ? : 0.5f;
-        
-        [UIView animateWithDuration:duration
-                              delay:0.0f
-             usingSpringWithDamping:damping
-              initialSpringVelocity:velocity
-                            options:UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionCurveEaseInOut
-                         animations:animations
-                         completion:NULL];
-    }
-    else {
-        animations();
-    }
-}
-
-- (void)setTintColor:(UIColor *)tintColor forSegmentAtIndex:(NSUInteger)segment
-{
-    if (!tintColor) {
-        return;
-    }
-    
-    NSAssert(segment < self.numberOfSegments, @"Cannot assign a tint color to non-existing segment.");
-    NSAssert(segment >= 0, @"Cannot assign a tint color to a negative segment.");
-    
-    NSAssert([tintColor isKindOfClass:[UIColor class]], @"Cannot assign a tint color with an unvalid color object.");
-    
-    UIButton *button = [self buttonAtIndex:segment];
-    
-    if (!self.isImageMode) {
-        button.backgroundColor = tintColor;
-    }
-}
-
-- (void)setTitle:(NSString *)title forSegmentAtIndex:(NSUInteger)segment
-{
-    if (!title || self.isImageMode) {
-        return;
-    }
-    
-    NSAssert(segment <= self.numberOfSegments, @"Cannot assign a title to non-existing segment.");
-    NSAssert(segment >= 0, @"Cannot assign a title to a negative segment.");
-    
-    NSMutableArray *items = [NSMutableArray arrayWithArray:self.items];
-    
-    if (segment >= self.numberOfSegments) {
-        [items insertObject:title atIndex:self.numberOfSegments];
-        [self addButtonForSegment:segment];
-    }
-    else {
-        [items replaceObjectAtIndex:segment withObject:title];
-        [self setCount:[self countForSegmentAtIndex:segment] forSegmentAtIndex:segment];
-    }
-    
-    _items = items;
-}
-
-- (void)setCount:(NSNumber *)count forSegmentAtIndex:(NSUInteger)segment
-{
-    if (!count || !self.items || self.isImageMode) {
-        return;
-    }
-    
-    NSAssert(segment < self.numberOfSegments, @"Cannot assign a count to non-existing segment.");
-    NSAssert(segment >= 0, @"Cannot assign a title to a negative segment.");
-    
-    self.counts[segment] = count;
-    
-    [self configureSegments];
-}
-
-- (void)setImage:(UIImage *)image forSegmentAtIndex:(NSUInteger)segment
-{
-    if (!image || !self.isImageMode) {
-        return;
-    }
-    
-    NSAssert(segment <= self.numberOfSegments, @"Cannot assign an image to non-existing segment.");
-    NSAssert(segment >= 0, @"Cannot assign an image to a negative segment.");
-    
-    NSMutableArray *items = [NSMutableArray arrayWithArray:self.items];
-    
-    if (segment >= self.numberOfSegments) {
-        [items insertObject:image atIndex:self.numberOfSegments];
-        [self addButtonForSegment:segment];
-    }
-    else {
-        [items replaceObjectAtIndex:segment withObject:image];
-    }
-    
-    [self configureButtonImage:image forSegment:segment];
-    
-    _items = items;
-}
-
-- (void)setAttributedTitle:(NSAttributedString *)attributedString forSegmentAtIndex:(NSUInteger)segment
-{
-    UIButton *button = [self buttonAtIndex:segment];
-    button.titleLabel.numberOfLines = (self.showsCount) ? 2 : 1;
-    
-    [button setAttributedTitle:attributedString forState:UIControlStateNormal];
-    [button setAttributedTitle:attributedString forState:UIControlStateHighlighted];
-    [button setAttributedTitle:attributedString forState:UIControlStateSelected];
-    [button setAttributedTitle:attributedString forState:UIControlStateDisabled];
-    
-    [self setTitleColor:[self titleColorForState:UIControlStateNormal] forState:UIControlStateNormal];
-    [self setTitleColor:[self titleColorForState:UIControlStateHighlighted] forState:UIControlStateHighlighted];
-    [self setTitleColor:[self titleColorForState:UIControlStateDisabled] forState:UIControlStateDisabled];
-    [self setTitleColor:[self titleColorForState:UIControlStateSelected] forState:UIControlStateSelected];
-    
-    [self configureAccessoryViews];
-}
-
-- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state
-{
-    if (self.isImageMode) {
-        return;
-    }
-    
-    NSAssert([color isKindOfClass:[UIColor class]], @"Cannot assign a title color with an unvalid color object.");
-    
-    for (UIButton *button in [self buttons]) {
-        
-        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:[button attributedTitleForState:state]];
-        NSString *string = attributedString.string;
-        
-        NSMutableParagraphStyle *style  = [[NSMutableParagraphStyle alloc] init];
-        style.alignment = NSTextAlignmentCenter;
-        style.lineBreakMode = (self.showsCount) ? NSLineBreakByWordWrapping : NSLineBreakByTruncatingTail;
-        style.lineBreakMode = NSLineBreakByWordWrapping;
-        style.minimumLineHeight = 20.0f;
-        
-        [attributedString addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, string.length)];
-        
-        if (self.showsCount) {
-            
-            NSArray *components = [attributedString.string componentsSeparatedByString:@"\n"];
-            
-            if (components.count < 2) {
-                return;
-            }
-            
-            NSString *count = [components objectAtIndex:self.inverseTitles ? 1 : 0];
-            NSString *title = [components objectAtIndex:self.inverseTitles ? 0 : 1];
-            
-            CGFloat fontSizeForTitle = [self appropriateFontSizeForTitle:title];
-            
-            [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:self.font.fontName size:19.0f] range:[string rangeOfString:count]];
-            [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:self.font.fontName size:fontSizeForTitle] range:[string rangeOfString:title]];
-            
-            if (state == UIControlStateNormal) {
-                
-                UIColor *topColor = self.inverseTitles ? [color colorWithAlphaComponent:0.5f] : color;
-                UIColor *bottomColor = self.inverseTitles ? color : [color colorWithAlphaComponent:0.5f];
-                
-                NSUInteger topLength = self.inverseTitles ? title.length : count.length;
-                NSUInteger bottomLength = self.inverseTitles ? count.length : title.length;
-                
-                [attributedString addAttribute:NSForegroundColorAttributeName value:topColor range:NSMakeRange(0, topLength)];
-                [attributedString addAttribute:NSForegroundColorAttributeName value:bottomColor range:NSMakeRange(topLength, bottomLength+1)];
-            }
-            else {
-                [attributedString addAttribute:NSForegroundColorAttributeName value:color range:NSMakeRange(0, string.length)];
-                
-                if (state == UIControlStateSelected) {
-                    self.selectionIndicator.backgroundColor = color;
-                }
-            }
-        }
-        else {
-            [attributedString addAttribute:NSFontAttributeName value:self.font range:NSMakeRange(0, attributedString.string.length)];
-            [attributedString addAttribute:NSForegroundColorAttributeName value:color range:NSMakeRange(0, attributedString.string.length)];
-        }
-        
-        [button setAttributedTitle:attributedString forState:state];
-    }
-    
-    NSString *key = [NSString stringWithFormat:@"UIControlState%d", (int)state];
-    [self.colors setObject:color forKey:key];
-}
-
-- (void)setDisplayCount:(BOOL)count
-{
-    if (self.showsCount == count) {
-        return;
-    }
-    
-    _showsCount = count;
-    
-    [self configureSegments];
-}
-
-- (void)setFont:(UIFont *)font
-{
-    if ( [self.font.fontName isEqualToString:font.fontName] && self.font.pointSize == font.pointSize ) {
-        return;
-    }
-    
-    _font = font;
-    
-    [self configureSegments];
-}
-
-- (void)setShowsGroupingSeparators:(BOOL)showsGroupingSeparators
-{
-    if (self.showsGroupingSeparators == showsGroupingSeparators) {
-        return;
-    }
-    
-    _showsGroupingSeparators = showsGroupingSeparators;
-    
-    [self configureSegments];
-}
-
-- (void)setNumberFormatter:(NSNumberFormatter *)numberFormatter
-{
-    if ([self.numberFormatter isEqual:numberFormatter]) {
-        return;
-    }
-    
-    _numberFormatter = numberFormatter;
-    
-    [self configureSegments];
-}
-
-- (void)setEnabled:(BOOL)enabled forSegmentAtIndex:(NSUInteger)segment
-{
-    UIButton *button = [self buttonAtIndex:segment];
-    button.enabled = enabled;
-}
-
-- (BOOL)isSegmentAtIndexEnabled:(NSUInteger)segment
-{
-    UIButton *button = [self buttonAtIndex:segment];
-    return button.enabled;
-}
-
-- (void)setHairlineColor:(UIColor *)color
-{
-    if (self.initializing) {
-        return;
-    }
-    
-    self.hairline.backgroundColor = color;
-}
-
-- (void)setAdjustsButtonTopInset:(BOOL)adjustsButtonTopInset
-{
-    _adjustsButtonTopInset = adjustsButtonTopInset;
-    
-    [self layoutSubviews];
-}
-
-
-#pragma mark - DZNSegmentedControl Configuration
-
-- (void)insertAllSegments
-{
-    for (int i = 0; i < self.numberOfSegments; i++) {
-        [self addButtonForSegment:i];
-    }
-    
-    if (self.isImageMode || self.window) {
-        [self configureSegments];
-    }
-}
-
-- (void)addButtonForSegment:(NSUInteger)segment
-{
-    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
-    
-    [button addTarget:self action:@selector(willSelectedButton:) forControlEvents:UIControlEventTouchDown];
-    [button addTarget:self action:@selector(didSelectButton:) forControlEvents:UIControlEventTouchDragOutside|UIControlEventTouchDragInside|UIControlEventTouchDragEnter|UIControlEventTouchDragExit|UIControlEventTouchCancel|UIControlEventTouchUpInside|UIControlEventTouchUpOutside];
-    
-    button.backgroundColor = [UIColor clearColor];
-    button.opaque = YES;
-    button.clipsToBounds = YES;
-    button.adjustsImageWhenHighlighted = NO;
-    button.exclusiveTouch = YES;
-    button.tag = segment;
-    
-    [self insertSubview:button belowSubview:self.selectionIndicator];
-}
-
-- (void)configureSegments
-{
-    for (UIButton *button in [self buttons]) {
-        [self configureButtonForSegment:button.tag];
-    }
-    
-    [self configureAccessoryViews];
-}
-
-- (void)configureAccessoryViews
-{
-    self.selectionIndicator.frame = [self selectionIndicatorRect];
-    self.selectionIndicator.backgroundColor = self.tintColor;
-    
-    self.hairline.frame = [self hairlineRect];
-}
-
-- (void)configureButtonForSegment:(NSUInteger)segment
-{
-    NSAssert(segment < self.numberOfSegments, @"Cannot configure a button for a non-existing segment.");
-    NSAssert(segment >= 0, @"Cannot configure a button for a negative segment.");
-    
-    id item = self.items[segment];
-    
-    if ([item isKindOfClass:[NSString class]]) {
-        [self configureButtonTitle:item forSegment:segment];
-    }
-    else if ([item isKindOfClass:[UIImage class]]) {
-        [self configureButtonImage:item forSegment:segment];
-    }
-}
-
-- (void)configureButtonTitle:(NSString *)title forSegment:(NSUInteger)segment
-{
-    NSMutableString *mutableTitle = [NSMutableString stringWithString:title];
-    
-    if (self.showsCount) {
-        NSNumber *count = [self countForSegmentAtIndex:segment];
-        
-        NSString *breakString = @"\n";
-        NSString *countString;
-        
-        if (self.numberFormatter) {
-            countString = [self.numberFormatter stringFromNumber:count];
-        }
-        else if (!self.numberFormatter && _showsGroupingSeparators) {
-            countString = [[[self class] defaultFormatter] stringFromNumber:count];
-        }
-        else {
-            countString = [NSString stringWithFormat:@"%@", count];
-        }
-        
-        NSString *resultString = self.inverseTitles ? [breakString stringByAppendingString:countString] : [countString stringByAppendingString:breakString];
-        
-        [mutableTitle insertString:resultString atIndex:self.inverseTitles ? title.length : 0];
-    }
-    
-    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:mutableTitle];
-    [self setAttributedTitle:attributedString forSegmentAtIndex:segment];
-}
-
-- (void)configureButtonImage:(UIImage *)image forSegment:(NSUInteger)segment
-{
-    UIButton *button = [self buttonAtIndex:segment];
-    
-    [button setImage:image forState:UIControlStateNormal];
-    
-    [self setAttributedTitle:nil forSegmentAtIndex:segment];
-}
-
-- (void)willSelectedButton:(id)sender
-{
-    UIButton *button = (UIButton *)sender;
-    
-    if (self.selectedSegmentIndex != button.tag) {
-        [self setSelectedSegmentIndex:button.tag animated:YES];
-        [self sendActionsForControlEvents:UIControlEventValueChanged];
-    }
-    else if (!self.disableSelectedSegment) {
-        [self sendActionsForControlEvents:UIControlEventValueChanged];
-    }
-}
-
-- (void)didSelectButton:(id)sender
-{
-    UIButton *button = (UIButton *)sender;
-    
-    button.highlighted = NO;
-    button.selected = YES;
-}
-
-- (void)unselectAllButtons
-{
-    [self.buttons setValue:@NO forKey:@"selected"];
-    [self.buttons setValue:@NO forKey:@"highlighted"];
-}
-
-- (void)enableAllButtonsInteraction:(BOOL)enable
-{
-    [self.buttons setValue:@(enable) forKey:@"userInteractionEnabled"];
-}
-
-- (void)removeAllSegments
-{
-    // Removes all the buttons
-    [[self buttons] makeObjectsPerformSelector:@selector(removeFromSuperview)];
-    
-    _items = nil;
-    _counts = nil;
-}
-
-
-#pragma mark - Class Methods
-
-+ (NSNumberFormatter *)defaultFormatter
-{
-    static NSNumberFormatter *defaultFormatter;
-    
-    static dispatch_once_t oncePredicate;
-    dispatch_once(&oncePredicate, ^{
-        defaultFormatter = [[NSNumberFormatter alloc] init];
-        defaultFormatter.numberStyle = NSNumberFormatterDecimalStyle;
-        [defaultFormatter setGroupingSeparator:[[NSLocale currentLocale] objectForKey:NSLocaleGroupingSeparator]];
-    });
-    
-    return defaultFormatter;
-}
-
-@end

+ 0 - 41
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/KLTAnimateNav/AnimationContoller.h

@@ -1,41 +0,0 @@
-//
-//  AnimationContoller.h
-//  ChongZu
-//
-//  Created by 孔令涛 on 2016/10/9.
-//  Copyright © 2016年 cz10000. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-/**
- 导航栏操作类型
- */
-#define ScreenWidth [UIScreen mainScreen].bounds.size.width
-#define ScreenHeight [UIScreen mainScreen].bounds.size.height
-
-@interface AnimationContoller : NSObject<UIViewControllerAnimatedTransitioning>
-
-+ (instancetype)AnimationControllerWithOperation:(UINavigationControllerOperation)operation;
-+ (instancetype)AnimationControllerWithOperation:(UINavigationControllerOperation)operation NavigationController:(UINavigationController *)navigationController;
-
-@property(nonatomic,assign)UINavigationControllerOperation  navigationOperation;
-@property(nonatomic,weak)UINavigationController * navigationController;
-
-/**
- 导航栏Pop时删除了多少张截图(调用PopToViewController时,计算要删除的截图的数量)
- */
-@property(nonatomic,assign)NSInteger  removeCount;
-
-/**
- 调用此方法删除数组最后一张截图 (调用pop手势或一次pop多个控制器时使用)
- */
-- (void)removeLastScreenShot;
-/**
- 移除全部屏幕截图
- */
-- (void)removeAllScreenShot;
-/**
- 从截屏数组尾部移除指定数量的截图
- */
-- (void)removeLastScreenShotWithNumber:(NSInteger)number;
-@end

+ 0 - 236
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/KLTAnimateNav/AnimationContoller.m

@@ -1,236 +0,0 @@
-//
-//  AnimationContoller.m
-//  ChongZu
-//
-//  Created by 孔令涛 on 2016/10/9.
-//  Copyright © 2016年 cz10000. All rights reserved.
-//
-
-#import "AnimationContoller.h"
-@interface AnimationContoller ()
-
-@property(nonatomic,strong)NSMutableArray * screenShotArray;
-/**
- 所属的导航栏有没有TabBarController
- */
-@property (nonatomic,assign)BOOL isTabbarExist;
-
-@end
-
-@implementation AnimationContoller
-
-+ (instancetype)AnimationControllerWithOperation:(UINavigationControllerOperation)operation NavigationController:(UINavigationController *)navigationController
-{
-    AnimationContoller * ac = [[AnimationContoller alloc]init];
-    ac.navigationController = navigationController;
-    ac.navigationOperation = operation;
-    return ac;
-}
-+ (instancetype)AnimationControllerWithOperation:(UINavigationControllerOperation)operation
-{
-    AnimationContoller * ac = [[AnimationContoller alloc]init];
-    ac.navigationOperation = operation;
-    return ac;
-}
-
-- (void)setNavigationController:(UINavigationController *)navigationController
-{
-    _navigationController = navigationController;
-    
-    UIViewController *beyondVC = self.navigationController.view.window.rootViewController;
-    //判断该导航栏是否有TabBarController
-    if (self.navigationController.tabBarController == beyondVC) {
-        _isTabbarExist = YES;
-    }
-    else
-    {
-        _isTabbarExist = NO;
-    }
-}
-
-- (NSMutableArray *)screenShotArray
-{
-    if (_screenShotArray == nil) {
-        _screenShotArray = [[NSMutableArray alloc]init];
-    }
-    return _screenShotArray;
-}
-- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext
-{
-    return .3f;
-}
-
--(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
-{
-    
-    
-    UIImageView * screentImgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
-    UIImage * screenImg = [self screenShot];
-    screentImgView.image =screenImg;
-    
-    //取出fromViewController,fromView和toViewController,toView
-    UIViewController * fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
-    //    UIView * fromView = [transitionContext viewForKey:UITransitionContextFromViewKey];
-    UIViewController * toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
-    UIView * toView = [transitionContext viewForKey:UITransitionContextToViewKey];
-    
-    
-    CGRect fromViewEndFrame = [transitionContext finalFrameForViewController:fromViewController];
-    fromViewEndFrame.origin.x = ScreenWidth;
-    CGRect fromViewStartFrame = fromViewEndFrame;
-    CGRect toViewEndFrame = [transitionContext finalFrameForViewController:toViewController];
-    CGRect toViewStartFrame = toViewEndFrame;
-    
-    
-    
-    UIView * containerView = [transitionContext containerView];
-    
-    if (self.navigationOperation == UINavigationControllerOperationPush) {
-        
-        
-        [self.screenShotArray addObject:screenImg];
-        
-        //这句非常重要,没有这句,就无法正常Push和Pop出对应的界面
-        [containerView addSubview:toView];
-        
-        toView.frame = toViewStartFrame;
-        
-        UIView * nextVC = [[UIView alloc]initWithFrame:CGRectMake(ScreenWidth, 0, ScreenWidth, ScreenHeight)];
-        
-        //将截图添加到导航栏的View所属的window上
-        [self.navigationController.view.window insertSubview:screentImgView atIndex:0];
-        
-        nextVC.layer.shadowColor = [UIColor blackColor].CGColor;
-        nextVC.layer.shadowOffset = CGSizeMake(-0.8, 0);
-        nextVC.layer.shadowOpacity = 0.6;
-        
-        self.navigationController.view.transform = CGAffineTransformMakeTranslation(ScreenWidth, 0);
-        
-        [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
-            //toView.frame = toViewEndFrame;
-            self.navigationController.view.transform = CGAffineTransformMakeTranslation(0, 0);
-            screentImgView.center = CGPointMake(-ScreenWidth/2, ScreenHeight / 2);
-            //nextVC.center = CGPointMake(ScreenWidth/2, ScreenHeight / 2);
-            
-            
-        } completion:^(BOOL finished) {
-            
-            [nextVC removeFromSuperview];
-            [screentImgView removeFromSuperview];
-            [transitionContext completeTransition:YES];
-        }];
-        
-    }
-    if (self.navigationOperation == UINavigationControllerOperationPop) {
-        
-        
-        
-        fromViewStartFrame.origin.x = 0;
-        [containerView addSubview:toView];
-        
-        UIImageView * lastVcImgView = [[UIImageView alloc]initWithFrame:CGRectMake(-ScreenWidth, 0, ScreenWidth, ScreenHeight)];
-        //若removeCount大于0  则说明Pop了不止一个控制器
-        if (_removeCount > 0) {
-            for (NSInteger i = 0; i < _removeCount; i ++) {
-                if (i == _removeCount - 1) {
-                    //当删除到要跳转页面的截图时,不再删除,并将该截图作为ToVC的截图展示
-                    lastVcImgView.image = [self.screenShotArray lastObject];
-                    _removeCount = 0;
-                    break;
-                }
-                else
-                {
-                    [self.screenShotArray removeLastObject];
-                }
-                
-            }
-        }
-        else
-        {
-            lastVcImgView.image = [self.screenShotArray lastObject];
-        }
-        screentImgView.layer.shadowColor = [UIColor blackColor].CGColor;
-        screentImgView.layer.shadowOffset = CGSizeMake(-0.8, 0);
-        screentImgView.layer.shadowOpacity = 0.6;
-        [self.navigationController.view.window addSubview:lastVcImgView];
-        [self.navigationController.view addSubview:screentImgView];
-        
-        // fromView.frame = fromViewStartFrame;
-        [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
-            
-            screentImgView.center = CGPointMake(ScreenWidth * 3 / 2 , ScreenHeight / 2);
-            lastVcImgView.center = CGPointMake(ScreenWidth/2, ScreenHeight/2);
-            //fromView.frame = fromViewEndFrame;
-            
-        } completion:^(BOOL finished) {
-            //[self.navigationController setNavigationBarHidden:NO];
-            [lastVcImgView removeFromSuperview];
-            [screentImgView removeFromSuperview];
-            [self.screenShotArray removeLastObject];
-            [transitionContext completeTransition:YES];
-            
-        }];
-        
-        
-    }
-    
-}
-- (void)removeLastScreenShot
-{
-    [self.screenShotArray removeLastObject];
-    
-}
-- (void)removeAllScreenShot
-{
-    [self.screenShotArray removeAllObjects];
-}
-- (void)removeLastScreenShotWithNumber:(NSInteger)number
-{
-    for (NSInteger  i = 0; i < number ; i++) {
-        [self.screenShotArray removeLastObject];
-    }
-}
-- (UIImage *)screenShot
-{
-    // 将要被截图的view,即窗口的根控制器的view(必须不含状态栏,默认ios7中控制器是包含了状态栏的)
-    UIViewController *beyondVC = self.navigationController.view.window.rootViewController;
-    // 背景图片 总的大小
-    CGSize size = beyondVC.view.frame.size;
-    // 开启上下文,使用参数之后,截出来的是原图(YES  0.0 质量高)
-    UIGraphicsBeginImageContextWithOptions(size, YES, 0.0);
-    // 要裁剪的矩形范围
-    CGRect rect = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
-    //注:iOS7以后renderInContext:由drawViewHierarchyInRect:afterScreenUpdates:替代
-    
-    //判读是导航栏是否有上层的Tabbar  决定截图的对象
-    if (_isTabbarExist) {
-        [beyondVC.view drawViewHierarchyInRect:rect  afterScreenUpdates:NO];
-    }
-    else
-    {
-        [self.navigationController.view drawViewHierarchyInRect:rect afterScreenUpdates:NO];
-    }
-    // 从上下文中,取出UIImage
-    UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
-    
-    // 千万记得,结束上下文(移除栈顶的基于当前位图的图形上下文)
-    UIGraphicsEndImageContext();
-    
-    
-    
-    // 返回截取好的图片
-    return snapshot;
-    
-}
-
-/*
- #pragma mark - Navigation
- 
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
-
-@end

+ 0 - 15
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/KLTAnimateNav/KLTNavigationController.h

@@ -1,15 +0,0 @@
-//
-//  CZNavigationController.h
-//  ChongZu
-//
-//  Created by cz10000 on 16/4/27.
-//  Copyright © 2016年 cz10000. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface KLTNavigationController : UINavigationController
-
-@property(strong,nonatomic)UIScreenEdgePanGestureRecognizer *panGestureRec;
-
-@end

+ 0 - 317
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/KLTAnimateNav/KLTNavigationController.m

@@ -1,317 +0,0 @@
-//
-//  CZNavigationController.m
-//  ChongZu
-//
-//  Created by cz10000 on 16/4/27.
-//  Copyright © 2016年 cz10000. All rights reserved.
-//
-
-#import "KLTNavigationController.h"
-#import "AnimationContoller.h"
-
-#define ColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
-@interface KLTNavigationController ()<UIGestureRecognizerDelegate,UINavigationControllerDelegate>
-@property(strong,nonatomic)UIImageView * screenshotImgView;
-@property(strong,nonatomic)UIView * coverView;
-@property(strong,nonatomic)NSMutableArray * screenshotImgs;
-
-
-@property(nonatomic,strong)UIImage * nextVCScreenShotImg;
-
-
-@property(nonatomic,strong)AnimationContoller * animationController;
-
-@end
-
-@implementation KLTNavigationController
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    
-    self.delegate = self;
-    
-    
-    self.navigationBar.tintColor = ColorFromRGB(0x0a2c8b);
-    
-    self.view.layer.shadowColor = [UIColor blackColor].CGColor;
-    self.view.layer.shadowOffset = CGSizeMake(-0.8, 0);
-    self.view.layer.shadowOpacity = 0.6;
-    
-    
-    // Do any additional setup after loading the view.
-    // 1,创建Pan手势识别器,并绑定监听方法
-    
-    
-    _panGestureRec = [[UIScreenEdgePanGestureRecognizer alloc]initWithTarget:self action:@selector(panGestureRec:)];
-    _panGestureRec.edges = UIRectEdgeLeft;
-    // 为导航控制器的view添加Pan手势识别器
-    [self.view addGestureRecognizer:_panGestureRec];
-    
-    // 2.创建截图的ImageView
-    _screenshotImgView = [[UIImageView alloc] init];
-    // app的frame是包括了状态栏高度的frame
-    _screenshotImgView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
-    
-    
-    // 3.创建截图上面的黑色半透明遮罩
-    _coverView = [[UIView alloc] init];
-    // 遮罩的frame就是截图的frame
-    _coverView.frame = _screenshotImgView.frame;
-    // 遮罩为黑色
-    _coverView.backgroundColor = [UIColor blackColor];
-    _coverView.alpha = 0.5;
-    // 4.存放所有的截图数组初始化
-    _screenshotImgs = [NSMutableArray array];
-}
-
-- (nullable id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
-                                            animationControllerForOperation:(UINavigationControllerOperation)operation
-                                                         fromViewController:(UIViewController *)fromVC
-                                                           toViewController:(UIViewController *)toVC  NS_AVAILABLE_IOS(7_0)
-{
-    self.animationController.navigationOperation = operation;
-    self.animationController.navigationController = self;
-    //    self.animationController.lastVCScreenShot = self.lastVCScreenShotImg;
-    // self.animationController.nextVCScreenShot = self.nextVCScreenShotImg;
-    return self.animationController;
-}
-- (AnimationContoller *)animationController
-{
-    if (_animationController == nil) {
-        _animationController = [[AnimationContoller alloc]init];
-        
-    }
-    return _animationController;
-}
-- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
-{
-    
-    
-    // 只有在导航控制器里面有子控制器的时候才需要截图
-    if (self.viewControllers.count >= 1) {
-        // 调用自定义方法,使用上下文截图
-        [self screenShot];
-    }
-    
-    [super pushViewController:viewController animated:animated];
-    
-    
-}
-- (UIViewController *)popViewControllerAnimated:(BOOL)animated
-{
-    NSInteger index = self.viewControllers.count;
-    NSString * className = nil;
-    if (index >= 2) {
-        className = NSStringFromClass([self.viewControllers[index -2] class]);
-    }
-    
-    if (_screenshotImgs.count >= index - 1) {
-        [_screenshotImgs removeLastObject];
-    }
-    
-    
-    return [super popViewControllerAnimated:animated];
-}
-- (NSArray<UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated
-{
-    
-    NSInteger removeCount = 0;
-    for (NSInteger i = self.viewControllers.count - 1; i > 0; i--) {
-        if (viewController == self.viewControllers[i]) {
-            break;
-        }
-        
-        [_screenshotImgs removeLastObject];
-        removeCount ++;
-        
-    }
-    _animationController.removeCount = removeCount;
-    return [super popToViewController:viewController animated:animated];
-}
-- (NSArray<UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated
-{
-    [_screenshotImgs removeAllObjects];
-    [_animationController removeAllScreenShot];
-    return [super popToRootViewControllerAnimated:animated];
-}
-// 使用上下文截图,并使用指定的区域裁剪,模板代码
-- (void)screenShot
-{
-    // 将要被截图的view,即窗口的根控制器的view(必须不含状态栏,默认ios7中控制器是包含了状态栏的)
-    UIViewController *beyondVC = self.view.window.rootViewController;
-    // 背景图片 总的大小
-    CGSize size = beyondVC.view.frame.size;
-    // 开启上下文,使用参数之后,截出来的是原图(YES  0.0 质量高)
-    UIGraphicsBeginImageContextWithOptions(size, YES, 0.0);
-    // 要裁剪的矩形范围
-    CGRect rect = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
-    //注:iOS7以后renderInContext:由drawViewHierarchyInRect:afterScreenUpdates:替代
-    //判读是导航栏是否有上层的Tabbar  决定截图的对象
-    if (self.tabBarController == beyondVC) {
-        [beyondVC.view drawViewHierarchyInRect:rect  afterScreenUpdates:NO];
-    }
-    else
-    {
-        [self.view drawViewHierarchyInRect:rect afterScreenUpdates:NO];
-    }
-    // 从上下文中,取出UIImage
-    UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
-    // 添加截取好的图片到图片数组
-    if (snapshot) {
-        [_screenshotImgs addObject:snapshot];
-        //self.lastVCScreenShotImg = snapshot;
-    }
-    
-    
-    // 千万记得,结束上下文(移除栈顶的基于当前位图的图形上下文)
-    UIGraphicsEndImageContext();
-    
-}
-
-
-// 监听手势的方法,只要是有手势就会执行
-- (void)panGestureRec:(UIScreenEdgePanGestureRecognizer *)panGestureRec
-{
-    
-    // 如果当前显示的控制器已经是根控制器了,不需要做任何切换动画,直接返回
-    if(self.visibleViewController == self.viewControllers[0]) return;
-    
-    // 判断pan手势的各个阶段
-    switch (panGestureRec.state) {
-        case UIGestureRecognizerStateBegan:
-            // 开始拖拽阶段
-            [self dragBegin];
-            break;
-        case UIGestureRecognizerStateCancelled:
-        case UIGestureRecognizerStateFailed:
-        case UIGestureRecognizerStateEnded:
-            // 结束拖拽阶段
-            [self dragEnd];
-            break;
-            
-        default:
-            // 正在拖拽阶段
-            [self dragging:panGestureRec];
-            break;
-    }
-}
-
-
-#pragma mark 开始拖动,添加图片和遮罩
-- (void)dragBegin
-{
-    // 重点,每次开始Pan手势时,都要添加截图imageview 和 遮盖cover到window中
-    [self.view.window insertSubview:_screenshotImgView atIndex:0];
-    [self.view.window insertSubview:_coverView aboveSubview:_screenshotImgView];
-    
-    // 并且,让imgView显示截图数组中的最后(最新)一张截图
-    _screenshotImgView.image = [_screenshotImgs lastObject];
-    //_screenshotImgView.transform = CGAffineTransformMakeTranslation(ScreenWidth, 0);
-}
-
-
-// 默认的将要变透明的遮罩的初始透明度(全黑)
-#define kDefaultAlpha 0.6
-
-
-// 当拖动的距离,占了屏幕的总宽高的3/4时, 就让imageview完全显示,遮盖完全消失
-#define kTargetTranslateScale 0.75
-#pragma mark 正在拖动,动画效果的精髓,进行位移和透明度变化
-- (void)dragging:(UIPanGestureRecognizer *)pan
-{
-    
-    // 得到手指拖动的位移
-    CGFloat offsetX = [pan translationInView:self.view].x;
-    
-    // 让整个view都平移     // 挪动整个导航view
-    if (offsetX > 0) {
-        self.view.transform = CGAffineTransformMakeTranslation(offsetX, 0);
-    }
-    
-    
-    // 计算目前手指拖动位移占屏幕总的宽高的比例,当这个比例达到3/4时, 就让imageview完全显示,遮盖完全消失
-    double currentTranslateScaleX = offsetX/self.view.frame.size.width;
-    
-    if (offsetX < ScreenWidth) {
-        
-        _screenshotImgView.transform = CGAffineTransformMakeTranslation((offsetX - ScreenWidth) * 0.6, 0);
-    }
-    
-    // 让遮盖透明度改变,直到减为0,让遮罩完全透明,默认的比例-(当前平衡比例/目标平衡比例)*默认的比例
-    double alpha = kDefaultAlpha - (currentTranslateScaleX/kTargetTranslateScale) * kDefaultAlpha;
-    _coverView.alpha = alpha;
-}
-
-#pragma mark 结束拖动,判断结束时拖动的距离作相应的处理,并将图片和遮罩从父控件上移除
-- (void)dragEnd
-{
-    // 取出挪动的距离
-    CGFloat translateX = self.view.transform.tx;
-    // 取出宽度
-    CGFloat width = self.view.frame.size.width;
-    
-    if (translateX <= 40) {
-        // 如果手指移动的距离还不到屏幕的一半,往左边挪 (弹回)
-        [UIView animateWithDuration:0.3 animations:^{
-            // 重要~~让被右移的view弹回归位,只要清空transform即可办到
-            self.view.transform = CGAffineTransformIdentity;
-            // 让imageView大小恢复默认的translation
-            self->_screenshotImgView.transform = CGAffineTransformMakeTranslation(-ScreenWidth, 0);
-            // 让遮盖的透明度恢复默认的alpha 1.0
-            self->_coverView.alpha = kDefaultAlpha;
-        } completion:^(BOOL finished) {
-            // 重要,动画完成之后,每次都要记得 移除两个view,下次开始拖动时,再添加进来
-            [self->_screenshotImgView removeFromSuperview];
-            [self->_coverView removeFromSuperview];
-        }];
-    } else {
-        // 如果手指移动的距离还超过了屏幕的一半,往右边挪
-        [UIView animateWithDuration:0.3 animations:^{
-            // 让被右移的view完全挪到屏幕的最右边,结束之后,还要记得清空view的transform
-            self.view.transform = CGAffineTransformMakeTranslation(width, 0);
-            // 让imageView位移还原
-            self->_screenshotImgView.transform = CGAffineTransformMakeTranslation(0, 0);
-            // 让遮盖alpha变为0,变得完全透明
-            self->_coverView.alpha = 0;
-        } completion:^(BOOL finished) {
-            // 重要~~让被右移的view完全挪到屏幕的最右边,结束之后,还要记得清空view的transform,不然下次再次开始drag时会出问题,因为view的transform没有归零
-            self.view.transform = CGAffineTransformIdentity;
-            // 移除两个view,下次开始拖动时,再加回来
-            [self->_screenshotImgView removeFromSuperview];
-            [self->_coverView removeFromSuperview];
-            
-            // 执行正常的Pop操作:移除栈顶控制器,让真正的前一个控制器成为导航控制器的栈顶控制器
-            [self popViewControllerAnimated:NO];
-            
-            // 重要~记得这时候,可以移除截图数组里面最后一张没用的截图了
-            // [_screenshotImgs removeLastObject];
-            [self.animationController removeLastScreenShot];
-        }];
-    }
-}
-- (void)didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
-}
-//- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
-//{
-//    // 注意:只有非根控制器才有滑动返回功能,根控制器没有。
-//    // 判断导航控制器是否只有一个子控制器,如果只有一个子控制器,肯定是根控制器
-//    if (self.childViewControllers.count == 1) {
-//        // 表示用户在根控制器界面,就不需要触发滑动手势,
-//        return NO;
-//    }
-//
-//    return YES;
-//}
-/*
- #pragma mark - Navigation
- 
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
-
-@end

+ 0 - 167
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseActionSheet.m

@@ -1,167 +0,0 @@
-//
-//  MSSBrowseActionSheet.m
-//  MSSBrowse
-//
-//  Created by 于威 on 16/2/14.
-//  Copyright © 2016年 于威. All rights reserved.
-//
-
-#define kBrowseActionSheetSpace 10.0f
-#define kBrowseActionSheetCellHeight 44.0f
-
-#import "MSSBrowseActionSheet.h"
-#import "MSSBrowseDefine.h"
-#import "MSSBrowseActionSheetCell.h"
-
-@interface MSSBrowseActionSheet ()<UITableViewDelegate,UITableViewDataSource>
-
-@property (nonatomic,strong)UITableView *tableView;
-@property (nonatomic,strong)NSArray *titleArray;
-@property (nonatomic,copy)NSString *cancelTitle;
-@property (nonatomic,copy)MSSBrowseActionSheetDidSelectedAtIndexBlock selectedBlock;
-@property (nonatomic,assign)CGFloat tableViewHeight;
-@property (nonatomic,strong)UIView *maskView;
-
-@end
-
-@implementation MSSBrowseActionSheet
-
-- (instancetype)initWithTitleArray:(NSArray *)titleArray cancelButtonTitle:(NSString *)cancelTitle didSelectedBlock:(MSSBrowseActionSheetDidSelectedAtIndexBlock)selectedBlock
-{
-    self = [super initWithFrame:CGRectZero];
-    if(self)
-    {
-        _titleArray = titleArray;
-        _cancelTitle = cancelTitle;
-        _selectedBlock = selectedBlock;
-        _tableViewHeight = (_titleArray.count + 1) * kBrowseActionSheetCellHeight + kBrowseActionSheetSpace;
-        [self createBrowseActionSheet];
-    }
-    return self;
-}
-
-- (void)createBrowseActionSheet
-{
-    _maskView = [[UIView alloc]init];
-    _maskView.backgroundColor = [UIColor blackColor];
-    _maskView.alpha = 0.3;
-    [self addSubview:_maskView];
-    
-    _tableView = [[UITableView alloc]init];
-    _tableView.delegate = self;
-    _tableView.dataSource = self;
-    _tableView.separatorColor = [UIColor clearColor];
-    _tableView.bounces = NO;
-    [self addSubview:_tableView];
-}
-
-- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
-{
-    if(section == 1)
-    {
-        return kBrowseActionSheetSpace;
-    }
-    return 0;
-}
-
-- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
-{
-    if(section == 1)
-    {
-        UIView *view = [[UIView alloc]init];
-        view.backgroundColor = [UIColor lightGrayColor];
-        return view;
-    }
-    return nil;
-}
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
-{
-    return 2;
-}
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
-    if(section == 0)
-    {
-        return _titleArray.count;
-    }
-    return 1;
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    static NSString *cellName = @"cell";
-    MSSBrowseActionSheetCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
-    if(cell == nil)
-    {
-        cell = [[MSSBrowseActionSheetCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
-    }
-    cell.titleLabel.frame = CGRectMake(0, 0, self.mssWidth, kBrowseActionSheetCellHeight);
-    cell.bottomLineView.hidden = YES;
-    if(indexPath.section == 0)
-    {
-        cell.titleLabel.text = _titleArray[indexPath.row];
-        if(_titleArray.count > indexPath.row + 1)
-        {
-            cell.bottomLineView.frame = CGRectMake(0, kBrowseActionSheetCellHeight - 1, self.mssWidth,1);
-            cell.bottomLineView.hidden = NO;
-        }
-    }
-    else
-    {
-        cell.titleLabel.text = _cancelTitle;
-    }
-    return cell;
-}
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
-{
-    if(indexPath.section == 0)
-    {
-        if(_selectedBlock)
-        {
-            _selectedBlock(indexPath.row);
-        }
-    }
-    [self disMissActionSheet];
-}
-
-- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-{
-    [self disMissActionSheet];
-}
-
-- (void)disMissActionSheet
-{
-    [UIView animateWithDuration:0.3 animations:^{
-        [_tableView setMssY:self.mssHeight];
-    } completion:^(BOOL finished) {
-        [self removeFromSuperview];
-    }];
-}
-
-- (void)showInView:(UIView *)view
-{
-    [view addSubview:self];
-    self.frame = view.bounds;
-    _maskView.frame = view.bounds;
-    _tableView.frame = CGRectMake(0, self.mssHeight, self.mssWidth, _tableViewHeight);
-    [UIView animateWithDuration:0.3 animations:^{
-        [_tableView setMssY:self.mssHeight - _tableViewHeight];
-    }];
-}
-
-// transform时更新frame
-- (void)updateFrame
-{
-    if(self.superview)
-    {
-        self.frame = self.superview.bounds;
-        _maskView.frame = self.superview.bounds;
-        _tableView.frame = CGRectMake(0, self.mssHeight - _tableViewHeight, self.mssWidth, _tableViewHeight);
-        [_tableView reloadData];
-    }
-}
-
-@end

+ 0 - 35
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseActionSheetCell.m

@@ -1,35 +0,0 @@
-//
-//  MSSBrowseActionSheetCell.m
-//  MSSBrowse
-//
-//  Created by 于威 on 16/2/14.
-//  Copyright © 2016年 于威. All rights reserved.
-//
-
-#import "MSSBrowseActionSheetCell.h"
-#import "MSSBrowseDefine.h"
-
-@implementation MSSBrowseActionSheetCell
-
-- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
-{
-    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
-    if(self)
-    {
-        [self createCell];
-    }
-    return self;
-}
-
-- (void)createCell
-{
-    _titleLabel = [[UILabel alloc]init];
-    _titleLabel.textAlignment = NSTextAlignmentCenter;
-    [self.contentView addSubview:_titleLabel];
-    
-    _bottomLineView = [[UIView alloc]init];
-    _bottomLineView.backgroundColor = [UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f];
-    [self.contentView addSubview:_bottomLineView];
-}
-
-@end

+ 0 - 416
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseBaseViewController.m

@@ -1,416 +0,0 @@
-//
-//  MSSBrowseBaseViewController.m
-//  MSSBrowse
-//
-//  Created by 于威 on 16/4/26.
-//  Copyright © 2016年 于威. All rights reserved.
-//
-
-#import "MSSBrowseBaseViewController.h"
-#import "UIImageView+WebCache.h"
-#import "SDImageCache.h"
-#import "UIImage+MSSScale.h"
-#import "MSSBrowseRemindView.h"
-#import "MSSBrowseActionSheet.h"
-#import "MSSBrowseDefine.h"
-
-@interface MSSBrowseBaseViewController ()
-
-@property (nonatomic,strong)NSArray *browseItemArray;
-@property (nonatomic,assign)NSInteger currentIndex;
-@property (nonatomic,assign)BOOL isRotate;// 判断是否正在切换横竖屏
-@property (nonatomic,strong)UILabel *countLabel;// 当前图片位置
-@property (nonatomic,strong)UIView *snapshotView;
-@property (nonatomic,strong)NSMutableArray *verticalBigRectArray;
-@property (nonatomic,strong)NSMutableArray *horizontalBigRectArray;
-@property (nonatomic,strong)UIView *bgView;
-@property (nonatomic,assign)UIDeviceOrientation currentOrientation;
-@property (nonatomic,strong)MSSBrowseActionSheet *browseActionSheet;
-@property (nonatomic,strong)MSSBrowseRemindView *browseRemindView;
-
-@end
-
-@implementation MSSBrowseBaseViewController
-
-- (instancetype)initWithBrowseItemArray:(NSArray *)browseItemArray currentIndex:(NSInteger)currentIndex
-{
-    self = [super init];
-    if(self)
-    {
-        _browseItemArray = browseItemArray;
-        _currentIndex = currentIndex;
-        _isEqualRatio = YES;
-        _isFirstOpen = YES;
-        _screenWidth = MSS_SCREEN_WIDTH;
-        _screenHeight = MSS_SCREEN_HEIGHT;
-        _currentOrientation = UIDeviceOrientationPortrait;
-        _verticalBigRectArray = [[NSMutableArray alloc]init];
-        _horizontalBigRectArray = [[NSMutableArray alloc]init];
-    }
-    return self;
-}
-
-- (void)dealloc
-{
-    [NSObject cancelPreviousPerformRequestsWithTarget:self];
-}
-
-- (void)showBrowseViewController
-{
-    UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
-    if([[[UIDevice currentDevice]systemVersion]floatValue] >= 8.0)
-    {
-        self.modalPresentationStyle = UIModalPresentationOverCurrentContext;
-    }
-    else
-    {
-        _snapshotView = [rootViewController.view snapshotViewAfterScreenUpdates:NO];
-    }
-    [rootViewController presentViewController:self animated:NO completion:^{
-        
-    }];
-}
-
-- (void)showCurrentIndex:(BOOL)isShow {
-    if (!isShow) {
-        self.countLabel.hidden = YES;
-    }else {
-        self.countLabel.hidden = NO;
-    }
-}
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-    [self initData];
-    [self createBrowseView];
-}
-
-- (void)initData
-{
-    for (MSSBrowseModel *browseItem in _browseItemArray)
-    {
-        CGRect verticalRect = CGRectZero;
-        CGRect horizontalRect = CGRectZero;
-        // 等比可根据小图宽高计算大图宽高
-        if(_isEqualRatio)
-        {
-            if(browseItem.smallImageView)
-            {
-                verticalRect = [browseItem.smallImageView.image mss_getBigImageRectSizeWithScreenWidth:MSS_SCREEN_WIDTH screenHeight:MSS_SCREEN_HEIGHT];
-                horizontalRect = [browseItem.smallImageView.image mss_getBigImageRectSizeWithScreenWidth:MSS_SCREEN_HEIGHT screenHeight:MSS_SCREEN_WIDTH];
-            }
-        }
-        NSValue *verticalValue = [NSValue valueWithCGRect:verticalRect];
-        [_verticalBigRectArray addObject:verticalValue];
-        NSValue *horizontalValue = [NSValue valueWithCGRect:horizontalRect];
-        [_horizontalBigRectArray addObject:horizontalValue];
-    }
-    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
-}
-
-// 获取指定视图在window中的位置
-- (CGRect)getFrameInWindow:(UIView *)view
-{
-    // 改用[UIApplication sharedApplication].keyWindow.rootViewController.view,防止present新viewController坐标转换不准问题
-    return [view.superview convertRect:view.frame toView:[UIApplication sharedApplication].keyWindow.rootViewController.view];
-}
-
-- (void)createBrowseView
-{
-    self.view.backgroundColor = [UIColor blackColor];
-    if(_snapshotView)
-    {
-        _snapshotView.hidden = YES;
-        [self.view addSubview:_snapshotView];
-    }
-    
-    _bgView = [[UIView alloc]initWithFrame:self.view.bounds];
-    _bgView.backgroundColor = [UIColor clearColor];
-    [self.view addSubview:_bgView];
-    
-    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
-    flowLayout.minimumLineSpacing = 0;
-    // 布局方式改为从上至下,默认从左到右
-    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
-    // Section Inset就是某个section中cell的边界范围
-    flowLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
-    // 每行内部cell item的间距
-    flowLayout.minimumInteritemSpacing = 0;
-    // 每行的间距
-    flowLayout.minimumLineSpacing = 0;
-    
-    _collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, _screenWidth + kBrowseSpace, _screenHeight) collectionViewLayout:flowLayout];
-    _collectionView.delegate = self;
-    _collectionView.dataSource = self;
-    _collectionView.pagingEnabled = YES;
-    _collectionView.bounces = NO;
-    _collectionView.showsHorizontalScrollIndicator = NO;
-    _collectionView.showsVerticalScrollIndicator = NO;
-    _collectionView.backgroundColor = [UIColor blackColor];
-    [_collectionView registerClass:[MSSBrowseCollectionViewCell class] forCellWithReuseIdentifier:@"MSSBrowserCell"];
-    _collectionView.contentOffset = CGPointMake(_currentIndex * (_screenWidth + kBrowseSpace), 0);
-    [_bgView addSubview:_collectionView];
-    
-    _countLabel = [[UILabel alloc]init];
-    _countLabel.textColor = [UIColor whiteColor];
-    _countLabel.frame = CGRectMake(0, _screenHeight - 50, _screenWidth, 50);
-    _countLabel.text = [NSString stringWithFormat:@"%ld/%ld",(long)_currentIndex + 1,(long)_browseItemArray.count];
-    _countLabel.textAlignment = NSTextAlignmentCenter;
-    [_bgView addSubview:_countLabel];
-    
-    _browseRemindView = [[MSSBrowseRemindView alloc]initWithFrame:_bgView.bounds];
-    [_bgView addSubview:_browseRemindView];
-}
-
-
-#pragma mark UIColectionViewDelegate
-- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    MSSBrowseCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MSSBrowserCell" forIndexPath:indexPath];
-    if(cell)
-    {        
-        MSSBrowseModel *browseItem = [_browseItemArray objectAtIndex:indexPath.row];
-        // 还原初始缩放比例
-        cell.zoomScrollView.frame = CGRectMake(0, 0, _screenWidth, _screenHeight);
-        cell.zoomScrollView.zoomScale = 1.0f;
-        // 将scrollview的contentSize还原成缩放前
-        cell.zoomScrollView.contentSize = CGSizeMake(_screenWidth, _screenHeight);
-        cell.zoomScrollView.zoomImageView.contentMode = browseItem.smallImageView.contentMode;
-        cell.zoomScrollView.zoomImageView.clipsToBounds = browseItem.smallImageView.clipsToBounds;
-        [cell.loadingView mss_setFrameInSuperViewCenterWithSize:CGSizeMake(30, 30)];
-        CGRect bigImageRect = [_verticalBigRectArray[indexPath.row] CGRectValue];
-        if(_currentOrientation != UIDeviceOrientationPortrait)
-        {
-            bigImageRect = [_horizontalBigRectArray[indexPath.row] CGRectValue];
-        }
-        [self loadBrowseImageWithBrowseItem:browseItem Cell:cell bigImageRect:bigImageRect];
-        
-        __weak __typeof(self)weakSelf = self;
-        [cell tapClick:^(MSSBrowseCollectionViewCell *browseCell) {
-            __strong __typeof(weakSelf)strongSelf = weakSelf;
-            [strongSelf tap:browseCell];
-        }];
-        [cell longPress:^(MSSBrowseCollectionViewCell *browseCell) {
-            __strong __typeof(weakSelf)strongSelf = weakSelf;
-            [[SDImageCache sharedImageCache] diskImageExistsWithKey:browseItem.bigImageUrl completion:^(BOOL isInCache) {
-                if (isInCache) {
-                    [strongSelf longPress:browseCell];
-                }
-            }];
-        }];
-    }
-    return cell;
-}
-
-// 子类重写此方法
-- (void)loadBrowseImageWithBrowseItem:(MSSBrowseModel *)browseItem Cell:(MSSBrowseCollectionViewCell *)cell bigImageRect:(CGRect)bigImageRect
-{
-
-}
-
-- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
-{
-    return _browseItemArray.count;
-}
-
-- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    return CGSizeMake(_screenWidth + kBrowseSpace, _screenHeight);
-}
-
-#pragma mark UIScrollViewDeletate
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView
-{
-    if(!_isRotate)
-    {
-        _currentIndex = scrollView.contentOffset.x / (_screenWidth + kBrowseSpace);
-        _countLabel.text = [NSString stringWithFormat:@"%ld/%ld",(long)_currentIndex + 1,(long)_browseItemArray.count];
-    }
-    _isRotate = NO;
-}
-
-#pragma mark Tap Method
-- (void)tap:(MSSBrowseCollectionViewCell *)browseCell
-{
-    // 移除通知
-    [[NSNotificationCenter defaultCenter]removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
-    if(_snapshotView)
-    {
-        _snapshotView.hidden = NO;
-    }
-    else
-    {
-        self.view.backgroundColor = [UIColor clearColor];
-    }
-    // 集合视图背景色设置为透明
-    _collectionView.backgroundColor = [UIColor clearColor];
-    // 动画结束前不可点击透明背景后的内容
-    _collectionView.userInteractionEnabled = NO;
-    // 显示状态栏
-    [self setNeedsStatusBarAppearanceUpdate];
-    // 停止加载
-    NSArray *cellArray = _collectionView.visibleCells;
-    for (MSSBrowseCollectionViewCell *cell in cellArray)
-    {
-        [cell.loadingView stopAnimation];
-    }
-    [_countLabel removeFromSuperview];
-    _countLabel = nil;
-    
-    NSIndexPath *indexPath = [_collectionView indexPathForCell:browseCell];
-    browseCell.zoomScrollView.zoomScale = 1.0f;
-    MSSBrowseModel *browseItem = _browseItemArray[indexPath.row];
-    /*
-     建议小图列表的collectionView尽量不要复用,因为当小图的列表collectionview复用时,传进来的BrowseItem数组只有当前显示cell的smallImageView,在当前屏幕外的cell上的小图由于复用关系实际是没有的,所以只能有简单的渐变动画
-     */
-    if(browseItem.smallImageView)
-    {
-        CGRect rect = [self getFrameInWindow:browseItem.smallImageView];
-        CGAffineTransform transform = CGAffineTransformMakeRotation(0);
-        if(_currentOrientation == UIDeviceOrientationLandscapeLeft)
-        {
-            transform = CGAffineTransformMakeRotation(- M_PI / 2);
-            rect = CGRectMake(rect.origin.y, MSS_SCREEN_WIDTH - rect.size.width - rect.origin.x, rect.size.height, rect.size.width);
-        }
-        else if(_currentOrientation == UIDeviceOrientationLandscapeRight)
-        {
-            transform = CGAffineTransformMakeRotation(M_PI / 2);
-            rect = CGRectMake(MSS_SCREEN_HEIGHT - rect.size.height - rect.origin.y, rect.origin.x, rect.size.height, rect.size.width);
-        }
-        [UIView animateWithDuration:0.5 animations:^{
-            browseCell.zoomScrollView.zoomImageView.transform = transform;
-            browseCell.zoomScrollView.zoomImageView.frame = rect;
-        } completion:^(BOOL finished) {
-            [self dismissViewControllerAnimated:NO completion:^{
-                
-            }];
-        }];
-    }
-    else
-    {
-        [UIView animateWithDuration:0.1 animations:^{
-            self.view.alpha = 0.0;
-        } completion:^(BOOL finished) {
-            [self dismissViewControllerAnimated:NO completion:^{
-                
-            }];
-        }];
-    }
-}
-
-- (void)longPress:(MSSBrowseCollectionViewCell *)browseCell
-{
-    [_browseActionSheet removeFromSuperview];
-    _browseActionSheet = nil;
-    __weak __typeof(self)weakSelf = self;
-    _browseActionSheet = [[MSSBrowseActionSheet alloc]initWithTitleArray:@[@"保存图片",@"复制图片地址"] cancelButtonTitle:@"取消" didSelectedBlock:^(NSInteger index) {
-        __strong __typeof(weakSelf)strongSelf = weakSelf;
-        [strongSelf browseActionSheetDidSelectedAtIndex:index currentCell:browseCell];
-    }];
-    [_browseActionSheet showInView:_bgView];
-}
-
-#pragma mark StatusBar Method
-- (BOOL)prefersStatusBarHidden
-{
-    if(!_collectionView.userInteractionEnabled)
-    {
-        return NO;
-    }
-    return YES;
-}
-
-#pragma mark Orientation Method
-- (void)deviceOrientationDidChange:(NSNotification *)notification
-{
-    UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
-    if(orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)
-    {
-        _isRotate = YES;
-        _currentOrientation = orientation;
-        if(_currentOrientation == UIDeviceOrientationPortrait)
-        {
-            _screenWidth = MSS_SCREEN_WIDTH;
-            _screenHeight = MSS_SCREEN_HEIGHT;
-            [UIView animateWithDuration:0.5 animations:^{
-                self->_bgView.transform = CGAffineTransformMakeRotation(0);
-            }];
-        }
-        else
-        {
-            _screenWidth = MSS_SCREEN_HEIGHT;
-            _screenHeight = MSS_SCREEN_WIDTH;
-            if(_currentOrientation == UIDeviceOrientationLandscapeLeft)
-            {
-                [UIView animateWithDuration:0.5 animations:^{
-                    self->_bgView.transform = CGAffineTransformMakeRotation(M_PI / 2);
-                }];
-            }
-            else
-            {
-                [UIView animateWithDuration:0.5 animations:^{
-                    self->_bgView.transform = CGAffineTransformMakeRotation(- M_PI / 2);
-                }];
-            }
-        }
-        _bgView.frame = CGRectMake(0, 0, MSS_SCREEN_WIDTH, MSS_SCREEN_HEIGHT);
-        _browseRemindView.frame = CGRectMake(0, 0, _screenWidth, _screenHeight);
-        if(_browseActionSheet)
-        {
-            [_browseActionSheet updateFrame];
-        }
-        _countLabel.frame = CGRectMake(0, _screenHeight - 50, _screenWidth, 50);
-        [_collectionView.collectionViewLayout invalidateLayout];
-        _collectionView.frame = CGRectMake(0, 0, _screenWidth + kBrowseSpace, _screenHeight);
-        _collectionView.contentOffset = CGPointMake((_screenWidth + kBrowseSpace) * _currentIndex, 0);
-        [_collectionView reloadData];
-    }
-}
-
-#pragma mark MSSActionSheetClick
-- (void)browseActionSheetDidSelectedAtIndex:(NSInteger)index currentCell:(MSSBrowseCollectionViewCell *)currentCell
-{    // 保存图片
-    if(index == 0)
-    {
-        UIImageWriteToSavedPhotosAlbum(currentCell.zoomScrollView.zoomImageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
-    }
-    // 复制图片地址
-    else if(index == 1)
-    {
-        MSSBrowseModel *currentBwowseItem = _browseItemArray[_currentIndex];
-        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
-        pasteboard.string = currentBwowseItem.bigImageUrl;
-        [self showBrowseRemindViewWithText:@"复制图片地址成功"];
-    }
-}
-
-- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
-{
-    NSString *text = nil;
-    if(error)
-    {
-        text = @"保存图片失败";
-    }
-    else
-    {
-        text = @"保存图片成功";
-    }
-    [self showBrowseRemindViewWithText:text];
-}
-
-#pragma mark RemindView Method
-- (void)showBrowseRemindViewWithText:(NSString *)text
-{
-    [_browseRemindView showRemindViewWithText:text];
-    _bgView.userInteractionEnabled = NO;
-    [self performSelector:@selector(hideRemindView) withObject:nil afterDelay:0.7];
-}
-
-- (void)hideRemindView
-{
-    [_browseRemindView hideRemindView];
-    _bgView.userInteractionEnabled = YES;
-}
-
-@end

+ 0 - 69
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseCollectionViewCell.m

@@ -1,69 +0,0 @@
-//
-//  MSSBrowseCollectionViewCell.m
-//  MSSBrowse
-//
-//  Created by 于威 on 15/12/5.
-//  Copyright © 2015年 于威. All rights reserved.
-//
-
-#import "MSSBrowseCollectionViewCell.h"
-#import "MSSBrowseDefine.h"
-
-@interface MSSBrowseCollectionViewCell ()
-
-@property (nonatomic,copy)MSSBrowseCollectionViewCellTapBlock tapBlock;
-@property (nonatomic,copy)MSSBrowseCollectionViewCellLongPressBlock longPressBlock;
-
-@end
-
-@implementation MSSBrowseCollectionViewCell
-
-- (id)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-    if(self)
-    {
-        [self createCell];
-    }
-    return self;
-}
-
-- (void)createCell
-{
-    _zoomScrollView = [[MSSBrowseZoomScrollView alloc]init];
-    __weak __typeof(self)weakSelf = self;
-    [_zoomScrollView tapClick:^{
-        __strong __typeof(weakSelf)strongSelf = weakSelf;
-        strongSelf.tapBlock(strongSelf);
-    }];
-    [self.contentView addSubview:_zoomScrollView];
-    
-    _loadingView = [[MSSBrowseLoadingImageView alloc]init];
-    [_zoomScrollView addSubview:_loadingView];
-    
-    UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressGesture:)];
-    [self.contentView addGestureRecognizer:longPressGesture];
-}
-
-- (void)tapClick:(MSSBrowseCollectionViewCellTapBlock)tapBlock
-{
-    _tapBlock = tapBlock;
-}
-
-- (void)longPress:(MSSBrowseCollectionViewCellLongPressBlock)longPressBlock
-{
-    _longPressBlock = longPressBlock;
-}
-
-- (void)longPressGesture:(UILongPressGestureRecognizer *)gesture
-{
-    if(_longPressBlock)
-    {
-        if(gesture.state == UIGestureRecognizerStateBegan)
-        {
-            _longPressBlock(self);
-        }
-    }
-}
-
-@end

+ 0 - 52
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseLoadingImageView.m

@@ -1,52 +0,0 @@
-//
-//  MSSBrowseLoadingImageView.m
-//  MSSBrowse
-//
-//  Created by 于威 on 16/4/29.
-//  Copyright © 2016年 于威. All rights reserved.
-//
-
-#import "MSSBrowseLoadingImageView.h"
-
-@interface MSSBrowseLoadingImageView ()
-
-@property (nonatomic,strong)CABasicAnimation *rotationAnimation;
-
-@end
-
-@implementation MSSBrowseLoadingImageView
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-    if(self)
-    {
-        [self createImageView];
-    }
-    return self;
-}
-
-- (void)createImageView
-{
-    self.image = [UIImage imageNamed:@"mss_browseLoading"];
-    _rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
-    _rotationAnimation.toValue = [NSNumber numberWithFloat:(2 * M_PI)];
-    _rotationAnimation.duration = 0.6f;
-    _rotationAnimation.repeatCount = FLT_MAX;
-}
-
-- (void)startAnimation
-{
-    self.hidden = NO;
-    [self.layer addAnimation:_rotationAnimation
-                      forKey:@"rotateAnimation"];
-}
-
-- (void)stopAnimation
-{
-    self.hidden = YES;
-    [self.layer removeAnimationForKey:@"rotateAnimation"];
-}
-
-
-@end

+ 0 - 62
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseLocalViewController.m

@@ -1,62 +0,0 @@
-//
-//  MSSBrowseLocalViewController.m
-//  MSSBrowse
-//
-//  Created by 于威 on 16/4/26.
-//  Copyright © 2016年 于威. All rights reserved.
-//
-
-#import "MSSBrowseLocalViewController.h"
-#import "UIImage+MSSScale.h"
-
-@implementation MSSBrowseLocalViewController
-
-- (void)loadBrowseImageWithBrowseItem:(MSSBrowseModel *)browseItem Cell:(MSSBrowseCollectionViewCell *)cell bigImageRect:(CGRect)bigImageRect
-{
-    cell.loadingView.hidden = YES;
-    UIImageView *imageView = cell.zoomScrollView.zoomImageView;
-    if(browseItem.bigImageLocalPath)
-    {
-        NSData *imageData = [[NSData alloc]initWithContentsOfFile:browseItem.bigImageLocalPath];
-        imageView.image = [[UIImage alloc]initWithData:imageData];
-    }
-    else if(browseItem.bigImage)
-    {
-        imageView.image = browseItem.bigImage;
-    }
-    else if(browseItem.bigImageData)
-    {
-        imageView.image = [[UIImage alloc]initWithData:browseItem.bigImageData];
-    }
-    else
-    {
-        imageView.image = nil;
-    }
-    // 当大图frame为空时,需要大图加载完成后重新计算坐标
-    CGRect bigRect = [self getBigImageRectIfIsEmptyRect:bigImageRect bigImage:imageView.image];
-    // 第一次打开浏览页需要加载动画
-    if(self.isFirstOpen)
-    {
-        self.isFirstOpen = NO;
-        imageView.frame = [self getFrameInWindow:browseItem.smallImageView];
-        [UIView animateWithDuration:0.5 animations:^{
-            imageView.frame = bigRect;
-        }];
-    }
-    else
-    {
-        imageView.frame = bigRect;
-    }
-}
-
-// 当大图frame为空时,需要大图加载完成后重新计算坐标
-- (CGRect)getBigImageRectIfIsEmptyRect:(CGRect)rect bigImage:(UIImage *)bigImage
-{
-    if(CGRectIsEmpty(rect))
-    {
-        return [bigImage mss_getBigImageRectSizeWithScreenWidth:self.screenWidth screenHeight:self.screenHeight];
-    }
-    return rect;
-}
-
-@end

+ 0 - 13
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseModel.m

@@ -1,13 +0,0 @@
-//
-//  MSSBrowseModel.m
-//  MSSBrowse
-//
-//  Created by 于威 on 15/12/5.
-//  Copyright © 2015年 于威. All rights reserved.
-//
-
-#import "MSSBrowseModel.h"
-
-@implementation MSSBrowseModel
-
-@end

+ 0 - 101
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseNetworkViewController.m

@@ -1,101 +0,0 @@
-//
-//  MSSBrowseNetworkViewController.m
-//  MSSBrowse
-//
-//  Created by 于威 on 16/4/26.
-//  Copyright © 2016年 于威. All rights reserved.
-//
-
-#import "MSSBrowseNetworkViewController.h"
-#import "SDImageCache.h"
-#import "UIView+MSSLayout.h"
-#import "UIImage+MSSScale.h"
-#import <SDWebImage/UIImageView+WebCache.h>
-#import <SDWebImage/UIView+WebCache.h>
-
-@implementation MSSBrowseNetworkViewController
-
-- (void)loadBrowseImageWithBrowseItem:(MSSBrowseModel *)browseItem Cell:(MSSBrowseCollectionViewCell *)cell bigImageRect:(CGRect)bigImageRect
-{
-    // 停止加载
-    [cell.loadingView stopAnimation];
-    // 判断大图是否存在
-    [[SDImageCache sharedImageCache] diskImageExistsWithKey:browseItem.bigImageUrl completion:^(BOOL isInCache) {
-        if (isInCache) {
-            // 显示大图
-            [self showBigImage:cell.zoomScrollView.zoomImageView browseItem:browseItem rect:bigImageRect];
-        }
-        // 如果大图不存在
-        else {
-            self.isFirstOpen = NO;
-            // 加载大图
-            [self loadBigImageWithBrowseItem:browseItem cell:cell rect:bigImageRect];
-        }
-    }];
-}
-
-- (void)showBigImage:(UIImageView *)imageView browseItem:(MSSBrowseModel *)browseItem rect:(CGRect)rect
-{
-    // 取消当前请求防止复用问题
-    [imageView sd_cancelCurrentImageLoad];
-    // 如果存在直接显示图片
-    imageView.image = [[SDImageCache sharedImageCache]imageFromDiskCacheForKey:browseItem.bigImageUrl];
-    // 当大图frame为空时,需要大图加载完成后重新计算坐标
-    CGRect bigRect = [self getBigImageRectIfIsEmptyRect:rect bigImage:imageView.image];
-    // 第一次打开浏览页需要加载动画
-    if(self.isFirstOpen)
-    {
-        self.isFirstOpen = NO;
-        imageView.frame = [self getFrameInWindow:browseItem.smallImageView];
-        [UIView animateWithDuration:0.5 animations:^{
-            imageView.frame = bigRect;
-        }];
-    }
-    else
-    {
-        imageView.frame = bigRect;
-    }
-}
-
-// 加载大图
-- (void)loadBigImageWithBrowseItem:(MSSBrowseModel *)browseItem cell:(MSSBrowseCollectionViewCell *)cell rect:(CGRect)rect
-{
-    UIImageView *imageView = cell.zoomScrollView.zoomImageView;
-    // 加载圆圈显示
-    [cell.loadingView startAnimation];
-    // 默认为屏幕中间
-    [imageView mss_setFrameInSuperViewCenterWithSize:CGSizeMake(browseItem.smallImageView.mssWidth, browseItem.smallImageView.mssHeight)];
-    [imageView sd_setImageWithURL:[NSURL URLWithString:browseItem.bigImageUrl] placeholderImage:browseItem.smallImageView.image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
-        // 关闭图片浏览view的时候,不需要继续执行小图加载大图动画
-        if(self.collectionView.userInteractionEnabled)
-        {
-            // 停止加载
-            [cell.loadingView stopAnimation];
-            if(error)
-            {
-                [self showBrowseRemindViewWithText:@"图片加载失败"];
-            }
-            else
-            {
-                // 当大图frame为空时,需要大图加载完成后重新计算坐标
-                CGRect bigRect = [self getBigImageRectIfIsEmptyRect:rect bigImage:image];
-                // 图片加载成功
-                [UIView animateWithDuration:0.5 animations:^{
-                    imageView.frame = bigRect;
-                }];
-            }
-        }
-    }];
-}
-
-// 当大图frame为空时,需要大图加载完成后重新计算坐标
-- (CGRect)getBigImageRectIfIsEmptyRect:(CGRect)rect bigImage:(UIImage *)bigImage
-{
-    if(CGRectIsEmpty(rect))
-    {
-        return [bigImage mss_getBigImageRectSizeWithScreenWidth:self.screenWidth screenHeight:self.screenHeight];
-    }
-    return rect;
-}
-
-@end

+ 0 - 73
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseRemindView.m

@@ -1,73 +0,0 @@
-//
-//  MSSBrowseRemindView.m
-//  MSSBrowse
-//
-//  Created by 于威 on 16/2/14.
-//  Copyright © 2016年 于威. All rights reserved.
-//
-
-#import "MSSBrowseRemindView.h"
-#import "UIView+MSSLayout.h"
-
-@interface MSSBrowseRemindView ()
-
-@property (nonatomic,strong)UILabel *remindLabel;
-@property (nonatomic,strong)UIView *maskView;
-
-@end
-
-@implementation MSSBrowseRemindView
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-    if(self)
-    {
-        [self createRemindView];
-    }
-    return self;
-}
-
-- (void)createRemindView
-{
-    self.alpha = 0;
-    
-    _maskView = [[UIView alloc]init];
-    _maskView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
-    _maskView.backgroundColor = [UIColor blackColor];
-    _maskView.alpha = 0.5f;
-    _maskView.layer.cornerRadius = 5.0f;
-    _maskView.layer.masksToBounds = YES;
-    [self addSubview:_maskView];
-    
-    _remindLabel = [[UILabel alloc]init];
-    _remindLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
-    _remindLabel.font = [UIFont boldSystemFontOfSize:14.0f];
-    _remindLabel.textColor = [UIColor whiteColor];
-    [self addSubview:_remindLabel];
-}
-
-- (void)showRemindViewWithText:(NSString *)text
-{
-    CGRect textRect = [text boundingRectWithSize:CGSizeMake(MAXFLOAT,MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:_remindLabel.font} context:nil];
-    CGSize size = textRect.size;
-    [_maskView mss_setFrameInSuperViewCenterWithSize:CGSizeMake(size.width + 20, size.height + 40)];
-    [_remindLabel mss_setFrameInSuperViewCenterWithSize:CGSizeMake(size.width, size.height)];
-    _remindLabel.text = text;
-    self.alpha = 0;
-    [UIView animateWithDuration:0.3 animations:^{
-        self.alpha = 1;
-    }];
-}
-
-- (void)hideRemindView
-{
-    self.alpha = 1;
-    [UIView animateWithDuration:0.3 animations:^{
-        self.alpha = 0;
-    }completion:^(BOOL finished) {
-        
-    }];
-}
-
-@end

+ 0 - 111
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/MSSBrowseZoomScrollView.m

@@ -1,111 +0,0 @@
-//
-//  MSSBrowseZoomScrollView.m
-//  MSSBrowse
-//
-//  Created by 于威 on 15/12/5.
-//  Copyright © 2015年 于威. All rights reserved.
-//
-
-#import "MSSBrowseZoomScrollView.h"
-#import "MSSBrowseDefine.h"
-
-@interface MSSBrowseZoomScrollView ()
-
-@property (nonatomic,copy)MSSBrowseZoomScrollViewTapBlock tapBlock;
-@property (nonatomic,assign)BOOL isSingleTap;
-
-@end
-
-@implementation MSSBrowseZoomScrollView
-
-- (id)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-    if (self) {
-        // Initialization code
-        [self createZoomScrollView];
-    }
-    return self;
-}
-
-- (void)createZoomScrollView
-{
-    self.delegate = self;
-    _isSingleTap = NO;
-    self.minimumZoomScale = 1.0f;
-    self.maximumZoomScale = 3.0f;
-    
-    _zoomImageView = [[UIImageView alloc]init];
-    _zoomImageView.userInteractionEnabled = YES;
-    [self addSubview:_zoomImageView];
-}
-
-- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
-{
-    return _zoomImageView;
-}
-
-- (void)scrollViewDidZoom:(UIScrollView *)scrollView
-{
-    // 延中心点缩放
-    CGRect rect = _zoomImageView.frame;
-    rect.origin.x = 0;
-    rect.origin.y = 0;
-    if (rect.size.width < self.mssWidth) {
-        rect.origin.x = floorf((self.mssWidth - rect.size.width) / 2.0);
-    }
-    if (rect.size.height < self.mssHeight) {
-        rect.origin.y = floorf((self.mssHeight - rect.size.height) / 2.0);
-    }
-    _zoomImageView.frame = rect;
-}
-
-- (void)tapClick:(MSSBrowseZoomScrollViewTapBlock)tapBlock
-{
-    _tapBlock = tapBlock;
-}
-
-- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-{
-    UITouch *touch = touches.anyObject;
-    if(touch.tapCount == 1)
-    {
-        [self performSelector:@selector(singleTapClick) withObject:nil afterDelay:0.17];
-    }
-    else
-    {
-        [NSObject cancelPreviousPerformRequestsWithTarget:self];
-        // 防止先执行单击手势后还执行下面双击手势动画异常问题
-        if(!_isSingleTap)
-        {
-            CGPoint touchPoint = [touch locationInView:_zoomImageView];
-            [self zoomDoubleTapWithPoint:touchPoint];
-        }
-    }
-}
-
-- (void)singleTapClick
-{
-    _isSingleTap = YES;
-    if(_tapBlock)
-    {
-        _tapBlock();
-    }
-}
-
-- (void)zoomDoubleTapWithPoint:(CGPoint)touchPoint
-{
-    if(self.zoomScale > self.minimumZoomScale)
-    {
-        [self setZoomScale:self.minimumZoomScale animated:YES];
-    }
-    else
-    {
-        CGFloat width = self.bounds.size.width / self.maximumZoomScale;
-        CGFloat height = self.bounds.size.height / self.maximumZoomScale;
-        [self zoomToRect:CGRectMake(touchPoint.x - width / 2, touchPoint.y - height / 2, width, height) animated:YES];
-    }
-}
-
-
-@end

+ 0 - 24
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/UIImage+MSSScale.m

@@ -1,24 +0,0 @@
-//
-//  UIImage+MSSScale.m
-//  MSSBrowse
-//
-//  Created by 于威 on 15/12/6.
-//  Copyright © 2015年 于威. All rights reserved.
-//
-
-#import "UIImage+MSSScale.h"
-
-@implementation UIImage (MSSScale)
-
-// 得到图像显示完整后的宽度和高度
-- (CGRect)mss_getBigImageRectSizeWithScreenWidth:(CGFloat)screenWidth screenHeight:(CGFloat)screenHeight
-{
-    CGFloat widthRatio = screenWidth / self.size.width;
-    CGFloat heightRatio = screenHeight / self.size.height;
-    CGFloat scale = MIN(widthRatio, heightRatio);
-    CGFloat width = scale * self.size.width;
-    CGFloat height = scale * self.size.height;
-    return CGRectMake((screenWidth - width) / 2, (screenHeight - height) / 2, width, height);
-}
-
-@end

+ 0 - 76
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/UIView+MSSLayout.m

@@ -1,76 +0,0 @@
-//
-//  UIView+MSSLayout.m
-//  MSSBrowse
-//
-//  Created by 于威 on 15/12/5.
-//  Copyright © 2015年 于威. All rights reserved.
-//
-
-#import "UIView+MSSLayout.h"
-
-@implementation UIView (MSSLayout)
-
-- (CGFloat)mssLeft
-{
-    return CGRectGetMinX(self.frame);
-}
-
-- (CGFloat)mssRight
-{
-    return CGRectGetMaxX(self.frame);
-}
-
-- (CGFloat)mssBottom
-{
-    return CGRectGetMaxY(self.frame);
-}
-
-- (CGFloat)mssTop
-{
-    return CGRectGetMinY(self.frame);
-}
-
-- (CGFloat)mssHeight
-{
-    return CGRectGetHeight(self.frame);
-}
-
-- (CGFloat)mssWidth
-{
-    return CGRectGetWidth(self.frame);
-}
-
-- (void)setMssX:(CGFloat)mssX
-{
-    CGRect rect = self.frame;
-    rect.origin.x = mssX;
-    self.frame = rect;
-}
-
-- (void)setMssY:(CGFloat)mssY
-{
-    CGRect rect = self.frame;
-    rect.origin.y = mssY;
-    self.frame = rect;
-}
-
-- (void)setMssWidth:(CGFloat)mssWidth
-{
-    CGRect rect = self.frame;
-    rect.size.width = mssWidth;
-    self.frame = rect;
-}
-
-- (void)setMssHeight:(CGFloat)mssHeight
-{
-    CGRect rect = self.frame;
-    rect.size.height = mssHeight;
-    self.frame = rect;
-}
-
-- (void)mss_setFrameInSuperViewCenterWithSize:(CGSize)size
-{
-    self.frame = CGRectMake((self.superview.mssWidth - size.width) / 2, (self.superview.mssHeight - size.height) / 2, size.width, size.height);
-}
-
-@end

BIN
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/mss_browseLoading@2x.png


BIN
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/MSSBrowse/mss_browseLoading@3x.png


+ 0 - 560
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SCIndexView/SCIndexView.m

@@ -1,560 +0,0 @@
-
-#import "SCIndexView.h"
-
-#define kSCIndexViewSpace (self.configuration.indexItemHeight + self.configuration.indexItemsSpace)
-#define kSCIndexViewMargin ((self.bounds.size.height - kSCIndexViewSpace * self.dataSource.count) / 2)
-#define kSCIndexViewInsetTop (self.translucentForTableViewInNavigationBar ? UIApplication.sharedApplication.statusBarFrame.size.height + 44 : 0)
-
-static NSTimeInterval kAnimationDuration = 0.25;
-
-// 根据section值获取TextLayer的中心点y值
-static inline CGFloat SCGetTextLayerCenterY(NSUInteger position, CGFloat margin, CGFloat space)
-{
-    return margin + (position + 1.0 / 2) * space;
-}
-
-// 根据y值获取TextLayer的section值
-static inline NSInteger SCPositionOfTextLayerInY(CGFloat y, CGFloat margin, CGFloat space)
-{
-    CGFloat position = (y - margin) / space - 1.0 / 2;
-    if (position <= 0) return 0;
-    NSUInteger bigger = (NSUInteger)ceil(position);
-    NSUInteger smaller = bigger - 1;
-    CGFloat biggerCenterY = SCGetTextLayerCenterY(bigger, margin, space);
-    CGFloat smallerCenterY = SCGetTextLayerCenterY(smaller, margin, space);
-    return biggerCenterY + smallerCenterY > 2 * y ? smaller : bigger;
-}
-
-
-
-@interface SCTextLayer : CATextLayer
-
-@property (nonatomic, strong) UIFont *itemFont;
-
-@end
-
-@implementation SCTextLayer
-
-- (void)drawInContext:(CGContextRef)context {
-    CGFloat height = self.bounds.size.height;
-    CGFloat fontSize = self.itemFont.lineHeight;
-    CGFloat yOffset = (height - fontSize) / 2;
-    
-    CGContextSaveGState(context);
-    CGContextTranslateCTM(context, 0, yOffset);
-    [super drawInContext:context];
-    CGContextRestoreGState(context);
-}
-
-- (void)setItemFont:(UIFont *)itemFont {
-    _itemFont = itemFont;
-    self.font = (__bridge CFTypeRef _Nullable)(itemFont.fontName);
-    self.fontSize = itemFont.pointSize;
-}
-
-@end
-
-
-
-@interface SCIndexView ()
-
-@property (nonatomic, strong, nullable) CAShapeLayer *searchLayer;
-@property (nonatomic, strong) NSMutableArray<SCTextLayer *> *subTextLayers;
-@property (nonatomic, strong) UILabel *indicator;
-@property (nonatomic, weak) UITableView *tableView;
-
-// 触摸索引视图
-@property (nonatomic, assign, getter=isTouchingIndexView) BOOL touchingIndexView;
-
-// 触感反馈
-@property (nonatomic, strong) UIImpactFeedbackGenerator *generator NS_AVAILABLE_IOS(10_0);
-
-@end
-
-@implementation SCIndexView
-
-#pragma mark - Life Cycle
-
-- (instancetype)initWithTableView:(UITableView *)tableView configuration:(SCIndexViewConfiguration *)configuration
-{
-    if (self = [super initWithFrame:tableView.frame]) {
-        _tableView = tableView;
-        _currentSection = NSUIntegerMax;
-        _configuration = configuration;
-        _translucentForTableViewInNavigationBar = YES;
-        
-        [self addSubview:self.indicator];
-    }
-    return self;
-}
-
-- (void)layoutSubviews {
-    [super layoutSubviews];
-    
-    CGFloat space = kSCIndexViewSpace;
-    CGFloat margin = kSCIndexViewMargin;
-    
-    [CATransaction begin];
-    [CATransaction setDisableActions:YES];
-    if (self.searchLayer && !self.searchLayer.hidden) {
-        self.searchLayer.frame = CGRectMake(self.bounds.size.width - self.configuration.indexItemRightMargin - self.configuration.indexItemHeight, SCGetTextLayerCenterY(0, margin, space) - self.configuration.indexItemHeight / 2, self.configuration.indexItemHeight, self.configuration.indexItemHeight);
-        self.searchLayer.cornerRadius = self.configuration.indexItemHeight / 2;
-        self.searchLayer.contentsScale = UIScreen.mainScreen.scale;
-        self.searchLayer.backgroundColor = self.configuration.indexItemBackgroundColor.CGColor;
-    }
-    
-    NSInteger deta = self.searchLayer ? 1 : 0;
-    for (int i = 0; i < self.subTextLayers.count; i++) {
-        SCTextLayer *textLayer = self.subTextLayers[i];
-        NSUInteger section = i + deta;
-        textLayer.frame = CGRectMake(self.bounds.size.width - self.configuration.indexItemRightMargin - self.configuration.indexItemHeight, SCGetTextLayerCenterY(section, margin, space) - self.configuration.indexItemHeight / 2, self.configuration.indexItemHeight, self.configuration.indexItemHeight);
-    }
-    [CATransaction commit];
-}
-
-#pragma mark - Public Methods
-
-- (void)refreshCurrentSection {
-    [self onActionWithScroll];
-}
-
-#pragma mark - 
-
-- (void)configSubLayersAndSubviews
-{
-    BOOL hasSearchLayer = [self.dataSource.firstObject isEqualToString:UITableViewIndexSearch];
-    NSUInteger deta = 0;
-    if (hasSearchLayer) {
-        if (!self.searchLayer) {
-            self.searchLayer = [self createSearchLayer];
-            [self.layer addSublayer:self.searchLayer];
-        }
-        self.searchLayer.hidden = NO;
-        deta = 1;
-    } else if (self.searchLayer) {
-        self.searchLayer.hidden = YES;
-    }
-    
-    NSInteger countDifference = self.dataSource.count - deta - self.subTextLayers.count;
-    if (countDifference > 0) {
-        for (int i = 0; i < countDifference; i++) {
-            SCTextLayer *textLayer = [SCTextLayer layer];
-            [self.layer addSublayer:textLayer];
-            [self.subTextLayers addObject:textLayer];
-        }
-    } else {
-        for (int i = 0; i < -countDifference; i++) {
-            SCTextLayer *textLayer = self.subTextLayers.lastObject;
-            [textLayer removeFromSuperlayer];
-            [self.subTextLayers removeObject:textLayer];
-        }
-    }
-    
-    CGFloat space = kSCIndexViewSpace;
-    CGFloat margin = kSCIndexViewMargin;
-    
-    [CATransaction begin];
-    [CATransaction setDisableActions:YES];
-    
-    if (hasSearchLayer) {
-        self.searchLayer.frame = CGRectMake(self.bounds.size.width - self.configuration.indexItemRightMargin - self.configuration.indexItemHeight, SCGetTextLayerCenterY(0, margin, space) - self.configuration.indexItemHeight / 2, self.configuration.indexItemHeight, self.configuration.indexItemHeight);
-        self.searchLayer.cornerRadius = self.configuration.indexItemHeight / 2;
-        self.searchLayer.contentsScale = UIScreen.mainScreen.scale;
-        self.searchLayer.backgroundColor = self.configuration.indexItemBackgroundColor.CGColor;
-    }
-    
-    for (int i = 0; i < self.subTextLayers.count; i++) {
-        SCTextLayer *textLayer = self.subTextLayers[i];
-        NSUInteger section = i + deta;
-        textLayer.frame = CGRectMake(self.bounds.size.width - self.configuration.indexItemRightMargin - self.configuration.indexItemHeight, SCGetTextLayerCenterY(section, margin, space) - self.configuration.indexItemHeight / 2, self.configuration.indexItemHeight, self.configuration.indexItemHeight);
-        textLayer.string = self.dataSource[section];
-        textLayer.itemFont = self.configuration.indexItemTextFont;
-        textLayer.cornerRadius = self.configuration.indexItemHeight / 2;
-        textLayer.alignmentMode = kCAAlignmentCenter;
-        textLayer.contentsScale = UIScreen.mainScreen.scale;
-        textLayer.backgroundColor = self.configuration.indexItemBackgroundColor.CGColor;
-        textLayer.foregroundColor = self.configuration.indexItemTextColor.CGColor;
-    }
-    [CATransaction commit];
-    
-    if (self.subTextLayers.count == 0) {
-        self.currentSection = NSUIntegerMax;
-    } else if (self.currentSection == NSUIntegerMax) {
-        self.currentSection = self.searchLayer ? SCIndexViewSearchSection : 0;
-    } else {
-        self.currentSection = self.subTextLayers.count - 1;
-    }
-}
-
-- (void)configCurrentSection
-{
-    NSInteger currentSection = SCIndexViewInvalidSection;
-    if (self.delegate && [self.delegate respondsToSelector:@selector(sectionOfIndexView:tableViewDidScroll:)]) {
-        currentSection = [self.delegate sectionOfIndexView:self tableViewDidScroll:self.tableView];
-        if ((currentSection >= 0 && currentSection != SCIndexViewInvalidSection)
-            || currentSection == SCIndexViewSearchSection) {
-            self.currentSection = currentSection;
-            return;
-        }
-    }
-    
-    NSInteger firstVisibleSection = self.tableView.indexPathsForVisibleRows.firstObject.section;
-    CGFloat insetTop = kSCIndexViewInsetTop;
-    for (NSInteger section = firstVisibleSection; section < self.tableView.numberOfSections; section++) {
-        CGRect sectionFrame = [self.tableView rectForSection:section];
-        if (sectionFrame.origin.y + sectionFrame.size.height - self.tableView.contentOffset.y > insetTop) {
-            currentSection = section;
-            break;
-        }
-    }
-    
-    BOOL selectSearchLayer = NO;
-    if (currentSection == 0 && self.searchLayer && currentSection < self.tableView.numberOfSections) {
-        CGRect sectionFrame = [self.tableView rectForSection:currentSection];
-        selectSearchLayer = (sectionFrame.origin.y - self.tableView.contentOffset.y - insetTop) > 0;
-    }
-    
-    if (selectSearchLayer) {
-        currentSection = SCIndexViewSearchSection;
-    }
-    else {
-        currentSection = currentSection - self.startSection;
-    }
-    
-    self.currentSection = currentSection;
-}
-
-#pragma mark - Event Response
-
-- (void)onActionWithDidSelect
-{
-    if ((self.currentSection < 0 && self.currentSection != SCIndexViewSearchSection)
-        || self.currentSection >= (NSInteger)self.subTextLayers.count) {
-        return;
-    }
-    
-    CGFloat insetTop = kSCIndexViewInsetTop;
-    if (self.currentSection == SCIndexViewSearchSection) {
-        [self.tableView setContentOffset:CGPointMake(0, -insetTop) animated:NO];
-    } else {
-        NSInteger currentSection = self.currentSection + self.startSection;
-        if (currentSection >= 0 && currentSection < self.tableView.numberOfSections) {
-            NSUInteger rowCountInSection = [self.tableView numberOfRowsInSection:currentSection];
-            if (rowCountInSection > 0) {
-                NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:currentSection];
-                [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
-            }
-        }
-    }
-    
-    if (self.isTouchingIndexView) {
-        if (@available(iOS 10.0, *)) {
-            [self.generator prepare];
-            [self.generator impactOccurred];
-        }
-    }
-}
-
-- (void)onActionWithScroll
-{
-    if (self.isTouchingIndexView) {
-        // 当滑动tableView视图时,另一手指滑动索引视图,让tableView滑动失效
-        self.tableView.panGestureRecognizer.enabled = NO;
-        self.tableView.panGestureRecognizer.enabled = YES;
-        
-        return; // 当滑动索引视图时,tableView滚动不能影响索引位置
-    }
-    
-    [self configCurrentSection];
-}
-
-#pragma mark - Display
-
-- (UIBezierPath *)drawIndicatorPath
-{
-    CGFloat indicatorRadius = self.configuration.indicatorHeight / 2;
-    CGFloat sinPI_4_Radius = sin(M_PI_4) * indicatorRadius;
-    CGFloat margin = (sinPI_4_Radius * 2 - indicatorRadius);
-    
-    CGPoint startPoint = CGPointMake(margin + indicatorRadius + sinPI_4_Radius, indicatorRadius - sinPI_4_Radius);
-    CGPoint trianglePoint = CGPointMake(4 * sinPI_4_Radius, indicatorRadius);
-    CGPoint centerPoint = CGPointMake(margin + indicatorRadius, indicatorRadius);
-    
-    UIBezierPath *bezierPath = [UIBezierPath bezierPath];
-    [bezierPath moveToPoint:startPoint];
-    [bezierPath addArcWithCenter:centerPoint radius:indicatorRadius startAngle:-M_PI_4 endAngle:M_PI_4 clockwise:NO];
-    [bezierPath addLineToPoint:trianglePoint];
-    [bezierPath addLineToPoint:startPoint];
-    [bezierPath closePath];
-    return bezierPath;
-}
-
-- (CAShapeLayer *)createSearchLayer
-{
-    CGFloat radius = self.configuration.indexItemHeight / 4;
-    CGFloat margin = self.configuration.indexItemHeight / 4;
-    CGFloat start = radius * 2.5 + margin;
-    CGFloat end = radius + sin(M_PI_4) * radius + margin;
-    UIBezierPath *path = [UIBezierPath bezierPath];
-    [path moveToPoint:CGPointMake(start, start)];
-    [path addLineToPoint:CGPointMake(end, end)];
-    [path addArcWithCenter:CGPointMake(radius + margin, radius + margin) radius:radius startAngle:M_PI_4 endAngle:2 * M_PI + M_PI_4 clockwise:YES];
-    [path closePath];
-    
-    CAShapeLayer *layer = [CAShapeLayer layer];
-    layer.fillColor = self.configuration.indexItemBackgroundColor.CGColor;
-    layer.strokeColor = self.configuration.indexItemTextColor.CGColor;
-    layer.contentsScale = [UIScreen mainScreen].scale;
-    layer.lineWidth = self.configuration.indexItemHeight / 12;
-    layer.path = path.CGPath;
-    return layer;
-}
-
-- (void)showIndicator:(BOOL)animated
-{
-    if (self.currentSection >= (NSInteger)self.subTextLayers.count) return;
-    
-    if (self.currentSection < 0) {
-        if (self.currentSection == SCIndexViewSearchSection) {
-            [self hideIndicator:animated];
-        }
-        return;
-    }
-    
-    SCTextLayer *textLayer = self.subTextLayers[self.currentSection];
-    if (self.configuration.indexViewStyle == SCIndexViewStyleDefault) {
-        self.indicator.center = CGPointMake(self.bounds.size.width - self.indicator.bounds.size.width / 2 - self.configuration.indicatorRightMargin, textLayer.position.y);
-    } else {
-        self.indicator.center = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2);
-    }
-    self.indicator.text = textLayer.string;
-    
-    if (animated) {
-        self.indicator.alpha = 0;
-        self.indicator.hidden = NO;
-        [UIView animateWithDuration:kAnimationDuration animations:^{
-            self.indicator.alpha = 1;
-        }];
-    } else {
-        self.indicator.alpha = 1;
-        self.indicator.hidden = NO;
-    }
-}
-
-- (void)hideIndicator:(BOOL)animated
-{
-    if (self.indicator.hidden) return;
-    
-    if (animated) {
-        self.indicator.alpha = 1;
-        self.indicator.hidden = NO;
-        [UIView animateWithDuration:kAnimationDuration animations:^{
-            self.indicator.alpha = 0;
-        } completion:^(BOOL finished) {
-            self.indicator.alpha = 1;
-            self.indicator.hidden = YES;
-        }];
-    } else {
-        self.indicator.alpha = 1;
-        self.indicator.hidden = YES;
-    }
-}
-
-- (void)refreshTextLayer:(BOOL)selected
-{
-    if (self.currentSection < 0 || self.currentSection >= (NSInteger)self.subTextLayers.count) return;
-    
-    SCTextLayer *textLayer = self.subTextLayers[self.currentSection];
-    UIColor *backgroundColor, *foregroundColor;
-    UIFont *font;
-    if (selected) {
-        backgroundColor = self.configuration.indexItemSelectedBackgroundColor;
-        foregroundColor = self.configuration.indexItemSelectedTextColor;
-        font = self.configuration.indexItemSelectedTextFont;
-    } else {
-        backgroundColor = self.configuration.indexItemBackgroundColor;
-        foregroundColor = self.configuration.indexItemTextColor;
-        font = self.configuration.indexItemTextFont;
-    }
-    
-    [CATransaction begin];
-    [CATransaction setDisableActions:YES];
-    textLayer.backgroundColor = backgroundColor.CGColor;
-    textLayer.foregroundColor = foregroundColor.CGColor;
-    textLayer.itemFont = font;
-    [CATransaction commit];
-}
-
-#pragma mark - UITouch and UIEvent
-
-- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
-{
-    // 当滑动索引视图时,防止其他手指去触发事件
-    if (self.touchingIndexView) return YES;
-    
-    CALayer *firstLayer = self.searchLayer ?: self.subTextLayers.firstObject;
-    if (!firstLayer) return NO;
-    CALayer *lastLayer = self.subTextLayers.lastObject ?: self.searchLayer;
-    if (!lastLayer) return NO;
-    
-    CGFloat space = self.configuration.indexItemRightMargin * 2;
-    if (point.x > self.bounds.size.width - space - self.configuration.indexItemHeight
-        && point.x <= self.bounds.size.width
-        && point.y > CGRectGetMinY(firstLayer.frame) - space
-        && point.y < CGRectGetMaxY(lastLayer.frame) + space) {
-        return YES;
-    }
-    return NO;
-}
-
-- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
-{
-    self.touchingIndexView = YES;
-    CGPoint location = [touch locationInView:self];
-    NSInteger currentPosition = SCPositionOfTextLayerInY(location.y, kSCIndexViewMargin, kSCIndexViewSpace);
-    if (currentPosition < 0 || currentPosition >= (NSInteger)self.dataSource.count) return YES;
-    
-    NSInteger deta = self.searchLayer ? 1 : 0;
-    NSInteger currentSection = currentPosition - deta;
-    self.currentSection = currentSection;
-    [self showIndicator:YES];
-    [self onActionWithDidSelect];
-    if (self.delegate && [self.delegate respondsToSelector:@selector(indexView:didSelectAtSection:)]) {
-        [self.delegate indexView:self didSelectAtSection:self.currentSection];
-    }
-    return YES;
-}
-
-- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
-{
-    self.touchingIndexView = YES;
-    CGPoint location = [touch locationInView:self];
-    NSInteger currentPosition = SCPositionOfTextLayerInY(location.y, kSCIndexViewMargin, kSCIndexViewSpace);
-    
-    if (currentPosition < 0) {
-        currentPosition = 0;
-    } else if (currentPosition >= (NSInteger)self.dataSource.count) {
-        currentPosition = self.dataSource.count - 1;
-    }
-    
-    NSInteger deta = self.searchLayer ? 1 : 0;
-    NSInteger currentSection = currentPosition - deta;
-    if (currentSection == self.currentSection) return YES;
-    
-    self.currentSection = currentSection;
-    [self showIndicator:NO];
-    [self onActionWithDidSelect];
-    if (self.delegate && [self.delegate respondsToSelector:@selector(indexView:didSelectAtSection:)]) {
-        [self.delegate indexView:self didSelectAtSection:self.currentSection];
-    }
-    return YES;
-}
-
-- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
-{
-    self.touchingIndexView = NO;
-    NSInteger oldCurrentPosition = self.currentSection;
-    [self refreshCurrentSection];
-    if (oldCurrentPosition != self.currentSection) {
-        [self showIndicator:NO];
-    }
-    [self hideIndicator:YES];
-}
-
-- (void)cancelTrackingWithEvent:(UIEvent *)event
-{
-    self.touchingIndexView = NO;
-    NSInteger oldCurrentPosition = self.currentSection;
-    [self refreshCurrentSection];
-    if (oldCurrentPosition != self.currentSection) {
-        [self showIndicator:NO];
-    }
-    [self hideIndicator:YES];
-}
-
-#pragma mark - Getters and Setters
-
-- (void)setDataSource:(NSArray<NSString *> *)dataSource
-{
-    if (_dataSource == dataSource) return;
-    
-    _dataSource = dataSource.copy;
-    
-    [self configSubLayersAndSubviews];
-    [self configCurrentSection];
-}
-
-- (void)setCurrentSection:(NSInteger)currentSection
-{
-    if (currentSection == _currentSection) return;
-    if ((currentSection < 0 && currentSection != SCIndexViewSearchSection)
-        || currentSection >= (NSInteger)self.subTextLayers.count) {
-        [self refreshTextLayer:NO];
-        return;
-    }
-    
-    [self refreshTextLayer:NO];
-    _currentSection = currentSection;
-    [self refreshTextLayer:YES];
-}
-
-- (void)setStartSection:(NSUInteger)startSection {
-    if (_startSection == startSection) return;
-    _startSection = startSection;
-    [self configCurrentSection];
-}
-
-- (NSMutableArray *)subTextLayers
-{
-    if (!_subTextLayers) {
-        _subTextLayers = [NSMutableArray array];
-    }
-    return _subTextLayers;
-}
-
-- (UILabel *)indicator
-{
-    if (!_indicator) {
-        _indicator = [UILabel new];
-        _indicator.layer.backgroundColor = self.configuration.indicatorBackgroundColor.CGColor;
-        _indicator.textColor = self.configuration.indicatorTextColor;
-        _indicator.font = self.configuration.indicatorTextFont;
-        _indicator.textAlignment = NSTextAlignmentCenter;
-        _indicator.hidden = YES;
-        
-        switch (self.configuration.indexViewStyle) {
-            case SCIndexViewStyleDefault:
-            {
-                CGFloat indicatorRadius = self.configuration.indicatorHeight / 2;
-                CGFloat sinPI_4_Radius = sin(M_PI_4) * indicatorRadius;
-                _indicator.bounds = CGRectMake(0, 0, (4 * sinPI_4_Radius), 2 * indicatorRadius);
-                
-                CAShapeLayer *maskLayer = [CAShapeLayer layer];
-                maskLayer.path = [self drawIndicatorPath].CGPath;
-                _indicator.layer.mask = maskLayer;
-            }
-                break;
-                
-            case SCIndexViewStyleCenterToast:
-            {
-                _indicator.bounds = CGRectMake(0, 0, self.configuration.indicatorHeight, self.configuration.indicatorHeight);
-                _indicator.center = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2);
-                _indicator.layer.cornerRadius = self.configuration.indicatorCornerRadius;
-            }
-                break;
-                
-            default:
-                break;
-        }
-    }
-    return _indicator;
-}
-
-- (UIImpactFeedbackGenerator *)generator {
-    if (!_generator) {
-        _generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight];
-    }
-    return _generator;
-}
-
-@end

+ 0 - 115
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SCIndexView/SCIndexViewConfiguration.m

@@ -1,115 +0,0 @@
-
-#import "SCIndexViewConfiguration.h"
-
-const NSUInteger SCIndexViewInvalidSection = NSUIntegerMax - 1;
-const NSInteger SCIndexViewSearchSection = -1;
-
-static inline UIColor *SCGetColor(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha)
-{
-    return [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:alpha];
-}
-
-@interface SCIndexViewConfiguration ()
-
-@property (nonatomic, assign) SCIndexViewStyle indexViewStyle;  // 索引元素之间间隔距离
-
-@end
-
-@implementation SCIndexViewConfiguration
-
-@synthesize indexViewStyle = _indexViewStyle;
-
-+ (instancetype)configuration
-{
-    return [self configurationWithIndexViewStyle:SCIndexViewStyleDefault];
-}
-
-+ (instancetype)configurationWithIndexViewStyle:(SCIndexViewStyle)indexViewStyle
-{
-    UIColor *indicatorBackgroundColor, *indicatorTextColor;
-    UIFont *indicatorTextFont;
-    CGFloat indicatorHeight;
-    switch (indexViewStyle) {
-        case SCIndexViewStyleDefault:
-        {
-            indicatorBackgroundColor = SCGetColor(200, 200, 200, 1);
-            indicatorTextColor = [UIColor whiteColor];
-            indicatorTextFont = [UIFont systemFontOfSize:38];
-            indicatorHeight = 50;
-        }
-            break;
-            
-        case SCIndexViewStyleCenterToast:
-        {
-            indicatorBackgroundColor = SCGetColor(200, 200, 200, 0.8);
-            indicatorTextColor = [UIColor whiteColor];
-            indicatorTextFont = [UIFont systemFontOfSize:60];
-            indicatorHeight = 120;
-        }
-            break;
-            
-        default:
-            return nil;
-            break;
-    }
-    
-    return [self configurationWithIndexViewStyle:indexViewStyle
-                        indicatorBackgroundColor:indicatorBackgroundColor
-                              indicatorTextColor:indicatorTextColor
-                               indicatorTextFont:indicatorTextFont
-                                 indicatorHeight:indicatorHeight
-                            indicatorRightMargin:40
-                           indicatorCornerRadius:10
-                        indexItemBackgroundColor:[UIColor clearColor]
-                              indexItemTextColor:[UIColor darkGrayColor]
-                               indexItemTextFont:[UIFont fontWithName:@"Helvetica" size:12]
-                indexItemSelectedBackgroundColor:SCGetColor(40, 170, 40, 1)
-                      indexItemSelectedTextColor:[UIColor whiteColor]
-                       indexItemSelectedTextFont:[UIFont fontWithName:@"Helvetica" size:12]
-                                 indexItemHeight:15
-                            indexItemRightMargin:5
-                                 indexItemsSpace:0];
-}
-
-+ (instancetype)configurationWithIndexViewStyle:(SCIndexViewStyle)indexViewStyle
-                       indicatorBackgroundColor:(UIColor *)indicatorBackgroundColor
-                             indicatorTextColor:(UIColor *)indicatorTextColor
-                              indicatorTextFont:(UIFont *)indicatorTextFont
-                                indicatorHeight:(CGFloat)indicatorHeight
-                           indicatorRightMargin:(CGFloat)indicatorRightMargin
-                          indicatorCornerRadius:(CGFloat)indicatorCornerRadius
-                       indexItemBackgroundColor:(UIColor *)indexItemBackgroundColor
-                             indexItemTextColor:(UIColor *)indexItemTextColor
-                              indexItemTextFont:(UIFont *)indexItemTextFont
-               indexItemSelectedBackgroundColor:(UIColor *)indexItemSelectedBackgroundColor
-                     indexItemSelectedTextColor:(UIColor *)indexItemSelectedTextColor
-                      indexItemSelectedTextFont:(UIFont *)indexItemSelectedTextFont
-                                indexItemHeight:(CGFloat)indexItemHeight
-                           indexItemRightMargin:(CGFloat)indexItemRightMargin
-                                indexItemsSpace:(CGFloat)indexItemsSpace
-{
-    SCIndexViewConfiguration *configuration = [self new];
-    if (!configuration) return nil;
-    
-    configuration.indexViewStyle = indexViewStyle;
-    configuration.indicatorBackgroundColor = indicatorBackgroundColor;
-    configuration.indicatorTextColor = indicatorTextColor;
-    configuration.indicatorTextFont = indicatorTextFont;
-    configuration.indicatorHeight = indicatorHeight;
-    configuration.indicatorRightMargin = indicatorRightMargin;
-    configuration.indicatorCornerRadius = indicatorCornerRadius;
-    
-    configuration.indexItemBackgroundColor = indexItemBackgroundColor;
-    configuration.indexItemTextColor = indexItemTextColor;
-    configuration.indexItemTextFont = indexItemTextFont;
-    configuration.indexItemSelectedBackgroundColor = indexItemSelectedBackgroundColor;
-    configuration.indexItemSelectedTextColor = indexItemSelectedTextColor;
-    configuration.indexItemSelectedTextFont = indexItemSelectedTextFont;
-    configuration.indexItemHeight = indexItemHeight;
-    configuration.indexItemRightMargin = indexItemRightMargin;
-    configuration.indexItemsSpace = indexItemsSpace;
-    
-    return configuration;
-}
-
-@end

+ 0 - 193
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SCIndexView/UITableView+SCIndexView.m

@@ -1,193 +0,0 @@
-
-#import "UITableView+SCIndexView.h"
-#import <objc/runtime.h>
-#import "SCIndexView.h"
-
-@interface SCWeakProxy : NSObject
-@property (nonatomic, weak) id target;
-@end
-@implementation SCWeakProxy
-@end
-
-@interface UITableView () <SCIndexViewDelegate>
-
-@property (nonatomic, strong) SCIndexView *sc_indexView;
-
-@end
-
-@implementation UITableView (SCIndexView)
-
-#pragma mark - Swizzle Method
-
-+ (void)load
-{
-    [self swizzledSelector:@selector(SCIndexView_layoutSubviews) originalSelector:@selector(layoutSubviews)];
-}
-
-+ (void)swizzledSelector:(SEL)swizzledSelector originalSelector:(SEL)originalSelector
-{
-    Class class = [self class];
-    Method originalMethod = class_getInstanceMethod(class, originalSelector);
-    Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
-    BOOL didAddMethod =
-    class_addMethod(class,
-                    originalSelector,
-                    method_getImplementation(swizzledMethod),
-                    method_getTypeEncoding(swizzledMethod));
-    if (didAddMethod) {
-        class_replaceMethod(class,
-                            swizzledSelector,
-                            method_getImplementation(originalMethod),
-                            method_getTypeEncoding(originalMethod));
-    } else {
-        method_exchangeImplementations(originalMethod, swizzledMethod);
-    }
-}
-
-- (void)SCIndexView_layoutSubviews {
-    [self SCIndexView_layoutSubviews];
-    
-    if (!self.sc_indexView) {
-        return;
-    }
-    if (self.superview && !self.sc_indexView.superview) {
-        [self.superview addSubview:self.sc_indexView];
-    }
-    else if (!self.superview && self.sc_indexView.superview) {
-        [self.sc_indexView removeFromSuperview];
-    }
-    if (!CGRectEqualToRect(self.sc_indexView.frame, self.frame)) {
-        self.sc_indexView.frame = self.frame;
-    }
-    [self.sc_indexView refreshCurrentSection];
-}
-
-#pragma mark - SCIndexViewDelegate
-
-- (void)indexView:(SCIndexView *)indexView didSelectAtSection:(NSUInteger)section
-{
-    if (self.sc_indexViewDelegate && [self.delegate respondsToSelector:@selector(tableView:didSelectIndexViewAtSection:)]) {
-        [self.sc_indexViewDelegate tableView:self didSelectIndexViewAtSection:section];
-    }
-}
-
-- (NSUInteger)sectionOfIndexView:(SCIndexView *)indexView tableViewDidScroll:(UITableView *)tableView
-{
-    if (self.sc_indexViewDelegate && [self.delegate respondsToSelector:@selector(sectionOfTableViewDidScroll:)]) {
-        return [self.sc_indexViewDelegate sectionOfTableViewDidScroll:self];
-    } else {
-        return SCIndexViewInvalidSection;
-    }
-}
-
-#pragma mark - Public Methods
-
-- (void)sc_refreshCurrentSectionOfIndexView {
-    [self.sc_indexView refreshCurrentSection];
-}
-
-#pragma mark - Private Methods
-
-- (SCIndexView *)createIndexView {
-    SCIndexView *indexView = [[SCIndexView alloc] initWithTableView:self configuration:self.sc_indexViewConfiguration];
-    indexView.translucentForTableViewInNavigationBar = self.sc_translucentForTableViewInNavigationBar;
-    indexView.startSection = self.sc_startSection;
-    indexView.delegate = self;
-    return indexView;
-}
-
-#pragma mark - Getter and Setter
-
-- (SCIndexView *)sc_indexView
-{
-    return objc_getAssociatedObject(self, @selector(sc_indexView));
-}
-
-- (void)setSc_indexView:(SCIndexView *)sc_indexView
-{
-    if (self.sc_indexView == sc_indexView) return;
-    
-    objc_setAssociatedObject(self, @selector(sc_indexView), sc_indexView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (SCIndexViewConfiguration *)sc_indexViewConfiguration
-{
-    SCIndexViewConfiguration *sc_indexViewConfiguration = objc_getAssociatedObject(self, @selector(sc_indexViewConfiguration));
-    if (!sc_indexViewConfiguration) {
-        sc_indexViewConfiguration = [SCIndexViewConfiguration configuration];
-    }
-    return sc_indexViewConfiguration;
-}
-
-- (void)setSc_indexViewConfiguration:(SCIndexViewConfiguration *)sc_indexViewConfiguration
-{
-    if (self.sc_indexViewConfiguration == sc_indexViewConfiguration) return;
-    
-    objc_setAssociatedObject(self, @selector(sc_indexViewConfiguration), sc_indexViewConfiguration, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (id<SCTableViewSectionIndexDelegate>)sc_indexViewDelegate
-{
-    SCWeakProxy *weakProxy = objc_getAssociatedObject(self, @selector(sc_indexViewDelegate));
-    return weakProxy.target;
-}
-
-- (void)setSc_indexViewDelegate:(id<SCTableViewSectionIndexDelegate>)sc_indexViewDelegate
-{
-    if (self.sc_indexViewDelegate == sc_indexViewDelegate) return;
-    
-    SCWeakProxy *weakProxy = [SCWeakProxy new];
-    weakProxy.target = sc_indexViewDelegate;
-    objc_setAssociatedObject(self, @selector(sc_indexViewDelegate), weakProxy, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (BOOL)sc_translucentForTableViewInNavigationBar
-{
-    NSNumber *number = objc_getAssociatedObject(self, @selector(sc_translucentForTableViewInNavigationBar));
-    return number.boolValue;
-}
-
-- (void)setSc_translucentForTableViewInNavigationBar:(BOOL)sc_translucentForTableViewInNavigationBar
-{
-    if (self.sc_translucentForTableViewInNavigationBar == sc_translucentForTableViewInNavigationBar) return;
-    
-    objc_setAssociatedObject(self, @selector(sc_translucentForTableViewInNavigationBar), @(sc_translucentForTableViewInNavigationBar), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-    self.sc_indexView.translucentForTableViewInNavigationBar = sc_translucentForTableViewInNavigationBar;
-}
-
-- (NSArray<NSString *> *)sc_indexViewDataSource
-{
-    return objc_getAssociatedObject(self, @selector(sc_indexViewDataSource));
-}
-
-- (void)setSc_indexViewDataSource:(NSArray<NSString *> *)sc_indexViewDataSource
-{
-    if (self.sc_indexViewDataSource == sc_indexViewDataSource) return;
-    objc_setAssociatedObject(self, @selector(sc_indexViewDataSource), sc_indexViewDataSource.copy, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-    
-    if (sc_indexViewDataSource.count > 0) {
-        if (!self.sc_indexView) {
-            self.sc_indexView = [self createIndexView];
-            [self.superview addSubview:self.sc_indexView];
-        }
-        self.sc_indexView.dataSource = sc_indexViewDataSource.copy;
-        self.sc_indexView.hidden = NO;
-    }
-    else {
-        self.sc_indexView.hidden = YES;
-    }
-}
-
-- (NSUInteger)sc_startSection {
-    NSNumber *number = objc_getAssociatedObject(self, @selector(sc_startSection));
-    return number.unsignedIntegerValue;
-}
-
-- (void)setSc_startSection:(NSUInteger)sc_startSection {
-    if (self.sc_startSection == sc_startSection) return;
-    
-    objc_setAssociatedObject(self, @selector(sc_startSection), @(sc_startSection), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-    self.sc_indexView.startSection = sc_startSection;
-}
-
-@end

+ 0 - 30
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/PageControl/TAAbstractDotView.m

@@ -1,30 +0,0 @@
-//
-//  TAAbstractDotView.m
-//  TAPageControl
-//
-//  Created by Tanguy Aladenise on 2015-01-22.
-//  Copyright (c) 2015 Tanguy Aladenise. All rights reserved.
-//
-
-#import "TAAbstractDotView.h"
-
-
-@implementation TAAbstractDotView
-
-
-- (id)init
-{
-    @throw [NSException exceptionWithName:NSInternalInconsistencyException
-                                   reason:[NSString stringWithFormat:@"You must override %@ in %@", NSStringFromSelector(_cmd), self.class]
-                                 userInfo:nil];
-}
-
-
-- (void)changeActivityState:(BOOL)active
-{
-    @throw [NSException exceptionWithName:NSInternalInconsistencyException
-                                   reason:[NSString stringWithFormat:@"You must override %@ in %@", NSStringFromSelector(_cmd), self.class]
-                                 userInfo:nil];
-}
-
-@end

+ 0 - 88
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/PageControl/TAAnimatedDotView.m

@@ -1,88 +0,0 @@
-//
-//  TAAnimatedDotView.m
-//  TAPageControl
-//
-//  Created by Tanguy Aladenise on 2015-01-22.
-//  Copyright (c) 2015 Tanguy Aladenise. All rights reserved.
-//
-
-#import "TAAnimatedDotView.h"
-
-static CGFloat const kAnimateDuration = 1;
-
-@implementation TAAnimatedDotView
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        [self initialization];
-    }
-    
-    return self;
-}
-
-
-- (id)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-    if (self) {
-        [self initialization];
-    }
-    return self;
-}
-
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
-    self = [super initWithCoder:aDecoder];
-    if (self) {
-        [self initialization];
-    }
-    
-    return self;
-}
-
-- (void)setDotColor:(UIColor *)dotColor
-{
-    _dotColor = dotColor;
-    self.layer.borderColor  = dotColor.CGColor;
-}
-
-- (void)initialization
-{
-    _dotColor = [UIColor whiteColor];
-    self.backgroundColor    = [UIColor clearColor];
-    self.layer.cornerRadius = CGRectGetWidth(self.frame) / 2;
-    self.layer.borderColor  = [UIColor whiteColor].CGColor;
-    self.layer.borderWidth  = 2;
-}
-
-
-- (void)changeActivityState:(BOOL)active
-{
-    if (active) {
-        [self animateToActiveState];
-    } else {
-        [self animateToDeactiveState];
-    }
-}
-
-
-- (void)animateToActiveState
-{
-    [UIView animateWithDuration:kAnimateDuration delay:0 usingSpringWithDamping:.5 initialSpringVelocity:-20 options:UIViewAnimationOptionCurveLinear animations:^{
-        self.backgroundColor = _dotColor;
-        self.transform = CGAffineTransformMakeScale(1.4, 1.4);
-    } completion:nil];
-}
-
-- (void)animateToDeactiveState
-{
-    [UIView animateWithDuration:kAnimateDuration delay:0 usingSpringWithDamping:.5 initialSpringVelocity:0 options:UIViewAnimationOptionCurveLinear animations:^{
-        self.backgroundColor = [UIColor clearColor];
-        self.transform = CGAffineTransformIdentity;
-    } completion:nil];
-}
-
-@end

+ 0 - 63
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/PageControl/TADotView.m

@@ -1,63 +0,0 @@
-//
-//  TADotView.m
-//  TAPageControl
-//
-//  Created by Tanguy Aladenise on 2015-01-22.
-//  Copyright (c) 2015 Tanguy Aladenise. All rights reserved.
-//
-
-#import "TADotView.h"
-
-@implementation TADotView
-
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        [self initialization];
-    }
-    
-    return self;
-}
-
-
-- (id)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-    if (self) {
-        [self initialization];
-    }
-    return self;
-}
-
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
-    self = [super initWithCoder:aDecoder];
-    if (self) {
-        [self initialization];
-    }
-    
-    return self;
-}
-
-- (void)initialization
-{
-    self.backgroundColor    = [UIColor clearColor];
-    self.layer.cornerRadius = CGRectGetWidth(self.frame) / 2;
-    self.layer.borderColor  = [UIColor whiteColor].CGColor;
-    self.layer.borderWidth  = 2;
-}
-
-
-- (void)changeActivityState:(BOOL)active
-{
-    if (active) {
-        self.backgroundColor = [UIColor whiteColor];
-    } else {
-        self.backgroundColor = [UIColor clearColor];
-    }
-}
-
-@end

+ 0 - 364
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/PageControl/TAPageControl.m

@@ -1,364 +0,0 @@
-//
-//  TAPageControl.m
-//  TAPageControl
-//
-//  Created by Tanguy Aladenise on 2015-01-21.
-//  Copyright (c) 2015 Tanguy Aladenise. All rights reserved.
-//
-
-#import "TAPageControl.h"
-#import "TAAbstractDotView.h"
-#import "TAAnimatedDotView.h"
-#import "TADotView.h"
-
-/**
- *  Default number of pages for initialization
- */
-static NSInteger const kDefaultNumberOfPages = 0;
-
-/**
- *  Default current page for initialization
- */
-static NSInteger const kDefaultCurrentPage = 0;
-
-/**
- *  Default setting for hide for single page feature. For initialization
- */
-static BOOL const kDefaultHideForSinglePage = NO;
-
-/**
- *  Default setting for shouldResizeFromCenter. For initialiation
- */
-static BOOL const kDefaultShouldResizeFromCenter = YES;
-
-/**
- *  Default spacing between dots
- */
-static NSInteger const kDefaultSpacingBetweenDots = 8;
-
-/**
- *  Default dot size
- */
-static CGSize const kDefaultDotSize = {8, 8};
-
-
-@interface TAPageControl()
-
-
-/**
- *  Array of dot views for reusability and touch events.
- */
-@property (strong, nonatomic) NSMutableArray *dots;
-
-
-@end
-
-@implementation TAPageControl
-
-
-#pragma mark - Lifecycle
-
-
-- (id)init
-{
-    self = [super init];
-    if (self) {
-        [self initialization];
-    }
-    
-    return self;
-}
-
-
-- (id)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-    if (self) {
-        [self initialization];
-    }
-    return self;
-}
-
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
-    self = [super initWithCoder:aDecoder];
-    if (self) {
-        [self initialization];
-    }
-    
-    return self;
-}
-
-
-/**
- *  Default setup when initiating control
- */
-- (void)initialization
-{
-    self.dotViewClass           = [TAAnimatedDotView class];
-    self.spacingBetweenDots     = kDefaultSpacingBetweenDots;
-    self.numberOfPages          = kDefaultNumberOfPages;
-    self.currentPage            = kDefaultCurrentPage;
-    self.hidesForSinglePage     = kDefaultHideForSinglePage;
-    self.shouldResizeFromCenter = kDefaultShouldResizeFromCenter;
-}
-
-
-#pragma mark - Touch event
-
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
-{
-    UITouch *touch = [touches anyObject];
-    if (touch.view != self) {
-        NSInteger index = [self.dots indexOfObject:touch.view];
-        if ([self.delegate respondsToSelector:@selector(TAPageControl:didSelectPageAtIndex:)]) {
-            [self.delegate TAPageControl:self didSelectPageAtIndex:index];
-        }
-    }
-}
-
-#pragma mark - Layout
-
-
-/**
- *  Resizes and moves the receiver view so it just encloses its subviews.
- */
-- (void)sizeToFit
-{
-    [self updateFrame:YES];
-}
-
-
-- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount
-{
-    return CGSizeMake((self.dotSize.width + self.spacingBetweenDots) * pageCount - self.spacingBetweenDots , self.dotSize.height);
-}
-
-
-/**
- *  Will update dots display and frame. Reuse existing views or instantiate one if required. Update their position in case frame changed.
- */
-- (void)updateDots
-{
-    if (self.numberOfPages == 0) {
-        return;
-    }
-    
-    for (NSInteger i = 0; i < self.numberOfPages; i++) {
-        
-        UIView *dot;
-        if (i < self.dots.count) {
-            dot = [self.dots objectAtIndex:i];
-        } else {
-            dot = [self generateDotView];
-        }
-        
-        [self updateDotFrame:dot atIndex:i];
-    }
-    
-    [self changeActivity:YES atIndex:self.currentPage];
-    
-    [self hideForSinglePage];
-}
-
-
-/**
- *  Update frame control to fit current number of pages. It will apply required size if authorize and required.
- *
- *  @param overrideExistingFrame BOOL to allow frame to be overriden. Meaning the required size will be apply no mattter what.
- */
-- (void)updateFrame:(BOOL)overrideExistingFrame
-{
-    CGPoint center = self.center;
-    CGSize requiredSize = [self sizeForNumberOfPages:self.numberOfPages];
-    
-    // We apply requiredSize only if authorize to and necessary
-    if (overrideExistingFrame || ((CGRectGetWidth(self.frame) < requiredSize.width || CGRectGetHeight(self.frame) < requiredSize.height) && !overrideExistingFrame)) {
-        self.frame = CGRectMake(CGRectGetMinX(self.frame), CGRectGetMinY(self.frame), requiredSize.width, requiredSize.height);
-        if (self.shouldResizeFromCenter) {
-            self.center = center;
-        }
-    }
-    
-    [self resetDotViews];
-}
-
-
-/**
- *  Update the frame of a specific dot at a specific index
- *
- *  @param dot   Dot view
- *  @param index Page index of dot
- */
-- (void)updateDotFrame:(UIView *)dot atIndex:(NSInteger)index
-{
-    // Dots are always centered within view
-    CGFloat x = (self.dotSize.width + self.spacingBetweenDots) * index + ( (CGRectGetWidth(self.frame) - [self sizeForNumberOfPages:self.numberOfPages].width) / 2);
-    CGFloat y = (CGRectGetHeight(self.frame) - self.dotSize.height) / 2;
-    
-    dot.frame = CGRectMake(x, y, self.dotSize.width, self.dotSize.height);
-}
-
-
-#pragma mark - Utils
-
-
-/**
- *  Generate a dot view and add it to the collection
- *
- *  @return The UIView object representing a dot
- */
-- (UIView *)generateDotView
-{
-    UIView *dotView;
-    
-    if (self.dotViewClass) {
-        dotView = [[self.dotViewClass alloc] initWithFrame:CGRectMake(0, 0, self.dotSize.width, self.dotSize.height)];
-        if ([dotView isKindOfClass:[TAAnimatedDotView class]] && self.dotColor) {
-            ((TAAnimatedDotView *)dotView).dotColor = self.dotColor;
-        }
-    } else {
-        dotView = [[UIImageView alloc] initWithImage:self.dotImage];
-        dotView.frame = CGRectMake(0, 0, self.dotSize.width, self.dotSize.height);
-    }
-    
-    if (dotView) {
-        [self addSubview:dotView];
-        [self.dots addObject:dotView];
-    }
-    
-    dotView.userInteractionEnabled = YES;    
-    return dotView;
-}
-
-
-/**
- *  Change activity state of a dot view. Current/not currrent.
- *
- *  @param active Active state to apply
- *  @param index  Index of dot for state update
- */
-- (void)changeActivity:(BOOL)active atIndex:(NSInteger)index
-{
-    if (self.dotViewClass) {
-        TAAbstractDotView *abstractDotView = (TAAbstractDotView *)[self.dots objectAtIndex:index];
-        if ([abstractDotView respondsToSelector:@selector(changeActivityState:)]) {
-            [abstractDotView changeActivityState:active];
-        } else {
-            NSLog(@"Custom view : %@ must implement an 'changeActivityState' method or you can subclass %@ to help you.", self.dotViewClass, [TAAbstractDotView class]);
-        }
-    } else if (self.dotImage && self.currentDotImage) {
-        UIImageView *dotView = (UIImageView *)[self.dots objectAtIndex:index];
-        dotView.image = (active) ? self.currentDotImage : self.dotImage;
-    }
-}
-
-
-- (void)resetDotViews
-{
-    for (UIView *dotView in self.dots) {
-        [dotView removeFromSuperview];
-    }
-    
-    [self.dots removeAllObjects];
-    [self updateDots];
-}
-
-
-- (void)hideForSinglePage
-{
-    if (self.dots.count == 1 && self.hidesForSinglePage) {
-        self.hidden = YES;
-    } else {
-        self.hidden = NO;
-    }
-}
-
-#pragma mark - Setters
-
-
-- (void)setNumberOfPages:(NSInteger)numberOfPages
-{
-    _numberOfPages = numberOfPages;
-    
-    // Update dot position to fit new number of pages
-    [self resetDotViews];
-}
-
-
-- (void)setSpacingBetweenDots:(NSInteger)spacingBetweenDots
-{
-    _spacingBetweenDots = spacingBetweenDots;
-    
-    [self resetDotViews];
-}
-
-
-- (void)setCurrentPage:(NSInteger)currentPage
-{
-    // If no pages, no current page to treat.
-    if (self.numberOfPages == 0 || currentPage == _currentPage) {
-        _currentPage = currentPage;
-        return;
-    }
-    
-    // Pre set
-    [self changeActivity:NO atIndex:_currentPage];
-    _currentPage = currentPage;
-    // Post set
-    [self changeActivity:YES atIndex:_currentPage];
-}
-
-
-- (void)setDotImage:(UIImage *)dotImage
-{
-    _dotImage = dotImage;
-    [self resetDotViews];
-    self.dotViewClass = nil;
-}
-
-
-- (void)setCurrentDotImage:(UIImage *)currentDotimage
-{
-    _currentDotImage = currentDotimage;
-    [self resetDotViews];
-    self.dotViewClass = nil;
-}
-
-
-- (void)setDotViewClass:(Class)dotViewClass
-{
-    _dotViewClass = dotViewClass;
-    self.dotSize = CGSizeZero;
-    [self resetDotViews];
-}
-
-
-#pragma mark - Getters
-
-
-- (NSMutableArray *)dots
-{
-    if (!_dots) {
-        _dots = [[NSMutableArray alloc] init];
-    }
-    
-    return _dots;
-}
-
-
-- (CGSize)dotSize
-{
-    // Dot size logic depending on the source of the dot view
-    if (self.dotImage && CGSizeEqualToSize(_dotSize, CGSizeZero)) {
-        _dotSize = self.dotImage.size;
-    } else if (self.dotViewClass && CGSizeEqualToSize(_dotSize, CGSizeZero)) {
-        _dotSize = kDefaultDotSize;
-        return _dotSize;
-    }
-    
-    return _dotSize;
-}
-
-@end

+ 0 - 30
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/QWdynamicModel.h

@@ -1,30 +0,0 @@
-//
-//  QWdynamicModel.h
-//  Shopping
-//
-//  Created by 小威 on 16/4/18.
-//  Copyright © 2018年 李翔. All rights reserved.
-//
-
-#import "KSBaseModel.h"
-
-@interface QWdynamicModel : KSBaseModel
-@property (nonatomic, copy) NSString *article_logo;
-@property (nonatomic, copy) NSString *content;
-@property (nonatomic, copy) NSString *code;
-@property (nonatomic, copy) NSString *link;
-@property (nonatomic, copy) NSString *article_id;
-@property (nonatomic, copy) NSString *sort_order;
-@property (nonatomic, copy) NSString *store_id;
-@property (nonatomic, copy) NSString *if_show;
-@property (nonatomic, copy) NSString *add_time;
-
-@property (nonatomic, copy) NSString *cate_logo;
-@property (nonatomic, copy) NSString *name;
-@property (nonatomic, copy) NSString *title;
-
-@property (nonatomic, copy) NSString *ad;
-@property (nonatomic, copy) NSString *ad_url;
-@property (nonatomic, copy) NSString *url;
-
-@end

+ 0 - 13
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/QWdynamicModel.m

@@ -1,13 +0,0 @@
-//
-//  QWdynamicModel.m
-//  Shopping
-//
-//  Created by 小威 on 16/4/18.
-//  Copyright © 2018年 李翔. All rights reserved.
-//
-
-#import "QWdynamicModel.h"
-
-@implementation QWdynamicModel
-
-@end

+ 0 - 128
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/SDCollectionViewCell.m

@@ -1,128 +0,0 @@
-//
-//  SDCollectionViewCell.m
-//  SDCycleScrollView
-//
-//  Created by aier on 15-3-22.
-//  Copyright (c) 2015年 GSD. All rights reserved.
-//
-
-
-/*
- 
- *********************************************************************************
- *
- * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟
- *
- * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并
- * 帮您解决问题。
- * 新浪微博:GSD_iOS
- * Email : gsdios@126.com
- * GitHub: https://github.com/gsdios
- *
- * 另(我的自动布局库SDAutoLayout):
- *  一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于
- *  做最简单易用的AutoLayout库。
- * 视频教程:http://www.letv.com/ptv/vplay/24038772.html
- * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md
- * GitHub:https://github.com/gsdios/SDAutoLayout
- *********************************************************************************
- 
- */
-
-
-#import "SDCollectionViewCell.h"
-#import "UIView+SDExtension.h"
-
-@implementation SDCollectionViewCell
-{
-    __weak UILabel *_titleLabel;
-}
-
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    if (self = [super initWithFrame:frame]) {
-        [self setupImageView];
-        [self setupTitleLabel];
-         [self setupMaskView];//自定义View
-    }
-    
-    return self;
-}
-
-- (void)setupMaskView
-{
-    SDQWMaskCustomView *customMask = [SDQWMaskCustomView item];
-//    customMask.backgroundColor = [UIColor whiteColor];
-    _mkjBannerMask = customMask;
-    [self.contentView addSubview:customMask];
-}
-
-- (void)setTitleLabelBackgroundColor:(UIColor *)titleLabelBackgroundColor
-{
-    _titleLabelBackgroundColor = titleLabelBackgroundColor;
-    _titleLabel.backgroundColor = titleLabelBackgroundColor;
-}
-
-- (void)setTitleLabelTextColor:(UIColor *)titleLabelTextColor
-{
-    _titleLabelTextColor = titleLabelTextColor;
-    _titleLabel.textColor = titleLabelTextColor;
-}
-
-- (void)setTitleLabelTextFont:(UIFont *)titleLabelTextFont
-{
-    _titleLabelTextFont = titleLabelTextFont;
-    _titleLabel.font = titleLabelTextFont;
-}
-
-- (void)setupImageView
-{
-    UIImageView *imageView = [[UIImageView alloc] init];
-    _imageView = imageView;
-    [self.contentView addSubview:imageView];
-}
-
-- (void)setupTitleLabel
-{
-    UILabel *titleLabel = [[UILabel alloc] init];
-    _titleLabel = titleLabel;
-    _titleLabel.hidden = YES;
-    [self.contentView addSubview:titleLabel];
-}
-
-- (void)setTitle:(NSString *)title
-{
-    _title = [title copy];
-    _titleLabel.text = [NSString stringWithFormat:@"   %@", title];
-    if (_titleLabel.hidden) {
-        _titleLabel.hidden = NO;
-    }
-}
-
-
-- (void)layoutSubviews
-{
-    [super layoutSubviews];
-    
-    if (self.onlyDisplayText) {
-        _titleLabel.frame = self.bounds;
-    } else {
-        if (!self.zoomType) {
-            _imageView.frame = self.bounds;
-        }
-        CGFloat titleLabelW = self.sd_width;
-        CGFloat titleLabelH = _titleLabelHeight;
-        CGFloat titleLabelX = 0;
-        CGFloat titleLabelY = self.sd_height - titleLabelH;
-        _titleLabel.frame = CGRectMake(titleLabelX, titleLabelY, titleLabelW, titleLabelH);
-    }
-    if (self.isShow) {
-        _mkjBannerMask.hidden = NO;
-        _mkjBannerMask.frame = self.bounds;
-    }else{
-        _mkjBannerMask.hidden = YES;
-    }
-}
-
-@end

+ 0 - 811
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/SDCycleScrollView.m

@@ -1,811 +0,0 @@
-//
-//  SDCycleScrollView.m
-//  SDCycleScrollView
-//
-//  Created by aier on 15-3-22.
-//  Copyright (c) 2015年 GSD. All rights reserved.
-//
-
-/*
- 
- *********************************************************************************
- *
- * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟
- *
- * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并
- * 帮您解决问题。
- * 新浪微博:GSD_iOS
- * Email : gsdios@126.com
- * GitHub: https://github.com/gsdios
- *
- * 另(我的自动布局库SDAutoLayout):
- *  一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于
- *  做最简单易用的AutoLayout库。
- * 视频教程:http://www.letv.com/ptv/vplay/24038772.html
- * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md
- * GitHub:https://github.com/gsdios/SDAutoLayout
- *********************************************************************************
- 
- */
-
-
-#import "SDCycleScrollView.h"
-#import "SDCollectionViewCell.h"
-#import "UIView+SDExtension.h"
-#import "TAPageControl.h"
-#import "UIImageView+WebCache.h"
-#import "SDCycleScrollView.h"
-#import "SDCollectionViewCell.h"
-#import "UIView+SDExtension.h"
-#import "TAPageControl.h"
-#import "UIImageView+WebCache.h"
-#import "SDImageCache.h"
-
-#define kCycleScrollViewInitialPageControlDotSize CGSizeMake(10, 10)
-
-NSString * const ID = @"cycleCell";
-
-typedef NS_ENUM(NSInteger, DragDirection) {
-    DragDirectionNone,
-    DragDirectionLeft,
-    DragDirectionRight,
-};
-
-@interface SDCycleScrollView () <UICollectionViewDataSource, UICollectionViewDelegate>
-
-
-@property (nonatomic, weak) UICollectionView *mainView; // 显示图片的collectionView
-@property (nonatomic, weak) UICollectionViewFlowLayout *flowLayout;
-@property (nonatomic, strong) NSArray *imagePathsGroup;
-@property (nonatomic, weak) NSTimer *timer;
-@property (nonatomic, assign) NSInteger totalItemsCount;
-@property (nonatomic, weak) UIControl *pageControl;
-
-@property (nonatomic, strong) UIImageView *backgroundImageView; // 当imageURLs为空时的背景图
-
-@property (assign, nonatomic) CGFloat contentOffsetX;  // collectionView偏移量
-@property (assign, nonatomic) DragDirection dragDirection;  // 拖动方向
-@property (assign, nonatomic) BOOL isDragging;  // 是否处于被拖动状态
-
-@end
-
-@implementation SDCycleScrollView
-
-//- (instancetype)initWithFrame:(CGRect)frame
-//{
-//    if (self = [super initWithFrame:frame]) {
-//        [self initialization];
-//        [self setupMainView];
-//    }
-//    return self;
-//}
-//
-//- (void)awakeFromNib
-//{
-//    [super awakeFromNib];
-//    [self initialization];
-//    [self setupMainView];
-//}
-
-/**
- Custome Change
- */
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    if (self = [super initWithFrame:frame]) {
-        _scrollEnabled = YES;
-        [self initialization];
-        [self setupMainView];
-    }
-    return self;
-}
-
-- (void)awakeFromNib
-{
-    [super awakeFromNib];
-    _scrollEnabled = YES;
-    [self initialization];
-    [self setupMainView];
-}
-
-
-- (void)initialization
-{
-    _pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
-    _autoScrollTimeInterval = 2.0;
-    _titleLabelTextColor = [UIColor whiteColor];
-    _titleLabelTextFont= [UIFont systemFontOfSize:14];
-    _titleLabelBackgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
-    _titleLabelHeight = 30;
-    _autoScroll = YES;
-    _infiniteLoop = YES;
-    _showPageControl = YES;
-    _pageControlDotSize = kCycleScrollViewInitialPageControlDotSize;
-    _pageControlBottomOffset = 0;
-    _pageControlRightOffset = 0;
-    _pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
-    _hidesForSinglePage = YES;
-    _currentPageDotColor = [UIColor whiteColor];
-    _pageDotColor = [UIColor lightGrayColor];
-    _bannerImageViewContentMode = UIViewContentModeScaleToFill;
-    
-    self.backgroundColor = [UIColor clearColor];
-    self.contentOffsetX = 0;
-}
-
-+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame imageNamesGroup:(NSArray *)imageNamesGroup
-{
-    SDCycleScrollView *cycleScrollView = [[self alloc] initWithFrame:frame];
-    cycleScrollView.localizationImageNamesGroup = [NSMutableArray arrayWithArray:imageNamesGroup];
-    return cycleScrollView;
-}
-
-+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame shouldInfiniteLoop:(BOOL)infiniteLoop imageNamesGroup:(NSArray *)imageNamesGroup
-{
-    SDCycleScrollView *cycleScrollView = [[self alloc] initWithFrame:frame];
-    cycleScrollView.infiniteLoop = infiniteLoop;
-    cycleScrollView.localizationImageNamesGroup = [NSMutableArray arrayWithArray:imageNamesGroup];
-    return cycleScrollView;
-}
-
-+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame imageURLStringsGroup:(NSArray *)imageURLsGroup
-{
-    SDCycleScrollView *cycleScrollView = [[self alloc] initWithFrame:frame];
-    cycleScrollView.imageURLStringsGroup = [NSMutableArray arrayWithArray:imageURLsGroup];
-    return cycleScrollView;
-}
-
-+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame delegate:(id<SDCycleScrollViewDelegate>)delegate placeholderImage:(UIImage *)placeholderImage
-{
-    SDCycleScrollView *cycleScrollView = [[self alloc] initWithFrame:frame];
-    cycleScrollView.delegate = delegate;
-    cycleScrollView.placeholderImage = placeholderImage;
-    
-    return cycleScrollView;
-}
-
-// 设置显示图片的collectionView
-- (void)setupMainView
-{
-    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
-    flowLayout.minimumLineSpacing = 0;
-    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
-    _flowLayout = flowLayout;
-    
-    UICollectionView *mainView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:flowLayout];
-    mainView.backgroundColor = [UIColor clearColor];
-    mainView.pagingEnabled = YES;
-    mainView.showsHorizontalScrollIndicator = NO;
-    mainView.showsVerticalScrollIndicator = NO;
-    [mainView registerClass:[SDCollectionViewCell class] forCellWithReuseIdentifier:ID];
-    mainView.dataSource = self;
-    mainView.delegate = self;
-    mainView.scrollsToTop = NO;
-    [self addSubview:mainView];
-    _mainView = mainView;
-}
-
-
-#pragma mark - properties
-
-- (void)setPlaceholderImage:(UIImage *)placeholderImage
-{
-    _placeholderImage = placeholderImage;
-    
-    if (!self.backgroundImageView) {
-        UIImageView *bgImageView = [UIImageView new];
-        bgImageView.contentMode = UIViewContentModeScaleAspectFit;
-        [self insertSubview:bgImageView belowSubview:self.mainView];
-        self.backgroundImageView = bgImageView;
-    }
-    
-    self.backgroundImageView.image = placeholderImage;
-}
-
-- (void)setPageControlDotSize:(CGSize)pageControlDotSize
-{
-    _pageControlDotSize = pageControlDotSize;
-    [self setupPageControl];
-    if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
-        TAPageControl *pageContol = (TAPageControl *)_pageControl;
-        pageContol.dotSize = pageControlDotSize;
-        pageContol.contentMode = UIViewContentModeScaleAspectFit;
-    }
-}
-
-- (void)setShowPageControl:(BOOL)showPageControl
-{
-    _showPageControl = showPageControl;
-    
-    _pageControl.hidden = !showPageControl;
-}
-
-- (void)setCurrentPageDotColor:(UIColor *)currentPageDotColor
-{
-    _currentPageDotColor = currentPageDotColor;
-    if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
-        TAPageControl *pageControl = (TAPageControl *)_pageControl;
-        pageControl.dotColor = currentPageDotColor;
-    } else {
-        UIPageControl *pageControl = (UIPageControl *)_pageControl;
-        pageControl.currentPageIndicatorTintColor = currentPageDotColor;
-    }
-    
-}
-
-- (void)setPageDotColor:(UIColor *)pageDotColor
-{
-    _pageDotColor = pageDotColor;
-    
-    if ([self.pageControl isKindOfClass:[UIPageControl class]]) {
-        UIPageControl *pageControl = (UIPageControl *)_pageControl;
-        pageControl.pageIndicatorTintColor = pageDotColor;
-    }
-}
-
-- (void)setCurrentPageDotImage:(UIImage *)currentPageDotImage
-{
-    _currentPageDotImage = currentPageDotImage;
-    
-    if (self.pageControlStyle != SDCycleScrollViewPageContolStyleAnimated) {
-        self.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
-    }
-    
-    [self setCustomPageControlDotImage:currentPageDotImage isCurrentPageDot:YES];
-}
-
-- (void)setPageDotImage:(UIImage *)pageDotImage
-{
-    _pageDotImage = pageDotImage;
-    
-    if (self.pageControlStyle != SDCycleScrollViewPageContolStyleAnimated) {
-        self.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
-    }
-    
-    [self setCustomPageControlDotImage:pageDotImage isCurrentPageDot:NO];
-}
-
-- (void)setCustomPageControlDotImage:(UIImage *)image isCurrentPageDot:(BOOL)isCurrentPageDot
-{
-    if (!image || !self.pageControl) return;
-    
-    if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
-        TAPageControl *pageControl = (TAPageControl *)_pageControl;
-           pageControl.contentMode = UIViewContentModeScaleAspectFit;
-        if (isCurrentPageDot) {
-            pageControl.currentDotImage = image;
-          
-        } else {
-            pageControl.dotImage = image;
-        }
-    }
-}
-
-- (void)setInfiniteLoop:(BOOL)infiniteLoop
-{
-    _infiniteLoop = infiniteLoop;
-    
-    if (self.imagePathsGroup.count) {
-        self.imagePathsGroup = self.imagePathsGroup;
-    }
-}
-
--(void)setAutoScroll:(BOOL)autoScroll{
-    _autoScroll = autoScroll;
-    
-    [self invalidateTimer];
-    
-    if (_autoScroll) {
-        [self setupTimer];
-    }
-}
-
-- (void)setScrollDirection:(UICollectionViewScrollDirection)scrollDirection
-{
-    _scrollDirection = scrollDirection;
-    
-    _flowLayout.scrollDirection = scrollDirection;
-}
-
-- (void)setAutoScrollTimeInterval:(CGFloat)autoScrollTimeInterval
-{
-    _autoScrollTimeInterval = autoScrollTimeInterval;
-    
-    [self setAutoScroll:self.autoScroll];
-}
-
-- (void)setPageControlStyle:(SDCycleScrollViewPageContolStyle)pageControlStyle
-{
-    _pageControlStyle = pageControlStyle;
-    
-    [self setupPageControl];
-}
-
-- (void)setImagePathsGroup:(NSArray *)imagePathsGroup
-{
-    [self invalidateTimer];
-    
-    _imagePathsGroup = imagePathsGroup;
-    
-    _totalItemsCount = self.infiniteLoop ? self.imagePathsGroup.count * 100 : self.imagePathsGroup.count;
-    
-//    if (imagePathsGroup.count != 1) {
-//        self.mainView.scrollEnabled = YES;
-//        [self setAutoScroll:self.autoScroll];
-//    } else {
-//        self.mainView.scrollEnabled = NO;
-//    }
-    
-/**
- Custome Change
- */
-    if (imagePathsGroup.count != 1) {
-        self.mainView.scrollEnabled = self.scrollEnabled;
-        [self setAutoScroll:self.autoScroll];
-    } else {
-        self.mainView.scrollEnabled = NO;
-    }
-    
-    [self setupPageControl];
-    [self.mainView reloadData];
-}
-
-- (void)setImageURLStringsGroup:(NSArray *)imageURLStringsGroup
-{
-    _imageURLStringsGroup = imageURLStringsGroup;
-    
-    NSMutableArray *temp = [NSMutableArray new];
-    [_imageURLStringsGroup enumerateObjectsUsingBlock:^(NSString * obj, NSUInteger idx, BOOL * stop) {
-        NSString *urlString;
-        if ([obj isKindOfClass:[NSString class]]) {
-            urlString = obj;
-        } else if ([obj isKindOfClass:[NSURL class]]) {
-            NSURL *url = (NSURL *)obj;
-            urlString = [url absoluteString];
-        }
-        if (urlString) {
-            [temp addObject:urlString];
-        }
-    }];
-    self.imagePathsGroup = [temp copy];
-}
-
-- (void)setLocalizationImageNamesGroup:(NSArray *)localizationImageNamesGroup
-{
-    _localizationImageNamesGroup = localizationImageNamesGroup;
-    self.imagePathsGroup = [localizationImageNamesGroup copy];
-}
-
-- (void)setTitlesGroup:(NSArray *)titlesGroup
-{
-    _titlesGroup = titlesGroup;
-    if (self.onlyDisplayText) {
-        NSMutableArray *temp = [NSMutableArray new];
-        for (int i = 0; i < _titlesGroup.count; i++) {
-            [temp addObject:@""];
-        }
-        self.backgroundColor = [UIColor clearColor];
-        self.imageURLStringsGroup = [temp copy];
-    }
-}
-
--(void)setModelArray:(NSArray *)modelArray{
-    _modelArray = modelArray;
-//    NSMutableArray *temp = [NSMutableArray new];
-     self.imagePathsGroup = modelArray;
-}
-
-#pragma mark - actions
-
-- (void)setupTimer
-{
-    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:self.autoScrollTimeInterval target:self selector:@selector(automaticScroll) userInfo:nil repeats:YES];
-    _timer = timer;
-    [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
-}
-
-- (void)invalidateTimer
-{
-    [_timer invalidate];
-    _timer = nil;
-}
-
-- (void)setupPageControl
-{
-    if (_pageControl) [_pageControl removeFromSuperview]; // 重新加载数据时调整
-    
-    if (self.imagePathsGroup.count == 0 || self.onlyDisplayText) return;
-    
-    if ((self.imagePathsGroup.count == 1) && self.hidesForSinglePage) return;
-    
-    int indexOnPageControl = [self pageControlIndexWithCurrentCellIndex:[self currentIndex]];
-    
-    switch (self.pageControlStyle) {
-        case SDCycleScrollViewPageContolStyleAnimated:
-        {
-            TAPageControl *pageControl = [[TAPageControl alloc] init];
-            pageControl.numberOfPages = self.imagePathsGroup.count;
-            pageControl.dotColor = self.currentPageDotColor;
-            pageControl.userInteractionEnabled = NO;
-            pageControl.currentPage = indexOnPageControl;
-            [self addSubview:pageControl];
-            _pageControl = pageControl;
-        }
-            break;
-            
-        case SDCycleScrollViewPageContolStyleClassic:
-        {
-            UIPageControl *pageControl = [[UIPageControl alloc] init];
-            pageControl.numberOfPages = self.imagePathsGroup.count;
-            pageControl.currentPageIndicatorTintColor = self.currentPageDotColor;
-            pageControl.pageIndicatorTintColor = self.pageDotColor;
-            pageControl.userInteractionEnabled = NO;
-            pageControl.currentPage = indexOnPageControl;
-            [self addSubview:pageControl];
-            _pageControl = pageControl;
-        }
-            break;
-            
-        default:
-            break;
-    }
-    
-    // 重设pagecontroldot图片
-    if (self.currentPageDotImage) {
-        self.currentPageDotImage = self.currentPageDotImage;
-    }
-    if (self.pageDotImage) {
-        self.pageDotImage = self.pageDotImage;
-    }
-}
-
-
-- (void)automaticScroll
-{
-    if (0 == _totalItemsCount) return;
-    int currentIndex = [self currentIndex];
-    int targetIndex = currentIndex + 1;
-    [self scrollToIndex:targetIndex];
-    
-    if ([self.delegate respondsToSelector:@selector(cycleScrollView:didScrollToIndex:)]) {
-        [self.delegate cycleScrollView:self didScrollToIndex:targetIndex];
-    } else if (self.itemDidScrollOperationBlock) {
-        self.itemDidScrollOperationBlock(targetIndex);
-    }
-}
-
-- (void)scrollToIndex:(int)targetIndex
-{
-    if (targetIndex >= _totalItemsCount) {
-        if (self.infiniteLoop) {
-            targetIndex = _totalItemsCount * 0.5;
-            [_mainView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
-        }
-        return;
-    }
-    [_mainView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:YES];
-}
-
-- (int)currentIndex
-{
-    if (_mainView.sd_width == 0 || _mainView.sd_height == 0) {
-        return 0;
-    }
-    
-    int index = 0;
-    if (_flowLayout.scrollDirection == UICollectionViewScrollDirectionHorizontal) {
-        index = (_mainView.contentOffset.x + _flowLayout.itemSize.width * 0.5) / _flowLayout.itemSize.width;
-        float interval;
-        if (self.dragDirection == DragDirectionNone) {
-            interval = _flowLayout.itemSize.width * 0.5;
-        } else if (self.dragDirection == DragDirectionLeft) {
-            interval = _flowLayout.itemSize.width * 0.8;
-        } else {
-            interval = _flowLayout.itemSize.width * 0.2;
-        }
-    } else {
-        index = (_mainView.contentOffset.y + _flowLayout.itemSize.height * 0.5) / _flowLayout.itemSize.height;
-    }
-    return MAX(0, index);
-}
-
-- (int)pageControlIndexWithCurrentCellIndex:(NSInteger)index
-{
-    return (int)index % self.imagePathsGroup.count;
-}
-
-- (void)clearCache
-{
-    [[self class] clearImagesCache];
-}
-
-+ (void)clearImagesCache
-{
-    [[[SDWebImageManager sharedManager] imageCache] clearWithCacheType:SDImageCacheTypeDisk completion:^{
-        
-    }];
-    
-}
-
-#pragma mark - life circles
-
-- (void)layoutSubviews
-{
-    [super layoutSubviews];
-    if (!self.zoomType) {
-        _flowLayout.itemSize = self.frame.size;
-    }
-    else {
-        _flowLayout.itemSize = CGSizeMake(MaxWidth, MaxHeight);
-    }
-    
-    
-    _mainView.frame = self.bounds;
-    if (_mainView.contentOffset.x == 0 &&  _totalItemsCount) {
-        int targetIndex = 0;
-        if (self.infiniteLoop) {
-            targetIndex = _totalItemsCount * 0.5;
-        }else{
-            targetIndex = 0;
-        }
-        [_mainView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
-    }
-    
-    CGSize size = CGSizeZero;
-    if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
-        TAPageControl *pageControl = (TAPageControl *)_pageControl;
-        if (!(self.pageDotImage && self.currentPageDotImage && CGSizeEqualToSize(kCycleScrollViewInitialPageControlDotSize, self.pageControlDotSize))) {
-            pageControl.dotSize = self.pageControlDotSize;
-        }
-        size = [pageControl sizeForNumberOfPages:self.imagePathsGroup.count];
-    } else {
-        size = CGSizeMake(self.imagePathsGroup.count * self.pageControlDotSize.width * 1.5, self.pageControlDotSize.height);
-    }
-    CGFloat x = (self.sd_width - size.width) * 0.5;
-    if (self.pageControlAliment == SDCycleScrollViewPageContolAlimentRight) {
-        x = self.mainView.sd_width - size.width - 10;
-    }
-    
-    CGFloat y = self.mainView.sd_height - size.height - 10;
-    
-    if (self.pageControlAliment == SDCycleScrollViewPageContolAlimentCenterQW) {
-        y = self.mainView.sd_height - size.height - 10 -3-27;
-    }
-    
-    if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
-        TAPageControl *pageControl = (TAPageControl *)_pageControl;
-        [pageControl sizeToFit];
-    }
-    
-    CGRect pageControlFrame = CGRectMake(x, y, size.width, size.height);
-    pageControlFrame.origin.y -= self.pageControlBottomOffset;
-    pageControlFrame.origin.x -= self.pageControlRightOffset;
-    self.pageControl.frame = pageControlFrame;
-    self.pageControl.hidden = !_showPageControl;
-    
-    if (self.backgroundImageView) {
-        self.backgroundImageView.frame = self.bounds;
-    }
-    
-}
-
-//解决当父View释放时,当前视图因为被Timer强引用而不能释放的问题
-- (void)willMoveToSuperview:(UIView *)newSuperview
-{
-    if (!newSuperview) {
-        [self invalidateTimer];
-    }
-}
-
-//解决当timer释放后 回调scrollViewDidScroll时访问野指针导致崩溃
-- (void)dealloc {
-    _mainView.delegate = nil;
-    _mainView.dataSource = nil;
-}
-
-#pragma mark - public actions
-
-- (void)adjustWhenControllerViewWillAppera
-{
-    long targetIndex = [self currentIndex];
-    if (targetIndex < _totalItemsCount) {
-        [_mainView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
-    }
-}
-
-
-#pragma mark - UICollectionViewDataSource
-
-- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
-{
-    return _totalItemsCount;
-}
-
-//-(void)setNeedMask:(BOOL)needMask{
-//    _needMask = needMask;
-//    [self.mainView reloadData];
-//}
-
-#pragma mark 在collectionCell上添加自定义View
-- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    SDCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
-    long itemIndex = [self pageControlIndexWithCurrentCellIndex:indexPath.item];
-    
-    if (self.needMask) {
-        cell.isShow = self.needMask;
-//        if (((NSArray *)self.modelArray[itemIndex]).count && [self.modelArray[itemIndex] isKindOfClass:[NSArray class]]&& self.modelArray.count) {
-//            cell.mkjBannerMask.SDArray = self.modelArray[itemIndex];
-//        }
-        if (self.modelArray.count) {
-            cell.mkjBannerMask.SDArray = self.modelArray[itemIndex];
-        }
-        
-    }else{
-        NSString *imagePath = self.imagePathsGroup[itemIndex];
-        
-        if (!self.onlyDisplayText && [imagePath isKindOfClass:[NSString class]]) {
-            if ([imagePath hasPrefix:@"http"]||[imagePath hasPrefix:@"https"]) {
-                [cell.imageView sd_setImageWithURL:[NSURL URLWithString:imagePath] placeholderImage:[UIImage imageNamed:@"icon111"]];
-            } else {
-                UIImage *image = [UIImage imageNamed:imagePath];
-                if (!image) {
-                    [UIImage imageWithContentsOfFile:imagePath];
-                }
-                cell.imageView.image = image;
-            }
-        } else if (!self.onlyDisplayText && [imagePath isKindOfClass:[UIImage class]]) {
-            cell.imageView.image = (UIImage *)imagePath;
-        }
-        
-        if (_titlesGroup.count && itemIndex < _titlesGroup.count) {
-            cell.title = _titlesGroup[itemIndex];
-        }
-        
-        if (!cell.hasConfigured) {
-            cell.titleLabelBackgroundColor = self.titleLabelBackgroundColor;
-            cell.titleLabelHeight = self.titleLabelHeight;
-            cell.titleLabelTextColor = self.titleLabelTextColor;
-            cell.titleLabelTextFont = self.titleLabelTextFont;
-            cell.hasConfigured = YES;
-            cell.imageView.contentMode = self.bannerImageViewContentMode;
-            cell.clipsToBounds = YES;
-            cell.onlyDisplayText = self.onlyDisplayText;
-            cell.zoomType = self.zoomType;
-        }
-        if (self.zoomType) {
-            if ([self currentIndex] == indexPath.item) {
-                cell.imageView.frame = CGRectMake(0, 0, MaxWidth, MaxHeight);
-            } else {
-                cell.imageView.frame = CGRectMake(0, 0, MinWidth, MinHeight);
-            }
-            
-            cell.imageView.center = cell.contentView.center;
-        }
-    }
-    
-    
-    
-    return cell;
-}
-
-- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    if ([self.delegate respondsToSelector:@selector(cycleScrollView:didSelectItemAtIndex:)]) {
-        [self.delegate cycleScrollView:self didSelectItemAtIndex:[self pageControlIndexWithCurrentCellIndex:indexPath.item]];
-    }
-    if (self.clickItemOperationBlock) {
-        self.clickItemOperationBlock([self pageControlIndexWithCurrentCellIndex:indexPath.item]);
-    }
-}
-
-
-#pragma mark - UIScrollViewDelegate
-
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView
-{
-    if (!self.imagePathsGroup.count) return; // 解决清除timer时偶尔会出现的问题
-    int itemIndex = [self currentIndex];
-    int indexOnPageControl = [self pageControlIndexWithCurrentCellIndex:itemIndex];
-    
-    if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
-        TAPageControl *pageControl = (TAPageControl *)_pageControl;
-        pageControl.currentPage = indexOnPageControl;
-    } else {
-        UIPageControl *pageControl = (UIPageControl *)_pageControl;
-        pageControl.currentPage = indexOnPageControl;
-    }
-    
-    // 图片缩放
-    if (self.zoomType) {
-        SDCollectionViewCell *lastCell = (SDCollectionViewCell *)[self.mainView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:itemIndex - 1 inSection:0]];
-        SDCollectionViewCell *currentCell = (SDCollectionViewCell *)[self.mainView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:itemIndex inSection:0]];
-        SDCollectionViewCell *nextCell = (SDCollectionViewCell *)[self.mainView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:itemIndex + 1 inSection:0]];
-        
-        // 当前cell的偏移比例
-        CGFloat scale = (fabs(self.flowLayout.itemSize.width * itemIndex - (self.mainView.contentOffset.x + (SDScreen_Width - self.flowLayout.itemSize.width)/2)))/self.flowLayout.itemSize.width;
-        
-        currentCell.imageView.frame = CGRectMake(0, 0, MaxWidth - scale * (MaxWidth - MinWidth), MaxHeight - scale * (MaxHeight - MinHeight));
-
-        if (self.mainView.contentOffset.x > self.contentOffsetX) {
-            // 向左滚动
-            if (self.isDragging) {
-                self.dragDirection = 1;
-            }
-            
-            if (self.flowLayout.itemSize.width * itemIndex < self.mainView.contentOffset.x + (SDScreen_Width - self.flowLayout.itemSize.width)/2) {
-                // 当前页图片缩小,下一页图片放大
-                nextCell.imageView.frame = CGRectMake(0, 0, MinWidth + scale * (MaxWidth - MinWidth), MinHeight + scale * (MaxHeight - MinHeight));
-            } else {
-                // 当前页图片放大,前一页图片缩小
-                lastCell.imageView.frame = CGRectMake(0, 0, MaxWidth - (1 - scale) * (MaxWidth - MinWidth), MaxHeight - (1 - scale) * (MaxHeight - MinHeight));
-            }
-        } else {
-            // 向右滚动
-            if (self.isDragging) {
-                self.dragDirection = 2;
-            }
-            
-            if (self.flowLayout.itemSize.width * itemIndex < self.mainView.contentOffset.x + (SDScreen_Width - self.flowLayout.itemSize.width)/2) {
-                // 当前页图片放大,下一页图片缩小
-                nextCell.imageView.frame = CGRectMake(0, 0, MinWidth + scale * (MaxWidth - MinWidth), MinHeight + scale * (MaxHeight - MinHeight));
-            } else {
-                // 当前页图片缩小,前一页图片放大
-                lastCell.imageView.frame = CGRectMake(0, 0, MaxWidth - (1 - scale) * (MaxWidth - MinWidth), MaxHeight - (1 - scale) * (MaxHeight - MinHeight));
-            }
-        }
-        
-        currentCell.imageView.center = currentCell.contentView.center;
-        nextCell.imageView.center = nextCell.contentView.center;
-        lastCell.imageView.center = lastCell.contentView.center;
-        
-        self.contentOffsetX = self.mainView.contentOffset.x;
-    }
-}
-
-- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
-{
-    self.isDragging = YES;
-    if (self.autoScroll) {
-        [self invalidateTimer];
-    }
-}
-
-- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
-{
-    if (self.zoomType) {
-        dispatch_async(dispatch_get_main_queue(), ^{
-            int index = [self currentIndex];
-            [self scrollToIndex:index];
-        });
-    }
-    if (self.autoScroll) {
-        [self setupTimer];
-    }
-}
-
-- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
-{
-    [self scrollViewDidEndScrollingAnimation:self.mainView];
-}
-
-- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
-{
-    self.contentOffsetX = self.mainView.contentOffset.x;
-    if (!self.imagePathsGroup.count) return; // 解决清除timer时偶尔会出现的问题
-    int itemIndex = [self currentIndex];
-    int indexOnPageControl = [self pageControlIndexWithCurrentCellIndex:itemIndex];
-    
-    if ([self.delegate respondsToSelector:@selector(cycleScrollView:didScrollToIndex:)]) {
-        [self.delegate cycleScrollView:self didScrollToIndex:indexOnPageControl];
-    } else if (self.itemDidScrollOperationBlock) {
-        self.itemDidScrollOperationBlock(indexOnPageControl);
-    }
-    self.isDragging = NO;
-    self.dragDirection = DragDirectionNone;
-}
-
-- (void)setScrollEnable:(BOOL)scrollEnabled {
-    _mainView.scrollEnabled = scrollEnabled;
-}
-@end

+ 0 - 16
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/SDQWMaskCustomModel.h

@@ -1,16 +0,0 @@
-//
-//  SDQWMaskCustomModel.h
-//  testMansory
-//
-//  Created by 小威 on 2018/1/10.
-//  Copyright © 2018年 qingwei. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-
-@interface SDQWMaskCustomModel : NSObject
-@property (nonatomic, copy) NSString *imagepath;
-@property (nonatomic, copy) NSString *descriptionName;
-@property (nonatomic, copy) NSString *url;
-@end

+ 0 - 16
KulexiuForStudent/KulexiuForStudent/Common/ThirdPart/SDCycleScrollView/SDQWMaskCustomModel.m

@@ -1,16 +0,0 @@
-//
-//  SDQWMaskCustomModel.m
-//  testMansory
-//
-//  Created by 小威 on 2018/1/10.
-//  Copyright © 2018年 qingwei. All rights reserved.
-//
-
-#import "SDQWMaskCustomModel.h"
-
-@implementation SDQWMaskCustomModel
-+ (NSDictionary *)modelCustomPropertyMapper {
-    return @{@"descriptionName" : @"description",
-             };
-}
-@end

Some files were not shown because too many files changed in this diff