Commit 279e3c89 authored by leijunbo's avatar leijunbo

增加了奖品兑换

parent 9c2ba95d
...@@ -38,6 +38,7 @@ static CGFloat SuccessWindow_hight = 170; ...@@ -38,6 +38,7 @@ static CGFloat SuccessWindow_hight = 170;
[self addSubview:self.lb_title]; [self addSubview:self.lb_title];
[self addSubview:self.btn_check]; [self addSubview:self.btn_check];
[self addSubview:self.lb_num]; [self addSubview:self.lb_num];
[self addSubview:self.img_num];
[self addSubview:self.btn_dismiss]; [self addSubview:self.btn_dismiss];
self.backgroundColor = [UIColor clearColor]; self.backgroundColor = [UIColor clearColor];
[self configSubviews]; [self configSubviews];
...@@ -81,6 +82,7 @@ static CGFloat SuccessWindow_hight = 170; ...@@ -81,6 +82,7 @@ static CGFloat SuccessWindow_hight = 170;
- (void)showAnimation - (void)showAnimation
{ {
[self startAnimation]; [self startAnimation];
[self startAnimation2];
} }
#pragma mark - 动画 #pragma mark - 动画
...@@ -91,11 +93,11 @@ static CGFloat SuccessWindow_hight = 170; ...@@ -91,11 +93,11 @@ static CGFloat SuccessWindow_hight = 170;
anima.keyPath = @"position"; anima.keyPath = @"position";
anima.duration = 0.4; anima.duration = 0.8;
anima.fromValue = [NSValue valueWithCGPoint:CGPointMake(300, 250)]; anima.fromValue = [NSValue valueWithCGPoint:CGPointMake(215, 215)];
anima.toValue = [NSValue valueWithCGPoint:CGPointMake(300, 200)]; anima.toValue = [NSValue valueWithCGPoint:CGPointMake(215, 175)];
...@@ -104,7 +106,7 @@ static CGFloat SuccessWindow_hight = 170; ...@@ -104,7 +106,7 @@ static CGFloat SuccessWindow_hight = 170;
CABasicAnimation *anima2 = [CABasicAnimation animation]; CABasicAnimation *anima2 = [CABasicAnimation animation];
anima2.keyPath = @"opacity"; anima2.keyPath = @"opacity";
anima2.duration = 0.4; anima2.duration = 0.8;
anima2.fromValue = [NSNumber numberWithFloat:1.0]; anima2.fromValue = [NSNumber numberWithFloat:1.0];
anima2.toValue = [NSNumber numberWithFloat:0.0]; anima2.toValue = [NSNumber numberWithFloat:0.0];
anima2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; anima2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
...@@ -114,12 +116,48 @@ static CGFloat SuccessWindow_hight = 170; ...@@ -114,12 +116,48 @@ static CGFloat SuccessWindow_hight = 170;
CAAnimationGroup *groupAnima = [CAAnimationGroup animation]; CAAnimationGroup *groupAnima = [CAAnimationGroup animation];
groupAnima.animations = @[anima,anima2]; groupAnima.animations = @[anima,anima2];
groupAnima.duration = 0.4; groupAnima.duration = 0.8;
groupAnima.fillMode = kCAFillModeForwards; groupAnima.fillMode = kCAFillModeForwards;
groupAnima.removedOnCompletion = NO; groupAnima.removedOnCompletion = NO;
[self.lb_num.layer addAnimation:groupAnima forKey:nil]; [self.lb_num.layer addAnimation:groupAnima forKey:nil];
} }
- (void)startAnimation2
{
//创建核心动画
CABasicAnimation *anima = [CABasicAnimation animation];
anima.keyPath = @"position";
anima.duration = 0.8;
anima.fromValue = [NSValue valueWithCGPoint:CGPointMake(259.5, 215)];
anima.toValue = [NSValue valueWithCGPoint:CGPointMake(259.5, 175)];
anima.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
CABasicAnimation *anima2 = [CABasicAnimation animation];
anima2.keyPath = @"opacity";
anima2.duration = 0.8;
anima2.fromValue = [NSNumber numberWithFloat:1.0];
anima2.toValue = [NSNumber numberWithFloat:0.0];
anima2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
CAAnimationGroup *groupAnima = [CAAnimationGroup animation];
groupAnima.animations = @[anima,anima2];
groupAnima.duration = 0.8;
groupAnima.fillMode = kCAFillModeForwards;
groupAnima.removedOnCompletion = NO;
[self.img_num.layer addAnimation:groupAnima forKey:nil];
}
#pragma mark - event response #pragma mark - event response
- (void)btnClick:(UIButton *)sender - (void)btnClick:(UIButton *)sender
{ {
...@@ -178,9 +216,9 @@ static CGFloat SuccessWindow_hight = 170; ...@@ -178,9 +216,9 @@ static CGFloat SuccessWindow_hight = 170;
- (UILabel *)lb_num - (UILabel *)lb_num
{ {
if (!_lb_num) { if (!_lb_num) {
_lb_num = [[UILabel alloc]initWithFrame:CGRectMake(260, 230, 80, 40)]; _lb_num = [[UILabel alloc]initWithFrame:CGRectMake(175, 195, 80, 40)];
_lb_num.text = @"+100"; _lb_num.text = @"+100";
_lb_num.font = [UIFont systemFontOfSize:16]; _lb_num.font = [UIFont systemFontOfSize:32];
_lb_num.textColor = [UIColor colorWithHex:0xfed052]; _lb_num.textColor = [UIColor colorWithHex:0xfed052];
} }
return _lb_num; return _lb_num;
...@@ -188,8 +226,8 @@ static CGFloat SuccessWindow_hight = 170; ...@@ -188,8 +226,8 @@ static CGFloat SuccessWindow_hight = 170;
- (UIImageView *)img_num - (UIImageView *)img_num
{ {
if (!_img_num) { if (!_img_num) {
_img_num = [[UIImageView alloc]init]; _img_num = [[UIImageView alloc]initWithFrame:CGRectMake(247, 207, 25, 16)];
_img_num.image = [UIImage imageNamed:@""]; _img_num.image = [UIImage imageNamed:@"金币"];
} }
return _img_num; return _img_num;
} }
......
...@@ -49,6 +49,9 @@ ...@@ -49,6 +49,9 @@
// 跑到这里的block的时候,就已经是主线程了。 // 跑到这里的block的时候,就已经是主线程了。
__block NSURLSessionDataTask *dataTask = nil; __block NSURLSessionDataTask *dataTask = nil;
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html",@"image/jpeg",@"text/plain", nil];
dataTask = [manager dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { dataTask = [manager dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
NSNumber *requestID = @([dataTask taskIdentifier]); NSNumber *requestID = @([dataTask taskIdentifier]);
[self.dispatchTable removeObjectForKey:requestID]; [self.dispatchTable removeObjectForKey:requestID];
......
...@@ -20,7 +20,10 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -20,7 +20,10 @@ NS_ASSUME_NONNULL_BEGIN
+(void)GET:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete; +(void)GET:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete;
+(void)GET2:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete;
+(void)POST:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete; +(void)POST:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete;
+ (void)POST2:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete;
@end @end
......
...@@ -107,6 +107,22 @@ ...@@ -107,6 +107,22 @@
} }
+(void)GET2:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete
{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer= [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html",@"image/jpeg",@"text/plain", nil];
[manager GET:url parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"JSON:%@",responseObject);
complete(responseObject,nil);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"Error: %@",error);
complete(nil,error);
}];
}
+(void)POST:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete +(void)POST:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete
{ {
...@@ -126,6 +142,24 @@ ...@@ -126,6 +142,24 @@
} }
+ (void)POST2:(NSString *)url params:(NSDictionary *)params completionHandler:(void (^)(id responseObject, NSError *error))complete
{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager.requestSerializer setValue:@"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/xml",@"text/html", @"application/json", @"text/json", @"text/javascript", @"text/plain", nil];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager POST:url parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"JSON:%@",responseObject);
complete(responseObject,nil);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"Error: %@",error);
complete(nil,error);
}];
}
#pragma mark - private methods #pragma mark - private methods
- (void)removeRequestIdWithRequestID:(NSInteger)requestId - (void)removeRequestIdWithRequestID:(NSInteger)requestId
{ {
...@@ -146,6 +180,7 @@ ...@@ -146,6 +180,7 @@
if (_httpRequestSerializer == nil) { if (_httpRequestSerializer == nil) {
_httpRequestSerializer = [AFHTTPRequestSerializer serializer]; _httpRequestSerializer = [AFHTTPRequestSerializer serializer];
[_httpRequestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [_httpRequestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[_httpRequestSerializer setValue:@"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
} }
return _httpRequestSerializer; return _httpRequestSerializer;
} }
......
...@@ -36,6 +36,7 @@ return [self POST:pathNew1 parameters:dictNew completionHandler:^(id responseOb ...@@ -36,6 +36,7 @@ return [self POST:pathNew1 parameters:dictNew completionHandler:^(id responseOb
if (responseObj) { if (responseObj) {
NSLog(@"%@",[NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:NULL]); NSLog(@"%@",[NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:NULL]);
NSLog(@"%@",[[NSString alloc] initWithData:responseObj encoding:NSUTF8StringEncoding]);
} }
if ( error || responseObj == nil ) { if ( error || responseObj == nil ) {
complete( nil,error); complete( nil,error);
...@@ -785,6 +786,12 @@ return [self POST:pathNew1 parameters:dictNew completionHandler:^(id responseOb ...@@ -785,6 +786,12 @@ return [self POST:pathNew1 parameters:dictNew completionHandler:^(id responseOb
return [self POST:pathNew1 parameters:dictNew completionHandler:^(resulTModel* responseObj, NSError *error) { return [self POST:pathNew1 parameters:dictNew completionHandler:^(resulTModel* responseObj, NSError *error) {
NSLog(@"response:%@",responseObj); NSLog(@"response:%@",responseObj);
if (responseObj) {
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:nil];
NSLog(@"%@",dic);
}
if (error) { if (error) {
NSLog(@"打印错误:%@",error); NSLog(@"打印错误:%@",error);
}else }else
......
//
// CTDiskCacheCenter.h
// Open
//
// Created by 雷俊博 on 2019/8/26.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface CTDiskCacheCenter : NSObject
+ (id)fetchCachedRecordWithKey:(NSString *)key;
+ (void)saveCacheWithResponse:(id)response key:(NSString *)key cacheTime:(NSTimeInterval)cacheTime;
+ (void)cleanAll;
@end
NS_ASSUME_NONNULL_END
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</data> </data>
<key>Info.plist</key> <key>Info.plist</key>
<data> <data>
savQXok3w1Sr3sI/oxRmAKpzs7M= 0x48A5rwEiIXNto9pMvZ17FgHrc=
</data> </data>
<key>Modules/module.modulemap</key> <key>Modules/module.modulemap</key>
<data> <data>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#import "successViewController.h" #import "successViewController.h"
#import "AuthenticationGuideView.h"
@interface GreenChannelVC ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate> @interface GreenChannelVC ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
...@@ -69,6 +70,8 @@ ...@@ -69,6 +70,8 @@
//起点发生变化 //起点发生变化
self.edgesForExtendedLayout=UIRectEdgeBottom; self.edgesForExtendedLayout=UIRectEdgeBottom;
[self configBackBtn];
} }
- (void)viewWillLayoutSubviews - (void)viewWillLayoutSubviews
...@@ -81,6 +84,50 @@ ...@@ -81,6 +84,50 @@
} }
#pragma mark - 导航栏返回按钮及点击事件
- (void)configBackBtn
{
UIButton *backbtn = [UIButton buttonWithType:UIButtonTypeCustom];
backbtn.frame = CGRectMake(-50, 0, 40, 40);
[backbtn setTitle:@"返回" forState:UIControlStateNormal];
[backbtn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
[backbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[backbtn addTarget:self action:@selector(backBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[backbtn layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleLeft imageTitleSpace:6];
if (self.state == GreenRenZheng) {
UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithCustomView:backbtn];
self.navigationItem.leftBarButtonItem = backItem;
}
}
- (void)backBtnClick:(UIButton *)btn
{
BOOL show = [[NSUserDefaults standardUserDefaults]boolForKey:@"SocialSecurityAuthenticationggreenVC"];
if (!show) {
[AuthenticationGuideView showGuideViewWithimgHidden:YES Block:^(BOOL isBack) {
[[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"SocialSecurityAuthenticationggreenVC"];
[[NSUserDefaults standardUserDefaults]synchronize];
if (isBack) {
[self.navigationController popViewControllerAnimated:YES];
}
}];
}else {
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark - event response #pragma mark - event response
- (void)btnClick:(UIButton *)sender - (void)btnClick:(UIButton *)sender
{ {
......
...@@ -401,6 +401,10 @@ static NSInteger *tagChangeFOrNumber; ...@@ -401,6 +401,10 @@ static NSInteger *tagChangeFOrNumber;
_completion_int(provinceName); _completion_int(provinceName);
} }
//雷俊博
// if (![provinceName isEqualToString:@"请选择"] && provinceName) {
// [getPeopleID getprovinceNightSix:provinceName];
// }
[self hide]; [self hide];
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
#import "AtlasDetailVC.h" #import "AtlasDetailVC.h"
#import "WebDetailVC.h" #import "WebDetailVC.h"
#import "BaseNetManager.h" #import "BaseNetManager.h"
//天气
#import "LMJScrollTextView.h"
#import "WETianqiController.h"
@interface KKNewsVC ()<TTNewsViewDelegate,TTNewsDetailControllerDelegate> @interface KKNewsVC ()<TTNewsViewDelegate,TTNewsDetailControllerDelegate>
{ {
NSString* _startTimeStr; NSString* _startTimeStr;
...@@ -122,10 +126,71 @@ ...@@ -122,10 +126,71 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(APPWillResignActive) name:@"APPWillResignActive" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(APPWillResignActive) name:@"APPWillResignActive" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(APPDidBecomeActive) name:@"APPDidBecomeActive" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(APPDidBecomeActive) name:@"APPDidBecomeActive" object:nil];
[self configNavBarItems];
} }
- (void)resetTitle{ - (void)resetTitle{
} }
- (void)configNavBarItems
{
LMJScrollTextView *cityView = [[LMJScrollTextView alloc]initWithFrame:CGRectMake(0, 0, 100, 40) textScrollModel:LMJTextScrollContinuous direction:LMJTextScrollMoveLeft];
UILabel *lb_weather = [[UILabel alloc]init];
UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:cityView];
UIBarButtonItem *item2 = [[UIBarButtonItem alloc]initWithCustomView:lb_weather];
NSString *city = nil;
NSString *weather = nil;
if ([[NSUserDefaults standardUserDefaults]objectForKey:@"TQData"]) {
NSDictionary *data = [[NSUserDefaults standardUserDefaults]objectForKey:@"TQData"][@"data"];
city = [NSString stringWithFormat:@"%@",data[@"cityname"]];
weather = [NSString stringWithFormat:@"%@ %@℃~%@℃",data[@"weather"],data[@"ltemp"],data[@"htemp"]];
}else {
city = @"北京市";
weather =@"晴 22℃";
}
CGFloat width = [city sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:16], NSFontAttributeName, nil]].width;
if (width >= 100) {
cityView.frame = CGRectMake(0, 0, 100, 40);
[cityView startScrollWithText:city textColor:[UIColor whiteColor] font:[UIFont systemFontOfSize:16]];
}else {
cityView.frame = CGRectMake(0, 0, width, 40);
[cityView startShowWithText:city textColor:[UIColor whiteColor] font:[UIFont systemFontOfSize:16]];
}
CGFloat width2 = [weather sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:16], NSFontAttributeName, nil]].width;
lb_weather.frame = CGRectMake(0, 0, width2, 40);
lb_weather.textColor = [UIColor whiteColor];
lb_weather.font = [UIFont systemFontOfSize:16];
lb_weather.text = weather;
self.navigationItem.rightBarButtonItems = @[item2,item];
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGesture:)];
[cityView addGestureRecognizer:singleTap];
UITapGestureRecognizer *singleTap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGesture:)];
lb_weather.userInteractionEnabled = YES;
[lb_weather addGestureRecognizer:singleTap1];
}
#pragma mark - TTNewsViewDelegate #pragma mark - TTNewsViewDelegate
/** 执行返回顶部方法回调 */ /** 执行返回顶部方法回调 */
- (void)TTNewsViewBackToTop:(TTNewsView *)newsView { - (void)TTNewsViewBackToTop:(TTNewsView *)newsView {
...@@ -263,7 +328,7 @@ ...@@ -263,7 +328,7 @@
NSInteger time = [timeStr integerValue] - [_startTimeStr integerValue] - (NSInteger)_timeD ; NSInteger time = [timeStr integerValue] - [_startTimeStr integerValue] - (NSInteger)_timeD ;
//判断是否已登录 //判断是否已登录
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"firstlog"] && [getPeopleID PeopleID] && time >= 6) { if ([[NSUserDefaults standardUserDefaults] objectForKey:@"firstlog"] && [getPeopleID PeopleID] && time >= 6 && _slidingdistance > 0) {
NSDictionary *params = @{ NSDictionary *params = @{
@"uid":[NSNumber numberWithInteger:[getPeopleID PeopleID]], @"uid":[NSNumber numberWithInteger:[getPeopleID PeopleID]],
@"telphone":[EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY], @"telphone":[EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
...@@ -287,11 +352,11 @@ ...@@ -287,11 +352,11 @@
NSString *code = [responseObj[@"code"] stringValue]; NSString *code = [responseObj[@"code"] stringValue];
if ([code isEqualToString:@"0"]) { if ([code isEqualToString:@"0"]) {
NSLog(@"看新闻接口提交成功"); NSLog(@"看新闻接口提交成功");
_lastUrl = _currentPageUrl; self->_lastUrl = self->_currentPageUrl;
_startTimeStr = nil; self->_startTimeStr = nil;
_endTimeStr = nil; self->_endTimeStr = nil;
_currentNewsHeight = 0.0; self->_currentNewsHeight = 0.0;
_slidingdistance = 0.0; self->_slidingdistance = 0.0;
} }
} }
...@@ -309,6 +374,24 @@ ...@@ -309,6 +374,24 @@
_slidingdistance = fabs(scrollHeight); _slidingdistance = fabs(scrollHeight);
} }
#pragma mark - event response
- (void)singleTapGesture:(UITapGestureRecognizer *)ges
{
NSDictionary *data = [[NSUserDefaults standardUserDefaults]objectForKey:@"TQData"][@"data"];
if (data) {
NSString *lat = [NSString stringWithFormat:@"%@",data[@"lat"]];
NSString *lng = [NSString stringWithFormat:@"%@",data[@"lng"]];
WETianqiController *controlltr = [[WETianqiController alloc] init];
[controlltr fetchWeatherDataLocationLat:[lat doubleValue] LocationLng:[lng doubleValue]];
[self presentViewController:controlltr animated:YES completion:NULL];
}else{
WETianqiController *controlltr = [[WETianqiController alloc] init];
[controlltr fetchWeatherDataLocationLat:39.91488908 LocationLng:116.40387397];
[self presentViewController:controlltr animated:YES completion:NULL];
}
}
#pragma mark - getters and setters #pragma mark - getters and setters
- (NSMutableDictionary *)dispatchTable - (NSMutableDictionary *)dispatchTable
{ {
......
...@@ -21,13 +21,13 @@ ...@@ -21,13 +21,13 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/> <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="my-open.png" translatesAutoresizingMaskIntoConstraints="NO" id="k0g-X0-sDj"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="my-open.png" translatesAutoresizingMaskIntoConstraints="NO" id="k0g-X0-sDj">
<rect key="frame" x="0.0" y="20" width="320" height="460"/> <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstItem="k0g-X0-sDj" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" constant="20" id="L22-bR-zWG"/> <constraint firstItem="k0g-X0-sDj" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="L22-bR-zWG"/>
<constraint firstAttribute="trailing" secondItem="k0g-X0-sDj" secondAttribute="trailing" id="YeL-ZN-62Y"/> <constraint firstAttribute="trailing" secondItem="k0g-X0-sDj" secondAttribute="trailing" id="YeL-ZN-62Y"/>
<constraint firstAttribute="bottom" secondItem="k0g-X0-sDj" secondAttribute="bottom" id="eaY-8H-48s"/> <constraint firstAttribute="bottom" secondItem="k0g-X0-sDj" secondAttribute="bottom" id="eaY-8H-48s"/>
<constraint firstItem="k0g-X0-sDj" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="pxa-47-QCZ"/> <constraint firstItem="k0g-X0-sDj" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="pxa-47-QCZ"/>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="52" y="374.66266866566718"/> <point key="canvasLocation" x="50.625" y="373.75"/>
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
......
...@@ -15,10 +15,21 @@ typedef NS_ENUM(NSUInteger, ListCoinsMissonType) { ...@@ -15,10 +15,21 @@ typedef NS_ENUM(NSUInteger, ListCoinsMissonType) {
ListCoinsMissonTypeNews, ListCoinsMissonTypeNews,
ListCoinsMissonTypeVideo ListCoinsMissonTypeVideo
}; };
typedef NS_ENUM(NSUInteger, ListCoinsMissonState) {
ListCoinsMissonStateUNFinished,
ListCoinsMissonStateFinished
};
@interface CoinCenterTableViewCell : UITableViewCell @interface CoinCenterTableViewCell : UITableViewCell
@property (nonatomic, strong)UIButton *btn_right;
@property (nonatomic, assign)ListCoinsMissonState state;
- (void)refreshUIWithString:(NSString *)str; - (void)refreshUIWithString:(NSString *)str;
- (void)refreshUIWithDic:(NSDictionary *)dic index:(NSInteger)index;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
@property (nonatomic, strong)UILabel *lb_num; @property (nonatomic, strong)UILabel *lb_num;
@property (nonatomic, strong)UIButton *btn_right;
@property (nonatomic, strong)UIView *lineView; @property (nonatomic, strong)UIView *lineView;
...@@ -81,8 +81,74 @@ ...@@ -81,8 +81,74 @@
self.type = ListCoinsMissonTypeVideo; self.type = ListCoinsMissonTypeVideo;
} }
} }
- (void)refreshUIWithDic:(NSDictionary *)dic index:(NSInteger)index
{
NSString *str;
if (index == 0) {
[self.btn_right setTitle:@"去关注" forState:UIControlStateNormal];
str = @"关注“看看社保”公众号";
}else if (index == 1){
if ([self isUserNotificationEnable]) {
[self.btn_right setTitle:@"领取" forState:UIControlStateNormal];
}else{
[self.btn_right setTitle:@"去开启" forState:UIControlStateNormal];
}
str = @"打开APP推送权限";
}
NSNumber *status = dic[@"status"];
if (status.integerValue == 304) {
self.state = ListCoinsMissonStateFinished;
}else if (status.integerValue == 305){
self.state = ListCoinsMissonStateUNFinished;
}
self.lb_type.text = str;
self.lb_num.text =[NSString stringWithFormat:@"+%@金币",dic[@"sourceScore"]];
}
#pragma mark - private methods
- (BOOL)isUserNotificationEnable { // 判断用户是否允许接收通知
BOOL isEnable = NO;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0f) { // iOS版本 >=8.0 处理逻辑
UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings];
isEnable = (UIUserNotificationTypeNone == setting.types) ? NO : YES;
} else { // iOS版本 <8.0 处理逻辑
UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
isEnable = (UIRemoteNotificationTypeNone == type) ? NO : YES;
}
return isEnable;
}
#pragma mark - getters and setters #pragma mark - getters and setters
- (void)setState:(ListCoinsMissonState)state
{
if (state == ListCoinsMissonStateUNFinished) {
[self.btn_right setTitleColor:[UIColor colorWithHex:0xfa9504] forState:UIControlStateNormal];
self.btn_right.layer.borderWidth = 1.0;
self.btn_right.layer.borderColor = [UIColor colorWithHex:0xfa9504].CGColor;
self.btn_right.layer.cornerRadius = 12 * WIDTHRADIU;
self.btn_right.layer.masksToBounds = YES;
}else if (state == ListCoinsMissonStateFinished){
[self.btn_right setTitle:@"已完成" forState:UIControlStateNormal];
[self.btn_right setTitleColor:[UIColor colorWithHex:0x999999] forState:UIControlStateNormal];
self.btn_right .backgroundColor = [UIColor colorWithHex:0xe5e5e5];
self.btn_right.layer.borderWidth = 1.0;
self.btn_right.layer.borderColor = [UIColor colorWithHex:0xe5e5e5].CGColor;
self.btn_right.layer.cornerRadius = 12 * WIDTHRADIU;
self.btn_right.layer.masksToBounds = YES;
}
}
- (void)setType:(ListCoinsMissonType)type - (void)setType:(ListCoinsMissonType)type
{ {
if (type == ListCoinsMissonTypePublic) { if (type == ListCoinsMissonTypePublic) {
......
...@@ -10,17 +10,27 @@ ...@@ -10,17 +10,27 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, ListCoinsPackageType) { typedef NS_ENUM(NSUInteger, ListCoinsPackageType) {
ListCoinsPackageTypeCheckedIn,
ListCoinsPackageTypeNumber, ListCoinsPackageTypeNumber,
ListCoinsPackageTypeRedPacket, ListCoinsPackageTypeRedPacket,
ListCoinsPackageTypeGiftBag, ListCoinsPackageTypeGiftBag,
ListCoinsPackageTypeTreasureBox ListCoinsPackageTypeTreasureBox
}; };
typedef NS_ENUM(NSUInteger, ListCoinsPackageState) {
ListCoinsPackageStateToSign,//待签到
ListCoinsPackageStateNoSigned,//未签到
ListCoinsPackageStateSigned//已签到;
};
@interface SignInCollectionViewCell : UICollectionViewCell @interface SignInCollectionViewCell : UICollectionViewCell
@property (nonatomic, assign)ListCoinsPackageType type;
@property (nonatomic, assign)ListCoinsPackageState state;
- (void)refreshUIWithData:(NSDictionary *)dic; - (void)refreshUIWithData:(NSDictionary *)dic index:(NSInteger)index;
@end @end
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
@property (nonatomic, strong)UILabel *lb_date; @property (nonatomic, strong)UILabel *lb_date;
@property (nonatomic, assign)ListCoinsPackageType type;
@end @end
...@@ -59,31 +59,86 @@ ...@@ -59,31 +59,86 @@
} }
#pragma mark - public methods #pragma mark - public methods
- (void)refreshUIWithData:(NSDictionary *)dic - (void)refreshUIWithData:(NSDictionary *)dic index:(NSInteger)index
{ {
NSString *type = dic[@"type"];
if ([type isEqualToString:@"num"]) { if (index == 2) {
self.lb_num.text = dic[@"num"];
self.img_back.image = [UIImage imageNamed:@"my_gold_Checkin_bg_normal"];
self.type = ListCoinsPackageTypeNumber;
}else if ([type isEqualToString:@"redPacket"]){
self.type = ListCoinsPackageTypeRedPacket; self.type = ListCoinsPackageTypeRedPacket;
}else if ([type isEqualToString:@"giftBag"]){ }else if (index == 4){
self.type = ListCoinsPackageTypeGiftBag; self.type = ListCoinsPackageTypeGiftBag;
self.img_back.image = [UIImage imageNamed:@"my_gold_Checkin_Friday_normal"];
}else if ([type isEqualToString:@"treasureBox"]){ }else if (index == 6){
self.type = ListCoinsPackageTypeTreasureBox; self.type = ListCoinsPackageTypeTreasureBox;
self.img_back.image = [UIImage imageNamed:@"my_gold_Checkin_Sunday_normal"]; }else{
self.type = ListCoinsPackageTypeNumber;
}
NSNumber *status = dic[@"status"];
if (status.integerValue == 302) {
self.state = ListCoinsPackageStateSigned;
}else if (status.integerValue == 301){
self.state = ListCoinsPackageStateNoSigned;
}else if (status.integerValue == 300){
self.state = ListCoinsPackageStateToSign;
} }
self.lb_date.text = dic[@"title"];
self.lb_num.text = [NSString stringWithFormat:@"%@",dic[@"sourceScore"]];
self.lb_date.text = dic[@"desc"];
} }
#pragma mark - getters and setters #pragma mark - getters and setters
- (void)setState:(ListCoinsPackageState)state
{
_state = state;
switch (state) {
//未签到
case ListCoinsPackageStateNoSigned:
self.img_back.image = [UIImage imageNamed:@"my_gold_Checkin_bg_Signed_normal"];
self.lb_num.hidden = NO;
break;
//待签到
case ListCoinsPackageStateToSign:
self.lb_num.hidden = NO;
break;
//已签到
case ListCoinsPackageStateSigned:
self.img_back.image = [UIImage imageNamed:@"coins-signSuccess"];
self.lb_num.hidden = YES;
break;
default:
break;
}
}
- (void)setType:(ListCoinsPackageType)type - (void)setType:(ListCoinsPackageType)type
{ {
_type = type;
switch (type) {
case ListCoinsPackageTypeNumber:
self.img_back.image = [UIImage imageNamed:@"my_gold_Checkin_bg_normal"];
break;
case ListCoinsPackageTypeRedPacket:
self.img_back.image = [UIImage imageNamed:@"my_gold_Checkin_ Wednesday_normal"];
break;
case ListCoinsPackageTypeGiftBag:
self.img_back.image = [UIImage imageNamed:@"my_gold_Checkin_Friday_normal"];
break;
case ListCoinsPackageTypeTreasureBox:
self.img_back.image = [UIImage imageNamed:@"my_gold_Checkin_Sunday_normal"];
break;
default:
break;
}
if ((type == ListCoinsPackageTypeRedPacket) || (type == ListCoinsPackageTypeGiftBag) || (type == ListCoinsPackageTypeTreasureBox)) { if ((type == ListCoinsPackageTypeRedPacket) || (type == ListCoinsPackageTypeGiftBag) || (type == ListCoinsPackageTypeTreasureBox)) {
self.lb_num.hidden = YES; self.lb_num.hidden = YES;
}else{ }else{
......
...@@ -9,10 +9,14 @@ ...@@ -9,10 +9,14 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
typedef void(^tapBlock)(BOOL hidden);
@interface SignInSuccessView : UIView @interface SignInSuccessView : UIView
+ (void)showSuccessViewWithTitle:(NSString *)title; @property (nonatomic, strong)tapBlock block;
+ (void)showSuccessViewWithTitle:(NSString *)title message:(NSString *)message num:(NSString *)num block:(tapBlock)block;
@end @end
......
...@@ -27,11 +27,15 @@ ...@@ -27,11 +27,15 @@
@end @end
@implementation SignInSuccessView @implementation SignInSuccessView
#pragma mark - life cycle #pragma mark - life cycle
- (instancetype)initWithTitle:(NSString *)title - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message num:(NSString *)num block:(tapBlock)block
{ {
self = [super init]; self = [super init];
if (self) { if (self) {
[self initUI]; [self initUI];
self.lb_successTitle.text = title;
self.lb_message.text = message;
self.lb_num.text = [NSString stringWithFormat:@"+%@",num];
self.block = block;
} }
return self; return self;
} }
...@@ -85,9 +89,9 @@ ...@@ -85,9 +89,9 @@
} }
#pragma mark - public methods #pragma mark - public methods
+ (void)showSuccessViewWithTitle:(NSString *)title + (void)showSuccessViewWithTitle:(NSString *)title message:(nonnull NSString *)message num:(nonnull NSString *)num block:(nonnull tapBlock)block
{ {
SignInSuccessView *view = [[SignInSuccessView alloc]initWithTitle:title]; SignInSuccessView *view = [[SignInSuccessView alloc]initWithTitle:title message:message num:num block:block];
[view showWithAnimation:YES]; [view showWithAnimation:YES];
} }
...@@ -108,7 +112,7 @@ ...@@ -108,7 +112,7 @@
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
[keyWindow addSubview: self]; [keyWindow addSubview: self];
[self addAnimation]; //[self addAnimation];
} }
...@@ -134,7 +138,7 @@ ...@@ -134,7 +138,7 @@
- (void)dismissWithAnimation:(BOOL)animation - (void)dismissWithAnimation:(BOOL)animation
{ {
self.block(YES);
[self.lb_message removeFromSuperview]; [self.lb_message removeFromSuperview];
[self.lb_num removeFromSuperview]; [self.lb_num removeFromSuperview];
[self.img_Success removeFromSuperview]; [self.img_Success removeFromSuperview];
......
...@@ -12,7 +12,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -12,7 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, ListVCType) { typedef NS_ENUM(NSUInteger, ListVCType) {
ListVCTypeCoinsDetail, ListVCTypeCoinsDetail,
ListVCTypeMyWallet ListVCTypeMyWallet,
ListVCTypeCoinsCost
}; };
@interface CoinsDetailListVC : UIViewController @interface CoinsDetailListVC : UIViewController
......
...@@ -43,8 +43,16 @@ ...@@ -43,8 +43,16 @@
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
[self.view addSubview:self.btn_Exchange]; [self.view addSubview:self.btn_Exchange];
self.tableView.tableFooterView = self.footerView; self.tableView.tableFooterView = self.footerView;
[self loadData];
[self.headerView refreshData]; [self.headerView refreshData];
if (self.type == ListVCTypeCoinsDetail) {
[self configNavBar];
[self loadData];
}else if (self.type == ListVCTypeCoinsCost){
[self loadData];
}
} }
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated
{ {
...@@ -56,13 +64,37 @@ ...@@ -56,13 +64,37 @@
self.navigationController.navigationBar.barTintColor = [UIColor colorWithHex:0xed8b0b]; self.navigationController.navigationBar.barTintColor = [UIColor colorWithHex:0xed8b0b];
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) { } completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
}]; }];
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
if ([self.title isEqualToString:@"金币明细"]) {
[JANALYTICSService startLogPageView:@"金币明细"];
[MobClick beginLogPageView:@"金币明细"];
}else if ([self.title isEqualToString:@"金币消费"]){
[JANALYTICSService startLogPageView:@"金币消费"];
[MobClick beginLogPageView:@"金币消费"];
}
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
if ([self.title isEqualToString:@"金币明细"]) {
[JANALYTICSService stopLogPageView:@"金币明细"];
[MobClick endLogPageView:@"金币明细"];
}else if ([self.title isEqualToString:@"金币消费"]){
[JANALYTICSService stopLogPageView:@"金币消费"];
[MobClick endLogPageView:@"金币消费"];
}
} }
- (void)viewWillLayoutSubviews - (void)viewWillLayoutSubviews
{ {
[super viewWillLayoutSubviews]; [super viewWillLayoutSubviews];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.offset(0); make.top.left.right.offset(0);
make.bottom.offset(-45 * WIDTHRADIU); make.bottom.offset(0);
}]; }];
[self.btn_Exchange mas_makeConstraints:^(MASConstraintMaker *make) { [self.btn_Exchange mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.offset(0); make.left.right.bottom.offset(0);
...@@ -71,9 +103,26 @@ ...@@ -71,9 +103,26 @@
} }
- (void)configNavBar
{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(0, 0, 60, 40);
btn.titleLabel.font = [UIFont systemFontOfSize:16];
[btn setTitle:@"金币消费" forState:UIControlStateNormal];
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(goTocoinCostListVC:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:btn];
self.navigationItem.rightBarButtonItem = item;
}
#pragma mark - call api #pragma mark - call api
//金币明细接口
- (void)loadData{ - (void)loadData{
if ([getPeopleID PeopleID] && self.type == ListVCTypeCoinsDetail) if ([getPeopleID PeopleID] )
{ {
NSDictionary *params = @{ NSDictionary *params = @{
@"uid":[NSNumber numberWithInteger:[getPeopleID PeopleID]], @"uid":[NSNumber numberWithInteger:[getPeopleID PeopleID]],
...@@ -85,7 +134,15 @@ ...@@ -85,7 +134,15 @@
if (responseObj) { if (responseObj) {
NSString *code = [responseObj[@"code"] stringValue]; NSString *code = [responseObj[@"code"] stringValue];
if ([code isEqualToString:@"0"]) { if ([code isEqualToString:@"0"]) {
NSArray *array = responseObj[@"result"][@"detailInfo"];
NSArray *array = nil;
if (self.type == ListVCTypeCoinsDetail) {
array = responseObj[@"result"][@"detailInfo"];
}else if (self.type == ListVCTypeCoinsCost){
array = responseObj[@"result"][@"expendList"];
}
self.dataArray = [CoinDetailModel mj_objectArrayWithKeyValuesArray:array]; self.dataArray = [CoinDetailModel mj_objectArrayWithKeyValuesArray:array];
[self.tableView reloadData]; [self.tableView reloadData];
}else{ }else{
...@@ -97,6 +154,8 @@ ...@@ -97,6 +154,8 @@
} }
} }
//消费明细接口
#pragma mark - UITableViewDataSource #pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
...@@ -112,6 +171,8 @@ ...@@ -112,6 +171,8 @@
if (self.type == ListVCTypeCoinsDetail) { if (self.type == ListVCTypeCoinsDetail) {
[cell refreshUIWithData:self.dataArray[indexPath.row]]; [cell refreshUIWithData:self.dataArray[indexPath.row]];
}else if (self.type == ListVCTypeCoinsCost){
[cell refreshUIWithData:self.dataArray[indexPath.row]];
} }
...@@ -145,6 +206,15 @@ ...@@ -145,6 +206,15 @@
} }
- (void)goTocoinCostListVC:(UIButton *)btn
{
CoinsDetailListVC *vc = [[CoinsDetailListVC alloc]init];
vc.title = @"金币消费";
vc.type = ListVCTypeCoinsCost;
vc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark getters and setters #pragma mark getters and setters
- (UITableView *)tableView - (UITableView *)tableView
{ {
...@@ -157,7 +227,7 @@ ...@@ -157,7 +227,7 @@
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[_tableView registerClass:[CoinsListItemTableViewCell class] forCellReuseIdentifier:@"cell"]; [_tableView registerClass:[CoinsListItemTableViewCell class] forCellReuseIdentifier:@"cell"];
_tableView.tableHeaderView = self.headerView; // _tableView.tableHeaderView = self.headerView;
} }
return _tableView; return _tableView;
} }
...@@ -169,6 +239,7 @@ ...@@ -169,6 +239,7 @@
_btn_Exchange.titleLabel.font = [UIFont systemFontOfSize:15 * WIDTHRADIU]; _btn_Exchange.titleLabel.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
[_btn_Exchange setTitle:@"金币兑换" forState:UIControlStateNormal]; [_btn_Exchange setTitle:@"金币兑换" forState:UIControlStateNormal];
[_btn_Exchange addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; [_btn_Exchange addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
_btn_Exchange.hidden = YES;
} }
return _btn_Exchange; return _btn_Exchange;
} }
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
{ {
if (!_lb_coinsNumTitle) { if (!_lb_coinsNumTitle) {
_lb_coinsNumTitle = [[UILabel alloc]init]; _lb_coinsNumTitle = [[UILabel alloc]init];
_lb_coinsNumTitle.text = @"金币(个)"; _lb_coinsNumTitle.text = @"可用金币(个)";
_lb_coinsNumTitle.textColor = [UIColor whiteColor]; _lb_coinsNumTitle.textColor = [UIColor whiteColor];
_lb_coinsNumTitle.font = [UIFont systemFontOfSize:13 * WIDTHRADIU]; _lb_coinsNumTitle.font = [UIFont systemFontOfSize:13 * WIDTHRADIU];
_lb_coinsNumTitle.textAlignment = NSTextAlignmentCenter; _lb_coinsNumTitle.textAlignment = NSTextAlignmentCenter;
......
...@@ -70,7 +70,12 @@ ...@@ -70,7 +70,12 @@
CoinDetailModel *myModel = (CoinDetailModel *)model; CoinDetailModel *myModel = (CoinDetailModel *)model;
self.lb_itemType.text = myModel.sourcestr; self.lb_itemType.text = myModel.sourcestr;
self.lb_timeStamp.text = myModel.create_time; self.lb_timeStamp.text = myModel.create_time;
if (self.type == ListVCTypeCoinsDetail) {
self.lb_addOrReduce.text = [NSString stringWithFormat:@"+%@",myModel.socre]; self.lb_addOrReduce.text = [NSString stringWithFormat:@"+%@",myModel.socre];
}else if (self.type == ListVCTypeCoinsCost){
self.lb_addOrReduce.text = [NSString stringWithFormat:@"-%@",myModel.socre];
}
} }
} }
......
//
// HealthKitManager.h
// Open
//
// Created by 雷俊博 on 2019/8/30.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import <Foundation/Foundation.h>
#import <HealthKit/HealthKit.h>
#import <UIKit/UIDevice.h>
NS_ASSUME_NONNULL_BEGIN
@interface HealthKitManager : NSObject
@property (nonatomic, strong) HKHealthStore *healthStore;
+(id)shareInstance;
- (void)authorizeHealthKit:(void(^)(BOOL success, NSError *error))compltion;
- (void)getStepCount:(void(^)(double value, NSError *error))completion;
- (void)getDistance:(void(^)(double value, NSError *error))completion;
@end
NS_ASSUME_NONNULL_END
//
// OnFootAlertView.h
// Open
//
// Created by 雷俊博 on 2019/9/3.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface OnFootAlertView : UIView
/** 带block回调的弹窗 */
+ (void)alertWithButtonClickedBlock:(void (^)(void))buttonClickedBlock;
@end
NS_ASSUME_NONNULL_END
//
// OnFootAlertView.m
// Open
//
// Created by 雷俊博 on 2019/9/3.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import "OnFootAlertView.h"
#import <Masonry.h>
#import "UIColor+Hex.h"
#import "UIButton+CQBlockSupport.h"
#import "Constants.h"
@implementation OnFootAlertView
/** 带block回调的弹窗 */
+ (void)alertWithButtonClickedBlock:(void (^)(void))buttonClickedBlock
{
//大背景
UIView *bgView = [[UIView alloc]init];
[[[[UIApplication sharedApplication] delegate] window] addSubview:bgView];
bgView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.7];
[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
}];
UIView *backView = [[UIView alloc]init];
backView.backgroundColor = [UIColor clearColor];
[bgView addSubview:backView];
[backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(bgView);
make.size.mas_equalTo(CGSizeMake(272, 245));
}];
// 背景图片
UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"exercise_coinsAlertView"]];
[backView addSubview:bgImageView];
[bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(bgView);
make.size.mas_equalTo(CGSizeMake(272, 245));
}];
UILabel *lb_number = [[UILabel alloc]init];
lb_number.text = @"+100";
lb_number.textAlignment = NSTextAlignmentCenter;
lb_number.textColor = [UIColor colorWithHex:0xfff1d1];
lb_number.font = [UIFont systemFontOfSize:43];
[bgImageView addSubview:lb_number];
[lb_number mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.offset(68);
make.centerX.equalTo(bgImageView);
make.height.offset(35);
}];
UILabel *lb_message = [[UILabel alloc]init];
lb_message.text = @"恭喜!您已完成今日健步走";
lb_message.textAlignment = NSTextAlignmentCenter;
lb_message.textColor = [UIColor colorWithHex:0xfff1d1];
lb_message.font = [UIFont systemFontOfSize:15];
[bgImageView addSubview:lb_message];
[lb_message mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(lb_number.mas_bottom).offset(25);
make.centerX.equalTo(bgImageView);
make.height.offset(15);
}];
UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[confirmBtn setTitle:@"确定" forState:UIControlStateNormal];
confirmBtn.backgroundColor = [UIColor clearColor];
[confirmBtn setTitleColor:[UIColor colorWithHex:0xfff1d1] forState:UIControlStateNormal];
confirmBtn.titleLabel.font = [UIFont systemFontOfSize:15];
confirmBtn.layer.cornerRadius = 17.5;
confirmBtn.layer.borderColor = [UIColor colorWithHex:0xfff1d1].CGColor;
confirmBtn.layer.borderWidth = 1.0;
[confirmBtn cq_addAction:^(UIButton *button) {
[bgView removeFromSuperview];
} forControlEvents:UIControlEventTouchUpInside];
[backView addSubview:confirmBtn];
[confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(13 + 15);
make.bottom.offset(-15);
make.size.mas_equalTo(CGSizeMake(101, 35));
}];
UIButton *OtherBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[OtherBtn setTitle:@"去抽奖" forState:UIControlStateNormal];
OtherBtn.backgroundColor = [UIColor colorWithHex:0xfff1d1];
[OtherBtn setTitleColor:[UIColor colorWithHex:0xc95215] forState:UIControlStateNormal];
OtherBtn.titleLabel.font = [UIFont systemFontOfSize:15];
OtherBtn.layer.cornerRadius = 17.5;
[OtherBtn cq_addAction:^(UIButton *button) {
buttonClickedBlock();
[bgView removeFromSuperview];
} forControlEvents:UIControlEventTouchUpInside];
[backView addSubview:OtherBtn];
[OtherBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.offset(-13 - 15);
make.bottom.offset(-15);
make.size.mas_equalTo(CGSizeMake(101, 35));
}];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// PrizeDetailInfoViewController.h
// Open
//
// Created by 雷俊博 on 2019/9/5.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ListPrizeTableViewCell.h"
NS_ASSUME_NONNULL_BEGIN
@interface PrizeDetailInfoViewController : UIViewController
@property (nonatomic, assign)CTListPrizeType type;
@property (nonatomic, assign)CTListPrizeState state;
@property (nonatomic, strong)NSDictionary *contentDic;
@property (nonatomic, copy) void(^clickBlock)(BOOL);
@end
NS_ASSUME_NONNULL_END
//
// CTPrizeDetailProcessTableCellContentView.h
// Open
//
// Created by 雷俊博 on 2019/9/6.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ListPrizeTableViewCell.h"
NS_ASSUME_NONNULL_BEGIN
@interface CTPrizeDetailProcessTableCellContentView : UIView
@property (assign, nonatomic) BOOL hasUpLine;
@property (assign, nonatomic) BOOL hasDownLine;
@property (assign, nonatomic) BOOL currented;
@property (assign, nonatomic) CTListPrizeState state;
@property (assign, nonatomic)NSInteger index;
- (void)reloadUIWithData:(NSDictionary *)dic state:(CTListPrizeState)state Index:(NSInteger)index;
@end
NS_ASSUME_NONNULL_END
//
// CTPrizeDetailProcessTableCellContentView.m
// Open
//
// Created by 雷俊博 on 2019/9/6.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import "CTPrizeDetailProcessTableCellContentView.h"
#import "UIColor+Hex.h"
#import "Constants.h"
@interface CTPrizeDetailProcessTableCellContentView ()
@property (strong, nonatomic)UILabel *infoLabel;
@property (strong, nonatomic)UILabel *dateLabel;
@property (strong, nonatomic)UILabel *infoLabel2;
@property (strong, nonatomic)UIImageView *img_error;
@end
@implementation CTPrizeDetailProcessTableCellContentView
#pragma mark - life cycle
- (instancetype)init
{
self = [super init];
if (self) {
[self addSubview:self.infoLabel];
[self addSubview:self.img_error];
[self addSubview:self.dateLabel];
[self addSubview:self.infoLabel2];
[self setupUI];
}
return self;
}
- (void)setupUI
{
[self.infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.offset(10 * WIDTHRADIU);
make.left.offset(35 * WIDTHRADIU);
make.height.offset(15 * WIDTHRADIU);
}];
[self.img_error mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.infoLabel);
make.left.equalTo(self.infoLabel.mas_right).offset(3);
}];
[self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.infoLabel);
make.top.equalTo(self.infoLabel.mas_bottom).offset(5 * WIDTHRADIU);
make.height.offset(12 * WIDTHRADIU);
}];
[self.infoLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.infoLabel);
make.centerY.equalTo(self);
make.height.offset(15 * WIDTHRADIU);
}];
}
#pragma mark - public methods
- (void)reloadUIWithData:(NSDictionary *)dic state:(CTListPrizeState)state Index:(NSInteger)index
{
self.state = state;
self.index = index;
if (index == 0) {
self.infoLabel.text = @"奖励已领取";
self.img_error.image = [UIImage imageNamed:@""];
if (self.state == CTListPrizeStateGiving || self.state == CTListPrizeStateFailure || self.state == CTListPrizeStateReceived) {
self.dateLabel.text = [dic[@"orderRequestTime"] stringByReplacingOccurrencesOfString:@"/" withString:@"."];
}else{
self.dateLabel.text = [dic[@"createTime"] stringByReplacingOccurrencesOfString:@"/" withString:@"."];
}
self.infoLabel2.text = @"";
}else if (index == 1){
self.infoLabel.text = @"奖励发放中";
self.img_error.image = [UIImage imageNamed:@""];
self.dateLabel.text = @"预计两小时到账";
self.infoLabel2.text = @"";
}else if (index == 2){
if (self.state == CTListPrizeStateGiving) {
self.infoLabel.text = @"";
self.img_error.image = [UIImage imageNamed:@""];
self.dateLabel.text = @"";
self.infoLabel2.text = @"奖励到账";
}else if (self.state == CTListPrizeStateReceived){
self.infoLabel.text = @"奖励已到账";
self.img_error.image = [UIImage imageNamed:@""];
self.dateLabel.text = [dic[@"payTime"] stringByReplacingOccurrencesOfString:@"/" withString:@"."];
self.infoLabel2.text = @"";
}else if (self.state == CTListPrizeStateFailure){
self.infoLabel.text = @"奖励发放失败";
self.img_error.image = [UIImage imageNamed:@"奖品详情-警示"];
self.dateLabel.text = @"请确认微信账号是否实名";
self.infoLabel2.text = @"";
}else{
self.infoLabel.text = @"";
self.img_error.image = [UIImage imageNamed:@""];
self.dateLabel.text = @"";
self.infoLabel2.text = @"奖励到账";
}
}
[self setNeedsDisplay];
}
#pragma mark - getters and setters
- (UILabel *)infoLabel
{
if (!_infoLabel) {
_infoLabel = [[UILabel alloc]init];
_infoLabel.text = @"奖励已领取";
_infoLabel.textColor = [UIColor colorWithHex:0xfe5733];
_infoLabel.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
_infoLabel.textAlignment = NSTextAlignmentCenter;
}
return _infoLabel;
}
- (UIImageView *)img_error
{
if (!_img_error) {
_img_error = [[UIImageView alloc]init];
}
return _img_error;
}
- (UILabel *)dateLabel
{
if (!_dateLabel) {
_dateLabel = [[UILabel alloc]init];
_dateLabel.text = @"2019.09.02 15:40";
_dateLabel.textColor = [UIColor colorWithHex:0x808080];
_dateLabel.font = [UIFont systemFontOfSize:12 * WIDTHRADIU];
_dateLabel.textAlignment = NSTextAlignmentCenter;
}
return _dateLabel;
}
- (UILabel *)infoLabel2
{
if (!_infoLabel2) {
_infoLabel2 = [[UILabel alloc]init];
_infoLabel2.text = @"奖励到账";
_infoLabel2.textColor = [UIColor colorWithHex:0xb2b2b2];
_infoLabel2.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
_infoLabel2.textAlignment = NSTextAlignmentCenter;
}
return _infoLabel2;
}
- (void)drawRect:(CGRect)rect {
// Drawing code
CGFloat height = self.bounds.size.height;
if (self.hasUpLine) {
if (self.state == CTListPrizeStateGiving || self.state == CTListPrizeStateFailure) {
if (self.index == 2) {
UIBezierPath *topBezier = [UIBezierPath bezierPath];
[topBezier moveToPoint:CGPointMake(10 * WIDTHRADIU +7.5, 0)];
[topBezier addLineToPoint:CGPointMake(10 * WIDTHRADIU +7.5, (height -15)/2.0 + 2.5)];
topBezier.lineWidth = 1.0;
UIColor *stroke = [UIColor colorWithHex:0x808080];
[stroke set];
[topBezier stroke];
}else{
UIBezierPath *topBezier = [UIBezierPath bezierPath];
[topBezier moveToPoint:CGPointMake(10 * WIDTHRADIU +7.5, 0)];
[topBezier addLineToPoint:CGPointMake(10 * WIDTHRADIU +7.5, (height -15)/2.0 + 2.5)];
topBezier.lineWidth = 1.0;
UIColor *stroke = [UIColor colorWithHex:0xfe5733];
[stroke set];
[topBezier stroke];
}
}else{
UIBezierPath *topBezier = [UIBezierPath bezierPath];
[topBezier moveToPoint:CGPointMake(10 * WIDTHRADIU +7.5, 0)];
[topBezier addLineToPoint:CGPointMake(10 * WIDTHRADIU +7.5, height/2.0 - 5)];
topBezier.lineWidth = 1.0;
UIColor *stroke = [UIColor colorWithHex:0xfe5733];
[stroke set];
[topBezier stroke];
}
}
if (self.currented) {
if (self.state == CTListPrizeStateGiving || self.state == CTListPrizeStateFailure) {
if (self.index == 2) {
UIBezierPath *cicle = [UIBezierPath bezierPathWithArcCenter:CGPointMake(10 * WIDTHRADIU +7.5, height/2) radius:5 startAngle:0 endAngle:(M_PI * 2) clockwise:YES];
cicle.lineWidth = 1.0;
UIColor *cColor = [UIColor colorWithHex:0x808080];
[cColor set];
[cicle fill];
[cicle stroke];
UIBezierPath *cicle2 = [UIBezierPath bezierPathWithArcCenter:CGPointMake(10 * WIDTHRADIU +7.5, height/2) radius:7.5 startAngle:0 endAngle:(M_PI * 2) clockwise:YES];
cicle2.lineWidth = 1.0;
UIColor *cColor2 = [UIColor colorWithHex:0x808080];
[cColor2 set];
[cicle2 stroke];
}else{
UIBezierPath *cicle = [UIBezierPath bezierPathWithArcCenter:CGPointMake(10 * WIDTHRADIU +7.5, height/2) radius:5 startAngle:0 endAngle:(M_PI * 2) clockwise:YES];
cicle.lineWidth = 1.0;
UIColor *cColor = [UIColor colorWithHex:0xfe5633];
[cColor set];
[cicle fill];
[cicle stroke];
UIBezierPath *cicle2 = [UIBezierPath bezierPathWithArcCenter:CGPointMake(10 * WIDTHRADIU +7.5, height/2) radius:7.5 startAngle:0 endAngle:(M_PI * 2) clockwise:YES];
cicle2.lineWidth = 1.0;
UIColor *cColor2 = [UIColor colorWithHex:0xfe5633];
[cColor2 set];
[cicle2 stroke];
}
}else{
UIBezierPath *cicle = [UIBezierPath bezierPathWithArcCenter:CGPointMake(10 * WIDTHRADIU +7.5, height/2) radius:5 startAngle:0 endAngle:(M_PI * 2) clockwise:YES];
cicle.lineWidth = 1.0;
UIColor *cColor = [UIColor colorWithHex:0xfe5633];
[cColor set];
[cicle fill];
[cicle stroke];
UIBezierPath *cicle2 = [UIBezierPath bezierPathWithArcCenter:CGPointMake(10 * WIDTHRADIU +7.5, height/2) radius:7.5 startAngle:0 endAngle:(M_PI * 2) clockwise:YES];
cicle2.lineWidth = 1.0;
UIColor *cColor2 = [UIColor colorWithHex:0xfe5633];
[cColor2 set];
[cicle2 stroke];
}
}
if (self.hasDownLine) {
UIBezierPath *downBezier = [UIBezierPath bezierPath];
[downBezier moveToPoint:CGPointMake(10 * WIDTHRADIU +7.5, (height - 15)/2.0 +15 - 2.5)];
[downBezier addLineToPoint:CGPointMake(10 * WIDTHRADIU +7.5, height)];
downBezier.lineWidth = 1.0;
UIColor *stroke = [UIColor colorWithHex:0xfe5733];
[stroke set];
[downBezier stroke];
}
}
@end
//
// PrizeDetailCardView.h
// Open
//
// Created by 雷俊博 on 2019/9/5.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface PrizeDetailCardView : UIView
@end
NS_ASSUME_NONNULL_END
//
// PrizeDetailCardView.m
// Open
//
// Created by 雷俊博 on 2019/9/5.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import "PrizeDetailCardView.h"
#import "Constants.h"
#define degreesToRadian(x) (M_PI * (x) / 180.0)
@interface PrizeDetailCardView ()
/** 遮罩 */
@property (nonatomic, strong) CAShapeLayer *maskLayer;
/** 路径 */
@property (nonatomic, strong) UIBezierPath *borderPath;
@end
@implementation PrizeDetailCardView
-(instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// 初始化遮罩
self.maskLayer = [CAShapeLayer layer];
// 设置遮罩
[self.layer setMask:self.maskLayer];
// 初始化路径
self.borderPath = [UIBezierPath bezierPath];
}
return self;
}
- (void)layoutSubviews
{
[super layoutSubviews];
//遮罩层frame
self.maskLayer.frame = self.bounds;
//设置path的起点
[self.borderPath moveToPoint:CGPointMake(0, 10)];
//左上角的圆角
[self.borderPath addQuadCurveToPoint:CGPointMake(10, 0) controlPoint:CGPointMake(0, 0)];
// 直线,到右上角
[self.borderPath addLineToPoint:CGPointMake(self.bounds.size.width - 10, 0)];
// 右上角的圆角
[self.borderPath addQuadCurveToPoint:CGPointMake(self.bounds.size.width, 10) controlPoint:CGPointMake(self.bounds.size.width, 0)];
// 直线,到右下角
[self.borderPath addLineToPoint:CGPointMake(self.bounds.size.width, self.bounds.size.height - 91 * WIDTHRADIU)];
[self.borderPath addArcWithCenter:CGPointMake(self.bounds.size.width , self.bounds.size.height - 91 * WIDTHRADIU + 6 *WIDTHRADIU ) radius:6 * WIDTHRADIU startAngle:degreesToRadian(-90) endAngle:degreesToRadian(-270) clockwise:NO];
[self.borderPath addLineToPoint:CGPointMake(self.bounds.size.width, self.bounds.size.height - 10)];
[self.borderPath addQuadCurveToPoint:CGPointMake(self.bounds.size.width-10, self.bounds.size.height) controlPoint:CGPointMake(self.bounds.size.width, self.bounds.size.height)];
[self.borderPath addLineToPoint:CGPointMake(10, self.bounds.size.height )];
[self.borderPath addQuadCurveToPoint:CGPointMake(0, self.bounds.size.height - 10) controlPoint:CGPointMake(0, self.bounds.size.height)];
[self.borderPath addLineToPoint:CGPointMake(0, self.bounds.size.height - 91 * WIDTHRADIU + 10)];
[self.borderPath addArcWithCenter:CGPointMake(0, self.bounds.size.height - 91 * WIDTHRADIU + 6 * WIDTHRADIU) radius:6 * WIDTHRADIU startAngle:degreesToRadian(90) endAngle:degreesToRadian(-90) clockwise:NO];
[self.borderPath addLineToPoint:CGPointMake(0, 10)];
self.maskLayer.path = self.borderPath.CGPath;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// PrizeDetailProcessView.h
// Open
//
// Created by 雷俊博 on 2019/9/5.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface PrizeDetailProcessView : UIView
@end
NS_ASSUME_NONNULL_END
//
// PrizeDetailProcessView.m
// Open
//
// Created by 雷俊博 on 2019/9/5.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import "PrizeDetailProcessView.h"
#import "Constants.h"
#define degreesToRadian(x) (M_PI * (x) / 180.0)
@interface PrizeDetailProcessView ()
{
CGFloat _radius;
}
/** 遮罩 */
@property (nonatomic, strong) CAShapeLayer *maskLayer;
/** 路径 */
@property (nonatomic, strong) UIBezierPath *borderPath;
@end
@implementation PrizeDetailProcessView
-(instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// 初始化遮罩
self.maskLayer = [CAShapeLayer layer];
// 设置遮罩
[self.layer setMask:self.maskLayer];
// 初始化路径
self.borderPath = [UIBezierPath bezierPath];
_radius = (frame.size.width - 21 * 5*WIDTHRADIU)/40;
}
return self;
}
- (void)layoutSubviews
{
[super layoutSubviews];
//遮罩层frame
self.maskLayer.frame = self.bounds;
//设置path的起点
[self.borderPath moveToPoint:CGPointMake(0, 10)];
//左上角的圆角
[self.borderPath addQuadCurveToPoint:CGPointMake(10, 0) controlPoint:CGPointMake(0, 0)];
// 直线,到右上角
[self.borderPath addLineToPoint:CGPointMake(self.bounds.size.width - 10, 0)];
// 右上角的圆角
[self.borderPath addQuadCurveToPoint:CGPointMake(self.bounds.size.width, 10) controlPoint:CGPointMake(self.bounds.size.width, 0)];
// 直线,到右下角
[self.borderPath addLineToPoint:CGPointMake(self.bounds.size.width, self.bounds.size.height)];
[self.borderPath addLineToPoint:CGPointMake(self.bounds.size.width - 5 * WIDTHRADIU, self.bounds.size.height)];
for (int i = 0; i < 20; i++) {
[self.borderPath addArcWithCenter:CGPointMake(self.bounds.size.width -_radius - 5 * WIDTHRADIU - i *(_radius * 2 + 5 * WIDTHRADIU ) , self.bounds.size.height) radius:_radius startAngle:degreesToRadian(0) endAngle:degreesToRadian(180) clockwise:NO];
[self.borderPath addLineToPoint:CGPointMake((5 * WIDTHRADIU + 2 *_radius)*(19 - i), self.bounds.size.height)];
}
[self.borderPath addLineToPoint:CGPointMake(0, 10)];
self.maskLayer.path = self.borderPath.CGPath;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// MyPrizeListVC.h
// Open
//
// Created by 雷俊博 on 2019/9/3.
// Copyright © 2019 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface MyPrizeListVC : UIViewController
@property (nonatomic,assign) NSInteger index;
@end
NS_ASSUME_NONNULL_END
This diff is collapsed.
//
// orderHeader.h
// YKHXProject
//
// Created by 杜文全 on 15/11/1.
// Copyright © 2015年 com.iOSDeveloper.duwenquan. All rights reserved.
//
#define DWQMainScreenWidth [UIScreen mainScreen].bounds.size.width
#define DWQMainScreenHeight [UIScreen mainScreen].bounds.size.height
#define DWQMainScreenBounds [UIScreen mainScreen].bounds
#define Button_Origin_Tag 78
#import <UIKit/UIKit.h>
@interface orderHeader : UIView
//外部决定有多少模块
@property (nonatomic,strong) NSArray * items;
//内部选中某一个模块,传递给外部
@property (nonatomic,copy) void(^itemClickAtIndex)(NSInteger index);
//由外部决定选中哪一个模块
-(void)setSelectAtIndex:(NSInteger)index;
-(void)buttonClick:(UIButton*)button;
@end
//
// orderHeader.m
// YKHXProject
//
// Created by 杜文全 on 15/11/1.
// Copyright © 2015年 com.iOSDeveloper.duwenquan. All rights reserved.
//
#import "orderHeader.h"
#import "UIColor+Hex.h"
@implementation orderHeader
{
UIView * _redLine ;
}
-(void)setItems:(NSArray *)items
{
_items = items;
//先清空当前视图上的所有子视图
for (UIView * view in self.subviews) {
[view removeFromSuperview];
}
//添加按钮
CGFloat itemWidth = DWQMainScreenWidth/items.count;
CGFloat itemHeight = self.frame.size.height-2;
for (int i = 0; i< items.count;i++ ) {
UIButton * buton = [[UIButton alloc]init];
buton.frame = CGRectMake(i*itemWidth, 0, itemWidth, itemHeight);
[buton setTitle:items[i] forState:UIControlStateNormal];
[buton setTitleColor:[UIColor colorWithHex:0x808080]forState:UIControlStateNormal];
[buton setTitleColor:[UIColor colorWithHex:0x4d4d4d] forState:UIControlStateSelected];
[buton addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchDown];
buton.tag = Button_Origin_Tag+i;
[self addSubview:buton];
if (i == 0) {
buton.selected = YES;
}
}
//加红线
_redLine = [[UIView alloc]init];
_redLine.frame = CGRectMake(itemWidth * 0.1, self.frame.size.height-2, itemWidth * 0.8, 2);
_redLine.backgroundColor = [UIColor redColor];
[self addSubview:_redLine];
}
-(void)buttonClick:(UIButton*)button
{
//获取点击的是第几个button
NSInteger index = button.tag - Button_Origin_Tag;
[self setSelectAtIndex:index];
//2、把事件传递出去
if (self.itemClickAtIndex) {
_itemClickAtIndex(index);
}
}
-(void)setSelectAtIndex:(NSInteger)index
{
//1、先调整自身的视图显示
for (int i = 0; i < self.items.count; i++) {
UIButton * bt = [self viewWithTag:i+Button_Origin_Tag];
if (bt.tag-Button_Origin_Tag == index) {
bt.selected = YES;
}else{
bt.selected = NO;
}
}
//调整红线的位置
CGFloat itemWidth = DWQMainScreenWidth/self.items.count;
[UIView animateWithDuration:0.2 animations:^{
CGRect rect = self->_redLine.frame;
rect.origin.x = index*(rect.size.width + 0.2 *itemWidth) + 0.1 * itemWidth;
self->_redLine.frame = rect;
}];
}
@end
//
// JYEmpty.h
// ShowEmptyView
//
// Created by Davis on 16/9/22.
// Copyright © 2016年 Davis. All rights reserved.
//
#ifndef JYEmpty_h
#define JYEmpty_h
#endif /* JYEmpty_h */
#import "JYEmptyConst.h"
#import "UIView+Awesome.h"
#import "JYEmptyView.h"
#import "UITableView+JYEmptyView.h"
\ No newline at end of file
//
// JYEmptyConst.h
// ShowEmptyView
//
// Created by Davis on 16/9/22.
// Copyright © 2016年 Davis. All rights reserved.
//
#import <UIKit/UIKit.h>
#define kRGBColor(r,g,b) ([UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1])
#define kFont(font) ([UIFont boldSystemFontOfSize:font])
#define kWindow [UIApplication sharedApplication].keyWindow
// 常量
// 字体大小
// 16
UIKIT_EXTERN const CGFloat Font_H1;
// 15
UIKIT_EXTERN const CGFloat Font_H2;
// 12
UIKIT_EXTERN const CGFloat Font_H3;
// 空白视图间距
UIKIT_EXTERN const CGFloat Margin_Top;
// Label最大高度
UIKIT_EXTERN const CGFloat UILabelMaxHeight;
\ No newline at end of file
//
// JYEmptyConst.m
// ShowEmptyView
//
// Created by Davis on 16/9/22.
// Copyright © 2016年 Davis. All rights reserved.
//
#import <UIKit/UIKit.h>
const CGFloat Font_H1 = 16;
const CGFloat Font_H2 = 15;
const CGFloat Font_H3 = 12;
const CGFloat Margin_Top = 20;
const CGFloat UILabelMaxHeight = 80.f;
NSString *const kImageStr = @"imageKey";
NSString *const kTopStr = @"topKey";
NSString *const kDesStr = @"desKey";
\ No newline at end of file
//
// JYEmptyView.h
// ShowEmptyView
//
// Created by Davis on 16/9/22.
// Copyright © 2016年 Davis. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void(^RefreshBtnClick)();
@interface JYEmptyView : UIView
/** 上方的提示文本 */
@property (nonatomic, copy, nullable) NSString *labelText;
/** 下方的提示文本 */
@property (nonatomic, copy, nullable) NSString *detailsLabelText;
/** 提示的图片 */
@property (nonatomic, strong, nullable) UIImage *iconImage;
/** 点击回调 */
@property (nonatomic, copy, nonnull) RefreshBtnClick refreshBtnClickBlock;
+ (JYEmptyView * _Nonnull)showTitle:(NSString * _Nonnull)title
details:(NSString * _Nonnull)details
iconImag:(NSString * _Nonnull)imageName;
@end
//
// JYEmptyView.m
// ShowEmptyView
//
// Created by Davis on 16/9/22.
// Copyright © 2016年 Davis. All rights reserved.
//
#import "JYEmptyView.h"
#import "JYEmpty.h"
#import <Reachability.h>
@interface JYEmptyView ()
/** 刷新按钮 */
@property (nonatomic, strong, nonnull) UIButton *refreshBtn;
/** 图标 */
@property (nonatomic, strong, nonnull) UIImageView *iconImageView;
/** 上面的提示信息 */
@property (nonatomic, strong, nonnull) UILabel *topTitleLabel;
/** 下面的提示信息 */
@property (nonatomic, strong, nonnull) UILabel *detailsLabel;
@end
@implementation JYEmptyView
/** 计算文本 CGSize */
static inline CGSize LableExpectedSize(NSString *text, UIFont *font, CGSize maxSize){
if (text.length > 0) {
//计算大小
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
paragraphStyle.alignment = NSTextAlignmentCenter;
NSDictionary * attributes = @{NSFontAttributeName: font,
NSParagraphStyleAttributeName: paragraphStyle
};
return [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;
}
return CGSizeZero;
}
+ (JYEmptyView *)showTitle:(NSString *)title
details:(NSString *)details
iconImag:(NSString *)imageName {
//自定义相关配置
JYEmptyView *emptyView = [[JYEmptyView alloc]init];
emptyView.iconImage = [UIImage imageNamed:imageName];
emptyView.labelText = title;
emptyView.detailsLabelText = details;
return emptyView;
}
#pragma mark - 重新刷新按钮的点击事件
- (void)refreshBtnClicked {
if (self.refreshBtnClickBlock) {
self.refreshBtnClickBlock();
}
}
#pragma mark - setter
- (void)setIconImage:(UIImage *)iconImage {
_iconImage = iconImage;
self.iconImageView.image = iconImage;
}
- (void)setLabelText:(NSString *)labelText {
_labelText = labelText;
self.topTitleLabel.text = self.labelText;
}
- (void)setDetailsLabelText:(NSString *)detailsLabelText {
_detailsLabelText = detailsLabelText;
self.detailsLabel.text = detailsLabelText;
}
- (void)layoutSubviews {
[super layoutSubviews];
// 调整位置
self.topTitleLabel.size = LableExpectedSize(_labelText, kFont(Font_H1), CGSizeMake(self.topTitleLabel.bounds.size.width, UILabelMaxHeight));
self.detailsLabel.size = LableExpectedSize(_detailsLabel.text, kFont(Font_H2),CGSizeMake(_detailsLabel.bounds.size.width, UILabelMaxHeight));
self.iconImageView.size = CGSizeMake(self.iconImage.size.width, self.iconImage.size.height);
CGFloat contentHeight = self.iconImageView.height + Margin_Top + self.topTitleLabel.height + Margin_Top + self.detailsLabel.height + Margin_Top + self.refreshBtn.height;
CGFloat topBottomMargin = (self.height - contentHeight) / 2;
self.iconImageView.centerX = self.width / 2;
self.iconImageView.y = topBottomMargin;
self.topTitleLabel.y = self.iconImageView.bottom + Margin_Top;
self.topTitleLabel.centerX = self.iconImageView.centerX;
self.detailsLabel.y = self.topTitleLabel.bottom + Margin_Top;
self.detailsLabel.centerX = self.width / 2;
self.refreshBtn.y = self.detailsLabel.bottom + Margin_Top;
self.refreshBtn.centerX = self.width / 2;
}
#pragma mark - 懒加载
- (UIButton *)refreshBtn {
if(!_refreshBtn) {
_refreshBtn= [[UIButton alloc]init];
[_refreshBtn setTitle:@"重新加载" forState:UIControlStateNormal];
_refreshBtn.layer.cornerRadius = 3.0f;
_refreshBtn.layer.masksToBounds = YES;
_refreshBtn.layer.borderColor = [UIColor redColor].CGColor;
_refreshBtn.layer.borderWidth = 0.5;
[_refreshBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
[_refreshBtn sizeToFit];
_refreshBtn.size = CGSizeMake(120, 35);
_refreshBtn.titleLabel.font = kFont(Font_H2);
[_refreshBtn addTarget:self action:@selector(refreshBtnClicked) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_refreshBtn];
}
return _refreshBtn;
}
- (UIImageView *)iconImageView {
if(!_iconImageView) {
_iconImageView = [[UIImageView alloc] init];
_iconImageView.contentMode = UIViewContentModeCenter;
[self addSubview:_iconImageView];
}
return _iconImageView;
}
/** 主标题只显示一行 */
- (UILabel *)topTitleLabel {
if (!_topTitleLabel) {
_topTitleLabel = [[UILabel alloc] init];
_topTitleLabel.numberOfLines = 1;
_topTitleLabel.textAlignment = NSTextAlignmentCenter;
_topTitleLabel.font = kFont(Font_H1);
_topTitleLabel.textColor = kRGBColor(46, 46, 46);
[self addSubview:_topTitleLabel];
}
return _topTitleLabel;
}
/** 详情 -- 多行 */
- (UILabel *)detailsLabel {
if(!_detailsLabel) {
_detailsLabel = [[UILabel alloc] initWithFrame:self.bounds];
_detailsLabel.textAlignment = NSTextAlignmentCenter;
_detailsLabel.numberOfLines = 0;
_detailsLabel.font = kFont(Font_H3);
_detailsLabel.textColor = kRGBColor(100, 100, 100);
[self addSubview:_detailsLabel];
}
return _detailsLabel;
}
@end
//
// UITableView+JYEmptyView.h
// ShowEmptyView
//
// Created by Davis on 16/9/22.
// Copyright © 2016年 Davis. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UITableView (JYEmptyView)
/** 传入的空视图 */
@property (nonatomic, strong, nonnull) UIView *emptyView;
/** 传入的无网络视图 */
@property (nonatomic, strong, nonnull) UIView *noNetworkView;
@end
//
// UITableView+JYEmptyView.m
// ShowEmptyView
//
// Created by Davis on 16/9/22.
// Copyright © 2016年 Davis. All rights reserved.
//
#import "UITableView+JYEmptyView.h"
#import <objc/runtime.h>
#import "JYEmpty.h"
#import <Reachability.h>
static JYEmptyView *view;
@implementation UITableView (JYEmptyView)
/**
* 交换方法
*
* @param c 类
* @param orig system @selector
* @param new new @selector
*/
void swizzle(Class c, SEL orig, SEL new) {
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) {
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
} else {
method_exchangeImplementations(origMethod, newMethod);
}
}
+ (void)load {
// 交换方法
[self swizzleMethod];
}
+ (void)swizzleMethod {
Class c = [UITableView class];
swizzle(c, @selector(layoutSubviews), @selector(JY_layoutSubviews));
}
- (void)listenNetwork {
static Reachability *reach = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
reach = [Reachability reachabilityWithHostname:@"www.baidu.com"];
[reach startNotifier];
});
UIView *noNetworkView = self.noNetworkView;
noNetworkView.frame = [UIScreen mainScreen].bounds;
reach.reachableBlock = ^(Reachability *reach) {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"REACHABLE!");
if (noNetworkView.superview) {
[noNetworkView removeFromSuperview];
}
});
};
reach.unreachableBlock = ^(Reachability *reach){
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"UNREACHABLE!");
if (!noNetworkView.superview) {
[kWindow addSubview:noNetworkView];
}
});
};
}
#pragma mark - 根据数据情况确定空白视图显示与否
- (BOOL)isShowEmptyView {
NSUInteger numberOfRows = 0;
for (NSInteger sectionIndex = 0; sectionIndex < self.numberOfSections; sectionIndex++) {
numberOfRows += [self numberOfRowsInSection:sectionIndex];
}
return (numberOfRows > 0);
}
#pragma mark - 设置空白视图
- (void)setEmptyView {
UIView *emptyView = self.emptyView;
if (emptyView.superview) {
[emptyView removeFromSuperview];
}
[kWindow addSubview:emptyView];
emptyView.backgroundColor = [UIColor whiteColor];
emptyView.frame = [UIScreen mainScreen].bounds;
BOOL emptyViewShouldBeShow = ([self isShowEmptyView] == NO);
emptyView.hidden = !emptyViewShouldBeShow;
if (emptyView.hidden) {
[emptyView removeFromSuperview];
emptyView = nil;
}
}
#pragma mark - swizzle method
- (void)JY_layoutSubviews {
[self JY_layoutSubviews];
[self setEmptyView];
}
#pragma mark - AssociatedObject
- (void)setEmptyView:(UIView *)emptyView {
objc_setAssociatedObject(self, @selector(setEmptyView:), emptyView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (UIView *)emptyView {
return objc_getAssociatedObject(self, @selector(setEmptyView:));
}
- (void)setNoNetworkView:(UIView *)noNetworkView {
objc_setAssociatedObject(self, @selector(setNoNetworkView:), noNetworkView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
[self listenNetwork];
}
- (UIView *)noNetworkView {
return objc_getAssociatedObject(self, @selector(setNoNetworkView:));
}
@end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
}else if (indexPath.row == 1){ }else if (indexPath.row == 1){
cell.lb_Content_ArrowHidden.text = @"400-002-1709"; cell.lb_Content_ArrowHidden.text = @"400-002-1799";
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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