Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit cbc73098
由
cgx
编写于
2022-06-30 17:01:39 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
完成大部分每日任务页面UI
1 个父辈
b6ad8d66
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
509 行增加
和
129 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep.xcworkspace/xcuserdata/peter.xcuserdatad/UserInterfaceState.xcuserstate
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskCell.h
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskCell.m
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskController.m
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskModel.h
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskView.h
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskView.m
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/SignCollectionViewCell.m
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/SignTaskView.m
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/TaskGroupModel.h
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/TaskGroupModel.m
DreamSleep/DreamSleep/Resource/Assets.xcassets/.DS_Store
DreamSleep/DreamSleep/Resource/Assets.xcassets/ScoreTask/.DS_Store
DreamSleep/Pods/Pods.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist
DreamSleep/TapiOS/Unity-iPhone.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
cbc7309
...
@@ -179,6 +179,7 @@
...
@@ -179,6 +179,7 @@
D0D3826728124E8A005BB219 /* FeedbackController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D3826628124E8A005BB219 /* FeedbackController.m */; };
D0D3826728124E8A005BB219 /* FeedbackController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D3826628124E8A005BB219 /* FeedbackController.m */; };
D0D4107C2844B8DB00009638 /* DailyTaskController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D4107B2844B8DB00009638 /* DailyTaskController.m */; };
D0D4107C2844B8DB00009638 /* DailyTaskController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D4107B2844B8DB00009638 /* DailyTaskController.m */; };
D0D4107F2844D38400009638 /* RankModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D4107E2844D38400009638 /* RankModel.m */; };
D0D4107F2844D38400009638 /* RankModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D4107E2844D38400009638 /* RankModel.m */; };
D0D5BB0D286D7A8D00D0507E /* TaskGroupModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D5BB0C286D7A8D00D0507E /* TaskGroupModel.m */; };
D0D69ED3282360F100A0D5EB /* LookAllController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D69ED2282360F100A0D5EB /* LookAllController.m */; };
D0D69ED3282360F100A0D5EB /* LookAllController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D69ED2282360F100A0D5EB /* LookAllController.m */; };
D0D69ED628236E0800A0D5EB /* SafeSleepListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D69ED528236E0800A0D5EB /* SafeSleepListController.m */; };
D0D69ED628236E0800A0D5EB /* SafeSleepListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D69ED528236E0800A0D5EB /* SafeSleepListController.m */; };
D0D96FDF2848457900461839 /* RelaxTrainRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D96FDE2848457900461839 /* RelaxTrainRequestModel.m */; };
D0D96FDF2848457900461839 /* RelaxTrainRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D96FDE2848457900461839 /* RelaxTrainRequestModel.m */; };
...
@@ -577,6 +578,8 @@
...
@@ -577,6 +578,8 @@
D0D4107B2844B8DB00009638 /* DailyTaskController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DailyTaskController.m; sourceTree = "<group>"; };
D0D4107B2844B8DB00009638 /* DailyTaskController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DailyTaskController.m; sourceTree = "<group>"; };
D0D4107D2844D38400009638 /* RankModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RankModel.h; sourceTree = "<group>"; };
D0D4107D2844D38400009638 /* RankModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RankModel.h; sourceTree = "<group>"; };
D0D4107E2844D38400009638 /* RankModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RankModel.m; sourceTree = "<group>"; };
D0D4107E2844D38400009638 /* RankModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RankModel.m; sourceTree = "<group>"; };
D0D5BB0B286D7A8D00D0507E /* TaskGroupModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TaskGroupModel.h; sourceTree = "<group>"; };
D0D5BB0C286D7A8D00D0507E /* TaskGroupModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TaskGroupModel.m; sourceTree = "<group>"; };
D0D69ED1282360F100A0D5EB /* LookAllController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LookAllController.h; sourceTree = "<group>"; };
D0D69ED1282360F100A0D5EB /* LookAllController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LookAllController.h; sourceTree = "<group>"; };
D0D69ED2282360F100A0D5EB /* LookAllController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LookAllController.m; sourceTree = "<group>"; };
D0D69ED2282360F100A0D5EB /* LookAllController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LookAllController.m; sourceTree = "<group>"; };
D0D69ED428236E0800A0D5EB /* SafeSleepListController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafeSleepListController.h; sourceTree = "<group>"; };
D0D69ED428236E0800A0D5EB /* SafeSleepListController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafeSleepListController.h; sourceTree = "<group>"; };
...
@@ -1096,6 +1099,8 @@
...
@@ -1096,6 +1099,8 @@
D037C499284F4F0D000F3089 /* DailyTaskCell.m */,
D037C499284F4F0D000F3089 /* DailyTaskCell.m */,
D07257F1286BF99F0080F458 /* DailyTaskView.h */,
D07257F1286BF99F0080F458 /* DailyTaskView.h */,
D07257F2286BF99F0080F458 /* DailyTaskView.m */,
D07257F2286BF99F0080F458 /* DailyTaskView.m */,
D0D5BB0B286D7A8D00D0507E /* TaskGroupModel.h */,
D0D5BB0C286D7A8D00D0507E /* TaskGroupModel.m */,
D0D4107A2844B8DB00009638 /* DailyTaskController.h */,
D0D4107A2844B8DB00009638 /* DailyTaskController.h */,
D0D4107B2844B8DB00009638 /* DailyTaskController.m */,
D0D4107B2844B8DB00009638 /* DailyTaskController.m */,
D0336161285035AB005573CF /* DailyBgView.h */,
D0336161285035AB005573CF /* DailyBgView.h */,
...
@@ -2066,6 +2071,7 @@
...
@@ -2066,6 +2071,7 @@
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */,
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */,
D055BEC828252D8200BC11A4 /* AudioCourseCell.m in Sources */,
D055BEC828252D8200BC11A4 /* AudioCourseCell.m in Sources */,
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */,
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */,
D0D5BB0D286D7A8D00D0507E /* TaskGroupModel.m in Sources */,
D09BF331280E570D00E5F06C /* UserModel.m in Sources */,
D09BF331280E570D00E5F06C /* UserModel.m in Sources */,
D0C50B4F27FD832300DC68F0 /* LeadView.m in Sources */,
D0C50B4F27FD832300DC68F0 /* LeadView.m in Sources */,
D091E674283F5B4200D3279E /* ScoreDetailModel.m in Sources */,
D091E674283F5B4200D3279E /* ScoreDetailModel.m in Sources */,
...
...
DreamSleep/DreamSleep.xcworkspace/xcuserdata/peter.xcuserdatad/UserInterfaceState.xcuserstate
查看文件 @
cbc7309
此文件类型无法预览
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskCell.h
查看文件 @
cbc7309
...
@@ -6,17 +6,25 @@
...
@@ -6,17 +6,25 @@
//
//
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import "ScoreTaskRequestModel.h"
#import "DailyTaskModel.h"
#import "NewTaskModel.h"
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
@protocol
DailyTaskCellDelegate
<
NSObject
>
-
(
void
)
finishWithModel
:
(
id
)
model
type
:
(
int
)
type
;
@end
/// 每日任务、新手任务cell
/// 每日任务、新手任务cell
@interface
DailyTaskCell
:
UITableViewCell
@interface
DailyTaskCell
:
UITableViewCell
/// 分组类型(1:每日任务,2:新手任务)
@property
(
nonatomic
,
assign
)
int
type
;
/// 每日任务cell数据model
@property
(
nonatomic
,
strong
)
DailyTaskModel
*
dailyTaskModel
;
/// 新手任务cell数据model
@property
(
nonatomic
,
strong
)
NewTaskModel
*
nTaskModel
;
-
(
instancetype
)
initWithReuseIdentifier
:(
NSString
*
)
reuseIdentifier
indexPath
:(
NSIndexPath
*
)
indexPath
;
@property
(
nonatomic
,
weak
)
id
<
DailyTaskCellDelegate
>
delegate
;
-
(
void
)
updateSignView
:(
ScoreTaskRequestModel
*
)
requestModel
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskCell.m
查看文件 @
cbc7309
...
@@ -6,38 +6,167 @@
...
@@ -6,38 +6,167 @@
//
//
#import "DailyTaskCell.h"
#import "DailyTaskCell.h"
#import "SignTaskView.h"
@interface
DailyTaskCell
()
@interface
DailyTaskCell
()
@property
(
nonatomic
,
strong
)
SignTaskView
*
signTaskView
;
@property
(
nonatomic
,
strong
)
UIImageView
*
taskIcon
;
@property
(
nonatomic
,
strong
)
UILabel
*
titleLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
descrLab
;
@property
(
nonatomic
,
strong
)
UIButton
*
goFinishBtn
;
@end
@end
@implementation
DailyTaskCell
@implementation
DailyTaskCell
-
(
instancetype
)
initWith
ReuseIdentifier
:(
NSString
*
)
reuseIdentifier
indexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
instancetype
)
initWith
Style
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
(
self
=
[
super
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
reuseIdentifier
])
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
TabBarBG
);
[
self
.
contentView
addSubview
:
self
.
taskIcon
];
[
self
.
contentView
addSubview
:
self
.
titleLab
];
[
self
.
contentView
addSubview
:
self
.
descrLab
];
[
self
.
contentView
addSubview
:
self
.
goFinishBtn
];
[
self
.
taskIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerY
.
equalTo
(
self
.
contentView
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
15
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
40
,
40
));
}];
[
self
.
titleLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
contentView
).
offset
(
12
);
make
.
left
.
equalTo
(
self
.
taskIcon
.
mas_right
).
offset
(
12
);
make
.
right
.
equalTo
(
self
.
goFinishBtn
.
mas_left
).
offset
(
-
12
);
}];
[
self
.
descrLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
titleLab
);
make
.
bottom
.
equalTo
(
self
.
contentView
).
offset
(
-
12
);
make
.
right
.
equalTo
(
self
.
goFinishBtn
.
mas_left
).
offset
(
-
12
);
}];
[
self
.
goFinishBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerY
.
equalTo
(
self
.
contentView
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
80
,
34
));
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
15
);
}];
}
return
self
;
}
if
(
indexPath
.
section
==
0
)
{
-
(
void
)
goFinishAction
{
[
self
.
contentView
addSubview
:
self
.
signTaskView
];
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
finishWithModel
:
type
:
)])
{
self
.
backgroundColor
=
DSClearColor
;
if
(
self
.
type
==
1
)
{
[
self
.
delegate
finishWithModel
:
self
.
dailyTaskModel
type
:
1
];
}
else
{
}
else
{
self
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
TabBarBG
)
;
[
self
.
delegate
finishWithModel
:
self
.
nTaskModel
type
:
2
]
;
}
}
}
}
return
self
;
}
}
-
(
void
)
updateSignView
:(
ScoreTaskRequestModel
*
)
requestModel
{
-
(
void
)
setDailyTaskModel
:
(
DailyTaskModel
*
)
dailyTaskModel
{
[
self
.
signTaskView
updateSignView
:
requestModel
];
_dailyTaskModel
=
dailyTaskModel
;
// 任务图标处理
[
self
.
taskIcon
yy_setImageWithURL
:[
NSURL
URLWithString
:
dailyTaskModel
.
img_url
]
placeholder
:[
UIImage
imageNamed
:
@"basicPlaceholder"
]];
// 任务名称标签处理(AI睡眠教练特殊处理(根据id进行判断))
if
(
dailyTaskModel
.
task_id
==
1
)
{
NSString
*
str1
=
dailyTaskModel
.
name
;
NSString
*
space
=
@" "
;
NSString
*
str2
=
[
NSString
stringWithFormat
:
@"%d"
,
dailyTaskModel
.
finish_point
];
NSString
*
str3
=
[
NSString
stringWithFormat
:
@"/%d分"
,
dailyTaskModel
.
integral
];
NSString
*
ai_title
=
[
NSString
stringWithFormat
:
@"%@%@%@%@"
,
str1
,
space
,
str2
,
str3
];
self
.
titleLab
.
text
=
ai_title
;
NSMutableAttributedString
*
title_attText
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
ai_title
];
UIColor
*
dkColor
=
[
self
.
dk_manager
.
themeVersion
isEqualToString
:
DKThemeVersionNormal
]
?
MainTextColor
:
DkTitleColor
;
[
title_attText
addAttribute
:
NSForegroundColorAttributeName
value
:
dkColor
range
:
NSMakeRange
(
0
,
str1
.
length
)];
[
title_attText
addAttribute
:
NSForegroundColorAttributeName
value
:
BrandColor
range
:
NSMakeRange
(
str1
.
length
+
space
.
length
,
str2
.
length
)];
[
title_attText
addAttribute
:
NSForegroundColorAttributeName
value
:
dkColor
range
:
NSMakeRange
(
str1
.
length
+
space
.
length
+
str2
.
length
,
str3
.
length
)];
self
.
titleLab
.
attributedText
=
title_attText
;
}
else
{
self
.
titleLab
.
text
=
dailyTaskModel
.
name
;
}
// 任务描述标签处理
int
desc_point
=
dailyTaskModel
.
task_id
==
1
?
dailyTaskModel
.
points
:
dailyTaskModel
.
integral
;
NSString
*
leftStr
=
[
NSString
stringWithFormat
:
@"+%d分"
,
desc_point
];
NSString
*
spaceStr
=
@" "
;
NSString
*
rightStr
=
dailyTaskModel
.
task_id
==
1
?
dailyTaskModel
.
item_name
:
dailyTaskModel
.
task_description
;
NSString
*
descStr
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
leftStr
,
spaceStr
,
rightStr
];
self
.
descrLab
.
text
=
descStr
;
NSMutableAttributedString
*
desc_attText
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
descStr
];
UIColor
*
dkColor1
=
[
self
.
dk_manager
.
themeVersion
isEqualToString
:
DKThemeVersionNormal
]
?
BrandColor
:
ColorFromHexA
(
0x62C3D5
,
.
5
);
UIColor
*
dkColor2
=
[
self
.
dk_manager
.
themeVersion
isEqualToString
:
DKThemeVersionNormal
]
?
SubTitleColor
:
ColorFromHexA
(
0xFFFFFF
,
.
5
);;
[
desc_attText
addAttribute
:
NSForegroundColorAttributeName
value
:
dkColor1
range
:
NSMakeRange
(
0
,
leftStr
.
length
)];
[
desc_attText
addAttribute
:
NSForegroundColorAttributeName
value
:
dkColor2
range
:
NSMakeRange
(
leftStr
.
length
+
spaceStr
.
length
,
rightStr
.
length
)];
self
.
descrLab
.
attributedText
=
desc_attText
;
// 完成按钮背景色
[
self
dealFinishBtn
:
dailyTaskModel
.
state
];
}
-
(
void
)
setNTaskModel
:
(
NewTaskModel
*
)
nTaskModel
{
_nTaskModel
=
nTaskModel
;
[
self
.
taskIcon
yy_setImageWithURL
:[
NSURL
URLWithString
:
nTaskModel
.
img_url
]
placeholder
:[
UIImage
imageNamed
:
@"basicPlaceholder"
]];
self
.
titleLab
.
text
=
nTaskModel
.
name
;
self
.
descrLab
.
text
=
[
NSString
stringWithFormat
:
@"+%d分"
,
nTaskModel
.
integral
];
// 完成按钮背景色
[
self
dealFinishBtn
:
nTaskModel
.
state
];
}
-
(
void
)
dealFinishBtn
:
(
int
)
state
{
BOOL
isEnable
=
YES
;
NSString
*
btn_title
=
@"去完成"
;
DKColorPicker
dk_bg_color
=
DKColorPickerWithColors
(
BrandColor
,
ColorFromHex
(
0x45A4B5
),
DSWhite
);
DKColorPicker
dk_title_color
=
DKColorPickerWithColors
(
DSWhite
,
DSWhite
,
DSWhite
);
if
(
state
==
1
)
{
btn_title
=
@"待领取"
;
dk_bg_color
=
DKColorPickerWithColors
(
ColorFromHexA
(
0xF23D4F
,
.
1
),
ColorFromHexA
(
0xF23D4F
,
.
1
),
DSWhite
);
dk_title_color
=
DKColorPickerWithColors
(
ColorFromHex
(
0xF23D4F
),
ColorFromHex
(
0xF23D4F
),
DSWhite
);
}
else
if
(
state
==
2
)
{
isEnable
=
NO
;
btn_title
=
@"已领取"
;
dk_bg_color
=
DKColorPickerWithColors
(
ColorFromHexA
(
0xFC7032
,
.
1
),
ColorFromHexA
(
0xFC7032
,
.
1
),
DSWhite
);
dk_title_color
=
DKColorPickerWithColors
(
ColorFromHex
(
0xFC7032
),
ColorFromHex
(
0xFC7032
),
DSWhite
);
}
self
.
goFinishBtn
.
userInteractionEnabled
=
isEnable
;
[
self
.
goFinishBtn
setTitle
:
btn_title
forState
:
UIControlStateNormal
];
self
.
goFinishBtn
.
dk_backgroundColorPicker
=
dk_bg_color
;
[
self
.
goFinishBtn
dk_setTitleColorPicker
:
dk_title_color
forState
:
UIControlStateNormal
];
}
}
#pragma mark - lazy
#pragma mark - lazy
-
(
SignTaskView
*
)
signTaskView
{
-
(
UIImageView
*
)
taskIcon
{
if
(
!
_signTaskView
)
{
if
(
!
_taskIcon
)
{
_signTaskView
=
[[
SignTaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
-
30
,
186
)];
_taskIcon
=
[
UIImageView
new
];
_taskIcon
.
dk_alphaPicker
=
DKAlphaPickerWithAlphas
(
1
.
0
,
.
5
,
1
.
0
);
}
return
_taskIcon
;
}
-
(
UILabel
*
)
titleLab
{
if
(
!
_titleLab
)
{
_titleLab
=
[
UILabel
labWithFont
:
SysFont
(
15
.
0
)];
_titleLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
DkTitleColor
,
DSWhite
);
}
return
_titleLab
;
}
-
(
UILabel
*
)
descrLab
{
if
(
!
_descrLab
)
{
_descrLab
=
[
UILabel
labWithTextColor
:
BrandColor
font
:
SysFont
(
14
.
0
)];
}
return
_descrLab
;
}
-
(
UIButton
*
)
goFinishBtn
{
if
(
!
_goFinishBtn
)
{
_goFinishBtn
=
[
UIButton
btnWithTitle
:
@"去完成"
font
:
BoldFont
(
14
.
0
)];
_goFinishBtn
.
userInteractionEnabled
=
NO
;
[
_goFinishBtn
addTarget
:
self
action
:
@selector
(
goFinishAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_goFinishBtn
cornerRadius
:
17
.
0
];
}
}
return
_
signTaskView
;
return
_
goFinishBtn
;
}
}
@end
@end
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskController.m
查看文件 @
cbc7309
...
@@ -35,13 +35,13 @@
...
@@ -35,13 +35,13 @@
}];
}];
[
ScoreTaskRequestModel
queryUserDailyTaskListWithCompletion
:
^
(
ScoreTaskRequestModel
*
_Nonnull
requestModel
)
{
[
ScoreTaskRequestModel
queryUserDailyTaskListWithCompletion
:
^
(
ScoreTaskRequestModel
*
_Nonnull
requestModel
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
[
self
.
dailyTaskView
updateTaskView
:
requestModel
];
}
}
}];
}];
}
}
#pragma mark - DailyTaskViewDelegate
#pragma mark - DailyTaskViewDelegate
-
(
void
)
scrollViewDidScroll
:
(
BOOL
)
isMax
{
-
(
void
)
didScrollToMaxOffsetY
:
(
BOOL
)
isMax
{
if
(
isMax
)
{
if
(
isMax
)
{
self
.
naviTitle
=
@"每日任务"
;
self
.
naviTitle
=
@"每日任务"
;
self
.
isNeedUpdateStatusBarStyle
=
YES
;
self
.
isNeedUpdateStatusBarStyle
=
YES
;
...
@@ -55,6 +55,10 @@
...
@@ -55,6 +55,10 @@
}
}
}
}
-
(
void
)
popViewController
{
[
self
.
navigationController
popViewControllerAnimated
:
NO
];
}
#pragma mark - lazy
#pragma mark - lazy
-
(
DailyTaskView
*
)
dailyTaskView
{
-
(
DailyTaskView
*
)
dailyTaskView
{
if
(
!
_dailyTaskView
)
{
if
(
!
_dailyTaskView
)
{
...
...
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskModel.h
查看文件 @
cbc7309
...
@@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
assign
)
int
integral
;
@property
(
nonatomic
,
assign
)
int
integral
;
/// 任务描述详情
/// 任务描述详情
@property
(
nonatomic
,
copy
)
NSString
*
task_description
;
@property
(
nonatomic
,
copy
)
NSString
*
task_description
;
/// 任务名
@property
(
nonatomic
,
copy
)
NSString
*
name
;
/// 任务描述
/// 任务描述
@property
(
nonatomic
,
copy
)
NSString
*
item_name
;
@property
(
nonatomic
,
copy
)
NSString
*
item_name
;
/// 跳转页面url
/// 跳转页面url
...
...
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskView.h
查看文件 @
cbc7309
...
@@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
/// 监听scrollview是否滚动到临界值
/// 监听scrollview是否滚动到临界值
/// @param isMax isMax
/// @param isMax isMax
-
(
void
)
didScrollToMaxOffsetY
:
(
BOOL
)
isMax
;
-
(
void
)
didScrollToMaxOffsetY
:
(
BOOL
)
isMax
;
/// 退出当前页面
-
(
void
)
popViewController
;
@end
@end
/// 每日任务页面自定义主view
/// 每日任务页面自定义主view
...
@@ -24,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -24,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
instancetype
)
initWithDelegate
:(
id
<
DailyTaskViewDelegate
>
)
delegate
;
-
(
instancetype
)
initWithDelegate
:(
id
<
DailyTaskViewDelegate
>
)
delegate
;
-
(
void
)
updateSignView
:(
ScoreTaskRequestModel
*
)
requestModel
;
-
(
void
)
updateSignView
:(
ScoreTaskRequestModel
*
)
requestModel
;
-
(
void
)
updateTaskView
:(
ScoreTaskRequestModel
*
)
requestModel
;
@end
@end
...
...
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/DailyTaskView.m
查看文件 @
cbc7309
...
@@ -8,18 +8,20 @@
...
@@ -8,18 +8,20 @@
#import "DailyTaskView.h"
#import "DailyTaskView.h"
#import "DailyTaskSrollView.h"
#import "DailyTaskSrollView.h"
#import "DailyBgView.h"
#import "DailyBgView.h"
#import "SignTaskView.h"
#import "DailyTaskCell.h"
#import "DailyTaskCell.h"
#import "TaskGroupModel.h"
@interface
DailyTaskView
()
<
UIScrollViewDelegate
,
UITableViewDelegate
,
UITableViewDataSource
>
@interface
DailyTaskView
()
<
UIScrollViewDelegate
,
UITableViewDelegate
,
UITableViewDataSource
,
DailyTaskCellDelegate
>
@property
(
nonatomic
,
strong
)
DailyTaskSrollView
*
dtSrollView
;
@property
(
nonatomic
,
strong
)
DailyTaskSrollView
*
dtSrollView
;
@property
(
nonatomic
,
strong
)
UIScrollView
*
scrollInnerView
;
@property
(
nonatomic
,
strong
)
UIScrollView
*
scrollInnerView
;
@property
(
nonatomic
,
strong
)
DailyBgView
*
dailyBgView
;
@property
(
nonatomic
,
strong
)
DailyBgView
*
dailyBgView
;
@property
(
nonatomic
,
strong
)
UITableView
*
taskTableView
;
@property
(
nonatomic
,
strong
)
UITableView
*
taskTableView
;
@property
(
nonatomic
,
strong
)
SignTaskView
*
signTaskView
;
@property
(
nonatomic
,
assign
)
BOOL
vccanScroll
;
@property
(
nonatomic
,
assign
)
BOOL
vccanScroll
;
@property
(
nonatomic
,
assign
)
CGFloat
bgHeight
;
@property
(
nonatomic
,
assign
)
CGFloat
bgHeight
;
@property
(
nonatomic
,
assign
)
CGFloat
coverHeight
;
@property
(
nonatomic
,
assign
)
CGFloat
coverHeight
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
taskListArr
;
@property
(
nonatomic
,
strong
)
NSArray
*
taskListArr
;
@property
(
nonatomic
,
strong
)
ScoreTaskRequestModel
*
requestModel
;
@end
@end
@implementation
DailyTaskView
@implementation
DailyTaskView
...
@@ -31,118 +33,134 @@
...
@@ -31,118 +33,134 @@
self
.
vccanScroll
=
YES
;
self
.
vccanScroll
=
YES
;
self
.
bgHeight
=
kScreenWidth
*
300
/
375
.
0
;
self
.
bgHeight
=
kScreenWidth
*
300
/
375
.
0
;
self
.
coverHeight
=
50
;
self
.
coverHeight
=
50
;
// 模拟数据
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
[
self
.
taskListArr
addObject
:
@
(
i
+
1
)];
}
[
self
insertSubview
:
self
.
dtSrollView
atIndex
:
0
];
[
self
insertSubview
:
self
.
dtSrollView
atIndex
:
0
];
}
}
return
self
;
return
self
;
}
}
-
(
void
)
updateSignView
:(
ScoreTaskRequestModel
*
)
requestModel
{
#pragma mark - DailyTaskCellDelegate
self
.
requestModel
=
requestModel
;
-
(
void
)
finishWithModel
:(
id
)
model
type
:(
int
)
type
{
[
self
.
taskTableView
reloadRowsAtIndexPaths
:@[[
NSIndexPath
indexPathForRow
:
0
inSection
:
0
]]
withRowAnimation
:
UITableViewRowAnimationNone
];
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
popViewController
)])
{
}
[
self
.
delegate
popViewController
];
}
#pragma mark - UIScrollViewDelegate
-
(
void
)
scrollViewDidScroll
:(
UIScrollView
*
)
scrollView
{
if
(
type
==
1
)
{
// 每日任务
CGFloat
offsetY
=
scrollView
.
contentOffset
.
y
;
DailyTaskModel
*
dailyTaskModel
=
(
DailyTaskModel
*
)
model
;
if
(
scrollView
==
self
.
dtSrollView
)
{
switch
(
dailyTaskModel
.
task_id
)
{
CGFloat
maxOffsetY
=
self
.
bgHeight
-
self
.
coverHeight
;
case
1
:
// AI睡眠教练(该任务不需要手动调用更新状态接口)
if
(
offsetY
>=
maxOffsetY
)
{
{
scrollView
.
contentOffset
=
CGPointMake
(
0
,
maxOffsetY
);
self
.
ds_viewController
.
tabBarController
.
selectedIndex
=
1
;
self
.
vccanScroll
=
NO
;
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
didScrollToMaxOffsetY
:)])
{
[
self
.
delegate
didScrollToMaxOffsetY
:
YES
];
}
}
else
{
if
(
self
.
vccanScroll
==
NO
)
{
scrollView
.
contentOffset
=
CGPointMake
(
0
,
maxOffsetY
);
}
}
break
;
default:
break
;
}
}
}
else
{
// 新手任务
if
(
offsetY
<=
0
)
{
NewTaskModel
*
newTaskModel
=
(
NewTaskModel
*
)
model
;
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
didScrollToMaxOffsetY
:)])
{
switch
(
newTaskModel
.
task_id
)
{
[
self
.
delegate
didScrollToMaxOffsetY
:
NO
];
case
9
:
// 上传头像
{
}
}
}
break
;
}
else
if
(
scrollView
==
self
.
taskTableView
)
{
case
10
:
// 修改昵称
CGPoint
point
=
[
scrollView
.
panGestureRecognizer
translationInView
:
scrollView
];
{
CGFloat
taboffsetY
=
point
.
y
;
if
(
offsetY
<
0
)
{
self
.
vccanScroll
=
YES
;
}
if
(
taboffsetY
<
0
)
{
if
(
self
.
dtSrollView
.
contentOffset
.
y
<
self
.
bgHeight
-
self
.
coverHeight
)
{
self
.
taskTableView
.
contentOffset
=
CGPointZero
;
}
}
}
else
{
break
;
if
(
offsetY
>
0
)
{
case
11
:
// 选择性别
self
.
dtSrollView
.
contentOffset
=
CGPointMake
(
0
,
self
.
bgHeight
-
self
.
coverHeight
);
{
}
else
if
(
offsetY
<
0
)
{
if
(
self
.
dtSrollView
.
contentOffset
.
y
>
0
&&
self
.
dtSrollView
.
contentOffset
.
y
<
self
.
bgHeight
-
self
.
coverHeight
)
{
}
self
.
taskTableView
.
contentOffset
=
CGPointZero
;
break
;
}
case
12
:
// 完善生日
{
}
}
break
;
default:
break
;
}
}
}
}
}
}
#pragma mark - public
-
(
void
)
updateSignView
:(
ScoreTaskRequestModel
*
)
requestModel
{
[
self
.
signTaskView
updateSignView
:
requestModel
];
}
-
(
void
)
updateTaskView
:(
ScoreTaskRequestModel
*
)
requestModel
{
if
(
!
requestModel
)
{
return
;
}
NSMutableArray
*
tmpArr
=
[
NSMutableArray
array
];
if
(
requestModel
.
task_items
.
count
)
{
TaskGroupModel
*
groupModel
=
[
TaskGroupModel
modelWithTaskType
:
TaskTypeDaily
taskArr
:
requestModel
.
task_items
];
[
tmpArr
addObject
:
groupModel
];
}
if
(
requestModel
.
task_news
.
count
)
{
TaskGroupModel
*
groupModel
=
[
TaskGroupModel
modelWithTaskType
:
TaskTypeNew
taskArr
:
requestModel
.
task_news
];
[
tmpArr
addObject
:
groupModel
];
}
self
.
taskListArr
=
[
tmpArr
copy
];
[
self
.
taskTableView
reloadData
];
}
#pragma mark - UITableViewDelegate && UITableViewDataSource
#pragma mark - UITableViewDelegate && UITableViewDataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
return
3
;
return
self
.
taskListArr
.
count
;
}
}
-
(
NSInteger
)
tableView
:(
UITableView
*
)
tableView
numberOfRowsInSection
:(
NSInteger
)
section
{
-
(
NSInteger
)
tableView
:(
UITableView
*
)
tableView
numberOfRowsInSection
:(
NSInteger
)
section
{
if
(
section
==
0
)
{
TaskGroupModel
*
groupModel
=
self
.
taskListArr
[
section
];
return
1
;
if
(
groupModel
.
taskType
==
TaskTypeDaily
)
{
return
groupModel
.
task_items
.
count
;
}
else
{
return
groupModel
.
task_news
.
count
;
}
}
return
self
.
taskListArr
.
count
;
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
0
)
{
return
71
;
return
186
;
}
else
{
return
50
;
}
}
}
-
(
UITableViewCell
*
)
tableView
:(
UITableView
*
)
tableView
cellForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
UITableViewCell
*
)
tableView
:(
UITableView
*
)
tableView
cellForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
NSString
*
cellID
=
[
NSString
stringWithFormat
:
@"DailyTaskCell_%zd"
,
indexPath
.
section
];
NSString
*
cellID
=
[
NSString
stringWithFormat
:
@"DailyTaskCell_%zd"
,
indexPath
.
section
];
DailyTaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
DailyTaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
if
(
!
cell
)
{
if
(
!
cell
)
{
cell
=
[[
DailyTaskCell
alloc
]
initWith
ReuseIdentifier
:
cellID
indexPath
:
indexPath
];
cell
=
[[
DailyTaskCell
alloc
]
initWith
Style
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
}
}
cell
.
delegate
=
self
;
if
(
indexPath
.
section
==
0
)
{
// 签到cell
TaskGroupModel
*
groupModel
=
self
.
taskListArr
[
indexPath
.
section
];
[
cell
updateSignView
:
self
.
requestModel
];
if
(
groupModel
.
taskType
==
TaskTypeDaily
)
{
cell
.
type
=
1
;
DailyTaskModel
*
dailyTaskModel
=
groupModel
.
task_items
[
indexPath
.
row
];
cell
.
dailyTaskModel
=
dailyTaskModel
;
}
else
{
}
else
{
cell
.
type
=
2
;
NewTaskModel
*
newTaskModel
=
groupModel
.
task_news
[
indexPath
.
row
];
cell
.
nTaskModel
=
newTaskModel
;
}
}
return
cell
;
return
cell
;
}
}
-
(
void
)
tableView
:(
UITableView
*
)
tableView
willDisplayCell
:(
UITableViewCell
*
)
cell
forRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
void
)
tableView
:(
UITableView
*
)
tableView
willDisplayCell
:(
UITableViewCell
*
)
cell
forRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
TaskGroupModel
*
groupModel
=
self
.
taskListArr
[
indexPath
.
section
];
NSArray
*
tmpArr
=
groupModel
.
taskType
==
TaskTypeDaily
?
groupModel
.
task_items
:
groupModel
.
task_news
;
// 最后1个单元格圆角设置
// 最后1个单元格圆角设置
if
(
indexPath
.
row
==
self
.
taskList
Arr
.
count
-
1
)
{
if
(
indexPath
.
row
==
tmp
Arr
.
count
-
1
)
{
[
cell
setCornerRadiusRect
:
UIRectCornerBottomLeft
|
UIRectCornerBottomRight
cornerRadius
:
24
.
0
];
[
cell
setCornerRadiusRect
:
UIRectCornerBottomLeft
|
UIRectCornerBottomRight
cornerRadius
:
24
.
0
];
}
}
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForHeaderInSection
:(
NSInteger
)
section
{
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForHeaderInSection
:(
NSInteger
)
section
{
if
(
section
==
0
)
{
return
15
.
0
+
52
;
return
0
.
001
;
}
else
{
return
15
.
0
+
52
;
}
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForFooterInSection
:(
NSInteger
)
section
{
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForFooterInSection
:(
NSInteger
)
section
{
if
(
section
==
2
)
{
if
(
section
==
self
.
taskListArr
.
count
-
1
)
{
return
(
24
+
Bottom_SafeArea_Height
);
return
(
24
+
Bottom_SafeArea_Height
);
}
else
{
}
else
{
return
0
.
001
;
return
0
.
001
;
...
@@ -150,26 +168,23 @@
...
@@ -150,26 +168,23 @@
}
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForHeaderInSection
:(
NSInteger
)
section
{
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForHeaderInSection
:(
NSInteger
)
section
{
CGFloat
h
=
section
==
0
?
0
.
001
:
15
.
0
+
52
;
TaskGroupModel
*
groupModel
=
self
.
taskListArr
[
section
];
if
(
section
==
0
)
{
return
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
10
,
h
)];
CGFloat
h
=
15
.
0
+
52
;
}
else
{
UIView
*
headView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
h
)];
// 添加分区头
headView
.
backgroundColor
=
DSClearColor
;
UIView
*
headView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
h
)];
UILabel
*
titleLab
=
[
UILabel
labWithText
:(
groupModel
.
taskType
==
TaskTypeDaily
?
@"每日任务"
:
@"新手任务"
)
font
:
BoldFont
(
16
.
0
)
fit
:
YES
];
headView
.
backgroundColor
=
DSClearColor
;
titleLab
.
textAlignment
=
NSTextAlignmentCenter
;
UILabel
*
titleLab
=
[
UILabel
labWithText
:(
section
==
1
?
@"每日任务"
:
@"新手任务"
)
font
:
BoldFont
(
16
.
0
)
fit
:
YES
];
titleLab
.
frame
=
CGRectMake
(
0
,
15
,
kScreenWidth
-
30
,
52
);
titleLab
.
textAlignment
=
NSTextAlignmentCenter
;
[
titleLab
setCornerRadiusRect
:(
UIRectCornerTopLeft
|
UIRectCornerTopRight
)
cornerRadius
:
24
.
0
];
titleLab
.
frame
=
CGRectMake
(
0
,
15
,
kScreenWidth
-
30
,
52
);
titleLab
.
dk_textColorPicker
=
DKColorPickerWithKey
(
Dk_TITLE
);
[
titleLab
setCornerRadiusRect
:(
UIRectCornerTopLeft
|
UIRectCornerTopRight
)
cornerRadius
:
24
.
0
];
titleLab
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
TabBarBG
);
titleLab
.
dk_textColorPicker
=
DKColorPickerWithKey
(
Dk_TITLE
);
[
headView
addSubview
:
titleLab
];
titleLab
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
TabBarBG
);
return
headView
;
[
headView
addSubview
:
titleLab
];
return
headView
;
}
}
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForFooterInSection
:(
NSInteger
)
section
{
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForFooterInSection
:(
NSInteger
)
section
{
CGFloat
h
=
section
==
2
?
(
24
+
Bottom_SafeArea_Height
)
:
0
.
001
;
CGFloat
h
=
(
section
==
self
.
taskListArr
.
count
-
1
)
?
(
24
+
Bottom_SafeArea_Height
)
:
0
.
001
;
return
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
10
,
h
)];
return
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
10
,
h
)];
}
}
...
@@ -215,15 +230,68 @@
...
@@ -215,15 +230,68 @@
_taskTableView
.
backgroundColor
=
DSClearColor
;
_taskTableView
.
backgroundColor
=
DSClearColor
;
_taskTableView
.
showsVerticalScrollIndicator
=
NO
;
_taskTableView
.
showsVerticalScrollIndicator
=
NO
;
_taskTableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
_taskTableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
_taskTableView
.
tableHeaderView
=
self
.
signTaskView
;
}
}
return
_taskTableView
;
return
_taskTableView
;
}
}
-
(
NSMutableArray
*
)
taskListArr
{
-
(
SignTaskView
*
)
signTaskView
{
if
(
!
_signTaskView
)
{
_signTaskView
=
[[
SignTaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
-
30
,
186
)];
}
return
_signTaskView
;
}
-
(
NSArray
*
)
taskListArr
{
if
(
!
_taskListArr
)
{
if
(
!
_taskListArr
)
{
_taskListArr
=
[
NS
Mutable
Array
array
];
_taskListArr
=
[
NSArray
array
];
}
}
return
_taskListArr
;
return
_taskListArr
;
}
}
#pragma mark - UIScrollViewDelegate
-
(
void
)
scrollViewDidScroll
:
(
UIScrollView
*
)
scrollView
{
CGFloat
offsetY
=
scrollView
.
contentOffset
.
y
;
if
(
scrollView
==
self
.
dtSrollView
)
{
CGFloat
maxOffsetY
=
self
.
bgHeight
-
self
.
coverHeight
;
if
(
offsetY
>=
maxOffsetY
)
{
scrollView
.
contentOffset
=
CGPointMake
(
0
,
maxOffsetY
);
self
.
vccanScroll
=
NO
;
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
didScrollToMaxOffsetY
:)])
{
[
self
.
delegate
didScrollToMaxOffsetY
:
YES
];
}
}
else
{
if
(
self
.
vccanScroll
==
NO
)
{
scrollView
.
contentOffset
=
CGPointMake
(
0
,
maxOffsetY
);
}
}
if
(
offsetY
<=
0
)
{
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
didScrollToMaxOffsetY
:)])
{
[
self
.
delegate
didScrollToMaxOffsetY
:
NO
];
}
}
}
else
if
(
scrollView
==
self
.
taskTableView
)
{
CGPoint
point
=
[
scrollView
.
panGestureRecognizer
translationInView
:
scrollView
];
CGFloat
taboffsetY
=
point
.
y
;
if
(
offsetY
<
0
)
{
self
.
vccanScroll
=
YES
;
}
if
(
taboffsetY
<
0
)
{
if
(
self
.
dtSrollView
.
contentOffset
.
y
<
self
.
bgHeight
-
self
.
coverHeight
)
{
self
.
taskTableView
.
contentOffset
=
CGPointZero
;
}
}
else
{
if
(
offsetY
>
0
)
{
self
.
dtSrollView
.
contentOffset
=
CGPointMake
(
0
,
self
.
bgHeight
-
self
.
coverHeight
);
}
else
if
(
offsetY
<
0
)
{
if
(
self
.
dtSrollView
.
contentOffset
.
y
>
0
&&
self
.
dtSrollView
.
contentOffset
.
y
<
self
.
bgHeight
-
self
.
coverHeight
)
{
self
.
taskTableView
.
contentOffset
=
CGPointZero
;
}
}
}
}
}
@end
@end
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/SignCollectionViewCell.m
查看文件 @
cbc7309
...
@@ -22,12 +22,14 @@
...
@@ -22,12 +22,14 @@
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
[
self
debugViewShowBorderWithColor
:[
UIColor
greenColor
]];
[
self
.
contentView
addSubview
:
self
.
dayView
];
[
self
.
contentView
addSubview
:
self
.
dayView
];
[
self
.
contentView
addSubview
:
self
.
giftIV
];
[
self
.
contentView
addSubview
:
self
.
giftIV
];
[
self
.
contentView
addSubview
:
self
.
scoreLab
];
[
self
.
contentView
addSubview
:
self
.
scoreLab
];
[
self
.
contentView
addSubview
:
self
.
doneIV
];
[
self
.
contentView
addSubview
:
self
.
doneIV
];
[
self
.
contentView
addSubview
:
self
.
dayLab
];
[
self
.
contentView
addSubview
:
self
.
line
];
[
self
.
contentView
addSubview
:
self
.
bigDot
];
[
self
.
contentView
addSubview
:
self
.
smallDot
];
[
self
.
dayView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
dayView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
left
.
equalTo
(
self
.
contentView
);
make
.
top
.
left
.
equalTo
(
self
.
contentView
);
...
@@ -40,6 +42,19 @@
...
@@ -40,6 +42,19 @@
make
.
centerX
.
equalTo
(
self
.
dayView
);
make
.
centerX
.
equalTo
(
self
.
dayView
);
make
.
bottom
.
equalTo
(
self
.
dayView
).
offset
(
-
6
);
make
.
bottom
.
equalTo
(
self
.
dayView
).
offset
(
-
6
);
}];
}];
[
self
.
dayLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
.
dayView
);
make
.
top
.
equalTo
(
self
.
dayView
.
mas_bottom
).
offset
(
18
);
}];
[
self
.
bigDot
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
.
dayView
);
make
.
centerY
.
equalTo
(
self
.
line
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
6
,
6
));
}];
[
self
.
smallDot
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
center
.
equalTo
(
self
.
bigDot
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
2
,
2
));
}];
}
}
return
self
;
return
self
;
}
}
...
@@ -66,6 +81,19 @@
...
@@ -66,6 +81,19 @@
}
else
{
// 已签到不显示礼物图标
}
else
{
// 已签到不显示礼物图标
self
.
giftIV
.
hidden
=
YES
;
self
.
giftIV
.
hidden
=
YES
;
}
}
// 动画效果
if
(
signModel
.
state
==
0
&&
(
requestModel
.
cur_day
==
3
||
requestModel
.
cur_day
==
7
))
{
CABasicAnimation
*
animation
=
[
CABasicAnimation
animationWithKeyPath
:
@"transform.scale"
];
animation
.
duration
=
2
.
0
;
animation
.
repeatCount
=
HUGE_VALF
;
animation
.
autoreverses
=
YES
;
animation
.
removedOnCompletion
=
NO
;
animation
.
fromValue
=
[
NSNumber
numberWithFloat
:
1
.
2
];
animation
.
toValue
=
[
NSNumber
numberWithFloat
:.
8
];
[
self
.
giftIV
.
layer
addAnimation
:
animation
forKey
:
@"scale-layer"
];
}
else
{
[
self
.
giftIV
.
layer
removeAllAnimations
];
}
// 积分显示
// 积分显示
if
(
signModel
.
state
==
0
&&
(
signModel
.
day
==
3
||
signModel
.
day
==
7
))
{
if
(
signModel
.
state
==
0
&&
(
signModel
.
day
==
3
||
signModel
.
day
==
7
))
{
...
@@ -75,13 +103,15 @@
...
@@ -75,13 +103,15 @@
}
}
self
.
scoreLab
.
text
=
[
NSString
stringWithFormat
:
@"+%d"
,
signModel
.
point
];
self
.
scoreLab
.
text
=
[
NSString
stringWithFormat
:
@"+%d"
,
signModel
.
point
];
self
.
scoreLab
.
font
=
signModel
.
state
==
1
?
SysFont
(
12
.
0
)
:
SysFont
(
14
.
0
);
self
.
scoreLab
.
font
=
signModel
.
state
==
1
?
SysFont
(
12
.
0
)
:
SysFont
(
14
.
0
);
[
self
.
scoreLab
sizeToFit
];
CGFloat
sH
=
[
NSString
getHeightWithText
:
self
.
scoreLab
.
text
withFont
:
self
.
scoreLab
.
font
withMaxWidth
:
30
];
[
self
.
scoreLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
scoreLab
mas_
re
makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
if
(
signModel
.
state
==
1
)
{
if
(
signModel
.
state
==
1
)
{
make
.
centerX
.
equalTo
(
self
.
dayView
);
make
.
centerX
.
equalTo
(
self
.
dayView
);
make
.
top
.
equalTo
(
self
.
dayView
).
offset
(
6
);
make
.
top
.
equalTo
(
self
.
dayView
).
offset
(
6
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
30
,
sH
));
}
else
{
}
else
{
make
.
center
.
equalTo
(
self
.
dayView
);
make
.
center
.
equalTo
(
self
.
dayView
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
30
,
sH
));
}
}
}];
}];
DKColorPicker
score_dk_text_color
=
is_cur_day
?
DKColorPickerWithColors
(
DSWhite
,
DkTitleColor
,
DSWhite
)
:
DKColorPickerWithColors
(
ColorFromHex
(
0xFC7032
),
ColorFromHex
(
0xFC7032
),
DSWhite
);
DKColorPicker
score_dk_text_color
=
is_cur_day
?
DKColorPickerWithColors
(
DSWhite
,
DkTitleColor
,
DSWhite
)
:
DKColorPickerWithColors
(
ColorFromHex
(
0xFC7032
),
ColorFromHex
(
0xFC7032
),
DSWhite
);
...
@@ -89,6 +119,34 @@
...
@@ -89,6 +119,34 @@
// 完成图标显示
// 完成图标显示
self
.
doneIV
.
hidden
=
signModel
.
state
==
0
;
self
.
doneIV
.
hidden
=
signModel
.
state
==
0
;
// 第几天显示
self
.
dayLab
.
text
=
requestModel
.
cur_day
==
signModel
.
day
?
@"今天"
:
[
NSString
stringWithFormat
:
@"第%d天"
,
signModel
.
day
];
DKColorPicker
day_dk_text_color
=
is_cur_day
?
DKColorPickerWithColors
(
ColorFromHex
(
0xFC7032
),
ColorFromHex
(
0xB5552E
),
DSWhite
)
:
DKColorPickerWithColors
(
SmallTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
3
),
DSWhite
);
self
.
dayLab
.
dk_textColorPicker
=
day_dk_text_color
;
// line
[
self
.
line
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
dayView
.
mas_bottom
).
offset
(
11
);
make
.
height
.
equalTo
(
@1
);
if
(
indexPath
.
row
==
0
)
{
make
.
left
.
equalTo
(
self
.
dayView
.
mas_centerX
);
make
.
right
.
equalTo
(
self
.
contentView
);
}
else
if
(
indexPath
.
row
==
requestModel
.
signList
.
count
-
1
)
{
make
.
left
.
equalTo
(
self
.
contentView
);
make
.
right
.
equalTo
(
self
.
dayView
.
mas_centerX
);
}
else
{
make
.
left
.
right
.
equalTo
(
self
.
contentView
);
}
}];
// 大圆点
DKColorPicker
big_dk_bg_color
=
is_cur_day
?
DKColorPickerWithColors
(
ColorFromHex
(
0xFC7032
),
ColorFromHex
(
0xB5552E
),
DSWhite
)
:
DKColorPickerWithColors
(
ColorFromHex
(
0xF6F6F6
),
ColorFromHex
(
0x1E2332
),
DSWhite
);
self
.
bigDot
.
dk_backgroundColorPicker
=
big_dk_bg_color
;
// 小圆点
DKColorPicker
small_dk_bg_color
=
is_cur_day
?
DKColorPickerWithColors
(
DSWhite
,
AlertDarkColor
,
DSWhite
)
:
DKColorPickerWithColors
(
ColorFromHex
(
0xDDDDDD
),
ColorFromHex
(
0x3B4258
),
DSWhite
);
self
.
smallDot
.
dk_backgroundColorPicker
=
small_dk_bg_color
;
}
}
#pragma mark - lazy
#pragma mark - lazy
...
@@ -123,4 +181,36 @@
...
@@ -123,4 +181,36 @@
return
_doneIV
;
return
_doneIV
;
}
}
-
(
UILabel
*
)
dayLab
{
if
(
!
_dayLab
)
{
_dayLab
=
[
UILabel
labWithFont
:
SysFont
(
12
.
0
)];
_dayLab
.
textAlignment
=
NSTextAlignmentCenter
;
}
return
_dayLab
;
}
-
(
UIView
*
)
line
{
if
(
!
_line
)
{
_line
=
[
UIView
new
];
_line
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
ColorFromHex
(
0xF6F6F6
),
ColorFromHex
(
0x1E2332
),
DSWhite
);
}
return
_line
;
}
-
(
UIView
*
)
bigDot
{
if
(
!
_bigDot
)
{
_bigDot
=
[
UIView
new
];
[
_bigDot
cornerRadius
:
3
.
0
];
}
return
_bigDot
;
}
-
(
UIView
*
)
smallDot
{
if
(
!
_smallDot
)
{
_smallDot
=
[
UIView
new
];
[
_smallDot
cornerRadius
:
1
.
0
];
}
return
_smallDot
;
}
@end
@end
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/SignTaskView.m
查看文件 @
cbc7309
...
@@ -47,7 +47,24 @@
...
@@ -47,7 +47,24 @@
}
}
-
(
void
)
signAction
{
-
(
void
)
signAction
{
[
ScoreTaskRequestModel
receiveUserDailySignPointWithCurDay
:
self
.
requestModel
.
cur_day
completion
:
^
(
ScoreTaskRequestModel
*
_Nonnull
requestModel
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
// 回调数据到DailyTaskView
// 更新按钮状态
[
self
.
signBtn
setTitle
:
@"已签到"
forState
:
UIControlStateNormal
];
self
.
signBtn
.
userInteractionEnabled
=
NO
;
// 刷新签到列表
self
.
requestModel
.
sign_flag
=
1
;
[
self
.
requestModel
.
signList
enumerateObjectsUsingBlock
:
^
(
SignModel
*
obj
,
NSUInteger
idx
,
BOOL
*
_Nonnull
stop
)
{
if
(
self
.
requestModel
.
cur_day
==
obj
.
day
)
{
obj
.
state
=
1
;
}
}];
[
self
.
signMainView
reloadData
];
}
}];
}
}
-
(
void
)
updateSignView
:
(
ScoreTaskRequestModel
*
)
requestModel
{
-
(
void
)
updateSignView
:
(
ScoreTaskRequestModel
*
)
requestModel
{
...
@@ -55,6 +72,9 @@
...
@@ -55,6 +72,9 @@
self
.
requestModel
=
requestModel
;
self
.
requestModel
=
requestModel
;
self
.
signList
=
requestModel
.
signList
;
self
.
signList
=
requestModel
.
signList
;
[
self
.
signMainView
reloadData
];
[
self
.
signMainView
reloadData
];
[
self
.
signBtn
setTitle
:(
requestModel
.
sign_flag
==
0
?
@"签到领积分"
:
@"已签到"
)
forState
:
UIControlStateNormal
];
self
.
signBtn
.
userInteractionEnabled
=
requestModel
.
sign_flag
==
0
;
}
}
}
}
...
@@ -100,6 +120,7 @@
...
@@ -100,6 +120,7 @@
-
(
UIButton
*
)
signBtn
{
-
(
UIButton
*
)
signBtn
{
if
(
!
_signBtn
)
{
if
(
!
_signBtn
)
{
_signBtn
=
[
UIButton
btnWithTitle
:
@"签到领积分"
font
:
BoldFont
(
16
)];
_signBtn
=
[
UIButton
btnWithTitle
:
@"签到领积分"
font
:
BoldFont
(
16
)];
_signBtn
.
userInteractionEnabled
=
NO
;
[
_signBtn
dk_setTitleColorPicker
:
DKColorPickerWithColors
(
DSWhite
,
DkTitleColor
,
DSWhite
)
forState
:
UIControlStateNormal
];
[
_signBtn
dk_setTitleColorPicker
:
DKColorPickerWithColors
(
DSWhite
,
DkTitleColor
,
DSWhite
)
forState
:
UIControlStateNormal
];
[
_signBtn
dk_setBackgroundColorPicker
:
DKColorPickerWithColors
(
ColorFromHex
(
0xFEA961
),
ColorFromHex
(
0xB77C4E
),
DSWhite
)];
[
_signBtn
dk_setBackgroundColorPicker
:
DKColorPickerWithColors
(
ColorFromHex
(
0xFEA961
),
ColorFromHex
(
0xB77C4E
),
DSWhite
)];
[
_signBtn
addTarget
:
self
action
:
@selector
(
signAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_signBtn
addTarget
:
self
action
:
@selector
(
signAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
...
...
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/TaskGroupModel.h
0 → 100644
查看文件 @
cbc7309
//
// TaskGroupModel.h
// DreamSleep
//
// Created by peter on 2022/6/30.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef
NS_ENUM
(
NSInteger
,
TaskType
)
{
TaskTypeDaily
,
// 每日任务
TaskTypeNew
,
// 新手任务
};
/// 每日任务和新手任务组数据
@interface
TaskGroupModel
:
NSObject
@property
(
nonatomic
,
assign
)
TaskType
taskType
;
@property
(
nonatomic
,
strong
)
NSArray
*
task_items
;
@property
(
nonatomic
,
strong
)
NSArray
*
task_news
;
+
(
instancetype
)
modelWithTaskType
:(
TaskType
)
taskType
taskArr
:(
NSArray
*
)
taskArr
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/TaskGroupModel.m
0 → 100644
查看文件 @
cbc7309
//
// TaskGroupModel.m
// DreamSleep
//
// Created by peter on 2022/6/30.
//
#import "TaskGroupModel.h"
@implementation
TaskGroupModel
+
(
instancetype
)
modelWithTaskType
:(
TaskType
)
taskType
taskArr
:(
NSArray
*
)
taskArr
{
TaskGroupModel
*
groupModel
=
[
TaskGroupModel
new
];
groupModel
.
taskType
=
taskType
;
if
(
taskType
==
TaskTypeDaily
)
{
groupModel
.
task_items
=
taskArr
;
}
else
if
(
taskType
==
TaskTypeNew
)
{
groupModel
.
task_news
=
taskArr
;
}
return
groupModel
;
}
@end
DreamSleep/DreamSleep/Resource/Assets.xcassets/.DS_Store
查看文件 @
cbc7309
此文件类型无法预览
DreamSleep/DreamSleep/Resource/Assets.xcassets/ScoreTask/.DS_Store
0 → 100644
查看文件 @
cbc7309
此文件类型无法预览
DreamSleep/Pods/Pods.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist
查看文件 @
cbc7309
...
@@ -7,12 +7,12 @@
...
@@ -7,12 +7,12 @@
<key>
AFNetworking.xcscheme_^#shared#^_
</key>
<key>
AFNetworking.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
3
</integer>
<integer>
1
5
</integer>
</dict>
</dict>
<key>
DKNightVersion.xcscheme_^#shared#^_
</key>
<key>
DKNightVersion.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
11
</integer>
<integer>
7
</integer>
</dict>
</dict>
<key>
DOUAudioStreamer.xcscheme_^#shared#^_
</key>
<key>
DOUAudioStreamer.xcscheme_^#shared#^_
</key>
<dict>
<dict>
...
@@ -22,12 +22,12 @@
...
@@ -22,12 +22,12 @@
<key>
FreeStreamer.xcscheme_^#shared#^_
</key>
<key>
FreeStreamer.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
0
</integer>
<integer>
1
8
</integer>
</dict>
</dict>
<key>
IQKeyboardManager.xcscheme_^#shared#^_
</key>
<key>
IQKeyboardManager.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
5
</integer>
<integer>
9
</integer>
</dict>
</dict>
<key>
MBProgressHUD.xcscheme_^#shared#^_
</key>
<key>
MBProgressHUD.xcscheme_^#shared#^_
</key>
<dict>
<dict>
...
@@ -37,47 +37,47 @@
...
@@ -37,47 +37,47 @@
<key>
MJRefresh.xcscheme_^#shared#^_
</key>
<key>
MJRefresh.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
8
</integer>
<integer>
1
4
</integer>
</dict>
</dict>
<key>
Masonry.xcscheme_^#shared#^_
</key>
<key>
Masonry.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
5
</integer>
<integer>
5
</integer>
</dict>
</dict>
<key>
Pods-DreamSleep.xcscheme_^#shared#^_
</key>
<key>
Pods-DreamSleep.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
7
</integer>
<integer>
19
</integer>
</dict>
</dict>
<key>
Reachability.xcscheme_^#shared#^_
</key>
<key>
Reachability.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
4
</integer>
<integer>
1
0
</integer>
</dict>
</dict>
<key>
YYCache.xcscheme_^#shared#^_
</key>
<key>
YYCache.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
16
</integer>
<integer>
4
</integer>
</dict>
</dict>
<key>
YYImage.xcscheme_^#shared#^_
</key>
<key>
YYImage.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
9
</integer>
<integer>
1
3
</integer>
</dict>
</dict>
<key>
YYModel.xcscheme_^#shared#^_
</key>
<key>
YYModel.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
17
</integer>
<integer>
8
</integer>
</dict>
</dict>
<key>
YYWebImage.xcscheme_^#shared#^_
</key>
<key>
YYWebImage.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
4
</integer>
<integer>
17
</integer>
</dict>
</dict>
<key>
lottie-ios.xcscheme_^#shared#^_
</key>
<key>
lottie-ios.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
8
</integer>
<integer>
11
</integer>
</dict>
</dict>
</dict>
</dict>
</dict>
</dict>
...
...
DreamSleep/TapiOS/Unity-iPhone.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist
查看文件 @
cbc7309
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<key>
UnityFramework.xcscheme_^#shared#^_
</key>
<key>
UnityFramework.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
9
</integer>
<integer>
16
</integer>
</dict>
</dict>
</dict>
</dict>
</dict>
</dict>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论