Prechádzať zdrojové kódy

修改部分UI问题

Steven 1 rok pred
rodič
commit
58041680a3

+ 12 - 6
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/project.pbxproj

@@ -1163,6 +1163,7 @@
 		BCF1BA5627F5CBA100FA36C4 /* LiveSeatApplyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCF1BA5527F5CBA100FA36C4 /* LiveSeatApplyView.xib */; };
 		BCF1BA5A27F5CF3C00FA36C4 /* LiveSeatApplyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BCF1BA5827F5CF3C00FA36C4 /* LiveSeatApplyCell.m */; };
 		BCF1BA5B27F5CF3C00FA36C4 /* LiveSeatApplyCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCF1BA5927F5CF3C00FA36C4 /* LiveSeatApplyCell.xib */; };
+		BCF425E52AB8797500BCD942 /* NSDate+DateDetail.m in Sources */ = {isa = PBXBuildFile; fileRef = BCF425E42AB8797500BCD942 /* NSDate+DateDetail.m */; };
 		BCF61BE128041FC90000ACFE /* UIView+ExtensionForDotLine.m in Sources */ = {isa = PBXBuildFile; fileRef = BCF61BE028041FC90000ACFE /* UIView+ExtensionForDotLine.m */; };
 		BCF61BE42804248F0000ACFE /* InstrumentChooseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCF61BE32804248F0000ACFE /* InstrumentChooseViewController.m */; };
 		BCF61BE8280425DA0000ACFE /* InstrumentChooseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BCF61BE6280425DA0000ACFE /* InstrumentChooseCell.m */; };
