Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 62038973
由
cgx
编写于
2022-09-24 18:09:01 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
完成绑定手机、动态发布相关UI及部分逻辑
1 个父辈
bad86e04
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
607 行增加
和
44 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Basement/Utils/DSConstUtil.h
DreamSleep/DreamSleep/Basement/Utils/DSConstUtil.m
DreamSleep/DreamSleep/Class/CommunityModule/ArticleRequestModel.m
DreamSleep/DreamSleep/Class/CommunityModule/CommunityController.h → DreamSleep/DreamSleep/Class/CommunityModule/Controller/BindMobileController.h
DreamSleep/DreamSleep/Class/CommunityModule/Controller/BindMobileController.m
DreamSleep/DreamSleep/Class/CommunityModule/Controller/BindMobileController.storyboard
DreamSleep/DreamSleep/Class/CommunityModule/Controller/CommunityController.m
DreamSleep/DreamSleep/Class/CommunityModule/Controller/DynamicController.h
DreamSleep/DreamSleep/Class/CommunityModule/Controller/DynamicController.m
DreamSleep/DreamSleep/Class/CommunityModule/View/CommunityView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/CommunityView.m
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicView.m
DreamSleep/DreamSleep/Class/CommunityModule/ArticleRequestModel.h → DreamSleep/DreamSleep/Class/CommunityModule/ViewModel/DynamicViewModel.h
DreamSleep/DreamSleep/Class/CommunityModule/ViewModel/DynamicViewModel.m
DreamSleep/DreamSleep/Class/ProfileModule/UserLogin/UserRequestModel.h
DreamSleep/DreamSleep/Class/ProfileModule/UserLogin/UserRequestModel.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
6203897
...
@@ -106,6 +106,11 @@
...
@@ -106,6 +106,11 @@
D0691E1128801D43008BFFAB /* RelaxItemsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691E1028801D43008BFFAB /* RelaxItemsView.m */; };
D0691E1128801D43008BFFAB /* RelaxItemsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691E1028801D43008BFFAB /* RelaxItemsView.m */; };
D0691E1428801EF3008BFFAB /* ReadyTimeMarker.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691E1328801EF3008BFFAB /* ReadyTimeMarker.m */; };
D0691E1428801EF3008BFFAB /* ReadyTimeMarker.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691E1328801EF3008BFFAB /* ReadyTimeMarker.m */; };
D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D070509928071BAF006D72E1 /* DSNetworkTool.m */; };
D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D070509928071BAF006D72E1 /* DSNetworkTool.m */; };
D070A78328DEE5C20039C5A7 /* BindMobileController.m in Sources */ = {isa = PBXBuildFile; fileRef = D070A78228DEE5C20039C5A7 /* BindMobileController.m */; };
D070A78528DEE6760039C5A7 /* BindMobileController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D070A78428DEE6760039C5A7 /* BindMobileController.storyboard */; };
D070A78828DEED640039C5A7 /* DynamicController.m in Sources */ = {isa = PBXBuildFile; fileRef = D070A78728DEED640039C5A7 /* DynamicController.m */; };
D070A78B28DEF2D30039C5A7 /* DynamicView.m in Sources */ = {isa = PBXBuildFile; fileRef = D070A78A28DEF2D30039C5A7 /* DynamicView.m */; };
D070A78E28DF02DE0039C5A7 /* DynamicViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D070A78D28DF02DE0039C5A7 /* DynamicViewModel.m */; };
D07257F0286BE5510080F458 /* GoodSleepHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07257EF286BE5510080F458 /* GoodSleepHeadView.m */; };
D07257F0286BE5510080F458 /* GoodSleepHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07257EF286BE5510080F458 /* GoodSleepHeadView.m */; };
D07257F3286BF99F0080F458 /* DailyTaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07257F2286BF99F0080F458 /* DailyTaskView.m */; };
D07257F3286BF99F0080F458 /* DailyTaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07257F2286BF99F0080F458 /* DailyTaskView.m */; };
D07257F6286C2F110080F458 /* SignCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D07257F5286C2F110080F458 /* SignCollectionViewCell.m */; };
D07257F6286C2F110080F458 /* SignCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D07257F5286C2F110080F458 /* SignCollectionViewCell.m */; };
...
@@ -460,6 +465,15 @@
...
@@ -460,6 +465,15 @@
D0691E1328801EF3008BFFAB /* ReadyTimeMarker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReadyTimeMarker.m; sourceTree = "<group>"; };
D0691E1328801EF3008BFFAB /* ReadyTimeMarker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReadyTimeMarker.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>"; };
D070A78128DEE5C20039C5A7 /* BindMobileController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BindMobileController.h; sourceTree = "<group>"; };
D070A78228DEE5C20039C5A7 /* BindMobileController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BindMobileController.m; sourceTree = "<group>"; };
D070A78428DEE6760039C5A7 /* BindMobileController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = BindMobileController.storyboard; sourceTree = "<group>"; };
D070A78628DEED640039C5A7 /* DynamicController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DynamicController.h; sourceTree = "<group>"; };
D070A78728DEED640039C5A7 /* DynamicController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DynamicController.m; sourceTree = "<group>"; };
D070A78928DEF2D30039C5A7 /* DynamicView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DynamicView.h; sourceTree = "<group>"; };
D070A78A28DEF2D30039C5A7 /* DynamicView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DynamicView.m; sourceTree = "<group>"; };
D070A78C28DF02DE0039C5A7 /* DynamicViewModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DynamicViewModel.h; sourceTree = "<group>"; };
D070A78D28DF02DE0039C5A7 /* DynamicViewModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DynamicViewModel.m; sourceTree = "<group>"; };
D07257EE286BE5510080F458 /* GoodSleepHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GoodSleepHeadView.h; sourceTree = "<group>"; };
D07257EE286BE5510080F458 /* GoodSleepHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GoodSleepHeadView.h; sourceTree = "<group>"; };
D07257EF286BE5510080F458 /* GoodSleepHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoodSleepHeadView.m; sourceTree = "<group>"; };
D07257EF286BE5510080F458 /* GoodSleepHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoodSleepHeadView.m; sourceTree = "<group>"; };
D07257F1286BF99F0080F458 /* DailyTaskView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DailyTaskView.h; sourceTree = "<group>"; };
D07257F1286BF99F0080F458 /* DailyTaskView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DailyTaskView.h; sourceTree = "<group>"; };
...
@@ -1411,6 +1425,8 @@
...
@@ -1411,6 +1425,8 @@
children = (
children = (
D0A3BB9028D95A2B00F58781 /* CommunityView.h */,
D0A3BB9028D95A2B00F58781 /* CommunityView.h */,
D0A3BB9128D95A2B00F58781 /* CommunityView.m */,
D0A3BB9128D95A2B00F58781 /* CommunityView.m */,
D070A78928DEF2D30039C5A7 /* DynamicView.h */,
D070A78A28DEF2D30039C5A7 /* DynamicView.m */,
);
);
path = View;
path = View;
sourceTree = "<group>";
sourceTree = "<group>";
...
@@ -1427,6 +1443,11 @@
...
@@ -1427,6 +1443,11 @@
D0A3BB9528D9B43700F58781 /* ArticleController.m */,
D0A3BB9528D9B43700F58781 /* ArticleController.m */,
D0A3BB9728D9B76C00F58781 /* EvaluateController.h */,
D0A3BB9728D9B76C00F58781 /* EvaluateController.h */,
D0A3BB9828D9B76C00F58781 /* EvaluateController.m */,
D0A3BB9828D9B76C00F58781 /* EvaluateController.m */,
D070A78128DEE5C20039C5A7 /* BindMobileController.h */,
D070A78228DEE5C20039C5A7 /* BindMobileController.m */,
D070A78428DEE6760039C5A7 /* BindMobileController.storyboard */,
D070A78628DEED640039C5A7 /* DynamicController.h */,
D070A78728DEED640039C5A7 /* DynamicController.m */,
);
);
path = Controller;
path = Controller;
sourceTree = "<group>";
sourceTree = "<group>";
...
@@ -1445,6 +1466,8 @@
...
@@ -1445,6 +1466,8 @@
D0A1C49128C2084B000975DC /* ArticleRequestModel.m */,
D0A1C49128C2084B000975DC /* ArticleRequestModel.m */,
D0A3BB9A28D9BA3500F58781 /* EvaluateRequestModel.h */,
D0A3BB9A28D9BA3500F58781 /* EvaluateRequestModel.h */,
D0A3BB9B28D9BA3500F58781 /* EvaluateRequestModel.m */,
D0A3BB9B28D9BA3500F58781 /* EvaluateRequestModel.m */,
D070A78C28DF02DE0039C5A7 /* DynamicViewModel.h */,
D070A78D28DF02DE0039C5A7 /* DynamicViewModel.m */,
);
);
path = ViewModel;
path = ViewModel;
sourceTree = "<group>";
sourceTree = "<group>";
...
@@ -2184,6 +2207,7 @@
...
@@ -2184,6 +2207,7 @@
isa = PBXResourcesBuildPhase;
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
buildActionMask = 2147483647;
files = (
files = (
D070A78528DEE6760039C5A7 /* BindMobileController.storyboard in Resources */,
D0F963D0285C51E100D75CD7 /* TencentOpenApi_IOS_Bundle.bundle in Resources */,
D0F963D0285C51E100D75CD7 /* TencentOpenApi_IOS_Bundle.bundle in Resources */,
D0C09ED728007D9100709D4C /* relax_normal_lottie.json in Resources */,
D0C09ED728007D9100709D4C /* relax_normal_lottie.json in Resources */,
D0A1C48F28C1A9E1000975DC /* Info_Debug.plist in Resources */,
D0A1C48F28C1A9E1000975DC /* Info_Debug.plist in Resources */,
...
@@ -2310,11 +2334,13 @@
...
@@ -2310,11 +2334,13 @@
D0B5ECA627F2D9DE003EDFE3 /* AppDelegate.m in Sources */,
D0B5ECA627F2D9DE003EDFE3 /* AppDelegate.m in Sources */,
D0FAC422281B817D00D4B859 /* GKPanGestureRecognizer.m in Sources */,
D0FAC422281B817D00D4B859 /* GKPanGestureRecognizer.m in Sources */,
D07DACA82810557D0067A1BF /* RSKImageCropViewController.m in Sources */,
D07DACA82810557D0067A1BF /* RSKImageCropViewController.m in Sources */,
D070A78328DEE5C20039C5A7 /* BindMobileController.m in Sources */,
D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */,
D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */,
D0A245F6283DB12100FB49AA /* WKWebView+Extras.m in Sources */,
D0A245F6283DB12100FB49AA /* WKWebView+Extras.m in Sources */,
D0E65FFA2807A654006562F2 /* NSArray+HYBUnicodeReadable.m in Sources */,
D0E65FFA2807A654006562F2 /* NSArray+HYBUnicodeReadable.m in Sources */,
D04B3DC027F6F82D0022F8DF /* ProfileController.m in Sources */,
D04B3DC027F6F82D0022F8DF /* ProfileController.m in Sources */,
D01C9D7028168BFC00163567 /* NSDate+Extension.m in Sources */,
D01C9D7028168BFC00163567 /* NSDate+Extension.m in Sources */,
D070A78B28DEF2D30039C5A7 /* DynamicView.m in Sources */,
D0F9AC582826602400FD7A3B /* SPButton.m in Sources */,
D0F9AC582826602400FD7A3B /* SPButton.m in Sources */,
D0DB33A528204E7C00E15914 /* FirstLeadAlertView.m in Sources */,
D0DB33A528204E7C00E15914 /* FirstLeadAlertView.m in Sources */,
D02D0827287BBEDE005C3A00 /* SleepReadyController.m in Sources */,
D02D0827287BBEDE005C3A00 /* SleepReadyController.m in Sources */,
...
@@ -2345,6 +2371,7 @@
...
@@ -2345,6 +2371,7 @@
D07257F6286C2F110080F458 /* SignCollectionViewCell.m in Sources */,
D07257F6286C2F110080F458 /* SignCollectionViewCell.m in Sources */,
D00291892816CD4500C0573B /* DsCacheUtils.m in Sources */,
D00291892816CD4500C0573B /* DsCacheUtils.m in Sources */,
D07DAC902810546A0067A1BF /* DSImagePickerController.m in Sources */,
D07DAC902810546A0067A1BF /* DSImagePickerController.m in Sources */,
D070A78E28DF02DE0039C5A7 /* DynamicViewModel.m in Sources */,
D0A1C49228C2084B000975DC /* ArticleRequestModel.m in Sources */,
D0A1C49228C2084B000975DC /* ArticleRequestModel.m in Sources */,
D0DF90AE2814390000FC0F64 /* BannerModel.m in Sources */,
D0DF90AE2814390000FC0F64 /* BannerModel.m in Sources */,
D0E65FFF2807AC5E006562F2 /* DSProgressHUD.m in Sources */,
D0E65FFF2807AC5E006562F2 /* DSProgressHUD.m in Sources */,
...
@@ -2391,6 +2418,7 @@
...
@@ -2391,6 +2418,7 @@
D037B1172875635F00236753 /* DarwArcView.swift in Sources */,
D037B1172875635F00236753 /* DarwArcView.swift in Sources */,
D091E671283F2E6F00D3279E /* ScoreDetailListController.m in Sources */,
D091E671283F2E6F00D3279E /* ScoreDetailListController.m in Sources */,
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D070A78828DEED640039C5A7 /* DynamicController.m in Sources */,
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */,
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */,
D0A3BB9228D95A2B00F58781 /* CommunityView.m in Sources */,
D0A3BB9228D95A2B00F58781 /* CommunityView.m in Sources */,
D02D082D287BD05D005C3A00 /* ReadyListController.m in Sources */,
D02D082D287BD05D005C3A00 /* ReadyListController.m in Sources */,
...
...
DreamSleep/DreamSleep/Basement/Utils/DSConstUtil.h
查看文件 @
6203897
...
@@ -57,6 +57,7 @@ FOUNDATION_EXTERN NSString * const RemoteCommandCenterDidClick;
...
@@ -57,6 +57,7 @@ FOUNDATION_EXTERN NSString * const RemoteCommandCenterDidClick;
// 用户基础信息
// 用户基础信息
FOUNDATION_EXTERN
NSString
*
const
UserBasicInfo
;
FOUNDATION_EXTERN
NSString
*
const
UserBasicInfo
;
FOUNDATION_EXTERN
NSString
*
const
IsBindMobile
;
#pragma mark - 第三方平台配置
#pragma mark - 第三方平台配置
/** 微信开放平台AppID */
/** 微信开放平台AppID */
...
...
DreamSleep/DreamSleep/Basement/Utils/DSConstUtil.m
查看文件 @
6203897
...
@@ -36,6 +36,7 @@ NSString * const UnlockAudioSuccess = @"UnlockAudioSuccessNoti";
...
@@ -36,6 +36,7 @@ NSString * const UnlockAudioSuccess = @"UnlockAudioSuccessNoti";
NSString
*
const
RemoteCommandCenterDidClick
=
@"RemoteCommandCenterDidClickNoti"
;
NSString
*
const
RemoteCommandCenterDidClick
=
@"RemoteCommandCenterDidClickNoti"
;
NSString
*
const
UserBasicInfo
=
@"UserBasicInfo"
;
NSString
*
const
UserBasicInfo
=
@"UserBasicInfo"
;
NSString
*
const
IsBindMobile
=
@"IsBindMobile"
;
NSString
*
const
WeChatAppID
=
@"wx4cdd4760092cdfdf"
;
NSString
*
const
WeChatAppID
=
@"wx4cdd4760092cdfdf"
;
NSString
*
const
WeChatAppSecret
=
@"72c0a939b605b824d0c6d9dbde152ae0"
;
NSString
*
const
WeChatAppSecret
=
@"72c0a939b605b824d0c6d9dbde152ae0"
;
...
...
DreamSleep/DreamSleep/Class/CommunityModule/ArticleRequestModel.m
deleted
100644 → 0
查看文件 @
bad86e0
//
// ArticleRequestModel.m
// DreamSleep
//
// Created by peter on 2022/9/2.
//
#import "ArticleRequestModel.h"
@implementation
ArticleRequestModel
+
(
NSURLSessionDataTask
*
)
querySsmianKnowledgeListWithTypeID
:(
int
)
type_id
WithCompletion
:(
void
(
^
)(
ArticleRequestModel
*
requestModel
))
completion
{
ArticleRequestModel
*
requestModel
=
[[
ArticleRequestModel
alloc
]
init
];
NSString
*
api
=
@"query_ssmian_knowledge_list"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"query{%@(type_id:%d)}"
,
api
,
type_id
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"文章咨询数据接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
NSDictionary
*
resultDic
=
apiDic
[
@"result"
];
completion
(
requestModel
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
requestModel
.
errMessage
=
failureInfo
[
@"errMessage"
];
completion
(
requestModel
);
}];
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/Co
mmunity
Controller.h
→
DreamSleep/DreamSleep/Class/CommunityModule/Co
ntroller/BindMobile
Controller.h
查看文件 @
6203897
//
//
//
Community
Controller.h
//
BindMobile
Controller.h
// DreamSleep
// DreamSleep
//
//
// Created by peter on 2022/9/2.
// Created by peter on 2022/9/2
4
.
//
//
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
@interface
Community
Controller
:
UIViewController
@interface
BindMobile
Controller
:
UIViewController
@end
@end
...
...
DreamSleep/DreamSleep/Class/CommunityModule/Controller/BindMobileController.m
0 → 100644
查看文件 @
6203897
//
// BindMobileController.m
// DreamSleep
//
// Created by peter on 2022/9/24.
//
#import "BindMobileController.h"
@interface
BindMobileController
()
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
mobileTF
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
codeTF
;
@end
@implementation
BindMobileController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
navigationItem
.
title
=
@"绑定手机号"
;
self
.
view
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
}
-
(
IBAction
)
getMobileCode
:
(
UIButton
*
)
sender
{
if
(
self
.
mobileTF
.
text
.
length
)
{
[
DSProgressHUD
showProgressHUDWithInfo
:
@""
];
[
UserRequestModel
getMobileCode
:
self
.
mobileTF
.
text
completion
:
^
(
UserRequestModel
*
_Nonnull
requestModel
)
{
[
DSProgressHUD
dissmissProgressHUD
];
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
}
else
{
[
DSProgressHUD
showToast
:
requestModel
.
errMessage
];
}
}];
}
}
-
(
IBAction
)
bindMobile
:
(
UIButton
*
)
sender
{
if
(
self
.
mobileTF
.
text
.
length
&&
self
.
codeTF
.
text
.
length
)
{
[
DSProgressHUD
showProgressHUDWithInfo
:
@""
];
[
UserRequestModel
verifyBindMobile
:
self
.
mobileTF
.
text
code
:
self
.
codeTF
.
text
completion
:^
(
UserRequestModel
*
_Nonnull
requestModel
)
{
[
DSProgressHUD
dissmissProgressHUD
];
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
// 保存绑定手机号码标识
kSetUserDefaultsBOOL
(
YES
,
IsBindMobile
);
kUserDefaultsSynchronize
;
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
else
{
[
DSProgressHUD
showToast
:
requestModel
.
errMessage
];
}
}];
}
}
#pragma mark - 品牌模式
-
(
NaviStyle
)
navigationBarStyle
{
return
NaviStyleDefault
;
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/Controller/BindMobileController.storyboard
0 → 100644
查看文件 @
6203897
此文件的差异被折叠,
点击展开。
DreamSleep/DreamSleep/Class/CommunityModule/Controller/CommunityController.m
查看文件 @
6203897
...
@@ -55,6 +55,22 @@
...
@@ -55,6 +55,22 @@
});
});
}
}
-
(
void
)
publishLogicDeal
{
// 1、判断用户有没有登录
if
(
!
[
LoginUtils
getUserLoginData
])
{
[
LoginUtils
jumpToLoginControllerWithTarget
:
self
];
return
;
}
// 2、登录了,判断是否绑定了手机号
if
(
!
kGetUserDefaultsBOOL
(
IsBindMobile
))
{
UIViewController
*
bindVC
=
[[
UIStoryboard
storyboardWithName
:
@"BindMobileController"
bundle
:
nil
]
instantiateViewControllerWithIdentifier
:
@"BindMobileController"
];
[
self
.
navigationController
pushViewController
:
bindVC
animated
:
YES
];
return
;
}
// 3、进入发布动态页面
[
self
.
navigationController
pushViewController
:[
NSClassFromString
(
@"DynamicController"
)
new
]
animated
:
YES
];
}
#pragma mark - lazy
#pragma mark - lazy
-
(
CommunityView
*
)
communityView
{
-
(
CommunityView
*
)
communityView
{
if
(
!
_communityView
)
{
if
(
!
_communityView
)
{
...
...
DreamSleep/DreamSleep/Class/CommunityModule/Controller/DynamicController.h
0 → 100644
查看文件 @
6203897
//
// DynamicController.h
// DreamSleep
//
// Created by peter on 2022/9/24.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 动态发布页面
@interface
DynamicController
:
UIViewController
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/Controller/DynamicController.m
0 → 100644
查看文件 @
6203897
//
// DynamicController.m
// DreamSleep
//
// Created by peter on 2022/9/24.
//
#import "DynamicController.h"
#import "DynamicView.h"
#import "DynamicViewModel.h"
#import "TZImagePickerController.h"
// 最大图片上传数量
static
int
MaxUpdateImgCount
=
3
;
// 相册显示列数
static
int
AlbumColumnCount
=
4
;
@interface
DynamicController
()
<
DynamicViewDelegate
,
TZImagePickerControllerDelegate
>
@property
(
nonatomic
,
strong
)
DynamicView
*
dynamicView
;
@property
(
nonatomic
,
strong
)
DynamicViewModel
*
dynamicVM
;
@property
(
nonatomic
,
assign
)
BOOL
isSelectOriginalPhoto
;
@property
(
nonatomic
,
copy
)
NSString
*
result_imgurls
;
@end
@implementation
DynamicController
-
(
void
)
loadView
{
self
.
view
=
self
.
dynamicView
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
navigationItem
.
title
=
@"动态发布"
;
}
#pragma mark - DynamicViewDelegate
-
(
void
)
openAlbum
{
if
(
MaxUpdateImgCount
<=
0
)
{
return
;
}
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithMaxImagesCount
:
MaxUpdateImgCount
columnNumber
:
AlbumColumnCount
delegate
:
self
pushPhotoPickerVc
:
NO
];
imagePickerVc
.
isSelectOriginalPhoto
=
self
.
isSelectOriginalPhoto
;
imagePickerVc
.
naviBgColor
=
[
self
.
dk_manager
.
themeVersion
isEqualToString
:
DKThemeVersionNight
]
?
SubNaviDarkColor
:
BrandColor
;
// 设置目前已经选中的图片数组
if
(
MaxUpdateImgCount
>
1
)
{
imagePickerVc
.
selectedAssets
=
self
.
dynamicVM
.
selectedAssets
;
}
// 在内部显示拍照按钮
imagePickerVc
.
allowTakePicture
=
YES
;
imagePickerVc
.
iconThemeColor
=
ColorFromRGBA
(
31
.
0
,
185
.
0
,
34
.
0
,
1
.
0
);
imagePickerVc
.
showPhotoCannotSelectLayer
=
YES
;
imagePickerVc
.
cannotSelectLayerColor
=
[
DSWhite
colorWithAlphaComponent
:
0
.
8
];
// 设置是否可以选择视频/图片/原图
imagePickerVc
.
allowPickingVideo
=
NO
;
imagePickerVc
.
allowPickingImage
=
YES
;
imagePickerVc
.
allowPickingOriginalPhoto
=
NO
;
imagePickerVc
.
allowPickingGif
=
NO
;
// 是否可以多选视频
imagePickerVc
.
allowPickingMultipleVideo
=
NO
;
// 照片排列按修改时间升序
imagePickerVc
.
sortAscendingByModificationDate
=
YES
;
imagePickerVc
.
showSelectBtn
=
NO
;
imagePickerVc
.
allowCrop
=
NO
;
imagePickerVc
.
needCircleCrop
=
NO
;
// 设置竖屏下的裁剪尺寸
NSInteger
left
=
30
;
NSInteger
widthHeight
=
self
.
view
.
width
-
2
*
left
;
NSInteger
top
=
(
self
.
view
.
height
-
widthHeight
)
/
2
;
imagePickerVc
.
cropRect
=
CGRectMake
(
left
,
top
,
widthHeight
,
widthHeight
);
// 设置是否显示图片序号
imagePickerVc
.
showSelectedIndex
=
YES
;
imagePickerVc
.
autoDismiss
=
NO
;
// 你可以通过block或者代理,来得到用户选择的照片.
__weak
TZImagePickerController
*
weakPicker
=
imagePickerVc
;
[
imagePickerVc
setDidFinishPickingPhotosHandle
:
^
(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
BOOL
isSelectOriginalPhoto
)
{
if
(
photos
.
count
)
{
[
self
uploadImgsWithPhotos
:
photos
picker
:
weakPicker
];
}
}];
[
self
presentViewController
:
imagePickerVc
animated
:
YES
completion
:
nil
];
}
-
(
void
)
previewPicture
:
(
NSIndexPath
*
)
indexPath
{
id
asset
=
self
.
dynamicVM
.
selectedAssets
[(
indexPath
.
row
-
1
)];
BOOL
isVideo
=
NO
;
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
PHAsset
*
phAsset
=
asset
;
isVideo
=
phAsset
.
mediaType
==
PHAssetMediaTypeVideo
;
}
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithSelectedAssets
:
self
.
dynamicVM
.
selectedAssets
selectedPhotos
:
self
.
dynamicVM
.
selectedPhotos
index
:
(
indexPath
.
row
-
1
)];
imagePickerVc
.
maxImagesCount
=
MaxUpdateImgCount
;
imagePickerVc
.
allowPickingOriginalPhoto
=
NO
;
imagePickerVc
.
allowPickingMultipleVideo
=
NO
;
imagePickerVc
.
showSelectedIndex
=
YES
;
imagePickerVc
.
isSelectOriginalPhoto
=
self
.
isSelectOriginalPhoto
;
WS
(
weakSelf
);
[
imagePickerVc
setDidFinishPickingPhotosHandle
:
^
(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
BOOL
isSelectOriginalPhoto
)
{
self
.
dynamicVM
.
selectedPhotos
=
[
NSMutableArray
arrayWithArray
:
photos
];
self
.
dynamicVM
.
selectedAssets
=
[
NSMutableArray
arrayWithArray
:
assets
];
self
.
isSelectOriginalPhoto
=
isSelectOriginalPhoto
;
[
weakSelf
.
dynamicView
refreshImageContentView
];
}];
[
self
presentViewController
:
imagePickerVc
animated
:
YES
completion
:
nil
];
}
-
(
void
)
deletePicture
:
(
NSInteger
)
tag
{
[
self
.
dynamicVM
.
selectedPhotos
removeObjectAtIndex
:
tag
];
[
self
.
dynamicVM
.
selectedAssets
removeObjectAtIndex
:
tag
];
[
self
.
dynamicView
refreshAfterDelete
:
tag
];
}
-
(
void
)
publishDynamic
{
}
#pragma mark - TZImagePickerControllerDelegate
-
(
void
)
imagePickerController
:
(
TZImagePickerController
*
)
picker
didFinishPickingPhotos
:
(
NSArray
<
UIImage
*>
*
)
photos
sourceAssets
:
(
NSArray
*
)
assets
isSelectOriginalPhoto
:
(
BOOL
)
isSelectOriginalPhoto
infos
:
(
NSArray
<
NSDictionary
*>
*
)
infos
{
self
.
dynamicVM
.
selectedPhotos
=
[
NSMutableArray
arrayWithArray
:
photos
];
self
.
dynamicVM
.
selectedAssets
=
[
NSMutableArray
arrayWithArray
:
assets
];
self
.
isSelectOriginalPhoto
=
isSelectOriginalPhoto
;
[
self
.
dynamicView
refreshImageContentView
];
}
// 如果用户选择了一个gif图片,下面的handle会被执行
-
(
void
)
imagePickerController
:
(
TZImagePickerController
*
)
picker
didFinishPickingGifImage
:
(
UIImage
*
)
animatedImage
sourceAssets
:
(
id
)
asset
{
self
.
dynamicVM
.
selectedPhotos
=
[
NSMutableArray
arrayWithArray
:@[
animatedImage
]];
self
.
dynamicVM
.
selectedAssets
=
[
NSMutableArray
arrayWithArray
:@[
asset
]];
[
self
.
dynamicView
refreshImageContentView
];
}
// 决定相册显示与否
-
(
BOOL
)
isAlbumCanSelect
:
(
NSString
*
)
albumName
result
:
(
id
)
result
{
return
YES
;
}
#pragma mark - 图片上传
-
(
void
)
uploadImgsWithPhotos
:
(
NSArray
<
UIImage
*>
*
)
photos
picker
:
(
TZImagePickerController
*
)
picker
{
// 1、处理图片
NSMutableString
*
mstr
=
[
NSMutableString
string
];
[
mstr
appendString
:
@"["
];
for
(
int
index
=
0
;
index
<
photos
.
count
;
index
++
)
{
UIImage
*
img
=
photos
[
index
];
NSString
*
base64Str
=
[
UIImage
imageToBase64Str
:
img
];
NSString
*
sepStr
=
(
index
==
(
photos
.
count
-
1
))
?
@""
:
@","
;
[
mstr
appendString
:[
NSString
stringWithFormat
:
@"
\"
%@
\"
%@"
,
base64Str
,
sepStr
]];
}
[
mstr
appendString
:
@"]"
];
// 2、上传图片
// [DSProgressHUD showProgressHUDWithInfo:@""];
// [FeedbackRequestModel uploadBulkImagesWithImgStr:[mstr copy] completion:^(FeedbackRequestModel * _Nonnull requestModel) {
// [DSProgressHUD dissmissProgressHUD];
// if (requestModel.resCode == DSResCodeSuccess) {
// // 存储图片上传成功后返回的urls
// self.result_imgurls = requestModel.result_imgurls;
// [picker dismissViewControllerAnimated:YES completion:nil];
// }
// }];
[
picker
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
#pragma mark - 品牌模式
-
(
NaviStyle
)
navigationBarStyle
{
return
NaviStyleDefault
;
}
#pragma mark - lazy
-
(
DynamicViewModel
*
)
dynamicVM
{
if
(
!
_dynamicVM
)
{
_dynamicVM
=
[
DynamicViewModel
new
];
}
return
_dynamicVM
;
}
-
(
DynamicView
*
)
dynamicView
{
if
(
!
_dynamicView
)
{
_dynamicView
=
[[
DynamicView
alloc
]
initWithDelegate
:
self
dynamicVM
:
self
.
dynamicVM
];
}
return
_dynamicView
;
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/CommunityView.h
查看文件 @
6203897
...
@@ -14,10 +14,14 @@
...
@@ -14,10 +14,14 @@
/// 获取社区动态列表请求
/// 获取社区动态列表请求
-
(
void
)
getDynamicListRequest
:(
BOOL
)
loadMore
;
-
(
void
)
getDynamicListRequest
:(
BOOL
)
loadMore
;
/// 点击发布按钮
-
(
void
)
publishLogicDeal
;
@end
@end
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/// 社区主视图
@interface
CommunityView
:
UIView
@interface
CommunityView
:
UIView
@property
(
nonatomic
,
weak
)
id
<
CommunityViewDelegate
>
delegate
;
@property
(
nonatomic
,
weak
)
id
<
CommunityViewDelegate
>
delegate
;
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/CommunityView.m
查看文件 @
6203897
...
@@ -58,7 +58,9 @@
...
@@ -58,7 +58,9 @@
}
}
-
(
void
)
publishAction
{
-
(
void
)
publishAction
{
DSLog
(
@"发布说说..."
);
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
publishLogicDeal
)])
{
[
self
.
delegate
publishLogicDeal
];
}
}
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
#pragma mark - UITableViewDelegate, UITableViewDataSource
...
@@ -83,7 +85,7 @@
...
@@ -83,7 +85,7 @@
}
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForFooterInSection
:
(
NSInteger
)
section
{
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForFooterInSection
:
(
NSInteger
)
section
{
return
section
==
self
.
listArr
.
count
-
1
?
CGFLOAT_MIN
:
12
;;
return
section
==
self
.
listArr
.
count
-
1
?
6
.
5
:
12
;;
}
}
-
(
UIView
*
)
tableView
:
(
UITableView
*
)
tableView
viewForFooterInSection
:
(
NSInteger
)
section
{
-
(
UIView
*
)
tableView
:
(
UITableView
*
)
tableView
viewForFooterInSection
:
(
NSInteger
)
section
{
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicView.h
0 → 100644
查看文件 @
6203897
//
// DynamicView.h
// DreamSleep
//
// Created by peter on 2022/9/24.
//
#import <UIKit/UIKit.h>
#import "DynamicViewModel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol
DynamicViewDelegate
<
NSObject
>
/// 打开相册
-
(
void
)
openAlbum
;
/// 预览图片
-
(
void
)
previewPicture
:(
NSIndexPath
*
)
indexPath
;
/// 删除图片
-
(
void
)
deletePicture
:(
NSInteger
)
tag
;
/// 发布动态
-
(
void
)
publishDynamic
;
@end
/// 动态主视图
@interface
DynamicView
:
UIView
@property
(
nonatomic
,
weak
)
id
<
DynamicViewDelegate
>
delegate
;
-
(
instancetype
)
initWithDelegate
:(
id
<
DynamicViewDelegate
>
)
delegate
dynamicVM
:(
DynamicViewModel
*
)
dynamicVM
;
-
(
void
)
refreshImageContentView
;
-
(
void
)
refreshAfterDelete
:(
NSInteger
)
tag
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicView.m
0 → 100644
查看文件 @
6203897
//
// DynamicView.m
// DreamSleep
//
// Created by peter on 2022/9/24.
//
#import "DynamicView.h"
#import "FeedImageCollectionCell.h"
@interface
DynamicView
()
<
UITextViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegate
>
@property
(
strong
,
nonatomic
)
UITextView
*
textView
;
@property
(
strong
,
nonatomic
)
UILabel
*
wordLimitLab
;
@property
(
strong
,
nonatomic
)
UICollectionView
*
imgCollectionView
;
@property
(
strong
,
nonatomic
)
UIButton
*
publishBtn
;
@property
(
strong
,
nonatomic
)
DynamicViewModel
*
dynamicVM
;
@end
@implementation
DynamicView
-
(
instancetype
)
initWithDelegate
:(
id
<
DynamicViewDelegate
>
)
delegate
dynamicVM
:(
DynamicViewModel
*
)
dynamicVM
{
if
(
self
=
[
super
init
])
{
self
.
delegate
=
delegate
;
self
.
dynamicVM
=
dynamicVM
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
[
self
addSubview
:
self
.
textView
];
[
self
addSubview
:
self
.
wordLimitLab
];
[
self
addSubview
:
self
.
imgCollectionView
];
[
self
addSubview
:
self
.
publishBtn
];
[
self
.
textView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
@15
);
make
.
right
.
equalTo
(
@
-
15
);
make
.
top
.
equalTo
(
@15
);
}];
[
self
.
imgCollectionView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
textView
.
mas_bottom
).
offset
(
26
);
make
.
left
.
equalTo
(
@15
);
make
.
right
.
equalTo
(
@
-
15
);
make
.
height
.
equalTo
(
@92
);
}];
[
self
.
publishBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
imgCollectionView
.
mas_bottom
).
offset
(
60
);
make
.
centerX
.
equalTo
(
self
);
make
.
bottom
.
equalTo
(
self
).
offset
(
-
91
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
155
,
40
));
}];
[
self
.
wordLimitLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
right
.
equalTo
(
self
.
textView
).
offset
(
-
8
);
make
.
bottom
.
equalTo
(
self
.
textView
).
offset
(
-
15
);
make
.
width
.
equalTo
(
@200
);
}];
}
return
self
;
}
-
(
void
)
publishAction
{
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
publishDynamic
)])
{
[
self
.
delegate
publishDynamic
];
}
}
-
(
void
)
deleteBtnClick
:
(
UIButton
*
)
sender
{
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
deletePicture
:)])
{
[
self
.
delegate
deletePicture
:
sender
.
tag
];
}
}
#pragma mark - public
-
(
void
)
refreshImageContentView
{
[
self
.
imgCollectionView
reloadData
];
}
-
(
void
)
refreshAfterDelete
:
(
NSInteger
)
tag
{
[
self
.
imgCollectionView
performBatchUpdates
:
^
{
NSIndexPath
*
indexPath
=
[
NSIndexPath
indexPathForItem
:
tag
inSection
:
0
];
[
self
.
imgCollectionView
deleteItemsAtIndexPaths
:@[
indexPath
]];
}
completion
:
^
(
BOOL
finished
)
{
[
self
.
imgCollectionView
reloadData
];
}];
}
#pragma mark - UITextViewDelegate
-
(
void
)
textViewDidEndEditing
:
(
UITextView
*
)
textView
{
[
self
dealWorldLimitAttTextWithChangeLength
:(
int
)
textView
.
text
.
length
];
}
-
(
BOOL
)
textView
:
(
UITextView
*
)
textView
shouldChangeTextInRange
:
(
NSRange
)
range
replacementText
:
(
NSString
*
)
text
{
int
textLength
=
(
int
)(
textView
.
text
.
length
-
range
.
length
+
text
.
length
);
[
self
dealWorldLimitAttTextWithChangeLength
:
textLength
];
if
(
textLength
>
200
)
{
return
NO
;
}
return
YES
;
}
-
(
void
)
dealWorldLimitAttTextWithChangeLength
:
(
int
)
changeLength
{
NSString
*
changeStr
=
[
NSString
stringWithFormat
:
@"%d"
,
changeLength
];
NSString
*
fixStr
=
@"/200"
;
NSMutableAttributedString
*
attStr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:[
NSString
stringWithFormat
:
@"%@%@"
,
changeStr
,
fixStr
]];
UIColor
*
changeColor
=
changeLength
>
400
?
ColorFromHex
(
0xF04B77
)
:
BrandColor
;
[
attStr
addAttribute
:
NSForegroundColorAttributeName
value
:
changeColor
range
:
NSMakeRange
(
0
,
changeStr
.
length
)];
UIColor
*
fixColor
=
[
self
.
dk_manager
.
themeVersion
isEqualToString
:
DKThemeVersionNormal
]
?
SmallTextColor
:
DarkTextColor
;
[
attStr
addAttribute
:
NSForegroundColorAttributeName
value
:
fixColor
range
:
NSMakeRange
(
changeStr
.
length
,
fixStr
.
length
)];
self
.
wordLimitLab
.
attributedText
=
attStr
;
}
#pragma mark - UICollectionViewDataSource && UICollectionViewDelegate
-
(
NSInteger
)
collectionView
:
(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:
(
NSInteger
)
section
{
return
self
.
dynamicVM
.
selectedPhotos
.
count
+
1
;
}
-
(
UICollectionViewCell
*
)
collectionView
:
(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
FeedImageCollectionCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"FeedImageCollectionCell"
forIndexPath
:
indexPath
];
if
(
indexPath
.
row
==
0
)
{
cell
.
imageView
.
image
=
nil
;
cell
.
addIcon
.
hidden
=
NO
;
cell
.
deleteBtn
.
hidden
=
YES
;
}
else
{
cell
.
imageView
.
image
=
self
.
dynamicVM
.
selectedPhotos
[
indexPath
.
row
-
1
];
cell
.
asset
=
self
.
dynamicVM
.
selectedAssets
[
indexPath
.
row
-
1
];
cell
.
addIcon
.
hidden
=
YES
;
cell
.
deleteBtn
.
hidden
=
NO
;
cell
.
deleteBtn
.
tag
=
indexPath
.
row
-
1
;
[
cell
.
deleteBtn
addTarget
:
self
action
:
@selector
(
deleteBtnClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
return
cell
;
}
-
(
void
)
collectionView
:
(
UICollectionView
*
)
collectionView
didSelectItemAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
0
)
{
// 打开相册
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
openAlbum
)])
{
[
self
.
delegate
openAlbum
];
}
}
else
{
// 预览照片或者视频
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
previewPicture
:)])
{
[
self
.
delegate
previewPicture
:
indexPath
];
}
}
}
#pragma mark - lazy
-
(
UITextView
*
)
textView
{
if
(
!
_textView
)
{
_textView
=
[[
UITextView
alloc
]
init
];
_textView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
ColorFromHex
(
0xf0f0f0
),
CornerViewDarkColor
,
DSWhite
);
_textView
.
dk_textColorPicker
=
DKColorPickerWithColors
(
SubTitleColor
,
DarkTextColor
,
DSWhite
);
_textView
.
font
=
SysFont
(
14
);
_textView
.
delegate
=
self
;
[
_textView
cornerRadius
:
12
];
}
return
_textView
;
}
-
(
UILabel
*
)
wordLimitLab
{
if
(
!
_wordLimitLab
)
{
_wordLimitLab
=
[
UILabel
labWithFont
:
SysFont
(
12
)];
_wordLimitLab
.
textAlignment
=
NSTextAlignmentRight
;
[
self
dealWorldLimitAttTextWithChangeLength
:
0
];
}
return
_wordLimitLab
;
}
-
(
UICollectionView
*
)
imgCollectionView
{
if
(
!
_imgCollectionView
)
{
UICollectionViewFlowLayout
*
layout
=
[[
UICollectionViewFlowLayout
alloc
]
init
];
layout
.
itemSize
=
CGSizeMake
(
92
,
92
);
layout
.
sectionInset
=
UIEdgeInsetsMake
(
0
,
0
,
0
,
0
);
layout
.
minimumLineSpacing
=
0
;
layout
.
minimumInteritemSpacing
=
0
;
layout
.
scrollDirection
=
UICollectionViewScrollDirectionHorizontal
;
_imgCollectionView
=
[[
UICollectionView
alloc
]
initWithFrame
:
CGRectZero
collectionViewLayout
:
layout
];
_imgCollectionView
.
showsHorizontalScrollIndicator
=
NO
;
_imgCollectionView
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
_imgCollectionView
.
dataSource
=
self
;
_imgCollectionView
.
delegate
=
self
;
_imgCollectionView
.
keyboardDismissMode
=
UIScrollViewKeyboardDismissModeOnDrag
;
[
_imgCollectionView
registerClass
:[
FeedImageCollectionCell
class
]
forCellWithReuseIdentifier
:
@"FeedImageCollectionCell"
];
}
return
_imgCollectionView
;
}
-
(
UIButton
*
)
publishBtn
{
if
(
!
_publishBtn
)
{
_publishBtn
=
[
UIButton
btnWithTitle
:
@"发布"
titleColor
:
DSWhite
font
:
BoldFont
(
16
)
bgColor
:
BrandColor
];
[
_publishBtn
addTarget
:
self
action
:
@selector
(
publishAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_publishBtn
cornerRadius
:
20
];
}
return
_publishBtn
;
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/
ArticleRequest
Model.h
→
DreamSleep/DreamSleep/Class/CommunityModule/
ViewModel/DynamicView
Model.h
查看文件 @
6203897
//
//
//
ArticleRequest
Model.h
//
DynamicView
Model.h
// DreamSleep
// DreamSleep
//
//
// Created by peter on 2022/9/2.
// Created by peter on 2022/9/2
4
.
//
//
#import "DSNetworkTool.h"
#import "DSNetworkTool.h"
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/// 文章咨询数据请求model
@interface
DynamicViewModel
:
DSNetworkTool
@interface
ArticleRequestModel
:
DSNetworkTool
@property
(
nonatomic
,
strong
)
NSMutableArray
*
selectedPhotos
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
selectedAssets
;
/// 获取文章咨询列表接口
/// @param type_id 类型(4,5)
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
querySsmianKnowledgeListWithTypeID
:(
int
)
type_id
WithCompletion
:(
void
(
^
)(
ArticleRequestModel
*
requestModel
))
completion
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/ViewModel/DynamicViewModel.m
0 → 100644
查看文件 @
6203897
//
// DynamicViewModel.m
// DreamSleep
//
// Created by peter on 2022/9/24.
//
#import "DynamicViewModel.h"
@implementation
DynamicViewModel
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
self
.
selectedPhotos
=
[
NSMutableArray
array
];
self
.
selectedAssets
=
[
NSMutableArray
array
];
}
return
self
;
}
@end
DreamSleep/DreamSleep/Class/ProfileModule/UserLogin/UserRequestModel.h
查看文件 @
6203897
...
@@ -53,6 +53,16 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -53,6 +53,16 @@ NS_ASSUME_NONNULL_BEGIN
/// @param completion completion
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
updateUserInfoWithData
:(
NSDictionary
*
)
data
completion
:(
void
(
^
)(
UserRequestModel
*
requestModel
))
completion
;
+
(
NSURLSessionDataTask
*
)
updateUserInfoWithData
:(
NSDictionary
*
)
data
completion
:(
void
(
^
)(
UserRequestModel
*
requestModel
))
completion
;
/// 获取手机验证码
/// @param mobile 手机号
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
getMobileCode
:(
NSString
*
)
mobile
completion
:(
void
(
^
)(
UserRequestModel
*
requestModel
))
completion
;
/// 验证手机号码
/// @param mobile mobile
/// @param code code
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
verifyBindMobile
:(
NSString
*
)
mobile
code
:(
NSString
*
)
code
completion
:(
void
(
^
)(
UserRequestModel
*
requestModel
))
completion
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/ProfileModule/UserLogin/UserRequestModel.m
查看文件 @
6203897
...
@@ -165,4 +165,34 @@
...
@@ -165,4 +165,34 @@
}];
}];
}
}
+
(
NSURLSessionDataTask
*
)
getMobileCode
:(
NSString
*
)
mobile
completion
:(
void
(
^
)(
UserRequestModel
*
requestModel
))
completion
{
UserRequestModel
*
requestModel
=
[[
UserRequestModel
alloc
]
init
];
NSString
*
api
=
@"get_mobile_code"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"query{%@(mobile:
\"
%@
\"
,type:2)}"
,
api
,
mobile
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"获取手机验证码接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
completion
(
requestModel
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
requestModel
.
errMessage
=
failureInfo
[
@"errMessage"
];
completion
(
requestModel
);
}];
}
+
(
NSURLSessionDataTask
*
)
verifyBindMobile
:(
NSString
*
)
mobile
code
:(
NSString
*
)
code
completion
:(
void
(
^
)(
UserRequestModel
*
requestModel
))
completion
{
UserRequestModel
*
requestModel
=
[[
UserRequestModel
alloc
]
init
];
NSString
*
api
=
@"verify_bind_mobile_phone"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"mutation{%@(mobile:
\"
%@
\"
,code:
\"
%@
\"
)}"
,
api
,
mobile
,
code
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"验证手机号码接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
completion
(
requestModel
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
requestModel
.
errMessage
=
failureInfo
[
@"errMessage"
];
completion
(
requestModel
);
}];
}
@end
@end
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论