소스 검색

VIP课相关配置参数

Steven 10 달 전
부모
커밋
6cdda19fcf

+ 8 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/Controller/MineVipProgramViewController.m

@@ -29,6 +29,8 @@
 
 @property (nonatomic, assign) NSInteger maxPrice;
 
+@property (nonatomic, assign) NSInteger dayConfig;
+
 @end
 
 @implementation MineVipProgramViewController
@@ -83,7 +85,7 @@
 - (void)requsetConfig {
     
     dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager queryConfigLimit:KS_GET parms:@"vip_course_times_setting,vip_course_service_fee" success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager queryConfigLimit:KS_GET parms:@"vip_course_times_setting,vip_course_service_fee,vip_course_account_period" success:^(NSDictionary * _Nonnull dic) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
             NSArray *result = [dic ks_arrayValueForKey:@"data"];
             for (NSDictionary *parm in result) {
@@ -91,6 +93,10 @@
                     self.feeNum = [parm ks_doubleValueForKey:@"paramValue"] / 100.0f;
                     self.settingView.feeRate = self.feeNum;
                 }
+                else if ([[parm ks_stringValueForKey:@"paramName"] isEqualToString:@"vip_course_account_period"]) {
+                    self.dayConfig = [parm ks_integerValueForKey:@"paramValue"];
+                    self.settingView.dayConfig = self.dayConfig;
+                }
                 else if ([[parm ks_stringValueForKey:@"paramName"] isEqualToString:@"vip_course_times_setting"]) { // 时间
                     NSString *values = [parm ks_stringValueForKey:@"paramValue"];
                     NSData *valueData = [values dataUsingEncoding:NSUTF8StringEncoding];
@@ -176,7 +182,7 @@
 - (void)submitProgramWithSubjectId:(NSString *)subjectId subjectName:(NSString *)subjectName duration:(NSString *)duration price:(NSString *)price {
     [LOADING_MANAGER showHUD];
     [KSNetworkingManager teacherSubjectPriceSaveRequest:KS_POST courseType:@"VIP" subjectName:subjectName subjectId:subjectId subjectPrice:price courseMinutes:duration success:^(NSDictionary * _Nonnull dic) {
-        [LOADING_MANAGER removeHUD];
+        [LOADING_MANAGER removeHUDNoDelay];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
             [LOADING_MANAGER KSShowProgressMsg:@"创建成功" promptCompletion:^{
                 [self backAction];

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/Model/CoursePargramListModel.h

@@ -21,6 +21,7 @@
 @property (nonatomic, assign) double freeMinutes;
 @property (nonatomic, strong) NSString *teacherId;
 @property (nonatomic, strong) NSString *courseType;
+@property (nonatomic, strong) NSString *subjectPic;
 
 + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
 - (instancetype)initWithDictionary:(NSDictionary *)dict;

+ 7 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/Model/CoursePargramListModel.m

@@ -18,6 +18,7 @@ NSString *const kCoursePargramListModelCourseMinutes = @"courseMinutes";
 NSString *const kCoursePargramListModelFreeMinutes = @"freeMinutes";
 NSString *const kCoursePargramListModelTeacherId = @"teacherId";
 NSString *const kCoursePargramListModelCourseType = @"courseType";
+NSString *const kCoursePargramListModelSubjectPic = @"subjectPic";
 
 
 @interface CoursePargramListModel ()
@@ -38,7 +39,7 @@ NSString *const kCoursePargramListModelCourseType = @"courseType";
 @synthesize freeMinutes = _freeMinutes;
 @synthesize teacherId = _teacherId;
 @synthesize courseType = _courseType;
-
+@synthesize subjectPic = _subjectPic;
 
 + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
 {
@@ -62,6 +63,7 @@ NSString *const kCoursePargramListModelCourseType = @"courseType";
             self.freeMinutes = [[self objectOrNilForKey:kCoursePargramListModelFreeMinutes fromDictionary:dict] doubleValue];
             self.teacherId = [self objectOrNilForKey:kCoursePargramListModelTeacherId fromDictionary:dict];
             self.courseType = [self objectOrNilForKey:kCoursePargramListModelCourseType fromDictionary:dict];
+            self.subjectPic = [self objectOrNilForKey:kCoursePargramListModelSubjectPic fromDictionary:dict];
 
     }
     
@@ -82,7 +84,7 @@ NSString *const kCoursePargramListModelCourseType = @"courseType";
     [mutableDict setValue:[NSNumber numberWithDouble:self.freeMinutes] forKey:kCoursePargramListModelFreeMinutes];
     [mutableDict setValue:self.teacherId forKey:kCoursePargramListModelTeacherId];
     [mutableDict setValue:self.courseType forKey:kCoursePargramListModelCourseType];
-
+    [mutableDict setValue:self.subjectPic forKey:kCoursePargramListModelSubjectPic];
     return [NSDictionary dictionaryWithDictionary:mutableDict];
 }
 
@@ -119,6 +121,7 @@ NSString *const kCoursePargramListModelCourseType = @"courseType";
     self.freeMinutes = [aDecoder decodeDoubleForKey:kCoursePargramListModelFreeMinutes];
     self.teacherId = [aDecoder decodeObjectForKey:kCoursePargramListModelTeacherId];
     self.courseType = [aDecoder decodeObjectForKey:kCoursePargramListModelCourseType];
+    self.subjectPic = [aDecoder decodeObjectForKey:kCoursePargramListModelSubjectPic];
     return self;
 }
 
@@ -135,6 +138,7 @@ NSString *const kCoursePargramListModelCourseType = @"courseType";
     [aCoder encodeDouble:_freeMinutes forKey:kCoursePargramListModelFreeMinutes];
     [aCoder encodeObject:_teacherId forKey:kCoursePargramListModelTeacherId];
     [aCoder encodeObject:_courseType forKey:kCoursePargramListModelCourseType];
+    [aCoder encodeObject:_subjectPic forKey:kCoursePargramListModelSubjectPic];
 }
 
 - (id)copyWithZone:(NSZone *)zone
@@ -153,6 +157,7 @@ NSString *const kCoursePargramListModelCourseType = @"courseType";
         copy.freeMinutes = self.freeMinutes;
         copy.teacherId = [self.teacherId copyWithZone:zone];
         copy.courseType = [self.courseType copyWithZone:zone];
+        copy.subjectPic = [self.subjectPic copyWithZone:zone];
     }
     
     return copy;

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/VIPProgramCreate/MineVipProgramMainView.h

@@ -20,6 +20,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) double feeRate;
 
+@property (nonatomic, assign) NSInteger dayConfig;
+
 + (instancetype)sharedInstanace;
 
 - (void)configSubjectNameArray:(NSArray *)subjectNameArray subjectIds:(NSArray *)subjectIdArray durationArray:(NSArray *)timesArray minPrice:(NSInteger)minPrice maxPrice:(NSInteger)maxPrice;

+ 27 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/VIPProgramCreate/MineVipProgramMainView.m

@@ -9,8 +9,11 @@
 #import "ProgramAddButton.h"
 
 @interface MineVipProgramMainView ()<UITextFieldDelegate>
+
 @property (weak, nonatomic) IBOutlet UILabel *priceLabel;
 
+@property (weak, nonatomic) IBOutlet UILabel *dayLabel;
+
 @property (weak, nonatomic) IBOutlet UIView *subjectContainer;
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *subjectContainerHeight;
 
@@ -190,6 +193,20 @@
     }
 }
 