@@ -3157,6 +3158,8 @@
 		BCF1BA5727F5CF3C00FA36C4 /* LiveSeatApplyCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LiveSeatApplyCell.h; sourceTree = "<group>"; };
 		BCF1BA5827F5CF3C00FA36C4 /* LiveSeatApplyCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LiveSeatApplyCell.m; sourceTree = "<group>"; };
 		BCF1BA5927F5CF3C00FA36C4 /* LiveSeatApplyCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LiveSeatApplyCell.xib; sourceTree = "<group>"; };
+		BCF425E32AB8797500BCD942 /* NSDate+DateDetail.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+DateDetail.h"; sourceTree = "<group>"; };
+		BCF425E42AB8797500BCD942 /* NSDate+DateDetail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+DateDetail.m"; sourceTree = "<group>"; };
 		BCF61BDF28041FC90000ACFE /* UIView+ExtensionForDotLine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+ExtensionForDotLine.h"; sourceTree = "<group>"; };
 		BCF61BE028041FC90000ACFE /* UIView+ExtensionForDotLine.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+ExtensionForDotLine.m"; sourceTree = "<group>"; };
 		BCF61BE22804248F0000ACFE /* InstrumentChooseViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InstrumentChooseViewController.h; sourceTree = "<group>"; };
@@ -3814,8 +3817,6 @@
 		277930E427E30FBE0010E277 /* Extension */ = {
 			isa = PBXGroup;
 			children = (
-				BCA7C33D284760AA009D20EC /* NSObject+KeyWindow.h */,
-				BCA7C33E284760AA009D20EC /* NSObject+KeyWindow.m */,
 				2779311527E30FBE0010E277 /* CALayer+Color.h */,
 				277930EE27E30FBE0010E277 /* CALayer+Color.m */,
 				277930FA27E30FBE0010E277 /* CALayer+Layout.h */,
@@ -3824,6 +3825,8 @@
 				277930F527E30FBE0010E277 /* KSUtilities.m */,
 				2779312127E30FBE0010E277 /* NSArray+zh_SafeAccess.h */,
 				277930FF27E30FBE0010E277 /* NSArray+zh_SafeAccess.m */,
+				BCF425E32AB8797500BCD942 /* NSDate+DateDetail.h */,
+				BCF425E42AB8797500BCD942 /* NSDate+DateDetail.m */,
 				277930F427E30FBE0010E277 /* NSDate+Extension.h */,
 				2779311027E30FBE0010E277 /* NSDate+Extension.m */,
 				277930EF27E30FBE0010E277 /* NSDate+Transform.h */,
@@ -3834,6 +3837,8 @@
 				277930F027E30FBE0010E277 /* NSMutableAttributedString+CZHExtention.m */,
 				2779310D27E30FBE0010E277 /* NSObject+AssociatedObject.h */,
 				277930E527E30FBE0010E277 /* NSObject+AssociatedObject.m */,
+				BCA7C33D284760AA009D20EC /* NSObject+KeyWindow.h */,
+				BCA7C33E284760AA009D20EC /* NSObject+KeyWindow.m */,
 				2779311C27E30FBE0010E277 /* NSObject+Parse.h */,
 				2779310327E30FBE0010E277 /* NSObject+Parse.m */,
 				277930ED27E30FBE0010E277 /* NSString+CZHSizeExtension.h */,
@@ -3845,20 +3850,20 @@
 				277930F627E30FBE0010E277 /* Pinyin */,
 				2779311727E30FBE0010E277 /* UIAlertController+Extend.h */,
 				277930FC27E30FBE0010E277 /* UIAlertController+Extend.m */,
+				BC450D332A86024600992740 /* UIButton+KSDelayAction.h */,
+				BC450D342A86024600992740 /* UIButton+KSDelayAction.m */,
 				2779312027E30FBE0010E277 /* UIColor+Extend.h */,
 				2779310027E30FBE0010E277 /* UIColor+Extend.m */,
 				2779310B27E30FBE0010E277 /* UIControl+ButtonAction.h */,
 				277930E727E30FBE0010E277 /* UIControl+ButtonAction.m */,
-				BC450D332A86024600992740 /* UIButton+KSDelayAction.h */,
-				BC450D342A86024600992740 /* UIButton+KSDelayAction.m */,
 				2779310A27E30FBE0010E277 /* UIDevice+zhDeviceType.h */,
 				277930E827E30FBE0010E277 /* UIDevice+zhDeviceType.m */,
 				277930F927E30FBE0010E277 /* UIImage+Color.h */,
 				2779311B27E30FBE0010E277 /* UIImage+Color.m */,
-				277930FD27E30FBE0010E277 /* UIImageView+CornerRadius.h */,
-				2779311827E30FBE0010E277 /* UIImageView+CornerRadius.m */,
 				BC8B6E73285855B600866917 /* UIImage+KSScreenShot.h */,
 				BC8B6E74285855B700866917 /* UIImage+KSScreenShot.m */,
+				277930FD27E30FBE0010E277 /* UIImageView+CornerRadius.h */,
+				2779311827E30FBE0010E277 /* UIImageView+CornerRadius.m */,
 				2779310F27E30FBE0010E277 /* UILabel+Extension.h */,
 				277930F327E30FBE0010E277 /* UILabel+Extension.m */,
 				277930FE27E30FBE0010E277 /* UIScreen+Extend.h */,
@@ -8890,6 +8895,7 @@
 				BC12638028FEB5B900509E90 /* UserDetailNavView.m in Sources */,
 				BC106BAC2A8F45AA000759A9 /* TXUISeatMember.m in Sources */,
 				BCB9FA1C286D537E005D766B /* KSScanViewController.m in Sources */,
+				BCF425E52AB8797500BCD942 /* NSDate+DateDetail.m in Sources */,
 				277931F427E30FC20010E277 /* NSDate+Extension.m in Sources */,
 				277931C127E30FC20010E277 /* NSDictionary+KSSafe.m in Sources */,
 				277931FF27E30FC30010E277 /* GRCreateManager.m in Sources */,

+ 1 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseWKWebViewController.m

@@ -25,7 +25,6 @@
 #import "KSICloudManager.h"
 #import "AddressListViewController.h"
 #import "KSOrderManager.h"
-#import "KSEnterLiveroomManager.h"
 #import "KSUMShareManager.h"
 #import "TZImageManager.h"
 #import "MusicRoomViewController.h"
@@ -592,7 +591,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 
 
 - (void)joinLiveRoomWithRoomId:(NSString *)roomId {
-    [KSEnterLiveroomManager queryLiveStatusConfig:roomId isLiveCourse:YES liveContent:nil inController:(CustomNavViewController *)self.navigationController callback:^(ENTER_CALLTYPE type) {
+    [KSEnterLiveroomManager queryLiveStatusConfig:roomId liveContent:nil inController:(CustomNavViewController *)self.navigationController callback:^(ENTER_CALLTYPE type) {
         
     }];
 }

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Custom/KSFullDatePicker.h

@@ -16,6 +16,7 @@ typedef NS_ENUM(NSInteger, KSDATEPICKER_MODE) {
     KSDATEPICKER_MODE_FULLTIME = 4,   // yyyy/MM/dd HH:mm:ss
     KSDATEPICKER_MODE_YEAR_MONTH = 5, // yyyy-MM
     KSDATEPICKER_MODE_HOUR_MINUTE = 6, // HH:mm
+    KSDATEPICKER_MODE_YEAR = 7,        // yyyy
 };
 
 

+ 67 - 23
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Custom/KSFullDatePicker.m

@@ -7,7 +7,7 @@
 //
 
 #import "KSFullDatePicker.h"
-#import "NSDate+KSBaseDatePicker.h"
+#import "NSDate+DateDetail.h"
 #import "NSDate+Extension.h"
 
 
@@ -99,15 +99,15 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
     self.block = block;
     self.cancleBlock = cancleBlock;
     self.pickMode = pickMode;
-    self.frame = CGRectMake(0, 0, kScreen_Width, kScreen_Height);
-    self.backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kScreen_Height)];
-    self.backView.backgroundColor = HexRGBAlpha(0x363636, 0.55f);
+    self.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
+    self.backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
+    self.backView.backgroundColor = HexRGBAlpha(0x000000, 0.6f);
     self.date = date;
     UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
     tap.delegate = self;
     [self.backView addGestureRecognizer:tap];
     
-    self.timeView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreen_Height, kScreen_Width, 266)];
+    self.timeView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenHeight, kScreenWidth, 266)];
     self.timeView.backgroundColor = [UIColor whiteColor];
     self.timeView.layer.masksToBounds = YES;
     if (@available(iOS 11.0, *)) {
@@ -122,7 +122,7 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
         self.timeView.layer.mask = maskLayer;
     }
     /*创建显示View*/
