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

Merge branch 'master' of https://git.oschina.net/gomore/Opple-iOS

parents a78c18b9 faa497b2
...@@ -57,4 +57,14 @@ ...@@ -57,4 +57,14 @@
*/ */
@property (nonatomic,strong) CustomTOForumReplyEntity *replyEntity; @property (nonatomic,strong) CustomTOForumReplyEntity *replyEntity;
/**
附件栏
*/
@property (weak, nonatomic) IBOutlet UIView *attachmentView;
/**
附件栏高度
*/
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutAttHeight;
@end @end
...@@ -7,7 +7,10 @@ ...@@ -7,7 +7,10 @@
// //
#import "CommentListTableViewCell.h" #import "CommentListTableViewCell.h"
#import "MWPhotoBrowser.h"
@interface CommentListTableViewCell ()<MWPhotoBrowserDelegate>
@property (nonatomic,strong) NSMutableArray *browserArray;
@end
@implementation CommentListTableViewCell @implementation CommentListTableViewCell
- (void)awakeFromNib { - (void)awakeFromNib {
...@@ -20,8 +23,50 @@ ...@@ -20,8 +23,50 @@
make.size.mas_equalTo(CGSizeMake(0, 30)); make.size.mas_equalTo(CGSizeMake(0, 30));
make.centerY.equalTo(self.optionButton); make.centerY.equalTo(self.optionButton);
}]; }];
for (UIImageView *obj in self.attachmentView.subviews) {
if ([obj isKindOfClass:[UIImageView class]]) {
obj.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImage:)];
[obj addGestureRecognizer:tap];
}
}
} }
- (void)tapImage:(UIGestureRecognizer *)tap {
if (tap.view.tag + 1 > self.replyEntity.attachments.count) {
return;
}
[self.browserArray removeAllObjects];
for (TOAttachmentEntity *att in self.replyEntity.attachments) {
MWPhoto *photo = [MWPhoto photoWithURL:[NSURL URLWithString:att.fileUrl]];
[self.browserArray addObject:photo];
}
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
[browser setCurrentPhotoIndex:tap.view.tag];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:browser];
[self.viewController.navigationController presentViewController:nav animated:YES completion:nil];
}
#pragma mark - <MWPhotoBrowserDelegate>
- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser
{
return self.browserArray.count;
}
- (id<MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index
{
if (index < self.browserArray.count) {
return [self.browserArray objectAtIndex:index];
}
return nil;
}
- (NSString *)photoBrowser:(MWPhotoBrowser *)photoBrowser titleForPhotoAtIndex:(NSUInteger)index
{
return [NSString stringWithFormat:@"%ld/%ld", index + 1, self.browserArray.count];
}
#pragma mark - 选项按钮 #pragma mark - 选项按钮
- (IBAction)extensionButtonClickAction:(UIButton *)sender { - (IBAction)extensionButtonClickAction:(UIButton *)sender {
if (self.bestView.width != 0) { if (self.bestView.width != 0) {
...@@ -49,6 +94,26 @@ ...@@ -49,6 +94,26 @@
self.bestView.isBest = _replyEntity.best; self.bestView.isBest = _replyEntity.best;
self.bestView.indexPath = self.indexPath; self.bestView.indexPath = self.indexPath;
self.baseImageView.hidden = !_replyEntity.best; self.baseImageView.hidden = !_replyEntity.best;
if (replyEntity.attachments.count > 0) {
self.layoutAttHeight.constant = 164;
}else{
self.layoutAttHeight.constant = 0;
}
for (NSInteger i = 0; i < replyEntity.attachments.count; i++) {
TOAttachmentEntity *att = replyEntity.attachments[i];
UIImageView *imgView = (UIImageView *)[self.attachmentView viewWithTag:i];
[imgView sd_setImageWithURL:[NSURL URLWithString:att.fileUrl] placeholderImage:REPLACEIMAGE];
}
}
#pragma mark - lazy
- (NSMutableArray *)browserArray
{
if (!_browserArray) {
_browserArray = [NSMutableArray array];
}
return _browserArray;
} }
@end @end
...@@ -13,13 +13,12 @@ ...@@ -13,13 +13,12 @@
- (void)awakeFromNib { - (void)awakeFromNib {
[super awakeFromNib]; [super awakeFromNib];
[self setUpToolView]; [self setUpToolView];
} }
#pragma mark - ToolView #pragma mark - ToolView
- (void)setUpToolView - (void)setUpToolView {
{
KeyBoardAccessoryView *toolView = [[KeyBoardAccessoryView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 44)]; KeyBoardAccessoryView *toolView = [[KeyBoardAccessoryView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 44)];
toolView.delegate = self; toolView.delegate = self;
self.contentTextView.inputAccessoryView = toolView; self.contentTextView.inputAccessoryView = toolView;
...@@ -27,45 +26,37 @@ ...@@ -27,45 +26,37 @@
} }
#pragma mark - Click #pragma mark - Click
- (void)extensionButtonClick:(UIButton *)sender - (void)extensionButtonClick:(UIButton *)sender {
{
switch (sender.tag) { switch (sender.tag) {
case Camera: case Camera: {
{
if ([self.delgate respondsToSelector:@selector(showCameraAction)]) { if ([self.delgate respondsToSelector:@selector(showCameraAction)]) {
[self.delgate showCameraAction]; [self.delgate showCameraAction];
} }
} } break;
break; case PhotoAlbum: {
case PhotoAlbum:
{
if ([self.delgate respondsToSelector:@selector(showPhotoAlbumAction)]) { if ([self.delgate respondsToSelector:@selector(showPhotoAlbumAction)]) {
[self.delgate showPhotoAlbumAction]; [self.delgate showPhotoAlbumAction];
} }
} } break;
break; case Emoji: {
case Emoji:
{
sender.selected = !sender.selected; sender.selected = !sender.selected;
if (sender.selected) { if (sender.selected) {
[[STEmojiKeyboard keyboard] setTextView:self.contentTextView]; [[STEmojiKeyboard keyboard] setTextView:self.contentTextView];
}else { } else {
[self.contentTextView setInputView:nil]; [self.contentTextView setInputView:nil];
} }
[self.contentTextView reloadInputViews]; [self.contentTextView reloadInputViews];
[self.contentTextView becomeFirstResponder]; [self.contentTextView becomeFirstResponder];
} } break;
break;
default: default:
break; break;
} }
} }
#pragma mark - <UITextViewDelegate> #pragma mark - <UITextViewDelegate>
- (void)textViewDidEndEditing:(UITextView *)textView - (void)textViewDidEndEditing:(UITextView *)textView {
{
self.heightConstraint.constant = [self calculateStudyIntroductionHeight:textView.text]; self.heightConstraint.constant = [self calculateStudyIntroductionHeight:textView.text];
if ([self.delgate respondsToSelector:@selector(refreshHeight:)]) { if ([self.delgate respondsToSelector:@selector(refreshHeight:)]) {
[self.delgate refreshHeight:self.contentTextView.height]; [self.delgate refreshHeight:self.contentTextView.height];
...@@ -73,22 +64,9 @@ ...@@ -73,22 +64,9 @@
} }
#pragma mark - 计算高度 #pragma mark - 计算高度
- (CGFloat)calculateStudyIntroductionHeight:(NSString *)content - (CGFloat)calculateStudyIntroductionHeight:(NSString *)content {
{ return [content heightWithFontSize:14 width:ScreenWidth - 40] + 20;
return [content heightWithFontSize:14 width:ScreenWidth-40]+20;
} }
@end @end
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
TOForumCategoryEntity *category = self.result.list[indexPath.row]; TOForumCategoryEntity *category = self.result.list[indexPath.row];
category.typeId = self.result.forumType.fid; category.typeId = self.result.forumType.fid;
itemListVc.category = category; itemListVc.category = category;
itemListVc.isPosting = [category.name isEqualToString:@"欧普问问"]?0:1; itemListVc.isPosting = [category.name isEqualToString:@"欧普问问"]?2:1;
[self.navigationController pushViewController:itemListVc animated:YES]; [self.navigationController pushViewController:itemListVc animated:YES];
} }
......
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
#import "WkWebViewViewController.h" #import "WkWebViewViewController.h"
#import "AnnouncementContentTableViewCell.h" #import "AnnouncementContentTableViewCell.h"
#import "ForumDetailPhotoTableViewCell.h" #import "ForumDetailPhotoTableViewCell.h"
#import "ZJKeyBoardAccessoryView.h"
#import "ForumDetailBottomView.h"
#import "OSSHelper.h"
#import "ForumCommentListViewModel.h"
#import "UIImage+Helper.h"
@interface ForumItemDetailViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,TapClickDelegate,ReturnTableviewcellIndexpathdelegate> @interface ForumItemDetailViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,TapClickDelegate,ReturnTableviewcellIndexpathdelegate>
...@@ -70,6 +74,13 @@ ...@@ -70,6 +74,13 @@
@property (nonatomic,strong) ForumReplyCondition *condition; @property (nonatomic,strong) ForumReplyCondition *condition;
/**
底部的view
*/
@property (weak, nonatomic) IBOutlet ForumDetailBottomView *bottomView;
@end @end
@implementation ForumItemDetailViewController @implementation ForumItemDetailViewController
...@@ -118,6 +129,10 @@ ...@@ -118,6 +129,10 @@
[self.forumDetailTableView registerClass:[ForumDetailPhotoTableViewCell class] forCellReuseIdentifier:@"ForumDetailPhotoTableViewCell"]; [self.forumDetailTableView registerClass:[ForumDetailPhotoTableViewCell class] forCellReuseIdentifier:@"ForumDetailPhotoTableViewCell"];
[self setUpHeaderView]; [self setUpHeaderView];
self.forumDetailTableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.forumDetailTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.commentInputTextFieldView.inputAccessoryView = self.bottomView.toolView;
} }
#pragma mark - WKWebView/photoManager #pragma mark - WKWebView/photoManager
...@@ -157,7 +172,12 @@ ...@@ -157,7 +172,12 @@
weakSelf.commentsArray = nil; weakSelf.commentsArray = nil;
} }
weakSelf.topicReply = [[ForumReplyResponse alloc] initWithDictionary:RESPONSE(returnValue) error:nil]; weakSelf.topicReply = [[ForumReplyResponse alloc] initWithDictionary:RESPONSE(returnValue) error:nil];
[weakSelf.commentsArray addObjectsFromArray:weakSelf.topicReply.forumReplyEntity]; for (CustomTOForumReplyEntity *entity in weakSelf.topicReply.forumReplyEntity) {
ForumCommentListViewModel *model = [ForumCommentListViewModel new];
model.replyEntity = entity;
[weakSelf.commentsArray addObject:model];
}
[weakSelf setUpCommentNumber]; [weakSelf setUpCommentNumber];
[weakSelf.forumDetailTableView reloadData]; [weakSelf.forumDetailTableView reloadData];
}else { }else {
...@@ -217,7 +237,8 @@ ...@@ -217,7 +237,8 @@
CommentListTableViewCell *commentCell = [tableView dequeueReusableCellWithIdentifier:@"CommentListTableViewCell" forIndexPath:indexPath]; CommentListTableViewCell *commentCell = [tableView dequeueReusableCellWithIdentifier:@"CommentListTableViewCell" forIndexPath:indexPath];
commentCell.bestView.delegate = self; commentCell.bestView.delegate = self;
commentCell.indexPath = indexPath; commentCell.indexPath = indexPath;
commentCell.replyEntity = self.commentsArray[indexPath.row]; ForumCommentListViewModel *cellModel = self.commentsArray[indexPath.row];
commentCell.replyEntity = cellModel.replyEntity;
BOOL boolValue = ([self.topicDetail.posterId isEqualToString:[Shoppersmanager manager].shoppers.employee.fid] && [self.category.name isEqualToString:OPPLE_ASK]); BOOL boolValue = ([self.topicDetail.posterId isEqualToString:[Shoppersmanager manager].shoppers.employee.fid] && [self.category.name isEqualToString:OPPLE_ASK]);
commentCell.optionButton.hidden = !boolValue; commentCell.optionButton.hidden = !boolValue;
return commentCell; return commentCell;
...@@ -243,9 +264,9 @@ ...@@ -243,9 +264,9 @@
} }
break; break;
} }
CustomTOForumReplyEntity *replyEntity = self.commentsArray[indexPath.row]; ForumCommentListViewModel *cellModel = self.commentsArray[indexPath.row];
//68为上边距 10为下边距 //68为上边距 10为下边距
return replyEntity.replyContentHeight + 68 + 10; return cellModel.height;
} }
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
...@@ -283,6 +304,8 @@ ...@@ -283,6 +304,8 @@
#pragma mark - 确认回复 #pragma mark - 确认回复
- (BOOL)textFieldShouldReturn:(UITextField *)textField - (BOOL)textFieldShouldReturn:(UITextField *)textField
{ {
[[UIApplication sharedApplication].keyWindow endEditing:YES];
if ([[self class] isBlankString:textField.text]) { if ([[self class] isBlankString:textField.text]) {
[XBLoadingView showHUDViewWithText:@"评论内容不能为空"]; [XBLoadingView showHUDViewWithText:@"评论内容不能为空"];
}else { }else {
...@@ -291,18 +314,91 @@ ...@@ -291,18 +314,91 @@
return YES; return YES;
} }
#pragma mark - 上传图片附件
- (void)uploadAttachments:(void(^)(NSArray *OSSKeys))finish
{
if (self.bottomView.toolView.arrSelectedPhotos.count == 0) {
finish(nil);
return;
}
NSMutableArray *OSSKeyArray = [NSMutableArray array];
for (int i=0; i<self.bottomView.toolView.arrSelectedPhotos.count; i++) {
[OSSKeyArray addObject:[OSSHelper getOSSObjectKeyWithtype:@"jpg" index:i]];
}
XBLoadingView *loadView = [XBLoadingView showHUDViewProgressLabel:[NSString stringWithFormat:@"图片上传中:1/%ld",self.bottomView.toolView.arrSelectedPhotos.count]];
static NSInteger number = 0;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
for (int i=0;i<self.bottomView.toolView.arrSelectedPhotos.count;i++) {
UIImage *image = self.bottomView.toolView.arrSelectedPhotos[i];
NSString *ossKey = OSSKeyArray[i];
UIImage *newSizeImage = [image scaledToWidth:1024];
NSData *data = [newSizeImage scaledToSpaceMaxSize:200];
[OSSHelper uploadImageObjectWithKey:ossKey data:data type:OSSHelperOperationTypeSynchronous progress:^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
CGFloat totalBytesSentFloat = totalBytesSent;
CGFloat totalBytesExpectedToSendFloat = totalBytesExpectedToSend;
CGFloat progress = totalBytesSentFloat / totalBytesExpectedToSendFloat;
NSLog(@"-->进度%f", progress);
loadView.progress = progress;
} success:^id(OSSTask *task) {
number ++;
loadView.labelText = [NSString stringWithFormat:@"图片上传中:%ld/%ld",number,self.self.bottomView.toolView.arrSelectedPhotos.count];
if (number == self.bottomView.toolView.arrSelectedPhotos.count) {
number = 0;
dispatch_async(dispatch_get_main_queue(), ^{
[loadView hide:YES];
[XBLoadingView showHUDViewWithSuccessText:@"图片上传成功" completeBlock:^{
finish(OSSKeyArray);
}];
});
}
return nil;
} error:^(NSError *error) {
[XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
});
}
#pragma mark - 回复帖子 #pragma mark - 回复帖子
- (void)replyPostRequest - (void)replyPostRequest
{ {
[self.view endEditing:YES]; WS(weakSelf);
TOForumReplyEntity *reply = [[TOForumReplyEntity alloc] init]; [self uploadAttachments:^(NSArray *OSSKeys) {
reply.topicId = self.topicDetail.fid; NSLog(@"%@", OSSKeys);
reply.replyContent = self.commentInputTextFieldView.text; TOForumReplyEntity *reply = [[TOForumReplyEntity alloc] init];
reply.replyerName = [Shoppersmanager manager].shoppers.employee.userName; reply.topicId = self.topicDetail.fid;
reply.replyerRealName = [Shoppersmanager manager].shoppers.employee.realName; reply.replyContent = self.commentInputTextFieldView.text;
reply.replyerPosition = [Shoppersmanager manager].shoppers.employee.positionsName; reply.replyerName = [Shoppersmanager manager].shoppers.employee.userName;
reply.replyTime = [[self class] getTimeby:0]; reply.replyerRealName = [Shoppersmanager manager].shoppers.employee.realName;
reply.replyerId = [Shoppersmanager manager].shoppers.employee.fid; reply.replyerPosition = [Shoppersmanager manager].shoppers.employee.positionsName;
reply.replyTime = [[self class] getTimeby:0];
reply.replyerId = [Shoppersmanager manager].shoppers.employee.fid;
NSMutableArray *attachments = [NSMutableArray array];
NSString *entityId = [OSSHelper getOSSObjectKey];
reply.attachmentId = entityId;
for (NSString *ossKey in OSSKeys) {
TOAttachmentEntity *entity = [[TOAttachmentEntity alloc] init];
entity.entityType = @"forumReply";
entity.entityId = entityId;
entity.fileUrl = [OSSHelper getCompleteImageURLWithOSSkey:ossKey];
entity.fileName = ossKey;
[attachments addObject:entity];
}
reply.attachments = (NSArray<TOAttachmentEntity>*)attachments;
[weakSelf httpSubmit:reply complete:nil];
}];
}
- (void)httpSubmit:(TOForumReplyEntity *)reply complete:(void (^)(void))complete {
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
WS(weakSelf); WS(weakSelf);
[HTTP networkRequestWithURL:SERVERREQUESTURL(REPLYPOST) withRequestType:ZERO withParameter:reply withReturnValueBlock:^(id returnValue) { [HTTP networkRequestWithURL:SERVERREQUESTURL(REPLYPOST) withRequestType:ZERO withParameter:reply withReturnValueBlock:^(id returnValue) {
...@@ -310,6 +406,7 @@ ...@@ -310,6 +406,7 @@
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
if (RESULT(returnValue)) { if (RESULT(returnValue)) {
weakSelf.commentInputTextFieldView.text = nil; weakSelf.commentInputTextFieldView.text = nil;
[weakSelf.bottomView clearPhoto];
[XBLoadingView showHUDViewWithSuccessText:@"评论成功" completeBlock:^{ [XBLoadingView showHUDViewWithSuccessText:@"评论成功" completeBlock:^{
if (weakSelf.refreshBlock) { if (weakSelf.refreshBlock) {
weakSelf.refreshBlock(ONE,Comment,weakSelf.indexPath); weakSelf.refreshBlock(ONE,Comment,weakSelf.indexPath);
......
//
// ForumCommentListViewModel.h
// Lighting
//
// Created by Javen on 2017/4/18.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ForumCommentListViewModel : NSObject
/**
回复数据源
*/
@property (nonatomic,strong) CustomTOForumReplyEntity *replyEntity;
@property (nonatomic, assign) CGFloat height;
@end
//
// ForumCommentListViewModel.m
// Lighting
//
// Created by Javen on 2017/4/18.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "ForumCommentListViewModel.h"
static UILabel *stringLabel = nil;
@implementation ForumCommentListViewModel
- (void)setReplyEntity:(CustomTOForumReplyEntity *)replyEntity {
_replyEntity = replyEntity;
self.height = 88;
if (replyEntity.attachments.count > 0) {
self.height = 88 + 164;
}
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ //生成一个用于计算文本高度的label
stringLabel = [[UILabel alloc] init];
stringLabel.font = [UIFont systemFontOfSize:17];
stringLabel.numberOfLines = 0;
});
stringLabel.text = replyEntity.replyContent;
self.height = self.height + [stringLabel sizeThatFits:CGSizeMake(ScreenWidth - 40, MAXFLOAT)].height + 16;
NSLog(@"%f", self.height);
}
@end
//
// ForumDetailBottomPictureCell.h
// Lighting
//
// Created by Javen on 2017/4/17.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ForumDetailBottomPictureCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (copy, nonatomic) void (^blockDelete)(void);
@end
//
// ForumDetailBottomPictureCell.m
// Lighting
//
// Created by Javen on 2017/4/17.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "ForumDetailBottomPictureCell.h"
@implementation ForumDetailBottomPictureCell
- (IBAction)actionDelete:(UIButton *)sender {
if (self.blockDelete) {
self.blockDelete();
}
}
@end
//
// ForumDetailBottomView.h
// Lighting
//
// Created by Javen on 2017/4/17.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ZJKeyBoardAccessoryView.h"
@interface ForumDetailBottomView : UIView<UICollectionViewDelegate, UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *layout;
/**
输入框toolbar
*/
@property (strong, nonatomic) ZJKeyBoardAccessoryView *toolView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutHeight;
- (void)clearPhoto;
@end
//
// ForumDetailBottomView.m
// Lighting
//
// Created by Javen on 2017/4/17.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "ForumDetailBottomView.h"
#import "ForumDetailBottomPictureCell.h"
@implementation ForumDetailBottomView
- (void)awakeFromNib {
[super awakeFromNib];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.layout.itemSize = CGSizeMake(64, 64);
self.layout.sectionInset = UIEdgeInsetsMake(0, 30, 0, 30);
self.toolView = [[ZJKeyBoardAccessoryView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 44)];
self.layoutHeight.constant = 50;
//结束选择照片 (删除照片时这里也会回调)
WS(weakSelf);
self.toolView.blockFinishSelected = ^{
[weakSelf.collectionView reloadData];
if (weakSelf.toolView.arrSelectedPhotos.count > 0) {
weakSelf.layoutHeight.constant = 114;
}else{
weakSelf.layoutHeight.constant = 50;
}
};
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.toolView.arrSelectedPhotos.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
ForumDetailBottomPictureCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ForumDetailBottomPictureCell" forIndexPath:indexPath];
UIImage *image = self.toolView.arrSelectedPhotos[indexPath.row];
cell.imageView.image = image;
WS(weakSelf);
cell.blockDelete = ^{
ShowAlertView(weakSelf.viewController, nil, @"确认删除", @"取消", @"确认", UIAlertControllerStyleAlert, ^{
NSLog(@"删除");
[weakSelf.toolView deletePhotoWithIndex:indexPath.row];
},
nil);
};
return cell;
}
- (void)clearPhoto {
[self.toolView deleteAll];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
CGFloat interval = 30; CGFloat interval = 30;
for (int i=0; i<itemArray.count; i++) { for (int i=0; i<itemArray.count; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
// button.imageView
button.tag = i; button.tag = i;
button.tintColor = [UIColor whiteColor]; button.tintColor = [UIColor whiteColor];
[button setBackgroundImage:TCImage(itemArray[i]) forState:UIControlStateNormal]; [button setBackgroundImage:TCImage(itemArray[i]) forState:UIControlStateNormal];
......
//
// ZJKeyBoardAccessoryView.h
// Lighting
//
// Created by Javen on 2017/4/17.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ZJKeyBoardAccessoryView : UIView
@property (strong, nonatomic) NSMutableArray *arrSelectedAssets;
@property (strong, nonatomic) NSMutableArray *arrSelectedPhotos;
@property (nonatomic, copy) void (^blockFinishSelected)(void);
/**
删除指定下标的图片
@param index 下标
*/
- (void)deletePhotoWithIndex:(NSInteger)index;
/**
删除所有的图片
*/
- (void)deleteAll;
@end
...@@ -203,6 +203,7 @@ ...@@ -203,6 +203,7 @@
[weakSelf videoPlayFinish:studyList withIndexPath:indexPath]; [weakSelf videoPlayFinish:studyList withIndexPath:indexPath];
}]; }];
}]; }];
[self presentViewController:pptVc animated:YES completion:nil]; [self presentViewController:pptVc animated:YES completion:nil];
} }
} }
...@@ -229,21 +230,11 @@ ...@@ -229,21 +230,11 @@
}]; }];
} }
#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"];
......
...@@ -335,6 +335,11 @@ ...@@ -335,6 +335,11 @@
29F726011CE1D05D0072FE0E /* ScreeningCollectionReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F726001CE1D05D0072FE0E /* ScreeningCollectionReusableView.m */; }; 29F726011CE1D05D0072FE0E /* ScreeningCollectionReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F726001CE1D05D0072FE0E /* ScreeningCollectionReusableView.m */; };
29F726041CE1E96E0072FE0E /* ScreeningSecondCollectionReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F726031CE1E96E0072FE0E /* ScreeningSecondCollectionReusableView.m */; }; 29F726041CE1E96E0072FE0E /* ScreeningSecondCollectionReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F726031CE1E96E0072FE0E /* ScreeningSecondCollectionReusableView.m */; };
458754197D16754238F76D64 /* libPods-Lighting.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 776B804E9EBF4148093B44DF /* libPods-Lighting.a */; }; 458754197D16754238F76D64 /* libPods-Lighting.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 776B804E9EBF4148093B44DF /* libPods-Lighting.a */; };
8F0FD1A11EA48EC500D38035 /* ForumDetailBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A01EA48EC500D38035 /* ForumDetailBottomView.m */; };
8F0FD1A41EA494EA00D38035 /* ForumDetailBottomPictureCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A31EA494EA00D38035 /* ForumDetailBottomPictureCell.m */; };
8F0FD1A71EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A61EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m */; };
8F7B45461EA61FED00E52092 /* ForumCommentListViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F7B45451EA61FED00E52092 /* ForumCommentListViewModel.m */; };
8FEF03F31EA7543F00837A64 /* UIImage+Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FEF03F21EA7543F00837A64 /* UIImage+Helper.m */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
...@@ -976,6 +981,16 @@ ...@@ -976,6 +981,16 @@
29F726031CE1E96E0072FE0E /* ScreeningSecondCollectionReusableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreeningSecondCollectionReusableView.m; sourceTree = "<group>"; }; 29F726031CE1E96E0072FE0E /* ScreeningSecondCollectionReusableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreeningSecondCollectionReusableView.m; sourceTree = "<group>"; };
76F03CC259F648C692EA812D /* Pods-Lighting.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Lighting.release.xcconfig"; path = "Pods/Target Support Files/Pods-Lighting/Pods-Lighting.release.xcconfig"; sourceTree = "<group>"; }; 76F03CC259F648C692EA812D /* Pods-Lighting.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Lighting.release.xcconfig"; path = "Pods/Target Support Files/Pods-Lighting/Pods-Lighting.release.xcconfig"; sourceTree = "<group>"; };
776B804E9EBF4148093B44DF /* libPods-Lighting.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Lighting.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 776B804E9EBF4148093B44DF /* libPods-Lighting.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Lighting.a"; sourceTree = BUILT_PRODUCTS_DIR; };
8F0FD19F1EA48EC500D38035 /* ForumDetailBottomView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForumDetailBottomView.h; sourceTree = "<group>"; };
8F0FD1A01EA48EC500D38035 /* ForumDetailBottomView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ForumDetailBottomView.m; sourceTree = "<group>"; };
8F0FD1A21EA494EA00D38035 /* ForumDetailBottomPictureCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForumDetailBottomPictureCell.h; sourceTree = "<group>"; };
8F0FD1A31EA494EA00D38035 /* ForumDetailBottomPictureCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ForumDetailBottomPictureCell.m; sourceTree = "<group>"; };
8F0FD1A51EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZJKeyBoardAccessoryView.h; sourceTree = "<group>"; };
8F0FD1A61EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZJKeyBoardAccessoryView.m; sourceTree = "<group>"; };
8F7B45441EA61FED00E52092 /* ForumCommentListViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForumCommentListViewModel.h; sourceTree = "<group>"; };
8F7B45451EA61FED00E52092 /* ForumCommentListViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ForumCommentListViewModel.m; sourceTree = "<group>"; };
8FEF03F11EA7543F00837A64 /* UIImage+Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Helper.h"; sourceTree = "<group>"; };
8FEF03F21EA7543F00837A64 /* UIImage+Helper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Helper.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -1768,6 +1783,8 @@ ...@@ -1768,6 +1783,8 @@
2901738A1E0A22940005F48B /* UIButton+countDown.m */, 2901738A1E0A22940005F48B /* UIButton+countDown.m */,
298111101DFE674600F7EAFF /* UIImage+Fit.h */, 298111101DFE674600F7EAFF /* UIImage+Fit.h */,
298111111DFE674600F7EAFF /* UIImage+Fit.m */, 298111111DFE674600F7EAFF /* UIImage+Fit.m */,
8FEF03F11EA7543F00837A64 /* UIImage+Helper.h */,
8FEF03F21EA7543F00837A64 /* UIImage+Helper.m */,
2962D07F1CD1E6010058829D /* UIView+Frame.h */, 2962D07F1CD1E6010058829D /* UIView+Frame.h */,
2962D0801CD1E6010058829D /* UIView+Frame.m */, 2962D0801CD1E6010058829D /* UIView+Frame.m */,
2916A7461D703A1700644C8C /* UIView+cornerRadius.h */, 2916A7461D703A1700644C8C /* UIView+cornerRadius.h */,
...@@ -2160,6 +2177,8 @@ ...@@ -2160,6 +2177,8 @@
29ACDAE51DF9696E003A0634 /* CustomImageBackView.m */, 29ACDAE51DF9696E003A0634 /* CustomImageBackView.m */,
29B78C101DFA8BD500C7C6D8 /* KeyBoardAccessoryView.h */, 29B78C101DFA8BD500C7C6D8 /* KeyBoardAccessoryView.h */,
29B78C111DFA8BD500C7C6D8 /* KeyBoardAccessoryView.m */, 29B78C111DFA8BD500C7C6D8 /* KeyBoardAccessoryView.m */,
8F0FD1A51EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.h */,
8F0FD1A61EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m */,
291D11971E790DFA001E081E /* CalibrationCollectionViewCell.h */, 291D11971E790DFA001E081E /* CalibrationCollectionViewCell.h */,
291D11981E790DFA001E081E /* CalibrationCollectionViewCell.m */, 291D11981E790DFA001E081E /* CalibrationCollectionViewCell.m */,
291D119A1E790E16001E081E /* CalibrationDetailCollectionCell.h */, 291D119A1E790E16001E081E /* CalibrationDetailCollectionCell.h */,
...@@ -2170,6 +2189,10 @@ ...@@ -2170,6 +2189,10 @@
291D11A11E7923FF001E081E /* TriangleIndicatorView.m */, 291D11A11E7923FF001E081E /* TriangleIndicatorView.m */,
299E45C51E8D2C860071A4CF /* ForumDetailPhotoTableViewCell.h */, 299E45C51E8D2C860071A4CF /* ForumDetailPhotoTableViewCell.h */,
299E45C61E8D2C860071A4CF /* ForumDetailPhotoTableViewCell.m */, 299E45C61E8D2C860071A4CF /* ForumDetailPhotoTableViewCell.m */,
8F0FD19F1EA48EC500D38035 /* ForumDetailBottomView.h */,
8F0FD1A01EA48EC500D38035 /* ForumDetailBottomView.m */,
8F0FD1A21EA494EA00D38035 /* ForumDetailBottomPictureCell.h */,
8F0FD1A31EA494EA00D38035 /* ForumDetailBottomPictureCell.m */,
); );
path = Views; path = Views;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2296,6 +2319,7 @@ ...@@ -2296,6 +2319,7 @@
29C30BD71DDC1E8C00CA3E29 /* ComprehensiveDiscussion */ = { 29C30BD71DDC1E8C00CA3E29 /* ComprehensiveDiscussion */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8F7B45431EA61FB700E52092 /* ViewModels */,
2999B1301DE6CD760031F79E /* Cells */, 2999B1301DE6CD760031F79E /* Cells */,
2999B12C1DE6CD4F0031F79E /* Controllers */, 2999B12C1DE6CD4F0031F79E /* Controllers */,
298111171DFE9F2C00F7EAFF /* Models */, 298111171DFE9F2C00F7EAFF /* Models */,
...@@ -2870,6 +2894,15 @@ ...@@ -2870,6 +2894,15 @@
name = Pods; name = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
8F7B45431EA61FB700E52092 /* ViewModels */ = {
isa = PBXGroup;
children = (
8F7B45441EA61FED00E52092 /* ForumCommentListViewModel.h */,
8F7B45451EA61FED00E52092 /* ForumCommentListViewModel.m */,
);
path = ViewModels;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
...@@ -3080,6 +3113,7 @@ ...@@ -3080,6 +3113,7 @@
files = ( files = (
293163FA1DCE3CBA0075129D /* LuckyDrawDetailsViewController.m in Sources */, 293163FA1DCE3CBA0075129D /* LuckyDrawDetailsViewController.m in Sources */,
29CC51ED1E8A011E009FBB6A /* RebateDetailsViewController.m in Sources */, 29CC51ED1E8A011E009FBB6A /* RebateDetailsViewController.m in Sources */,
8F7B45461EA61FED00E52092 /* ForumCommentListViewModel.m in Sources */,
29045F321DCA192700E42A86 /* PromptHeaderTableViewCell.m in Sources */, 29045F321DCA192700E42A86 /* PromptHeaderTableViewCell.m in Sources */,
2940AE9B1DE7FE17001164B0 /* OnlineLearningDetailViewController.m in Sources */, 2940AE9B1DE7FE17001164B0 /* OnlineLearningDetailViewController.m in Sources */,
2986B9A31DE1D30700F4A1CF /* PromotionChooseNavigationController.m in Sources */, 2986B9A31DE1D30700F4A1CF /* PromotionChooseNavigationController.m in Sources */,
...@@ -3151,6 +3185,7 @@ ...@@ -3151,6 +3185,7 @@
29E384D11CE9C65700888199 /* SearchViewController.m in Sources */, 29E384D11CE9C65700888199 /* SearchViewController.m in Sources */,
29AB91FF1E553C16003A3A08 /* AnnouncementListTableViewCell.m in Sources */, 29AB91FF1E553C16003A3A08 /* AnnouncementListTableViewCell.m in Sources */,
2928F8421CD0ABAC0036D761 /* ShoppingViewController.m in Sources */, 2928F8421CD0ABAC0036D761 /* ShoppingViewController.m in Sources */,
8F0FD1A71EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m in Sources */,
29AB920C1E5542CD003A3A08 /* MessageTableViewCell.m in Sources */, 29AB920C1E5542CD003A3A08 /* MessageTableViewCell.m in Sources */,
29698D611CE2C11500D72CE7 /* SettlementViewController.m in Sources */, 29698D611CE2C11500D72CE7 /* SettlementViewController.m in Sources */,
29498C5D1D053B2C004FA79B /* ShoppingBagViewController.m in Sources */, 29498C5D1D053B2C004FA79B /* ShoppingBagViewController.m in Sources */,
...@@ -3200,6 +3235,7 @@ ...@@ -3200,6 +3235,7 @@
291D118D1E790B0B001E081E /* DiscussMainViewController.m in Sources */, 291D118D1E790B0B001E081E /* DiscussMainViewController.m in Sources */,
2942F8A61CDD80C2005B377E /* authenticateView.m in Sources */, 2942F8A61CDD80C2005B377E /* authenticateView.m in Sources */,
29ACDAE31DF966EF003A0634 /* ForumItemListViewController.m in Sources */, 29ACDAE31DF966EF003A0634 /* ForumItemListViewController.m in Sources */,
8F0FD1A11EA48EC500D38035 /* ForumDetailBottomView.m in Sources */,
2940AE861DE7FCDB001164B0 /* VideoListViewController.m in Sources */, 2940AE861DE7FCDB001164B0 /* VideoListViewController.m in Sources */,
291D6A581CFFD45F007891AE /* SceneSectionHeaderView.m in Sources */, 291D6A581CFFD45F007891AE /* SceneSectionHeaderView.m in Sources */,
29CC51F51E8A011E009FBB6A /* BindingSuccessViewController.m in Sources */, 29CC51F51E8A011E009FBB6A /* BindingSuccessViewController.m in Sources */,
...@@ -3275,6 +3311,7 @@ ...@@ -3275,6 +3311,7 @@
295DEAA71DB756DA006ED4A6 /* CardCollectionViewCell.m in Sources */, 295DEAA71DB756DA006ED4A6 /* CardCollectionViewCell.m in Sources */,
291D6A6B1D000A2A007891AE /* ProductScreeningCollectionViewCell.m in Sources */, 291D6A6B1D000A2A007891AE /* ProductScreeningCollectionViewCell.m in Sources */,
29CC51EC1E8A011E009FBB6A /* PaymentWithdrawalMainViewController.m in Sources */, 29CC51EC1E8A011E009FBB6A /* PaymentWithdrawalMainViewController.m in Sources */,
8F0FD1A41EA494EA00D38035 /* ForumDetailBottomPictureCell.m in Sources */,
297BA2C81DE94D3300474F79 /* VIMediaDownloader.m in Sources */, 297BA2C81DE94D3300474F79 /* VIMediaDownloader.m in Sources */,
299876421CD99E4000C90D0A /* OrderdetailsViewController.m in Sources */, 299876421CD99E4000C90D0A /* OrderdetailsViewController.m in Sources */,
29EC331A1CE023D5005F0C13 /* ChangePasswordViewController.m in Sources */, 29EC331A1CE023D5005F0C13 /* ChangePasswordViewController.m in Sources */,
...@@ -3359,6 +3396,7 @@ ...@@ -3359,6 +3396,7 @@
29834EC01CDF5E4E001A484F /* ScreeningFirstCollectionViewCell.m in Sources */, 29834EC01CDF5E4E001A484F /* ScreeningFirstCollectionViewCell.m in Sources */,
29834EC51CDF76C1001A484F /* UserViewController.m in Sources */, 29834EC51CDF76C1001A484F /* UserViewController.m in Sources */,
29E2D3271DB88D8B00443170 /* CardOrderInformationReusableView.m in Sources */, 29E2D3271DB88D8B00443170 /* CardOrderInformationReusableView.m in Sources */,
8FEF03F31EA7543F00837A64 /* UIImage+Helper.m in Sources */,
2971E9841DF69F9A00256567 /* CountDownLabel.m in Sources */, 2971E9841DF69F9A00256567 /* CountDownLabel.m in Sources */,
29CC51F81E8A032D009FBB6A /* LuckyDrawMainViewController.m in Sources */, 29CC51F81E8A032D009FBB6A /* LuckyDrawMainViewController.m in Sources */,
2962D06D1CD1A43A0058829D /* ClientViewController.m in Sources */, 2962D06D1CD1A43A0058829D /* ClientViewController.m in Sources */,
......
This diff is collapsed.
{
"images" : [
{
"idiom" : "universal",
"filename" : "img_delete_icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "img_delete_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "img_delete_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundleName</key> <key>CFBundleName</key>
<string>欧立方</string> <string>欧立方</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.1.0</string> <string>2.1.1</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
<array> <array>
<dict> <dict>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string></string> <string>2.1.1</string>
<key>LSApplicationQueriesSchemes</key> <key>LSApplicationQueriesSchemes</key>
<array> <array>
<string>wechat</string> <string>wechat</string>
......
...@@ -99,6 +99,10 @@ typedef NS_ENUM(NSInteger,COMMENT_PRAISE) { ...@@ -99,6 +99,10 @@ 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/
/**
* 局域网开发地址
*/
//#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://192.168.199.198:8080/opple-web/app%@",URL]
/** /**
* 服务器测试地址 * 服务器测试地址
......
//
// UIImage+Helper.h
// CXA
//
// Created by Xummer on 14-3-3.
// Copyright (c) 2014年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (Helper)
+ (UIImage *)getThumbnailImage:(UIImage *)image withMaxLen:(CGFloat)maxLen;
- (UIImage *)thumbnailWithMaxLen:(CGFloat)maxLen;
- (UIImage *)imageWithTintColor:(UIColor *)tintColor;
- (UIImage *)imageWithGradientTintColor:(UIColor *)tintColor;
- (UIImage *)imageWithTintColor:(UIColor *)tintColor blendMode:(CGBlendMode)blendMode;
@end
@interface UIImage (Color)
+ (UIImage *)imageWithColor:(UIColor *)color;
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size;
+ (UIImage *)imageWithColor:(UIColor *)color andRect:(CGRect)rect;
- (UIImage *)greyScaleImage;
/**
* 图片压缩到指定大小(具体看图片大小,过大的图片无法压缩到指定大小)
*
* @param kb 压缩后图片大小
*
* @return
*/
- (NSData *)scaledToSpaceMaxSize:(NSInteger)kb;
/**
* 压缩图片到指定高宽
*
* @param newSize 新的图片尺寸
*
* @return
*/
- (UIImage *)scaledToSize:(CGSize)newSize;
/**
* 按比例压缩图片至指定宽度
*
* @param newWidth 指定宽度
*
* @return
*/
- (UIImage *)scaledToWidth:(NSInteger)newWidth;
/**
* 获取图片缩略图
*
* @param sourceImage 原始图片
* @param size 生成尺寸
*
* @return 新的图片
*/
+ (UIImage *)imageCompressForSize:(UIImage *)sourceImage targetSize:(CGSize)size;
@end
//
// UIImage+Helper.m
// CXA
//
// Created by Xummer on 14-3-3.
// Copyright (c) 2014年 Xummer. All rights reserved.
//
#import "UIImage+Helper.h"
@implementation UIImage (Helper)
// if newImage's width or heigth < 1, image will be cliped
+ (UIImage *)getThumbnailImage:(UIImage *)image withMaxLen:(CGFloat)maxLen
{
CGFloat imageMaxLen, imageMinLen;
BOOL widthIsLarger = image.size.width > image.size.height;
if (widthIsLarger) {
imageMaxLen = image.size.width;
imageMinLen = image.size.height;
}
else {
imageMaxLen = image.size.height;
imageMinLen = image.size.width;
}
if (imageMaxLen > maxLen) {
CGFloat scaleFloat = maxLen/imageMaxLen;
CGFloat newImgMinL = imageMinLen * scaleFloat;
CGSize size;
if (newImgMinL < 1) {
scaleFloat = 1/imageMinLen;
if (widthIsLarger) {
size = CGSizeMake(maxLen, image.size.height * scaleFloat);
}
else {
size = CGSizeMake(image.size.width * scaleFloat, maxLen);
}
}
else {
size = CGSizeMake(image.size.width * scaleFloat,
image.size.height * scaleFloat);
}
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformScale(transform, scaleFloat, scaleFloat);
CGContextConcatCTM(context, transform);
// Draw the image into the transformed context and return the image
[image drawAtPoint:CGPointMake(0.0f, 0.0f)];
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newimg;
}
else{
return image;
}
}
- (UIImage *)thumbnailWithMaxLen:(CGFloat)maxLen {
return [[self class] getThumbnailImage:self withMaxLen:maxLen];
}
- (UIImage *)imageWithTintColor:(UIColor *)tintColor {
return [self imageWithTintColor:tintColor blendMode:kCGBlendModeDestinationIn];
}
- (UIImage *)imageWithGradientTintColor:(UIColor *)tintColor {
return [self imageWithTintColor:tintColor blendMode:kCGBlendModeOverlay];
}
- (UIImage *)imageWithTintColor:(UIColor *)tintColor blendMode:(CGBlendMode)blendMode
{
//We want to keep alpha, set opaque to NO; Use 0.0f for scale to use the scale factor of the device’s main screen.
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f);
[tintColor setFill];
CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height);
UIRectFill(bounds);
//Draw the tinted image in context
[self drawInRect:bounds blendMode:blendMode alpha:1.0f];
if (blendMode != kCGBlendModeDestinationIn) {
[self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0f];
}
UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return tintedImage;
}
@end
@implementation UIImage (Color)
typedef enum {
ALPHA = 0,
BLUE = 1,
GREEN = 2,
RED = 3
} PIXELS;
+ (UIImage *)imageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f,0.0f,1.0f,1.0f);
return [[self class] imageWithColor:color andRect:rect];
}
+ (UIImage *)imageWithColor:(UIColor *)color andRect:(CGRect)rect {
UIGraphicsBeginImageContext(rect.size);
CGContextRef context =UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,[color CGColor]);
CGContextFillRect(context, rect);
UIImage *image =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size {
return [[self class] imageWithColor:color andRect:(CGRect){
.origin = CGPointZero,
.size = size
}];
}
- (UIImage *)greyScaleImage {
CGSize size = [self size];
int width = size.width;
int height = size.height;
// the pixels will be painted to this array
uint32_t *pixels = (uint32_t *) malloc(width * height * sizeof(uint32_t));
// clear the pixels so any transparency is preserved
memset(pixels, 0, width * height * sizeof(uint32_t));
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
// create a context with RGBA pixels
CGContextRef context = CGBitmapContextCreate(pixels, width, height, 8, width * sizeof(uint32_t), colorSpace,
kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedLast);
// paint the bitmap to our context which will fill in the pixels array
CGContextDrawImage(context, CGRectMake(0, 0, width, height), [self CGImage]);
for(int y = 0; y < height; y++) {
for(int x = 0; x < width; x++) {
uint8_t *rgbaPixel = (uint8_t *) &pixels[y * width + x];
// convert to grayscale using recommended method: http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
uint32_t gray = 0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE];
// set the pixels to gray
rgbaPixel[RED] = gray;
rgbaPixel[GREEN] = gray;
rgbaPixel[BLUE] = gray;
}
}
// create a new CGImageRef from our context with the modified pixels
CGImageRef image = CGBitmapContextCreateImage(context);
// we're done with the context, color space, and pixels
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
free(pixels);
// make a new UIImage to return
UIImage *resultUIImage = [UIImage imageWithCGImage:image];
// we're done with image now too
CGImageRelease(image);
return resultUIImage;
}
- (NSData *)scaledToSpaceMaxSize:(NSInteger)kb {
//压缩到100kb以内
CGFloat compression = 0.5f;
CGFloat maxCompression = 0.1f;
NSUInteger maxlength = kb * 1024;
NSData *imgData = UIImageJPEGRepresentation(self, compression);
// CLog(@"处理之前的大小--->%lukB",(unsigned long)imgData.length/1024);
while ([imgData length] > maxlength && compression > maxCompression) {
compression -= 0.1;
imgData = UIImageJPEGRepresentation(self, compression);
}
// CLog(@"处理之后的大小--->%lukB",(unsigned long)imgData.length/1024);
return imgData;
}
- (UIImage *)scaledToSize:(CGSize)newSize {
UIGraphicsBeginImageContextWithOptions(newSize, YES, 0);
[self drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}
- (UIImage *)scaledToWidth:(NSInteger)newWidth {
CGSize newSize = CGSizeMake(newWidth, newWidth / self.size.width * self.size.height);
UIGraphicsBeginImageContextWithOptions(newSize, YES, 0);
[self drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}
#pragma mark - 获取缩略图
+ (UIImage *)imageCompressForSize:(UIImage *)sourceImage targetSize:(CGSize)size
{
UIImage *newImage = nil;
CGSize imageSize = sourceImage.size;
CGFloat width = imageSize.width;
CGFloat height = imageSize.height;
CGFloat targetWidth = size.width;
CGFloat targetHeight = size.height;
CGFloat scaleFactor = 0.0;
CGFloat scaledWidth = targetWidth;
CGFloat scaledHeight = targetHeight;
CGPoint thumbnailPoint = CGPointMake(0.0, 0.0);
if(CGSizeEqualToSize(imageSize, size) == NO){
CGFloat widthFactor = targetWidth / width;
CGFloat heightFactor = targetHeight / height;
if(widthFactor > heightFactor){
scaleFactor = widthFactor;
}
else{
scaleFactor = heightFactor;
}
scaledWidth = width * scaleFactor;
scaledHeight = height * scaleFactor;
if(widthFactor > heightFactor){
thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
}else if(widthFactor < heightFactor){
thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
}
}
UIGraphicsBeginImageContextWithOptions(size, NO, 3.0);
CGRect thumbnailRect = CGRectZero;
thumbnailRect.origin = thumbnailPoint;
thumbnailRect.size.width = scaledWidth;
thumbnailRect.size.height = scaledHeight;
[sourceImage drawInRect:thumbnailRect];
newImage = UIGraphicsGetImageFromCurrentImageContext();
if(newImage == nil){
NSLog(@"scale image fail");
}
UIGraphicsEndImageContext();
return newImage;
}
@end
...@@ -5757,8 +5757,6 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -5757,8 +5757,6 @@ extern NSString * const GRADEMETHOD_MANUL;
* *
*/ */
@property (nonatomic, copy) NSString *replyTime; @property (nonatomic, copy) NSString *replyTime;
@property (nonatomic,copy) NSString *replyerPicture;
/** /**
* 方法: 取得回复内容 * 方法: 取得回复内容
* *
...@@ -5795,6 +5793,36 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -5795,6 +5793,36 @@ extern NSString * const GRADEMETHOD_MANUL;
* *
*/ */
@property (nonatomic, copy) NSString *replyerPosition; @property (nonatomic, copy) NSString *replyerPosition;
/**
* (no documentation provided)
*
*
*/
@property (nonatomic, assign) NSInteger top;
/**
* (no documentation provided)
*
*
*/
@property (nonatomic, copy) NSString *attachmentId;
/**
* (no documentation provided)
* @see TOAttachmentEntity
*
*/
@property (nonatomic, strong) NSArray<TOAttachmentEntity> *attachments;
/**
* (no documentation provided)
*
*
*/
@property (nonatomic, copy) NSString *bestName;
/**
* 回复人头像
*
*
*/
@property (nonatomic, copy) NSString *replyerPicture;
@end /* interface TOForumReplyEntity */ @end /* interface TOForumReplyEntity */
......
...@@ -1996,6 +1996,11 @@ NSString * const GRADEMETHOD_MANUL = @"manul"; ...@@ -1996,6 +1996,11 @@ NSString * const GRADEMETHOD_MANUL = @"manul";
@synthesize replyerName; @synthesize replyerName;
@synthesize replyerRealName; @synthesize replyerRealName;
@synthesize replyerPosition; @synthesize replyerPosition;
@synthesize top;
@synthesize attachmentId;
@synthesize attachments;
@synthesize bestName;
@synthesize replyerPicture;
+(BOOL)propertyIsOptional:(NSString*)propertyName +(BOOL)propertyIsOptional:(NSString*)propertyName
{ {
......
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
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);
...@@ -204,15 +204,6 @@ ...@@ -204,15 +204,6 @@
} }
} }
#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