123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- //
- // LZMWebPageViewController.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/1/31.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LZMWebPageViewController.h"
- #import <AlibcTradeSDK/AlibcTradeSDK.h>
- #import <AlibabaAuthSDK/ALBBSession.h>
- #import <AlibabaAuthSDK/ALBBSDK.h>
- #import "LZMTaobaoAuthorView.h"
- @interface LZMWebPageViewController ()<UIWebViewDelegate>
- @property (nonatomic, strong) UIButton *backButton;
- @property (nonatomic, strong) UIButton *closeButton;
- @property (nonatomic, strong) LZMTaobaoAuthorView *authorView;
- @end
- @implementation LZMWebPageViewController
- - (instancetype)init {
- self = [super init];
- if (self) {
- [self configWebView];
- }
- return self;
- }
- - (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
- [SVProgressHUD dismiss];
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
-
- [self configTaobaoAuthorView];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self initHUD];
- [self configNavigationBar];
-
- }
- - (void)configTaobaoAuthorView {
- if ([[ALBBSession sharedInstance] isLogin]){
- [self openAliMyOrderWebView];
- self.webView.hidden = NO;
- self.authorView.hidden = YES;
- }else {
- self.webView.hidden = YES;
- self.authorView.hidden = NO;
-
- }
- }
- - (void)initHUD {
- [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
- [SVProgressHUD setForegroundColor:[UIColor YHColorWithHex:0xff2420]];
- [SVProgressHUD setBackgroundColor:[UIColor YHColorWithHex:0xf5f4f4]];
-
- }
- - (void)configWebView {
-
- self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight)];
- self.webView.delegate = self;
- [self.view addSubview:self.webView];
- self.authorView = [[LZMTaobaoAuthorView alloc] initWithFrame:self.webView.frame text:@"授权淘宝登录,一键查看淘宝内商品" clickBlock:^{
- //淘宝授权
- ALBBSDK *albbSDK = [ALBBSDK sharedInstance];
- [albbSDK setAppkey:ALBC_APP_KEY];
- [albbSDK setAuthOption:NormalAuth];
-
- [albbSDK auth:self successCallback:^(ALBBSession *session){
- [self configTaobaoAuthorView];
- } failureCallback:^(ALBBSession *session,NSError *error){
- }];
- }];
- [self.view addSubview:self.authorView];
- }
- - (void)configNavigationBar {
-
- self.view.backgroundColor = [UIColor whiteColor];
-
- self.navigationBar.showNavigationBarBottomLine = YES;
-
-
- [self.navigationBar setCustomLeftButtons:@[self.backButton]];
-
- }
- - (void)backAction {
- if (self.webView.canGoBack) {
- [self.webView goBack];
- }else{
- [self.navigationController popViewControllerAnimated:YES];
- }
- }
- - (void)closeAction {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)updateNavigationBarButtons {
- if (self.webView.canGoBack) {
- [self.navigationBar setCustomLeftButtons:@[self.backButton,self.closeButton]];
- }else {
- [self.navigationBar setCustomLeftButtons:@[self.backButton]];
- }
- }
- - (void)openAliMyOrderWebView {
- [SVProgressHUD show];
-
- switch (self.openPage) {
- case AlibcOpenPageShopCar:
- {
- id<AlibcTradePage> page = [AlibcTradePageFactory myCartsPage];
- [self openWebViewByPage:page];
- }
-
- break;
- case AlibcOpenPageMyOrder:
- {
- id<AlibcTradePage> page = [AlibcTradePageFactory myOrdersPage:0 isAllOrder:YES];
- [self openWebViewByPage:page];
- }
- break;
-
- default:
- {
- id<AlibcTradePage> page = [AlibcTradePageFactory myOrdersPage:0 isAllOrder:YES];
- [self openWebViewByPage:page];
- }
- break;
- }
-
-
- }
- - (void)openWebViewByPage:(id<AlibcTradePage>)page {
- //淘客信息
- AlibcTradeTaokeParams *taoKeParams=[[AlibcTradeTaokeParams alloc] init];
- taoKeParams.pid = ALTK_PID;
- //打开方式
- AlibcTradeShowParams* showParam = [[AlibcTradeShowParams alloc] init];
-
- showParam.openType = AlibcOpenTypeH5;
-
- [[AlibcTradeSDK sharedInstance].tradeService show:self webView:self.webView page:page showParams:showParam taoKeParams:taoKeParams trackParam:nil tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable result) {
-
- } tradeProcessFailedCallback:^(NSError * _Nullable error) {
-
- }];
- self.webView.delegate = self;
- }
- #pragma mark -------------- UIWebView delegate --------
- - (void)webViewDidFinishLoad:(UIWebView *)webView {
- [self updateNavigationBarButtons];
- [SVProgressHUD dismiss];
- // NSString *jsToGetHTMLSource = @"document.getElementsByTagName('html')[0].innerHTML";
- //
- // NSString *HTMLSource = [self.webView stringByEvaluatingJavaScriptFromString:jsToGetHTMLSource];
- //
- // NSLog(@"------------:%@",HTMLSource);
- }
- - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
- [SVProgressHUD dismiss];
- }
- #pragma mark ------
- - (UIButton *)backButton {
- if (!_backButton) {
- _backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
- [_backButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
- [_backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
- }
- return _backButton;
- }
- - (UIButton *)closeButton {
- if (!_closeButton) {
- _closeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
- [_closeButton setImage:[UIImage imageNamed:@"close_web"] forState:UIControlStateNormal];
- [_closeButton addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
- }
- return _closeButton;
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- -(void)asFPdl0q:(UIColor*) asFPdl0q aDQj2ewz:(UIRegion*) aDQj2ewz abliIEh:(UISwitch*) abliIEh aajwuen1hBd:(UIInputView*) aajwuen1hBd aOuUJbptB:(UISearchBar*) aOuUJbptB asGSJ:(UIImageView*) asGSJ amV3AX750ge:(UIEdgeInsets*) amV3AX750ge a7KTI:(UIBezierPath*) a7KTI aBpurxAeNI:(UIActivity*) aBpurxAeNI aUidlrWIV:(UIImage*) aUidlrWIV aheRJB5Lyw:(UIBezierPath*) aheRJB5Lyw {
- NSLog(@"fn08PMgwoxAt7Fdy1R6kbiKCV");
- NSLog(@"MDFLbVY9orAnGXQ2zxCRwOlmUNIfT3d8gjas");
- NSLog(@"4BDNKXTUR8wodyQ0viP6sCYVE");
- NSLog(@"z1Xi6SmsKoEC");
- NSLog(@"XVuID7fajLNw1UgizpS4tZyM3vRrH85YxJ");
- NSLog(@"zagNdYRIBDJ2qlSeiXP7wCjtu50Kf");
- NSLog(@"eDLuNFPYfmqKTVZzgHwSps5Qa0jMnkcRvtr");
- NSLog(@"ietck9XVAzLGlaJgRSrI8hju0T65YdDp");
- NSLog(@"K0Q1NyOvkEVsIL");
- NSLog(@"DecIpdJAghTtv0jyloXa73CBb8Wr");
- NSLog(@"LhZ1YsUugdzoN2y9DEfJiK6qIca07PVtX");
- NSLog(@"cfoPu5NFy816aZQG");
- NSLog(@"ogdrVtDQF1jlGZyzB7nY2kiULJTRuqS5H6K8awXp");
- }
- -(void)akO6UeIj3L:(UIInputView*) akO6UeIj3L aGzX3l:(UIEvent*) aGzX3l aKAj4:(UIInputView*) aKAj4 abiYs3T:(UIControl*) abiYs3T acD6f3gI7:(UIView*) acD6f3gI7 aH4kKZCFc:(UIFont*) aH4kKZCFc acEBJT:(UILabel*) acEBJT a7VQR:(UIDocument*) a7VQR a1ReUFCsTM9:(UIKeyCommand*) a1ReUFCsTM9 a7IG3d61:(UIColor*) a7IG3d61 apObaweoHxu:(UIBezierPath*) apObaweoHxu aHUGc:(UIUserInterfaceIdiom*) aHUGc aGMBfko:(UIBarButtonItem*) aGMBfko agszqQSMTy:(UIImageView*) agszqQSMTy arumD:(UIControlEvents*) arumD {
- NSLog(@"wVhk2NyAqr8TK0gz4nFPZXtdIa");
- NSLog(@"HVSf67bU2QL9jlN41rOKFR");
- NSLog(@"dObV0KJEzgs8aRcLYumNXx");
- NSLog(@"ySXBeYrKU34GtiwFkJcuRDPTsgxIMCf7V8Lmq52");
- NSLog(@"7dcoNTlkSKLMuWp84FC9a1OeJAjIizrZ0fqhwVv");
- NSLog(@"IRQFUeat5KLqCfDNZm083");
- NSLog(@"g43whdJrLTAPi7q10VlZbepSHCXQafjWOBms6k");
- NSLog(@"tk0GCKOFVHW");
- NSLog(@"Ufbi1BZFxE8s3");
- NSLog(@"EqdcSIrNMs3aFTDnXw0v8QzLRf5V9WYbKU2x");
- NSLog(@"oFXI0EanCfc6GyV8QBx4AKLTY9k3HReu7WPMDlm");
- NSLog(@"JpHcDGxIaWu7lvC1B4k5K6YRjQm0gVnb8s");
- NSLog(@"jilmNVgJI4K7M");
- NSLog(@"Hz4yfJujDRthgsBNEd3VZPIp7U2wYxT1alX");
- NSLog(@"6OAolrkRVYpxNGCfP1tgj05vceEhDWK2MzFL");
- NSLog(@"MC46OdzZPvApewQGKlcVTS0I37mEo5RBWXaLsyH2");
- NSLog(@"eNSR0l15BtcECW");
- NSLog(@"VhDtsKIg71NGe6pkQ5Odfj2inMYaC3Z9");
- NSLog(@"nEslDQomge7wP1q3dU65pGx");
- }
- -(void)aKPpt1QV:(UIEdgeInsets*) aKPpt1QV aXwvVJ2rM:(UIActivity*) aXwvVJ2rM aRBv3fTu1P:(UILabel*) aRBv3fTu1P aNSgiklX1BY:(UIVisualEffectView*) aNSgiklX1BY aHwpQZk7:(UIDocument*) aHwpQZk7 aUp7FKWk:(UIBezierPath*) aUp7FKWk akvSjB:(UIScreen*) akvSjB aksq4JwUR:(UIViewController*) aksq4JwUR aaPLFSkUeBR:(UIButton*) aaPLFSkUeBR aO02t4:(UIBarButtonItem*) aO02t4 adjsAbFr:(UIImageView*) adjsAbFr a49AxbG7:(UIEvent*) a49AxbG7 a1snUgDx2h:(UIEdgeInsets*) a1snUgDx2h aG8a7FY6:(UIWindow*) aG8a7FY6 aO9MxdSWV8F:(UIColor*) aO9MxdSWV8F aOGkF:(UIBarButtonItem*) aOGkF aKEGok0:(UIBezierPath*) aKEGok0 {
- NSLog(@"oSwqK4YR6EOnmUbDxfZiQ8Tz0cJukVHeN9p");
- NSLog(@"y7HsYDAhwLnXdeJK");
- NSLog(@"SRrDiIujdk3AgXzOwfh");
- NSLog(@"jQ4EKTglucmWILiX60AsxYfBMHJo7wnDh1ZR53yz");
- NSLog(@"kT5lX38hQir6SYZpwuPfIe7tNbB0ax4gUGM1");
- NSLog(@"5iRHPTGLKEBMCWhXrcOt09SlwsD6ke1");
- NSLog(@"floc3DIHUZrAKMPGhbBsTnivzadF");
- NSLog(@"FHlYEGIaBs0CLDwt8Qx7de21vi6rNTnfgycb");
- NSLog(@"fOE7bLRKeTcmQ8WUgaP6X5sA");
- NSLog(@"Si0lsbYVqMcAtWJFvhLDPnokdH87rQm913g");
- NSLog(@"NqVyIitgfc4FD9mTo");
- NSLog(@"hxbf4s6WvRKOdwg");
- NSLog(@"lgIAXLYj7wrbBTRuWSt6hx8NyDmGOa0V4kZ");
- NSLog(@"NWeaTrydt3zAbZmCJRs08");
- NSLog(@"eqh1R9YbK2");
- NSLog(@"PWgQTX2VknrM");
- }
- @end
|