-    _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 50, kScreen_Width, 216)];
+    _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 50, kScreenWidth, 216)];
     _contentView.backgroundColor = [UIColor whiteColor];
     [_timeView addSubview:_contentView];
     
@@ -131,18 +131,18 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
     UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
     UIButton *sureButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
     [cancelButton setTitle:@"取消" forState:UIControlStateNormal];
-    [cancelButton setTitleColor:HexRGB(0x666666) forState:UIControlStateNormal];
+    [cancelButton setTitleColor:HexRGB(0x777777) forState:UIControlStateNormal];
     [sureButton setTitle:@"确定" forState:UIControlStateNormal];
     [sureButton setTitleColor:THEMECOLOR forState:UIControlStateNormal];
-    cancelButton.titleLabel.font = [UIFont systemFontOfSize:17.0f];
-    sureButton.titleLabel.font = [UIFont systemFontOfSize:17.0f];
+    cancelButton.titleLabel.font = [UIFont systemFontOfSize:16.0f];
+    sureButton.titleLabel.font = [UIFont systemFontOfSize:16.0f];
     
     [cancelButton addTarget:self action:@selector(cancelButtonAction:) forControlEvents:UIControlEventTouchUpInside];
     [sureButton addTarget:self action:@selector(doneButtonAction:) forControlEvents:UIControlEventTouchUpInside];
     
     
-    cancelButton.frame = CGRectMake(20, 10, 60, 30);
-    sureButton.frame = CGRectMake(kScreen_Width - 80, 10, 60, 30);
+    cancelButton.frame = CGRectMake(10, 10, 60, 30);
+    sureButton.frame = CGRectMake(kScreenWidth - 70, 10, 60, 30);
     [self.timeView addSubview:cancelButton];
     [self.timeView addSubview:sureButton];
     
@@ -153,6 +153,11 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
     titleLabel.font = [UIFont systemFontOfSize:15];
     titleLabel.textAlignment = NSTextAlignmentCenter;
     [self.timeView addSubview:titleLabel];
+    
+    // lineView
+    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(13, 50, KPortraitWidth - 26, 1)];
+    lineView.backgroundColor = HexRGB(0xF2F2F2);
+    [self.timeView addSubview:lineView];
     [self.backView addSubview:self.timeView];
     [self addSubview:self.backView];
     
@@ -173,6 +178,7 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
 }
 
 - (void)initPickViews {
+
     /*添加PickerView*/
     NSMutableArray* tempArray1 = [[NSMutableArray alloc] initWithCapacity:0];
     NSMutableArray* tempArray2 = [[NSMutableArray alloc] initWithCapacity:0];
@@ -192,6 +198,14 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
     [self createDataSource];
     CGRect frame = _contentView.frame;
     CGFloat height = CGRectGetHeight(frame);
+    
+    if (self.pickMode != KSDATEPICKER_MODE_YEAR) {
+        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, (height - 44) / 2.0f, CGRectGetWidth(frame) , 44)];
+        lineView.backgroundColor = HexRGB(0xF2F2F2);
+        lineView.layer.cornerRadius = 8.0f;
+        [_contentView addSubview:lineView];
+    }
+    
     if (_pickMode == KSDATEPICKER_MODE_TIME) {  // 时分秒
         CGFloat width = CGRectGetWidth(frame) / 3.0f;
         
@@ -343,6 +357,16 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
         [_contentView addSubview:self.hourPicker];
         [_contentView addSubview:self.minutePicker];
     }