+- (void)setDayConfig:(NSInteger)dayConfig {
+    _dayConfig = dayConfig;
+    [self evaluateMessage];
+}
+
+- (void)evaluateMessage {
+    NSString *dayMsg = [NSString stringWithFormat:@"%zd",self.dayConfig];
+    NSString *desc = [NSString stringWithFormat:@"您的课程收入将在课程结束 %@ 天后结算到您的账户",dayMsg];
+    NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:desc attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName:HexRGB(0x999999)}];
+    [attrs addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0f weight:UIFontWeightSemibold], NSForegroundColorAttributeName:HexRGB(0xFF4E19)} range:[desc rangeOfString:dayMsg]];
+    self.dayLabel.attributedText = attrs;
+}
+
+#pragma mark ----- text field delegate
 - (void)textFieldDidEndEditing:(UITextField *)textField {
     NSString *priceSetting = textField.text;
     if (![NSString isEmptyString:priceSetting]) {
@@ -202,6 +219,16 @@
         }
     }
     self.price = textField.text;
+    [self evaluatePriceWithMsg];
+}
+
+- (void)evaluatePriceWithMsg {
+    double arriveM = [self.price integerValue] * (1 - self.feeRate);
+    NSString *arriveMString = [NSString stringWithFormat:@"%.2f",arriveM];
+    NSString *desc = [NSString stringWithFormat:@"您的课程预计收入为:单课时 %@ 元/节",arriveMString];
+    NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:desc attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0f], NSForegroundColorAttributeName:HexRGB(0x999999)}];
+    [attrs addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0f weight:UIFontWeightSemibold], NSForegroundColorAttributeName:HexRGB(0xFF4E19)} range:[desc rangeOfString:arriveMString]];
+    self.priceLabel.attributedText = attrs;
 }
 
 /*

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/VIPProgramCreate/MineVipProgramMainView.xib

@@ -377,6 +377,7 @@
             <nil key="simulatedBottomBarMetrics"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
+                <outlet property="dayLabel" destination="8cf-Hr-8hz" id="FpT-hW-2lM"/>
                 <outlet property="durationContainer" destination="rxq-ZU-nkf" id="hl9-ZB-u7j"/>
                 <outlet property="durationContainerHeight" destination="ooA-7L-hHZ" id="ByT-lR-Val"/>
                 <outlet property="priceLabel" destination="Ob3-72-Iij" id="FCN-zb-51c"/>

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/VipCourse/MinePageVipProgramCell.m

@@ -53,6 +53,7 @@
     NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:descMsg attributes:@{NSFontAttributeName:[UIFont fontWithName:@"DIN Alternate Bold" size:14.0f],NSForegroundColorAttributeName:HexRGB(0xF44541)}];
     [attr addAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"DIN Alternate Bold" size:18.0f]} range:[descMsg rangeOfString:mountMsg]];
     self.priceLabel.attributedText = attr;
+    [self.subjectImage sd_setImageWithURL:[NSURL URLWithString:[model.subjectPic getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@""]];
 }
 
 - (IBAction)deleteProgram:(id)sender {

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/VipCourse/MinePageVipProgramCell.xib

@@ -19,7 +19,7 @@
                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nbw-m5-dtr">
                         <rect key="frame" x="14" y="0.0" width="292" height="74"/>
                         <subviews>
-                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lj2-cE-uvp">
+                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lj2-cE-uvp">
                                 <rect key="frame" x="12" y="12" width="50" height="50"/>
                                 <constraints>
                                     <constraint firstAttribute="width" secondItem="lj2-cE-uvp" secondAttribute="height" id="W1n-Cs-zAF"/>