Commit f4ae3d57ab0a10cb2d6b6866eda24f846512964a
1 parent
0196d7d3
no message
Showing
3 changed files
with
82 additions
and
61 deletions
CNLiveScioLive/Pages/Live/Controller/VideoPlayBackViewController.h
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | #import <MediaPlayer/MediaPlayer.h> |
| 12 | 12 | #import "ZXVideoPlayerController.h" |
| 13 | 13 | #import "CNLivePlayerController.h" |
| 14 | -@interface VideoPlayBackViewController : BaseViewController<UITableViewDelegate,UITableViewDataSource,WKNavigationDelegate>{ | |
| 14 | +@interface VideoPlayBackViewController : BaseViewController<UITableViewDelegate,UITableViewDataSource,WKNavigationDelegate, WKUIDelegate>{ | |
| 15 | 15 | UIScrollView *backgroundView; |
| 16 | 16 | UIImageView *imageView; |
| 17 | 17 | UIButton *playBtn; | ... | ... |
CNLiveScioLive/Pages/Live/Controller/VideoPlayBackViewController.m
| ... | ... | @@ -72,10 +72,7 @@ |
| 72 | 72 | [SVProgressHUD show]; |
| 73 | 73 | AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; |
| 74 | 74 | manager.responseSerializer = [AFHTTPResponseSerializer serializer]; |
| 75 | - [manager POST:tuwen([_dictionary[@"gxbArticleId"] intValue]) | |
| 76 | - parameters:nil headers:nil | |
| 77 | - progress:^(NSProgress * _Nonnull uploadProgress) {} | |
| 78 | - success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | |
| 75 | + [manager POST:tuwen([_dictionary[@"gxbArticleId"] intValue]) parameters:nil headers:nil progress:^(NSProgress * _Nonnull uploadProgress) {} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | |
| 79 | 76 | // 请求成功,解析数据 |
| 80 | 77 | NSString * jsonString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; |
| 81 | 78 | // NSLog(@"jsonString == %@",jsonString); |
| ... | ... | @@ -84,14 +81,14 @@ |
| 84 | 81 | // NSLog(@"%@", _dicArticle); |
| 85 | 82 | [self->_webView loadHTMLString:[self setHTMLString] baseURL:nil]; |
| 86 | 83 | [SVProgressHUD dismiss]; |
| 87 | - } | |
| 88 | - failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | |
| 89 | - // 请求失败 | |
| 90 | - NSLog(@"%@", [error localizedDescription]); | |
| 91 | - [SVProgressHUD dismiss]; | |
| 92 | - //[SVProgressHUD showErrorWithStatus:CustomStr(@"ServerBusy") duration:0.5]; | |
| 93 | - | |
| 94 | - }]; | |
| 84 | + | |
| 85 | + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | |
| 86 | + // 请求失败 | |
| 87 | + NSLog(@"%@", [error localizedDescription]); | |
| 88 | + [SVProgressHUD dismiss]; | |
| 89 | + //[SVProgressHUD showErrorWithStatus:CustomStr(@"ServerBusy") duration:0.5]; | |
| 90 | + | |
| 91 | + }]; | |
| 95 | 92 | } |
| 96 | 93 | - (void)loadShareView { |
| 97 | 94 | UIImageView *lineImage = [[UIImageView alloc] init]; |
| ... | ... | @@ -225,7 +222,18 @@ |
| 225 | 222 | } |
| 226 | 223 | backgroundView.bounces = NO; |
| 227 | 224 | [self.view addSubview:backgroundView]; |
| 228 | - relatedWebView = [[WKWebView alloc] initWithFrame:CGRectZero]; | |
| 225 | + // | |
| 226 | + | |
| 227 | + WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc]init]; | |
| 228 | + | |
| 229 | + config.preferences = [WKPreferences new]; | |
| 230 | + config.preferences.minimumFontSize = 20; | |
| 231 | + | |
| 232 | + config.preferences.javaScriptEnabled = YES; | |
| 233 | + config.preferences.javaScriptCanOpenWindowsAutomatically = YES; | |
| 234 | + config.userContentController = [[WKUserContentController alloc]init]; | |
| 235 | + relatedWebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, MainScreenWidth, 200) configuration:config]; | |
| 236 | +// relatedWebView = [[WKWebView alloc] initWithFrame:CGRectZero]; | |
| 229 | 237 | relatedWebView.scrollView.backgroundColor = [UIColor whiteColor]; |
| 230 | 238 | // relatedWebView.dataDetectorTypes = UIDataDetectorTypeNone; |
| 231 | 239 | relatedWebView.backgroundColor = [UIColor whiteColor]; |
| ... | ... | @@ -404,51 +412,61 @@ |
| 404 | 412 | - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation |
| 405 | 413 | { |
| 406 | 414 | if (1000 == webView.tag) { |
| 407 | - CGRect frame = relatedWebView.frame; | |
| 408 | - frame.size.width = MainScreenWidth; | |
| 409 | - frame.size.height = 1; | |
| 410 | - relatedWebView.frame = frame; | |
| 411 | - descriptionHeight = relatedWebView.scrollView.contentSize.height; | |
| 412 | - [relatedWebView setFrame:CGRectMake(0, 0, MainScreenWidth, descriptionHeight)]; | |
| 413 | - lineImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, descriptionHeight, MainScreenWidth, 1)]; | |
| 414 | - lineImage1.backgroundColor = Color_Line; | |
| 415 | - [backgroundView addSubview:lineImage1]; | |
| 416 | - | |
| 417 | - upDownButton = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 418 | - [upDownButton addTarget:self action:@selector(showGraphicLive:) forControlEvents:UIControlEventTouchUpInside]; | |
| 419 | - [upDownButton setFrame:CGRectMake(0, descriptionHeight, MainScreenWidth, 40)]; | |
| 420 | - [backgroundView addSubview:upDownButton]; | |
| 421 | - | |
| 422 | - UILabel *graphicLive = [[UILabel alloc] initWithFrame:CGRectMake(20, descriptionHeight, MainScreenWidth/2, 40)]; | |
| 423 | - graphicLive.font = [UIFont systemFontOfSize:13]; | |
| 424 | - graphicLive.backgroundColor = [UIColor clearColor]; | |
| 425 | - graphicLive.textColor = HEXCOLOR(0x184085); | |
| 426 | - [backgroundView addSubview:graphicLive]; | |
| 427 | - graphicLive.text = @"发布会图文播报"; | |
| 428 | - | |
| 429 | - upDownImage = [[UIImageView alloc] initWithFrame:CGRectMake(MainScreenWidth - 31, descriptionHeight + 16, 13, 7)]; | |
| 430 | - upDownImage.image = [UIImage imageNamed:@"cnlive_button_down"]; | |
| 431 | - [backgroundView addSubview:upDownImage]; | |
| 432 | - | |
| 433 | - lineImage2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 40 + descriptionHeight, MainScreenWidth, 1)]; | |
| 434 | - lineImage2.backgroundColor = Color_Line; | |
| 435 | - [backgroundView addSubview:lineImage2]; | |
| 436 | - | |
| 437 | - [backgroundView setContentSize:CGSizeMake(MainScreenWidth, 40 + descriptionHeight)]; | |
| 438 | - | |
| 439 | - _webView = [[WKWebView alloc] initWithFrame:CGRectZero]; | |
| 440 | - _webView.scrollView.backgroundColor = [UIColor clearColor]; | |
| 441 | - // _webView.dataDetectorTypes = UIDataDetectorTypeNone; | |
| 442 | - _webView.backgroundColor = [UIColor clearColor]; | |
| 443 | - _webView.scrollView.bounces = NO; | |
| 444 | - _webView.UIDelegate = self; | |
| 445 | - | |
| 446 | - _webView.opaque = NO; | |
| 447 | - _webView.tag = 2000; | |
| 415 | + CGRect frame = relatedWebView.frame; | |
| 416 | + frame.size.width = MainScreenWidth; | |
| 417 | + frame.size.height = 1; | |
| 418 | + relatedWebView.frame = frame; | |
| 419 | + descriptionHeight = relatedWebView.scrollView.contentSize.height; | |
| 420 | + [relatedWebView setFrame:CGRectMake(0, 0, MainScreenWidth, descriptionHeight)]; | |
| 421 | + lineImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, descriptionHeight, MainScreenWidth, 1)]; | |
| 422 | + lineImage1.backgroundColor = Color_Line; | |
| 423 | + [backgroundView addSubview:lineImage1]; | |
| 424 | + | |
| 425 | + upDownButton = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 426 | + [upDownButton addTarget:self action:@selector(showGraphicLive:) forControlEvents:UIControlEventTouchUpInside]; | |
| 427 | + [upDownButton setFrame:CGRectMake(0, descriptionHeight, MainScreenWidth, 40)]; | |
| 428 | + [backgroundView addSubview:upDownButton]; | |
| 429 | + | |
| 430 | + UILabel *graphicLive = [[UILabel alloc] initWithFrame:CGRectMake(20, descriptionHeight, MainScreenWidth/2, 40)]; | |
| 431 | + graphicLive.font = [UIFont systemFontOfSize:13]; | |
| 432 | + graphicLive.backgroundColor = [UIColor clearColor]; | |
| 433 | + graphicLive.textColor = HEXCOLOR(0x184085); | |
| 434 | + [backgroundView addSubview:graphicLive]; | |
| 435 | + graphicLive.text = @"发布会图文播报"; | |
| 436 | + | |
| 437 | + upDownImage = [[UIImageView alloc] initWithFrame:CGRectMake(MainScreenWidth - 31, descriptionHeight + 16, 13, 7)]; | |
| 438 | + upDownImage.image = [UIImage imageNamed:@"cnlive_button_down"]; | |
| 439 | + [backgroundView addSubview:upDownImage]; | |
| 440 | + | |
| 441 | + lineImage2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 40 + descriptionHeight, MainScreenWidth, 1)]; | |
| 442 | + lineImage2.backgroundColor = Color_Line; | |
| 443 | + [backgroundView addSubview:lineImage2]; | |
| 444 | + | |
| 445 | + [backgroundView setContentSize:CGSizeMake(MainScreenWidth, 40 + descriptionHeight)]; | |
| 448 | 446 | |
| 449 | - [backgroundView addSubview:_webView]; | |
| 450 | - [self loadRelatedInformation]; | |
| 451 | - [self loadData]; | |
| 447 | + WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc]init]; | |
| 448 | + | |
| 449 | + config.preferences = [WKPreferences new]; | |
| 450 | + config.preferences.minimumFontSize = 12; | |
| 451 | + | |
| 452 | + config.preferences.javaScriptEnabled = YES; | |
| 453 | + config.preferences.javaScriptCanOpenWindowsAutomatically = YES; | |
| 454 | + config.userContentController = [[WKUserContentController alloc]init]; | |
| 455 | + _webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:config]; | |
| 456 | + | |
| 457 | +// _webView = [[WKWebView alloc] initWithFrame:CGRectZero]; | |
| 458 | + _webView.scrollView.backgroundColor = [UIColor clearColor]; | |
| 459 | +// _webView.dataDetectorTypes = UIDataDetectorTypeNone; | |
| 460 | + _webView.backgroundColor = [UIColor clearColor]; | |
| 461 | + _webView.scrollView.bounces = NO; | |
| 462 | + _webView.UIDelegate = self; | |
| 463 | + | |
| 464 | + _webView.opaque = NO; | |
| 465 | + _webView.tag = 2000; | |
| 466 | + | |
| 467 | + [backgroundView addSubview:_webView]; | |
| 468 | + [self loadRelatedInformation]; | |
| 469 | + [self loadData]; | |
| 452 | 470 | } |
| 453 | 471 | else if (2000 == webView.tag) { |
| 454 | 472 | CGFloat width = MainScreenWidth - 20; | ... | ... |
CNLiveScioLive/Pages/Tools/DBAction/DBAction.m
| ... | ... | @@ -130,8 +130,11 @@ static DBAction *instance = nil; |
| 130 | 130 | BOOL res = [db executeUpdate:sql]; |
| 131 | 131 | if (!res) { |
| 132 | 132 | NSLog(@"建表失败"); |
| 133 | - NSString *sql = [NSString stringWithFormat:@"ALTER TABLE %@ ADD %@ INTEGER",@"DATATABLE",@"playType"]; | |
| 134 | - BOOL result = [db executeUpdate:sql]; | |
| 133 | + NSString *sql1 = [NSString stringWithFormat:@"ALTER TABLE %@ ADD %@ VARCHAR",@"DATATABLE",@"playType"]; | |
| 134 | + BOOL result1 = [db executeUpdate:sql1]; | |
| 135 | + | |
| 136 | + NSString *sql2 = [NSString stringWithFormat:@"ALTER TABLE %@ ADD %@ VARCHAR",@"DATATABLE",@"uuid"]; | |
| 137 | + BOOL result2 = [db executeUpdate:sql2]; | |
| 135 | 138 | |
| 136 | 139 | } else { |
| 137 | 140 | NSLog(@"建表成功"); |
| ... | ... | @@ -160,7 +163,7 @@ static DBAction *instance = nil; |
| 160 | 163 | FMResultSet * re = [db executeQuery:check]; |
| 161 | 164 | if (![re next]) { |
| 162 | 165 | NSString *desc = [notice.desc stringByReplacingOccurrencesOfString:@"'" withString:@"''"]; |
| 163 | - NSString * sql = [NSString stringWithFormat:@"INSERT INTO DATATABLE (cmsColumnName, cmsColumnId, cmsContentId, createDate, desc, gxbArticleId, gxbVideoId, img, pageUrl, picType, playType, publishDate, subTitle, title, type, uploadVideoUrl, videoUrl, vipFlag, uuid) values('%@','%@','%d', '%@','%@','%d','%d', '%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%d', '%@')", notice.cmsColumnName, notice.cmsColumnId, notice.cmsContentId, notice.createDate, desc, notice.gxbArticleId, notice.gxbVideoId, notice.img, notice.pageUrl, notice.picType, notice.playType, notice.publishDate, notice.subTitle, notice.title, notice.type, notice.uploadVideoUrl, notice.videoUrl, notice.vipFlag, notice.uuid]; | |
| 166 | + NSString * sql = [NSString stringWithFormat:@"INSERT INTO DATATABLE (cmsColumnName, cmsColumnId, cmsContentId, createDate, desc, gxbArticleId, gxbVideoId, img, pageUrl, picType, playType, publishDate, subTitle, title, type, uploadVideoUrl, videoUrl, vipFlag, uuid) values('%@','%@','%d', '%@','%@','%d','%d', '%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%d', '%@')", notice.cmsColumnName, notice.cmsColumnId, notice.cmsContentId, notice.createDate, desc, notice.gxbArticleId, notice.gxbVideoId, notice.img, notice.pageUrl, notice.picType, notice.playType, notice.publishDate, notice.subTitle, notice.title, notice.type, notice.uploadVideoUrl, notice.videoUrl, notice.vipFlag, notice.uuid?notice.uuid:@""]; | |
| 164 | 167 | BOOL res = [db executeUpdate:sql]; |
| 165 | 168 | if (!res) { |
| 166 | 169 | return NO; | ... | ... |