+    else if (_pickMode == KSDATEPICKER_MODE_YEAR) { // 年
+        CGFloat width = CGRectGetWidth(frame);
+        
+        UIPickerView* yearPickerTemp = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
+        [self setYearPicker:yearPickerTemp];
+        [yearPickerTemp setValue:[UIColor blackColor] forKey:@"textColor"];
+        [self.yearPicker setFrame:CGRectMake(0, 0, width, height)];
+        
+        [_contentView addSubview:self.yearPicker];
+    }
     [self.yearPicker setDataSource:self];
     [self.monthPicker setDataSource:self];
     [self.dayPicker setDataSource:self];
@@ -380,7 +404,7 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
 - (void)cancelButtonAction:(UIButton *)sender
 {
     [UIView animateWithDuration:0.3f animations:^{
-        self.timeView.frame = CGRectMake(0, kScreen_Height,kScreen_Width, 266);
+        self.timeView.frame = CGRectMake(0, kScreenHeight,kScreenWidth, 266);
     } completion:^(BOOL finished) {
         [self removeFromSuperview];
     }];
@@ -424,6 +448,10 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
             date = [NSString stringWithFormat:@"%02ld:%02ld",_hourValue,_minuteValue];
         }
             break;
+        case KSDATEPICKER_MODE_YEAR:
+        {
+            date = [NSString stringWithFormat:@"%ld",_yearValue];
+        }
         default:
             break;
     }
@@ -433,7 +461,7 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
     
     
     [UIView animateWithDuration:0.3 animations:^{
-        self.timeView.frame = CGRectMake(0, self.bounds.size.height, self.bounds.size.width, 230);
+        self.timeView.frame = CGRectMake(0, self.bounds.size.height, self.bounds.size.width, 266);
     } completion:^(BOOL finished) {
         [self removeFromSuperview];
     }];
@@ -442,7 +470,7 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
 - (void)tapAction:(UITapGestureRecognizer *)tap
 {
     [UIView animateWithDuration:0.3f animations:^{
-        self.timeView.frame = CGRectMake(0, kScreen_Height,kScreen_Width, 266);
+        self.timeView.frame = CGRectMake(0, kScreenHeight,kScreenWidth, 266);
     } completion:^(BOOL finished) {
         [self removeFromSuperview];
     }];
@@ -458,7 +486,7 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
     [window addSubview:self];
     
     [UIView animateWithDuration:0.3f animations:^{
-        self.timeView.frame = CGRectMake(0, kScreen_Height - 266, kScreen_Width, 266);
+        self.timeView.frame = CGRectMake(0, kScreenHeight - 266, kScreenWidth, 266);
     } completion:^(BOOL finished) {
         nil;
     }];
@@ -468,6 +496,10 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
 
 
 #pragma mark - UIPickerViewDataSource
+- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component {
+    return 46.0f;
+}
+
 - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
     return 1;
 }
