ソースを参照

订阅盲盒列表

hjx 1 年間 前
コミット
0433156f3c

+ 6 - 0
TOKTOK/TOKTOK.xcodeproj/project.pbxproj

@@ -133,6 +133,7 @@
 		84B9184B29F27579003CF0A0 /* XSTTBlindBoxDetailsGoodsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84B9184A29F27579003CF0A0 /* XSTTBlindBoxDetailsGoodsTableViewController.m */; };
 		84B9184E29F28858003CF0A0 /* XSTTBlindBoxDetailsTipsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84B9184D29F28858003CF0A0 /* XSTTBlindBoxDetailsTipsViewController.m */; };
 		84CADD132A1CA7F1004B0600 /* t_xstt_city_data.db in Resources */ = {isa = PBXBuildFile; fileRef = 84CADD122A1CA7F1004B0600 /* t_xstt_city_data.db */; };
+		84CADD162A1DEEF9004B0600 /* XSTTBlindBoxToOrderModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CADD152A1DEEF9004B0600 /* XSTTBlindBoxToOrderModel.m */; };
 		84CD5AF929F7719E00531BB6 /* AppDelegate+XSTTPushNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CD5AF829F7719E00531BB6 /* AppDelegate+XSTTPushNotification.m */; };
 		84CD5AFD2A04E7BE00531BB6 /* XSTTBeerDetailsRadarMapView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CD5AFC2A04E7BE00531BB6 /* XSTTBeerDetailsRadarMapView.m */; };
 		84D3FCDD268C45DE00D61979 /* UIControl+XSTTButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D3FCDC268C45DE00D61979 /* UIControl+XSTTButton.m */; };
@@ -415,6 +416,8 @@
 		84B9184C29F28858003CF0A0 /* XSTTBlindBoxDetailsTipsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSTTBlindBoxDetailsTipsViewController.h; sourceTree = "<group>"; };
 		84B9184D29F28858003CF0A0 /* XSTTBlindBoxDetailsTipsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XSTTBlindBoxDetailsTipsViewController.m; sourceTree = "<group>"; };
 		84CADD122A1CA7F1004B0600 /* t_xstt_city_data.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = t_xstt_city_data.db; sourceTree = "<group>"; };
+		84CADD142A1DEEF9004B0600 /* XSTTBlindBoxToOrderModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSTTBlindBoxToOrderModel.h; sourceTree = "<group>"; };
+		84CADD152A1DEEF9004B0600 /* XSTTBlindBoxToOrderModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XSTTBlindBoxToOrderModel.m; sourceTree = "<group>"; };
 		84CD5AF729F7719E00531BB6 /* AppDelegate+XSTTPushNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+XSTTPushNotification.h"; sourceTree = "<group>"; };
 		84CD5AF829F7719E00531BB6 /* AppDelegate+XSTTPushNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+XSTTPushNotification.m"; sourceTree = "<group>"; };
 		84CD5AFB2A04E7BE00531BB6 /* XSTTBeerDetailsRadarMapView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSTTBeerDetailsRadarMapView.h; sourceTree = "<group>"; };
@@ -676,6 +679,8 @@
 			children = (
 				84287A6D29DE74260037FD51 /* XSTTBlindBoxToOrderTableViewController.h */,
 				84287A6E29DE74260037FD51 /* XSTTBlindBoxToOrderTableViewController.m */,
+				84CADD142A1DEEF9004B0600 /* XSTTBlindBoxToOrderModel.h */,
+				84CADD152A1DEEF9004B0600 /* XSTTBlindBoxToOrderModel.m */,
 			);
 			path = Order;
 			sourceTree = "<group>";
@@ -1654,6 +1659,7 @@
 				84D748C526833C2400AD7C92 /* UIViewController+XSTTNavigationBar.m in Sources */,
 				849C70B928C891A500BE760C /* JXHZoomImageView.m in Sources */,
 				84D7492D2689B39800AD7C92 /* XSTTHtmlViewController.m in Sources */,
+				84CADD162A1DEEF9004B0600 /* XSTTBlindBoxToOrderModel.m in Sources */,
 				84D7492726857ABD00AD7C92 /* XSTTVerificationProfile.m in Sources */,
 				84D748EE268422D400AD7C92 /* YYClassInfo.m in Sources */,
 				841C06602916059800D7BAC8 /* XSTTAboutUsViewController.m in Sources */,

