Commit f44682f1 cgx

完成积分明细

1 个父辈 95334adc
正在显示 33 个修改的文件 包含 803 行增加7 行删除
......@@ -113,6 +113,13 @@
D08F79E6281A198E000D99DD /* FeedImageCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D08F79E5281A198E000D99DD /* FeedImageCollectionCell.m */; };
D091BBB72808F9DA00487A50 /* BreathTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = D091BBB62808F9DA00487A50 /* BreathTextView.m */; };
D091BBBB2809079600487A50 /* NSString+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D091BBBA2809079600487A50 /* NSString+Extras.m */; };
D091E665283F0C4800D3279E /* ScoreTaskRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D091E664283F0C4800D3279E /* ScoreTaskRequestModel.m */; };
D091E668283F0E8800D3279E /* MyPointController.m in Sources */ = {isa = PBXBuildFile; fileRef = D091E667283F0E8800D3279E /* MyPointController.m */; };
D091E66B283F120100D3279E /* MyScoreModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D091E66A283F120100D3279E /* MyScoreModel.m */; };
D091E66E283F29D100D3279E /* ScoreDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D091E66D283F29D100D3279E /* ScoreDetailController.m */; };
D091E671283F2E6F00D3279E /* ScoreDetailListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D091E670283F2E6F00D3279E /* ScoreDetailListController.m */; };
D091E674283F5B4200D3279E /* ScoreDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D091E673283F5B4200D3279E /* ScoreDetailModel.m */; };
D091E677283F614900D3279E /* ScoreDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D091E676283F614900D3279E /* ScoreDetailCell.m */; };
D0930F122801124E006B497A /* BaseNaviController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0930F112801124E006B497A /* BaseNaviController.m */; };
D0930F1A2801874B006B497A /* UIViewController+Swizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = D0930F152801874B006B497A /* UIViewController+Swizzling.m */; };
D0930F1B2801874B006B497A /* UINavigationController+Pop.m in Sources */ = {isa = PBXBuildFile; fileRef = D0930F182801874B006B497A /* UINavigationController+Pop.m */; };
......@@ -409,6 +416,20 @@
D091BBB82809024100487A50 /* DreamSleepBeta.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DreamSleepBeta.entitlements; sourceTree = "<group>"; };
D091BBB92809079600487A50 /* NSString+Extras.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSString+Extras.h"; sourceTree = "<group>"; };
D091BBBA2809079600487A50 /* NSString+Extras.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSString+Extras.m"; sourceTree = "<group>"; };
D091E663283F0C4800D3279E /* ScoreTaskRequestModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScoreTaskRequestModel.h; sourceTree = "<group>"; };
D091E664283F0C4800D3279E /* ScoreTaskRequestModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScoreTaskRequestModel.m; sourceTree = "<group>"; };
D091E666283F0E8800D3279E /* MyPointController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyPointController.h; sourceTree = "<group>"; };
D091E667283F0E8800D3279E /* MyPointController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyPointController.m; sourceTree = "<group>"; };
D091E669283F120100D3279E /* MyScoreModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyScoreModel.h; sourceTree = "<group>"; };
D091E66A283F120100D3279E /* MyScoreModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyScoreModel.m; sourceTree = "<group>"; };
D091E66C283F29D100D3279E /* ScoreDetailController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScoreDetailController.h; sourceTree = "<group>"; };
D091E66D283F29D100D3279E /* ScoreDetailController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScoreDetailController.m; sourceTree = "<group>"; };
D091E66F283F2E6F00D3279E /* ScoreDetailListController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScoreDetailListController.h; sourceTree = "<group>"; };
D091E670283F2E6F00D3279E /* ScoreDetailListController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScoreDetailListController.m; sourceTree = "<group>"; };
D091E672283F5B4200D3279E /* ScoreDetailModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScoreDetailModel.h; sourceTree = "<group>"; };
D091E673283F5B4200D3279E /* ScoreDetailModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScoreDetailModel.m; sourceTree = "<group>"; };
D091E675283F614900D3279E /* ScoreDetailCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScoreDetailCell.h; sourceTree = "<group>"; };
D091E676283F614900D3279E /* ScoreDetailCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScoreDetailCell.m; sourceTree = "<group>"; };
D0930F102801124E006B497A /* BaseNaviController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNaviController.h; sourceTree = "<group>"; };
D0930F112801124E006B497A /* BaseNaviController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseNaviController.m; sourceTree = "<group>"; };
D0930F152801874B006B497A /* UIViewController+Swizzling.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+Swizzling.m"; sourceTree = "<group>"; };
......@@ -765,6 +786,7 @@
D0D3826428124E34005BB219 /* Feedback */,
D09D0E97280D4EEA008DEDAB /* SystemSet */,
D0D382682812660C005BB219 /* InviteFriend */,
D091E662283F0BD400D3279E /* ScoreTaskAI */,
);
path = ProfileModule;
sourceTree = "<group>";
......@@ -960,6 +982,27 @@
path = TZImagePickerController;
sourceTree = "<group>";
};
D091E662283F0BD400D3279E /* ScoreTaskAI */ = {
isa = PBXGroup;
children = (
D091E663283F0C4800D3279E /* ScoreTaskRequestModel.h */,
D091E664283F0C4800D3279E /* ScoreTaskRequestModel.m */,
D091E666283F0E8800D3279E /* MyPointController.h */,
D091E667283F0E8800D3279E /* MyPointController.m */,
D091E669283F120100D3279E /* MyScoreModel.h */,
D091E66A283F120100D3279E /* MyScoreModel.m */,
D091E672283F5B4200D3279E /* ScoreDetailModel.h */,
D091E673283F5B4200D3279E /* ScoreDetailModel.m */,
D091E675283F614900D3279E /* ScoreDetailCell.h */,
D091E676283F614900D3279E /* ScoreDetailCell.m */,
D091E66C283F29D100D3279E /* ScoreDetailController.h */,
D091E66D283F29D100D3279E /* ScoreDetailController.m */,
D091E66F283F2E6F00D3279E /* ScoreDetailListController.h */,
D091E670283F2E6F00D3279E /* ScoreDetailListController.m */,
);
path = ScoreTaskAI;
sourceTree = "<group>";
};
D0930F142801874B006B497A /* DSNavigationTools */ = {
isa = PBXGroup;
children = (
......@@ -1716,6 +1759,7 @@
D0A75108282E2A8500589B0E /* NoisePlayBar.m in Sources */,
D0C50B4627FD66FB00DC68F0 /* DSConstUtil.m in Sources */,
D08F79DC281A1838000D99DD /* TZProgressView.m in Sources */,
D091E66B283F120100D3279E /* MyScoreModel.m in Sources */,
D01BD428282C003900BA86B3 /* NoiseTypeModel.m in Sources */,
D01814D227FFCBAF00583D4E /* CWFlowLayout.m in Sources */,
D0D69ED3282360F100A0D5EB /* LookAllController.m in Sources */,
......@@ -1732,6 +1776,7 @@
D08F79E6281A198E000D99DD /* FeedImageCollectionCell.m in Sources */,
D07DACA52810557D0067A1BF /* RSKInternalUtility.m in Sources */,
D08F79E0281A1838000D99DD /* TZImagePickerController.m in Sources */,
D091E671283F2E6F00D3279E /* ScoreDetailListController.m in Sources */,
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */,
D0F9AC542826563400FD7A3B /* MusicPlayerController.m in Sources */,
......@@ -1749,6 +1794,7 @@
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */,
D09BF331280E570D00E5F06C /* UserModel.m in Sources */,
D0C50B4F27FD832300DC68F0 /* LeadView.m in Sources */,
D091E674283F5B4200D3279E /* ScoreDetailModel.m in Sources */,
D01BD425282BFFB400BA86B3 /* WhiteNoiseRequestModel.m in Sources */,
D0BE32E9281551EB006539BE /* ShareAlertView.m in Sources */,
D091BBBB2809079600487A50 /* NSString+Extras.m in Sources */,
......@@ -1760,9 +1806,11 @@
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */,
D049679D2834E1AB00FB81E5 /* ProfileHeaderView.m in Sources */,
D0FAC421281B817D00D4B859 /* GKPhotoView.m in Sources */,
D091E66E283F29D100D3279E /* ScoreDetailController.m in Sources */,
D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */,
D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */,
D0A72E39282B566200EED7BE /* HomeBasicCell.m in Sources */,
D091E665283F0C4800D3279E /* ScoreTaskRequestModel.m in Sources */,
D08F79DA281A1838000D99DD /* TZPhotoPreviewController.m in Sources */,
D01BD42B282C03FC00BA86B3 /* NoiseAudioModel.m in Sources */,
D01814EE28002DC700583D4E /* HeaderDataModel.m in Sources */,
......@@ -1790,6 +1838,7 @@
D01C9D6728167F9D00163567 /* InfoModifyAlertView.m in Sources */,
D0BB9AA728164DFB00DB209E /* NickNameController.m in Sources */,
D0E6F1FD28290128004150E5 /* TimingView.m in Sources */,
D091E677283F614900D3279E /* ScoreDetailCell.m in Sources */,
D08F79DF281A1838000D99DD /* TZPhotoPreviewCell.m in Sources */,
D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */,
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
......@@ -1803,6 +1852,7 @@
D0506B1828054ECD00229278 /* SafeHelperCollectionView.m in Sources */,
D04B3DC327F6F9390022F8DF /* HomeViewController.m in Sources */,
D0F9AC5E282660CC00FD7A3B /* MusicPlayerView.m in Sources */,
D091E668283F0E8800D3279E /* MyPointController.m in Sources */,
D08F79D7281A1838000D99DD /* TZAssetModel.m in Sources */,
D01C9D6F28168BFC00163567 /* WSDatePickerView.m in Sources */,
);
......
......@@ -66,7 +66,7 @@
[WKWebView deleteWebCache];
// 延迟的时间
int64_t delayInSeconds = 2.0;
int64_t delayInSeconds = 3.0;
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.aiWebView reload];
......
......@@ -12,6 +12,7 @@
#import "InviteController.h"
#import "ProfileAlertView.h"
#import "ProfileTableView.h"
#import "MyPointController.h"
@interface ProfileController () <ProfileTableViewDelegate>
@property (nonatomic, strong) UIImageView *bgIV;
......@@ -100,7 +101,7 @@
break;
case 2: // 我的积分
{
[self.navigationController pushViewController:[MyPointController new] animated:YES];
}
break;
case 3: // 开通AI
......
//
// MyPointController.h
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "DSNaviBarViewController.h"
NS_ASSUME_NONNULL_BEGIN
/// 我的积分页面
@interface MyPointController : DSNaviBarViewController
@end
NS_ASSUME_NONNULL_END
//
// MyPointController.m
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "MyPointController.h"
#import "ScoreTaskRequestModel.h"
#import "ScoreDetailController.h"
@interface MyPointController ()
@property (nonatomic, strong) UIImageView *headBgIV;
@property (nonatomic, strong) UIButton *scoreDetailBtn;
@end
@implementation MyPointController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = DSWhite;
self.naviBgColor = DSClearColor;
self.naviTitle = @"我的积分";
self.naviBarAlpha = 1.0;
self.titleLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite);
[self.dsNaviBar addSubview:self.backBtn];
[self.view insertSubview:self.headBgIV atIndex:0];
[self.headBgIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.view);
}];
[self.dsNaviBar addSubview:self.scoreDetailBtn];
[self.scoreDetailBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.dsNaviBar);
make.bottom.equalTo(self.dsNaviBar).offset(-7);
make.size.mas_equalTo(CGSizeMake(81, 26));
}];
[ScoreTaskRequestModel queryUserIntegralRankWithCompletion:^(ScoreTaskRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
}
}];
}
#pragma mark - Action
- (void)lookDetailAction {
ScoreDetailController *detailVC = [ScoreDetailController new];
[self.navigationController pushViewController:detailVC animated:YES];
}
#pragma mark - lazy
- (UIImageView *)headBgIV {
if (!_headBgIV) {
_headBgIV = [[UIImageView alloc] dk_initWithImagePicker:DKImagePickerWithNames(@"bj_jf_dingbu", @"dk_bj_jf_dingbu", @"dk_bj_jf_dingbu")];
}
return _headBgIV;
}
- (UIButton *)scoreDetailBtn {
if (!_scoreDetailBtn) {
_scoreDetailBtn = [UIButton btnWithTitle:@"积分明细" font:SysFont(12.0)];
[_scoreDetailBtn dk_setTitleColorPicker:DKColorPickerWithKey(Dk_TITLE) forState:UIControlStateNormal];
_scoreDetailBtn.layer.borderColor = _scoreDetailBtn.titleLabel.textColor.CGColor;
_scoreDetailBtn.layer.borderWidth = 1.0;
_scoreDetailBtn.layer.cornerRadius = 13.0;
_scoreDetailBtn.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMinXMaxYCorner;
[_scoreDetailBtn addTarget:self action:@selector(lookDetailAction) forControlEvents:UIControlEventTouchUpInside];
}
return _scoreDetailBtn;
}
@end
//
// MyScoreModel.h
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 我的积分数据model
@interface MyScoreModel : NSObject
/// 头部背景图
@property (nonatomic, copy) NSString *bg_up;
/// 等级名称
@property (nonatomic, copy) NSString *rank_name;
/// 积分规则说明
@property (nonatomic, strong) NSArray *rules;
/// 当前等级简称和最低积分
@property (nonatomic, copy) NSString *cur_rank;
/// 总积分
@property (nonatomic, assign) NSInteger total_points;
/// 内容背景
@property (nonatomic, copy) NSString *bg_down;
/// 奖牌图片
@property (nonatomic, copy) NSString *reward_img;
/// 当前等级最低积分
@property (nonatomic, assign) NSInteger cur_min_point;
/// 下一个等级简称和最低积分
@property (nonatomic, copy) NSString *next_rank;
/// 下一等级最低积分
@property (nonatomic, assign) NSInteger next_min_point;
@end
NS_ASSUME_NONNULL_END
//
// MyScoreModel.m
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "MyScoreModel.h"
@implementation MyScoreModel
@end
//
// ScoreDetailCell.h
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import <UIKit/UIKit.h>
#import "ScoreDetailModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 积分明细cell
@interface ScoreDetailCell : UITableViewCell
@property (nonatomic, strong) ScoreDetailModel *model;
@end
NS_ASSUME_NONNULL_END
//
// ScoreDetailCell.m
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "ScoreDetailCell.h"
@interface ScoreDetailCell ()
@property (nonatomic, strong) UILabel *itemNameLab;
@property (nonatomic, strong) UILabel *taskDateLab;
@property (nonatomic, strong) UILabel *pointsLab;
@end
@implementation ScoreDetailCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.backgroundColor = DSClearColor;
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.itemNameLab];
[self.contentView addSubview:self.taskDateLab];
[self.contentView addSubview:self.pointsLab];
}
return self;
}
- (void)setModel:(ScoreDetailModel *)model {
_model = model;
self.itemNameLab.text = model.item_name;
self.taskDateLab.text = model.task_date;
self.pointsLab.text = [NSString stringWithFormat:@"+%d", model.points];
[self.itemNameLab sizeToFit];
[self.taskDateLab sizeToFit];
[self.pointsLab sizeToFit];
[self.itemNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(15);
make.top.equalTo(self.contentView).offset(24);
}];
[self.taskDateLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.itemNameLab);
make.top.equalTo(self.itemNameLab.mas_bottom).offset(8);
}];
[self.pointsLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.itemNameLab).offset(13);
make.right.equalTo(self.contentView).offset(-15);
}];
}
#pragma mark - lazy
- (UILabel *)itemNameLab {
if (!_itemNameLab) {
_itemNameLab = [UILabel labWithFont:BoldFont(15.0)];
_itemNameLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
}
return _itemNameLab;
}
- (UILabel *)taskDateLab {
if (!_taskDateLab) {
_taskDateLab = [UILabel labWithFont:SysFont(12.0)];
_taskDateLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHexA(0xFFFFFF, .3));
}
return _taskDateLab;
}
- (UILabel *)pointsLab {
if (!_pointsLab) {
_pointsLab = [UILabel labWithFont:SysFont(15.0)];
_pointsLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
_pointsLab.textAlignment = NSTextAlignmentRight;
}
return _pointsLab;
}
@end
//
// ScoreDetailController.h
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 积分明细页面
@interface ScoreDetailController : UIViewController
@end
NS_ASSUME_NONNULL_END
//
// ScoreDetailController.m
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "ScoreDetailController.h"
#import "ScoreDetailListController.h"
@interface ScoreDetailController () <UIScrollViewDelegate>
@property (nonatomic, strong) UIView *headView;
@property (nonatomic, strong) UIScrollView *bodyView;
@end
@implementation ScoreDetailController {
UIView *_indicatorView;
NSArray *_btns;
NSInteger _selectedIndex;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.navigationItem.title = @"积分明细";
[self.view addSubview:self.headView];
[self.view addSubview:self.bodyView];
}
#pragma mark - 导航栏日间、黑夜模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
}
#pragma mark - 关闭侧滑
- (BOOL)enableInteractivePopGestureRecognizer {
return NO;
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
NSInteger index = scrollView.contentOffset.x / scrollView.width;
_selectedIndex = index;
[self adjustUI];
}
#pragma mark - Actions
- (void)adjustUI {
for (UIButton *btn in _btns) {
if (_selectedIndex == btn.tag) {
[btn.titleLabel setFont:BoldFont(16)];
[btn dk_setTitleColorPicker:DKColorPickerWithColors(MainTextColor, ColorFromHex(0xE8E9E9), DSWhite) forState:UIControlStateNormal];
} else {
[btn.titleLabel setFont:SysFont(15)];
[btn dk_setTitleColorPicker:DKColorPickerWithColors(ColorFromHexA(0x333333, .49), ColorFromHex(0x7A7F8E), DSWhite) forState:UIControlStateNormal];
}
}
UIButton *selectedBtn = _btns[_selectedIndex];
[UIView animateWithDuration:.3 animations:^{
self->_indicatorView.width = selectedBtn.width;
self->_indicatorView.centerX = selectedBtn.centerX;
[self->_bodyView setContentOffset:CGPointMake(self->_selectedIndex * self->_bodyView.width, 0)];
}];
}
- (void)addSubControllerView {
ScoreDetailListController *todayList = [[ScoreDetailListController alloc] initWithQueryType:0];
todayList.view.frame = CGRectMake(0, 0, kScreenWidth, self.bodyView.height);
[self.bodyView addSubview:todayList.view];
[self addChildViewController:todayList];
ScoreDetailListController *threeList = [[ScoreDetailListController alloc] initWithQueryType:1];
threeList.view.frame = CGRectMake(kScreenWidth, 0, kScreenWidth, self.bodyView.height);
[self.bodyView addSubview:threeList.view];
[self addChildViewController:threeList];
ScoreDetailListController *weekList = [[ScoreDetailListController alloc] initWithQueryType:2];
weekList.view.frame = CGRectMake(2*kScreenWidth, 0, kScreenWidth, self.bodyView.height);
[self.bodyView addSubview:weekList.view];
[self addChildViewController:weekList];
}
- (void)switchViewControllerAction:(UIButton *)sender {
_selectedIndex = sender.tag;
[self adjustUI];
}
#pragma mark - lazy
- (UIView *)headView {
if (!_headView) {
_headView = [[UIView alloc] initWithFrame:CGRectMake(23, 0, kScreenWidth - 46, 40)];
_indicatorView = [[UIView alloc] initWithFrame:CGRectMake(0, _headView.height - 8, 0, 4)];
_indicatorView.backgroundColor = BrandColor;
[_headView addSubview:_indicatorView];
NSArray *titles = @[@"今日", @"近3日", @"近1周"];
NSMutableArray *tmpArr = [NSMutableArray array];
CGFloat width = 0;
for (int i = 0; i < 3; i++) {
UIButton *btn = [self btnWithTitle:titles[i] font:BoldFont(16) tag:i sView:_headView];
[btn sizeToFit];
CGFloat x = i*33 + width;
width += btn.width;
btn.frame = CGRectMake(x, _headView.height - btn.height, btn.width, btn.height);
[tmpArr addObject:btn];
}
_btns = [tmpArr copy];
_selectedIndex = 0;
[self adjustUI];
}
return _headView;
}
- (UIButton *)btnWithTitle:(NSString *)title font:(UIFont *)font tag:(NSInteger)tag sView:(UIView *)sView {
UIButton *btn = [UIButton btnWithTitle:title font:font];
btn.tag = tag;
[btn sizeToFit];
[btn addTarget:self action:@selector(switchViewControllerAction:) forControlEvents:UIControlEventTouchUpInside];
[sView addSubview:btn];
return btn;
}
- (UIScrollView *)bodyView {
if (!_bodyView) {
_bodyView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_headView.frame), kScreenWidth, kScreenHeight - kTopHeight(0) - _headView.height)];
_bodyView.contentSize = CGSizeMake(3 * kScreenWidth, _bodyView.height);
_bodyView.pagingEnabled = YES;
_bodyView.showsHorizontalScrollIndicator = NO;
_bodyView.delegate = self;
[_bodyView setContentOffset:CGPointMake(_selectedIndex * _bodyView.width, 0)];
[self addSubControllerView];
}
return _bodyView;
}
@end
//
// ScoreDetailListController.h
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 积分列表页面
@interface ScoreDetailListController : UIViewController
- (instancetype)initWithQueryType:(int)queryType;
@end
NS_ASSUME_NONNULL_END
//
// ScoreDetailListController.m
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "ScoreDetailListController.h"
#import "ScoreTaskRequestModel.h"
#import "ScoreDetailCell.h"
@interface ScoreDetailListController () <UITableViewDelegate>
@property (nonatomic, strong) UITableView *detailListView;
@property (nonatomic, strong) DSDataSource *dataSource;
@end
@implementation ScoreDetailListController {
int _queryType;
int _offset;
NSArray *_listArr;
}
- (instancetype)initWithQueryType:(int)queryType {
if (self = [super init]) {
_queryType = queryType;
_offset = 1;
_listArr = @[];
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self.dataSource addDataArray:@[]];
self.detailListView.mj_header = [DSGifHeader headerWithRefreshingBlock:^{
[self requestData];
}];
[self.detailListView.mj_header beginRefreshing];
self.detailListView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMore)];
}
#pragma mark - 下拉刷新
- (void)requestData {
_offset = 1;
NSDictionary *params = @{@"query_type" : @(_queryType),
@"offset" : @(_offset)
};
[ScoreTaskRequestModel queryUserPointsDetailListWithParams:params completion:^(ScoreTaskRequestModel * _Nonnull requestModel) {
[self.detailListView.mj_header endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
if (requestModel.pointList.count > 0) {
self->_offset++;
[self.dataSource addDataArray:requestModel.pointList];
[self.detailListView reloadData];
}
}
}];
}
#pragma mark - 上拉刷新
- (void)loadMore {
NSDictionary *params = @{@"query_type" : @(_queryType),
@"offset" : @(_offset)
};
[ScoreTaskRequestModel queryUserPointsDetailListWithParams:params completion:^(ScoreTaskRequestModel * _Nonnull requestModel) {
[self.detailListView.mj_footer endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
if (requestModel.pointList.count > 0) {
self->_offset++;
NSMutableArray *tmpArr = [NSMutableArray array];
[tmpArr addObjectsFromArray:self->_listArr];
[tmpArr addObjectsFromArray:requestModel.pointList];
[self.dataSource addDataArray:[tmpArr copy]];
[self.detailListView reloadData];
}
}
}];
}
#pragma mark - 关闭侧滑
- (BOOL)enableInteractivePopGestureRecognizer {
return NO;
}
#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 70;
}
#pragma mark - lazy
- (DSDataSource *)dataSource {
if (!_dataSource) {
CellConfigureBlock cellBlock = ^(ScoreDetailCell * cell, ScoreDetailModel * model, NSIndexPath * indexPath) {
cell.model = model;
};
_dataSource = [[DSDataSource alloc] initWithIdentifier:NSStringFromClass([ScoreDetailCell class]) datas:@[] isSection:NO configureBlock:cellBlock];
UITableView *detailListView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
detailListView.separatorStyle = UITableViewCellSeparatorStyleNone;
detailListView.dataSource = _dataSource;
detailListView.showsVerticalScrollIndicator = NO;
detailListView.backgroundColor = DSClearColor;
detailListView.delegate = self;
[detailListView registerClass:[ScoreDetailCell class] forCellReuseIdentifier:NSStringFromClass([ScoreDetailCell class])];
[self.view addSubview:detailListView];
self.detailListView = detailListView;
[self.detailListView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
}
return _dataSource;
}
@end
//
// ScoreDetailModel.h
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 积分明细数据model
@interface ScoreDetailModel : NSObject
/// 任务名称
@property (nonatomic, copy) NSString *item_name;
/// 日期
@property (nonatomic, copy) NSString *task_date;
/// 积分数
@property (nonatomic, assign) int points;
@end
NS_ASSUME_NONNULL_END
//
// ScoreDetailModel.m
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "ScoreDetailModel.h"
@implementation ScoreDetailModel
@end
//
// ScoreTaskRequestModel.h
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "DSNetworkTool.h"
#import "MyScoreModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 任务积分请求数据接口
@interface ScoreTaskRequestModel : DSNetworkTool
/// 我的积分数据
@property (nonatomic, strong) MyScoreModel *scoreModel;
/// 积分明细列表数据
@property (nonatomic, strong) NSArray *pointList;
/// 我的积分等级接口
/// @param completion completion
+ (NSURLSessionDataTask *)queryUserIntegralRankWithCompletion:(void (^)(ScoreTaskRequestModel *requestModel))completion;
/// 每日任务-查询用户积分明细
/// @param params params
/// @param completion completion
+ (NSURLSessionDataTask *)queryUserPointsDetailListWithParams:(NSDictionary *)params completion:(void (^)(ScoreTaskRequestModel *requestModel))completion;
@end
NS_ASSUME_NONNULL_END
//
// ScoreTaskRequestModel.m
// DreamSleep
//
// Created by peter on 2022/5/26.
//
#import "ScoreTaskRequestModel.h"
#import "ScoreDetailModel.h"
@implementation ScoreTaskRequestModel
+ (NSURLSessionDataTask *)queryUserIntegralRankWithCompletion:(void (^)(ScoreTaskRequestModel *requestModel))completion {
NSString *api = @"query_user_integral_rank";
NSString *argStr = [NSString stringWithFormat:@"query{%@}", api];
ScoreTaskRequestModel * requestModel = [[ScoreTaskRequestModel alloc] init];
return [self httpPostBodyRequestWithAPI:api params:@{@"query" : argStr} view:nil hasNetActivity:YES loadingInfo:nil hasFailInfo:YES success:^(NSDictionary *apiDic) {
DSLog(@"我的积分等级接口dataDic:%@", apiDic);
requestModel.resCode = DSResCodeSuccess;
NSDictionary *resultDic = apiDic[@"result"];
MyScoreModel *scoreModel = [MyScoreModel yy_modelWithDictionary:resultDic];
requestModel.scoreModel = scoreModel;
completion(requestModel);
} failure:^(id failure) {
requestModel.resCode = DSResCodeNetFail;
requestModel.errorInfo = failure;
completion(requestModel);
}];
}
+ (NSURLSessionDataTask *)queryUserPointsDetailListWithParams:(NSDictionary *)params completion:(void (^)(ScoreTaskRequestModel *requestModel))completion {
NSString *api = @"query_user_points_detail_list";
NSString *argStr = [NSString stringWithFormat:@"query{%@(query_type:%d,offset:%d)}", api, [params[@"query_type"] intValue], [params[@"offset"] intValue]];
ScoreTaskRequestModel * requestModel = [[ScoreTaskRequestModel alloc] init];
return [self httpPostBodyRequestWithAPI:api params:@{@"query" : argStr} view:nil hasNetActivity:YES loadingInfo:nil hasFailInfo:YES success:^(NSDictionary *apiDic) {
DSLog(@"每日任务-查询用户积分明细接口dataDic:%@", apiDic);
requestModel.resCode = DSResCodeSuccess;
NSArray *resultArr = apiDic[@"result"];
NSMutableArray *tmpArr = [NSMutableArray array];
for (int i = 0; i < resultArr.count; i++) {
ScoreDetailModel *detailModel = [ScoreDetailModel yy_modelWithDictionary:resultArr[i]];
[tmpArr addObject:detailModel];
}
requestModel.pointList = [tmpArr copy];
completion(requestModel);
} failure:^(id failure) {
requestModel.resCode = DSResCodeNetFail;
requestModel.errorInfo = failure;
completion(requestModel);
}];
}
@end
......@@ -11,12 +11,20 @@ NS_ASSUME_NONNULL_BEGIN
/// 自定义导航栏基类
@interface DSNaviBarViewController : UIViewController
/// 自定义导航栏
@property (nonatomic, strong) UIView *dsNaviBar;
/// 导航栏title
@property (nonatomic, strong) UILabel *titleLab;
/// 返回按钮
@property (nonatomic, strong) UIButton *backBtn;
/// 导航栏标题
@property (nonatomic, copy) NSString *naviTitle;
/// 导航栏透明度
@property (nonatomic, assign) CGFloat naviBarAlpha;
/// 是否需要更新状态栏风格
@property (nonatomic, assign) BOOL isNeedUpdateStatusBarStyle;
/// 导航栏背景色
@property (nonatomic, strong) UIColor *naviBgColor;
@end
NS_ASSUME_NONNULL_END
......@@ -8,10 +8,6 @@
#import "DSNaviBarViewController.h"
@interface DSNaviBarViewController ()
/// 自定义导航栏
@property (nonatomic, strong) UIView *dsNaviBar;
/// 导航栏title
@property (nonatomic, strong) UILabel *titleLab;
@end
@implementation DSNaviBarViewController
......@@ -19,7 +15,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addSubview:self.dsNaviBar];
[self.view insertSubview:self.dsNaviBar atIndex:99];
}
- (void)setNaviTitle:(NSString *)naviTitle {
......@@ -38,6 +34,11 @@
[self setNeedsStatusBarAppearanceUpdate];
}
- (void)setNaviBgColor:(UIColor *)naviBgColor {
_naviBgColor = naviBgColor;
self.dsNaviBar.backgroundColor = naviBgColor;
}
#pragma mark - 隐藏系统导航栏
- (BOOL)isShowNavigationBar {
return YES;
......@@ -61,6 +62,12 @@
// }
//}
- (void)backAction {
if (self.navigationController.viewControllers.count > 0) {
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark - lazy
- (UIView *)dsNaviBar {
if (!_dsNaviBar) {
......@@ -85,4 +92,13 @@
return _titleLab;
}
- (UIButton *)backBtn {
if (!_backBtn) {
_backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, 40, 40)];
[_backBtn dk_setImage:DKImagePickerWithNames(@"cus_back_icon", @"dk_cus_back_icon", @"dk_cus_back_icon") forState:UIControlStateNormal];
[_backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backBtn;
}
@end
{
"images" : [
{
"filename" : "bg_card_jifen.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "bg_card_jifen@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "bg_card_jifen@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "bg_jf_dingbu.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "bg_jf_dingbu@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "bg_jf_dingbu@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "dk_bj_jf_dingbu.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_bj_jf_dingbu@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_bj_jf_dingbu@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -9,6 +9,8 @@ NORMAL NIGHT RED
#333333 #FFFFFF #000000 TEXT
#AAAAAA #FFFFFF #000000 SubTEXT
#FFFFFF #333333 #000000 APPLE_TEXT
#333333 #E8E9E9 #000000 Dk_TITLE
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!