@@ -528,15 +560,15 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
 - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
     if (ePickerViewTagYear == pickerView.tag) {
         self.yearValue = [[self.yearArray objectAtIndex:row] intValue];
-    } else if(ePickerViewTagMonth == pickerView.tag){
+    } else if(ePickerViewTagMonth == pickerView.tag) {
         self.monthValue = [[self.monthArray objectAtIndex:row] intValue];
-    }else if(ePickerViewTagDay == pickerView.tag){
+    }else if(ePickerViewTagDay == pickerView.tag) {
         self.dayValue = [[self.dayArray objectAtIndex:row] intValue];
-    }else if(ePickerViewTagHour == pickerView.tag){
+    }else if(ePickerViewTagHour == pickerView.tag) {
         self.hourValue = [[self.hourArray objectAtIndex:row] intValue];
-    } else if(ePickerViewTagMinute == pickerView.tag){
+    } else if(ePickerViewTagMinute == pickerView.tag) {
         self.minuteValue = [[self.minuteArray objectAtIndex:row] intValue];
-    } else if(ePickerViewTagSecond == pickerView.tag){
+    } else if(ePickerViewTagSecond == pickerView.tag) {
         self.secondValue = [[self.secondArray objectAtIndex:row] intValue];
     }
     if (ePickerViewTagMonth == pickerView.tag || ePickerViewTagYear == pickerView.tag) {
@@ -665,7 +697,7 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
 - (void)resetDateToCurrentDate {
     
     NSDate* nowDate = self.date;
-    [self.yearPicker selectRow:[self.yearArray count]-100 inComponent:0 animated:YES];
+    [self.yearPicker selectRow:[self getYearRow:[nowDate getYear]] inComponent:0 animated:YES];
     [self.monthPicker selectRow:[nowDate getMonth]-1 inComponent:0 animated:YES];
     [self.dayPicker selectRow:[nowDate getDay]-1 inComponent:0 animated:YES];
     
@@ -681,6 +713,14 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
     [self setSecondValue:[nowDate getSeconds]];
 }
 
+- (NSInteger)getYearRow:(NSInteger)year {
+    NSInteger index = [self.yearArray indexOfObject:[NSString stringWithFormat:@"%zd",year]];
+    if (index > 0) {
+        return index;
+    }
+    return [self.yearArray count]-100;
+}
+
 #pragma mark -pickerViewDelegate
 -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
 {
@@ -690,14 +730,18 @@ typedef NS_ENUM(NSInteger, PickViewTag) {
         pickerLabel.adjustsFontSizeToFitWidth = YES;
         [pickerLabel setTextAlignment:NSTextAlignmentCenter];
         [pickerLabel setBackgroundColor:[UIColor clearColor]];
-        [pickerLabel setFont:[UIFont systemFontOfSize:16]];
-        [pickerLabel setTextColor:[UIColor blackColor]];
+        [pickerLabel setFont:[UIFont systemFontOfSize:16.0f weight:UIFontWeightMedium]];
+        [pickerLabel setTextColor:HexRGB(0x333333)];
     }
     // Fill the label text here
     pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];
+    if (self.subviews.count > 0 && self.pickMode != KSDATEPICKER_MODE_YEAR) {
+        pickerView.subviews[1].backgroundColor = [UIColor clearColor];
+    }
     return pickerLabel;
 }
 
