Commit 3bb2a0a6 by 刘卓鑫

提交部分代码(蓝牙洗衣)

parent eaa1aa70
......@@ -20,11 +20,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/Tool(工具)/ZXTool.m"
timestampString = "588735277.853282"
timestampString = "589276473.6948169"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1765"
endingLineNumber = "1765">
startingLineNumber = "1708"
endingLineNumber = "1708">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
......@@ -75,5 +75,53 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../../Desktop/ss/ss/View/DC_ZXWashOrderPayCell.m"
timestampString = "589276473.695222"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "110"
endingLineNumber = "110"
landmarkName = "-setOrder:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../../Desktop/ss/ss/View/DC_ZXWashOrderPayCell.m"
timestampString = "589276473.695297"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "94"
endingLineNumber = "94"
landmarkName = "-setOrder:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../../Desktop/ss/ss/View/DC_ZXWashOrderPayCell.m"
timestampString = "589276473.695364"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "88"
endingLineNumber = "88"
landmarkName = "-setOrder:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
......@@ -15,7 +15,7 @@
#import "ViewController.h"
#import "UIView+ABExtras.h"
#import "JDPAuthSDK.h"
#import "ZXHomePageFeedBackViewController.h"
#import "YWPrintViewController.h"
#import "XMGFileTool.h"
#import "FTUploader.h"
......@@ -80,11 +80,11 @@
//版本检测
[self checkVersion];
// YYFPSLabel *fps = [[YYFPSLabel alloc] initWithFrame:CGRectMake(kScreenWidth - 150, kScreenHeight - 100, 100, 30)];
// [kAppWindow addSubview:fps];
YYFPSLabel *fps = [[YYFPSLabel alloc] initWithFrame:CGRectMake(kScreenWidth - 150, kScreenHeight - 100, 100, 30)];
[kAppWindow addSubview:fps];
//默认配置
[self defaultLauchConfigAndIsOpenPreventCrashManager:YES];
[self defaultLauchConfigAndIsOpenPreventCrashManager:NO];
//防止蓝牙洗浴后台运行被系统中断
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:20 target:self selector:@selector(ccc) userInfo:nil repeats:YES];
......@@ -192,6 +192,7 @@
} @finally {
}
}
......@@ -233,7 +234,7 @@
- (BOOL) yingwaPrintWithUrl:(NSURL *) url {
[ZXTool showUploadingAnimation];
NSString *tel = [ZXTool getValueFromKey:@"account"];
NSString *tel = CacheAccount;
if (tel == nil) {
[ZXTool showText:@"请先登录多彩校园!"];
[ZXTool hideUploadingAnimation];
......@@ -472,12 +473,17 @@
#pragma mark - 点击推送 跳转未支付订单
#pragma mark - 点击推送 跳转 反馈/未支付订单
- (void) jumpNotPayView:(NSDictionary *) userInfo {
if (userInfo[@"CODE"] == nil || [userInfo[@"CODE"] isKindOfClass:[NSNull class]]) {
return;
}
if ([userInfo[@"CODE"] integerValue] == 997) {
if ([userInfo[@"CODE"] integerValue] == 996){
ZXHomePageFeedBackViewController *feedVc = [[ZXHomePageFeedBackViewController alloc] init];
[[ZXTool getCurrentVC].navigationController pushViewController:feedVc animated:YES];
} else if ([userInfo[@"CODE"] integerValue] == 997) {
//请求未支付订单数据
NSString *url = [NSString stringWithFormat:@"%@/consumeOrder/getUnpaidOrder?customerId=%@", [kUserDefaults objectForKey:@"NEW_PAY"], CacheUserId];
[XMCenter sendRequest:^(XMRequest *request) {
......
//
//
......@@ -46,7 +46,7 @@ kSINGLETON_FOR_CLASS(APIManager)
[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.33:8990" forKey:@"NEW_PAY"];
// [userDefaults setObject:@"http://192.168.1.173:9095" forKey:@"SX_MONEY"];
[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 setObject:@"http://192.168.3.55:8888" forKey:@"BATH"];
......@@ -55,7 +55,7 @@ kSINGLETON_FOR_CLASS(APIManager)
// [userDefaults setObject:@"http://192.168.3.57:8880" forKey:@"AppointBATH"];
[userDefaults setObject:@"http://ex-dev-dcxy-home-app.168cad.top" forKey:@"HomePage"];
[userDefaults setObject:@"http://ex-dev-other-device-app.168cad.top" forKey:@"DCWash"];
[userDefaults synchronize];
break;
}
......@@ -87,6 +87,7 @@ kSINGLETON_FOR_CLASS(APIManager)
[userDefaults setObject:@"http://in-test-shower-app-server.168cad.top" forKey:@"BATH"];
[userDefaults setObject:@"http://in-test-shower-app-server.168cad.top" forKey:@"AppointBATH"];
[userDefaults setObject:@"http://ex-test-dcxy-home-app.168cad.top" forKey:@"HomePage"];
[userDefaults setObject:@"http://ex-test-other-device-app.168cad.top" forKey:@"DCWash"];
[userDefaults synchronize];
break;
}
......@@ -125,6 +126,9 @@ kSINGLETON_FOR_CLASS(APIManager)
[userDefaults setObject:@"http://shower-app-server.dcrym.com" forKey:@"AppointBATH"];
[userDefaults setObject:@"http://dcxy-home-app.dcrym.com" forKey:@"HomePage"];
[userDefaults setObject:@"http://ex-dev-other-device-app.168cad.top" forKey:@"DCWash"];
[userDefaults synchronize];
break;
}
......
//
//
......@@ -114,6 +114,7 @@
{
[SVProgressHUD dismiss];
[self popViewControllerAnimated:YES];
}
@end
//
//
......@@ -8,7 +8,7 @@
#import "ZXNewsViewController.h"
#import <WebKit/WebKit.h>
@interface ZXNewsViewController ()
@interface ZXNewsViewController ()<WKUIDelegate, WKNavigationDelegate>
@property (strong, nonatomic) UIProgressView *progressView;
@property (nonatomic, strong) WKWebView *webView;
@end
......@@ -20,6 +20,8 @@
self.title = self.titleStr;
self.webView = [[WKWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.view addSubview:self.webView];
self.webView.UIDelegate = self;
self.webView.navigationDelegate = self;
[self.webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ZXTool URLEncoded:self.jumpUrl]]]];
if (self.titleStr == nil) {
......@@ -60,8 +62,70 @@
self.title = self.webView.title;
}
}
#pragma mark 这个代理方法表示当客户端收到服务器的响应头,根据 response 相关信息,可以决定这次跳转是否可以继续进行。在发送请求之前,决定是否跳转,如果不添加这个,那么 wkwebview 跳转不了 AppStore 和 打电话
- (void)webView:(WKWebView *)webView detagidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
NSURL *url = navigationAction.request.URL;
//NSString *url_scheme = url.scheme;
// APPStore
if ([url.absoluteString containsString:@"itunes.apple.com"])
{
[[UIApplication sharedApplication] openURL:navigationAction.request.URL];
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
// 调用电话
if ([url.scheme isEqualToString:@"tel"])
{
if ([kApplication canOpenURL:url])
{
[kApplication openURL:url];
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
}
if ([url.scheme isEqualToString:@"openapp.jdmobile"]) {
if ([kApplication canOpenURL:url])
{
[kApplication openURL:url];
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
}
if ([url isKindOfClass:[NSURL class]])
{
if (!navigationAction.targetFrame)
{
[self.webView loadRequest:[NSURLRequest requestWithURL:url]];
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
}
else if ([kApplication canOpenURL:url])
{
[kApplication openURL:url];
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
decisionHandler(WKNavigationActionPolicyAllow);
}
#pragma mark - 在响应完成时,调用的方法。如果设置为不允许响应,web内 容就不会传过来
- (void)webView:(WKWebView *)webView detagidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler
{
decisionHandler(WKNavigationResponsePolicyAllow);
}
-(WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
{
NSLog(@"createWebViewWithConfiguration");
if (!navigationAction.targetFrame.isMainFrame) {
[webView loadRequest:navigationAction.request];
}
return nil;
}
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
......
//
//
......@@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface ZXHomePageFeedBackViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
//
//
......@@ -15,6 +15,7 @@
#import "ZXTextView.h"
#import "enlargeClickRegionBtn.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
#import "XMGNavigationViewController.h"
@interface ZXHomePageFeedBackViewController ()<UITableViewDataSource, UITableViewDelegate, UITextViewDelegate>
@property (nonatomic, strong) UITableView *myTableView;
@property (nonatomic, strong) ZXTextView *field;
......@@ -42,22 +43,54 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.title = @"意见反馈";
self.lastId = @"";
self.pageNum = 1;
[self createNabar];
[self.view addSubview:self.myTableView];
[self createMessageInput];
[self.myTableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self.view);
make.left.right.equalTo(self.view);
make.top.equalTo(self.view.mas_top).offset(kTopHeight);
make.bottom.equalTo(self.footer.mas_top);
}];
[self loadNewData];
// 键盘出现的通知
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardWillShowNotification object:nil];
//// // 键盘消失的通知
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillBeHiden:) name:UIKeyboardWillHideNotification object:nil];
}
- (void) createNabar {
self.view.backgroundColor = [UIColor whiteColor];
UIView *nabar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kTopHeight)];
nabar.layer.contents = (__bridge id _Nullable)(kToppicBgImage.CGImage);
[self.view addSubview:nabar];
UILabel *naTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, kScreenWidth, kNavBarHeight)];
naTitle.backgroundColor = [UIColor clearColor];
naTitle.textAlignment = NSTextAlignmentCenter;
naTitle.textColor = [UIColor whiteColor];
naTitle.font = [UIFont boldSystemFontOfSize:16 * k6Scale];
naTitle.userInteractionEnabled = YES;
[nabar addSubview:naTitle];
naTitle.text = @"意见反馈";
enlargeClickRegionBtn *back = [[enlargeClickRegionBtn alloc] init];
[back setImage:[UIImage imageNamed:@"return---Assistor"] forState:UIControlStateNormal];
[naTitle addSubview:back];
[back mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(naTitle.mas_left).offset(10 * k6Scale);
make.width.height.mas_equalTo(22 * k6Scale);
make.centerY.equalTo(naTitle);
}];
@weakify(self);
[[back rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
[self.navigationController popToRootViewControllerAnimated:YES];
}];
}
//- (void) keyboardWasShown:(NSNotification *) notifi {
// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:([self.myTableView numberOfRowsInSection:0]-1) inSection:0];
// UITableViewCell *cell = [self.myTableView cellForRowAtIndexPath:indexPath];
......@@ -234,8 +267,9 @@
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBar.hidden = NO;
self.navigationController.navigationBar.hidden = YES;
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
......@@ -396,4 +430,5 @@
}
@end
//
//
......@@ -14,7 +14,6 @@
#import "UIView+NineLayoutView.h"
#import "AimiWalletViewController.h"
#import "ZXSettingViewController.h"
#import "FeedBackView.h"
#import "AboutUs.h"
#import "ZXMePageCollectionViewCell.h"
#import "ZXMePageMenuModel.h"
......@@ -59,9 +58,9 @@
if (_dataSource == nil) {
NSArray *datas;
if ([UserManager sharedUserManager].user.isShowOrder) {
datas = @[@{@"title":@"校园生活卡", @"index":@(0), @"image":@"ic_xiaoyuanka"},@{@"title":@"我的订单", @"index":@(1),@"image":@"ic_dingdan"},@{@"title":@"意见反馈", @"index":@(2), @"image":@"ic_fankui", @"hasNewReply":@(NO)},@{@"title":@"个人设置", @"index":@(3),@"image":@"ic_setting"},@{@"title":@"关于多彩", @"index":@(4),@"image":@"ic_duocai"}];
datas = @[@{@"title":@"校园艾米卡", @"index":@(0), @"image":@"ic_xiaoyuanka"},@{@"title":@"我的订单", @"index":@(1),@"image":@"ic_dingdan"},@{@"title":@"意见反馈", @"index":@(2), @"image":@"ic_fankui", @"hasNewReply":@(NO)},@{@"title":@"个人设置", @"index":@(3),@"image":@"ic_setting"},@{@"title":@"关于多彩", @"index":@(4),@"image":@"ic_duocai"}];
} else {
datas = @[@{@"title":@"校园生活卡", @"index":@(0), @"image":@"ic_xiaoyuanka"},@{@"title":@"意见反馈", @"index":@(2), @"image":@"ic_fankui", @"hasNewReply":@(NO)},@{@"title":@"个人设置", @"index":@(3),@"image":@"ic_setting"},@{@"title":@"关于多彩", @"index":@(4),@"image":@"ic_duocai"}];
datas = @[@{@"title":@"校园艾米卡", @"index":@(0), @"image":@"ic_xiaoyuanka"},@{@"title":@"意见反馈", @"index":@(2), @"image":@"ic_fankui", @"hasNewReply":@(NO)},@{@"title":@"个人设置", @"index":@(3),@"image":@"ic_setting"},@{@"title":@"关于多彩", @"index":@(4),@"image":@"ic_duocai"}];
}
_dataSource = [[NSMutableArray alloc] init];
[_dataSource addObjectsFromArray:[ZXMePageMenuModel mj_objectArrayWithKeyValuesArray:datas]];
......@@ -240,22 +239,9 @@
[ZXTool showText:@"网络不可用,请检查网络设置重试~"];
return;
}
@weakify(self);
[ZXTool checkCurrentUserModeCompleted:^(BOOL isOld) {
@strongify(self);
dispatch_async(dispatch_get_main_queue(), ^{
if (isOld) {
FeedBackView * VC=[FeedBackView new];
VC.hidesBottomBarWhenPushed=YES;
[self.navigationController pushViewController:VC animated:YES];
} else {
UIViewController * VC=[[NSClassFromString(@"ZXHomePageFeedBackViewController") alloc] init];
VC.hidesBottomBarWhenPushed=YES;
[self.navigationController pushViewController:VC animated:YES];
}
});
}];
}
......
//
//
......@@ -86,11 +86,20 @@
/*强更*/
[self udateAppVersion];
//完成支付的通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(payCompleted) name:kOrder_Completed_Pay object:nil];
//收到修改了用户信息的通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeUserNameAction:) name:@"changeUserNameNotification" object:nil];
// //测试按钮
// UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, kScreenHeight - 100, 80, 80)];
// [self.view addSubview:btn];
// btn.backgroundColor = [UIColor orangeColor];
// [[btn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
// UIViewController *vc = [[NSClassFromString(@"DC_ZXWashTabbarViewController") alloc] init];
// vc.hidesBottomBarWhenPushed = YES;
// [self.navigationController pushViewController:vc animated:YES];
// }];
}
- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
......@@ -464,6 +473,7 @@
#pragma mark - 强更
- (void) udateAppVersion {
[self.service checkVersionCompleted:^(AppUpdateVersion *version) {
dispatch_async(dispatch_get_main_queue(), ^{
ZXHomePageUpdateAppView *v = [[ZXHomePageUpdateAppView alloc] initWithUpdateModel:version];
v.frame = [UIScreen mainScreen].bounds;
......
//
//
......@@ -62,6 +62,14 @@
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
[ZXTool hideLoadingAnimation];
}
-(WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
{
NSLog(@"createWebViewWithConfiguration");
if (!navigationAction.targetFrame.isMainFrame) {
[webView loadRequest:navigationAction.request];
}
return nil;
}
#pragma mark 这个代理方法表示当客户端收到服务器的响应头,根据 response 相关信息,可以决定这次跳转是否可以继续进行。在发送请求之前,决定是否跳转,如果不添加这个,那么 wkwebview 跳转不了 AppStore 和 打电话
- (void)webView:(WKWebView *)webView detagidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
......
//
//
......@@ -11,7 +11,8 @@
NS_ASSUME_NONNULL_BEGIN
@interface ZXAimiWalletAlertView : UIView
/** */
@property (nonatomic, copy) NSString *alertDesc;
@end
NS_ASSUME_NONNULL_END
//
//
......@@ -67,5 +67,8 @@
return self;
}
- (void)setAlertDesc:(NSString *)alertDesc {
_alertDesc = alertDesc;
self.contentLabel.text = _alertDesc;
}
@end
//
//
......@@ -93,8 +93,6 @@
if (model.isForce) {
//退出程序
exit(0);
// [ZXTool showText:@"正在退出登录,请稍后"];
// [ZXTool backToLoginAndOperationInterface];
} else {
self.hidden = YES;
[self removeFromSuperview];
......@@ -112,17 +110,17 @@
make.top.equalTo(bottomLine.mas_bottom);
}];
[[rightBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
@strongify(self);
dispatch_async(dispatch_get_main_queue(), ^{
self.hidden = YES;
[self removeFromSuperview];
// self.hidden = YES;
// [self removeFromSuperview];
NSString * str= [model.downloadUrl stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString * url = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:url]];
});
}];
}
return self;
}
......
//
//
......@@ -45,7 +45,14 @@
[ZXTool hideLoadingAnimation];
self.title = self.webView.title;
}
-(WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
{
NSLog(@"createWebViewWithConfiguration");
if (!navigationAction.targetFrame.isMainFrame) {
[webView loadRequest:navigationAction.request];
}
return nil;
}
#pragma mark - ========== 加载失败 ==========
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
[ZXTool hideLoadingAnimation];
......
//
//
......@@ -26,6 +26,10 @@
@property (nonatomic, strong) id rspCode;
@property (nonatomic, strong) id accounts;
@property (nonatomic, strong) id defaultPayType;
// 推送开关
@property (nonatomic, assign) BOOL pushSwitch;
/** 推送开关描述 */
@property (nonatomic, copy) NSString *des;
......
//
//
......@@ -74,9 +74,7 @@ NSString * const CloceClickNotification=@"CloceClickNotification";
// 完成回调
weakSelf.completionCallBack(stringValue);
}];
__weak typeof(scanner) weakScanner = scanner;
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"reStartScan" object:nil] subscribeNext:^(id x) {
// [weakScanner startScan];
[weakSelf.navigationController popToRootViewControllerAnimated:YES];
}];
}
......
//
//
......@@ -18,11 +18,9 @@
- (void)viewDidLoad {
[super viewDidLoad];
[UIApplication sharedApplication].statusBarHidden = NO;
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
UIImageView *nabar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kNavBarHeight + kStatusBarHeight)];
nabar.userInteractionEnabled = YES;
nabar.image = [UIImage imageNamed:@"top-bg"];
nabar.image = kToppicBgImage;
[self.view addSubview:nabar];
......
//
//
......@@ -7,7 +7,7 @@
//
#import "ZXBathAlert.h"
#import "ZXOpenBlueToothView.h"
@implementation ZXBathAlert
- (instancetype)initWithFrame:(CGRect)frame {
......@@ -88,11 +88,11 @@
[[okBtn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
self.hidden = YES;
[self removeFromSuperview];
[self.superview removeFromSuperview];
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
ZXOpenBlueToothView *openView = [[ZXOpenBlueToothView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[kAppWindow addSubview:openView];
}];
[okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
......
//
//
......@@ -17,17 +17,18 @@
#import "ZXAppointBathTabbarViewController.h"
#import "ZXBathShowAccountView.h"
#import "ZXScannerViewController.h"
//开发
//#define kSocketUrl @"hard-tcp-server.nat123.net" //socket连接地址
//#define kSocketPort 29800 //socket端口号
//测试
//#define kSocketUrl @"b6ece215c693ca21.natapp.cc" //socket连接地址
//#define kSocketPort 8192 //socket端口号
#define kSocketUrl @"b6ece215c693ca21.natapp.cc" //socket连接地址
#define kSocketPort 8192 //socket端口号
//生产
#define kSocketUrl @"shower-tcp1.dcrym.com" //socket连接地址
#define kSocketPort 8003 //socket端口号
//#define kSocketUrl @"shower-tcp1.dcrym.com" //socket连接地址
//#define kSocketPort 8003 //socket端口号
#define kScoketSendMsgTime 30 //发送消息间隔
......@@ -76,6 +77,10 @@
@property (nonatomic, strong) NSArray *balances;
//是否收到socket服务器的回应(设备号)
@property (nonatomic, assign) BOOL isReciveDeviceInfo;
@end
@implementation ZXBathViewController
......@@ -121,6 +126,18 @@
self.gcdTimer = nil;
}
}];
//MARK:观察是否收到socket反馈设备信息
[RACObserve(self, isReciveDeviceInfo) subscribeNext:^(id _Nullable x) {
@strongify(self);
if ([x integerValue]) {
//开始洗浴
if (self.isBegingBath == NO) {
self.isBegingBath = YES;
[self startBathByBluetooth];//调用接口
}
}
}];
}
#pragma mark - ==========读取本地缓存数据==========
......@@ -347,6 +364,7 @@
#pragma mark - ==========开始洗浴按钮事件==========
- (void) startBath {
self.isBegingBath = NO;//标记为no
self.isReciveDeviceInfo = NO;//标记为未接收到消息
@weakify(self);
[ZXAppointBathService dealAccountActionWithOperationMode:self.currentBluetooth.operationMode isBlueBath:YES completed:^{
@strongify(self);
......@@ -364,7 +382,10 @@
}
if (self.centralManager.state == CBManagerStatePoweredOff) {
//蓝牙未打开
ZXBathAlert *a = [[ZXBathAlert alloc] initWithFrame:[UIScreen mainScreen].bounds];
@weakify(self);
__weak typeof(a) weakA = a;
a.cancelAction = ^{
......@@ -395,7 +416,7 @@
#pragma mark - ==========点击了开始按钮 5s后检测蓝牙连接状态==========
- (void) checkBluetoothConectStatus {
// [ZXTool showLoadingAnimation];
// [ZXTool showLoadingAnimation];
NSInteger times = 5;
if (self.currentBluetooth.isOnlyBluetooth) {
times = 10;
......@@ -555,8 +576,8 @@
}
#pragma mark - ==========蓝牙连接状态监听==========
- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
// NSString *strMessage = @"";
// NSString *buttonTitle = nil;
// NSString *strMessage = @"";
// NSString *buttonTitle = nil;
switch (central.state) {
case CBManagerStatePoweredOn: {
NSLog(@"蓝牙开启且可用");
......@@ -565,33 +586,33 @@
}
break;
case CBManagerStateUnknown: {
// strMessage = @"手机没有识别到蓝牙,请检查手机。";
// buttonTitle = @"前往设置";
// strMessage = @"手机没有识别到蓝牙,请检查手机。";
// buttonTitle = @"前往设置";
NSLog(@"手机没有识别到蓝牙,请检查手机。");
}
break;
case CBManagerStateResetting: {
// strMessage = @"手机蓝牙已断开连接,重置中...";
// buttonTitle = @"前往设置";
// strMessage = @"手机蓝牙已断开连接,重置中...";
// buttonTitle = @"前往设置";
NSLog(@"手机蓝牙已断开连接,重置中...");
}
break;
case CBManagerStateUnsupported: {
// strMessage = @"手机不支持蓝牙功能,请更换手机。";
// strMessage = @"手机不支持蓝牙功能,请更换手机。";
NSLog(@"手机不支持蓝牙功能,请更换手机。.");
}
break;
case CBManagerStatePoweredOff: {
// strMessage = @"手机蓝牙功能关闭,请前往设置打开蓝牙及控制中心打开蓝牙。";
// buttonTitle = @"前往设置";
// strMessage = @"手机蓝牙功能关闭,请前往设置打开蓝牙及控制中心打开蓝牙。";
// buttonTitle = @"前往设置";
NSLog(@"手机蓝牙功能关闭,请前往设置打开蓝牙及控制中心打开蓝牙。");
}
break;
case CBManagerStateUnauthorized: {
// strMessage = @"手机蓝牙功能没有权限,请前往设置。";
// buttonTitle = @"前往设置";
// strMessage = @"手机蓝牙功能没有权限,请前往设置。";
// buttonTitle = @"前往设置";
NSLog(@"手机蓝牙功能没有权限,请前往设置");
}
......@@ -652,15 +673,34 @@
}
}
#pragma mark - ==========蓝牙连接成功 发送设备号给socket==========
- (void) sendDeviceInfoToSocketByTimes:(int) times {
//执行三次
if (times < 4 && self.isReciveDeviceInfo == NO) {
NSLog(@"//蓝牙连接成功---发送设备号给socket");
[self sendMessage:[NSString stringWithFormat:@"{<%@>}", self.currentPeripheralName]];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self sendDeviceInfoToSocketByTimes:(times + 1)];
});
}
}
#pragma mark - ==========蓝牙连接成功==========
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error {
NSLog(@"=========================蓝牙连接成功=========================");
//[SVProgressHUD showSuccessWithStatus:@"蓝牙连接成功"];
[self sendMessage:[NSString stringWithFormat:@"{<%@>}", self.currentPeripheralName]];
if (self.isBegingBath == NO) {
self.isBegingBath = YES;
[self startBathByBluetooth];//调用接口
[self sendDeviceInfoToSocketByTimes:1];
//三秒之后查看状态 如果还是没有收到 直接cancel掉所有连接 提示错误信息
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.isReciveDeviceInfo == NO) {
[ZXTool hideLoadingAnimation];
[SVProgressHUD showErrorWithStatus:@"未收到socket服务器响应的设备信息,请稍后再试!"];
}
});
for (CBCharacteristic *characteristic in service.characteristics) {
[peripheral setNotifyValue:YES forCharacteristic:characteristic];
self.currentCharacteristic = characteristic;
......@@ -837,7 +877,6 @@
}
#pragma mark - ==========收到socket消息==========
- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag {
NSString *text = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"=============收到服务器返回消息:%@====================", text);
......@@ -848,6 +887,9 @@
[self cutBluetoothAndSocketConnect];
} else if ([text isEqualToString:@"[]"]) {
} else if ([text isEqualToString:[NSString stringWithFormat:@"[<%@>]", self.currentPeripheralName]]) {
self.isReciveDeviceInfo = YES;
NSLog(@"=============收到服务器返回的设备号");
} else {
//发送给蓝牙
if (self.currentCharacteristic) {
......@@ -918,8 +960,8 @@
self.clientSocket.delegate = nil;
self.clientSocket = nil;
self.isSocketConnected = NO;
// self.centralManager.delegate = nil;
// self.centralManager = nil;
// self.centralManager.delegate = nil;
// self.centralManager = nil;
self.isServiceCut = YES;//触发服务端中断指令
self.startDrink.enabled = YES;
self.isBegingBath = NO;
......
//
//
//
// AimiCoinDetailViewController.h
// ZXOpenBlueToothView.h
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
// Created by 刘卓鑫 on 2019/8/30.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AimiCoinDetailViewController : UIViewController
NS_ASSUME_NONNULL_BEGIN
@interface ZXOpenBlueToothView : UIView
@end
NS_ASSUME_NONNULL_END
//
//
// ZXOpenBlueToothView.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/8/30.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXOpenBlueToothView.h"
#import "YYImage.h"
@interface ZXOpenBlueToothView ()
/** */
@property (nonatomic, strong) YYAnimatedImageView *imageView;
@end
@implementation ZXOpenBlueToothView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor clearColor];
YYImage *image = [YYImage imageNamed:@"openBluetooth.gif"];
self.imageView = [[YYAnimatedImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.imageView.image = image;
[self addSubview:self.imageView];
// @weakify(self);
// [RACObserve(self.imageView, currentAnimatedImageIndex) subscribeNext:^(id _Nullable x) {
// @strongify(self);
// if ([x integerValue] == self.imageView.animationImages.count) {
// [self.imageView stopAnimating];
// self.imageView.hidden = YES;
//
// [self.imageView removeFromSuperview];
// self.hidden = YES;
// [self removeFromSuperview];
// }
// }];
}
return self;
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.imageView stopAnimating];
self.imageView.hidden = YES;
[self.imageView removeFromSuperview];
self.imageView = nil;
self.hidden = YES;
[self removeFromSuperview];
}
@end
//
//
......@@ -7,7 +7,6 @@
//
#import "ZXWashScanViewController.h"
#import "HMScanerCardViewController.h"
#import "HMScannerBorder.h"
#import "HMScannerMaskView.h"
#import "HMScanner.h"
......
//
//
......@@ -19,6 +19,8 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.tabBarController.tabBar.hidden = YES;
self.tabBar.hidden = NO;
ZXWashCloseViewController *washVc = [[ZXWashCloseViewController alloc] init];
ZXLocationViewController *locationVC = [[ZXLocationViewController alloc] init];
ZXWashRecordViewController *recordVC = [[ZXWashRecordViewController alloc] init];
......
//
//
......@@ -105,7 +105,9 @@
make.bottom.equalTo(line2.mas_top).offset(-2 * k6Scale);
make.width.mas_equalTo(80 * k6Scale);
}];
@weakify(self);
[[reciveCodeBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
@strongify(self);
if (![usernameField.text isEqualToString:@""]) {
if (![reciveCodeBtn.titleLabel.text isEqualToString:@"获取验证码"]) {
......@@ -121,6 +123,7 @@
[ZXTool showText:error];
} else {
[ZXTool showText:@"获取短信验证码成功"];
[vioCodeField becomeFirstResponder];
reciveCodeBtn.userInteractionEnabled = NO;
dispatch_async(dispatch_get_main_queue(), ^{
NSString *S = [ZXTool getCurrentTime];
......
//
//
......@@ -62,7 +62,7 @@
make.right.equalTo(header.mas_right).offset(-10 * k6Scale);
make.width.mas_equalTo(65 * k6Scale);
make.height.mas_equalTo(25 * k6Scale);
make.centerY.equalTo(field.mas_centerY);
make.centerY.equalTo(self->field.mas_centerY);
}];
@weakify(self);
// [field.rac_textSignal subscribeNext:^(NSString *x) {
......@@ -118,8 +118,8 @@
}
[self.myTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index_T] atScrollPosition:UITableViewScrollPositionTop animated:YES];
} else {
//NSArray *s = [ZXNewCampus findAll];
NSArray *arr = [ZXNewCampus findByCriteria:[NSString stringWithFormat:@"where areaName like '%@%%'", weakfield.text]];
NSArray *arr = [ZXNewCampus findByCriteria:[NSString stringWithFormat:@"where areaName like '%%%@%%'", weakfield.text]];
[self sortResult:arr];
}
......@@ -258,21 +258,49 @@
[ZXTool showText:error];
[self.myTableView.mj_header endRefreshing];
} else {
NSArray *arr = [ZXNewCampus mj_objectArrayWithKeyValuesArray:common.data];
NSArray *arr = [common.data allKeys];
NSArray *result = [arr sortedArrayUsingComparator:^NSComparisonResult(NSString *obj1, NSString *obj2) {
return [obj1 caseInsensitiveCompare:obj2];
}];
[self.listDataSource removeAllObjects];
[ZXNewCampus clearTable];
[ZXNewCampus saveObjects:arr];
[self sortResult:arr];
for (NSString *py in result) {
ZXBaseItem *item = [[ZXBaseItem alloc] init];
item.py = py;
NSArray *campusList = [ZXNewCampus mj_objectArrayWithKeyValuesArray:common.data[py]];
[ZXNewCampus saveObjects:campusList];
item.baseSchool = campusList;
[self.listDataSource addObject:item];
}
dispatch_async(dispatch_get_main_queue(), ^{
[self.myTableView.mj_header endRefreshing];
[self.myTableView reloadData];
[self.indexListView reloadData];
});
// [ZXNewCampus clearTable];
// [ZXNewCampus saveObjects:arr];
// [self sortResult:arr];
}
});
}];
}
- (void) sortResult:(NSArray *) arr {
if (arr.count == 0) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.listDataSource removeAllObjects];
[self.myTableView reloadData];
[self.indexListView reloadData];
});
return;
}
NSArray *result = [arr sortedArrayUsingComparator:^NSComparisonResult(ZXNewCampus *obj1, ZXNewCampus *obj2) {
return [obj1.initial caseInsensitiveCompare:obj2.initial];
}];
[self.listDataSource removeAllObjects];
NSString *charter = @"A";
NSString *charter = [result.firstObject valueForKey:@"initial"];
NSMutableArray *list = [[NSMutableArray alloc] init];
for (int i = 0; i < result.count; i++) {
ZXNewCampus *item = result[i];
......
//
//
......@@ -676,7 +676,7 @@
};
}
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/dcxy/api/customer/app/register", [kUserDefaults objectForKey:@"Recharge"]] para:dic completed:^(CommonModel *common, NSString *error) {
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/app/customer/register", [kUserDefaults objectForKey:@"Recharge"]] para:dic completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
......
//
//
......@@ -7,7 +7,6 @@
//
#import "AimiWalletViewController.h"
#import "DetailViewController.h"
#import "FetchAccoutDataModel.h"
#import "BeanCell.h"
#import "TopupWalletCell.h"
......@@ -281,35 +280,28 @@ static NSString * const ID = @"CollectionCell";
[self.tableView registerNib:[UINib nibWithNibName:@"PayTypeCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:PayTypeCellID];
[self creatBeanCollectionView];
}
#pragma mark - ==========查询钱包页面数据==========
- (void) checkWalletData {
[self FetchAccountDataFromServer];
[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) {
[self FetchAccountDataFromSerVer:YES];
} else {
if (!error) {
if (common.data) {
if (common.data[@"mode"]) {
self.isNeedOld = NO;
dispatch_async(dispatch_get_main_queue(), ^{
self.detailBtn.hidden = YES;
});
self.isOld = [common.data[@"mode"] isEqualToString:@"3"];
if (!self.isOld) {
self.isOld = [common.data[@"mode"] isEqualToString:@"1"];
if (self.isOld) {
[self getSXBZJ];//获取授信保证金
}
[self FetchAccountDataFromSerVer:NO];
} else {
[self FetchAccountDataFromSerVer:YES];
}
} else {
[self FetchAccountDataFromSerVer:YES];
}
}
});
......@@ -331,11 +323,11 @@ static NSString * const ID = @"CollectionCell";
if ([m.showType isEqualToString:@"1"]) {
self.sxLabel.text = @"我的授信";
self.sxMoneyLabel.text = [NSString stringWithFormat:@"%.2f", m.amount];
self.rightNoteLabel.text = @"";
self.rightNoteLabel.text = @"";
} else if ([m.showType isEqualToString:@"2"]) {
self.sxLabel.text = @"我的保证金";
self.sxMoneyLabel.text = [NSString stringWithFormat:@"%.2f", m.amount];
self.rightNoteLabel.text = @"";
self.rightNoteLabel.text = @"";
}
});
......@@ -365,52 +357,12 @@ static NSString * const ID = @"CollectionCell";
[self removeNotificationAndKVO];
}
#pragma mark - ========== 获取账户信息相关数据 ==========
-(void)FetchAccountDataFromSerVer:(BOOL) isOld {
-(void)FetchAccountDataFromServer {
if (isOld) {
///老版本获取支付方式 账户信息 充值项
[self.accountDataModel fetchAcountData];
[self.topUpDataModel fetchTopUpeData];
[ZXTool requestPayStylesCompleted:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (error) {
//[ZXTool showText:error];
} else {
JDPayItem *item = [JDPayItem mj_objectWithKeyValues:common.data];
[self createFooter];
[self oldSettingPayType:item];
}
});
}];
} else {
/*获取最新的充值祥和充值方式*/
[self zx_new_get_recharge_info];
//获取账户信息
[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) {
[ZXTool showText:error];
} else {
[self.moneyArray removeAllObjects];
for (NSDictionary *dic in common.data) {
servicePeasListItem *item = [servicePeasListItem mj_objectWithKeyValues:dic];
if ([item.serviceId isEqualToString:@"0"]) {
if ([[NSString stringWithFormat:@"%.2f", item.money] isEqualToString:self.moneyLabel.text] && self.isRechargeCompleted) {
[ZXTool showText:@"由于网络原因,本次购买可能延迟到账,请稍后查看余额"];
} else {
self.moneyLabel.text=[NSString stringWithFormat:@"%.2f", item.money];
}
} else {
[self.moneyArray addObject:item];
}
[self->beanCollectionView reloadData];
}
}
});
}];
}
[self refreshUserInfo];
}
......@@ -583,10 +535,6 @@ heightForFooterInSection:(NSInteger)section {
- (IBAction)backBtnClick:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)DetailBtnClick:(id)sender {
DetailViewController * VC=[DetailViewController new];
[self.navigationController pushViewController:VC animated:YES];
}
#pragma mark 支付相关;
-(void)confirmBtnFuc{
......@@ -606,16 +554,16 @@ heightForFooterInSection:(NSInteger)section {
confirmVc.isFirstRecharge = YES;
confirmVc.rechargeId = self.selectTopUpItem.id;
if (self.selectTopUpItem.giveName && self.selectTopUpItem.giveMoney != 0) {
confirmVc.rechargeDesc = [NSString stringWithFormat:@"购买%.2f送%@%.2f个",self.selectTopUpItem.rechargeMoney,self.selectTopUpItem.giveName, self.selectTopUpItem.giveMoney];
confirmVc.rechargeDesc = [NSString stringWithFormat:@"购买%.2f送%@%.2f个",self.selectTopUpItem.rechargeMoney,self.selectTopUpItem.giveName, self.selectTopUpItem.giveMoney];
} else {
confirmVc.rechargeDesc = [NSString stringWithFormat:@"购买%.2f",self.selectTopUpItem.rechargeMoney];
confirmVc.rechargeDesc = [NSString stringWithFormat:@"购买%.2f",self.selectTopUpItem.rechargeMoney];
}
} else {
confirmVc.rechargeId = self.selectTopUpItem.id;
if (self.selectTopUpItem.giveName && self.selectTopUpItem.giveMoney != 0) {
confirmVc.rechargeDesc = [NSString stringWithFormat:@"购买%.2f送%@%ld个",self.selectTopUpItem.rechargeMoney,self.selectTopUpItem.giveName, (long)self.selectTopUpItem.giveMoney];
confirmVc.rechargeDesc = [NSString stringWithFormat:@"购买%.2f送%@%ld个",self.selectTopUpItem.rechargeMoney,self.selectTopUpItem.giveName, (long)self.selectTopUpItem.giveMoney];
} else {
confirmVc.rechargeDesc = [NSString stringWithFormat:@"购买%.2f",self.selectTopUpItem.rechargeMoney];
confirmVc.rechargeDesc = [NSString stringWithFormat:@"购买%.2f",self.selectTopUpItem.rechargeMoney];
}
}
@weakify(self);
......@@ -634,12 +582,6 @@ heightForFooterInSection:(NSInteger)section {
}
- (void) refreshUserInfo {
@weakify(self);
[ZXTool checkCurrentUserModeCompleted:^(BOOL isOld) {
@strongify(self);
if (isOld) {
[self.accountDataModel fetchAcountData];
} else {
@weakify(self);
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/customerAccount/queryAccount", [kUserDefaults objectForKey:@"NEW_PAY"]] para:@{@"areaId":CacheCampusId, @"customerPhone":CacheAccount, @"id":CacheUserId} completed:^(CommonModel *common, NSString *error) {
@strongify(self);
dispatch_async(dispatch_get_main_queue(), ^{
......@@ -664,8 +606,6 @@ heightForFooterInSection:(NSInteger)section {
}
});
}];
}
}];
}
......@@ -777,20 +717,4 @@ heightForFooterInSection:(NSInteger)section {
}
//- (id) findItemFromList:(NSArray *)list by:(NSInteger) key {
//
// NSInteger index = list.count / 2;
// id item = list[index];
// if ([item[@"key"] integerValue] == key) {
// return item;
// } else if (key > [item[@"key"] integerValue]) {
// NSArray *subArray = [list subarrayWithRange:NSMakeRange(index, list.count-1)];
// return [self findItemFromList:subArray by:key];
// }
// NSArray *subArray = [list subarrayWithRange:NSMakeRange(0, index)];
// return [self findItemFromList:subArray by:key];
//}
@end
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
......@@ -101,7 +101,7 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gMo-fa-td4">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gMo-fa-td4">
<rect key="frame" x="107.5" y="146.5" width="15.5" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......
//
//
......@@ -170,31 +170,6 @@
NSString *userId = [kUserDefaults valueForKey:@"userId"];
@weakify(self);
__weak typeof(confirmBtn) weakConfirmVtn = confirmBtn;
[ZXTool checkCurrentUserModeCompleted:^(BOOL isOld) {
@strongify(self);
if (isOld) {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/customer/recharge?customerId=%@&rechargeId=%ld&payWay=%ld", [kUserDefaults valueForKey:@"Recharge"],userId, (long)rechageId, (long)payType] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
weakConfirmVtn.enabled = YES;
if (error) {
[ZXTool hideLoadingAnimation];
[ZXTool showText:error];
} else {
[ZXTool hideLoadingAnimation];
NSString *payTypeStr = @"";
if ([self.payType isEqualToString:@"2"]) {
payTypeStr = @"wx";
} else if ([self.payType isEqualToString:@"3"]) {
payTypeStr = @"ali";
} else if ([self.payType isEqualToString:@"4"]) {
payTypeStr = @"jd";
}
NSString *response = [ZXTool decryptResult:common.data[@"payStr"] payType:payTypeStr];
[self createOrderSuccessThanStartPayByResponse:response];
}
});
}];
} else {
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/dcxy/app/rechargeOrder/rechargeOrder/sure", [kUserDefaults valueForKey:@"NEW_PAY"]] para:@{@"customerId":userId, @"id":[NSString stringWithFormat:@"%ld", (long)self.rechargeId],@"isFirstRecharge":self.isFirstRecharge?@"0":@"1", @"rechargeType":self.payType} completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
weakConfirmVtn.enabled = YES;
......@@ -215,9 +190,6 @@
}
});
}];
}
}];
}
#pragma mark - ========== 订单创建成功-发起支付 ==========
......
//
//
......@@ -16,7 +16,7 @@
}
- (void)setTopUpDataItem:(ZX_recharge_item *)topUpDataItem {
_topUpDataItem = topUpDataItem;
self.priceLabel.text=[NSString stringWithFormat:@"购买%.2f",_topUpDataItem.rechargeMoney];
self.priceLabel.text=[NSString stringWithFormat:@"购买%.2f",_topUpDataItem.rechargeMoney];
if (_topUpDataItem.giveMoney==0) {
self.presentBeanLabel.hidden=YES;
......
//
++ /dev/null
//
// AimiCoinDetailViewController.m
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import "AimiCoinDetailViewController.h"
#import "AimiCoinDetailModel.h"
#import "DetailHeadView.h"
#import "AcountTimeDetailModel.h"
#import "AimiCoinCel.h"
@interface AimiCoinDetailViewController ()<UITableViewDataSource ,UITableViewDelegate>{
NSMutableArray * dataArray;
NSMutableDictionary * isExPandDic;
}
@property (nonatomic, strong)AimiCoinDetailModel * aimiCoinDetailModel;
@property (nonatomic, strong)AcountTimeDetailModel * acountTimeModel;
@property (nonatomic, strong)NSString *refreshMonthStr;
@property (strong, nonatomic) IBOutlet UITableView *tableView;
@end
@implementation AimiCoinDetailViewController
- (void)dealloc{
[self removeNotificationAndKVO];
}
-(void)registNotificationAndKVO{
[self.aimiCoinDetailModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.aimiCoinDetailModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
[self.acountTimeModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.acountTimeModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
}
-(void)removeNotificationAndKVO{
[self.aimiCoinDetailModel removeObserver:self forKeyPath:@"isLoaded"];
[self.aimiCoinDetailModel removeObserver:self forKeyPath:@"error"];
[self.acountTimeModel removeObserver:self forKeyPath:@"isLoaded"];
[self.acountTimeModel removeObserver:self forKeyPath:@"error"];
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if (object == self.aimiCoinDetailModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
[self loadDataGroup1:self.aimiCoinDetailModel.detailItemListArray Group2:self.aimiCoinDetailModel.detailItemListArray1 Group3:self.aimiCoinDetailModel.detailItemListArray2];
if (self.aimiCoinDetailModel.aimiCoinDetailModelItem.datalist.count==0) {
[SVProgressHUD showImage:nil status:@"没有明细"];
}
}
else{
}
[self.tableView reloadData];
[self.tableView.mj_header endRefreshing];
[self.tableView.mj_footer endRefreshing];
}
else if (object == self.acountTimeModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
[self.tableView reloadData];
}
else{
}
}
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
isExPandDic=[NSMutableDictionary new];
for (int i=0; i<3; i++) {
[isExPandDic setObject:@"0" forKey:[NSString stringWithFormat:@"%d",i]];
}
self.tableView.delegate=self;
self.tableView.dataSource=self;
self.aimiCoinDetailModel=[AimiCoinDetailModel new];
self.acountTimeModel =[AcountTimeDetailModel new];
[self registNotificationAndKVO];
[self.acountTimeModel fetchCountDetail];
self.tableView.tableFooterView=[UIView new];
[self.tableView registerNib:[UINib nibWithNibName:@"AimiCoinCel" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"CoinCell"];
/*
刷新中
*/
MJRefreshNormalHeader * header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
[self.aimiCoinDetailModel reloadCoinDetaiWithMonth:self.refreshMonthStr];
}];
self.tableView.mj_header=header;
MJRefreshBackNormalFooter * footer=[MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self.aimiCoinDetailModel loadMoreCoinDetaiWithMonth:self.refreshMonthStr];
}];
self.tableView.mj_footer=footer;
[self loadDataGroup1:[NSMutableArray new] Group2:[NSMutableArray new] Group3:[NSMutableArray new]];
self.tableView.tableFooterView = [[UIView alloc] init];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
AppDelegate * ppdelegate= (AppDelegate *)[UIApplication sharedApplication].delegate;
if (ppdelegate) {
self.navigationController.navigationBarHidden=YES;
}
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
self.navigationController.navigationBarHidden=NO;
}
/*
设置视图
*/
-(void)loadDataGroup1:(NSArray *)group1 Group2:(NSArray *)group2 Group3:(NSArray *)group3
{
dataArray=[[NSMutableArray alloc]initWithObjects:group1,group2,group3,nil];
[self.tableView reloadData];
}
-(void)setExpandDicValueisOne:(int)index{
// 非选择标记
[isExPandDic enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
NSString * keystr=key;
if (![keystr isEqualToString:[NSString stringWithFormat:@"%d",index]]) {
[isExPandDic setObject:@"0" forKey:key];
}
}];
// 选择标记
NSString * expandStr= [isExPandDic objectForKey:[NSString stringWithFormat:@"%d",index]];
if ([expandStr isEqualToString:@"1"]) {
[isExPandDic setObject:@"0" forKey:[NSString stringWithFormat:@"%d",index]];
}
else if ([expandStr isEqualToString:@"0"]){
[isExPandDic setObject:@"1" forKey:[NSString stringWithFormat:@"%d",index]];
}
}
#pragma -mark UITableView delegate
//
- (CGFloat)tableView:(UITableView *)tableView
heightForFooterInSection:(NSInteger)section
{
return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (_acountTimeModel.ListArray.count==0) {
return 0;
}
return 50;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 66;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return self.acountTimeModel.ListArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSArray * arr=dataArray[section];
NSString * isExpand=[isExPandDic objectForKey:[NSString stringWithFormat:@"%ld",(long)section]];
if ([isExpand isEqualToString:@"1"]) {
return arr.count;
}
else{
return 0;
}
return 0;//arr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
AimiCoinCel * cell=[tableView dequeueReusableCellWithIdentifier:@"CoinCell"];
if (cell==nil) {
cell=[[AimiCoinCel alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CoinCell"];
}
NSArray * tempArr;
if (indexPath.section<dataArray.count) {
tempArr=dataArray[indexPath.section];
}
if (indexPath.row<tempArr.count) {
DetailItem * item=(tempArr)[indexPath.row];
cell.detailItem=item;
}
cell.selectionStyle= UITableViewCellSelectionStyleNone;
cell.separatorInset=UIEdgeInsetsMake(0, 10, 0, 0);
return cell;
}
////自定义区头 把区头model 创建的view写这里
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView*view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 55)];
DetailHeadView * headView =[[DetailHeadView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 55)];
headView.block = ^(id sender){
[self expand:sender];
};
headView.ExpandBtn.tag=section;
if (_acountTimeModel.ListArray.count>0) {
AcountTimeDetailItem * item= _acountTimeModel.ListArray[section];
headView.monthLabel.text=item.title;
}
NSString *expandStr=[isExPandDic objectForKey:[NSString stringWithFormat:@"%ld",(long)section]];
if ([expandStr isEqualToString:@"1"]) {
[headView.ExpandBtn setImage:[UIImage imageNamed:@"收起icon.png"] forState:UIControlStateNormal];
}else{
[headView.ExpandBtn setImage:[UIImage imageNamed:@"下拉icon.png"] forState:UIControlStateNormal];
}
[view addSubview:headView];
return view;
}
#pragma mark - ActionMethord
//点击区头按钮 修改数据源数组 展开区
- (void)expand:(UIButton*)btn
{
[self setExpandDicValueisOne:(int)btn.tag];
AcountTimeDetailItem * item= _acountTimeModel.ListArray[btn.tag];
self.refreshMonthStr=[NSString stringWithFormat:@"%ld",(long)btn.tag];
NSString * expandStr= [isExPandDic objectForKey:[NSString stringWithFormat:@"%d",(int)btn.tag]];
if ([expandStr isEqualToString:@"1"]) {
[self.aimiCoinDetailModel fetchCoinDetailWithMonth:item.timeId clickIndex:(int)btn.tag];
}else{
[self.tableView reloadData];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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].
// Pass the selected object to the new view controller.
}
*/
@end
<?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="16F73" 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="AimiCoinDetailViewController">
<connections>
<outlet property="tableView" destination="lrq-al-WT6" id="Rc3-xo-o8b"/>
<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" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="lrq-al-WT6">
<rect key="frame" x="0.0" y="119" width="375" height="548"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="lrq-al-WT6" secondAttribute="bottom" id="GF8-33-IFV"/>
<constraint firstItem="lrq-al-WT6" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="Qas-Ho-WHo"/>
<constraint firstAttribute="trailing" secondItem="lrq-al-WT6" secondAttribute="trailing" id="kbI-Z6-yXg"/>
<constraint firstItem="lrq-al-WT6" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="119" id="nui-eh-e4U"/>
</constraints>
</view>
</objects>
</document>
//
++ /dev/null
//
// BeanDetaiViewController.h
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BeanDetaiViewController : UIViewController
@end
//
++ /dev/null
//
// BeanDetaiViewController.m
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import "BeanDetaiViewController.h"
#import "DetailHeadView.h"
#import "BeanDetailModel.h"
#import "AcountTimeDetailModel.h"
#import "AimiCoinCel.h"
#import "AimiCoinDetailModel.h"
@interface BeanDetaiViewController ()<UITableViewDataSource ,UITableViewDelegate>{
NSMutableArray * dataArray;
NSMutableDictionary * isExPandDic;
}
@property (strong, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic, strong) BeanDetailModel * beanDetailModel;
@property (nonatomic, strong)AcountTimeDetailModel * acountTimeModel;
@property (nonatomic, strong)NSString *refreshMonthStr;
@end
@implementation BeanDetaiViewController
- (void)dealloc{
[self removeNotificationAndKVO];
}
-(void)registNotificationAndKVO{
[self.beanDetailModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.beanDetailModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
[self.acountTimeModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.acountTimeModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
}
-(void)removeNotificationAndKVO{
[self.beanDetailModel removeObserver:self forKeyPath:@"isLoaded"];
[self.beanDetailModel removeObserver:self forKeyPath:@"error"];
[self.acountTimeModel removeObserver:self forKeyPath:@"isLoaded"];
[self.acountTimeModel removeObserver:self forKeyPath:@"error"];
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if (object == self.beanDetailModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
[self loadDataGroup1:self.beanDetailModel.detailItemListArray Group2:self.beanDetailModel.detailItemListArray1 Group3:self.beanDetailModel.detailItemListArray2];
if (self.beanDetailModel.beanDetailModelItem.datalist.count==0) {
[SVProgressHUD showImage:nil status:@"没有明细"];
}
}
else{
}
[self.tableView reloadData];
[self.tableView.mj_header endRefreshing];
[self.tableView.mj_footer endRefreshing];
}
else if (object == self.acountTimeModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
[self.tableView reloadData];
}
else{
}
}
}
- (void)viewDidLoad {
[super viewDidLoad];
isExPandDic=[NSMutableDictionary new];
for (int i=0; i<3; i++) {
[isExPandDic setObject:@"0" forKey:[NSString stringWithFormat:@"%d",i]];
}
self.tableView.delegate=self;
self.tableView.dataSource=self;
self.acountTimeModel =[AcountTimeDetailModel new];
self.beanDetailModel=[BeanDetailModel new];
[self registNotificationAndKVO];
[self.acountTimeModel fetchCountDetail];
self.tableView.tableFooterView=[UIView new];
[self.tableView registerNib:[UINib nibWithNibName:@"AimiCoinCel" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"CoinCell"];
/*
刷新中
*/
MJRefreshNormalHeader * header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
[self.beanDetailModel reloadBeanDetaiWithMonth:self.refreshMonthStr];
}];
self.tableView.mj_header=header;
MJRefreshBackNormalFooter * footer=[MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self.beanDetailModel loadMoreBeanDetaiWithMonth:self.refreshMonthStr];
}];
self.tableView.mj_footer=footer;
[self loadDataGroup1:[NSMutableArray new] Group2:[NSMutableArray new] Group3:[NSMutableArray new]];
// Do any additional setup after loading the view from its nib.
}
/*
设置视图
*/
-(void)loadDataGroup1:(NSArray *)group1 Group2:(NSArray *)group2 Group3:(NSArray *)group3
{
dataArray=[[NSMutableArray alloc]initWithObjects:group1,group2,group3,nil];
[self.tableView reloadData];
}
-(void)setExpandDicValueisOne:(int)index{
// 非选择标记
[isExPandDic enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
NSString * keystr=key;
if (![keystr isEqualToString:[NSString stringWithFormat:@"%d",index]]) {
[isExPandDic setObject:@"0" forKey:key];
}
}];
// 选择标记
NSString * expandStr= [isExPandDic objectForKey:[NSString stringWithFormat:@"%d",index]];
if ([expandStr isEqualToString:@"1"]) {
[isExPandDic setObject:@"0" forKey:[NSString stringWithFormat:@"%d",index]];
}
else if ([expandStr isEqualToString:@"0"]){
[isExPandDic setObject:@"1" forKey:[NSString stringWithFormat:@"%d",index]];
}
}
#pragma -mark UITableView delegate
//
- (CGFloat)tableView:(UITableView *)tableView
heightForFooterInSection:(NSInteger)section
{
return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (_acountTimeModel.ListArray.count==0) {
return 0;
}
return 50;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 66;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return self.acountTimeModel.ListArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSArray * arr=dataArray[section];
NSString * isExpand= [isExPandDic objectForKey:[NSString stringWithFormat:@"%ld",(long)section]];
if ([isExpand isEqualToString:@"1"]) {
return arr.count;
}
else{
return 0;
}
return 0;//arr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
AimiCoinCel * cell=[tableView dequeueReusableCellWithIdentifier:@"CoinCell"];
if (cell==nil) {
cell=[[AimiCoinCel alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CoinCell"];
}
NSArray * tempArr;
if (indexPath.section<dataArray.count) {
tempArr=dataArray[indexPath.section];
}
if (indexPath.row<tempArr.count) {
DetailItem * item=(tempArr)[indexPath.row];
cell.detailItem=item;
}
cell.selectionStyle= UITableViewCellSelectionStyleNone;
cell.separatorInset=UIEdgeInsetsMake(0, 10, 0, 0);
return cell;
}
//-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
// UIView * BgView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 50)];
// BgView.backgroundColor=[UIColor yellowColor];
//
// return BgView;
//}
////自定义区头 把区头model 创建的view写这里
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView*view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 55)];
DetailHeadView * headView =[[DetailHeadView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 55)];
headView.block = ^(id sender){
[self expand:sender];
};
headView.ExpandBtn.tag=section;
if (_acountTimeModel.ListArray.count>0) {
AcountTimeDetailItem * item= _acountTimeModel.ListArray[section];
headView.monthLabel.text=item.title;
}
NSString *expandStr=[isExPandDic objectForKey:[NSString stringWithFormat:@"%ld",(long)section]];
if ([expandStr isEqualToString:@"1"]) {
[headView.ExpandBtn setImage:[UIImage imageNamed:@"收起icon.png"] forState:UIControlStateNormal];
}else{
[headView.ExpandBtn setImage:[UIImage imageNamed:@"下拉icon.png"] forState:UIControlStateNormal];
}
[view addSubview:headView];
return view;
}
#pragma mark - ActionMethord
//点击区头按钮 修改数据源数组 展开区
- (void)expand:(UIButton*)btn
{
[self setExpandDicValueisOne:(int)btn.tag];
AcountTimeDetailItem * item= _acountTimeModel.ListArray[btn.tag];
self.refreshMonthStr=[NSString stringWithFormat:@"%ld",(long)btn.tag];
NSString * expandStr= [isExPandDic objectForKey:[NSString stringWithFormat:@"%d",(int)btn.tag]];
if ([expandStr isEqualToString:@"1"]) {
[self.beanDetailModel fetchBeanDetaiWithMonth:item.timeId clickIndex:(int)btn.tag];
}else{
[self.tableView reloadData];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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].
// Pass the selected object to the new view controller.
}
*/
@end
<?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="16F73" 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="BeanDetaiViewController">
<connections>
<outlet property="tableView" destination="RlK-IC-OFk" id="NE4-vP-5E8"/>
<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" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="RlK-IC-OFk">
<rect key="frame" x="0.0" y="119" width="375" height="548"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableView>
</subviews>
<constraints>
<constraint firstItem="RlK-IC-OFk" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="0mC-Zg-cyM"/>
<constraint firstAttribute="bottom" secondItem="RlK-IC-OFk" secondAttribute="bottom" id="USs-QW-bsf"/>
<constraint firstItem="RlK-IC-OFk" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="119" id="mU2-Yw-dSR"/>
<constraint firstAttribute="trailing" secondItem="RlK-IC-OFk" secondAttribute="trailing" id="zx3-x5-8Zk"/>
</constraints>
</view>
</objects>
</document>
//
++ /dev/null
//
// DetailViewController.h
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import <UIKit/UIKit.h>
/** TitleButton被重复点击的通知 */
UIKIT_EXTERN NSString * const XMGTitleButtonDidRepeatClickNotification;
@interface DetailViewController : UIViewController
@end
//
++ /dev/null
//
// AcountTimeDetailModel.h
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface AcountTimeDetailItem : NSObject
@property (nonatomic, strong) NSString *timeId;
@property (nonatomic, strong) NSString *title;
@end
@interface AcountTimeDetailModel : NSObject
/**
数据是否成功加载
*/
@property (nonatomic) BOOL isLoaded;
/**
数据加载错误
*/
@property (nonatomic) BOOL error;
@property (nonatomic) NSMutableArray *ListArray;
//获取账户明细时间;
-(void)fetchCountDetail;
@end
//
++ /dev/null
//
// AcountTimeDetailModel.m
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import "AcountTimeDetailModel.h"
@implementation AcountTimeDetailItem
+(NSDictionary*)mj_replacedKeyFromPropertyName{
return@{@"timeId":@"id"};
}
@end
@implementation AcountTimeDetailModel
-(void)fetchCountDetail{
GetData * data=[GetData shareData];
__weak typeof(self) WeakSelf=self;
self.ListArray = [NSMutableArray array];
[data fetchCountDetailSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSDictionary * dic=responseObject;
if ([dic[@"code"] isEqualToString:@"0"]) {
// [[dic[@"data"] firstObject] createPropertyCode];
NSArray * array= [AcountTimeDetailItem mj_objectArrayWithKeyValuesArray:dic[@"data"]];
[WeakSelf.ListArray addObjectsFromArray:array];
[SVProgressHUD dismiss];
WeakSelf.isLoaded=YES;
}
else{
WeakSelf.error=YES;
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
WeakSelf.error=YES;
}];
}
@end
//
++ /dev/null
//
// AimiCoinDetailModel.h
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DetailItem : NSObject
@property (nonatomic, strong) NSString *amount;
@property (nonatomic, strong) NSString *flowTime;
@property (nonatomic, strong) NSString *flowName;
@end
@interface AimiCoinDetailModelItem : NSObject
@property (nonatomic, strong) NSString *startTime;
@property (nonatomic, strong) NSMutableArray *datalist;
@property (nonatomic, strong) NSString *monthId;
@property (nonatomic, strong) NSString *endTime;
@property (nonatomic, strong) NSString *pageNo;
@end
@interface AimiCoinDetailModel : NSObject
/**
数据是否成功加载
*/
@property (nonatomic) BOOL isLoaded;
/**
数据加载错误
*/
@property (nonatomic) BOOL error;
@property (nonatomic) AimiCoinDetailModelItem *aimiCoinDetailModelItem;
//返回给外部每次加载十条数据的数组;
@property (nonatomic) NSMutableArray * detailItemListArray;
@property (nonatomic) NSMutableArray * detailItemListArray1;
@property (nonatomic) NSMutableArray * detailItemListArray2;
-(void)reloadCoinDetaiWithMonth:(NSString *)month;
-(void)loadMoreCoinDetaiWithMonth:(NSString *)month;
//获取赠送豆
-(void)fetchCoinDetailWithMonth:(NSString *)month clickIndex:(int)index;
@end
//
++ /dev/null
//
// AimiCoinDetailModel.m
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import "AimiCoinDetailModel.h"
@implementation DetailItem
@end
@implementation AimiCoinDetailModelItem
+(NSDictionary*)mj_replacedKeyFromPropertyName{
return@{@"monthId":@"id"};
}
+ (NSDictionary *)mj_objectClassInArray
{
return @{
@"datalist" : @"DetailItem",
};
}
@end
@interface AimiCoinDetailModel()
@property(nonatomic)NSInteger currentPage;
@property (nonatomic) BOOL hasLoadAll;
@end
@interface AimiCoinDetailModel()
//接收后台数据一次性返回的数据;
@property (nonatomic) NSMutableArray * array;
@property (nonatomic) NSMutableArray * array1;
@property (nonatomic) NSMutableArray * array2;
@property (nonatomic) NSDictionary *dic;
@property (nonatomic) NSDictionary *dic1;
@property (nonatomic) NSDictionary *dic2;
@end
@implementation AimiCoinDetailModel
-(void)reloadCoinDetaiWithMonth:(NSString *)month
{
self.currentPage = 1;
self.hasLoadAll = NO;
[self nilArrayForOut];
[self addDataWithPage:(int)self.currentPage WithMonth:month];
self.isLoaded=YES;
}
-(void)loadMoreCoinDetaiWithMonth:(NSString *)month
{
self.currentPage += 1;
[self addDataWithPage:(int)self.currentPage WithMonth:month];
self.isLoaded=YES;
}
-(void)nilArrayForOut{
self.detailItemListArray=nil;
self.detailItemListArray1=nil;
self.detailItemListArray2=nil;
}
-(void)newArrayForOut{
if (self.detailItemListArray==nil) {
self.detailItemListArray=[NSMutableArray array];
}
if (self.detailItemListArray1==nil) {
self.detailItemListArray1=[NSMutableArray array];
}
if (self.detailItemListArray2==nil) {
self.detailItemListArray2=[NSMutableArray array];
}
}
-(void)addDataWithPage:(int)page WithMonth:(NSString *)month{
[self newArrayForOut];
// 返回成功反给外部10条数据;
if ([month isEqualToString:@"0"]) {
[self.detailItemListArray removeAllObjects];
[self.array enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (idx>=10*page) {
return ;
}
[self.detailItemListArray addObject:obj];
}];
}
else if ([month isEqualToString:@"1"]){
[self.detailItemListArray1 removeAllObjects];
[self.array1 enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (idx>=10*page) {
return ;
}
[self.detailItemListArray1 addObject:obj];
}];
}
else if ([month isEqualToString:@"2"]){
[self.detailItemListArray2 removeAllObjects];
[self.array2 enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (idx>=10*page) {
return ;
}
[self.detailItemListArray2 addObject:obj];
}];
}
}
//获取赠送豆
-(void)fetchCoinDetailWithMonth:(NSString *)month clickIndex:(int)index
{
switch (index) {
case 0:
if (self.array.count>0) {
//数据加载成功返回十条数据
self.aimiCoinDetailModelItem= [AimiCoinDetailModelItem mj_objectWithKeyValues:_dic];
[self addDataWithPage:1 WithMonth:[NSString stringWithFormat:@"%d",index]];
self.
self.isLoaded=YES;
return;
}
break;
case 1:
if (self.array1.count>0) {
//数据加载成功返回十条数据
self.aimiCoinDetailModelItem= [AimiCoinDetailModelItem mj_objectWithKeyValues:_dic1];
[self addDataWithPage:1 WithMonth:[NSString stringWithFormat:@"%d",index]];
self.isLoaded=YES;
return;
}
break;
case 2:
if (self.array2.count>0) {
//数据加载成功返回十条数据
self.aimiCoinDetailModelItem= [AimiCoinDetailModelItem mj_objectWithKeyValues:_dic2];
[self addDataWithPage:1 WithMonth:[NSString stringWithFormat:@"%d",index]];
self.isLoaded=YES;
return;
}
break;
default:
break;
}
if (self.array==nil) {
self.array=[NSMutableArray array];
}
if (self.array1==nil) {
self.array1=[NSMutableArray array];
}
if (self.array2==nil) {
self.array2=[NSMutableArray array];
}
if (self.dic==nil) {
self.dic=[NSDictionary new];
}
if (self.dic1==nil) {
self.dic1=[NSDictionary new];
}
if (self.dic2==nil) {
self.dic2=[NSDictionary new];
}
GetData * data=[GetData shareData];
__weak typeof(self) WeakSelf=self;
[data fetchCoinDetailWithMonth:month Page:[NSString stringWithFormat:@"%ld",(long)WeakSelf.currentPage] success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSDictionary * dic=responseObject;
if ([dic[@"code"] isEqualToString:@"0"]) {
WeakSelf.aimiCoinDetailModelItem= [AimiCoinDetailModelItem mj_objectWithKeyValues:dic[@"data"]];
switch (index) {
case 0:
WeakSelf.dic=dic[@"data"];
WeakSelf.array=WeakSelf.aimiCoinDetailModelItem.datalist;
break;
case 1:
WeakSelf.dic1=dic[@"data"];
WeakSelf.array1=WeakSelf.aimiCoinDetailModelItem.datalist;
break;
case 2:
WeakSelf.dic2=dic[@"data"];
WeakSelf.array2=WeakSelf.aimiCoinDetailModelItem.datalist;
break;
default:
break;
}
//数据加载成功返回十条数据
[WeakSelf addDataWithPage:1 WithMonth:[NSString stringWithFormat:@"%d",index]];
[SVProgressHUD dismiss];
WeakSelf.isLoaded=YES;
}
else{
WeakSelf.error=YES;
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
WeakSelf.error=YES;
}];
}
@end
//
++ /dev/null
//
// BeanDetailModel.h
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AimiCoinDetailModel.h"
@interface BeanDetailItem : NSObject
@property (nonatomic, assign) double amount;
@property (nonatomic, strong) NSString *flowTime;
@property (nonatomic, strong) NSString *flowName;
@end
@interface BeanDetailModelItem : NSObject
@property (nonatomic, strong) NSString *startTime;
@property (nonatomic, strong) NSMutableArray *datalist;
@property (nonatomic, strong) NSString *monthId;
@property (nonatomic, strong) NSString *endTime;
@property (nonatomic, strong) NSString *pageNo;
@end
@interface BeanDetailModel : NSObject
/**
数据是否成功加载
*/
@property (nonatomic) BOOL isLoaded;
/**
数据加载错误
*/
@property (nonatomic) BOOL error;
@property (nonatomic) BeanDetailModelItem *beanDetailModelItem;
@property (nonatomic) NSMutableArray * detailItemListArray;
@property (nonatomic) NSMutableArray * detailItemListArray1;
@property (nonatomic) NSMutableArray * detailItemListArray2;
-(void)reloadBeanDetaiWithMonth:(NSString *)month;
-(void)loadMoreBeanDetaiWithMonth:(NSString *)month;
-(void)fetchBeanDetaiWithMonth:(NSString *)month clickIndex:(int)index;
@end
//
++ /dev/null
//
// BeanDetailModel.m
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import "BeanDetailModel.h"
@implementation BeanDetailItem
@end
@implementation BeanDetailModelItem
+(NSDictionary*)mj_replacedKeyFromPropertyName{
return@{@"monthId":@"id"};
}
+ (NSDictionary *)mj_objectClassInArray
{
return @{
@"datalist" : @"DetailItem",
};
}
@end
@interface BeanDetailModel()
@property(nonatomic)NSInteger currentPage;
@property (nonatomic) BOOL hasLoadAll;
@end
@interface BeanDetailModel()
//接收后台数据一次性返回的数据;
@property (nonatomic) NSMutableArray * array;
@property (nonatomic) NSMutableArray * array1;
@property (nonatomic) NSMutableArray * array2;
@property (nonatomic) NSDictionary *dic;
@property (nonatomic) NSDictionary *dic1;
@property (nonatomic) NSDictionary *dic2;
@end
@implementation BeanDetailModel
-(void)reloadBeanDetaiWithMonth:(NSString *)month{
self.currentPage = 1;
self.hasLoadAll = NO;
[self nilArrayForOut];
[self addDataWithPage:(int)self.currentPage WithMonth:month];
self.isLoaded=YES;
}
-(void)loadMoreBeanDetaiWithMonth:(NSString *)month{
self.currentPage += 1;
[self addDataWithPage:(int)self.currentPage WithMonth:month];
self.isLoaded=YES;
}
-(void)nilArrayForOut{
self.detailItemListArray=nil;
self.detailItemListArray1=nil;
self.detailItemListArray2=nil;
}
-(void)newArrayForOut{
if (self.detailItemListArray==nil) {
self.detailItemListArray=[NSMutableArray array];
}
if (self.detailItemListArray1==nil) {
self.detailItemListArray1=[NSMutableArray array];
}
if (self.detailItemListArray2==nil) {
self.detailItemListArray2=[NSMutableArray array];
}
}
-(void)addDataWithPage:(int)page WithMonth:(NSString *)month{
[self newArrayForOut];
// 返回成功反给外部10条数据;
if ([month isEqualToString:@"0"]) {
[self.detailItemListArray removeAllObjects];
[self.array enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (idx>=10*page) {
return ;
}
[self.detailItemListArray addObject:obj];
}];
}
else if ([month isEqualToString:@"1"]){
[self.detailItemListArray1 removeAllObjects];
[self.array1 enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (idx>=10*page) {
return ;
}
[self.detailItemListArray1 addObject:obj];
}];
}
else if ([month isEqualToString:@"2"]){
[self.detailItemListArray2 removeAllObjects];
[self.array2 enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (idx>=10*page) {
return ;
}
[self.detailItemListArray2 addObject:obj];
}];
}
}
-(void)fetchBeanDetaiWithMonth:(NSString *)month clickIndex:(int)index{
switch (index) {
case 0:
if (self.array.count>0) {
//数据加载成功返回十条数据
self.beanDetailModelItem= [BeanDetailModelItem mj_objectWithKeyValues:_dic];
[self addDataWithPage:1 WithMonth:[NSString stringWithFormat:@"%d",index]];
self.
self.isLoaded=YES;
return;
}
break;
case 1:
if (self.array1.count>0) {
//数据加载成功返回十条数据
self.beanDetailModelItem= [BeanDetailModelItem mj_objectWithKeyValues:_dic1];
[self addDataWithPage:1 WithMonth:[NSString stringWithFormat:@"%d",index]];
self.isLoaded=YES;
return;
}
break;
case 2:
if (self.array2.count>0) {
//数据加载成功返回十条数据
self.beanDetailModelItem= [BeanDetailModelItem mj_objectWithKeyValues:_dic2];
[self addDataWithPage:1 WithMonth:[NSString stringWithFormat:@"%d",index]];
self.isLoaded=YES;
return;
}
break;
default:
break;
}
if (self.array==nil) {
self.array=[NSMutableArray array];
}
if (self.array1==nil) {
self.array1=[NSMutableArray array];
}
if (self.array2==nil) {
self.array2=[NSMutableArray array];
}
GetData * data=[GetData shareData];
__weak typeof(self) WeakSelf=self;
[data fetchBeanDetailWithMonth:month Page:[NSString stringWithFormat:@"%ld",(long)WeakSelf.currentPage] success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSDictionary * dic=responseObject;
if ([dic[@"code"] isEqualToString:@"0"]) {
[dic[@"data"] createPropertyCode];
WeakSelf.beanDetailModelItem= [BeanDetailModelItem mj_objectWithKeyValues:dic[@"data"]];
switch (index) {
case 0:
WeakSelf.dic=dic[@"data"];
WeakSelf.array=WeakSelf.beanDetailModelItem.datalist;
break;
case 1:
WeakSelf.dic1=dic[@"data"];
WeakSelf.array1=WeakSelf.beanDetailModelItem.datalist;
break;
case 2:
WeakSelf.dic2=dic[@"data"];
WeakSelf.array2=WeakSelf.beanDetailModelItem.datalist;
break;
default:
break;
}
//数据加载成功返回十条数据
[WeakSelf addDataWithPage:1 WithMonth:[NSString stringWithFormat:@"%d",index]];
[SVProgressHUD dismiss];
WeakSelf.isLoaded=YES;
}
else{
WeakSelf.error=YES;
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
WeakSelf.error=YES;
}];
}
@end
//
++ /dev/null
//
// AimiCoinCel.h
// ColorfulSchool
//
// Created by rym on 2017/8/14.
// Copyright © 2017年 rym. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AimiCoinDetailModel.h"
#import "BeanDetailModel.h"
//艾米币,赠送豆共用
@interface AimiCoinCel : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *moneyLabel;
@property (nonatomic, strong) DetailItem * detailItem;
@end
//
++ /dev/null
//
// AimiCoinCel.m
// ColorfulSchool
//
// Created by rym on 2017/8/14.
// Copyright © 2017年 rym. All rights reserved.
//
#import "AimiCoinCel.h"
@implementation AimiCoinCel
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)setDetailItem:(DetailItem *)detailItem{
self.nameLabel.text=detailItem.flowName;
self.timeLabel.text=detailItem.flowTime;
self.moneyLabel.text=detailItem.amount;//[NSString stringWithFormat:@"%.2f",(double)detailItem.amount];//[detailItem.amount stringValue];
}
@end
<?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="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="AimiCoinCel">
<rect key="frame" x="0.0" y="0.0" width="320" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="66"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LhO-RG-deH">
<rect key="frame" x="12" y="15" width="37.5" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="dLA-G0-uv4"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PoX-eQ-HGP">
<rect key="frame" x="258" y="24" width="42" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="TGm-m7-mCj"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CM2-0u-YDf">
<rect key="frame" x="12" y="45" width="28.5" height="11"/>
<constraints>
<constraint firstAttribute="height" constant="11" id="irB-Oe-iAY"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.70588235294117641" green="0.70588235294117641" blue="0.70588235294117641" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="LhO-RG-deH" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="12" id="0bJ-mw-ORg"/>
<constraint firstItem="CM2-0u-YDf" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="12" id="6IN-UP-rUx"/>
<constraint firstItem="LhO-RG-deH" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="Hkg-TG-4Kw"/>
<constraint firstItem="CM2-0u-YDf" firstAttribute="top" secondItem="LhO-RG-deH" secondAttribute="bottom" constant="15" id="aTb-np-KvB"/>
<constraint firstItem="PoX-eQ-HGP" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="bbj-X8-YFy"/>
<constraint firstAttribute="trailingMargin" secondItem="PoX-eQ-HGP" secondAttribute="trailing" constant="12" id="oAQ-LO-pYP"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="moneyLabel" destination="PoX-eQ-HGP" id="35H-4C-mrI"/>
<outlet property="nameLabel" destination="LhO-RG-deH" id="0Sb-Ew-fTU"/>
<outlet property="timeLabel" destination="CM2-0u-YDf" id="i7N-Q6-bFE"/>
</connections>
<point key="canvasLocation" x="-82" y="-1"/>
</tableViewCell>
</objects>
</document>
//
++ /dev/null
//
// DetailHeadView.h
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DetailHeadView : UIView
@property (strong, nonatomic) IBOutlet UILabel *monthLabel;
@property (strong, nonatomic) IBOutlet UIButton *ExpandBtn;
@property (strong, nonatomic) void(^block)(id);
@end
//
++ /dev/null
//
// DetailHeadView.m
// ColorfulSchool
//
// Created by Listen on 2017/8/11.
// Copyright © 2017年 rym. All rights reserved.
//
#import "DetailHeadView.h"
@implementation DetailHeadView
- (instancetype)init{
self = [super init];
if (self) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"DetailHeadView" owner:self options:nil];
self = (DetailHeadView *)[nib firstObject];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"DetailHeadView" owner:self options:nil];
self = (DetailHeadView *)[nib firstObject];
self.frame=frame;
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (IBAction)ExpandClick:(id)sender {
//更改图片
self.block(sender);
}
@end
<?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"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="DetailHeadView">
<rect key="frame" x="0.0" y="0.0" width="375" height="55"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="calendar.png" translatesAutoresizingMaskIntoConstraints="NO" id="DFo-Pv-RCG">
<rect key="frame" x="15" y="20.5" width="14" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="14" id="8G5-Yf-vuy"/>
<constraint firstAttribute="height" constant="14" id="aRZ-0p-hLe"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="9月" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3Xf-Ng-9Do">
<rect key="frame" x="40" y="18.5" width="25.5" height="18"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OLs-1L-G1G">
<rect key="frame" x="46" y="5" width="314" height="45"/>
<constraints>
<constraint firstAttribute="width" constant="314" id="C74-Cl-ViO"/>
<constraint firstAttribute="height" constant="45" id="YOk-sF-zjq"/>
</constraints>
<inset key="imageEdgeInsets" minX="300" minY="19" maxX="0.0" maxY="19"/>
<state key="normal" image="下拉icon.png"/>
<connections>
<action selector="ExpandClick:" destination="iN0-l3-epB" eventType="touchUpInside" id="ULn-eS-4Bq"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="OLs-1L-G1G" secondAttribute="trailing" constant="15" id="MJh-fv-8je"/>
<constraint firstItem="DFo-Pv-RCG" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="15" id="PLO-VE-S7W"/>
<constraint firstItem="3Xf-Ng-9Do" firstAttribute="leading" secondItem="DFo-Pv-RCG" secondAttribute="trailing" constant="11" id="Z7E-3l-AUK"/>
<constraint firstItem="3Xf-Ng-9Do" firstAttribute="centerY" secondItem="DFo-Pv-RCG" secondAttribute="centerY" id="eE6-hS-Ugw"/>
<constraint firstItem="DFo-Pv-RCG" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="jSn-Dh-djn"/>
<constraint firstItem="OLs-1L-G1G" firstAttribute="centerY" secondItem="DFo-Pv-RCG" secondAttribute="centerY" id="lOO-AG-kvI"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="ExpandBtn" destination="OLs-1L-G1G" id="Z7D-Ff-JYf"/>
<outlet property="monthLabel" destination="3Xf-Ng-9Do" id="iwa-Rs-HBf"/>
</connections>
<point key="canvasLocation" x="314.5" y="75.5"/>
</view>
</objects>
<resources>
<image name="calendar.png" width="28" height="28"/>
<image name="下拉icon.png" width="30" height="16"/>
</resources>
</document>
//
++ /dev/null
//
// XMGTitleButton.h
// BuDeJie
//
// Created by zl on 16/3/18.
// Copyright © 2016年 zl. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface XMGTitleButton : UIButton
@end
//
++ /dev/null
//
// XMGTitleButton.m
// BuDeJie
//
// Created by zl on 16/3/18.
// Copyright © 2016年 zl. All rights reserved.
//
/*
特定构造方法
1> 后面带有NS_DESIGNATED_INITIALIZER的方法,就是特定构造方法
2> 子类如果重写了父类的【特定构造方法】,那么必须用super调用父类的【特定构造方法】,不然会出现警告
*/
/*
警告信息:Designated initializer missing a 'super' call to a designated initializer of the super class
意思:【特定构造方法】缺少super去调用父类的【特定构造方法】
*/
#import "XMGTitleButton.h"
@implementation XMGTitleButton
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
[self setTitleColor:[UIColor colorWithHexString:@"#1e1e1e"] forState:UIControlStateNormal];
[self setTitleColor:[UIColor colorWithHexString:@"#FFA713"] forState:UIControlStateSelected];
}
return self;
}
- (void)setHighlighted:(BOOL)highlighted
{ // 只要重写了这个方法,按钮就无法进入highlighted状态
}
@end
//
++ /dev/null
//
// FeedBackView.h
// ColorfulSchool
//
// Created by rym on 2017/7/13.
// Copyright © 2017年 rym. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PrefixHeader.pch"
@interface FeedBackView : UIViewController<UITextViewDelegate>
{
UILabel * promptLabel;
UITextView * contentEnter;
}
@end
//
++ /dev/null
//
// FeedBackView.m
// ColorfulSchool
//
// Created by rym on 2017/7/13.
// Copyright © 2017年 rym. All rights reserved.
//
#import "FeedBackView.h"
#import "EmotionAlertView.h"
#import <CommonCrypto/CommonDigest.h>
@interface FeedBackView ()<UITextViewDelegate,GDTMobBannerViewDelegate>
@property (nonatomic)EmotionAlertView * alert;
@property (nonatomic) UIButton * confirmBtn;
@end
@implementation FeedBackView
@synthesize confirmBtn;
- (void)viewDidLoad
{
[super viewDidLoad];
[self initNavButtons];
[self setViews];
//[[ZXTXAdTool sharedZXTXAdTool] createBannerAdByPlacmentId:kTXAdBannerPLACEMENTID currentViewController:self superView:self.view];
}
-(void)setViews
{
self.view.backgroundColor = [UIColor whiteColor];
/*
背景颜色
*/
UIView * bgView = [[UIView alloc]initWithFrame:CGRectMake(12,13, kWidth-24, 210)];
bgView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
bgView.layer.cornerRadius = 4.0;
[self.view addSubview:bgView];
/*
意见反馈输入框
*/
contentEnter = [[UITextView alloc]initWithFrame:CGRectMake(12, 34, kWidth-24-24, 176)];
contentEnter.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
contentEnter.delegate = self;
contentEnter.returnKeyType = UIReturnKeyDone;
contentEnter.layer.cornerRadius = 4.0;
contentEnter.delegate=self;
[bgView addSubview:contentEnter];
/*
监听
*/
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged) name:UITextViewTextDidChangeNotification object:contentEnter];
/*
意见反馈
*/
// UILabel * feedLabel = [[UILabel alloc]initWithFrame:CGRectMake(16, 0, 220, 44)];
// feedLabel.text = @"意见反馈";
// feedLabel.font = [UIFont systemFontOfSize:15.0];
// feedLabel.textColor = [UIColor colorWithRed:30/255.0 green:30/255.0 blue:30/255.0 alpha:1.0];
// [bgView addSubview:feedLabel];
/*
限制提示
*/
promptLabel = [[UILabel alloc]initWithFrame:CGRectMake(14, 26, 220, 44)];
promptLabel.textColor = [UIColor colorWithRed:180/255.0 green:180/255.0 blue:180/255.0 alpha:1.0];
promptLabel.font = [UIFont systemFontOfSize:12.0];
promptLabel.text = @"(字数限制在200字以内)";
[bgView addSubview:promptLabel];
/*
确认按钮
*/
confirmBtn = [[UIButton alloc]initWithFrame:CGRectMake(12, CGRectGetMaxY(contentEnter.frame)+50, kWidth-24, 44)];
[confirmBtn setBackgroundImage:kToppicBgImage forState:UIControlStateNormal];
kViewRadius(confirmBtn, 10 * k6Scale);
confirmBtn.backgroundColor = [UIColor whiteColor];
[confirmBtn setTitle:@"提 交" forState:UIControlStateNormal];
[confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
confirmBtn.titleLabel.font = [UIFont systemFontOfSize:17.0];
[confirmBtn addTarget:self action:@selector(confirmBtnFuc) forControlEvents:UIControlEventTouchUpInside];
confirmBtn.layer.cornerRadius = 6.0;
[self.view addSubview:confirmBtn];
}
/*
提交资料
*/
-(void)initNavButtons
{
UILabel* titleLabel = [MCCustomizeControl customizeLabel:@"意见反馈"
backgroundColor:[UIColor clearColor] font:[UIFont boldSystemFontOfSize:MC_NAVBAR_TITLE_FONT_SIZE] textColor:[UIColor colorWithHexString:@"#f3f3f3"] textAlignment:NSTextAlignmentCenter lineBreakMode:NSLineBreakByWordWrapping];
self.navigationItem.titleView = titleLabel;
}
/*
字典转字符串
*/
- (NSString*)dictionaryToJson:(NSDictionary *)dic
{
NSError *parseError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
-(void)confirmBtnFuc
{
confirmBtn.enabled=NO;
if ([BYHelp stringContainsEmoji:contentEnter.text]) {
NSLog(@"含有表情");
if (_alert!=nil) {
[_alert removeFromSuperview];
_alert=nil;
}
_alert=[[EmotionAlertView alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
_alert.message=@"不能输入表情";
__weak typeof(self) weakSelf=self;
[_alert setOkClick:^{
weakSelf.confirmBtn.enabled=YES;
[weakSelf.alert removeFromSuperview];
}];
AppDelegate * app = (AppDelegate*)[UIApplication sharedApplication].delegate;
[app.window addSubview:_alert];
[_alert mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.bottom.mas_equalTo(@(0));
}];
return;
}else {
NSLog(@"不含有表情");
}
if (contentEnter.text.length < 1) {
[contentEnter becomeFirstResponder];
[SVProgressHUD showErrorWithStatus:@"请输入反馈内容"];
confirmBtn.enabled=YES;
return;
}
[self oldFeedback];
}
#pragma mark - ==========老版本反馈==========
- (void) oldFeedback {
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"]) {
[ZXTool showText:@" 反馈成功 "];
[self performSelector:@selector(delayMethod) withObject:nil afterDelay:0.5f];
} else {
[SVProgressHUD showErrorWithStatus:@"反馈失败"];
self->confirmBtn.enabled=YES;
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
self->confirmBtn.userInteractionEnabled = YES;
[ZXTool showText:@" 网络错误 "];
NSLog(@"输出接口错误:%@",error);
self->confirmBtn.enabled=YES;
}];
}
-(void)delayMethod
{
[self.navigationController popViewControllerAnimated:YES];
confirmBtn.enabled=YES;
}
/*
内容变化时
*/
-(void)textChanged
{
promptLabel.hidden = contentEnter.text.length != 0;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[contentEnter endEditing:YES];
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
if ([text isEqualToString:@"\n"]){ //判断输入的字是否是回车,即按下return
[contentEnter endEditing:YES];
//在这里做你响应return键的代码
return NO; //这里返回NO,就代表return键值失效,即页面上按下return,不会出现换行,如果为yes,则输入页面会换行
}
NSString *new = [contentEnter.text stringByReplacingCharactersInRange:range withString:text];
NSInteger res = 200-[new length];
if(res >= 0){
return YES;
}
//zl
else
{
[SVProgressHUD showErrorWithStatus:@"字数限制在200字以内"];
return NO;
}
}
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
super.navigationController.navigationBar.hidden = NO;
}
/*
md5加密
*/
-(NSString *)md5:(NSString *) input
{
// const char *cStr = [input UTF8String];
// unsigned char digest[CC_MD5_DIGEST_LENGTH];
// CC_MD5( cStr, strlen(cStr), digest ); //This is the md5 call
// NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
// for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
// [output appendFormat:@"%02x", digest[i]];
// return output;
//传入参数,转化成char
const char * str = [input UTF8String];
//开辟一个16字节(128位:md5加密出来就是128位/bit)的空间(一个字节=8字位=8个二进制数)
unsigned char md[CC_MD5_DIGEST_LENGTH];
/*
7 extern unsigned char * CC_MD5(const void *data, CC_LONG len, unsigned char *md)官方封装好的加密方法
8 把str字符串转换成了32位的16进制数列(这个过程不可逆转) 存储到了md这个空间中
9 */
CC_MD5(str, (int)strlen(str), md);
//创建一个可变字符串收集结果
NSMutableString * ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH];
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
/**
15 X 表示以十六进制形式输入/输出
16 02 表示不足两位,前面补0输出;出过两位不影响
17 printf("%02X", 0x123); //打印出:123
18 printf("%02X", 0x1); //打印出:01
19 */
[ret appendFormat:@"%02X",md[i]];
}
//返回一个长度为32的字符串
return ret;
}
@end
//
++ /dev/null
//
// MineViewController.h
// ColorfulSchool
//
// Created by Listen on 2017/8/10.
// Copyright © 2017年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MineViewController : UIViewController
@end
//
//
// ZXChangeCommonView.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/8/29.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXChangeCommonView : UIView
/** */
@property (nonatomic, strong) UITextField *textField;
/** 是否显示可见按钮 */
@property (nonatomic, assign) BOOL isShowSeeBtn;
@end
NS_ASSUME_NONNULL_END
//
//
// ZXChangeCommonView.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/8/29.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXChangeCommonView.h"
#import "enlargeClickRegionBtn.h"
@interface ZXChangeCommonView()
/** */
@property (nonatomic, strong) enlargeClickRegionBtn *see;
@end
@implementation ZXChangeCommonView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.backgroundColor = RGB(235, 235, 235);
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(10 * k6Scale, 0, 250, 45 * k6Scale)];
[self addSubview:self.textField ];
self.textField.font = kFontSize(14 * k6Scale);
self.textField.textColor = [UIColor colorWithHexString:@"#333333"];
self.see = [[enlargeClickRegionBtn alloc] init];
[self addSubview:self.see];
[self.see setBackgroundImage:[UIImage imageNamed:@"Not-showtwo"] forState:UIControlStateNormal];
[self.see setBackgroundImage:[UIImage imageNamed:@"showtwo"] forState:UIControlStateSelected];
[self.see mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.mas_right).offset(-15 * k6Scale);
make.centerY.equalTo(self);
make.width.mas_equalTo(19.5 * k6Scale);
make.height.mas_equalTo(11 * k6Scale);
}];
@weakify(self);
[[self.see rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(UIButton *x) {
@strongify(self);
x.selected = !x.selected;
self.textField .secureTextEntry = !x.selected;
}];
}
return self;
}
- (void)setIsShowSeeBtn:(BOOL)isShowSeeBtn {
_isShowSeeBtn = isShowSeeBtn;
self.textField.secureTextEntry = _isShowSeeBtn;
self.see.hidden = !_isShowSeeBtn;
}
@end
//
//
// ZXChangeMsgViewController.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/8/29.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef enum : NSUInteger {
ZXChangeLoginPwd = 0,
ZXChangeDevicePwd,
ZXChangeLoginAccount,
} ZXChangeMsg;
NS_ASSUME_NONNULL_BEGIN
@interface ZXChangeMsgViewController : UIViewController
/** 更改类型 */
@property (nonatomic, assign) ZXChangeMsg changeType;
@end
NS_ASSUME_NONNULL_END
//
++ /dev/null
//
// updateViewController.h
// ColorfulSchool
//
// Created by Listen on 2017/8/8.
// Copyright © 2017年 rym. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface updateViewController : UIViewController
@property (nonatomic, strong)NSString * titleStr;
@end
//
++ /dev/null
//
// ChangeDevicePasswordModel.h
// ColorfulSchool
//
// Created by Listen on 2017/8/9.
// Copyright © 2017年 rym. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ChangeDevicePasswordModel : NSObject
/**
数据是否成功加载
*/
@property (nonatomic) BOOL isLoaded;
/**
数据加载错误
*/
@property (nonatomic) BOOL error;
-(void)changeDevicePasswordWithOldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword;
@end
//
++ /dev/null
//
// ChangeDevicePasswordModel.m
// ColorfulSchool
//
// Created by Listen on 2017/8/9.
// Copyright © 2017年 rym. All rights reserved.
//
#import "ChangeDevicePasswordModel.h"
@implementation ChangeDevicePasswordModel
-(void)changeDevicePasswordWithOldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword{
GetData * data=[GetData shareData];
__weak typeof(self) WeakSelf=self;
[data changeDevicePasswordWithOldPassword:oldPassword newPassword:newPassword success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSDictionary * dic=responseObject;
if ([dic[@"code"] isEqualToString:@"0"]) {
[SVProgressHUD showSuccessWithStatus:@"设备密码修改成功"];
WeakSelf.isLoaded=YES;
}
else{
if (dic[@"msg"]) {
[SVProgressHUD showErrorWithStatus:dic[@"msg"]];
}
WeakSelf.error=YES;
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
WeakSelf.error=YES;
}];
}
@end
//
++ /dev/null
//
// ChangePassWordModel.h
// ColorfulSchool
//
// Created by Listen on 2017/8/9.
// Copyright © 2017年 rym. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ChangePassWordModel : NSObject
/**
数据是否成功加载
*/
@property (nonatomic) BOOL isLoaded;
/**
数据加载错误
*/
@property (nonatomic) BOOL error;
-(void)changePasswordWithOldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword;
@end
//
++ /dev/null
//
// ChangePassWordModel.m
// ColorfulSchool
//
// Created by Listen on 2017/8/9.
// Copyright © 2017年 rym. All rights reserved.
//
#import "ChangePassWordModel.h"
@implementation ChangePassWordModel
-(void)changePasswordWithOldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword{
GetData * data=[GetData shareData];
__weak typeof(self) WeakSelf=self;
[data changePasswordWithOldPassword:oldPassword newPassword:newPassword success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSDictionary * dic=responseObject;
if ([dic[@"code"] isEqualToString:@"0"]) {
// [SVProgressHUD showSuccessWithStatus:dic[@"msg"]];
[SVProgressHUD showSuccessWithStatus:@"密码修改成功"];
WeakSelf.isLoaded=YES;
}
else{
if (dic[@"msg"]) {
[SVProgressHUD showErrorWithStatus:dic[@"msg"]];
}
WeakSelf.error=YES;
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[SVProgressHUD dismiss];
WeakSelf.error=YES;
}];
}
@end
//
++ /dev/null
//
// ChangePhoneModel.h
// ColorfulSchool
//
// Created by Listen on 2017/8/9.
// Copyright © 2017年 rym. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ChangePhoneModel : NSObject
/**
数据是否成功加载
*/
@property (nonatomic) BOOL isLoaded;
/**
数据加载错误
*/
@property (nonatomic) BOOL error;
-(void)changePhoneWithPhoneNum:(NSString *)phoneNum oldPwd:(NSString*)oldPwd checkCode:(NSString *)checkCode;
@end
//
++ /dev/null
//
// ChangePhoneModel.m
// ColorfulSchool
//
// Created by Listen on 2017/8/9.
// Copyright © 2017年 rym. All rights reserved.
//
#import "ChangePhoneModel.h"
@implementation ChangePhoneModel
-(void)changePhoneWithPhoneNum:(NSString *)phoneNum oldPwd:(NSString*)oldPwd checkCode:(NSString *)checkCode{
GetData * data=[GetData shareData];
__weak typeof(self) WeakSelf=self;
[data changePhoneWithPhoneNum:phoneNum oldPwd:oldPwd checkCode:checkCode success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSDictionary * dic=responseObject;
if ([dic[@"code"] isEqualToString:@"0"]) {
[SVProgressHUD showSuccessWithStatus:@"更换手机账户成功"];
WeakSelf.isLoaded=YES;
}
else{
if (dic[@"msg"]) {
[SVProgressHUD showErrorWithStatus:dic[@"msg"]];
}
WeakSelf.error=YES;
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
WeakSelf.error=YES;
}];
}
@end
//
//
......@@ -21,9 +21,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) NSInteger switchType;
@property (nonatomic, assign) BOOL isCleanCache; //是缓存清理
@property (nonatomic, assign) BOOL isShowAlertBtn; //是缓存清理
/** 提醒文字描述 */
@property (nonatomic, copy) NSString *alertDes;
@end
NS_ASSUME_NONNULL_END
//
//
......@@ -8,6 +8,8 @@
#import "ZXUserSettingTableViewCell.h"
#import "XMGFileTool.h"
#import "enlargeClickRegionBtn.h"
#import "ZXAimiWalletAlertView.h"
typedef void(^totalSize)(NSString *size);
@interface ZXUserSettingTableViewCell()
......@@ -19,6 +21,12 @@ typedef void(^totalSize)(NSString *size);
@property (nonatomic, strong) UISwitch *mySwitch;
@property (nonatomic, strong) UILabel *cacheNumLalebl;
/** */
@property (nonatomic, strong) ZXAimiWalletAlertView *alertView;
/** */
@property (nonatomic, strong) enlargeClickRegionBtn *showAlertBtn;
@end
@implementation ZXUserSettingTableViewCell
......@@ -77,6 +85,24 @@ typedef void(^totalSize)(NSString *size);
make.centerY.equalTo(arrow);
}];
self.cacheNumLalebl.hidden = YES;
self.showAlertBtn = [[enlargeClickRegionBtn alloc] init];
[self.contentView addSubview:self.showAlertBtn];
[self.showAlertBtn setBackgroundImage:[UIImage imageNamed:@"ic_wenhao"] forState:UIControlStateNormal];
[self.showAlertBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel.mas_right).offset(5 * k6Scale);
make.centerY.equalTo(self.titleLabel.mas_centerY);
make.width.height.mas_equalTo(15 * k6Scale);
}];
kWeakSelf(self);
[[self.showAlertBtn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(enlargeClickRegionBtn *x) {
kStrongSelf(self);
[ZXTool showCustomMsg:self.model.alertDes];
}];
}
return self;
}
......@@ -124,6 +150,11 @@ typedef void(^totalSize)(NSString *size);
self.cacheNumLalebl.text = size;
}];
}
self.showAlertBtn.hidden = !_model.isShowAlertBtn;
if (_model.alertDes) {
self.alertView.alertDesc = _model.alertDes;
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
//
//
......@@ -157,13 +157,6 @@ typedef void(^checkIsOldCustomer)(BOOL isOld);
+(void) codePageIsNeedCheckNotPayOrder:(dispatch_block_t) completed;
//查询当前用户模式
/*
* completd 回调 yes 老模式 no新模式
*/
+(void) checkCurrentUserModeCompleted:(checkIsOldCustomer) completed;
/*获取用户信息 并回调首充状态*/
+(void) fetchUserInfoCompleted:(checkIsOldCustomer) completed;
+ (void) saveUserInfo:(ZXUserModel *) user;
......
//
//
......@@ -755,7 +755,7 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
token = @"";
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
@weakify(self);
[XMCenter sendRequest:^(XMRequest *request) {
request.url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
request.httpMethod = type;
......@@ -1553,23 +1553,6 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
#pragma mark - ==========是否需要在条码页轮训待支付订单==========
+(void) codePageIsNeedCheckNotPayOrder:(dispatch_block_t) completed {
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", @"clientSource":[ZXTool returnNormalHTTPHeaderJson]};
} onSuccess:^(id responseObject) {
if ([responseObject[@"code"] integerValue] == 1000) {
if (responseObject[@"data"] && ![responseObject[@"data"] isKindOfClass:[NSNull class]]) {
if (responseObject[@"data"][@"mode"] == nil || [responseObject[@"data"][@"mode"] isKindOfClass:[NSNull class]]) {
return ;
}
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];
......@@ -1587,49 +1570,9 @@ void ProviderReleaseData (void *info, const void *data, size_t size){
} onFailure:^(NSError *error) {
} onFinished:^(id responseObject, NSError *error) {
}];
}
}
}
} onFailure:^(NSError *error) {
} onFinished:^(id responseObject, NSError *error) {
}];
}
#pragma mark - ==========当前模式==========
+(void) checkCurrentUserModeCompleted:(checkIsOldCustomer) completed {
if (![CacheCampusId isKindOfClass:[NSString class]]) {
completed(NO);
return;
}
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", @"clientSource":[ZXTool returnNormalHTTPHeaderJson]};
} onSuccess:^(id responseObject) {
if ([responseObject[@"code"] integerValue] == 1000) {
if (responseObject[@"data"] && ![responseObject[@"data"] isKindOfClass:[NSNull class]]) {
if (responseObject[@"data"][@"mode"] == nil || [responseObject[@"data"][@"mode"] isKindOfClass:[NSNull class]]) {
completed(YES);
} else {
completed(NO);
}
} else {
completed(YES);
}
} else {
completed(YES);
}
} onFailure:^(NSError *error) {
completed(YES);
} onFinished:^(id responseObject, NSError *error) {
}];
}
#pragma mark - ==========获取用户信息==========
/*获取用户信息*/
+(void) fetchUserInfoCompleted:(checkIsOldCustomer) completed {
......
......@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.8.8</string>
<string>3.8.9</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "Not-show-icon---Assistor.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Password-icon---Assistor.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "show.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "user-icon---Assistor.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
++ /dev/null
{
"images" : [
{
"idiom" : "universal",
"filename" : "登录-ios.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "logo-1.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
{
......@@ -2,15 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "余额背景---Assistor.png",
"filename" : "ic_wenhao.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_wenhao@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_wenhao@3x.png",
"scale" : "3x"
}
],
......
......@@ -7,7 +7,6 @@ target 'ColorfulSchool' do
pod 'MJRefresh'
pod 'SVProgressHUD'
pod 'AFNetworking', '~> 2.6.3'
# pod 'AFNetworking', '~> 3.2.1'
pod 'Masonry'
pod 'XRCarouselView'
pod 'JPush'
......
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