+ 2 - 2
TOKTOK/TOKTOK/BeerCentre/StoreListView/XSTTStoreListViewController.m

@@ -231,7 +231,7 @@
     if (array.count == 0) {
         [self.tableView reloadData];
         if (_dataArray.count == 0) {
-            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.tableView) action:nil];
+            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
 //            self.tableView.tableFooterView.backgroundColor = xstt_background_color();
         } else {
             self.tableView.tableFooterView = _footerView;
@@ -249,7 +249,7 @@
 - (void)getDataFailure:(NSError *)error {
     if (_dataArray.count == 0) {
         @weakify(self)
-        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.tableView) action:^{
+        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:^{
             @strongify(self)
             [self getData];
         }];

+ 22 - 0
TOKTOK/TOKTOK/Home/BlindBox/Order/XSTTBlindBoxToOrderModel.h

@@ -0,0 +1,22 @@
+//
+//  XSTTBlindBoxToOrderModel.h
+//  TOKTOK
+//
+//  Created by shanp on 2023/5/24.
+//
+
+#import "XSTTBaseNetworkModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface XSTTBlindBoxToOrderModel : XSTTBaseNetworkModel
+
+@property (nonatomic, strong) NSString *xstt_boxId;
+@property (nonatomic, strong) NSString *xstt_boxName;
+@property (nonatomic, strong) NSString *xstt_boxBg;
+@property (nonatomic, strong) NSString *xstt_currBoxNo;
+@property (nonatomic, strong) NSString *xstt_cutOffTime;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 12 - 0
TOKTOK/TOKTOK/Home/BlindBox/Order/XSTTBlindBoxToOrderModel.m

@@ -0,0 +1,12 @@
+//
+//  XSTTBlindBoxToOrderModel.m
+//  TOKTOK
+//
+//  Created by shanp on 2023/5/24.
+//
+
+#import "XSTTBlindBoxToOrderModel.h"
+
+@implementation XSTTBlindBoxToOrderModel
+
+@end

+ 47 - 27
TOKTOK/TOKTOK/Home/BlindBox/Order/XSTTBlindBoxToOrderTableViewController.m

@@ -9,6 +9,10 @@
 #import "XSTTUIGeneralHeader.h"
 #import <CALayer+JXHShadow.h>
 #import "XSTTBlindBoxDetailsViewController.h"
+#import "XSTTBlindBoxToOrderModel.h"
+#import <UIImageView+WebCache.h>
+#import "UIViewController+XSTTNetworkManager.h"
+#import "XSTTBusinessManager.h"
 
 #define xstt_blindBoxToOrderCellImageHeight ((jxh_screenWidth() - XSTTMargin * 2) * 0.3)
 
@@ -95,35 +99,18 @@
     return self;
 }
 
-- (void)reloadData:(NSIndexPath *)data {
-    switch (data.row) {
-        case 0:
-            _imageView.image = jxh_getImage(列表_入门);
-            _title.text = @"入门精酿·盲盒订阅";
-            break;
-        case 1:
-            _imageView.image = jxh_getImage(列表_高端);
-            _title.text = @"高端玩家·精酿订阅";
-            break;
-        case 2:
-            _imageView.image = jxh_getImage(列表_酿造);
-            _title.text = @"亲自酿造·高级定制";
-            break;
-        case 3:
-            _imageView.image = jxh_getImage(列表_季节);
-            _title.text = @"季节尝鲜款·限量订阅";
-            break;
-            
-        default:
-            break;
-    }
-    _number.text = @"2023040159期";
-    _time.text = @"2023/03/20";
+- (void)reloadData:(XSTTBlindBoxToOrderModel *)data {
+    _title.text = data.xstt_boxName;
+    [_imageView sd_setImageWithURL:[NSURL URLWithString:data.xstt_boxBg]];
+    _number.text = [NSString stringWithFormat:@"%@期",data.xstt_currBoxNo];
+    _time.text = data.xstt_cutOffTime;
 }
 
 @end
 
-@interface XSTTBlindBoxToOrderTableViewController ()
+@interface XSTTBlindBoxToOrderTableViewController () {
+    NSArray<XSTTBlindBoxToOrderModel *> *_dataArray;
+}
 
 @end
 
@@ -132,16 +119,48 @@
 - (instancetype)init {
     self = [super initWithStyle:UITableViewStyleGrouped backgroundColor:XSTTTableViewBackgroundColorWhite];
     if (!self) return nil;
+    _dataArray = NSArray.new;
     return self;
 }
 
 - (void)viewDidLoad {
     [super viewDidLoad];
     [self setUpUI];
+    [self getList];
 }
 
 #pragma mark - Action
 #pragma mark - Network Action
+- (void)getList {
+    [self networkUseMethod:XSTTNetworkMethodGET loadingTips:XSTTGetDataLoadingCommonTips isLogin:xstt_isLogin() signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(XSTTURLGetBlindBoxList) urlParameters:nil parameters:nil success:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        [self getListSuccesss:data];
+        return @"";
+    } failure:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        [self getListFailure:error];
+        return XSTTGetDataFailureCommonTips;
+    }];
+}
+
+- (void)getListSuccesss:(id)data {
+    _dataArray = [XSTTBlindBoxToOrderModel getModelListWithArray:data[@"data"]];
+    [self.tableView reloadData];
+    if (_dataArray.count == 0) {
+        [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(blind_box_default) tips:@"还未开放精酿订购信息" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
+    } else {
+        [self.tableView removeDefaultFootView];
+    }
+}
+
+- (void)getListFailure:(NSError *)error {
+    if (_dataArray.count == 0) {
+        @weakify(self)
+        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:^{
+            @strongify(self)
+            [self getList];
+        }];
+    }
+}
+
 #pragma mark - Delegate & DataSource
 
 static NSString * const reuseIdentifier = @"XSTTBlindBoxToOrderTableViewCell";
