Commit 7cd30a83 authored by Sandy's avatar Sandy

修改界面问题

parent ff09757f
...@@ -1995,13 +1995,14 @@ ...@@ -1995,13 +1995,14 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
19000E731CC6215000DF8D71 /* salesInput */ = { 19000E731CC6215000DF8D71 /* salesInput(销售录入) */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
19000E741CC6215000DF8D71 /* Controller */, 19000E741CC6215000DF8D71 /* Controller */,
19000E7B1CC6215000DF8D71 /* Model */, 19000E7B1CC6215000DF8D71 /* Model */,
19000E7C1CC6215000DF8D71 /* View */, 19000E7C1CC6215000DF8D71 /* View */,
); );
name = "salesInput(销售录入)";
path = salesInput; path = salesInput;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
...@@ -2843,7 +2844,7 @@ ...@@ -2843,7 +2844,7 @@
C1D58B3D1BB1BC9200D297FE /* templates */ = { C1D58B3D1BB1BC9200D297FE /* templates */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
19000E731CC6215000DF8D71 /* salesInput */, 19000E731CC6215000DF8D71 /* salesInput(销售录入) */,
C1A069FB1BE1046B0082006F /* affairs */, C1A069FB1BE1046B0082006F /* affairs */,
C18A95231C01E7B100429BF7 /* announcement */, C18A95231C01E7B100429BF7 /* announcement */,
C19BBBDE1BBE85B300831290 /* common */, C19BBBDE1BBE85B300831290 /* common */,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#import "ScrollMultipleWebView.h" #import "ScrollMultipleWebView.h"
#import <WebKit/WebKit.h> #import <WebKit/WebKit.h>
#import "MBProgressHUD.h"
@interface ScrollMultipleWebView ()<WKNavigationDelegate, UIScrollViewDelegate> @interface ScrollMultipleWebView ()<WKNavigationDelegate, UIScrollViewDelegate>
@property (nonatomic, strong) NSArray *arrUrls; @property (nonatomic, strong) NSArray *arrUrls;
@property (nonatomic, strong) NSMutableArray *arrWebViews; @property (nonatomic, strong) NSMutableArray *arrWebViews;
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
@property (nonatomic, strong) NSMutableDictionary *dicFlag; @property (nonatomic, strong) NSMutableDictionary *dicFlag;
@property (nonatomic, strong) NSURLRequest *currentReq; @property (nonatomic, strong) NSURLRequest *currentReq;
@property (nonatomic, strong) UIPageControl *pageCtrl; @property (nonatomic, strong) UIPageControl *pageCtrl;
@property (nonatomic, strong) NSMutableDictionary *dicRecords;
@property (nonatomic, assign) NSInteger currentIndex;
...@@ -28,13 +32,14 @@ ...@@ -28,13 +32,14 @@
{ {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
CGFloat width = frame.size.width;
CGFloat height = frame.size.height;
self.arrUrls = arrUrls; self.arrUrls = arrUrls;
self.delegate = self; self.delegate = self;
self.contentSize = CGSizeMake(arrUrls.count * frame.size.width, 0); self.contentSize = CGSizeMake(arrUrls.count * width, 0);
self.pagingEnabled = YES; self.pagingEnabled = YES;
self.showsVerticalScrollIndicator = NO; self.showsVerticalScrollIndicator = NO;
CGFloat width = frame.size.width; self.showsHorizontalScrollIndicator = NO;
CGFloat height = frame.size.height;
for (int i = 0; i < arrUrls.count; i++) { for (int i = 0; i < arrUrls.count; i++) {
NSString *jScript; NSString *jScript;
...@@ -50,14 +55,16 @@ ...@@ -50,14 +55,16 @@
WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init]; WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init];
wkWebConfig.userContentController = wkUController; wkWebConfig.userContentController = wkUController;
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(i * frame.size.width, 0, frame.size.width, frame.size.height) WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(i * width, 0, width, height)
configuration:wkWebConfig configuration:wkWebConfig];
]; webView.navigationDelegate = self;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:arrUrls[i]]]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:arrUrls[i]]];
[self.arrReqs addObject:request]; [self.arrReqs addObject:request];
[self.arrWebViews addObject:webView]; [self.arrWebViews addObject:webView];
if (i == 0){ if (i == 0){
[self.dicRecords setObject:@1 forKey:request];
[webView loadRequest:request]; [webView loadRequest:request];
self.currentIndex = i;
self.currentReq = request; self.currentReq = request;
}; };
[self addSubview:webView]; [self addSubview:webView];
...@@ -85,29 +92,59 @@ ...@@ -85,29 +92,59 @@
} }
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
NSInteger index = scrollView.contentOffset.x / SCREEN_WIDTH; NSInteger index = scrollView.contentOffset.x / SCREEN_WIDTH;
self.pageCtrl.currentPage = index; self.pageCtrl.currentPage = index;
NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:self.arrUrls[index]]]; NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:self.arrUrls[index]]];
WKWebView *webView = self.arrWebViews[index];
self.currentReq = req; self.currentReq = req;
[webView loadRequest:req]; self.currentIndex = index;
if (![[self.dicRecords objectForKey:req] isEqualToNumber:@1]) {
WKWebView *webView = self.arrWebViews[index];
[self changeWebView:webView request:req];
}
} }
- (void)updateUrls:(NSArray *)arrUrls{ - (void)updateUrls:(NSArray *)arrUrls{
self.arrUrls = arrUrls; self.arrUrls = arrUrls;
[self.dicRecords removeAllObjects];
NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:arrUrls[self.currentIndex]]];
WKWebView *webView = self.arrWebViews[self.currentIndex];
for (int i = 0; i < arrUrls.count; i++) { [self changeWebView:webView request:req];
NSURLRequest *req = self.arrReqs[i]; }
if ([req isEqual:self.currentReq]) {
WKWebView *web = self.arrWebViews[i];
[web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:arrUrls[i]]]]; - (void)changeWebView:(WKWebView *)webView request:(NSURLRequest *)req
} {
} [UIView animateWithDuration:0.2 animations:^{
webView.alpha = 0;
} completion:^(BOOL finished) {
webView.hidden = YES;
[webView loadRequest:req];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
webView.hidden = NO;
[UIView animateWithDuration:0.2 animations:^{
webView.alpha = 1;
}];
});
[self.dicRecords setObject:@1 forKey:req];
}];
} }
#pragma mark - wkwebview delegate
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
[MBProgressHUD showHUDAddedTo:webView animated:YES];
}
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
[MBProgressHUD hideHUDForView:webView animated:YES];
}
#pragma mark - lazyloading
- (NSMutableArray *)arrWebViews { - (NSMutableArray *)arrWebViews {
if (!_arrWebViews) { if (!_arrWebViews) {
_arrWebViews = [NSMutableArray array]; _arrWebViews = [NSMutableArray array];
...@@ -127,10 +164,15 @@ ...@@ -127,10 +164,15 @@
} }
return _dicFlag; return _dicFlag;
} }
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
[webView sizeToFit]; - (NSMutableDictionary *)dicRecords {
if (!_dicRecords) {
_dicRecords = [NSMutableDictionary dictionary];
}
return _dicRecords;
} }
/* /*
// Only override drawRect: if you perform custom drawing. // Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation. // An empty implementation adversely affects performance during animation.
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.2.2</string> <string>1.3.3</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.2.2</string> <string>0</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
......
...@@ -22,16 +22,16 @@ ...@@ -22,16 +22,16 @@
#define VANKE_BAIDU_WEATHER_SERVER_URL @"http://api.map.baidu.com/telematics/v3/weather" #define VANKE_BAIDU_WEATHER_SERVER_URL @"http://api.map.baidu.com/telematics/v3/weather"
// 正式环境 // 正式环境
//#define VANKE_SERVER_BASE_URL @"http://140.206.62.178:8080/wanke-server/rest" //正式 #define VANKE_SERVER_BASE_URL @"http://140.206.62.178:8080/wanke-server/rest" //正式
// 测试环境 // 测试环境
#define VANKE_SERVER_BASE_URL @"http://218.244.151.129:7580/wanke-server/rest" //#define VANKE_SERVER_BASE_URL @"http://218.244.151.129:7580/wanke-server/rest"
//#define VANKE_SERVER_BASE_URL @"http://139.196.39.77:8080/wanke-server/rest" //#define VANKE_SERVER_BASE_URL @"http://139.196.39.77:8080/wanke-server/rest"
// 后台多媒体文件基准地址 // 后台多媒体文件基准地址
//#define VANKE_SERVER_MEDIA_BASE_URL @"http://140.206.62.178:8080" //正式 #define VANKE_SERVER_MEDIA_BASE_URL @"http://140.206.62.178:8080" //正式
#define VANKE_SERVER_MEDIA_BASE_URL @"http://192.168.199.198:8080" //川哥环境 //#define VANKE_SERVER_MEDIA_BASE_URL @"http://192.168.199.198:8080" //川哥环境
//#define VANKE_SERVER_MEDIA_BASE_URL @"http://218.244.151.129:7580" //#define VANKE_SERVER_MEDIA_BASE_URL @"http://218.244.151.129:7580"
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
self.title = self.floorValue.project.projectName; self.title = self.floorValue.project.projectClassification;
self.labelProjectName.text = self.floorValue.project.projectName; self.labelProjectName.text = self.floorValue.project.projectName;
NSString *imgUrl = [NSString stringWithFormat:@"%@/%@", VANKE_SERVER_MEDIA_BASE_URL, self.floorValue.project.picture]; NSString *imgUrl = [NSString stringWithFormat:@"%@/%@", VANKE_SERVER_MEDIA_BASE_URL, self.floorValue.project.picture];
[self.imgViewTop sd_setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageNamed:@"floor-def"]]; [self.imgViewTop sd_setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageNamed:@"floor-def"]];
...@@ -49,18 +49,16 @@ ...@@ -49,18 +49,16 @@
btnRightBar.tintColor = [UIColor whiteColor]; btnRightBar.tintColor = [UIColor whiteColor];
self.navigationItem.rightBarButtonItem = btnRightBar; self.navigationItem.rightBarButtonItem = btnRightBar;
[self setUpWebView]; [self setUpWebView];
// Do any additional setup after loading the view from its nib.
} }
/** 选择日期 */ /** 选择日期 */
- (void)actionSelectDate { - (void)actionSelectDate {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"\n\n\n\n\n\n\n\n\n\n\n" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"\n\n\n\n\n\n\n\n\n\n\n" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIDatePicker *picker;
[alertController.view addSubview:self.datePicker]; [alertController.view addSubview:self.datePicker];
[alertController addAction:({ [alertController addAction:({
UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
...@@ -69,12 +67,20 @@ ...@@ -69,12 +67,20 @@
NSString *dateStr = [df stringFromDate:self.datePicker.date]; NSString *dateStr = [df stringFromDate:self.datePicker.date];
self.strSelectDate = dateStr; self.strSelectDate = dateStr;
self.labelDate.text = dateStr;
[self.webView updateUrls:[self getUrlArr]]; [self.webView updateUrls:[self getUrlArr]];
}]; }];
action; action;
})]; })];
[alertController addAction:({
UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
action1;
})];
UIPopoverPresentationController *popoverController = alertController.popoverPresentationController; UIPopoverPresentationController *popoverController = alertController.popoverPresentationController;
popoverController.sourceView = self.view; popoverController.sourceView = self.view;
popoverController.sourceRect = [self.view bounds]; popoverController.sourceRect = [self.view bounds];
...@@ -85,8 +91,7 @@ ...@@ -85,8 +91,7 @@
if (!_datePicker) { if (!_datePicker) {
_datePicker = [[UIDatePicker alloc] init]; _datePicker = [[UIDatePicker alloc] init];
_datePicker.datePickerMode = UIDatePickerModeDate; _datePicker.datePickerMode = UIDatePickerModeDate;
NSDate *yesterday = [[NSDate alloc]initWithTimeIntervalSinceNow:-24*60*60]; _datePicker.maximumDate = [NSDate date];
_datePicker.maximumDate = yesterday;
_datePicker.locale = [NSLocale localeWithLocaleIdentifier:@"zh-Hans"]; _datePicker.locale = [NSLocale localeWithLocaleIdentifier:@"zh-Hans"];
[_datePicker setDatePickerMode:UIDatePickerModeDate]; [_datePicker setDatePickerMode:UIDatePickerModeDate];
} }
...@@ -98,20 +103,30 @@ ...@@ -98,20 +103,30 @@
self.labelDate.text = self.strSelectDate; self.labelDate.text = self.strSelectDate;
NSArray *urls = [self getUrlArr]; NSArray *urls = [self getUrlArr];
self.webView = [[ScrollMultipleWebView alloc] initWithFrame:CGRectMake(0, 190.0 + 64, SCREEN_WIDTH, SCREEN_HEIGHT - (190 + 64)) webViewUrls:urls]; self.webView = [[ScrollMultipleWebView alloc] initWithFrame:CGRectMake(0, 190.0 + 55, SCREEN_WIDTH, SCREEN_HEIGHT - (190 + 55)) webViewUrls:urls];
[self.view addSubview:self.webView]; [self.view insertSubview:self.webView belowSubview:self.imgViewTop];
[self.webView setPageControlBackgroundColor:nil]; [self.webView setPageControlBackgroundColor:nil];
} }
- (NSArray *)getUrlArr { - (NSArray *)getUrlArr {
NSString *formatdischart = [NSString stringWithFormat:@"%@/wanke-web/chart/formatdischart.thor?projectid=%@", VANKE_SERVER_MEDIA_BASE_URL,self.floorValue.project.projectId];
NSString *passengersaleschart = [NSString stringWithFormat:@"%@/wanke-web/chart/passengersaleschart.thor?projectid=%@&passengerflowdate=%@",VANKE_SERVER_MEDIA_BASE_URL, self.floorValue.project.projectId, self.strSelectDate];
NSString *flow = [NSString stringWithFormat:@"%@/wanke-web/chart/formatflowchart.thor?projectEquals=%@&salesDateEquals=%@&dimensionTypeEquals=flow", VANKE_SERVER_MEDIA_BASE_URL,self.floorValue.project.projectId,self.strSelectDate];
NSString *sale = [NSString stringWithFormat:@"%@/wanke-web/chart/formatflowchart.thor?projectEquals=%@&salesDateEquals=%@&dimensionTypeEquals=sale", VANKE_SERVER_MEDIA_BASE_URL,self.floorValue.project.projectId,self.strSelectDate];
return @[formatdischart, passengersaleschart, flow, sale]; Enterpirse *ent = [[VankeCommonModel sharedInstance] currentEnt];
//1客流销售
NSString *passengersaleschart = [NSString stringWithFormat:@"%@/wanke-web/chart/passengersaleschart.thor?projectid=%@&passengerflowdate=%@",VANKE_SERVER_MEDIA_BASE_URL, self.floorValue.project.projectId, self.strSelectDate];
//2业态经营
NSString *formatdischart = [NSString stringWithFormat:@"%@/wanke-web/chart/formatdischart.thor?projectid=%@", VANKE_SERVER_MEDIA_BASE_URL,self.floorValue.project.projectId];
//3收缴率
NSString *url2 = [NSString stringWithFormat:@"%@/wanke-web/chart/formatratechart.thor?projectid=%@&ratedate=%@", VANKE_SERVER_MEDIA_BASE_URL,self.floorValue.project.projectId,self.strSelectDate];
//业态销售
NSString *sale = [NSString stringWithFormat:@"%@/wanke-web/chart/formatflowchart.thor?projectEquals=%@&salesDateEquals=%@&dimensionTypeEquals=sale&enterprise=%@", VANKE_SERVER_MEDIA_BASE_URL,self.floorValue.project.projectId,self.strSelectDate,ent.uuid];
//楼层销售
NSString *flow = [NSString stringWithFormat:@"%@/wanke-web/chart/formatflowchart.thor?projectEquals=%@&salesDateEquals=%@&dimensionTypeEquals=flow&enterprise=%@", VANKE_SERVER_MEDIA_BASE_URL,self.floorValue.project.projectId,self.strSelectDate, ent.uuid];
//客流分布
NSString *url = [NSString stringWithFormat:@"%@/wanke-web/chart/formatpaschart.thor?projectEquals=%@&passengerFlowDateEquals=%@&enterprise=%@", VANKE_SERVER_MEDIA_BASE_URL,self.floorValue.project.projectId,self.strSelectDate,ent.uuid];
CLog(@"%@", @[passengersaleschart, formatdischart, url2, sale, flow, url]);
return @[passengersaleschart, formatdischart, url2, sale, flow, url];
} }
- (void)viewDidLayoutSubviews { - (void)viewDidLayoutSubviews {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="8hJ-MZ-YSk"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="8hJ-MZ-YSk">
<rect key="frame" x="0.0" y="64" width="375" height="190"/> <rect key="frame" x="0.0" y="64" width="375" height="190"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="190" id="hcr-zq-dSd"/> <constraint firstAttribute="height" constant="190" id="hcr-zq-dSd"/>
</constraints> </constraints>
......
...@@ -23,17 +23,18 @@ ...@@ -23,17 +23,18 @@
<label class="unit floor-ctr"></label> <label class="unit floor-ctr"></label>
</linear> </linear>
<linear orientation="h" class="row flow-wrapper">
<label class="lbl">客流:</label>
<label id="lblPassengerFlow" class="value"></label>
<label class="unit"></label>
</linear>
<linear orientation="h" class="row price-wrapper"> <linear orientation="h" class="row price-wrapper">
<label class="lbl">客单价:</label> <label class="lbl">客单价:</label>
<label id="lblPrice" class="value"></label> <label id="lblPrice" class="value"></label>
<label class="unit">元/人</label> <label class="unit">元/人</label>
</linear> </linear>
<linear orientation="h" class="row flow-wrapper">
<label class="lbl">昨日客流:</label>
<label id="lblPassengerFlow" class="value"></label>
<label class="unit"></label>
</linear>
</linear> </linear>
</linear> </linear>
......
...@@ -186,6 +186,7 @@ ON_SIGNAL3( VankeFloorListBoardCell_iPhone, mask, signal ) ...@@ -186,6 +186,7 @@ ON_SIGNAL3( VankeFloorListBoardCell_iPhone, mask, signal )
// [self showDetailView:cellValue]; // [self showDetailView:cellValue];
VankeFloorDetailWebViewController *detailWebVC = [[VankeFloorDetailWebViewController alloc] initWithNibName:@"VankeFloorDetailWebViewController" bundle:nil FloorValue:cellValue date:_salesDate]; VankeFloorDetailWebViewController *detailWebVC = [[VankeFloorDetailWebViewController alloc] initWithNibName:@"VankeFloorDetailWebViewController" bundle:nil FloorValue:cellValue date:_salesDate];
[self.navigationController pushViewController:detailWebVC animated:YES]; [self.navigationController pushViewController:detailWebVC animated:YES];
} }
......
...@@ -170,6 +170,10 @@ ON_SIGNAL3( VankeServiceSaleCell_iPhone, btnHistoryMask, signal ) { ...@@ -170,6 +170,10 @@ ON_SIGNAL3( VankeServiceSaleCell_iPhone, btnHistoryMask, signal ) {
}]; }];
action; action;
})]; })];
[alertController addAction:({
UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
action1;
})];
UIPopoverPresentationController *popoverController = alertController.popoverPresentationController; UIPopoverPresentationController *popoverController = alertController.popoverPresentationController;
popoverController.sourceView = self.view; popoverController.sourceView = self.view;
popoverController.sourceRect = [self.view bounds]; popoverController.sourceRect = [self.view bounds];
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
#serviceDashBoardView { #serviceDashBoardView {
width: 100%; width: 100%;
height: 305px; height: 50%;
padding: 5px 5px 0px 5px; padding: 5px 5px 0px 5px;
} }
</style> </style>
......
...@@ -57,11 +57,9 @@ ...@@ -57,11 +57,9 @@
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
self.searchText = searchText; self.searchText = searchText;
NSPredicate *pred = [NSPredicate predicateWithFormat:@"name contains [cd] %@ OR code contains [cd] %@", searchText, searchText]; NSPredicate *pred = [NSPredicate predicateWithFormat:@"name contains [cd] %@ OR code contains [cd] %@", searchText, searchText];
self.results = [self.arrData filteredArrayUsingPredicate:pred]; self.results = [self.arrData filteredArrayUsingPredicate:pred];
[self.tableView reloadData]; [self.tableView reloadData];
NSLog(@"df");
} }
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
...@@ -72,29 +70,22 @@ ...@@ -72,29 +70,22 @@
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[self searchShopName:self.searchText]; [self searchShopName:self.searchText];
[self.view endEditing:YES]; [self.view endEditing:YES];
} }
- (void)searchShopName:(NSString *)name { - (void)searchShopName:(NSString *)name {
NSDictionary *param = @{@"codeOrNameLike":name, NSDictionary *param = @{@"codeOrNameLike":name,
@"projectIdEquals":@""}; @"projectIdEquals":@""};
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController]; ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl getUrl:@"rest/shop/" params:param success:^(id data){ [httpCtrl getUrl:@"rest/shop/" params:param success:^(id data){
NSLog(@"d");
} failure:^(id data){ } failure:^(id data){
}]; }];
} }
- (void)setUpTableView { - (void)setUpTableView {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.searchBar.bottom, SCREEN_WIDTH, SCREEN_HEIGHT - self.searchBar.bottom - 64) style:UITableViewStylePlain]; self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.searchBar.bottom, SCREEN_WIDTH, SCREEN_HEIGHT - self.searchBar.bottom - 64) style:UITableViewStylePlain];
// self.tableView.backgroundColor = [UIColor greenColor];
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellId]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellId];
...@@ -106,10 +97,8 @@ ...@@ -106,10 +97,8 @@
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
VankeShopModel *shop = self.results[indexPath.row]; VankeShopModel *shop = self.results[indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"%@【%@】", shop.name, shop.code]; cell.textLabel.text = [NSString stringWithFormat:@"%@【%@】", shop.name, shop.code];
return cell; return cell;
} }
......
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