Skip to content

Commit 3d1c7c1

Browse files
committed
项目设置
1 parent e9fd351 commit 3d1c7c1

10 files changed

+652
-220
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,7 @@
12231223
B14689C21EE100B200B01371 /* vip_4_75@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B14689B21EE100B200B01371 /* vip_4_75@2x.png */; };
12241224
B14689C31EE100B200B01371 /* vip_4_75@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = B14689B31EE100B200B01371 /* vip_4_75@3x.png */; };
12251225
B152ED4E2090B223004A6E8A /* ProjectSettingEntranceController.m in Sources */ = {isa = PBXBuildFile; fileRef = B152ED4D2090B223004A6E8A /* ProjectSettingEntranceController.m */; };
1226+
B152ED542091B7CB004A6E8A /* ProjectArchiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B152ED532091B7CB004A6E8A /* ProjectArchiveViewController.m */; };
12261227
B16EEF08208DDBB6005ABFD5 /* timeline_icon_read@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = B16EEF06208DDBB5005ABFD5 /* timeline_icon_read@3x.png */; };
12271228
B16EEF09208DDBB6005ABFD5 /* timeline_icon_unread@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = B16EEF07208DDBB6005ABFD5 /* timeline_icon_unread@3x.png */; };
12281229
B16EEF13209080D7005ABFD5 /* TaskBoardsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B16EEF12209080D7005ABFD5 /* TaskBoardsViewController.m */; };
@@ -3333,6 +3334,8 @@
33333334
B14689B31EE100B200B01371 /* vip_4_75@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "vip_4_75@3x.png"; sourceTree = "<group>"; };
33343335
B152ED4C2090B223004A6E8A /* ProjectSettingEntranceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProjectSettingEntranceController.h; sourceTree = "<group>"; };
33353336
B152ED4D2090B223004A6E8A /* ProjectSettingEntranceController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProjectSettingEntranceController.m; sourceTree = "<group>"; };
3337+
B152ED522091B7CB004A6E8A /* ProjectArchiveViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProjectArchiveViewController.h; sourceTree = "<group>"; };
3338+
B152ED532091B7CB004A6E8A /* ProjectArchiveViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProjectArchiveViewController.m; sourceTree = "<group>"; };
33363339
B16EEF06208DDBB5005ABFD5 /* timeline_icon_read@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "timeline_icon_read@3x.png"; sourceTree = "<group>"; };
33373340
B16EEF07208DDBB6005ABFD5 /* timeline_icon_unread@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "timeline_icon_unread@3x.png"; sourceTree = "<group>"; };
33383341
B16EEF11209080D7005ABFD5 /* TaskBoardsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TaskBoardsViewController.h; sourceTree = "<group>"; };
@@ -7035,6 +7038,8 @@
70357038
isa = PBXGroup;
70367039
children = (
70377040
B9A00D7E1ACA3A05008BA008 /* ProjectSetting.storyboard */,
7041+
B152ED522091B7CB004A6E8A /* ProjectArchiveViewController.h */,
7042+
B152ED532091B7CB004A6E8A /* ProjectArchiveViewController.m */,
70387043
B152ED4C2090B223004A6E8A /* ProjectSettingEntranceController.h */,
70397044
B152ED4D2090B223004A6E8A /* ProjectSettingEntranceController.m */,
70407045
B9A00D801ACA3A17008BA008 /* ProjectSettingViewController.h */,
@@ -8529,6 +8534,7 @@
85298534
B12B64151FF0DE4800ACFDCC /* SkillCCell.m in Sources */,
85308535
4E94C4FF1B4D2B9300EB668A /* MenuButton.m in Sources */,
85318536
B12B64091FE900D400ACFDCC /* AMPopTip+Draw.m in Sources */,
8537+
B152ED542091B7CB004A6E8A /* ProjectArchiveViewController.m in Sources */,
85328538
4ED4B49D1D8295F600EED8C6 /* TeamViewController.m in Sources */,
85338539
4EF3741C1BB1258600DDA662 /* LocalFileViewController.m in Sources */,
85348540
3A3878401AE295970078D5DE /* ResetLabelCell.m in Sources */,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// ProjectArchiveViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Easeeeeeeeee on 2018/4/26.
6+
// Copyright © 2018年 Coding. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#import "Project.h"
11+
12+
@interface ProjectArchiveViewController : UITableViewController
13+
14+
@property (nonatomic, strong) Project *project;
15+
@property (strong, nonatomic) IBOutletCollection(NSLayoutConstraint) NSArray *lines;
16+
17+
@end
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
//
2+
// ProjectArchiveViewController.m
3+
// Coding_iOS
4+
//
5+
// Created by Easeeeeeeeee on 2018/4/26.
6+
// Copyright © 2018年 Coding. All rights reserved.
7+
//
8+
9+
#import "ProjectArchiveViewController.h"
10+
#import "Coding_NetAPIManager.h"
11+
12+
#import <SDCAlertController.h>
13+
#import <SDCAlertView.h>
14+
#import <UIView+SDCAutoLayout.h>
15+
#import "ProjectDeleteAlertControllerVisualStyle.h"
16+
17+
#import "Ease_2FA.h"
18+
19+
@interface ProjectArchiveViewController ()<UITextFieldDelegate>
20+
@property (strong, nonatomic) SDCAlertController *alert;
21+
22+
@end
23+
24+
@implementation ProjectArchiveViewController
25+
26+
- (void)viewDidLoad {
27+
[super viewDidLoad];
28+
self.title = @"归档项目";
29+
30+
for (NSLayoutConstraint *cons in self.lines) {
31+
cons.constant = 0.5;
32+
}
33+
34+
self.tableView.tableFooterView = [UIView new];
35+
[self.tableView setSeparatorColor:[UIColor colorWithRGBHex:0xe5e5e5]];
36+
self.tableView.backgroundColor = kColorTableSectionBg;
37+
}
38+
39+
40+
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
41+
return [UIView new];
42+
}
43+
44+
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
45+
{
46+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
47+
}
48+
49+
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
50+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
51+
if (indexPath.section != 1) {
52+
return;
53+
}
54+
[[Coding_NetAPIManager sharedManager] request_VerifyTypeWithBlock:^(VerifyType type, NSError *error) {
55+
if (!error) {
56+
[self showArchiveAlertWithType:type];
57+
}
58+
}];
59+
}
60+
61+
- (void)showArchiveAlertWithType:(VerifyType)type{
62+
63+
if (self.alert) {//正在显示
64+
return;
65+
}
66+
67+
NSString *title, *message, *placeHolder;
68+
if (type == VerifyTypePassword) {
69+
title = @"需要验证密码";
70+
message = @"这是一个危险的操作,请提供登录密码确认!";
71+
placeHolder = @"请输入密码";
72+
}else if (type == VerifyTypeTotp){
73+
title = @"需要动态验证码";
74+
message = @"这是一个危险操作,需要进行身份验证!";
75+
placeHolder = @"请输入动态验证码";
76+
}else{//不知道啥类型,不处理
77+
return;
78+
}
79+
80+
_alert = [SDCAlertController alertControllerWithTitle:title message:message preferredStyle:SDCAlertControllerStyleAlert];
81+
82+
UITextField *passwordTextField = [[UITextField alloc] initWithFrame:CGRectMake(15, 0, 240.0, 30.0)];
83+
passwordTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 30)];
84+
passwordTextField.leftViewMode = UITextFieldViewModeAlways;
85+
passwordTextField.layer.borderColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.6].CGColor;
86+
passwordTextField.layer.borderWidth = 1;
87+
passwordTextField.secureTextEntry = (type == VerifyTypePassword);
88+
passwordTextField.backgroundColor = [UIColor whiteColor];
89+
passwordTextField.placeholder = placeHolder;
90+
if (type == VerifyTypeTotp) {
91+
passwordTextField.text = [OTPListViewController otpCodeWithGK:[Login curLoginUser].global_key];
92+
}
93+
passwordTextField.delegate = self;
94+
95+
[_alert.contentView addSubview:passwordTextField];
96+
97+
NSDictionary* passwordViews = NSDictionaryOfVariableBindings(passwordTextField);
98+
99+
[_alert.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[passwordTextField]-(>=14)-|" options:0 metrics:nil views:passwordViews]];
100+
101+
// Style
102+
_alert.visualStyle = [ProjectDeleteAlertControllerVisualStyle new];
103+
104+
// 添加密码框
105+
// [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
106+
// textField.secureTextEntry = YES;
107+
// }];
108+
109+
// 添加按钮
110+
@weakify(self);
111+
_alert.actionLayout = SDCAlertControllerActionLayoutHorizontal;
112+
[_alert addAction:[SDCAlertAction actionWithTitle:@"取消" style:SDCAlertActionStyleDefault handler:^(SDCAlertAction *action) {
113+
@strongify(self);
114+
self.alert = nil;
115+
}]];
116+
[_alert addAction:[SDCAlertAction actionWithTitle:@"确定" style:SDCAlertActionStyleDefault handler:^(SDCAlertAction *action) {
117+
@strongify(self);
118+
self.alert = nil;
119+
NSString *passCode = passwordTextField.text;
120+
if ([passCode length] > 0) {
121+
// 归档项目
122+
[[Coding_NetAPIManager sharedManager] request_ArchiveProject_WithObj:self.project passCode:passCode type:type andBlock:^(Project *data, NSError *error) {
123+
if (!error) {
124+
[self.navigationController popToRootViewControllerAnimated:YES];
125+
}
126+
}];
127+
}
128+
}]];
129+
130+
[_alert presentWithCompletion:^{
131+
[passwordTextField becomeFirstResponder];
132+
}];
133+
}
134+
135+
136+
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
137+
[textField resignFirstResponder];
138+
return YES;
139+
}
140+
141+
#pragma mark - Orientations
142+
- (BOOL)shouldAutorotate{
143+
return UIInterfaceOrientationIsLandscape(self.interfaceOrientation);
144+
}
145+
146+
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
147+
return UIInterfaceOrientationPortrait;
148+
}
149+
150+
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
151+
return UIInterfaceOrientationMaskPortrait;
152+
}
153+
@end

0 commit comments

Comments
 (0)