@@ -151,12 +170,12 @@ static NSString * const reuseIdentifier = @"XSTTBlindBoxToOrderTableViewCell";
     if (!cell) {
         cell = [[XSTTBlindBoxToOrderTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
     }
-    [cell reloadData:indexPath];
+    [cell reloadData:_dataArray[indexPath.row]];
     return cell;
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return 10;
+    return _dataArray.count;
 }
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -184,6 +203,7 @@ static NSString * const reuseIdentifier = @"XSTTBlindBoxToOrderTableViewCell";
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
+    if (_dataArray.count == 0) return jxh_onePixe();
     return 16;
 }
 

+ 2 - 2
TOKTOK/TOKTOK/Home/BreweryList/XSTTBreweryListViewController.m

@@ -64,7 +64,7 @@
     if (array.count == 0) {
         [self.tableView reloadData];
         if (_dataArray.count == 0) {
-            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.tableView) action:nil];
+            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
 //            self.tableView.tableFooterView.backgroundColor = xstt_background_color();
         } else {
             self.tableView.tableFooterView = self.footerView;
@@ -82,7 +82,7 @@
 - (void)getDataFailure:(NSError *)error {
     if (_dataArray.count == 0) {
         @weakify(self)
-        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.tableView) action:^{
+        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:^{
             @strongify(self)
             [self getData];
         }];

+ 12 - 0
TOKTOK/TOKTOK/Home/Home.xcassets/BlindBox/blind_box_default.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "hema.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
TOKTOK/TOKTOK/Home/Home.xcassets/BlindBox/blind_box_default.imageset/hema.pdf


+ 2 - 2
TOKTOK/TOKTOK/Mine/MessageView/SystemMessage/XSTTSystemMessageViewController.m

@@ -133,7 +133,7 @@
     if (array.count == 0) {
         [self.tableView reloadData];
         if (_data.count == 0) {
-            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.tableView) action:nil];
+            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
 //            self.tableView.tableFooterView.backgroundColor = xstt_background_color();
         }
         [self endLoadDataStatusWithCanRefresh:true canLoad:false];
@@ -149,7 +149,7 @@
 - (void)getDataFailure:(NSError *)error {
     if (_data.count == 0) {
         @weakify(self)
-        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.tableView) action:^{
+        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:^{
             @strongify(self)
             [self getDataIsRefresh:true];
         }];

+ 2 - 2
TOKTOK/TOKTOK/Mine/MessageView/UserMessage/XSTTUserMessageViewController.m

@@ -177,7 +177,7 @@ CONST_STRING XSTTUserMessageStringTypeComment = @"Comment";
     if (array.count == 0) {
         [self.tableView reloadData];
         if (_data.count == 0) {
-            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.tableView) action:nil];
+            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
 //            self.tableView.tableFooterView.backgroundColor = xstt_background_color();
         }
         [self endLoadDataStatusWithCanRefresh:true canLoad:false];
@@ -193,7 +193,7 @@ CONST_STRING XSTTUserMessageStringTypeComment = @"Comment";
 - (void)getDataFailure:(NSError *)error {
     if (_data.count == 0) {
         @weakify(self)
-        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.tableView) action:^{
+        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:^{
             @strongify(self)
             [self getDataIsRefresh:true];
         }];

+ 3 - 0
TOKTOK/TOKTOK/Public/Profile/XSTTURLApiProfile.h

@@ -71,6 +71,9 @@ CONST_STRING_INTERFACE XSTTURLShop;//登录微盟
 #pragma mark - 门店相关
 CONST_STRING_INTERFACE XSTTURLGetStoreList;//门店列表
 
+#pragma mark - 盲盒相关
+CONST_STRING_INTERFACE XSTTURLGetBlindBoxList;//盲盒列表
+
 #pragma mark - 气泡相关
 CONST_STRING_INTERFACE XSTTURLGetCircleContentList;//获取气泡列表
 CONST_STRING_INTERFACE XSTTURLGetMineCircleContentList;//获取我发表气泡列表

+ 3 - 0
TOKTOK/TOKTOK/Public/Profile/XSTTURLApiProfile.m

@@ -107,6 +107,9 @@ CONST_STRING XSTTURLShop = @"/weimob/login";//登录微盟
 #pragma mark - 门店相关
 CONST_STRING XSTTURLGetStoreList = @"/stores/list";//门店列表
 
+#pragma mark - 盲盒相关
+CONST_STRING XSTTURLGetBlindBoxList = @"/box/list";//盲盒列表
+
 #pragma mark - 气泡相关
 CONST_STRING XSTTURLGetCircleContentList = @"/cont/content/list";//获取气泡列表
 CONST_STRING XSTTURLGetMineCircleContentList = @"/cont/content/mine";//获取我发表气泡列表

+ 1 - 1
TOKTOK/TOKTOK/SocialCircle/SocialCircleDetialsView/XSTTSocialCircleCommentTableViewController.m

@@ -204,7 +204,7 @@
 - (void)getDataFailure:(NSError *)error {
     if (_data.count == 0) {
         @weakify(self)
-        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.tableView) action:^{
+        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:^{
             @strongify(self)
             [self getData];
         }];

+ 2 - 2
TOKTOK/TOKTOK/SocialCircle/SocialCircleView/XSTTSocialCircleTableViewController.m

@@ -192,7 +192,7 @@ CONST_STRING XSTTSocialCircleViewTypeHot = @"Hot";
     if (array.count == 0) {
         [self.tableView reloadData];
         if (_data.count == 0) {
-            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.tableView) action:nil];
+            [self.tableView setDefaultFootViewWithError:nil image:jxh_getImage(no_data) tips:@"暂无数据" height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:nil];
 //            self.tableView.tableFooterView.backgroundColor = xstt_background_color();
         }
         [self endLoadDataStatusWithCanRefresh:true canLoad:false];
@@ -208,7 +208,7 @@ CONST_STRING XSTTSocialCircleViewTypeHot = @"Hot";
 - (void)getDataFailure:(NSError *)error {
     if (_data.count == 0) {
         @weakify(self)
-        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.tableView) action:^{
+        [self.tableView setDefaultFootViewWithError:error image:nil tips:nil height:jxh_viewHeight(self.view) - jxh_safeInsets(self.view).top - jxh_safeInsets(self.view).bottom action:^{
             @strongify(self)
             [self getDataIsRefresh:true];
         }];