Commit d148bf5c by lee

product update UI, add brand description

parent 4cfedd42
...@@ -350,6 +350,8 @@ ...@@ -350,6 +350,8 @@
DA4E36981F17729C0007E4D0 /* KWMCategoryModel.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36971F17729C0007E4D0 /* KWMCategoryModel.m */; }; DA4E36981F17729C0007E4D0 /* KWMCategoryModel.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36971F17729C0007E4D0 /* KWMCategoryModel.m */; };
DA4E369E1F188B400007E4D0 /* BUYClient+FilterSoldout.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E369D1F188B400007E4D0 /* BUYClient+FilterSoldout.m */; }; DA4E369E1F188B400007E4D0 /* BUYClient+FilterSoldout.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E369D1F188B400007E4D0 /* BUYClient+FilterSoldout.m */; };
DA4E36A11F18A6CB0007E4D0 /* KWMPageResult.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36A01F18A6CB0007E4D0 /* KWMPageResult.m */; }; DA4E36A11F18A6CB0007E4D0 /* KWMPageResult.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36A01F18A6CB0007E4D0 /* KWMPageResult.m */; };
DA7457681F692D67000E192E /* KWMProductSameBrandView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7457671F692D67000E192E /* KWMProductSameBrandView.m */; };
DA74576C1F692DCA000E192E /* KWMProductSameBrandView.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA74576B1F692DCA000E192E /* KWMProductSameBrandView.xib */; };
DA7DF8E51F1DB01600D5239B /* NSString+Format.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7DF8E41F1DB01600D5239B /* NSString+Format.m */; }; DA7DF8E51F1DB01600D5239B /* NSString+Format.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7DF8E41F1DB01600D5239B /* NSString+Format.m */; };
DA8B97801F58F816002FC38A /* SDImageCache+Resize.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8B977F1F58F816002FC38A /* SDImageCache+Resize.m */; }; DA8B97801F58F816002FC38A /* SDImageCache+Resize.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8B977F1F58F816002FC38A /* SDImageCache+Resize.m */; };
DA8D64121F31C67F00B8F4A6 /* DeepLinkURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8D64111F31C67F00B8F4A6 /* DeepLinkURLProtocol.m */; }; DA8D64121F31C67F00B8F4A6 /* DeepLinkURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8D64111F31C67F00B8F4A6 /* DeepLinkURLProtocol.m */; };
...@@ -978,6 +980,9 @@ ...@@ -978,6 +980,9 @@
DA4E369D1F188B400007E4D0 /* BUYClient+FilterSoldout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "BUYClient+FilterSoldout.m"; sourceTree = "<group>"; }; DA4E369D1F188B400007E4D0 /* BUYClient+FilterSoldout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "BUYClient+FilterSoldout.m"; sourceTree = "<group>"; };
DA4E369F1F18A6CB0007E4D0 /* KWMPageResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMPageResult.h; sourceTree = "<group>"; }; DA4E369F1F18A6CB0007E4D0 /* KWMPageResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMPageResult.h; sourceTree = "<group>"; };
DA4E36A01F18A6CB0007E4D0 /* KWMPageResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMPageResult.m; sourceTree = "<group>"; }; DA4E36A01F18A6CB0007E4D0 /* KWMPageResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMPageResult.m; sourceTree = "<group>"; };
DA7457661F692D67000E192E /* KWMProductSameBrandView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMProductSameBrandView.h; sourceTree = "<group>"; };
DA7457671F692D67000E192E /* KWMProductSameBrandView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMProductSameBrandView.m; sourceTree = "<group>"; };
DA74576B1F692DCA000E192E /* KWMProductSameBrandView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMProductSameBrandView.xib; sourceTree = "<group>"; };
DA7DF8E31F1DB01600D5239B /* NSString+Format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Format.h"; sourceTree = "<group>"; }; DA7DF8E31F1DB01600D5239B /* NSString+Format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Format.h"; sourceTree = "<group>"; };
DA7DF8E41F1DB01600D5239B /* NSString+Format.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Format.m"; sourceTree = "<group>"; }; DA7DF8E41F1DB01600D5239B /* NSString+Format.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Format.m"; sourceTree = "<group>"; };
DA8B977E1F58F816002FC38A /* SDImageCache+Resize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SDImageCache+Resize.h"; sourceTree = "<group>"; }; DA8B977E1F58F816002FC38A /* SDImageCache+Resize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SDImageCache+Resize.h"; sourceTree = "<group>"; };
...@@ -1515,6 +1520,9 @@ ...@@ -1515,6 +1520,9 @@
80C8014D1D78134800002306 /* KWMTBVSectionHeardView.h */, 80C8014D1D78134800002306 /* KWMTBVSectionHeardView.h */,
80C8014E1D78134800002306 /* KWMTBVSectionHeardView.m */, 80C8014E1D78134800002306 /* KWMTBVSectionHeardView.m */,
80C801501D78136400002306 /* KWMTBVSectionHeardView.xib */, 80C801501D78136400002306 /* KWMTBVSectionHeardView.xib */,
DA7457661F692D67000E192E /* KWMProductSameBrandView.h */,
DA7457671F692D67000E192E /* KWMProductSameBrandView.m */,
DA74576B1F692DCA000E192E /* KWMProductSameBrandView.xib */,
80E844251D7FB0FF0042AED2 /* KWMRuleView.h */, 80E844251D7FB0FF0042AED2 /* KWMRuleView.h */,
80E844261D7FB0FF0042AED2 /* KWMRuleView.m */, 80E844261D7FB0FF0042AED2 /* KWMRuleView.m */,
80E844281D7FB1130042AED2 /* KWMRuleView.xib */, 80E844281D7FB1130042AED2 /* KWMRuleView.xib */,
...@@ -2420,6 +2428,7 @@ ...@@ -2420,6 +2428,7 @@
8077F79B1D73E39000A2E2E2 /* KWMBrandCaramelCell.xib in Resources */, 8077F79B1D73E39000A2E2E2 /* KWMBrandCaramelCell.xib in Resources */,
C034E6EB1D6AF0A0006EE129 /* Localizable.strings in Resources */, C034E6EB1D6AF0A0006EE129 /* Localizable.strings in Resources */,
C0243BC91EFBD6060013CFA7 /* KWMCategoryFilterTab.xib in Resources */, C0243BC91EFBD6060013CFA7 /* KWMCategoryFilterTab.xib in Resources */,
DA74576C1F692DCA000E192E /* KWMProductSameBrandView.xib in Resources */,
C0F586AE1E279574001248E2 /* KWMBottomView.xib in Resources */, C0F586AE1E279574001248E2 /* KWMBottomView.xib in Resources */,
C0392DBA1DCC38450051AC8E /* KWMShippingCell.xib in Resources */, C0392DBA1DCC38450051AC8E /* KWMShippingCell.xib in Resources */,
C0CCB3D01EEA765B00BC2FB8 /* KWMFilterTabItem.xib in Resources */, C0CCB3D01EEA765B00BC2FB8 /* KWMFilterTabItem.xib in Resources */,
...@@ -2752,6 +2761,7 @@ ...@@ -2752,6 +2761,7 @@
807AF4A41DC984950000A326 /* KWMBrandsResult.m in Sources */, 807AF4A41DC984950000A326 /* KWMBrandsResult.m in Sources */,
C048342B1F1324B400A5BFB4 /* KWMAdHeader.m in Sources */, C048342B1F1324B400A5BFB4 /* KWMAdHeader.m in Sources */,
C034E8471D6B10A0006EE129 /* UIColor+Extend.m in Sources */, C034E8471D6B10A0006EE129 /* UIColor+Extend.m in Sources */,
DA7457681F692D67000E192E /* KWMProductSameBrandView.m in Sources */,
C0DD53351EE55190002D1E0C /* ArcToCircleLayer.m in Sources */, C0DD53351EE55190002D1E0C /* ArcToCircleLayer.m in Sources */,
C091EE361DDEEA9400A382B9 /* KWMVariants.m in Sources */, C091EE361DDEEA9400A382B9 /* KWMVariants.m in Sources */,
C0E8AE121D7D52B200C193DC /* KWMPayTypeVC.m in Sources */, C0E8AE121D7D52B200C193DC /* KWMPayTypeVC.m in Sources */,
......
...@@ -101,6 +101,12 @@ ...@@ -101,6 +101,12 @@
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "appicon-16.png", "filename" : "appicon-16.png",
"scale" : "2x" "scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "1024x1024bb.jpg",
"scale" : "1x"
} }
], ],
"info" : { "info" : {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<constraint firstAttribute="height" constant="24" id="x1H-Jw-5lD"/> <constraint firstAttribute="height" constant="24" id="x1H-Jw-5lD"/>
</constraints> </constraints>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="v 1.5.6" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ytF-B2-drm"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="v 1.5.7" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ytF-B2-drm">
<rect key="frame" x="168" y="631" width="39" height="16"/> <rect key="frame" x="168" y="631" width="39" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/> <fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
- (IBAction)wechatAction:(id)sender { - (IBAction)wechatAction:(id)sender {
[self showToast:@"复制成功"]; [self showToast:@"复制成功"];
UIPasteboard *pb = [UIPasteboard generalPasteboard]; UIPasteboard *pb = [UIPasteboard generalPasteboard];
pb.string = @"cemarose1"; pb.string = @"cemarose";
} }
- (IBAction)weiboAction:(id)sender { - (IBAction)weiboAction:(id)sender {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
...@@ -329,8 +329,8 @@ ...@@ -329,8 +329,8 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nFz-xe-Hyc" userLabel="v电话"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nFz-xe-Hyc" userLabel="v电话">
<rect key="frame" x="0.0" y="72" width="375" height="38"/> <rect key="frame" x="0.0" y="72" width="375" height="38"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="cemarose1" textAlignment="natural" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="elR-WQ-QQC"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="cemarose" textAlignment="natural" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="elR-WQ-QQC">
<rect key="frame" x="30" y="10.5" width="59.5" height="17"/> <rect key="frame" x="30" y="10.5" width="54.5" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.22352941179999999" green="0.22352941179999999" blue="0.22352941179999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.22352941179999999" green="0.22352941179999999" blue="0.22352941179999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
......
...@@ -209,6 +209,7 @@ typedef enum{ ...@@ -209,6 +209,7 @@ typedef enum{
-(void)kwm_onClickProduct:(BUYProduct *)product{ -(void)kwm_onClickProduct:(BUYProduct *)product{
// NSLog(@"product"); // NSLog(@"product");
[self openURLWithString:[NSString stringWithFormat:@"https://cemarose.myshopify.com/products/%@",product.handle]]; [self openURLWithString:[NSString stringWithFormat:@"https://cemarose.myshopify.com/products/%@",product.handle]];
// [self openURLWithString:[NSString stringWithFormat:@"https://cemarose.myshopify.com/products/19247-01"]];
} }
#pragma mark - UICollectionViewDataSource #pragma mark - UICollectionViewDataSource
......
...@@ -9,9 +9,18 @@ ...@@ -9,9 +9,18 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <Buy/Buy.h> #import <Buy/Buy.h>
@protocol KWMMidDetailViewDelegate <NSObject>
- (void) kwm_updatedHeight:(CGFloat) height;
@end
@interface KWMMidDetailView : UIView @interface KWMMidDetailView : UIView
@property(nonatomic,weak) IBOutlet UIView *vView; @property(nonatomic,weak) IBOutlet UIView *vView;
@property (nonatomic, weak) id<KWMMidDetailViewDelegate> delegate;
@property (nonatomic,weak) BUYProduct *product; @property (nonatomic,weak) BUYProduct *product;
@end @end
...@@ -6,11 +6,20 @@ ...@@ -6,11 +6,20 @@
// Copyright © 2017年 kollway. All rights reserved. // Copyright © 2017年 kollway. All rights reserved.
// //
#import <WebKit/WebKit.h>
#import "KWMMidDetailView.h" #import "KWMMidDetailView.h"
#import "KWMStringUtil.h" #import "KWMStringUtil.h"
#import "KWMTBVSectionHeardView.h"
#import <JLRoutes/JLRoutes.h>
@interface KWMMidDetailView()<WKNavigationDelegate,WKScriptMessageHandler>
@property(nonatomic,weak) IBOutlet UILabel *lbDetail;
@property (nonatomic, strong) WKWebView *webView;
@property (nonatomic, strong) KWMTBVSectionHeardView *titleView;
@interface KWMMidDetailView()
@property(nonatomic,weak) IBOutlet UILabel *lbDetail;
@end @end
@implementation KWMMidDetailView @implementation KWMMidDetailView
...@@ -43,22 +52,72 @@ ...@@ -43,22 +52,72 @@
} }
-(void)addView{ -(void)addView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) // [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class])
owner:self // owner:self
options:nil]; // options:nil];
self.titleView = [[KWMTBVSectionHeardView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 50)];
self.titleView.title = @"商品详情";
self.titleView.ivMore.hidden = YES;
WKUserContentController *userContentController = [[WKUserContentController alloc] init];
[userContentController addScriptMessageHandler:self name:@"handle"];
WKWebViewConfiguration *configutation = [[WKWebViewConfiguration alloc] init];
configutation.userContentController = userContentController;
self.webView = [[WKWebView alloc] initWithFrame:self.bounds configuration:configutation];
self.webView.navigationDelegate = self;
// self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
// [self addSubview:self.vView];
[self addSubview:self.webView];
[self addSubview:self.titleView];
self.webView.translatesAutoresizingMaskIntoConstraints = NO;
self.titleView.translatesAutoresizingMaskIntoConstraints = NO;
id views = @{@"web":self.webView,@"title":self.titleView};
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[web]|" options:0 metrics:nil views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[title]|" options:0 metrics:nil views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[title(50)][web]|" options:0 metrics:nil views:views]];
self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView];
} }
//- (void)layoutSubviews {
// [super layoutSubviews];
// self.webView.frame = self.bounds;
//}
-(void)setProduct:(BUYProduct *)product{ -(void)setProduct:(BUYProduct *)product{
_product = product; _product = product;
if(product && ![KWMStringUtil isEmpty:product.stringDescription]){ if(product && product.htmlDescription.length){
self.lbDetail.text = product.stringDescription; // self.lbDetail.text = product.htmlDescription;
// NSString *html = [NSString stringWithFormat:@"%@<script type='text/javascript'>window.webkit.messageHandlers.handle.postMessage(document.body.clientHeight)</scriot>",product.htmlDescription];
NSString *css = [NSString stringWithFormat:@"p{font-size:12px;}img{width:100%%;}*{padding:0;margin:0;max-width:%f}",UI_SCREEN_WIDTH];
NSString *html = [[NSString stringWithFormat:@"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0 user-scalable=yes\" /><div id=\"container\">%@<div><script type=\"text/javascript\">function update() {window.webkit.messageHandlers.handle.postMessage({height:document.body.scrollHeight})} function timer(){ setTimeout(timer,1000); update()} function delay() { setTimeout(update,1000) } window.onload = update</script><style type=\"text/css\">%@</style>",product.htmlDescription,css] stringByReplacingOccurrencesOfString:@"src=\"//cdn.shopify.com" withString:@"src=\"https://o42yton8r.qnssl.com"];
[self.webView loadHTMLString:html baseURL:nil];
}else{ }else{
self.lbDetail.text = @"暂无商品描述"; // self.lbDetail.text = @"暂无商品描述";
self.hidden = YES;
[self.delegate kwm_updatedHeight:0];
} }
} }
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSURL *url = navigationAction.request.URL;
if ([JLRoutes canRouteURL:url]) {
[JLRoutes routeURL:url];
decisionHandler(WKNavigationActionPolicyCancel);
}else {
decisionHandler(WKNavigationActionPolicyAllow);
}
}
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
NSNumber *height = [message.body objectForKey:@"height"];
NSLog(@"fuck height: %@",height);
[self.delegate kwm_updatedHeight:height.floatValue + 50];
}
@end @end
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
-(void)kwm_clickCollectionCell:(BUYProduct *)product; -(void)kwm_clickCollectionCell:(BUYProduct *)product;
-(void)kwm_updatedSecondDetailViewHeight:(CGFloat) height;
-(void)kwm_clickMore:(BOOL)isSameBrand; -(void)kwm_clickMore:(BOOL)isSameBrand;
@end @end
...@@ -37,6 +39,10 @@ ...@@ -37,6 +39,10 @@
@property (nonatomic) NSString *brand; @property (nonatomic) NSString *brand;
@property (nonatomic) NSNumber *productCount;
@property (nonatomic) NSString *brandDescription;
@property (nonatomic) NSInteger count; @property (nonatomic) NSInteger count;
//isSameBrand 是否同一品牌商品 //isSameBrand 是否同一品牌商品
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import "KWMSecondDetailView.h" #import "KWMSecondDetailView.h"
#import "KWMTBVSectionHeardView.h" #import "KWMTBVSectionHeardView.h"
#import "KWMProductSameBrandView.h"
@interface KWMSecondDetailView () @interface KWMSecondDetailView ()
...@@ -138,27 +139,30 @@ static NSString *idStr = @"KWMNewGoodsCell"; ...@@ -138,27 +139,30 @@ static NSString *idStr = @"KWMNewGoodsCell";
} }
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
KWMTBVSectionHeardView *vTBVSectionHeard = [[KWMTBVSectionHeardView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 60)];
if (section == 0) { if (section == 0) {
NSString *title; KWMProductSameBrandView *view = [[[NSBundle mainBundle] loadNibNamed:@"KWMProductSameBrandView" owner:nil options:nil] firstObject];
if(self.brand == nil){ view.frame = CGRectMake(0, 0, UI_SCREEN_WIDTH, [self tableView:tableView heightForHeaderInSection:section]);
vTBVSectionHeard = [[KWMTBVSectionHeardView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 40)]; view.brandName.text = self.brand ?: @"其他商品";
title = @"其他商品"; view.quantity.text = self.productCount.stringValue ?: @"0";
}else{ view.brandDescription.text = self.brandDescription;
title = [NSString stringWithFormat: @"%@\n其他商品", self.brand]; return view;
}
vTBVSectionHeard.lbSectionTitel.text = title;
}else{ }else{
KWMTBVSectionHeardView *vTBVSectionHeard = [[KWMTBVSectionHeardView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 60)];
vTBVSectionHeard = [[KWMTBVSectionHeardView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 40)]; vTBVSectionHeard = [[KWMTBVSectionHeardView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 40)];
vTBVSectionHeard.lbSectionTitel.text = @"同类商品"; vTBVSectionHeard.lbSectionTitel.text = @"同类商品";
vTBVSectionHeard.ivMore.hidden = YES;
return vTBVSectionHeard;
} }
vTBVSectionHeard.ivMore.hidden = YES;
return vTBVSectionHeard;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if(section == 0 && self.brand != nil){ if(section == 0 && self.brand != nil){
return 60; CGFloat height = 8;
// height += [self.brandDescription sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:11]}].height;
height += [self.brandDescription boundingRectWithSize:CGSizeMake(UI_SCREEN_WIDTH - 54, 0) options:NSStringDrawingUsesLineFragmentOrigin |
NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica Neue" size:11]} context:nil].size.height;
[self.delegate kwm_updatedSecondDetailViewHeight: 450 + height];
return 60 + height;
}else{ }else{
return 40; return 40;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#import <PPNetworkHelper/PPNetworkHelper.h> #import <PPNetworkHelper/PPNetworkHelper.h>
#import <TOWebViewController/NJKWebViewProgress.h> #import <TOWebViewController/NJKWebViewProgress.h>
@interface KWMNewProductVC () @interface KWMNewProductVC ()<KWMMidDetailViewDelegate>
@property (weak, nonatomic) IBOutlet KWMFirstDetailView *detailView1; @property (weak, nonatomic) IBOutlet KWMFirstDetailView *detailView1;
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightMidView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightMidView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *detailView2HeightConstraint;
// 0 非自动 1 是加购 2 是立即购买 // 0 非自动 1 是加购 2 是立即购买
@property (assign, nonatomic) NSInteger autoAddToBag; @property (assign, nonatomic) NSInteger autoAddToBag;
...@@ -82,6 +84,7 @@ ...@@ -82,6 +84,7 @@
- (void)viewWillAppear:(BOOL)animated{ - (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated]; [super viewWillAppear:animated];
[self initShopCartCount];
[self.navigationController setNavigationBarHidden:YES]; [self.navigationController setNavigationBarHidden:YES];
} }
...@@ -98,7 +101,7 @@ ...@@ -98,7 +101,7 @@
self.colorArray = [NSMutableArray array]; self.colorArray = [NSMutableArray array];
self.detailView1.delegate = self; self.detailView1.delegate = self;
self.detailView2.delegate = self; self.detailView2.delegate = self;
self.midDetailView.delegate = self;
if(self.product){ if(self.product){
self.midDetailView.product = self.product; self.midDetailView.product = self.product;
[self.detailView1 setData:self.product]; [self.detailView1 setData:self.product];
...@@ -109,8 +112,8 @@ ...@@ -109,8 +112,8 @@
} }
[self requestColorMetafield]; [self requestColorMetafield];
[self requestAdminProduct]; [self requestAdminProduct];
[self initShopCartCount]; // [self initShopCartCount];
[self initMidViewHight]; // [self initMidViewHight];
[self.btnLike setImage:[UIImage imageNamed:@"ic_like_unable"] forState:UIControlStateNormal]; [self.btnLike setImage:[UIImage imageNamed:@"ic_like_unable"] forState:UIControlStateNormal];
...@@ -123,22 +126,22 @@ ...@@ -123,22 +126,22 @@
[self.btnShopCart setTitle:count.stringValue forState:UIControlStateNormal]; [self.btnShopCart setTitle:count.stringValue forState:UIControlStateNormal];
} }
-(void)initMidViewHight{ //-(void)initMidViewHight{
if(self.product){ // if(self.product){
if([KWMStringUtil isEmpty:self.product.stringDescription]){ // if([KWMStringUtil isEmpty:self.product.stringDescription]){
self.heightMidView.constant = 86.5; // self.heightMidView.constant = 86.5;
}else{ // }else{
NSString *detail = self.product.stringDescription; // NSString *detail = self.product.stringDescription;
//获得字体,计算文字显示所需高度 // //获得字体,计算文字显示所需高度
UIFont *font = [UIFont systemFontOfSize:11]; // UIFont *font = [UIFont systemFontOfSize:11];
if(SYSTEM_VERSION_LESS_THAN(@"9.0")){ // if(SYSTEM_VERSION_LESS_THAN(@"9.0")){
[UIFont fontWithName:@"PingFang SC" size:11]; // [UIFont fontWithName:@"PingFang SC" size:11];
} // }
NSInteger heightLbDetail = [KWMStringUtil getLabelHeight:detail labelFont:font textWidth:UI_SCREEN_WIDTH - 20].height; // NSInteger heightLbDetail = [KWMStringUtil getLabelHeight:detail labelFont:font textWidth:UI_SCREEN_WIDTH - 20].height;
self.heightMidView.constant = (86.5 - 15 + heightLbDetail); // self.heightMidView.constant = (86.5 - 15 + heightLbDetail);
} // }
} // }
} //}
//请求API得到颜色Meterfield后才会调用这个. //请求API得到颜色Meterfield后才会调用这个.
...@@ -286,6 +289,10 @@ ...@@ -286,6 +289,10 @@
} }
#pragma mark -- KWMSecondDetailViewDelegate #pragma mark -- KWMSecondDetailViewDelegate
-(void)kwm_updatedSecondDetailViewHeight:(CGFloat)height {
self.detailView2HeightConstraint.constant = height;
}
-(void)kwm_clickCollectionCell:(BUYProduct *)product{ -(void)kwm_clickCollectionCell:(BUYProduct *)product{
if(!product){ if(!product){
return; return;
...@@ -435,6 +442,12 @@ ...@@ -435,6 +442,12 @@
} }
} }
#pragma mark - KWMMidViewDetailDelegate
-(void) kwm_updatedHeight:(CGFloat)height {
self.heightMidView.constant = height;
}
#pragma mark - API BUYClient+Storefront #pragma mark - API BUYClient+Storefront
-(void)requestProductDetail{ -(void)requestProductDetail{
if(!(self.productId || self.product || self.handle)){ if(!(self.productId || self.product || self.handle)){
...@@ -449,7 +462,7 @@ ...@@ -449,7 +462,7 @@
}else if(product){ }else if(product){
weakSelf.product = product; weakSelf.product = product;
weakSelf.productId = product.identifier; weakSelf.productId = product.identifier;
[weakSelf initMidViewHight]; // [weakSelf initMidViewHight];
weakSelf.midDetailView.product = product; weakSelf.midDetailView.product = product;
[weakSelf.detailView1 setData:product]; [weakSelf.detailView1 setData:product];
[self requestBrandProducts:1]; [self requestBrandProducts:1];
...@@ -490,11 +503,22 @@ ...@@ -490,11 +503,22 @@
NSString *handle = [KWMStringUtil deleteOtherCharExceptLetterWithLine:self.product.vendor]; NSString *handle = [KWMStringUtil deleteOtherCharExceptLetterWithLine:self.product.vendor];
self.detailView2.isLoadingSameBrand = YES; self.detailView2.isLoadingSameBrand = YES;
__weak KWMNewProductVC *weakSelf = self; __weak KWMNewProductVC *weakSelf = self;
[self.api searchProduct:@{@"keyword":self.product.vendor} success:^(NSURLSessionDataTask *task, KWMSearchResult *result) {
// weakSelf.detailView2.isLoadingSameBrand = NO;
weakSelf.detailView2.brand = weakSelf.product.vendor;
weakSelf.detailView2.productCount = result.products.total;
// [weakSelf.detailView2 setData:result.productList isSameBrand:YES];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
// weakSelf.detailView2.isLoadingSameBrand = NO;
}];
[self.client getCollectionByHandle:handle completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) { [self.client getCollectionByHandle:handle completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) {
if(collection && !error){ if(collection && !error){
weakSelf.detailView2.brandDescription = collection.stringDescription;
[weakSelf.client getProductsPage:page inCollection:collection.identifier completion:^(NSArray<BUYProduct *> * _Nullable products, NSUInteger page, BOOL reachedEnd, NSError * _Nullable error) { [weakSelf.client getProductsPage:page inCollection:collection.identifier completion:^(NSArray<BUYProduct *> * _Nullable products, NSUInteger page, BOOL reachedEnd, NSError * _Nullable error) {
weakSelf.detailView2.isLoadingSameBrand = NO; weakSelf.detailView2.isLoadingSameBrand = NO;
weakSelf.detailView2.brand = weakSelf.product.vendor;
[weakSelf.detailView2 setData:products isSameBrand:YES]; [weakSelf.detailView2 setData:products isSameBrand:YES];
}]; }];
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/> <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<customFonts key="customFonts">
<array key="PingFang.ttc">
<string>PingFangSC-Medium</string>
<string>PingFangSC-Regular</string>
</array>
</customFonts>
<scenes> <scenes>
<!--新商品详情--> <!--新商品详情-->
<scene sceneID="fO1-9n-Cyi"> <scene sceneID="fO1-9n-Cyi">
...@@ -79,7 +85,7 @@ ...@@ -79,7 +85,7 @@
<rect key="frame" x="0.0" y="50" width="375" height="567"/> <rect key="frame" x="0.0" y="50" width="375" height="567"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="X5Y-fo-qOg"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="X5Y-fo-qOg">
<rect key="frame" x="-0.5" y="0.0" width="375" height="1151.5"/> <rect key="frame" x="-0.5" y="0.0" width="375" height="1161.5"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2KH-pA-K5l" customClass="KWMFirstDetailView"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2KH-pA-K5l" customClass="KWMFirstDetailView">
<rect key="frame" x="0.0" y="0.0" width="375" height="625"/> <rect key="frame" x="0.0" y="0.0" width="375" height="625"/>
...@@ -93,10 +99,10 @@ ...@@ -93,10 +99,10 @@
</constraints> </constraints>
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pyO-1P-iAa" customClass="KWMSecondDetailView"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pyO-1P-iAa" customClass="KWMSecondDetailView">
<rect key="frame" x="0.0" y="711.5" width="375" height="440"/> <rect key="frame" x="0.0" y="711.5" width="375" height="450"/>
<color key="backgroundColor" red="0.82745098039999998" green="0.83921568629999999" blue="0.85098039219999999" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.82745098039999998" green="0.83921568629999999" blue="0.85098039219999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="440" id="SH3-J6-rwf"/> <constraint firstAttribute="height" constant="450" id="SH3-J6-rwf"/>
</constraints> </constraints>
</view> </view>
</subviews> </subviews>
...@@ -222,6 +228,7 @@ ...@@ -222,6 +228,7 @@
<outlet property="btnShopCart" destination="gbx-rg-A8B" id="vel-Ab-0rI"/> <outlet property="btnShopCart" destination="gbx-rg-A8B" id="vel-Ab-0rI"/>
<outlet property="detailView1" destination="2KH-pA-K5l" id="ynO-by-UfZ"/> <outlet property="detailView1" destination="2KH-pA-K5l" id="ynO-by-UfZ"/>
<outlet property="detailView2" destination="pyO-1P-iAa" id="scJ-Iv-fnz"/> <outlet property="detailView2" destination="pyO-1P-iAa" id="scJ-Iv-fnz"/>
<outlet property="detailView2HeightConstraint" destination="SH3-J6-rwf" id="H8q-0s-nUI"/>
<outlet property="heightMidView" destination="Pwf-vg-Z3k" id="h8Z-Kr-bXi"/> <outlet property="heightMidView" destination="Pwf-vg-Z3k" id="h8Z-Kr-bXi"/>
<outlet property="midDetailView" destination="t55-gT-VGG" id="BRI-de-9Jz"/> <outlet property="midDetailView" destination="t55-gT-VGG" id="BRI-de-9Jz"/>
<outlet property="scrollView" destination="T6J-Gp-5iu" id="ZLc-Xh-Pyk"/> <outlet property="scrollView" destination="T6J-Gp-5iu" id="ZLc-Xh-Pyk"/>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "Buy/Buy.h" #import "Buy/Buy.h"
#import "KWMDataProduct.h"
@interface KWMCollectionCell : UICollectionViewCell @interface KWMCollectionCell : UICollectionViewCell
...@@ -22,5 +23,6 @@ ...@@ -22,5 +23,6 @@
@property (nonatomic) BOOL isMore; @property (nonatomic) BOOL isMore;
-(void)setData:(BUYProduct *)product; -(void)setData:(BUYProduct *)product;
-(void)setDataProduct:(KWMDataProduct *) product;
@end @end
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
-(void)setData:(BUYProduct *)product{ -(void)setData:(BUYProduct *)product{
if(product!=nil){ if(product!=nil){
if ([product isKindOfClass:[KWMDataProduct class]]) {
[self setDataProduct:(KWMDataProduct *)product];
return;
}
self.product = product; self.product = product;
self.lbBrand.text = product.title; self.lbBrand.text = product.title;
NSString *imageUrl = [KWMImageUtil getProductImageUrl:product ImageSize:SmallImage]; NSString *imageUrl = [KWMImageUtil getProductImageUrl:product ImageSize:SmallImage];
...@@ -77,5 +81,45 @@ ...@@ -77,5 +81,45 @@
} }
} }
- (void)setDataProduct:(KWMDataProduct *)product {
self.lbBrand.text = product.vendor;
NSString *imageUrl = [KWMImageUtil getProductImageUrl:product ImageSize:SmallImage];
NSURL *imageURL = [NSURL URLWithString:imageUrl];
[self.ivCollectionCell sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
KWMVariants *variant = product.variants.firstObject;
if (variant.compareAtPrice) {
self.lbPrice.hidden = NO;
self.priceSpace.constant = 4;
// NSString *priceString = productVariant.compareAtPriceFormatted;
NSString *priceString = variant.compareAtPrice.priceFormatted;
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic];
self.lbPrice.attributedText = attribtStr;
}else{
self.lbPrice.hidden = YES;
self.lbPrice.text = nil;
self.priceSpace.constant = 0;
}
NSString *priceString,*discountStr;
if (variant.compareAtPrice) {
self.lbPrice.hidden = NO;
self.priceSpace.constant = 4;
// priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
priceString = variant.compareAtPrice.priceFormatted;
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic];
self.lbPrice.attributedText = attribtStr;
}else{
self.lbPrice.hidden = YES;
self.lbPrice.text = nil;
self.priceSpace.constant = 0;
// self.discountLeft.constant = -28;
// self.lbDiscount.textAlignment = NSTextAlignmentCenter;
}
// discountStr = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.price]];
discountStr = variant.price.priceFormatted;
self.lbDiscount.text = discountStr;
}
@end @end
...@@ -312,11 +312,11 @@ ...@@ -312,11 +312,11 @@
// // init checkout 这里应该也没用了 因为self.cart不存在 // // init checkout 这里应该也没用了 因为self.cart不存在
// checkout = [[BUYCheckout alloc] initWithModelManager:self.client.modelManager cart:self.cart]; // checkout = [[BUYCheckout alloc] initWithModelManager:self.client.modelManager cart:self.cart];
// } // }
NSDictionary *checkoutCache = [self.userDao checkOutCache]; // NSDictionary *checkoutCache = [self.userDao checkOutCache];
BUYCheckout *checkout = nil; BUYCheckout *checkout = nil;
if (!checkoutCache || self.cartCookie) { // if (!checkoutCache || self.cartCookie) {
checkout = [[BUYCheckout alloc] initWithModelManager:self.client.modelManager JSONDictionary:nil]; checkout = [[BUYCheckout alloc] initWithModelManager:self.client.modelManager JSONDictionary:nil];
} // }
// if(self.address){ // if(self.address){
if([self checkAddress:self.address]){ if([self checkAddress:self.address]){
KWMSelectAddressVC *addressVC = (KWMSelectAddressVC *)[KWMBaseVC findControllerBy:[KWMSelectAddressVC kwmTag] fromStoryboard:@"ShopCart"]; KWMSelectAddressVC *addressVC = (KWMSelectAddressVC *)[KWMBaseVC findControllerBy:[KWMSelectAddressVC kwmTag] fromStoryboard:@"ShopCart"];
...@@ -554,10 +554,11 @@ ...@@ -554,10 +554,11 @@
[newReq setValue:this.client.customerToken.accessToken forHTTPHeaderField:@"X-Shopify-Customer-Access-Token"]; [newReq setValue:this.client.customerToken.accessToken forHTTPHeaderField:@"X-Shopify-Customer-Access-Token"];
} }
// 如果有checkout说明是新订单 直接更新订单地址就好 如果没有checkout说明是旧订单已经有地址所以无需更新 // 如果有checkout说明是新订单 直接更新订单地址就好 如果没有checkout说明是旧订单已经有地址所以无需更新
if (checkout || this.cartCookie) { // 170922 所有订单全部刷新地址
// if (checkout || this.cartCookie) {
newReq.HTTPMethod = @"PATCH"; newReq.HTTPMethod = @"PATCH";
[newReq setHTTPBody:[NSJSONSerialization dataWithJSONObject:[checkout jsonDictionaryForCheckout] options:0 error:nil]]; [newReq setHTTPBody:[NSJSONSerialization dataWithJSONObject:[checkout jsonDictionaryForCheckout] options:0 error:nil]];
} // }
return newReq; return newReq;
}]; }];
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#import "KWMImageUtil.h" #import "KWMImageUtil.h"
#import "KWMStringUtil.h" #import "KWMStringUtil.h"
#import "Buy/Buy.h" #import "Buy/Buy.h"
#import <RegexKitLite/RegexKitLite.h>
@implementation KWMImageUtil { @implementation KWMImageUtil {
...@@ -181,18 +182,22 @@ ...@@ -181,18 +182,22 @@
+ (NSString *)getProductImageUrlByOriginalUrl:(NSString *)originalImgUrl ImageSize:(NSInteger)ImageSize{ + (NSString *)getProductImageUrlByOriginalUrl:(NSString *)originalImgUrl ImageSize:(NSInteger)ImageSize{
NSMutableString *newImageUrl = [[NSMutableString alloc]initWithString:@""];; NSMutableString *newImageUrl = [[NSMutableString alloc]initWithString:[originalImgUrl stringByReplacingOccurrencesOfString:@"?" withString:@"%3F"]];;
//https://cdn.shopify.com/s/files/1/1089/5284/products/5413_1.jpg?v==1459708223 转换为 //https://cdn.shopify.com/s/files/1/1089/5284/products/5413_1.jpg?v==1459708223 转换为
//https://o42yton8r.qnssl.com/s/files/1/1089/5284/products/5413_1.jpg?imageView2/1/w/300/h/300/v==1459708223 //https://o42yton8r.qnssl.com/s/files/1/1089/5284/products/5413_1.jpg?imageView2/1/w/300/h/300/v==1459708223
if(originalImgUrl){ // if(originalImgUrl){
NSRange startRange = [originalImgUrl rangeOfString:@"?"]; // NSRange startRange = [originalImgUrl rangeOfString:@"?"];
if (startRange.location != NSNotFound) { // if (startRange.location != NSNotFound) {
newImageUrl=[[NSMutableString alloc]initWithString:originalImgUrl]; // newImageUrl=[[NSMutableString alloc]initWithString:originalImgUrl];
NSArray<NSString *> *imageWH = [self getImageWH:ImageSize]; // NSArray<NSString *> *imageWH = [self getImageWH:ImageSize];
NSString *size = [NSString stringWithFormat:@"imageView2/2/w/%@/h/%@/",imageWH[0],imageWH[1]]; // NSString *size = [NSString stringWithFormat:@"imageView2/2/w/%@/h/%@/",imageWH[0],imageWH[1]];
[newImageUrl insertString:size atIndex:startRange.location+1]; // [newImageUrl insertString:size atIndex:startRange.location+1];
} // }
} // }
NSArray<NSString *> *imageWH = [self getImageWH:ImageSize];
NSString *size = [NSString stringWithFormat:@"?imageView2/2/w/%@/h/%@/",imageWH[0],imageWH[1]];
[newImageUrl appendString:size];
return [newImageUrl stringByReplacingOccurrencesOfString:@"cdn.shopify.com" withString:Image_Domain]; return [newImageUrl stringByReplacingOccurrencesOfString:@"cdn.shopify.com" withString:Image_Domain];
} }
......
//
// KWMProductSameBrandView.h
// iCemarose
//
// Created by Sanchew on 2017/9/13.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KWMProductSameBrandView : UIView
@property (weak, nonatomic) IBOutlet UILabel *brandName;
@property (weak, nonatomic) IBOutlet UILabel *quantity;
@property (weak, nonatomic) IBOutlet UILabel *brandDescription;
@end
//
// KWMProductSameBrandView.m
// iCemarose
//
// Created by Sanchew on 2017/9/13.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMProductSameBrandView.h"
@implementation KWMProductSameBrandView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
@property (nonatomic) KWMNewGoodsModel *goodsModel; @property (nonatomic) KWMNewGoodsModel *goodsModel;
@property (nonatomic) NSString *title;
@property (weak, nonatomic) id<KWMTBVSectionHeardViewDelegate>delegate; @property (weak, nonatomic) id<KWMTBVSectionHeardViewDelegate>delegate;
@end @end
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
} }
} }
- (void)setTitle:(NSString *)title {
_lbSectionTitel.text = title;
}
- (void)onClickWacthMore:(UITapGestureRecognizer *)tapGesture{ - (void)onClickWacthMore:(UITapGestureRecognizer *)tapGesture{
if ([self.delegate respondsToSelector:@selector(kwm_watchMoreProductsByBrand:AndTitle:)]) { if ([self.delegate respondsToSelector:@selector(kwm_watchMoreProductsByBrand:AndTitle:)]) {
[self.delegate kwm_watchMoreProductsByBrand:_goodsModel AndTitle:_lbSectionTitel.text]; [self.delegate kwm_watchMoreProductsByBrand:_goodsModel AndTitle:_lbSectionTitel.text];
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<customFonts key="customFonts">
<array key="PingFang.ttc">
<string>PingFangSC-Light</string>
</array>
</customFonts>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMTBVSectionHeardView"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMTBVSectionHeardView">
<connections> <connections>
...@@ -54,27 +59,17 @@ ...@@ -54,27 +59,17 @@
</imageView> </imageView>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="wdX-Ml-DYY" firstAttribute="centerY" secondItem="PIL-ko-rzF" secondAttribute="centerY" id="9nq-Ez-yrN"/>
<constraint firstAttribute="trailing" secondItem="wdX-Ml-DYY" secondAttribute="trailing" constant="140" id="NEV-2U-wJ5"/>
<constraint firstAttribute="trailing" secondItem="owh-51-VTC" secondAttribute="trailing" constant="20" id="NS0-1s-TK1"/> <constraint firstAttribute="trailing" secondItem="owh-51-VTC" secondAttribute="trailing" constant="20" id="NS0-1s-TK1"/>
<constraint firstAttribute="bottom" secondItem="wdX-Ml-DYY" secondAttribute="bottom" id="PA5-Nd-lp4"/> <constraint firstAttribute="bottom" secondItem="wdX-Ml-DYY" secondAttribute="bottom" id="PA5-Nd-lp4"/>
<constraint firstItem="wdX-Ml-DYY" firstAttribute="top" secondItem="PIL-ko-rzF" secondAttribute="top" id="cHx-1l-c6C"/> <constraint firstItem="wdX-Ml-DYY" firstAttribute="top" secondItem="PIL-ko-rzF" secondAttribute="top" id="cHx-1l-c6C"/>
<constraint firstItem="wdX-Ml-DYY" firstAttribute="centerX" secondItem="PIL-ko-rzF" secondAttribute="centerX" id="hFz-IN-tkC"/> <constraint firstItem="wdX-Ml-DYY" firstAttribute="centerX" secondItem="PIL-ko-rzF" secondAttribute="centerX" id="hFz-IN-tkC"/>
<constraint firstItem="owh-51-VTC" firstAttribute="centerY" secondItem="PIL-ko-rzF" secondAttribute="centerY" id="hO5-ch-Xcn"/> <constraint firstItem="owh-51-VTC" firstAttribute="centerY" secondItem="PIL-ko-rzF" secondAttribute="centerY" id="hO5-ch-Xcn"/>
<constraint firstAttribute="trailing" secondItem="aAy-jd-lsA" secondAttribute="trailing" constant="50" id="k3t-q6-hhh"/> <constraint firstAttribute="trailing" secondItem="aAy-jd-lsA" secondAttribute="trailing" constant="50" id="k3t-q6-hhh"/>
<constraint firstItem="wdX-Ml-DYY" firstAttribute="leading" secondItem="PIL-ko-rzF" secondAttribute="leading" constant="140" id="op9-bF-1ab"/>
<constraint firstItem="aAy-jd-lsA" firstAttribute="leading" secondItem="PIL-ko-rzF" secondAttribute="leading" constant="50" id="pbZ-Az-bo4"/> <constraint firstItem="aAy-jd-lsA" firstAttribute="leading" secondItem="PIL-ko-rzF" secondAttribute="leading" constant="50" id="pbZ-Az-bo4"/>
<constraint firstItem="aAy-jd-lsA" firstAttribute="centerY" secondItem="PIL-ko-rzF" secondAttribute="centerY" id="zQe-eq-mgX"/> <constraint firstItem="aAy-jd-lsA" firstAttribute="centerY" secondItem="PIL-ko-rzF" secondAttribute="centerY" id="zQe-eq-mgX"/>
</constraints> </constraints>
<nil key="simulatedStatusBarMetrics"/> <nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<variation key="default">
<mask key="constraints">
<exclude reference="9nq-Ez-yrN"/>
<exclude reference="NEV-2U-wJ5"/>
<exclude reference="op9-bF-1ab"/>
</mask>
</variation>
<point key="canvasLocation" x="559.5" y="-51"/> <point key="canvasLocation" x="559.5" y="-51"/>
</view> </view>
</objects> </objects>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.5.6</string> <string>1.5.7</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2017090617</string> <string>1.5.7.4</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSApplicationQueriesSchemes</key> <key>LSApplicationQueriesSchemes</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment