add weixinapi

This commit is contained in:
lianxiang 2018-08-27 13:35:39 +08:00
parent a4242fa7b7
commit 6e090fd28d
21 changed files with 325 additions and 58 deletions

View File

@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
6B67B068A469498C38CEF799 /* Pods_GIGA.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B14B65914FBF61910191D7A8 /* Pods_GIGA.framework */; };
8314D2112133ABE500B458BF /* WeiIXinApiManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8314D2102133ABE500B458BF /* WeiIXinApiManager.m */; };
83346AC0212BB50A0054D597 /* PassWordResetVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 83346ABE212BB50A0054D597 /* PassWordResetVC.m */; };
83346AC1212BB50A0054D597 /* PassWordResetVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83346ABF212BB50A0054D597 /* PassWordResetVC.xib */; };
83346AC5212BBC8C0054D597 /* GiGaRegistViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83346AC3212BBC8C0054D597 /* GiGaRegistViewController.m */; };
@ -18,6 +19,7 @@
83346AD4212BFF6E0054D597 /* UserGuardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83346AD3212BFF6E0054D597 /* UserGuardViewController.m */; };
83346AD7212C18F50054D597 /* GiGaAppGaurdVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 83346AD6212C18F50054D597 /* GiGaAppGaurdVC.m */; };
833DA7762122A62000A5C614 /* GiGaMaskTaskViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 833DA7752122A62000A5C614 /* GiGaMaskTaskViewController.m */; };
8342D9FD2131150200D16B1D /* 4481.wav in Resources */ = {isa = PBXBuildFile; fileRef = 8342D9FC2131150200D16B1D /* 4481.wav */; };
8349585C212511040064DB6C /* AppDelegate+ThirdParty.m in Sources */ = {isa = PBXBuildFile; fileRef = 8349585B212511040064DB6C /* AppDelegate+ThirdParty.m */; };
835060A2212D1225007E6220 /* GiGaMeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 835060A1212D1225007E6220 /* GiGaMeViewController.m */; };
835060A5212D3536007E6220 /* AppDelegate+GiGaConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 8361B40A21217B2100238FEB /* AppDelegate+GiGaConfig.m */; };
@ -105,6 +107,8 @@
/* Begin PBXFileReference section */
055947143A68ADCC68C3F3E1 /* Pods-GIGA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GIGA.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GIGA/Pods-GIGA.debug.xcconfig"; sourceTree = "<group>"; };
8314D20F2133ABE500B458BF /* WeiIXinApiManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeiIXinApiManager.h; sourceTree = "<group>"; };
8314D2102133ABE500B458BF /* WeiIXinApiManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WeiIXinApiManager.m; sourceTree = "<group>"; };
83346ABD212BB50A0054D597 /* PassWordResetVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PassWordResetVC.h; sourceTree = "<group>"; };
83346ABE212BB50A0054D597 /* PassWordResetVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PassWordResetVC.m; sourceTree = "<group>"; };
83346ABF212BB50A0054D597 /* PassWordResetVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PassWordResetVC.xib; sourceTree = "<group>"; };
@ -121,6 +125,7 @@
83346AD6212C18F50054D597 /* GiGaAppGaurdVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaAppGaurdVC.m; sourceTree = "<group>"; };
833DA7742122A62000A5C614 /* GiGaMaskTaskViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMaskTaskViewController.h; sourceTree = "<group>"; };
833DA7752122A62000A5C614 /* GiGaMaskTaskViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaMaskTaskViewController.m; sourceTree = "<group>"; };
8342D9FC2131150200D16B1D /* 4481.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = 4481.wav; sourceTree = "<group>"; };
8349585A212511040064DB6C /* AppDelegate+ThirdParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+ThirdParty.h"; sourceTree = "<group>"; };
8349585B212511040064DB6C /* AppDelegate+ThirdParty.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+ThirdParty.m"; sourceTree = "<group>"; };
835060A0212D1225007E6220 /* GiGaMeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMeViewController.h; sourceTree = "<group>"; };
@ -293,6 +298,7 @@
83346AC8212BD4160054D597 /* Source */ = {
isa = PBXGroup;
children = (
8342D9FC2131150200D16B1D /* 4481.wav */,
838388D92130046D00D14C53 /* emojizone.mp4 */,
838388C9212FA00200D14C53 /* MaskTime.png */,
838388C3212F934400D14C53 /* pomodoSound.m4a */,
@ -386,6 +392,8 @@
8357ADCF2123C5F7000816F2 /* GiGaAPIRequest.m */,
8357ADD12123C7C6000816F2 /* GiGaAPIResult.h */,
8357ADD22123C7C6000816F2 /* GiGaAPIResult.m */,
8314D20F2133ABE500B458BF /* WeiIXinApiManager.h */,
8314D2102133ABE500B458BF /* WeiIXinApiManager.m */,
);
path = GiGaNetTool;
sourceTree = "<group>";
@ -928,6 +936,7 @@
83835BA8212E4748001480F2 /* MAssaageCenterCell.xib in Resources */,
8361B3D3212155C300238FEB /* Assets.xcassets in Resources */,
8361B3D1212155C200238FEB /* Main.storyboard in Resources */,
8342D9FD2131150200D16B1D /* 4481.wav in Resources */,
83835BB0212E4FCD001480F2 /* MessageListViewCell.xib in Resources */,
83346ACF212BD7830054D597 /* GiGaWebViewController.xib in Resources */,
);
@ -1025,6 +1034,7 @@
83346AC5212BBC8C0054D597 /* GiGaRegistViewController.m in Sources */,
83346AD7212C18F50054D597 /* GiGaAppGaurdVC.m in Sources */,
8349585C212511040064DB6C /* AppDelegate+ThirdParty.m in Sources */,
8314D2112133ABE500B458BF /* WeiIXinApiManager.m in Sources */,
83835BCA212E8045001480F2 /* GIGAQuetionView.m in Sources */,
8361B3CE212155C200238FEB /* ViewController.m in Sources */,
8361B4382121847600238FEB /* UINavigationBar+Custom.m in Sources */,

View File

@ -8,6 +8,7 @@
#import "AppDelegate+ThirdParty.h"
#define PUSH_APPKEY @"1f8122badd24c2adb8b3f231"
#import "WXApi.h"
@implementation AppDelegate (ThirdParty)
@ -37,11 +38,11 @@
//
[WXApi registerApp:WXin_APPID];
}
//
#pragma mark
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [WXApi handleOpenURL:url delegate:self];
@ -57,11 +58,14 @@
if ([resp isKindOfClass:[SendAuthResp class]]) {
SendAuthResp*rep = (SendAuthResp*)resp;
if (resp.errCode == 0) {
[[NSNotificationCenter defaultCenter] postNotificationName: @"WXAuthSuccess" object:@{@"code":rep.code}];
NC_POST_NAME_OBJECT(kWeiXinAuthrization_Success, @{@"code":rep.code})
}else{
[[UIApplication sharedApplication].keyWindow makeToast:@"授权失败" duration:1.6 position:CSToastPositionCenter];
}
}
}
#pragma mark -
// ios 10 Support
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0)){
@ -102,7 +106,6 @@
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
[JPUSHService resetBadge];
// Required, iOS 7 Support
GILog(@"iOS 7 userInfo%@",userInfo);
[JPUSHService handleRemoteNotification:userInfo];

View File

@ -40,7 +40,6 @@
//广
[self creatAdView];
//[self setupTabBarController];
return YES;
}
@ -109,7 +108,7 @@
if (_isMasking) {
[[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"闹钟提醒!" fireTimeInterval:2 alertAction:@"面膜时间已添加闹钟提醒!" withIdentifier:kLOCALNotifiID_APPTERMINAL];
// [[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"闹钟提醒!" fireTimeInterval:2 alertAction:@"面膜时间已添加闹钟提醒!" withIdentifier:kLOCALNotifiID_APPTERMINAL];
}
}

View File

@ -45,6 +45,8 @@
//计算文字的长度
+ (CGSize)sizeWithText:(NSString *)text font:(UIFont *)font maxSize:(CGSize)maxSize;
+(CGFloat)getSpaceLabelHeight:(NSString*)str withFont:(UIFont*)font maxSize:(CGSize)maxSize;
+(void)setLabelSpace:(UILabel*)label withValue:(NSString*)str withFont:(UIFont*)font;
@end

View File

@ -55,7 +55,6 @@
NSString *futrueTimeStr = [formatter stringFromDate:futrueDate];
NSDate *furtureformatDate = [formatter dateFromString:futrueTimeStr];
long futrueTimestamp= [furtureformatDate timeIntervalSince1970];
return futrueTimestamp;
}
@ -84,10 +83,65 @@
}
//
//size
+ (CGSize)sizeWithText:(NSString *)text font:(UIFont *)font maxSize:(CGSize)maxSize
{
return [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil].size;
}
+(CGFloat)getSpaceLabelHeight:(NSString*)str withFont:(UIFont*)font maxSize:(CGSize)maxSize {
NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
paraStyle.lineBreakMode = NSLineBreakByCharWrapping;
paraStyle.alignment = NSTextAlignmentLeft;
paraStyle.lineSpacing = 6;
paraStyle.hyphenationFactor = 1.0;
paraStyle.firstLineHeadIndent = 0.0;
paraStyle.paragraphSpacingBefore = 0.0;
paraStyle.headIndent = 0;
paraStyle.tailIndent = 0;
NSDictionary *dic = @{NSFontAttributeName:font, NSParagraphStyleAttributeName:paraStyle, NSKernAttributeName:@1.5f
};
CGSize size =[str boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size;
return size.height;
}
+(void)setLabelSpace:(UILabel*)label withValue:(NSString*)str withFont:(UIFont*)font {
NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
paraStyle.lineBreakMode = NSLineBreakByCharWrapping;
paraStyle.alignment = NSTextAlignmentLeft;
paraStyle.lineSpacing = 6; //
paraStyle.hyphenationFactor = 1.0;
paraStyle.firstLineHeadIndent = 0.0;
paraStyle.paragraphSpacingBefore = 0.0;
paraStyle.headIndent = 0;
paraStyle.tailIndent = 0;
// NSKernAttributeName:@1.5f
NSDictionary *dic = @{NSFontAttributeName:font, NSParagraphStyleAttributeName:paraStyle, NSKernAttributeName:@1.5f
};
NSAttributedString *attributeStr = [[NSAttributedString alloc] initWithString:str attributes:dic];
label.attributedText = attributeStr;
}
@end

View File

@ -28,25 +28,24 @@
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
content.title = alertAction;
content.body = alertBoday;
content.sound = [UNNotificationSound defaultSound];
//content.sound = [UNNotificationSound defaultSound];
content.sound = [UNNotificationSound soundNamed:@"4481.wav"];
//content.sound = UNNotificationSound
// <10M p3 p4 <50M pmeg mpeg4 <5M
NSURL *imageUrl = [[NSBundle mainBundle] URLForResource:@"MaskTime" withExtension:@"png"];
UNNotificationAttachment *attach = [UNNotificationAttachment attachmentWithIdentifier:@"photo" URL:imageUrl options:nil error:nil];
NSURL *audioUrl = [[NSBundle mainBundle] URLForResource:@"pomodoSound" withExtension:@"m4a"];
NSURL *audioUrl = [[NSBundle mainBundle] URLForResource:@"4481" withExtension:@"wav"];
UNNotificationAttachment *attachAudio = [UNNotificationAttachment attachmentWithIdentifier:@"audio" URL:audioUrl options:nil error:nil];
NSURL *vedioUrl = [[NSBundle mainBundle] URLForResource:@"emojizone" withExtension:@"mp4"];
UNNotificationAttachment *vedioAudio = [UNNotificationAttachment attachmentWithIdentifier:@"vedio" URL:vedioUrl options:nil error:nil];
content.attachments = @[vedioAudio];
content.attachments = @[attachAudio];
// 60s
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:timeInterval repeats:NO];
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:60 repeats:NO];
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:identifier content:content trigger:trigger];
[center addNotificationRequest:request withCompletionHandler:^(NSError *_Nullable error) {
GILog(@"成功添加推送");
@ -62,6 +61,7 @@
localNotification.alertAction = alertAction;
localNotification.applicationIconBadgeNumber = 1;
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.soundName = @"4481.wav";
//localNotification.alertLaunchImage = @"MaskTime.png";
localNotification.userInfo = @{identifier:identifier};
//
@ -127,6 +127,7 @@ API_AVAILABLE(ios(10.0)){
NSLog(@"iOS10 前台 收到本地通知:{\\\\nbody:%@\\\\ntitle:%@,\\\\nsubtitle:%@,\\\\nbadge%@\\\\nsound%@\\\\nuserInfo%@\\\\n}",body,title,subtitle,badge,sound,userInfo);
[self showAlert:title message:body];
[center removeAllPendingNotificationRequests];
}
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
}
@ -136,7 +137,7 @@ API_AVAILABLE(ios(10.0)){
API_AVAILABLE(ios(10.0)){
GILog(@"ios10用户点击通知栏相应");
[center removeAllPendingNotificationRequests];
completionHandler();
}
//

View File

@ -12,4 +12,6 @@
+(GiGaNetManager *)shareInstance;
+(void)request:(GiGaAPIRequest*)api;
@end

View File

@ -67,4 +67,6 @@
}
}
@end

View File

@ -0,0 +1,35 @@
//
// WeiIXinApiManager.h
// GIGA
//
// Created by lianxiang on 2018/8/27.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WeiIXinApiManager : NSObject
/**
access_token
@param url get access_token
@param parameters
@param success
@param failure
*/
+(void)weixinAccessTokeRequstUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id response))success
failure:(void (^)(NSError *err))failure;
/**
@param parameters
@param success
@param failure
*/
+(void)getWeiXinUserInfoUrl:(NSString *)url parameters:(NSDictionary *)parameters
success:(void (^)(id response))success
failure:(void (^)(NSError *err))failure;
@end

View File

@ -0,0 +1,45 @@
//
// WeiIXinApiManager.m
// GIGA
//
// Created by lianxiang on 2018/8/27.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "WeiIXinApiManager.h"
@implementation WeiIXinApiManager
+(void)weixinAccessTokeRequstUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id response))success
failure:(void (^)(NSError *err))failure
{
[self getrequstweiAPiUrl:url params:parameters success:success failure:failure];
}
+ (void)getWeiXinUserInfoUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id))success failure:(void (^)(NSError *))failure
{
[self getrequstweiAPiUrl:url params:parameters success:success failure:failure];
}
+(void)getrequstweiAPiUrl:(NSString *)url params:(NSDictionary *)parameters success:(void (^)(id response))success
failure:(void (^)(NSError *err))failure
{
AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] init];
manager.responseSerializer=[AFHTTPResponseSerializer serializer];
[manager GET:url parameters:parameters progress:^(NSProgress * _Nonnull downloadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
if (success) {
success(responseObject);
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
if (failure) {
failure(error);
}
}];
}
@end

View File

@ -39,5 +39,13 @@
+(void)saveAppGaurdflag:(BOOL)showedGaurd;
+(BOOL)isShowedAppGaurd;
/**
access_token返回信息
@param dic
*/
+(void)saveWeiXinaccesstokenInfoWithDic:(NSDictionary *)dic;
+(NSDictionary *)getWeiXinAccessToenDic;
@end