+
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
     if ([touch.view isDescendantOfView:self.timeView]) {
         return NO;

+ 30 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Extension/NSDate+DateDetail.h

@@ -0,0 +1,30 @@
+//
+//  NSDate+DateDetail.h
+//  GuanYueTeam
+//
+//  Created by 王智 on 2022/11/14.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NSDate (DateDetail)
+
+-(int)getYear;
+-(int)getMonth;
+-(int)getDay;
+-(int)getHours;
+-(int)getMinutes;
+-(int)getSeconds;
+
+- (NSString *)getPreMonthFirstDay:(NSDate *)currentMonth;
+
+- (NSString *)getNextMonthLastDay:(NSDate *)currentMonth;
+
++ (NSDate *)getCurrentWeakFirstDay;
+
++ (NSDate *)getCurrentWeakLastDay;
+@end
+
+NS_ASSUME_NONNULL_END

+ 143 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Extension/NSDate+DateDetail.m

@@ -0,0 +1,143 @@
+//
+//  NSDate+DateDetail.m
+//  GuanYueTeam
+//
+//  Created by 王智 on 2022/11/14.
+//
+
+#import "NSDate+DateDetail.h"
+
+@implementation NSDate (DateDetail)
+
+- (int)getYear {
+    NSCalendar *calendar = [NSCalendar currentCalendar];
+    NSUInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
+    NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:self];
+    return (int)dateComponent.year;
+}
+
+-(int)getMonth{
+    NSCalendar *calendar = [NSCalendar currentCalendar];
+    NSUInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
+    NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:self];
+    return (int)dateComponent.month;
+}
+-(int)getDay{
+    NSCalendar *calendar = [NSCalendar currentCalendar];
+    NSUInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
+    NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:self];
+    return (int)dateComponent.day;
+}
+-(int)getHours{
+    NSCalendar *calendar = [NSCalendar currentCalendar];
+    NSUInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;;
+    NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:self];
+    return (int)dateComponent.hour;
+}
+-(int)getMinutes{
+    NSCalendar *calendar = [NSCalendar currentCalendar];
+    NSUInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
+    NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:self];
+    return (int)dateComponent.minute;
+}
+-(int)getSeconds{
+    NSCalendar *calendar = [NSCalendar currentCalendar];
+    NSUInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
+    NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:self];
+    return (int)dateComponent.second;
+}
+
+- (NSString *)getPreMonthFirstDay:(NSDate *)currentMonth {
+    NSDate *preMonth = [self getPriousorLaterDateFromDate:currentMonth withMonth:-1];
+    NSString *firstDay = [self getMonthFirstDayWithDate:preMonth format:@"yyyy-MM-dd"];
+    return firstDay;
+}
+
+- (NSString *)getNextMonthLastDay:(NSDate *)currentMonth {
+    NSDate *nextMonth = [self getPriousorLaterDateFromDate:currentMonth withMonth:1];
+    NSString *lastDay = [self getMonthLastDayWithDate:nextMonth format:@"yyyy-MM-dd"];
+    return lastDay;
+}
+
+-(NSDate *)getPriousorLaterDateFromDate:(NSDate *)date withMonth:(NSInteger)month {
+    NSDateComponents *comps = [[NSDateComponents alloc] init];
+    [comps setMonth:month];
+    NSCalendar *calender = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
+    NSDate *mDate = [calender dateByAddingComponents:comps toDate:date options:0];
+    return mDate;
+}
+
+-(NSString *)getMonthLastDayWithDate:(NSDate *)date format:(NSString *)aformat {
+    
+    NSDate * newDate = date;
+    double interval = 0;
+    NSDate * firstDate = nil;
+    NSDate * lastDate = nil;
+    NSCalendar * calendar = [NSCalendar currentCalendar];
+    BOOL bl = [calendar rangeOfUnit:NSCalendarUnitMonth startDate:&firstDate interval:&interval forDate:newDate];
+    if(bl) {
+        lastDate = [firstDate dateByAddingTimeInterval:interval -1];
+        NSDateFormatter * myDateFormatter = [[NSDateFormatter alloc]init];
+        [myDateFormatter setDateFormat:aformat];
+        NSString * lastString = [myDateFormatter stringFromDate:lastDate];
+        return lastString;
+    }
+    return @"";
+}
+
+-(NSString *)getMonthFirstDayWithDate:(NSDate *)date format:(NSString *)aformat{
+    
+    NSDate * newDate = date;
+    double interval = 0;
+    NSDate * firstDate = nil;
+    NSCalendar * calendar = [NSCalendar currentCalendar];
+    BOOL bl = [calendar rangeOfUnit:NSCalendarUnitMonth startDate:&firstDate interval:&interval forDate:newDate];
+    if(bl) {
+        NSDateFormatter * myDateFormatter = [[NSDateFormatter alloc]init];
+        [myDateFormatter setDateFormat:aformat];
+        NSString * firstString = [myDateFormatter stringFromDate: firstDate];
+        return firstString;
+    }
+    return @"";
+}
+
+
++ (NSDate *)getCurrentWeakFirstDay {
+    NSCalendar *calendar = [NSCalendar currentCalendar];
+    NSDateComponents *dateComponents = [calendar components:NSCalendarUnitWeekday | NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]];
+    NSInteger weekday = [dateComponents weekday];   //第几天(从sunday开始)
+    NSInteger firstDiff,lastDiff;
+    if (weekday == 1) {
+        firstDiff = -6;
+        lastDiff = 0;
+    }else {
+        firstDiff =  - weekday + 2;
+        lastDiff = 8 - weekday;
+    }
+    NSInteger day = [dateComponents day];
+    NSDateComponents *firstComponents = [calendar components:NSCalendarUnitWeekday | NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]];
+    [firstComponents setDay:day+firstDiff];
+    NSDate *firstDay = [calendar dateFromComponents:firstComponents];
+    return firstDay;
+}
+
++ (NSDate *)getCurrentWeakLastDay {
+    NSCalendar *calendar = [NSCalendar currentCalendar];
+    NSDateComponents *dateComponents = [calendar components:NSCalendarUnitWeekday | NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]];
+    NSInteger weekday = [dateComponents weekday];   //第几天(从sunday开始)
+    NSInteger firstDiff,lastDiff;
+    if (weekday == 1) {
+        firstDiff = -6;
+        lastDiff = 0;
+    }else {
+        firstDiff =  - weekday + 2;
+        lastDiff = 8 - weekday;
+    }
+    NSInteger day = [dateComponents day];
+    NSDateComponents *lastComponents = [calendar components:NSCalendarUnitWeekday | NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]];
+    [lastComponents setDay:day+lastDiff];
+    NSDate *lastDay = [calendar dateFromComponents:lastComponents];
+    return lastDay;
+}
+
+@end

+ 43 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Controller/TXCustom/KSTXBaseChatViewController.m

@@ -43,6 +43,8 @@
 #import "MinePageViewController.h"
 #import "KSBaseWKWebViewController.h"
 
