Skip to content

Commit 922a72d

Browse files
committed
奖励码币的提示框
1 parent d304871 commit 922a72d

6 files changed

Lines changed: 195 additions & 1 deletion

File tree

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@
408408
4E80E9301DFFF06E00DE1BC6 /* shortcut_task@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E80E92A1DFFF06E00DE1BC6 /* shortcut_task@3x.png */; };
409409
4E80E9311DFFF06E00DE1BC6 /* shortcut_tweet@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E80E92B1DFFF06E00DE1BC6 /* shortcut_tweet@2x.png */; };
410410
4E80E9321DFFF06E00DE1BC6 /* shortcut_tweet@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E80E92C1DFFF06E00DE1BC6 /* shortcut_tweet@3x.png */; };
411+
4E80E9351E011D6000DE1BC6 /* RewardTipManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E80E9341E011D6000DE1BC6 /* RewardTipManager.m */; };
412+
4E80E9381E01218300DE1BC6 /* reward_tip_logo@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E80E9361E01218300DE1BC6 /* reward_tip_logo@2x.png */; };
413+
4E80E9391E01218300DE1BC6 /* reward_tip_logo@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E80E9371E01218300DE1BC6 /* reward_tip_logo@3x.png */; };
411414
4E83AE7B1CF30F1A006BA3BB /* SettingEmailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E83AE7A1CF30F1A006BA3BB /* SettingEmailViewController.m */; };
412415
4E86FEE51BB556D6005E53F3 /* tipIcon_ProjectFileComment@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E86FEE41BB556D6005E53F3 /* tipIcon_ProjectFileComment@2x.png */; };
413416
4E8765651A22E5B40090CFB9 /* NSMutableArray+SWUtilityButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E87655A1A22E5B40090CFB9 /* NSMutableArray+SWUtilityButtons.m */; };
@@ -1770,6 +1773,10 @@
17701773
4E80E92A1DFFF06E00DE1BC6 /* shortcut_task@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "shortcut_task@3x.png"; sourceTree = "<group>"; };
17711774
4E80E92B1DFFF06E00DE1BC6 /* shortcut_tweet@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "shortcut_tweet@2x.png"; sourceTree = "<group>"; };
17721775
4E80E92C1DFFF06E00DE1BC6 /* shortcut_tweet@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "shortcut_tweet@3x.png"; sourceTree = "<group>"; };
1776+
4E80E9331E011D6000DE1BC6 /* RewardTipManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RewardTipManager.h; sourceTree = "<group>"; };
1777+
4E80E9341E011D6000DE1BC6 /* RewardTipManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RewardTipManager.m; sourceTree = "<group>"; };
1778+
4E80E9361E01218300DE1BC6 /* reward_tip_logo@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "reward_tip_logo@2x.png"; sourceTree = "<group>"; };
1779+
4E80E9371E01218300DE1BC6 /* reward_tip_logo@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "reward_tip_logo@3x.png"; sourceTree = "<group>"; };
17731780
4E83AE791CF30F1A006BA3BB /* SettingEmailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingEmailViewController.h; sourceTree = "<group>"; };
17741781
4E83AE7A1CF30F1A006BA3BB /* SettingEmailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingEmailViewController.m; sourceTree = "<group>"; };
17751782
4E86FEE41BB556D6005E53F3 /* tipIcon_ProjectFileComment@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tipIcon_ProjectFileComment@2x.png"; sourceTree = "<group>"; };
@@ -4162,6 +4169,8 @@
41624169
4E00229F1B7360B1005308DE /* FunctionIntroManager.m */,
41634170
4E5D13131C0EDFE700985AEB /* SendRewardManager.h */,
41644171
4E5D13141C0EDFE700985AEB /* SendRewardManager.m */,
4172+
4E80E9331E011D6000DE1BC6 /* RewardTipManager.h */,
4173+
4E80E9341E011D6000DE1BC6 /* RewardTipManager.m */,
41654174
);
41664175
path = Manager;
41674176
sourceTree = "<group>";
@@ -5023,6 +5032,8 @@
50235032
4E59D3301D409C8C008C914B /* topic_add_watcher_btn@2x.png */,
50245033
4E6CBE521D8EA9D100644086 /* icon_best_answer@2x.png */,
50255034
4E6CBE531D8EA9D100644086 /* icon_best_answer@3x.png */,
5035+
4E80E9361E01218300DE1BC6 /* reward_tip_logo@2x.png */,
5036+
4E80E9371E01218300DE1BC6 /* reward_tip_logo@3x.png */,
50265037
);
50275038
path = Images;
50285039
sourceTree = "<group>";
@@ -6288,6 +6299,7 @@
62886299
927AFF531BFF6DAD00AAE593 /* shop_nar_history_icon@3x.png in Resources */,
62896300
4EC461B41B39360F00D08970 /* file_changeType_MODIFY@2x.png in Resources */,
62906301
D0C447A71C02A3C700DC1C4B /* project_normal@2x.png in Resources */,
6302+
4E80E9381E01218300DE1BC6 /* reward_tip_logo@2x.png in Resources */,
62916303
4ED4B48C1D82646100EED8C6 /* user_info_point@3x.png in Resources */,
62926304
4EA679191A14BFA0001A0324 /* icon_file_folder_default@2x.png in Resources */,
62936305
4E6383D61B32665700D98648 /* project_item_readme@2x.png in Resources */,
@@ -6355,6 +6367,7 @@
63556367
4EAECBC61C44CB860096CA74 /* member_cell_edit_type@2x.png in Resources */,
63566368
4E93F23B1B84356500017916 /* file_menu_icon_edit@2x.png in Resources */,
63576369
8E1C3DF619E7F4CA00EF3032 /* address.json in Resources */,
6370+
4E80E9391E01218300DE1BC6 /* reward_tip_logo@3x.png in Resources */,
63586371
4E09DCAA1C15662E001C9392 /* share_Nav@3x.png in Resources */,
63596372
4E2BF3D01B96CDF800A5A0A8 /* share_btn_copylink@2x.png in Resources */,
63606373
4EF17ED41B3C3112003CDD2D /* intro_icon_2@3x.png in Resources */,
@@ -7011,6 +7024,7 @@
70117024
8EF643AE19FF7E2900F7EEB0 /* TweetMediaItemSingleCCell.m in Sources */,
70127025
8EF643AC19FF7E2900F7EEB0 /* TweetLikeUserCCell.m in Sources */,
70137026
8E64ED7B19ED0CE3006E99DA /* QBAssetsCollectionCheckmarkView.m in Sources */,
7027+
4E80E9351E011D6000DE1BC6 /* RewardTipManager.m in Sources */,
70147028
4EE1A22E1B5D02CA004284F1 /* ProjectFolderListView.m in Sources */,
70157029
4E4D6A701B1C68F100FD2E49 /* CommitFilesViewController.m in Sources */,
70167030
4E4D6A911B1D84B400FD2E49 /* FileChange.m in Sources */,

