From 112115134975972f95232e047f12341935990a46 Mon Sep 17 00:00:00 2001 From: zjf <zhangjf@probim.com.cn> Date: Mon, 06 Mar 2023 16:35:48 +0800 Subject: [PATCH] 文档适配300012、 token过期处理 已经处理,本次为检查后 详情内不显示创建的图片视频,及视频缩略图显示 --- IphoneBIMe/IphoneBIMe/Classes/Project/Issue/Views/AddIssueView/PBVideoCollectionViewCell.m | 35 +++++++++++++++++++++++++++++++++-- IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBExamineDetailController.m | 19 ++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBExamineDetailController.m b/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBExamineDetailController.m index 449579a..8aeae8e 100644 --- a/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBExamineDetailController.m +++ b/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBExamineDetailController.m @@ -33,6 +33,7 @@ #import "PBRadioTableViewCell.h" #import "PBCheckInfoTableViewCell.h" #import "PBCheckImageTableViewCell.h" +#import "PBCheckHeaderView.h" static NSString *const inputCellID = @"InputCellID"; static NSString *const topTitleCellID = @"topTitleCellID"; static NSString *const timeChooseCellID = @"timeChooseCellID"; @@ -53,6 +54,7 @@ @property (nonatomic, strong) NSDictionary *typeDict; @property (nonatomic, weak) UIButton *typeListBtn; @property (nonatomic, weak) UIButton *functionBtn; +@property (nonatomic, strong) PBCheckHeaderView *tableheaderView1; @end @implementation PBExamineDetailController @@ -182,7 +184,7 @@ [self setupUI]; } - (void)setupUI { -// __weak typeof(self) weakSelf = self; + __weak typeof(self) weakSelf = self; self.title = [self.examinDetailDic valueForKey:@"aedt_name"]; self.view.backgroundColor = PBColor(244, 245, 246); // self.view.backgroundColor = [UIColor blackColor]; @@ -221,6 +223,21 @@ make.right.equalTo(self.view).offset(-10); make.bottom.equalTo(self.view).offset(-(bottomH)); }]; + NSArray *imageArr = [self.examinDetailDic valueForKey:@"imges"]; + if (imageArr.count > 0) { + self.tableheaderView1 = [[PBCheckHeaderView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 100)]; + self.tableheaderView1.PlayVideoUrlBlock = ^(NSString * _Nonnull url) { + [weakSelf.view endEditing:YES]; + NSLog(@"打开视频"); + PBVideoPlayViewController *playVC = [[PBVideoPlayViewController alloc] init]; + playVC.url = url; + [weakSelf.navigationController pushViewController:playVC animated:YES]; + }; + self.tableheaderView1.projectModel = self.projectModel; + self.tableheaderView1.isAddExamine = NO; + self.tableheaderView1.detailsImageArr = imageArr; + self.tableView.tableHeaderView = self.tableheaderView1; + } UIView *linV = [[UIView alloc] init]; linV.backgroundColor = PBColor(246, 246, 247); [self.view addSubview:linV]; diff --git a/IphoneBIMe/IphoneBIMe/Classes/Project/Issue/Views/AddIssueView/PBVideoCollectionViewCell.m b/IphoneBIMe/IphoneBIMe/Classes/Project/Issue/Views/AddIssueView/PBVideoCollectionViewCell.m index f6db481..7c6068b 100644 --- a/IphoneBIMe/IphoneBIMe/Classes/Project/Issue/Views/AddIssueView/PBVideoCollectionViewCell.m +++ b/IphoneBIMe/IphoneBIMe/Classes/Project/Issue/Views/AddIssueView/PBVideoCollectionViewCell.m @@ -10,6 +10,7 @@ @interface PBVideoCollectionViewCell() @property (nonatomic, weak) UIImageView *imageV; @property (nonatomic, weak) UIButton *playBtn; +typedef void(^MyImageBlock)(UIImage * _Nullable image); @end @implementation PBVideoCollectionViewCell - (instancetype)initWithFrame:(CGRect)frame { @@ -49,7 +50,37 @@ } - (void)setVideoUrl:(NSString *)videoUrl { _videoUrl = videoUrl; - NSString *imageStr = [videoUrl stringByReplacingOccurrencesOfString:@".mp4" withString:@"_image.png"]; - [self.imageV sd_setImageWithURL:[NSURL URLWithString:imageStr] placeholderImage:[UIImage imageNamed:@""]]; +// NSString *imageStr = [videoUrl stringByReplacingOccurrencesOfString:@".mp4" withString:@"_image.png"]; +// [self.imageV sd_setImageWithURL:[NSURL URLWithString:imageStr] placeholderImage:[UIImage imageNamed:@""]]; + [self getThumbnailImage:[NSURL URLWithString:videoUrl] completion:^(UIImage * _Nullable image) { + self.imageV.image = image; + }]; +} +- (void)getThumbnailImage:(NSURL *)videoURL completion:(MyImageBlock)handler { + + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + + AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:videoURL options:nil]; + + AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset]; + + generator.appliesPreferredTrackTransform = YES; + + CMTime time = CMTimeMakeWithSeconds(0.0, 600); + + NSError *error = nil; + + CMTime actualTime; + + CGImageRef imageRef = [generator copyCGImageAtTime:time actualTime:&actualTime error:&error]; + + UIImage *thumb = [[UIImage alloc] initWithCGImage:imageRef]; + + CGImageRelease(imageRef); + + dispatch_async(dispatch_get_main_queue(), ^{ + handler(thumb); + }); + }); } @end -- Gitblit v1.9.3