Commit cdc3408ed81042c15cdefe0a55c56286f3e6578e
1 parent
8a54326d
1. 答记者问增加新字段
2. 国新之声播放页面显示预览图 3.答记者问简单修改网络请求逻辑 4.解决页面布局逻辑显示异常问题
Showing
6 changed files
with
202 additions
and
49 deletions
CNLiveScioLive.xcodeproj/project.pbxproj
| ... | ... | @@ -50,6 +50,7 @@ |
| 50 | 50 | 0838487D215CF6FC00186618 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838487C215CF6FB00186618 /* BaseViewController.m */; }; |
| 51 | 51 | 0838487E215CF6FC00186618 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838487C215CF6FB00186618 /* BaseViewController.m */; }; |
| 52 | 52 | 0838487F215CF6FC00186618 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838487C215CF6FB00186618 /* BaseViewController.m */; }; |
| 53 | + 08471A9F25E7864E0043FC2D /* VideoDetailPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 08471A9E25E7864E0043FC2D /* VideoDetailPresent.m */; }; | |
| 53 | 54 | 084ACDFD21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACDFC21547AE80089E035 /* CNLiveContactUsViewController.m */; }; |
| 54 | 55 | 084ACDFE21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACDFC21547AE80089E035 /* CNLiveContactUsViewController.m */; }; |
| 55 | 56 | 084ACDFF21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACDFC21547AE80089E035 /* CNLiveContactUsViewController.m */; }; |
| ... | ... | @@ -781,6 +782,8 @@ |
| 781 | 782 | 08384877215CC9E400186618 /* GraphicLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicLiveViewController.h; sourceTree = "<group>"; }; |
| 782 | 783 | 0838487B215CF6FB00186618 /* BaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = "<group>"; }; |
| 783 | 784 | 0838487C215CF6FB00186618 /* BaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = "<group>"; }; |
| 785 | + 08471A9D25E7864E0043FC2D /* VideoDetailPresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VideoDetailPresent.h; sourceTree = "<group>"; }; | |
| 786 | + 08471A9E25E7864E0043FC2D /* VideoDetailPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VideoDetailPresent.m; sourceTree = "<group>"; }; | |
| 784 | 787 | 084ACDFB21547AE80089E035 /* CNLiveContactUsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveContactUsViewController.h; sourceTree = "<group>"; }; |
| 785 | 788 | 084ACDFC21547AE80089E035 /* CNLiveContactUsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveContactUsViewController.m; sourceTree = "<group>"; }; |
| 786 | 789 | 084ACE0021547B4D0089E035 /* CNLiveMyCollectionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveMyCollectionViewController.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -1288,6 +1291,7 @@ |
| 1288 | 1291 | 0838484A215CA71C00186618 /* OldController */ = { |
| 1289 | 1292 | isa = PBXGroup; |
| 1290 | 1293 | children = ( |
| 1294 | + 08471A8F25E785B50043FC2D /* Present */, | |
| 1291 | 1295 | 0838487B215CF6FB00186618 /* BaseViewController.h */, |
| 1292 | 1296 | 0838487C215CF6FB00186618 /* BaseViewController.m */, |
| 1293 | 1297 | 0838484B215CA73A00186618 /* OldArticleDetailViewController.h */, |
| ... | ... | @@ -1316,6 +1320,15 @@ |
| 1316 | 1320 | path = Html5Utils; |
| 1317 | 1321 | sourceTree = "<group>"; |
| 1318 | 1322 | }; |
| 1323 | + 08471A8F25E785B50043FC2D /* Present */ = { | |
| 1324 | + isa = PBXGroup; | |
| 1325 | + children = ( | |
| 1326 | + 08471A9D25E7864E0043FC2D /* VideoDetailPresent.h */, | |
| 1327 | + 08471A9E25E7864E0043FC2D /* VideoDetailPresent.m */, | |
| 1328 | + ); | |
| 1329 | + path = Present; | |
| 1330 | + sourceTree = "<group>"; | |
| 1331 | + }; | |
| 1319 | 1332 | 084ACE0A21547F9F0089E035 /* DBAction */ = { |
| 1320 | 1333 | isa = PBXGroup; |
| 1321 | 1334 | children = ( |
| ... | ... | @@ -2659,6 +2672,7 @@ |
| 2659 | 2672 | TargetAttributes = { |
| 2660 | 2673 | 08C08F6D214F997E00E23D16 = { |
| 2661 | 2674 | CreatedOnToolsVersion = 9.4.1; |
| 2675 | + LastSwiftMigration = 1240; | |
| 2662 | 2676 | SystemCapabilities = { |
| 2663 | 2677 | com.apple.BackgroundModes = { |
| 2664 | 2678 | enabled = 1; |
| ... | ... | @@ -3015,6 +3029,7 @@ |
| 3015 | 3029 | 08B5C5962153490B00F5476E /* CNMyAnnouncementsModel.m in Sources */, |
| 3016 | 3030 | 08FB8777215DD3C600DA5423 /* NewsVoiceTableViewCell.m in Sources */, |
| 3017 | 3031 | 08FB8774215DD3C600DA5423 /* SelectedTableViewCell.m in Sources */, |
| 3032 | + 08471A9F25E7864E0043FC2D /* VideoDetailPresent.m in Sources */, | |
| 3018 | 3033 | C3E502DA2152432700DA4320 /* CNHomeRightTableViewCell.m in Sources */, |
| 3019 | 3034 | 08C090AB215103C400E23D16 /* CNLiveHeaderView.m in Sources */, |
| 3020 | 3035 | 08585D56215B4C7200FC2CA2 /* PGDatePicker+Time.m in Sources */, |
| ... | ... | @@ -3597,6 +3612,7 @@ |
| 3597 | 3612 | buildSettings = { |
| 3598 | 3613 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 3599 | 3614 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; |
| 3615 | + CLANG_ENABLE_MODULES = YES; | |
| 3600 | 3616 | CODE_SIGN_ENTITLEMENTS = CNLiveScioLive/CNLiveScioLive.entitlements; |
| 3601 | 3617 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 3602 | 3618 | CODE_SIGN_STYLE = Automatic; |
| ... | ... | @@ -3639,6 +3655,9 @@ |
| 3639 | 3655 | PRODUCT_BUNDLE_IDENTIFIER = cn.gov.scio.live1; |
| 3640 | 3656 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 3641 | 3657 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| 3658 | + SWIFT_OBJC_BRIDGING_HEADER = "CNLiveScioLive/Pages/Home/新闻详情/OldController/Present/CNLiveScioLive-Bridging-Header.h"; | |
| 3659 | + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | |
| 3660 | + SWIFT_VERSION = 5.0; | |
| 3642 | 3661 | TARGETED_DEVICE_FAMILY = 1; |
| 3643 | 3662 | VALID_ARCHS = "arm64 arm64e armv7s"; |
| 3644 | 3663 | }; |
| ... | ... | @@ -3650,6 +3669,7 @@ |
| 3650 | 3669 | buildSettings = { |
| 3651 | 3670 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 3652 | 3671 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; |
| 3672 | + CLANG_ENABLE_MODULES = YES; | |
| 3653 | 3673 | CODE_SIGN_ENTITLEMENTS = CNLiveScioLive/CNLiveScioLive.entitlements; |
| 3654 | 3674 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 3655 | 3675 | CODE_SIGN_STYLE = Automatic; |
| ... | ... | @@ -3692,6 +3712,8 @@ |
| 3692 | 3712 | PRODUCT_BUNDLE_IDENTIFIER = cn.gov.scio.live1; |
| 3693 | 3713 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 3694 | 3714 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| 3715 | + SWIFT_OBJC_BRIDGING_HEADER = "CNLiveScioLive/Pages/Home/新闻详情/OldController/Present/CNLiveScioLive-Bridging-Header.h"; | |
| 3716 | + SWIFT_VERSION = 5.0; | |
| 3695 | 3717 | TARGETED_DEVICE_FAMILY = 1; |
| 3696 | 3718 | VALID_ARCHS = "arm64 arm64e armv7s"; |
| 3697 | 3719 | }; | ... | ... |
CNLiveScioLive/Pages/Header/SystemMacro.h
| ... | ... | @@ -9,6 +9,13 @@ |
| 9 | 9 | #ifndef SystemMacro_h |
| 10 | 10 | #define SystemMacro_h |
| 11 | 11 | |
| 12 | +#ifndef AppKeyWindow | |
| 13 | +#define AppKeyWindow ((AppDelegate *)[UIApplication sharedApplication].delegate).window | |
| 14 | +#endif | |
| 15 | + | |
| 16 | +//协议调取方法 | |
| 17 | +#define CNMessageSend(instance,protocol,message) [(id<protocol>)(instance) message] | |
| 18 | + | |
| 12 | 19 | // 系统语言 |
| 13 | 20 | #define SYSTEM_LANGUAGE [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0] |
| 14 | 21 | #define IS_CHINESE ([SYSTEM_LANGUAGE isEqualToString:@"zh-Hans-CN"]||[SYSTEM_LANGUAGE isEqualToString:@"zh-Hant-CN"]||[SYSTEM_LANGUAGE isEqualToString:@"zh-Hans"] ||[SYSTEM_LANGUAGE isEqualToString:@"zh-hans"]) | ... | ... |
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m
| ... | ... | @@ -12,9 +12,12 @@ |
| 12 | 12 | #import "VideoTableViewCell.h" |
| 13 | 13 | #import "ArticleTableViewCell.h" |
| 14 | 14 | #import "SearchResultViewController.h" |
| 15 | -@interface OldVideoDetailViewController ()<CNLivePlayerControllerDelegate>{ | |
| 15 | +#import "VideoDetailPresent.h" | |
| 16 | +@interface OldVideoDetailViewController ()<CNLivePlayerControllerDelegate,ProgramDelegate>{ | |
| 16 | 17 | UIButton *_shareBtn; |
| 17 | 18 | } |
| 19 | +@property (nonatomic,strong)VideoDetailPresent *present; | |
| 20 | +@property (nonatomic,strong)NSString *content; | |
| 18 | 21 | |
| 19 | 22 | @end |
| 20 | 23 | @implementation OldVideoDetailViewController |
| ... | ... | @@ -63,10 +66,14 @@ |
| 63 | 66 | |
| 64 | 67 | NSString* htmldate = @""; |
| 65 | 68 | NSString* htmlForm = @""; |
| 69 | + NSString* content = @""; | |
| 66 | 70 | if ([_dictionary objectForKey:@"publishDate"] && [_dictionary objectForKey:@"author"]) { |
| 67 | 71 | htmldate = [[NSString alloc] initWithFormat:@"<html><p>%@</p><body>",[NSString stringWithFormat:@"%@",[_dictionary objectForKey:@"publishDate"]]]; |
| 68 | 72 | htmlForm = [[NSString alloc] initWithFormat:@"<html><p>%@:%@</p><body>", CustomStr(@"Source"), _dictionary[@"author"]]; |
| 69 | 73 | self.authorName = _dictionary[@"author"]; |
| 74 | + if (self.content&&![self.content isEqualToString:@""]) { | |
| 75 | + content = [[NSString alloc] initWithFormat:@"<div class=\"logo\" style=\"text-indent:2em\"><font style=\"font-size:%@px;\">%@</font></div>",fontArray[fontIndex],self.content]; | |
| 76 | + } | |
| 70 | 77 | } else { |
| 71 | 78 | htmldate = [[NSString alloc] initWithFormat:@"<html><p>%@</p><body>",[NSString stringWithFormat:@"%@",[_dictionary objectForKey:@"publishDate"]]]; |
| 72 | 79 | NSDictionary *author = [NSDictionary dictionaryWithContentsOfFile:FavouriteAuthors_PATH]; |
| ... | ... | @@ -76,7 +83,7 @@ |
| 76 | 83 | |
| 77 | 84 | NSString* htmlBody = [[NSString alloc] initWithFormat:@"<div class=\"logo\" style=\"text-indent:2em\"><font style=\"font-size:%@px;\">%@</font></div>",fontArray[fontIndex],[_dictionary objectForKey:@"desc"]]; |
| 78 | 85 | NSString* htmlFooter = @"</body></html>"; |
| 79 | - NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@%@%@%@",htmlHeader,htmldate,htmlForm,htmlBody,htmlFooter]; | |
| 86 | + NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@%@%@%@%@",htmlHeader,htmldate,htmlForm,content,htmlBody,htmlFooter]; | |
| 80 | 87 | return strHtml; |
| 81 | 88 | } |
| 82 | 89 | |
| ... | ... | @@ -238,8 +245,11 @@ |
| 238 | 245 | _webView.UIDelegate = self; |
| 239 | 246 | _webView.opaque = NO; |
| 240 | 247 | [backgroundView addSubview:_webView]; |
| 248 | + if ([_dictionary objectForKey:@"publishDate"] && [_dictionary objectForKey:@"author"]) { | |
| 249 | + [self.present requestProgram:_dictionary[@"cmsContentId"]]; | |
| 250 | + }else{ | |
| 241 | 251 | [_webView loadHTMLString:[self setHTMLString] baseURL:nil]; |
| 242 | - | |
| 252 | + } | |
| 243 | 253 | self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; |
| 244 | 254 | self.tableView.backgroundColor = [UIColor whiteColor]; |
| 245 | 255 | self.tableView.backgroundView = nil; |
| ... | ... | @@ -252,6 +262,7 @@ |
| 252 | 262 | if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { |
| 253 | 263 | [self.tableView setSeparatorInset:UIEdgeInsetsZero]; |
| 254 | 264 | } |
| 265 | + [self.present loadRelatedInformation:_dictionary[@"cmsContentId"]]; | |
| 255 | 266 | self.errorLabe = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 256 | 267 | self.errorLabe.backgroundColor = [UIColor clearColor]; |
| 257 | 268 | self.errorLabe.textColor = HEXCOLOR(0x333333); |
| ... | ... | @@ -270,17 +281,18 @@ |
| 270 | 281 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { |
| 271 | 282 | |
| 272 | 283 | if ([keyPath isEqualToString:@"contentSize"] && !_webView.loading && _webView.height != _webView.scrollView.contentSize.height) { |
| 273 | - CGRect frame = self->_webView.frame; | |
| 284 | + CGRect frame = _webView.frame; | |
| 274 | 285 | frame.size.width = MainScreenWidth; |
| 275 | 286 | frame.size.height = 1; |
| 276 | 287 | CGFloat graphicLiveHeight = self->_webView.scrollView.contentSize.height; |
| 277 | - frame.size.height = self->_webView.scrollView.contentSize.height; | |
| 278 | - NSLog(@"YYYYYYYYYYY%f",self->_webView.scrollView.contentSize.height); | |
| 279 | - self->_webView.frame = frame; | |
| 280 | - if (0 == [self->heightArr[self->fontIndex] floatValue]) { | |
| 281 | - [self->heightArr replaceObjectAtIndex:self->fontIndex withObject:[NSString stringWithFormat:@"%f",graphicLiveHeight]]; | |
| 288 | + frame.size.height = _webView.scrollView.contentSize.height; | |
| 289 | + NSLog(@"YYYYYYYYYYY%f",_webView.scrollView.contentSize.height); | |
| 290 | + _webView.frame = frame; | |
| 291 | + [heightArr replaceObjectAtIndex:fontIndex withObject:[NSString stringWithFormat:@"%f",graphicLiveHeight]]; | |
| 292 | + if (_newsArray.count != 0) { | |
| 293 | + [self.tableView setFrame:CGRectMake(0, [heightArr[fontIndex] floatValue], MainScreenWidth, 36 + 86*_newsArray.count)]; | |
| 282 | 294 | } |
| 283 | - [self loadRelatedInformation]; | |
| 295 | + [backgroundView setContentSize:CGSizeMake(MainScreenWidth, [heightArr[fontIndex] floatValue] + self.tableView.frame.size.height)]; | |
| 284 | 296 | } |
| 285 | 297 | } |
| 286 | 298 | // CNLivePlayer |
| ... | ... | @@ -444,48 +456,30 @@ |
| 444 | 456 | NSLog(@"value: %@ error: %@", response, error); |
| 445 | 457 | |
| 446 | 458 | }]; |
| 459 | + | |
| 447 | 460 | } |
| 448 | -- (void)loadRelatedInformation { | |
| 449 | - if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { | |
| 450 | - [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")]; | |
| 451 | - return; | |
| 461 | + | |
| 462 | +#pragma mark - ProgramDelegate | |
| 463 | +-(void)programDetail:(NSString *)content | |
| 464 | +{ | |
| 465 | + self.content = content; | |
| 466 | + [_webView loadHTMLString:[self setHTMLString] baseURL:nil]; | |
| 467 | +} | |
| 468 | + | |
| 469 | +- (void)reloadWithData:(NSArray *)dataArray | |
| 470 | +{ | |
| 471 | + if (0 != [dataArray count]) { | |
| 472 | + _newsArray = [NSArray arrayWithArray:dataArray]; | |
| 473 | + [self.tableView setFrame:CGRectMake(0, [heightArr[fontIndex] floatValue], MainScreenWidth, 36 + 86*_newsArray.count)]; | |
| 474 | + } else { | |
| 475 | + // [self.errorLabe setFrame:CGRectMake(12, [heightArr[fontIndex] floatValue], MainScreenWidth - 24, 20)]; | |
| 476 | + // self.errorLabe.hidden = NO; | |
| 452 | 477 | } |
| 453 | - NSString *strUrl = @"http://app.phonemovie.cnlive.com/gxb/api/programRelative"; | |
| 454 | - NSLog(@"%@",strUrl); | |
| 455 | - NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"cmsContentId\":\"%@\"}",_dictionary[@"cmsContentId"]]; | |
| 456 | - NSLog(@"%@",categoryId); | |
| 457 | - NSDictionary *parameters = @{@"params":categoryId}; | |
| 458 | - AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; | |
| 459 | - [manager POST:strUrl | |
| 460 | - parameters:parameters headers:nil | |
| 461 | - progress:^(NSProgress * _Nonnull uploadProgress) {} | |
| 462 | - success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | |
| 463 | - // 请求成功,解析数据 | |
| 464 | - NSLog(@"%@", responseObject); | |
| 465 | - NSDictionary *_dic = [NSDictionary dictionaryWithDictionary:responseObject]; | |
| 466 | - if ([_dic[@"errorCode"] isEqualToString:@"0"]) { | |
| 467 | - NSArray *array = _dic[@"programs"]; | |
| 468 | - if (0 != [array count]) { | |
| 469 | - self->_newsArray = [NSArray arrayWithArray:array]; | |
| 470 | - [self.tableView setFrame:CGRectMake(0, [self->heightArr[self->fontIndex] floatValue], MainScreenWidth, 36 + 86*self->_newsArray.count)]; | |
| 471 | - } else { | |
| 472 | - // [self.errorLabe setFrame:CGRectMake(12, [heightArr[fontIndex] floatValue], MainScreenWidth - 24, 20)]; | |
| 473 | - // self.errorLabe.hidden = NO; | |
| 474 | - } | |
| 475 | - NSLog(@"%@",NSStringFromCGRect(self.tableView.frame)); | |
| 476 | - [self->backgroundView setContentSize:CGSizeMake(MainScreenWidth, [self->heightArr[self->fontIndex] floatValue] + self.tableView.frame.size.height)]; | |
| 477 | - [self.tableView reloadData]; | |
| 478 | - } else { | |
| 479 | - [AlertViewTool showHUDViewText:_dic[@"errorMessage"]]; | |
| 480 | - } | |
| 481 | - } | |
| 482 | - failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | |
| 483 | - // 请求失败 | |
| 484 | - NSLog(@"%@", [error localizedDescription]); | |
| 485 | - [SVProgressHUD dismiss]; | |
| 486 | - [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"ServerBusy")]; | |
| 487 | - }]; | |
| 478 | + NSLog(@"%@",NSStringFromCGRect(self.tableView.frame)); | |
| 479 | + [backgroundView setContentSize:CGSizeMake(MainScreenWidth, [heightArr[fontIndex] floatValue] + self.tableView.frame.size.height)]; | |
| 480 | + [self.tableView reloadData]; | |
| 488 | 481 | } |
| 482 | +#pragma mark - UITableViewDelegate And UITableViewDataSource | |
| 489 | 483 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
| 490 | 484 | return [_newsArray count]; |
| 491 | 485 | } |
| ... | ... | @@ -605,4 +599,15 @@ |
| 605 | 599 | |
| 606 | 600 | } |
| 607 | 601 | |
| 602 | +#pragma mark - Lazy | |
| 603 | +- (VideoDetailPresent *)present | |
| 604 | +{ | |
| 605 | + if (!_present) { | |
| 606 | + _present = [[VideoDetailPresent alloc] init]; | |
| 607 | + _present.currentView = self; | |
| 608 | + _present.delegate = self; | |
| 609 | + } | |
| 610 | + return _present; | |
| 611 | +} | |
| 612 | + | |
| 608 | 613 | @end | ... | ... |
CNLiveScioLive/Pages/Home/新闻详情/OldController/Present/VideoDetailPresent.h
0 → 100644
| 1 | +// | |
| 2 | +// VideoDetailPresent.h | |
| 3 | +// CNLiveScioLive | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/2/25. | |
| 6 | +// Copyright © 2021 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | +@protocol ProgramDelegate<NSObject> | |
| 13 | +@required | |
| 14 | +-(void)programDetail:(NSString *)content; | |
| 15 | +-(void)reloadWithData:(NSArray *)dataArray; | |
| 16 | +@end | |
| 17 | + | |
| 18 | +@interface VideoDetailPresent : NSObject | |
| 19 | +@property(nonatomic,weak) id currentView; | |
| 20 | +@property(nonatomic,weak)id<ProgramDelegate> delegate; | |
| 21 | + | |
| 22 | +-(void)requestProgram:(NSString *)reportId; | |
| 23 | +-(void)loadRelatedInformation:(NSString *)reportId; | |
| 24 | +@end | |
| 25 | + | |
| 26 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveScioLive/Pages/Home/新闻详情/OldController/Present/VideoDetailPresent.m
0 → 100644
| 1 | +// | |
| 2 | +// VideoDetailPresent.m | |
| 3 | +// CNLiveScioLive | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/2/25. | |
| 6 | +// Copyright © 2021 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "VideoDetailPresent.h" | |
| 10 | + | |
| 11 | +@implementation VideoDetailPresent | |
| 12 | + | |
| 13 | +-(void)requestProgram:(NSString *)reportId | |
| 14 | +{ | |
| 15 | + if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { | |
| 16 | + [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")]; | |
| 17 | + return; | |
| 18 | + } | |
| 19 | + NSString *strUrl = @"http://app.phonemovie.cnlive.com/gxb/api/programDetail"; | |
| 20 | + NSLog(@"%@",strUrl); | |
| 21 | + NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"type\":\"program\",\"id\":\"%@\"}",reportId]; | |
| 22 | + NSLog(@"%@",categoryId); | |
| 23 | + NSDictionary *parameters = @{@"params":categoryId}; | |
| 24 | + AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; | |
| 25 | + [manager POST:strUrl | |
| 26 | + parameters:parameters headers:nil | |
| 27 | + progress:^(NSProgress * _Nonnull uploadProgress) {} | |
| 28 | + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | |
| 29 | + // 请求成功,解析数据 | |
| 30 | + NSLog(@"%@", responseObject); | |
| 31 | + NSDictionary *_dic = [NSDictionary dictionaryWithDictionary:responseObject]; | |
| 32 | + if ([_dic[@"errorCode"] isEqualToString:@"0"]) { | |
| 33 | + NSString *content = _dic[@"content"]; | |
| 34 | + CNMessageSend(self.currentView, ProgramDelegate, programDetail:content); | |
| 35 | + | |
| 36 | + } else { | |
| 37 | + [AlertViewTool showHUDViewText:_dic[@"errorMessage"]]; | |
| 38 | + } | |
| 39 | + } | |
| 40 | + failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | |
| 41 | + // 请求失败 | |
| 42 | + NSLog(@"%@", [error localizedDescription]); | |
| 43 | + [SVProgressHUD dismiss]; | |
| 44 | + [AlertViewTool showHUDAddedToView:AppKeyWindow text:CustomStr(@"ServerBusy")]; | |
| 45 | + }]; | |
| 46 | +} | |
| 47 | +- (void)loadRelatedInformation:(NSString *)reportId { | |
| 48 | + if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { | |
| 49 | + [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")]; | |
| 50 | + return; | |
| 51 | + } | |
| 52 | + NSString *strUrl = @"http://app.phonemovie.cnlive.com/gxb/api/programRelative"; | |
| 53 | + NSLog(@"%@",strUrl); | |
| 54 | + NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"cmsContentId\":\"%@\"}",reportId]; | |
| 55 | + NSLog(@"%@",categoryId); | |
| 56 | + NSDictionary *parameters = @{@"params":categoryId}; | |
| 57 | + AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; | |
| 58 | + [manager POST:strUrl | |
| 59 | + parameters:parameters headers:nil | |
| 60 | + progress:^(NSProgress * _Nonnull uploadProgress) {} | |
| 61 | + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | |
| 62 | + // 请求成功,解析数据 | |
| 63 | + NSLog(@"%@", responseObject); | |
| 64 | + NSDictionary *_dic = [NSDictionary dictionaryWithDictionary:responseObject]; | |
| 65 | + if ([_dic[@"errorCode"] isEqualToString:@"0"]) { | |
| 66 | + NSArray *array = _dic[@"programs"]; | |
| 67 | + CNMessageSend(self.currentView, ProgramDelegate, reloadWithData:array); | |
| 68 | + } else { | |
| 69 | + [AlertViewTool showHUDViewText:_dic[@"errorMessage"]]; | |
| 70 | + } | |
| 71 | + } | |
| 72 | + failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | |
| 73 | + // 请求失败 | |
| 74 | + NSLog(@"%@", [error localizedDescription]); | |
| 75 | + [SVProgressHUD dismiss]; | |
| 76 | + [AlertViewTool showHUDAddedToView:AppKeyWindow text:CustomStr(@"ServerBusy")]; | |
| 77 | + }]; | |
| 78 | +} | |
| 79 | +@end | ... | ... |
CNLiveScioLive/Pages/Newsound/OldController/VoiceViewController.m
| ... | ... | @@ -29,6 +29,8 @@ |
| 29 | 29 | UIButton *shareBtn;//分享 |
| 30 | 30 | UIButton *favoriteBtn;//收藏 |
| 31 | 31 | |
| 32 | + UIImageView *reviewImage;//预览图片 | |
| 33 | + | |
| 32 | 34 | UIButton *playBackBtn;//15s |
| 33 | 35 | UIButton *playBtn;//播放 |
| 34 | 36 | UIButton *playNextBtn;//下一首 |
| ... | ... | @@ -645,6 +647,17 @@ static const NSInteger margin = 34; |
| 645 | 647 | playProgress.backgroundColor = HEXCOLOR(0x1959C9); |
| 646 | 648 | [self.view addSubview:playProgress]; |
| 647 | 649 | |
| 650 | + reviewImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; | |
| 651 | + reviewImage.backgroundColor = [UIColor whiteColor]; | |
| 652 | + reviewImage.contentMode = UIViewContentModeScaleAspectFit; | |
| 653 | + [self.view addSubview:reviewImage]; | |
| 654 | + [reviewImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 655 | + make.left.equalTo(self->titleLabel.mas_left); | |
| 656 | + make.right.equalTo(self->titleLabel.mas_right); | |
| 657 | + make.top.equalTo(self->favoriteBtn.mas_bottom).with.offset(5); | |
| 658 | + make.bottom.equalTo(self->playBtn.mas_top).with.offset(-5); | |
| 659 | + }]; | |
| 660 | + | |
| 648 | 661 | } |
| 649 | 662 | //2个列表UI |
| 650 | 663 | - (void)createUI{ |
| ... | ... | @@ -847,6 +860,7 @@ static const NSInteger margin = 34; |
| 847 | 860 | } else { |
| 848 | 861 | sourceLabel.text = [NSString stringWithFormat:@"Source: %@",dic[@"author"]]; |
| 849 | 862 | } |
| 863 | + [reviewImage sd_setImageWithURL:dic[@"imgSmall"]]; | |
| 850 | 864 | // 判断收藏按钮状态 |
| 851 | 865 | TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; |
| 852 | 866 | BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice]; | ... | ... |