Commit b5bec041 authored by Sandy's avatar Sandy

1.学习完成增加是否学习完成接口。2.列表页增加答题按钮

parent 6bbcfab2
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
三次重考机会 三次重考机会
*/ */
@property (nonatomic,assign) NSInteger retakeCount; @property (nonatomic,assign) NSInteger retakeCount;
@property (strong, nonatomic) TOStudyResultEntity *studyResult;
@end @end
...@@ -52,6 +53,7 @@ ...@@ -52,6 +53,7 @@
self.retakeCount = 3; self.retakeCount = 3;
[self getExaminationQuestions]; [self getExaminationQuestions];
[self httpGetAnswerId];
} }
#pragma mark - 获取考题 #pragma mark - 获取考题
...@@ -156,9 +158,9 @@ ...@@ -156,9 +158,9 @@
#pragma mark - 提交考核结果 #pragma mark - 提交考核结果
- (void)submitAnswer - (void)submitAnswer
{ {
TOStudyResultEntity *studyResult = [[TOStudyResultEntity alloc]init]; TOStudyResultEntity *studyResult = self.studyResult;
studyResult.taskId = self.taskId; // studyResult.taskId = self.taskId;
studyResult.employeeId = [Shoppersmanager manager].shoppers.employee.fid; // studyResult.employeeId = [Shoppersmanager manager].shoppers.employee.fid;
studyResult.submitTime = [[NSDate date] httpParameterString]; studyResult.submitTime = [[NSDate date] httpParameterString];
NSArray *answerArray = self.taskDetails.topics; NSArray *answerArray = self.taskDetails.topics;
NSMutableArray *submitAnswerArray = [NSMutableArray array]; NSMutableArray *submitAnswerArray = [NSMutableArray array];
...@@ -244,6 +246,17 @@ ...@@ -244,6 +246,17 @@
}]; }];
} }
- (void)httpGetAnswerId {
WS(weakSelf);
NSString *url = [NSString stringWithFormat:@"/study/startExam/%@/%@", self.taskId, [Shoppersmanager manager].shoppers.employee.fid];
[HTTP networkRequestWithURL:SERVERREQUESTURL(url) withRequestType:(GET) withParameter:nil withReturnValueBlock:^(id returnValue) {
NSLog(@"%@", returnValue);
weakSelf.studyResult = [[TOStudyResultEntity alloc] initWithDictionary:RESPONSE(returnValue) error:nil];
} withFailureBlock:^(NSError *error) {
}];
}
#pragma mark - 判断得分是否及格 #pragma mark - 判断得分是否及格
- (void)determineIsQualified:(NSInteger)allScore - (void)determineIsQualified:(NSInteger)allScore
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
#import "LearningCompleteViewController.h" #import "LearningCompleteViewController.h"
#import "AssessmentViewController.h" #import "AssessmentViewController.h"
@interface OnlineLearningDetailViewController ()<SelectStudyItemDelegate,VideoPlayerDelegate,BeginAssessmentDelegate,InspectionStateDelegate> @interface OnlineLearningDetailViewController ()<SelectStudyItemDelegate,VideoPlayerDelegate,BeginAssessmentDelegate,InspectionStateDelegate>
@property (nonatomic,strong) WYPopoverController *settingsPopoverController; @property (nonatomic,strong) WYPopoverController *settingsPopoverController;
@property (nonatomic, assign) BOOL isNotFirstIn;
@end @end
...@@ -31,9 +31,11 @@ ...@@ -31,9 +31,11 @@
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO; self.navigationController.interactivePopGestureRecognizer.enabled = NO;
} }
if (!self.isNotFirstIn) {
//播放进入选中的视频 //播放进入选中的视频
[self seleStudyItemCellIndex:self.interIndex]; self.isNotFirstIn = YES;
[self seleStudyItemCellIndex:self.interIndex];
}
} }
#pragma mark -视图即将消失 #pragma mark -视图即将消失
...@@ -195,6 +197,7 @@ ...@@ -195,6 +197,7 @@
pptVc.type = Study; pptVc.type = Study;
pptVc.indexPath = indexPath; pptVc.indexPath = indexPath;
videoVc.learningItem = nil; videoVc.learningItem = nil;
pptVc.studyId = studyList.fid;
[pptVc setScrollViewEndBottomBlock:^(NSIndexPath *indexPath){ [pptVc setScrollViewEndBottomBlock:^(NSIndexPath *indexPath){
[weakSelf dismissViewControllerAnimated:YES completion:^{ [weakSelf dismissViewControllerAnimated:YES completion:^{
[weakSelf videoPlayFinish:studyList withIndexPath:indexPath]; [weakSelf videoPlayFinish:studyList withIndexPath:indexPath];
...@@ -226,10 +229,21 @@ ...@@ -226,10 +229,21 @@
}]; }];
} }
#pragma mark - 学习完成,告诉服务器学习完成
- (void)httpStudyCompleteTaskId:(NSString *)taskId {
NSString *url = [NSString stringWithFormat:@"/study/finishStudy/%@/%@", taskId, [Shoppersmanager manager].shoppers.employee.fid];
[HTTP networkRequestWithURL:SERVERREQUESTURL(url) withRequestType:(GET) withParameter:nil withReturnValueBlock:^(id returnValue) {
NSLog(@"%@", returnValue);
} withFailureBlock:^(NSError *error) {
}];
}
#pragma mark - 视频播放完成 #pragma mark - 视频播放完成
- (void)videoPlayFinish:(CustomStudyEntity *)studyEntity withIndexPath:(NSIndexPath *)indexPath - (void)videoPlayFinish:(CustomStudyEntity *)studyEntity withIndexPath:(NSIndexPath *)indexPath
{ {
[self httpStudyCompleteTaskId:studyEntity.fid];
WS(weakSelf); WS(weakSelf);
[self studyFinishGetIntegral:^(NSString *integral) { [self studyFinishGetIntegral:^(NSString *integral) {
LearningCompleteViewController *assessmentVc = [[[weakSelf class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"LearningCompleteViewController"]; LearningCompleteViewController *assessmentVc = [[[weakSelf class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"LearningCompleteViewController"];
...@@ -299,6 +313,7 @@ ...@@ -299,6 +313,7 @@
videoWindow.playerLayer.frame = CGRectMake(0, 0, ScreenWidth*2/3, ScreenHeight/2); videoWindow.playerLayer.frame = CGRectMake(0, 0, ScreenWidth*2/3, ScreenHeight/2);
}completion:^(BOOL finished) { }completion:^(BOOL finished) {
[weakSelf assessment:studyEntity.fid withIndexPath:indexPath]; [weakSelf assessment:studyEntity.fid withIndexPath:indexPath];
}]; }];
}else { }else {
[weakSelf assessment:studyEntity.fid withIndexPath:indexPath]; [weakSelf assessment:studyEntity.fid withIndexPath:indexPath];
......
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
}else if (self.type == VideoViewTypeList){ }else if (self.type == VideoViewTypeList){
OnlineLearningDetailViewController *studyDetail = [[[self class] getLearningCenterStoryboardClass]instantiateViewControllerWithIdentifier:@"OnlineLearningDetailViewController"]; OnlineLearningDetailViewController *studyDetail = [[[self class] getLearningCenterStoryboardClass]instantiateViewControllerWithIdentifier:@"OnlineLearningDetailViewController"];
studyDetail.studyResult = self.studyTypeEntity; studyDetail.studyResult = self.studyTypeEntity;
studyDetail.interIndex = indexPath; studyDetail.interIndex = indexPath;
[self.navigationController pushViewController:studyDetail animated:YES]; [self.navigationController pushViewController:studyDetail animated:YES];
} }
......
...@@ -36,4 +36,9 @@ ...@@ -36,4 +36,9 @@
*/ */
@property (nonatomic,strong) CustomStudyEntity *model; @property (nonatomic,strong) CustomStudyEntity *model;
/**
开始答题按钮
*/
@property (weak, nonatomic) IBOutlet UIButton *btnStartAnswer;
@end @end
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import "PPTListItemTableViewCell.h" #import "PPTListItemTableViewCell.h"
#import "AssessmentViewController.h"
@implementation PPTListItemTableViewCell @implementation PPTListItemTableViewCell
- (void)awakeFromNib { - (void)awakeFromNib {
...@@ -20,11 +20,26 @@ ...@@ -20,11 +20,26 @@
{ {
_model = model; _model = model;
self.studyItemTitleLabel.text = _model.title; self.studyItemTitleLabel.text = _model.title;
//考核状态 //考核状态
if ([BaseViewController isBlankString:_model.examResult] || [_model.examResult isEqualToString:@"0"]) { if ([BaseViewController isBlankString:_model.examResult] || [_model.examResult isEqualToString:@"0"]) {
self.examResultImageView.hidden = YES; self.examResultImageView.hidden = YES;
if (model.studyComplete == nil || !model.hasStudyTopic) {
self.btnStartAnswer.hidden = YES;
}else{
self.btnStartAnswer.hidden = NO;
}
}else { }else {
self.examResultImageView.hidden = NO; self.examResultImageView.hidden = NO;
self.btnStartAnswer.hidden = YES;
} }
} }
- (IBAction)actionStartAnswer:(id)sender {
AssessmentViewController *assessmentVc = [[AssessmentViewController getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"AssessmentViewController"];
assessmentVc.taskId = _model.fid;
// assessmentVc.indexPath = indexPath;
// assessmentVc.delegate = weakSelf;
[self.viewController.navigationController pushViewController:assessmentVc animated:YES];
}
@end @end
...@@ -47,5 +47,9 @@ ...@@ -47,5 +47,9 @@
*/ */
@property (weak, nonatomic) IBOutlet UIImageView *examResultImageView; @property (weak, nonatomic) IBOutlet UIImageView *examResultImageView;
/**
开始答题按钮
*/
@property (weak, nonatomic) IBOutlet UIButton *btnStartAnswer;
@end @end
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import "VideoListItemTableViewCell.h" #import "VideoListItemTableViewCell.h"
#import "AssessmentViewController.h"
@implementation VideoListItemTableViewCell @implementation VideoListItemTableViewCell
- (void)awakeFromNib { - (void)awakeFromNib {
...@@ -32,9 +32,23 @@ ...@@ -32,9 +32,23 @@
//考核状态 //考核状态
if ([BaseViewController isBlankString:_model.examResult] || [_model.examResult isEqualToString:@"0"]) { if ([BaseViewController isBlankString:_model.examResult] || [_model.examResult isEqualToString:@"0"]) {
self.examResultImageView.hidden = YES; self.examResultImageView.hidden = YES;
if (model.studyComplete == nil || !model.hasStudyTopic) {
self.btnStartAnswer.hidden = YES;
}else{
self.btnStartAnswer.hidden = NO;
}
}else { }else {
self.examResultImageView.hidden = NO; self.examResultImageView.hidden = NO;
self.btnStartAnswer.hidden = YES;
} }
} }
- (IBAction)actionStartAnswer:(id)sender {
AssessmentViewController *assessmentVc = [[AssessmentViewController getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"AssessmentViewController"];
assessmentVc.taskId = _model.fid;
// assessmentVc.indexPath = indexPath;
// assessmentVc.delegate = weakSelf;
[self.viewController.navigationController pushViewController:assessmentVc animated:YES];
}
@end @end
This diff is collapsed.
...@@ -96,7 +96,7 @@ typedef NS_ENUM(NSInteger,COMMENT_PRAISE) { ...@@ -96,7 +96,7 @@ typedef NS_ENUM(NSInteger,COMMENT_PRAISE) {
/** /**
* 服务器开发地址 * 服务器开发地址
*/ */
//#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://gomoredev:8082/opple-web/app%@",URL] #define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://gomoredev:8082/opple-web/app%@",URL]
//外网http://debenson.picp.io/opple-web/ //外网http://debenson.picp.io/opple-web/
...@@ -108,7 +108,7 @@ typedef NS_ENUM(NSInteger,COMMENT_PRAISE) { ...@@ -108,7 +108,7 @@ typedef NS_ENUM(NSInteger,COMMENT_PRAISE) {
//** //**
// * 服务器正式地址 // * 服务器正式地址
// */ // */
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg.opple.com/opple-web/app%@",URL] //#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg.opple.com/opple-web/app%@",URL]
/*****************************************接口地址*****************************************/ /*****************************************接口地址*****************************************/
......
...@@ -24,5 +24,10 @@ ...@@ -24,5 +24,10 @@
@param number 圆角系数 @param number 圆角系数
*/ */
- (void)setMyCorner:(CGFloat)number; - (void)setMyCorner:(CGFloat)number;
/**
* 获取view父视图的控制器
*
* @return 控制器
*/
- (UIViewController *)viewController;
@end @end
...@@ -73,5 +73,15 @@ ...@@ -73,5 +73,15 @@
self.layer.rasterizationScale = [UIScreen mainScreen].scale; self.layer.rasterizationScale = [UIScreen mainScreen].scale;
} }
- (UIViewController *)viewController
{
for (UIView *next = [self superview]; next; next = next.superview) {
UIResponder *nextResponder = [next nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]]) {
return (UIViewController *)nextResponder;
}
}
return nil;
}
@end @end
...@@ -4098,6 +4098,12 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -4098,6 +4098,12 @@ extern NSString * const GRADEMETHOD_MANUL;
* *
*/ */
@property (nonatomic, copy) NSString *examResult; @property (nonatomic, copy) NSString *examResult;
/**
* 是否学习完成
*
*
*/
@property (nonatomic, copy) NSString *studyComplete;
/** /**
* 学习内容 * 学习内容
* *
...@@ -4170,6 +4176,12 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -4170,6 +4176,12 @@ extern NSString * const GRADEMETHOD_MANUL;
* *
*/ */
@property (nonatomic, copy) NSString *studyCategory; @property (nonatomic, copy) NSString *studyCategory;
/**
* 分类id
*
*
*/
@property (nonatomic, assign) BOOL hasStudyTopic;
/** /**
* 分类标题 * 分类标题
* *
......
...@@ -1443,6 +1443,7 @@ NSString * const SORTDIRECTION_DESC = @"desc"; ...@@ -1443,6 +1443,7 @@ NSString * const SORTDIRECTION_DESC = @"desc";
@synthesize title; @synthesize title;
@synthesize typeName; @synthesize typeName;
@synthesize examResult; @synthesize examResult;
@synthesize studyComplete;
@synthesize content; @synthesize content;
@synthesize teacher; @synthesize teacher;
@synthesize teacherIntro; @synthesize teacherIntro;
...@@ -1455,6 +1456,7 @@ NSString * const SORTDIRECTION_DESC = @"desc"; ...@@ -1455,6 +1456,7 @@ NSString * const SORTDIRECTION_DESC = @"desc";
@synthesize topics; @synthesize topics;
@synthesize stateName; @synthesize stateName;
@synthesize studyCategory; @synthesize studyCategory;
@synthesize hasStudyTopic;
@synthesize categoryName; @synthesize categoryName;
+(BOOL)propertyIsOptional:(NSString*)propertyName +(BOOL)propertyIsOptional:(NSString*)propertyName
......
...@@ -54,6 +54,7 @@ typedef NS_ENUM(NSInteger,CALL_TYPE) { ...@@ -54,6 +54,7 @@ typedef NS_ENUM(NSInteger,CALL_TYPE) {
学习项下标 学习项下标
*/ */
@property (nonatomic,strong) NSIndexPath *indexPath; @property (nonatomic,strong) NSIndexPath *indexPath;
@property (strong, nonatomic) NSString *studyId;
@end @end
...@@ -189,11 +189,13 @@ ...@@ -189,11 +189,13 @@
#pragma mark - <UIScrollViewDelegate> #pragma mark - <UIScrollViewDelegate>
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{ {
CGFloat height = scrollView.frame.size.height; CGFloat height = scrollView.frame.size.height;
CGFloat contentYoffset = scrollView.contentOffset.y; CGFloat contentYoffset = scrollView.contentOffset.y;
CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset; CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset;
WS(weakSelf); WS(weakSelf);
if (distanceFromBottom <= height && self.type == Study) { if (distanceFromBottom <= height && self.type == Study) {
[self httpStudyCompleteTaskId:self.studyId];
ShowDefaultAlertView(self, nil, @"学习完成,是否开始考核?", UIAlertControllerStyleAlert, ^{ ShowDefaultAlertView(self, nil, @"学习完成,是否开始考核?", UIAlertControllerStyleAlert, ^{
if (weakSelf.scrollViewEndBottomBlock) { if (weakSelf.scrollViewEndBottomBlock) {
weakSelf.scrollViewEndBottomBlock(weakSelf.indexPath); weakSelf.scrollViewEndBottomBlock(weakSelf.indexPath);
...@@ -202,7 +204,15 @@ ...@@ -202,7 +204,15 @@
} }
} }
#pragma mark - 学习完成,告诉服务器学习完成
- (void)httpStudyCompleteTaskId:(NSString *)taskId {
NSString *url = [NSString stringWithFormat:@"/study/finishStudy/%@/%@", taskId, [Shoppersmanager manager].shoppers.employee.fid];
[HTTP networkRequestWithURL:SERVERREQUESTURL(url) withRequestType:(GET) withParameter:nil withReturnValueBlock:^(id returnValue) {
NSLog(@"%@", returnValue);
} withFailureBlock:^(NSError *error) {
}];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment