Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
Opple-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
张杰
Opple-iOS
Commits
798b5db8
Commit
798b5db8
authored
May 17, 2016
by
勾芒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caoyunxiao
parent
490bc4e3
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
295 additions
and
85 deletions
+295
-85
CustomerOrderViewController.m
Lighting/Class/CustomerOrderViewController.m
+28
-5
OrderdetailsViewController.m
Lighting/Class/OrderdetailsViewController.m
+51
-18
ProductDetailsHeaderView.xib
Lighting/Class/ProductDetailsHeaderView.xib
+3
-3
ProductDetailsViewController.m
Lighting/Class/ProductDetailsViewController.m
+3
-2
ProductLibraryViewController.m
Lighting/Class/ProductLibraryViewController.m
+1
-1
GenerateOrdersViewController.m
Lighting/Class/Shoppingcart/GenerateOrdersViewController.m
+4
-11
140046029-MX260-D112-03-星冠-5700K(2).png
...5700K(2).imageset/140046029-MX260-D112-03-星冠-5700K(2).png
+0
-0
Contents.json
...40046029-MX260-D112-03-星冠-5700K(2).imageset/Contents.json
+22
-0
140046029-MX260-D112-03-星冠-5700K(4).png
...5700K(4).imageset/140046029-MX260-D112-03-星冠-5700K(4).png
+0
-0
Contents.json
...40046029-MX260-D112-03-星冠-5700K(4).imageset/Contents.json
+22
-0
Contents.json
...Lighting/Images.xcassets/bg-img 副本.imageset/Contents.json
+22
-0
bg-img 副本.jpg
...Lighting/Images.xcassets/bg-img 副本.imageset/bg-img 副本.jpg
+0
-0
BaseViewController.h
Lighting/Tools/BaseViewController.h
+5
-2
BaseViewController.m
Lighting/Tools/BaseViewController.m
+33
-27
NetworkRequestClassManager.h
Lighting/Tools/NetworkRequestClassManager.h
+12
-3
NetworkRequestClassManager.m
Lighting/Tools/NetworkRequestClassManager.m
+59
-6
PrefixHeader.pch
Lighting/Tools/PrefixHeader.pch
+29
-0
Shoppersmanager.h
Lighting/Tools/Shoppersmanager.h
+1
-7
No files found.
Lighting/Class/CustomerOrderViewController.m
View file @
798b5db8
...
...
@@ -11,10 +11,28 @@
@interface
CustomerOrderViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
>
/**
* 数据源数组
*/
@property
(
nonatomic
,
strong
)
NSMutableArray
*
datasArray
;
@end
@implementation
CustomerOrderViewController
/**
* 初始化数据源数组
*/
-
(
NSMutableArray
*
)
datasArray
{
if
(
_datasArray
==
nil
)
{
_datasArray
=
[
NSMutableArray
array
];
}
return
_datasArray
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
...
...
@@ -28,7 +46,6 @@
{
self
.
customerOrderTableView
.
dataSource
=
self
;
self
.
customerOrderTableView
.
delegate
=
self
;
self
.
StyleButton
=
[
screeningButton
buttonWithType
:
UIButtonTypeCustom
];
self
.
StyleButton
.
frame
=
CGRectMake
(
ScreenWidth
-
250
,
20
,
150
,
30
);
self
.
StyleButton
.
backgroundColor
=
kTCColor
(
131
,
131
,
131
);
...
...
@@ -47,18 +64,21 @@
OrderBill
*
allOrder
=
[[
OrderBill
alloc
]
init
];
//分页
DataPage
*
page
=
[[
DataPage
alloc
]
init
];
page
=
0
;
page
.
page
=
0
;
page
.
rows
=
10
;
//订单
TOOrderEntity
*
order
=
[[
TOOrderEntity
alloc
]
init
];
order
.
guideId
=
[
Shoppersmanager
manager
].
guide
id
;
TOOrderEntity
*
New
order
=
[[
TOOrderEntity
alloc
]
init
];
Neworder
.
guideId
=
[
Shoppersmanager
manager
].
Shoppers
.
employee
.
f
id
;
allOrder
.
datapage
=
page
;
allOrder
.
order
=
order
;
allOrder
.
order
=
New
order
;
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:[
NSString
stringWithFormat
:
@"%@%@"
,
ServerAddress
,
@"/order/query"
]
WithRequestType
:
0
WithParameter
:
allOrder
WithReturnValueBlock
:^
(
id
returnValue
)
{
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
NSLog
(
@"%@"
,
returnValue
);
OrderResponse
*
Allorder
=
[[
OrderResponse
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
}
else
{
...
...
@@ -86,6 +106,9 @@
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
CustomerOrderTableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"customerordercell"
forIndexPath
:
indexPath
];
...
...
Lighting/Class/OrderdetailsViewController.m
View file @
798b5db8
...
...
@@ -14,8 +14,10 @@
#import "AllpriceTableViewCell.h"
#import "SettlementViewController.h"
#import "AdditionalTableViewCell.h"
#import <QuickLook/QuickLook.h>
@interface
OrderdetailsViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@interface
OrderdetailsViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
QLPreviewControllerDataSource
>
/**
...
...
@@ -341,32 +343,63 @@
#pragma mark -打印订单
-
(
void
)
AirprintButtonClick
:
(
UIButton
*
)
button
{
// [self callAirprintWithdata:nil];
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:[
NSString
stringWithFormat
:
@"%@%@%@"
,
ServerAddress
,
@"/order/UrlOfprintPDF/"
,
_orderCode
]
WithRequestType
:
0
WithParameter
:
nil
WithReturnValueBlock
:^
(
id
returnValue
)
{
NSLog
(
@"%@"
,
returnValue
);
[
self
DownloadPDF
:
^
(
id
returnValue
)
{
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
id
error
)
{
NSLog
(
@"%@"
,
error
)
;
[
self
callAirprintWithdata
:
returnValue
SuccessBlock
:
^
{
[
self
SuccessMBProgressView
:
@"打印成功"
];
}
ErrorBlock
:^
{
[
self
ErrorMBProgressView
:
@"打印失败"
];
}]
;
}];
}
#pragma mark -预览订单
-
(
void
)
PreviewButtonClick
:
(
UIButton
*
)
button
#pragma mark -下载PDF
-
(
void
)
DownloadPDF
:
(
void
(
^
)(
id
returnValue
))
success
{
[
self
CreateMBProgressHUDLoding
];
[[
NetworkRequestClassManager
Manager
]
NetworkWithDictionaryRequestWithURL
:[
NSString
stringWithFormat
:
@"%@%@%@"
,
ServerAddress
,
@"/order/UrlOfprintPDF/"
,
@"A0716051715560001"
]
WithRequestType
:
1
WithParameter
:
nil
WithReturnValueBlock
:^
(
id
returnValue
)
{
[[
NetworkRequestClassManager
Manager
]
DownloadPDFdatasWithURL
:[
NSString
stringWithFormat
:
@"%@%@"
,
PDFSERADDRESS
,
returnValue
[
@"data"
]]
WithReturnValueBlock
:
^
(
id
returnValue
)
{
[
self
RemoveMBProgressHUDLoding
];
success
(
returnValue
);
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
id
error
)
{
[
self
RemoveMBProgressHUDLoding
];
}];
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
id
error
)
{
[
self
RemoveMBProgressHUDLoding
];
}];
}
//
//#pragma mark -预览订单
//- (void)PreviewButtonClick:(UIButton *)button
//{
// //初始化QLPreviewController对象
// QLPreviewController *previewController = [[QLPreviewController alloc] init];
// previewController.dataSource = self;
// [self.navigationController pushViewController:previewController animated:YES];
//}
//
//
////再实现QLPreviewControllerDataSource的两个方法即可显示
////显示文件数量
//- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller
//{
// return 1;
//}
////文件路径URL
//- (id <QLPreviewItem>)previewController: (QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
//{
//
//}
...
...
Lighting/Class/ProductDetailsHeaderView.xib
View file @
798b5db8
...
...
@@ -14,7 +14,7 @@
<rect
key=
"frame"
x=
"20"
y=
"20"
width=
"350"
height=
"350"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
flexibleMaxX=
"YES"
heightSizable=
"YES"
/>
<subviews>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"
05产品库-详情_03
"
id=
"tLl-kB-n3W"
>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"
140046029-MX260-D112-03-星冠-5700K(4)
"
id=
"tLl-kB-n3W"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"350"
height=
"350"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
flexibleMaxX=
"YES"
heightSizable=
"YES"
/>
</imageView>
...
...
@@ -25,7 +25,7 @@
<state
key=
"normal"
title=
"放大"
/>
</button>
</subviews>
<color
key=
"backgroundColor"
red=
"0.
40784313729999999"
green=
"0.40784313729999999"
blue=
"0.40784313729999999
"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"backgroundColor"
red=
"0.
9882352941176471"
green=
"0.97254901960784312"
blue=
"0.93725490196078431
"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
</view>
<scrollView
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"scaleToFill"
id=
"tsa-PY-0mz"
>
<rect
key=
"frame"
x=
"383"
y=
"59"
width=
"80"
height=
"269"
/>
...
...
@@ -187,6 +187,6 @@
</view>
</objects>
<resources>
<image
name=
"
05产品库-详情_03"
width=
"500"
height=
"375
"
/>
<image
name=
"
140046029-MX260-D112-03-星冠-5700K(4)"
width=
"600"
height=
"450
"
/>
</resources>
</document>
Lighting/Class/ProductDetailsViewController.m
View file @
798b5db8
...
...
@@ -96,11 +96,12 @@
self
.
headerView
.
nameLabe
.
text
=
self
.
entity
.
name
;
self
.
headerView
.
brandName
.
text
=
self
.
entity
.
brandId
;
self
.
headerView
.
dorpPriceLabe
.
text
=
[
self
.
entity
.
tagPrice
stringValue
];
[
self
.
headerView
.
goodsImageview
sd_setImageWithURL
:[
NSURL
URLWithString
:
self
.
entity
.
pictures
]
placeholderImage
:
ReplaceImage
];
[
self
.
headerView
.
goodsImageview
sd_setImageWithURL
:[
NSURL
URLWithString
:
self
.
entity
.
pictures
]
placeholderImage
:
TCImage
(
@"140046029-MX260-D112-03-星冠-5700K(4)"
)];
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
...
...
Lighting/Class/ProductLibraryViewController.m
View file @
798b5db8
...
...
@@ -282,7 +282,7 @@
{
ProductCollectionViewCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"productcell"
forIndexPath
:
indexPath
];
NSURL
*
url
=
[
NSURL
URLWithString
:[
NSString
stringWithFormat
:
@"%@/%@"
,
ServerAddress
,[[
self
.
datasArray
.
goodsEntity
objectAtIndex_opple
:
indexPath
.
row
]
pictures
]]];
[
cell
.
productImageView
sd_setImageWithURL
:
url
placeholderImage
:
nil
];
[
cell
.
productImageView
sd_setImageWithURL
:
url
placeholderImage
:
REPLACEIMAGE
];
return
cell
;
...
...
Lighting/Class/Shoppingcart/GenerateOrdersViewController.m
View file @
798b5db8
...
...
@@ -379,17 +379,10 @@
orderGoods
.
goodsBrand
=
model
.
goods
.
brandId
;
orderGoods
.
goodsNum
=
model
.
goods
.
number
;
orderGoods
.
goodsPrice
=
model
.
goods
.
costPrice
;
// orderGoods.goodsUnit = model.goods.unit;
// @synthesize goodsId;
// @synthesize goodsCode;
// @synthesize goodsName;
// @synthesize goodsCover;
// @synthesize goodsSpec;
// @synthesize goodsBrand;
// @synthesize goodsNum;
// @synthesize goodsPrice;
// @synthesize goodsTotalPrice;
orderGoods
.
remark
=
@" "
;
//总价
NSInteger
allprice
=
[
model
.
goods
.
number
integerValue
]
*
[
model
.
goods
.
costPrice
integerValue
];
orderGoods
.
goodsTotalPrice
=
[
NSNumber
numberWithInteger
:
allprice
];
[
goodidArr
addObject
:
orderGoods
];
}
...
...
Lighting/Lighting/Images.xcassets/140046029-MX260-D112-03-星冠-5700K(2).imageset/140046029-MX260-D112-03-星冠-5700K(2).png
0 → 100644
View file @
798b5db8
123 KB
Lighting/Lighting/Images.xcassets/140046029-MX260-D112-03-星冠-5700K(2).imageset/Contents.json
0 → 100644
View file @
798b5db8
{
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"140046029-MX260-D112-03-星冠-5700K(2).png"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
Lighting/Lighting/Images.xcassets/140046029-MX260-D112-03-星冠-5700K(4).imageset/140046029-MX260-D112-03-星冠-5700K(4).png
0 → 100644
View file @
798b5db8
105 KB
Lighting/Lighting/Images.xcassets/140046029-MX260-D112-03-星冠-5700K(4).imageset/Contents.json
0 → 100644
View file @
798b5db8
{
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"140046029-MX260-D112-03-星冠-5700K(4).png"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
Lighting/Lighting/Images.xcassets/bg-img 副本.imageset/Contents.json
0 → 100644
View file @
798b5db8
{
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"bg-img 副本.jpg"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
Lighting/Lighting/Images.xcassets/bg-img 副本.imageset/bg-img 副本.jpg
0 → 100644
View file @
798b5db8
45.4 KB
Lighting/Tools/BaseViewController.h
View file @
798b5db8
...
...
@@ -43,7 +43,7 @@
/**
* 调用打印机
*/
-
(
void
)
callAirprintWithdata
:(
NS
Data
*
)
PDFdata
;
-
(
void
)
callAirprintWithdata
:(
NS
String
*
)
PDFpath
SuccessBlock
:(
void
(
^
)())
success
ErrorBlock
:(
void
(
^
)())
failed
;
...
...
@@ -63,7 +63,10 @@
*/
-
(
void
)
SHOWPrompttext
:(
NSString
*
)
Text
;
/**
* 调用无线打印机......成功回调、失败回调
*/
-
(
void
)
callAirprintWithURL
:(
NSURL
*
)
datasurl
SuccessBlock
:(
void
(
^
)())
success
ErrorBlock
:(
void
(
^
)())
failed
;
...
...
Lighting/Tools/BaseViewController.m
View file @
798b5db8
...
...
@@ -162,14 +162,13 @@
}
#pragma mark 调用airPrint无线打印机
-
(
void
)
callAirprintWithdata
:
(
NS
Data
*
)
PDFdata
-
(
void
)
callAirprintWithdata
:
(
NS
String
*
)
PDFpath
SuccessBlock
:
(
void
(
^
)())
success
ErrorBlock
:
(
void
(
^
)())
failed
{
NSData
*
mypdfdata
=
[
NSData
dataWithContentsOfFile
:[[
NSBundle
mainBundle
]
pathForResource
:
@"The Swift Programming Language 中文版 - v1.2"
ofType
:
@"pdf"
]];
NSData
*
mypdfdata
=
[
NSData
dataWithContentsOfFile
:
PDFpath
];
UIPrintInteractionController
*
pic
=
[
UIPrintInteractionController
sharedPrintController
];
if
(
pic
&&
[
UIPrintInteractionController
canPrintData
:
mypdfdata
]
)
{
pic
.
delegate
=
self
;
UIPrintInfo
*
printInfo
=
[
UIPrintInfo
printInfo
];
printInfo
.
outputType
=
UIPrintInfoOutputGeneral
;
printInfo
.
jobName
=
@"订单明细"
;
...
...
@@ -178,16 +177,21 @@
pic
.
showsPageRange
=
YES
;
pic
.
printingItem
=
mypdfdata
;
void
(
^
completionHandler
)(
UIPrintInteractionController
*
,
BOOL
,
NSError
*
)
=
^
(
UIPrintInteractionController
*
pic
,
BOOL
completed
,
NSError
*
error
)
{
if
(
!
completed
&&
error
)
NSLog
(
@"FAILED! due to error in domain %@ with error code %ld"
,
error
.
domain
,
error
.
code
);
void
(
^
completionHandler
)(
UIPrintInteractionController
*
,
BOOL
,
NSError
*
)
=
^
(
UIPrintInteractionController
*
pic
,
BOOL
completed
,
NSError
*
error
)
{
if
(
completed
)
{
// 执行成功后的处理
success
();
}
else
if
(
!
completed
&&
error
)
{
// 执行失败后的处理
failed
();
}
};
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPad
)
{
if
([[
UIDevice
currentDevice
]
userInterfaceIdiom
]
==
UIUserInterfaceIdiomPad
)
{
[
pic
presentAnimated
:
YES
completionHandler
:
completionHandler
];
}
else
{
[
pic
presentAnimated
:
YES
completionHandler
:
completionHandler
];
}
}
...
...
@@ -198,11 +202,10 @@
#pragma mark 调用airPrint无线打印机
-
(
void
)
callAirprintWithURL
:
(
NSURL
*
)
datasurl
-
(
void
)
callAirprintWithURL
:
(
NSURL
*
)
datasurl
SuccessBlock
:
(
void
(
^
)())
success
ErrorBlock
:
(
void
(
^
)())
failed
{
// NSData *mypdfdata = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"The Swift Programming Language 中文版 - v1.2" ofType:@"pdf"]];
UIPrintInteractionController
*
pic
=
[
UIPrintInteractionController
sharedPrintController
];
pic
.
delegate
=
self
;
...
...
@@ -212,24 +215,27 @@
UIPrintInfo
*
printInfo
=
[
UIPrintInfo
printInfo
];
printInfo
.
outputType
=
UIPrintInfoOutputGeneral
;
printInfo
.
jobName
=
@"订单明细"
;
printInfo
.
duplex
=
UIPrintInfoDuplex
Long
Edge
;
printInfo
.
duplex
=
UIPrintInfoDuplex
Short
Edge
;
pic
.
printInfo
=
printInfo
;
pic
.
showsPageRange
=
YES
;
// pic.printingItem = mypdfdata;
void
(
^
completionHandler
)(
UIPrintInteractionController
*
,
BOOL
,
NSError
*
)
=
^
(
UIPrintInteractionController
*
pic
,
BOOL
completed
,
NSError
*
error
)
{
if
(
!
completed
&&
error
)
NSLog
(
@"FAILED! due to error in domain %@ with error code %ld"
,
error
.
domain
,
error
.
code
);
};
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPad
)
{
[
pic
presentAnimated
:
YES
completionHandler
:
completionHandler
];
}
else
{
[
pic
presentAnimated
:
YES
completionHandler
:
completionHandler
];
void
(
^
completionHandler
)(
UIPrintInteractionController
*
,
BOOL
,
NSError
*
)
=
^
(
UIPrintInteractionController
*
pic
,
BOOL
completed
,
NSError
*
error
)
{
if
(
completed
)
{
// 执行成功后的处理
success
();
}
else
if
(
!
completed
&&
error
)
{
// 执行失败后的处理
failed
();
}
};
if
([[
UIDevice
currentDevice
]
userInterfaceIdiom
]
==
UIUserInterfaceIdiomPad
)
{
[
pic
presentAnimated
:
YES
completionHandler
:
completionHandler
];
}
}
...
...
Lighting/Tools/NetworkRequestClassManager.h
View file @
798b5db8
...
...
@@ -75,9 +75,18 @@ typedef enum {
/**
* 下载PDF
*
* @param requestURLString 网址
* @param successBlock 成功回调
* @param errorCodeBlock 错误编码回到
* @param failureBlock 失败回调
*/
-
(
void
)
DownloadPDFdatasWithURL
:(
NSString
*
)
requestURLString
WithReturnValueBlock
:
(
ReturnValueBlock
)
successBlock
WithErrorCodeBlock
:
(
ErrorCodeBlock
)
errorCodeBlock
WithFailureBlock
:
(
FailureBlock
)
failureBlock
;
...
...
Lighting/Tools/NetworkRequestClassManager.m
View file @
798b5db8
...
...
@@ -159,12 +159,65 @@ static NetworkRequestClassManager *manager = nil;
/**
* 下载PDF
*
* @param requestURLString 网址
* @param successBlock 成功回调
* @param errorCodeBlock 错误编码回到
* @param failureBlock 失败回调
*/
-
(
void
)
DownloadPDFdatasWithURL
:
(
NSString
*
)
requestURLString
WithReturnValueBlock
:
(
ReturnValueBlock
)
successBlock
WithErrorCodeBlock
:
(
ErrorCodeBlock
)
errorCodeBlock
WithFailureBlock
:
(
FailureBlock
)
failureBlock
{
NSURLSessionConfiguration
*
configuration
=
[
NSURLSessionConfiguration
defaultSessionConfiguration
];
AFHTTPSessionManager
*
manager
=
[[
AFHTTPSessionManager
alloc
]
initWithSessionConfiguration
:
configuration
];
manager
.
responseSerializer
=
[
AFJSONResponseSerializer
serializer
];
manager
.
requestSerializer
=
[
AFJSONRequestSerializer
serializer
];
manager
.
requestSerializer
.
timeoutInterval
=
10
.
0
f
;
[
manager
.
requestSerializer
setValue
:
@"application/json;charset=utf-8"
forHTTPHeaderField
:
@"Content-Type"
];
//网络检测
if
(
SHARED_APPDELEGATE
.
Networkstatus
==
false
)
{
errorCodeBlock
(
BROKEN
);
return
;
}
//构造URL对象
NSURL
*
url
=
[
NSURL
URLWithString
:
requestURLString
];
//构造request对象
NSMutableURLRequest
*
request
=
[
NSMutableURLRequest
requestWithURL
:
url
];
//使用系统类创建downLoad Task对象
NSURLSessionDownloadTask
*
task
=
[
manager
downloadTaskWithRequest
:
request
progress
:
^
(
NSProgress
*
_Nonnull
downloadProgress
)
{
NSLog
(
@"%@"
,
downloadProgress
);
//下载进度
}
destination
:^
NSURL
*
_Nonnull
(
NSURL
*
_Nonnull
targetPath
,
NSURLResponse
*
_Nonnull
response
)
{
//返回下载到哪里(返回值是一个路径)
//拼接存放路径
NSURL
*
pathURL
=
[[
NSFileManager
defaultManager
]
URLForDirectory
:
NSDocumentDirectory
inDomain
:
NSUserDomainMask
appropriateForURL
:
nil
create
:
YES
error
:
nil
];
return
[
pathURL
URLByAppendingPathComponent
:[
response
suggestedFilename
]];
}
completionHandler
:^
(
NSURLResponse
*
_Nonnull
response
,
NSURL
*
_Nullable
filePath
,
NSError
*
_Nullable
error
)
{
//下载完成走这个block
if
(
!
error
)
{
successBlock
(
filePath
);
//如果请求没有错误(请求成功), 则打印地址
// NSLog(@"%@", filePath);
}
else
{
failureBlock
(
error
);
}
}];
//开始请求
[
task
resume
];
}
...
...
Lighting/Tools/PrefixHeader.pch
View file @
798b5db8
...
...
@@ -151,4 +151,33 @@
#define SEARCHHISTORY @"searchhistory"
/**
* PDF地址
*/
#define PDFSERADDRESS @"http://139.196.195.30:8090/opple-web/"
/**
* 默认图
*/
#define REPLACEIMAGE [UIImage imageNamed:@"bg-img 副本"]
#endif /* PrefixHeader_pch */
Lighting/Tools/Shoppersmanager.h
View file @
798b5db8
...
...
@@ -12,9 +12,6 @@
/**
* 导购个人信息Jastor对象
*/
...
...
@@ -47,10 +44,7 @@
/**
* 导购ID
*/
@property
(
nonatomic
,
copy
)
NSString
*
guideid
;
...
...
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