Browse Source

feat:商品详情分享功能

“wangdongchao” 1 year ago
parent
commit
19bc468f00

+ 4 - 1
Asteria/Fuction/Cart/PayManager/ASCheckoutPayManager.m

@@ -90,6 +90,9 @@ static ASCheckoutPayManager *_instance = nil;
 
     } else if ([payType isEqualToString:@"afterpay_payment"]) {//afterpay
         
+        
+        
+        
     } else if ([payType isEqualToString:@"klarna_kco"]) {//klarna
                 
         K_WEAK_SELF;
@@ -210,7 +213,7 @@ static ASCheckoutPayManager *_instance = nil;
         if ([is_active isEqualToString:@"1"]) {
             [self tool_creatOrderAutoken:authToken];
         } else {
-            
+            //异常状态、需要返回购物车刷新
         }
         
     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {

+ 22 - 0
Asteria/Fuction/Goods/Assets/Goods.xcassets/share_icon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "share_icon@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "share_icon@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
Asteria/Fuction/Goods/Assets/Goods.xcassets/share_icon.imageset/share_icon@2x.png


BIN
Asteria/Fuction/Goods/Assets/Goods.xcassets/share_icon.imageset/share_icon@3x.png


+ 23 - 4
Asteria/Fuction/Goods/Revies/cell/GoodsReviewsCell.m

@@ -12,6 +12,7 @@
 
 @interface GoodsReviewsCell ()
 @property (nonatomic, strong) UIImageView *headImg;
+@property (nonatomic, strong) UILabel *headNameLab;
 @property (nonatomic, strong) UILabel *nicknameLab;
 @property (nonatomic, strong) UILabel *creatLab;
 @property (nonatomic, strong) UIButton *zanBtn;
@@ -36,7 +37,10 @@
 - (void)configData:(id)Data{
     GoodsReviewsListM *model = (GoodsReviewsListM *)Data;
     self.reviewM = model;
-    self.headImg.image = UIImageDefaultImg_SD;
+//    self.headImg.image = UIImageDefaultImg_SD;
+    
+    self.headNameLab.text = [[model.nickname substringToIndex:1] uppercaseString];
+    
     self.nicknameLab.text = model.nickname;
     self.creatLab.text = model.created_at;
     self.sizeTitleLab.text = model.title;
@@ -59,6 +63,7 @@
 
 - (void)setupSubviewS{
     [self.contentView addSubview:self.headImg];
+    [self.headImg addSubview:self.headNameLab];
     [self.contentView addSubview:self.nicknameLab];
     [self.contentView addSubview:self.creatLab];
     [self.contentView addSubview:self.zanBtn];
@@ -67,7 +72,7 @@
     [self.contentView addSubview:self.detailLab];
     [self.contentView addSubview:self.reviewsImgV];
     [self setupSubViewsFrame];
-    self.backgroundColor = [UIColor clearColor];
+    self.backgroundColor = [UIColor whiteColor];
     @weakify(self)
     self.reviewsImgV.ViewtapClose = ^(NSInteger num, id  _Nonnull data) {
 
@@ -89,6 +94,11 @@
         make.width.mas_equalTo(40);
         make.height.mas_equalTo(40);
     }];
+    
+    [self.headNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.center.mas_equalTo(self.headImg);
+    }];
+    
     [self.nicknameLab mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.equalTo(self.headImg.mas_right).offset(16);
         make.top.equalTo(self.headImg);
@@ -186,11 +196,20 @@
 
 -(UIImageView *)headImg{
     if(!_headImg){
-        _headImg = [[UIImageView alloc]init];
-        _headImg.image = UIImageDefaultImg_SD;
+        _headImg = [[UIImageView alloc] init];
+        _headImg.backgroundColor = _E0FFF5;
     }
     return _headImg;
 }
+
+- (UILabel *)headNameLab {
+    if(!_headNameLab){
+        _headNameLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Regular size:24] textColor:_113632];
+        _headNameLab.textAlignment = NSTextAlignmentCenter;
+    }
+    return _headNameLab;
+}
+
 -(UILabel *)nicknameLab{
     if(!_nicknameLab){
         _nicknameLab = [[UILabel alloc]init];

+ 16 - 0
Asteria/Fuction/Goods/VC/ASGoodsDetailsViewController.m

@@ -58,9 +58,25 @@
     
 }
 
+- (void)_shareClick {
+    [Fuction_Tool tool_shareImgStr:self.model.add_gooodsImgUrl sharetitle:self.model.name shareUrl:@"https://www.baidu.com" currentVC:self];
+}
+
 - (void)initSubviews {
     [super initSubviews];
     
+    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
+    [button setImage:[UIImage imageNamed:@"share_icon"] forState:UIControlStateNormal];
+    [button addTarget:self action:@selector(_shareClick) forControlEvents:UIControlEventTouchUpInside];
+//    button.backgroundColor = [UIColor yellowColor];
+    [self.customNavBar addSubview:button];
+    [button mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-8);
+        make.bottom.mas_equalTo(-2);
+        make.width.height.mas_equalTo(40);
+    }];
+    
+    
     [self.view addSubview:self.bottomV];
     @weakify(self)
     self.bottomV.ViewtapClose = ^(NSInteger num, id  _Nonnull data) {

+ 2 - 2
Asteria/Fuction/UserCenter/Orders/Controller/ASOrderDetailsViewController.m

@@ -33,9 +33,9 @@
     [super viewDidLoad];
     
     if (self.isPay) {
-        self.titleStr = @"Orders Information";
-    } else {
         self.titleStr = @"Payment";
+    } else {
+        self.titleStr = @"Orders Information";
     }
     
     self.statusBgV.backgroundColor = Col_FFF;

+ 4 - 0
Asteria/Product/Tool/Fuction_Tool.h

@@ -14,6 +14,10 @@ NS_ASSUME_NONNULL_BEGIN
 +(void)push_BaseWebUrl:(NSString *)url webTitle:(NSString *)title;
 +(void)push_JSBaseWebUrl:(NSString *)url webTitle:(NSString *)title;
 +(void)pop_toLoginVC;
+
+
++(void)tool_shareImgStr:(NSString *)imgStr sharetitle:(NSString *)title shareUrl:(NSString *)urlStr currentVC:(UIViewController *)vc;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 29 - 0
Asteria/Product/Tool/Fuction_Tool.m

@@ -30,6 +30,35 @@
 }
 
 
++(void)tool_shareImgStr:(NSString *)imgStr sharetitle:(NSString *)title shareUrl:(NSString *)urlStr currentVC:(UIViewController *)vc{
+    [MBProgressHUD showHUDAddedTo:vc.view animated:YES];
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            NSData * data = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:imgStr]];
+            UIImage *image = [[UIImage alloc]initWithData:data];
+        dispatch_async(dispatch_get_main_queue(), ^{
+            //在这里做UI操作(UI操作都要放在主线程中运行)
+            NSString *textToShare = title;
+            NSURL *urlToShare = [NSURL URLWithString:urlStr];
+            NSArray *activityItems = [NSMutableArray array];
+            
+            if (data != nil) {
+//                activityItems = [NSMutableArray arrayWithArray:@[textToShare, image, urlToShare]];
+                activityItems = [NSMutableArray arrayWithArray:@[urlToShare, image, textToShare]];
+
+            }else{
+                activityItems = [NSMutableArray arrayWithArray:@[textToShare, urlToShare]];
+
+            }
+            UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];
+            activityVC.definesPresentationContext = YES;
+            activityVC.excludedActivityTypes = @[UIActivityTypeOpenInIBooks,@"com.burbn.instagram.shareextension"];
+            [MBProgressHUD hideHUDForView:vc.view animated:YES];
+            [vc presentViewController:activityVC animated:YES completion:nil];
+        });
+        
+        });
+ 
+}
 
 
 @end

File diff suppressed because it is too large
+ 3191 - 3074
Pods/Pods.xcodeproj/project.pbxproj