Commit 68ee5ebe cgx

完成测评列表

1 个父辈 b89de40f
......@@ -207,6 +207,8 @@
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE7A2817D13400230DC6 /* UITableViewCell+CardRadius.m */; };
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE7E2817DD1500230DC6 /* MyFeedCell.m */; };
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE802817DD1500230DC6 /* MyFeedListController.m */; };
D0B0B4D429092D3500FBE6E2 /* EvaluateCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0B0B4D329092D3500FBE6E2 /* EvaluateCell.m */; };
D0B0B4D729092D6200FBE6E2 /* EvaluateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0B0B4D629092D6200FBE6E2 /* EvaluateModel.m */; };
D0B1124A28631D8C00A496FB /* DSSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = D0B1124928631D8C00A496FB /* DSSlider.m */; };
D0B5ECA627F2D9DE003EDFE3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D0B5ECA527F2D9DE003EDFE3 /* AppDelegate.m */; };
D0B5ECAF27F2D9DE003EDFE3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D0B5ECAD27F2D9DE003EDFE3 /* Main.storyboard */; };
......@@ -724,6 +726,10 @@
D0AEFE7E2817DD1500230DC6 /* MyFeedCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyFeedCell.m; sourceTree = "<group>"; };
D0AEFE7F2817DD1500230DC6 /* MyFeedListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyFeedListController.h; sourceTree = "<group>"; };
D0AEFE802817DD1500230DC6 /* MyFeedListController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyFeedListController.m; sourceTree = "<group>"; };
D0B0B4D229092D3500FBE6E2 /* EvaluateCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EvaluateCell.h; sourceTree = "<group>"; };
D0B0B4D329092D3500FBE6E2 /* EvaluateCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EvaluateCell.m; sourceTree = "<group>"; };
D0B0B4D529092D6200FBE6E2 /* EvaluateModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EvaluateModel.h; sourceTree = "<group>"; };
D0B0B4D629092D6200FBE6E2 /* EvaluateModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EvaluateModel.m; sourceTree = "<group>"; };
D0B1124828631D8C00A496FB /* DSSlider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DSSlider.h; sourceTree = "<group>"; };
D0B1124928631D8C00A496FB /* DSSlider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSSlider.m; sourceTree = "<group>"; };
D0B5ECA127F2D9DE003EDFE3 /* 小梦睡眠-Dev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "小梦睡眠-Dev.app"; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -1912,6 +1918,10 @@
D0A3BB8E28D95A0200F58781 /* Evaluate */ = {
isa = PBXGroup;
children = (
D0B0B4D229092D3500FBE6E2 /* EvaluateCell.h */,
D0B0B4D329092D3500FBE6E2 /* EvaluateCell.m */,
D0B0B4D529092D6200FBE6E2 /* EvaluateModel.h */,
D0B0B4D629092D6200FBE6E2 /* EvaluateModel.m */,
D0A3BB9728D9B76C00F58781 /* EvaluateController.h */,
D0A3BB9828D9B76C00F58781 /* EvaluateController.m */,
D0A3BB9A28D9BA3500F58781 /* EvaluateRequestModel.h */,
......@@ -3047,6 +3057,7 @@
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */,
D0B836F828F1232F006E76C0 /* ComReplyModel.m in Sources */,
D0B0B4D429092D3500FBE6E2 /* EvaluateCell.m in Sources */,
D0A72E3F282B89AD00EED7BE /* DSHomeView.m in Sources */,
D01814E8280020F900583D4E /* CWPageControl.m in Sources */,
D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */,
......@@ -3057,6 +3068,7 @@
D0A7510E282E2FEF00589B0E /* NoisePlayView.m in Sources */,
D0E41B602851E0F6005A7DA4 /* ShareItem.m in Sources */,
D0506B1828054ECD00229278 /* SafeHelperCollectionView.m in Sources */,
D0B0B4D729092D6200FBE6E2 /* EvaluateModel.m in Sources */,
D0E41B5D2851E0D1005A7DA4 /* ShareRequestModel.m in Sources */,
D078281F28FE953A00C8D612 /* OfficialNotiModel.m in Sources */,
D04B3DC327F6F9390022F8DF /* HomeViewController.m in Sources */,
......@@ -3221,7 +3233,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
......@@ -3304,7 +3316,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO;
......@@ -3447,7 +3459,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
......
......@@ -17,6 +17,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 加载H5页面控制器(二级页面)
@interface DsWebController : UIViewController
/// 是否支持侧滑
@property (nonatomic, assign) BOOL enableInteractivePop;
@property (nonatomic, weak) id<DsWebControllerDelegate> refreshDelegate;
/// 初始化方法
......
......@@ -330,7 +330,7 @@
#pragma mark - 关闭侧滑
- (BOOL)enableInteractivePopGestureRecognizer {
return NO;
return self.enableInteractivePop;
}
#pragma mark - 隐藏导航栏
......
//
// EvaluateCell.h
// DreamSleep
//
// Created by peter on 2022/10/26.
//
#import "BaseTableViewCell.h"
#import "EvaluateModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface EvaluateCell : BaseTableViewCell
@property (nonatomic, strong) EvaluateModel *evaluateModel;
@end
NS_ASSUME_NONNULL_END
//
// EvaluateCell.m
// DreamSleep
//
// Created by peter on 2022/10/26.
//
#import "EvaluateCell.h"
@interface EvaluateCell ()
@property (nonatomic, strong) UIImageView *coverIV;
@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UILabel *descLab;
@property (nonatomic, strong) UILabel *countLab;
@property (nonatomic, strong) UIButton *startBtn;
@end
@implementation EvaluateCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self.contentView addSubview:self.coverIV];
[self.contentView addSubview:self.titleLab];
[self.contentView addSubview:self.descLab];
[self.contentView addSubview:self.countLab];
[self.contentView addSubview:self.startBtn];
[self.coverIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.equalTo(self.contentView).offset(15);
make.size.mas_equalTo(CGSizeMake(76, 90));
}];
[self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.coverIV);
make.left.equalTo(self.coverIV.mas_right).offset(12);
make.right.equalTo(self.contentView).offset(-15);
}];
[self.descLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView).offset(45);
make.left.equalTo(self.titleLab);
make.right.equalTo(self.titleLab);
}];
[self.countLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView);
make.left.equalTo(self.titleLab);
make.right.equalTo(self.startBtn.mas_left).offset(-10);
}];
[self.startBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView);
make.right.equalTo(self.contentView).offset(-15);
}];
}
return self;
}
- (void)setEvaluateModel:(EvaluateModel *)evaluateModel {
_evaluateModel = evaluateModel;
[self.coverIV yy_setImageWithURL:[NSURL URLWithString:evaluateModel.cover_img] placeholder:[UIImage defaultPlaceholderWithSize:CGSizeMake(76, 90)]];
self.titleLab.text = evaluateModel.title;
self.descLab.text = evaluateModel.cover_desc;
self.countLab.text = [NSString stringWithFormat:@"%@道题", evaluateModel.total_subjects];
}
#pragma mark - lazy
- (UIImageView *)coverIV {
if (!_coverIV) {
_coverIV = [UIImageView new];
_coverIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1, .5, 1);
_coverIV.contentMode = UIViewContentModeScaleAspectFit;
[_coverIV cornerRadius:12];
}
return _coverIV;
}
- (UILabel *)titleLab {
if (!_titleLab) {
_titleLab = [UILabel labWithFont:BoldFont(16)];
_titleLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
}
return _titleLab;
}
- (UILabel *)descLab {
if (!_descLab) {
_descLab = [UILabel labWithFont:SysFont(14)];
_descLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, ColorFromHexA(0xFFFFFF, .5), DSWhite);
}
return _descLab;
}
- (UILabel *)countLab {
if (!_countLab) {
_countLab = [UILabel labWithFont:SysFont(12)];
_countLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHexA(0xFFFFFF, .3), DSWhite);
}
return _countLab;
}
- (UIButton *)startBtn {
if (!_startBtn) {
_startBtn = [UIButton btnWithTitle:@"开始测试" font:BoldFont(16)];
_startBtn.size = (CGSizeMake(96, 34));
_startBtn.userInteractionEnabled = NO;
[_startBtn dk_setTitleColorPicker:DKColorPickerWithKey(Sub_Navi_TITLE) forState:UIControlStateNormal];
[_startBtn cornerRadius:17];
CGPoint start = CGPointMake(0, 0.5);
CGPoint end = CGPointMake(0.5, 0.5);
UIView *normal_tmp_view = [_startBtn genGradientWithStart:start end:end colors:@[(__bridge id)ColorFromHex(0x9BE3EC).CGColor, (__bridge id)ColorFromHex(0x62C3D5).CGColor] locations:@[@(0), @(1.0f)]];
UIView *dk_tmp_view = [_startBtn genGradientWithStart:start end:end colors:@[(__bridge id)ColorFromHex(0x77A6AE).CGColor, (__bridge id)ColorFromHex(0x45A4B5).CGColor] locations:@[@(0), @(1.0f)]];
[_startBtn dk_setBackgroundImage:DKImagePickerWithImages([normal_tmp_view snapshotImage], [dk_tmp_view snapshotImage], [normal_tmp_view snapshotImage]) forState:UIControlStateNormal];
}
return _startBtn;
}
@end
......@@ -7,9 +7,11 @@
#import "EvaluateController.h"
#import "EvaluateRequestModel.h"
#import "EvaluateCell.h"
@interface EvaluateController ()
@interface EvaluateController () <UITableViewDelegate>
@property (nonatomic, strong) DSDataSource *dataSource;
@property (nonatomic, strong) UITableView *evaluateListView;
@end
@implementation EvaluateController
......@@ -17,16 +19,72 @@
- (void)viewDidLoad {
[super viewDidLoad];
#warning --- 人气测评待开发...
self.navigationItem.title = @"人气测评";
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self.dataSource addDataArray:@[]];
[self.evaluateListView.mj_header beginRefreshing];
}
- (void)getEvaluateListData {
[EvaluateRequestModel queryCommunityEvaluationListWithCompletion:^(EvaluateRequestModel * _Nonnull requestModel) {
[self.evaluateListView.mj_header endRefreshing];
if (requestModel.resCode == DSResCodeSuccess) {
if (requestModel.listArr.count == 0) {
[self updateDefalutView:DefaultTypeEmpty info:@""];
} else {
[self.dataSource addDataArray:requestModel.listArr];
}
[self.evaluateListView reloadData];
} else {
[self updateDefalutView:DefaultTypeNet info:requestModel.errMessage];
}
}];
[DataStatisticsUtil event:AccessEvaluationList attributes:@{}];
}
#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 105;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
EvaluateModel *model = self.dataSource.dataArray[indexPath.row];
DsWebController *webVC = [[DsWebController alloc] initWithLink:model.redirect_url isShowNavi:NO];
webVC.enableInteractivePop = YES;
[self.navigationController pushViewController:webVC animated:YES];
}
#pragma mark - lazy
- (DSDataSource *)dataSource {
if (!_dataSource) {
CellConfigureBlock cellBlock = ^(EvaluateCell * cell, EvaluateModel * model, NSIndexPath * indexPath) {
cell.evaluateModel = model;
};
_dataSource = [[DSDataSource alloc] initWithIdentifier:NSStringFromClass([EvaluateCell class]) datas:@[] isSection:NO configureBlock:cellBlock];
UITableView *listView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
listView.separatorStyle = UITableViewCellSeparatorStyleNone;
listView.delegate = self;
listView.dataSource = _dataSource;
listView.showsVerticalScrollIndicator = NO;
listView.backgroundColor = DSClearColor;
listView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
[listView registerClass:[EvaluateCell class] forCellReuseIdentifier:NSStringFromClass([EvaluateCell class])];
listView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 24 + Bottom_SafeArea_Height)];
[self.view addSubview:listView];
self.evaluateListView = listView;
[self.evaluateListView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
WS(weakSelf);
self.evaluateListView.mj_header = [DSGifHeader headerWithRefreshingBlock:^{
[weakSelf getEvaluateListData];
}];
}
return _dataSource;
}
@end
//
// EvaluateModel.h
// DreamSleep
//
// Created by peter on 2022/10/26.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface EvaluateModel : NSObject
/// 评测id
@property (nonatomic, assign) int evaID;
/// 封面
@property (nonatomic, copy) NSString *cover_img;
/// 测评标题
@property (nonatomic, copy) NSString *title;
/// 描述
@property (nonatomic, copy) NSString *cover_desc;
/// 测评总题目数
@property (nonatomic, copy) NSString *total_subjects;
/// 详情url
@property (nonatomic, copy) NSString *redirect_url;
@end
NS_ASSUME_NONNULL_END
//
// EvaluateModel.m
// DreamSleep
//
// Created by peter on 2022/10/26.
//
#import "EvaluateModel.h"
@implementation EvaluateModel
+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper {
return @{@"evaID" : @"id"
};
}
@end
......@@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
/// @param completion completion
+ (NSURLSessionDataTask *)queryCommunityEvaluationListWithCompletion:(void (^)(EvaluateRequestModel *requestModel))completion;
@property (nonatomic, strong) NSArray *listArr;
@end
NS_ASSUME_NONNULL_END
......@@ -6,6 +6,7 @@
//
#import "EvaluateRequestModel.h"
#import "EvaluateModel.h"
@implementation EvaluateRequestModel
......@@ -16,7 +17,13 @@
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;
NSArray *resultArr = apiDic[@"result"];
NSMutableArray *tmpArr = [NSMutableArray array];
for (int i = 0; i < resultArr.count; i++) {
EvaluateModel *model = [EvaluateModel yy_modelWithDictionary:resultArr[i]];
[tmpArr addObject:model];
}
requestModel.listArr = tmpArr.copy;
completion(requestModel);
} failure:^(id _Nonnull failureInfo) {
requestModel.resCode = [failureInfo[@"errorCode"] integerValue];
......
......@@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *detail;
@property (nonatomic, assign) int messageCount;
/// 用于区分官方通知和收到点赞标识
@property (nonatomic, assign) BOOL isPraise;
@end
NS_ASSUME_NONNULL_END
......@@ -56,7 +56,7 @@
self.titleLab.text = officialModel.title;
self.mesCountLab.hidden = !officialModel.messageCount;
self.mesCountLab.text = [NSString stringWithFormat:@"%d", officialModel.messageCount];
self.detailLab.text = self.mesCountLab.hidden == NO ? officialModel.detail : @"暂无通知";
self.detailLab.text = self.mesCountLab.hidden == NO ? officialModel.detail : (officialModel.isPraise ? @"暂无点赞" : @"暂无通知");
}
#pragma mark - lazy
......
......@@ -164,6 +164,7 @@
officialModel.title = titleArr[i];
officialModel.detail = detailArr[i];
officialModel.messageCount = [messageCountArr[i] intValue];
officialModel.isPraise = i == 0 ? NO : YES;
[tmpArr addObject:officialModel];
}
self.offNotiArr = tmpArr.copy;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!