No Description

LFWAdWebViewController.m 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. //
  2. // LFWAdWebViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/2/5.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWAdWebViewController.h"
  9. #import <AlibcTradeSDK/AlibcTradeSDK.h>
  10. #import <AlibabaAuthSDK/ALBBSession.h>
  11. #import <AlibabaAuthSDK/ALBBSDK.h>
  12. #import <WebKit/WebKit.h>
  13. @interface LFWAdWebViewController ()<UIWebViewDelegate,UIScrollViewDelegate>
  14. /** webView视图 */
  15. @property (nonatomic, strong) UIWebView *webView;
  16. /** 加载进度条 */
  17. //@property (nonatomic, strong) UIProgressView *progressView;
  18. @property (nonatomic, strong) UIButton *backButton;
  19. @property (nonatomic, strong) UIButton *closeButton;
  20. @end
  21. @implementation LFWAdWebViewController
  22. - (void)viewWillDisappear:(BOOL)animated {
  23. [super viewWillDisappear:animated];
  24. [SVProgressHUD dismiss];
  25. }
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28. if (@available(iOS 11.0, *)) {
  29. self.webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;//UIScrollView也适用
  30. }else {
  31. self.automaticallyAdjustsScrollViewInsets = NO;
  32. }
  33. [self configNavigationBar];
  34. [self initHUD];
  35. [self loadSubViewsConfiguration];
  36. [self openWebView];
  37. }
  38. - (void)initHUD {
  39. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
  40. [SVProgressHUD setForegroundColor:[UIColor YHColorWithHex:0xff2420]];
  41. [SVProgressHUD setBackgroundColor:[UIColor YHColorWithHex:0xf5f4f4]];
  42. }
  43. - (void)configNavigationBar {
  44. self.view.backgroundColor = [UIColor whiteColor];
  45. self.navigationBar.showNavigationBarBottomLine = YES;
  46. [self.navigationBar setCustomLeftButtons:@[self.backButton]];
  47. self.navigationBar.backgroundColor = [UIColor clearColor];
  48. }
  49. - (void)openWebView {
  50. [SVProgressHUD show];
  51. id<AlibcTradePage> page = [AlibcTradePageFactory page:self.url];
  52. //淘客信息
  53. AlibcTradeTaokeParams *taoKeParams=[[AlibcTradeTaokeParams alloc] init];
  54. taoKeParams.pid= ALTK_PID;
  55. //打开方式
  56. AlibcTradeShowParams* showParam = [[AlibcTradeShowParams alloc] init];
  57. showParam.openType = AlibcOpenTypeAuto;
  58. [[AlibcTradeSDK sharedInstance].tradeService show:self.parentViewController webView:self.webView page:page showParams:showParam taoKeParams:taoKeParams trackParam:nil tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable result) {
  59. } tradeProcessFailedCallback:^(NSError * _Nullable error) {
  60. }];
  61. self.webView.delegate = self;
  62. }
  63. #pragma mark-
  64. #pragma mark- UIWebviewDelegate delegate
  65. /**
  66. 当网页加载完成的时候调用
  67. */
  68. - (void)webViewDidFinishLoad:(UIWebView *)webView {
  69. [[UIApplication sharedApplication]setNetworkActivityIndicatorVisible:NO];
  70. [self updateNavigationBarButtons];
  71. // 获取h5的标题
  72. NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
  73. [self.navigationBar setNavTitle:title];
  74. }
  75. - (void)webViewDidStartLoad:(UIWebView *)webView {
  76. [SVProgressHUD dismiss];
  77. }
  78. - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
  79. [SVProgressHUD dismiss];
  80. }
  81. - (void)updateNavigationBarButtons {
  82. if (self.webView.canGoBack) {
  83. [self.navigationBar setCustomLeftButtons:@[self.backButton,self.closeButton]];
  84. }else {
  85. [self.navigationBar setCustomLeftButtons:@[self.backButton]];
  86. }
  87. }
  88. - (void)backAction {
  89. if (self.webView.canGoBack) {
  90. [self.webView goBack];
  91. }else{
  92. [self.navigationController popViewControllerAnimated:YES];
  93. }
  94. }
  95. - (void)closeAction {
  96. [self.navigationController popViewControllerAnimated:YES];
  97. }
  98. #pragma mark --------- lazy -------
  99. - (UIWebView *)webView{
  100. if (!_webView) {
  101. _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight)];
  102. _webView.backgroundColor = [UIColor colorWithRed:240.0/255 green:240.0/255 blue:240.0/255 alpha:1.0];
  103. _webView.delegate = self;
  104. _webView.scrollView.delegate = self;
  105. //自适应
  106. [_webView sizeToFit];
  107. }
  108. return _webView;
  109. }
  110. #pragma mark-
  111. #pragma mark- SetupConstraints
  112. /** 加载配置以及视图添加*/
  113. - (void)loadSubViewsConfiguration{
  114. [self.view addSubview:self.webView];
  115. }
  116. - (UIButton *)backButton {
  117. if (!_backButton) {
  118. _backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  119. [_backButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  120. [_backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  121. }
  122. return _backButton;
  123. }
  124. - (UIButton *)closeButton {
  125. if (!_closeButton) {
  126. _closeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  127. [_closeButton setImage:[UIImage imageNamed:@"close_web"] forState:UIControlStateNormal];
  128. [_closeButton addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
  129. }
  130. return _closeButton;
  131. }
  132. //观察的移除
  133. - (void)dealloc{
  134. }
  135. - (void)didReceiveMemoryWarning {
  136. [super didReceiveMemoryWarning];
  137. // Dispose of any resources that can be recreated.
  138. }
  139. /*
  140. #pragma mark - Navigation
  141. // In a storyboard-based application, you will often want to do a little preparation before navigation
  142. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  143. // Get the new view controller using [segue destinationViewController].
  144. // Pass the selected object to the new view controller.
  145. }
  146. */
  147. -(void)aMtlLABk6:(UIFontWeight*) aMtlLABk6 aurQCGVp:(UIActivity*) aurQCGVp a80S3crtyO:(UIControlEvents*) a80S3crtyO a10sE4oi27:(UIViewController*) a10sE4oi27 aJkzm:(UITableView*) aJkzm aQ9rV:(UIRegion*) aQ9rV ah03bFX:(UIActivity*) ah03bFX a5OUwgnd:(UIMotionEffect*) a5OUwgnd aluXRy:(UIViewController*) aluXRy {
  148. NSLog(@"W65OYLQej0R3UrMFiJz4AcT");
  149. NSLog(@"oDOB9KtU2l3xM8aIwNpiTcXrgPvFQZmSYRnAG0");
  150. NSLog(@"uT6raOVb8KLtDmzJgyeI");
  151. NSLog(@"raBW0FOw1ogHsm7KhlMJyXCLQ9YepTPqfjdGc2");
  152. NSLog(@"iW3sEK5a9UIMFoged");
  153. NSLog(@"8nT5fRhIwoM13G4qWN0dbyPB");
  154. NSLog(@"aU1zGM5lRFqsbhJi2m");
  155. NSLog(@"BNGDEt1k9iRWlJVQH3T6");
  156. NSLog(@"tQbnjD8saAGFWpME1yH9VxONfgkzKBoruZ");
  157. NSLog(@"ASIYxnN3JhQWU74kuKDs0GEFwygjVtrMm");
  158. NSLog(@"Bx9QsLgfkd6VKmNTuWZXz4rGM");
  159. NSLog(@"qaCO9gpBxr");
  160. NSLog(@"f75vaJB6bxdiLIrNDmApQEP2ZCclnR");
  161. NSLog(@"MrSmuwovGYX16V9nIKfbEiJ4tFs");
  162. NSLog(@"T3rgvcKeJWjUtCPk");
  163. NSLog(@"lROgxkyu2FSojMQh0wLtXsm4v89CVUdEI1qN");
  164. }
  165. -(void)a4fC1esmr:(UIBarButtonItem*) a4fC1esmr av41pW:(UIMenuItem*) av41pW amZ98paVJ:(UIDevice*) amZ98paVJ a79gMI1t:(UIVisualEffectView*) a79gMI1t aZnr5w1:(UIApplication*) aZnr5w1 aLjXdtalsW:(UIInputView*) aLjXdtalsW ai4h2T:(UIImageView*) ai4h2T aZxDy:(UIControlEvents*) aZxDy asHuh:(UIScreen*) asHuh {
  166. NSLog(@"sqmyLbn4cij0woZY");
  167. NSLog(@"qk5rocTtCMAYJ8O");
  168. NSLog(@"lPNBTo65Xz2x");
  169. NSLog(@"uhRx0frcaDz");
  170. NSLog(@"VGvli0mL8aOuDsnEyCrfz1tSAcWh6Hgq52oN4JBM");
  171. NSLog(@"6bLtcJXl9KDH0ZTmMgAkRs1xBC");
  172. NSLog(@"0AfVuKj61QWBNRzdUinO");
  173. NSLog(@"DvcEHS6XqAzMbGkTiQfK5VwsF7ge");
  174. NSLog(@"NB2owJEZW3sgD1xIrdeh450RP7cCyQzXm");
  175. NSLog(@"B39Z4zHNxUPMfISprX5DG7V6bYqtAKg");
  176. NSLog(@"VMgu7DQtRexbOBwkXfTWLcE5I80oaYsN1j9np6");
  177. NSLog(@"fBaiw5oJguErOs2d7DCxmV4bjp3Xq8R1kKNM");
  178. NSLog(@"eFgVjbAYm2Nfo7t8GZMdE5RUc9BqJziKH");
  179. NSLog(@"EoiOfMpWtRUmA6djDTgHecXaJv");
  180. NSLog(@"WZVuMUFqDH7z5jTgNx2G");
  181. NSLog(@"JpKEF3W7VNTAbBSq6DgZHLalm0RU");
  182. NSLog(@"QwxBjFVhyHzKpS2");
  183. NSLog(@"kWLY8dBpalQZjr47coyVC1DhiAqbv95NKX");
  184. }
  185. -(void)a2svA:(UIFont*) a2svA afHe9bhE7l:(UIVisualEffectView*) afHe9bhE7l asxWXeLdtZr:(UIDevice*) asxWXeLdtZr acyjJL:(UIMotionEffect*) acyjJL af5eW:(UIActivity*) af5eW aRjMwNP:(UISwitch*) aRjMwNP afpI9No:(UIDocument*) afpI9No a0TxBX89w1:(UIFontWeight*) a0TxBX89w1 aaHh29o8m:(UIDevice*) aaHh29o8m aNXY6:(UIApplication*) aNXY6 aXj3V6C:(UIEdgeInsets*) aXj3V6C aVG7cFv:(UIControl*) aVG7cFv aWUh80J1Mp:(UIFont*) aWUh80J1Mp aCku4bUPpl:(UIImage*) aCku4bUPpl aPGqiFt:(UIApplication*) aPGqiFt aCcUM1:(UIColor*) aCcUM1 asvSEk3mnFT:(UIBezierPath*) asvSEk3mnFT anSaJwqPiM:(UIViewController*) anSaJwqPiM {
  186. NSLog(@"g7OJ8aAyvw9c");
  187. NSLog(@"GoxbzAnBCL68gXckvImQeMFi2yV");
  188. NSLog(@"l3J7yLvHDjecMXBZomNk0");
  189. NSLog(@"val1y7SUBshIFndjOVA3u8N");
  190. NSLog(@"Ah9H3YBjMILu");
  191. NSLog(@"hLxPMdKu3JeTnqkyBS6fzbl7tXpg29R45wAHDaco");
  192. NSLog(@"VceJgkxnUIF0ZsOPdlG8uvmE2htBDqy3");
  193. NSLog(@"aKW43uVnXONkMjYTB6PfAp7SRG");
  194. NSLog(@"0NFIelMHuiO1462gJBvGdfz");
  195. NSLog(@"YSevcginj3mhWlN0ykPZxfVJ9azoLQT1U");
  196. NSLog(@"pHwk5cj0fSr8OUe");
  197. }
  198. -(void)aEzHviX:(UIActivity*) aEzHviX a34GLHkg:(UISwitch*) a34GLHkg ahgYDk3WHaZ:(UIView*) ahgYDk3WHaZ aIl6shz:(UIScreen*) aIl6shz aJfW0DK:(UIWindow*) aJfW0DK ayP63ugkvF0:(UIMotionEffect*) ayP63ugkvF0 {
  199. NSLog(@"C2uG7sV5iLrfYDX4PEhcQ3tWkHR8advAjTop6");
  200. NSLog(@"ycnYQi5GbuAxUwthIjdW6z4MaEV1ZrN");
  201. NSLog(@"aJkor6fscTv04XmbjSY2VLC3UR5gOZ");
  202. NSLog(@"ijGAn4HYozQ9a8SCwDltZuh1MPBFrxKegvWsO");
  203. NSLog(@"ECjtXaUrsTG631uReSfLQ9Kzy4vlnMp");
  204. NSLog(@"XE72tUeO6W3YsIcwB9Q");
  205. NSLog(@"TI5jBhxqUVSu3NRwXzYc7mEHaOgfJL");
  206. NSLog(@"8LYQRzJa6tFcnOm7X5s9");
  207. NSLog(@"W6fJU7dOpIwBsi5m9rQt4TqauHK3XC");
  208. NSLog(@"5u3lxLwR0G82IKzWchaMsUJAFEX");
  209. }
  210. -(void)awbrVkl6fQC:(UISearchBar*) awbrVkl6fQC aChGi:(UIImageView*) aChGi at2L0:(UIKeyCommand*) at2L0 aaOy1fP0M:(UISwitch*) aaOy1fP0M a03rvFA:(UICollectionView*) a03rvFA am91B8Jvdg0:(UIUserInterfaceIdiom*) am91B8Jvdg0 a9mkFLxs:(UIViewController*) a9mkFLxs arI10:(UILabel*) arI10 aD5m26ChiYe:(UIAlertView*) aD5m26ChiYe aECTil:(UIBezierPath*) aECTil a7xoFQs2z81:(UIColor*) a7xoFQs2z81 ahG9fRxn:(UIKeyCommand*) ahG9fRxn aaBjlYiEs:(UIBezierPath*) aaBjlYiEs aVX82euYTD:(UISearchBar*) aVX82euYTD aB1u0cKWNzr:(UIEdgeInsets*) aB1u0cKWNzr aeQJMoNGX:(UIBezierPath*) aeQJMoNGX aQhFUd1:(UIUserInterfaceIdiom*) aQhFUd1 a9E7T1k3fX5:(UIViewController*) a9E7T1k3fX5 asaHCd1Sl4:(UIViewController*) asaHCd1Sl4 aE6jL:(UIBarButtonItem*) aE6jL {
  211. NSLog(@"VyI67JxqPu");
  212. NSLog(@"71YvGSfboQKXF4ORZ3WAk9ythqzgTN");
  213. NSLog(@"KcOaIu7LRUjNvTmqPDxf35X");
  214. NSLog(@"6Qrb73aYOwFIWulAVJGUR4qzxpkT50jtN8ce");
  215. NSLog(@"tA4SBcLjFTkCeh2wsMD3V");
  216. NSLog(@"FyVnhCSmQzEHUpK3BeXkMN8wbcZR7xO2l0P");
  217. NSLog(@"UOwc1V2R6mvbtqP30KgCp9LkWshHeM54");
  218. NSLog(@"Oy8pUXmkYSTvEF5uPbj");
  219. NSLog(@"boD8jAn0L3YRieTSJE9Vh7frxckp");
  220. NSLog(@"TOu9befXP2HRrdcVLi4");
  221. NSLog(@"DXuSgT38xAy6rEhYztbjVNvRmKHa");
  222. NSLog(@"QD1JNWXLnc8I07trYGmgxiVTH9a5");
  223. }
  224. -(void)aghcFx:(UIColor*) aghcFx aCzx9ymXvAV:(UIDocument*) aCzx9ymXvAV ay1UteDRo:(UIRegion*) ay1UteDRo aZgvP6d:(UIUserInterfaceIdiom*) aZgvP6d atZaBY3:(UIBarButtonItem*) atZaBY3 arvEQKI:(UIActivity*) arvEQKI aRwJk:(UIDevice*) aRwJk aXONmeS7Tbg:(UIEdgeInsets*) aXONmeS7Tbg abDA70Q:(UIBezierPath*) abDA70Q anYQs6awCDv:(UIFont*) anYQs6awCDv a2HFV4ogjWv:(UIInputView*) a2HFV4ogjWv acbzdJ2FV:(UIDevice*) acbzdJ2FV {
  225. NSLog(@"Cn4xQtlL8i53gWzhGJ");
  226. NSLog(@"3ebhmsJXf0d5K2a1DRMGycNrk8ITlSqFO6iw9");
  227. NSLog(@"m0IvjLhkQin2JXquyMZUpGtYg");
  228. NSLog(@"T6kCvuHjAWgaRKBzql9ZoypeIrhYXDO5ENsG3Fm");
  229. NSLog(@"PbLTHX8WlZ3tIw09iEOJU2C6");
  230. NSLog(@"tLPaneJX1ZxGFYf2qpkCgWcNbmwTSsuzli9V73");
  231. NSLog(@"beuyLB4ztX53HZ0o1iThfMDYWmdlI7C2UOgNwsr");
  232. NSLog(@"FVJn3xKM94HsewgSZEdq51y2cPmkBr6iOXhf");
  233. NSLog(@"AL4H1ovDQbY3P9d6cTSO");
  234. NSLog(@"rB53suNhmgGSoZdRVF6EOtjpe");
  235. NSLog(@"Bzmt4CjrZNIRXhibaEq");
  236. NSLog(@"2lCSHiOxzU6BD7915cdrJgu0EkNbQPL");
  237. NSLog(@"vtfgxPSNZiVm92zs5dE");
  238. NSLog(@"zkWA240xjcMZHrpUQ9YvBiE76");
  239. NSLog(@"mXzc3FCAf4h8ou5PMTZ2Stw");
  240. NSLog(@"Zj0FJNzxCbgrQ");
  241. NSLog(@"vLn3QCpuYZof4IRVbhXWFyN97i6zdGcAHsOge");
  242. NSLog(@"iUoW3TzxCIymaR7r0HZPkt4SJ");
  243. }
  244. -(void)aeTtDU:(UIAlertView*) aeTtDU aieqs0gT:(UIMenuItem*) aieqs0gT azjY2q6d:(UIMotionEffect*) azjY2q6d ayUnxVED1tO:(UIControl*) ayUnxVED1tO a16RLUi:(UIDocument*) a16RLUi aEwIJDerx:(UIColor*) aEwIJDerx awN95:(UIImage*) awN95 a9myVRbA:(UIBezierPath*) a9myVRbA aGmcyZzq:(UISwitch*) aGmcyZzq azaHcT:(UISearchBar*) azaHcT aRs1ixfLy:(UIImage*) aRs1ixfLy {
  245. NSLog(@"w5A7vuhYMzxkJGENgl16SfHXcBpT980C");
  246. NSLog(@"tC5rvJwPHK0WX1axSDO74");
  247. NSLog(@"hYG7nxqrduiKf54U3");
  248. NSLog(@"V1Ns38bBj5mtWMgwGqh6v0lK");
  249. NSLog(@"QgyG1jcPIHuSr5anUYiXJqA7xOs4WZEfTeh");
  250. NSLog(@"toVfcd93ir7EqGBUCWa");
  251. NSLog(@"LuDOd9RmiY5");
  252. NSLog(@"LGbhDd0RNiVKaI3y79");
  253. NSLog(@"tEaWQHyNervxDopus");
  254. NSLog(@"xtQaYXkoybqnDW97U8v1lMj6Nfge40L");
  255. NSLog(@"XpcTOfyomidNCHrgBz2");
  256. NSLog(@"YwTkbrMKxIUAX");
  257. NSLog(@"3GKxIT10UuZq8");
  258. NSLog(@"0m8xENbwAr");
  259. NSLog(@"dkLz36DWmIc2qp57aPyYwbMH4gsh1NZ8TUn");
  260. NSLog(@"9oXVexMsaH0");
  261. NSLog(@"dbcNUgIDj4toeFrO3VWPiBlhqf7EHs1G9Zw");
  262. NSLog(@"PyE36bMrBhxGtJ2lZ5XOzRcAi0");
  263. }
  264. -(void)aEYBlgr:(UIActivity*) aEYBlgr anmxo:(UIActivity*) anmxo aLv8h:(UISearchBar*) aLv8h aeVFox2:(UIAlertView*) aeVFox2 ahPGlz:(UIVisualEffectView*) ahPGlz aKrwBsLTChk:(UIAlertView*) aKrwBsLTChk arxCU87:(UIImageView*) arxCU87 aLOAE:(UICollectionView*) aLOAE aUWkT:(UIBarButtonItem*) aUWkT aJ3n9Oha7i:(UIKeyCommand*) aJ3n9Oha7i {
  265. NSLog(@"6vsXRe8nCqiO4mU9jbLJ3aWyT");
  266. NSLog(@"wP1RF5boHqgZjd");
  267. NSLog(@"TiQ1UB48fJ");
  268. NSLog(@"TtUx7c5CSXgfLywYhvEBWaMpkGszq0Z93KO6N");
  269. NSLog(@"lvb8GaOwePiWdJBIUHS049qnL2VXAujcY1t");
  270. NSLog(@"Pud5xV7okNZMrisFX8QGHqlt");
  271. NSLog(@"gjltBocRTWpHbqisVaM7F");
  272. NSLog(@"cYIRLOEn3Q17eVKZfxMAgovr5HXlkTq6bCpm4aPw");
  273. NSLog(@"SpBXFcgMk3V");
  274. NSLog(@"aoeRLEwpSb38Z2B0izAntl71mMTHO");
  275. NSLog(@"8U9kP6p51uXWQseH");
  276. NSLog(@"UVh1ZlPTQOe8Rc2EA6L");
  277. NSLog(@"d8fFgVJshS27eHn4cawvT5DGW1");
  278. NSLog(@"pVL7UouIDmCGwfz924bP80RSiWtl5FhsZ3qyTJ");
  279. NSLog(@"ZioQhObL1FGnHJMyTejB4sXU5PgfIq8");
  280. NSLog(@"JiPkmQnWdZFuV3LslCyKrG90pXtN");
  281. NSLog(@"1HVtTcE26rDMhG5RUq8uNFml97gpe");
  282. NSLog(@"UrIa3ecljqvByTK6Aop9bR8M5Q");
  283. }
  284. @end