Commit fbb0bbfe authored by 曹云霄's avatar 曹云霄

修改项说明:学习积分控制,优化相册权限,区分精华帖

parent 61bfff8b
......@@ -32,6 +32,11 @@
*/
@property (nonatomic,strong) TOAfficheEntity *afficheEntity;
/**
是否已读
*/
@property (weak, nonatomic) IBOutlet UIImageView *isReadImageview;
@end
......@@ -175,7 +175,8 @@
- (void)getAnnouncementDatas:(BOOL)isRemove
{
WS(weakSelf);
[XBLoadingView showHUDViewWithDefault];;
[XBLoadingView showHUDViewWithDefault];
NSLog(@"%@",[self.afficheModel toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(AFFICHELIST) WithRequestType:ZERO WithParameter:self.afficheModel WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
......@@ -194,6 +195,7 @@
} WithFailureBlock:^(NSError *error) {
[weakSelf endRefreshingForTableView:weakSelf.announcementTableView];
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -202,7 +204,9 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
AnnouncementTableViewCell *announcementCell = [tableView dequeueReusableCellWithIdentifier:@"AnnouncementTableViewCell" forIndexPath:indexPath];
announcementCell.afficheEntity = self.afficheArray[indexPath.row];
TOAfficheEntity *entity = self.afficheArray[indexPath.row];
announcementCell.afficheEntity = entity;
announcementCell.isReadImageview.hidden = entity.readed;
return announcementCell;
}
......@@ -215,8 +219,13 @@
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
AnnountcementDetailViewController *detail = [[[self class] getAnnouncementStoryboardClass]instantiateViewControllerWithIdentifier:@"AnnountcementDetailViewController"];
TOAfficheEntity *entity = self.afficheArray[indexPath.row];
detail.announcementID = entity.fid;
detail.announcementEntity = self.afficheArray[indexPath.row];
WS(weakSelf);
[detail setReadBlock:^{
TOAfficheEntity *entity = weakSelf.afficheArray[indexPath.row];
entity.readed = YES;
[weakSelf.announcementTableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}];
[self.navigationController pushViewController:detail animated:YES];
}
......@@ -230,7 +239,9 @@
page.rows = KROWS;
_afficheModel.page = page;
_afficheModel.dayCountEquals = 20;
// _afficheModel.userIdEquals = [Shoppersmanager manager].Shoppers.employee.fid;
_afficheModel.sort = @"createDate";
_afficheModel.order = SORTDIRECTION_ASC;
_afficheModel.userIdEquals = [Shoppersmanager manager].Shoppers.employee.fid;
}
return _afficheModel;
}
......
......@@ -14,8 +14,13 @@
@property (weak, nonatomic) IBOutlet UITableView *announcementDetailsTableView;
/**
公告ID
公告
*/
@property (nonatomic,copy) NSString *announcementID;
@property (nonatomic,strong) TOAfficheEntity *announcementEntity;
/**
已读
*/
@property (nonatomic,copy) void(^readBlock)();
@end
......@@ -100,7 +100,7 @@
{
WS(weakSelf);
[XBLoadingView showHUDViewWithDefault];;
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(AFFICHEdETAILS),self.announcementID] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(AFFICHEdETAILS),self.announcementEntity.fid] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
......@@ -108,11 +108,35 @@
WkWebViewViewController *webView = [weakSelf.childViewControllers firstObject];
webView.htmlString = weakSelf.afficheResult.content;
[weakSelf setUpTableViewHeaderView:weakSelf.afficheResult];
if (!weakSelf.announcementEntity.readed) {
[weakSelf announcementRead];
}
}else {
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
[weakSelf.announcementDetailsTableView reloadData];
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
#pragma mark - 公告已读
- (void)announcementRead
{
WS(weakSelf);
NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(READANNOUNCEMENT),self.announcementEntity.fid,[Shoppersmanager manager].Shoppers.employee.departid,[Shoppersmanager manager].Shoppers.employee.fid,[[NSDate date] httpParameterString]];
url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:url WithRequestType:ZERO WithParameter:nil WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (weakSelf.readBlock) {
weakSelf.readBlock();
}
}else {
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
......
......@@ -29,6 +29,8 @@
color = RGB(0, 127, 210, 1);
}else if ([customText isEqualToString:@"活动公告"]) {
color = RGB(241, 171, 0, 1);
}else if ([customText isEqualToString:@"精华帖"]) {
color = [UIColor redColor];
}
self.layer.masksToBounds = YES;
self.layer.borderWidth = 1.0f;
......
......@@ -60,6 +60,7 @@
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:@"加载失败"];
}
......
......@@ -147,6 +147,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -117,6 +117,7 @@
}
}WithFailureBlock:^(NSError *error) {
[weakSelf endRefreshingForTableView:weakSelf.beenUseCardCollectionView];
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -135,6 +136,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -135,6 +135,7 @@
}
}WithFailureBlock:^(NSError *error) {
[weakSelf endRefreshingForTableView:weakSelf.dontUseCardCollectionView];
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -256,6 +257,7 @@
progressView.progress = progress;
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -278,6 +280,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -110,6 +110,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -198,6 +198,7 @@
}
}WithFailureBlock:^(NSError *error) {
[weakSelf endRefreshingForTableView:weakSelf.informationTableview];
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -429,6 +430,7 @@
progressView.progress = progress;
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -453,6 +455,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -40,7 +40,7 @@
self.integralDetailsTableView.rowHeight = (self.cellType == PrizeTableView)?90:70;
self.integralDetailsTableView.tableFooterView = [UIView new];
if (self.cellType == PrizeTableView) {
self.topConstraint.constant = 24;
self.topConstraint.constant = NavigationHeight;
self.integralDetailsTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.integralDetailsTableView.backgroundColor = RGB(237, 238, 239, 1);
}
......@@ -121,6 +121,7 @@
}WithFailureBlock:^(NSError *error) {
[weakSelf endRefreshingForTableView:weakSelf.integralDetailsTableView];
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -150,6 +151,7 @@
} WithFailureBlock:^(NSError *error) {
[weakSelf endRefreshingForTableView:weakSelf.integralDetailsTableView];
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -61,7 +61,7 @@
{
if ([self.delegate respondsToSelector:@selector(tapClickAction:withReplyId:withIndexPath:)]) {
UIButton *button = [self viewWithTag:100];
[self.delegate tapClickAction:button.isSelected withReplyId:self.replyId withIndexPath:self.indexPath];
[self.delegate tapClickAction:!button.isSelected withReplyId:self.replyId withIndexPath:self.indexPath];
}
}
......
......@@ -24,8 +24,8 @@
#pragma mark - 选项按钮
- (IBAction)extensionButtonClickAction:(UIButton *)sender {
if (self.bestView.width) {
self.bestView.hidden = NO;
if (self.bestView.width != 0) {
[UIView animateWithDuration:0.2 animations:^{
self.bestView.width = 0;
self.bestView.x = self.optionButton.x;
......
......@@ -86,7 +86,7 @@
[super viewDidLoad];
[self uiConfigAction];
[self getPostDetailAction];
[self getPostDetailAction:NO];
}
#pragma mark - UI
......@@ -100,15 +100,17 @@
}
#pragma mark - 获取回复列表
- (void)getPostDetailAction
- (void)getPostDetailAction:(BOOL)isRemove
{
WS(weakSelf);
[XBLoadingView showHUDViewWithDefault];
NSLog(@"%@",[self.condition toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(POSTDETAIL) WithRequestType:ZERO WithParameter:self.condition WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (isRemove) {
[weakSelf.commentsArray removeAllObjects];
}
weakSelf.topicReply = [[ForumReplyResponse alloc] initWithDictionary:returnValue[@"data"] error:nil];
[weakSelf.commentsArray addObjectsFromArray:weakSelf.topicReply.forumReplyEntity];
[weakSelf setUpCommentNumber];
......@@ -118,6 +120,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -140,6 +143,7 @@
[self.tableViewHeaderView addSubview:photoManager.view];
self.tableViewHeaderView.height = attachment + self.topicDetail.contentHeight + self.contentLabel.top + 20;
photoManager.view.frame = CGRectMake(self.contentLabel.left, self.topicDetail.contentHeight+10+self.contentLabel.top, self.contentLabel.width, attachment);
self.delectButton.hidden = ![self.topicDetail.posterId isEqualToString:[Shoppersmanager manager].Shoppers.employee.fid];
self.forumDetailTableView.tableHeaderView = self.tableViewHeaderView;
}
......@@ -147,6 +151,7 @@
- (void)setUpCommentNumber
{
self.commentNumberLabel.text = [NSString stringWithFormat:@"已有%ld条评论",self.commentsArray.count];
self.praiseButton.selected = self.topicDetail.canLike;
}
#pragma mark - <UITableViewDelegate,UITableViewDataSource>
......@@ -156,6 +161,7 @@
commentCell.bestView.delegate = self;
commentCell.indexPath = indexPath;
commentCell.replyEntity = self.commentsArray[indexPath.row];
commentCell.optionButton.hidden = ![self.topicDetail.posterId isEqualToString:[Shoppersmanager manager].Shoppers.employee.fid];
return commentCell;
}
......@@ -174,7 +180,7 @@
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
CommentListTableViewCell *commentCell = (CommentListTableViewCell *)cell;
[commentCell.bestView removeFromSuperview];
commentCell.bestView.hidden = YES;
}
#pragma mark - 计算选中图片显示所需高度
......@@ -227,12 +233,15 @@
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
weakSelf.commentInputTextFieldView.text = nil;
[XBLoadingView showHUDViewWithSuccessText:@"评论成功" completeBlock:nil];
[XBLoadingView showHUDViewWithSuccessText:@"评论成功" completeBlock:^{
[weakSelf getPostDetailAction:YES];
}];
}else {
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -256,6 +265,7 @@
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -266,18 +276,19 @@
{
WS(weakSelf);
[XBLoadingView showHUDViewWithDefault];
NSLog(@"%@",[NSString stringWithFormat:SERVERREQUESTURL(BASEREPLY),self.topicDetail.fid,replyId,isBest]);
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(BASEREPLY),self.topicDetail.fid,replyId,isBest] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
NSLog(@"%@",[NSString stringWithFormat:SERVERREQUESTURL(BASEREPLY),self.topicDetail.fid,replyId,isBest?@"true":@"false"]);
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(BASEREPLY),self.topicDetail.fid,replyId,isBest?@"true":@"false"] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
CustomTOForumReplyEntity *entity = [weakSelf.commentsArray objectAtIndex_opple:indexPath.row];
entity.best = !isBest;
entity.best = isBest;
[weakSelf.forumDetailTableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
}else {
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -286,7 +297,7 @@
- (IBAction)praiseButtonClickAction:(UIButton *)sender {
[XBLoadingView showHUDViewWithDefault];
NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(PRAISE),self.topicDetail.fid,!sender.selected];
NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(PRAISE),self.topicDetail.fid,!sender.selected?@"true":@"false"];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:url WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
......@@ -296,6 +307,7 @@
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -116,6 +116,7 @@
}
[weakSelf.classificationListTableView reloadData];
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -36,6 +36,11 @@
*/
@property (weak, nonatomic) IBOutlet UILabel *commentsNumberLabel;
/**
是否是精华帖
*/
@property (weak, nonatomic) IBOutlet CustomBorderLabel *isElitePostLabel;
/**
赞数量
*/
......
......@@ -19,6 +19,7 @@
{
_topicEntity = topicEntity;
if (_topicEntity) {
self.isElitePostLabel.hidden = !_topicEntity.bestTopic;
self.titleLabel.text = _topicEntity.title;
self.contentLabel.text = _topicEntity.content;
self.nameAndDateLabel.text = [NSString stringWithFormat:@"%@: %@ %@",_topicEntity.posterPosition,_topicEntity.posterRealName,_topicEntity.postTime];
......
......@@ -48,6 +48,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -152,6 +152,11 @@
self.publishTableView.tableFooterView = [UIView new];
[self.categoryImageView sd_setImageWithURL:[NSURL URLWithString:self.category.attachment.fileUrl] placeholderImage:REPLACEIMAGE];
self.categoryTitleLabel.text = self.category.name;
if (![[self class] determinePhotosPermissions]) {
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:@"请在iPad的“设置-隐私-相册”选项中,允许欧立方访问你的相册" preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleCancel handler:nil]];
[self presentViewController:alertVC animated:YES completion:nil];
}
}
#pragma mark - 图片管理
......@@ -409,6 +414,7 @@
}
return nil;
} error:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -458,6 +464,7 @@
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -77,6 +77,7 @@
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -67,6 +67,7 @@
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -155,6 +156,7 @@
TOStudyResultEntity *studyResult = [[TOStudyResultEntity alloc]init];
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];
NSInteger allScore = 0;//总分
......@@ -227,6 +229,7 @@
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -266,6 +269,7 @@
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -21,6 +21,12 @@
*/
@property (nonatomic,assign) CGFloat teacherIntroHeight;
/**
视频长度
*/
@property (nonatomic,copy) NSString * videoLength;
@end
......@@ -7,14 +7,14 @@
//
#import "CustomStudyEntity.h"
#import <AVFoundation/AVFoundation.h>
@implementation CustomStudyEntity
- (CGFloat)contentHeight
{
if (!_contentHeight) {
_contentHeight = [self calculateStudyIntroductionHeight:self.content]+78;
_contentHeight = [self calculateStudyIntroductionHeight:self.content]+74;
}
return _contentHeight;
}
......@@ -22,11 +22,43 @@
- (CGFloat)teacherIntroHeight
{
if (!_teacherIntroHeight) {
_teacherIntroHeight = [self calculateStudyIntroductionHeight:self.teacherIntro]+108;
_teacherIntroHeight = [self calculateStudyIntroductionHeight:self.teacherIntro]+106;
}
return _teacherIntroHeight;
}
- (NSString *)videoLength
{
if (!_videoLength) {
_videoLength = [self calculateVideoLength];
}
return _videoLength;
}
#pragma mark - 计算视频长度
- (NSString *)calculateVideoLength
{
if ([self.attachment.fileUrl rangeOfString:@".mp4"].location != NSNotFound) {
NSURL *movieURL = [NSURL URLWithString:self.attachment.fileUrl];
NSDictionary *opts = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO]
forKey:AVURLAssetPreferPreciseDurationAndTimingKey];
AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:movieURL options:opts]; // 初始化视频媒体文件
NSInteger interval = urlAsset.duration.value / urlAsset.duration.timescale; // 获取视频总时长,单位秒
NSUInteger secondPerDay = 24 * 60 * 60;
NSUInteger secondPerHour = 60 * 60;
NSUInteger secondPerMinute = 60;
// 剩余小时不应该大于24小时,所以应该先除去满足一天的秒数,再计算还剩下多少小时
NSInteger hour = interval % secondPerDay / secondPerHour;
// 剩余分钟数与上面同理
NSInteger minute = interval % secondPerHour / secondPerMinute;
// 剩余秒数直接等于秒数对每分钟秒数所取的余数
NSInteger second = interval % secondPerMinute;
return [NSString stringWithFormat:@"%02zd:%02zd:%02zd", hour, minute, second];
}
return nil;
}
#pragma mark - 计算高度
- (CGFloat)calculateStudyIntroductionHeight:(NSString *)content
......
......@@ -30,4 +30,10 @@
*/
@property (nonatomic,strong) CustomStudyEntity *studyEntity;
/**
积分
*/
@property (nonatomic,assign) NSString *integralString;
@end
......@@ -17,6 +17,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.obtainIntegralLabel.text = [NSString stringWithFormat:@"+%@",_integralString];
}
#pragma mark - 开始考核
......@@ -25,7 +26,6 @@
if ([self.delegate respondsToSelector:@selector(beginAssessment:)]) {
[self.delegate beginAssessment:self.studyEntity];
}
}
@end
......@@ -121,6 +121,7 @@
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -130,7 +131,7 @@
{
VideoDetailViewController *studyDetailVc = [self.childViewControllers lastObject];
studyDetailVc.indexPath = indexPath;
WS(weakSelf);
VideoHelperViewController *videoVc = [self.childViewControllers firstObject];
RsStudyTask *studyEntity = self.studyResult.studyEntity[indexPath.section];
CustomStudyEntity *studyList = studyEntity.studyTasks[indexPath.row];
......@@ -142,6 +143,11 @@
[videoVc resetPlayer];
CustomWKWebViewController *pdfvc = [[CustomWKWebViewController alloc]init];
pdfvc.urlString = studyList.attachment.fileUrl;
[pdfvc setScrollViewEndBottomBlock:^{
[weakSelf dismissViewControllerAnimated:YES completion:^{
[weakSelf videoPlayFinish:studyList];
}];
}];
[self presentViewController:pdfvc animated:YES completion:nil];
}
}
......@@ -149,17 +155,41 @@
#pragma mark - 视频播放完成
- (void)videoPlayFinish:(CustomStudyEntity *)studyEntity
{
LearningCompleteViewController *assessmentVc = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"LearningCompleteViewController"];
assessmentVc.delegate = self;
assessmentVc.studyEntity = studyEntity;
assessmentVc.preferredContentSize = CGSizeMake(520, 450);
self.settingsPopoverController = [[WYPopoverController alloc] initWithContentViewController:assessmentVc];
self.settingsPopoverController.wantsDefaultContentAppearance = NO;
self.settingsPopoverController.theme.fillBottomColor = [UIColor clearColor];
self.settingsPopoverController.theme.fillTopColor = [UIColor clearColor];
self.settingsPopoverController.theme.glossShadowColor = [UIColor clearColor];
[self.settingsPopoverController presentPopoverAsDialogAnimated:YES
options:WYPopoverAnimationOptionFadeWithScale];
WS(weakSelf);
[self studyFinishGetIntegral:^(NSString *integral) {
LearningCompleteViewController *assessmentVc = [[[weakSelf class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"LearningCompleteViewController"];
assessmentVc.delegate = weakSelf;
assessmentVc.studyEntity = studyEntity;
assessmentVc.integralString = integral;
assessmentVc.preferredContentSize = CGSizeMake(520, 450);
weakSelf.settingsPopoverController = [[WYPopoverController alloc] initWithContentViewController:assessmentVc];
weakSelf.settingsPopoverController.wantsDefaultContentAppearance = NO;
weakSelf.settingsPopoverController.theme.fillBottomColor = [UIColor clearColor];
weakSelf.settingsPopoverController.theme.fillTopColor = [UIColor clearColor];
weakSelf.settingsPopoverController.theme.glossShadowColor = [UIColor clearColor];
[weakSelf.settingsPopoverController presentPopoverAsDialogAnimated:YES
options:WYPopoverAnimationOptionFadeWithScale];
}];
}
#pragma mark - 学习完成获取积分
- (void)studyFinishGetIntegral:(void(^)(NSString *integral))getIntegral
{
[XBLoadingView showHUDViewWithDefault];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(GETINTEGRAL),@"finishStudyScore"] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (getIntegral) {
getIntegral(returnValue[@"data"][@"optionValue"]);
}
}else {
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
#pragma mark - 开始考核
......@@ -179,6 +209,12 @@
[weakSelf.navigationController pushViewController:assessmentVc animated:YES];
}];
}];
}else {
[self.settingsPopoverController dismissPopoverAnimated:YES completion:^{
AssessmentViewController *assessmentVc = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"AssessmentViewController"];
assessmentVc.taskId = studyEntity.fid;
[weakSelf.navigationController pushViewController:assessmentVc animated:YES];
}];
}
}
......
......@@ -54,6 +54,7 @@
[weakSelf.onlineLearningCollectionView reloadData];
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -34,6 +34,6 @@
/**
学习列表数据源
*/
@property (nonatomic,strong) TOStudyTaskEntity *model;
@property (nonatomic,strong) CustomStudyEntity *model;
@end
......@@ -13,12 +13,13 @@
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.studyItemLabel.hidden = YES;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
- (void)setModel:(CustomStudyEntity *)model
{
_model = model;
self.studyItemTitleLabel.text = _model.title;
}
@end
......@@ -37,18 +37,6 @@
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideOrShowNavigationBarAndToolBar)]];
}
#pragma mark -
- (void)judgeVideoOrPPT
{
NSURL *movieURL = [NSURL URLWithString:self.learningItem.attachment.fileUrl];
NSDictionary *opts = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO]
forKey:AVURLAssetPreferPreciseDurationAndTimingKey];
AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:movieURL options:opts]; // 初始化视频媒体文件
NSInteger second = 0;
second = urlAsset.duration.value / urlAsset.duration.timescale; // 获取视频总时长,单位秒
//NSLog(@"movie duration : %d", second);
NSLog(@"%ld",second);
}
#pragma mark - 播放地址
- (void)setLearningItem:(CustomStudyEntity *)learningItem
......@@ -72,10 +60,9 @@
if (configuration.progress >= 1.0) {
NSLog(@"缓存完成");
}
[XBLoadingView showHUDViewWithDefault];
[XBLoadingView showHUDViewWithDefaultWithView:self.view];
self.customPlayer = [[AVPlayer alloc] initWithPlayerItem:self.playerItem];
self.playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.customPlayer];
self.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
self.playerLayer.frame = CGRectMake(0, 0, ScreenWidth*2/3, ScreenHeight/2);
[self.view.layer insertSublayer:self.playerLayer atIndex:0];
//设置静音模式播放声音
......@@ -103,10 +90,11 @@
case AVPlayerStatusFailed:
self.bufferProgressView.progress = ZERO;
self.playButton.selected = YES;
[XBLoadingView hideHUDViewWithDefaultWithView:self.view];
[XBLoadingView showHUDViewWithText:@"播放失败"];
break;
case AVPlayerStatusReadyToPlay://正在播放
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView hideHUDViewWithDefaultWithView:self.view];
self.playItemTotalTimeLabel.text = [NSString stringWithFormat:@"/ %@",[self convertTime:CMTimeGetSeconds(self.playerItem.duration)]];
self.playButton.selected = NO;
break;
......@@ -115,7 +103,7 @@
}
}else if ([keyPath isEqualToString:@"loadedTimeRanges"]){//缓冲
NSTimeInterval timeInterval = [self availableDuration];// 计算缓冲进度
if (timeInterval > self.getCurrentPlayingTime+5){ // 缓存 大于 播放 当前时长+5
if (timeInterval > self.getCurrentPlayingTime+5 && !self.playButton.selected){ // 缓存 大于 播放 当前时长+5
[self.customPlayer play];
}
}
......@@ -204,7 +192,7 @@
#pragma mark - 退出播放
- (IBAction)exitPlayControllerButtonClick:(UIButton *)sender {
[self.customPlayer pause];
self.playButton.selected = NO;
self.playButton.selected = YES;
if (self.playerLayer.frame.size.height == ScreenHeight) {
if (self.zoomButtonClickBlock) {
self.zoomButtonClickBlock(NO);
......@@ -217,7 +205,9 @@
#pragma mark - 后退5秒
- (IBAction)backFiveSecondButtnClick:(UIButton *)sender {
[self.customPlayer seekToTime:CMTimeMake(5, 1)];
[self.customPlayer pause];
self.playButton.selected = YES;
[self.customPlayer seekToTime:CMTimeMake([self getCurrentPlayingTime]-5, 1) toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];
}
#pragma mark - 放大缩小按钮
......
......@@ -34,6 +34,6 @@
/**
学习列表数据源
*/
@property (nonatomic,strong) TOStudyTaskEntity *model;
@property (nonatomic,strong) CustomStudyEntity *model;
@end
......@@ -16,10 +16,11 @@
}
- (void)setModel:(TOStudyTaskEntity *)model
- (void)setModel:(CustomStudyEntity *)model
{
_model = model;
self.studyItemTitleLabel.text = _model.title;
self.studyItemTitleLabel.text = _model.title;
self.studyItemTimeLabel.text = _model.videoLength;
}
@end
......@@ -12,6 +12,11 @@
@optional
- (void)dismissController;
/**
闯关完成
*/
- (void)emigratedFinish;
@end
@interface AnswerViewController : BaseViewController
......@@ -24,4 +29,6 @@
*/
@property (nonatomic,copy) NSString *passLevelId;
@end
......@@ -54,6 +54,7 @@
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -161,7 +162,6 @@
NSMutableArray *submitAnswerArray = [NSMutableArray array];
//判断考核结果
NSInteger allScore = 0;//总分
studyResult.passResult = self.emigrated.passGrade > [studyResult.grade integerValue]?@"0":@"1";
for (CustomTOPassLevelTopicEntity *topicEntity in answerArray) {
TOPassLevelResultDetailEntity *resultEntity = [[TOPassLevelResultDetailEntity alloc] init];
......@@ -223,44 +223,52 @@
}
studyResult.details = (NSArray<TOPassLevelResultDetailEntity>*)submitAnswerArray;
studyResult.grade = [NSNumber numberWithFloat:allScore];
if ([[self class] isBlankString:studyResult.passResult]) {
studyResult.passResult = (self.emigrated.passGrade > allScore)?@"0":@"1";
}
[XBLoadingView showHUDViewWithDefault];
WS(weakSelf);
NSLog(@"%@",[studyResult toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(SUBMITEMIGRATEDANSWER) WithRequestType:ZERO WithParameter:studyResult WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[weakSelf determineIsQualified:[studyResult.grade integerValue] passResult:[studyResult.passResult integerValue]];
[weakSelf determineIsQualified:[studyResult.grade integerValue] passResult:studyResult.passResult];
if ([weakSelf.delegate respondsToSelector:@selector(emigratedFinish)]) {
[weakSelf.delegate emigratedFinish];
}
}else{
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
#pragma mark - 判断得分是否及格
- (void)determineIsQualified:(NSInteger)allScore passResult:(NSInteger)state
- (void)determineIsQualified:(NSInteger)allScore passResult:(NSString *)state
{
EmigratedFinishViewController *finish = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"EmigratedFinishViewController"];
finish.delegate = self;
finish.preferredContentSize = CGSizeMake(520, 400);
if (self.emigrated.passGrade > allScore) {
finish.state = state;
finish.state = ZERO;
finish.score = [NSString stringWithFormat:@"%ld",allScore];
[self showPopoverView:finish];
}else if ([state isEqualToString:@"2"]) {
finish.state = 2;
finish.score = [NSString stringWithFormat:@"%ld",allScore];
[self showPopoverView:finish];
}else {
WS(weakSelf);
[XBLoadingView showHUDViewWithDefault];
NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(GETINTEGRAL),@"passLevelScore"];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:url WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
finish.state = state;
finish.state = ONE;
finish.score = [NSString stringWithFormat:@"%ld",allScore];
finish.integral = [NSString stringWithFormat:@"+%@",returnValue[@"data"][@"optionValue"]];
[weakSelf showPopoverView:finish];
......@@ -270,6 +278,7 @@
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -35,7 +35,7 @@
NSRange range = NSMakeRange(5, [self.score length]);
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:range];
[attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Bold" size:35] range:range];
self.integralLabel.text = [NSString stringWithFormat:@"+%@",self.integral];
self.integralLabel.text = [NSString stringWithFormat:@"%@",self.integral];
self.emigratedResultLabel.attributedText = attributedString;
}
break;
......
......@@ -47,11 +47,13 @@
[XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
weakSelf.emigratedResponse = [[PassLevelResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
[weakSelf setUpEmigratedItem];
}else {
[XBLoadingView hideHUDViewWithDefault];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -59,6 +61,19 @@
#pragma mark - 开始
- (IBAction)beginButtonClickAction:(UIButton *)sender {
CGFloat width = 100;
CGFloat interval = 30;
self.throughHistoryBackScrollView.contentSize = CGSizeMake(self.emigratedResponse.passLevelEntity.count*width+(self.emigratedResponse.passLevelEntity.count-1)*interval, 0);
WS(weakSelf);
[UIView animateWithDuration:0.2 animations:^{
sender.alpha = 0;
weakSelf.throughHistoryBackScrollView.alpha = 1;
}];
}
#pragma mark - 设置闯关项
- (void)setUpEmigratedItem
{
CGFloat width = 100;
CGFloat height = 120;
CGFloat interval = 30;
......@@ -67,20 +82,14 @@
ThroughHistoryView *throughView = [ThroughHistoryView initializeView];
throughView.tag = i;
if ([[self class] isBlankString:entity.passResult]) {
[throughView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectApplicableAction:)]];
[throughView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectApplicableAction:)]];
}
throughView.titleLabel.text = entity.title;
throughView.endDateLabel.text = [[entity.endDate componentsSeparatedByString:@" "] firstObject];
throughView.frame = CGRectMake(i*width+i*interval, 0, width, height);
throughView.stateImageView.image = [self emigratedState:[entity.passResult integerValue]];
throughView.stateImageView.image = [self emigratedState:entity.passResult];
[self.throughHistoryBackScrollView addSubview:throughView];
}
self.throughHistoryBackScrollView.contentSize = CGSizeMake(self.emigratedResponse.passLevelEntity.count*width+(self.emigratedResponse.passLevelEntity.count-1)*interval, 0);
WS(weakSelf);
[UIView animateWithDuration:0.2 animations:^{
sender.alpha = 0;
weakSelf.throughHistoryBackScrollView.alpha = 1;
}];
}
#pragma mark - 选择相应的期数
......@@ -94,10 +103,17 @@
[self showPopoverView:answer];
}
#pragma mark ------- <DismissDelegate>
#pragma mark - 做题完成
- (void)dismissController
{
[self.popover dismissPopoverAnimated:YES];
[self.popover dismissPopoverAnimated:NO];
}
#pragma mark - 闯关完成
- (void)emigratedFinish
{
[self getThroughHistoryDatasAction];
}
#pragma mark - 闯关说明
......
......@@ -155,8 +155,7 @@
{
RightViewController *rightVC = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"RightViewController"];
rightVC.delegate = self;
UINavigationController *rightNav = [[UINavigationController alloc]initWithRootViewController:rightVC];
self.drawerController = [[MMDrawerController alloc]initWithCenterViewController:self.customtabbar rightDrawerViewController:rightNav];
self.drawerController = [[MMDrawerController alloc]initWithCenterViewController:self.customtabbar rightDrawerViewController:rightVC];
[self.drawerController setMaximumRightDrawerWidth:RightWidth];
[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
......@@ -219,6 +218,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -335,6 +335,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -424,8 +425,8 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView showHUDViewWithText:error.localizedDescription];
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -474,6 +475,7 @@
[weakSelf presentViewController:alertVC animated:YES completion:nil];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -96,6 +96,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -555,6 +555,7 @@ NSString *const PROMOTIONALSTRING = @"促销信息";
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -62,6 +62,7 @@
}
[weakSelf.prizeExchangeDetailsTableView reloadData];
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -27,7 +27,7 @@
CGFloat horizontalInterval = 300;
for (int i=0; i<_giftDetailsArray.count; i++) {
TOPrizeBillDetailsEntity *entity = _giftDetailsArray[i];
GiftInformationView *giftView = [[GiftInformationView alloc] initWithializeGiftView:entity.prize.picture withGiftName:entity.prize.name];
GiftInformationView *giftView = [[GiftInformationView alloc] initWithializeGiftView:entity.prize.attachment.fileUrl withGiftName:entity.prize.name];
giftView.frame = CGRectMake((i%2)*(itemHeight+horizontalInterval)+itemHeight/2, (i/2)*(itemHeight+tandemInterval)+tandemInterval, horizontalInterval, itemHeight);
[self.contentView addSubview:giftView];
}
......
......@@ -104,6 +104,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -157,6 +157,7 @@
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -186,6 +187,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -111,6 +111,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -217,6 +217,7 @@
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -108,18 +108,15 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self createHeaderview];
[self uiConfigAction];
}
#pragma mark -布局
- (void)uiConfigAction
{
self.rightTableview.delegate = self;
self.rightTableview.dataSource = self;
self.rightTableview.tableFooterView = [UIView new];
[self.rightTableview registerClass:[UITableViewCell class] forCellReuseIdentifier:@"rightcell"];
[self createHeaderview];
[self.rightTableview registerClass:[RightControlSectionView class] forHeaderFooterViewReuseIdentifier:@"RightControlSectionView"];
}
......@@ -139,9 +136,9 @@
[label setTextColor:[UIColor whiteColor]];
[navigationView addSubview:label];
label.textAlignment = NSTextAlignmentCenter;
[self.navigationController.navigationBar addSubview:navigationView];
//headerView
UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, RightWidth, 30)];
[self.view addSubview:navigationView];
UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, RightWidth, NavigationHeight)];
self.rightTableview.tableHeaderView = headerView;
}
......
......@@ -167,6 +167,7 @@
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -202,6 +202,7 @@
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -483,6 +484,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -153,6 +153,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -269,6 +269,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[weakSelf endRefreshingForTableView:weakSelf.shoppingTableview];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
......@@ -487,6 +488,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -559,6 +561,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -165,6 +165,7 @@
progressView.progress = progress;
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -459,6 +459,7 @@
295DEAC11DB786B8006ED4A6 /* CardDontUseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CardDontUseViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
295DEAC31DB786C6006ED4A6 /* CardBeenUseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardBeenUseViewController.h; sourceTree = "<group>"; };
295DEAC41DB786C6006ED4A6 /* CardBeenUseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CardBeenUseViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
2960EACC1E07DE1100107876 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
296287A01DF7DD230056FDC1 /* CustomTOStudyTopicEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomTOStudyTopicEntity.h; sourceTree = "<group>"; };
296287A11DF7DD230056FDC1 /* CustomTOStudyTopicEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomTOStudyTopicEntity.m; sourceTree = "<group>"; };
296287A31DF7E3020056FDC1 /* AssessmentShortAnswerTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssessmentShortAnswerTableViewCell.h; sourceTree = "<group>"; };
......@@ -2400,6 +2401,7 @@
4333C4B25549A396FC0CD944 /* Frameworks */ = {
isa = PBXGroup;
children = (
2960EACC1E07DE1100107876 /* CoreLocation.framework */,
2945FA811DFAC02F0066C55D /* Photos.framework */,
29702B471D72921600322196 /* AFNetworking.framework */,
29702B481D72921600322196 /* DZNEmptyDataSet.framework */,
......
......@@ -28,6 +28,10 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="品牌咨询" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uFh-Bz-DRu" customClass="CustomBorderLabel">
<constraints>
<constraint firstAttribute="width" constant="60" id="Q5Y-bG-ZaF"/>
<constraint firstAttribute="height" constant="20" id="mqd-Hx-Tb7"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......@@ -42,13 +46,16 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="new" translatesAutoresizingMaskIntoConstraints="NO" id="BYW-aT-dKb"/>
</subviews>
<constraints>
<constraint firstItem="vAA-od-PUc" firstAttribute="leading" secondItem="uFh-Bz-DRu" secondAttribute="trailing" constant="15" id="0Mg-3c-voT"/>
<constraint firstItem="cUg-l9-anJ" firstAttribute="centerY" secondItem="xVc-uc-PDl" secondAttribute="centerY" constant="12" id="3cA-9s-C3W"/>
<constraint firstItem="uFh-Bz-DRu" firstAttribute="centerY" secondItem="xVc-uc-PDl" secondAttribute="centerY" constant="-12" id="F63-yT-xZ9"/>
<constraint firstItem="BYW-aT-dKb" firstAttribute="centerY" secondItem="vAA-od-PUc" secondAttribute="centerY" id="Mab-nh-kQV"/>
<constraint firstItem="uFh-Bz-DRu" firstAttribute="leading" secondItem="xVc-uc-PDl" secondAttribute="leading" constant="30" id="OiS-2m-KgZ"/>
<constraint firstItem="vAA-od-PUc" firstAttribute="centerY" secondItem="uFh-Bz-DRu" secondAttribute="centerY" id="gkM-Tm-POO"/>
<constraint firstItem="BYW-aT-dKb" firstAttribute="leading" secondItem="vAA-od-PUc" secondAttribute="trailing" constant="10" id="q0T-Hj-pYL"/>
<constraint firstItem="cUg-l9-anJ" firstAttribute="leading" secondItem="uFh-Bz-DRu" secondAttribute="leading" id="qps-Gp-LAB"/>
</constraints>
</tableViewCellContentView>
......@@ -56,6 +63,7 @@
<outlet property="announcementTimeLabel" destination="cUg-l9-anJ" id="fFq-XM-k8W"/>
<outlet property="announcementTitleLabel" destination="vAA-od-PUc" id="FHX-jL-8ok"/>
<outlet property="announcementTypeLabel" destination="uFh-Bz-DRu" id="0Lb-wR-jeF"/>
<outlet property="isReadImageview" destination="BYW-aT-dKb" id="xiW-mE-Hj3"/>
</connections>
</tableViewCell>
</prototypes>
......@@ -94,7 +102,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="pOM-XN-SeP" firstAttribute="top" secondItem="dJk-hW-r6I" secondAttribute="bottom" id="8X0-qz-hL7"/>
<constraint firstItem="EHt-av-SPm" firstAttribute="top" secondItem="taf-UX-SPD" secondAttribute="bottom" constant="44" id="GIO-kz-l60"/>
<constraint firstItem="EHt-av-SPm" firstAttribute="top" secondItem="taf-UX-SPD" secondAttribute="bottom" constant="24" id="GIO-kz-l60"/>
<constraint firstItem="dJk-hW-r6I" firstAttribute="top" secondItem="EHt-av-SPm" secondAttribute="bottom" id="HDy-4a-8g8"/>
<constraint firstAttribute="trailing" secondItem="EHt-av-SPm" secondAttribute="trailing" id="Omx-pv-taK"/>
<constraint firstItem="dJk-hW-r6I" firstAttribute="leading" secondItem="K8I-7A-x3V" secondAttribute="leading" id="m6C-hd-f2m"/>
......@@ -127,7 +135,7 @@
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="67" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Nxo-16-vKa">
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="Fm8-gj-pKn">
<rect key="frame" x="0.0" y="0.0" width="768" height="80"/>
<rect key="frame" x="0.0" y="0.0" width="536" height="80"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="亚洲风格产品发布会" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="t4k-fa-t7j">
......@@ -136,6 +144,10 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="品牌资讯" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Ae-Oz-bjL" customClass="CustomBorderLabel">
<constraints>
<constraint firstAttribute="width" constant="60" id="7I8-X3-qWy"/>
<constraint firstAttribute="height" constant="20" id="At8-nH-Hlq"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......@@ -254,6 +266,7 @@
<resources>
<image name="asc" width="7" height="13"/>
<image name="desc" width="7" height="13"/>
<image name="new" width="29" height="19"/>
<image name="read" width="14" height="12"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
......
This diff is collapsed.
This diff is collapsed.
......@@ -51,6 +51,11 @@
*/
+ (BOOL)determineCameraPermissions;
/**
* 判断是否有相册权限
*/
+ (BOOL)determinePhotosPermissions;
/**
* 提示框
*
......@@ -137,7 +142,7 @@
@return 状态图片
*/
- (UIImage *)emigratedState:(NSInteger)passResult;
- (UIImage *)emigratedState:(NSString *)passResult;
@end
......@@ -10,7 +10,7 @@
#import "LoginViewController.h"
#import <WebKit/WebKit.h>
#import <AVFoundation/AVFoundation.h>
#import <Photos/Photos.h>
@interface BaseViewController ()<UIPrintInteractionControllerDelegate,UIWebViewDelegate,WKNavigationDelegate>
......@@ -58,7 +58,6 @@
[super viewDidLoad];
self.automaticallyAdjustsScrollViewInsets = NO;
self.navigationController.navigationBarHidden = YES;
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
{
[self prefersStatusBarHidden];
......@@ -167,6 +166,18 @@
}
}
#pragma mark - 判断相册的权限
+ (BOOL)determinePhotosPermissions
{
PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
if (status == PHAuthorizationStatusRestricted ||
status == PHAuthorizationStatusDenied) {
//无权限
return NO;
}
return YES;
}
#pragma mark - 考核题型转义
+ (NSString *)returnTopicTypeTitle:(NSString *)typeCode
{
......@@ -519,21 +530,14 @@
@return 状态图片
*/
- (UIImage *)emigratedState:(NSInteger)passResult
- (UIImage *)emigratedState:(NSString *)passResult
{
switch (passResult) {
case 0:
return TCImage(@"failure");
break;
case 1:
return TCImage(@"success");
break;
case 2:
return TCImage(@"submited");
break;
default:
break;
if ([passResult isEqualToString:@"0"]) {
return TCImage(@"failure");
}else if ([passResult isEqualToString:@"1"]) {
return TCImage(@"success");
}else if ([passResult isEqualToString:@"2"]) {
return TCImage(@"submited");
}
return nil;
}
......
......@@ -402,6 +402,11 @@ extern NSString *const DELETEPOST;
* 帖子详情
*/
extern NSString *const POSTDETAIL;
/**
* 公告已读
*/
extern NSString *const READANNOUNCEMENT;
/*****************************************接口地址*****************************************/
......
......@@ -380,12 +380,12 @@ NSString *const REPLYPOST = @"/forum/replyTopic";
/**
* 最佳回复、取消最佳回复
*/
NSString *const BASEREPLY = @"/forum/updateBestReply/%@/%@?best=%d";
NSString *const BASEREPLY = @"/forum/updateBestReply/%@/%@?best=%@";
/**
* 点赞、取消点赞
*/
NSString *const PRAISE = @"/forum/updateLikeTopic/%@?like=%d";
NSString *const PRAISE = @"/forum/updateLikeTopic/%@?like=%@";
/**
* 删除帖子
......@@ -396,6 +396,11 @@ NSString *const DELETEPOST = @"/forum/deleteTopic/%@";
* 帖子回复
*/
NSString *const POSTDETAIL = @"/forum/queryReply";
/**
* 公告已读
*/
NSString *const READANNOUNCEMENT = @"/affiche/read/%@?departId=%@&employee_id=%@&read_time=%@";
/*****************************************接口地址*****************************************/
......
......@@ -28,5 +28,10 @@
*/
@property (nonatomic,copy) void(^dismissLuckyDrawController)();
/**
滑动结束到底部
*/
@property (nonatomic,copy) void(^scrollViewEndBottomBlock)();
@end
......@@ -43,6 +43,7 @@
if (!_webView) {
_webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:self.config];
_webView.navigationDelegate = self;
_webView.scrollView.delegate = self;
[self.view insertSubview:_webView atIndex:0];
}
return _webView;
......@@ -79,40 +80,6 @@
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_urlString]]];
}
//#pragma mark - 加载PPT文件
//- (void)loadPPTfileAction
//{
// [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]];
// self.webView.scrollView.scrollEnabled = NO;
// self.webView.scrollView.pagingEnabled = YES;
// self.webView.scrollView.delegate = self;
// self.countdownLabel.text = @"10";
// [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode];
//}
//
//- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
//{
// NSLog(@" end %f",scrollView.contentOffset.y);
// [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode];
// self.countdownLabel.text = @"10";
// self.webView.scrollView.scrollEnabled = NO;
//}
//
//#pragma mark - 浏览PPT倒计时
//- (void)timerAction
//{
// NSInteger number = [self.countdownLabel.text integerValue];
// if (number <= 0) {
// self.webView.scrollView.scrollEnabled = YES;
// self.countdownLabel.text = @"请翻页";
// [self.timer invalidate];
// self.timer = nil;
// }else{
// number --;
// self.countdownLabel.text = [NSString stringWithFormat:@"%ld",number];
// }
//}
#pragma mark - 添加删除按钮
- (void)addDismissButton
{
......@@ -173,10 +140,27 @@
- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error
{
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:@"加载失败"];
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - <UIScrollViewDelegate>
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
CGFloat height = scrollView.frame.size.height;
CGFloat contentYoffset = scrollView.contentOffset.y;
CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset;
if (distanceFromBottom <= height) {
[self promptBoxWithMessage:@"学习完成,是否开始考核?" cancelBlock:nil sureBlock:^{
if (self.scrollViewEndBottomBlock) {
self.scrollViewEndBottomBlock();
}
}];
}
}
......
......@@ -80,6 +80,7 @@ static NetworkRequestClassManager *manager = nil;
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[[NSNotificationCenter defaultCenter] postNotificationName:LOGINTIMEOUT object:nil];
}else {
successBlock(responseObject);
......@@ -97,6 +98,7 @@ static NetworkRequestClassManager *manager = nil;
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[[NSNotificationCenter defaultCenter] postNotificationName:LOGINTIMEOUT object:nil];
}else{
successBlock(responseObject);
......@@ -133,6 +135,7 @@ static NetworkRequestClassManager *manager = nil;
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[[NSNotificationCenter defaultCenter] postNotificationName:LOGINTIMEOUT object:nil];
}else {
successBlock(responseObject);
......@@ -145,6 +148,7 @@ static NetworkRequestClassManager *manager = nil;
[manager GET:requestURLString parameters:parameter progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[[NSNotificationCenter defaultCenter] postNotificationName:LOGINTIMEOUT object:nil];
}else{
successBlock(responseObject);
......@@ -156,6 +160,7 @@ static NetworkRequestClassManager *manager = nil;
[manager DELETE:requestURLString parameters:parameter success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
//登陆超时
if ([responseObject[@"code"] isEqualToNumber:@1]) {
[XBLoadingView hideHUDViewWithDefault];
[[NSNotificationCenter defaultCenter] postNotificationName:LOGINTIMEOUT object:nil];
}else{
successBlock(responseObject);
......
......@@ -434,7 +434,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -524,7 +524,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[weakSelf endRefreshingForTableView:weakSelf.sceneOrProductClollectionView];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
......
......@@ -42,6 +42,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}else//分享商品
......@@ -68,6 +69,7 @@
progressView.progress = progress;
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -270,6 +270,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......@@ -316,6 +317,7 @@
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
}WithFailureBlock:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
......
......@@ -1573,6 +1573,9 @@ extern NSString * const GRADEMETHOD_MANUL;
*
*/
@property (nonatomic, copy) NSString *departId;
@property (nonatomic,assign) BOOL readed;
/**
* (no documentation provided)
* @see TOAttachmentEntity
......
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