View File

@ -12,6 +12,7 @@ NSString *const kUserManagerVerision = @"GiGAUserDBVeriosn";
NSString *const GIGADEFAULTKEY_USERID = @"GiGaUserId";
NSString *const kShowUserGuard = @"ShowUserGuard";
NSString *const kShowAppGuard = @"ShowAppGuard";
NSString *const kWeiXinSaveToken = @"WeiXinSaveToken";
@implementation GiGaUserDefault
@ -77,4 +78,14 @@ NSString *const kShowAppGuard = @"ShowAppGuard";
return showedGaurd;
}
+(void)saveWeiXinaccesstokenInfoWithDic:(NSDictionary *)dic
{
[UD_STADARDUD setObject:dic forKey:kWeiXinSaveToken];
}
+(NSDictionary *)getWeiXinAccessToenDic{
return [UD_STADARDUD objectForKey:kWeiXinSaveToken];
}
@end

BIN
GIGA/Common/Source/4481.wav Normal file

Binary file not shown.

View File

@ -39,6 +39,10 @@ UD_SYNC
#define kLOCALNotifiID_MASKETIMEEND @"GIGALocalNotificationMaskTimeEnd"
//app 挂起
#define kLOCALNotifiID_APPTERMINAL @"GIGALocalNotificationAppTerminal"
//微信登陆授权成功
#define kWeiXinAuthrization_Success @"WXAuthSuccess"
#define WXin_APPID @"wx1fa33defa5cbc8dd"
#define WXin_APPSecret @"3c03917b01f74a7f2d8a9bdd64f40697"
#define GIGARGB(R,G,B,A) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A]
#define GIGAUIColorFromRGB_A(rgbValue,alphaValue) [UIColor \

View File

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
@ -18,6 +22,19 @@
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>weixin</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wx1fa33defa5cbc8dd</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>

View File

@ -11,6 +11,10 @@
#import "PassWordResetVC.h"
#import "GiGaRegistViewController.h"
#import "GiGaUserDefault.h"
#import "WXApi.h"
#import "GiGaNetManager.h"
#import "WeiIXinApiManager.h"
@interface GiGaUserLoginVC ()
@property (weak, nonatomic) IBOutlet UIImageView *userImagView;
@property (weak, nonatomic) IBOutlet UITextField *acountTextField;
@ -33,9 +37,19 @@
[self textFieldUI];
[self.registBtn addTarget:self action:@selector(registBtnAction) forControlEvents:UIControlEventTouchUpInside];
[self.loginBtn addTarget:self action:@selector(loginBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[self.weiXinLoginBtn addTarget:self
action:@selector(weiXinLoginAction) forControlEvents:UIControlEventTouchUpInside];
NC_ADD_TARGET_NAME_OBJECT(self, @selector(WeiXinLongIn:), kWeiXinAuthrization_Success, nil)
if (![WXApi isWXAppInstalled]) {
self.weiXinLoginBtn.hidden = YES;
}
}
-(void)dealloc{
NC_REMOVE_NAME(self, kWeiXinAuthrization_Success,nil);
}
-(void)setUpX{
@ -49,8 +63,7 @@
}
-(void)textFieldUI{
//self.acountTextField.attributedPlaceholder = @"";
UIView *acountView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
acountView.backgroundColor = [UIColor redColor];
@ -60,7 +73,8 @@
self.acountTextField.leftView = acountView;
self.acountTextField.leftViewMode = UITextFieldViewModeAlways;
[self.passwordTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"];
// NSAttributedString *passholderText = [[NSAttributedString alloc] initWithString:@"密码" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:[UIColor redColor]}];
// self.passwordTextField.attributedPlaceholder = passholderText;
UIView *passView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
passView.backgroundColor = [UIColor redColor];
UIImageView *passViewIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)];
@ -68,7 +82,6 @@
[passView addSubview:passViewIcon];
self.passwordTextField.leftView = passView;
self.passwordTextField.leftViewMode = UITextFieldViewModeAlways;
self.loginBtn.layer.masksToBounds = YES;
self.loginBtn.layer.cornerRadius = self.loginBtn.frame.size.height / 2;
@ -116,4 +129,58 @@
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark -
//
-(void)weiXinLoginAction{
if ([WXApi isWXAppInstalled]) {
SendAuthReq * req = [[SendAuthReq alloc] init] ;
req.scope = @"snsapi_userinfo";
req.state = @"wx_oauth2_authorization_state";
[WXApi sendReq:req];
}
}
//access_token
-(void)WeiXinLongIn:(NSNotification *)notification{
NSDictionary *param = @{
@"appid":WXin_APPID,
@"secret":WXin_APPSecret,
@"code":notification.object[@"code"],
@"grant_type":@"authorization_code"
};
[WeiIXinApiManager weixinAccessTokeRequstUrl:@"https://api.weixin.qq.com/sns/oauth2/access_token" parameters:param success:^(id response) {
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingAllowFragments error:nil];
GILog(@"access_token back -->%@",dict);
[GiGaUserDefault saveWeiXinaccesstokenInfoWithDic:dict];
[self requstWeiXinUserinfo];
} failure:^(NSError *err) {
GILog(@"access_token err-->%@",err.localizedDescription);
}];
}
//
-(void)requstWeiXinUserinfo{
NSDictionary *tokenDic = [GiGaUserDefault getWeiXinAccessToenDic];
NSDictionary *param = @{
@"openid":tokenDic[@"openid"],
@"access_token":tokenDic[@"access_token"],
};
[WeiIXinApiManager getWeiXinUserInfoUrl:@"https://api.weixin.qq.com/sns/userinfo" parameters:param success:^(id response) {
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingAllowFragments error:nil];
GILog(@"weixinUser info back -->%@",dict);
} failure:^(NSError *err) {
GILog(@"weixin_userinfoApi err-->%@",err.localizedDescription);
}];
}
@end

