This commit is contained in:
lianxiang
2018-09-26 00:33:06 +08:00
parent 69522b22fc
commit d0230f55ed
68 changed files with 1599 additions and 209 deletions
+10 -7
View File
@@ -39,7 +39,7 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ns1-dj-ePW">
<rect key="frame" x="68.5" y="313" width="238" height="88"/>
<rect key="frame" x="68.5" y="289" width="238" height="88"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="客服热线: 400-0000-000" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fQZ-vC-DAg">
<rect key="frame" x="44" y="25" width="151" height="17"/>
@@ -64,7 +64,10 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="当前版本: v 1.0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O00-AN-ESn">
<rect key="frame" x="142.5" y="405" width="90" height="17"/>
<rect key="frame" x="142.5" y="382" width="90" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="6TJ-hh-QMB"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
@@ -76,7 +79,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CopyRight @ 极迦生物 2018 - 2020" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uqu-At-cU5">
<rect key="frame" x="103.5" y="640" width="168" height="14"/>
<rect key="frame" x="103.5" y="628" width="168" height="14"/>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
@@ -94,14 +97,14 @@
<constraint firstItem="CaV-Vg-83Z" firstAttribute="top" secondItem="KQS-5b-EYm" secondAttribute="bottom" constant="8" id="0Ca-ma-0Xq"/>
<constraint firstItem="aZZ-3P-qGO" firstAttribute="top" secondItem="uWt-SH-yKP" secondAttribute="top" constant="599" id="4aq-UH-aog"/>
<constraint firstItem="KQS-5b-EYm" firstAttribute="centerX" secondItem="uWt-SH-yKP" secondAttribute="centerX" id="743-r4-R1X"/>
<constraint firstAttribute="bottom" secondItem="uqu-At-cU5" secondAttribute="bottom" constant="31" id="F3V-4E-z1P"/>
<constraint firstItem="O00-AN-ESn" firstAttribute="top" secondItem="ns1-dj-ePW" secondAttribute="bottom" constant="4" id="VBQ-rU-lZq"/>
<constraint firstAttribute="bottom" secondItem="uqu-At-cU5" secondAttribute="bottom" constant="12" id="F3V-4E-z1P"/>
<constraint firstItem="O00-AN-ESn" firstAttribute="top" secondItem="ns1-dj-ePW" secondAttribute="bottom" constant="5" id="VBQ-rU-lZq"/>
<constraint firstItem="ns1-dj-ePW" firstAttribute="centerX" secondItem="uWt-SH-yKP" secondAttribute="centerX" id="Vgi-dq-8gh"/>
<constraint firstItem="YGv-MC-rGM" firstAttribute="top" secondItem="uWt-SH-yKP" secondAttribute="top" constant="60" id="WYS-WQ-DAP"/>
<constraint firstItem="O00-AN-ESn" firstAttribute="centerX" secondItem="uWt-SH-yKP" secondAttribute="centerX" id="bbr-sV-JYk"/>
<constraint firstItem="uqu-At-cU5" firstAttribute="top" secondItem="aZZ-3P-qGO" secondAttribute="bottom" constant="24" id="bn8-GO-D8j"/>
<constraint firstItem="uqu-At-cU5" firstAttribute="top" secondItem="aZZ-3P-qGO" secondAttribute="bottom" constant="12" id="bn8-GO-D8j"/>
<constraint firstAttribute="trailing" secondItem="uqu-At-cU5" secondAttribute="trailing" constant="104" id="f5C-j2-JuY"/>
<constraint firstItem="ns1-dj-ePW" firstAttribute="top" secondItem="CaV-Vg-83Z" secondAttribute="bottom" constant="91" id="guj-Ca-B2n"/>
<constraint firstItem="ns1-dj-ePW" firstAttribute="top" secondItem="CaV-Vg-83Z" secondAttribute="bottom" constant="67" id="guj-Ca-B2n"/>
<constraint firstItem="YGv-MC-rGM" firstAttribute="centerX" secondItem="uWt-SH-yKP" secondAttribute="centerX" id="nXD-1v-Onf"/>
<constraint firstItem="aZZ-3P-qGO" firstAttribute="centerX" secondItem="uWt-SH-yKP" secondAttribute="centerX" id="o8Y-VR-Tgb"/>
<constraint firstItem="KQS-5b-EYm" firstAttribute="top" secondItem="YGv-MC-rGM" secondAttribute="bottom" constant="22" id="u8C-WB-j66"/>
+14 -10
View File
@@ -8,6 +8,9 @@
#import "GIGaChangePassVC.h"
#import "GiGaBaseAPiRequest.h"
#import "GiGaNetManager.h"
#import "GiGaServerConfig.h"
#import "GiGaAPIResult.h"
@interface GIGaChangePassVC ()
@@ -79,22 +82,23 @@
@"newPassword":self.xinPassFiled.text,
@"newPasswordConfirm":self.reNewPassFiled.text
};
GiGaBaseAPiRequest *requst = [GiGaBaseAPiRequest initWithRequestPath:kPAiUSerEditpwd method:RequestPostMethod parms:params];
[requst requstDataWithResult:^(GiGaAPIResult *result) {
NSString *url = [NSString stringWithFormat:@"%@%@",[GiGaServerConfig getMainUrl],kPAiUSerEditpwd];
[GiGaNetManager userbodyRequest:url params:params completionHandler:^(NSURLResponse *response, NSDictionary *resDic, NSError * _Nullable error) {
GiGaAPIResult *reult = [[GiGaAPIResult alloc] initWithDictionary:resDic];
[self.view hideToastActivity];
btn.userInteractionEnabled = YES;
if (result.success) {
GIGA_WIndowTost(result.message);
if (reult.success) {
GIGA_WIndowTost(reult.message);
[self.navigationController popViewControllerAnimated:YES];
}else{
if (result.code == 401) {
//token失效
[GiGaBaseAPiRequest userTokenTimeOutGologinFromVC:self];
}
GIGA_WIndowTost(result.message);
if (reult.code == 401) {
//token失效
[GiGaBaseAPiRequest userTokenTimeOutGologinFromVC:self];
}
GIGA_WIndowTost(reult.message);
}
}];
}
@@ -9,7 +9,7 @@
#import "GiGaChangePhoneNumberVC.h"
#import "GIGaUserChangeMobleCell.h"
#import "GiGaBaseAPiRequest.h"
#import "NSTimer+Convenience.h"
//typedef NS_ENUM(NSInteger,PohoneCodeType)
//{
// PohoneCodeTypeOld = 0,//原手机号
@@ -23,6 +23,9 @@
@property(nonatomic) BOOL nextSteep;
@property(nonatomic,copy) NSString *oldCode;
@property(nonatomic,copy) NSString *xinCode;
@property(nonatomic,strong) NSTimer*timer;
@property(nonatomic) NSInteger time;
@property(nonatomic,strong) UIButton *codeBtn;
@end
@implementation GiGaChangePhoneNumberVC
@@ -31,6 +34,7 @@
[super viewDidLoad];
[self addNavTitile:@"修改手机号"];
_nextSteep = NO;
_time = 60;
// Do any additional setup after loading the view from its nib.
[self.view addSubview:self.tableView];
self.tableView.delegate = self;
@@ -63,8 +67,11 @@
}
[cell.codeSendBtn addTarget:self action:@selector(sendCodeBtnAction:) forControlEvents:UIControlEventTouchUpInside];
self.codeBtn = cell.codeSendBtn;
if (_nextSteep) {
cell.numberTexFiled.userInteractionEnabled = YES;
cell.numberTexFiled.text = @"";
cell.numberTexFiled.placeholder = @"请输入新手机号";
cell.oldBtn.backgroundColor = GIGARGB(227, 227, 227, 1);
NSAttributedString *atti1 = [GiGaHelper stringWithText:@"1.验证原号码" textColor:GIGARGB(165,165, 165, 1) textFont:GIGA_TEXTFONTMEDIUM(13) leterSpace:0];
@@ -78,6 +85,10 @@
}else{
GiGaUser *user = [[GiGaUserManager shareUser] getCurrentUser];
if (user.mobileMask) {
cell.numberTexFiled.text = user.mobileMask;
}
cell.numberTexFiled.userInteractionEnabled = NO;
}
@@ -117,6 +128,7 @@
NSAttributedString *attrititle = [GiGaHelper stringWithText:@"完成" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(16) leterSpace:0];
[nextBtn setAttributedTitle:attrititle forState:UIControlStateNormal];
}
[view addSubview:nextBtn];
UILabel *tishiLab = [[UILabel alloc] init];
@@ -212,6 +224,8 @@
#pragma mark - 发送验证码
-(void)sendCodeBtnAction:(UIButton *)btn{
if (_nextSteep) {
GIGaUserChangeMobleCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
@@ -219,7 +233,9 @@
GIGA_ShowToast(@"请输新手机号");
return;
}
btn.userInteractionEnabled = NO;
[self startTimer:btn];
self.xinCode = cell.codeTexFiled.text;
[self sendCodeWith:cell.numberTexFiled.text];
@@ -230,11 +246,32 @@
GILog(@"手机号为空");
return;
}
btn.userInteractionEnabled = NO;
[self startTimer:btn];
[self sendCodeWith:user.mobile];
}
}
//计时
-(void)startTimer:(UIButton *)btn{
if (_time>0) {
_timer = [NSTimer scheduledTimerWithTimeInterval:1 count:60 callback:^{
NSString *timeStr=[NSString stringWithFormat:@"%lds",(long)self->_time];
[btn setTitle:timeStr forState:UIControlStateNormal];
self->_time--;
if (self->_time==0) {
[self codeBtnStateNormal];
}
}];
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
}
}
-(void)sendCodeWith:(NSString *)phone{
NSString *utl = nil;
if (_nextSteep) {
@@ -244,14 +281,27 @@
}
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:utl method:RequestPostMethod parms:@{@"mobile":phone}];
[api requstDataWithResult:^(GiGaAPIResult *result) {
if (result.success) {
GIGA_ShowToast(@"已发送");
}else{
[self codeBtnStateNormal];
GIGA_ShowToast(result.message);
}
}];
}
-(void)codeBtnStateNormal{
NSAttributedString *att = [GiGaHelper stringWithText:@"发送验证码" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(10) leterSpace:0];
[self.codeBtn setAttributedTitle:att forState:UIControlStateNormal];
self.time =60;
self.codeBtn.userInteractionEnabled = YES;
}
#pragma mark - 验证手机验证码
-(void)verifyPhoneCode:(NSString *)phonenumber code:(NSString *)code btn:(UIButton *)btn
{
@@ -261,7 +311,9 @@
[api requstDataWithResult:^(GiGaAPIResult *result) {
if (result.success) {
if (self.nextSteep) {
//验证码通过 完成
[self finishBtn:btn wtihNewPhone:phonenumber];
@@ -270,6 +322,7 @@
[self.view hideToastActivity];
self.nextSteep = YES;
self.oldCode = code;
[self codeBtnStateNormal];
[self.tableView reloadData];
}
@@ -281,7 +334,10 @@
}];
}
-(void)dealloc{
[self.timer invalidate];
self.timer = nil;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@@ -20,6 +20,8 @@
@interface GiGaFeedBackViewController ()
@property(nonatomic,strong) NSMutableArray *imagesUrl;
@property(nonatomic,copy) NSString *kinCode;
@property(nonatomic,strong) UIButton *tijiaoBtn;
@end
@@ -29,6 +31,7 @@
[super viewDidLoad];
[self addNavTitile:@"意见反馈"];
_imagesUrl = [NSMutableArray new];
self.kinCode = @"1";
[self.view addSubview:self.tableView];
self.tableView.delegate = self;
self.tableView.dataSource = self;
@@ -50,9 +53,10 @@
btn.frame = CGRectMake((self.view.frame.size.width - 245) /2 , 20, 245,40);
btn.backgroundColor = [UIColor whiteColor];
NSAttributedString *atti = [GiGaHelper stringWithText:@"提交" textColor:GIGA_MAIN_BGCOLOR textFont:GIGA_TEXTFONTBOLD(18) leterSpace:0];
[btn addTarget:self action:@selector(tijiaoAction) forControlEvents:UIControlEventTouchUpInside];
[btn addTarget:self action:@selector(tijiaoAction:) forControlEvents:UIControlEventTouchUpInside];
[btn setAttributedTitle:atti forState:UIControlStateNormal];
[footer addSubview:btn];
self.tijiaoBtn = btn;
self.tableView.tableFooterView = footer;
@@ -93,13 +97,12 @@
__weak typeof(cell) weakCell = cell;
cell.pickerBalock = ^{
[[SJPhotoPicker shareSJPhotoPicker] showPhotoPickerToController:self pickedAssets:^(NSArray<PHAsset *> *assets) {
// 添加按钮6张以上被遮挡可不写
// if ((weakCell.images.count + assets.count) > 6) {
// GIGA_ShowToast(@"最多六张");
// return ;
// }
if ((weakCell.images.count + assets.count) > 6) {
GIGA_ShowToast(@"最多六张");
return ;
}
[weakCell.images addObjectsFromArray:assets];
//weakSelf.images = [NSMutableArray arrayWithArray:assets];
[weakCell.collectionView reloadData];
}];
@@ -115,9 +118,11 @@
if (indexPath.section == 0) {
GiGaFeedBackKindView *piker = [GiGaFeedBackKindView showAt:self atRow:0];
piker.selectedItemBlock = ^(NSString *tile) {
GiGaFeedLeiIingViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.kidLabel.text = tile;
piker.selectedItemBlock = ^(GIGaFeedKind *kind) {
GiGaFeedLeiIingViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.kidLabel.text = kind.dictLabel;
self.kinCode = kind.dictCode;
};
}
@@ -166,7 +171,7 @@
#pragma mark 提交
-(void)tijiaoAction{
-(void)tijiaoAction:(UIButton *)btn{
@@ -190,19 +195,27 @@
NSDictionary *dic =nil;
NSString *qqcom = qqcell.QTextFiled.text;
if (!qqcom) {
dic = @{@"type":kindcell.kidLabel.text,@"content":contencell.contentFiled.text};
}else{
dic = @{@"type":kindcell.kidLabel.text,@"content":contencell.contentFiled.text,@"contact":qqcom
};
qqcom = @"contact";
}
[self.imagesUrl removeAllObjects];
[self uploadImags:dic];
dic = @{@"type":self.kinCode,@"content":contencell.contentFiled.text,@"contact":qqcom
};
//图片非必选
if (self.imagesUrl.count <= 0) {
//未选择图片 设置空数组
[self uploadFeedinfo:dic imgUrlList:self.imagesUrl];
}else{
////获取图片链接
[self uploadImags:dic];
}
}
//先上传图片获取到 imageurls 再 提交内容信息
}
//先上传图片获取到 imageurls 再 提交内容信息
-(void)uploadImags:(NSDictionary *)params{
[self.imagesUrl removeAllObjects];
GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]];
NSArray *names =cell.imageNames;
@@ -233,15 +246,14 @@
});
}
}
// 单张上传
-(void)uploadImage:(NSData *)imageData name:(NSString *)name info:(NSDictionary *)info totalCount:(NSInteger)count{
[self.view makeToastActivity:CSToastPositionCenter];
self.tijiaoBtn.userInteractionEnabled = NO;
NSString *url = [NSString stringWithFormat:@"%@%@",[GiGaServerConfig getMainUrl],kUploadFeed];
[GiGaNetManager uploadImage:url imgData:imageData parms:@{@"file":@"file"} responseBlock:^(NSDictionary *responseDict, NSDictionary *responseHeaderFields, NSError *error) {
[self.view hideToastActivity];
@@ -251,7 +263,8 @@
NSString *url = responseDict[@"url"];
if (url) {
[self.imagesUrl addObject:url];
NSDictionary *dic = [NSDictionary dictionaryWithObject:url forKey:@"imgUrl"];
[self.imagesUrl addObject:dic];
NSLog(@"上船图片%@成功",name);
NSLog(@"当前获取图片数组:%@",self.imagesUrl);
if (self.imagesUrl.count == count) {
@@ -260,25 +273,29 @@
}
}else if (result.code == 401){
self.tijiaoBtn.userInteractionEnabled = YES;
GIGA_WIndowTost(@"登录超时,请重新登录");
[GiGaBaseAPiRequest userTokenTimeOutGologinFromVC:self];
}else{
GIGA_ShowToast(result.message);
self.tijiaoBtn.userInteractionEnabled = YES;
}
}];
}
//body 传参数
//body 传参数
-(void)uploadFeedinfo:(NSDictionary*)params imgUrlList:(NSArray *)urlArr{
NSMutableDictionary *finallyparam = [NSMutableDictionary dictionaryWithDictionary:params];
[finallyparam setObject:urlArr forKey:@"imgUrlList"];
NSLog(@"finallyparam%@",finallyparam);
[self.view makeToastActivity:CSToastPositionCenter];
NSString *url = [NSString stringWithFormat:@"%@%@",[GiGaServerConfig getMainUrl],kAPiUpLoadFeeeds];
[GiGaNetManager userbodyRequest:url params:finallyparam completionHandler:^(NSURLResponse *response, NSDictionary *resDic, NSError * _Nullable error) {
self.tijiaoBtn.userInteractionEnabled = YES;
[self.view hideToastActivity];
if (error) {
GILog(@"err:%@",error.localizedDescription);
@@ -289,7 +306,10 @@
GiGaAPIResult *result = [[GiGaAPIResult alloc] initWithDictionary:resDic];
if (result.success) {
GIGA_ShowToast(@"🙏感谢提出宝贵意见!🙏");
GIGA_WIndowTost(@"感谢提出宝贵意见!");
[self.navigationController popViewControllerAnimated:YES];
}else if (result.code == 401){
GIGA_WIndowTost(@"登录超时,请重新登录");
[GiGaBaseAPiRequest userTokenTimeOutGologinFromVC:self];
@@ -326,6 +346,7 @@
// }
// }];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@@ -18,6 +18,7 @@
#import "UIImageView+WebCache.h"
#import "GiGaUserInfoVC.h"
#import "GIGaMaskTimeUseRecordVC.h"
#import "MaskTestResultVC.h"
@interface GiGaMeViewController ()
@property (nonatomic,strong) GiGaUser *user;
@@ -152,9 +153,11 @@
[self.navigationController pushViewController:historyVC animated:YES];
}else if (indexPath.section == 1 && indexPath.row == 1){
//使用记录
GIGaMaskTimeUseRecordVC *historyVC= [[GIGaMaskTimeUseRecordVC alloc] init];
[self.navigationController pushViewController:historyVC animated:YES];
//历史测试
// GIGaMaskTimeUseRecordVC *historyVC= [[GIGaMaskTimeUseRecordVC alloc] init];
// [self.navigationController pushViewController:historyVC animated:YES];
MaskTestResultVC *reult = [[MaskTestResultVC alloc] init];
[self.navigationController pushViewController:reult animated:YES];
}else{
//系统设置
@@ -113,12 +113,12 @@
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserIDViewCell" owner:self options:nil] lastObject];
}
[cell loadCellData:indexPath user: self.user];
return cell;
}else if (indexPath.section == 1 && indexPath.row <= 2){
GIGaUserWeChatViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GIGaUserWeChatViewCell"];
if(!cell){
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserWeChatViewCell" owner:self options:nil] lastObject];
@@ -157,14 +157,23 @@
cell = [[GiGaUserJobViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];
}
[cell userSelectjobAction:^() {
self.jobSpread = !self.jobSpread;
[tableView reloadSections:[NSIndexSet indexSetWithIndex:3] withRowAnimation:UITableViewRowAnimationNone];
[UIView performWithoutAnimation:^{
[tableView reloadSections:[NSIndexSet indexSetWithIndex:3] withRowAnimation:UITableViewRowAnimationNone];
}];
}];
[cell setButtnImage:self.jobSpread with:self.jobArr];
[cell userSelectjob:^(NSString *title) {
self.user.occupationCode = title;
[tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:3 inSection:2]] withRowAnimation:UITableViewRowAnimationNone];
[UIView performWithoutAnimation:^{
[tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:3 inSection:2]] withRowAnimation:UITableViewRowAnimationNone];
}];
}];
return cell;
@@ -180,7 +189,7 @@
weakify(self);
[LYSDatePickerController customdidSelectDatePicker:^(NSDate *date) {
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy/MM/dd"];
[dateFormat setDateFormat:@"yyyy-MM-dd"];
NSString *currentDate = [dateFormat stringFromDate:date];
GIGaUserCityViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
weakSelf.user.birthday = currentDate;
@@ -507,9 +516,10 @@
if (newurl) {
user.headImgUrl = newurl;
}
[[GiGaUserManager shareUser] saveUser:user];
NC_POST_NAME_OBJECT(kUserAvatorUpdateNoti, nil);
GIGA_ShowToast(@"👮‍♀️修改成功")
GIGA_ShowToast(@"修改成功")
}else{
GIGA_ShowToast(reullt.message);
}
@@ -7,8 +7,23 @@
//
#import "GiMaskTimeHistoryVC.h"
#import "MaskHistoryListViewCell.h"
#import "MasHistoryFirstViewCell.h"
#import "GiGaBaseAPiRequest.h"
#import "MaskHistryRecord.h"
#import <MJRefresh/MJRefresh.h>
#import "GiGaWebViewController.h"
@interface GiMaskTimeHistoryVC ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong) NSMutableArray *dataArr;
@property(nonatomic) NSUInteger currentPage;
@property(nonatomic,assign) NSInteger totalMinute;
@property(nonatomic,assign) NSInteger ranking;
@property(nonatomic,assign) NSUInteger totalPage;
//@property(nonatomic,strong) MaskHistryRecordlist *record;
@property(nonatomic,copy) NSString * guizeUrl;
@property(nonatomic) BOOL isFreshing;
@interface GiMaskTimeHistoryVC ()
@end
@@ -16,8 +31,131 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.dataArr = [[NSMutableArray alloc] init];
_currentPage = 1;
_totalMinute = 0;
_ranking = 0;
_isFreshing = NO;
[self addNavTitile:@"历史记录"];
// Do any additional setup after loading the view.
[self.view addSubview:self.tableView];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
self.tableView.sectionFooterHeight = 0;
self.tableView.estimatedSectionFooterHeight= 0;
self.tableView.estimatedSectionHeaderHeight = 0;
self.tableView.frame = CGRectMake(0,2, KMainW, self.view.bounds.size.height - SAFE_NAV_HEIGHT);
self.tableView.estimatedRowHeight = 170;
self.tableView.rowHeight = UITableViewAutomaticDimension;
[self creatRefreshView];
[self loadDataWtih:[NSString stringWithFormat:@"%ld",_currentPage] isFresh:YES];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.section ==0){
MasHistoryFirstViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MasHistoryFirstViewCell"];
if(!cell){
cell = [[[NSBundle mainBundle] loadNibNamed:@"MasHistoryFirstViewCell" owner:self options:nil] lastObject];
}
cell.timeLabe.text = [NSString stringWithFormat:@"%ld",(long)self.totalMinute];
cell.rankLabe.text = [NSString stringWithFormat:@"全国排行榜第%ld名",(long)self.ranking];
[cell.guizeBtn addTarget:self action:@selector(guizeShow) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
MaskHistoryListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MaskHistoryListViewCell"];
if(!cell){
cell = [[[NSBundle mainBundle] loadNibNamed:@"MaskHistoryListViewCell" owner:self options:nil] lastObject];
}
MaskHistryRecord *recod = self.dataArr[indexPath.row];
[cell loadCellDataAt:indexPath recod:recod];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section == 0) {
return 1;
}
return self.dataArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewAutomaticDimension;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section == 1) {
return 6;
}
return 0.1;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *view = [[UIView alloc] init];
view.backgroundColor = GIGARGB(235, 235, 235, 1);
return view;
}
-(void)loadDataWtih:(NSString *)page isFresh:(BOOL)isFresh{
self.isFreshing = YES;
[self.view makeToastActivity:CSToastPositionCenter];
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:kApiUserHistoryList method:RequestPostMethod parms:@{@"page":page,@"limit":@"10"}];
[api requstDataWithResult:^(GiGaAPIResult *result) {
[self.view hideToastActivity];
self.isFreshing = NO;
if (isFresh) {
[self.tableView.mj_header endRefreshing];
}else{
[self.tableView.mj_footer endRefreshing];
}
if (result.success) {
NSDictionary *reDic =result.dic;
self.ranking = [[reDic valueForKey:@"ranking"] integerValue];
self.totalMinute = [[reDic valueForKey:@"totalMinute"] integerValue] ;
self.guizeUrl = [reDic valueForKey:@"ruleUrl"];
NSDictionary *pageDic = reDic[@"page"];
//self.currentPage = [pageDic valueForKey:@"currPage"];
MaskHistryRecordlist *list = [[MaskHistryRecordlist alloc] initWithDictionary:pageDic error:nil];
self.totalPage = [pageDic[@"totalPage"] integerValue];
NSArray *listA = list.list;
if (isFresh) {
[self.dataArr removeAllObjects];
}
for (MaskHistryRecord *recod in listA) {
[self.dataArr addObject:recod];
}
[self.tableView reloadData];
}else if (result.code == 401) {
//token失效
[GiGaBaseAPiRequest userTokenTimeOutGologinFromVC:self];
}else{
GIGA_ShowToast(result.message);
}
}];
}
- (void)didReceiveMemoryWarning {
@@ -25,14 +163,55 @@
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
-(void)creatRefreshView{
self.tableView.mj_header = [MJRefreshHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMore)];
}
*/
-(void)headerRefresh{
if (_isFreshing) {
[self.tableView.mj_header endRefreshing];
return;
}
[self loadDataWtih:@"0" isFresh:YES];
}
-(void)loadMore{
if (_isFreshing) {
[self.tableView.mj_footer endRefreshing];
return;
}
if (_currentPage == _totalPage) {
[self.tableView.mj_footer endRefreshingWithNoMoreData];
return;
}
if (_currentPage < _totalPage) {
_currentPage ++;
[self loadDataWtih:[NSString stringWithFormat:@"%ld",self.currentPage] isFresh:NO];
}
}
//规则
-(void)guizeShow{
if (self.guizeUrl) {
GiGaWebViewController *web = [[GiGaWebViewController alloc] init];
web.souceType = WebSourceTypeUrlLink;
web.url = self.guizeUrl;
[self.navigationController pushViewController:web animated:YES];
}
}
@end
+11 -7
View File
@@ -14,7 +14,7 @@
#import "AppVerionDescriptionVC.h"
#import "GIGaAboutUsVC.h"
#import "GiGaFeedBackViewController.h"
#import "GiGaWebViewController.h"
@interface GiSysSettingsVC ()
@end
@@ -78,11 +78,16 @@
GIGaAboutUsVC *usVC= [[GIGaAboutUsVC alloc] init];
[self.navigationController pushViewController:usVC animated:YES];
}else if (indexPath.row == 3){
AppVerionDescriptionVC *verVC =[[AppVerionDescriptionVC alloc] init];
[self.navigationController pushViewController:verVC animated:YES];
// AppVerionDescriptionVC *verVC =[[AppVerionDescriptionVC alloc] init];
// [self.navigationController pushViewController:verVC animated:YES];
GiGaWebViewController *webVC = [[GiGaWebViewController alloc] init];
webVC.url = @"";
webVC.souceType = WebSourceTypeUrlLink;
[self.navigationController pushViewController:webVC animated:YES];
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
@@ -107,11 +112,10 @@
[btn setTitle:@"退出登录" forState:UIControlStateNormal];
btn.layer.masksToBounds = YES;
btn.layer.cornerRadius = btn.frame.size.height / 2;
btn.backgroundColor = GIGA_MAIN_BGCOLOR;
btn.backgroundColor = GIGARGB(181, 14, 14, 1);
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(userLogOutAction) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:btn];
return view;
}