Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
HDMall-iOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
HDMall-iOS
Commits
c32525ec
Commit
c32525ec
authored
Aug 02, 2017
by
Sandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件上传类封装
parent
e07121cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
446 additions
and
52 deletions
+446
-52
project.pbxproj
HDMall.xcodeproj/project.pbxproj
+6
-0
SaleInput.storyboard
HDMall/CodeClass/Business/SaleInput/SaleInput.storyboard
+149
-5
SaleInputAddViewController.m
...ss/SaleInput/ViewControllers/SaleInputAddViewController.m
+38
-9
SaleInputListViewController.m
...s/SaleInput/ViewControllers/SaleInputListViewController.m
+1
-1
SaleInputViewModel.h
...eClass/Business/SaleInput/ViewModels/SaleInputViewModel.h
+5
-0
SaleInputViewModel.m
...eClass/Business/SaleInput/ViewModels/SaleInputViewModel.m
+18
-0
SalesInputTotalVIew.h
.../CodeClass/Business/SaleInput/Views/SalesInputTotalVIew.h
+15
-0
SalesInputTotalVIew.m
.../CodeClass/Business/SaleInput/Views/SalesInputTotalVIew.m
+93
-0
HDMall_TEST.plist
HDMall/HDMall_TEST.plist
+26
-32
Contents.json
... Files/Assets.xcassets/list_nodata.imageset/Contents.json
+23
-0
list_nodata.png
...iles/Assets.xcassets/list_nodata.imageset/list_nodata.png
+0
-0
list_nodata@2x.png
...s/Assets.xcassets/list_nodata.imageset/list_nodata@2x.png
+0
-0
PrefixHeader.pch
HDMall/Supporting Files/PrefixHeader.pch
+2
-0
BaseListViewController.m
HDMall/Tools/BaseClass/BaseListViewController.m
+10
-2
ZJBaseFileModel.h
HDMall/Tools/BaseClass/ZJBaseFileModel.h
+9
-0
ZJBaseFileModel.m
HDMall/Tools/BaseClass/ZJBaseFileModel.m
+1
-0
UIImage+Helper.h
HDMall/Tools/Category/UIImage+Helper.h
+2
-1
UIImage+Helper.m
HDMall/Tools/Category/UIImage+Helper.m
+6
-0
InspectRepairAddPicTableViewCell.m
...s/PictureTableViewCell/InspectRepairAddPicTableViewCell.m
+1
-1
ZJBaseHttpManager.h
HDMall/Tools/ZJBaseHttpManager/ZJBaseHttpManager.h
+5
-1
ZJBaseHttpManager.m
HDMall/Tools/ZJBaseHttpManager/ZJBaseHttpManager.m
+36
-0
No files found.
HDMall.xcodeproj/project.pbxproj
View file @
c32525ec
...
...
@@ -69,6 +69,7 @@
8F4BFD071F2F3314003EA16B
/* GalleryViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8F4BFD031F2F3314003EA16B
/* GalleryViewController.m */
;
};
8F4BFD081F2F3314003EA16B
/* SingleScrollView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8F4BFD051F2F3314003EA16B
/* SingleScrollView.m */
;
};
8F4BFD0A1F2F3596003EA16B
/* ZJPicture.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8F4BFD091F2F3596003EA16B
/* ZJPicture.storyboard */
;
};
8F4BFD0D1F3019AC003EA16B
/* SalesInputTotalVIew.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8F4BFD0C1F3019AC003EA16B
/* SalesInputTotalVIew.m */
;
};
8F6C92381F2ADF4F0060E983
/* HomeWeatherBoard.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8F6C92371F2ADF4F0060E983
/* HomeWeatherBoard.m */
;
};
8F6C923B1F2ADFEC0060E983
/* WeatherModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8F6C923A1F2ADFEC0060E983
/* WeatherModel.m */
;
};
8F6C923E1F2AE3430060E983
/* HomeViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8F6C923D1F2AE3430060E983
/* HomeViewController.m */
;
};
...
...
@@ -229,6 +230,8 @@
8F4BFD041F2F3314003EA16B
/* SingleScrollView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
SingleScrollView.h
;
sourceTree
=
"<group>"
;
};
8F4BFD051F2F3314003EA16B
/* SingleScrollView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
SingleScrollView.m
;
sourceTree
=
"<group>"
;
};
8F4BFD091F2F3596003EA16B
/* ZJPicture.storyboard */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.storyboard
;
path
=
ZJPicture.storyboard
;
sourceTree
=
"<group>"
;
};
8F4BFD0B1F3019AC003EA16B
/* SalesInputTotalVIew.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
SalesInputTotalVIew.h
;
sourceTree
=
"<group>"
;
};
8F4BFD0C1F3019AC003EA16B
/* SalesInputTotalVIew.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
SalesInputTotalVIew.m
;
sourceTree
=
"<group>"
;
};
8F6C92361F2ADF4F0060E983
/* HomeWeatherBoard.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HomeWeatherBoard.h
;
sourceTree
=
"<group>"
;
};
8F6C92371F2ADF4F0060E983
/* HomeWeatherBoard.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HomeWeatherBoard.m
;
sourceTree
=
"<group>"
;
};
8F6C92391F2ADFEC0060E983
/* WeatherModel.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
WeatherModel.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -631,6 +634,8 @@
8F4BFCCE1F2EF508003EA16B
/* Views */
=
{
isa
=
PBXGroup
;
children
=
(
8F4BFD0B1F3019AC003EA16B
/* SalesInputTotalVIew.h */
,
8F4BFD0C1F3019AC003EA16B
/* SalesInputTotalVIew.m */
,
8F4BFCEC1F2F0F16003EA16B
/* SaleInputAmountCollectionViewCell.h */
,
8F4BFCED1F2F0F16003EA16B
/* SaleInputAmountCollectionViewCell.m */
,
8F4BFCE01F2F02CB003EA16B
/* SaleInputTopView.h */
,
...
...
@@ -1150,6 +1155,7 @@
8F973C1F1F21FD54003D3ADB
/* ViewController.m in Sources */
,
8F4BFCC51F2EDCAF003EA16B
/* BusinessFunctionModel.m in Sources */
,
8F250D451F297DA80031B4BC
/* XWFilterAnimator+XWBarSwipe.m in Sources */
,
8F4BFD0D1F3019AC003EA16B
/* SalesInputTotalVIew.m in Sources */
,
8F4BFCFA1F2F32D5003EA16B
/* InspectRepairAddPicTableViewCell.m in Sources */
,
8F250D841F29C14F0031B4BC
/* LoginViewModel.m in Sources */
,
8FEF5E7E1F285E56001496E3
/* UIViewController+Additions.m in Sources */
,
...
...
HDMall/CodeClass/Business/SaleInput/SaleInput.storyboard
View file @
c32525ec
This diff is collapsed.
Click to expand it.
HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputAddViewController.m
View file @
c32525ec
...
...
@@ -10,14 +10,16 @@
#import "SaleInputViewModel.h"
#import "SaleInputAmountCollectionViewCell.h"
#import "SaleInputAddAmountCell.h"
#import "PicViewModel.h"
#import "InspectRepairAddPicTableViewCell.h"
#import "CalculateHelper.h"
#import "SalesInputTotalVIew.h"
@interface
SaleInputAddViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@property
(
weak
,
nonatomic
)
IBOutlet
UITableView
*
tableView
;
/** 计算本单合计、输入总笔数 */
@property
(
nonatomic
,
weak
)
IBOutlet
SalesInputTotalVIew
*
totalView
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
btnBottom
;
@property
(
strong
,
nonatomic
)
SaleInputViewModel
*
viewModel
;
@property
(
strong
,
nonatomic
)
NSMutableArray
*
arrData
;
@property
(
strong
,
nonatomic
)
PicViewModel
*
picVM
;
@end
@implementation
SaleInputAddViewController
...
...
@@ -45,11 +47,24 @@
}
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForHeaderInSection
:
(
NSInteger
)
section
{
if
(
section
==
0
)
{
return
0
;
}
else
{
return
50
;
}
}
-
(
UIView
*
)
tableView
:
(
UITableView
*
)
tableView
viewForHeaderInSection
:
(
NSInteger
)
section
{
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"header"
];
return
cell
.
contentView
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
0
)
{
return
50
;
}
else
{
return
self
.
picVM
.
cellHeight
;
return
self
.
viewModel
.
picVM
.
cellHeight
;
}
}
...
...
@@ -59,31 +74,45 @@
SaleInputAddAmountCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"SaleInputAddAmountCell"
forIndexPath
:
indexPath
];
cell
.
isEdit
=
self
.
viewModel
.
type
!=
SaleInputTypeReadOnly
;
[
cell
configCellWithArray
:
self
.
arrData
indexPath
:
indexPath
];
//
WS(weakSelf);
WS
(
weakSelf
);
cell
.
blockNumberChanged
=
^
{
//
[weakSelf allInputMoney];
[
weakSelf
allInputMoney
];
};
return
cell
;
}
else
{
InspectRepairAddPicTableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"InspectRepairAddPicTableViewCell"
forIndexPath
:
indexPath
];
[
cell
configCellWithViewModel
:
self
.
picVM
[
cell
configCellWithViewModel
:
self
.
viewModel
.
picVM
indexPath
:
indexPath
target
:
self
];
WS
(
weakSelf
);
cell
.
blockReloadData
=
^
{
[
weakSelf
.
tableView
reloadSections
:[
NSIndexSet
indexSetWithIndex
:
0
]
withRowAnimation
:
UITableViewRowAnimationAutomatic
];
[
weakSelf
.
tableView
reloadSections
:[
NSIndexSet
indexSetWithIndex
:
1
]
withRowAnimation
:
UITableViewRowAnimationFade
];
};
return
cell
;
}
}
-
(
void
)
allInputMoney
{
NSDecimalNumber
*
allInputMoney
=
nil
;
for
(
HMSaleInputDetail_payments
*
cellModel
in
self
.
arrData
)
{
allInputMoney
=
[
CalculateHelper
calculateNum1
:
allInputMoney
num2
:
cellModel
.
total
type
:
CalculateTypeAdd
];
}
//本单合计
self
.
totalView
.
labelTotal
.
text
=
[
CalculateHelper
getMoneyStringFrom
:
allInputMoney
];
}
-
(
void
)
httpPayments
{
}
#pragma mark - actions
-
(
IBAction
)
actionSubmit
:
(
id
)
sender
{
[
self
.
viewModel
httpUpload
];
}
ZJLazy
(
SaleInputViewModel
,
viewModel
);
ZJLazy
(
NSMutableArray
,
arrData
);
ZJLazy
(
PicViewModel
,
picVM
);
@end
HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputListViewController.m
View file @
c32525ec
...
...
@@ -39,7 +39,7 @@
self
.
query
.
dateRange
.
beginDate
=
@"2016-07-12"
;
self
.
query
.
dateRange
.
endDate
=
@"2017-07-13"
;
WS
(
weakSelf
);
[
ZJHttpManager
POST
:
@"hdmall/
api/sale/getList
"
parameters
:
self
.
query
.
toDictionary
complete
:^
(
id
responseObject
,
NSError
*
error
)
{
[
ZJHttpManager
POST
:
@"hdmall/
salesinput/query
"
parameters
:
self
.
query
.
toDictionary
complete
:^
(
id
responseObject
,
NSError
*
error
)
{
if
(
kIsResponse
)
{
}
else
{
...
...
HDMall/CodeClass/Business/SaleInput/ViewModels/SaleInputViewModel.h
View file @
c32525ec
...
...
@@ -8,6 +8,8 @@
#import <Foundation/Foundation.h>
#import "HMSaleInputDetail.h"
#import "PicViewModel.h"
typedef
NS_ENUM
(
NSInteger
,
SaleInputType
)
{
SaleInputTypeCreate
,
SaleInputTypeEdit
,
...
...
@@ -15,6 +17,7 @@ typedef NS_ENUM(NSInteger, SaleInputType) {
};
@interface
SaleInputViewModel
:
NSObject
@property
(
assign
,
nonatomic
)
SaleInputType
type
;
@property
(
strong
,
nonatomic
)
PicViewModel
*
picVM
;
/**
获取全部支付方式
...
...
@@ -22,4 +25,6 @@ typedef NS_ENUM(NSInteger, SaleInputType) {
@param callBack 获取到支付方式的回调(如果arrPayments = nil, 则代表请求失败)
*/
-
(
void
)
httpAllPayments
:(
void
(
^
)(
NSMutableArray
<
HMSaleInputDetail_payments
*>
*
arrPayments
))
callBack
;
-
(
void
)
httpUpload
;
@end
HDMall/CodeClass/Business/SaleInput/ViewModels/SaleInputViewModel.m
View file @
c32525ec
...
...
@@ -34,4 +34,22 @@
}
}];
}
-
(
void
)
httpUpload
{
NSMutableArray
*
arrImage
=
[
NSMutableArray
array
];
for
(
UIImage
*
img
in
self
.
picVM
.
arrPics
)
{
ZJBaseFileModel
*
file
=
[
ZJBaseFileModel
new
];
file
.
data
=
[
img
imageDataForUpload
];
file
.
name
=
[
file
.
data
md5String
];
file
.
keyName
=
@"file"
;
file
.
mimeType
=
@"image/jpeg"
;
[
arrImage
addObject
:
file
];
}
[
ZJHttpManager
upLoadFiles
:
arrImage
params
:
nil
commplete
:^
(
NSMutableArray
*
attachments
)
{
}];
}
ZJLazy
(
PicViewModel
,
picVM
);
@end
HDMall/CodeClass/Business/SaleInput/Views/SalesInputTotalVIew.h
0 → 100644
View file @
c32525ec
//
// SalesInputTotalVIew.h
// vanke
//
// Created by Z on 16/4/20.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface
SalesInputTotalVIew
:
UIView
@property
(
weak
,
nonatomic
)
IBOutlet
UILabel
*
labelTotal
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
textFieldBillCount
;
@end
HDMall/CodeClass/Business/SaleInput/Views/SalesInputTotalVIew.m
0 → 100644
View file @
c32525ec
//
// SalesInputTotalVIew.m
// vanke
//
// Created by Z on 16/4/20.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "SalesInputTotalVIew.h"
@interface
SalesInputTotalVIew
()
<
UITextFieldDelegate
>
@property
(
weak
,
nonatomic
)
IBOutlet
UIView
*
viewRedBac
;
@end
@implementation
SalesInputTotalVIew
-
(
void
)
awakeFromNib
{
[
super
awakeFromNib
];
self
.
viewRedBac
.
layer
.
cornerRadius
=
7
;
self
.
textFieldBillCount
.
delegate
=
self
;
}
-
(
BOOL
)
textField
:
(
UITextField
*
)
textField
shouldChangeCharactersInRange
:
(
NSRange
)
range
replacementString
:
(
NSString
*
)
string
{
NSArray
*
valideInput
=
@[
@"0"
,
@"1"
,
@"2"
,
@"3"
,
@"4"
,
@"5"
,
@"6"
,
@"7"
,
@"8"
,
@"9"
,
@"-"
,
@""
];
if
([
valideInput
containsObject
:
string
])
{
if
(
textField
.
text
.
length
>
0
&&
[
string
isEqualToString
:
@"-"
])
{
return
NO
;
}
NSMutableString
*
futureString
=
[
NSMutableString
stringWithString
:
textField
.
text
];
[
futureString
insertString
:
string
atIndex
:
range
.
location
];
if
([
futureString
hasPrefix
:
@"0."
]
||
[
futureString
hasPrefix
:
@"00"
]
||
[
futureString
hasPrefix
:
@"-0"
]
||
futureString
.
length
>
6
)
{
return
NO
;
}
NSInteger
flag
=
0
;
NSInteger
pointNum
=
0
;
//用于标记-的数量,只能有一个-
const
NSInteger
limited
=
20
;
//限制小数点后面的位数
for
(
int
i
=
(
int
)
futureString
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
([
futureString
characterAtIndex
:
i
]
==
'-'
)
{
pointNum
++
;
if
(
pointNum
==
2
)
{
return
NO
;
}
}
}
for
(
int
i
=
(
int
)
futureString
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
([
futureString
characterAtIndex
:
i
]
==
'-'
)
{
if
(
flag
>
limited
)
{
return
NO
;
}
break
;
}
flag
++
;
}
return
YES
;
}
else
{
return
NO
;
}
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
HDMall/HDMall_TEST.plist
View file @
c32525ec
...
...
@@ -27,10 +27,32 @@
<
k
e
y
>
NSAllowsArbitraryLoads
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
k
e
y
>
NSLocationAlwaysUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能始终访问位置
<
/string
>
<
k
e
y
>
NSLocationUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问位置
<
/string
>
<
k
e
y
>
NSAppleMusicUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问媒体资料库
<
/string
>
<
k
e
y
>
NSBluetoothPeripheralUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问蓝牙
<
/string
>
<
k
e
y
>
NSCalendarsUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问日历
<
/string
>
<
k
e
y
>
NSCameraUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问相机
<
/string
>
<
k
e
y
>
NSHealthShareUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问健康分享
<
/string
>
<
k
e
y
>
NSHealthUpdateUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问健康更新
<
/string
>
<
k
e
y
>
NSLocationAlwaysUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能始终访问位置
<
/string
>
<
k
e
y
>
NSLocationUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问位置
<
/string
>
<
k
e
y
>
NSLocationWhenInUseUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能在使用期间访问位置
<
/string
>
<
k
e
y
>
NSMicrophoneUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问麦克风
<
/string
>
<
k
e
y
>
NSMotionUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问运动与健身
<
/string
>
<
k
e
y
>
NSPhotoLibraryUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问相册
<
/string
>
<
k
e
y
>
NSRemindersUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问提醒事项
<
/string
>
<
k
e
y
>
UILaunchStoryboardName
<
/k
e
y
>
<
string
>
LaunchScreen
<
/string
>
<
k
e
y
>
UIMainStoryboardFile
<
/k
e
y
>
...
...
@@ -39,37 +61,9 @@
<
a
rr
a
y
>
<
string
>
armv7
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
NSAppleMusicUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问媒体资料库
<
/string
>
<
k
e
y
>
NSBluetoothPeripheralUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问蓝牙
<
/string
>
<
k
e
y
>
NSCalendarsUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问日历
<
/string
>
<
k
e
y
>
NSCameraUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问相机
<
/string
>
<
k
e
y
>
NSHealthShareUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问健康分享
<
/string
>
<
k
e
y
>
NSHealthUpdateUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问健康更新
<
/string
>
<
k
e
y
>
NSLocationAlwaysUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能始终访问位置
<
/string
>
<
k
e
y
>
NSLocationUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问位置
<
/string
>
<
k
e
y
>
NSLocationWhenInUseUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能在使用期间访问位置
<
/string
>
<
k
e
y
>
NSMicrophoneUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问麦克风
<
/string
>
<
k
e
y
>
NSMotionUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问运动与健身
<
/string
>
<
k
e
y
>
NSPhotoLibraryUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问相册
<
/string
>
<
k
e
y
>
NSRemindersUsageDescription
<
/k
e
y
>
<
string
>
App
需要您的同意,才能访问提醒事项
<
/string
>
<
k
e
y
>
UISupportedInterfaceOrientations
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
UIInterfaceOrientationPortrait
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeLeft
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeRight
<
/string
>
<
/
a
rr
a
y
>
<
/
d
i
c
t
>
<
/plist
>
HDMall/Supporting Files/Assets.xcassets/list_nodata.imageset/Contents.json
0 → 100644
View file @
c32525ec
{
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"list_nodata.png"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"list_nodata@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"list_nodata@3x.png"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
HDMall/Supporting Files/Assets.xcassets/list_nodata.imageset/list_nodata.png
0 → 100644
View file @
c32525ec
4 KB
HDMall/Supporting Files/Assets.xcassets/list_nodata.imageset/list_nodata@2x.png
0 → 100644
View file @
c32525ec
8.07 KB
HDMall/Supporting Files/PrefixHeader.pch
View file @
c32525ec
...
...
@@ -18,6 +18,7 @@
//BaseClass
#import "BaseViewController.h"
#import "ZJBaseModel.h"
#import "ZJBaseFileModel.h"
#import "ZJBaseHttpManager.h"
//third
...
...
@@ -35,6 +36,7 @@
#import "NSNumber+Addtions.h"
#import "NSString+Additions.h"
#import "NSDate+Additions.h"
#import "NSData+EncodeAdditions.h"
// 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.
...
...
HDMall/Tools/BaseClass/BaseListViewController.m
View file @
c32525ec
...
...
@@ -22,7 +22,6 @@
self
.
pageSize
=
15
;
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
self
.
tableView
.
estimatedRowHeight
=
159
;
self
.
tableView
.
rowHeight
=
UITableViewAutomaticDimension
;
if
(
!
self
.
tableView
.
tableFooterView
)
{
...
...
@@ -66,7 +65,7 @@
-
(
void
)
paggingMode
{
WS
(
weakSelf
);
self
.
tableView
.
mj_header
=
[
MJRefreshNormalHeader
headerWithRefreshingBlock
:
^
{
weakSelf
.
page
=
0
;
weakSelf
.
page
=
1
;
[
weakSelf
.
arrData
removeAllObjects
];
/**
* 子类里面要重写httpRequest方法
...
...
@@ -108,6 +107,15 @@
-
(
void
)
emptyDataSet
:
(
UIScrollView
*
)
scrollView
didTapView
:
(
UIView
*
)
view
{
[
self
.
tableView
.
mj_header
beginRefreshing
];
}
-
(
BOOL
)
emptyDataSetShouldAllowScroll
:
(
UIScrollView
*
)
scrollView
{
return
YES
;
}
-
(
void
)
emptyDataSetWillAppear
:
(
UIScrollView
*
)
scrollView
{
scrollView
.
contentOffset
=
CGPointZero
;
}
-
(
CAAnimation
*
)
imageAnimationForEmptyDataSet
:
(
UIScrollView
*
)
scrollView
{
CABasicAnimation
*
animation
=
[
CABasicAnimation
animationWithKeyPath
:
@"transform"
];
animation
.
fromValue
=
[
NSValue
valueWithCATransform3D
:
CATransform3DIdentity
];
...
...
HDMall/Tools/BaseClass/ZJBaseFileModel.h
View file @
c32525ec
...
...
@@ -15,12 +15,21 @@
@property
(
nonatomic
,
strong
)
NSString
<
Optional
>
*
name
;
/** 文件上传时的文件类型 */
@property
(
nonatomic
,
strong
)
NSString
<
Ignore
>
*
mimeType
;
/** 文件上传时的key(与后台约定) */
@property
(
nonatomic
,
strong
)
NSString
<
Ignore
>
*
keyName
;
@property
(
nonatomic
,
strong
)
NSString
<
Ignore
>
*
localPath
;
@property
(
strong
,
nonatomic
)
UIImage
<
Ignore
>
*
image
;
@property
(
strong
,
nonatomic
)
NSData
<
Ignore
>
*
data
;
-
(
instancetype
)
initWithDictionary
:(
NSDictionary
*
)
dict
;
/**
* 显示附件的图片
*
...
...
HDMall/Tools/BaseClass/ZJBaseFileModel.m
View file @
c32525ec
...
...
@@ -56,4 +56,5 @@
}
}
@end
HDMall/Tools/Category/UIImage+Helper.h
View file @
c32525ec
...
...
@@ -41,7 +41,8 @@
*
*/
-
(
UIImage
*
)
scaledToWidth
:(
NSInteger
)
newWidth
;
/** 获取用于图片上传的图片data */
-
(
NSData
*
)
imageDataForUpload
;
/** 计算图片大小 */
-
(
CGFloat
)
dataSize
;
@end
...
...
HDMall/Tools/Category/UIImage+Helper.m
View file @
c32525ec
...
...
@@ -135,6 +135,12 @@
return
scaledImage
;
}
-
(
NSData
*
)
imageDataForUpload
{
UIImage
*
imageScaled
=
[
self
scaledToWidth
:
400
];
NSData
*
data
=
[
imageScaled
scaledToSpaceMaxSize
:
80
];
return
data
;
}
/** 计算图片大小 */
-
(
CGFloat
)
dataSize
{
NSData
*
data
=
UIImageJPEGRepresentation
(
self
,
1
);
...
...
HDMall/Tools/PictureTableViewCell/InspectRepairAddPicTableViewCell.m
View file @
c32525ec
...
...
@@ -110,8 +110,8 @@
WS
(
weakSelf
);
[
imagePickerVc
setDidFinishPickingPhotosHandle
:
^
(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
BOOL
isSelectOriginalPhoto
)
{
[
weakSelf
.
viewModel
.
arrPics
addObjectsFromArray
:
photos
];
[
weakSelf
.
collectionView
reloadData
];
weakSelf
.
blockReloadData
();
// [weakSelf.collectionView reloadData];
}];
[
self
.
vc
presentViewController
:
imagePickerVc
animated
:
YES
completion
:
nil
];
...
...
HDMall/Tools/ZJBaseHttpManager/ZJBaseHttpManager.h
View file @
c32525ec
...
...
@@ -7,6 +7,7 @@
//
#import <Foundation/Foundation.h>
@class
ZJBaseFileModel
;
#define ZJHttpManager [ZJBaseHttpManager shareCilent]
@interface
ZJBaseHttpManager
:
NSObject
@property
(
assign
,
nonatomic
)
BOOL
debugLogEnabled
;
...
...
@@ -27,5 +28,8 @@
-
(
void
)
DELETE
:(
NSString
*
)
URLString
parameters
:(
id
)
parameters
complete
:(
void
(
^
)(
id
responseObject
,
NSError
*
error
))
complete
;
/** 上传文件 */
-
(
void
)
upLoadFiles
:(
NSArray
<
ZJBaseFileModel
*>
*
)
files
params
:(
NSDictionary
*
)
params
commplete
:(
void
(
^
__nullable
)(
NSMutableArray
*
attachments
))
complete
;
@end
HDMall/Tools/ZJBaseHttpManager/ZJBaseHttpManager.m
View file @
c32525ec
...
...
@@ -10,6 +10,7 @@
#import "AFNetworking.h"
#import "ZJShowLogView.h"
#import "JSONKit.h"
#import "ZJBaseFileModel.h"
@interface
ZJBaseHttpManager
()
@property
(
nonatomic
,
strong
)
AFHTTPSessionManager
*
manager
;
...
...
@@ -144,6 +145,41 @@
}];
}
/** 上传文件 */
-
(
void
)
upLoadFiles
:
(
NSArray
<
ZJBaseFileModel
*>
*
)
files
params
:
(
NSDictionary
*
)
params
commplete
:
(
void
(
^
__nullable
)(
NSMutableArray
*
attachments
))
complete
{
if
(
files
.
count
==
0
)
{
complete
(
nil
);
return
;
}
WS
(
weakSelf
);
[
self
.
manager
POST
:
@"hdmall/media/upload"
parameters
:
params
constructingBodyWithBlock
:^
(
id
<
AFMultipartFormData
>
_Nonnull
formData
)
{
for
(
ZJBaseFileModel
*
file
in
files
)
{
[
formData
appendPartWithFileData
:
file
.
data
//data
name
:
file
.
keyName
//接口key值
fileName
:
file
.
name
//文件名称,必须有后缀
mimeType
:
file
.
mimeType
];
//文件类型,后台接受使用
}
}
progress
:^
(
NSProgress
*
_Nonnull
uploadProgress
)
{
}
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nullable
responseObject
)
{
if
(
kIsResponse
)
{
}
else
{
kFalseHttpTips
;
}
[
weakSelf
logWithUrl
:
@"hdmall/media/upload"
Method
:
@"UPLOAD"
param
:
params
respones
:
responseObject
];
}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{
[
MBProgressHUD
j_error
:
@"上传失败"
complete
:
nil
];
[
weakSelf
logWithUrl
:
@"hdmall/media/upload"
Method
:
@"UPLOAD"
param
:
params
respones
:
error
];
}];
}
/**
打印网络请求的详情
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment