Commit 65a068ef by 刘卓鑫

同步3.7.3代码

parent 0441bb0f
......@@ -84,10 +84,11 @@
[userDefaults setObject:@"http://192.168.1.33:8080" forKey:@"Ad"];
[userDefaults setObject:@"http://192.168.1.173:9091" forKey:@"BOOK"];
[userDefaults setObject:@"http://ex-dev-dcxy-customer-app.168cad.top" forKey:@"NEW_PAY"];
// [userDefaults setObject:@"http://192.168.1.102:8000" forKey:@"NEW_PAY"];
// [userDefaults setObject:@"http://ex-dev-dcxy-customer-app.168cad.top" forKey:@"NEW_PAY"];
[userDefaults setObject:@"http://192.168.1.33:8333" forKey:@"NEW_PAY"];
[userDefaults setObject:@"http://ex-dev-dcxy-base-app.168cad.top" forKey:@"SX_MONEY"]; //授信保证金
[userDefaults setValue:@"http://121.15.180.66:801/netpayment/BaseHttp.dll?MB_EUserPay" forKey:@"YWT_PAY"];
[userDefaults synchronize];
break;
}
......@@ -131,6 +132,7 @@
[userDefaults setObject:@"http://ex-test-dcxy-base-app.168cad.top" forKey:@"SX_MONEY"]; //授信保证金
[userDefaults setValue:@"https://netpay.cmbchina.com/netpayment/BaseHttp.dll?MB_EUserPay" forKey:@"YWT_PAY"];
[userDefaults synchronize];
break;
}
......@@ -169,6 +171,7 @@
[userDefaults setObject:@"http://dcxy-base-app.dcrym.com" forKey:@"SX_MONEY"]; //授信保证金
[userDefaults setValue:@"https://netpay.cmbchina.com/netpayment/BaseHttp.dll?MB_EUserPay" forKey:@"YWT_PAY"];
[userDefaults synchronize];
break;
}
......
......@@ -59,7 +59,7 @@
_isPlaying = NO;
[self defaultConfig];
//启动环境
[self configSystemAPIByEnvironment:ZXColorfulSchoolEnvironmentProduct];
[self configSystemAPIByEnvironment:ZXColorfulSchoolEnvironmentDevelop];
//极光推送
[self initPushWithOptions:launchOptions isProduct:kJPushIsProduct];
//网络监测
......@@ -89,6 +89,7 @@
if ([jump isEqualToString:@"NONE"]) {
//先读取缓存
NSArray *list = [LoginJump findAll];
if (list.count == 0) {
jump = @"DC_01";
......@@ -128,15 +129,20 @@
- (void)applicationDidEnterBackground:(UIApplication *)application {
CGFloat defaultBright = [[[NSUserDefaults standardUserDefaults] objectForKey:@"defaultBright"] floatValue];
[[UIScreen mainScreen] setBrightness:defaultBright];
if ([[ZXTool getCurrentVC] isKindOfClass:NSClassFromString(@"ZXSelfHelpViewController")] || [[ZXTool getCurrentVC] isKindOfClass:NSClassFromString(@"ZXDrinkViewController")]) {
CGFloat defaultBright = [[[NSUserDefaults standardUserDefaults] objectForKey:@"defaultBright"] floatValue];
[[UIScreen mainScreen] setBrightness:defaultBright];
[[NSNotificationCenter defaultCenter] postNotificationName:kSelf_help_destory_timer object:nil];
}
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
[kUserDefaults setObject:[ZXTool getCurrentTimeStamp] forKey:@"uploadBatch"];
if ([[ZXTool getCurrentVC] isKindOfClass:NSClassFromString(@"ZXSelfHelpViewController")] || [[ZXTool getCurrentVC] isKindOfClass:NSClassFromString(@"ZXDrinkViewController")]) {
[[NSNotificationCenter defaultCenter] postNotificationName:kSelf_help_start_timer object:nil];
}
}
......@@ -314,6 +320,8 @@
});
}
}
#pragma mark 极光推送相关
-(void)initPushWithOptions:(NSDictionary *)launchOptions isProduct:(BOOL) isProduct {
//初始化消息推送
......@@ -348,35 +356,8 @@
}
//iOS7.0以上版本
- (void)application:(UIApplication *)application
handleActionWithIdentifier:(NSString *)identifier
forRemoteNotification:(NSDictionary *)userInfo
completionHandler:(void (^)())completionHandler {
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// 取得 APNs 标准信息内容,如果没需要可以不取
// NSString *content = [aps valueForKey:@"alert"]; //推送显示的内容
// NSInteger badge = [[aps valueForKey:@"badge"] integerValue];
// NSString *sound = [aps valueForKey:@"sound"]; //播放的声音
// 取得自定义字段内容,userInfo就是后台返回的JSON数据,是一个字典
[JPUSHService handleRemoteNotification:userInfo];
if ([[UIDevice currentDevice].systemVersion floatValue]<10.0 || application.applicationState>0) {
// [rootViewController addNotificationCount];
}
completionHandler(UIBackgroundFetchResultNewData);
//[self playSoundByUserInfo:userInfo];
}
//添加处理APNs通知回调方法
#pragma mark- JPUSHRegisterDelegate
// iOS 10 Support
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler {
// Required
......
//
//
......@@ -156,6 +156,7 @@
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBar.hidden = NO;
self.navigationController.navigationBar.translucent = YES;
self.tabBarController.tabBar.hidden = NO;
[self.tabBarController.tabBar hideBadgeOnItemIndex:1];
}
......
//
//
......@@ -30,7 +30,7 @@
#import "ZXSimpleGoRechargeViewController.h"
#import "ZXUserModel.h"
//========老版本部分内容-===============
#import "AnnouncementView.h"
#import "ZXAnnouncementView.h"
#import "CampasVersionUpdateModel.h"
#import "JudgeFirstTopUpModel.h"
#import "JudgeFirstTopUpModel.h"
......@@ -70,7 +70,7 @@
*/
@property (nonatomic, strong)PerfectInformation * infoView;
//强弹公告
@property (nonatomic, strong)AnnouncementView * announce;
@property (nonatomic, strong)ZXAnnouncementView * announce;
@property (nonatomic, strong)CampasVersionUpdateModel * updateModel;
@property (nonatomic,strong) UIAlertView * updateAlert;
@property (nonatomic, assign) BOOL isShowVersion;
......@@ -326,6 +326,7 @@ static NSInteger seq = 0;
[super viewWillAppear:animated];
[UIApplication sharedApplication].statusBarStyle = 0;
[UIApplication sharedApplication].statusBarHidden = NO; self.navigationController.navigationBar.hidden = YES;
self.navigationController.navigationBar.translucent = YES;
self.tabBarController.tabBar.hidden = NO;
[self oldVersion];
......@@ -614,31 +615,20 @@ static NSInteger seq = 0;
}
#pragma mark - ========== 显示公告 ==========
- (void) showPublishWithItem:(ZXInformation *) info {
if (_announce) {
if (self.announce) {
return;
}
NSString *jumpUrl = [NSString stringWithFormat:@"%@/Content/%ld?title=%@", [kUserDefaults valueForKey:@"h5FirstPage"], (long)info.id, info.title];
AnnounceModelItem *item = [[AnnounceModelItem alloc] init];
item.noticeTitle = info.title;
item.noticeContent = jumpUrl;
item.updateDate = info.createTime;
item.noticeType = @"3";
item.forceId = [NSString stringWithFormat:@"%ld", info.id];
_announce=[[AnnouncementView alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
_announce.announceItem=item;
@weakify(self);
_announce.ok = ^(BOOL noNotice) {
@strongify(self);
self.announce.hidden = YES;
[self.announce removeFromSuperview];
NSString *jumpUrl = [NSString stringWithFormat:@"%@/Content/%ld?title=%@", [kUserDefaults objectForKey:@"h5FirstPage"],(long)info.id, info.title];
kWeakSelf(self);
self.announce = [[ZXAnnouncementView alloc] initWithFrame:[UIScreen mainScreen].bounds jumpUrl:jumpUrl];
self.announce.comfirm = ^(BOOL isNotAlert) {
kStrongSelf(self);
self.announce = nil;
//访问不再提醒接口
if (noNotice==YES) {
if (isNotAlert==YES) {
[self.service notShowPublishMsgWithInfo:info];
}
};
[[ZXTool returnKeyWindow] addSubview:_announce];
[kAppWindow addSubview:self.announce];
}
#pragma mark - ========== 内存警告 ==========
......@@ -728,8 +718,7 @@ static NSInteger seq = 0;
webVc.isFromSimple = YES;
[self.navigationController pushViewController:webVc animated:YES];
} else if ([operation.defaultValue isEqualToString:@"997"]) {
ZXJTJYViewController *jtjyVc = [[ZXJTJYViewController alloc] init];
[self.navigationController pushViewController:jtjyVc animated:YES];
[self jtAction];
} else if ([operation.defaultValue isEqualToString:@"8"]) {
UIViewController *vc= [[NSClassFromString(@"ZXWisdomLatticeViewController") alloc] init];
[self.navigationController pushViewController:vc animated:YES];
......@@ -759,6 +748,8 @@ static NSInteger seq = 0;
ZXMallViewController *webVc = [[ZXMallViewController alloc] init];
webVc.isFromSimple = YES;
[self.navigationController pushViewController:webVc animated:YES];
} else if ([operation.defaultValue isEqualToString:@"997"]) {
[self jtAction];
} else if ([operation.defaultValue isEqualToString:@"8"]) {
UIViewController *vc= [[NSClassFromString(@"ZXWisdomLatticeViewController") alloc] init];
[self.navigationController pushViewController:vc animated:YES];
......@@ -774,7 +765,43 @@ static NSInteger seq = 0;
}
}
}
#pragma mark - ==========金图教育==========
- (void) jtAction {
//查询是否授权
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/app/jt/whether/grant?customerId=%@", [kUserDefaults valueForKey:@"h5FirstPageAPI"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
[ZXTool showText:error];
} else {
if ([common.data integerValue] == 0) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"您将授权使用第三方的精图教育服务,精图提供教资、考研、国考等精选课程;授权后精图将使用您的多彩相关信息!" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ac1 = [UIAlertAction actionWithTitle:@"取消" style:0 handler:^(UIAlertAction * _Nonnull action) {
}];
UIAlertAction *ac2 = [UIAlertAction actionWithTitle:@"同意" style:0 handler:^(UIAlertAction * _Nonnull action) {
//金图教育
ZXJTJYViewController *jtjyVc = [[ZXJTJYViewController alloc] init];
[self.navigationController pushViewController:jtjyVc animated:YES];
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/app/jt/grant?customerId=%@&grant=1", [kUserDefaults valueForKey:@"h5FirstPageAPI"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
});
}];
}];
[alert addAction:ac1];
[alert addAction:ac2];
[self presentViewController:alert animated:YES completion:nil];
} else {
//金图教育
ZXJTJYViewController *jtjyVc = [[ZXJTJYViewController alloc] init];
[self.navigationController pushViewController:jtjyVc animated:YES];
}
}
});
}];
}
#pragma mark - ========== 壁挂跳转 ==========
- (void) jumpDrinkByOperation:(ZXOperation *) operation {
//获取配置信息
......
//
//
......@@ -45,6 +45,17 @@ static NSString *kFailurMsg = @"数据加载失败,请检查一下当前网络
/*一网通支付结果通知*/
#define kYWT_PAY_RESULT @"ywtPayResult"
//订单模式下 完成支付的通知
#define kOrder_Completed_Pay @"kOrder_Completed_Pay"
//订单模式下 立即刷新是否有待支付订单的通知
#define kOrder_CheckNopPay_Pay @"kOrder_CheckNopPay_Pay"
//自助服务页面 定时器销毁 (app退到后台)
#define kSelf_help_destory_timer @"kSelf_help_destory_timer"
//自助服务页面 定时器开启 (app进入前台)
#define kSelf_help_start_timer @"kSelf_help_start_timer"
/*首页的key和value--对应rootUrl*/
#define kMALL_IDENTIFIER_VALUE @"first_page_key"
#define kMALL_IDENTIFIER_KEY @"first_page_key_KEY"
......
//
//
......@@ -49,13 +49,17 @@
}
- (void)setModel:(ZXCoverAdModel *)model {
_model = model;
if (_model.isRender) {
return;
}
_model.isRender = YES;
if ([_model.adSource isEqualToString:@"TXAD"]) {
if (self.nativeAd == nil) {
self.nativeAd = [[GDTNativeExpressAd alloc] initWithAppId:kTXAdAPPID placementId:kTXAdPLACEMENTID adSize:CGSizeMake(kScreenWidth, kScreenWidth * 0.56)];
self.nativeAd.delegate = self;
}
[self.nativeAd loadAd:1];
} else if ([_model.adSource isEqualToString:@"TXAD"]) {
} else if ([_model.adSource isEqualToString:@"RSAD"]) {
//瑞狮广告
NSString *idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
......@@ -80,7 +84,7 @@
[self.contentView addSubview:self.sharedAdView];
[self.sharedAdView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView);
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(10 * k6Scale, 5 * k6Scale, 0, 5 * k6Scale));;
}];
self.sharedAdView.delegate = self;
......@@ -99,7 +103,7 @@
[expressView render];
[self.contentView addSubview:expressView];
[expressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView);
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(10 * k6Scale, 5 * k6Scale, 0, 5 * k6Scale));
}];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
//
//
......@@ -70,4 +70,8 @@
//曝光需要
@property (nonatomic, copy) NSString *adsenseName;
@property (nonatomic, assign) BOOL isRender;
@end
//
//
......@@ -39,60 +39,7 @@
}];
[_adImageView sd_setImageWithURL:[NSURL URLWithString:model.uploadImg]];
UIImageView *closeBg = [[UIImageView alloc] init];
[_adImageView addSubview:closeBg];
closeBg.userInteractionEnabled = YES;
closeBg.image = [UIImage imageNamed:@"wwww"];
[closeBg mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(_adImageView.mas_right).offset(-10 * k6Scale);
make.top.equalTo(_adImageView.mas_top).offset(10 * k6Scale);
}];
UILabel *closeLabel = [[UILabel alloc] init];
closeLabel.textColor = [UIColor colorWithHexString:@"#ffffff"];
[closeBg addSubview:closeLabel];
closeLabel.font = kFontSize(12 * k6Scale);
[closeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(closeBg);
}];
__block int cou = model.showTime<3?3:(int)model.showTime;
closeLabel.text = [NSString stringWithFormat:@"%ld 跳过", (long)cou];
UITapGestureRecognizer *closeCountingDown = [[UITapGestureRecognizer alloc] init];
[closeBg addGestureRecognizer:closeCountingDown];
self.gcdTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
dispatch_source_set_timer(self.gcdTimer, DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC, 0.0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(self.gcdTimer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
closeLabel.text = [NSString stringWithFormat:@"%d 跳过", (int)cou];
if(cou == 0) {
// 终止定时器
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
//移除广告
[self removeCoverAd:_adImageView];
}
cou --;
});
});
// 启动任务,GCD计时器创建后需要手动启动
dispatch_resume(self.gcdTimer);
@weakify(self);
[[closeCountingDown rac_gestureSignal] subscribeNext:^(id x) {
@strongify(self);
// 终止定时器
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
//移除广告
[self removeCoverAd:_adImageView];
}];
UITapGestureRecognizer *jump = [[UITapGestureRecognizer alloc] init];
[_adImageView addGestureRecognizer:jump];
[[jump rac_gestureSignal] subscribeNext:^(id x) {
@strongify(self);
[self action:model];
}];
[self addRemoveView:_adImageView model:model];
} else {
UITableView *tableView = [[UITableView alloc] init];
tableView.delegate = self;
......@@ -104,16 +51,84 @@
}];
tableView.tableFooterView = [UIView new];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
ZXCoverAdModel *model = items.firstObject;
if (model.showTime > 0) {
[self addRemoveView:self model:model];
}
}
}
return self;
}
#pragma mark - ==========添加倒计时/移除广告view==========
/*
* superView 父视图
* model 单个浮动对应模型
*/
- (void) addRemoveView:(UIView *) superView
model:(ZXCoverAdModel *) model {
UIImageView *closeBg = [[UIImageView alloc] init];
[superView addSubview:closeBg];
closeBg.userInteractionEnabled = YES;
closeBg.image = [UIImage imageNamed:@"wwww"];
[closeBg mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(superView.mas_right).offset(-10 * k6Scale);
make.top.equalTo(superView.mas_top).offset(10 * k6Scale);
}];
UILabel *closeLabel = [[UILabel alloc] init];
closeLabel.textColor = [UIColor colorWithHexString:@"#ffffff"];
[closeBg addSubview:closeLabel];
closeLabel.font = kFontSize(12 * k6Scale);
[closeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(closeBg);
}];
__block int cou = model.showTime<3?3:(int)model.showTime;
closeLabel.text = [NSString stringWithFormat:@"%ld 跳过", (long)cou];
UITapGestureRecognizer *closeCountingDown = [[UITapGestureRecognizer alloc] init];
[closeBg addGestureRecognizer:closeCountingDown];
self.gcdTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
dispatch_source_set_timer(self.gcdTimer, DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC, 0.0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(self.gcdTimer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
closeLabel.text = [NSString stringWithFormat:@"%d 跳过", (int)cou];
if(cou == 0) {
// 终止定时器
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
//移除广告
[self removeCoverAd:superView];
}
cou --;
});
});
// 启动任务,GCD计时器创建后需要手动启动
dispatch_resume(self.gcdTimer);
@weakify(self);
[[closeCountingDown rac_gestureSignal] subscribeNext:^(id x) {
@strongify(self);
// 终止定时器
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
//移除广告
[self removeCoverAd:superView];
}];
if (model) {
UITapGestureRecognizer *jump = [[UITapGestureRecognizer alloc] init];
[superView addGestureRecognizer:jump];
[[jump rac_gestureSignal] subscribeNext:^(id x) {
@strongify(self);
[self action:model];
}];
}
}
#pragma mark - ========== 移除悬浮广告 ==========
- (void) removeCoverAd:(UIImageView *) imageView {
imageView.hidden = YES;
[imageView removeFromSuperview];
- (void) removeCoverAd:(UIView *) view {
view.hidden = YES;
[view removeFromSuperview];
self.hidden = YES;
[self removeFromSuperview];
}
......
//
++ /dev/null
//
// AnnouncementView.h
// ColorfulSchool
//
// Created by rym on 2017/11/28.
// Copyright © 2017年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
#import "AnnounceModel.h"
@interface AnnouncementView : UIView<WKNavigationDelegate,WKUIDelegate>
@property(nonatomic,strong)WKWebView *webView;
@property (weak, nonatomic) IBOutlet UIView *webBgView;
@property (weak, nonatomic) IBOutlet UIView *BgView;
@property (strong, nonatomic) IBOutlet UIButton *agreedBtn;
@property (weak, nonatomic) IBOutlet UIButton *comfirmBtn;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *noNoticeHeightConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bgViewBottomConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bgViewTopConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *noNoticeBgHeightConstraint;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UIView *nonoticeBgView;
@property (nonatomic)AnnounceModelItem * announceItem;
@property (nonatomic,copy)void(^ok)(BOOL noNotice);
@end
//
++ /dev/null
//
// AnnouncementView.m
// ColorfulSchool
//
// Created by rym on 2017/11/28.
// Copyright © 2017年 Colorful Any Door. All rights reserved.
//
#import "AnnouncementView.h"
@interface AnnouncementView()<UIScrollViewDelegate>{
BOOL jugeAgreed;
}
@property (nonatomic, strong) NSArray *indentifierList;
@end
@implementation AnnouncementView
-(WKWebView *)webView{
if (_webView==nil) {
WKWebViewConfiguration *config = [WKWebViewConfiguration new];
_webView = [[WKWebView alloc]initWithFrame:CGRectMake(0,0,kWidth-20, kHeight-2*87) configuration:config];
_webView.scrollView.delegate = self;
}
return _webView;
}
#pragma mark - scrollView协议
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
if (scrollView.contentSize.height - scrollView.contentOffset.y == self.webView.frame.size.height) {
//滚动到底部了
self.agreedBtn.hidden = NO;
}
}
- (instancetype)init{
self = [super init];
if (self) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"AnnouncementView" owner:self options:nil];
self = (AnnouncementView*)[nib firstObject];
self.BgView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
[self creatWebView];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"AnnouncementView" owner:self options:nil];
self = (AnnouncementView
*)[nib firstObject];
self.frame=frame;
self.BgView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
[self creatWebView];
self.agreedBtn.hidden = YES;
}
return self;
}
-(void)setAnnounceItem:(AnnounceModelItem *)announceItem{
if ([announceItem.noticeType isEqualToString:@"3"]) {
self.nonoticeBgView.hidden=NO;
self.noNoticeHeightConstraint.constant=37;
self.noNoticeBgHeightConstraint.constant=125;
}else{
self.nonoticeBgView.hidden=YES;
self.noNoticeHeightConstraint.constant=0;
self.noNoticeBgHeightConstraint.constant=125-37;
}
self.titleLabel.text=announceItem.noticeTitle;
self.timeLabel.text=announceItem.updateDate;
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[announceItem.noticeContent stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];
}
-(void)creatWebView{
[self.webBgView addSubview:self.webView];
[self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.bottom. mas_equalTo(@(0));
}];
}
- (IBAction)agreeBtnClick:(id)sender {
jugeAgreed = !jugeAgreed;
if (jugeAgreed)
{
[_agreedBtn setImage:[UIImage imageNamed:@"check.png"] forState:UIControlStateNormal];
}
else
{
[_agreedBtn setImage:[UIImage imageNamed:@"条款未选中.png"] forState:UIControlStateNormal];
}
}
- (IBAction)confirmBtnClick:(id)sender {
if (self.ok) {
self.ok(jugeAgreed);
}
}
@end
//
//
// ZXAnnouncementView.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/4/3.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void(^confirmAction)(BOOL isNotAlert);
@interface ZXAnnouncementView : UIView
- (instancetype) initWithFrame:(CGRect)frame jumpUrl:(NSString *) jumpUrl;
@property (nonatomic, copy) confirmAction comfirm;
@end
NS_ASSUME_NONNULL_END
//
//
// ZXAnnouncementView.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/4/3.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXAnnouncementView.h"
#import <WebKit/WebKit.h>
#import "JXLayoutButton.h"
@interface ZXAnnouncementView()<UIScrollViewDelegate, WKNavigationDelegate, WKUIDelegate>
@property (nonatomic, strong) WKWebView *webView;
@property (nonatomic, strong) JXLayoutButton *agreedBtn;
@end
@implementation ZXAnnouncementView
- (instancetype) initWithFrame:(CGRect)frame jumpUrl:(NSString *) jumpUrl {
if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.2];
UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(15 * k6Scale, 85 * k6Scale, kScreenWidth - 30 * k6Scale, kScreenHeight - 170 * k6Scale)];
bgView.backgroundColor = [UIColor whiteColor];
bgView.layer.cornerRadius = 5 * k6Scale;
bgView.layer.masksToBounds = YES;
[self addSubview:bgView];
self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(10 * k6Scale, 0, kScreenWidth - 50 * k6Scale, kScreenHeight - 295 * k6Scale)];
[bgView addSubview:self.webView];
self.webView.UIDelegate = self;
self.webView.navigationDelegate = self;
self.webView.scrollView.delegate = self;
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[jumpUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];
self.agreedBtn = [[JXLayoutButton alloc] init];
self.agreedBtn.layoutStyle = JXLayoutButtonStyleLeftImageRightTitle;
[self.agreedBtn setImage:[UIImage imageNamed:@"条款未选中"] forState:UIControlStateNormal];
[self.agreedBtn setImage:[UIImage imageNamed:@"check"] forState:UIControlStateSelected];
[self.agreedBtn setTitle:@"不再提示" forState:UIControlStateNormal];
[self.agreedBtn setTitleColor:[UIColor colorWithHexString:@"#ffa244"] forState:UIControlStateNormal];
self.agreedBtn.titleLabel.font = kFontSize(16 * k6Scale);
[bgView addSubview:self.agreedBtn];
[self.agreedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(40 * k6Scale);
make.left.equalTo(bgView.mas_left).offset(20 * k6Scale);
make.top.equalTo(self.webView.mas_bottom);
make.width.mas_equalTo(70 * k6Scale);
}];
[self.agreedBtn addTarget:self action:@selector(notAlert:) forControlEvents:UIControlEventTouchDown];
UIButton *OKBtn = [[UIButton alloc] init];
[bgView addSubview:OKBtn];
kViewRadius(OKBtn, 5 * k6Scale);
[OKBtn setBackgroundImage:[UIImage imageNamed:@"确定按钮"] forState:UIControlStateNormal];
[OKBtn setTitle:@"我知道了" forState:UIControlStateNormal];
[OKBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.webView);
make.height.mas_equalTo(50 * k6Scale);
make.top.equalTo(self.agreedBtn.mas_bottom).offset(12 * k6Scale);
}];
[OKBtn addTarget:self action:@selector(okAction:) forControlEvents:UIControlEventTouchDown];
self.agreedBtn.hidden = YES;
}
return self;
}
#pragma mark - ==========确定事件==========
- (void) okAction:(UIButton *) sender {
self.hidden =YES;
[self removeFromSuperview];
if (self.comfirm) {
self.comfirm(self.agreedBtn.selected);
}
}
#pragma mark - ==========不再提示事件==========
- (void) notAlert:(UIButton *) sender {
sender.selected = !sender.selected;
}
#pragma mark - scrollView协议
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
NSLog(@"%.2f -- %.2f --- %.2f",scrollView.contentSize.height, scrollView.contentOffset.y , self.webView.frame.size.height);
if (scrollView.contentSize.height - scrollView.contentOffset.y <= self.webView.frame.size.height + 50) {
//滚动到底部了
self.agreedBtn.hidden = NO;
}
}
@end
//
//
......@@ -11,6 +11,7 @@
#import "LoginJump.h"
#import "ZXSections.h"
#import "ZXInformation.h"
#import "ZXNotPay.h"
@implementation LoginModelItem
@end
......@@ -91,8 +92,11 @@
if ([kUserDefaults objectForKey:@"token"]) {
[kUserDefaults removeObjectForKey:@"token"];
}
[kUserDefaults removeObjectForKey:@"isOpenFreePay"];
[kUserDefaults removeObjectForKey:@"currentUserIsOpenJPush"];
[XMGFileTool removeDirectoryPath:CachePath];
[LoginJump clearTable];
[ZXNotPay clearTable];
[ExpecptionModel clearTable];
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
......
//
//
......@@ -241,19 +241,7 @@ static NSString * const ID = @"CollectionCell";
if ([item.serviceId isEqualToString:@"0"]) {
self.moneyLabel.text=[NSString stringWithFormat:@"%.2f", item.money];
self.aimiLabel.text = @"我的艾米币";
// if (item.money > 0) {
// self.moneyLabel.text=[NSString stringWithFormat:@"%.2f", item.money];
// self.aimiLabel.text = @"我的艾米币";
// } else {
// [self.sxMoneyLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(self.view.mas_left).offset(23 * k6Scale);
// make.top.equalTo(self.backBtn.mas_bottom).offset(50 * k6Scale);
// }];
// [self.sxLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(self.view.mas_left).offset(23 * k6Scale);
// make.bottom.equalTo(self.sxMoneyLabel.mas_top).offset(-5 * k6Scale);
// }];
// }
} else {
[self.moneyArray addObject:item];
}
......
//
//
......@@ -136,44 +136,18 @@
confirmBtn.enabled=YES;
return;
}
NSDictionary * dataDic = [[NSDictionary alloc]initWithObjectsAndKeys:CacheAccount,@"account",CacheUserId,@"userId",CacheCampusId,@"campusId",contentEnter.text,@"content",nil];
NSString * json=[self dictionaryToJson:dataDic];
NSString * postStr = [NSString stringWithFormat:@"%@%@%@",@"dc2017",@"MT_MOB_00037",json];
NSString * md5Str = [self md5:postStr];
NSString * dicstr=[BYHelp DataTOjsonString:dataDic];
NSString * token=CacheToken;
if (token==nil) {
token=@"";
}
NSDictionary * parametersDic = [[NSDictionary alloc]initWithObjectsAndKeys:@"MT_MOB_00037",@"sid",reqSource,@"reqSource",md5Str,@"key",token,@"token",dicstr,@"data",nil];
NSString * urlStr = [NSString stringWithFormat:@"%@",requestUrlStr];
NSLog(@"完善信息上传的是:%@",parametersDic);
[GetData request:urlStr type:@"POST" timer:10 parameters:parametersDic success:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSString * code = [NSString stringWithFormat:@"%@",[responseObject objectForKey:@"code"]];
if ([code isEqualToString:@"0"])
{
[SVProgressHUD showSuccessWithStatus:@" 反馈成功 "];
[self performSelector:@selector(delayMethod) withObject:nil afterDelay:1.0f];
}
else
{
[SVProgressHUD showErrorWithStatus:@"反馈失败"];
confirmBtn.enabled=YES;
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error)
{
confirmBtn.userInteractionEnabled = YES;
[SVProgressHUD showErrorWithStatus:@" 网络错误 "];
NSLog(@"输出接口错误:%@",error);
confirmBtn.enabled=YES;
}];
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/dcxy/customerFeedback/customerFeedback", [kUserDefaults valueForKey:@"NEW_PAY"]] para:@{@"customerId":CacheUserId,@"content":contentEnter.text} completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
[SVProgressHUD showSuccessWithStatus:@" 反馈成功 "];
[self performSelector:@selector(delayMethod) withObject:nil afterDelay:1.0f];
}else{
[SVProgressHUD showErrorWithStatus:@"反馈失败"];
confirmBtn.enabled=YES;
}
});
}];
}
-(void)delayMethod
{
......
//
//
......@@ -7,7 +7,7 @@
//
#import "MineViewController.h"
#import "UserSettingViewController.h"
#import "ZXSettingViewController.h"
#import "UserCenterModel.h"
#import "UserInfoViewController.h"
#import "FeedBackView.h"
......@@ -206,7 +206,7 @@
VC.hidesBottomBarWhenPushed=YES;
[self.navigationController pushViewController:VC animated:YES];
}else if (indexPath.row==2){
UserSettingViewController * VC=[UserSettingViewController new];
ZXSettingViewController * VC=[ZXSettingViewController new];
VC.hidesBottomBarWhenPushed=YES;
[self.navigationController pushViewController:VC animated:YES];
}
......
<?xml version="1.0" encoding="UTF-8"?>
++ /dev/null
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UserSettingViewController">
<connections>
<outlet property="tableView" destination="Ptq-rZ-MwY" id="VOc-p8-pcg"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="Ptq-rZ-MwY">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="Ptq-rZ-MwY" secondAttribute="trailing" id="Bt4-Wo-y13"/>
<constraint firstAttribute="bottom" secondItem="Ptq-rZ-MwY" secondAttribute="bottom" id="Qkd-yX-XzK"/>
<constraint firstItem="Ptq-rZ-MwY" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="qvU-Ec-5Ki"/>
<constraint firstItem="Ptq-rZ-MwY" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="tyk-aI-AQu"/>
</constraints>
</view>
</objects>
</document>
//
//
//
// UserSettingViewController.h
// ZXSettingViewController.h
// ColorfulSchool
//
// Created by Listen on 2017/8/9.
// Copyright © 2017年 rym. All rights reserved.
// Created by 刘卓鑫 on 2019/4/8.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UserSettingViewController : UIViewController
NS_ASSUME_NONNULL_BEGIN
@interface ZXSettingViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
//
//
// ZXUserSettingModel.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/4/8.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXUserSettingModel : NSObject
@property (nonatomic, copy) NSString *imageName;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) BOOL isHasSwitch;
@property (nonatomic, assign) BOOL switchIsOn;
//开关的类型 1代表开启设备登录密码 2 开启系统自动扣费 3开启订单推送
@property (nonatomic, assign) NSInteger switchType;
@property (nonatomic, assign) BOOL isCleanCache; //是缓存清理
@end
NS_ASSUME_NONNULL_END
//
//
// ZXUserSettingModel.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/4/8.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXUserSettingModel.h"
@implementation ZXUserSettingModel
@end
//
//
// ZXUserSettingTableViewCell.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/4/8.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ZXUserSettingModel.h"
NS_ASSUME_NONNULL_BEGIN
typedef void(^switchAction)(NSInteger switchType);
@interface ZXUserSettingTableViewCell : UITableViewCell
@property (nonatomic, strong) ZXUserSettingModel *model;
@property (nonatomic, copy) switchAction switchAction;
@end
NS_ASSUME_NONNULL_END
//
//
// ZXUserSettingTableViewCell.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/4/8.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXUserSettingTableViewCell.h"
#import "XMGFileTool.h"
typedef void(^totalSize)(NSString *size);
@interface ZXUserSettingTableViewCell()
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UISwitch *mySwitch;
@property (nonatomic, strong) UILabel *cacheNumLalebl;
@end
@implementation ZXUserSettingTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.iconImageView = [[UIImageView alloc] init];
[self.contentView addSubview:self.iconImageView];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(15 * k6Scale);
make.width.height.mas_equalTo(15 * k6Scale);
make.centerY.equalTo(self.contentView);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = kFontSize(15 * k6Scale);
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconImageView.mas_right).offset(15 * k6Scale);
make.centerY.equalTo(self.iconImageView);
}];
UIImageView *arrow = [[UIImageView alloc] init];
[self.contentView addSubview:arrow];
arrow.image = [UIImage imageNamed:@"更多"];
[arrow mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-15 * k6Scale);
make.width.mas_equalTo(8 * k6Scale);
make.height.mas_equalTo(15);
make.centerY.equalTo(self.contentView.mas_centerY);
}];
self.mySwitch = [[UISwitch alloc] init];
[self.contentView addSubview:self.mySwitch];
self.mySwitch.onTintColor = [UIColor orangeColor];
self.mySwitch.backgroundColor = [UIColor whiteColor];
[self.mySwitch mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-15 * k6Scale);
make.centerY.equalTo(self.contentView);
}];
[self.mySwitch addTarget:self action:@selector(switchActionss:) forControlEvents:UIControlEventValueChanged];
self.cacheNumLalebl = [[UILabel alloc]init];
self.cacheNumLalebl.font = [UIFont systemFontOfSize:15.0];
self.cacheNumLalebl.textColor = [UIColor colorWithRed:180/255.0 green:180/255.0 blue:180/255.0 alpha:1.0];
[self.contentView addSubview:self.cacheNumLalebl];
[self.cacheNumLalebl mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(arrow.mas_left).offset(-5 * k6Scale);
make.centerY.equalTo(arrow);
}];
self.cacheNumLalebl.hidden = YES;
}
return self;
}
//获取缓存尺寸
-(void)sizeStr:(totalSize) completed{
// 获取文件夹尺寸
// 文件夹非常小,如果我的文件非常大
[XMGFileTool getFileSize:CachePath completion:^(NSInteger totalSize) {
NSString *sizeStr = @"0.00B";
// MB KB B
if (totalSize > 1000 * 1000) {
// MB
CGFloat sizeF = totalSize / 1000.0 / 1000.0;
sizeStr = [NSString stringWithFormat:@"%.1fMB",sizeF];
} else if (totalSize > 1000) {
// KB
CGFloat sizeF = totalSize / 1000.0;
sizeStr = [NSString stringWithFormat:@"%.1fKB",sizeF];
} else if (totalSize > 0) {
// B
sizeStr = [NSString stringWithFormat:@"%.ldB",totalSize];
}
completed(sizeStr);
}];
}
- (void) switchActionss:(UISwitch *) sender {
_model.switchIsOn = !_model.switchIsOn;
if (self.switchAction) {
self.switchAction(self.model.switchType);
}
}
- (void)setModel:(ZXUserSettingModel *)model {
_model = model;
self.iconImageView.image = [UIImage imageNamed:_model.imageName];
self.titleLabel.text = _model.name;
self.mySwitch.hidden = !_model.isHasSwitch;
[self.mySwitch setOn:_model.switchIsOn];
self.cacheNumLalebl.hidden = YES;
if (_model.isCleanCache) {
self.cacheNumLalebl.hidden = NO;
[self sizeStr:^(NSString *size) {
self.cacheNumLalebl.text = size;
}];
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
//
......@@ -50,8 +50,7 @@
}
} else if ([operation.defaultValue isEqualToString:@"997"]) {
//金图教育
ZXJTJYViewController *jtjyVc = [[ZXJTJYViewController alloc] init];
[self.navigationController pushViewController:jtjyVc animated:YES];
[self jtAction];
} else if ([operation.defaultValue isEqualToString:@"8"]) {
UIViewController *vc= [[NSClassFromString(@"ZXWisdomLatticeViewController") alloc] init];
[self.navigationController pushViewController:vc animated:YES];
......@@ -82,8 +81,7 @@
}
} else if ([operation.defaultValue isEqualToString:@"997"]) {
//金图教育
ZXJTJYViewController *jtjyVc = [[ZXJTJYViewController alloc] init];
[self.navigationController pushViewController:jtjyVc animated:YES];
[self jtAction];
} else if ([operation.defaultValue isEqualToString:@"8"]) {
UIViewController *vc= [[NSClassFromString(@"ZXWisdomLatticeViewController") alloc] init];
[self.navigationController pushViewController:vc animated:YES];
......@@ -102,7 +100,43 @@
}
}
}
#pragma mark - ==========金图教育==========
- (void) jtAction {
//查询是否授权
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/app/jt/whether/grant?customerId=%@", [kUserDefaults valueForKey:@"h5FirstPageAPI"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
[ZXTool showText:error];
} else {
if ([common.data integerValue] == 0) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"您将授权使用第三方的精图教育服务,精图提供教资、考研、国考等精选课程;授权后精图将使用您的多彩相关信息!" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ac1 = [UIAlertAction actionWithTitle:@"取消" style:0 handler:^(UIAlertAction * _Nonnull action) {
}];
UIAlertAction *ac2 = [UIAlertAction actionWithTitle:@"同意" style:0 handler:^(UIAlertAction * _Nonnull action) {
//金图教育
ZXJTJYViewController *jtjyVc = [[ZXJTJYViewController alloc] init];
[self.navigationController pushViewController:jtjyVc animated:YES];
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/app/jt/grant?customerId=%@&grant=1", [kUserDefaults valueForKey:@"h5FirstPageAPI"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
});
}];
}];
[alert addAction:ac1];
[alert addAction:ac2];
[self presentViewController:alert animated:YES completion:nil];
} else {
//金图教育
ZXJTJYViewController *jtjyVc = [[ZXJTJYViewController alloc] init];
[self.navigationController pushViewController:jtjyVc animated:YES];
}
}
});
}];
}
#pragma mark - ========== 壁挂跳转 ==========
- (void) jumpDrinkByOperation:(ZXOperation *) operation {
//获取配置信息
......
//
//
......@@ -42,7 +42,7 @@
#import "ZXFirstPageService.h"
#import "NSString+Extension.h"
//========老版本部分内容-===============
#import "AnnouncementView.h"
#import "ZXAnnouncementView.h"
#import "CampasVersionUpdateModel.h"
#import "JudgeFirstTopUpModel.h"
#import "JudgeFirstTopUpModel.h"
......@@ -90,7 +90,7 @@
*/
@property (nonatomic, strong)PerfectInformation * infoView;
//强弹公告
@property (nonatomic, strong)AnnouncementView * announce;
@property (nonatomic, strong)ZXAnnouncementView * announce;
@property (nonatomic, strong)CampasVersionUpdateModel * updateModel;
@property (nonatomic,strong) UIAlertView * updateAlert;
@property (nonatomic, assign) BOOL isShowVersion;
......@@ -1116,31 +1116,20 @@ static NSInteger seq = 0;
}
#pragma mark - ========== 显示公告 ==========
- (void) showPublishWithItem:(ZXInformation *) info {
if (_announce) {
if (self.announce) {
return;
}
NSString *jumpUrl = [NSString stringWithFormat:@"%@/Content/%ld?title=%@", [kUserDefaults valueForKey:@"h5FirstPage"], (long)info.id, info.title];
AnnounceModelItem *item = [[AnnounceModelItem alloc] init];
item.noticeTitle = info.title;
item.noticeContent = jumpUrl;
item.updateDate = info.createTime;
item.noticeType = @"3";
item.forceId = [NSString stringWithFormat:@"%ld", info.id];
_announce=[[AnnouncementView alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
_announce.announceItem=item;
@weakify(self);
_announce.ok = ^(BOOL noNotice) {
@strongify(self);
self.announce.hidden = YES;
[self.announce removeFromSuperview];
NSString *jumpUrl = [NSString stringWithFormat:@"%@/Content/%ld?title=%@", [kUserDefaults objectForKey:@"h5FirstPage"],(long)info.id, info.title];
kWeakSelf(self);
self.announce = [[ZXAnnouncementView alloc] initWithFrame:[UIScreen mainScreen].bounds jumpUrl:jumpUrl];
self.announce.comfirm = ^(BOOL isNotAlert) {
kStrongSelf(self);
self.announce = nil;
//访问不再提醒接口
if (noNotice==YES) {
if (isNotAlert==YES) {
[self.service notShowPublishMsgWithInfo:info];
}
};
[[ZXTool returnKeyWindow] addSubview:_announce];
[kAppWindow addSubview:self.announce];
}
#pragma mark - ========== 内存警告 ==========
......
//
//
......@@ -105,6 +105,17 @@
make.height.mas_equalTo(0);
}];
//收到订单完成支付的通知
kWeakSelf(self);
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:kOrder_Completed_Pay object:nil] subscribeNext:^(id x) {
kStrongSelf(self);
self.notPayView.hidden = YES;
}];
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:kOrder_CheckNopPay_Pay object:nil] subscribeNext:^(id x) {
kStrongSelf(self);
self.section.isShowMask = NO;
[self createNotPayOrderView:self.notPayView];
}];
}
return self;
}
......@@ -155,9 +166,10 @@
if (self.section.isShowMask) {
return;
}
v.hidden = NO;
self.section.isShowMask = YES;
if ([ZXNotPay findAll].count) {
v.hidden = NO;
ZXNotPay *order = [ZXNotPay findAll].lastObject;
[self createNotPayViewBySuperView:v orderDetail:order.orderId alertStr:order.orderTitle];
return;
......@@ -183,6 +195,7 @@
p.userId = CacheUserId;
p.orderTitle = order;
[p save];
v.hidden = NO;
[self createNotPayViewBySuperView:v orderDetail:orderId alertStr:order];
});
}
......@@ -221,7 +234,10 @@
[backView addSubview:desc];
desc.font = kFontSize(12 * k6Scale);
desc.textColor = [UIColor whiteColor];
desc.text = alertStr?alertStr:@"您有一个待支付订单,请立即支付!";
if (alertStr == nil || [alertStr isEqualToString:@""]) {
alertStr = @"您有一个待支付订单,请立即支付!";
}
desc.text = alertStr;
[desc mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(iconImageView.mas_right).offset(10 * k6Scale);
......
//
//
......@@ -88,10 +88,10 @@
[list addObject:info];
_items = list.mutableCopy;
}
CGFloat W = kScreenWidth / 2.0f;
CGFloat W = (kScreenWidth-10 * k6Scale) / 2.0f;
for (int i = 0; i < count; i++) {
for (int j = 0; j < 2; j++) {
UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(W * j, 110 * k6Scale * i, W, 110 * k6Scale)];
UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(W * j + 5 * k6Scale, 110 * k6Scale * i, W, 110 * k6Scale)];
[self.contentView addSubview:imageV];
UIView *line = [UIView new];
[imageV addSubview:line];
......
//
//
......@@ -39,8 +39,10 @@
CGFloat brite = [[kUserDefaults objectForKey:@"defaultBright"] floatValue];
[[UIScreen mainScreen] setBrightness:brite];
[self removeNotificationAndKVO];
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
if (self.gcdTimer) {
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
}
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
......@@ -69,7 +71,18 @@
[self createBannerView];
[self createCodeView];
@weakify(self);
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:kSelf_help_start_timer object:nil] subscribeNext:^(id x) {
@strongify(self);
[self createTimer];
}];
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:kSelf_help_destory_timer object:nil] subscribeNext:^(id x) {
@strongify(self);
if (self.gcdTimer) {
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
}
}];
}
#pragma mark - ===================创建条码view==============================
- (void) createBarCodeView {
......@@ -245,6 +258,7 @@
}];
__weak typeof(self) weakSelf = self;
[[back rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
[[NSNotificationCenter defaultCenter] postNotificationName:kOrder_CheckNopPay_Pay object:nil];
for (UIViewController *vc in weakSelf.navigationController.childViewControllers) {
if ([vc isKindOfClass:NSClassFromString(@"ZTHomeViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXSimpleHomeController")] || [vc isKindOfClass:NSClassFromString(@"ZXRSNewViewController")]) {
[weakSelf.navigationController popToViewController:vc animated:YES];
......@@ -340,17 +354,19 @@
#pragma mark - 创建定时器 5s一次请求当前是否有未支付订单
#pragma mark - 创建定时器 15s一次请求当前是否有未支付订单
- (void) createTimer {
self.gcdTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
dispatch_source_set_timer(self.gcdTimer, DISPATCH_TIME_NOW, 5.0 * NSEC_PER_SEC, 0.0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(self.gcdTimer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showNotPayOrderMaskView:self];
[ZXTool codePageIsNeedCheckNotPayOrder:^{
self.gcdTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
dispatch_source_set_timer(self.gcdTimer, DISPATCH_TIME_NOW, 15.0 * NSEC_PER_SEC, 0.0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(self.gcdTimer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showNotPayOrderMaskView:self];
});
});
});
// 启动任务,GCD计时器创建后需要手动启动
dispatch_resume(self.gcdTimer);
// 启动任务,GCD计时器创建后需要手动启动
dispatch_resume(self.gcdTimer);
}];
}
......
//
//
......@@ -35,18 +35,23 @@
[self createNabar];
[self.view addSubview:self.myTableView];
[self createHeader];
// //加载广告信息
// @weakify(self);
// [self.service loadADListCompleted:^{
// @strongify(self);
// if (self.service.adList.count) {
// ZXDrinkAdModel *ad = self.service.adList.firstObject;
// [self.adImageView sd_setImageWithURL:[NSURL URLWithString:ad.imgUrl]];
// }
// }];
[ZXTool loadAdInfoByAdId:@"8" topView:nil superView:self.view fromVc:self];
//加载最新数据
[self loadNewData];
@weakify(self);
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:kSelf_help_start_timer object:nil] subscribeNext:^(id x) {
@strongify(self);
[self createTimer];
}];
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:kSelf_help_destory_timer object:nil] subscribeNext:^(id x) {
@strongify(self);
if (self.gcdTimer) {
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
}
}];
}
#pragma mark - ========== 创建导航栏 ==========
......@@ -77,11 +82,13 @@
make.left.equalTo(naTitle.mas_left).offset(12 * k6Scale);
make.centerY.equalTo(naTitle);
}];
__weak typeof(self) weakSelf = self;
@weakify(self);
[[back rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
[[NSNotificationCenter defaultCenter] postNotificationName:kOrder_CheckNopPay_Pay object:nil];
for (UIViewController *vc in self.navigationController.childViewControllers) {
if ([vc isKindOfClass:NSClassFromString(@"ZTHomeViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXRSNewViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXSimpleHomeController")]) {
[weakSelf.navigationController popToViewController:vc animated:YES];
[self.navigationController popToViewController:vc animated:YES];
}
}
}];
......@@ -93,7 +100,6 @@
make.right.equalTo(naTitle.mas_right).offset(-12 * k6Scale);
make.centerY.equalTo(naTitle);
}];
@weakify(self);
[[scan rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
if (self.currentMerthin && self.startDrink.selected) {
......@@ -277,8 +283,10 @@
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
if (self.gcdTimer) {
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
}
}
#pragma mark - ========== UITableView/Delegate/Datasource ==========
- (UITableView *)myTableView {
......@@ -434,16 +442,18 @@
// }
// return _adImageView;
//}
#pragma mark - 创建定时器 10s一次请求当前是否有未支付订单
#pragma mark - 创建定时器 5s一次请求当前是否有未支付订单
- (void) createTimer {
self.gcdTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
dispatch_source_set_timer(self.gcdTimer, DISPATCH_TIME_NOW, 10.0 * NSEC_PER_SEC, 0.0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(self.gcdTimer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showNotPayOrderMaskView:self];
[ZXTool codePageIsNeedCheckNotPayOrder:^{
self.gcdTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
dispatch_source_set_timer(self.gcdTimer, DISPATCH_TIME_NOW, 15.0 * NSEC_PER_SEC, 0.0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(self.gcdTimer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showNotPayOrderMaskView:self];
});
});
});
// 启动任务,GCD计时器创建后需要手动启动
dispatch_resume(self.gcdTimer);
// 启动任务,GCD计时器创建后需要手动启动
dispatch_resume(self.gcdTimer);
}];
}
@end
//
//
......@@ -12,6 +12,8 @@
#import "HMScannerMaskView.h"
#import "HMScanner.h"
#import "enlargeClickRegionBtn.h"
#import "JXLayoutButton.h"
#import <AVFoundation/AVFoundation.h>//调用闪光灯需要导入该框架
/// 控件间距
#define kControlMarginWash 92.0
......@@ -200,6 +202,48 @@
if (self.model) {
[self createCard];
} else {
JXLayoutButton *open = [[JXLayoutButton alloc] init];
[self.view addSubview:open];
[open mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(scannerBorder.mas_bottom).offset(20 * k6Scale);
make.width.mas_equalTo(150 * k6Scale);
make.height.mas_equalTo(80 * k6Scale);
make.centerX.equalTo(scannerBorder.mas_centerX);
}];
open.imageSize =CGSizeMake(10 * k6Scale, 22 * k6Scale);
open.layoutStyle = JXLayoutButtonStyleUpImageDownTitle;
open.midSpacing = 3 * k6Scale;
open.titleLabel.font = kFontSize(12 * k6Scale);
[open setTitle:@"打开闪光灯" forState:UIControlStateNormal];
[open setTitle:@"关闭闪光灯" forState:UIControlStateSelected];
[open setImage:[UIImage imageNamed:@"icon_off"] forState:UIControlStateNormal];
[open setImage:[UIImage imageNamed:@"icon_on"] forState:UIControlStateSelected];
[open setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[open setTitleColor:[UIColor colorWithHexString:@"#456beb"] forState:UIControlStateSelected];
[[open rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(UIButton *x) {
x.selected = !x.selected;
if (x.isSelected == YES) { //打开闪光灯
AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
if ([captureDevice hasTorch]) {
BOOL locked = [captureDevice lockForConfiguration:&error];
if (locked) {
captureDevice.torchMode = AVCaptureTorchModeOn;
[captureDevice unlockForConfiguration];
}
}
}else{//关闭闪光灯
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([device hasTorch]) {
[device lockForConfiguration:nil];
[device setTorchMode: AVCaptureTorchModeOff];
[device unlockForConfiguration];
}
}
}];
}
if ([self.cardName isEqualToString:@""] || self.cardName ==nil) {
......
//
//
......@@ -21,7 +21,7 @@
self.webView = [[WKWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.view addSubview:self.webView];
[self.webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.jumpUrl]]];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[self.jumpUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];
}
......
//
//
......@@ -14,7 +14,7 @@
#import "ZXInformation.h"
#import "ZXRSTableHeader.h"
//========老版本部分内容-===============
#import "AnnouncementView.h"
#import "ZXAnnouncementView.h"
#import "AnnounceModel.h"
#import "ZXPopMenuViewController.h"
#import "ZXBannerJumpViewController.h"
......@@ -33,7 +33,7 @@
@property (nonatomic, strong) SDCycleScrollView *cycleScrollView;
@property (nonatomic, strong) ZXFirstPageService *service;
//强弹公告
@property (nonatomic, strong)AnnouncementView * announce;
@property (nonatomic, strong)ZXAnnouncementView * announce;
@property (nonatomic, assign) BOOL isExpan;
......@@ -127,31 +127,20 @@
}
#pragma mark - ========== 显示公告 ==========
- (void) showPublishWithItem:(ZXInformation *) info {
if (_announce) {
if (self.announce) {
return;
}
NSString *jumpUrl = [NSString stringWithFormat:@"%@/Content/%ld?title=%@", [kUserDefaults valueForKey:@"h5FirstPage"], (long)info.id, info.title];
AnnounceModelItem *item = [[AnnounceModelItem alloc] init];
item.noticeTitle = info.title;
item.noticeContent = jumpUrl;
item.updateDate = info.createTime;
item.noticeType = @"3";
item.forceId = [NSString stringWithFormat:@"%ld", (long)info.id];
_announce=[[AnnouncementView alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
_announce.announceItem=item;
@weakify(self);
_announce.ok = ^(BOOL noNotice) {
@strongify(self);
self.announce.hidden = YES;
[self.announce removeFromSuperview];
NSString *jumpUrl = [NSString stringWithFormat:@"%@/Content/%ld?title=%@", [kUserDefaults objectForKey:@"h5FirstPage"],(long)info.id, info.title];
kWeakSelf(self);
self.announce = [[ZXAnnouncementView alloc] initWithFrame:[UIScreen mainScreen].bounds jumpUrl:jumpUrl];
self.announce.comfirm = ^(BOOL isNotAlert) {
kStrongSelf(self);
self.announce = nil;
//访问不再提醒接口
if (noNotice==YES) {
if (isNotAlert==YES) {
[self.service notShowPublishMsgWithInfo:info];
}
};
[[ZXTool returnKeyWindow] addSubview:_announce];
[kAppWindow addSubview:self.announce];
}
- (void) createMenuViewByList:(NSArray *) list {
......
//
//
......@@ -24,7 +24,7 @@
#import "ZXNewsViewController.h"
#import "ZXRSNewsManagerController.h"
//========老版本部分内容-===============
#import "AnnouncementView.h"
#import "ZXAnnouncementView.h"
#import "CampasVersionUpdateModel.h"
#import "JudgeFirstTopUpModel.h"
#import "JudgeFirstTopUpModel.h"
......@@ -72,7 +72,7 @@
*/
@property (nonatomic, strong)PerfectInformation * infoView;
//强弹公告
@property (nonatomic, strong)AnnouncementView * announce;
@property (nonatomic, strong)ZXAnnouncementView * announce;
@property (nonatomic, strong)CampasVersionUpdateModel * updateModel;
@property (nonatomic,strong) UIAlertView * updateAlert;
@property (nonatomic, assign) BOOL isShowVersion;
......@@ -792,31 +792,20 @@ static NSInteger seq = 0;
}
#pragma mark - ========== 显示公告 ==========
- (void) showPublishWithItem:(ZXInformation *) info {
if (_announce) {
if (self.announce) {
return;
}
NSString *jumpUrl = [NSString stringWithFormat:@"%@/Content/%ld?title=%@", [kUserDefaults valueForKey:@"h5FirstPage"], (long)info.id, info.title];
AnnounceModelItem *item = [[AnnounceModelItem alloc] init];
item.noticeTitle = info.title;
item.noticeContent = jumpUrl;
item.updateDate = info.createTime;
item.noticeType = @"3";
item.forceId = [NSString stringWithFormat:@"%ld", info.id];
_announce=[[AnnouncementView alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
_announce.announceItem=item;
@weakify(self);
_announce.ok = ^(BOOL noNotice) {
@strongify(self);
self.announce.hidden = YES;
[self.announce removeFromSuperview];
NSString *jumpUrl = [NSString stringWithFormat:@"%@/Content/%ld?title=%@", [kUserDefaults objectForKey:@"h5FirstPage"],(long)info.id, info.title];
kWeakSelf(self);
self.announce = [[ZXAnnouncementView alloc] initWithFrame:[UIScreen mainScreen].bounds jumpUrl:jumpUrl];
self.announce.comfirm = ^(BOOL isNotAlert) {
kStrongSelf(self);
self.announce = nil;
//访问不再提醒接口
if (noNotice==YES) {
if (isNotAlert==YES) {
[self.service notShowPublishMsgWithInfo:info];
}
};
[[ZXTool returnKeyWindow] addSubview:_announce];
[kAppWindow addSubview:self.announce];
}
#pragma mark - ========== 内存警告 ==========
......
//
//
......@@ -150,4 +150,6 @@ typedef void(^loginSuccessJump)(NSString *jump);
adType:(NSString *) adType
isFirstPage:(BOOL) isFirstPage
isHasBottomMargin:(BOOL) isHasBottomMargin;
+(void) codePageIsNeedCheckNotPayOrder:(dispatch_block_t) completed;
@end
//
//
......@@ -1767,4 +1767,53 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
[[ZXBDTool sharedZXBDTool] createNativieAdByView:superView topView:topView viewController:fromVc isFirstPage:isFirstPage isHasBottomMargin:isHasBottomMargin];
}
}
#pragma mark - ==========是否需要在条码页轮训待支付订单==========
+(void) codePageIsNeedCheckNotPayOrder:(dispatch_block_t) completed {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/operationModeConf?areaId=%@", [kUserDefaults objectForKey:@"SX_MONEY"], CacheCampusId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error==nil) {
}
});
}];
NSString *url = [NSString stringWithFormat:@"%@/dcxy/api/operationModeConf?areaId=%@", [kUserDefaults objectForKey:@"SX_MONEY"], CacheCampusId];
[XMCenter sendRequest:^(XMRequest *request) {
request.url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
request.httpMethod = kXMHTTPMethodGET;
request.headers = @{@"token": CacheToken,@"reqSource":@"app", @"Content-Type":@"application/json"};
} onSuccess:^(id responseObject) {
if ([responseObject[@"code"] integerValue] == 1000) {
if (responseObject[@"data"]) {
if ([responseObject[@"data"][@"mode"] integerValue] == 1 || [responseObject[@"data"][@"mode"] integerValue] == 2) {
//单独加载是否是订单模式
NSString *url2 = [NSString stringWithFormat:@"%@/app/customer/balance/state?customerId=%@", [kUserDefaults valueForKey:@"NEW_PAY"],CacheUserId];
[XMCenter sendRequest:^(XMRequest *request) {
request.url = [url2 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
request.httpMethod = kXMHTTPMethodGET;
request.headers = @{@"token": CacheToken,@"reqSource":@"app", @"Content-Type":@"application/json"};
} onSuccess:^(id responseObject) {
if ([responseObject[@"code"] integerValue] == 1000) {
if (responseObject[@"data"]) {
NSInteger status = [responseObject[@"data"] integerValue];
if (status == 0) {
completed();
}
}
}
} onFailure:^(NSError *error) {
} onFinished:^(id responseObject, NSError *error) {
}];
}
}
}
} onFailure:^(NSError *error) {
} onFinished:^(id responseObject, NSError *error) {
}];
}
@end
//
//
......@@ -180,6 +180,13 @@
}
}];
});
} else if ([responseObject[@"code"] integerValue] == 1006) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXNotPay clearTable];
[ZXTool hideLoadingAnimation];
[self paySuccessAndBackToRoot];
[ZXTool showText:responseObject[@"msg"]];
});
} else {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
......@@ -199,6 +206,7 @@
if (self.paySuccess) {
self.paySuccess();
}
[[NSNotificationCenter defaultCenter] postNotificationName:kOrder_Completed_Pay object:nil];
dispatch_async(dispatch_get_main_queue(), ^{
NSArray *controllers = self.navigationController.childViewControllers;
NSArray *res = [[controllers reverseObjectEnumerator] allObjects];
......
//
//
......@@ -60,7 +60,7 @@
if (dic && dic[@"paymentAndActiveInfos"]) {
[self.payTypes removeAllObjects];
NSInteger defaultPayType = -1;//默认为-1
if (responseObject[@"defaultPayType"]) {
if (responseObject[@"defaultPayType"] && ![responseObject[@"defaultPayType"] isKindOfClass:[NSNull class]]) {
defaultPayType = [responseObject[@"defaultPayType"] integerValue];
}
NSArray *arr = [ZXNewPayTypeModel mj_objectArrayWithKeyValuesArray:dic[@"paymentAndActiveInfos"]];
......@@ -192,6 +192,7 @@
@weakify(self);
[[back rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
[[NSNotificationCenter defaultCenter] postNotificationName:kOrder_CheckNopPay_Pay object:nil];
for (UIViewController *vc in self.navigationController.childViewControllers) {
if ([vc isKindOfClass:NSClassFromString(@"ZTHomeViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXRSNewViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXSimpleHomeController")] || [vc isKindOfClass:NSClassFromString(@"ZXNewPayOrderListViewController")]) {
[self.navigationController popToViewController:vc animated:YES];
......
//
//
......@@ -82,14 +82,8 @@
#pragma mark - 生命周期方法
- (void)viewDidLoad {
[super viewDidLoad];
// self.hasGzstore=NO;
// 判断是否有格子铺
// self.gzstoreModel=[JudgegzStore new];
// [self registNotificationAndKVO];
// [self.gzstoreModel judgeGzStore];
[kUserDefaults setValue:@"isOpenFreePay" forKey:@"no"];//默认是no
[kUserDefaults setValue:@"no" forKey:@"isOpenFreePay"];//默认是no
NSString *url = [NSString stringWithFormat:@"%@/area/switchs?areaId=%@", [kUserDefaults objectForKey:@"SX_MONEY"], CacheCampusId];
@weakify(self);
[XMCenter sendRequest:^(XMRequest *request) {
......@@ -102,11 +96,11 @@
NSArray *arr = responseObject[@"areaSwitchs"];
NSMutableArray *arr_type = [[NSMutableArray alloc] init];
for (NSDictionary *dic in arr) {
if ([dic[@"isEnabled"] integerValue] == 1) {
if ([dic[@"isEnabled"] integerValue] == 1 && ![dic[@"type"] isEqualToString:@"4"]) {
[arr_type addObject:dic];
}
if ([dic[@"type"] isEqualToString:@"3"] && [dic[@"isEnabled"] integerValue] == 1) {
[kUserDefaults setValue:@"isOpenFreePay" forKey:@"yes"];//默认是no
if ([dic[@"type"] isEqualToString:@"4"] && [dic[@"isEnabled"] integerValue] == 1) {
[kUserDefaults setValue:@"yes" forKey:@"isOpenFreePay"];//默认是no
}
}
if (arr_type.count == 2) {
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_off.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "icon_off@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "icon_off@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_on.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "icon_on@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "icon_on@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