Commit 0441bb0f by 刘卓鑫

最新需求 1.订单推送 2.订单模式和系扣切换。。。

parent cd6c1a70
......@@ -86,9 +86,6 @@
[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-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];
......
......@@ -8,6 +8,7 @@
#import "AppDelegate.h"
#import "AppDelegate+Extension.h"
#import "ZXOrderPayController.h"
#import "LoginView.h"
#import "MyTabViewController.h"
#import "XMGNavigationViewController.h"
......@@ -18,6 +19,7 @@
#import "XMGFileTool.h"
#import "LoginJump.h"
#import "FTUploader.h"
#import "ZXNewOrderDetailViewController.h"
#import <AFNetworkReachabilityManager.h>
// 引入JPush功能所需头文件
#import "JPUSHService.h"
......@@ -351,7 +353,7 @@
handleActionWithIdentifier:(NSString *)identifier
forRemoteNotification:(NSDictionary *)userInfo
completionHandler:(void (^)())completionHandler {
//MARK:点击通知触发的动作
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
......@@ -428,23 +430,49 @@ fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
self.notifyDic=userInfo;
}
//跳转到指定界面;
[self goToMssageViewControllerWith:userInfo];
[self jumpNotPayView:userInfo];
}
else {
// 判断为本地通知
NSLog(@"iOS10 收到本地通知:{\nbody:%@,\ntitle:%@,\nsubtitle:%@,\nbadge:%@,\nsound:%@,\nuserInfo:%@\n}",body,title,subtitle,badge,sound,userInfo);
}
completionHandler(); // 系统要求执行这个方法
}
#pragma mark 通过通知跳转到指定界面;
- (void)goToMssageViewControllerWith:(NSDictionary*)msgDic{
#pragma mark - 点击推送 跳转未支付订单
- (void) jumpNotPayView:(NSDictionary *) userInfo {
if ([userInfo[@"CODE"] integerValue] == 997) {
//请求未支付订单数据
NSString *url = [NSString stringWithFormat:@"%@/consumeOrder/getUnpaidOrder?customerId=%@", [kUserDefaults objectForKey:@"NEW_PAY"], CacheUserId];
[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) {
dispatch_async(dispatch_get_main_queue(), ^{
id order = responseObject[@"orderId"];
if (![order isKindOfClass:[NSNull class]]) {
ZXOrderPayController *jumpPay = [[ZXOrderPayController alloc] init];
NSInteger orderId = [responseObject[@"orderId"] integerValue];
jumpPay.orderId = orderId;
[ZXPayManager sharedZXPayManager].orderId = orderId;
[[ZXTool getCurrentVC].navigationController pushViewController:jumpPay animated:YES];
} else {
ZXNewOrderDetailViewController *orderDetail = [[ZXNewOrderDetailViewController alloc] init];
orderDetail.orderId = [userInfo[@"orderInfo"] integerValue];
[[ZXTool getCurrentVC].navigationController pushViewController:orderDetail animated:YES];
}
});
}
} onFailure:^(NSError *error) {
} onFinished:^(id responseObject, NSError *error) {
}];
}
}
//#pragma mark - ========== 版本检测 ==========
//-(void)checkVersion{
// self.updateModel = [[UpdateVersionModel alloc] init];
......
//
//
......@@ -533,7 +533,7 @@ static NSInteger seq = 0;
//当没得校区的时候就判定为个人信息没有完善
NSLog(@"====%@",CacheCampusId);
if ([CacheCampusId isEqualToString:@""]){
if ([CacheCampusId isEqualToString:@""] || [CacheCampusId isEqualToString:@"0"]){
_infoView = [[PerfectInformation alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
@weakify(self);
......
//
//
......@@ -8,8 +8,8 @@
#import "AnnouncementView.h"
@interface AnnouncementView()<WKScriptMessageHandler>{
@interface AnnouncementView()<UIScrollViewDelegate>{
BOOL jugeAgreed;
}
@property (nonatomic, strong) NSArray *indentifierList;
......@@ -19,153 +19,20 @@
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 - ========== 注册方法列表 ==========
- (NSArray *)indentifierList {
if (!_indentifierList) {
_indentifierList = @[@"backToTheHomePageH5ToAPPNative",//返回
@"scanH5ToAPPNative",//打开扫一扫
@"newPageH5ToAPPNative",//打开新页面
@"onLoadingInitViewH5ToAPPnative",//预加载
@"closeWindowsH5ToAPPNative",//关闭页面
@"writeDataH5ToAPPNative",//存储数据
@"readDataH5ToAPPNative",//读数据
@"removeDataH5ToAPPnative",//删除键值对数据
@"removeLazyInitViewH5ToAPPNative",//删除某页面的缓存数据
@"showProgressDialogH5ToAPPNative",//打开加载框
@"closeProgressDialogH5ToAPPNative",//关闭加载框
@"showDialogH5ToAPPNative",//显示提示信息
@"doWXPayH5ToAPPNative",//微信支付
@"doAlipayH5ToAPPNative",//支付宝支付
@"showToastH5ToAPPNative",//弹出提示信息
@"closeAllWindowsH5ToAPPNative",//关闭除首页外的所有窗口
@"getUserInfoH5ToAPPNative",//获取用户信息
@"setGenerateQrCodesH5ToAPPNative",//二维码
@"showYesNoDialogH5ToAPPNative",//确认选择弹窗
@"getCachePageH5ToAPPNative", //banner外联
@"registerDeviceServiceEvent",//呼起原生快捷操作
@"setHighlightH5ToAPPNative",//屏幕高亮
@"ExitLogin",//退出登录
@"setCameraCutting",//裁剪图片
@"doJDPayH5ToAPPNative",//京东支付
];
}
return _indentifierList;
}
#pragma mark - ==========JS 调用 OC ==========
- (void)ba_JS_OC {
for (NSString *str in self.indentifierList) {
[self.webView.configuration.userContentController addScriptMessageHandler:self name:str];
}
}
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
if ([message.name isEqualToString:self.indentifierList[0]]) {
} else if ([message.name isEqualToString:self.indentifierList[1]]) {
} else if ([message.name isEqualToString:self.indentifierList[2]]) {
} else if ([message.name isEqualToString:self.indentifierList[3]]) {
} else if ([message.name isEqualToString:self.indentifierList[4]]) {
} else if ([message.name isEqualToString:self.indentifierList[5]]) {
/*准备写入数据*/
//注意callBackPage0001 对商品应详情页
[ZXTool saveValue:[message.body lastObject] fromKey:[message.body firstObject]];
} else if ([message.name isEqualToString:self.indentifierList[6]]) {
/*准备读取数据*/
NSString *str = [ZXTool getValueFromKey:[message.body firstObject]];
[self.webView evaluateJavaScript:[NSString stringWithFormat:@"%@('%@')", [message.body lastObject], str] completionHandler:^(id _Nullable result, NSError * _Nullable error) {
}];
} else if ([message.name isEqualToString:self.indentifierList[7]]) {
/*删除键值对数据*/
[ZXTool removeValueFromKey:message.body];
} else if ([message.name isEqualToString:self.indentifierList[8]]) {
} else if ([message.name isEqualToString:self.indentifierList[9]]) {
/*打开加载框*/
[ZXTool showLoadingAnimation];
} else if ([message.name isEqualToString:self.indentifierList[10]]) {
/*关闭加载框*/
[ZXTool hideLoadingAnimation];
} else if ([message.name isEqualToString:self.indentifierList[11]]) {
/*显示提示信息*/
if ([message.body isKindOfClass:[NSArray class]]) {
[ZXTool showAlertText:[message.body lastObject]];
} else {
[ZXTool showAlertText:message.body];
}
} else if ([message.name isEqualToString:self.indentifierList[12]]) {
} else if ([message.name isEqualToString:self.indentifierList[13]]) {
} else if ([message.name isEqualToString:self.indentifierList[14]]) {
/*显示提示信息*/
if ([message.body isKindOfClass:[NSArray class]]) {
[ZXTool showText:[message.body lastObject]];
} else {
[ZXTool showText:message.body];
}
} else if ([message.name isEqualToString:self.indentifierList[15]]) {
} else if ([message.name isEqualToString:self.indentifierList[16]]) {
/*获取用户信息*/
NSString *str = [ZXTool returnUserInfo];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.webView evaluateJavaScript:[NSString stringWithFormat:@"%@('%@')", message.body, str] completionHandler:^(id _Nullable result, NSError * _Nullable error) {
NSLog(@"%@", error?error:@"成功");;
}];
});
} else if ([message.name isEqualToString:self.indentifierList[17]]) {
} else if ([message.name isEqualToString:self.indentifierList[18]]) {
} else if ([message.name isEqualToString:self.indentifierList[19]]) {
} else if ([message.name isEqualToString:self.indentifierList[20]]) {
/*呼起原生快捷操作*/
} else if ([message.name isEqualToString:self.indentifierList[21]]) {
} else if ([message.name isEqualToString:self.indentifierList[22]]) {
/*退出登录*/
[self exitLogin:message.body];
} else if ([message.name isEqualToString:self.indentifierList[23]]) {
/*裁剪图片*/
} else if ([message.name isEqualToString:self.indentifierList[24]]) {
/*京东支付*/
}
}
/*退出登录*/
- (void) exitLogin:(id) info {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
if ([userDefaults objectForKey:@"userId"] == nil) {
return;
#pragma mark - scrollView协议
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
if (scrollView.contentSize.height - scrollView.contentOffset.y == self.webView.frame.size.height) {
//滚动到底部了
self.agreedBtn.hidden = NO;
}
[ZXTool showText:info];
[ZXTool backToLogin];
}
- (instancetype)init{
self = [super init];
......@@ -185,23 +52,24 @@
*)[nib firstObject];
self.frame=frame;
self.BgView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
[self creatWebView];
[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;
......@@ -209,12 +77,11 @@
[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));
}];
[self ba_JS_OC];
}
- (IBAction)agreeBtnClick:(id)sender {
......@@ -227,21 +94,14 @@
{
[_agreedBtn setImage:[UIImage imageNamed:@"条款未选中.png"] forState:UIControlStateNormal];
}
}
- (IBAction)confirmBtnClick:(id)sender {
if (self.ok) {
self.ok(jugeAgreed);
}
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
//
......@@ -19,7 +19,7 @@
@implementation AboutUs
- (void)dealloc{
// [UIGestureRecognizer ]
[self removeNotificationAndKVO];
[self.webView removeObserver:self forKeyPath:@"loading"];
[self.webView removeObserver:self forKeyPath:@"estimatedProgress"];
......
//
//
......@@ -12,22 +12,30 @@
#import "updateViewController.h"
#import "AllowEequipCountLoginModel.h"
#import "LoginModel.h"
#import "FetchAccoutDataModel.h"
#import "ZXOrderPayController.h"
#import "AimiWalletViewController.h"
#define CachePath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]
typedef void(^isCanChange)(BOOL iCan);
@interface UserSettingViewController ()<UITableViewDataSource,UITableViewDelegate>
{
NSMutableArray * dataArray;
NSMutableArray * imageArray;
NSMutableArray * sectionTitle;
UILabel *cacheNum;
UISwitch * switchButton;
UISwitch * free_switch_Button;
UISwitch * push_switch_Button;
}
@property (nonatomic, assign) NSInteger totalSize;
@property (strong, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) AllowEequipCountLoginModel * allowModel;
@property (nonatomic, assign) NSInteger isOpenFreePay;
@property (nonatomic, assign) BOOL isCloseOrderPush;//是否关闭订单推送 NO不关闭 YES关闭
@end
@implementation UserSettingViewController
......@@ -38,29 +46,29 @@
-(void)registNotificationAndKVO{
[self.allowModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.allowModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
}
-(void)removeNotificationAndKVO{
[self.allowModel removeObserver:self forKeyPath:@"isLoaded"];
[self.allowModel removeObserver:self forKeyPath:@"error"];
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if (object == self.allowModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
}
else{
}
}
}
- (void)viewDidLoad {
[super viewDidLoad];
self.isOpenFreePay = 0;
[self loadCache];
......@@ -72,24 +80,25 @@
self.tableView.dataSource=self;
self.tableView.tableFooterView=[UIView new];
[self loadIsOpenFreePay];
[self checkCurrentUserIsOpenJPush];
[ZXTool loadAdInfoByAdId:@"5" topView:self.tableView superView:self.view fromVc:self];
}
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
super.navigationController.navigationBar.hidden = NO;
}
//获取缓存尺寸
-(void)loadCache{
// 获取文件夹尺寸
// 文件夹非常小,如果我的文件非常大
[XMGFileTool getFileSize:CachePath completion:^(NSInteger totalSize) {
_totalSize = totalSize;
[self.tableView reloadData];
}];
}
// 获取缓存尺寸字符串
......@@ -110,7 +119,7 @@
// B
sizeStr = [NSString stringWithFormat:@"%.ldB",totalSize];
}
return sizeStr;
}
/*
......@@ -118,44 +127,44 @@
*/
-(void)loadData
{
NSArray* group1;
BOOL isOpenFreePay = [[kUserDefaults valueForKey:@"isOpenFreePay"] isEqualToString:@"yes"];
if ([CacheVersion isEqualToString:@"2"]) {
if (isOpenFreePay) {
group1=@[@"app登录密码",@"设备密码",@"更换手机账户",@"开启设备登录密码",@"开启余额支付"];
group1=@[@"app登录密码",@"设备密码",@"更换手机账户",@"开启设备登录密码",@"开启系统自动扣费", @"开启订单推送"];
} else {
group1=@[@"app登录密码",@"设备密码",@"更换手机账户",@"开启设备登录密码"];
}
}
else{
if (isOpenFreePay) {
group1=@[@"app登录密码",@"更换手机账户",@"开启设备登录密码",@"开启余额支付"];
group1=@[@"app登录密码",@"更换手机账户",@"开启设备登录密码",@"开启系统自动扣费"];
} else {
group1=@[@"app登录密码",@"更换手机账户",@"开启设备登录密码"];
}
}
NSArray * group2=@[@"清理缓存",@"退出登录"];
NSArray * imagegroup1;
if ([CacheVersion isEqualToString:@"2"]) {
if (isOpenFreePay) {
imagegroup1=@[@"Passwordtwo.png",@"设备.png",@"app.png",@"set_bar_code",@"icon_mianmi"];
imagegroup1=@[@"Passwordtwo.png",@"设备.png",@"app.png",@"set_bar_code",@"icon_mianmi",@"icon-push"];
} else {
imagegroup1=@[@"Passwordtwo.png",@"设备.png",@"app.png",@"set_bar_code"];
}
}
else{
if (isOpenFreePay) {
imagegroup1=@[@"Passwordtwo.png",@"app.png",@"set_bar_code",@"icon_mianmi"];
imagegroup1=@[@"Passwordtwo.png",@"app.png",@"set_bar_code",@"icon_mianmi",@"icon-push"];
} else {
imagegroup1=@[@"Passwordtwo.png",@"app.png",@"set_bar_code"];
}
}
NSArray * imagegroup2=@[@"Clear.png",@"Close.png"];
dataArray=[[NSMutableArray alloc]initWithObjects:group1,group2,nil];
imageArray=[[NSMutableArray alloc]initWithObjects:imagegroup1,imagegroup2,nil];
sectionTitle=[[NSMutableArray alloc]initWithObjects:@"密码与安全",@"其它",nil];
}
......@@ -180,36 +189,36 @@ heightForFooterInSection:(NSInteger)section
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return dataArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSArray * arr=dataArray[section];
return arr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:@"MCCMineCell"];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MCCMineCell"];
}
NSArray * tempArr;
if (indexPath.section<dataArray.count) {
tempArr=dataArray[indexPath.section];
}
UIImage * image=[UIImage imageNamed:(imageArray[indexPath.section])[indexPath.row]];
cell.imageView.image=image;
cell.textLabel.text=(tempArr)[indexPath.row];
cell.selectionStyle= UITableViewCellSelectionStyleNone;
cell.separatorInset=UIEdgeInsetsMake(0, 10, 0, 0);
if (!(indexPath.section==1&&indexPath.row==0)) {
if ([CacheVersion isEqualToString:@"2"]) {
......@@ -217,6 +226,8 @@ heightForFooterInSection:(NSInteger)section
[self addSwithWithCell:cell];
} else if (indexPath.section==0&&indexPath.row==4) {
[self addFreeSwithWithCell:cell];
} else if (indexPath.section==0&&indexPath.row==5) {
[self addPushSwithWithCell:cell];
} else{
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
......@@ -225,13 +236,15 @@ heightForFooterInSection:(NSInteger)section
[self addSwithWithCell:cell];
} else if (indexPath.section==0&&indexPath.row==3) {
[self addFreeSwithWithCell:cell];
} else{
} else if (indexPath.section==0&&indexPath.row==4) {
[self addPushSwithWithCell:cell];
} else{
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
}
}
else{
if (cacheNum) {
[cacheNum removeFromSuperview];
......@@ -257,14 +270,14 @@ heightForFooterInSection:(NSInteger)section
}
switchButton = [[UISwitch alloc] initWithFrame:CGRectMake(kWidth-70, 7, 100, 24)];
// 0开1关
if ([CacheDevPassSwitch integerValue] == 0) {
if ([CacheDevPassSwitch isEqualToString:@"0"]) {
[switchButton setOn:YES];
}else{
[switchButton setOn:NO];
}
switchButton.onTintColor=[UIColor orangeColor];
[switchButton addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
[cell addSubview:switchButton];
}
......@@ -279,7 +292,7 @@ heightForFooterInSection:(NSInteger)section
}
});
}];
}
-(void)addFreeSwithWithCell:(UITableViewCell *)cell {
if (free_switch_Button) {
......@@ -288,22 +301,219 @@ heightForFooterInSection:(NSInteger)section
}
free_switch_Button = [[UISwitch alloc] initWithFrame:CGRectMake(kWidth-70, 7, 100, 24)];
// 0开1关
if (self.isOpenFreePay) {
[free_switch_Button setOn:YES];
}else{
[free_switch_Button setOn:NO];
}
free_switch_Button.onTintColor=[UIColor orangeColor];
[free_switch_Button addTarget:self action:@selector(freeSwitchAction:) forControlEvents:UIControlEventValueChanged];
[cell addSubview:free_switch_Button];
}
#pragma mark - ===================查询是否开启推送==============================
- (void) checkCurrentUserIsOpenJPush {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/common/jpush/isOpen?customerId=%@", [kUserDefaults valueForKey:@"SX_MONEY"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (common.data) {
self.isCloseOrderPush = [common.data integerValue];
[self.tableView reloadData];
}
});
}];
}
- (BOOL)isUserNotificationEnable { // 判断用户是否允许接收通知
BOOL isEnable = NO;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0f) { // iOS版本 >=8.0 处理逻辑
UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings];
isEnable = (UIUserNotificationTypeNone == setting.types) ? NO : YES;
} else { // iOS版本 <8.0 处理逻辑
UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
isEnable = (UIRemoteNotificationTypeNone == type) ? NO : YES;
}
return isEnable;
}
#pragma mark - ========开启/关闭激光推送============
-(void)jpushSwitchAction:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
BOOL isButtonOn = [switchButton isOn];
if (isButtonOn) {
BOOL isOpen = [self isUserNotificationEnable];
if (isOpen == NO) {
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) {
NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[kApplication openURL:url];
}];
[alert addAction:ac1];
[alert addAction:ac2];
[self presentViewController:alert animated:YES completion:nil];
switchButton.on = !isButtonOn;//y还原
return;
}
}
self.isCloseOrderPush = isButtonOn;
[ZXTool requestDataWithType:kXMHTTPMethodPUT url:[NSString stringWithFormat:@"%@/common/jpush/isOpen?customerId=%@", [kUserDefaults valueForKey:@"SX_MONEY"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
switchButton.on = !isButtonOn;
}
});
}];
}
-(void)addPushSwithWithCell:(UITableViewCell *)cell {
if (push_switch_Button) {
[push_switch_Button removeFromSuperview];
push_switch_Button=nil;
}
push_switch_Button = [[UISwitch alloc] initWithFrame:CGRectMake(kWidth-70, 7, 100, 24)];
// 0开1关
if (self.isCloseOrderPush) {
[push_switch_Button setOn:NO];
}else{
[push_switch_Button setOn:YES];
}
push_switch_Button.onTintColor=[UIColor orangeColor];
[push_switch_Button addTarget:self action:@selector(jpushSwitchAction:) forControlEvents:UIControlEventValueChanged];
[cell addSubview:push_switch_Button];
}
-(void)freeSwitchAction:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
BOOL isButtonOn = [switchButton isOn];
if (isButtonOn == NO) {
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/customerAccount/queryAccount", [kUserDefaults objectForKey:@"NEW_PAY"]] para:@{@"areaId":CacheCampusId, @"customerPhone":CacheAccount, @"id":CacheUserId} completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
switchButton.on = !isButtonOn;
[ZXTool showText:error];
} else {
BOOL isCanChange = YES;
for (NSDictionary *dic in common.data) {
servicePeasListItem *item = [servicePeasListItem mj_objectWithKeyValues:dic];
if ([item.serviceId isEqualToString:@"0"]) {
isCanChange = item.money >= 0;
if (isCanChange == NO) {
switchButton.on = !isButtonOn;
//弹窗提示
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) {
//余额太少 前往充值
AimiWalletViewController *wallet = [[AimiWalletViewController alloc] init];
[self.navigationController pushViewController:wallet animated:YES];
}];
[alert addAction:ac1];
[alert addAction:ac2];
[self presentViewController:alert animated:YES completion:nil];
return ;
}
break;
}
}
if (isCanChange) {
//需要先判断一下当前是否有待支付订单
kWeakSelf(self);
[self checkIsHasNotPayOrderIsCanChange:^(BOOL isCan) {
kStrongSelf(self);
if (isCan) {
//弹窗提示
[self changeSystemReduceMoney:switchButton isBtnOn:isButtonOn];
} else {
dispatch_async(dispatch_get_main_queue(), ^{
switchButton.on = !isButtonOn;
});
}
}];
} else {
dispatch_async(dispatch_get_main_queue(), ^{
switchButton.on = !isButtonOn;
});
}
}
});
}];
} else {
kWeakSelf(self);
[self checkIsHasNotPayOrderIsCanChange:^(BOOL isCan) {
kStrongSelf(self);
if (isCan) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showAlertText:@"开启后系统将按照消费自动抵扣艾米和余额,当账户余额<=0时,将无法自动扣费!"];
});
[self changeSystemReduceMoney:switchButton isBtnOn:isButtonOn];
} else {
dispatch_async(dispatch_get_main_queue(), ^{
switchButton.on = !isButtonOn;
});
}
}];
}
}
#pragma mark - ==========查询当前是否有待支付订单==========
- (void) checkIsHasNotPayOrderIsCanChange:(isCanChange) completed {
NSString *url = [NSString stringWithFormat:@"%@/consumeOrder/getUnpaidOrder?customerId=%@", [kUserDefaults objectForKey:@"NEW_PAY"], CacheUserId];
kWeakSelf(self);
[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) {
kStrongSelf(self);
if ([responseObject[@"code"] integerValue] == 1000) {
if ([responseObject[@"orderId"] isKindOfClass:[NSNull class]] || responseObject[@"orderId"]== nil) {
completed(YES);
return ;
}
completed(NO);
dispatch_async(dispatch_get_main_queue(), ^{
//弹窗提示
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) {
ZXOrderPayController *jumpPay = [[ZXOrderPayController alloc] init];
jumpPay.orderId = [responseObject[@"orderId"] integerValue];
[self.navigationController pushViewController:jumpPay animated:YES];
}];
[alert addAction:ac1];
[alert addAction:ac2];
[self presentViewController:alert animated:YES completion:nil];
});
} else {
completed(NO);
}
} onFailure:^(NSError *error) {
completed(NO);
} onFinished:^(id responseObject, NSError *error) {
}];
}
#pragma mark - ==========切换系统扣费事件==========
- (void) changeSystemReduceMoney:(UISwitch *) switchButton isBtnOn:(BOOL) isButtonOn{
self.isOpenFreePay = isButtonOn;
[ZXTool requestDataWithType:kXMHTTPMethodPUT url:[NSString stringWithFormat:@"%@/app/customer/swich/balance/%@/%d", [kUserDefaults valueForKey:@"NEW_PAY"],CacheUserId,isButtonOn] para:@{@"customerId":CacheUserId,@"isEnabled":@(isButtonOn)} completed:^(CommonModel *common, NSString *error) {
//
......@@ -315,6 +525,7 @@ heightForFooterInSection:(NSInteger)section
});
}];
}
-(void)switchAction:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
......@@ -323,7 +534,7 @@ heightForFooterInSection:(NSInteger)section
// showSwitchValue.text = @"是";
// 0开1关
[self.allowModel AllowEquitLoginWithStatu:@"0"];
}else {
// showSwitchValue.text = @"否";
[self.allowModel AllowEquitLoginWithStatu:@"1"];
......@@ -332,13 +543,13 @@ heightForFooterInSection:(NSInteger)section
-(UIImage*) OriginImage:(UIImage *)image scaleToSize:(CGSize)size
{
UIGraphicsBeginImageContext(size); //size 为CGSize类型,即你所需要的图片尺寸
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage; //返回的就是已经改变的图片
}
......@@ -363,15 +574,15 @@ heightForFooterInSection:(NSInteger)section
else if (indexPath.row==1){
[self exitBtnFuc];
}
}
else if(indexPath.section==0)
{
NSArray * tempArr;
tempArr=dataArray[indexPath.section];
NSString *s = (tempArr)[indexPath.row];
if ([s isEqualToString:@"开启设备登录密码"] || [s isEqualToString:@"钱包免密支付"]) {
if ([s isEqualToString:@"开启设备登录密码"] || [s isEqualToString:@"开启系统自动扣费"] || [s isEqualToString:@"开启订单推送"]) {
return;
}
//app登录密码
......@@ -385,7 +596,7 @@ heightForFooterInSection:(NSInteger)section
*/
-(void)cacheBtnFuc
{
NSLog(@" 缓存");
// 清空缓存
// 删除文件夹里面所有文件
......@@ -393,14 +604,14 @@ heightForFooterInSection:(NSInteger)section
_totalSize = 0;
[self.tableView reloadData];
[SVProgressHUD showSuccessWithStatus:@"清除缓存成功"];
}
/*
退出按钮
*/
-(void)exitBtnFuc
{
[ZXTool backToLogin];
}
......@@ -411,7 +622,7 @@ heightForFooterInSection:(NSInteger)section
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
......
//
//
......@@ -95,6 +95,9 @@
vc.adUrl = [NSString stringWithFormat:@"%@/static/outlink.html", [kUserDefaults valueForKey:@"h5FirstPage"]];
vc.selfHelpTitle = operation.remark;
vc.selfHelpType = operation.defaultValue.length==1?[@"0" stringByAppendingString:operation.defaultValue]:operation.defaultValue;
vc.backAction = ^{
[ZXTool firstPageRefreshAddNotPayView:self.view];
};
[self.navigationController pushViewController:vc animated:YES];
}
}
......@@ -114,6 +117,9 @@
vc.adUrl = @"";
vc.model = model;
vc.defaultModel = defaultValue;
vc.backAction = ^{
[ZXTool firstPageRefreshAddNotPayView:self.view];
};
[self.navigationController pushViewController:vc animated:YES];
break;
}
......@@ -136,6 +142,9 @@
vc.adUrl = @"";
vc.model = model;
vc.defaultModel = defaultValue;
vc.backAction = ^{
[ZXTool firstPageRefreshAddNotPayView:self.view];
};
[self.navigationController pushViewController:vc animated:YES];
} else {
ZXDrinkViewController *vc= [[ZXDrinkViewController alloc] init];
......@@ -161,6 +170,9 @@
vc.adUrl = @"";
vc.model = 1;
vc.defaultModel = 1;
vc.backAction = ^{
[ZXTool firstPageRefreshAddNotPayView:self.view];
};
[self.navigationController pushViewController:vc animated:YES];
}
break;
......
//
//
......@@ -146,20 +146,12 @@ static NSInteger seq = 0;
- (void) createUI {
//
// [UIApplication sharedApplication].statusBarHidden = NO;
// [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
// UIView *nabar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kNavBarHeight + kStatusBarHeight)];
// nabar.backgroundColor = [UIColor orangeColor];
//
// [self.view addSubview:nabar];
// UILabel *naTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, kScreenWidth, kNavBarHeight)];
// naTitle.textAlignment = NSTextAlignmentCenter;
// naTitle.textColor = [UIColor whiteColor];
// naTitle.font = [UIFont boldSystemFontOfSize:17 * k6Scale];
// naTitle.text = @"多彩校园";
// [nabar addSubview:naTitle];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
[UIApplication sharedApplication].statusBarHidden = NO;
UIView *nabar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kStatusBarHeight)];
nabar.backgroundColor = [UIColor colorWithHexString:@"#ffa244"];
[self.view addSubview:nabar];
[self.view addSubview:self.myTableView];
}
......@@ -308,7 +300,7 @@ static NSInteger seq = 0;
if (iPhoneX) {
bottomH = 34;
}
_myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - bottomH - 49) style:UITableViewStyleGrouped];
_myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, kScreenWidth, kScreenHeight - bottomH - 49 - kStatusBarHeight) style:UITableViewStyleGrouped];
_myTableView.delegate = self;
_myTableView.dataSource = self;
_myTableView.backgroundColor = [UIColor whiteColor];
......@@ -342,7 +334,9 @@ static NSInteger seq = 0;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[UIApplication sharedApplication].statusBarHidden = NO;
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
[self.navigationController.navigationBar setHidden:YES];
[self.tabBarController.tabBar setHidden:NO];
if ([[kUserDefaults valueForKey:@"isUploadLog"] integerValue]) {
NSArray *list = [ExpecptionModel findByCriteria:[NSString stringWithFormat:@"where uploadStatus <> 1"]];
......@@ -1032,7 +1026,7 @@ static NSInteger seq = 0;
//当没得校区的时候就判定为个人信息没有完善
NSLog(@"====%@",CacheCampusId);
if ([CacheCampusId isEqualToString:@""]){
if ([CacheCampusId isEqualToString:@""] || [CacheCampusId isEqualToString:@"0"]){
_infoView = [[PerfectInformation alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
__weak typeof (self) weakSelf=self;
......
//
//
......@@ -35,4 +35,7 @@
@property (nonatomic, assign) BOOL isExpan;
//行数
@property (nonatomic, assign) NSInteger rows;
//是否显示了未支付订单蒙层(只针对公告)
@property (nonatomic, assign) BOOL isShowMask;
@end
//
//
......@@ -25,7 +25,7 @@
self.contentImageview = [[UIImageView alloc] init];
[self.contentView addSubview:self.contentImageview];
[self.contentImageview mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(0, 15 * k6Scale, 5 * k6Scale, 15 * k6Scale));
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(5 * k6Scale, 5 * k6Scale, 5 * k6Scale, 5 * k6Scale));
}];
self.contentImageview.layer.cornerRadius = 5;
self.contentImageview.clipsToBounds = YES;
......
//
//
......@@ -30,7 +30,7 @@
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, kScreenWidth, 120 * k6Scale) shouldInfiniteLoop:YES imageNamesGroup:@[]];
self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
self.cycleScrollView.autoScrollTimeInterval = 3;
self.cycleScrollView.autoScrollTimeInterval = 5;
self.cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
[self.contentView addSubview:self.cycleScrollView];
......
//
//
......@@ -9,9 +9,15 @@
#import "New_PublicCell.h"
#import "GYRollingNoticeView.h"
#import "PublicScollCell.h"
#import "ZXNotPay.h"
#import "enlargeClickRegionBtn.h"
#import "ZXOrderPayController.h"
@interface New_PublicCell() <GYRollingNoticeViewDataSource, GYRollingNoticeViewDelegate>
@property (nonatomic, strong) GYRollingNoticeView *noticeView;
@property (nonatomic, strong) UIView *notPayView;
@end
@implementation New_PublicCell
......@@ -30,28 +36,16 @@
make.left.right.top.equalTo(self.contentView);
make.height.mas_equalTo(1);
}];
UILabel *adLsabel = [[UILabel alloc] init];
adLsabel.textColor = [UIColor redColor];
UIImageView *adLsabel = [[UIImageView alloc] init];
[self addSubview:adLsabel];
adLsabel.text = @"公告";
adLsabel.font = kFontSize(14 * k6Scale);
adLsabel.image = [UIImage imageNamed:@"zx_ann_icon"];
[adLsabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.mas_centerY);
make.left.equalTo(self.mas_left).offset(15 * k6Scale);
}];
UIView *line = [[UIView alloc] init];
[self addSubview:line];
line.backgroundColor = [UIColor redColor];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(adLsabel.mas_right).offset(15 * k6Scale);
make.width.mas_equalTo(1);
make.height.mas_equalTo(20 * k6Scale);
make.centerY.equalTo(adLsabel);
}];
UIImageView *arrow = [[UIImageView alloc] init];
arrow.image = [UIImage imageNamed:@"查看全部@2x"];
[self.contentView addSubview:arrow];
......@@ -60,7 +54,7 @@
make.right.equalTo(self.contentView.mas_right).offset(-15 * k6Scale);
make.width.mas_equalTo(5.5 * k6Scale);
make.height.mas_equalTo(11 * k6Scale);
}];
UILabel *checkAll = [[UILabel alloc] init];
checkAll.textColor = kRGBColor(119, 119, 119, 1);
......@@ -71,19 +65,19 @@
make.centerY.equalTo(arrow.mas_centerY);
make.right.equalTo(arrow.mas_left).offset(-3 * k6Scale);
}];
self.noticeView = [[GYRollingNoticeView alloc]init];
self.noticeView.dataSource = self;
self.noticeView.delegate = self;
[self.contentView addSubview:self.noticeView];
self.noticeView.backgroundColor = [UIColor whiteColor];
[self.noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(line.mas_right).offset(8 * k6Scale);
make.left.equalTo(adLsabel.mas_right).offset(8 * k6Scale);
make.right.equalTo(checkAll.mas_left).offset(-8 * k6Scale);
make.top.equalTo(self.contentView.mas_top).offset(2);
make.top.equalTo(self.contentView.mas_top).offset(4);
make.bottom.equalTo(self.contentView.mas_bottom).offset(-2);
}];
UIView *con = [UIView new];
con.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:con];
......@@ -99,13 +93,24 @@
self.checkAll(jump);
}
}];
self.notPayView = [[UIView alloc] init];
self.notPayView.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.notPayView];
[self.notPayView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(adLsabel.mas_right);
make.right.equalTo(self.contentView.mas_right);
make.centerY.equalTo(self.contentView);
make.height.mas_equalTo(0);
}];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
......@@ -117,12 +122,12 @@
- (NSInteger)numberOfRowsForRollingNoticeView:(GYRollingNoticeView *)rollingView
{
return self.items.count;
}
- (__kindof GYNoticeViewCell *)rollingNoticeView:(GYRollingNoticeView *)rollingView cellAtIndex:(NSUInteger)index
{
PublicScollCell *cell = [rollingView dequeueReusableCellWithIdentifier:@"PublicScollCell"];
if (cell == nil) {
cell = [[PublicScollCell alloc] initWithReuseIdentifier:@"PublicScollCell"];
......@@ -132,7 +137,7 @@
}
- (void)didClickRollingNoticeView:(GYRollingNoticeView *)rollingView forIndex:(NSUInteger)index
{
ZXInformation *info = self.items[index];
if (self.clickAction) {
self.clickAction(info);
......@@ -143,5 +148,113 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.noticeView reloadDataAndStartRoll];
});
[self createNotPayOrderView:self.notPayView];
}
-(void) createNotPayOrderView:(UIView *) v {
if (self.section.isShowMask) {
return;
}
v.hidden = NO;
self.section.isShowMask = YES;
if ([ZXNotPay findAll].count) {
ZXNotPay *order = [ZXNotPay findAll].lastObject;
[self createNotPayViewBySuperView:v orderDetail:order.orderId alertStr:order.orderTitle];
return;
}
//请求未支付订单数据
NSString *url = [NSString stringWithFormat:@"%@/consumeOrder/getUnpaidOrder?customerId=%@", [kUserDefaults objectForKey:@"NEW_PAY"], CacheUserId];
[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) {
[ZXNotPay clearTable];
if ([responseObject[@"orderId"] isKindOfClass:[NSNull class]]) {
return ;
}
NSString *order = responseObject[@"title"];
NSInteger orderId = [responseObject[@"orderId"] integerValue];
if (order && ![order isKindOfClass:[NSNull class]]) {
dispatch_async(dispatch_get_main_queue(), ^{
ZXNotPay *p = [[ZXNotPay alloc] init];
p.orderId = orderId;
p.userId = CacheUserId;
p.orderTitle = order;
[p save];
[self createNotPayViewBySuperView:v orderDetail:orderId alertStr:order];
});
}
}
} onFailure:^(NSError *error) {
} onFinished:^(id responseObject, NSError *error) {
}];
}
- (void) createNotPayViewBySuperView:(UIView *) superView orderDetail:(NSInteger) orderId alertStr:(NSString *) alertStr {
for (UIView *v in superView.subviews) {
[v removeFromSuperview];
}
[superView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(38);
}];
[ZXPayManager sharedZXPayManager].orderId = orderId;
UIView *backView = [[UIView alloc] init];
[superView addSubview:backView];
backView.backgroundColor = RGB(255, 186, 112);
backView.alpha = 0.9;
[backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(superView).insets(UIEdgeInsetsMake(5 * k6Scale, kCellContentLeftMargin * k6Scale, 5 * k6Scale,kCellContentLeftMargin * k6Scale));
}];
kViewRadius(backView, 5);
UIImageView *iconImageView = [[UIImageView alloc] init];
[backView addSubview:iconImageView];
iconImageView.image = [UIImage imageNamed:@"home_tishi_icon"];
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(backView.mas_left).offset(10 * k6Scale);
make.width.height.mas_equalTo(15 * k6Scale);
make.centerY.equalTo(backView);
}];
UILabel *desc = [[UILabel alloc] init];
[backView addSubview:desc];
desc.font = kFontSize(12 * k6Scale);
desc.textColor = [UIColor whiteColor];
desc.text = alertStr?alertStr:@"您有一个待支付订单,请立即支付!";
[desc mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(iconImageView.mas_right).offset(10 * k6Scale);
make.centerY.equalTo(backView);
}];
enlargeClickRegionBtn *closeBtn = [[enlargeClickRegionBtn alloc] init];
[backView addSubview:closeBtn];
[closeBtn setImage:[UIImage imageNamed:@"home_guanbi_icon"] forState:UIControlStateNormal];
[[closeBtn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
[superView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(0);
}];
}];
[closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(backView.mas_right).offset(-10 * k6Scale);
make.width.height.mas_equalTo(20 * k6Scale);
make.centerY.equalTo(backView);
}];
//收起
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
[superView addGestureRecognizer:tap];
[[tap rac_gestureSignal] subscribeNext:^(id x) {
ZXOrderPayController *jumpPay = [[ZXOrderPayController alloc] init];
jumpPay.orderId = [ZXPayManager sharedZXPayManager].orderId;
kWeakSelf(superView);
jumpPay.paySuccess = ^{
kStrongSelf(superView);
superView.hidden = YES;
};
[[ZXTool getCurrentVC].navigationController pushViewController:jumpPay animated:YES];
}];
}
@end
//
//
......@@ -87,13 +87,18 @@
self.userCenterItem.campusName=@"请填写真实信息";
self.userCenterItem.schoolName=@"请填写真实信息";
self.userCenterItem.enterSchoolDate=@"请填写真实信息";
}
-(void)setViews{
[self loadData];
self.allSchoolModel=[FetchAllSchoolModel new];
self.saveModel=[SaveUserInfoModel new];
self.userCenterItem =[UserCenerModelItem new];
self.userCenterItem.username = [kUserDefaults objectForKey:@"username"];
self.userCenterItem.gender = [kUserDefaults objectForKey:@"gender"];
self.userCenterItem.studentNo = [kUserDefaults objectForKey:@"studentNo"];
self.userCenterItem.birthday = [kUserDefaults objectForKey:@"birthday"];
self.userCenterItem.enterSchoolDate = [kUserDefaults objectForKey:@"enterSchoolDate"];
[self registNotificationAndKVO];
_schoolArray = [[NSMutableArray alloc]init];
_allDataArray = [[NSArray alloc]init];
......@@ -153,9 +158,10 @@
self.saveSuccess();
}
else{
} else {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:@"服务器内部错误,请联系管路员处理!"];
});
}
}
......
//
//
......@@ -7,7 +7,6 @@
// 自助页面
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
@interface ZXSelfHelpViewController : UIViewController
//广告链接
......@@ -16,12 +15,13 @@
@property (nonatomic, copy) NSString *selfHelpTitle;
//自助类型
@property (nonatomic, copy) NSString *selfHelpType;
@property (nonatomic, strong) WKWebView *webView;
@property (nonatomic, copy) NSString *jsStr;
//模式 1.条码,2扫码,3 混合
@property (nonatomic, assign) NSInteger model;
//混合模式下的默认使用方式(1.条码,2扫码)
@property (nonatomic, assign) NSInteger defaultModel;
@property (nonatomic, copy) dispatch_block_t backAction;
@end
//
//
......@@ -11,78 +11,36 @@
#import "enlargeClickRegionBtn.h"
#import "ZXDrinkViewController.h"
#import "SDCycleScrollView.h"
@interface ZXSelfHelpViewController () {
//条码背景
UIImageView * codeBarbackGroundImage;
UIImageView * codeBarbackGroundImage1;
UIImageView * scaleBtnImageView;
UIImageView * scaleBtnImageView1;
UIButton * scaleBtn;
UIButton * scaleBtn1;
//是否是大的条码
BOOL isBigSizeCodeBar;
@interface ZXSelfHelpViewController () {
enlargeClickRegionBtn *showCode;
}
@property (strong, nonatomic) UIButton *changeBtn;
@property (nonatomic) UIView * functionView;//一维码视图
@property (nonatomic) UIView * functionView1;//一维码视图大
@property (nonatomic, strong) dispatch_source_t gcdTimer;
/**
刷新条码
*/
@property (strong, nonatomic) RefreshBarCodeModel * barCodeModel;
@property (nonatomic, assign) BOOL hiddenOrNo;//控制一维码的显示与否
/**
条码View
*/
@property (nonatomic, strong)UIImageView *codeImageView;
@property (nonatomic, strong)UIImageView *codeImageView1;
@property (nonatomic, strong) SDCycleScrollView *cycleScrollView;
@property (nonatomic, strong) UIView *fouvtionView;
@property (nonatomic, strong) UIImageView *barcodeView;
@end
@implementation ZXSelfHelpViewController
@synthesize functionView,functionView1,hiddenOrNo;
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
self.navigationController.navigationBar.hidden = NO;
CGFloat brite = [[kUserDefaults objectForKey:@"defaultBright"] floatValue];
[[UIScreen mainScreen] setBrightness:brite];
[self removeNotificationAndKVO];
// self.cycleScrollView = nil;
// self.barCodeModel = nil;
// functionView = nil;
// functionView1 = nil;
// self.changeBtn = nil;
// self.codeImageView = nil;
// self.codeImageView1 = nil;
// codeBarbackGroundImage = nil;
// codeBarbackGroundImage1 = nil;
// scaleBtnImageView = nil;
// scaleBtnImageView1 = nil;
// scaleBtn = nil;
// scaleBtn1 = nil;
// showCode = nil;
NSLog(@"已经清理所有的绑定");
// @try {
// for (NSString *str in self.indentifierList) {
// [self.webView.configuration.userContentController removeScriptMessageHandlerForName:str];
// }
// } @catch (NSException *exception) {
// [ZXTool saveException:exception];
// } @finally {
//
// }
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
......@@ -92,8 +50,10 @@
[kUserDefaults setObject:defaultBright forKey:@"defaultBright"];
[[UIScreen mainScreen] setBrightness:1];
[self registNotificationAndKVO];
[ZXTool showNotPayOrderMaskView:self];
if (self.gcdTimer == nil) {
[self createTimer];
}
}
- (void)dealloc {
NSLog(@"%s", __func__);
......@@ -103,88 +63,147 @@
self.view.backgroundColor = [UIColor whiteColor];
self.barCodeModel = [RefreshBarCodeModel new];
[self registNotificationAndKVO];
[self createNabar];
[self addFunctionView];
[self addFunctionView1];
[self createBarCodeView];
[self createBannerView];
[self createCodeView];
}
#pragma mark - ===================创建条码view==============================
- (void) createBarCodeView {
self.fouvtionView = [[UIView alloc] init];
[self.view addSubview:self.fouvtionView];
self.fouvtionView.backgroundColor = [UIColor whiteColor];
[self.fouvtionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.equalTo(self.view.mas_top).offset(kTopHeight);
make.height.mas_equalTo(150 * k6Scale);
}];
self.barcodeView = [[UIImageView alloc] init];
[self.fouvtionView addSubview:self.barcodeView];
[self.barcodeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.fouvtionView).insets(UIEdgeInsetsMake(18 * k6Scale, 26 * k6Scale, 38 * k6Scale, 26 * k6Scale));
}];
self.barcodeView.image = [self createBarCode:CacheidBar width:kScreenWidth - 52 * k6Scale height:94 * k6Scale];
UIView *holder = [[UIView alloc] init];
[self.fouvtionView addSubview:holder];
[holder mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.fouvtionView);
make.height.mas_equalTo(20 * k6Scale);
}];
holder.backgroundColor = [UIColor colorWithHexString:@"#ebebeb"];
enlargeClickRegionBtn *expanBtn = [[enlargeClickRegionBtn alloc] init];
[self.fouvtionView addSubview:expanBtn];
[expanBtn setImage:[UIImage imageNamed:@"icon_fangda"] forState:UIControlStateNormal];
[expanBtn setImage:[UIImage imageNamed:@"icon_suoxiao"] forState:UIControlStateSelected];
expanBtn.backgroundColor = [UIColor whiteColor];
expanBtn.layer.cornerRadius = 7 * k6Scale;
expanBtn.layer.masksToBounds = YES;
[expanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.fouvtionView);
make.width.mas_equalTo(68 * k6Scale);
make.height.mas_equalTo(25 * k6Scale);
make.bottom.equalTo(self.fouvtionView.mas_bottom).offset(-5 * k6Scale);
}];
@weakify(self);
[[expanBtn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(UIButton *x) {
@strongify(self);
x.selected = !x.selected;
//更新约束
[UIView animateWithDuration:1.5 animations:^{
[self.fouvtionView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(x.selected?218 * k6Scale:130 * k6Scale);
}];
}];
}];
UIImageView *refreshBtn = [[UIImageView alloc] init];
[self.fouvtionView addSubview:refreshBtn];
refreshBtn.userInteractionEnabled = YES;
refreshBtn.image = [UIImage imageNamed:@"pic_shuaxin"];
[refreshBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(expanBtn.mas_bottom).offset(10 * k6Scale);
make.height.mas_equalTo(35 * k6Scale);
make.width.mas_equalTo(70 * k6Scale);
make.right.equalTo(self.fouvtionView.mas_right).offset(-18 * k6Scale);
}];
UITapGestureRecognizer *refreshcode = [[UITapGestureRecognizer alloc] init];
[refreshBtn addGestureRecognizer:refreshcode];
[[refreshcode rac_gestureSignal] subscribeNext:^(id x) {
@strongify(self);
[self.barCodeModel refreshBarCode];
}];
}
#pragma mark - ========== 创建占位banner ==========
- (void) createBannerView {
NSArray *images = @[];
if ([self.selfHelpType isEqualToString:@"05"]) {
images = @[@"洗浴01", @"洗浴02"];
} else if ([self.selfHelpType isEqualToString:@"04"]) {
images = @[@"吹风01", @"吹风02"];
} else if ([self.selfHelpType isEqualToString:@"03"] || [self.selfHelpType isEqualToString:@"09"]) {
images = @[@"饮水01", @"饮水02"];
} else if ([self.selfHelpType isEqualToString:@"02"]) {
images = @[@"洗衣01", @"洗衣02"];
}
self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero shouldInfiniteLoop:YES imageNamesGroup:images];
self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
self.cycleScrollView.autoScrollTimeInterval = 3;
self.cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
[self.view addSubview:self.cycleScrollView];
[self.cycleScrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.fouvtionView.mas_bottom).offset(5 * k6Scale);
make.left.equalTo(self.view.mas_left).offset(5 * k6Scale);
make.right.equalTo(self.view.mas_right).offset(-5 * k6Scale);
make.height.mas_equalTo(250 * k6Scale);
}];
self.cycleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.cycleScrollView.hidden = YES;
if ([self.selfHelpType isEqualToString:@"05"] || [self.selfHelpType isEqualToString:@"04"] || [self.selfHelpType isEqualToString:@"03"] ||[self.selfHelpType isEqualToString:@"02"] ||[self.selfHelpType isEqualToString:@"09"]) {
NSArray *images = @[];
if ([self.selfHelpType isEqualToString:@"05"]) {
images = @[@"洗浴01", @"洗浴02"];
} else if ([self.selfHelpType isEqualToString:@"04"]) {
images = @[@"吹风01", @"吹风02"];
} else if ([self.selfHelpType isEqualToString:@"03"] || [self.selfHelpType isEqualToString:@"09"]) {
images = @[@"饮水01", @"饮水02"];
} else if ([self.selfHelpType isEqualToString:@"02"]) {
images = @[@"洗衣01", @"洗衣02"];
}
self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero shouldInfiniteLoop:YES imageNamesGroup:images];
self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
self.cycleScrollView.autoScrollTimeInterval = 3;
self.cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
[self.view addSubview:self.cycleScrollView];
[self.cycleScrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(functionView.mas_bottom).offset(5 * k6Scale);
make.left.equalTo(self.view.mas_left).offset(5 * k6Scale);
make.right.equalTo(self.view.mas_right).offset(-5 * k6Scale);
make.height.mas_equalTo(250 * k6Scale);
}];
self.cycleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.cycleScrollView.hidden = NO;
}
}
-(void)registNotificationAndKVO{
[_barCodeModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[_barCodeModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
}
-(void)removeNotificationAndKVO{
@try {
[_barCodeModel removeObserver:self forKeyPath:@"isLoaded"];
[_barCodeModel removeObserver:self forKeyPath:@"error"];
}@catch(NSException *ex) {
[ZXTool saveException:ex];
}@finally {
}
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if (object == _barCodeModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
self.codeImageView.image = [self createBarCode:CacheidBar width:self.codeImageView.frame.size.width height:self.codeImageView.frame.size.height];
self.codeImageView1.image = [self createBarCode:CacheidBar width:self.codeImageView1.frame.size.width height:self.codeImageView1.frame.size.height];
}
else{
self.barcodeView.image = [self createBarCode:CacheidBar width:self.barcodeView.frame.size.width height:self.barcodeView.frame.size.height];
}
}
}
#pragma mark - ========== 创建导航栏 ==========
- (void) createNabar {
......@@ -199,7 +218,7 @@
nabar.userInteractionEnabled = YES;
nabar.image = image;
[self.view addSubview:nabar];
UILabel *naTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, kScreenWidth, kNavBarHeight)];
naTitle.backgroundColor = [UIColor clearColor];
naTitle.textAlignment = NSTextAlignmentCenter;
......@@ -208,7 +227,7 @@
naTitle.userInteractionEnabled = YES;
[nabar addSubview:naTitle];
naTitle.text = self.selfHelpTitle;
UIView *vvv = [[UIView alloc] init];
[nabar addSubview:vvv];
vvv.backgroundColor = [UIColor whiteColor];
......@@ -216,7 +235,7 @@
make.top.equalTo(naTitle.mas_bottom);
make.left.right.bottom.equalTo(nabar);
}];
enlargeClickRegionBtn *back = [[enlargeClickRegionBtn alloc] init];
[back setImage:[UIImage imageNamed:@"nav_return"] forState:UIControlStateNormal];
[naTitle addSubview:back];
......@@ -231,122 +250,20 @@
[weakSelf.navigationController popToViewController:vc animated:YES];
}
}
if (self.backAction) {
self.backAction();
}
}];
}
#pragma mark - ========== 顶部条码view ==========
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
/*
添加功能视图
*/
-(void)addFunctionView
{
/*
功能背景
*/
functionView = [[UIView alloc]initWithFrame:CGRectMake(0, kTopHeight, kWidth, 130 * k6Scale)];
functionView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:functionView];
codeBarbackGroundImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 130 * k6Scale)];
codeBarbackGroundImage.userInteractionEnabled = YES;
codeBarbackGroundImage.image = [UIImage imageNamed:@"tiaoxingma-2"];
[functionView addSubview:codeBarbackGroundImage];
_codeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(26 * k6Scale, 13 * k6Scale , kWidth-52 * k6Scale, 130 * k6Scale - 36 * k6Scale)];
_codeImageView.userInteractionEnabled = YES;
_codeImageView.image = [UIImage imageNamed:@"replaceCodeImage"];
[functionView addSubview:_codeImageView];
enlargeClickRegionBtn * updateBtn = [[enlargeClickRegionBtn alloc]initWithFrame:CGRectMake(kWidth-23 * k6Scale, 0, 20 * k6Scale, 30 * k6Scale)];
[updateBtn setImage:[UIImage imageNamed:@"刷新icon"] forState:UIControlStateNormal];
[updateBtn addTarget:self action:@selector(updateStatusBarCode) forControlEvents:UIControlEventTouchUpInside];
[functionView addSubview:updateBtn];
scaleBtnImageView=[[UIImageView alloc]init];
scaleBtnImageView.image=[UIImage imageNamed:@"矩形-1941---Assistor"];
[functionView addSubview:scaleBtnImageView];
[scaleBtnImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(functionView.mas_right);
make.bottom.equalTo(functionView.mas_bottom);
make.width.mas_equalTo(40 * k6Scale);
make.height.mas_equalTo(20 * k6Scale);
}];
scaleBtn = [UIButton new];
[scaleBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
scaleBtn.titleLabel.font=[UIFont boldSystemFontOfSize:12 * k6Scale];
scaleBtn.contentEdgeInsets=UIEdgeInsetsMake(18 * k6Scale,46 * k6Scale,0,0);
[scaleBtn setTitle:@"放大" forState:UIControlStateNormal];
[scaleBtn addTarget:self action:@selector(scacleBtnClick) forControlEvents:UIControlEventTouchUpInside];
[functionView addSubview:scaleBtn];
[scaleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.equalTo(functionView);
make.width.mas_equalTo(80 * k6Scale);
make.height.mas_equalTo(40 * k6Scale);
}];
self.codeImageView.image = [self createBarCode:CacheidBar width:self.codeImageView.frame.size.width height:self.codeImageView.frame.size.height];
}
/*
添加功能视图
*/
-(void)addFunctionView1
{
/*
功能背景
*/
functionView1 = [[UIView alloc]initWithFrame:CGRectMake(0, -218 * k6Scale, kWidth, 218 * k6Scale)];
functionView1.backgroundColor = [UIColor whiteColor];
[self.view addSubview:functionView1];
codeBarbackGroundImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 218 * k6Scale)];
codeBarbackGroundImage1.userInteractionEnabled = YES;
codeBarbackGroundImage1.image = [UIImage imageNamed:@"tiaoxingma-2"];
[functionView1 addSubview:codeBarbackGroundImage1];
_codeImageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(13 * k6Scale, 13 * k6Scale , kWidth-26 * k6Scale, 180 * k6Scale)];
_codeImageView1.userInteractionEnabled = YES;
_codeImageView1.image = [UIImage imageNamed:@"replaceCodeImage"];
[functionView1 addSubview:_codeImageView1];
scaleBtnImageView1=[[UIImageView alloc]initWithFrame:CGRectMake(kWidth-60 * k6Scale, 0, 40 * k6Scale, 20 * k6Scale)];
scaleBtnImageView1.xmg_bottom=216 * k6Scale;
scaleBtnImageView1.xmg_x=kWidth-40 * k6Scale;
scaleBtnImageView1.xmg_width=40 * k6Scale;
scaleBtnImageView1.xmg_height=20 * k6Scale;
scaleBtnImageView1.image=[UIImage imageNamed:@"矩形-1941---Assistor"];
[functionView1 addSubview:scaleBtnImageView1];
scaleBtn1 = [enlargeClickRegionBtn new];
scaleBtn1.xmg_bottom=(218-42) * k6Scale;
scaleBtn1.xmg_x=kWidth-80 * k6Scale;
scaleBtn1.xmg_width=80 * k6Scale;
scaleBtn1.xmg_height=40 * k6Scale;
[scaleBtn1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
scaleBtn1.titleLabel.font=[UIFont boldSystemFontOfSize:12 * k6Scale];
scaleBtn1.contentEdgeInsets=UIEdgeInsetsMake(18 * k6Scale,46 * k6Scale,0,0);
[scaleBtn1 setTitle:@"缩小" forState:UIControlStateNormal];
[scaleBtn1 addTarget:self action:@selector(scacleBtnClick) forControlEvents:UIControlEventTouchUpInside];
[functionView1 addSubview:scaleBtn1];
self.codeImageView1.image = [self createBarCode:CacheidBar width:self.codeImageView.frame.size.width height:self.codeImageView1.frame.size.height];
}
- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
[self.view bringSubviewToFront:showCode];
......@@ -360,7 +277,7 @@
[showCode setBackgroundImage:[UIImage imageNamed:@"hide_barcode_icon"] forState:UIControlStateNormal];
[showCode mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.view.mas_right);
make.top.equalTo(functionView.mas_bottom).offset(20 * k6Scale);
make.top.equalTo(self.fouvtionView.mas_bottom).offset(20 * k6Scale);
}];
@weakify(self);
[[showCode rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
......@@ -376,73 +293,10 @@
[self.navigationController popViewControllerAnimated:YES];
}
}];
}
}
-(void)scacleBtnClick{
isBigSizeCodeBar=!isBigSizeCodeBar;
@weakify(self);
__weak typeof(functionView) weakfun = functionView;
__weak typeof(functionView1) weakfun1 = functionView1;
__weak typeof(showCode) weakshowCode = showCode;
if (isBigSizeCodeBar) {
[UIView animateWithDuration:1.0 animations:^{
@strongify(self);
CGRect frame= weakfun.frame;
frame.origin.y=-frame.size.height;
weakfun.frame=frame;
CGRect frame1= weakfun1.frame;
frame1.origin.y=kTopHeight;
weakfun1.frame=frame1;
// [self.webView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(functionView1.mas_bottom);
// make.left.right.bottom.equalTo(self.view);
// }];
[self.cycleScrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(weakfun1.mas_bottom).offset(5 * k6Scale);
make.left.equalTo(self.view.mas_left).offset(5 * k6Scale);
make.right.equalTo(self.view.mas_right).offset(-5 * k6Scale);
make.height.mas_equalTo(250 * k6Scale);
}];
[weakshowCode mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view.mas_top).offset(frame1.size.height + 20 * k6Scale + kTopHeight);
}];
} completion:^(BOOL finished) {
}];
}else{
[UIView animateWithDuration:1.0 animations:^{
@strongify(self);
CGRect frame= weakfun.frame;
frame.origin.y=kTopHeight;
weakfun.frame=frame;
CGRect frame1= weakfun1.frame;
frame1.origin.y=-frame1.size.height;
weakfun1.frame=frame1;
// [self.webView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(functionView.mas_bottom);
// make.left.right.bottom.equalTo(self.view);
// }];
[self.cycleScrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(weakfun.mas_bottom).offset(5 * k6Scale);
make.left.equalTo(self.view.mas_left).offset(5 * k6Scale);
make.right.equalTo(self.view.mas_right).offset(-5 * k6Scale);
make.height.mas_equalTo(250 * k6Scale);
}];
[weakshowCode mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view.mas_top).offset(frame.size.height + 20 * k6Scale + kTopHeight);
}];
} completion:^(BOOL finished) {
}];
}
}
-(void)updateStatusBarCode
{//网络访问
[self.barCodeModel refreshBarCode];
......@@ -463,32 +317,41 @@
NSString *refreshCode = [[code substringToIndex:code.length-2] stringByAppendingString:self.selfHelpType];
// 生成条形码图片
CIImage *barcodeImage;
NSData *data = [refreshCode dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:false];
CIFilter *filter = [CIFilter filterWithName:@"CICode128BarcodeGenerator"];
[filter setValue:data forKey:@"inputMessage"];
[filter setValue:[NSNumber numberWithInteger:0] forKey:@"inputQuietSpace"];
barcodeImage = [filter outputImage];
// 消除模糊
CGFloat scaleX = width / barcodeImage.extent.size.width; // extent 返回图片的frame
CGFloat scaleY = height / barcodeImage.extent.size.height;
CIImage *transformedImage = [barcodeImage imageByApplyingTransform:CGAffineTransformScale(CGAffineTransformIdentity, scaleX, scaleY)];
return [UIImage imageWithCIImage:transformedImage];
}
#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, 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];
});
});
// 启动任务,GCD计时器创建后需要手动启动
dispatch_resume(self.gcdTimer);
}
......
//
//
......@@ -23,6 +23,7 @@
@property (nonatomic, strong) UIImageView *adImageView;
@property (nonatomic, strong) UIButton *startDrink;
@property (nonatomic, strong) ZXDrinkMerthinModel *currentMerthin;
@property (nonatomic, strong) dispatch_source_t gcdTimer;
@end
@implementation ZXDrinkViewController
......@@ -270,7 +271,14 @@
self.currentMerthin = m;
}];
[ZXTool showNotPayOrderMaskView:self];
if (self.gcdTimer == nil) {
[self createTimer];
}
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
dispatch_cancel(self.gcdTimer);
self.gcdTimer = nil;
}
#pragma mark - ========== UITableView/Delegate/Datasource ==========
- (UITableView *)myTableView {
......@@ -426,4 +434,16 @@
// }
// return _adImageView;
//}
#pragma mark - 创建定时器 10s一次请求当前是否有未支付订单
- (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];
});
});
// 启动任务,GCD计时器创建后需要手动启动
dispatch_resume(self.gcdTimer);
}
@end
//
//
......@@ -702,7 +702,7 @@ static NSInteger seq = 0;
//当没得校区的时候就判定为个人信息没有完善
NSLog(@"====%@",CacheCampusId);
if ([CacheCampusId isEqualToString:@""]){
if ([CacheCampusId isEqualToString:@""] || [CacheCampusId isEqualToString:@"0"]){
_infoView = [[PerfectInformation alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
__weak typeof (self) weakSelf=self;
......
//
//
......@@ -902,8 +902,8 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
make.height.mas_equalTo(0 * k6Scale);
make.bottom.equalTo(superView.mas_bottom).offset(-bottomMargin);
}];
[ZXPayManager sharedZXPayManager].notPayOrderView = notPayView;
[self createNotPayOrderView:notPayView];//创建广告view
// [ZXPayManager sharedZXPayManager].notPayOrderView = notPayView;
// [self createNotPayOrderView:notPayView];//创建广告view
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
@weakify(self);
......@@ -1027,34 +1027,40 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
}
#pragma mark - ========== 首页下拉刷新显示未支付订单 ==========
+(void) firstPageRefreshAddNotPayView:(UIView *) v {
if ([ZXPayManager sharedZXPayManager].notPayOrderView == nil) {
UIView *notPayView;
CGFloat bottomMargin = 49;
if (iPhoneX) {
bottomMargin = 83;
}
notPayView = [[UIView alloc] init];
notPayView.backgroundColor = [UIColor whiteColor];
[v addSubview:notPayView];
[notPayView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(v);
make.height.mas_equalTo(0 * k6Scale);
make.bottom.equalTo(v.mas_bottom).offset(-bottomMargin);
}];
[ZXPayManager sharedZXPayManager].notPayOrderView = notPayView;
[self createNotPayOrderView:notPayView];//创建广告view
}
if ([ZXNotPay findByCriteria:[NSString stringWithFormat:@"where userId = '%@'", CacheUserId]].count) {
ZXNotPay *m = [ZXNotPay findByCriteria:[NSString stringWithFormat:@"where userId = '%@'", CacheUserId]].lastObject;
[ZXPayManager sharedZXPayManager].orderId = m.orderId;
dispatch_async(dispatch_get_main_queue(), ^{
[[ZXPayManager sharedZXPayManager].notPayOrderView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(50);
}];
});
} else {
[self createNotPayOrderView:[ZXPayManager sharedZXPayManager].notPayOrderView];
}
//暂时注释掉
// if ([ZXPayManager sharedZXPayManager].notPayOrderView == nil) {
// UIView *notPayView;
// CGFloat bottomMargin = 49;
// if (iPhoneX) {
// bottomMargin = 83;
// }
// notPayView = [[UIView alloc] init];
// notPayView.backgroundColor = [UIColor whiteColor];
// [v addSubview:notPayView];
// [notPayView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.equalTo(v);
// make.height.mas_equalTo(0 * k6Scale);
// make.bottom.equalTo(v.mas_bottom).offset(-bottomMargin);
// }];
// [ZXPayManager sharedZXPayManager].notPayOrderView = notPayView;
// [self createNotPayOrderView:notPayView];//创建广告view
// }
// if ([ZXNotPay findByCriteria:[NSString stringWithFormat:@"where userId = '%@'", CacheUserId]].count) {
// ZXNotPay *m = [ZXNotPay findByCriteria:[NSString stringWithFormat:@"where userId = '%@'", CacheUserId]].lastObject;
// [ZXPayManager sharedZXPayManager].orderId = m.orderId;
// if ([ZXPayManager sharedZXPayManager].notPayOrderView.subviews.count) {
// dispatch_async(dispatch_get_main_queue(), ^{
// [[ZXPayManager sharedZXPayManager].notPayOrderView mas_updateConstraints:^(MASConstraintMaker *make) {
// make.height.mas_equalTo(50);
// }];
// });
// } else {
// [self createNotPayOrderView:[ZXPayManager sharedZXPayManager].notPayOrderView];
// }
// } else {
// [self createNotPayOrderView:[ZXPayManager sharedZXPayManager].notPayOrderView];
// }
}
......@@ -1080,6 +1086,7 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
ZXNotPay *p = [[ZXNotPay alloc] init];
p.orderId = orderId;
p.userId = CacheUserId;
p.orderTitle = order;
[p save];
[self createNotPayViewBySuperView:v orderDetail:orderId alertStr:order];
});
......@@ -1103,7 +1110,7 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
[backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(superView).insets(UIEdgeInsetsMake(5 * k6Scale, kCellContentLeftMargin * k6Scale, 5 * k6Scale,kCellContentLeftMargin * k6Scale));
}];
kViewRadius(backView, 4);
kViewRadius(backView, 5);
UIImageView *iconImageView = [[UIImageView alloc] init];
[backView addSubview:iconImageView];
iconImageView.image = [UIImage imageNamed:@"home_tishi_icon"];
......
//
//
......@@ -203,7 +203,7 @@
NSArray *controllers = self.navigationController.childViewControllers;
NSArray *res = [[controllers reverseObjectEnumerator] allObjects];
for (UIViewController *vc in res) {
if ([vc isKindOfClass:NSClassFromString(@"ZTHomeViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXRSNewViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXSimpleHomeController")] || [vc isKindOfClass:NSClassFromString(@"ZXNewPayOrderListViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXSelfHelpViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXDrinkViewController")]) {
if ([vc isKindOfClass:NSClassFromString(@"ZTHomeViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXRSNewViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXSimpleHomeController")] || [vc isKindOfClass:NSClassFromString(@"ZXNewPayOrderListViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXSelfHelpViewController")] || [vc isKindOfClass:NSClassFromString(@"ZXDrinkViewController")]|| [vc isKindOfClass:NSClassFromString(@"UserSettingViewController")]) {
[self.navigationController popToViewController:vc animated:YES];
}
}
......
//
//
......@@ -59,9 +59,17 @@
[ZXNewPayLessMoneyModel saveObjects:accounts];
if (dic && dic[@"paymentAndActiveInfos"]) {
[self.payTypes removeAllObjects];
NSInteger defaultPayType = -1;//默认为-1
if (responseObject[@"defaultPayType"]) {
defaultPayType = [responseObject[@"defaultPayType"] integerValue];
}
NSArray *arr = [ZXNewPayTypeModel mj_objectArrayWithKeyValuesArray:dic[@"paymentAndActiveInfos"]];
for (ZXNewPayTypeModel *ty in arr) {
ty.payableMoney = self.order.payableMoney;
if (([ty.payType integerValue] == defaultPayType)) {
ty.isSelect = YES;
self.currentPayType = ty;
}
if ([ty.payType isEqualToString:@"6"]) {
ty.sortIndex = 1;
} else if ([ty.payType isEqualToString:@"7"]) {
......
//
//
......@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface ZXNotPay : JKDBModel
@property (nonatomic, copy) NSString *userId;
@property (nonatomic, assign) NSInteger orderId;
@property (nonatomic, copy) NSString *orderTitle;
@end
NS_ASSUME_NONNULL_END
{
"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" : "icon_fangda.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "icon_fangda@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "icon_fangda@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_suoxiao.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "icon_suoxiao@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "icon_suoxiao@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "pic_shuaxin.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "pic_shuaxin@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "pic_shuaxin@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