Coding_iOS/Controllers/MeSetting/SettingPhoneViewController.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#import "Login.h"
1414
#import "CountryCodeListViewController.h"
1515
#import "Ease_2FA.h"
16+
#import "RewardTipManager.h"
1617

1718
@interface SettingPhoneViewController ()<UITableViewDataSource, UITableViewDelegate>
1819
@property (strong, nonatomic) TPKeyboardAvoidingTableView *myTableView;
@@ -161,8 +162,13 @@ - (void)doneBtnClicked:(id)sender{
161162
__weak typeof(self) weakSelf = self;
162163
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"api/account/phone/change" withParams:params withMethodType:Post andBlock:^(id data, NSError *error) {
163164
if (data) {
164-
[NSObject showHudTipStr:@"手机号码绑定成功"];
165165
[weakSelf.navigationController popViewControllerAnimated:YES];
166+
if (![Login curLoginUser].is_phone_validated.boolValue) {//之前没有绑定过手机号的,奖励码币
167+
[Login curLoginUser].is_phone_validated = @(YES);
168+
[RewardTipManager showTipWithTitle:@"成功完成手机验证 !" rewardPoint:@"0.1"];
169+
}else{
170+
[NSObject showHudTipStr:@"手机号码绑定成功"];
171+
}
166172
}
167173
}];
168174
}
6.93 KB
Loading
11.2 KB
Loading
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// RewardTipManager.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 2016/12/14.
6+
// Copyright © 2016年 Coding. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface RewardTipManager : NSObject
12+
+ (void)showTipWithTitle:(NSString *)title rewardPoint:(NSString *)rewardPoint;
13+
@end
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
//
2+
// RewardTipManager.m
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 2016/12/14.
6+
// Copyright © 2016年 Coding. All rights reserved.
7+
//
8+
9+
#import "RewardTipManager.h"
10+
#import "PointRecordsViewController.h"
11+
#import "Login.h"
12+
13+
@interface RewardTipManager ()
14+
@property (strong, nonatomic) NSString *title, *rewardPoint;
15+
16+
@property (strong, nonatomic) UIView *bgView, *contentView;
17+
@property (strong, nonatomic) UIImageView *logoImgV;
18+
@property (strong, nonatomic) UILabel *titleL, *rewardPointL;
19+
@property (strong, nonatomic) UIButton *closeBtn, *knowMoreBtn;
20+
@end
21+
22+
@implementation RewardTipManager
23+
+ (instancetype)shareManager{
24+
static RewardTipManager *shared_manager = nil;
25+
static dispatch_once_t pred;
26+
dispatch_once(&pred, ^{
27+
shared_manager = [[self alloc] init];
28+
});
29+
return shared_manager;
30+
}
31+
32+
+ (void)showTipWithTitle:(NSString *)title rewardPoint:(NSString *)rewardPoint{
33+
if (![Login isLogin]) {
34+
return;
35+
}
36+
RewardTipManager *manager = [self shareManager];
37+
manager.title = title;
38+
manager.rewardPoint = rewardPoint;
39+
[manager p_show];
40+
}
41+
42+
- (instancetype)init{
43+
self = [super init];
44+
if (self) {
45+
//层级关系
46+
_bgView = [UIView new];
47+
_contentView = [UIView new];
48+
49+
_logoImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"reward_tip_logo"]];
50+
_titleL = [UILabel labelWithFont:[UIFont boldSystemFontOfSize:18] textColor:[UIColor colorWithHexString:@"0x222222"]];
51+
_rewardPointL = [UILabel labelWithSystemFontSize:15 textColorHexString:@"0x222222"];
52+
_knowMoreBtn = ({
53+
UIButton *button = [UIButton new];
54+
button.backgroundColor = kColorBrandGreen;
55+
[button doBorderWidth:0 color:nil cornerRadius:4];
56+
button.titleLabel.font = [UIFont systemFontOfSize:18];
57+
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
58+
[button setTitle:@"了解码币" forState:UIControlStateNormal];
59+
[button addTarget:self action:@selector(knowMoreBtnClicked) forControlEvents:UIControlEventTouchUpInside];
60+
button;
61+
});
62+
_closeBtn = ({
63+
UIButton *button = [UIButton new];
64+
button.backgroundColor = kColorTableSectionBg;
65+
[button doBorderWidth:1.0 color:kColorDDD cornerRadius:4];
66+
button.titleLabel.font = [UIFont systemFontOfSize:18];
67+
[button setTitleColor:kColor666 forState:UIControlStateNormal];
68+
[button setTitle:@"知道了" forState:UIControlStateNormal];
69+
[button addTarget:self action:@selector(p_dismiss) forControlEvents:UIControlEventTouchUpInside];
70+
button;
71+
});
72+
[_contentView addSubview:_logoImgV];
73+
[_contentView addSubview:_titleL];
74+
[_contentView addSubview:_rewardPointL];
75+
[_contentView addSubview:_knowMoreBtn];
76+
[_contentView addSubview:_closeBtn];
77+
[_bgView addSubview:_contentView];
78+
//属性设置
79+
_contentView.backgroundColor = kColorTableSectionBg;
80+
_contentView.layer.masksToBounds = YES;
81+
_contentView.layer.cornerRadius = 6;
82+
_rewardPointL.textAlignment = _titleL.textAlignment = NSTextAlignmentCenter;
83+
_titleL.numberOfLines = 0;
84+
//位置大小
85+
[_contentView mas_makeConstraints:^(MASConstraintMaker *make) {
86+
make.width.mas_equalTo(270);
87+
make.center.equalTo(_bgView);
88+
}];
89+
[_logoImgV mas_makeConstraints:^(MASConstraintMaker *make) {
90+
make.size.mas_equalTo(CGSizeMake(88, 67));
91+
make.centerX.equalTo(_contentView);
92+
make.top.equalTo(_contentView).mas_offset(30);
93+
}];
94+
[_titleL mas_makeConstraints:^(MASConstraintMaker *make) {
95+
make.top.equalTo(_logoImgV.mas_bottom).offset(30);
96+
make.left.equalTo(_contentView).offset(15);
97+
make.right.equalTo(_contentView).offset(-15);
98+
}];
99+
[_rewardPointL mas_makeConstraints:^(MASConstraintMaker *make) {
100+
make.top.equalTo(_titleL.mas_bottom).offset(10);
101+
make.left.right.equalTo(_titleL);
102+
}];
103+
[_knowMoreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
104+
make.top.equalTo(_rewardPointL.mas_bottom).offset(20);
105+
make.left.equalTo(_contentView).offset(20);
106+
make.bottom.equalTo(_contentView).offset(-20);
107+
make.right.equalTo(_closeBtn.mas_left).offset(-10);
108+
make.width.equalTo(_closeBtn);
109+
make.height.mas_equalTo(44);
110+
}];
111+
[_closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
112+
make.right.equalTo(_contentView).offset(-20);
113+
make.top.bottom.equalTo(_knowMoreBtn);
114+
}];
115+
//关联事件
116+
[_bgView bk_whenTapped:^{
117+
[self p_dismiss];
118+
}];
119+
}
120+
return self;
121+
}
122+
123+
- (void)setTitle:(NSString *)title{
124+
_title = title;
125+
_titleL.text = _title;
126+
}
127+
128+
- (void)setRewardPoint:(NSString *)rewardPoint{
129+
_rewardPoint = rewardPoint;
130+
_rewardPointL.text = [NSString stringWithFormat:@"获得 %@ MB 的奖励", _rewardPoint];
131+
}
132+
133+
- (void)knowMoreBtnClicked{
134+
PointRecordsViewController *vc = [PointRecordsViewController new];
135+
[BaseViewController goToVC:vc];
136+
[self p_dismiss];
137+
}
138+
139+
- (void)p_show{
140+
//初始状态
141+
_bgView.backgroundColor = [UIColor clearColor];
142+
_contentView.alpha = 0;
143+
_bgView.frame = kScreen_Bounds;
144+
145+
[kKeyWindow addSubview:_bgView];
146+
[UIView animateWithDuration:0.3 animations:^{
147+
_bgView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
148+
_contentView.alpha = 1;
149+
} completion:nil];
150+
}
151+
152+
- (void)p_dismiss{
153+
[UIView animateWithDuration:0.3 animations:^{
154+
_bgView.backgroundColor = [UIColor clearColor];
155+
_contentView.alpha = 0;
156+
} completion:^(BOOL finished) {
157+
[_bgView removeFromSuperview];
158+
}];
159+
}
160+
161+
@end

0 commit comments

Comments
 (0)