Commit 97ac91c6 authored by admin's avatar admin

首页添加了刷新功能

parent edfaf8dc
......@@ -3,4 +3,5 @@ platform:ios, ‘7.0’
pod 'AFNetworking', '~> 2.0'
pod 'SDWebImage'
pod 'MBProgressHUD'
\ No newline at end of file
pod 'MBProgressHUD'
pod 'MJRefresh'
\ No newline at end of file
......@@ -21,6 +21,7 @@ PODS:
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- MBProgressHUD (0.9.1)
- MJRefresh (2.2.0)
- SDWebImage (3.7.2):
- SDWebImage/Core (= 3.7.2)
- SDWebImage/Core (3.7.2)
......@@ -28,11 +29,13 @@ PODS:
DEPENDENCIES:
- AFNetworking (~> 2.0)
- MBProgressHUD
- MJRefresh
- SDWebImage
SPEC CHECKSUMS:
AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e
MBProgressHUD: c47f2c166c126cf2ce36498d80f33e754d4e93ad
MJRefresh: 65a2bf14abb6feeaed8696aa1551f70e15ab0a08
SDWebImage: 71b7cdc1d1721d6a82ed62889030225f2c249e29
COCOAPODS: 0.38.2
......@@ -21,6 +21,7 @@ PODS:
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- MBProgressHUD (0.9.1)
- MJRefresh (2.2.0)
- SDWebImage (3.7.2):
- SDWebImage/Core (= 3.7.2)
- SDWebImage/Core (3.7.2)
......@@ -28,11 +29,13 @@ PODS:
DEPENDENCIES:
- AFNetworking (~> 2.0)
- MBProgressHUD
- MJRefresh
- SDWebImage
SPEC CHECKSUMS:
AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e
MBProgressHUD: c47f2c166c126cf2ce36498d80f33e754d4e93ad
MJRefresh: 65a2bf14abb6feeaed8696aa1551f70e15ab0a08
SDWebImage: 71b7cdc1d1721d6a82ed62889030225f2c249e29
COCOAPODS: 0.38.2
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "05C49BFC6678D02A5BA2AF9E"
BlueprintIdentifier = "AE900CC8E6ED3E19DFF18311"
BuildableName = "libAFNetworking.a"
BlueprintName = "AFNetworking"
ReferencedContainer = "container:Pods.xcodeproj">
......
......@@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2A1A0185E3E06B44EFB3B811"
BlueprintIdentifier = "747D7E0958082D17803EDDAC"
BuildableName = "libPods.a"
BlueprintName = "Pods"
ReferencedContainer = "container:Pods.xcodeproj">
......
......@@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "92F70C8D85FB927B0B2E889F"
BlueprintIdentifier = "2BC52E53FCF0B8169EC62C4C"
BuildableName = "libSDWebImage.a"
BlueprintName = "SDWebImage"
ReferencedContainer = "container:Pods.xcodeproj">
......
......@@ -14,6 +14,11 @@
<key>isShown</key>
<false/>
</dict>
<key>MJRefresh.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
</dict>
<key>Pods.xcscheme</key>
<dict>
<key>isShown</key>
......@@ -27,22 +32,27 @@
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>5352D432641F0656C90741034E32F31E</key>
<key>093DA7459B26B3BB6EA2FAB386E04977</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>5FC6A81851E4FEDCC925827D24095F98</key>
<key>4082B3C59B8C69587CDAABCA983AFFE3</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>5352D432641F0656C90741034E32F31E</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>CC9C3BA776D2012790953F771B30655B</key>
<key>641530337E97CC5094B7B5005825BE9E</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>E9009E5FE25F72AC37C4386F9825CBCA</key>
<key>89FEAF84E8C8693D1BADE75876809E36</key>
<dict>
<key>primary</key>
<true/>
......
#include "AFNetworking.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/SDWebImage"
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_LDFLAGS = ${AFNETWORKING_OTHER_LDFLAGS}
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
......@@ -46,6 +46,29 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## MJRefresh
Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## SDWebImage
Copyright (c) 2009 Olivier Poitrey <rs@dailymotion.com>
......
......@@ -65,6 +65,33 @@ THE SOFTWARE.</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>MJRefresh</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2009 Olivier Poitrey &lt;rs@dailymotion.com&gt;
......
......@@ -57,6 +57,12 @@ install_resource()
;;
esac
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_resource "MJRefresh/MJRefresh/MJRefresh.bundle"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_resource "MJRefresh/MJRefresh/MJRefresh.bundle"
fi
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
......
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/MBProgressHUD" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"MBProgressHUD" -l"SDWebImage" -framework "CoreGraphics" -framework "ImageIO" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/MBProgressHUD" -isystem "${PODS_ROOT}/Headers/Public/MJRefresh" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"MBProgressHUD" -l"MJRefresh" -l"SDWebImage" -framework "CoreGraphics" -framework "ImageIO" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/MBProgressHUD" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"MBProgressHUD" -l"SDWebImage" -framework "CoreGraphics" -framework "ImageIO" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/MBProgressHUD" -isystem "${PODS_ROOT}/Headers/Public/MJRefresh" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"MBProgressHUD" -l"MJRefresh" -l"SDWebImage" -framework "CoreGraphics" -framework "ImageIO" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
#include "SDWebImage.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/SDWebImage"
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_LDFLAGS = ${SDWEBIMAGE_OTHER_LDFLAGS}
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
......@@ -50,6 +50,8 @@
#import "HttpClient.h"
#import <MBProgressHUD.h>
#import <MJRefresh.h>
@interface HomeViewController () <UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate, UITextFieldDelegate, RankListHeaderDelegate>
@property (nonatomic, strong) UIImageView *bgImageView; // 背景
@property (nonatomic, strong) UITextField *searchTextField; // 搜索框
......@@ -126,8 +128,99 @@
// 问题与知识
[self requestQuestionList];
// 设置下拉刷新
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
// 进入刷新状态后会自动调用这个block
[self refreshAllData];
}];
}
- (void)refreshAllData
{
// 口碑巡检
NSString *url1 = [NSString stringWithFormat:@"%@%@", kRedStarURL, kRankingListURL];
HttpClient *httpCilent1 = [[HttpClient alloc] initWithUrl:url1];
NSDictionary *parameters1 = @{
@"queryOrders":@[@{@"direction":@"asc"}],
@"pageNumber":@(0),
@"pageSize":@(3)
};
__block HomeViewController *weakSelf = self;
[httpCilent1 getRankingListWithParameters:parameters1 completion:^(id response, NSError *error) {
NSLog(@"刷新!! = 口碑排名response = %@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *rankTempArr = [NSMutableArray array];
for (NSDictionary *ListDict in dataArray) {
RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict];
[rankTempArr addObject:rankList];
}
weakSelf.allRankListArray = rankTempArr;
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
// 问题与知识
NSString *url2 = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionListURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters2 = @{
@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(0),
@"pageSize":@(2)
};
HttpClient *httpClient2 = [[HttpClient alloc] initWithUrl:url2];
[httpClient2 getQuestionListWithParameters:parameters2 completion:^(id response, NSError *error) {
NSDictionary *dataDict = (NSDictionary *)response[@"data"];
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"刷新!! = 问题与知识列表recods = %@", response);
NSMutableArray *questionTempArr = [NSMutableArray array];
for (NSDictionary *questionDict in recordsDict) {
QuestionModel *question = [[QuestionModel alloc] init];
[question setValuesForKeysWithDictionary:questionDict];
[questionTempArr addObject:question];
}
weakSelf.allQuestionArray = questionTempArr;
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
// 口碑任务
NSString *url3 = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent3 = [[HttpClient alloc] initWithUrl:url3];
NSDictionary *parameters3 = @{
@"userUuid":@"",
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0),
@"pageSize":@(2)
};
[httpCilent3 getInspectListWithParameters:parameters3 completion:^(id response, NSError *error) {
NSLog(@"刷新!! = 巡检列表%@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *inspectTempArr = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[inspectTempArr addObject:taskList];
}
_taskListDataArray = inspectTempArr;
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self.tableView.header endRefreshing];
}];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
......
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