Commit b5bec041 authored by Sandy's avatar Sandy

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

parent 6bbcfab2
......@@ -21,6 +21,7 @@
三次重考机会
*/
@property (nonatomic,assign) NSInteger retakeCount;
@property (strong, nonatomic) TOStudyResultEntity *studyResult;
@end
......@@ -52,6 +53,7 @@
self.retakeCount = 3;
[self getExaminationQuestions];
[self httpGetAnswerId];
}
#pragma mark - 获取考题
......@@ -156,9 +158,9 @@
#pragma mark - 提交考核结果
- (void)submitAnswer
{
TOStudyResultEntity *studyResult = [[TOStudyResultEntity alloc]init];
studyResult.taskId = self.taskId;
studyResult.employeeId = [Shoppersmanager manager].shoppers.employee.fid;
TOStudyResultEntity *studyResult = self.studyResult;
// studyResult.taskId = self.taskId;
// studyResult.employeeId = [Shoppersmanager manager].shoppers.employee.fid;
studyResult.submitTime = [[NSDate date] httpParameterString];
NSArray *answerArray = self.taskDetails.topics;
NSMutableArray *submitAnswerArray = [NSMutableArray array];
......@@ -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 - 判断得分是否及格
- (void)determineIsQualified:(NSInteger)allScore
......
......@@ -13,10 +13,10 @@
#import "LearningCompleteViewController.h"
#import "AssessmentViewController.h"
@interface OnlineLearningDetailViewController ()<SelectStudyItemDelegate,VideoPlayerDelegate,BeginAssessmentDelegate,InspectionStateDelegate>
@property (nonatomic,strong) WYPopoverController *settingsPopoverController;
@property (nonatomic, assign) BOOL isNotFirstIn;
@end
......@@ -31,9 +31,11 @@
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
//播放进入选中的视频
[self seleStudyItemCellIndex:self.interIndex];
if (!self.isNotFirstIn) {
//播放进入选中的视频
self.isNotFirstIn = YES;
[self seleStudyItemCellIndex:self.interIndex];
}
}
#pragma mark -视图即将消失
......@@ -195,6 +197,7 @@
pptVc.type = Study;
pptVc.indexPath = indexPath;
videoVc.learningItem = nil;
pptVc.studyId = studyList.fid;
[pptVc setScrollViewEndBottomBlock:^(NSIndexPath *indexPath){
[weakSelf dismissViewControllerAnimated:YES completion:^{
[weakSelf videoPlayFinish:studyList withIndexPath:indexPath];
......@@ -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 - 视频播放完成
- (void)videoPlayFinish:(CustomStudyEntity *)studyEntity withIndexPath:(NSIndexPath *)indexPath
{
[self httpStudyCompleteTaskId:studyEntity.fid];
WS(weakSelf);
[self studyFinishGetIntegral:^(NSString *integral) {
LearningCompleteViewController *assessmentVc = [[[weakSelf class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"LearningCompleteViewController"];
......@@ -299,6 +313,7 @@
videoWindow.playerLayer.frame = CGRectMake(0, 0, ScreenWidth*2/3, ScreenHeight/2);
}completion:^(BOOL finished) {
[weakSelf assessment:studyEntity.fid withIndexPath:indexPath];
}];
}else {
[weakSelf assessment:studyEntity.fid withIndexPath:indexPath];
......
......@@ -169,7 +169,7 @@
}else if (self.type == VideoViewTypeList){
OnlineLearningDetailViewController *studyDetail = [[[self class] getLearningCenterStoryboardClass]instantiateViewControllerWithIdentifier:@"OnlineLearningDetailViewController"];
studyDetail.studyResult = self.studyTypeEntity;
studyDetail.interIndex = indexPath;
studyDetail.interIndex = indexPath;
[self.navigationController pushViewController:studyDetail animated:YES];
}
......
......@@ -36,4 +36,9 @@
*/
@property (nonatomic,strong) CustomStudyEntity *model;
/**
开始答题按钮
*/
@property (weak, nonatomic) IBOutlet UIButton *btnStartAnswer;
@end
......@@ -7,7 +7,7 @@
//
#import "PPTListItemTableViewCell.h"
#import "AssessmentViewController.h"
@implementation PPTListItemTableViewCell
- (void)awakeFromNib {
......@@ -20,11 +20,26 @@
{
_model = model;
self.studyItemTitleLabel.text = _model.title;
//考核状态
if ([BaseViewController isBlankString:_model.examResult] || [_model.examResult isEqualToString:@"0"]) {
self.examResultImageView.hidden = YES;
if (model.studyComplete == nil || !model.hasStudyTopic) {
self.btnStartAnswer.hidden = YES;
}else{
self.btnStartAnswer.hidden = NO;
}
}else {
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
......@@ -47,5 +47,9 @@
*/
@property (weak, nonatomic) IBOutlet UIImageView *examResultImageView;
/**
开始答题按钮
*/
@property (weak, nonatomic) IBOutlet UIButton *btnStartAnswer;
@end
......@@ -7,7 +7,7 @@
//
#import "VideoListItemTableViewCell.h"
#import "AssessmentViewController.h"
@implementation VideoListItemTableViewCell
- (void)awakeFromNib {
......@@ -32,9 +32,23 @@
//考核状态
if ([BaseViewController isBlankString:_model.examResult] || [_model.examResult isEqualToString:@"0"]) {
self.examResultImageView.hidden = YES;
if (model.studyComplete == nil || !model.hasStudyTopic) {
self.btnStartAnswer.hidden = YES;
}else{
self.btnStartAnswer.hidden = NO;
}
}else {
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
This diff is collapsed.
......@@ -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/
......@@ -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 @@
@param number 圆角系数
*/
- (void)setMyCorner:(CGFloat)number;
/**
* 获取view父视图的控制器
*
* @return 控制器
*/
- (UIViewController *)viewController;
@end
......@@ -73,5 +73,15 @@
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
......@@ -4098,6 +4098,12 @@ extern NSString * const GRADEMETHOD_MANUL;
*
*/
@property (nonatomic, copy) NSString *examResult;
/**
* 是否学习完成
*
*
*/
@property (nonatomic, copy) NSString *studyComplete;
/**
* 学习内容
*
......@@ -4170,6 +4176,12 @@ extern NSString * const GRADEMETHOD_MANUL;
*
*/
@property (nonatomic, copy) NSString *studyCategory;
/**
* 分类id
*
*
*/
@property (nonatomic, assign) BOOL hasStudyTopic;
/**
* 分类标题
*
......
......@@ -1443,6 +1443,7 @@ NSString * const SORTDIRECTION_DESC = @"desc";
@synthesize title;
@synthesize typeName;
@synthesize examResult;
@synthesize studyComplete;
@synthesize content;
@synthesize teacher;
@synthesize teacherIntro;
......@@ -1455,6 +1456,7 @@ NSString * const SORTDIRECTION_DESC = @"desc";
@synthesize topics;
@synthesize stateName;
@synthesize studyCategory;
@synthesize hasStudyTopic;
@synthesize categoryName;
+(BOOL)propertyIsOptional:(NSString*)propertyName
......
......@@ -54,6 +54,7 @@ typedef NS_ENUM(NSInteger,CALL_TYPE) {
学习项下标
*/
@property (nonatomic,strong) NSIndexPath *indexPath;
@property (strong, nonatomic) NSString *studyId;
@end
......@@ -189,11 +189,13 @@
#pragma mark - <UIScrollViewDelegate>
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
CGFloat height = scrollView.frame.size.height;
CGFloat contentYoffset = scrollView.contentOffset.y;
CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset;
WS(weakSelf);
if (distanceFromBottom <= height && self.type == Study) {
[self httpStudyCompleteTaskId:self.studyId];
ShowDefaultAlertView(self, nil, @"学习完成,是否开始考核?", UIAlertControllerStyleAlert, ^{
if (weakSelf.scrollViewEndBottomBlock) {
weakSelf.scrollViewEndBottomBlock(weakSelf.indexPath);
......@@ -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