Commit 294283e9 authored by Sandy's avatar Sandy

初始化项目主体框架,登录,销售工分列表界面搭建、接口调用

parent 319a96d2
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Car.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Car.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
//
// AppDelegate.h
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
//
// AppDelegate.m
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "leftvc_bill.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "leftvc_bill@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "leftvc_bill@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "leftvc_cash.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "leftvc_cash@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "leftvc_cash@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "leftvc_login_out.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "leftvc_login_out@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "leftvc_login_out@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "leftvc_modify_psw.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "leftvc_modify_psw@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "leftvc_modify_psw@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "leftvc_user_placeholder.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "leftvc_user_placeholder@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "leftvc_user_placeholder@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "login_input_psw.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "login_input_psw@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "login_input_psw@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "login_top_icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "login_top_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "login_top_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "loin_input_user.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "loin_input_user@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "loin_input_user@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"resizing" : {
"mode" : "3-part-horizontal",
"center" : {
"mode" : "tile",
"width" : 4
},
"cap-insets" : {
"right" : 0,
"left" : 0
}
},
"idiom" : "universal",
"filename" : "list_line.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" : "list_no_data.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "list_no_data@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "list_no_data@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "main_left_bar_item.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "main_left_bar_item@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "main_left_bar_item@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "main_right_bar_item.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "main_right_bar_item@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "main_right_bar_item@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "right_arrow.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" : "side_bg.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "side_bg@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "side_bg@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
This diff is collapsed.
//
// LeftTableViewController.h
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LeftTableViewController : UITableViewController
@end
//
// LeftTableViewController.m
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "LeftTableViewController.h"
@interface LeftTableViewController ()
@end
@implementation LeftTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (indexPath.row == 0) {//流水账单
}else if (indexPath.row == 1) {//金额提现
}else if (indexPath.row == 2) {//核销卡券
}else if (indexPath.row == 3) {//修改密码
}else if (indexPath.row == 4) {//退出登录
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
// Configure the cell...
return cell;
}
*/
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
/*
#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
//
// LoginViewController.h
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LoginViewController : UIViewController
@end
//
// LoginViewController.m
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "LoginViewController.h"
#import "MainViewController.h"
#import "LeftTableViewController.h"
#import "WWSideslipViewController.h"
#import "HttpCilent.h"
@interface LoginViewController ()
@property(weak, nonatomic) IBOutlet UITextField *textFieldUser;
@property(weak, nonatomic) IBOutlet UITextField *textFieldPsw;
@end
@implementation LoginViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self configUI];
// Do any additional setup after loading the view.
}
- (void)configUI {
self.textFieldUser.text = kGlobal.userName;
self.textFieldPsw.text = kGlobal.userPsw;
}
#pragma mark - actions
- (IBAction)actionLogin:(id)sender {
kCanNotBeNil(self.textFieldUser.text, @"工号不能为空!");
kCanNotBeNil(self.textFieldPsw.text, @"密码不能为空!");
NSDictionary *myDictionary = @{
@"userName" : self.textFieldUser.text,
@"password" : self.textFieldPsw.text,
@"longitude" : @"30.9813540",
@"latitude" : @"121.7236680"
};
WS(weakSelf);
[MBProgressHUD j_loading:@"登录中…"];
[kHttp POST:kLoginUrl
parameters:myDictionary
complete:^(id _Nullable response, NSError *_Nullable error) {
[MBProgressHUD j_hideLoadingView];
if (response) {
UINavigationController *mainNaVC =
[self storyboardType:STORYBOARD_TYPE_MAIN
identifier:@"MainNavigationController"];
LeftTableViewController *leftVC = [LeftTableViewController
viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN];
WWSideslipViewController *sideVC = [[WWSideslipViewController alloc]
initWithLeftView:leftVC
andMainView:mainNaVC
andRightView:nil
andBackgroundImage:[UIImage imageNamed:@"side_bg"]];
kGlobal.loginResult =
[[LoginResult alloc] initWithDictionary:response[@"data"]
error:nil];
kGlobal.sideSlipVC = sideVC;
kGlobal.userName = weakSelf.textFieldUser.text;
kGlobal.userPsw = weakSelf.textFieldPsw.text;
sideVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:sideVC animated:YES completion:nil];
}
}];
}
- (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
//
// OrderListTableViewCell.h
// Car
//
// Created by Javen on 2016/12/26.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OrderListTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *labelTime;
@property (weak, nonatomic) IBOutlet UILabel *labelStation;
@property (weak, nonatomic) IBOutlet UILabel *labelOil;
@property (weak, nonatomic) IBOutlet UILabel *labelBillNumber;
@property (weak, nonatomic) IBOutlet UILabel *labelPrice;
- (void)configCellArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath;
@end
//
// OrderListTableViewCell.m
// Car
//
// Created by Javen on 2016/12/26.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "OrderListTableViewCell.h"
#import "OrderListModel.h"
@implementation OrderListTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)configCellArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath {
OrderListModel *model = array[indexPath.row];
self.labelTime.text = [model.payTime substringToIndex:16];
self.labelStation.text = [NSString stringWithFormat:@"%@ - %@",model.stationName, model.stationUserName];
self.labelOil.text = [NSString stringWithFormat:@"%@ - %@",model.gasItemName, model.oilGunName];
self.labelBillNumber.text = model.billNumber;
self.labelPrice.text = [model.deduct stringValue];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// OrderListModel.h
// Car
//
// Created by Javen on 2016/12/26.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "car_objc_json_client.h"
@interface OrderListModel : OrderEntity
@end
//
// OrderListModel.m
// Car
//
// Created by Javen on 2016/12/26.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "OrderListModel.h"
@implementation OrderListModel
@end
//
// MainViewController.h
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MainViewController : BaseListViewController
@end
//
// MainViewController.m
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "MainViewController.h"
#import "HttpCilent.h"
#import "OrderListTableViewCell.h"
#import "OrderListModel.h"
@interface MainViewController ()
@end
@implementation MainViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self httpRequest];
}
- (void)httpRequest {
NSDictionary *myDictionary = @{@"orders" : @[@{@"field" : @"payTime",
@"direction" : @"desc"}],
@"pageNumber" : @(self.page),
@"pageSize" : @(self.pageSize),
@"userId" : kUser.fid,
@"userNameLike" : [NSNull null],
@"billNumberLike" : [NSNull null],
@"endDate" : [NSNull null],
@"state" : @"paid"};
WS(weakSelf);
[kHttp POST:kOrderQuery parameters:myDictionary complete:^(id _Nullable response, NSError * _Nullable error) {
if ([response[@"code"] isEqualToNumber:@0]) {
for (NSDictionary *dict in response[@"data"][@"records"]) {
OrderListModel *model = [[OrderListModel alloc] initWithDictionary:dict error:nil];
[weakSelf.arrData addObject:model];
}
[weakSelf listTableViewReloadData];
}else{
if (self.page > 0) {
self.page--;
}
}
}];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 166;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.arrData.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
OrderListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrderListTableViewCell" forIndexPath:indexPath];
[cell configCellArray:self.arrData indexPath:indexPath];
return cell;
}
#pragma mark - actions
- (IBAction)actionLeft:(UIBarButtonItem *)sender {
[kGlobal.sideSlipVC showLeftView];
}
- (IBAction)actionRight:(id)sender {
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
//
// PrefixHeader.pch
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#ifndef PrefixHeader_pch
#define PrefixHeader_pch
#import "ToolHeader.h"
//colors
#define kMainOrangeColor [UIColor colorWithRed:0.89 green:0.44 blue:0.23 alpha:1.00]
//主题色
#define kMainColor kMainOrangeColor
#ifdef DEBUG
#define CLog(format, ...) \
NSLog((@"[L %d] %s " format), __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
#else
#define CLog(format, ...)
#endif
#define kFalseHttpTips \
if (responseObject) { \
[MBProgressHUD j_error:responseObject[@"message"] complete:nil]; \
}
#define kWindow [UIApplication sharedApplication].keyWindow
#define kBounds [UIScreen mainScreen].bounds
#define kWidth [UIScreen mainScreen].bounds.size.width
#define kHeight [UIScreen mainScreen].bounds.size.height
#define kAutoValue(value) (float)value / 375 * kWidth
#define WS(weakSelf) __weak __typeof(&*self) weakSelf = self
//收起键盘
#define HIDE_KEYBOARD \
[[UIApplication sharedApplication].keyWindow endEditing:YES]
// Include any system framework and library headers here that should be included
// in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of
// your targets to reference this file.
#endif /* PrefixHeader_pch */
//
// URL.h
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#ifndef URL_h
#define URL_h
static NSString *const VersionName = @"车族通测试版";
static NSString *const BASE_IP = @"http://test.gomoretech.com";
/** 请求基准地址 */
#define REST_BASE_URL [NSString stringWithFormat:@"%@/car-web/app", BASE_IP]
static NSString *const kLoginUrl = @"stationUser/login";
static NSString *const kUpgradeUrl = @"stationUser/getUpgrade";
static NSString *const kModifyPswUrl = @"stationUser/modifyPassword";
static NSString *const kResetPswUrl = @"stationUser/resetPassword";
static NSString *const kGetUserInfo = @"account/get";
static NSString *const kOrderQuery = @"order/query";
#endif /* URL_h */
This diff is collapsed.
#import "car_objc_json_client.h"
NSString * const QUERYORDERDIRECTION_ASC = @"asc";
NSString * const QUERYORDERDIRECTION_DESC = @"desc";
@implementation QueryResultPaging
@synthesize page;
@synthesize pageSize;
@synthesize pageCount;
@synthesize recordCount;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation ExceptionCode
@synthesize code;
@synthesize message;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation RsResponse
@synthesize code;
@synthesize message;
@synthesize data;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation LoginResult
@synthesize user;
@synthesize station;
@synthesize createOrderUrl;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation ResetPasswordRequest
@synthesize userName;
@synthesize smsCode;
@synthesize fnewPassword;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"newPassword": @"fnewPassword",
}];
}
@end
@implementation ModifyPasswordRequest
@synthesize userName;
@synthesize oldPassword;
@synthesize fnewPassword;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"newPassword": @"fnewPassword",
}];
}
@end
@implementation StationUserAcctHisEntity
@synthesize fid;
@synthesize createName;
@synthesize createBy;
@synthesize createDate;
@synthesize updateName;
@synthesize updateBy;
@synthesize updateDate;
@synthesize sysOrgCode;
@synthesize sysCompanyCode;
@synthesize userId;
@synthesize oldBalance;
@synthesize occur;
@synthesize fnewBalance;
@synthesize billNumber;
@synthesize action;
@synthesize remark;
@synthesize userName;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"newBalance": @"fnewBalance",
@"id": @"fid",
}];
}
@end
@implementation OrderEntity
@synthesize fid;
@synthesize createName;
@synthesize createBy;
@synthesize createDate;
@synthesize updateName;
@synthesize updateBy;
@synthesize updateDate;
@synthesize sysOrgCode;
@synthesize sysCompanyCode;
@synthesize billNumber;
@synthesize stationId;
@synthesize stationName;
@synthesize stationUserId;
@synthesize stationUserName;
@synthesize memberId;
@synthesize memberName;
@synthesize memberMobilephone;
@synthesize oilGunId;
@synthesize oilGunName;
@synthesize gasItemId;
@synthesize gasItemName;
@synthesize total;
@synthesize realPayTotal;
@synthesize payTime;
@synthesize payMethod;
@synthesize deduct;
@synthesize invoice;
@synthesize printed;
@synthesize lstPrintedTime;
@synthesize payFlowNum;
@synthesize state;
@synthesize remark;
@synthesize printId;
@synthesize vehicleNo;
@synthesize payFailedMsg;
@synthesize printState;
@synthesize invoiceId;
@synthesize alipayBuyerId;
@synthesize alipaybuyerLogonId;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"id": @"fid",
}];
}
@end
@implementation IdEntity
@synthesize fid;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"id": @"fid",
}];
}
@end
@implementation CheckTicketRequest
@synthesize ticketNumber;
@synthesize checkManId;
@synthesize checkManName;
@synthesize checkDate;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation LoginRequest
@synthesize userName;
@synthesize password;
@synthesize longitude;
@synthesize latitude;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation RsQueryResult
@synthesize paging;
@synthesize page;
@synthesize pageSize;
@synthesize pageCount;
@synthesize recordCount;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation QueryOrder
@synthesize field;
@synthesize direction;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation QueryDefinition
@synthesize orders;
@synthesize pageNumber;
@synthesize pageSize;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation TSBaseUser
@synthesize userType;
@synthesize departid;
@synthesize signature;
@synthesize browser;
@synthesize userKey;
@synthesize status;
@synthesize activitiSync;
@synthesize password;
@synthesize userName;
@synthesize realName;
@synthesize currentDepart;
@synthesize userOrgList;
@synthesize deleteFlag;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation TSDepart
@synthesize TSPDepart;
@synthesize departname;
@synthesize fdescription;
@synthesize TSDeparts;
@synthesize orgCode;
@synthesize orgType;
@synthesize mobile;
@synthesize fax;
@synthesize address;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"description": @"fdescription",
}];
}
@end
@implementation TSUserOrg
@synthesize tsUser;
@synthesize tsDepart;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation OrderQueryDefintion
@synthesize userId;
@synthesize userNameLike;
@synthesize billNumberLike;
@synthesize endDate;
@synthesize state;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation OrderQueryResult
@synthesize records;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation AccountHistoryQueryResult
@synthesize records;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation AccountHistoryQueryDefintion
@synthesize userId;
@synthesize beginDate;
@synthesize endDate;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation TSUser
@synthesize signatureFile;
@synthesize mobilePhone;
@synthesize officePhone;
@synthesize email;
@synthesize createDate;
@synthesize createBy;
@synthesize createName;
@synthesize updateDate;
@synthesize updateBy;
@synthesize updateName;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation StationEntity
@synthesize createName;
@synthesize createBy;
@synthesize createDate;
@synthesize updateName;
@synthesize updateBy;
@synthesize updateDate;
@synthesize sysOrgCode;
@synthesize sysCompanyCode;
@synthesize province;
@synthesize city;
@synthesize county;
@synthesize brand;
@synthesize longitude;
@synthesize latitude;
@synthesize partner;
@synthesize services;
@synthesize grade;
@synthesize remark;
@synthesize printerMachineCode;
@synthesize printerKey;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation StationUserEntity
@synthesize worknum;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
//
// main.m
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
//
// BaseListViewController.h
// RealEstateManagement
//
// Created by Javen on 16/9/8.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BaseViewController.h"
#import "UITableView+Addtions.h"
#import "UIScrollView+EmptyDataSet.h"
@interface BaseListViewController : BaseViewController<UITableViewDelegate, UITableViewDataSource, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *arrData;
/**
* 分页加载时记录当前页数
*/
@property (nonatomic, assign) NSInteger page;
/**
* 分页加载一页大小
*/
@property (nonatomic, assign) NSInteger pageSize;
/**
* 启用分页加载模式,还需要手动调用httpRequest
*/
- (void)paggingMode;
/**
* 请求数据要重写这个方法,在这个方法里面请求数据,获取数据后调用showData方法,展示获取到的数据
*/
- (void)httpRequest;
/**
* 选中列表cell之后
*/
- (void)listDidSelect:(id)model;
/**
* 刷新tableView
*/
- (void)listTableViewReloadData;
- (void)listTableViewReloadDataWithNewRecord:(NSArray *)newRecord;
/**
* 下拉刷新
*/
- (void)refresh;
@end
//
// BaseListViewController.m
// RealEstateManagement
//
// Created by Javen on 16/9/8.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BaseListViewController.h"
#import "MJRefresh.h"
@interface BaseListViewController ()
@end
@implementation BaseListViewController
#pragma mark - life cycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.pageSize = 15;
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.emptyDataSetSource = self;
self.tableView.emptyDataSetDelegate = self;
self.tableView.estimatedRowHeight = 159;
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.tableFooterView = [UIView new];
[self paggingMode];
// Do any additional setup after loading the view.
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/**
* 启用分页加载(最好在ViewDidLoad里面调用)
*/
- (void)paggingMode
{
WS(weakSelf);
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 0;
[weakSelf.arrData removeAllObjects];
/**
* 子类里面要重写httpRequest方法
*/
[MBProgressHUD j_loading];
[weakSelf httpRequest];
}];
self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf httpRequest];
}];
self.tableView.mj_footer.hidden = YES;
}
- (void)refresh
{
[self.tableView.mj_header beginRefreshing];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.arrData.count;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[self listDidSelect:self.arrData[indexPath.row]];
}
#pragma mark - empty state
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
{
return [UIImage imageNamed:@"list_no_data"];
}
- (void)emptyDataSet:(UIScrollView *)scrollView didTapView:(UIView *)view
{
[self.tableView.mj_header beginRefreshing];
}
- (CAAnimation *)imageAnimationForEmptyDataSet:(UIScrollView *)scrollView
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 0.0, 0.0, 1.0)];
animation.duration = 1;
animation.cumulative = YES;
animation.repeatCount = MAXFLOAT;
return animation;
}
- (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
{
return [UIColor whiteColor];
}
- (IBAction)actionAdd:(UIButton *)sender
{
}
- (void)listTableViewReloadData
{
[MBProgressHUD j_hideLoadingView];
[self.tableView reloadData];
[self.tableView j_endRefresh];
self.tableView.mj_footer.hidden = self.arrData.count == 0;
if (self.arrData.count < self.pageSize * self.page) {
[self.tableView.mj_footer endRefreshingWithNoMoreData];
}
}
- (void)listTableViewReloadDataWithNewRecord:(NSArray *)newRecord
{
[self listTableViewReloadData];
CLog(@"newrecord count = %lu", newRecord.count);
if ([newRecord count] < self.pageSize) {
[self.tableView.mj_footer endRefreshingWithNoMoreData];
}
}
- (NSMutableArray *)arrData
{
if (!_arrData) {
_arrData = [NSMutableArray array];
}
return _arrData;
}
/*
#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
//
// BaseViewController.h
// RealEstateManagement
//
// Created by Z on 16/6/24.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void (^blockCommplete)(void);
@interface BaseViewController : UIViewController
/**
* 页面跳转之后的回调,手动调用,可选
*/
@property(nonatomic, copy) blockCommplete commplete;
/**
push到指定页面,并且返回的时候执行回调函数
@param vc 目标vc
@param commplete 回调
*/
- (void)pushTo:(BaseViewController *)vc commplete:(blockCommplete)commplete;
@end
//
// BaseViewController.m
// RealEstateManagement
//
// Created by Z on 16/6/24.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BaseViewController.h"
#import "MBProgressHUD.h"
@interface BaseViewController ()
@property (nonatomic, copy) blockCommplete pushCommplete;
@end
@implementation BaseViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithWhite:0.965 alpha:1.000];
// Do any additional setup after loading the view.
}
- (void)pushTo:(BaseViewController *)vc commplete:(blockCommplete)commplete {
[self.navigationController pushViewController:vc animated:YES];
vc.pushCommplete = commplete;
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
if (self.pushCommplete) {
self.pushCommplete();
}
}
- (void)dealloc {
CLog(@"%@页面释放", NSStringFromClass([self class]));
}
- (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
//
// CategoryHeader.h
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#ifndef CategoryHeader_h
#define CategoryHeader_h
#import "MBProgressHUD+Addtions.h"
#import "UIViewController+Additions.h"
#endif /* CategoryHeader_h */
//
// MBProgressHUD+Addtions.h
// RealEstateManagement
//
// Created by Z on 16/6/24.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <MBProgressHUD/MBProgressHUD.h>
@interface MBProgressHUD (Addtions)
+ (MBProgressHUD *)Javen_showSuccess:(NSString *)success onView:(UIView *)view delay:(NSTimeInterval)time complete:(void (^)(void))complete;
+ (void)Javen_showError:(NSString *)error onView:(UIView *)view delay:(NSTimeInterval)time complete:(void (^)(void))complete;
+ (MBProgressHUD *)JVShowMessage:(NSString *)message onView:(UIView *)view autoDisppear:(BOOL)autoDisppear;
/**
* 展示成功信息 自动消失
*
* @param success 显示文字
* @param complete 完成回调
*/
+ (void)j_success:(NSString *)success complete:(void (^)(void))complete;
/**
* 展示失败信息 自动消失
*
* @param error 提示文字
* @param complete 完成回调
*/
+ (void)j_error:(NSString *)error complete:(void (^)(void))complete;
/**
* 只有菊花
*/
+ (void)j_loading;
/**
* 菊花+文字
*
* @param text 提示文字
*/
+ (void)j_loading:(NSString *)text;
/**
* 文字提示 自动消失
*
* @param text 仅提示文字
*/
+ (void)j_textOnly:(NSString *)text;
/**
* 隐藏kwindow上面的所有hud
*/
+ (void)j_hideLoadingView;
@end
//
// MBProgressHUD+Addtions.m
// RealEstateManagement
//
// Created by Z on 16/6/24.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "MBProgressHUD+Addtions.h"
//hud 延迟多久消失
static CGFloat const delay = 1.2;
@implementation MBProgressHUD (Addtions)
+ (MBProgressHUD *)Javen_showSuccess:(NSString *)success onView:(UIView *)view delay:(NSTimeInterval)time complete:(void (^)(void))complete {
[[UIApplication sharedApplication].keyWindow endEditing:YES];
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view];
[view addSubview:hud];
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.tintColor = [UIColor whiteColor];
hud.customView = imageView;
hud.mode = MBProgressHUDModeCustomView;
hud.label.text = success;
[hud showAnimated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[hud removeFromSuperview];
if (complete) {
complete();
}
});
return hud;
}
+ (void)Javen_showError:(NSString *)error onView:(UIView *)view delay:(NSTimeInterval)time complete:(void (^)(void))complete {
[[UIApplication sharedApplication].keyWindow endEditing:YES];
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view];
[view addSubview:hud];
UIImage *image = [[UIImage imageNamed:@"cross"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.tintColor = [UIColor whiteColor];
hud.customView = imageView;
hud.mode = MBProgressHUDModeCustomView;
hud.label.text = error;
[hud showAnimated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[hud removeFromSuperview];
if (complete) {
complete();
}
});
}
+ (MBProgressHUD *)JVShowMessage:(NSString *)message onView:(UIView *)view autoDisppear:(BOOL)autoDisppear {
if (message.length < 1 || message == nil) {
return nil;
}
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view];
hud.mode = MBProgressHUDModeText;
hud.label.text = message;
[view addSubview:hud];
[hud showAnimated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[hud removeFromSuperview];
});
return hud;
}
//创建一个hud 配置hud样式
+ (MBProgressHUD *)j_hudWithView:(UIView *)view {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.animationType = MBProgressHUDAnimationZoomOut;
hud.contentColor = kMainColor;
hud.label.font = [UIFont systemFontOfSize:18];
hud.detailsLabel.font = [UIFont systemFontOfSize:16];
hud.removeFromSuperViewOnHide = YES;
return hud;
}
//成功的hud
+ (void)j_success:(NSString *)success complete:(void (^)(void))complete {
[self j_customViewImageName:@"Checkmark" text:success complete:complete];
}
//失败的hud
+ (void)j_error:(NSString *)error complete:(void (^)(void))complete {
[self j_customViewImageName:@"cross" text:error complete:complete];
}
//自定义hud图片
+ (MBProgressHUD *)j_customViewImageName:(NSString *)imageName text:(NSString *)text complete:(void (^)(void))complete{
[self j_removeAllHud];
MBProgressHUD *hud = [self j_hudWithView:[UIApplication sharedApplication].keyWindow];
hud.mode = MBProgressHUDModeCustomView;
UIImage *image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.tintColor = kMainColor;
hud.customView = imageView;
hud.detailsLabel.text = text;
[hud showAnimated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self j_hideLoadingView];
if (complete) {
complete();
}
});
return hud;
}
/**
* 只有菊花
*/
+ (void)j_loading {
[self j_removeAllHud];
MBProgressHUD *hud = [self j_hudWithView:[UIApplication sharedApplication].keyWindow];
[hud showAnimated:YES];
}
/**
* 菊花+文字
*
* @param text 提示文字
*/
+ (void)j_loading:(NSString *)text {
[self j_removeAllHud];
MBProgressHUD *hud = [self j_hudWithView:[UIApplication sharedApplication].keyWindow];
hud.label.text = text;
[hud showAnimated:YES];
}
/**
* 仅文字提示 自动消失
*
* @param text 提示文字
*/
+ (void)j_textOnly:(NSString *)text {
[self j_removeAllHud];
MBProgressHUD *hud = [self j_hudWithView:[UIApplication sharedApplication].keyWindow];
hud.mode = MBProgressHUDModeText;
hud.label.text = text;
[hud showAnimated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self j_hideLoadingView];
});
}
/**
* 隐藏[UIApplication sharedApplication].keyWindow上面的所有hud
*/
+ (void)j_hideLoadingView {
MBProgressHUD *hud;
for (id view in [UIApplication sharedApplication].keyWindow.subviews) {
if ([view isKindOfClass:[MBProgressHUD class]]) {
hud = view;
[hud hideAnimated:YES];
hud = nil;
}
}
}
/**
* 删除所有hud
*/
+ (void)j_removeAllHud {
for (id view in [UIApplication sharedApplication].keyWindow.subviews) {
if ([view isKindOfClass:[MBProgressHUD class]]) {
MBProgressHUD *hud = view;
[hud removeFromSuperview];
hud = nil;
}
}
}
@end
//
// UITableView+Addtions.h
// RealEstateManagement
//
// Created by Javen on 16/9/8.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UITableView (Addtions)
/**
* 停止刷新
*/
- (void)j_endRefresh;
@end
//
// UITableView+Addtions.m
// RealEstateManagement
//
// Created by Javen on 16/9/8.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "UITableView+Addtions.h"
#import "MJRefresh.h"
@implementation UITableView (Addtions)
- (void)j_endRefresh {
if ([self.mj_header isRefreshing]) {
[self.mj_header endRefreshing];
}else if ([self.mj_footer isRefreshing]) {
[self.mj_footer endRefreshing];
}
}
@end
This diff is collapsed.
This diff is collapsed.
//
// LoginInfo.h
// Car
//
// Created by Javen on 2016/12/23.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "car_objc_json_client.h"
#import "WWSideslipViewController.h"
#define kGlobal [GlobalInstance shareInstance]
#define kUser kGlobal.loginResult.user
@interface GlobalInstance : NSObject
{
NSString *_userName;
NSString *_userPsw;
}
/**
登录时返回的数据
*/
@property (strong, nonatomic) LoginResult *loginResult;
/**
全局可访问的侧边栏vc
*/
@property (strong, nonatomic) WWSideslipViewController *sideSlipVC;
+ (instancetype)shareInstance;
- (void)setUserName:(NSString *)userName;
- (void)setUserPsw:(NSString *)userPsw;
- (NSString *)userName;
- (NSString *)userPsw;
@end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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