Commit 73552bc3 by 刘卓鑫

no message

parent 711a0a2b
......@@ -53,6 +53,7 @@
1C5B26BB225B3B85001B0E1B /* ZXUserSettingTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C5B26B9225B3B83001B0E1B /* ZXUserSettingTableViewCell.m */; };
1C5B26BE225B3B8F001B0E1B /* ZXUserSettingModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C5B26BC225B3B8E001B0E1B /* ZXUserSettingModel.m */; };
1C64275C2314C36D00AEC294 /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C64275B2314C36C00AEC294 /* UserNotifications.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
1C721E3923699A39006E5D3D /* ZXAliMaRecomondModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C721E3823699A39006E5D3D /* ZXAliMaRecomondModel.m */; };
1C73BEED22439F8D0078947F /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C73BEEC22439F8C0078947F /* SafariServices.framework */; };
1C73BEEF2243A0080078947F /* EventKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C73BEEE2243A0070078947F /* EventKit.framework */; };
1C73BEFB22447DA90078947F /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C73BEFA22447DA90078947F /* MessageUI.framework */; };
......@@ -817,6 +818,8 @@
1C5B26BD225B3B8F001B0E1B /* ZXUserSettingModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZXUserSettingModel.h; sourceTree = "<group>"; };
1C64275B2314C36C00AEC294 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
1C6427632314FD9000AEC294 /* UIViewController+TunTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+TunTransition.h"; sourceTree = "<group>"; };
1C721E3723699A39006E5D3D /* ZXAliMaRecomondModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXAliMaRecomondModel.h; sourceTree = "<group>"; };
1C721E3823699A39006E5D3D /* ZXAliMaRecomondModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXAliMaRecomondModel.m; sourceTree = "<group>"; };
1C73BEEC22439F8C0078947F /* SafariServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SafariServices.framework; path = System/Library/Frameworks/SafariServices.framework; sourceTree = SDKROOT; };
1C73BEEE2243A0070078947F /* EventKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EventKit.framework; path = System/Library/Frameworks/EventKit.framework; sourceTree = SDKROOT; };
1C73BEF822447CB40078947F /* BaiduMobAdSDK */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = BaiduMobAdSDK; path = "ColorfulSchool/Classes/百度广告/BaiduMobAdSDK.framework/BaiduMobAdSDK"; sourceTree = "<group>"; };
......@@ -2074,6 +2077,8 @@
1CFDEC83235FFD3E007701A5 /* ZXFliterView.m */,
1C8AF53E2362C1CC00E592E4 /* ZXSearchViewController.h */,
1C8AF53F2362C1CC00E592E4 /* ZXSearchViewController.m */,
1C721E3723699A39006E5D3D /* ZXAliMaRecomondModel.h */,
1C721E3823699A39006E5D3D /* ZXAliMaRecomondModel.m */,
);
path = AliMaMa;
sourceTree = "<group>";
......@@ -5338,6 +5343,7 @@
A7EC706F20ECC504001504C5 /* ZXWashOrderListModel.m in Sources */,
A754368C21D331F8005584CC /* fetchAllDeviceModel.m in Sources */,
A705C01B21D4B067004F1628 /* MWGridViewController.m in Sources */,
1C721E3923699A39006E5D3D /* ZXAliMaRecomondModel.m in Sources */,
1C39411D230BC9D5005048EB /* ZXRSReportItemView.m in Sources */,
A7F3E01721B530F500010E23 /* ZXBookTopModel.m in Sources */,
A7BC4D6320CA105A009C031D /* HomeNormalHeader.m in Sources */,
......
......@@ -104,7 +104,7 @@
}
- (NSArray *)titleArr {
if (_titleArr == nil) {
_titleArr = @[@"全部", @"男装", @"女装", @"美妆", @"配饰", @"男鞋", @"女鞋", @"手机", @"零食", @"水果", @"文具", @"礼品鲜花", @"户外运动"];
_titleArr = @[@"推荐", @"男装", @"女装", @"美妆", @"配饰", @"男鞋", @"女鞋", @"手机", @"零食", @"水果", @"文具", @"礼品鲜花", @"户外运动"];
}
return _titleArr;
}
......
......@@ -13,6 +13,8 @@
#import "ZXAlimamaCollectionViewCell.h"
#import "ZXBannerJumpViewController.h"
#import "enlargeClickRegionBtn.h"
#import "ZXAliMaRecomondModel.h"
#import "ZXAliMaRecomondModel.h"
static NSString * const LMHShopId = @"shop";
@interface ZXAliMaMaViewController ()<UICollectionViewDataSource, LMHWaterFallLayoutDeleaget, UICollectionViewDelegate>
......@@ -47,7 +49,7 @@ static NSString * const LMHShopId = @"shop";
- (void)viewDidLoad {
[super viewDidLoad];
// [self initialize];
// [self initialize];
[self setupLayoutAndCollectionView];
......@@ -140,12 +142,12 @@ static NSString * const LMHShopId = @"shop";
- (void)setupRefresh{
self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewShops)];
// self.collectionView.mj_header.backgroundColor = [UIColor yellowColor];
// self.collectionView.mj_header.backgroundColor = [UIColor yellowColor];
[self.collectionView.mj_header beginRefreshing];
self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreShops)];
// self.collectionView.mj_footer.backgroundColor = [UIColor yellowColor];
// self.collectionView.mj_footer.backgroundColor = [UIColor yellowColor];
self.collectionView.mj_footer.hidden = YES;
}
......@@ -157,7 +159,37 @@ static NSString * const LMHShopId = @"shop";
[self loadData];
}
- (void) loadData {
NSString *url = [NSString stringWithFormat:@"%@/alimama/tbk/dg/material/optional?pageNo=%ld&pageNo=20&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot", [kUserDefaults objectForKey:@"HomePage"], (long)self.currentPage,[self.titleStr isEqualToString:@"全部"]?@"":self.titleStr];
NSString *url = [NSString stringWithFormat:@"%@/alimama/tbk/dg/material/optional?pageNo=%ld&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot", [kUserDefaults objectForKey:@"HomePage"], (long)self.currentPage,self.titleStr];
if ([self.titleStr isEqualToString:@"推荐"]) {
url = [NSString stringWithFormat:@"%@/alimama/tbk/uatm/favorites/item?pageNo=%ld", [kUserDefaults objectForKey:@"HomePage"], (long)self.currentPage];
[ZXTool requestDataWithType:kXMHTTPMethodGET url:url para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
});
id res = common.data[@"tbk_uatm_favorites_item_get_response"][@"results"][@"uatm_tbk_item"];
if (res) {
NSArray *list = [ZXAliMaRecomondModel mj_objectArrayWithKeyValuesArray:res];
if (self.currentPage == 1) {
[self.shops removeAllObjects];
}
[self.shops addObjectsFromArray:list];
dispatch_async(dispatch_get_main_queue(), ^{
[self.collectionView.mj_header endRefreshing];
[self.collectionView.mj_footer endRefreshing];
[self.collectionView reloadData];
});
} else {
dispatch_async(dispatch_get_main_queue(), ^{
[self.collectionView.mj_header endRefreshing];
[self.collectionView.mj_footer endRefreshingWithNoMoreData];
});
}
}];
} else {
[[ZXAdViewService sharedManager] GET:[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
id res = responseObject[@"data"][@"tbk_dg_material_optional_response"][@"result_list"][@"map_data"];
if (res) {
......@@ -171,11 +203,21 @@ static NSString * const LMHShopId = @"shop";
[self.collectionView.mj_footer endRefreshing];
[self.collectionView reloadData];
});
} else {
dispatch_async(dispatch_get_main_queue(), ^{
[self.collectionView.mj_header endRefreshing];
[self.collectionView.mj_footer endRefreshingWithNoMoreData];
});
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"%@", error);
dispatch_async(dispatch_get_main_queue(), ^{
[self.collectionView.mj_header endRefreshing];
[self.collectionView.mj_footer endRefreshing];
});
}];
}
}
/**
* 加载更多商品
......@@ -200,8 +242,12 @@ static NSString * const LMHShopId = @"shop";
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
ZXAlimamaCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:LMHShopId forIndexPath:indexPath];
if ([self.titleStr isEqualToString:@"推荐"]) {
cell.recomond = self.shops[indexPath.item];
} else {
cell.model = self.shops[indexPath.item];
}
return cell;
}
......@@ -211,7 +257,7 @@ static NSString * const LMHShopId = @"shop";
#pragma mark - <LMHWaterFallLayoutDeleaget>
- (CGFloat)waterFallLayout:(LMHWaterFallLayout *)waterFallLayout heightForItemAtIndexPath:(NSUInteger)indexPath itemWidth:(CGFloat)itemWidth{
return 238 * k6Scale;
return 245 * k6Scale;
}
- (CGFloat)rowMarginInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout{
......@@ -226,6 +272,49 @@ static NSString * const LMHShopId = @"shop";
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
if ([self.titleStr isEqualToString:@"推荐"]) {
ZXAliMaRecomondModel *recom = self.shops[indexPath.item];
NSString *url = [NSString stringWithFormat:@"%@/alimama/tbk/dg/material/optional?pageNo=1&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot", [kUserDefaults objectForKey:@"HomePage"], recom.title];
[[ZXAdViewService sharedManager] GET:[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
id res = responseObject[@"data"][@"tbk_dg_material_optional_response"][@"result_list"][@"map_data"];
if (res) {
NSArray *list = [ZXAlimamaModel mj_objectArrayWithKeyValuesArray:res];
for (ZXAlimamaModel *item in list) {
if ([item.item_id integerValue] == [recom.num_iid integerValue]) {
dispatch_async(dispatch_get_main_queue(), ^{
NSString *url = [@"taobao:" stringByAppendingString:item.coupon_share_url];
NSURL *URL = [NSURL URLWithString:url];
if ([[UIApplication sharedApplication] canOpenURL:URL]) {
[[UIApplication sharedApplication] openURL:URL];
} else {
ZXBannerJumpViewController *jumpVc = [[ZXBannerJumpViewController alloc] init];
jumpVc.jumpUrl = [@"https:" stringByAppendingString:item.coupon_share_url];
jumpVc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:jumpVc animated:YES];
}
});
}
}
} else {
dispatch_async(dispatch_get_main_queue(), ^{
ZXBannerJumpViewController *jumpVc = [[ZXBannerJumpViewController alloc] init];
jumpVc.jumpUrl = recom.coupon_click_url;
jumpVc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:jumpVc animated:YES];
});
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
dispatch_async(dispatch_get_main_queue(), ^{
ZXBannerJumpViewController *jumpVc = [[ZXBannerJumpViewController alloc] init];
jumpVc.jumpUrl = recom.coupon_click_url;
jumpVc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:jumpVc animated:YES];
});
}];
} else {
ZXAlimamaModel *model = self.shops[indexPath.item];
NSString *url = [@"taobao:" stringByAppendingString:model.coupon_share_url];
NSURL *URL = [NSURL URLWithString:url];
......@@ -237,6 +326,7 @@ static NSString * const LMHShopId = @"shop";
jumpVc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:jumpVc animated:YES];
}
}
}
@end
//
// ZXAliMaRecomondModel.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/10/30.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXAliMaRecomondModel : NSObject
/** 商品ID */
@property (nonatomic, copy) NSString *num_iid;
/** 商品标题 */
@property (nonatomic, copy) NSString *title;
/** 商品主图 */
@property (nonatomic, copy) NSString *pict_url;
/** 商品小图列表 */
@property (nonatomic, strong) NSArray *small_images;
/** 商品一口价格 */
@property (nonatomic, copy) NSString *reserve_price;
/** 商品折扣价格 */
@property (nonatomic, copy) NSString *zk_final_price;
/** 卖家类型,0表示集市,1表示商城 */
@property (nonatomic, copy) NSString *user_type;
/** 宝贝所在地 */
@property (nonatomic, copy) NSString *provcity;
/** 商品地址 */
@property (nonatomic, copy) NSString *item_url;
/** 淘客地址 */
@property (nonatomic, copy) NSString *click_url;
/** 卖家昵称 */
@property (nonatomic, copy) NSString *nick;
/** 卖家id */
@property (nonatomic, copy) NSString *seller_id;
/** 30天销量 */
@property (nonatomic, copy) NSString *volume;
/** 收入比例,举例,取值为20.00,表示比例20.00% */
@property (nonatomic, copy) NSString *tk_rate;
/** 无线折扣价,即宝贝在无线上的实际售卖价格。 */
@property (nonatomic, copy) NSString *zk_final_price_wap;
/** shop_title */
@property (nonatomic, copy) NSString *shop_title;
/** 招商活动开始时间;如果该宝贝取自普通选品组,则取值为1970-01-01 00:00:00; */
@property (nonatomic, copy) NSString *event_start_time;
/** 招行活动的结束时间;如果该宝贝取自普通的选品组,则取值为1970-01-01 00:00:00 */
@property (nonatomic, copy) NSString *event_end_time;
/** 宝贝类型:1 普通商品; 2 鹊桥高佣金商品;3 定向招商商品;4 营销计划商品; */
@property (nonatomic, copy) NSString *type;
/** 宝贝状态,0失效,1有效;注:失效可能是宝贝已经下线或者是被处罚不能在进行推广 */
@property (nonatomic, copy) NSString *status;
/** 后台一级类目 */
@property (nonatomic, copy) NSString *category;
/** 商品优惠券推广链接 */
@property (nonatomic, copy) NSString *coupon_click_url;
/** 优惠券结束时间 */
@property (nonatomic, copy) NSString *coupon_end_time;
/** 优惠券面额 */
@property (nonatomic, copy) NSString *coupon_info;
/** 优惠券开始时间 */
@property (nonatomic, copy) NSString *coupon_start_time;
/** 优惠券总量 */
@property (nonatomic, copy) NSString *coupon_total_count;
/** 优惠券剩余量 */
@property (nonatomic, copy) NSString *coupon_remain_count;
@end
NS_ASSUME_NONNULL_END
//
// ZXAliMaRecomondModel.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/10/30.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXAliMaRecomondModel.h"
@implementation ZXAliMaRecomondModel
@end
......@@ -8,10 +8,12 @@
#import <UIKit/UIKit.h>
#import "ZXAlimamaModel.h"
#import "ZXAliMaRecomondModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface ZXAlimamaCollectionViewCell : UICollectionViewCell
/** */
@property (nonatomic, strong) ZXAliMaRecomondModel *recomond;
/** */
@property (nonatomic, strong) ZXAlimamaModel *model;
@end
......
......@@ -74,6 +74,7 @@
[quamBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10 * k6Scale);
make.top.equalTo(self.priceLabel.mas_bottom).offset(5 * k6Scale);
make.height.mas_equalTo(24 * k6Scale);
}];
quamBgView.image = [UIImage imageNamed:@"label"];
......@@ -82,9 +83,10 @@
self.quanLabel.font = kFontSize(12 * k6Scale);
self.quanLabel.textColor = UIColor.whiteColor;
[self.quanLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(quamBgView).insets(UIEdgeInsetsMake(1 * k6Scale, 5 * k6Scale, 1 * k6Scale, 5 * k6Scale));
make.edges.equalTo(quamBgView).insets(UIEdgeInsetsMake(2 * k6Scale, 5 * k6Scale, 2 * k6Scale, 5 * k6Scale));
}];
kViewRadius(quamBgView, 5 * k6Scale);
self.quanLabel.textAlignment = NSTextAlignmentCenter;
kViewRadius(quamBgView, 10 * k6Scale);
self.payNumLabel = [[UILabel alloc] init];
[self.contentView addSubview:self.payNumLabel];
......@@ -110,4 +112,17 @@
self.quanLabel.text = [NSString stringWithFormat:@"¥%@券", _model.coupon_amount?_model.coupon_amount:@"0"];
self.payNumLabel.text = [NSString stringWithFormat:@"月销%@", _model.volume];
}
- (void)setRecomond:(ZXAliMaRecomondModel *)recomond {
_recomond = recomond;
[self.iconImageView sd_setImageWithURL:[NSURL URLWithString:_recomond.pict_url]];
self.titleLabel.text = _recomond.title;
self.priceLabel.text = _recomond.zk_final_price;
self.priceOnceLabel.text = @"";
// //添加中划线
// NSDictionary *centerAttribtDic = @{NSStrikethroughStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle],NSForegroundColorAttributeName:RGB(133, 133, 133)};
// NSMutableAttributedString * centerAttr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"¥%@", _recomond.zk_final_price] attributes:centerAttribtDic];
// self.priceOnceLabel.attributedText = centerAttr;
self.quanLabel.text = [NSString stringWithFormat:@"%@", _recomond.coupon_info?_recomond.coupon_info:@"无"];
self.payNumLabel.text = [NSString stringWithFormat:@"月销%@", _recomond.volume];
}
@end
......@@ -64,7 +64,7 @@
}
- (NSString *)url {
if (!_url) {
_url = [NSString stringWithFormat:@"%@/alimama/tbk/dg/material/optional?pageNo=%ld&pageNo=20&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot", [kUserDefaults objectForKey:@"HomePage"], (long)self.currentPage,[self.searchStr isEqualToString:@"全部"]?@"":self.searchStr];
_url = [NSString stringWithFormat:@"%@/alimama/tbk/dg/material/optional?pageNo=%ld&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot", [kUserDefaults objectForKey:@"HomePage"], (long)self.currentPage,[self.searchStr isEqualToString:@"全部"]?@"":self.searchStr];
}
return _url;
}
......
//
//
......@@ -311,7 +311,7 @@ heightForFooterInSection:(NSInteger)section
//教师账号
if (indexPath.row==3) {
//设备账号
UILabel *userIdLabel=[ZLControl createzlLabelWithtextColor:[UIColor colorWithHexString:@"#b4b4b4"] frame:CGRectMake(120, 0, kWidth-100, 44) font:nil backGroundColor:[UIColor whiteColor] TextAlignment:NSTextAlignmentLeft text:[NSString stringWithFormat:@"%ld", (long)self.user.hardwareAccount]];
UILabel *userIdLabel=[ZLControl createzlLabelWithtextColor:[UIColor colorWithHexString:@"#b4b4b4"] frame:CGRectMake(120, 0, kWidth-100, 44) font:nil backGroundColor:[UIColor whiteColor] TextAlignment:NSTextAlignmentLeft text:[NSString stringWithFormat:@"%ld(初始密码为手机号后4位)", (long)self.user.hardwareAccount]];
userIdLabel.tag=CellTag+indexPath.row;
[cell addSubview:userIdLabel];
}
......@@ -330,7 +330,7 @@ heightForFooterInSection:(NSInteger)section
}
if (indexPath.row==4) {
//设备账号
UILabel *userIdLabel=[ZLControl createzlLabelWithtextColor:[UIColor colorWithHexString:@"#b4b4b4"] frame:CGRectMake(120, 0, kWidth-100, 44) font:nil backGroundColor:[UIColor whiteColor] TextAlignment:NSTextAlignmentLeft text:[NSString stringWithFormat:@"%ld", (long)self.user.hardwareAccount]];
UILabel *userIdLabel=[ZLControl createzlLabelWithtextColor:[UIColor colorWithHexString:@"#b4b4b4"] frame:CGRectMake(120, 0, kWidth-100, 44) font:nil backGroundColor:[UIColor whiteColor] TextAlignment:NSTextAlignmentLeft text:[NSString stringWithFormat:@"%ld(初始密码为手机号后4位)", (long)self.user.hardwareAccount]];
userIdLabel.tag=CellTag+indexPath.row;
[cell addSubview:userIdLabel];
}
......
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