Commit cdbeba74 by 刘卓鑫

任务内容提交 定版百青藤

parent d711926b
......@@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9142D2B61F35C84E004F90CF"
BuildableName = "ColorfulSchool.app"
BuildableName = "&#x591a;&#x5f69;&#x6821;&#x56ed;.app"
BlueprintName = "ColorfulSchool"
ReferencedContainer = "container:ColorfulSchool.xcodeproj">
</BuildableReference>
......@@ -31,7 +31,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9142D2B61F35C84E004F90CF"
BuildableName = "ColorfulSchool.app"
BuildableName = "&#x591a;&#x5f69;&#x6821;&#x56ed;.app"
BlueprintName = "ColorfulSchool"
ReferencedContainer = "container:ColorfulSchool.xcodeproj">
</BuildableReference>
......@@ -74,7 +74,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9142D2B61F35C84E004F90CF"
BuildableName = "ColorfulSchool.app"
BuildableName = "&#x591a;&#x5f69;&#x6821;&#x56ed;.app"
BlueprintName = "ColorfulSchool"
ReferencedContainer = "container:ColorfulSchool.xcodeproj">
</BuildableReference>
......@@ -98,7 +98,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9142D2B61F35C84E004F90CF"
BuildableName = "ColorfulSchool.app"
BuildableName = "&#x591a;&#x5f69;&#x6821;&#x56ed;.app"
BlueprintName = "ColorfulSchool"
ReferencedContainer = "container:ColorfulSchool.xcodeproj">
</BuildableReference>
......
......@@ -19,8 +19,13 @@
#import "YWPrintViewController.h"
#import "XMGFileTool.h"
#import "FTUploader.h"
#import "ZXBDTool.h"
#import "ZXNewOrderDetailViewController.h"
#import <AFNetworkReachabilityManager.h>
#import "BaiduMobAdSDK/BaiduMobAdSplash.h"
#import "BaiduMobAdSDK/BaiduMobAdView.h"
#import "BaiduMobAdSDK/BaiduMobAdSetting.h"
#import "BDADHeader.h"
// 引入JPush功能所需头文件
#import <JPUSHService.h>
// iOS10注册APNs所需头文件
......@@ -45,7 +50,7 @@
#import "ZXAdViewAdTool.h"
#import "BUADTool.h"
@interface AppDelegate ()<WXApiDelegate,UIAlertViewDelegate,UITabBarControllerDelegate,JPUSHRegisterDelegate, AVSpeechSynthesizerDelegate, BUSplashAdDelegate>
@interface AppDelegate ()<WXApiDelegate,UIAlertViewDelegate,UITabBarControllerDelegate,JPUSHRegisterDelegate, AVSpeechSynthesizerDelegate, BUSplashAdDelegate, BaiduMobAdSplashDelegate>
{
BOOL _isPlaying;//是否正在播放
}
......@@ -54,7 +59,10 @@
@property (nonatomic,strong) UIAlertView *updateAlert;
@property (nonatomic, strong) UpdateVersionModel *updateModel;
@property (nonatomic) NSDictionary * notifyDic;
/** */
@property (nonatomic, strong) BaiduMobAdSplash *splash;
/** */
@property (nonatomic, strong) UIView *splashView;
@end
@implementation AppDelegate
......@@ -65,7 +73,7 @@
_isPlaying = NO;
//启动环境
[APIManager sharedAPIManager].lauchEnvironment = ZXColorfulSchoolEnvironmentTest;
[APIManager sharedAPIManager].lauchEnvironment = ZXColorfulSchoolEnvironmentDevelop;
//极光推送
[self initPushWithOptions:launchOptions isProduct:YES];
......@@ -75,9 +83,14 @@
//token登录
[self tokenLogin];
//注册穿山甲
[BUADTool setupBUAdSDK];
//开屏广告
[ZXAdTool startLauchAd];
@weakify(self);
[ZXAdTool startLauchAdIsBaiduAd:^{
@strongify(self);
[self createBaiduLauchAd];
}];
//版本检测
[self checkVersion];
......@@ -94,6 +107,53 @@
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
return YES;
}
#pragma mark - BaiduMobAdViewDelegate
- (NSString *)publisherId
{
return kBaiduAdAppId;
}
-(BOOL) enableLocation
{
//启用location会有一次alert提示
return YES;
}
-(void) willDisplayAd:(BaiduMobAdView*) adview
{
NSLog(@"delegate: will display ad");
}
-(void) failedDisplayAd:(BaiduMobFailReason) reason;
{
NSLog(@"delegate: failedDisplayAd %d", reason);
}
- (void)didAdImpressed {
NSLog(@"delegate: didAdImpressed");
}
- (void)didAdClicked {
NSLog(@"delegate: didAdClicked");
}
#pragma mark - 开屏广告
- (void) createBaiduLauchAd {
self.splash = [[BaiduMobAdSplash alloc] init];
self.splash.delegate = self;
self.splash.AdUnitTag = kBaiduAdLauchId;
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
self.splashView = [[UIView alloc] initWithFrame:window.frame];
[window addSubview:self.splashView];
[self.splash loadAndDisplayUsingContainerView:self.splashView];
}
#pragma mark - 穿山甲广告Delegate
- (void)splashAdDidClose:(BUSplashAdView *)splashAd {
[splashAd removeFromSuperview];
......
//
//
......@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
//单例化
kSINGLETON_FOR_HEADER(ZXBDTool)
- (void) createNativie20_3AdByView:(UIView *) view;
- (void) createNativieAdByView:(UIView *) view
topView:(UIView *) topView
......@@ -28,6 +28,14 @@ kSINGLETON_FOR_HEADER(ZXBDTool)
- (void) createBaiduLauchAdView;
- (void) createLauchAdWithDelegate:(id) delegate;
//创建激励视频广告
- (void) createRewardVideoAd;
@end
NS_ASSUME_NONNULL_END
//
//
......@@ -11,11 +11,18 @@
#import "BaiduMobAdSDK/BaiduMobAdSetting.h"
#import "BaiduMobAdSDK/BaiduMobAdSplash.h"
#import "BDADHeader.h"
#import "BaiduMobAdSDK/BaiduMobAdRewardVideo.h"
#import "BaiduMobAdSDK/BaiduMobAdSetting.h"
@interface ZXBDTool ()<BaiduMobAdViewDelegate, BaiduMobAdSplashDelegate> {
@interface ZXBDTool ()<BaiduMobAdViewDelegate, BaiduMobAdSplashDelegate, BaiduMobAdRewardVideoDelegate> {
BaiduMobAdView *sharedAdView;
}
@property (nonatomic, strong) BaiduMobAdRewardVideo *reward;
/** */
@property (nonatomic, strong) BaiduMobAdSplash *splash;
/** */
@property (nonatomic, strong) UIView *splashView;
@property (nonatomic, strong) dispatch_source_t gcdTimer;
@end
......@@ -82,6 +89,26 @@ kSINGLETON_FOR_CLASS(ZXBDTool)
[self createCountingDowViewByAdView:sharedAdView];
}
}
- (void) createNativie20_3AdByView:(UIView *) view {
[BaiduMobAdSetting setLpStyle:BaiduMobAdLpStyleDefault];
//使用嵌入广告的方法实例。
sharedAdView = [[BaiduMobAdView alloc] init];
sharedAdView.AdUnitTag = @"6592671";
sharedAdView.AdType = BaiduMobAdViewTypeBanner;
[view insertSubview:sharedAdView atIndex:0];
[sharedAdView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(view.mas_left).offset(5 * k6Scale);
make.right.equalTo(view.mas_right).offset(-5 * k6Scale);
make.height.mas_equalTo(kScreenWidth * 0.15);
make.bottom.equalTo(view.mas_bottom).offset(-kScreenWidth * 0.15);
}];
sharedAdView.delegate = self;
[sharedAdView start];
}
#pragma mark - ========== 创建删除view ==========
- (void) createRemoveAdView:(BaiduMobAdView *) expressView{
UIImageView *closeBg = [[UIImageView alloc] init];
......@@ -178,6 +205,21 @@ kSINGLETON_FOR_CLASS(ZXBDTool)
sharedAdView = nil;
}
- (void) createLauchAdWithDelegate:(id) delegate{
self.splash = [[BaiduMobAdSplash alloc] init];
self.splash.delegate = delegate;
self.splash.AdUnitTag = kBaiduAdLauchId;
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
self.splashView = [[UIView alloc] initWithFrame:window.frame];
[window addSubview:self.splashView];
[self.splash loadAndDisplayUsingContainerView:self.splashView];
}
#pragma mark - BaiduMobAdViewDelegate
- (NSString *)publisherId
{
......@@ -267,4 +309,54 @@ kSINGLETON_FOR_CLASS(ZXBDTool)
}
//创建激励视频广告
- (void) createRewardVideoAd {
self.reward = [[BaiduMobAdRewardVideo alloc] init];
self.reward.delegate = self;
self.reward.AdUnitTag = @"6697174";
self.reward.publisherId = kBaiduAdAppId;
[self.reward load];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.reward showFromViewController:[ZXTool getCurrentVC]];
});
}
- (void)rewardedVideoAdLoaded:(BaiduMobAdRewardVideo *)video {
[[[UIAlertView alloc]initWithTitle:@"激励视频缓存成功" message:nil delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil] show];
NSLog(@"激励视频缓存成功");
}
- (void)rewardedVideoAdLoadFailed:(BaiduMobAdRewardVideo *)video withError:(BaiduMobFailReason)reason {
[[[UIAlertView alloc]initWithTitle:@"激励视频缓存失败" message:nil delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil] show];
NSLog(@"激励视频缓存失败,failReason:%d",reason);
}
- (void)rewardedVideoAdShowFailed:(BaiduMobAdRewardVideo *)video withError:(BaiduMobFailReason)reason {
NSLog(@"激励视频展现失败,failReason:%d",reason);
//异常情况处理
[[[UIAlertView alloc]initWithTitle:@"激励视频展现失败" message:nil delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil] show];
}
- (void)rewardedVideoAdDidStarted:(BaiduMobAdRewardVideo *)video {
NSLog(@"激励视频开始播放");
}
- (void)rewardedVideoAdDidPlayFinish:(BaiduMobAdRewardVideo *)video {
NSLog(@"激励视频完成播放");
}
- (void)rewardedVideoAdDidClick:(BaiduMobAdRewardVideo *)video withPlayingProgress:(CGFloat)progress {
NSLog(@"激励视频LP被点击,progress:%f",progress);
}
- (void)rewardedVideoAdDidClose:(BaiduMobAdRewardVideo *)video withPlayingProgress:(CGFloat)progress {
NSLog(@"激励视频点击关闭,progress:%f",progress);
}
@end
//
//
......@@ -12,10 +12,18 @@ NS_ASSUME_NONNULL_BEGIN
@interface BUADTool : NSObject
- (void)setupBUAdSDKAndLoadLauchAdByDelegate:(id) delegate;
+ (void)setupBUAdSDK;
- (void) loadLauchAdByDelegate:(id) delagte;
- (void) loadBannerAdWithController:(UIViewController *) viewController;
- (void) loadBannerAdWithController:(UIViewController *) viewController superView:(UIView *) superView;
//创建激励视频
- (void) createRewardedVideoAdWithController:(UIViewController *) viewController;
////展示激励视频广告
//- (void) showRewardedVideoAd;
@end
NS_ASSUME_NONNULL_END
//
//
......@@ -9,22 +9,24 @@
#import "BUADTool.h"
#import <BUAdSDK/BUAdSDK.h>
@interface BUADTool()
@interface BUADTool()<BUNativeExpressRewardedVideoAdDelegate, BUNativeExpressBannerViewDelegate>
/** */
@property (nonatomic, strong) BUNativeExpressBannerView *bannerView;
@property (nonatomic, strong) BUNativeExpressRewardedVideoAd *rewardedAd;
@end
@implementation BUADTool
- (void)setupBUAdSDKAndLoadLauchAdByDelegate:(id) delegate {
+ (void)setupBUAdSDK {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
dispatch_async(dispatch_get_main_queue(), ^{
[BUAdSDKManager setAppID:@"5033112"];
[BUAdSDKManager setIsPaidApp:NO];
// splash AD demo
[self loadLauchAdByDelegate:delegate];
});
});
}
......@@ -57,20 +59,90 @@
NSLog(@"穿山甲开屏广告加载失败");
}
- (void) loadBannerAdWithController:(UIViewController *) viewController {
[BUAdSDKManager setAppID:@"5033112"];
[BUAdSDKManager setIsPaidApp:NO];
- (void) loadBannerAdWithController:(UIViewController *) viewController superView:(UIView *) superView {
// splash AD demo
BUSize *imgSize = [BUSize sizeBy:BUProposalSize_Banner600_90];
CGFloat bannerHeigh = kScreenWidth/600*90;
if (self.bannerView == nil) {
self.bannerView = [[BUNativeExpressBannerView alloc] initWithSlotID:@"933112579" rootViewController:viewController imgSize:imgSize adSize:CGSizeMake(kScreenWidth, bannerHeigh) IsSupportDeepLink:YES];
self.bannerView.frame = CGRectMake(0, kScreenHeight - bannerHeigh, kScreenWidth, bannerHeigh);
self.bannerView.delegate = (id)viewController;
[viewController.view addSubview:self.bannerView];
self.bannerView.frame = CGRectMake(0, kScreenWidth * 0.3 + 10 * k6Scale - bannerHeigh, kScreenWidth, bannerHeigh);
self.bannerView.delegate = self;
[superView addSubview:self.bannerView];
}
[self.bannerView loadAdData];
}
- (void)createRewardedVideoAdWithController:(UIViewController *)viewController {
BURewardedVideoModel *model = [[BURewardedVideoModel alloc] init];
model.userId = @"123";
self.rewardedAd = [[BUNativeExpressRewardedVideoAd alloc] initWithSlotID:@"933112439" rewardedVideoModel:model];
self.rewardedAd.delegate = self;
[self.rewardedAd loadAdData];
//为保证播放流畅和展示流畅建议可在收到渲染成功和视频下载完成回调后再展示视频。
if (self.rewardedAd.isAdValid) {
[self.rewardedAd showAdFromRootViewController:viewController.navigationController];
}
}
#pragma mark - BUNativeExpressRewardedVideoAdDelegate
- (void)nativeExpressRewardedVideoAdDidLoad:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
- (void)nativeExpressRewardedVideoAd:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error {
}
- (void)nativeExpressRewardedVideoAdDidDownLoadVideo:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
- (void)nativeExpressRewardedVideoAdViewRenderSuccess:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
- (void)nativeExpressRewardedVideoAdViewRenderFail:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd error:(NSError *_Nullable)error {
}
- (void)nativeExpressRewardedVideoAdWillVisible:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
- (void)nativeExpressRewardedVideoAdDidVisible:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
- (void)nativeExpressRewardedVideoAdWillClose:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
- (void)nativeExpressRewardedVideoAdDidClose:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
[self.rewardedAd loadAdData];
}
- (void)nativeExpressRewardedVideoAdDidClick:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
- (void)nativeExpressRewardedVideoAdDidClickSkip:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
- (void)nativeExpressRewardedVideoAdDidPlayFinish:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error {
}
- (void)nativeExpressRewardedVideoAdServerRewardDidSucceed:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd verify:(BOOL)verify {
}
- (void)nativeExpressRewardedVideoAdServerRewardDidFail:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
@end
//
//
......@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface ZXAdTool : NSObject
+ (void) startLauchAd;
+ (void) startLauchAdIsBaiduAd:(dispatch_block_t) baiduAd;
@end
......
//
//
......@@ -17,11 +17,11 @@
@implementation ZXAdTool
+ (void) startLauchAd {
+ (void) startLauchAdIsBaiduAd:(dispatch_block_t) baiduAd {
//开屏广告 二次展示
if (CacheUserId == nil) {
return;
}
// if (CacheUserId == nil) {
// return;
// }
// ZXLauchModel *lastAd = [ZXLauchModel findAll].lastObject;
// if (lastAd && lastAd.whether) {
// if (lastAd.platformSource == 1) {
......@@ -57,9 +57,10 @@
// }
// }];
//开屏广告 1次展示
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/tencent/advertisement/spread2?id=%@&sourceType=iOS", [kUserDefaults valueForKey:@"SX_MONEY"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/app/open/advert/round/info?id=%@&sourceType=0", [kUserDefaults valueForKey:@"SX_MONEY"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
if (error == nil) {
ZXLauchModel *lauch = [ZXLauchModel mj_objectWithKeyValues:common.data];
[ZXLauchModel clearTable];
......@@ -67,6 +68,7 @@
if (lauch.whether == NO) {
return ;
}
dispatch_async(dispatch_get_main_queue(), ^{
if (lauch.isButt) {
......@@ -78,7 +80,10 @@
[[[ZXAdViewAdTool alloc] init] startLauchAd];
break;
case 5: //穿山甲
[[BUADTool new] setupBUAdSDKAndLoadLauchAdByDelegate:UIApplication.sharedApplication.delegate];
[[[BUADTool alloc] init] loadLauchAdByDelegate:UIApplication.sharedApplication.delegate];
break;
case 6: //百度
baiduAd();
break;
default:
break;
......
//
// LMHWaterFallLayout.h
// WateFallLayoutTest
//
// Created by 刘梦桦 on 2017/5/18.
// Copyright © 2017年 lmh. All rights reserved.
//
#import <UIKit/UIKit.h>
@class LMHWaterFallLayout;
@protocol LMHWaterFallLayoutDeleaget<NSObject>
@required
/**
* 每个item的高度
*/
- (CGFloat)waterFallLayout:(LMHWaterFallLayout *)waterFallLayout heightForItemAtIndexPath:(NSUInteger)indexPath itemWidth:(CGFloat)itemWidth;
@optional
/**
* 有多少列
*/
- (NSUInteger)columnCountInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout;
/**
* 每列之间的间距
*/
- (CGFloat)columnMarginInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout;
/**
* 每行之间的间距
*/
- (CGFloat)rowMarginInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout;
/**
* 每个item的内边距
*/
- (UIEdgeInsets)edgeInsetdInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout;
@end
@interface LMHWaterFallLayout : UICollectionViewLayout
/** 代理 */
@property (nonatomic, weak) id<LMHWaterFallLayoutDeleaget> delegate;
@end
//
// LMHWaterFallLayout.m
// WateFallLayoutTest
//
// Created by 刘梦桦 on 2017/5/18.
// Copyright © 2017年 lmh. All rights reserved.
//
#import "LMHWaterFallLayout.h"
/** 默认的列数 */
static const CGFloat LMHDefaultColunmCount = 3;
/** 每一列之间的间距 */
static const CGFloat LMHDefaultColunmMargin = 10;
/** 每一行之间的间距 */
static const CGFloat LMHDefaultRowMargin = 10;
/** 内边距 */
static const UIEdgeInsets LMHDefaultEdgeInsets = {10,10,10,10};
@interface LMHWaterFallLayout()
/** 存放所有的布局属性 */
@property (nonatomic, strong) NSMutableArray * attrsArr;
/** 存放所有列的当前高度 */
@property (nonatomic, strong) NSMutableArray *columnHeights;
/** 内容的高度 */
@property (nonatomic, assign) CGFloat contentHeight;
- (NSUInteger)colunmCount;
- (CGFloat)columnMargin;
- (CGFloat)rowMargin;
- (UIEdgeInsets)edgeInsets;
@end
@implementation LMHWaterFallLayout
#pragma mark 懒加载
- (NSMutableArray *)attrsArr{
if (!_attrsArr) {
_attrsArr = [NSMutableArray array];
}
return _attrsArr;
}
- (NSMutableArray *)columnHeights{
if (!_columnHeights) {
_columnHeights = [NSMutableArray array];
}
return _columnHeights;
}
#pragma mark - 数据处理
/**
* 列数
*/
- (NSUInteger)colunmCount{
if ([self.delegate respondsToSelector:@selector(columnCountInWaterFallLayout:)]) {
return [self.delegate columnCountInWaterFallLayout:self];
}else{
return LMHDefaultColunmCount;
}
}
/**
* 列间距
*/
- (CGFloat)columnMargin{
if ([self.delegate respondsToSelector:@selector(columnMarginInWaterFallLayout:)]) {
return [self.delegate columnMarginInWaterFallLayout:self];
}else{
return LMHDefaultColunmMargin;
}
}
/**
* 行间距
*/
- (CGFloat)rowMargin{
if ([self.delegate respondsToSelector:@selector(rowMarginInWaterFallLayout:)]) {
return [self.delegate rowMarginInWaterFallLayout:self];
}else{
return LMHDefaultRowMargin;
}
}
/**
* item的内边距
*/
- (UIEdgeInsets)edgeInsets{
if ([self.delegate respondsToSelector:@selector(edgeInsetdInWaterFallLayout:)]) {
return [self.delegate edgeInsetdInWaterFallLayout:self];
}else{
return LMHDefaultEdgeInsets;
}
}
/**
* 初始化
*/
- (void)prepareLayout{
[super prepareLayout];
self.contentHeight = 0;
// 清楚之前计算的所有高度
[self.columnHeights removeAllObjects];
// 设置每一列默认的高度
for (NSInteger i = 0; i < LMHDefaultColunmCount ; i ++) {
[self.columnHeights addObject:@(LMHDefaultEdgeInsets.top)];
}
// 清楚之前所有的布局属性
[self.attrsArr removeAllObjects];
// 开始创建每一个cell对应的布局属性
NSInteger count = [self.collectionView numberOfItemsInSection:0];
for (int i = 0; i < count; i++) {
// 创建位置
NSIndexPath * indexPath = [NSIndexPath indexPathForItem:i inSection:0];
// 获取indexPath位置上cell对应的布局属性
UICollectionViewLayoutAttributes * attrs = [self layoutAttributesForItemAtIndexPath:indexPath];
[self.attrsArr addObject:attrs];
}
}
/**
* 返回indexPath位置cell对应的布局属性
*/
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath{
// 创建布局属性
UICollectionViewLayoutAttributes * attrs = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
//collectionView的宽度
CGFloat collectionViewW = self.collectionView.frame.size.width;
// 设置布局属性的frame
CGFloat cellW = (collectionViewW - self.edgeInsets.left - self.edgeInsets.right - (self.colunmCount - 1) * self.columnMargin) / self.colunmCount;
CGFloat cellH = [self.delegate waterFallLayout:self heightForItemAtIndexPath:indexPath.item itemWidth:cellW];
// 找出最短的那一列
NSInteger destColumn = 0;
CGFloat minColumnHeight = [self.columnHeights[0] doubleValue];
for (int i = 1; i < LMHDefaultColunmCount; i++) {
// 取得第i列的高度
CGFloat columnHeight = [self.columnHeights[i] doubleValue];
if (minColumnHeight > columnHeight) {
minColumnHeight = columnHeight;
destColumn = i;
}
}
CGFloat cellX = self.edgeInsets.left + destColumn * (cellW + self.columnMargin);
CGFloat cellY = minColumnHeight;
if (cellY != self.edgeInsets.top) {
cellY += self.rowMargin;
}
attrs.frame = CGRectMake(cellX, cellY, cellW, cellH);
// 更新最短那一列的高度
self.columnHeights[destColumn] = @(CGRectGetMaxY(attrs.frame));
// 记录内容的高度 - 即最长那一列的高度
CGFloat maxColumnHeight = [self.columnHeights[destColumn] doubleValue];
if (self.contentHeight < maxColumnHeight) {
self.contentHeight = maxColumnHeight;
}
return attrs;
}
/**
* 决定cell的高度
*/
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect{
return self.attrsArr;
}
/**
* 内容的高度
*/
- (CGSize)collectionViewContentSize{
// CGFloat maxColumnHeight = [self.columnHeights[0] doubleValue];
// for (int i = 0; i < LMHDefaultColunmCount; i++) {
//
// // 取得第i列的高度
// CGFloat columnHeight = [self.columnHeights[i] doubleValue];
//
// if (maxColumnHeight < columnHeight) {
// maxColumnHeight = columnHeight;
// }
//
// }
return CGSizeMake(0, self.contentHeight + self.edgeInsets.bottom);
}
@end
//
// LZNCollectionViewFlowLayout.h
// ThirdTask-瀑布流
//
// Created by linzhennan on 16/3/21.
// Copyright © 2016年 Zhennan Lin. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LZNCollectionViewFlowLayout : UICollectionViewLayout
@property (nonatomic, assign) id<UICollectionViewDelegateFlowLayout> delegate;
@property (nonatomic, assign) NSUInteger cellCount; // cell 的个数
@property (nonatomic, strong) NSMutableArray *cellHeightArray;
@property (nonatomic, strong) NSMutableDictionary *cellAttributeDict; // cell 的位置信息
/**
* @author Paul Wang, 16-03-10 20:03:19
*
* @brief 构造方法,用于特殊高度的 headerView
*
* @param topHeight 顶高度
*
* @return
*/
- (instancetype)initWithTopHeight:(CGFloat)topHeight;
@end
//
// LZNCollectionViewFlowLayout.m
// ThirdTask-瀑布流
//
// Created by linzhennan on 16/3/21.
// Copyright © 2016年 Zhennan Lin. All rights reserved.
//
#import "LZNCollectionViewFlowLayout.h"
@interface LZNCollectionViewFlowLayout () {
CGFloat _topHeight;
}
@end
@implementation LZNCollectionViewFlowLayout
- (instancetype)initWithTopHeight:(CGFloat)topHeight {
self = [super init];
if (self) {
_topHeight = topHeight;
}
return self;
}
- (void)prepareLayout {
[super prepareLayout];
_cellHeightArray = [NSMutableArray array];
_cellAttributeDict = [NSMutableDictionary dictionary];
_delegate = (id<UICollectionViewDelegateFlowLayout>)self.collectionView.delegate;
// 获取cell的个数
_cellCount = [self.collectionView numberOfItemsInSection:0];
if (_cellCount == 0) {
return;
}
float top = _topHeight;
for (NSInteger i = 0; i < 2; i++) {
[_cellHeightArray addObject:@(top)];
}
// 调用layoutForItemAtIndexPath方法,为每个cell布局,
for (NSInteger i = 0; i < _cellCount; i ++) {
[self layoutItemAtIndexPath:[NSIndexPath indexPathForItem:i inSection:0]];
}
}
- (void)layoutItemAtIndexPath:(NSIndexPath *)indexPath {
// 通过协议获得cell的间隙
UIEdgeInsets edgeInsets = [self.delegate collectionView:self.collectionView layout:self insetForSectionAtIndex:indexPath.row];
// 通过协议获得cell的大小
CGSize itemSize = [self.delegate collectionView:self.collectionView layout:self sizeForItemAtIndexPath:indexPath];
NSInteger column = 0;
float shortHeight = [[_cellHeightArray objectAtIndex:column] floatValue];
//找出高度最小的列,将cell加到最小列中
for (int i = 0; i < _cellHeightArray.count; i++) {
float height = [[_cellHeightArray objectAtIndex:i] floatValue];
if (height < shortHeight) {
shortHeight = height;
column = i;
}
}
float top = [[_cellHeightArray objectAtIndex:column] floatValue];
//确定cell的frame
CGRect frame = CGRectMake(edgeInsets.left + column * (edgeInsets.left + itemSize.width), top + edgeInsets.top, itemSize.width, itemSize.height);
//更新列高
[_cellHeightArray replaceObjectAtIndex:column withObject:[NSNumber numberWithFloat:top + edgeInsets.top + itemSize.height]];
//每个cell的frame对应一个indexPath,放入字典中
[_cellAttributeDict setObject:NSStringFromCGRect(frame) forKey:indexPath];
}
//返回cell的布局信息,如果忽略传入的rect一次性将所有的cell布局信息返回,图片过多时性能会很差
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
NSMutableArray *muArr = [NSMutableArray array];
for (NSIndexPath *indexPath in _cellAttributeDict) {
CGRect cellRect = CGRectFromString(_cellAttributeDict[indexPath]);
if (CGRectIntersectsRect(cellRect, rect)) {
UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath:indexPath];
[muArr addObject:attributes];
}
}
return muArr;
}
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
attributes.frame = CGRectFromString(_cellAttributeDict[indexPath]);
return attributes;
}
//最后还要实现这个方法,返回collectionView内容的大小
//只需要遍历前面创建的存放列高的数组得到列最高的一个作为高度返回就可以了
- (CGSize)collectionViewContentSize {
CGSize size = self.collectionView.frame.size;
float maxHeight = 0;
// 查找最高的列的高度
for (int i = 0; i < _cellHeightArray.count; i++) {
float colHeight = [[_cellHeightArray objectAtIndex:i] floatValue];
if (colHeight > maxHeight) {
maxHeight = colHeight;
}
}
size.height = maxHeight;
return size;
}
@end
......@@ -9,15 +9,14 @@
#import "ZXAliMaMaViewController.h"
#import "ZXAdViewService.h"
#import "ZXAlimamaModel.h"
#import "LMHWaterFallLayout.h"
#import "ZXAlimamaCollectionViewCell.h"
#import "ZXBannerJumpViewController.h"
#import "enlargeClickRegionBtn.h"
#import "ZXAliMaRecomondModel.h"
#import "ZXAliMaRecomondModel.h"
#import "LZNCollectionViewFlowLayout.h"
static NSString * const LMHShopId = @"shop";
@interface ZXAliMaMaViewController ()<UICollectionViewDataSource, LMHWaterFallLayoutDeleaget, UICollectionViewDelegate>
@interface ZXAliMaMaViewController ()<UICollectionViewDataSource, UICollectionViewDelegate>
/** 所有的商品数据 */
@property (nonatomic, strong) NSMutableArray * shops;
......@@ -119,11 +118,12 @@ static NSString * const LMHShopId = @"shop";
- (void)setupLayoutAndCollectionView{
// 创建布局
LMHWaterFallLayout * waterFallLayout = [[LMHWaterFallLayout alloc]init];
waterFallLayout.delegate = self;
// LMHWaterFallLayout * waterFallLayout = [[LMHWaterFallLayout alloc]init];
// waterFallLayout.delegate = self;
LZNCollectionViewFlowLayout *flow = [[LZNCollectionViewFlowLayout alloc] init];
flow.delegate = self;
// 创建collectionView
UICollectionView * collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight - kTabBarHeight - 30 * k6Scale) collectionViewLayout:waterFallLayout];
UICollectionView * collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight - kTabBarHeight - 30 * k6Scale) collectionViewLayout:flow];
collectionView.backgroundColor = [UIColor whiteColor];
collectionView.dataSource = self;
......@@ -253,49 +253,38 @@ static NSString * const LMHShopId = @"shop";
}
#pragma mark - <LMHWaterFallLayoutDeleaget>
- (CGFloat)waterFallLayout:(LMHWaterFallLayout *)waterFallLayout heightForItemAtIndexPath:(NSUInteger)indexPath itemWidth:(CGFloat)itemWidth{
return 245 * k6Scale;
#pragma mark - UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake((kScreenWidth - 30 * k6Scale) / 2.0f, 245 * k6Scale);
}
- (CGFloat)rowMarginInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout{
return 10;
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
return UIEdgeInsetsMake(10 * k6Scale, 10 * k6Scale, 10 * k6Scale, 10 * k6Scale);
}
- (NSUInteger)columnCountInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout{
return 2;
}
- (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];
NSString *url = [NSString stringWithFormat:@"%@/alimama/tbk/dg/material/optional/forItemId?pageNo=1&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot&itemId=%@&hasCoupon=0", [kUserDefaults objectForKey:@"HomePage"], recom.title, recom.num_iid];
[[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"];
id res = responseObject[@"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];
}
});
if (res[@"couponShareUrl"]) {
NSString *url = [@"taobao:" stringByAppendingString:res[@"couponShareUrl"]];
NSURL *URL = [NSURL URLWithString:url];
if ([[UIApplication sharedApplication] canOpenURL:URL]) {
[[UIApplication sharedApplication] openURL:URL];
}
} else {
if (res[@"url"]) {
NSString *url = [@"taobao:" stringByAppendingString:res[@"url"]];
NSURL *URL = [NSURL URLWithString:url];
if ([[UIApplication sharedApplication] canOpenURL:URL]) {
[[UIApplication sharedApplication] openURL:URL];
}
} else {
[ZXTool showText:@"活动已下架,请关注后续活动!"];
}
}
} else {
......
......@@ -9,7 +9,7 @@
#import "ZXSearchViewController.h"
#import "ZXAdViewService.h"
#import "ZXAlimamaModel.h"
#import "LMHWaterFallLayout.h"
#import "LZNCollectionViewFlowLayout.h"
#import "ZXAlimamaCollectionViewCell.h"
#import "ZXBannerJumpViewController.h"
#import "enlargeClickRegionBtn.h"
......@@ -17,7 +17,7 @@
#import "ZXFliterView.h"
@interface ZXSearchViewController ()<UICollectionViewDataSource, LMHWaterFallLayoutDeleaget, UICollectionViewDelegate, ZXFliterDelegate>
@interface ZXSearchViewController ()<UICollectionViewDataSource, UICollectionViewDelegate, ZXFliterDelegate>
/** 所有的商品数据 */
@property (nonatomic, strong) NSMutableArray * shops;
......@@ -165,7 +165,7 @@
- (void)setupLayoutAndCollectionView{
// 创建布局
LMHWaterFallLayout * waterFallLayout = [[LMHWaterFallLayout alloc]init];
LZNCollectionViewFlowLayout * waterFallLayout = [[LZNCollectionViewFlowLayout alloc]init];
waterFallLayout.delegate = self;
// 创建collectionView
......@@ -256,23 +256,7 @@
#pragma mark - <LMHWaterFallLayoutDeleaget>
- (CGFloat)waterFallLayout:(LMHWaterFallLayout *)waterFallLayout heightForItemAtIndexPath:(NSUInteger)indexPath itemWidth:(CGFloat)itemWidth{
return 238 * k6Scale;
}
- (CGFloat)rowMarginInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout{
return 10;
}
- (NSUInteger)columnCountInWaterFallLayout:(LMHWaterFallLayout *)waterFallLayout{
return 2;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
ZXAlimamaModel *model = self.shops[indexPath.item];
NSString *url = [@"taobao:" stringByAppendingString:model.coupon_share_url];
......@@ -286,7 +270,13 @@
[self.navigationController pushViewController:jumpVc animated:YES];
}
}
#pragma mark - UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake((kScreenWidth - 30 * k6Scale) / 2.0f, 245 * k6Scale);
}
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
return UIEdgeInsetsMake(10 * k6Scale, 10 * k6Scale, 10 * k6Scale, 10 * k6Scale);
}
#pragma mark - filterdelegate
- (void)filterByPrices:(NSInteger)status {
NSString *searchStr = @"";
......
//
//
......@@ -62,13 +62,14 @@ kSINGLETON_FOR_CLASS(APIManager)
// [userDefaults setObject:@"http://192.168.100.112:8888" forKey:@"DCWash"];
[userDefaults setObject:@"8197" forKey:@"DCWashSocketPort"];
[userDefaults setObject:@"2081ad8ddc23576.natapp.cc" forKey:@"DCWashSocketUrl"];
[userDefaults setObject:@"http://dev-task-appserv.168cad.top" forKey:@"Task"];
[userDefaults setObject:@"http://ex-dev-dcxy-static.168cad.top" forKey:@"TaskH5"];
[userDefaults synchronize];
break;
}
case ZXColorfulSchoolEnvironmentTest: {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:@"http://internal-test-dcxyapi.168cad.top/dcintsrv/mt/entrance.do" forKey:@"schoolIp"];
[userDefaults setObject:@"internal-test-dcgz-bg-static.168cad.top" forKey:@"RootUrl"];
[userDefaults setObject:@"http://internal-test-dcxyapi.168cad.top/dcintsrv/pay/createAliOrder.do"forKey:@"Ali"];
......@@ -99,7 +100,8 @@ kSINGLETON_FOR_CLASS(APIManager)
[userDefaults setObject:@"http://ex-test-other-device-app.168cad.top" forKey:@"DCWash"];
[userDefaults setObject:@"8197" forKey:@"DCWashSocketPort"];
[userDefaults setObject:@"12081ad8ddc23576.natapp.cc" forKey:@"DCWashSocketUrl"];
[userDefaults setObject:@"http://test-task-appserv.168cad.top" forKey:@"Task"];
[userDefaults setObject:@"http://ex-test-dcxy-static.168cad.top" forKey:@"TaskH5"];
[userDefaults synchronize];
break;
}
......@@ -145,6 +147,8 @@ kSINGLETON_FOR_CLASS(APIManager)
[userDefaults setObject:@"8005" forKey:@"DCWashSocketPort"];
[userDefaults setObject:@"other-tcp-mobile.dcrym.com" forKey:@"DCWashSocketUrl"];
[userDefaults setObject:@"http://product-task-appserv.168cad.top" forKey:@"Task"];
[userDefaults setObject:@"http://ex-dev-dcxy-static.168cad.top" forKey:@"TaskH5"];
[userDefaults synchronize];
break;
}
......
//
//
......@@ -22,4 +22,10 @@
@property (nonatomic, strong) NSArray *switchs;
@property(nonatomic, weak) id<didSelectItemActionDelegate> delegate;
/** 当前选中的title */
@property (nonatomic, copy) NSString *buttonTitle;
@end
//
//
......@@ -10,7 +10,8 @@
#import "JXLayoutButton.h"
@interface CustomerTabbar()
/** */
@property (nonatomic, strong) JXLayoutButton *currentButton;
@property (nonatomic, assign) int currentIndex;
@property (nonatomic, strong) UIView *maskView;
@end
......@@ -53,6 +54,10 @@
[titleArray addObject:@"短视频"];
[imagesArray addObject:@"nav_video_nor"];
[selectImagesArray addObject:@"nav_video_sel"];
} else if ([dic[@"type"] isEqualToString:@"14"]) {
[titleArray addObject:@"任务"];
[imagesArray addObject:@"nav_video_nor"];
[selectImagesArray addObject:@"nav_video_sel"];
}
}
if (isHasSc) {
......@@ -72,44 +77,53 @@
btn.frame = CGRectMake(W * i, 0, W, 49);
@weakify(self);
[[btn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(JXLayoutButton *x) {
currentBtn.enabled = YES;
x.enabled = NO;
currentBtn = x;
@strongify(self);
if ([title isEqualToString:@"多彩"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:0 fromIndex:self.currentIndex];
}
self.currentIndex = 0;
} else if ([title isEqualToString:@"发现"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:1 fromIndex:self.currentIndex];
}
self.currentIndex = 1;
} else if ([title isEqualToString:@"淘宝惠购"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:2 fromIndex:self.currentIndex];
}
self.currentIndex = 2;
} else if ([title isEqualToString:@"短视频"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:3 fromIndex:self.currentIndex];
}
self.currentIndex = 3;
} else if ([title isEqualToString:@"商城"]) {
if ([title isEqualToString:@"商城"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:4 fromIndex:self.currentIndex];
}
self.currentIndex = 4;
} else if ([title isEqualToString:@"我的"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:5 fromIndex:self.currentIndex];
} else {
self.currentButton.enabled = YES;
x.enabled = NO;
self.currentButton = x;
@strongify(self);
if ([title isEqualToString:@"多彩"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:0 fromIndex:self.currentIndex];
}
self.currentIndex = 0;
} else if ([title isEqualToString:@"发现"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:1 fromIndex:self.currentIndex];
}
self.currentIndex = 1;
} else if ([title isEqualToString:@"淘宝惠购"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:2 fromIndex:self.currentIndex];
}
self.currentIndex = 2;
} else if ([title isEqualToString:@"短视频"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:3 fromIndex:self.currentIndex];
}
self.currentIndex = 3;
} else if ([title isEqualToString:@"我的"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:5 fromIndex:self.currentIndex];
}
self.currentIndex = 5;
} else if ([title isEqualToString:@"任务"]) {
if ([self.delegate respondsToSelector:@selector(selectPageIndex:fromIndex:)]) {
[self.delegate selectPageIndex:6 fromIndex:self.currentIndex];
}
self.currentIndex = 6;
}
self.currentIndex = 5;
}
}];
if (i==0) {
currentBtn = btn;
self.currentButton = btn;
btn.enabled = NO;
self.currentIndex = 0;
}
......@@ -132,6 +146,24 @@
return button;
}
- (void)setButtonTitle:(NSString *)buttonTitle {
_buttonTitle = buttonTitle;
if (![buttonTitle isEqualToString:@"商城"]) {
for (int i = 0; i < self.subviews.count; i++) {
JXLayoutButton *button = self.subviews[i];
button.enabled = YES;
if ([button.titleLabel.text isEqualToString:buttonTitle]) {
self.currentIndex = 2;
button.enabled = NO;
self.currentButton = button;
}
}
}
}
@end
//
//
......@@ -27,7 +27,7 @@
// //设置颜色数组
UIColor *leftColor = kRGB(171, 178, 247);
UIColor *rightColor = kRGB(144, 152, 247);
// UIColor *leftColor = [UIColor colorWithHexString:@"#ff8809"];
// UIColor *rightColor = [UIColor colorWithHexString:@"#fe5b0b"];
//设置颜色
......
//
//
......@@ -526,27 +526,18 @@
return;
}
NSString *url = [NSString stringWithFormat:@"%@/alimama/tbk/dg/material/optional?pageNo=1&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot", [kUserDefaults objectForKey:@"HomePage"], dic[@"title"]];
NSString *url = [NSString stringWithFormat:@"%@/alimama/tbk/dg/material/optional/forItemId?pageNo=1&q=%@&deviceType=IMEI&deviceValue=02399123192391293123&cat=hot&itemId=%@&hasCoupon=0", [kUserDefaults objectForKey:@"HomePage"], dic[@"title"], item_id];
[[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"];
id res = responseObject[@"data"];
if (res) {
NSArray *list = [ZXAlimamaModel mj_objectArrayWithKeyValuesArray:res];
__block ZXAlimamaModel *m;
for (ZXAlimamaModel *item in list) {
if ([item.item_id integerValue] == [item_id integerValue]) {
m = item;
}
}
if (m) {
[self jumpTaobaoWithItem:m];
if (res[@"couponShareUrl"]) {
[self jumpTaobaoWithItem:res[@"couponShareUrl"]];
} else {
if (list.count) {
[self jumpTaobaoWithItem:list[0]];
if (res[@"url"]) {
[self jumpTaobaoWithItem:res[@"url"]];
} else {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:@"活动已下架,请关注后续活动!"];
});
[ZXTool showText:@"活动已下架,请关注后续活动!"];
}
}
} else {
......@@ -576,15 +567,15 @@
}
}
- (void) jumpTaobaoWithItem:(ZXAlimamaModel *) item {
- (void) jumpTaobaoWithItem:(NSString *) couponShareUrl {
dispatch_async(dispatch_get_main_queue(), ^{
NSString *url = [@"taobao:" stringByAppendingString:item.coupon_share_url];
NSString *url = [@"taobao:" stringByAppendingString:couponShareUrl];
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.jumpUrl = [@"https:" stringByAppendingString:couponShareUrl];
jumpVc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:jumpVc animated:YES];
}
......
//
//
......@@ -34,10 +34,11 @@
#import "AimiWalletViewController.h"
#import "enlargeClickRegionBtn.h"
#import "CropImageController.h"
#import "ZXBDTool.h"
#import "WWWWEbViewController.h"
#import "ZXAdViewService.h"
#import "ZXBannerJumpViewController.h"
#import "ZXTaskViewController.h"
@interface ZXHomePageViewController ()<UITableViewDelegate, UITableViewDataSource, UINavigationControllerDelegate, UIImagePickerControllerDelegate, CropImageDelegate>
/** tableview */
@property (nonatomic, strong) UITableView *myTableView;
......@@ -81,32 +82,32 @@
[self createUserHeader];
//直接加载最新数据
[self loadNewData];
//每次启动获取一次用户信息
[ZXTool fetchUserInfoCompleted:^(BOOL isOld) {
}];
/*强更*/
[self udateAppVersion];
//完成支付的通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(payCompleted) name:kOrder_Completed_Pay object:nil];
//收到修改了用户信息的通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeUserNameAction:) name:@"changeUserNameNotification" object:nil];
//测试按钮
// //测试按钮
// UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(50, kScreenHeight - 150, 80, 80)];
// [self.view addSubview:btn];
// btn.backgroundColor = [UIColor orangeColor];
// [[btn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
// WWWWEbViewController *vc = [[WWWWEbViewController alloc] init];
// vc.jumpUrl = @"https://cpu.baidu.com/1032/ed6b6847?scid=43624";
// [self.navigationController pushViewController:vc animated:YES];
// ZXTaskViewController *vc = [[NSClassFromString(@"ZXTaskViewController") alloc] init];
// [self.navigationController pushViewController:vc animated:YES];
// }];
}
- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
......@@ -146,7 +147,7 @@
//查看待支付订单和未读普通公告
[self createNotPayAndAnnouceView];
if (self.isShowFirstRecharge) {
self.isShowFirstRecharge = NO;
} else {
......@@ -165,8 +166,62 @@
[ExpecptionModel clearTable];
}
}
//查看任务相关内容
@weakify(self);
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/dcxy/api/tasks/homePage", [kUserDefaults objectForKey:@"Task"]] para:nil completed:^(CommonModel *common, NSString *error) {
@strongify(self);
if ([common.data boolValue]) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
[self showTaskDialog];
});
}
}];
}
#pragma mark - 显示领券弹窗
- (void) showTaskDialog {
UIView *taskBgView = [[UIView alloc] initWithFrame:UIScreen.mainScreen.bounds];
[kAppWindow addSubview:taskBgView];
taskBgView.backgroundColor = kRGBColor(0, 0, 0, 0.4);
UIImage *image = [UIImage imageNamed:@"task_home"];
UIImageView *imageV = [[UIImageView alloc] init];
imageV.image = image;
imageV.userInteractionEnabled = YES;
[taskBgView addSubview:imageV];
[imageV mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(taskBgView.mas_centerX);
make.top.equalTo(taskBgView.mas_top).offset(kTopHeight + 70 * k6Scale);
make.width.mas_equalTo(355 * k6Scale);
make.height.mas_equalTo(355 * k6Scale * image.size.height / image.size.width);
}];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
[imageV addGestureRecognizer:tap];
@weakify(self);
[[tap rac_gestureSignal] subscribeNext:^(id x) {
@strongify(self);
ZXTaskViewController *taskVc = [[ZXTaskViewController alloc] init];
taskVc.jumpUrl = [NSString stringWithFormat:@"%@/taskApp/coupon.html?token=%@", [kUserDefaults objectForKey:@"TaskH5"], CacheToken];
taskVc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:taskVc animated:YES];
}];
enlargeClickRegionBtn *closeButton = [[enlargeClickRegionBtn alloc] init];
[taskBgView addSubview:closeButton];
[closeButton setBackgroundImage:[UIImage imageNamed:@"task_close"] forState:UIControlStateNormal];
[closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(31 * k6Scale);
make.centerX.equalTo(taskBgView);
make.top.equalTo(imageV.mas_bottom);
}];
[[closeButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
taskBgView.hidden = YES;
[taskBgView removeFromSuperview];
}];
}
- (UITableView *)myTableView {
if (_myTableView== nil) {
CGFloat bottomH = 0;
......@@ -174,7 +229,7 @@
bottomH = 34;
}
_myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, kTopHeight + 13 * k6Scale, kScreenWidth, kScreenHeight - bottomH - 49 - kTopHeight - 13 * k6Scale) style:UITableViewStyleGrouped];
// _myTableView.contentInset = UIEdgeInsetsMake(6 * k6Scale, 0, 0, 0);
// _myTableView.contentInset = UIEdgeInsetsMake(6 * k6Scale, 0, 0, 0);
_myTableView.delegate = self;
_myTableView.dataSource = self;
_myTableView.showsHorizontalScrollIndicator = NO;
......@@ -209,9 +264,9 @@
//拉取最新的强弹公告
[self.service loadLatestNewAlertAnnounceCompleted:^(ZXHomePageAnnouce * _Nullable publish) {
//显示
//显示
@strongify(self);
dispatch_async(dispatch_get_main_queue(), ^{
[self showPublishWithItem:publish];
});
......@@ -255,10 +310,10 @@
NSArray *arr = self.service.dataSource[section];
return arr.count?1:0;
}
// ZXHomeChildInfo *child = sec.blockData.firstObject;
// if (child && [child.blockType isEqualToString:@"3"]) {
// return 1;
// }
// ZXHomeChildInfo *child = sec.blockData.firstObject;
// if (child && [child.blockType isEqualToString:@"3"]) {
// return 1;
// }
return sec.blockData.count;
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
......@@ -274,7 +329,7 @@
@strongify(self);
[self functionClickJump:info];
};
return cell;
}
......@@ -447,7 +502,7 @@
break;
}
case 8: { //08对接信息
return kScreenHeight;
break;
}
......@@ -486,7 +541,7 @@
#pragma mark - 强更
- (void) udateAppVersion {
[self.service checkVersionCompleted:^(AppUpdateVersion *version) {
dispatch_async(dispatch_get_main_queue(), ^{
ZXHomePageUpdateAppView *v = [[ZXHomePageUpdateAppView alloc] initWithUpdateModel:version];
v.frame = [UIScreen mainScreen].bounds;
......@@ -515,17 +570,17 @@
- (void) uploadItem:(ExpecptionModel *) exp {
NSDictionary *dic = @{
@"customerName": exp.customerName,
@"campusName": exp.campusName,
@"cellphone": exp.cellphone,
@"logType": @(exp.logType),
@"terminalInfo": exp.terminalInfo,
@"uploadBatch": exp.uploadBatch,
@"outputFile": exp.outputFile,
@"outputFileNumber": exp.outputFileNumber,
@"logInfos": [exp.logInfos separatorString],
@"terminalType":@(exp.terminalType),
};
@"customerName": exp.customerName,
@"campusName": exp.campusName,
@"cellphone": exp.cellphone,
@"logType": @(exp.logType),
@"terminalInfo": exp.terminalInfo,
@"uploadBatch": exp.uploadBatch,
@"outputFile": exp.outputFile,
@"outputFileNumber": exp.outputFileNumber,
@"logInfos": [exp.logInfos separatorString],
@"terminalType":@(exp.terminalType),
};
NSString *json = [ZXTool dictionaryToJson:dic];
NSString *url = [kUserDefaults valueForKey:@"ExceptionUploadAPI"];
NSString *token = [kUserDefaults valueForKey:@"token"];
......@@ -591,7 +646,7 @@
}];
firstRechargeView.frame = [UIScreen mainScreen].bounds;
[self.tabBarController.view addSubview:firstRechargeView];
}
- (void) createNotPayAndAnnouceView {
//待支付订单view
......@@ -648,7 +703,7 @@
make.width.height.mas_equalTo(50 * k6Scale);
}];
[self.goTop addTarget:self action:@selector(scollToTopAction:) forControlEvents:UIControlEventTouchUpInside];
}
- (void) scollToTopAction:(UIButton *) sender {
......
//
//
......@@ -13,15 +13,14 @@
#import "SDCycleScrollView.h"
#import "ZXAdViewAdTool.h"
#import "BUADTool.h"
#import <BUAdSDK/BUAdSDK.h>
#import "ZXBDTool.h"
@interface ZXSelfHelpViewController ()<BUNativeExpressBannerViewDelegate> {
@interface ZXSelfHelpViewController () {
enlargeClickRegionBtn *showCode;
}
/** banner广澳 */
@property (nonatomic, strong) BUNativeExpressBannerView *bannerView;
@property (nonatomic, strong) dispatch_source_t gcdTimer;
/**
......@@ -81,9 +80,31 @@
[self createBarCodeView];
[self createBannerView];
[self createCodeView];
if ([[kUserDefaults objectForKey:kAPP_SELP_ADVIEW_SHOW] isEqualToString:@"yes"]) {
[[[BUADTool alloc] init] loadBannerAdWithController:self];
UIView *adSuperView = [[UIView alloc] init];
[self.view addSubview:adSuperView];
adSuperView.backgroundColor = UIColor.whiteColor;
[adSuperView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view);
make.height.mas_equalTo(kScreenWidth * 0.3 + 10 * k6Scale);
}];
enlargeClickRegionBtn *closeButton = [[enlargeClickRegionBtn alloc] init];
[closeButton setBackgroundImage:[UIImage imageNamed:@"task_close"] forState:UIControlStateNormal];
[adSuperView addSubview:closeButton];
[closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.equalTo(adSuperView);
make.width.height.mas_equalTo(20 * k6Scale);
}];
[adSuperView bringSubviewToFront:closeButton];
[[closeButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
adSuperView.hidden = YES;
[adSuperView removeFromSuperview];
}];
[[ZXBDTool new] createNativie20_3AdByView:adSuperView];
[[[BUADTool alloc] init] loadBannerAdWithController:self superView:adSuperView];
}
......@@ -381,42 +402,5 @@
#pragma BUNativeExpressBannerViewDelegate
- (void)nativeExpressBannerAdViewDidLoad:(BUNativeExpressBannerView *)bannerAdView {
NSLog(@"%s",__func__);
}
- (void)nativeExpressBannerAdView:(BUNativeExpressBannerView *)bannerAdView didLoadFailWithError:(NSError *)error {
NSLog(@"%s",__func__);
}
- (void)nativeExpressBannerAdViewRenderSuccess:(BUNativeExpressBannerView *)bannerAdView {
NSLog(@"%s",__func__);
}
- (void)nativeExpressBannerAdViewRenderFail:(BUNativeExpressBannerView *)bannerAdView error:(NSError *)error {
NSLog(@"%s",__func__);
}
- (void)nativeExpressBannerAdViewWillBecomVisible:(BUNativeExpressBannerView *)bannerAdView {
NSLog(@"%s",__func__);
}
- (void)nativeExpressBannerAdViewDidClick:(BUNativeExpressBannerView *)bannerAdView {
NSLog(@"%s",__func__);
}
- (void)nativeExpressBannerAdView:(BUNativeExpressBannerView *)bannerAdView dislikeWithReason:(NSArray<BUDislikeWords *> *)filterwords {
NSLog(@"%s",__func__);
[UIView animateWithDuration:0.25 animations:^{
bannerAdView.alpha = 0;
} completion:^(BOOL finished) {
[bannerAdView removeFromSuperview];
if (self.bannerView == bannerAdView) {
self.bannerView = nil;
}
}];
}
@end
//
//
......@@ -78,9 +78,7 @@
}];
__weak typeof(self) weakSelf = self;
[[back rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
[self.bluetoothManager cutBluetoothAndSocketConnect];
self.bluetoothManager.delegate = nil;
self.bluetoothManager = nil;
[weakSelf.navigationController popViewControllerAnimated:YES];
}];
......@@ -246,5 +244,14 @@
- (void) connectBluetoothFaliure {
self.okPayButton.enabled = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.bluetoothManager cutBluetoothAndSocketConnect];
self.bluetoothManager.delegate = nil;
self.bluetoothManager = nil;
}
- (void)dealloc {
NSLog(@"%s", __func__);
}
@end
//
//
// ZXTaskManager.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/11/26.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXTaskManager : NSObject
kSINGLETON_FOR_HEADER(ZXTaskManager)
/** task */
@property (nonatomic, copy) NSString *taskCode;
/** 任务状态 0失败 1已完成(未上报) 2已上报*/
@property (nonatomic, assign) NSInteger status;
@end
NS_ASSUME_NONNULL_END
//
//
// ZXTaskManager.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/11/26.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXTaskManager.h"
@implementation ZXTaskManager
kSINGLETON_FOR_CLASS(ZXTaskManager)
@end
//
//
// ZXTaskViewController.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/11/22.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXTaskViewController : UIViewController
/** jumpUrl */
@property (nonatomic, copy) NSString *jumpUrl;
/** 是否是任务首页 */
@property (nonatomic, assign) NSInteger isTaskHomePage;
/** 状态栏颜色 */
@property (nonatomic, copy) NSString *colorHex;
/** 跳转淘宝惠购 */
@property (nonatomic, copy) dispatch_block_t jumpTaobaoHJ;
@end
NS_ASSUME_NONNULL_END
//
//
......@@ -174,4 +174,6 @@ typedef void(^checkIsOldCustomer)(BOOL isOld);
+(void) alimamaTest;
//ip
+ (NSString*)getCurentLocalIP;
@end
//
//
......@@ -29,7 +29,9 @@
#import "AppDelegate.h"
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
#import <ifaddrs.h>
#import <arpa/inet.h>
#import "ZXFirstPageService.h"
#import "ZXSections.h"
#import "ZXBookMarkModel.h"
......@@ -1763,5 +1765,55 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
}];
}
}
#pragma mark - 获取ip地址
+ (NSString*)getCurentLocalIP{
    NSString*address =nil;
    struct ifaddrs*interfaces =NULL;
    struct ifaddrs*temp_addr =NULL;
    int success =0;
    // retrieve the current interfaces - returns 0 on success
    success =getifaddrs(&interfaces);
    if(success ==0) {
        // Loop through linked list of interfaces
        temp_addr = interfaces;
        while(temp_addr !=NULL) {
            NSLog(@"%d",temp_addr->ifa_addr->sa_family);
            if(temp_addr->ifa_addr->sa_family==AF_INET|| temp_addr->ifa_addr->sa_family==AF_INET6|| temp_addr->ifa_addr->sa_family==AF_LINK) {
                if([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"]) {
                    // Get NSString from C String
                    address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];
                }
            }
            temp_addr = temp_addr->ifa_next;
        }
    }
    // Free memory
    freeifaddrs(interfaces);
    return address;
}
@end
......@@ -2,10 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>app需要你开启定位权限</string>
<key>CFBundleDevelopmentRegion</key>
<string>zh_CN</string>
<key>CFBundleDisplayName</key>
<string>多彩校园</string>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......
//
//
......@@ -19,7 +19,7 @@
#import "ZXRSNewsManagerController.h"
#import "ZXMallViewController.h"
#import "ZXBQTViewController.h"
#import "ZXTaskViewController.h"
@interface MyTabViewController ()<didSelectItemActionDelegate>
{
......@@ -31,13 +31,16 @@
XMGNavigationViewController *nav4;
XMGNavigationViewController *nav5;
XMGNavigationViewController *nav6;
XMGNavigationViewController *nav7;
ZXMallViewController *webVC;
//设置默认tabBar选项;
CustomerTabbar *cusTabbar;
}
/** 开关集合 */
@property (nonatomic, strong) NSMutableArray *switchs;
/** */
@property (nonatomic, strong) CustomerTabbar *cusTabbar;
@end
@implementation MyTabViewController
......@@ -51,24 +54,24 @@
- (void)viewDidLoad {
[super viewDidLoad];
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.tabBar setBackgroundImage:img];
[self.tabBar setShadowImage:img];
[self.tabBar setShadowImage:img];
[kUserDefaults setValue:@"no" forKey:kAPP_IS_OPEN_JK];//默认是no
[kUserDefaults setValue:@"no" forKey:kAPP_QB_SHOW];//默认是no
[kUserDefaults setValue:@"no" forKey:kAPP_SELP_ADVIEW_SHOW];//默认是no
......@@ -91,7 +94,7 @@
//type 1资讯 2商城 3支付配置 4免密开关 5小程序(app不需要) 10阿里妈妈 11百青藤
[self.switchs removeAllObjects];
for (NSDictionary *dic in arr) {
if ([dic[@"type"] isEqualToString:@"1"] || [dic[@"type"] isEqualToString:@"2"] || [dic[@"type"] isEqualToString:@"10"] || [dic[@"type"] isEqualToString:@"11"]) {
if ([dic[@"type"] isEqualToString:@"1"] || [dic[@"type"] isEqualToString:@"2"] || [dic[@"type"] isEqualToString:@"10"] || [dic[@"type"] isEqualToString:@"11"] || [dic[@"type"] isEqualToString:@"14"]) {
if ([dic[@"isEnabled"] integerValue] == 1) {
[self.switchs addObject:dic];
}
......@@ -105,6 +108,8 @@
if ([dic[@"type"] isEqualToString:@"12"] && [dic[@"isEnabled"] integerValue] == 1) {
[kUserDefaults setValue:@"yes" forKey:kAPP_SELP_ADVIEW_SHOW];//默认是no
}
}
dispatch_async(dispatch_get_main_queue(), ^{
[self setupAllTitleButton];
......@@ -134,6 +139,7 @@
@strongify(self);
//MARK:跳转商城
[self selectPageIndex:5 fromIndex:0];
};
nav =[[XMGNavigationViewController alloc]initWithRootViewController:homeView];
......@@ -146,6 +152,7 @@
nav6 = [[XMGNavigationViewController alloc] initWithRootViewController:bqtVc];
nav6.navigationController.navigationBar.hidden = YES;
//资讯
ZXRSNewsManagerController *rsManagerVc = [[ZXRSNewsManagerController alloc] init];
rsManagerVc.isFromTabbar = YES;
......@@ -161,14 +168,27 @@
ZXHomePageMeViewController * mineView = [[ZXHomePageMeViewController alloc]init];
nav3 =[[XMGNavigationViewController alloc]initWithRootViewController:mineView];
ZXTaskViewController *taskVc = [[ZXTaskViewController alloc] init];
taskVc.isTaskHomePage = YES;
nav7 = [[XMGNavigationViewController alloc] initWithRootViewController:taskVc];
taskVc.jumpTaobaoHJ = ^{
@strongify(self);
//MARK:跳转淘宝惠购
self.selectedIndex = 2;
self.cusTabbar.buttonTitle = @"淘宝惠购";
};
nav7.navigationController.navigationBar.hidden = YES;
[self addChildViewController:nav];
[self addChildViewController:nav4];
[self addChildViewController:nav5];
[self addChildViewController:nav6];
[self addChildViewController:nav1];
[self addChildViewController:nav3];
[self addChildViewController:nav7];
nav.interactivePopGestureRecognizer.enabled = NO;
nav1.interactivePopGestureRecognizer.enabled = NO;
nav3.interactivePopGestureRecognizer.enabled = NO;
......@@ -178,15 +198,15 @@
// 设置tabBar上所有按钮内容
- (void)setupAllTitleButton
{
if (cusTabbar == nil) {
cusTabbar = [[CustomerTabbar alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 49)];
cusTabbar.delegate = self;
[self.tabBar addSubview:cusTabbar];
if (self.cusTabbar == nil) {
self.cusTabbar = [[CustomerTabbar alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 49)];
self.cusTabbar.delegate = self;
[self.tabBar addSubview:self.cusTabbar];
}
cusTabbar.switchs = self.switchs;
self.cusTabbar.switchs = self.switchs;
}
- (void)viewWillLayoutSubviews {
[self.tabBar bringSubviewToFront:cusTabbar];
[self.tabBar bringSubviewToFront:self.cusTabbar];
}
-(void)playSound{
NSString *path = [[NSBundle mainBundle] pathForResource:@"like" ofType:@"caf"];
......@@ -229,6 +249,11 @@
if(![nav6.topViewController isKindOfClass:[ZXMallViewController class]]) {
[nav6 pushViewController:webVC animated:YES];
}
} else if (fromIndex == 6) {
if(![nav7.topViewController isKindOfClass:[ZXMallViewController class]]) {
[nav7 pushViewController:webVC animated:YES];
}
} else {
......@@ -237,11 +262,10 @@
}
}
} else {
self.selectedIndex=toIndex;
self.selectedIndex=toIndex;
}
}
@end
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "任务完成_抽奖券.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "任务完成_抽奖券@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "任务完成_抽奖券@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "首次登录_关闭.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "首次登录_关闭@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "首次登录_关闭@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "首次登录_获得奖券.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "首次登录_获得奖券@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "首次登录_获得奖券@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
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