Commit 3b599e34 cgx

动态发布页面UI调整、绑定手机号码页面搭建

1 个父辈 1bfaff4a
正在显示 30 个修改的文件 包含 253 行增加34 行删除
......@@ -666,7 +666,7 @@
D09D0E9C280D73B6008DEDAB /* InviteController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InviteController.m; sourceTree = "<group>"; };
D0A1C48128C195CD000975DC /* CommunityController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommunityController.h; sourceTree = "<group>"; };
D0A1C48228C195CD000975DC /* CommunityController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CommunityController.m; sourceTree = "<group>"; };
D0A1C48428C197B3000975DC /* Community.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Community.storyboard; path = "/Users/peter/SourceTree/DreamSleep-iOS/DreamSleep/DreamSleep/Class/CommunityModule/Community.storyboard"; sourceTree = "<absolute>"; };
D0A1C48428C197B3000975DC /* Community.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Community.storyboard; path = "/Users/peter/SourceTree/DreamSleep-iOS/DreamSleep/DreamSleep/Class/CommunityModule/DynamicList/Controller/Community.storyboard"; sourceTree = "<absolute>"; };
D0A1C49028C2084B000975DC /* ArticleRequestModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArticleRequestModel.h; sourceTree = "<group>"; };
D0A1C49128C2084B000975DC /* ArticleRequestModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArticleRequestModel.m; sourceTree = "<group>"; };
D0A245F4283DB12100FB49AA /* WKWebView+Extras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WKWebView+Extras.h"; sourceTree = "<group>"; };
......@@ -1282,6 +1282,15 @@
path = SleepReady;
sourceTree = "<group>";
};
D03041A62901305100840AE1 /* ConfirmBox */ = {
isa = PBXGroup;
children = (
D0FE45CC28FFE8E20020710A /* ConfirmBox.h */,
D0FE45CD28FFE8E20020710A /* ConfirmBox.m */,
);
path = ConfirmBox;
sourceTree = "<group>";
};
D030796628E3D92700ED96BF /* LikeButton */ = {
isa = PBXGroup;
children = (
......@@ -1610,8 +1619,6 @@
D0FE45BB28FF80AA0020710A /* MyDynamicController.m */,
D0FE45BD28FF814C0020710A /* MyDynamicView.h */,
D0FE45BE28FF814C0020710A /* MyDynamicView.m */,
D0FE45CC28FFE8E20020710A /* ConfirmBox.h */,
D0FE45CD28FFE8E20020710A /* ConfirmBox.m */,
D0FE45C328FF862F0020710A /* MyDynamicListResultModel.h */,
D0FE45C428FF862F0020710A /* MyDynamicListResultModel.m */,
);
......@@ -1860,6 +1867,7 @@
children = (
D078280C28FE612200C8D612 /* TextInput */,
D030796628E3D92700ED96BF /* LikeButton */,
D03041A62901305100840AE1 /* ConfirmBox */,
D078280328FE5A6500C8D612 /* MKTextView */,
);
path = View;
......
......@@ -11,9 +11,12 @@ NS_ASSUME_NONNULL_BEGIN
/*
自定义导航栏基类
日间模式:黑色风格 夜间模式:白色风格
我的积分页面
每日任务页面
安睡准备页面
绑定手机页面
*/
@interface DSNaviBarViewController : UIViewController
/// 自定义导航栏
......
......@@ -13,12 +13,12 @@
#import "DynamicDetailController.h"
@interface CommunityController () <CommunityViewDelegate, DynamicControllerDelegate, DynamicDetailControllerDelegate>
@property (nonatomic, strong) CommunityView *communityView;
@property (nonatomic, assign) int offset;
@property (nonatomic, strong) NSURLSessionDataTask *likeDataTask;
/// 存储动态id
@property (nonatomic, assign) int talkID;
@property (nonatomic, assign) int offset;
@property (nonatomic, strong) CommunityView *communityView;
@property (nonatomic, strong) ComListViewModel *comListViewModel;
@property (nonatomic, strong) NSURLSessionDataTask *likeDataTask;
@end
@implementation CommunityController
......@@ -106,13 +106,7 @@
[LoginUtils jumpToLoginControllerWithTarget:self];
return;
}
// 2、登录了,判断是否绑定了手机号
if (![LoginUtils getUserMobile]) {
UIViewController *bindVC = [[UIStoryboard storyboardWithName:@"BindMobileController" bundle:nil] instantiateViewControllerWithIdentifier:@"BindMobileController"];
[self.navigationController pushViewController:bindVC animated:YES];
return;
}
// 3、进入发布动态页面
// 2、进入发布动态页面
DynamicController *dyController = [DynamicController new];
dyController.delegate = self;
[self.navigationController pushViewController:dyController animated:YES];
......
......@@ -5,11 +5,11 @@
// Created by peter on 2022/9/24.
//
#import <UIKit/UIKit.h>
#import "DSNaviBarViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface BindMobileController : UIViewController
@interface BindMobileController : DSNaviBarViewController
@end
......
......@@ -8,8 +8,19 @@
#import "BindMobileController.h"
@interface BindMobileController ()
@property (weak, nonatomic) IBOutlet UILabel *bindMobileLab;
@property (weak, nonatomic) IBOutlet UILabel *mobileLab;
@property (weak, nonatomic) IBOutlet UIImageView *mobileIcon;
@property (weak, nonatomic) IBOutlet UILabel *countryLab;
@property (weak, nonatomic) IBOutlet UIImageView *selectIcon;
@property (weak, nonatomic) IBOutlet UITextField *mobileTF;
@property (weak, nonatomic) IBOutlet UITextField *codeTF;
@property (weak, nonatomic) IBOutlet UIView *mobileLine;
@property (weak, nonatomic) IBOutlet UILabel *verifyLab;
@property (weak, nonatomic) IBOutlet UITextField *verifyTF;
@property (weak, nonatomic) IBOutlet UIButton *getCodeBtn;
@property (weak, nonatomic) IBOutlet UIView *codeLine;
@property (weak, nonatomic) IBOutlet UIButton *bindBtn;
@property (weak, nonatomic) IBOutlet UILabel *tipsLab;
@end
@implementation BindMobileController
......@@ -17,10 +28,36 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"绑定手机号";
[self initUI];
}
- (void)initUI {
self.naviBarAlpha = 1.0;
self.naviBgColor = DSClearColor;
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self.backBtn dk_setImage:DKImagePickerWithNames(@"cus_back_icon", @"sys_back_icon", @"sys_back_icon") forState:UIControlStateNormal];
[self.dsNaviBar addSubview:self.backBtn];
self.bindMobileLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
self.mobileLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
self.countryLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
self.mobileTF.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
self.verifyLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
self.verifyLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
self.verifyTF.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
self.tipsLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHexA(0xFFFFFF, .3), DSWhite);
self.mobileLine.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0xE6E6E6), AlertDarkColor, DSWhite);
self.codeLine.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0xE6E6E6), AlertDarkColor, DSWhite);
self.mobileIcon.dk_imagePicker = DKImagePickerWithNames(@"ic_bangding_shouji", @"dk_ic_bangding_shouji", @"ic_bangding_shouji");
self.selectIcon.dk_imagePicker = DKImagePickerWithNames(@"ic_bangding_xiala", @"dk_ic_bangding_xiala", @"ic_bangding_xiala");
self.bindBtn.dk_backgroundColorPicker = DKColorPickerWithKey(BrandBG);
[self.bindBtn dk_setTitleColorPicker:DKColorPickerWithKey(Sub_Navi_TITLE) forState:UIControlStateNormal];
}
#pragma mark - Action
- (IBAction)getMobileCode:(UIButton *)sender {
if (self.mobileTF.text.length) {
[DSProgressHUD showProgressHUDWithInfo:@""];
......@@ -35,9 +72,9 @@
}
- (IBAction)bindMobile:(UIButton *)sender {
if (self.mobileTF.text.length && self.codeTF.text.length) {
if (self.mobileTF.text.length && self.verifyTF.text.length) {
[DSProgressHUD showProgressHUDWithInfo:@""];
[UserRequestModel verifyBindMobile:self.mobileTF.text code:self.codeTF.text completion:^(UserRequestModel * _Nonnull requestModel) {
[UserRequestModel verifyBindMobile:self.mobileTF.text code:self.verifyTF.text completion:^(UserRequestModel * _Nonnull requestModel) {
[DSProgressHUD dissmissProgressHUD];
if (requestModel.resCode == DSResCodeSuccess) {
// 保存绑定手机号码标识
......@@ -51,9 +88,9 @@
}
}
#pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
#pragma mark - 关闭侧滑
- (BOOL)enableInteractivePopGestureRecognizer {
return NO;
}
@end
......@@ -109,7 +109,14 @@ static int AlbumColumnCount = 4;
[self.dynamicView refreshAfterDelete:tag];
}
- (void)enterBindMobile {
// 3、进入绑定手机页面
UIViewController *bindVC = [[UIStoryboard storyboardWithName:@"BindMobileController" bundle:nil] instantiateViewControllerWithIdentifier:@"BindMobileController"];
[self.navigationController pushViewController:bindVC animated:YES];
}
- (void)publishDynamic {
// 4、发布动态请求
[DSProgressHUD showProgressHUDWithInfo:@""];
[self.dynamicVM publishDynamicWithCompletion:^(DynamicViewModel * _Nonnull viewModel) {
[DSProgressHUD dissmissProgressHUD];
......
......@@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)previewPicture:(NSIndexPath *)indexPath;
/// 删除图片
- (void)deletePicture:(NSInteger)tag;
/// 进入绑定手机页面
- (void)enterBindMobile;
/// 发布动态
- (void)publishDynamic;
@end
......
......@@ -8,13 +8,15 @@
#import "DynamicView.h"
#import "MKPPlaceholderTextView.h"
#import "FeedImageCollectionCell.h"
#import "ConfirmBox.h"
@interface DynamicView () <UITextViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate>
@interface DynamicView () <UITextViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate, ConfirmBoxDelegate>
@property (strong, nonatomic) MKPPlaceholderTextView *textView;
@property (strong, nonatomic) UILabel *wordLimitLab;
@property (strong, nonatomic) UICollectionView *imgCollectionView;
@property (strong, nonatomic) UIButton *publishBtn;
@property (strong, nonatomic) DynamicViewModel *dynamicVM;
@property (nonatomic, strong) ConfirmBox *bindMobileConfirmBox;
@end
@implementation DynamicView
......@@ -57,8 +59,16 @@
return self;
}
#pragma mark - private
- (void)publishAction {
if (self.dynamicVM.selectedPhotos.count || self.textView.text.length) {
// 1、登录了,判断是否绑定了手机号
#warning warning - 临时测试
if ([LoginUtils getUserMobile]) {
// 2、弹出绑定手机提示框框
[self.bindMobileConfirmBox show];
return;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(publishDynamic)]) {
[self.delegate publishDynamic];
}
......@@ -87,6 +97,14 @@
}];
}
#pragma mark - ConfirmBoxDelegate
- (void)jumpToBindMobilePage {
[self.bindMobileConfirmBox dismiss];
if (self.delegate && [self.delegate respondsToSelector:@selector(enterBindMobile)]) {
[self.delegate enterBindMobile];
}
}
#pragma mark - UITextViewDelegate
- (void)textViewDidEndEditing:(UITextView *)textView {
[self dealWorldLimitAttTextWithChangeLength:(int)textView.text.length];
......@@ -152,13 +170,13 @@
if (!_textView) {
_textView = [[MKPPlaceholderTextView alloc] init];
_textView.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0xf0f0f0), CornerViewDarkColor, DSWhite);
_textView.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, DarkTextColor, DSWhite);
_textView.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, ColorFromHexA(0xFFFFFF, .5), DSWhite);
_textView.font = SysFont(14);
_textView.delegate = self;
[_textView cornerRadius:12];
_textView.textContainerInset = UIEdgeInsetsMake(15, 8, 40, 8);
_textView.placeholder = @"请文明发言,不可涉及黄、赌、毒、国家政治相关动态!";
_textView.placeholderLabel.dk_textColorPicker = DKColorPickerWithColors(UIColor.lightGrayColor, DSWhite, DSWhite);
_textView.placeholderLabel.dk_textColorPicker = DKColorPickerWithColors(ColorFromHexA(0x777777, .3), ColorFromHexA(0xFFFFFF, .3), DSWhite);
}
return _textView;
}
......@@ -202,4 +220,11 @@
return _publishBtn;
}
- (ConfirmBox *)bindMobileConfirmBox {
if (!_bindMobileConfirmBox) {
_bindMobileConfirmBox = [[ConfirmBox alloc] initWithDelegate:self type:ConfirmBoxTypeBindMobile];
}
return _bindMobileConfirmBox;
}
@end
......@@ -99,6 +99,8 @@
[self.myDynVM deleteComDynWithDynamicID:self.myDynVM.delete_id];
[self.myDynamicView deleteSuccess];
[self.myDynamicView updateListView];
// 刷新社区动态列表
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateComList object:nil];
} else {
[DSProgressHUD showToast:requestModel.errMessage];
}
......
......@@ -158,7 +158,7 @@
- (ConfirmBox *)deleteConfirmBox {
if (!_deleteConfirmBox) {
_deleteConfirmBox = [[ConfirmBox alloc] initWithDelegate:self];
_deleteConfirmBox = [[ConfirmBox alloc] initWithDelegate:self type:ConfirmBoxTypeDynDelete];
}
return _deleteConfirmBox;
}
......
......@@ -9,19 +9,33 @@
NS_ASSUME_NONNULL_BEGIN
// 确认框类型
typedef NS_ENUM(int, ConfirmBoxType) {
ConfirmBoxTypeDynDelete, // 个人动态删除
ConfirmBoxTypeBindMobile // 绑定手机
};
@protocol ConfirmBoxDelegate <NSObject>
@optional
/// 执行确认删除操作
/// @param indexPath indexPath
- (void)excuteDeleteAction:(NSIndexPath *)indexPath;
/// 跳转到绑定手机页面
- (void)jumpToBindMobilePage;
@end
/// 确认框
@interface ConfirmBox : UIView
@property (nonatomic, weak) id<ConfirmBoxDelegate> delegate;
- (instancetype)initWithDelegate:(id<ConfirmBoxDelegate>)delegate;
- (instancetype)initWithDelegate:(id<ConfirmBoxDelegate>)delegate type:(ConfirmBoxType)type;
- (void)showConfirmBox:(NSIndexPath *)indexPath;
- (void)show;
- (void)dismiss;
@end
......
......@@ -8,6 +8,7 @@
#import "ConfirmBox.h"
@interface ConfirmBox ()
@property (nonatomic, assign) ConfirmBoxType boxType;
@property (nonatomic, strong) UIView *alertView;
@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UILabel *detailLab;
......@@ -19,9 +20,10 @@
NSIndexPath * _tmpIndexPath;
}
- (instancetype)initWithDelegate:(id<ConfirmBoxDelegate>)delegate {
- (instancetype)initWithDelegate:(id<ConfirmBoxDelegate>)delegate type:(ConfirmBoxType)type {
if (self = [super initWithFrame:[UIScreen mainScreen].bounds]) {
_delegate = delegate;
self.boxType = type;
self.backgroundColor = ColorFromHexA(0x161E38, .6);
[self addSubview:self.alertView];
......@@ -40,14 +42,24 @@
[DSKeyWindow addSubview:self];
}
- (void)show {
[DSKeyWindow addSubview:self];
}
- (void)dismiss {
[self removeFromSuperview];
}
#pragma mark - private
- (void)sureAction {
if (self.delegate && [self.delegate respondsToSelector:@selector(excuteDeleteAction:)]) {
[self.delegate excuteDeleteAction:_tmpIndexPath];
if (self.boxType == ConfirmBoxTypeDynDelete) {
if (self.delegate && [self.delegate respondsToSelector:@selector(excuteDeleteAction:)]) {
[self.delegate excuteDeleteAction:_tmpIndexPath];
}
} else if (self.boxType == ConfirmBoxTypeBindMobile) {
if (self.delegate && [self.delegate respondsToSelector:@selector(jumpToBindMobilePage)]) {
[self.delegate jumpToBindMobilePage];
}
}
}
......@@ -74,6 +86,8 @@
[self.detailLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(_alertView);
make.top.equalTo(_alertView).offset(62);
make.left.equalTo(_alertView).offset(16);
make.right.equalTo(_alertView).offset(-16);
}];
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.bottom.equalTo(_alertView);
......@@ -104,9 +118,22 @@
- (UILabel *)detailLab {
if (!_detailLab) {
_detailLab = [UILabel labWithText:@"您确定要删除该动态吗?" font:SysFont(15) fit:YES];
_detailLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
NSString *text = @"";
UIFont *font = SysFont(15);
NSInteger numberOfLines = 1;
DKColorPicker dkColor = DKColorPickerWithKey(Dk_TITLE);
if (self.boxType == ConfirmBoxTypeDynDelete) {
text = @"您确定要删除该动态吗?";
} else if (self.boxType == ConfirmBoxTypeBindMobile) {
text = @"根据网信办规定及《网络安全法》要求,需要您进行手机号绑定";
font = SysFont(14);
dkColor = DKColorPickerWithColors(SubTitleColor, ColorFromHexA(0xFFFFFF, .5), DSWhite);
numberOfLines = 0;
}
_detailLab = [UILabel labWithText:text font:font fit:YES];
_detailLab.dk_textColorPicker = dkColor;
_detailLab.textAlignment = NSTextAlignmentCenter;
_detailLab.numberOfLines = numberOfLines;
}
return _detailLab;
}
......@@ -122,8 +149,16 @@
- (UIButton *)sureBtn {
if (!_sureBtn) {
_sureBtn = [UIButton btnWithTitle:@"确定" font:SysFont(15)];
[_sureBtn dk_setTitleColorPicker:DKColorPickerWithKey(Dk_TITLE) forState:UIControlStateNormal];
NSString *title = @"";
DKColorPicker dkColor = DKColorPickerWithKey(Dk_TITLE);
if (self.boxType == ConfirmBoxTypeDynDelete) {
title = @"确定";
} else if (self.boxType == ConfirmBoxTypeBindMobile) {
title = @"绑定";
dkColor = DKColorPickerWithKey(BrandBG);
}
_sureBtn = [UIButton btnWithTitle:title font:SysFont(15)];
[_sureBtn dk_setTitleColorPicker:dkColor forState:UIControlStateNormal];
[_sureBtn addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside];
}
return _sureBtn;
......
{
"images" : [
{
"filename" : "dk_ic_bangding_shouji.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_ic_bangding_shouji@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_ic_bangding_shouji@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "dk_ic_bangding_xiala.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_ic_bangding_xiala@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_ic_bangding_xiala@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_bangding_shouji.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_bangding_shouji@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_bangding_shouji@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_bangding_xiala.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_bangding_xiala@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_bangding_xiala@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!