手表功能
@@ -400,7 +400,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.9;
|
||||
MARKETING_VERSION = 1.0.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProject;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
@@ -444,7 +444,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.9;
|
||||
MARKETING_VERSION = 1.0.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProject;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
|
||||
@@ -91,7 +91,7 @@ static char edgeKey;
|
||||
break;
|
||||
|
||||
case DIYStyleImgBottom:
|
||||
NSLog(@"%f",titleX);
|
||||
DLog(@"%f",titleX);
|
||||
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY),
|
||||
-(titleX + titleW/2.0 - selfW/2.0),
|
||||
-((selfH - totalH)/2.0 - titleY),
|
||||
@@ -156,7 +156,7 @@ static char edgeKey;
|
||||
break;
|
||||
|
||||
case DIYStyleImgBottom:
|
||||
NSLog(@"%f",titleX);
|
||||
DLog(@"%f",titleX);
|
||||
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY),
|
||||
-(titleX + titleW/2.0 - selfW/2.0),
|
||||
-((selfH - totalH)/2.0 - titleY),
|
||||
@@ -220,7 +220,7 @@ static char edgeKey;
|
||||
break;
|
||||
|
||||
case DIYStyleImgBottom:
|
||||
NSLog(@"%f",titleX);
|
||||
DLog(@"%f",titleX);
|
||||
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY),
|
||||
-(titleX + titleW/2.0 - selfW/2.0),
|
||||
-((selfH - totalH)/2.0 - titleY),
|
||||
@@ -288,7 +288,7 @@ static char edgeKey;
|
||||
break;
|
||||
|
||||
case DIYStyleImgBottom:
|
||||
NSLog(@"%f",titleX);
|
||||
DLog(@"%f",titleX);
|
||||
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY),
|
||||
-(titleX + titleW/2.0 - selfW/2.0),
|
||||
-((selfH - totalH)/2.0 - titleY),
|
||||
|
||||
@@ -15,13 +15,11 @@
|
||||
#define KNotificationLoginIMResult @"loginIMResult"
|
||||
|
||||
//切换tabar
|
||||
#define KNotificSelectHomePageTabbar @"SlectHomePageTabBar"
|
||||
|
||||
#define KNotificSelectSoSTabbar @"SlectSoSTabBar"
|
||||
#define KNotificSelectQuestionTabbar @"SlectQuestionTabBar"
|
||||
#define KNotificSelectSOSCenterTabbar @"SlectSoSTabBar"
|
||||
#define KNotificSelectWatchTabbar @"SlectMonitoringTabBar"
|
||||
|
||||
#define KNotificSelectPhysicalTabbar @"SlectPhysicalTabBar"
|
||||
|
||||
#define KNotificSelectFileTabbar @"SlectFileTabBar"
|
||||
|
||||
//同意协议
|
||||
|
||||
@@ -63,17 +61,17 @@
|
||||
#pragma mark: 网络前缀
|
||||
#define ResourceAddress [NSString stringWithFormat:@"%@/file/show/",Http]
|
||||
|
||||
////开发环境地址 彭杰 http://192.168.1.37
|
||||
////开发环境地址 彭杰
|
||||
//#define Http @"http://192.168.1.47"//昊
|
||||
//#define H5DevHost @"xj-admin.mcrm.vip:8888"//
|
||||
//#define IntervenH5 @"https://console-xj-admin.mcrm.vip:8888"
|
||||
//#define SCHEME @"https" //
|
||||
|
||||
//正式地址
|
||||
#define Http @"https://api-jkglpt.iosp.ydpt.tech"//
|
||||
#define H5DevHost @"api-jkglpt.iosp.ydpt.tech"//
|
||||
#define IntervenH5 @"https://console-jkglpt.iosp.ydpt.tech"
|
||||
#define SCHEME @"https" //
|
||||
//#define Http @"https://api-jkglpt.iosp.ydpt.tech"//
|
||||
//#define H5DevHost @"api-jkglpt.iosp.ydpt.tech"//
|
||||
//#define IntervenH5 @"https://console-jkglpt.iosp.ydpt.tech"
|
||||
//#define SCHEME @"https" //
|
||||
|
||||
//卫鑫本地
|
||||
//#define Http @"https://api-jkglpt.iosp.ydpt.tech"//
|
||||
@@ -81,17 +79,16 @@
|
||||
//#define IntervenH5 @"http://192.168.1.26:9876"
|
||||
//#define SCHEME @"https" //
|
||||
|
||||
//测试
|
||||
//#define Http @"https://api-xj.tri.icdat.cn"//
|
||||
//#define H5DevHost @"api-xj.tri.icdat.cn"//
|
||||
//#define IntervenH5 @"https://console-xj.tri.icdat.cn"
|
||||
//#define SCHEME @"https" //
|
||||
|
||||
//最新新疆测试地址
|
||||
//#define Http @"http://192.168.1.223"//彭杰
|
||||
// 最新地址
|
||||
//#define Http @"http://192.168.1.47"//王昊
|
||||
|
||||
//#define Http @"https://xj-api.mcrm.vip:8888"//
|
||||
//#define H5DevHost @"xj-admin.mcrm.vip:8888"//
|
||||
//#define IntervenH5 @"https://console-xj-admin.mcrm.vip:8888"
|
||||
//#define SCHEME @"https" //
|
||||
#define Http @"http://192.168.1.47"//王昊
|
||||
#define H5DevHost @"xj-admin.mcrm.vip:8888"//
|
||||
#define IntervenH5 @"https://console-xj-admin.mcrm.vip:8888"
|
||||
#define SCHEME @"https" //
|
||||
|
||||
//新疆项目后期的调试环境由阿里云迁移至公司内部主机服务器,功能联调和测试可用以下的环境地址
|
||||
//https://api-xj.tri.icdat.cn
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
|
||||
//下载进度
|
||||
progress ? progress(downloadProgress) : nil;
|
||||
NSLog(@"下载进度:%.2f%%",100.0*downloadProgress.completedUnitCount/downloadProgress.totalUnitCount);
|
||||
DLog(@"下载进度:%.2f%%",100.0*downloadProgress.completedUnitCount/downloadProgress.totalUnitCount);
|
||||
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
|
||||
|
||||
//拼接缓存目录
|
||||
@@ -35,11 +35,11 @@
|
||||
//拼接文件路径
|
||||
NSString *filePath = [downloadStr stringByAppendingPathComponent:fileDir];
|
||||
|
||||
NSLog(@"downloadStr = %@",downloadStr);
|
||||
DLog(@"downloadStr = %@",downloadStr);
|
||||
return [NSURL fileURLWithPath:filePath];
|
||||
|
||||
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
||||
NSLog(@"%@---%@", filePath, filePath.absoluteString);
|
||||
DLog(@"%@---%@", filePath, filePath.absoluteString);
|
||||
success ? success(filePath.absoluteString /** NSURL->NSString*/) : nil;
|
||||
failure && error ? failure(error) : nil;
|
||||
}];
|
||||
@@ -57,7 +57,7 @@
|
||||
//获取路径
|
||||
NSString *documentsPath = [ReaderDocument documentsPath];
|
||||
//可根据路径command + shift + G查看该路径下的所有的pdf文件
|
||||
NSLog(@"%@", documentsPath);
|
||||
DLog(@"%@", documentsPath);
|
||||
NSString *filePath = [documentsPath stringByAppendingPathComponent:fileName];
|
||||
ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath password:nil];
|
||||
if (document != nil)
|
||||
@@ -72,7 +72,7 @@
|
||||
[self downloadWithURL:url fileDir:fileName progress:^(NSProgress *progress) {
|
||||
|
||||
} success:^(NSString *filePath) {
|
||||
NSLog(@"%@", filePath);
|
||||
DLog(@"%@", filePath);
|
||||
//下载完成直接打开
|
||||
[self downLoadPdfFileByUrl:url fileName:fileName];
|
||||
} failure:^(NSError *error) {
|
||||
@@ -93,7 +93,7 @@
|
||||
NSString *filePath = [path stringByAppendingPathComponent:fileName];
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
BOOL result = [fileManager fileExistsAtPath:filePath];
|
||||
NSLog(@"这个文件已经存在:%@",result?@"是的":@"不存在");
|
||||
DLog(@"这个文件已经存在:%@",result?@"是的":@"不存在");
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@@ -154,4 +154,28 @@
|
||||
//消息
|
||||
- (void)getUserMessageList:(NSMutableDictionary *)parmDic;
|
||||
|
||||
- (void)getUserMessageDetailConnet:(NSMutableDictionary *)parmDic;
|
||||
|
||||
- (void)getHomepageBannerList:(NSMutableDictionary *)parmDic;
|
||||
|
||||
//我的积分
|
||||
- (void)getPointsBankHeard:(NSMutableDictionary *)parmDic;
|
||||
|
||||
- (void)postPointsBankRankData:(NSMutableDictionary *)parmDic;
|
||||
|
||||
- (void)postPointsBankSourceDetail:(NSMutableDictionary *)parmDic;
|
||||
- (void)postPointsCheckInCard:(NSMutableDictionary *)parmDic;
|
||||
|
||||
//积分任务
|
||||
- (void)postPointsTaskList:(NSMutableDictionary *)parmDic;
|
||||
|
||||
//图片地址
|
||||
- (void)getDetailImageAddress:(NSMutableDictionary *)parmDic;
|
||||
//轮播图一次性全请求
|
||||
- (void)getHomeBannerAllData:(NSMutableDictionary *)parmDic;
|
||||
|
||||
//手表接口
|
||||
- (void)getHomeWatchWearBool:(NSMutableDictionary *)parmDic;
|
||||
|
||||
- (void)getHomeWatchData:(NSMutableDictionary *)parmDic;
|
||||
@end
|
||||
|
||||
@@ -831,9 +831,80 @@
|
||||
|
||||
- (void)getUserMessageList:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-system//app/sys/message/notice/list",Http] params:parmDic];
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-system/app/sys/message/notice/list",Http] params:parmDic];
|
||||
|
||||
}
|
||||
|
||||
- (void)getUserMessageDetailConnet:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-system/app/sys/message/notice/queryById",Http] params:parmDic];
|
||||
|
||||
}
|
||||
|
||||
//轮播图
|
||||
- (void)getHomepageBannerList:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/api/banner/selectBannerList",Http] params:parmDic];
|
||||
|
||||
}
|
||||
|
||||
//积分银行
|
||||
- (void)getPointsBankHeard:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-system/bank/userPoints/app/myPoints",Http] params:parmDic];
|
||||
|
||||
}
|
||||
|
||||
//积分榜单
|
||||
- (void)postPointsBankRankData:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/bank/userPoints/app/pointRanking",Http] params:parmDic];
|
||||
|
||||
}
|
||||
|
||||
//积分明细
|
||||
- (void)postPointsBankSourceDetail:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/bank/userPoints/app/pointRecord",Http] params:parmDic];
|
||||
|
||||
}
|
||||
|
||||
//积分任务
|
||||
- (void)postPointsCheckInCard:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/bank/userPoints/app/pointCheckIn",Http] params:parmDic];
|
||||
|
||||
}
|
||||
|
||||
|
||||
//积分任务
|
||||
- (void)postPointsTaskList:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/bank/userPoints/app/pointsTaskList",Http] params:parmDic];
|
||||
|
||||
}
|
||||
|
||||
//图片地址
|
||||
- (void)getDetailImageAddress:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/consultation/conSession/getPicUrl",Http] params:parmDic];
|
||||
}
|
||||
|
||||
- (void)getHomeBannerAllData:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-system/sys/api/banner/selectAllBannerList",Http] params:parmDic];
|
||||
}
|
||||
|
||||
#pragma mark:手表相关
|
||||
//是否佩戴手表
|
||||
- (void)getHomeWatchWearBool:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-watch/api/watchData/findWatchInfo",Http] params:parmDic];
|
||||
}
|
||||
|
||||
//手表数据
|
||||
- (void)getHomeWatchData:(NSMutableDictionary *)parmDic {
|
||||
|
||||
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-watch/api/watchData/userWatchDataAll",Http] params:parmDic];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -34,23 +34,24 @@
|
||||
object:nil];
|
||||
|
||||
|
||||
//切换SOStabbar
|
||||
//切换咨询tabbar
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(tabBarSoSChange:)
|
||||
name:KNotificSelectSoSTabbar
|
||||
selector:@selector(tabBarQuestionChange:)
|
||||
name:KNotificSelectQuestionTabbar
|
||||
object:nil];
|
||||
//切换应急tabbar
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(tabBarSOSChange:)
|
||||
name:KNotificSelectSOSCenterTabbar
|
||||
object:nil];
|
||||
|
||||
//切换体检tabbar
|
||||
//切换监测tabbar
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(tabBarPhyChange:)
|
||||
name:KNotificSelectPhysicalTabbar
|
||||
selector:@selector(tabBarMonitoringChange:)
|
||||
name:KNotificSelectWatchTabbar
|
||||
object:nil];
|
||||
|
||||
//切换档案tabbar
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(tabBarFileChange:)
|
||||
name:KNotificSelectFileTabbar
|
||||
object:nil];
|
||||
|
||||
if ([HQCommonUtils isLogin]) {
|
||||
//腾讯im
|
||||
#if DEBUG
|
||||
@@ -159,6 +160,8 @@
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
//更新用户授权高德SDK隐私协议状态. since 8.1.0
|
||||
[MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree];
|
||||
KPostNotification(KNotificAgreeProtoocl, nil);
|
||||
|
||||
|
||||
}];
|
||||
|
||||
@@ -167,6 +170,8 @@
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
//更新用户授权高德SDK隐私协议状态. since 8.1.0
|
||||
[MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusNotAgree];
|
||||
KPostNotification(KNotificAgreeProtoocl, nil);
|
||||
|
||||
}];
|
||||
|
||||
[alert addAction:conform];
|
||||
@@ -244,27 +249,24 @@
|
||||
|
||||
|
||||
#pragma mark: 切换tabbar
|
||||
- (void)tabBarSoSChange:(NSNotification *)notification {
|
||||
- (void)tabBarQuestionChange:(NSNotification *)notification {
|
||||
|
||||
self.mainTabBar.selectedIndex = 1;
|
||||
|
||||
}
|
||||
|
||||
- (void)tabBarSOSChange:(NSNotification *)notification {
|
||||
|
||||
self.mainTabBar.selectedIndex = 2;
|
||||
|
||||
}
|
||||
|
||||
- (void)tabBarPhyChange:(NSNotification *)notification {
|
||||
- (void)tabBarMonitoringChange:(NSNotification *)notification {
|
||||
|
||||
self.mainTabBar.selectedIndex = 3;
|
||||
|
||||
}
|
||||
|
||||
- (void)tabBarFileChange:(NSNotification *)notification {
|
||||
|
||||
self.mainTabBar.selectedIndex = 4;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+ (AppDelegate *)shareAppDelegate{
|
||||
return (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// PointsBankHModel.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PointsBankHModel : NSObject
|
||||
|
||||
@property (nonatomic, assign) double points;
|
||||
@property (nonatomic, assign) double addPointsSum;
|
||||
@property (nonatomic, assign) double exchangePointsSum;
|
||||
|
||||
//RANK
|
||||
@property (nonatomic, assign) double frequency;
|
||||
@property (nonatomic, assign) double ruleCategory;
|
||||
@property (nonatomic, copy) NSString * ruleDesc;
|
||||
@property (nonatomic, copy) NSString * icon;
|
||||
@property (nonatomic, assign) double status;
|
||||
@property (nonatomic, assign) double delFlag;
|
||||
@property (nonatomic, copy) NSString * createUser;
|
||||
@property (nonatomic, copy) NSString * createTime;
|
||||
@property (nonatomic, copy) NSString * lastModifyDate;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// PointsBankHModel.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "PointsBankHModel.h"
|
||||
|
||||
@implementation PointsBankHModel
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// PointsBankDetailViewController.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "XJBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PointsBankDetailViewController : XJBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,263 @@
|
||||
//
|
||||
// PointsBankDetailViewController.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "PointsBankDetailViewController.h"
|
||||
#import "PointsBankHModel.h"
|
||||
#import "PointsBankHomeTopView.h"
|
||||
|
||||
@interface PointsBankDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
|
||||
@property (nonatomic, strong) UITableView * homeTable;
|
||||
|
||||
@property (nonatomic, assign) NSInteger pageNo;
|
||||
|
||||
@property (nonatomic, strong) PointsBankHomeTopView * topView;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray * dataArray;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PointsBankDetailViewController
|
||||
|
||||
- (NSMutableArray *)dataArray {
|
||||
if (!_dataArray) {
|
||||
_dataArray = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.view.backgroundColor = KWhiteColor;
|
||||
self.pageNo = 1;
|
||||
[self createData];
|
||||
[self createUI];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
- (void)createUI {
|
||||
|
||||
self.topView= [[PointsBankHomeTopView alloc] init];
|
||||
|
||||
[self.view addSubview:self.topView];
|
||||
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.right.mas_offset(0);
|
||||
|
||||
}];
|
||||
|
||||
|
||||
self.homeTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) {
|
||||
self.homeTable.estimatedRowHeight = 60;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.homeTable.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
self.homeTable.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
self.homeTable.delegate = self;
|
||||
self.homeTable.dataSource = self;
|
||||
self.homeTable.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
|
||||
self.homeTable.showsVerticalScrollIndicator = NO;
|
||||
self.homeTable.backgroundColor = KClearColor;
|
||||
self.homeTable.rowHeight = UITableViewAutomaticDimension;
|
||||
self.homeTable.estimatedRowHeight = 80;
|
||||
|
||||
|
||||
[self.view addSubview:self.homeTable];
|
||||
|
||||
[self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(_topView.mas_bottom);
|
||||
make.left.bottom.right.mas_offset(0);
|
||||
|
||||
}];
|
||||
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
|
||||
weakSelf.pageNo = 1;
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf createData];
|
||||
|
||||
}];
|
||||
|
||||
self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
|
||||
weakSelf.pageNo++;
|
||||
[weakSelf createData];
|
||||
|
||||
}];
|
||||
|
||||
|
||||
LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"noDataBox" titleStr:@"暂无数据" detailStr:@""];
|
||||
//元素竖直方向的间距
|
||||
emptyView.subViewMargin = 20.f;
|
||||
//标题颜色
|
||||
emptyView.titleLabTextColor = [UIColor blackColor];
|
||||
//描述字体
|
||||
emptyView.detailLabFont = [UIFont systemFontOfSize:17];
|
||||
//按钮背景色
|
||||
emptyView.actionBtnBackGroundColor = KWhiteColor;
|
||||
emptyView.actionBtnWidth = CGFLOAT_MIN;
|
||||
emptyView.actionBtnHeight = CGFLOAT_MIN;
|
||||
//设置空内容占位图
|
||||
self.homeTable.ly_emptyView = emptyView;
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)createData {
|
||||
|
||||
[self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false];
|
||||
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
|
||||
[parmDic setObject:@(self.pageNo) forKey:@"pageNo"];
|
||||
[parmDic setObject:@"10" forKey:@"pageSize"];
|
||||
|
||||
XJPNetAPI * listApi = [[XJPNetAPI alloc] init:self tag:@"LIST" NeedToken:@""];
|
||||
[listApi getUserMessageList:parmDic];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - DataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
|
||||
return UITableViewCell.new;
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
|
||||
return UIView.new;
|
||||
}
|
||||
|
||||
|
||||
- (void)chageDataType:(UIButton *)typeBtn {
|
||||
|
||||
//请求接口
|
||||
if (typeBtn.tag == 0) {
|
||||
[self creeateRankDataWithTyep:@"1"];
|
||||
}
|
||||
if (typeBtn.tag == 1) {
|
||||
[self creeateRankDataWithTyep:@"2"];
|
||||
}
|
||||
if (typeBtn.tag == 2) {
|
||||
[self creeateRankDataWithTyep:@"0"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)creeateRankDataWithTyep:(NSString *)type {
|
||||
|
||||
//rankType(榜单类型,0总榜,1周榜,2月榜)
|
||||
[self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false];
|
||||
|
||||
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
|
||||
[parmDic setObject:@(self.pageNo) forKey:@"pageNo"];
|
||||
[parmDic setObject:@"10" forKey:@"pageSize"];
|
||||
[parmDic setObject:type forKey:@"rankType"];
|
||||
|
||||
|
||||
XJPNetAPI * listApi = [[XJPNetAPI alloc] init:self tag:@"DETAIL" NeedToken:@""];
|
||||
[listApi postPointsBankSourceDetail:parmDic];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)Failed:(NSString*)message tag:(NSString*)tag
|
||||
{
|
||||
|
||||
[self.homeTable.mj_header endRefreshing];
|
||||
[self.homeTable.mj_footer endRefreshing];
|
||||
|
||||
[self hiddenAllMBProgressHUD];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)Sucess:(id)response tag:(NSString*)tag
|
||||
{
|
||||
[self.homeTable.mj_header endRefreshing];
|
||||
[self.homeTable.mj_footer endRefreshing];
|
||||
if ([tag isEqualToString:@"DETAIL"]) {
|
||||
|
||||
[self hiddenAllMBProgressHUD];
|
||||
NSDictionary * responseDic = response;
|
||||
|
||||
PointsBankHModel * model = [PointsBankHModel modelWithDictionary:responseDic];
|
||||
//points 可用积分 addPointsSum 累计积分 exchangePointsSum 累计兑换
|
||||
self.topView.model = model;
|
||||
|
||||
}
|
||||
if ([tag isEqualToString:@"RANK"]) {
|
||||
NSDictionary * dic = response;
|
||||
if ([dic.allKeys containsObject:@"page"]) {
|
||||
NSDictionary * pageDic = [dic objectForKey:@"page"];
|
||||
//取到排名
|
||||
if ([pageDic.allKeys containsObject:@"records"]) {
|
||||
NSArray * array = [pageDic objectForKey:@"records"];
|
||||
for (NSDictionary * rankDic in array) {
|
||||
PointsBankHModel * mdoel = [PointsBankHModel modelWithDictionary:rankDic];
|
||||
[self.dataArray addObject:mdoel];
|
||||
|
||||
}
|
||||
//处理结束 给数据
|
||||
[self.homeTable reloadData];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// PointsBankHomeTopView.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "PointsBankHModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PointsBankHomeTopView : UIView
|
||||
|
||||
@property (nonatomic, strong) PointsBankHModel * model;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// PointsBankHomeTopView.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "PointsBankHomeTopView.h"
|
||||
|
||||
@interface PointsBankHomeTopView ()
|
||||
|
||||
@property (nonatomic, strong) UILabel * pointsDataLabel;
|
||||
@property (nonatomic, strong) UILabel * pointsAddLabel;
|
||||
@property (nonatomic, strong) UILabel * exchangeLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PointsBankHomeTopView
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
|
||||
[self createUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createUI {
|
||||
|
||||
UILabel * haveLab = [[UILabel alloc] init];
|
||||
haveLab.text = @"可用积分";
|
||||
haveLab.textColor = CFontColor1;
|
||||
haveLab.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
|
||||
[self addSubview:haveLab];
|
||||
|
||||
[haveLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(15);
|
||||
make.top.mas_offset(15);
|
||||
}];
|
||||
|
||||
self.pointsDataLabel = [[UILabel alloc] init];
|
||||
self.pointsDataLabel.text = @"--";
|
||||
self.pointsDataLabel.textColor = CFontColor1;
|
||||
self.pointsDataLabel.font = [UIFont systemFontOfSize:28 weight:UIFontWeightBold];
|
||||
[self addSubview:self.pointsDataLabel];
|
||||
|
||||
[self.pointsDataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(haveLab);
|
||||
make.top.mas_equalTo(haveLab.mas_bottom).offset(12);
|
||||
}];
|
||||
|
||||
|
||||
UIButton * sourceBtn = [[UIButton alloc] init];
|
||||
[sourceBtn setTitle:@"获取积分" forState:UIControlStateNormal];
|
||||
[sourceBtn setTitleColor:KWhiteColor forState:UIControlStateNormal];
|
||||
sourceBtn.titleLabel.font = SYSTEMFONT(15);
|
||||
sourceBtn.layer.cornerRadius = 4;
|
||||
sourceBtn.layer.masksToBounds = true;
|
||||
sourceBtn.backgroundColor = UIColorHex(#21BEBE);
|
||||
[self addSubview:sourceBtn];
|
||||
|
||||
[sourceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_offset(-15);
|
||||
make.width.mas_offset(80);
|
||||
make.height.mas_offset(32);
|
||||
make.top.mas_offset(53);
|
||||
}];
|
||||
|
||||
UILabel * addLab = [[UILabel alloc] init];
|
||||
addLab.text = @"累计积分:";
|
||||
addLab.textColor = CFontColor1;
|
||||
addLab.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
|
||||
self.pointsAddLabel = addLab;
|
||||
[self addSubview:addLab];
|
||||
|
||||
[addLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(haveLab.mas_right).offset(81);
|
||||
make.top.mas_equalTo(haveLab.mas_bottom).offset(11);
|
||||
}];
|
||||
|
||||
self.exchangeLabel = [[UILabel alloc] init];
|
||||
self.exchangeLabel.text = @"累计兑换:";
|
||||
self.exchangeLabel.textColor = CFontColor1;
|
||||
self.exchangeLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
|
||||
[self addSubview:self.exchangeLabel];
|
||||
|
||||
[self.exchangeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(haveLab.mas_right).offset(81);
|
||||
make.top.mas_equalTo(addLab.mas_bottom).offset(11);
|
||||
}];
|
||||
|
||||
UIView *dashedView = [[UIView alloc] init];
|
||||
[self addSubview:dashedView];
|
||||
|
||||
// Masonry 布局
|
||||
[dashedView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(20);
|
||||
make.right.mas_equalTo(-20);
|
||||
make.top.mas_equalTo(self.pointsDataLabel.mas_bottom).offset(10);
|
||||
make.height.mas_equalTo(1); // 高度可以随意
|
||||
make.bottom.mas_equalTo(-10);
|
||||
}];
|
||||
//虚线
|
||||
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
|
||||
shapeLayer.strokeColor = [UIColor lightGrayColor].CGColor; // 线颜色
|
||||
shapeLayer.lineWidth = 1; // 线宽
|
||||
shapeLayer.lineDashPattern = @[@4, @2]; // 虚线:4pt 实线,2pt 空白
|
||||
|
||||
// 创建路径
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
CGPathMoveToPoint(path, NULL, 0, 0); // 起点
|
||||
CGPathAddLineToPoint(path, NULL, [UIScreen mainScreen].bounds.size.width - 40, 0); // 终点
|
||||
shapeLayer.path = path;
|
||||
CGPathRelease(path);
|
||||
|
||||
// 添加到 view
|
||||
[dashedView.layer addSublayer:shapeLayer];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void)setModel:(PointsBankHModel *)model {
|
||||
|
||||
_model = model;
|
||||
|
||||
self.pointsDataLabel.text = [NSString stringWithFormat:@"%.0f",_model.points];
|
||||
|
||||
self.pointsAddLabel.text = [NSString stringWithFormat:@"累计积分:%.0f",_model.addPointsSum];
|
||||
|
||||
self.exchangeLabel.text = [NSString stringWithFormat:@"累计兑换%.0f",_model.exchangePointsSum];
|
||||
|
||||
|
||||
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// myPointsBankHomeViewController.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "XJBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface myPointsBankHomeViewController : XJBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,439 @@
|
||||
//
|
||||
// myPointsBankHomeViewController.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "myPointsBankHomeViewController.h"
|
||||
#import "PointsBankHModel.h"
|
||||
#import "PointsBankHomeTopView.h"
|
||||
|
||||
@interface myPointsBankHomeViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
|
||||
@property (nonatomic, strong) UITableView * homeTable;
|
||||
@property (nonatomic, assign) NSInteger pageNo;
|
||||
@property (nonatomic, strong) NSMutableArray * dataArray;
|
||||
@property (nonatomic, strong) NSMutableArray * buttonArray;
|
||||
|
||||
@property (nonatomic, strong) PointsBankHomeTopView * topView;
|
||||
@property (nonatomic, strong) UIView * lineView;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation myPointsBankHomeViewController
|
||||
|
||||
- (NSMutableArray *)dataArray {
|
||||
|
||||
if (!_dataArray ) {
|
||||
_dataArray = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)buttonArray {
|
||||
|
||||
if (!_buttonArray ) {
|
||||
_buttonArray = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return _buttonArray;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
self.isHidenNaviBar = false;
|
||||
self.navigationItem.title = @"我的积分银行";
|
||||
|
||||
[self createData];
|
||||
//默认总榜单
|
||||
[self creeateRankDataWithTyep:@"0"];
|
||||
[self createUI];
|
||||
}
|
||||
|
||||
- (void)createUI {
|
||||
|
||||
//首页
|
||||
self.topView = [[PointsBankHomeTopView alloc] init];
|
||||
[self.view addSubview:self.topView];
|
||||
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_offset(0);
|
||||
// make.height.mas_offset(185);
|
||||
}];
|
||||
|
||||
//功能栏
|
||||
NSArray * toolsArray = @[@[@"积分兑换",@"img1"],@[@"积分明细",@"img2"],@[@"兑换记录",@"img3"]];
|
||||
|
||||
CGFloat itemWidth = 60;
|
||||
CGFloat itemHeight = 110;
|
||||
NSInteger count = toolsArray.count;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
||||
NSArray *item = toolsArray[i];
|
||||
|
||||
// 1️⃣ 容器 view
|
||||
UIView *itemView = [[UIView alloc] init];
|
||||
itemView.tag = i;
|
||||
itemView.userInteractionEnabled = YES;
|
||||
[self.view addSubview:itemView];
|
||||
|
||||
// 2️⃣ 点击手势
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(itemTap:)];
|
||||
[itemView addGestureRecognizer:tap];
|
||||
|
||||
// 3️⃣ 布局 container(每个 item 占 1/3 屏幕宽)
|
||||
CGFloat thirdWidth = UIScreen.mainScreen.bounds.size.width / count;
|
||||
|
||||
[itemView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.topView.mas_bottom).offset(20);
|
||||
make.width.mas_equalTo(itemWidth);
|
||||
make.height.mas_equalTo(itemHeight);
|
||||
make.centerX.mas_equalTo(self.view.mas_left).offset(thirdWidth * i + thirdWidth / 2);
|
||||
}];
|
||||
|
||||
// 4️⃣ 图片
|
||||
UIImageView *icon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:item[1]]];
|
||||
icon.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[itemView addSubview:icon];
|
||||
|
||||
[icon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(0);
|
||||
make.centerX.equalTo(itemView);
|
||||
make.width.height.mas_equalTo(40);
|
||||
}];
|
||||
|
||||
// 5️⃣ 文字
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.text = item[0];
|
||||
label.font = [UIFont systemFontOfSize:14];
|
||||
label.textAlignment = NSTextAlignmentCenter;
|
||||
[itemView addSubview:label];
|
||||
|
||||
[label mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(icon.mas_bottom).offset(8);
|
||||
make.left.right.equalTo(itemView);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
}
|
||||
|
||||
//排行
|
||||
UIView * rankView = [[UIView alloc] init];
|
||||
rankView.backgroundColor = KWhiteColor;
|
||||
[self.view addSubview:rankView];
|
||||
|
||||
|
||||
UILabel * rankTitleLab = [[UILabel alloc] init];
|
||||
rankTitleLab.text = @"积分排行(单位)";
|
||||
rankTitleLab.textColor = CFontColor1;
|
||||
[rankView addSubview:rankTitleLab];
|
||||
|
||||
[rankTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(15);
|
||||
make.top.mas_offset(15);
|
||||
}];
|
||||
|
||||
UILabel * detailLab = [[UILabel alloc] init];
|
||||
detailLab.text = @"以员工累计获得积分进行排名";
|
||||
detailLab.textColor = CFontColor1;
|
||||
[rankView addSubview:detailLab];
|
||||
|
||||
[detailLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(15);
|
||||
make.top.mas_equalTo(rankTitleLab.mas_bottom).offset(8);
|
||||
}];
|
||||
|
||||
//周排名 月排名 年排名
|
||||
UIView * lineView = [[UIView alloc] init];
|
||||
lineView.backgroundColor = UIColor.blueColor;
|
||||
self.lineView = lineView;
|
||||
[rankView addSubview:lineView];
|
||||
|
||||
[lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_offset(80);
|
||||
make.height.mas_offset(2);
|
||||
}];
|
||||
|
||||
NSArray * array = @[@"周排名",@"月排名",@"年排名"];
|
||||
UIButton * lastBtn = nil;
|
||||
for (int i= 0; i < 3; i ++) {
|
||||
|
||||
UIButton * btn = [[UIButton alloc] init];
|
||||
[btn setTitle:array[i] forState:UIControlStateNormal];
|
||||
[btn setTitleColor:UIColor.blueColor forState:UIControlStateSelected];
|
||||
[btn setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
|
||||
btn.titleLabel.font = MEDIUMFONT(13);
|
||||
btn.tag = i;
|
||||
[btn addTarget:self action:@selector(chageDataType:) forControlEvents:UIControlEventTouchUpInside];
|
||||
btn.selected = false;
|
||||
if (i == 2) {
|
||||
btn.selected = true;
|
||||
lastBtn = btn;
|
||||
|
||||
}
|
||||
[rankView addSubview:btn];
|
||||
|
||||
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_offset(80);
|
||||
make.height.mas_offset(32);
|
||||
make.top.mas_equalTo(detailLab.mas_bottom).offset(10);
|
||||
if (i == 0) {
|
||||
make.left.mas_offset(82);
|
||||
}
|
||||
if (i == 1) {
|
||||
make.centerX.mas_equalTo(rankView);
|
||||
|
||||
}
|
||||
if (i == 2) {
|
||||
make.right.mas_offset(-82);
|
||||
}
|
||||
}];
|
||||
[self.buttonArray addObject:btn];
|
||||
|
||||
}
|
||||
if (lastBtn) {
|
||||
[lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(lastBtn);
|
||||
make.top.mas_equalTo(lastBtn.mas_bottom).offset(5);
|
||||
}];
|
||||
}
|
||||
|
||||
[rankView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_offset(0);
|
||||
make.top.mas_equalTo(self.topView.mas_bottom).offset(15);
|
||||
make.bottom.mas_equalTo(lastBtn.mas_bottom).offset(20);
|
||||
}];
|
||||
|
||||
self.homeTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) {
|
||||
self.homeTable.estimatedRowHeight = 60;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.homeTable.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
self.homeTable.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
self.homeTable.delegate = self;
|
||||
self.homeTable.dataSource = self;
|
||||
self.homeTable.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
|
||||
self.homeTable.showsVerticalScrollIndicator = NO;
|
||||
self.homeTable.backgroundColor = KClearColor;
|
||||
self.homeTable.rowHeight = UITableViewAutomaticDimension;
|
||||
self.homeTable.estimatedRowHeight = 80;
|
||||
|
||||
|
||||
[self.view addSubview:self.homeTable];
|
||||
|
||||
[self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(rankView.mas_bottom);
|
||||
make.left.bottom.right.mas_offset(0);
|
||||
|
||||
}];
|
||||
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
|
||||
weakSelf.pageNo = 1;
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf createData];
|
||||
|
||||
}];
|
||||
|
||||
self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
|
||||
weakSelf.pageNo++;
|
||||
[weakSelf createData];
|
||||
|
||||
}];
|
||||
|
||||
|
||||
LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"noDataBox" titleStr:@"暂无数据" detailStr:@""];
|
||||
//元素竖直方向的间距
|
||||
emptyView.subViewMargin = 20.f;
|
||||
//标题颜色
|
||||
emptyView.titleLabTextColor = [UIColor blackColor];
|
||||
//描述字体
|
||||
emptyView.detailLabFont = [UIFont systemFontOfSize:17];
|
||||
//按钮背景色
|
||||
emptyView.actionBtnBackGroundColor = KWhiteColor;
|
||||
emptyView.actionBtnWidth = CGFLOAT_MIN;
|
||||
emptyView.actionBtnHeight = CGFLOAT_MIN;
|
||||
//设置空内容占位图
|
||||
self.homeTable.ly_emptyView = emptyView;
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)createData {
|
||||
|
||||
[self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false];
|
||||
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
|
||||
XJPNetAPI * listApi = [[XJPNetAPI alloc] init:self tag:@"HEARD" NeedToken:@""];
|
||||
[listApi getPointsBankHeard:parmDic];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - DataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
|
||||
return UITableViewCell.new;
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
|
||||
return UIView.new;
|
||||
}
|
||||
|
||||
|
||||
- (void)chageDataType:(UIButton *)typeBtn {
|
||||
|
||||
for (UIButton * seleBtn in self.buttonArray) {
|
||||
if (seleBtn == typeBtn) {
|
||||
seleBtn.selected = true;
|
||||
|
||||
[self.lineView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(typeBtn);
|
||||
make.bottom.mas_equalTo(typeBtn.mas_bottom).offset(8);
|
||||
make.height.mas_offset(1);
|
||||
make.centerX.mas_equalTo(typeBtn);
|
||||
}];
|
||||
}else
|
||||
{
|
||||
seleBtn.selected = false;
|
||||
}
|
||||
}
|
||||
//请求接口
|
||||
if (typeBtn.tag == 0) {
|
||||
[self creeateRankDataWithTyep:@"1"];
|
||||
}
|
||||
if (typeBtn.tag == 1) {
|
||||
[self creeateRankDataWithTyep:@"2"];
|
||||
}
|
||||
if (typeBtn.tag == 2) {
|
||||
[self creeateRankDataWithTyep:@"0"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)creeateRankDataWithTyep:(NSString *)type {
|
||||
|
||||
//rankType(榜单类型,0总榜,1周榜,2月榜)
|
||||
[self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false];
|
||||
|
||||
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
|
||||
[parmDic setObject:@(self.pageNo) forKey:@"pageNo"];
|
||||
[parmDic setObject:@"10" forKey:@"pageSize"];
|
||||
[parmDic setObject:type forKey:@"rankType"];
|
||||
|
||||
|
||||
XJPNetAPI * listApi = [[XJPNetAPI alloc] init:self tag:@"RANK" NeedToken:@""];
|
||||
[listApi postPointsBankRankData:parmDic];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)Failed:(NSString*)message tag:(NSString*)tag
|
||||
{
|
||||
|
||||
[self.homeTable.mj_header endRefreshing];
|
||||
[self.homeTable.mj_footer endRefreshing];
|
||||
|
||||
[self hiddenAllMBProgressHUD];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)Sucess:(id)response tag:(NSString*)tag
|
||||
{
|
||||
[self.homeTable.mj_header endRefreshing];
|
||||
[self.homeTable.mj_footer endRefreshing];
|
||||
if ([tag isEqualToString:@"HEARD"]) {
|
||||
|
||||
[self hiddenAllMBProgressHUD];
|
||||
NSDictionary * responseDic = response;
|
||||
|
||||
PointsBankHModel * model = [PointsBankHModel modelWithDictionary:responseDic];
|
||||
//points 可用积分 addPointsSum 累计积分 exchangePointsSum 累计兑换
|
||||
self.topView.model = model;
|
||||
|
||||
}
|
||||
if ([tag isEqualToString:@"RANK"]) {
|
||||
NSDictionary * dic = response;
|
||||
if ([dic.allKeys containsObject:@"page"]) {
|
||||
NSDictionary * pageDic = [dic objectForKey:@"page"];
|
||||
//取到排名
|
||||
if ([pageDic.allKeys containsObject:@"records"]) {
|
||||
NSArray * array = [pageDic objectForKey:@"records"];
|
||||
for (NSDictionary * rankDic in array) {
|
||||
PointsBankHModel * mdoel = [PointsBankHModel modelWithDictionary:rankDic];
|
||||
[self.dataArray addObject:mdoel];
|
||||
|
||||
}
|
||||
//处理结束 给数据
|
||||
[self.homeTable reloadData];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
- (void)itemTap:(UITapGestureRecognizer *)tap {
|
||||
NSInteger index = tap.view.tag;
|
||||
NSLog(@"点击了第 %ld 个", index);
|
||||
|
||||
if(index == 1 || index == 2) {
|
||||
[EasyTextView showInfoText:@"开发者,敬请期待!"];
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
#import "XJSosCenterViewController.h"
|
||||
#import "MonitoringWarchViewController.h"
|
||||
|
||||
//干预二期
|
||||
//新版首页
|
||||
#import "XJHomePageV2ViewController.h"
|
||||
|
||||
|
||||
@interface XJBaseTabBarController ()<UITabBarControllerDelegate>
|
||||
|
||||
@@ -39,8 +41,6 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.delegate = self;
|
||||
|
||||
|
||||
//初始化tabbar
|
||||
[self setUpTabBar];
|
||||
//添加子控制器
|
||||
@@ -73,6 +73,11 @@
|
||||
-(void)setUpAllChildViewController{
|
||||
_VCS = @[].mutableCopy;
|
||||
|
||||
//新增首页
|
||||
|
||||
XJHomePageV2ViewController * homeVC = [[XJHomePageV2ViewController alloc]init];
|
||||
[self setupChildViewController:homeVC title:@"首页" imageName:@"xjHomeTabBar_nomal" seleceImageName:@"xjHomeTabBar_selected"];
|
||||
|
||||
QuestionViewController * questionVC = [[QuestionViewController alloc]init];
|
||||
[self setupChildViewController:questionVC title:@"咨询" imageName:@"questionTabBar_nomal" seleceImageName:@"questionTabBar_selected"];
|
||||
|
||||
@@ -141,6 +146,10 @@
|
||||
return [self.selectedViewController supportedInterfaceOrientations];
|
||||
}
|
||||
|
||||
- (void)selectedQuestion {
|
||||
|
||||
self.selectedIndex = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes];
|
||||
NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
|
||||
[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
|
||||
NSLog(@"-----clear webView cache success------");
|
||||
DLog(@"-----clear webView cache success------");
|
||||
}];
|
||||
} else {
|
||||
NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
|
||||
@@ -221,7 +221,7 @@
|
||||
NSError *errors;
|
||||
[[NSFileManager defaultManager] removeItemAtPath:cookiesFolderPath error:&errors];
|
||||
if (!errors) {
|
||||
NSLog(@"-----clear wkWebView cache success------");
|
||||
DLog(@"-----clear wkWebView cache success------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@
|
||||
}
|
||||
|
||||
for (MsgBody *msgBody in model.MsgBody) {
|
||||
NSLog(@"MsgType: %@", msgBody.MsgType);
|
||||
NSLog(@"MsgContent Data - title: %@", msgBody.MsgContent.Text);
|
||||
DLog(@"MsgType: %@", msgBody.MsgType);
|
||||
DLog(@"MsgContent Data - title: %@", msgBody.MsgContent.Text);
|
||||
|
||||
if([msgBody.MsgType isEqualToString:@"TIMTextElem"]) //文本消息
|
||||
{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// EmptyFunctionDevelopmentVC.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/10.
|
||||
//
|
||||
|
||||
#import "XJBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface EmptyFunctionDevelopmentVC : XJBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// EmptyFunctionDevelopmentVC.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/10.
|
||||
//
|
||||
|
||||
#import "EmptyFunctionDevelopmentVC.h"
|
||||
|
||||
@interface EmptyFunctionDevelopmentVC ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation EmptyFunctionDevelopmentVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.isHidenNaviBar = false;
|
||||
self.view.backgroundColor = KWhiteColor;
|
||||
|
||||
UIImageView * deveImg = [[UIImageView alloc] init];
|
||||
deveImg.image = [UIImage imageNamed:@"deveEmptyImg"];
|
||||
[self.view addSubview:deveImg];
|
||||
|
||||
[deveImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_offset(90);
|
||||
make.height.mas_offset(76);
|
||||
make.centerX.mas_equalTo(self.view);
|
||||
make.centerY.mas_equalTo(self.view).offset(-70) ;
|
||||
}];
|
||||
|
||||
UILabel * dataLabel = [[UILabel alloc] init];
|
||||
dataLabel.text = @"~ 正在研发中,敬请期待 ~";
|
||||
dataLabel.font = SYSTEMFONT(14);
|
||||
dataLabel.textColor = UIColorHex(#B6B6B6);
|
||||
dataLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self.view addSubview:dataLabel];
|
||||
|
||||
[dataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(deveImg.mas_bottom).offset(12);
|
||||
make.left.right.mas_offset(0);
|
||||
}];
|
||||
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// HomeBannerModel.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/10.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface HomeBannerModel : NSObject
|
||||
|
||||
@property (nonatomic, strong) NSString * banner_id;
|
||||
@property (nonatomic, strong) NSString * tfJump;
|
||||
@property (nonatomic, strong) NSString * photoUrl;
|
||||
@property (nonatomic, strong) NSString * jumpUrl;
|
||||
@property (nonatomic, assign) NSInteger sort;
|
||||
@property (nonatomic, strong) NSString * showLocation;
|
||||
@property (nonatomic, strong) NSString * showLocation_dicText;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// HomeBannerModel.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/10.
|
||||
//
|
||||
|
||||
#import "HomeBannerModel.h"
|
||||
|
||||
@implementation HomeBannerModel
|
||||
|
||||
+ (NSDictionary *)modelCustomPropertyMapper
|
||||
{
|
||||
NSDictionary * dic =@{@"banner_id" :@"id"};
|
||||
return dic;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// XJHomeWatchModel.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/3/2.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XJHomeWatchModel : NSObject
|
||||
|
||||
@property (nonatomic, assign) CGFloat latest;
|
||||
@property (nonatomic, assign) CGFloat max;
|
||||
@property (nonatomic, assign) CGFloat min;
|
||||
@property (nonatomic, assign) CGFloat avg;
|
||||
|
||||
@property (nonatomic, copy) NSString * latestTime;
|
||||
@property (nonatomic, copy) NSString * watchNo;
|
||||
@property (nonatomic, copy) NSString * lastUploadDate;
|
||||
@property (nonatomic, copy) NSString * watchModel;
|
||||
@property (nonatomic, copy) NSString * bindDate;
|
||||
|
||||
@property (nonatomic, assign) BOOL hasWatch;
|
||||
|
||||
//手表详情
|
||||
@property (nonatomic, copy) NSString * type;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// XJHomeWatchModel.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/3/2.
|
||||
//
|
||||
|
||||
#import "XJHomeWatchModel.h"
|
||||
|
||||
@implementation XJHomeWatchModel
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// XJHomePageV2BottomTools.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef void(^bottomToolsImgClick)(NSInteger imgIndex);
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XJHomePageV2BottomTools : UIView
|
||||
|
||||
@property (nonatomic, strong)bottomToolsImgClick imgeBlock;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// XJHomePageV2BottomTools.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/9.
|
||||
//
|
||||
|
||||
#import "XJHomePageV2BottomTools.h"
|
||||
|
||||
@implementation XJHomePageV2BottomTools
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self createUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createUI {
|
||||
|
||||
UIImageView * leftImage = [[UIImageView alloc] init];
|
||||
leftImage.image = [UIImage imageNamed:@"bottomLeftImg"];
|
||||
leftImage.userInteractionEnabled = true;
|
||||
[self addSubview:leftImage];
|
||||
|
||||
[leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(0);
|
||||
make.top.bottom.mas_offset(0);
|
||||
make.width.mas_equalTo(self.mas_width).multipliedBy(0.5).offset(10);
|
||||
}];
|
||||
|
||||
UILabel * leftTitle = [[UILabel alloc] init];
|
||||
leftTitle.text = @"智慧体重";
|
||||
leftTitle.textColor = UIColorHex(#252535);
|
||||
leftTitle.font = MEDIUMFONT(15);
|
||||
[leftImage addSubview:leftTitle];
|
||||
|
||||
[leftTitle mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(27);
|
||||
make.top.mas_offset(25);
|
||||
}];
|
||||
|
||||
UILabel * leftDetailTitle = [[UILabel alloc] init];
|
||||
leftDetailTitle.text = @"智追体重 科学控重";
|
||||
leftDetailTitle.textColor = UIColorHex(#808080);
|
||||
leftDetailTitle.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
|
||||
[leftImage addSubview:leftDetailTitle];
|
||||
|
||||
[leftDetailTitle mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(27);
|
||||
make.top.mas_equalTo(leftTitle.mas_bottom).offset(8);
|
||||
}];
|
||||
|
||||
|
||||
UIImageView * rightImage = [[UIImageView alloc] init];
|
||||
rightImage.image = [UIImage imageNamed:@"bottomRightImg"];
|
||||
rightImage.userInteractionEnabled = true;
|
||||
[self addSubview:rightImage];
|
||||
|
||||
[rightImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_offset(0);
|
||||
make.top.bottom.mas_offset(0);
|
||||
make.width.mas_equalTo(self.mas_width).multipliedBy(0.5).offset(10);
|
||||
}];
|
||||
|
||||
UILabel * rightTitle = [[UILabel alloc] init];
|
||||
rightTitle.text = @"一人一案";
|
||||
rightTitle.textColor = UIColorHex(#252535);
|
||||
rightTitle.font = MEDIUMFONT(15);
|
||||
[rightImage addSubview:rightTitle];
|
||||
|
||||
[rightTitle mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(27);
|
||||
make.top.mas_offset(25);
|
||||
}];
|
||||
|
||||
UILabel * rightDetailTitle = [[UILabel alloc] init];
|
||||
rightDetailTitle.text = @"定制专属健康方案";
|
||||
rightDetailTitle.textColor = UIColorHex(#808080);
|
||||
rightDetailTitle.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
|
||||
[rightImage addSubview:rightDetailTitle];
|
||||
|
||||
[rightDetailTitle mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(27);
|
||||
make.top.mas_equalTo(rightTitle.mas_bottom).offset(8);
|
||||
}];
|
||||
|
||||
UITapGestureRecognizer *tap1 =
|
||||
[[UITapGestureRecognizer alloc] initWithTarget:self
|
||||
action:@selector(leftImageTap:)];
|
||||
|
||||
[leftImage addGestureRecognizer:tap1];
|
||||
|
||||
UITapGestureRecognizer *tap2 =
|
||||
[[UITapGestureRecognizer alloc] initWithTarget:self
|
||||
action:@selector(rightImageTap:)];
|
||||
|
||||
[rightImage addGestureRecognizer:tap2];
|
||||
|
||||
}
|
||||
|
||||
- (void)leftImageTap:(UITapGestureRecognizer *)tap {
|
||||
if (self.imgeBlock) {
|
||||
self.imgeBlock(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)rightImageTap:(UITapGestureRecognizer *)tap {
|
||||
|
||||
if (self.imgeBlock) {
|
||||
self.imgeBlock(2);
|
||||
}
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// XJHomePageV2HeardView.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "XJHomeWatchModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol homePageHeardDelegate <NSObject>
|
||||
|
||||
- (void)SDTitleItemClick;
|
||||
|
||||
- (void)heardTopToolsClick:(NSInteger)type;
|
||||
|
||||
- (void)heardImageClick:(NSInteger)imageIndex;
|
||||
|
||||
- (void)watchDetailClick;
|
||||
|
||||
@end
|
||||
|
||||
@interface XJHomePageV2HeardView : UIView
|
||||
|
||||
@property (nonatomic, strong) NSArray * dataArray;
|
||||
|
||||
@property (nonatomic, weak) id<homePageHeardDelegate> homeTopDelegate;
|
||||
|
||||
|
||||
@property (nonatomic, strong) NSArray * bannerArray;
|
||||
|
||||
@property (nonatomic, strong) XJHomeWatchModel * model;
|
||||
|
||||
@property (nonatomic, strong) NSArray * watchArray;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,489 @@
|
||||
//
|
||||
// XJHomePageV2HeardView.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/9.
|
||||
//
|
||||
|
||||
#import "XJHomePageV2HeardView.h"
|
||||
#import "SDCycleScrollView.h"
|
||||
#import "HealthyToolsView.h"
|
||||
#import "MyMessageModel.h"
|
||||
#import "HomeBannerModel.h"
|
||||
#import "XJHomeWatchDataView.h"
|
||||
|
||||
|
||||
@interface XJHomePageV2HeardView ()<SDCycleScrollViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIView * messageview;
|
||||
|
||||
|
||||
@property (nonatomic, strong) SDCycleScrollView * adTitleView;
|
||||
|
||||
@property (nonatomic, strong) UILabel * nameLabel;
|
||||
|
||||
@property (nonatomic, strong) XJHomeWatchDataView * watchDataView;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation XJHomePageV2HeardView
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.backgroundColor = CViewBgColor;
|
||||
[self createUI];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
}
|
||||
|
||||
- (void)createUI {
|
||||
|
||||
UIImageView * backImage = [[UIImageView alloc] init];
|
||||
backImage.userInteractionEnabled = true;
|
||||
backImage.image = [UIImage imageNamed:@"homePageHeardTop"];
|
||||
[self addSubview:backImage];
|
||||
|
||||
[backImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_offset(0);
|
||||
make.height.mas_offset(kRealValue(405));
|
||||
make.top.mas_offset(0);
|
||||
|
||||
}];
|
||||
|
||||
UIView * messageView = [[UIView alloc] init];
|
||||
messageView.layer.cornerRadius = 8;
|
||||
messageView.layer.masksToBounds = true;
|
||||
messageView.userInteractionEnabled = true;
|
||||
self.messageview = messageView;
|
||||
[backImage addSubview:messageView];
|
||||
|
||||
[messageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(12);
|
||||
make.right.mas_offset(-12);
|
||||
make.height.mas_offset(40);
|
||||
make.top.mas_offset(kRealValue(145));
|
||||
}];
|
||||
|
||||
|
||||
|
||||
UIImageView * messageImg = [[UIImageView alloc] init];
|
||||
messageImg.image = [UIImage imageNamed:@"messageBackImg"];
|
||||
messageImg.userInteractionEnabled = true;
|
||||
[messageView addSubview:messageImg];
|
||||
|
||||
[messageImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.offset(0);
|
||||
}];
|
||||
|
||||
UIImageView * labaImg = [[UIImageView alloc] init];
|
||||
labaImg.image = [UIImage imageNamed:@"homeLaba"];
|
||||
[messageView addSubview:labaImg];
|
||||
[labaImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(10);
|
||||
make.width.height.mas_offset(17);
|
||||
make.centerY.mas_equalTo(messageView);
|
||||
}];
|
||||
|
||||
|
||||
self.adTitleView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:nil];
|
||||
self.adTitleView.titleLabelTextColor = UIColorHex(#77849E);
|
||||
self.adTitleView.titleLabelBackgroundColor = KClearColor;
|
||||
self.adTitleView.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
self.adTitleView.onlyDisplayText = YES;
|
||||
NSArray *titles = @[];
|
||||
|
||||
self.adTitleView.titlesGroup = [titles copy];
|
||||
[self.adTitleView disableScrollGesture];
|
||||
[messageView addSubview:self.adTitleView];
|
||||
[self.adTitleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(labaImg.mas_right).offset(9);
|
||||
make.right.equalTo(messageView).offset(-12);
|
||||
make.top.bottom.equalTo(messageView);
|
||||
}];
|
||||
DLog(@"%@", self.adTitleView);
|
||||
|
||||
if ([HQCommonUtils isLogin]) {
|
||||
messageView.hidden = false;
|
||||
}else
|
||||
{
|
||||
messageView.hidden = true;
|
||||
|
||||
}
|
||||
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.textColor = KWhiteColor;
|
||||
self.nameLabel.font = BOLDSYSTEMFONT(12);
|
||||
self.nameLabel.text = @"Hi~";
|
||||
self.nameLabel.textAlignment = NSTextAlignmentLeft;
|
||||
[backImage addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(24);
|
||||
make.right.mas_offset(-12);
|
||||
if (messageView.hidden == false) {
|
||||
make.top.mas_equalTo(messageView.mas_bottom).offset(10);
|
||||
}else
|
||||
{
|
||||
make.top.mas_offset(kRealValue(145));
|
||||
}
|
||||
}];
|
||||
//姓名
|
||||
if ([HQCommonUtils isLogin]) {
|
||||
HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo];
|
||||
self.nameLabel.text = [NSString stringWithFormat:@"Hi~%@",user.realname];
|
||||
}
|
||||
|
||||
//
|
||||
UIView * toolsView = [[UIView alloc] init];
|
||||
toolsView.layer.cornerRadius = 12;
|
||||
toolsView.layer.masksToBounds = true;
|
||||
toolsView.alpha = 0.5;
|
||||
toolsView.backgroundColor = UIColorHex(#EBFFFD);
|
||||
[backImage addSubview:toolsView];
|
||||
|
||||
[toolsView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(6);
|
||||
make.right.mas_offset(-6);
|
||||
make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(8);
|
||||
make.height.mas_offset(126);
|
||||
|
||||
}];
|
||||
|
||||
UILabel * toolTitleLab = [[UILabel alloc] init];
|
||||
toolTitleLab.text = @"今日健康积分 0 | 累计积分 0";
|
||||
toolTitleLab.textColor = UIColorHex(#116F6B);
|
||||
toolTitleLab.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
|
||||
[toolsView addSubview:toolTitleLab];
|
||||
|
||||
[toolTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(18);
|
||||
make.top.mas_offset(8);
|
||||
make.right.mas_offset(0);
|
||||
}];
|
||||
|
||||
NSArray * toolsArray = @[@[@"健康档案",@"homeTools_1"],@[@"健康体检",@"homeTools_2"],@[@"应急就医",@"homeTools_3"],@[@"健康银行",@"homeTools_4"]];
|
||||
|
||||
UIView * customView = [[UIView alloc] init];
|
||||
customView.layer.cornerRadius = 6;
|
||||
customView.layer.masksToBounds = true;
|
||||
customView.backgroundColor = KWhiteColor;
|
||||
[backImage addSubview:customView];
|
||||
|
||||
[customView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(12);
|
||||
make.right.mas_offset(-12);
|
||||
make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(35);
|
||||
make.height.mas_offset(93);
|
||||
}];
|
||||
|
||||
NSInteger count = toolsArray.count;
|
||||
NSMutableArray *itemViews = [NSMutableArray array];
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
||||
NSArray *item = toolsArray[i];
|
||||
|
||||
UIView *itemView = [[UIView alloc] init];
|
||||
itemView.tag = i;
|
||||
itemView.userInteractionEnabled = YES;
|
||||
[customView addSubview:itemView];
|
||||
[itemViews addObject:itemView];
|
||||
|
||||
/// 点击手势
|
||||
UITapGestureRecognizer *tap =
|
||||
[[UITapGestureRecognizer alloc] initWithTarget:self
|
||||
action:@selector(cenetrFunctionItemTap:)];
|
||||
|
||||
[itemView addGestureRecognizer:tap];
|
||||
|
||||
/// 上图
|
||||
UIImageView *icon = [[UIImageView alloc] init];
|
||||
icon.image = [UIImage imageNamed:item[1]];
|
||||
icon.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[itemView addSubview:icon];
|
||||
|
||||
/// 下文
|
||||
UILabel *title = [[UILabel alloc] init];
|
||||
title.text = item[0];
|
||||
title.font = MEDIUMFONT(14);
|
||||
title.textColor = [UIColor blackColor];
|
||||
title.textAlignment = NSTextAlignmentCenter;
|
||||
[itemView addSubview:title];
|
||||
|
||||
/// icon 布局
|
||||
[icon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(10);
|
||||
make.centerX.equalTo(itemView);
|
||||
make.width.height.mas_equalTo(40);
|
||||
}];
|
||||
|
||||
/// label 布局
|
||||
[title mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(icon.mas_bottom).offset(6);
|
||||
make.left.right.equalTo(itemView);
|
||||
}];
|
||||
}
|
||||
[itemViews mas_distributeViewsAlongAxis:MASAxisTypeHorizontal
|
||||
withFixedSpacing:0
|
||||
leadSpacing:0
|
||||
tailSpacing:0];
|
||||
|
||||
[itemViews mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(customView);
|
||||
}];
|
||||
// 先用图片实现
|
||||
|
||||
NSArray *imageConfigs = @[
|
||||
@{@"img": @"heardTopImg_1", @"height": @65},
|
||||
@{@"img": @"heardTopImg_2", @"height": @60},
|
||||
];
|
||||
SDCycleScrollView *lastImageView = nil;
|
||||
|
||||
for (int i = 0; i < imageConfigs.count; i++) {
|
||||
|
||||
NSDictionary *config = imageConfigs[i];
|
||||
|
||||
SDCycleScrollView * SDCycles = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage: [UIImage imageNamed:@"placeholder"]];
|
||||
SDCycles.layer.cornerRadius = 12;
|
||||
SDCycles.layer.masksToBounds = true;
|
||||
SDCycles.backgroundColor = KClearColor;
|
||||
// UIViewContentModeScaleToFill,
|
||||
// UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent
|
||||
// UIViewContentModeScaleAspectFill,
|
||||
SDCycles.bannerImageViewContentMode = UIViewContentModeScaleToFill;
|
||||
SDCycles.currentPageDotImage = [UIImage imageNamed:@"pageControlDot"];
|
||||
SDCycles.pageDotImage = [UIImage imageNamed:@"pageControlNomalDot"]; SDCycles.pageDotColor = KWhiteColor;
|
||||
SDCycles.tag = 50 + i; //
|
||||
SDCycles.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
|
||||
SDCycles.pageControlDotSize = CGSizeMake(6, 4);
|
||||
[self addSubview:SDCycles];
|
||||
|
||||
// UIImageView *imageView = [[UIImageView alloc] init];
|
||||
// imageView.image = [UIImage imageNamed:config[@"img"]];
|
||||
// imageView.userInteractionEnabled = YES;
|
||||
// imageView.tag = 50 + i; // 用于区分点击的是哪一个
|
||||
// imageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
// imageView.layer.cornerRadius = 8;
|
||||
// imageView.layer.masksToBounds = true;
|
||||
// imageView.clipsToBounds = YES;
|
||||
//
|
||||
// [self addSubview:imageView];
|
||||
|
||||
/// 点击手势
|
||||
// UITapGestureRecognizer *tap =
|
||||
// [[UITapGestureRecognizer alloc] initWithTarget:self
|
||||
// action:@selector(topImageTap:)];
|
||||
//
|
||||
// [SDCycles addGestureRecognizer:tap];
|
||||
|
||||
/// 布局
|
||||
[SDCycles mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
||||
if (lastImageView) {
|
||||
make.top.equalTo(lastImageView.mas_bottom).offset(12);
|
||||
} else {
|
||||
make.top.equalTo(toolsView.mas_bottom).offset(12);
|
||||
}
|
||||
|
||||
make.left.mas_equalTo(12);
|
||||
make.right.mas_equalTo(-12);
|
||||
make.height.mas_equalTo([config[@"height"] floatValue]);
|
||||
|
||||
}];
|
||||
lastImageView = SDCycles;
|
||||
}
|
||||
[self layoutIfNeeded];
|
||||
|
||||
// @{@"img": @"heardTopImg_3", @"height": @120}
|
||||
|
||||
//手表数据
|
||||
self.watchDataView = [[XJHomeWatchDataView alloc] initWithFrame:CGRectZero];
|
||||
self.watchDataView.tabTitles = @[@"心脑血管", @"癌症", @"慢呼", @"糖尿病", @"亚健康",@"心脑血管", @"癌症", @"慢呼", @"糖尿病", @"亚健康"];
|
||||
self.watchDataView.tabSelectBlock = ^(NSInteger index, NSString *title) {
|
||||
DLog(@"选中 %ld - %@", index, title);
|
||||
// 切换 collectionView 到对应 page
|
||||
|
||||
};
|
||||
self.watchDataView.watchMoreBlock = ^{
|
||||
if ([self.homeTopDelegate respondsToSelector:@selector(watchDetailClick)]) {
|
||||
[self.homeTopDelegate watchDetailClick];
|
||||
}
|
||||
};
|
||||
|
||||
[self addSubview:self.watchDataView];
|
||||
|
||||
[self.watchDataView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(12);
|
||||
make.right.mas_offset(-12);
|
||||
make.height.mas_offset(300);
|
||||
make.top.mas_equalTo(lastImageView.mas_bottom).offset(12);
|
||||
}];
|
||||
|
||||
|
||||
SDCycleScrollView * questionSDCycles = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:[UIImage imageNamed:@"placeholder"]];
|
||||
questionSDCycles.backgroundColor = KClearColor;
|
||||
questionSDCycles.layer.cornerRadius = 12;
|
||||
questionSDCycles.layer.masksToBounds = true;
|
||||
questionSDCycles.bannerImageViewContentMode = UIViewContentModeScaleToFill;
|
||||
questionSDCycles.currentPageDotImage = [UIImage imageNamed:@"pageControlDot"];
|
||||
questionSDCycles.pageDotImage = [UIImage imageNamed:@"pageControlNomalDot"]; questionSDCycles.pageDotColor = KWhiteColor;
|
||||
questionSDCycles.tag = 52; //
|
||||
questionSDCycles.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
|
||||
questionSDCycles.pageControlDotSize = CGSizeMake(6, 4);
|
||||
[self addSubview:questionSDCycles];
|
||||
/// 布局
|
||||
[questionSDCycles mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.watchDataView.mas_bottom).offset(12);
|
||||
make.left.mas_equalTo(12);
|
||||
make.right.mas_equalTo(-12);
|
||||
make.height.mas_equalTo(@120);
|
||||
make.bottom.mas_offset(-12);
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)setModel:(XJHomeWatchModel *)model {
|
||||
|
||||
_model = model;
|
||||
|
||||
self.watchDataView.watchModel = _model;
|
||||
|
||||
}
|
||||
|
||||
- (void)setWatchArray:(NSArray *)watchArray {
|
||||
|
||||
_watchArray = watchArray;
|
||||
|
||||
self.watchDataView.dataList = _watchArray;
|
||||
|
||||
}
|
||||
- (void)setDataArray:(NSArray *)dataArray {
|
||||
|
||||
_dataArray = dataArray;
|
||||
|
||||
|
||||
NSMutableArray * titlesArray = [[NSMutableArray alloc] init];
|
||||
|
||||
for (MyMessageModel * model in _dataArray) {
|
||||
|
||||
//直接处理图片吧
|
||||
[titlesArray addObject:model.title];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(titlesArray.count == 0) {
|
||||
|
||||
|
||||
self.messageview.hidden = true;
|
||||
|
||||
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(24);
|
||||
make.right.mas_offset(-12);
|
||||
make.top.mas_offset(kRealValue(145));
|
||||
}];
|
||||
[self layoutIfNeeded];
|
||||
}else
|
||||
{
|
||||
self.messageview.hidden = false;
|
||||
|
||||
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(24);
|
||||
make.right.mas_offset(-12);
|
||||
make.top.mas_equalTo(self.messageview.mas_bottom).offset(10);
|
||||
}];
|
||||
[self layoutIfNeeded];
|
||||
}
|
||||
self.adTitleView.titlesGroup = titlesArray;
|
||||
|
||||
}
|
||||
|
||||
- (void)setBannerArray:(NSArray *)bannerArray {
|
||||
|
||||
// 1 首页体检模块。2 首页心理模块 3 健康咨询模块。4 ai随访
|
||||
//处理数据
|
||||
|
||||
_bannerArray = bannerArray;
|
||||
|
||||
SDCycleScrollView * oneSDView = [self viewWithTag:50]; //体检
|
||||
SDCycleScrollView * twoSDView = [self viewWithTag:51]; //EAP
|
||||
SDCycleScrollView * threeSDView = [self viewWithTag:52]; //健康咨询
|
||||
|
||||
NSMutableArray * tijianArray = [[NSMutableArray alloc] init];
|
||||
NSMutableArray * eapArray = [[NSMutableArray alloc] init];
|
||||
NSMutableArray * questionArray = [[NSMutableArray alloc] init];
|
||||
|
||||
for (HomeBannerModel * model in _bannerArray) {
|
||||
|
||||
//直接处理图片吧
|
||||
NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,model.photoUrl];
|
||||
|
||||
NSString * str1 = @"\\";
|
||||
|
||||
photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"];
|
||||
|
||||
NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8));
|
||||
|
||||
if ([model.showLocation intValue] == 1) {
|
||||
[tijianArray addObject:encodedString3];
|
||||
}
|
||||
if ([model.showLocation intValue] == 2) {
|
||||
[eapArray addObject:encodedString3];
|
||||
}
|
||||
if ([model.showLocation intValue] == 3) {
|
||||
[questionArray addObject:encodedString3];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
oneSDView.imageURLStringsGroup = tijianArray;
|
||||
twoSDView.imageURLStringsGroup = eapArray;
|
||||
threeSDView.imageURLStringsGroup = questionArray;
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
|
||||
|
||||
DLog(@"++%ld",index);
|
||||
if (cycleScrollView == self.adTitleView) {
|
||||
if ([self.homeTopDelegate respondsToSelector:@selector(SDTitleItemClick)]) {
|
||||
[self.homeTopDelegate SDTitleItemClick];
|
||||
}
|
||||
}else
|
||||
{
|
||||
CGFloat currentBanner = cycleScrollView.tag;
|
||||
|
||||
if([self.homeTopDelegate respondsToSelector:@selector(heardImageClick:)]) {
|
||||
|
||||
[self.homeTopDelegate heardImageClick:currentBanner];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cenetrFunctionItemTap:(UITapGestureRecognizer *)tap {
|
||||
UIView *view = tap.view;
|
||||
NSInteger index = view.tag;
|
||||
|
||||
if([self.homeTopDelegate respondsToSelector:@selector(heardTopToolsClick:)]) {
|
||||
[self.homeTopDelegate heardTopToolsClick:index];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// XJHomePageV2QuestionTableView.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "HealthyQuestionHeardView.h"
|
||||
#import "HomeQusetionRecordsModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
typedef void(^doctorBlock)(HomeQusetionRecordsModel * model);
|
||||
typedef void(^lookMoreDoctorBlock)();
|
||||
|
||||
@interface XJHomePageV2QuestionTableView : UITableView
|
||||
|
||||
@property (nonatomic, strong) NSArray * dataArray;
|
||||
|
||||
@property (nonatomic, copy) doctorBlock tableBlock;
|
||||
@property (nonatomic, copy) lookMoreDoctorBlock lookMoreBlock;
|
||||
|
||||
@property (nonatomic, weak)id <questionToolsProtocl> headDelegate;
|
||||
|
||||
@property (nonatomic, copy) NSString * haveSessioning;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,170 @@
|
||||
//
|
||||
// XJHomePageV2QuestionTableView.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/9.
|
||||
//
|
||||
|
||||
#import "XJHomePageV2QuestionTableView.h"
|
||||
#import "HealthyQuestionTable.h"
|
||||
#import "HealthyDoctorTableViewCell.h"
|
||||
#import "QustionHomeRecordsCell.h"
|
||||
|
||||
@interface XJHomePageV2QuestionTableView ()<UITableViewDelegate,UITableViewDataSource>
|
||||
|
||||
@end
|
||||
|
||||
@implementation XJHomePageV2QuestionTableView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
|
||||
{
|
||||
if (self = [super initWithFrame:frame style:style])
|
||||
{
|
||||
[self createUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)createUI
|
||||
{
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.estimatedRowHeight = 0;
|
||||
self.estimatedSectionFooterHeight = 0;
|
||||
self.estimatedSectionHeaderHeight = 0;
|
||||
self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
self.delegate = self;
|
||||
self.dataSource = self;
|
||||
self.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.showsVerticalScrollIndicator = NO;
|
||||
self.estimatedRowHeight = 60;
|
||||
self.rowHeight = UITableViewAutomaticDimension;
|
||||
}
|
||||
|
||||
- (void)setDataArray:(NSArray *)dataArray
|
||||
{
|
||||
_dataArray = dataArray;
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - DataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
|
||||
|
||||
static NSString * cellID = @"cellID";
|
||||
|
||||
|
||||
QustionHomeRecordsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
|
||||
|
||||
if (!cell) {
|
||||
|
||||
cell = [[QustionHomeRecordsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
|
||||
}
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
cell.backgroundColor = CViewBgColor;
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
return cell;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
HomeQusetionRecordsModel * model = self.dataArray[indexPath.row];
|
||||
|
||||
if (self.tableBlock) {
|
||||
|
||||
self.tableBlock(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return kRealValue(40);
|
||||
}
|
||||
|
||||
- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
|
||||
UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(12, 0, kScreenWidth -24, kRealValue(40))];
|
||||
sectionHeardView.backgroundColor = CViewBgColor;
|
||||
|
||||
UIImageView * heaedImg = [[UIImageView alloc] init];
|
||||
heaedImg.image = [UIImage imageNamed:@"heaedTitleBackImg"];
|
||||
[sectionHeardView addSubview:heaedImg];
|
||||
|
||||
[heaedImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_offset(0);
|
||||
}];
|
||||
|
||||
|
||||
UILabel * todayLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(16), 190, 16)];
|
||||
|
||||
todayLabel.text = @"专家咨询记录";
|
||||
|
||||
todayLabel.textAlignment = NSTextAlignmentLeft;
|
||||
|
||||
todayLabel.textColor = CFontColor1;
|
||||
|
||||
todayLabel.font = BOLDSYSTEMFONT(16);
|
||||
|
||||
[sectionHeardView addSubview:todayLabel];
|
||||
|
||||
[todayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(13);
|
||||
make.top.bottom.mas_offset(0);
|
||||
}];
|
||||
|
||||
|
||||
YYLabel * morelabel = [[YYLabel alloc] init];
|
||||
|
||||
morelabel.text = @">";
|
||||
morelabel.textAlignment = NSTextAlignmentRight;
|
||||
morelabel.textColor = UIColorHex(#999999);
|
||||
morelabel.font = SYSTEMFONT(14);
|
||||
MJWeakSelf
|
||||
[morelabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||||
if (self.lookMoreBlock) {
|
||||
self.lookMoreBlock();
|
||||
}
|
||||
}];
|
||||
[sectionHeardView addSubview:morelabel];
|
||||
|
||||
[morelabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_offset(-13);
|
||||
make.centerY.mas_equalTo(sectionHeardView);
|
||||
make.width.height.mas_offset(20);
|
||||
}];
|
||||
|
||||
return sectionHeardView;
|
||||
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
|
||||
return [[UIView alloc] init];
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// XJHomeWatchCollectionViewCell.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/3/2.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XJHomeWatchCollectionViewCell : UICollectionViewCell
|
||||
|
||||
/// 设置数据模型(id 兼容 HomePageV2WATACHModel)
|
||||
- (void)configureWithData:(nullable id)data;
|
||||
|
||||
/// 父 View Tab 切换时调用,更新展示类型
|
||||
/// 0=心率 1=血氧 2=压力 3=体温 4=睡眠
|
||||
- (void)updateTabIndex:(NSInteger)tabIndex;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,440 @@
|
||||
//
|
||||
// XJHomeWatchCollectionViewCell.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/3/2.
|
||||
//
|
||||
|
||||
#import "XJHomeWatchCollectionViewCell.h"
|
||||
#import "XJHomeWatchModel.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
// tabIndex 对应关系(由父 View XJHomeWatchDataView 的 Tab 传入)
|
||||
// 0=心率 1=血氧 2=压力 3=体温 4=睡眠
|
||||
|
||||
@interface XJHomeWatchCollectionViewCell ()
|
||||
|
||||
@property (nonatomic, strong) UIImageView *heartImg; // 类型图标
|
||||
@property (nonatomic, strong) UILabel *updateLabel; // "最新心率"
|
||||
@property (nonatomic, strong) UILabel *updateTimeLabel; // 最后更新时间(图标旁)
|
||||
@property (nonatomic, strong) UILabel *dataLabel; // 右侧大数值
|
||||
@property (nonatomic, strong) UILabel *backLeftLabel; // 左卡标题 "心率范围"
|
||||
@property (nonatomic, strong) UILabel *leftDataLabel; // 左卡数据
|
||||
@property (nonatomic, strong) UILabel *backRightLabel; // 右卡标题 "平均心率"
|
||||
@property (nonatomic, strong) UILabel *rightDataLabel; // 右卡数据
|
||||
@property (nonatomic, strong) UILabel *timeLabel; // 底部更新时间
|
||||
@property (nonatomic, strong) UIView *emptyView;
|
||||
@property (nonatomic, strong) XJHomeWatchModel *model;
|
||||
@property (nonatomic, assign) NSInteger currentTabIndex;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XJHomeWatchCollectionViewCell
|
||||
|
||||
#pragma mark - Init
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.layer.cornerRadius = 8.0f;
|
||||
self.layer.masksToBounds = YES;
|
||||
self.backgroundColor = KWhiteColor;
|
||||
[self createUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - UI
|
||||
|
||||
- (void)createUI {
|
||||
|
||||
// ── 类型图标 ──────────────────────────────────────────
|
||||
self.heartImg = [[UIImageView alloc] init];
|
||||
self.heartImg.image = [UIImage imageNamed:@"homePageXinlv"];
|
||||
[self.contentView addSubview:self.heartImg];
|
||||
|
||||
[self.heartImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.contentView).offset(15);
|
||||
make.top.equalTo(self.contentView).offset(kRealValue(24));
|
||||
make.size.mas_equalTo(CGSizeMake(32, 32));
|
||||
}];
|
||||
|
||||
// ── 类型标题 "最新心率" ───────────────────────────────
|
||||
self.updateLabel = [[UILabel alloc] init];
|
||||
self.updateLabel.font = BOLDSYSTEMFONT(14);
|
||||
self.updateLabel.textColor = UIColorHex(#252535);
|
||||
self.updateLabel.text = @"最新心率";
|
||||
[self.contentView addSubview:self.updateLabel];
|
||||
|
||||
[self.updateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.heartImg.mas_right).offset(12);
|
||||
make.top.equalTo(self.heartImg);
|
||||
make.height.mas_equalTo(15);
|
||||
}];
|
||||
|
||||
// ── 图标旁更新时间 ───────────────────────────────────
|
||||
self.updateTimeLabel = [[UILabel alloc] init];
|
||||
self.updateTimeLabel.font = MEDIUMFONT(12);
|
||||
self.updateTimeLabel.textColor = UIColorHex(#77849E);
|
||||
self.updateTimeLabel.text = @"--";
|
||||
[self.contentView addSubview:self.updateTimeLabel];
|
||||
|
||||
[self.updateTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.updateLabel);
|
||||
make.top.equalTo(self.updateLabel.mas_bottom).offset(11);
|
||||
make.height.mas_equalTo(11);
|
||||
}];
|
||||
|
||||
// ── 右侧大数值 ───────────────────────────────────────
|
||||
self.dataLabel = [[UILabel alloc] init];
|
||||
self.dataLabel.textColor = UIColorHex(#252535);
|
||||
self.dataLabel.text = @"--次/分钟";
|
||||
self.dataLabel.textAlignment = NSTextAlignmentRight;
|
||||
self.dataLabel.adjustsFontSizeToFitWidth = YES;
|
||||
[self.contentView addSubview:self.dataLabel];
|
||||
|
||||
[self.dataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.contentView).offset(-15);
|
||||
make.centerY.equalTo(self.heartImg);
|
||||
make.width.mas_equalTo(180);
|
||||
make.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
// ── 左卡片 ───────────────────────────────────────────
|
||||
UIView *backLeft = [[UIView alloc] init];
|
||||
backLeft.layer.cornerRadius = 8;
|
||||
backLeft.layer.masksToBounds = YES;
|
||||
backLeft.backgroundColor = UIColorHex(#F6F6F6);
|
||||
[self.contentView addSubview:backLeft];
|
||||
|
||||
[backLeft mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.contentView).offset(15);
|
||||
make.top.equalTo(self.heartImg.mas_bottom).offset(21);
|
||||
make.right.equalTo(self.contentView.mas_centerX).offset(-7.5);
|
||||
make.height.mas_equalTo(72);
|
||||
}];
|
||||
|
||||
UIView *redLine = [[UIView alloc] init];
|
||||
redLine.layer.cornerRadius = 2;
|
||||
redLine.layer.masksToBounds = YES;
|
||||
redLine.backgroundColor = CNavBgColor;
|
||||
[backLeft addSubview:redLine];
|
||||
|
||||
[redLine mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(backLeft).offset(15);
|
||||
make.top.equalTo(backLeft).offset(16);
|
||||
make.size.mas_equalTo(CGSizeMake(4, 11));
|
||||
}];
|
||||
|
||||
self.backLeftLabel = [[UILabel alloc] init];
|
||||
self.backLeftLabel.font = BOLDSYSTEMFONT(14);
|
||||
self.backLeftLabel.textColor = UIColorHex(#252535);
|
||||
self.backLeftLabel.text = @"心率范围";
|
||||
[backLeft addSubview:self.backLeftLabel];
|
||||
|
||||
[self.backLeftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(redLine.mas_right).offset(8);
|
||||
make.top.equalTo(backLeft).offset(13);
|
||||
make.height.mas_equalTo(15);
|
||||
}];
|
||||
|
||||
self.leftDataLabel = [[UILabel alloc] init];
|
||||
self.leftDataLabel.font = BOLDSYSTEMFONT(16);
|
||||
self.leftDataLabel.textColor = UIColorHex(#252535);
|
||||
self.leftDataLabel.text = @"--";
|
||||
self.leftDataLabel.adjustsFontSizeToFitWidth = YES;
|
||||
[backLeft addSubview:self.leftDataLabel];
|
||||
|
||||
[self.leftDataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(backLeft).offset(14);
|
||||
make.right.equalTo(backLeft).offset(-5);
|
||||
make.top.equalTo(self.backLeftLabel.mas_bottom).offset(13);
|
||||
make.height.mas_equalTo(17);
|
||||
}];
|
||||
|
||||
// ── 右卡片 ───────────────────────────────────────────
|
||||
UIView *backRight = [[UIView alloc] init];
|
||||
backRight.layer.cornerRadius = 8;
|
||||
backRight.layer.masksToBounds = YES;
|
||||
backRight.backgroundColor = UIColorHex(#F6F6F6);
|
||||
[self.contentView addSubview:backRight];
|
||||
|
||||
[backRight mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.contentView).offset(-15);
|
||||
make.left.equalTo(self.contentView.mas_centerX).offset(7.5);
|
||||
make.top.equalTo(backLeft);
|
||||
make.height.mas_equalTo(72);
|
||||
}];
|
||||
|
||||
UIView *blueLine = [[UIView alloc] init];
|
||||
blueLine.layer.cornerRadius = 2;
|
||||
blueLine.layer.masksToBounds = YES;
|
||||
blueLine.backgroundColor = UIColorHex(#30A9FF);
|
||||
[backRight addSubview:blueLine];
|
||||
|
||||
[blueLine mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(backRight).offset(15);
|
||||
make.top.equalTo(backRight).offset(16);
|
||||
make.size.mas_equalTo(CGSizeMake(4, 11));
|
||||
}];
|
||||
|
||||
self.backRightLabel = [[UILabel alloc] init];
|
||||
self.backRightLabel.font = BOLDSYSTEMFONT(14);
|
||||
self.backRightLabel.textColor = UIColorHex(#252535);
|
||||
self.backRightLabel.text = @"平均心率";
|
||||
[backRight addSubview:self.backRightLabel];
|
||||
|
||||
[self.backRightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(blueLine.mas_right).offset(8);
|
||||
make.top.equalTo(backRight).offset(13);
|
||||
make.height.mas_equalTo(15);
|
||||
}];
|
||||
|
||||
self.rightDataLabel = [[UILabel alloc] init];
|
||||
self.rightDataLabel.font = BOLDSYSTEMFONT(16);
|
||||
self.rightDataLabel.textColor = UIColorHex(#252535);
|
||||
self.rightDataLabel.text = @"--";
|
||||
self.rightDataLabel.adjustsFontSizeToFitWidth = YES;
|
||||
[backRight addSubview:self.rightDataLabel];
|
||||
|
||||
[self.rightDataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(backRight).offset(14);
|
||||
make.right.equalTo(backRight).offset(-5);
|
||||
make.top.equalTo(self.backRightLabel.mas_bottom).offset(13);
|
||||
make.height.mas_equalTo(17);
|
||||
}];
|
||||
|
||||
// ── 底部更新时间 ─────────────────────────────────────
|
||||
self.timeLabel = [[UILabel alloc] init];
|
||||
self.timeLabel.textColor = UIColorHex(#77849E);
|
||||
self.timeLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.timeLabel.text = @"更新时间:--:--";
|
||||
self.timeLabel.font = MEDIUMFONT(12);
|
||||
[self.contentView addSubview:self.timeLabel];
|
||||
|
||||
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(backLeft.mas_bottom).offset(8);
|
||||
make.left.equalTo(self.contentView).offset(15);
|
||||
make.right.equalTo(self.contentView).offset(-15);
|
||||
make.height.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
// ── 无数据占位 ───────────────────────────────────────
|
||||
self.emptyView = [[UIView alloc] init];
|
||||
self.emptyView.backgroundColor = KWhiteColor;
|
||||
self.emptyView.hidden = YES;
|
||||
[self.contentView addSubview:self.emptyView];
|
||||
|
||||
[self.emptyView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
UILabel *emptyLabel = [[UILabel alloc] init];
|
||||
emptyLabel.text = @"~ 无智能监测数据 ~";
|
||||
emptyLabel.textColor = UIColorHex(#77849E);
|
||||
emptyLabel.font = MEDIUMFONT(13);
|
||||
emptyLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self.emptyView addSubview:emptyLabel];
|
||||
|
||||
[emptyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(self.emptyView);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Public
|
||||
|
||||
- (void)configureWithData:(id)data {
|
||||
if ([data isKindOfClass:[XJHomeWatchModel class]]) {
|
||||
self.model = (XJHomeWatchModel *)data;
|
||||
} else {
|
||||
self.model = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Model Setter
|
||||
|
||||
- (void)setModel:(XJHomeWatchModel *)model {
|
||||
_model = model;
|
||||
|
||||
if (!model) {
|
||||
self.emptyView.hidden = NO;
|
||||
return;
|
||||
}
|
||||
|
||||
self.emptyView.hidden = YES;
|
||||
[self p_updateLabelsForTabIndex:[_model.type intValue]];
|
||||
[self changeDataShow:[_model.type intValue] withModel:_model];
|
||||
|
||||
if (!ValidStr(_model.latestTime)) {
|
||||
self.updateTimeLabel.text = _model.latestTime;
|
||||
self.timeLabel.text = [NSString stringWithFormat:@"更新时间:%@", _model.latestTime];
|
||||
} else {
|
||||
self.updateTimeLabel.text = @"--:--";
|
||||
self.timeLabel.text = @"更新时间:--:--";
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Tab UI Update
|
||||
|
||||
/// 根据 tabIndex 切换图标和文字标题(不涉及数据)
|
||||
- (void)p_updateLabelsForTabIndex:(NSInteger)tabIndex {
|
||||
|
||||
|
||||
NSArray *icons = @[@"homePageXinlv", @"homePageXueyang", @"homePageYali", @"homePageTiwen", @"homePageShuimian"];
|
||||
NSArray *latest = @[@"最新心率", @"最新血氧", @"最新压力", @"最新体温", @"睡眠总时长"];
|
||||
NSArray *left = @[@"心率范围", @"血氧范围", @"压力范围", @"体温范围", @"深睡时长"];
|
||||
NSArray *right = @[@"平均心率", @"平均血氧", @"平均压力", @"平均体温", @"浅睡时长"];
|
||||
NSArray *units = @[@"--次/分钟", @"--%", @"--", @"--℃", @"--"];
|
||||
/** 数据类型:0=心率 1=血氧 2=压力 3=体温 4=睡眠 */
|
||||
if (tabIndex < 0 || tabIndex >= (NSInteger)icons.count) return;
|
||||
|
||||
self.heartImg.image = [UIImage imageNamed:icons[tabIndex]];
|
||||
self.updateLabel.text = latest[tabIndex];
|
||||
self.backLeftLabel.text = left[tabIndex];
|
||||
self.backRightLabel.text = right[tabIndex];
|
||||
|
||||
// 无数据时显示占位
|
||||
if (!_model) {
|
||||
self.dataLabel.text = units[tabIndex];
|
||||
self.leftDataLabel.text = @"--";
|
||||
self.rightDataLabel.text = @"--";
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Data Display
|
||||
|
||||
- (void)changeDataShow:(NSInteger)isOne withModel:(XJHomeWatchModel *)model {
|
||||
|
||||
if (isOne == 0) { // 心率
|
||||
|
||||
NSString *s = [NSString stringWithFormat:@"%.0f次/分钟", model.latest];
|
||||
self.dataLabel.attributedText = [self p_bigAttr:s unitLen:4];
|
||||
|
||||
NSString *range = [NSString stringWithFormat:@"%.0f-%.0f次/分钟", model.max, model.min];
|
||||
self.leftDataLabel.attributedText = [self p_mediumAttr:range unitLen:4];
|
||||
|
||||
NSString *avg = [NSString stringWithFormat:@"%.0f次/分钟", model.avg];
|
||||
self.rightDataLabel.attributedText = [self p_mediumAttr:avg unitLen:4];
|
||||
|
||||
} else if (isOne == 1) { // 血氧
|
||||
|
||||
NSString *s = [NSString stringWithFormat:@"%.0f%%", model.latest];
|
||||
self.dataLabel.attributedText = [self p_bigAttr:s unitLen:1];
|
||||
|
||||
NSString *range = [NSString stringWithFormat:@"%.0f-%.0f%%", model.min, model.max];
|
||||
self.leftDataLabel.attributedText = [self p_mediumAttr:range unitLen:1];
|
||||
|
||||
NSString *avg = [NSString stringWithFormat:@"%.0f%%", model.avg];
|
||||
self.rightDataLabel.attributedText = [self p_mediumAttr:avg unitLen:1];
|
||||
|
||||
} else if (isOne == 2) { // 压力
|
||||
|
||||
NSString *s = [NSString stringWithFormat:@"%.0f", model.latest];
|
||||
self.dataLabel.attributedText = [self p_plainAttr:s size:25];
|
||||
|
||||
NSString *range = [NSString stringWithFormat:@"%.0f-%.0f", model.min, model.max];
|
||||
self.leftDataLabel.attributedText = [self p_plainAttr:range size:20];
|
||||
|
||||
NSString *avg = [NSString stringWithFormat:@"%.0f", model.avg];
|
||||
self.rightDataLabel.attributedText = [self p_plainAttr:avg size:20];
|
||||
|
||||
} else if (isOne == 3) { // 体温
|
||||
|
||||
NSString *s = [NSString stringWithFormat:@"%.1f℃", model.latest];
|
||||
self.dataLabel.attributedText = [self p_bigAttr:s unitLen:1];
|
||||
|
||||
NSString *range = [NSString stringWithFormat:@"%.1f-%.1f℃", model.min, model.max];
|
||||
self.leftDataLabel.attributedText = [self p_mediumAttr:range unitLen:1];
|
||||
|
||||
NSString *avg = [NSString stringWithFormat:@"%.1f℃", model.avg];
|
||||
self.rightDataLabel.attributedText = [self p_mediumAttr:avg unitLen:1];
|
||||
|
||||
} else if (isOne == 4) { // 睡眠
|
||||
|
||||
UIFont *bigFont = [UIFont systemFontOfSize:25 weight:UIFontWeightBold];
|
||||
UIFont *mediumFont = [UIFont systemFontOfSize:20 weight:UIFontWeightMedium];
|
||||
self.dataLabel.attributedText = [self convertMinutes:model.latest withFont:bigFont];
|
||||
self.leftDataLabel.attributedText = [self convertMinutes:model.max withFont:mediumFont];
|
||||
self.rightDataLabel.attributedText = [self convertMinutes:model.min withFont:mediumFont];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Attributed String Helpers
|
||||
|
||||
/// 大数值:主体 25pt bold #252535,末尾 unitLen 个字符 14pt #77849E
|
||||
- (NSMutableAttributedString *)p_bigAttr:(NSString *)str unitLen:(NSInteger)unitLen {
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
|
||||
NSInteger bodyLen = MAX((NSInteger)str.length - unitLen, 0);
|
||||
NSInteger tail = (NSInteger)str.length - bodyLen;
|
||||
|
||||
[attr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:25 weight:UIFontWeightBold]
|
||||
range:NSMakeRange(0, bodyLen)];
|
||||
[attr addAttribute:NSForegroundColorAttributeName value:UIColorHex(#252535)
|
||||
range:NSMakeRange(0, bodyLen)];
|
||||
if (tail > 0) {
|
||||
[attr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium]
|
||||
range:NSMakeRange(bodyLen, tail)];
|
||||
[attr addAttribute:NSForegroundColorAttributeName value:UIColorHex(#77849E)
|
||||
range:NSMakeRange(bodyLen, tail)];
|
||||
}
|
||||
return attr;
|
||||
}
|
||||
|
||||
/// 卡片数值:主体 20pt bold #252535,末尾 unitLen 个字符 12pt #77849E
|
||||
- (NSMutableAttributedString *)p_mediumAttr:(NSString *)str unitLen:(NSInteger)unitLen {
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
|
||||
NSInteger bodyLen = MAX((NSInteger)str.length - unitLen, 0);
|
||||
NSInteger tail = (NSInteger)str.length - bodyLen;
|
||||
|
||||
[attr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20 weight:UIFontWeightBold]
|
||||
range:NSMakeRange(0, bodyLen)];
|
||||
[attr addAttribute:NSForegroundColorAttributeName value:UIColorHex(#252535)
|
||||
range:NSMakeRange(0, bodyLen)];
|
||||
if (tail > 0) {
|
||||
[attr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium]
|
||||
range:NSMakeRange(bodyLen, tail)];
|
||||
[attr addAttribute:NSForegroundColorAttributeName value:UIColorHex(#77849E)
|
||||
range:NSMakeRange(bodyLen, tail)];
|
||||
}
|
||||
return attr;
|
||||
}
|
||||
|
||||
/// 纯数字(压力),无单位,整体 size pt bold #252535
|
||||
- (NSMutableAttributedString *)p_plainAttr:(NSString *)str size:(CGFloat)size {
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
|
||||
[attr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:size weight:UIFontWeightBold]
|
||||
range:NSMakeRange(0, str.length)];
|
||||
[attr addAttribute:NSForegroundColorAttributeName value:UIColorHex(#252535)
|
||||
range:NSMakeRange(0, str.length)];
|
||||
return attr;
|
||||
}
|
||||
|
||||
- (NSMutableAttributedString *)convertMinutes:(float)minutes withFont:(UIFont *)font {
|
||||
NSString *timeString;
|
||||
if (minutes == 0) {
|
||||
timeString = @"0分钟";
|
||||
} else if (minutes < 60) {
|
||||
timeString = [NSString stringWithFormat:@"%.0f分钟", minutes];
|
||||
} else {
|
||||
int h = (int)(minutes / 60);
|
||||
int m = (int)(minutes) % 60;
|
||||
timeString = [NSString stringWithFormat:@"%d小时%d分钟", h, m];
|
||||
}
|
||||
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:timeString];
|
||||
[attr addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, timeString.length)];
|
||||
[attr addAttribute:NSForegroundColorAttributeName value:UIColorHex(#252535)
|
||||
range:NSMakeRange(0, timeString.length)];
|
||||
|
||||
for (NSString *unit in @[@"小时", @"分钟"]) {
|
||||
NSRange r = [timeString rangeOfString:unit];
|
||||
if (r.location != NSNotFound) {
|
||||
[attr addAttribute:NSFontAttributeName
|
||||
value:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium]
|
||||
range:r];
|
||||
}
|
||||
}
|
||||
return attr;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// XJHomeWatchDataView.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/3/2.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XJHomeWatchModel.h"
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Tab 点击回调:index 选中下标,title 选中标题
|
||||
typedef void(^XJHomeWatchTabSelectBlock)(NSInteger index, NSString *title);
|
||||
|
||||
typedef void(^watchDataDetailBlick)();
|
||||
|
||||
|
||||
@interface XJHomeWatchDataView : UIView
|
||||
|
||||
/// 设置 Tab 标题数组,赋值后自动刷新按钮
|
||||
@property (nonatomic, copy) NSArray<NSString *> *tabTitles;
|
||||
|
||||
/// Tab 点击回调
|
||||
@property (nonatomic, copy, nullable) XJHomeWatchTabSelectBlock tabSelectBlock;
|
||||
|
||||
@property (nonatomic, copy, nullable) watchDataDetailBlick watchMoreBlock;
|
||||
|
||||
|
||||
/// 数据源,赋值后自动刷新 CollectionView,空数组时显示占位图
|
||||
@property (nonatomic, copy) NSArray *dataList;
|
||||
|
||||
/// 底部 CollectionView(可用于外部调用 scrollToItem 等)
|
||||
@property (nonatomic, strong, readonly) UICollectionView *collectionView;
|
||||
|
||||
/// 当前选中的 Tab 下标
|
||||
@property (nonatomic, assign, readonly) NSInteger selectedIndex;
|
||||
|
||||
/// 手动切换 Tab(不触发 block)
|
||||
- (void)selectTabAtIndex:(NSInteger)index;
|
||||
|
||||
@property (nonatomic, strong) XJHomeWatchModel * watchModel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,385 @@
|
||||
//
|
||||
// XJHomeWatchDataView.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/3/2.
|
||||
//
|
||||
|
||||
#import "XJHomeWatchDataView.h"
|
||||
#import "XJHomeWatchCollectionViewCell.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
// ── 布局常量 ──────────────────────────────────────────────
|
||||
static CGFloat const kHeaderHeight = 92.0; // 头部保留高度(外部自行填充)
|
||||
static CGFloat const kTabScrollH = 52.0; // Tab ScrollView 高度
|
||||
static CGFloat const kButtonH = 30.0; // 按钮高度
|
||||
static CGFloat const kButtonPadX = 10.0; // 按钮左右内边距
|
||||
static CGFloat const kButtonGap = 10.0; // 按钮间距
|
||||
|
||||
|
||||
// ── Private ───────────────────────────────────────────────
|
||||
@interface XJHomeWatchDataView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
|
||||
@property (nonatomic, strong) UILabel *watchNumberLabel; //
|
||||
|
||||
|
||||
@property (nonatomic, strong) UIScrollView *tabScrollView;
|
||||
@property (nonatomic, strong) UIView *tabContentView;
|
||||
@property (nonatomic, strong) NSMutableArray<UIButton *> *tabButtons;
|
||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||
@property (nonatomic, strong) UILabel *emptyLabel; // 无数据占位
|
||||
@property (nonatomic, strong) UIView *devView; // 紧急开发中占位
|
||||
@property (nonatomic, assign) NSInteger selectedIndex;
|
||||
|
||||
@end
|
||||
|
||||
// ─────────────────────────────────────────────────────────
|
||||
@implementation XJHomeWatchDataView
|
||||
|
||||
#pragma mark - Init
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
self.backgroundColor = KWhiteColor;
|
||||
self.layer.cornerRadius = 12;
|
||||
self.layer.masksToBounds = true;
|
||||
if (self) [self p_setupUI];
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - UI Setup
|
||||
|
||||
- (void)p_setupUI {
|
||||
_selectedIndex = 0;
|
||||
_tabButtons = [NSMutableArray array];
|
||||
|
||||
|
||||
UIImageView * heaedImg = [[UIImageView alloc] init];
|
||||
heaedImg.image = [UIImage imageNamed:@"heaedTitleBackImg"];
|
||||
heaedImg.userInteractionEnabled = true;
|
||||
[self addSubview:heaedImg];
|
||||
|
||||
[heaedImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_offset(0);
|
||||
make.height.mas_offset(40);
|
||||
}];
|
||||
|
||||
|
||||
UILabel * todayLabel = [[UILabel alloc] init];
|
||||
|
||||
todayLabel.text = @"健康监测";
|
||||
|
||||
todayLabel.textAlignment = NSTextAlignmentLeft;
|
||||
|
||||
todayLabel.textColor = CFontColor1;
|
||||
|
||||
todayLabel.font = BOLDSYSTEMFONT(16);
|
||||
|
||||
[heaedImg addSubview:todayLabel];
|
||||
|
||||
[todayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(13);
|
||||
make.top.bottom.mas_offset(0);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
YYLabel * morelabel = [[YYLabel alloc] init];
|
||||
morelabel.text = @">";
|
||||
morelabel.textAlignment = NSTextAlignmentRight;
|
||||
morelabel.textColor = UIColorHex(#999999);
|
||||
morelabel.font = SYSTEMFONT(14);
|
||||
MJWeakSelf
|
||||
[morelabel setTextTapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||||
if (self.watchMoreBlock) {
|
||||
self.watchMoreBlock();
|
||||
}
|
||||
}];
|
||||
[heaedImg addSubview:morelabel];
|
||||
|
||||
[morelabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_offset(-13);
|
||||
make.centerY.mas_equalTo(heaedImg);
|
||||
make.width.height.mas_offset(20);
|
||||
}];
|
||||
|
||||
self.watchNumberLabel = [[UILabel alloc] init];
|
||||
|
||||
self.watchNumberLabel.text = @"监测工具编码:--";
|
||||
|
||||
self.watchNumberLabel.textAlignment = NSTextAlignmentLeft;
|
||||
|
||||
self.watchNumberLabel.textColor = UIColorHex(#14BEBE);
|
||||
|
||||
self.watchNumberLabel.font = MEDIUMFONT(13);
|
||||
|
||||
[heaedImg addSubview:self.watchNumberLabel];
|
||||
|
||||
[self.watchNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(morelabel.mas_left).offset(6);
|
||||
make.top.mas_offset(0);
|
||||
make.height.mas_offset(40);
|
||||
}];
|
||||
|
||||
|
||||
// ── Tab ScrollView ───────────────────────────────────
|
||||
_tabScrollView = [[UIScrollView alloc] init];
|
||||
_tabScrollView.showsHorizontalScrollIndicator = NO;
|
||||
_tabScrollView.showsVerticalScrollIndicator = NO;
|
||||
[self addSubview:_tabScrollView];
|
||||
|
||||
[_tabScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(heaedImg.mas_bottom).offset(10);
|
||||
make.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(kTabScrollH);
|
||||
}];
|
||||
|
||||
// scrollView 内的容器 view(Masonry 驱动 contentSize)
|
||||
_tabContentView = [[UIView alloc] init];
|
||||
[_tabScrollView addSubview:_tabContentView];
|
||||
|
||||
[_tabContentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(_tabScrollView); // 四边贴 scrollView
|
||||
make.height.equalTo(_tabScrollView); // 固定高度 = scrollView,只横向滚动
|
||||
}];
|
||||
|
||||
// ── 底部 CollectionView ──────────────────────────────
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
layout.minimumLineSpacing = 0;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero
|
||||
collectionViewLayout:layout];
|
||||
_collectionView.backgroundColor = UIColor.clearColor;
|
||||
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||
_collectionView.pagingEnabled = YES;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
[_collectionView registerClass:[XJHomeWatchCollectionViewCell class]
|
||||
forCellWithReuseIdentifier:NSStringFromClass([XJHomeWatchCollectionViewCell class])];
|
||||
[self addSubview:_collectionView];
|
||||
|
||||
[_collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(_tabScrollView.mas_bottom);
|
||||
make.left.right.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
// ── 紧急开发中占位(tab 非第一个时显示)────────────────
|
||||
_devView = [[UIView alloc] init];
|
||||
_devView.backgroundColor = KWhiteColor;
|
||||
_devView.hidden = YES;
|
||||
[self addSubview:_devView];
|
||||
|
||||
[_devView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(_tabScrollView.mas_bottom);
|
||||
make.left.right.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
UILabel *devLabel = [[UILabel alloc] init];
|
||||
devLabel.text = @"紧急开发中";
|
||||
devLabel.textColor = [UIColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:1.0];
|
||||
devLabel.font = [UIFont systemFontOfSize:15.0];
|
||||
devLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[_devView addSubview:devLabel];
|
||||
|
||||
[devLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(_devView);
|
||||
}];
|
||||
|
||||
// ── 无数据占位 ────────────────────────────────────────
|
||||
_emptyLabel = [[UILabel alloc] init];
|
||||
_emptyLabel.text = @"暂无穿戴设备";
|
||||
_emptyLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_emptyLabel.textColor = [UIColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:1.0];
|
||||
_emptyLabel.font = [UIFont systemFontOfSize:15.0];
|
||||
_emptyLabel.hidden = YES;
|
||||
[_collectionView addSubview:_emptyLabel];
|
||||
|
||||
[_emptyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(_collectionView);
|
||||
make.centerY.equalTo(_collectionView);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
- (void)setWatchModel:(XJHomeWatchModel *)watchModel {
|
||||
|
||||
_watchModel = watchModel;
|
||||
|
||||
if (_watchModel.hasWatch == true) {
|
||||
//有手表
|
||||
self.watchNumberLabel.text = [NSString stringWithFormat:@"%@:%@",_watchModel.watchModel,_watchModel.watchNo];
|
||||
|
||||
|
||||
}else
|
||||
{
|
||||
self.dataList = @[];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Tab Titles Setter
|
||||
|
||||
- (void)setTabTitles:(NSArray<NSString *> *)tabTitles {
|
||||
_tabTitles = [tabTitles copy];
|
||||
_selectedIndex = 0;
|
||||
|
||||
// 清除旧按钮
|
||||
for (UIButton *btn in _tabButtons) [btn removeFromSuperview];
|
||||
[_tabButtons removeAllObjects];
|
||||
|
||||
UIFont *font = [UIFont systemFontOfSize:14.0];
|
||||
UIButton *prevBtn = nil;
|
||||
|
||||
for (NSInteger i = 0; i < (NSInteger)tabTitles.count; i++) {
|
||||
NSString *title = tabTitles[i];
|
||||
BOOL isSelected = (i == 0);
|
||||
|
||||
// 计算文字宽度,得到按钮宽度
|
||||
CGFloat textW = ceil([title boundingRectWithSize:CGSizeMake(MAXFLOAT, kButtonH)
|
||||
options:NSStringDrawingUsesLineFragmentOrigin
|
||||
attributes:@{NSFontAttributeName: font}
|
||||
context:nil].size.width);
|
||||
CGFloat btnW = textW + kButtonPadX * 2;
|
||||
|
||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
btn.tag = i;
|
||||
btn.titleLabel.font = font;
|
||||
btn.layer.cornerRadius = kButtonH / 2.0;
|
||||
btn.clipsToBounds = YES;
|
||||
btn.backgroundColor = isSelected ? UIColorHex(#14BEBE) : UIColorHex(#F6F7FB);
|
||||
[btn setTitle:title forState:UIControlStateNormal];
|
||||
btn.titleLabel.font = isSelected ? BOLDSYSTEMFONT(15) : [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
|
||||
[btn setTitleColor:isSelected ? KWhiteColor : UIColorHex(#808080)
|
||||
forState:UIControlStateNormal];
|
||||
[btn addTarget:self
|
||||
action:@selector(p_tabButtonTapped:)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
[_tabContentView addSubview:btn];
|
||||
|
||||
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(_tabContentView);
|
||||
make.height.mas_equalTo(kButtonH);
|
||||
make.width.mas_equalTo(btnW);
|
||||
|
||||
if (prevBtn) {
|
||||
make.left.equalTo(prevBtn.mas_right).offset(kButtonGap);
|
||||
} else {
|
||||
make.left.equalTo(_tabContentView).offset(kButtonGap);
|
||||
}
|
||||
|
||||
// 最后一个按钮右边贴 contentView(撑开 scrollView contentSize)
|
||||
if (i == (NSInteger)tabTitles.count - 1) {
|
||||
make.right.equalTo(_tabContentView).offset(-kButtonGap);
|
||||
}
|
||||
}];
|
||||
|
||||
[_tabButtons addObject:btn];
|
||||
prevBtn = btn;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Button Tap
|
||||
|
||||
- (void)p_tabButtonTapped:(UIButton *)sender {
|
||||
NSInteger index = sender.tag;
|
||||
[self selectTabAtIndex:index];
|
||||
if (self.tabSelectBlock) {
|
||||
self.tabSelectBlock(index, _tabTitles[index]);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Public: Select Tab
|
||||
|
||||
- (void)selectTabAtIndex:(NSInteger)index {
|
||||
if (index < 0 || index >= (NSInteger)_tabButtons.count) return;
|
||||
|
||||
// 恢复旧选中样式
|
||||
UIButton *oldBtn = _tabButtons[_selectedIndex];
|
||||
oldBtn.backgroundColor = UIColorHex(#F6F7FB);
|
||||
oldBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
|
||||
[oldBtn setTitleColor:UIColorHex(#808080) forState:UIControlStateNormal];
|
||||
|
||||
// 设置新选中样式
|
||||
_selectedIndex = index;
|
||||
UIButton *newBtn = _tabButtons[index];
|
||||
newBtn.backgroundColor = UIColorHex(#14BEBE);
|
||||
newBtn.titleLabel.font = BOLDSYSTEMFONT(14);
|
||||
[newBtn setTitleColor:KWhiteColor forState:UIControlStateNormal];
|
||||
|
||||
// 滚动让选中按钮可见/居中
|
||||
[self p_scrollToButton:newBtn];
|
||||
|
||||
// tab 0:显示 CollectionView;其他:显示"紧急开发中"
|
||||
BOOL isFirst = (index == 0);
|
||||
_collectionView.hidden = !isFirst;
|
||||
_devView.hidden = isFirst;
|
||||
}
|
||||
|
||||
/// 若按钮中心超过可视区一半,则滚动将其居中
|
||||
- (void)p_scrollToButton:(UIButton *)btn {
|
||||
// layoutIfNeeded 保证 frame 已计算
|
||||
[_tabScrollView layoutIfNeeded];
|
||||
|
||||
CGFloat scrollW = _tabScrollView.bounds.size.width;
|
||||
CGFloat contentW = _tabScrollView.contentSize.width;
|
||||
CGFloat btnCenterX = CGRectGetMidX(btn.frame);
|
||||
|
||||
CGFloat offsetX = 0;
|
||||
if (btnCenterX > scrollW / 2.0) {
|
||||
offsetX = btnCenterX - scrollW / 2.0;
|
||||
offsetX = MIN(offsetX, MAX(contentW - scrollW, 0));
|
||||
}
|
||||
|
||||
[_tabScrollView setContentOffset:CGPointMake(offsetX, 0) animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - DataList Setter
|
||||
|
||||
- (void)setDataList:(NSArray *)dataList {
|
||||
_dataList = [dataList copy];
|
||||
|
||||
BOOL isEmpty = (_dataList.count == 0);
|
||||
_emptyLabel.hidden = !isEmpty;
|
||||
|
||||
[_collectionView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDataSource
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.dataList.count;
|
||||
}
|
||||
|
||||
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
|
||||
cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XJHomeWatchCollectionViewCell *cell =
|
||||
[collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XJHomeWatchCollectionViewCell class])
|
||||
forIndexPath:indexPath];
|
||||
// 用 dataList 里对应位置的 model 填充
|
||||
if (indexPath.item < (NSInteger)_dataList.count) {
|
||||
[cell configureWithData:_dataList[indexPath.item]];
|
||||
}
|
||||
// // item 下标即数据类型:0=心率 1=血氧 2=压力 3=体温
|
||||
// [cell updateTabIndex:indexPath.item];
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegateFlowLayout
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView
|
||||
layout:(UICollectionViewLayout *)collectionViewLayout
|
||||
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
// cell 宽 = 整个 view 宽;cell 高 = collectionView 自身高度
|
||||
return CGSizeMake(self.bounds.size.width, collectionView.bounds.size.height);
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegate
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
// 预留:外部如需监听 cell 点击可在此通过 block 回调
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XJHomePageV2ViewController.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/9.
|
||||
//
|
||||
|
||||
#import "XJBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XJHomePageV2ViewController : XJBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -176,17 +176,21 @@
|
||||
|
||||
//1月21日新需求
|
||||
|
||||
self.topLoginTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, kRealValue(40), kScreenWidth, 20)];;
|
||||
self.topLoginTitleLab = [[UILabel alloc] init];;
|
||||
self.topLoginTitleLab.text = @"平台统一认证";
|
||||
self.topLoginTitleLab.font = [UIFont systemFontOfSize:20 weight:UIFontWeightBold];
|
||||
self.topLoginTitleLab.textColor = UIColorHex(#2EB8B2);
|
||||
self.topLoginTitleLab.textAlignment = NSTextAlignmentCenter;
|
||||
[self.loginView addSubview:self.topLoginTitleLab];
|
||||
|
||||
[self.topLoginTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_offset(0);
|
||||
make.top.mas_offset(40);
|
||||
make.height.mas_offset(kRealValue(40));
|
||||
}];
|
||||
|
||||
|
||||
UITextField *accountField = [[UITextField alloc]init];
|
||||
accountField.frame = CGRectMake(kRealValue(25),self.topLoginTitleLab.bottom + kRealValue(24), loginView.width - kRealValue(50), 48);
|
||||
accountField.placeholder = @"请输入员工编号或用户名";
|
||||
accountField.font = BOLDSYSTEMFONT(14);
|
||||
accountField.textColor = CFontColor1;
|
||||
@@ -203,9 +207,17 @@
|
||||
self.userNameField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
||||
[loginView addSubview:accountField ];
|
||||
//
|
||||
|
||||
[self.userNameField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(25);
|
||||
make.right.mas_offset(-25);
|
||||
make.height.mas_offset(48);
|
||||
make.top.mas_equalTo(self.topLoginTitleLab.mas_bottom).offset(kRealValue(24));
|
||||
}];
|
||||
|
||||
//
|
||||
MQTextField * passwordField = [[MQTextField alloc]init];
|
||||
passwordField.frame = CGRectMake(kRealValue(25), accountField.bottom + kRealValue(19), accountField.width, accountField.height);
|
||||
// passwordField.frame = CGRectMake(kRealValue(25), accountField.bottom + kRealValue(19), accountField.width, accountField.height);
|
||||
passwordField.placeholder = @"请输入密码";
|
||||
passwordField.font = BOLDSYSTEMFONT(14);
|
||||
passwordField.textColor = CFontColor1;
|
||||
@@ -223,7 +235,7 @@
|
||||
self.passwordField.layer.masksToBounds = true;
|
||||
self.passwordField.delegate = self;
|
||||
self.passwordField.inputView = self.keyboard;
|
||||
|
||||
|
||||
self.toggleButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[self.toggleButton setImage:[UIImage imageNamed:@"eye"] forState:UIControlStateNormal];
|
||||
[self.toggleButton setImage:[UIImage imageNamed:@"eye.slash"] forState:UIControlStateSelected];
|
||||
@@ -239,10 +251,16 @@
|
||||
[loginView addSubview:passwordField];
|
||||
|
||||
|
||||
[self.passwordField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(25);
|
||||
make.right.mas_offset(-25);
|
||||
make.height.mas_offset(48);
|
||||
make.top.mas_equalTo(self.userNameField.mas_bottom).offset(kRealValue(19));
|
||||
}];
|
||||
|
||||
|
||||
UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
loginBtn.frame = CGRectMake(kRealValue(25), self.passwordField.bottom + kRealValue(20), WIDTH - kRealValue(50), 48);
|
||||
// loginBtn.frame = CGRectMake(kRealValue(25), self.passwordField.bottom + kRealValue(20), WIDTH - kRealValue(50), 48);
|
||||
[loginBtn setTitle:@"登录" forState:UIControlStateNormal];
|
||||
[loginBtn.titleLabel setFont:BOLDSYSTEMFONT(16)];
|
||||
loginBtn.backgroundColor = UIColorHex(#2EB8B2);
|
||||
@@ -252,8 +270,18 @@
|
||||
[loginBtn addTarget:self action:@selector(toClickFootBtn:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[loginView addSubview:loginBtn];
|
||||
|
||||
[loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(kRealValue(25));
|
||||
make.right.mas_offset(-kRealValue(25));
|
||||
make.height.mas_offset(48);
|
||||
make.top.mas_equalTo(self.passwordField.mas_bottom).offset(kRealValue(20));
|
||||
}];
|
||||
|
||||
|
||||
|
||||
|
||||
UIButton * foundPasswordBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
foundPasswordBtn.frame = CGRectMake(loginBtn.right - 52, loginBtn.bottom + kRealValue(22), 52, 12);
|
||||
// foundPasswordBtn.frame = CGRectMake(loginBtn.right - 60, loginBtn.bottom + kRealValue(22), 60, 12);
|
||||
[foundPasswordBtn setTitle:@"找回密码" forState:UIControlStateNormal];
|
||||
foundPasswordBtn.titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
|
||||
[foundPasswordBtn setTitleColor:UIColorHex(#B6B6B6) forState:UIControlStateNormal];
|
||||
@@ -262,6 +290,12 @@
|
||||
[loginView addSubview:foundPasswordBtn];
|
||||
|
||||
|
||||
[foundPasswordBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(loginBtn.mas_right);
|
||||
make.height.mas_offset(kRealValue(20));
|
||||
make.top.mas_equalTo(loginBtn.mas_bottom).offset(18);
|
||||
}];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:@"LOGINAgree"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
||||
@@ -283,7 +317,7 @@
|
||||
{
|
||||
self.agreenBtn.selected = false;
|
||||
}
|
||||
[self.view addSubview:self.agreenBtn];
|
||||
[self.loginView addSubview:self.agreenBtn];
|
||||
|
||||
[self.agreenBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(25);
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
{
|
||||
[EasyTextView showErrorText:message];
|
||||
|
||||
NSLog(@"apiError=%@",message);
|
||||
DLog(@"apiError=%@",message);
|
||||
// [self showMessage:message];
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MyMessageDetailConnetController.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "XJBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MyMessageDetailConnetController : XJBaseViewController
|
||||
|
||||
@property (nonatomic, strong) NSString * messageID;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,285 @@
|
||||
//
|
||||
// MyMessageDetailConnetController.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "MyMessageDetailConnetController.h"
|
||||
#import <WebKit/WebKit.h>
|
||||
#import "MyMessageModel.h"
|
||||
|
||||
@interface MyMessageDetailConnetController () <WKNavigationDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIScrollView *scrollView;
|
||||
@property (nonatomic, strong) UIView *contentView;
|
||||
@property (nonatomic, strong) UIView *cardView;
|
||||
@property (nonatomic, strong) WKWebView *webView;
|
||||
|
||||
@property (nonatomic, strong) UILabel * titleLabel;
|
||||
@property (nonatomic, strong) UILabel * timeLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MyMessageDetailConnetController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.view.backgroundColor = KWhiteColor;
|
||||
self.isHidenNaviBar = false;
|
||||
self.navigationItem.title = @"消息详情";
|
||||
|
||||
[self setupUI];
|
||||
[self createData];
|
||||
}
|
||||
|
||||
#pragma mark - UI
|
||||
|
||||
- (void)setupUI {
|
||||
|
||||
/// 1️⃣ ScrollView
|
||||
self.scrollView = [[UIScrollView alloc] init];
|
||||
self.scrollView.alwaysBounceVertical = YES;
|
||||
self.scrollView.backgroundColor = KWhiteColor;
|
||||
[self.view addSubview:self.scrollView];
|
||||
|
||||
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
|
||||
/// 2️⃣ contentView(撑 scrollView)
|
||||
self.contentView = [[UIView alloc] init];
|
||||
[self.scrollView addSubview:self.contentView];
|
||||
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.scrollView);
|
||||
make.width.mas_equalTo(self.scrollView); // ⭐ 必须
|
||||
}];
|
||||
|
||||
/// 3️⃣ 白色卡片
|
||||
self.cardView = [[UIView alloc] init];
|
||||
self.cardView.backgroundColor = UIColor.whiteColor;
|
||||
self.cardView.layer.cornerRadius = 12;
|
||||
self.cardView.layer.masksToBounds = YES;
|
||||
[self.contentView addSubview:self.cardView];
|
||||
|
||||
[self.cardView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_offset(15);
|
||||
make.left.right.mas_offset(0);
|
||||
make.bottom.mas_offset(-15); // ⭐ 最小高度铺满屏幕
|
||||
}];
|
||||
|
||||
//加个标题
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.numberOfLines = 0;
|
||||
self.titleLabel.font = BOLDSYSTEMFONT(16);
|
||||
self.titleLabel.textColor = CFontColor1;
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self.cardView addSubview:self.titleLabel];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(15);
|
||||
make.right.mas_offset(-15);
|
||||
make.top.mas_offset(12);
|
||||
}];
|
||||
|
||||
self.timeLabel = [[UILabel alloc] init];
|
||||
self.timeLabel.font = SYSTEMFONT(12);
|
||||
self.timeLabel.textColor = CFontColor2;
|
||||
self.timeLabel.textAlignment = NSTextAlignmentRight;
|
||||
[self.cardView addSubview:self.timeLabel];
|
||||
|
||||
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_offset(-15);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(12);
|
||||
}];
|
||||
|
||||
|
||||
UIView *dashedView = [[UIView alloc] init];
|
||||
[self.cardView addSubview:dashedView];
|
||||
|
||||
// Masonry 布局
|
||||
[dashedView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(20);
|
||||
make.right.mas_equalTo(-20);
|
||||
make.top.mas_equalTo(self.timeLabel.mas_bottom).offset(10);
|
||||
make.height.mas_equalTo(1); // 高度可以随意
|
||||
}];
|
||||
//虚线
|
||||
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
|
||||
shapeLayer.strokeColor = [UIColor lightGrayColor].CGColor; // 线颜色
|
||||
shapeLayer.lineWidth = 1; // 线宽
|
||||
shapeLayer.lineDashPattern = @[@4, @2]; // 虚线:4pt 实线,2pt 空白
|
||||
|
||||
// 创建路径
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
CGPathMoveToPoint(path, NULL, 0, 0); // 起点
|
||||
CGPathAddLineToPoint(path, NULL, [UIScreen mainScreen].bounds.size.width - 40, 0); // 终点
|
||||
shapeLayer.path = path;
|
||||
CGPathRelease(path);
|
||||
|
||||
// 添加到 view
|
||||
[dashedView.layer addSublayer:shapeLayer];
|
||||
|
||||
/// 4️⃣ WKWebView
|
||||
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
|
||||
config.preferences.javaScriptEnabled = YES;
|
||||
|
||||
self.webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:config];
|
||||
self.webView.navigationDelegate = self;
|
||||
self.webView.scrollView.scrollEnabled = NO; // ⭐ 关键
|
||||
self.webView.backgroundColor = UIColor.clearColor;
|
||||
|
||||
[self.cardView addSubview:self.webView];
|
||||
|
||||
[self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.timeLabel.mas_bottom).offset(20);
|
||||
make.left.mas_offset(15);
|
||||
make.right.mas_offset(-15);
|
||||
make.height.mas_equalTo(1); // ⭐ 动态更新
|
||||
make.bottom.mas_equalTo(self.cardView.mas_bottom).offset(-15);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Data
|
||||
|
||||
- (void)createData {
|
||||
|
||||
[self showMBProgressHUDWithString:@"加载中,请稍候..." autoHidden:false];
|
||||
|
||||
NSMutableDictionary *parmDic = [[NSMutableDictionary alloc] init];
|
||||
[parmDic setObject:self.messageID forKey:@"id"];
|
||||
|
||||
XJPNetAPI *listApi = [[XJPNetAPI alloc] init:self tag:@"DETAIL" NeedToken:@""];
|
||||
[listApi getUserMessageDetailConnet:parmDic];
|
||||
}
|
||||
|
||||
#pragma mark - Net Callback
|
||||
|
||||
- (void)Failed:(NSString *)message tag:(NSString *)tag {
|
||||
[self hiddenAllMBProgressHUD];
|
||||
}
|
||||
|
||||
- (void)Sucess:(id)response tag:(NSString *)tag {
|
||||
|
||||
if ([tag isEqualToString:@"DETAIL"]) {
|
||||
|
||||
[self hiddenAllMBProgressHUD];
|
||||
|
||||
NSDictionary *dic = response;
|
||||
MyMessageModel *model = [MyMessageModel modelWithDictionary:dic];
|
||||
|
||||
self.titleLabel.text = model.title;
|
||||
|
||||
NSString *timeStr = [NSString stringWithFormat:@"%@",model.createTime];
|
||||
|
||||
if ([timeStr isKindOfClass:[NSString class]] && timeStr.length >= 16) {
|
||||
// 取到 yyyy-MM-dd HH:mm
|
||||
self.timeLabel.text = [timeStr substringToIndex:16];
|
||||
} else {
|
||||
// 融错
|
||||
self.timeLabel.text = @"";
|
||||
}
|
||||
[self loadHTML:model.content];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - Load HTML
|
||||
|
||||
- (void)loadHTML:(NSString *)content {
|
||||
|
||||
if (content.length == 0) return;
|
||||
|
||||
// 处理转义
|
||||
content = [content stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"];
|
||||
|
||||
NSString *html =
|
||||
[NSString stringWithFormat:
|
||||
@"<html>"
|
||||
"<head>"
|
||||
"<meta name='viewport' content='width=device-width, initial-scale=1.0'>"
|
||||
"<style>"
|
||||
"body { font-size: 15px; color: #333333; margin: 0; padding: 0; }"
|
||||
"img { max-width: 100%%; height: auto; }"
|
||||
"</style>"
|
||||
"</head>"
|
||||
"<body>%@</body>"
|
||||
"</html>", content];
|
||||
|
||||
BOOL needBaseURL = NO;
|
||||
|
||||
// 正则匹配所有 img 的 src
|
||||
NSError *error = nil;
|
||||
NSRegularExpression *regex =
|
||||
[NSRegularExpression regularExpressionWithPattern:@"<img[^>]+src=[\"']([^\"']+)[\"']"
|
||||
options:NSRegularExpressionCaseInsensitive
|
||||
error:&error];
|
||||
|
||||
NSArray *matches = [regex matchesInString:content
|
||||
options:0
|
||||
range:NSMakeRange(0, content.length)];
|
||||
|
||||
for (NSTextCheckingResult *match in matches) {
|
||||
|
||||
NSString *imgURL = [content substringWithRange:[match rangeAtIndex:1]];
|
||||
|
||||
if (![imgURL hasPrefix:@"http://"] &&
|
||||
![imgURL hasPrefix:@"https://"]) {
|
||||
|
||||
needBaseURL = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NSURL *baseURL = needBaseURL ? [NSURL URLWithString:ResourceAddress] : nil;
|
||||
|
||||
[self.webView loadHTMLString:html baseURL:baseURL];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - WKNavigationDelegate
|
||||
|
||||
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
// 第一次算高度
|
||||
[webView evaluateJavaScript:@"document.body.scrollHeight"
|
||||
completionHandler:^(id result, NSError *error) {
|
||||
|
||||
if (!error) {
|
||||
CGFloat height = [result doubleValue];
|
||||
[weakSelf updateWebViewHeight:height];
|
||||
}
|
||||
}];
|
||||
|
||||
// 如果有网络图片,延迟再算一次(更稳)
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)),
|
||||
dispatch_get_main_queue(), ^{
|
||||
[webView evaluateJavaScript:@"document.body.scrollHeight"
|
||||
completionHandler:^(id result, NSError *error) {
|
||||
if (!error) {
|
||||
CGFloat height = [result doubleValue];
|
||||
[weakSelf updateWebViewHeight:height];
|
||||
}
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)updateWebViewHeight:(CGFloat)height {
|
||||
|
||||
[self.webView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(height);
|
||||
}];
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MyMessageListViewController.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "XJBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MyMessageListViewController : XJBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// MyMessageListViewController.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "MyMessageListViewController.h"
|
||||
#import "MyMessageListTableViewCell.h"
|
||||
#import "MyMessageModel.h"
|
||||
#import "MyMessageDetailConnetController.h"
|
||||
|
||||
|
||||
@interface MyMessageListViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
|
||||
@property (nonatomic, assign) NSInteger pageNo;
|
||||
|
||||
@property (nonatomic, strong) UITableView * homeTable;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray * dataArray;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MyMessageListViewController
|
||||
|
||||
- (NSMutableArray *)dataArray {
|
||||
|
||||
if (!_dataArray) {
|
||||
_dataArray = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.view.backgroundColor = KWhiteColor;
|
||||
self.isHidenNaviBar = false;
|
||||
self.navigationItem.title = @"我的消息";
|
||||
[self createUI];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
||||
[super viewWillAppear:animated];
|
||||
[self.homeTable.mj_header beginRefreshing];
|
||||
|
||||
}
|
||||
|
||||
- (void)createUI {
|
||||
|
||||
self.homeTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) {
|
||||
self.homeTable.estimatedRowHeight = 60;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.homeTable.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
self.homeTable.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
self.homeTable.delegate = self;
|
||||
self.homeTable.dataSource = self;
|
||||
self.homeTable.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
|
||||
self.homeTable.showsVerticalScrollIndicator = NO;
|
||||
self.homeTable.backgroundColor = KClearColor;
|
||||
self.homeTable.rowHeight = UITableViewAutomaticDimension;
|
||||
self.homeTable.estimatedRowHeight = 80;
|
||||
|
||||
|
||||
[self.view addSubview:self.homeTable];
|
||||
|
||||
[self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_offset(0);
|
||||
}];
|
||||
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
self.homeTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
|
||||
weakSelf.pageNo = 1;
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf createData];
|
||||
|
||||
}];
|
||||
|
||||
self.homeTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
|
||||
weakSelf.pageNo++;
|
||||
[weakSelf createData];
|
||||
|
||||
}];
|
||||
|
||||
|
||||
LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"noDataBox" titleStr:@"暂无数据" detailStr:@""];
|
||||
//元素竖直方向的间距
|
||||
emptyView.subViewMargin = 20.f;
|
||||
//标题颜色
|
||||
emptyView.titleLabTextColor = [UIColor blackColor];
|
||||
//描述字体
|
||||
emptyView.detailLabFont = [UIFont systemFontOfSize:17];
|
||||
//按钮背景色
|
||||
emptyView.actionBtnBackGroundColor = KWhiteColor;
|
||||
emptyView.actionBtnWidth = CGFLOAT_MIN;
|
||||
emptyView.actionBtnHeight = CGFLOAT_MIN;
|
||||
//设置空内容占位图
|
||||
self.homeTable.ly_emptyView = emptyView;
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)createData {
|
||||
|
||||
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
|
||||
[parmDic setObject:@(self.pageNo) forKey:@"pageNo"];
|
||||
[parmDic setObject:@"10" forKey:@"pageSize"];
|
||||
|
||||
XJPNetAPI * listApi = [[XJPNetAPI alloc] init:self tag:@"LIST" NeedToken:@""];
|
||||
[listApi getUserMessageList:parmDic];
|
||||
|
||||
}
|
||||
|
||||
- (void)Failed:(NSString*)message tag:(NSString*)tag
|
||||
{
|
||||
|
||||
[self.homeTable.mj_header endRefreshing];
|
||||
[self.homeTable.mj_footer endRefreshing];
|
||||
|
||||
[self hiddenAllMBProgressHUD];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)Sucess:(id)response tag:(NSString*)tag
|
||||
{
|
||||
[self.homeTable.mj_header endRefreshing];
|
||||
[self.homeTable.mj_footer endRefreshing];
|
||||
if ([tag isEqualToString:@"LIST"]) {
|
||||
|
||||
[self hiddenAllMBProgressHUD];
|
||||
NSArray * array = response;
|
||||
|
||||
for (NSDictionary * dic in array) {
|
||||
|
||||
MyMessageModel * model = [MyMessageModel modelWithDictionary:dic];
|
||||
|
||||
[self.dataArray addObject:model];
|
||||
|
||||
}
|
||||
[self.homeTable reloadData];
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - DataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
|
||||
MyMessageModel * model = self.dataArray[indexPath.row];
|
||||
|
||||
|
||||
MyMessageListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MESSAGECELL"];
|
||||
|
||||
if (!cell) {
|
||||
|
||||
cell = [[MyMessageListTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"MESSAGECELL"];
|
||||
}
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
cell.model = model;
|
||||
return cell;
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
MyMessageModel * model = self.dataArray[indexPath.row];
|
||||
MyMessageDetailConnetController * addVC = [[MyMessageDetailConnetController alloc] init];
|
||||
addVC.messageID = model.message_id;
|
||||
[self.navigationController pushViewController:addVC animated:YES];
|
||||
|
||||
}
|
||||
|
||||
- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
|
||||
return UIView.new;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
stringPickerView.dataSourceArr = array;
|
||||
stringPickerView.selectIndex = 2;
|
||||
stringPickerView.resultModelBlock = ^(BRResultModel *resultModel) {
|
||||
NSLog(@"选择的值:%@", resultModel.value);
|
||||
DLog(@"选择的值:%@", resultModel.value);
|
||||
|
||||
for (FamilyMemberRelationModel * model in self.memberArray) {
|
||||
|
||||
|
||||
@@ -82,7 +82,11 @@
|
||||
// Do any additional setup after loading the view.
|
||||
self.isHidenNaviBar = false;
|
||||
self.pageNo = 0;
|
||||
self.type = [NSString stringWithFormat:@"%ld",_selectOnes];
|
||||
if (self.selectOnes == 6) {
|
||||
self.type = @"";
|
||||
}else {
|
||||
self.type = [NSString stringWithFormat:@"%ld",self.selectOnes];
|
||||
}
|
||||
[self createUI];
|
||||
if (self.isSlected == true) {
|
||||
[self createData];
|
||||
@@ -272,7 +276,7 @@
|
||||
self.type = @"5";
|
||||
}
|
||||
if (statusBtn.tag == 1003) { //全部
|
||||
self.type = @"6";
|
||||
self.type = @"";
|
||||
}
|
||||
for (UIButton * titBtn in self.buttonArray) {
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#import "XJSOSLookDoctoreViewController.h"
|
||||
#import "XJEmergencyListViewController.h"
|
||||
#import "SimulationViewController.h"
|
||||
#import "MyMessageListViewController.h"
|
||||
#import "myPointsBankHomeViewController.h"
|
||||
|
||||
@interface XJMyCenterViewController ()<myCenterHeardToolsDelegate,cenerCellListDelegate>
|
||||
|
||||
@@ -197,7 +199,10 @@
|
||||
}
|
||||
|
||||
- (void)cellListClick:(NSInteger)cellIndex {
|
||||
|
||||
if(![HQCommonUtils isLogin]) {
|
||||
KPostNotification(KNotificationLoginStateChange, @NO);
|
||||
return;
|
||||
}
|
||||
HQUserInfo *infoModel = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo];
|
||||
|
||||
UIViewController *vcToPush = nil;
|
||||
@@ -211,6 +216,10 @@
|
||||
case 2:
|
||||
vcToPush = [[XJEmergencyListViewController alloc] init];
|
||||
break;
|
||||
case 3:
|
||||
vcToPush = [[MyMessageListViewController alloc] init];
|
||||
// vcToPush = [[myPointsBankHomeViewController alloc] init];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// MyMessageModel.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MyMessageModel : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString * message_id;
|
||||
@property (nonatomic, copy) NSString * delFlag;
|
||||
@property (nonatomic, copy) NSString * updateBy;
|
||||
@property (nonatomic, copy) NSString * content;
|
||||
@property (nonatomic, copy) NSString * scopeType;
|
||||
@property (nonatomic, copy) NSString * title;
|
||||
@property (nonatomic, copy) NSString * createTime;
|
||||
@property (nonatomic, copy) NSString * noticeStatus;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MyMessageModel.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "MyMessageModel.h"
|
||||
|
||||
@implementation MyMessageModel
|
||||
|
||||
+ (NSDictionary *)modelCustomPropertyMapper
|
||||
{
|
||||
NSDictionary * dic =@{@"message_id" :@"id"};
|
||||
return dic;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MyMessageListTableViewCell.h
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MyMessageModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MyMessageListTableViewCell : UITableViewCell
|
||||
|
||||
@property (nonatomic, strong) MyMessageModel * model;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// MyMessageListTableViewCell.m
|
||||
// XinjiangProject
|
||||
//
|
||||
// Created by Apple on 2026/2/6.
|
||||
//
|
||||
|
||||
#import "MyMessageListTableViewCell.h"
|
||||
|
||||
@interface MyMessageListTableViewCell ()
|
||||
|
||||
@property (nonatomic, strong) UILabel * messageLabel;
|
||||
|
||||
@property (nonatomic, strong) UILabel * timeLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MyMessageListTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
|
||||
if (self =[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
|
||||
[self createUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createUI {
|
||||
|
||||
UIImageView * iconImg = [[UIImageView alloc] init];
|
||||
iconImg.image = [UIImage imageNamed:@"xiaolaba"];
|
||||
[self.contentView addSubview:iconImg];
|
||||
|
||||
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.mas_offset(15);
|
||||
make.width.height.mas_offset(20);
|
||||
}];
|
||||
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.textColor = CFontColor1;
|
||||
self.messageLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.messageLabel.numberOfLines = 2;
|
||||
self.messageLabel.font = BOLDSYSTEMFONT(16);
|
||||
[self.contentView addSubview:self.messageLabel];
|
||||
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(iconImg.mas_right).offset(5);
|
||||
make.right.mas_offset(-15);
|
||||
make.top.mas_offset(15);
|
||||
|
||||
}];
|
||||
|
||||
self.timeLabel = [[UILabel alloc] init];
|
||||
self.timeLabel.textColor = CFontColor2;
|
||||
self.timeLabel.font = MEDIUMFONT(12);
|
||||
self.timeLabel.textAlignment = NSTextAlignmentRight;
|
||||
[self.contentView addSubview:self.timeLabel];
|
||||
|
||||
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_offset(-15);
|
||||
make.top.mas_equalTo(self.messageLabel.mas_bottom).offset(15);
|
||||
make.bottom.mas_offset(-10);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)setModel:(MyMessageModel *)model {
|
||||
|
||||
_model = model;
|
||||
|
||||
self.messageLabel.text = [NSString stringWithFormat:@"%@",_model.title];
|
||||
|
||||
NSString *timeStr = [NSString stringWithFormat:@"%@",_model.createTime];
|
||||
|
||||
NSString *result = @"";
|
||||
if ([timeStr isKindOfClass:[NSString class]] && timeStr.length >= 16) {
|
||||
// 取到 yyyy-MM-dd HH:mm
|
||||
self.timeLabel.text = [timeStr substringToIndex:16];
|
||||
} else {
|
||||
// 融错
|
||||
self.timeLabel.text = @"";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -88,7 +88,7 @@
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
|
||||
return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
@@ -103,7 +103,8 @@
|
||||
NSArray *sectionOne = @[
|
||||
@[@"咨询人管理", @"relatives_icon"],
|
||||
@[@"应急就医", @"medicalReson_icon"],
|
||||
@[@"紧急联系人", @"emergency_icon"]
|
||||
@[@"紧急联系人", @"emergency_icon"],
|
||||
@[@"我的消息", @"myMessage_icon"]
|
||||
];
|
||||
|
||||
static NSString * cellID = @"cellID";
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
@property (nonatomic, strong) UIView * contentView;
|
||||
|
||||
@property (nonatomic, strong) UIImageView * detailImg ;
|
||||
@end
|
||||
|
||||
@implementation BannarDetailViewController
|
||||
@@ -25,6 +26,8 @@
|
||||
self.view.backgroundColor = KWhiteColor;
|
||||
self.navigationItem.title = @"员工心理帮助计划";
|
||||
|
||||
|
||||
|
||||
self.mainScrollView = [[UIScrollView alloc] init];
|
||||
self.mainScrollView.backgroundColor = KWhiteColor;
|
||||
self.mainScrollView.showsVerticalScrollIndicator = false;
|
||||
@@ -57,7 +60,10 @@
|
||||
}];
|
||||
|
||||
UIImageView * detailImg = [[UIImageView alloc] init];
|
||||
detailImg.image = [UIImage imageNamed:@"ADDetail"];
|
||||
// detailImg.image = [UIImage imageNamed:@"ADDetail"];
|
||||
self.detailImg = detailImg;
|
||||
self.detailImg.sd_imageIndicator = [SDWebImageActivityIndicator grayIndicator];
|
||||
|
||||
[contentView addSubview:detailImg];
|
||||
|
||||
[detailImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -68,8 +74,59 @@
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(detailImg);
|
||||
}];
|
||||
|
||||
//请求图片
|
||||
[self getDetailImageAddress];
|
||||
}
|
||||
|
||||
- (void)getDetailImageAddress {
|
||||
|
||||
|
||||
XJPNetAPI * homeRemakerApi = [[XJPNetAPI alloc] init:self tag:@"IMGURL" NeedToken:@""];
|
||||
|
||||
[homeRemakerApi getDetailImageAddress:nil];
|
||||
|
||||
}
|
||||
|
||||
- (void)Failed:(NSString*)message tag:(NSString*)tag
|
||||
{
|
||||
|
||||
[self showMBProgressHUDOnlyWithString:message];
|
||||
[self hiddenAllMBProgressHUD];
|
||||
|
||||
}
|
||||
|
||||
- (void)Sucess:(id)response tag:(NSString*)tag
|
||||
{
|
||||
if ([tag isEqualToString:@"IMGURL"]) {
|
||||
|
||||
NSString * urlString = response;
|
||||
|
||||
NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,urlString];
|
||||
|
||||
NSString * str1 = @"\\";
|
||||
|
||||
photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"];
|
||||
|
||||
NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8));
|
||||
|
||||
[self.detailImg sd_setImageWithURL:[NSURL URLWithString:encodedString3]
|
||||
placeholderImage:nil
|
||||
options:SDWebImageRetryFailed
|
||||
completed:^(UIImage * _Nullable image,
|
||||
NSError * _Nullable error,
|
||||
SDImageCacheType cacheType,
|
||||
NSURL * _Nullable imageURL) {
|
||||
|
||||
if (error) {
|
||||
self.detailImg.image = [UIImage imageNamed:@"image_load_fail"]; // 失败图
|
||||
}
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
#import <AMapLocationKit/AMapLocationKit.h>
|
||||
#import <AMapSearchKit/AMapSearchKit.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import "PSAppInfo.h"
|
||||
#import "PSCheckVersionView.h"
|
||||
//#import "PSAppInfo.h"
|
||||
//#import "PSCheckVersionView.h"
|
||||
#import "RoomDoctorRecordsVC.h"
|
||||
#import "HomeQusetionRecordsModel.h"
|
||||
#import "XJDoctorMainViewController.h"
|
||||
#import "UPAppVesionModel.h"
|
||||
//#import "UPAppVesionModel.h"
|
||||
#import "BannarDetailViewController.h"
|
||||
#import "HomeBannerModel.h"
|
||||
|
||||
|
||||
static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
@@ -36,8 +37,8 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
@property (nonatomic, strong) HealthyQuestionTable * homeTable;
|
||||
|
||||
@property (nonatomic, assign) NSInteger page;
|
||||
|
||||
@property (nonatomic, strong) PSCheckVersionView * checkVersionView;
|
||||
//
|
||||
//@property (nonatomic, strong) PSCheckVersionView * checkVersionView;
|
||||
|
||||
@property (nonatomic, strong) UIView * coverView;
|
||||
//定位相关
|
||||
@@ -59,6 +60,14 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
|
||||
@property (nonatomic, strong) MASConstraint *tableHeightConstraint;
|
||||
|
||||
@property (nonatomic, strong) HealthyQuestionHeardView * topView;
|
||||
|
||||
//用gcd做轮询
|
||||
@property (nonatomic, strong) dispatch_source_t timer;
|
||||
|
||||
@property (nonatomic, assign) BOOL polling; //失败了也轮询?先不管 有需要回调处理去
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -99,7 +108,9 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
object:nil];
|
||||
// [self createUI];
|
||||
[self updateV2UI];
|
||||
[self getUpDateinfo];
|
||||
// [self getUpDateinfo];
|
||||
//请求banner图
|
||||
// [self getBannerListData];
|
||||
self.page = 1;
|
||||
[self verifyTokenData];
|
||||
[self initCompleteBlock];
|
||||
@@ -144,9 +155,7 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
if (!ValidStr(UserDefaultObjectForKey(@"HTTPS"))) {
|
||||
[self verifyTokenData];
|
||||
}
|
||||
[self verifyTokenData];
|
||||
|
||||
|
||||
}
|
||||
@@ -300,13 +309,14 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark:请求结果
|
||||
- (void)Sucess:(id)response tag:(NSString*)tag
|
||||
{
|
||||
[self.mainScrollView.mj_footer endRefreshing];
|
||||
[self.mainScrollView.mj_header endRefreshing];
|
||||
[self hiddenAllMBProgressHUD];
|
||||
if ([tag isEqualToString:@"RECOMMEND"]) {
|
||||
[self hiddenAllMBProgressHUD];
|
||||
|
||||
NSArray * array = response ;
|
||||
if (self.page == 1) {
|
||||
[self.dataArray removeAllObjects];
|
||||
@@ -434,84 +444,8 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
[self.navigationController pushViewController:chatVC animated:YES];
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ([tag isEqualToString:@"UPVERSION"]) {
|
||||
|
||||
NSDictionary * dic = response;
|
||||
|
||||
UPAppVesionModel * model = [UPAppVesionModel modelWithDictionary:dic];
|
||||
// 避免1.0.10 跟 1.0.1 出错
|
||||
|
||||
NSString *version =
|
||||
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
||||
|
||||
NSString *versionCode =
|
||||
[version stringByReplacingOccurrencesOfString:@"." withString:@""];
|
||||
|
||||
NSInteger loctaionVesion = [versionCode integerValue];
|
||||
|
||||
NSDictionary * infoDic = @{
|
||||
@"version":[NSString stringWithFormat:@"%@",model.versionName] ,
|
||||
@"releaseNotes":model.updateContent,
|
||||
@"currentVersionReleaseDate":model.updateTime};
|
||||
|
||||
PSAppInfo * info = [[PSAppInfo alloc] initWithDict:infoDic];
|
||||
//是否需要强制更新
|
||||
|
||||
BOOL isNeed = [model.forced integerValue] == 1 ? YES : NO;
|
||||
|
||||
if ( model.versionNo > loctaionVesion) {
|
||||
[self show:info isNeedUpdate:isNeed];
|
||||
}else
|
||||
{
|
||||
DLog(@"不需要更新");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//是否需要更新
|
||||
- (void)show:(PSAppInfo *)info isNeedUpdate:(BOOL)isNeed {
|
||||
|
||||
|
||||
__weak typeof(self)weakSelf = self;
|
||||
|
||||
if(isNeed == true) { //强制更新
|
||||
self.checkVersionView = [[PSCheckVersionView alloc]
|
||||
initWithAppInfo:info
|
||||
confirm:^{
|
||||
[weakSelf jumpAppStoreUpdate];
|
||||
}];
|
||||
|
||||
}else {
|
||||
self.checkVersionView = [[PSCheckVersionView alloc] initWithAppInfo:info confirm:^{
|
||||
|
||||
[weakSelf jumpAppStoreUpdate];
|
||||
|
||||
} cancel:^{
|
||||
|
||||
[self.coverView removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
[self.coverView addSubview:self.checkVersionView];
|
||||
[self.checkVersionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.equalTo(self.coverView).multipliedBy(0.75);
|
||||
make.height.equalTo(self.coverView).multipliedBy(0.33);
|
||||
make.center.equalTo(self.coverView);
|
||||
}];
|
||||
|
||||
[[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:self.coverView];
|
||||
}
|
||||
|
||||
- (void)jumpAppStoreUpdate {
|
||||
|
||||
//强制退出
|
||||
exit(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark:小助手的回调
|
||||
- (void)loginImAccount {
|
||||
|
||||
@@ -551,8 +485,7 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
- (void)smallQuestionAction {
|
||||
|
||||
if ([ESCTUIManager TUIUserStatus] == false) {
|
||||
|
||||
|
||||
|
||||
[self loginImAccount];
|
||||
return;
|
||||
}
|
||||
@@ -612,13 +545,13 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
|
||||
- (void)handleLocationServicesRestricted {
|
||||
// 处理位置服务受限的情况
|
||||
NSLog(@"位置服务被限制");
|
||||
DLog(@"位置服务被限制");
|
||||
[self showAlertToOpenSettings];
|
||||
}
|
||||
|
||||
- (void)handleLocationServicesDenied {
|
||||
// 处理位置服务被拒绝的情况
|
||||
NSLog(@"位置服务被拒绝");
|
||||
DLog(@"位置服务被拒绝");
|
||||
[self showAlertToOpenSettings];
|
||||
}
|
||||
|
||||
@@ -626,7 +559,7 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
|
||||
- (void)handleLocationServicesDisabled {
|
||||
// 处理设备的定位服务被禁用的情况
|
||||
NSLog(@"设备的定位服务被禁用");
|
||||
DLog(@"设备的定位服务被禁用");
|
||||
[self showAlertToOpenSettings];
|
||||
}
|
||||
|
||||
@@ -663,9 +596,8 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
self.mainScrollView.backgroundColor = CViewBgColor;
|
||||
self.mainScrollView.showsVerticalScrollIndicator = false;
|
||||
self.mainScrollView.showsHorizontalScrollIndicator = false;
|
||||
self.mainScrollView.contentInset = UIEdgeInsetsZero; // 让 scrollView 从顶部开始
|
||||
self.mainScrollView.scrollIndicatorInsets = UIEdgeInsetsZero; // 滚动指示器也不受影响
|
||||
|
||||
self.mainScrollView.contentInset = UIEdgeInsetsZero; // 让 scrollView 从顶部开始
|
||||
self.mainScrollView.scrollIndicatorInsets = UIEdgeInsetsZero; // 滚动指示器也不受影响
|
||||
self.mainScrollView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight - kTabBarHeight);
|
||||
// 如果使用自动调整
|
||||
if (@available(iOS 11.0, *)) {
|
||||
@@ -675,7 +607,7 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
|
||||
// 创建一个 contentView(所有内容都加在这个 view 上)
|
||||
UIView *contentView = [[UIView alloc] init];
|
||||
contentView.backgroundColor = [UIColor whiteColor];
|
||||
contentView.backgroundColor = CViewBgColor;
|
||||
self.contentView = contentView;
|
||||
[self.mainScrollView addSubview:contentView];
|
||||
|
||||
@@ -696,6 +628,7 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
}];
|
||||
|
||||
HealthyQuestionHeardView * topView = [[HealthyQuestionHeardView alloc] initWithFrame:CGRectZero];
|
||||
self.topView = topView;
|
||||
topView.headDelegate = self;
|
||||
[self.contentView addSubview:topView];
|
||||
//
|
||||
@@ -711,7 +644,8 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
|
||||
[self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(topView.mas_bottom);
|
||||
make.left.right.equalTo(self.contentView);
|
||||
make.left.mas_offset(15);
|
||||
make.right.mas_offset(-15);
|
||||
self.tableHeightConstraint = make.height.mas_equalTo(kEmptyTableMinHeight);
|
||||
make.bottom.equalTo(self.contentView.mas_bottom);
|
||||
}];
|
||||
@@ -724,6 +658,12 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
kWeakSelf(self);
|
||||
self.homeTable.tableBlock = ^(HomeQusetionRecordsModel * _Nonnull model) {
|
||||
weakself.recomendModel = model;
|
||||
|
||||
if(![HQCommonUtils isLogin]) {
|
||||
KPostNotification(KNotificationLoginStateChange, @NO);
|
||||
return;
|
||||
}
|
||||
|
||||
//1图文 2视频
|
||||
if ([model.contentType intValue] == 2) {
|
||||
|
||||
@@ -767,16 +707,22 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
};
|
||||
|
||||
self.homeTable.lookMoreBlock = ^{
|
||||
|
||||
if(![HQCommonUtils isLogin]) {
|
||||
KPostNotification(KNotificationLoginStateChange, @NO);
|
||||
return;
|
||||
}
|
||||
[weakself myQuestionAction];
|
||||
|
||||
};
|
||||
//初始化一个emptyView
|
||||
|
||||
|
||||
LYEmptyView *emptyView = [LYEmptyView emptyViewWithImage:[UIImage imageNamed:@"noQuetionList"]
|
||||
titleStr:@"暂无咨询记录" detailStr:@""];
|
||||
//元素竖直方向的间距
|
||||
emptyView.titleLabMargin = kRealValue(5);
|
||||
emptyView.contentViewY = kRealValue(80);
|
||||
emptyView.contentViewY = kRealValue(45);
|
||||
emptyView.emptyViewIsCompleteCoverSuperView = YES;
|
||||
emptyView.imageSize = CGSizeMake(kRealValue(101), kRealValue(60));
|
||||
//标题颜色
|
||||
emptyView.titleLabTextColor =UIColorHex(#14BEBE);
|
||||
@@ -810,11 +756,6 @@ static CGFloat const kEmptyTableMinHeight = 300; // 或屏幕高度的一半
|
||||
}
|
||||
}
|
||||
|
||||
-(void)SDCycleScrollViewItemClick {
|
||||
|
||||
BannarDetailViewController * detailVC = [[BannarDetailViewController alloc] init];
|
||||
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -352,7 +352,7 @@
|
||||
datePickerView.isAutoSelect = YES;
|
||||
datePickerView.showUnitType = BRShowUnitTypeOnlyCenter;
|
||||
datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) {
|
||||
NSLog(@"选择的值:%@", selectValue);
|
||||
DLog(@"选择的值:%@", selectValue);
|
||||
self.birthdayTextField.text = selectValue;
|
||||
};
|
||||
|
||||
@@ -376,7 +376,7 @@
|
||||
stringPickerView.dataSourceArr = array;
|
||||
stringPickerView.selectIndex = 2;
|
||||
stringPickerView.resultModelBlock = ^(BRResultModel *resultModel) {
|
||||
NSLog(@"选择的值:%@", resultModel.value);
|
||||
DLog(@"选择的值:%@", resultModel.value);
|
||||
|
||||
|
||||
for (FamilyMemberRelationModel * model in self.memberArray) {
|
||||
|
||||
@@ -150,9 +150,9 @@
|
||||
NSRange range = [mainString rangeOfString:subString];
|
||||
|
||||
if (range.location != NSNotFound) {
|
||||
NSLog(@"Substring '%@' found at location %lu, length %lu", subString, (unsigned long)range.location, (unsigned long)range.length);
|
||||
DLog(@"Substring '%@' found at location %lu, length %lu", subString, (unsigned long)range.location, (unsigned long)range.length);
|
||||
} else {
|
||||
NSLog(@"Substring '%@' not found", subString);
|
||||
DLog(@"Substring '%@' not found", subString);
|
||||
}
|
||||
|
||||
QuestionOptionCustomModel * model = [[QuestionOptionCustomModel alloc] init];
|
||||
|
||||
@@ -501,6 +501,7 @@ else
|
||||
{
|
||||
topView.isSelected = false;
|
||||
}
|
||||
topView.lastType = i ;
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@
|
||||
[frameArray enumerateObjectsUsingBlock:^(NSNumber *number, NSUInteger idx, BOOL *stop) {
|
||||
sum += [number floatValue];
|
||||
}];
|
||||
NSLog(@"Sum: %f", sum);
|
||||
DLog(@"Sum: %f", sum);
|
||||
self.homeTable.dataArray = dataArray;
|
||||
|
||||
self.homeTable.frame = CGRectMake(kRealValue(15), self.doctorView.bottom + kRealValue(10), kScreenWidth - kRealValue(30), sum +kRealValue(50) );
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes];
|
||||
NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
|
||||
[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
|
||||
NSLog(@"-----clear webView cache success------");
|
||||
DLog(@"-----clear webView cache success------");
|
||||
}];
|
||||
} else {
|
||||
NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
|
||||
@@ -148,7 +148,7 @@
|
||||
NSError *errors;
|
||||
[[NSFileManager defaultManager] removeItemAtPath:cookiesFolderPath error:&errors];
|
||||
if (!errors) {
|
||||
NSLog(@"-----clear wkWebView cache success------");
|
||||
DLog(@"-----clear wkWebView cache success------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
|
||||
- (void)lookImageReport:(UIButton *)lookBtn {
|
||||
|
||||
NSLog(@"%d",lookBtn.tag);
|
||||
DLog(@"%d",lookBtn.tag);
|
||||
//影片原像
|
||||
if (lookBtn.tag < 2000) {
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) CGFloat h;
|
||||
|
||||
@property (nonatomic, weak)id <questionToolsProtocl> headDelegate;
|
||||
@property (nonatomic, copy) NSString * haveSessioning;
|
||||
|
||||
@property (nonatomic, strong) NSArray * picArray;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -8,11 +8,14 @@
|
||||
#import "HealthyQuestionHeardView.h"
|
||||
#import "SDCycleScrollView.h"
|
||||
#import "HealthyToolsView.h"
|
||||
#import "HomeBannerModel.h"
|
||||
|
||||
@interface HealthyQuestionHeardView ()<SDCycleScrollViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) SDCycleScrollView * adTitleView;
|
||||
@property (nonatomic, strong) UIView * redRadioView;
|
||||
|
||||
@property (nonatomic, strong) SDCycleScrollView * cycleView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation HealthyQuestionHeardView
|
||||
@@ -45,6 +48,7 @@
|
||||
[topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.right.mas_offset(0);
|
||||
make.height.mas_offset(kStatusBarHeight);
|
||||
|
||||
}];
|
||||
|
||||
UIImageView * backImage = [[UIImageView alloc] init];
|
||||
@@ -56,6 +60,7 @@
|
||||
make.left.right.mas_offset(0);
|
||||
make.height.mas_offset(kRealValue(288));
|
||||
make.top.mas_equalTo(topView.mas_bottom).offset(-1);
|
||||
make.bottom.mas_equalTo(self.mas_bottom).offset(-15);
|
||||
}];
|
||||
|
||||
|
||||
@@ -102,30 +107,32 @@
|
||||
}
|
||||
|
||||
//加个轮播图
|
||||
NSArray *originImages = @[@"h1"];
|
||||
|
||||
SDCycleScrollView *cycleView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero shouldInfiniteLoop:YES imageNamesGroup:originImages];
|
||||
cycleView.backgroundColor = KClearColor;
|
||||
cycleView.layer.cornerRadius = 8;
|
||||
cycleView.layer.masksToBounds = true;
|
||||
cycleView.showPageControl = YES;
|
||||
cycleView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
|
||||
|
||||
cycleView.delegate = self;
|
||||
// if (originImages.count <= 1) {
|
||||
// cycleView.autoScroll = NO;
|
||||
//// cycleView.scrollEnabled = NO;
|
||||
// }
|
||||
[self addSubview:cycleView];
|
||||
cycleView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
|
||||
[cycleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(15);
|
||||
make.right.mas_offset(-15);
|
||||
make.top.mas_equalTo(lastView.mas_bottom).offset(15);
|
||||
make.height.mas_offset(120);
|
||||
make.bottom.mas_equalTo(self.mas_bottom).offset(-15);
|
||||
}];
|
||||
// NSArray *originImages = @[@"h1"];
|
||||
//
|
||||
// SDCycleScrollView *cycleView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero shouldInfiniteLoop:YES imageNamesGroup:originImages];
|
||||
// self.cycleView = cycleView;
|
||||
// cycleView.backgroundColor = KClearColor;
|
||||
// cycleView.layer.cornerRadius = 8;
|
||||
// cycleView.layer.masksToBounds = true;
|
||||
// cycleView.showPageControl = YES;
|
||||
// cycleView.placeholderImage = PLACEHOLD_IMG;
|
||||
// cycleView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
|
||||
//
|
||||
// cycleView.delegate = self;
|
||||
//// if (originImages.count <= 1) {
|
||||
//// cycleView.autoScroll = NO;
|
||||
////// cycleView.scrollEnabled = NO;
|
||||
//// }
|
||||
// [self addSubview:cycleView];
|
||||
// cycleView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
//
|
||||
// [cycleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_offset(15);
|
||||
// make.right.mas_offset(-15);
|
||||
// make.top.mas_equalTo(lastView.mas_bottom).offset(15);
|
||||
// make.height.mas_offset(120);
|
||||
// make.bottom.mas_equalTo(self.mas_bottom).offset(-15);
|
||||
// }];
|
||||
|
||||
}
|
||||
|
||||
@@ -162,16 +169,32 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setHaveSessioning:(NSString *)haveSessioning {
|
||||
_haveSessioning = haveSessioning;
|
||||
if ([_haveSessioning integerValue] != 0) {
|
||||
self.redRadioView.hidden = false;
|
||||
}else
|
||||
{
|
||||
self.redRadioView.hidden = YES;
|
||||
- (void)setPicArray:(NSArray *)picArray {
|
||||
|
||||
_picArray = picArray;
|
||||
|
||||
NSMutableArray * dataArray = [[NSMutableArray alloc] init];
|
||||
|
||||
for (HomeBannerModel * model in _picArray) {
|
||||
|
||||
//直接处理图片吧
|
||||
NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,model.photoUrl];
|
||||
|
||||
NSString * str1 = @"\\";
|
||||
|
||||
photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"];
|
||||
|
||||
NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8));
|
||||
|
||||
[dataArray addObject:encodedString3];
|
||||
|
||||
}
|
||||
|
||||
|
||||
self.cycleView.imageURLStringsGroup = dataArray;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
|
||||
UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kRealValue(45))];
|
||||
UIView * sectionHeardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - 30, kRealValue(45))];
|
||||
sectionHeardView.backgroundColor = CViewBgColor;
|
||||
|
||||
UILabel * todayLabel = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(15), kRealValue(16), 190, 16)];
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
[sectionHeardView addSubview:todayLabel];
|
||||
|
||||
YYLabel * morelabel = [[YYLabel alloc] initWithFrame:CGRectMake(kScreenWidth - 165 , kRealValue(17), 150, 15)];
|
||||
YYLabel * morelabel = [[YYLabel alloc] initWithFrame:CGRectMake(sectionHeardView.width - 165 , kRealValue(17), 150, 15)];
|
||||
|
||||
morelabel.text = @"更多 >";
|
||||
morelabel.textAlignment = NSTextAlignmentRight;
|
||||
|
||||
@@ -68,10 +68,10 @@
|
||||
[self.contentView addSubview:self.backView];
|
||||
//
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(18);
|
||||
make.right.mas_offset(-18);
|
||||
make.left.mas_offset(0);
|
||||
make.right.mas_offset(0);
|
||||
make.top.mas_offset(0);
|
||||
make.bottom.mas_offset(15);
|
||||
make.bottom.mas_offset(0);
|
||||
}];
|
||||
//
|
||||
|
||||
@@ -234,8 +234,8 @@
|
||||
|
||||
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_offset(18);
|
||||
make.right.mas_offset(-18);
|
||||
make.left.mas_offset(0);
|
||||
make.right.mas_offset(0);
|
||||
make.top.mas_offset(15);
|
||||
make.bottom.mas_equalTo(self.questionTime.mas_bottom).offset(16);
|
||||
}];
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
// 输出排序后的模型数组
|
||||
for (QuestionOptionCustomModel * customModel in _model.answerList) {
|
||||
NSLog(@"Value: %ld", customModel.loctaionThin);
|
||||
DLog(@"Value: %ld", customModel.loctaionThin);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
CGRect textRect = [text boundingRectWithSize:constraintSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil];
|
||||
|
||||
CGFloat textHeight = CGRectGetHeight(textRect);
|
||||
NSLog(@"Text Height: %f", textHeight);
|
||||
DLog(@"Text Height: %f", textHeight);
|
||||
if (textHeight < kRealValue(30)) {
|
||||
|
||||
self.optionField.height = kRealValue(30);
|
||||
@@ -313,7 +313,7 @@
|
||||
CGRect textRect = [text boundingRectWithSize:constraintSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil];
|
||||
|
||||
CGFloat textHeight = CGRectGetHeight(textRect) + kRealValue(8);
|
||||
NSLog(@"Text Height: %f", textHeight);
|
||||
DLog(@"Text Height: %f", textHeight);
|
||||
if (textHeight <= kRealValue(30)) {
|
||||
|
||||
self.optionField.height = kRealValue(30);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "roomPlaceholder.png",
|
||||
"filename" : "bottomAIImg.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "roomPlaceholder@2x.png",
|
||||
"filename" : "bottomAIImg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "roomPlaceholder@3x.png",
|
||||
"filename" : "bottomAIImg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 270 KiB |
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "videQuestion_Left.png",
|
||||
"filename" : "bottomLeftImg.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "videQuestion_Left@2x.png",
|
||||
"filename" : "bottomLeftImg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "videQuestion_Left@3x.png",
|
||||
"filename" : "bottomLeftImg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 98 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "bottomRightImg.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "bottomRightImg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "bottomRightImg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 150 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "deveEmptyImg.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "deveEmptyImg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "deveEmptyImg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "heaedTitleBackImg.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "heaedTitleBackImg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "heaedTitleBackImg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 126 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "heardTopImg_1.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "heardTopImg_1@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "heardTopImg_1@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 217 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "heardTopImg_2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "heardTopImg_2@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "heardTopImg_2@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 200 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "heardTopImg_3.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "heardTopImg_3@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "heardTopImg_3@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 449 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "homeLaba.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "homeLaba@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "homeLaba@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 705 B |
|
After Width: | Height: | Size: 1.4 KiB |