Commit 833179f6 cgx

退出登录、注销账号弹框及接口

1 个父辈 20a47128
正在显示 26 个修改的文件 包含 330 行增加22 行删除
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1428051ED400229278 /* SafeSleepModel.m */; }; D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1428051ED400229278 /* SafeSleepModel.m */; };
D0506B1828054ECD00229278 /* SafeHelperCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */; }; D0506B1828054ECD00229278 /* SafeHelperCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */; };
D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */; }; D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */; };
D053BEE9280F9E310028CCFC /* CloseAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D053BEE8280F9E310028CCFC /* CloseAlertView.m */; };
D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D070509928071BAF006D72E1 /* DSNetworkTool.m */; }; D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D070509928071BAF006D72E1 /* DSNetworkTool.m */; };
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B26280E9BAA00BA0EC0 /* AccountController.m */; }; D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B26280E9BAA00BA0EC0 /* AccountController.m */; };
D07A4B2A280EA6B600BA0EC0 /* UserInfoTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */; }; D07A4B2A280EA6B600BA0EC0 /* UserInfoTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */; };
...@@ -140,6 +141,8 @@ ...@@ -140,6 +141,8 @@
D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeHelperCollectionView.m; sourceTree = "<group>"; }; D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeHelperCollectionView.m; sourceTree = "<group>"; };
D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafeHelperCollectionViewCell.h; sourceTree = "<group>"; }; D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafeHelperCollectionViewCell.h; sourceTree = "<group>"; };
D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeHelperCollectionViewCell.m; sourceTree = "<group>"; }; D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeHelperCollectionViewCell.m; sourceTree = "<group>"; };
D053BEE7280F9E310028CCFC /* CloseAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CloseAlertView.h; sourceTree = "<group>"; };
D053BEE8280F9E310028CCFC /* CloseAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CloseAlertView.m; sourceTree = "<group>"; };
D070509828071BAF006D72E1 /* DSNetworkTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSNetworkTool.h; sourceTree = "<group>"; }; D070509828071BAF006D72E1 /* DSNetworkTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSNetworkTool.h; sourceTree = "<group>"; };
D070509928071BAF006D72E1 /* DSNetworkTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSNetworkTool.m; sourceTree = "<group>"; }; D070509928071BAF006D72E1 /* DSNetworkTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSNetworkTool.m; sourceTree = "<group>"; };
D07A4B25280E9BAA00BA0EC0 /* AccountController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountController.h; sourceTree = "<group>"; }; D07A4B25280E9BAA00BA0EC0 /* AccountController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountController.h; sourceTree = "<group>"; };
...@@ -404,25 +407,41 @@ ...@@ -404,25 +407,41 @@
D04567AD27F6D0F4009F0A82 /* Profile */ = { D04567AD27F6D0F4009F0A82 /* Profile */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D07A4B2E280EC1F100BA0EC0 /* Me */,
D07A4B2F280EC21B00BA0EC0 /* Account */,
D0CE3D80280A532D00D8B02D /* UserLogin */, D0CE3D80280A532D00D8B02D /* UserLogin */,
D09D0E97280D4EEA008DEDAB /* SystemSet */, D09D0E97280D4EEA008DEDAB /* SystemSet */,
D09D0E9B280D73B6008DEDAB /* InviteController.h */,
D09D0E9C280D73B6008DEDAB /* InviteController.m */,
);
path = Profile;
sourceTree = "<group>";
};
D07A4B2E280EC1F100BA0EC0 /* Me */ = {
isa = PBXGroup;
children = (
D09D0E98280D507F008DEDAB /* ProfileAlertView.h */,
D09D0E99280D507F008DEDAB /* ProfileAlertView.m */,
D04B3DBC27F6F8090022F8DF /* Profile.storyboard */, D04B3DBC27F6F8090022F8DF /* Profile.storyboard */,
D04B3DBE27F6F82D0022F8DF /* ProfileController.h */, D04B3DBE27F6F82D0022F8DF /* ProfileController.h */,
D04B3DBF27F6F82D0022F8DF /* ProfileController.m */, D04B3DBF27F6F82D0022F8DF /* ProfileController.m */,
D0E660032807D02C006562F2 /* UserRequestModel.h */, );
D0E660042807D02C006562F2 /* UserRequestModel.m */, path = Me;
D09D0E98280D507F008DEDAB /* ProfileAlertView.h */, sourceTree = "<group>";
D09D0E99280D507F008DEDAB /* ProfileAlertView.m */, };
D09D0E9B280D73B6008DEDAB /* InviteController.h */, D07A4B2F280EC21B00BA0EC0 /* Account */ = {
D09D0E9C280D73B6008DEDAB /* InviteController.m */, isa = PBXGroup;
D07A4B25280E9BAA00BA0EC0 /* AccountController.h */, children = (
D07A4B26280E9BAA00BA0EC0 /* AccountController.m */,
D07A4B2B280EA73B00BA0EC0 /* UserInfoView.h */, D07A4B2B280EA73B00BA0EC0 /* UserInfoView.h */,
D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */, D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */,
D07A4B28280EA6B600BA0EC0 /* UserInfoTableView.h */, D07A4B28280EA6B600BA0EC0 /* UserInfoTableView.h */,
D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */, D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */,
D07A4B25280E9BAA00BA0EC0 /* AccountController.h */,
D07A4B26280E9BAA00BA0EC0 /* AccountController.m */,
D053BEE7280F9E310028CCFC /* CloseAlertView.h */,
D053BEE8280F9E310028CCFC /* CloseAlertView.m */,
); );
path = Profile; path = Account;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
D0878F49280BEFF9005F1B7F /* YBAttributeTextTapAction */ = { D0878F49280BEFF9005F1B7F /* YBAttributeTextTapAction */ = {
...@@ -480,18 +499,18 @@ ...@@ -480,18 +499,18 @@
children = ( children = (
D091BBB82809024100487A50 /* DreamSleepBeta.entitlements */, D091BBB82809024100487A50 /* DreamSleepBeta.entitlements */,
D0F808ED2803C83A0097899F /* DreamSleepDebug.entitlements */, D0F808ED2803C83A0097899F /* DreamSleepDebug.entitlements */,
D0E9408127FE961300D57495 /* Vendors */,
D04567AA27F6D067009F0A82 /* Main */, D04567AA27F6D067009F0A82 /* Main */,
D04567AB27F6D0A5009F0A82 /* HomeModule */, D04567AB27F6D0A5009F0A82 /* HomeModule */,
D04567AC27F6D0BA009F0A82 /* AISleepCoach */, D04567AC27F6D0BA009F0A82 /* AISleepCoach */,
D04567AD27F6D0F4009F0A82 /* Profile */, D04567AD27F6D0F4009F0A82 /* Profile */,
D04567A927F6D038009F0A82 /* Launcher */, D04567A927F6D038009F0A82 /* Launcher */,
D0C50B4327FD3DE800DC68F0 /* PrivacyPolicy */,
D0B5ECD927F2F410003EDFE3 /* Utils */, D0B5ECD927F2F410003EDFE3 /* Utils */,
D0B5ECBF27F2E0ED003EDFE3 /* DSConfig */,
D027EE2327FB3C99004BBA61 /* Network */, D027EE2327FB3C99004BBA61 /* Network */,
D0E9408127FE961300D57495 /* Vendors */,
D027EE2A27FB5285004BBA61 /* Category */, D027EE2A27FB5285004BBA61 /* Category */,
D0B5ECBF27F2E0ED003EDFE3 /* DSConfig */,
D04567A827F6D018009F0A82 /* Resource */, D04567A827F6D018009F0A82 /* Resource */,
D0C50B4327FD3DE800DC68F0 /* PrivacyPolicy */,
); );
path = DreamSleep; path = DreamSleep;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -545,6 +564,8 @@ ...@@ -545,6 +564,8 @@
D09BF330280E570D00E5F06C /* UserModel.m */, D09BF330280E570D00E5F06C /* UserModel.m */,
D0878F4D280C087E005F1B7F /* LoginController.h */, D0878F4D280C087E005F1B7F /* LoginController.h */,
D0878F4E280C087E005F1B7F /* LoginController.m */, D0878F4E280C087E005F1B7F /* LoginController.m */,
D0E660032807D02C006562F2 /* UserRequestModel.h */,
D0E660042807D02C006562F2 /* UserRequestModel.m */,
); );
path = UserLogin; path = UserLogin;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -798,6 +819,7 @@ ...@@ -798,6 +819,7 @@
files = ( files = (
D09D0E9D280D73B6008DEDAB /* InviteController.m in Sources */, D09D0E9D280D73B6008DEDAB /* InviteController.m in Sources */,
D04B3D9A27F6D4D90022F8DF /* LeadingController.m in Sources */, D04B3D9A27F6D4D90022F8DF /* LeadingController.m in Sources */,
D053BEE9280F9E310028CCFC /* CloseAlertView.m in Sources */,
D0B5ECD827F2F1B0003EDFE3 /* ServerAPIUtil.m in Sources */, D0B5ECD827F2F1B0003EDFE3 /* ServerAPIUtil.m in Sources */,
D0B5ECA627F2D9DE003EDFE3 /* AppDelegate.m in Sources */, D0B5ECA627F2D9DE003EDFE3 /* AppDelegate.m in Sources */,
D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */, D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */,
......
...@@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@property CGFloat x; @property CGFloat x;
@property CGFloat y; @property CGFloat y;
@property CGPoint origin; @property CGPoint origin;
@property CGSize size;
@property CGFloat centerX; @property CGFloat centerX;
@property CGFloat centerY; @property CGFloat centerY;
......
...@@ -59,6 +59,16 @@ ...@@ -59,6 +59,16 @@
self.frame = rect; self.frame = rect;
} }
- (CGSize)size {
return self.frame.size;
}
- (void)setSize:(CGSize)size {
CGRect rect = self.frame;
rect.size = size;
self.frame = rect;
}
- (CGFloat)centerX { - (CGFloat)centerX {
return self.center.x; return self.center.x;
} }
......
...@@ -98,8 +98,13 @@ NSString * const NetworkUnableError = @"网络不给力,请检查您的网络 ...@@ -98,8 +98,13 @@ NSString * const NetworkUnableError = @"网络不给力,请检查您的网络
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:NSJSONWritingPrettyPrinted error:nil]; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:NSJSONWritingPrettyPrinted error:nil];
[request setHTTPBody:jsonData]; [request setHTTPBody:jsonData];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
// 请求头自定义字段sid
[request addValue:[LoginUtils getSid] forHTTPHeaderField:@"sid"];
NSURLSessionDataTask *dataTask = [[DSNetworkTool sharedManager] dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { NSURLSessionDataTask *dataTask = [[DSNetworkTool sharedManager] dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
NSLog(@"allHeaderFieldsCookie:%@", httpResponse.allHeaderFields[@"Set-Cookie"]);
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
if (loadingInfo) { [DSProgressHUD dissmissProgressHUD]; } if (loadingInfo) { [DSProgressHUD dissmissProgressHUD]; }
......
...@@ -7,9 +7,12 @@ ...@@ -7,9 +7,12 @@
#import "AccountController.h" #import "AccountController.h"
#import "UserInfoView.h" #import "UserInfoView.h"
#import "CloseAlertView.h"
#import "UserRequestModel.h"
@interface AccountController () @interface AccountController () <UserInfoViewDelegate, CloseAlertViewDelegate>
@property (nonatomic, strong) UserInfoView *userInfoView; @property (nonatomic, strong) UserInfoView *userInfoView;
@property (nonatomic, strong) CloseAlertView *closeAlertView;
@end @end
@implementation AccountController @implementation AccountController
...@@ -30,7 +33,41 @@ ...@@ -30,7 +33,41 @@
} }
- (void)closeUserAction { - (void)closeUserAction {
self.closeAlertView = [[CloseAlertView alloc] initWithDelegate:self];
[self.closeAlertView showCloseUserAlertView];
}
#pragma mark - UserInfoViewDelegate
- (void)didTriggerUserAction:(int)index {
if (index == 1) { // 退出登录
[UserRequestModel layoutRequestWithCompletion:^(UserRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
[self clearUserData:@"退出成功"];
// 刷新我的个人信息相关数据
}
}];
}
}
#pragma mark - CloseAlertViewDelegate(注销账号)
- (void)didClickCloseUserBtn {
[UserRequestModel closeUserRequestWithCompletion:^(UserRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
[self.closeAlertView dismissCloseUserAlertView];
[self clearUserData:@"注销成功"];
// 刷新我的个人信息相关数据
}
}];
}
- (void)clearUserData:(NSString *)alerStr {
// 清除用户信息
[LoginUtils clearUserLoginData];
[DSProgressHUD showToast:alerStr];
[self.navigationController popViewControllerAnimated:YES];
} }
#pragma mark - 导航栏日间、黑夜模式 #pragma mark - 导航栏日间、黑夜模式
...@@ -40,7 +77,7 @@ ...@@ -40,7 +77,7 @@
- (UserInfoView *)userInfoView { - (UserInfoView *)userInfoView {
if (!_userInfoView) { if (!_userInfoView) {
_userInfoView = [[UserInfoView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0))]; _userInfoView = [[UserInfoView alloc] initWithDelegate:self];
} }
return _userInfoView; return _userInfoView;
} }
......
//
// CloseAlertView.h
// DreamSleep
//
// Created by peter on 2022/4/20.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol CloseAlertViewDelegate <NSObject>
- (void)didClickCloseUserBtn;
@end
@interface CloseAlertView : UIView
@property (nonatomic, weak) id<CloseAlertViewDelegate> delegate;
- (instancetype)initWithDelegate:(id<CloseAlertViewDelegate>)delegate;
- (void)showCloseUserAlertView;
- (void)dismissCloseUserAlertView;
@end
NS_ASSUME_NONNULL_END
//
// CloseAlertView.m
// DreamSleep
//
// Created by peter on 2022/4/20.
//
#import "CloseAlertView.h"
@interface CloseAlertView ()
@property (nonatomic, strong) UIView *alertView;
@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UIImageView *cryIV;
@property (nonatomic, strong) UILabel *redLab;
@property (nonatomic, strong) UIView *dealView;
@end
@implementation CloseAlertView
- (instancetype)initWithDelegate:(id<CloseAlertViewDelegate>)delegate {
if (self = [super initWithFrame:[UIScreen mainScreen].bounds]) {
_delegate = delegate;
self.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0x6F7587), DSClearColor, DSWhite);
self.backgroundColor = [self.backgroundColor colorWithAlphaComponent:0.6];
[self addSubview:self.alertView];
[self.alertView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self);
make.width.equalTo(@280);
make.height.equalTo(@467);
}];
}
return self;
}
#pragma mark - public
- (void)showCloseUserAlertView {
[DSKeyWindow addSubview:self];
}
- (void)dismissCloseUserAlertView {
[self removeFromSuperview];
}
#pragma mark - actions
- (void)closeAction {
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickCloseUserBtn)]) {
[self.delegate didClickCloseUserBtn];
}
}
- (void)cancelAction {
[self dismissCloseUserAlertView];
}
#pragma mark - lazy
- (UIView *)alertView {
if (!_alertView) {
_alertView = [UIView new];
[_alertView cornerRadius:20.0];
_alertView.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, AlertDarkColor, DSWhite);
[_alertView addSubview:self.titleLab];
[_alertView addSubview:self.cryIV];
[_alertView addSubview:self.redLab];
[_alertView addSubview:self.dealView];
[self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_alertView).offset(20);
make.centerX.equalTo(_alertView);
}];
[self.cryIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLab).offset(37);
make.left.equalTo(_alertView).offset(44);
make.width.equalTo(@198);
make.height.equalTo(@186);
}];
[self.redLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.cryIV.mas_bottom).offset(23);
make.left.equalTo(_alertView).offset(15);
make.right.equalTo(_alertView).offset(-15);
}];
[self.dealView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_alertView);
make.right.equalTo(_alertView);
make.bottom.equalTo(_alertView);
make.height.equalTo(@64);
}];
}
return _alertView;
}
- (UILabel *)titleLab {
if (!_titleLab) {
_titleLab = [UILabel dkLabWithText:@"确定要抛弃小梦吗?" font:BoldFont(16.0)];
}
return _titleLab;
}
- (UIImageView *)cryIV {
if (!_cryIV) {
_cryIV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"closeAlertIcon"]];
_cryIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1.0, .5, .8);
}
return _cryIV;
}
- (UILabel *)redLab {
if (!_redLab) {
NSString *str = @"• 您仅可注销您本人申请的账号\n\n• 注销后,账号的全部权益将被清除备份\n\n• 注销后,账号下的所有数据、记录等将无法访问或找回";
_redLab = [UILabel labWithText:str textColor:ColorFromHex(0xF04B77) font:SysFont(14.0)];
_redLab.numberOfLines = 0;
}
return _redLab;
}
- (UIView *)dealView {
if (!_dealView) {
_dealView = [UIView new];
UIButton *closeBtn = [UIButton btnWithTitle:@"注销" titleColor:ColorFromHex(0x62C3D5) font:BoldFont(15) bgColor:DSClearColor];
[closeBtn addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
[_dealView addSubview:closeBtn];
UIButton *cancelBtn = [UIButton btnWithTitle:@"取消" font:BoldFont(15)];
[cancelBtn dk_setTitleColorPicker:DKColorPickerWithKey(TEXT) forState:UIControlStateNormal];
[cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside];
[_dealView addSubview:cancelBtn];
UIView *line = [UIView new];
line.dk_backgroundColorPicker = DKColorPickerWithColors(DivideLineColor, DSWhite, DSWhite);
[_dealView addSubview:line];
[closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_dealView);
make.top.equalTo(_dealView);
make.bottom.equalTo(_dealView);
}];
[cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(closeBtn.mas_right);
make.right.equalTo(_dealView);
make.width.height.equalTo(closeBtn);
}];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(_dealView);
make.top.equalTo(_dealView).offset(12);
make.bottom.equalTo(_dealView).offset(-12);
make.width.equalTo(@1);
}];
}
return _dealView;
}
@end
...@@ -9,8 +9,16 @@ ...@@ -9,8 +9,16 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol UserInfoViewDelegate <NSObject>
- (void)didTriggerUserAction:(int)index;
@end
@interface UserInfoView : UIView @interface UserInfoView : UIView
@property (nonatomic, weak) id<UserInfoViewDelegate> delegate;
- (instancetype)initWithDelegate:(id<UserInfoViewDelegate>)delegate;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
@implementation UserInfoView @implementation UserInfoView
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithDelegate:(id<UserInfoViewDelegate>)delegate {
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0))]) {
_delegate = delegate;
[self.portraitBtn yy_setImageWithURL:[NSURL URLWithString:@"https://img2.ydniu.com/sleep_ssmain/face_img/1648892614555_QhXhJX.jpg"] forState:UIControlStateNormal placeholder:[UIImage imageNamed:@"portrait"]]; [self.portraitBtn yy_setImageWithURL:[NSURL URLWithString:@"https://img2.ydniu.com/sleep_ssmain/face_img/1648892614555_QhXhJX.jpg"] forState:UIControlStateNormal placeholder:[UIImage imageNamed:@"portrait"]];
[self addSubview:self.userInfoTV]; [self addSubview:self.userInfoTV];
...@@ -38,8 +40,10 @@ ...@@ -38,8 +40,10 @@
} }
- (void)exitAction { - (void)layoutAction {
if (self.delegate && [self.delegate respondsToSelector:@selector(didTriggerUserAction:)]) {
[self.delegate didTriggerUserAction:1];
}
} }
#pragma mark - UserInfoTableViewDelegate #pragma mark - UserInfoTableViewDelegate
...@@ -78,7 +82,7 @@ ...@@ -78,7 +82,7 @@
- (UIButton *)layoutBtn { - (UIButton *)layoutBtn {
if (!_layoutBtn) { if (!_layoutBtn) {
_layoutBtn = [UIButton btnWithTitle:@"退出登录" titleColor:BrandColor font:SysFont(15)]; _layoutBtn = [UIButton btnWithTitle:@"退出登录" titleColor:BrandColor font:SysFont(15)];
[_layoutBtn addTarget:self action:@selector(exitAction) forControlEvents:UIControlEventTouchUpInside]; [_layoutBtn addTarget:self action:@selector(layoutAction) forControlEvents:UIControlEventTouchUpInside];
[_layoutBtn cornerRadius:10]; [_layoutBtn cornerRadius:10];
_layoutBtn.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, CornerViewDarkColor, DSWhite); _layoutBtn.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, CornerViewDarkColor, DSWhite);
} }
......
...@@ -107,7 +107,9 @@ ...@@ -107,7 +107,9 @@
- (void)modifyAction { - (void)modifyAction {
// 判断是否登录成功 // 判断是否登录成功
if ([LoginUtils getUserLoginData]) {
#warning - 临时屏蔽
if (![LoginUtils getUserLoginData]) {
// 进入修改页面 // 进入修改页面
AccountController *accountVC = [[AccountController alloc] init]; AccountController *accountVC = [[AccountController alloc] init];
[self.navigationController pushViewController:accountVC animated:YES]; [self.navigationController pushViewController:accountVC animated:YES];
......
...@@ -16,11 +16,18 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -16,11 +16,18 @@ NS_ASSUME_NONNULL_BEGIN
/// 获取用户登录数据 /// 获取用户登录数据
+ (UserModel *)getUserLoginData; + (UserModel *)getUserLoginData;
/// 获取用户id
+ (int)getUserID; + (int)getUserID;
/// 获取sid
+ (NSString *)getSid;
/// 保存用户登录数据 /// 保存用户登录数据
+ (void)saveUserLoginData:(UserModel *)model; + (void)saveUserLoginData:(UserModel *)model;
/// 清除用户登录数据
+ (void)clearUserLoginData;
+ (void)jumpToLoginControllerWithTarget:(UIViewController *)target; + (void)jumpToLoginControllerWithTarget:(UIViewController *)target;
@end @end
......
...@@ -21,12 +21,21 @@ ...@@ -21,12 +21,21 @@
return userModel.user_id; return userModel.user_id;
} }
+ (NSString *)getSid {
UserModel *userModel = [self getUserLoginData];
return userModel.sid;
}
+ (void)saveUserLoginData:(UserModel *)model { + (void)saveUserLoginData:(UserModel *)model {
NSData *userData = [NSKeyedArchiver archivedDataWithRootObject:model]; NSData *userData = [NSKeyedArchiver archivedDataWithRootObject:model];
kSetUserDefaultsObj(userData, UserBasicInfo); kSetUserDefaultsObj(userData, UserBasicInfo);
kUserDefaultsSynchronize; kUserDefaultsSynchronize;
} }
+ (void)clearUserLoginData {
kUserDefaultsRemoveObj(UserBasicInfo);
}
+ (void)jumpToLoginControllerWithTarget:(UIViewController *)target { + (void)jumpToLoginControllerWithTarget:(UIViewController *)target {
if (target && [target isKindOfClass:[UIViewController class]]) { if (target && [target isKindOfClass:[UIViewController class]]) {
BaseNaviController *navi = [[BaseNaviController alloc] initWithRootViewController:[[LoginController alloc] init]]; BaseNaviController *navi = [[BaseNaviController alloc] initWithRootViewController:[[LoginController alloc] init]];
......
{
"images" : [
{
"filename" : "closeAlertIcon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "closeAlertIcon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "closeAlertIcon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -66,11 +66,11 @@ ...@@ -66,11 +66,11 @@
#define AlertDarkColor ColorFromHex(0x131724) #define AlertDarkColor ColorFromHex(0x131724)
// 常用圆角视图黑夜深色 // 常用圆角视图黑夜深色
#define CornerViewDarkColor ColorFromHex(0x1F263F) #define CornerViewDarkColor ColorFromHex(0x1F263F)
// 分割线颜色
#define DivideLineColor ColorFromHex(0xE6E6E6)
/** 副文案颜色 */ /** 副文案颜色 */
#define SubTextColor [UIColor colorWithHexString:@"#A0A0A0"] #define SubTextColor [UIColor colorWithHexString:@"#A0A0A0"]
/** 输入说明文案颜色/白色背景列表分割线颜色 */
#define PlaceholderColor [UIColor colorWithHexString:@"#E6E6E6"]
/** 突出显示文案颜色 */ /** 突出显示文案颜色 */
#define HighlightColor ColorFromHex(0x1AB69A) #define HighlightColor ColorFromHex(0x1AB69A)
/** 紧急提示文案颜色 */ /** 紧急提示文案颜色 */
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!