//
//  StoreViewController.m
//  ALand
//
//  Created by Z on 16/3/18.
//  Copyright © 2016年 Z. All rights reserved.
//

#import "StoreViewController.h"

@interface StoreViewController ()<UIWebViewDelegate,UIScrollViewDelegate>
@property (nonatomic, strong) UIWebView *webview;
@end

@implementation StoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.isShowNavigationBar = NO;

    UserInfo *userInfo = [UserInfo shareInstance];
    NSString *inviteWebUrl = [NSString stringWithFormat:@"%@Wap/index_shop/shop_id/%@/mobile/%@.html", userInfo.webShopBaseUrl, userInfo.shop.uuid, userInfo.mobilephone];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:inviteWebUrl] cachePolicy:(NSURLRequestReloadRevalidatingCacheData) timeoutInterval:10.0f];
    UIWebView *webView = [UIWebView new];
    [webView loadRequest:request];
    webView.scrollView.delegate = self;
    [self.view addSubview:webView];
    webView.delegate = self;
    self.webview = webView;
    webView.scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
    webView.frame = CGRectMake(0, 0, kWidth, kHeight - 49);
    
    // Do any additional setup after loading the view.
}

#pragma mark - webView delegate
- (void)webViewDidStartLoad:(UIWebView *)webView {
    [MBProgressHUD showHUDAddedTo:webView animated:YES];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [MBProgressHUD hideHUDForView:webView];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    
    
}


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.webview reload];
}
- (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.
}
*/

@end
