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
d29beda4
Commit
d29beda4
authored
May 17, 2016
by
勾芒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caoyunxiao
parent
27d221f0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
111 additions
and
63 deletions
+111
-63
ProductLibraryViewController.h
Lighting/Class/ProductLibraryViewController.h
+5
-0
ProductLibraryViewController.m
Lighting/Class/ProductLibraryViewController.m
+27
-1
SceneLibraryViewController.m
Lighting/Class/SceneLibraryViewController.m
+0
-3
SearchViewController.m
Lighting/Class/SearchViewController.m
+52
-19
GenerateOrdersViewController.m
Lighting/Class/Shoppingcart/GenerateOrdersViewController.m
+1
-0
CustomTabbarController.m
Lighting/Class/Tabbar/CustomTabbarController.m
+1
-2
StoryboardwithCYX.storyboard
Lighting/Lighting/StoryboardwithCYX.storyboard
+21
-36
PrefixHeader.pch
Lighting/Tools/PrefixHeader.pch
+4
-2
No files found.
Lighting/Class/ProductLibraryViewController.h
View file @
d29beda4
...
...
@@ -22,4 +22,9 @@
@property
(
weak
,
nonatomic
)
IBOutlet
UICollectionViewFlowLayout
*
productCollectionLayout
;
/**
* 搜索code
*/
@property
(
nonatomic
,
copy
)
NSString
*
selectedCode
;
@end
Lighting/Class/ProductLibraryViewController.m
View file @
d29beda4
...
...
@@ -87,6 +87,31 @@
[
self
getScreeningdatas
];
}
#pragma mark -热门搜索
-
(
void
)
setSelectedCode
:
(
NSString
*
)
selectedCode
{
_selectedCode
=
selectedCode
;
//默认数据
GoodsCondition
*
conditon
=
[[
GoodsCondition
alloc
]
init
];
//分页数据
DataPage
*
Newpage
=
[[
DataPage
alloc
]
init
];
Newpage
.
page
=
0
;
conditon
.
page
=
Newpage
;
conditon
.
categoryEquals
=
_selectedCode
;
__weak
typeof
(
self
)
weakSelf
=
self
;
[
self
getGoodsListdatas
:
conditon
returnResponse
:
^
(
GoodsResponse
*
response
)
{
if
(
response
.
goodsEntity
.
count
==
0
)
{
[
self
ErrorMBProgressView
:
@"暂无数据"
];
return
;
}
weakSelf
.
datasArray
=
response
;
[
weakSelf
.
productCollectionView
reloadData
];
}];
}
#pragma mark -获取商品列表数据
-
(
void
)
getGoodsListDatas
...
...
@@ -194,7 +219,8 @@
#pragma mark -返回根视图
-
(
void
)
popTorootviewController
:
(
NSNotification
*
)
not
{
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
[
self
.
navigationController
popToViewController
:[
self
.
navigationController
.
viewControllers
objectAtIndex_opple
:
1
]
animated
:
NO
];
}
...
...
Lighting/Class/SceneLibraryViewController.m
View file @
d29beda4
...
...
@@ -93,9 +93,6 @@
page
.
page
=
0
;
condition
.
page
=
page
;
[
self
getSceneLibrarydatas
:
condition
];
}
...
...
Lighting/Class/SearchViewController.m
View file @
d29beda4
...
...
@@ -74,40 +74,26 @@
//保存输入内容
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
searchInputString
:
)
name
:
SEARCHSTRING
object
:
nil
];
//返回根视图
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(popTorootviewController:) name:POPROOTCONTROLLER object:nil];
}
#pragma mark -返回根视图
-
(
void
)
popTorootviewController
:
(
NSNotification
*
)
not
{
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
#pragma mark -输入内容
-
(
void
)
searchInputString
:
(
NSNotification
*
)
not
{
[
self
.
localSearchArray
addObject
:
not
.
object
];
//调用商品控制器
ProductLibraryViewController
*
productVC
=
[[
self
getStoryboardWithName
]
instantiateViewControllerWithIdentifier
:
@"productlibrary"
];
UINavigationController
*
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
productVC
];
[
self
.
navigationController
pushViewController
:
nav
animated
:
YES
];
[
self
.
navigationController
pushViewController
:
productVC
animated
:
YES
];
}
#pragma mark -获取本地存储搜索历史
-
(
void
)
getlocalsaveDatas
{
NSString
*
homeDictionary
=
[
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
)
objectAtIndex
:
0
];
NSString
*
homepath
=
[
homeDictionary
stringByAppendingPathComponent
:
@"LOCALSAVE"
];
//添加储存的文件名
NSString
*
homepath
=
[
homeDictionary
stringByAppendingPathComponent
:
SEARCHHISTORY
];
//添加储存的文件名
self
.
localSearchArray
=
[
NSKeyedUnarchiver
unarchiveObjectWithFile
:
homepath
];
[
self
.
historyCollectionView
reloadData
];
}
...
...
@@ -116,12 +102,31 @@
-
(
void
)
SaveSearchDatas
{
NSString
*
homeDictionary
=
[
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
)
objectAtIndex
:
0
];
NSString
*
homepath
=
[
homeDictionary
stringByAppendingPathComponent
:
@"LOCALSAVE"
];
//添加储存的文件名
NSString
*
homepath
=
[
homeDictionary
stringByAppendingPathComponent
:
SEARCHHISTORY
];
//添加储存的文件名
BOOL
flag
=
[
NSKeyedArchiver
archiveRootObject
:
self
.
localSearchArray
toFile
:
homepath
];
//归档一个字符串
if
(
flag
)
{
NSLog
(
@"归档成功"
);
}
}
#pragma mark -将要加载前获取本地搜索历史
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
self
getlocalsaveDatas
];
}
#pragma mark -视图消失后归档搜索历史
-
(
void
)
viewDidDisappear
:
(
BOOL
)
animated
{
[
self
.
view
endEditing
:
YES
];
[
self
SaveSearchDatas
];
}
#pragma mark -获取热门搜索数据
-
(
void
)
getHotSearchdatas
{
...
...
@@ -175,6 +180,19 @@
return
self
.
localSearchArray
.
count
;
}
-
(
void
)
collectionView
:
(
UICollectionView
*
)
collectionView
didSelectItemAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
([
collectionView
isEqual
:
self
.
hotCollectionView
])
{
[
self
.
localSearchArray
addObject
:[[
self
.
response
.
list
objectAtIndex_opple
:
indexPath
.
item
]
name
]];
//调用商品控制器
ProductLibraryViewController
*
productVC
=
[[
self
getStoryboardWithName
]
instantiateViewControllerWithIdentifier
:
@"productlibrary"
];
productVC
.
selectedCode
=
[[
self
.
response
.
list
objectAtIndex_opple
:
indexPath
.
item
]
fid
];
[
self
.
navigationController
pushViewController
:
productVC
animated
:
YES
];
}
}
#pragma mark -释放
-
(
void
)
dealloc
...
...
@@ -184,6 +202,21 @@
#pragma mark -清除搜索历史
-
(
IBAction
)
delecteSearchHistoryButtonClick
:
(
UIButton
*
)
sender
{
NSString
*
homeDictionary
=
[
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
)
objectAtIndex
:
0
];
NSString
*
homepath
=
[
homeDictionary
stringByAppendingPathComponent
:
SEARCHHISTORY
];
//添加储存的文件名
NSFileManager
*
manager
=
[
NSFileManager
defaultManager
];
[
manager
removeItemAtPath
:
homepath
error
:
nil
];
[
self
.
localSearchArray
removeAllObjects
];
[
self
.
historyCollectionView
reloadData
];
}
-
(
void
)
didReceiveMemoryWarning
{
...
...
Lighting/Class/Shoppingcart/GenerateOrdersViewController.m
View file @
d29beda4
...
...
@@ -344,6 +344,7 @@
page
.
page
=
0
;
order
.
datapage
=
page
;
//收货地址
TOOrderEntity
*
orderReceiver
=
[[
TOOrderEntity
alloc
]
init
];
NSArray
*
Adressarr
=
[
self
.
datasArray
objectAtIndex_opple
:
1
];
...
...
Lighting/Class/Tabbar/CustomTabbarController.m
View file @
d29beda4
...
...
@@ -210,7 +210,6 @@
}
#pragma mark -二维码扫描
-
(
void
)
QrcodeButtonClick
{
...
...
@@ -243,7 +242,7 @@
if
(
textField
.
text
!=
nil
)
{
[
textField
resignFirstResponder
];
self
.
selectedIndex
=
4
;
//
self.selectedIndex = 4;
//搜索
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
SEARCHSTRING
object
:
textField
.
text
];
...
...
Lighting/Lighting/StoryboardwithCYX.storyboard
View file @
d29beda4
This diff is collapsed.
Click to expand it.
Lighting/Tools/PrefixHeader.pch
View file @
d29beda4
...
...
@@ -145,8 +145,10 @@
#define POPROOTCONTROLLER @"POPROOTCONTROLLER"
/**
* 储存本地的搜索历史文件名
*/
#define SEARCHHISTORY @"searchhistory"
#endif /* PrefixHeader_pch */
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