170 lines
6.7 KiB
Objective-C
170 lines
6.7 KiB
Objective-C
//
|
|
// XJSOSDetailSmallSumViewController.m
|
|
// EscortProject
|
|
//
|
|
// Created by 仁康信息 on 2023/8/22.
|
|
//
|
|
|
|
#import "XJSOSDetailSmallSumViewController.h"
|
|
|
|
@interface XJSOSDetailSmallSumViewController ()
|
|
|
|
@property (nonatomic, strong) UIScrollView * mainScrollview;
|
|
@property (nonatomic, strong) YYLabel * jingguoLabel;
|
|
@property (nonatomic, strong) YYLabel * xiaojieLabel;
|
|
|
|
@end
|
|
|
|
@implementation XJSOSDetailSmallSumViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
self.view.backgroundColor = CViewBgColor;
|
|
[self createUI];
|
|
[self createData];
|
|
}
|
|
|
|
|
|
- (void)createUI {
|
|
|
|
self.mainScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(kRealValue(10), kRealValue(58), kScreenWidth - kRealValue(20), kScreenHeight - kTopHeight - kRealValue(58))];
|
|
self.mainScrollview.layer.cornerRadius = 10.0;
|
|
self.mainScrollview.layer.masksToBounds = YES;
|
|
[self.view addSubview:self.mainScrollview];
|
|
|
|
|
|
UILabel * jingguoTitle = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), kRealValue(24), 100, 15)];
|
|
jingguoTitle.text = @"事件经过";
|
|
jingguoTitle.textColor = CFontColor1;
|
|
jingguoTitle.font = BOLDSYSTEMFONT(14);
|
|
[self.mainScrollview addSubview:jingguoTitle];
|
|
|
|
self.jingguoLabel = [[YYLabel alloc] initWithFrame:CGRectMake(kRealValue(13),kRealValue(55), self.mainScrollview.width, 13)];
|
|
self.jingguoLabel.textAlignment = NSTextAlignmentLeft;
|
|
self.jingguoLabel.font = MEDIUMFONT(13);
|
|
self.jingguoLabel.textColor = UIColorHex(#333333);
|
|
self.jingguoLabel.numberOfLines = 0;
|
|
|
|
// 查询文本排版结果
|
|
// 计算文本尺寸YYTextLayout
|
|
CGSize maxSize = CGSizeMake(self.mainScrollview.width, MAXFLOAT);
|
|
|
|
YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:self.jingguoLabel.attributedText];
|
|
self.jingguoLabel.textLayout = layout;
|
|
CGFloat introHeight = layout.textBoundingSize.height;
|
|
self.jingguoLabel.width = maxSize.width;
|
|
// 记录真正的正确高度
|
|
self.jingguoLabel.height = introHeight;
|
|
// 显示文本排版结果
|
|
[self.mainScrollview addSubview:self.jingguoLabel];
|
|
|
|
UILabel * xiaojieTitle = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(14), self.jingguoLabel.bottom + kRealValue(24), 100, 15)];
|
|
xiaojieTitle.text = @"事件小结";
|
|
xiaojieTitle.textColor = CFontColor1;
|
|
xiaojieTitle.font = BOLDSYSTEMFONT(14);
|
|
[self.mainScrollview addSubview:xiaojieTitle];
|
|
|
|
//小结
|
|
|
|
self.xiaojieLabel = [[YYLabel alloc] initWithFrame:CGRectMake(kRealValue(13),kRealValue(55), self.mainScrollview.width, 13)];
|
|
self.xiaojieLabel.textAlignment = NSTextAlignmentLeft;
|
|
self.xiaojieLabel.font = MEDIUMFONT(13);
|
|
self.xiaojieLabel.textColor = UIColorHex(#333333);
|
|
self.xiaojieLabel.numberOfLines = 0;
|
|
|
|
// 查询文本排版结果
|
|
// 计算文本尺寸YYTextLayout
|
|
|
|
YYTextLayout * sumlayout = [YYTextLayout layoutWithContainerSize:maxSize text:self.xiaojieLabel.attributedText];
|
|
self.xiaojieLabel.textLayout = layout;
|
|
CGFloat sumIntroHeight = sumlayout.textBoundingSize.height;
|
|
// 记录真正的正确高度
|
|
self.xiaojieLabel.height = sumIntroHeight;
|
|
// 显示文本排版结果
|
|
[self.mainScrollview addSubview:self.xiaojieLabel];
|
|
|
|
self.mainScrollview.contentSize = CGSizeMake(self.mainScrollview.width, self.xiaojieLabel.bottom + kRealValue(20));
|
|
}
|
|
|
|
|
|
- (void)createData {
|
|
|
|
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
|
|
|
|
[parmDic setObject:self.hospital_id forKey:@"id"];
|
|
|
|
JKCQAPI * smallApi = [[JKCQAPI alloc] init:self tag:@"SMALLAPI" NeedToken:@""];
|
|
|
|
[smallApi getSOSSmallSumData:parmDic];
|
|
|
|
}
|
|
|
|
|
|
- (void)Failed:(NSString*)message tag:(NSString*)tag
|
|
{
|
|
[self showMBProgressHUDOnlyWithString:message];
|
|
[self hiddenAllMBProgressHUD];
|
|
|
|
}
|
|
|
|
- (void)Sucess:(id)response tag:(NSString*)tag
|
|
{
|
|
if ([tag isEqualToString:@"DETAILAPI"]) {
|
|
NSDictionary * dic = response;
|
|
if (ValidDict(dic)) {
|
|
NSString * jingguoString = [dic objectForKey:@"orderThrough"];
|
|
NSString * xiaojieString = [dic objectForKey:@"orderResult"];
|
|
|
|
if (!ValidStr(jingguoString)) {
|
|
|
|
|
|
|
|
NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[jingguoString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
|
|
self.jingguoLabel.frame = CGRectMake(kRealValue(13),kRealValue(55), self.mainScrollview.width, 13);
|
|
// 查询文本排版结果
|
|
// 计算文本尺寸YYTextLayout
|
|
CGSize maxSize = CGSizeMake(self.mainScrollview.width, MAXFLOAT);
|
|
|
|
YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:self.jingguoLabel.attributedText];
|
|
self.jingguoLabel.textLayout = layout;
|
|
CGFloat introHeight = layout.textBoundingSize.height;
|
|
// 记录真正的正确高度
|
|
self.jingguoLabel.height = introHeight;
|
|
}
|
|
if (!ValidStr(xiaojieString)) {
|
|
//小结
|
|
|
|
NSAttributedString * sumAttrStr = [[NSAttributedString alloc] initWithData:[xiaojieString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
|
|
self.xiaojieLabel.frame = CGRectMake(kRealValue(13),kRealValue(55), self.mainScrollview.width, 13);
|
|
self.xiaojieLabel.attributedText = sumAttrStr;
|
|
// 查询文本排版结果
|
|
// 计算文本尺寸YYTextLayout
|
|
CGSize maxSize = CGSizeMake(self.mainScrollview.width, MAXFLOAT);
|
|
YYTextLayout * sumlayout = [YYTextLayout layoutWithContainerSize:maxSize text:self.xiaojieLabel.attributedText];
|
|
self.xiaojieLabel.textLayout = sumlayout;
|
|
CGFloat sumIntroHeight = sumlayout.textBoundingSize.height;
|
|
// 记录真正的正确高度
|
|
self.xiaojieLabel.height = sumIntroHeight;
|
|
|
|
// 显示文本排版结果
|
|
}
|
|
self.mainScrollview.contentSize = CGSizeMake(self.mainScrollview.width, self.xiaojieLabel.bottom + kRealValue(20));
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
/*
|
|
#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
|