+#import "KSAccompanyWebViewController.h"
+#import "KSEnterLiveroomManager.h"
 static UIView *gCustomTopView;
 
 @interface KSTXBaseChatViewController ()
@@ -60,6 +62,7 @@ static UIView *gCustomTopView;
 }
 
 - (void)messageController:(TUIBaseMessageController *)controller onSelectMessageAvatar:(TUIMessageCell *)cell {
+    /*
     NSString *userID = nil;
     if (cell.messageData.innerMessage.groupID.length > 0) {
         userID = cell.messageData.innerMessage.sender;
@@ -90,6 +93,7 @@ static UIView *gCustomTopView;
             [self displayTeacherInfo:userID];
         }
     }
+     */
 }
 
 - (void)displayMineInfo {
@@ -148,6 +152,45 @@ static UIView *gCustomTopView;
 }
 
 
+- (void)messageController:(TUIBaseMessageController *)controller onSelectMessageContent:(TUIMessageCell *)cell {
+    cell.disableDefaultSelectAction = NO;
+    if (cell.disableDefaultSelectAction) {
+        return;
+    }
+    V2TIMMessage *message = cell.messageData.innerMessage;
+    if (message.elemType == V2TIM_ELEM_TYPE_CUSTOM) {
+        NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil];
+        
+        if ([[param ks_stringValueForKey:@"businessID"] isEqualToString:@"TC_CHATSHARE_MUSIC"]) {
+            NSString *musicSongId = [param ks_stringValueForKey:@"songId"];
+            [self showMusic:musicSongId];
+        }
+        else if ([[param ks_stringValueForKey:@"businessID"] isEqualToString:@"TC_CHATSHARE_LIVE"]) {
+            NSString *roomId = [param ks_stringValueForKey:@"roomUID"];
+            NSString *liveDesc = [param ks_stringValueForKey:@"liveDescMessage"];
+            [self enterLiveRoom:roomId desc:liveDesc];
+        }
+    }
+    
+}
+
+- (void)enterLiveRoom:(NSString *)roomId desc:(NSString *)liveDesc {
+//     查询房间信息
+    [KSEnterLiveroomManager queryLiveStatusConfig:roomId liveContent:liveDesc inController:(CustomNavViewController *)self.navigationController callback:^(ENTER_CALLTYPE type) {
+            
+    }];
+}
+
+//- (void)
+- (void)showMusic:(NSString *)songId {
+    KSAccompanyWebViewController *detailCtrl = [[KSAccompanyWebViewController alloc] init];
+    detailCtrl.url = [NSString stringWithFormat:@"%@/accompany?id=%@",hostURL, songId];
+    detailCtrl.hiddenNavBar = YES;
+    detailCtrl.parmDic = @{@"isOpenLight" : @(YES), @"orientation" : @(0),@"isHideTitle" : @(YES)};
+    [self.navigationController pushViewController:detailCtrl animated:YES];
+}
+
+
 
 /*
 #pragma mark - Navigation

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeNavView.m

@@ -28,8 +28,8 @@
 }
 
 - (void)configMessage:(UserInfo *)infoMessage {
-    
-    if ([NSString isEmptyString:infoMessage.tenantName]) {
+    BOOL isTenant = infoMessage.tenantId > 0 ? YES : NO;
+    if (![NSString isEmptyString:infoMessage.tenantName] && isTenant) {
         self.nameLabel.text = [NSString stringWithFormat:@"%@%@", infoMessage.tenantName, [NSString returnNoNullStringWithString:infoMessage.username]];
     }
     else {

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Live/Controller/CreateLiveViewController.m

@@ -146,7 +146,7 @@
 
 - (void)previewViewWithRoomId:(NSString *)roomId liveDesc:(NSString *)liveDesc {
     
-    [KSEnterLiveroomManager queryLiveStatusConfig:roomId isLiveCourse:NO liveContent:liveDesc inController:(CustomNavViewController *)self.navigationController callback:^(ENTER_CALLTYPE type) {
+    [KSEnterLiveroomManager queryLiveStatusConfig:roomId liveContent:liveDesc inController:(CustomNavViewController *)self.navigationController callback:^(ENTER_CALLTYPE type) {
         if (type == ENTER_CALLTYPE_BACK) {
             [self backAction];
         }

+ 4 - 5
KulexiuForTeacher/KulexiuForTeacher/Module/MidiPlayer/ShareInChat/Controller/KSImageShareViewController.m

@@ -77,19 +77,18 @@
 }
 
 
-
 - (void)topViewAction:(CHATADDRESSTYPE)type search:(NSString *)searchKey {
     switch (type) {
         case CHATADDRESSTYPE_PERSON: // 联系人
         {
-            [self.categoryView selectItemAtIndex:0];
-            self.selectedIndex = 0;
+            [self.categoryView selectItemAtIndex:1];
+            self.selectedIndex = 1;
         }
             break;
         case CHATADDRESSTYPE_GROUP: // 群组
         {
-            [self.categoryView selectItemAtIndex:1];
-            self.selectedIndex = 1;
+            [self.categoryView selectItemAtIndex:0];
+            self.selectedIndex = 0;
         }
             break;
         case CHATADDRESSTYPE_SEARCH:  // 搜索

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/LiveList/View/LiveListBodyView.m

@@ -193,7 +193,7 @@
 
 - (void)toLiveRoomWithRoomMessaeg:(LiveListModel *)listModel {
     
-    [KSEnterLiveroomManager queryLiveStatusConfig:listModel.roomUid isLiveCourse:NO liveContent:listModel.liveRemark inController:(CustomNavViewController *)self.naviController callback:^(ENTER_CALLTYPE type) {
+    [KSEnterLiveroomManager queryLiveStatusConfig:listModel.roomUid liveContent:listModel.liveRemark inController:(CustomNavViewController *)self.naviController callback:^(ENTER_CALLTYPE type) {
         
     }];
 }

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/View/MineHeadView.m

@@ -126,8 +126,8 @@
     else {
         [self.userAvatal setImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
     }
-    
-    if (![NSString isEmptyString:infoMessage.tenantName]) {
+    BOOL isTenant = infoMessage.tenantId > 0 ? YES : NO;
+    if (![NSString isEmptyString:infoMessage.tenantName] && isTenant) {
         self.userName.text = [NSString stringWithFormat:@"%@%@", infoMessage.tenantName, [NSString returnNoNullStringWithString:infoMessage.username]];
     }
     else {

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/TXClassRoom/Service/TRTC/TXRTCService.m

@@ -116,7 +116,7 @@
     videoEncParams.videoResolution =  TRTCVideoResolution_640_480;
     [self.engine setVideoEncoderParam:videoEncParams];
     [self.engine setGSensorMode:TRTCGSensorMode_UIFixLayout];
-    [self.engine setVideoMuteImage:[self generalCloseImage] fps:5];
+//    [self.engine setVideoMuteImage:[self generalCloseImage] fps:5];
     [self config3AWithANS:self.ANS AEC:self.AEC AGC:self.AGC];
 }
 

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/TXLiveModule/Service/KSEnterLiveroomManager.h

@@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 + (void)queryLiveroomConfig:(NSString *)roomId callback:(RoomConfigCallback)callback;
 
-+ (void)queryLiveStatusConfig:(NSString *)roomID isLiveCourse:(BOOL)isLiveCourse liveContent:(NSString * _Nullable)liveContent inController:(CustomNavViewController *)navCtrl callback:(EnterCallback)callback;
++ (void)queryLiveStatusConfig:(NSString *)roomID liveContent:(NSString * _Nullable)liveContent inController:(CustomNavViewController *)navCtrl callback:(EnterCallback)callback;
 
 + (void)refreshClickStatus;
 

+ 2 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/TXLiveModule/Service/KSEnterLiveroomManager.m

@@ -30,7 +30,7 @@ static BOOL isRequestRoomMsg  = NO;
     }];
 }
 
-+ (void)queryLiveStatusConfig:(NSString *)roomID isLiveCourse:(BOOL)isLiveCourse liveContent:(NSString *)liveContent inController:(CustomNavViewController *)navCtrl callback:(EnterCallback)callback {
++ (void)queryLiveStatusConfig:(NSString *)roomID liveContent:(NSString *)liveContent inController:(CustomNavViewController *)navCtrl callback:(EnterCallback)callback {
     if (isRequestRoomMsg == YES) {
         return;
     }
@@ -40,6 +40,7 @@ static BOOL isRequestRoomMsg  = NO;
         
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
             NSDictionary *source = [dic ks_dictionaryValueForKey:@"data"];
+            BOOL isLiveCourse = [[source ks_stringValueForKey:@"type"] isEqualToString:@"LIVE"];
             [self enterLiveRoom:roomID liveSource:source isLiveCourse:isLiveCourse liveContent:liveContent inController:navCtrl callback:callback];
             if (callback) {
                 callback(ENTER_CALLTYPE_SUCCESS);