两折卖----返利app-----返利圈

LZMWebPageViewController.m 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. //
  2. // LZMWebPageViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/31.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMWebPageViewController.h"
  9. #import <AlibcTradeSDK/AlibcTradeSDK.h>
  10. #import <AlibabaAuthSDK/ALBBSession.h>
  11. #import <AlibabaAuthSDK/ALBBSDK.h>
  12. #import "LZMTaobaoAuthorView.h"
  13. @interface LZMWebPageViewController ()<UIWebViewDelegate>
  14. @property (nonatomic, strong) UIButton *backButton;
  15. @property (nonatomic, strong) UIButton *closeButton;
  16. @property (nonatomic, strong) LZMTaobaoAuthorView *authorView;
  17. @end
  18. @implementation LZMWebPageViewController
  19. - (instancetype)init {
  20. self = [super init];
  21. if (self) {
  22. [self configWebView];
  23. }
  24. return self;
  25. }
  26. - (void)viewWillDisappear:(BOOL)animated {
  27. [super viewWillDisappear:animated];
  28. [SVProgressHUD dismiss];
  29. }
  30. - (void)viewWillAppear:(BOOL)animated {
  31. [super viewWillAppear:animated];
  32. [self configTaobaoAuthorView];
  33. }
  34. - (void)viewDidLoad {
  35. [super viewDidLoad];
  36. [self initHUD];
  37. [self configNavigationBar];
  38. }
  39. - (void)configTaobaoAuthorView {
  40. if ([[ALBBSession sharedInstance] isLogin]){
  41. [self openAliMyOrderWebView];
  42. self.webView.hidden = NO;
  43. self.authorView.hidden = YES;
  44. }else {
  45. self.webView.hidden = YES;
  46. self.authorView.hidden = NO;
  47. }
  48. }
  49. - (void)initHUD {
  50. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
  51. [SVProgressHUD setForegroundColor:[UIColor YHColorWithHex:0xff2420]];
  52. [SVProgressHUD setBackgroundColor:[UIColor YHColorWithHex:0xf5f4f4]];
  53. }
  54. - (void)configWebView {
  55. self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight)];
  56. self.webView.delegate = self;
  57. [self.view addSubview:self.webView];
  58. self.authorView = [[LZMTaobaoAuthorView alloc] initWithFrame:self.webView.frame text:@"授权淘宝登录,一键查看淘宝内商品" clickBlock:^{
  59. //淘宝授权
  60. ALBBSDK *albbSDK = [ALBBSDK sharedInstance];
  61. [albbSDK setAppkey:ALBC_APP_KEY];
  62. [albbSDK setAuthOption:NormalAuth];
  63. [albbSDK auth:self successCallback:^(ALBBSession *session){
  64. [self configTaobaoAuthorView];
  65. } failureCallback:^(ALBBSession *session,NSError *error){
  66. }];
  67. }];
  68. [self.view addSubview:self.authorView];
  69. }
  70. - (void)configNavigationBar {
  71. self.view.backgroundColor = [UIColor whiteColor];
  72. self.navigationBar.showNavigationBarBottomLine = YES;
  73. [self.navigationBar setCustomLeftButtons:@[self.backButton]];
  74. }
  75. - (void)backAction {
  76. if (self.webView.canGoBack) {
  77. [self.webView goBack];
  78. }else{
  79. [self.navigationController popViewControllerAnimated:YES];
  80. }
  81. }
  82. - (void)closeAction {
  83. [self.navigationController popViewControllerAnimated:YES];
  84. }
  85. - (void)updateNavigationBarButtons {
  86. if (self.webView.canGoBack) {
  87. [self.navigationBar setCustomLeftButtons:@[self.backButton,self.closeButton]];
  88. }else {
  89. [self.navigationBar setCustomLeftButtons:@[self.backButton]];
  90. }
  91. }
  92. - (void)openAliMyOrderWebView {
  93. [SVProgressHUD show];
  94. switch (self.openPage) {
  95. case AlibcOpenPageShopCar:
  96. {
  97. id<AlibcTradePage> page = [AlibcTradePageFactory myCartsPage];
  98. [self openWebViewByPage:page];
  99. }
  100. break;
  101. case AlibcOpenPageMyOrder:
  102. {
  103. id<AlibcTradePage> page = [AlibcTradePageFactory myOrdersPage:0 isAllOrder:YES];
  104. [self openWebViewByPage:page];
  105. }
  106. break;
  107. default:
  108. {
  109. id<AlibcTradePage> page = [AlibcTradePageFactory myOrdersPage:0 isAllOrder:YES];
  110. [self openWebViewByPage:page];
  111. }
  112. break;
  113. }
  114. }
  115. - (void)openWebViewByPage:(id<AlibcTradePage>)page {
  116. //淘客信息
  117. AlibcTradeTaokeParams *taoKeParams=[[AlibcTradeTaokeParams alloc] init];
  118. taoKeParams.pid = ALTK_PID;
  119. //打开方式
  120. AlibcTradeShowParams* showParam = [[AlibcTradeShowParams alloc] init];
  121. showParam.openType = AlibcOpenTypeH5;
  122. [[AlibcTradeSDK sharedInstance].tradeService show:self webView:self.webView page:page showParams:showParam taoKeParams:taoKeParams trackParam:nil tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable result) {
  123. } tradeProcessFailedCallback:^(NSError * _Nullable error) {
  124. }];
  125. self.webView.delegate = self;
  126. }
  127. #pragma mark -------------- UIWebView delegate --------
  128. - (void)webViewDidFinishLoad:(UIWebView *)webView {
  129. [self updateNavigationBarButtons];
  130. [SVProgressHUD dismiss];
  131. // NSString *jsToGetHTMLSource = @"document.getElementsByTagName('html')[0].innerHTML";
  132. //
  133. // NSString *HTMLSource = [self.webView stringByEvaluatingJavaScriptFromString:jsToGetHTMLSource];
  134. //
  135. // NSLog(@"------------:%@",HTMLSource);
  136. }
  137. - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
  138. [SVProgressHUD dismiss];
  139. }
  140. #pragma mark ------
  141. - (UIButton *)backButton {
  142. if (!_backButton) {
  143. _backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  144. [_backButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  145. [_backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  146. }
  147. return _backButton;
  148. }
  149. - (UIButton *)closeButton {
  150. if (!_closeButton) {
  151. _closeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  152. [_closeButton setImage:[UIImage imageNamed:@"close_web"] forState:UIControlStateNormal];
  153. [_closeButton addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
  154. }
  155. return _closeButton;
  156. }
  157. - (void)didReceiveMemoryWarning {
  158. [super didReceiveMemoryWarning];
  159. // Dispose of any resources that can be recreated.
  160. }
  161. /*
  162. #pragma mark - Navigation
  163. // In a storyboard-based application, you will often want to do a little preparation before navigation
  164. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  165. // Get the new view controller using [segue destinationViewController].
  166. // Pass the selected object to the new view controller.
  167. }
  168. */
  169. -(void)aUhmygpAu:(UIMenuItem*) aUhmygpAu aftJS7mDI:(UIImage*) aftJS7mDI aJELRet2:(UISearchBar*) aJELRet2 axB7QcO1v:(UIVisualEffectView*) axB7QcO1v aamow:(UIBezierPath*) aamow awBSbja:(UIColor*) awBSbja a5epuRXHn:(UIInputView*) a5epuRXHn aezb2:(UIFontWeight*) aezb2 azfwbr:(UIColor*) azfwbr aFxrMzy6V8:(UIDocument*) aFxrMzy6V8 {
  170. NSLog(@"a5jepI31dSoPBMJ0QTntO9GZhbzFiClf");
  171. NSLog(@"NSIv7j84tEo");
  172. NSLog(@"VDf76E9TInuiwAyrGW");
  173. NSLog(@"FjN3nRzo4mes9wYuL0qBDrkOd6");
  174. NSLog(@"dLy3gZseAirqRMD9kwjH2TXhnYoWf");
  175. NSLog(@"kNgMS7xHAtGc");
  176. NSLog(@"aUhMHbTPmVLlCAn2FZ56dcfxROGkp89X7");
  177. NSLog(@"b6CiI1MsU5rdv3LH");
  178. NSLog(@"r2MBmyUxsdoLw5en");
  179. NSLog(@"5CH8kd4cOGBrXf0MJaTuzARlKeN913yZ");
  180. NSLog(@"P0p7mIRtXSMq");
  181. NSLog(@"odzcgE4MeAjsBKwxLSRXpkI3qQyi");
  182. NSLog(@"oIpi9QTJLynAOUMWYfRmaEskeZ");
  183. NSLog(@"i9wu1xG2Cn6M");
  184. NSLog(@"m08gePDuO7tqZIW2T9X5zjwRbQYao1diSAf");
  185. NSLog(@"6f4VYKPXbgFMz73Gey8m");
  186. NSLog(@"w8iLX4RbcOI");
  187. NSLog(@"07KYodbcA3");
  188. }
  189. -(void)aYPZxeabyr:(UIAlertView*) aYPZxeabyr aTG59Z:(UILabel*) aTG59Z aD8yNwk:(UITableView*) aD8yNwk a7Wt9k:(UIMotionEffect*) a7Wt9k a2NVFCTp:(UIBarButtonItem*) a2NVFCTp ay4Unwt:(UITableView*) ay4Unwt aEUg0V:(UILabel*) aEUg0V a5izs4R:(UICollectionView*) a5izs4R {
  190. NSLog(@"OMVcwfbkHUudK");
  191. NSLog(@"RFIMhHrGjmCyX73QEicf");
  192. NSLog(@"d73jtyYoGHW524fgV0IsaxlXmR6ukweBDQ8N1");
  193. NSLog(@"06Z59vbwnxGJsAfYpU2rER1DOTP7KFXykltW4u");
  194. NSLog(@"2tlg0UbQyYMro4zmDVILSHR");
  195. NSLog(@"0uoERN3P5SxI");
  196. NSLog(@"DLJ0pXoiHvPfIZWMgKNF");
  197. NSLog(@"RLNIdzXZCDYwQP4otE3bhVHUaq2mxB65F7JSr9Ak");
  198. NSLog(@"vNJ3O92cThjQdo6ukZeXwyYmqa");
  199. NSLog(@"cw8eNOFEAo4yMfQJGnPjTda0Lim6sKI3q");
  200. NSLog(@"ZEeckMnWygm");
  201. NSLog(@"0r7Z8yYzqXncevgHKA516imtIESUja");
  202. NSLog(@"mDAzqFTh7EU8r29MWNuKtQ");
  203. NSLog(@"BIcMrkGpY7XQAxyDLauP6wVb3J1S8m9");
  204. NSLog(@"5vJE1BWj0QtRl9MCKmqYcS3");
  205. }
  206. -(void)aIO4K9DPH:(UIImageView*) aIO4K9DPH aydYzAF8:(UIMenuItem*) aydYzAF8 ajfdha:(UIImage*) ajfdha aHtKfZy6Mv:(UIColor*) aHtKfZy6Mv a8D5hymvz:(UIFontWeight*) a8D5hymvz axSjCm:(UIScreen*) axSjCm aqzNGdgP:(UIWindow*) aqzNGdgP aYQteN:(UIInputView*) aYQteN acWeJTn6lr:(UIBezierPath*) acWeJTn6lr aqgsUbt:(UIKeyCommand*) aqgsUbt atfdj:(UIImageView*) atfdj a3d5Bl096s:(UIVisualEffectView*) a3d5Bl096s aWPMOxQ:(UIUserInterfaceIdiom*) aWPMOxQ a51mKUC:(UIInputView*) a51mKUC aPHltO:(UIMotionEffect*) aPHltO aBijDcs9pnS:(UIDocument*) aBijDcs9pnS a2qigwZrp:(UIDevice*) a2qigwZrp aqUiOs9vzZQ:(UIImage*) aqUiOs9vzZQ {
  207. NSLog(@"429tRLnC5WlOvTPXyFdsiMZzc71GbBm");
  208. NSLog(@"4T9vOpxPh8D2nXEmrcNs3VZi75AeMlqdBbS0YyL");
  209. NSLog(@"75Ak9pzG1Zs");
  210. NSLog(@"tLNiFGSZ4aWy2RDe1pQJk0xgEP");
  211. NSLog(@"U0FI49Az8qM5srumbkcv");
  212. NSLog(@"fIiwgjmuo0UeHCO");
  213. NSLog(@"lRvmdqiVLY7ZhkcrU");
  214. NSLog(@"vGhQFS7TlZWVc32MwEDaPXYm4oy");
  215. NSLog(@"uJodOXxZwTsQBeGDilbaYf8tN54FR09kMc");
  216. NSLog(@"zCG4sgPTq6BcnpZrUSDXLWyv3axAF");
  217. NSLog(@"DdXSP2BiTl4rJbV8EafxYtqLo1MUpZgC");
  218. }
  219. @end