View File

@ -22,6 +22,7 @@
#import "LXCountTimer.h"
#import "GiGaHelper.h"
#import <MediaPlayer/MediaPlayer.h>
#import "GiGaMeViewController.h"
@interface GiGaMaskTaskViewController ()
{
@ -56,7 +57,7 @@
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self startMaskTime];
}
- (void)viewDidLoad {
@ -139,14 +140,15 @@
-(void)startMaskTime{
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
if (delegate.isMasking) {
return;
}
delegate.isMasking = YES;
[_musicPalyer play];
[self setBackGroundPlayingInfo];//
// s
NSTimeInterval timeInterVal = 58;
NSString *timeformat = [GiGaHelper stringWithNSTimerinterval:timeInterVal];
NSArray *timesArr = [timeformat componentsSeparatedByString:@":"];
NSString *hour = timesArr[0];
@ -161,8 +163,7 @@
}
#pragma mark
#pragma mark
-(void)setBackGroundPlayingInfo{
MPMediaItemArtwork *arwork = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:@"MaskTime.png"]];
@ -181,6 +182,7 @@
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
}
- (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent {
if (receivedEvent.type == UIEventTypeRemoteControl) {
@ -216,15 +218,12 @@
#pragma mark
-(void)testBtnAcion:(UIButton *)btn{
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
if (delegate.isMasking) {
return;
}
[self startMaskTime];
return ;
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (isUserLogin) {
//GIGA_ShowToast(@"userLogin!");
@ -260,7 +259,6 @@
GiGaAdDetailViewController *detailVC=[[GiGaAdDetailViewController alloc] init];
[self.navigationController pushViewController:detailVC animated:YES];
}
#pragma mark
@ -298,11 +296,13 @@
userGuardVC.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
[self presentViewController:userGuardVC animated:NO completion:nil];
}
#pragma mark App
-(void)showAPPappGaurdView{
GiGaAppGaurdVC *gaurdVC = [[GiGaAppGaurdVC alloc] init];
[self presentViewController:gaurdVC animated:YES completion:nil];
}
#pragma mark - setUpNav
-(void)setUpNav{
@ -320,11 +320,11 @@
[rightBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
[rightBtn addTarget:self action:@selector(rightBtnAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
}
#pragma mark action
#pragma mark action
-(void)leftBtnAction{
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (isUserLogin) {
@ -342,6 +342,9 @@
#pragma mark action
-(void)rightBtnAction{
GiGaMeViewController *meVC= [[GiGaMeViewController alloc] init];
[self.navigationController pushViewController:meVC animated:YES];
}
#pragma mark -bottomView

View File

@ -44,7 +44,7 @@
-(void)setquestionArray{
NSArray *array = @[
@{@"questionid" : @"1", @"totalCount" : @"5", @"question" : @"如果昨天是明天的话就好了,这样今天就周五了。真实的今天可能是星期几?", @"questiontype" : @"1", @"questiontype_text" : @"单选题", @"questionselectnumber" : @"3", @"questiondescribe" : @"星期三:理想今天是星期五,昨天是星期四,真实明天是理想的昨天是星期四,真实的今天是星期三。\n星期日理想今天是星期五明天是星期六真实昨天是理想的明天是星期六真实的今天是星期日。", @"trueanswer" : @"A", @"userAnswer" : @[], @"tkselect" : @[@"A星期三", @"B星期四", @"C星期五"]},
@{@"questionid" : @"1", @"totalCount" : @"5", @"question" : @"如果昨天是明天的话就好了,这样今天就周五了。真实的今天可能是星期几?", @"questiontype" : @"1", @"questiontype_text" : @"单选题", @"questionselectnumber" : @"3", @"questiondescribe" : @"星期三:理想今天是星期五,昨天是星期四,真实明天是理想的昨天是星期四,真实的今天是星期三。\n星期日理想今天是星期五明天是星期六真实昨天是理想的明天是星期六真实的今天是星期日。", @"trueanswer" : @"A", @"userAnswer" : @[], @"tkselect" : @[@"A星期三星期三星期三星期三星期三星期三星期三", @"B星期四", @"C星期五星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三"]},
@{@"questionid" : @"2", @"totalCount" : @"5", @"question" : @"这里是问题这道题的答案是AC。这里是问题这道题的答案是AC。这里是问题这道题的答案是AC。", @"questiontype" : @"1", @"questiontype_text" : @"多选题", @"questionselectnumber" : @"5", @"questiondescribe" : @"这里是答案解析,这里可以很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的。", @"trueanswer" : @"AC", @"userAnswer" : @[], @"tkselect" : @[@"A这个选项是正确的。这个选项是正确的。这个选项是正确的。", @"B这个选项是错误的。这个选项是错误的。这个选项是错误的。", @"C这个选项是正确的。这个选项是正确的。这个选项是正确的。", @"D这个选项是错误的。这个选项是错误的。这个选项是错误的。", @"E这个选项是错误的。这个选项是错误的。这个选项是错误的。"]},
@{@"questionid" : @"3", @"totalCount" : @"5", @"question" : @"以下哪个牌子不是化妆品?", @"questiontype" : @"1", @"questiontype_text" : @"单选题", @"questionselectnumber" : @"3", @"questiondescribe" : @"化妆品,化妆品化妆品化妆品化妆品化妆品化妆品化妆品。", @"trueanswer" : @"A", @"userAnswer" : @[], @"tkselect" : @[@"A化妆品", @"B化妆品", @"C星期五"]},
@{@"questionid" : @"4", @"totalCount" : @"5", @"question" : @"如果昨天是明天的话就好了,这样今天就周五了。真实的今天可能是星期几?", @"questiontype" : @"1", @"questiontype_text" : @"单选题", @"questionselectnumber" : @"3", @"questiondescribe" : @"真实昨天是理想的明天是星期六,真实的今天是星期日?", @"trueanswer" : @"A", @"userAnswer" : @[], @"tkselect" : @[@"A星三", @"B星", @"C期"]},
@ -80,9 +80,8 @@
[self.view layoutIfNeeded];//
//
[_questionView reloadViewWithFrame:CGRectMake(0, CGRectGetMaxY(_questionlabel.frame) + 15, KMainW, 0) style:[_currentModel.questiontype intValue] - 1 answerArray:_currentModel.tkselect userAnswers:_currentModel.userAnswer];
[_questionView reloadViewWithFrame:CGRectMake(30, CGRectGetMaxY(_questionlabel.frame) + 15, KMainW - 30*2, 0) style:[_currentModel.questiontype intValue] - 1 answerArray:_currentModel.tkselect userAnswers:_currentModel.userAnswer];
}
#pragma mark

View File

@ -25,7 +25,7 @@
{
if (!_view) {
UIView *view = [[UIView alloc] init];
//view.backgroundColor = [UIColor blueColor];
view.backgroundColor = [UIColor blueColor];
[self addSubview:view];
_view = view;
}
@ -77,13 +77,15 @@
NSString *labelText = _answerArr[i];
labelText = [labelText stringByReplacingOccurrencesOfString:@"\r" withString:@""];
labelText = [labelText stringByReplacingOccurrencesOfString:@"\n" withString:@""];
//
CGFloat labelH = [GiGaHelper sizeWithText:labelText font:font maxSize:CGSizeMake(KMainW - 50, MAXFLOAT)].height;
//CGFloat labelH = [GiGaHelper sizeWithText:labelText font:font maxSize:CGSizeMake(frame.size.width - btnH - 5, MAXFLOAT)].height;
CGFloat labelH = [GiGaHelper getSpaceLabelHeight:labelText withFont:font maxSize:CGSizeMake(frame.size.width - btnH - 5, MAXFLOAT)];
//
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(btnH + 5, labelY + 4, KMainW - 50, labelH)];
label.text = labelText;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(btnH + 5, labelY + 4,frame.size.width - btnH - 5, labelH)];
[GiGaHelper setLabelSpace:label withValue:labelText withFont:font] ;
label.font = font;
label.numberOfLines = 0;
label.textColor = GIGAUIColorFromRGBA(0x616161);
@ -112,18 +114,17 @@
}
}
self.view.frame = CGRectMake(10, 0, KMainW - 20, labelY - padding);
self.view.frame = CGRectMake(0,0,frame.size.width, labelY - padding);
frame.size.height = labelY - padding;
self.frame = frame;
[self setNeedsUpdateConstraints];
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.superview.mas_top).offset(frame.origin.y + 10);
make.left.mas_equalTo(self.superview.mas_left).offset(30);
make.height.mas_equalTo(frame.size.height);
make.width.mas_equalTo(frame.size.width - 30*2);
}];
// [self setNeedsUpdateConstraints];
// [self mas_updateConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(self.superview.mas_top).offset(frame.origin.y + 10);
// make.left.mas_equalTo(self.superview.mas_left).offset(30);
// make.height.mas_equalTo(frame.size.height);
// make.width.mas_equalTo(frame.size.width - 30*2);
// }];
}
- (void)btnOnClick:(UIButton *)btn

View File

@ -7,6 +7,7 @@
//
#import "GiGaMeViewController.h"
#import "GiGaUserViewController.h"
@interface GiGaMeViewController ()
@ -16,6 +17,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"我的";
// Do any additional setup after loading the view.
}
@ -24,14 +26,12 @@
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
GiGaUserViewController *userVC= [[GiGaUserViewController alloc] init];
[self.navigationController pushViewController:userVC animated:YES];
// 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.
}
*/
@end

View File

@ -15,8 +15,11 @@
@implementation GiGaUserViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"个人中心";
}
- (void)didReceiveMemoryWarning {
@ -24,6 +27,7 @@
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation