feat(sos): 应急中心页面重构,新增参与订单模型及相关接口,补充首页图标资源

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
jiayangyang
2026-07-22 14:48:45 +08:00
co-authored by Claude Opus 4.7
parent 8a8a914a8c
commit a6a0f0a4ce
25 changed files with 682 additions and 70 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
platform :ios, '12.0'
platform :ios, '15.0'
# 忽略引入库的所有警告
inhibit_all_warnings!
+1 -1
View File
@@ -511,6 +511,6 @@ SPEC CHECKSUMS:
YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
PODFILE CHECKSUM: c63ef0a5edf68dd395621c435af5c0063b38442a
PODFILE CHECKSUM: 9ebe0e8991fab6e5cf3d18a72b82760099c4bc48
COCOAPODS: 1.16.2
@@ -219,7 +219,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1630;
LastUpgradeCheck = 2630;
TargetAttributes = {
1809E4612E092C710034C8FC = {
CreatedOnToolsVersion = 16.3;
@@ -389,6 +389,7 @@
CODE_SIGN_ENTITLEMENTS = XinjiangProject/XinjiangProject.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = A7CC5LW224;
ENABLE_MODULE_VERIFIER = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_PREFIX_HEADER = "$(SRCROOT)/XinjiangProject/Supporting Files/PrefixHeader.pch";
GENERATE_INFOPLIST_FILE = YES;
@@ -413,6 +414,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.14;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProject;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -433,6 +435,7 @@
CODE_SIGN_ENTITLEMENTS = XinjiangProject/XinjiangProject.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = A7CC5LW224;
ENABLE_MODULE_VERIFIER = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_PREFIX_HEADER = "$(SRCROOT)/XinjiangProject/Supporting Files/PrefixHeader.pch";
GENERATE_INFOPLIST_FILE = YES;
@@ -457,6 +460,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.14;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProject;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -527,6 +531,7 @@
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
};
name = Debug;
};
@@ -582,6 +587,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -31,12 +31,16 @@
- (void)getSearchExpert:(NSMutableDictionary *)parmDic;
// 急救员 - 搜索员工
- (void)getSearchEmployee:(NSMutableDictionary *)parmDic;
// 急救员 - 我参与的应急工单
- (void)getMyParticipatedOrders:(NSMutableDictionary *)parmDic;
// 急救员 - 创建群聊(不发起音视频通话)
- (void)getCreateGroupMagFirstAider:(NSMutableDictionary *)parmDic;
// 急救员 - 邀请进群
- (void)postAddGroupUser:(NSMutableDictionary *)parmDic;
// 急救员 - 移除群成员
- (void)postRemoveGroupUser:(NSMutableDictionary *)parmDic;
// 急救员 - 判断是否联络员
- (void)getIsLiaisonUser:(NSMutableDictionary *)parmDic;
// 急救员 - 群成员列表
- (void)getGroupMemberList:(NSMutableDictionary *)parmDic;
// 急救员 - 实际群成员列表(经腾讯IM验证,含isSelf字段)
@@ -74,11 +74,21 @@
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/searchExpert",Http] params:parmDic];
}
// 急救员 - 判断是否联络员
- (void)getIsLiaisonUser:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/emergency/LargeScreenNew/isLiaisonUser",Http] params:parmDic];
}
// 急救员 - 创建群聊(不发起音视频通话)
- (void)getCreateGroupMagFirstAider:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/createGroupMagFirstAider",Http] params:parmDic];
}
// 急救员 - 我参与的应急工单
- (void)getMyParticipatedOrders:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/myParticipatedOrders",Http] params:parmDic];
}
// 急救员 - 搜索员工
- (void)getSearchEmployee:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/searchEmployee",Http] params:parmDic];
@@ -12,6 +12,8 @@
#import <WebKit/WebKit.h>
#import "LXSegmentTitleView.h"
#import "XJSOSCenterModel.h"
#import "XJParticipatedOrderModel.h"
#import <MJRefresh/MJRefresh.h>
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapSearchKit/AMapSearchKit.h>
#import <AMapLocationKit/AMapLocationKit.h>
@@ -21,7 +23,7 @@
#import "XJHealthInterveneHomeModel.h"
#import "XJAEDNetWrokModel.h"
@interface XJSosCenterViewController ()<MAMapViewDelegate, LXSegmentTitleViewDelegate, LXSegmentTitleViewDataSource,AMapLocationManagerDelegate,SoSBottomProtocol,UIActionSheetDelegate>
@interface XJSosCenterViewController ()<MAMapViewDelegate, LXSegmentTitleViewDelegate, LXSegmentTitleViewDataSource,AMapLocationManagerDelegate,SoSBottomProtocol,UIActionSheetDelegate,UITableViewDelegate,UITableViewDataSource>
{
TYMapNavSheet * TYNavSheet;
@@ -50,6 +52,13 @@
@property (nonatomic, strong) XJSOSAddressView * addressView;
@property (nonatomic, strong) XJSOSResourcesModel * resourceModel;
@property (nonatomic, strong) XMButton * firstAiderBtn;
@property (nonatomic, strong) XMButton * callBtn;
@property (nonatomic, strong) XMButton * sosBtn;
@property (nonatomic, strong) NSMutableArray<XJParticipatedOrderModel *> *orderList;
@property (nonatomic, assign) NSInteger orderPage;
@property (nonatomic, strong) UITableView *orderPopupTable;
@property (nonatomic, assign) NSInteger selectedOrderIndex;
@property (assign, nonatomic) NSInteger selecetIndex;
@@ -287,58 +296,56 @@
[self addWhiteToBlackTransparentGradientToView:self.grapView];
// 120 按钮
XMButton * callBtn = [[XMButton alloc] initWithFrame:CGRectMake(kScreenWidth/4 - 35, grapView.height - 17 - 70, 70, 70)];
callBtn.style = SDButtonStyleTop;
callBtn.backgroundColor = KWhiteColor;
callBtn.layer.cornerRadius = 35.0f;
callBtn.layer.masksToBounds = true;
[callBtn setTitle:@"120" forState:UIControlStateNormal];
callBtn.titleLabel.font = SYSTEMFONT(12);
[callBtn setTitleColor:UIColorHex(#FF422F) forState:UIControlStateNormal];
[callBtn setImage:[UIImage imageNamed:@"callHospation"] forState:UIControlStateNormal];
[callBtn addTarget:self action:@selector(callHospationAction) forControlEvents:UIControlEventTouchUpInside];
callBtn.imageW = 22;
callBtn.imageH = 20;
callBtn.imageY = 19;
callBtn.imageX = 24;
callBtn.interval = 5;
[grapView addSubview:callBtn];
self.callBtn = [[XMButton alloc] initWithFrame:CGRectMake(0, grapView.height - 17 - 70, 70, 70)];
self.callBtn.style = SDButtonStyleTop;
self.callBtn.backgroundColor = KWhiteColor;
self.callBtn.layer.cornerRadius = 35.0f;
self.callBtn.layer.masksToBounds = true;
[self.callBtn setTitle:@"120" forState:UIControlStateNormal];
self.callBtn.titleLabel.font = SYSTEMFONT(12);
[self.callBtn setTitleColor:UIColorHex(#FF422F) forState:UIControlStateNormal];
[self.callBtn setImage:[UIImage imageNamed:@"callHospation"] forState:UIControlStateNormal];
[self.callBtn addTarget:self action:@selector(callHospationAction) forControlEvents:UIControlEventTouchUpInside];
self.callBtn.imageW = 22;
self.callBtn.imageH = 20;
self.callBtn.imageY = 19;
self.callBtn.imageX = 24;
self.callBtn.interval = 5;
[grapView addSubview:self.callBtn];
// 应急就医 按钮
XMButton * sosBtn = [[XMButton alloc] initWithFrame:CGRectMake(kScreenWidth/2 - 35, callBtn.top, 70, 70)];
sosBtn.style = SDButtonStyleTop;
sosBtn.backgroundColor = KWhiteColor;
sosBtn.layer.cornerRadius = 35.0f;
sosBtn.layer.masksToBounds = true;
[sosBtn setTitle:@"应急就医" forState:UIControlStateNormal];
sosBtn.titleLabel.font = SYSTEMFONT(11);
[sosBtn setTitleColor:UIColorHex(#FF422F) forState:UIControlStateNormal];
[sosBtn setImage:[UIImage imageNamed:@"callSoSIcon"] forState:UIControlStateNormal];
[sosBtn addTarget:self action:@selector(callSoSAction) forControlEvents:UIControlEventTouchUpInside];
sosBtn.imageW = 22;
sosBtn.imageH = 21;
sosBtn.imageY = 19;
sosBtn.imageX = 24;
sosBtn.interval = 5;
[grapView addSubview:sosBtn];
self.sosBtn = [[XMButton alloc] initWithFrame:CGRectMake(0, self.callBtn.top, 70, 70)];
self.sosBtn.style = SDButtonStyleTop;
self.sosBtn.backgroundColor = KWhiteColor;
self.sosBtn.layer.cornerRadius = 35.0f;
self.sosBtn.layer.masksToBounds = true;
[self.sosBtn setTitle:@"应急就医" forState:UIControlStateNormal];
self.sosBtn.titleLabel.font = SYSTEMFONT(11);
[self.sosBtn setTitleColor:UIColorHex(#FF422F) forState:UIControlStateNormal];
[self.sosBtn setImage:[UIImage imageNamed:@"callSoSIcon"] forState:UIControlStateNormal];
[self.sosBtn addTarget:self action:@selector(callSoSAction) forControlEvents:UIControlEventTouchUpInside];
self.sosBtn.imageW = 22;
self.sosBtn.imageH = 21;
self.sosBtn.imageY = 19;
self.sosBtn.imageX = 24;
self.sosBtn.interval = 5;
[grapView addSubview:self.sosBtn];
// 急救员 按钮
XMButton * firstAiderBtn = [[XMButton alloc] initWithFrame:CGRectMake(kScreenWidth*3/4 - 35, callBtn.top, 70, 70)];
firstAiderBtn.style = SDButtonStyleTop;
firstAiderBtn.backgroundColor = KWhiteColor;
firstAiderBtn.layer.cornerRadius = 35.0f;
firstAiderBtn.layer.masksToBounds = true;
[firstAiderBtn setTitle:@"急救员" forState:UIControlStateNormal];
firstAiderBtn.titleLabel.font = SYSTEMFONT(11);
[firstAiderBtn setTitleColor:UIColorHex(#FF422F) forState:UIControlStateNormal];
[firstAiderBtn setImage:[UIImage imageNamed:@"sosPeople"] forState:UIControlStateNormal];
[firstAiderBtn addTarget:self action:@selector(callFirstAiderAction) forControlEvents:UIControlEventTouchUpInside];
firstAiderBtn.imageW = 22;
firstAiderBtn.imageH = 21;
firstAiderBtn.imageY = 19;
firstAiderBtn.imageX = 24;
firstAiderBtn.interval = 5;
[grapView addSubview:firstAiderBtn];
self.firstAiderBtn = [[XMButton alloc] initWithFrame:CGRectMake(0, self.callBtn.top, 70, 70)];
self.firstAiderBtn.style = SDButtonStyleTop;
self.firstAiderBtn.backgroundColor = KWhiteColor;
self.firstAiderBtn.layer.cornerRadius = 35.0f;
self.firstAiderBtn.layer.masksToBounds = true;
[self.firstAiderBtn setBackgroundImage:[UIImage imageNamed:@"firstAid_icon"] forState:UIControlStateNormal];
[self.firstAiderBtn addTarget:self action:@selector(callFirstAiderAction) forControlEvents:UIControlEventTouchUpInside];
self.firstAiderBtn.imageW = 22;
self.firstAiderBtn.imageH = 21;
self.firstAiderBtn.imageY = 19;
self.firstAiderBtn.imageX = 24;
self.firstAiderBtn.interval = 5;
self.firstAiderBtn.hidden = YES;
[grapView addSubview:self.firstAiderBtn];
self.titles = @[@"油田医院",@"健康小屋",@"AED",@"救护车"];
self.titleView.segmentTitles = self.titles;
@@ -349,11 +356,143 @@
[self.mapView addSubview:self.gpsButton];
UIView *zoomPannelView = [self makeZoomPannelView];
// 放到指南针底部
CGFloat compassBottom = self.mapView.compassOrigin.y + self.mapView.compassSize.height;
zoomPannelView.center = CGPointMake(self.grapView.bounds.size.width - CGRectGetMidX(zoomPannelView.bounds) - 10,
self.grapView.bounds.size.height - CGRectGetMidY(zoomPannelView.bounds) - 10);
compassBottom + 10 + CGRectGetMidY(zoomPannelView.bounds));
zoomPannelView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
[self.grapView addSubview:zoomPannelView];
// 判断是否是联络员,决定是否展示急救员按钮
XJPNetAPI *api = [[XJPNetAPI alloc] init:self tag:@"isLiaisonUser" NeedToken:@""];
[api getIsLiaisonUser:nil];
}
/// 底部按钮均分布局(宽度三等分,各区域内居中)
- (void)layoutBottomButtons {
NSInteger count = self.firstAiderBtn.hidden ? 2 : 3;
CGFloat segW = kScreenWidth / count;
self.callBtn.centerX = segW * 0 + segW / 2;
self.sosBtn.centerX = segW * 1 + segW / 2;
if (!self.firstAiderBtn.hidden) {
self.firstAiderBtn.centerX = segW * 2 + segW / 2;
}
}
/// 进入群聊页面
- (void)enterChatWithSessionId:(NSString *)sessionId title:(NSString *)title {
if (!sessionId.length) return;
ChatViewController *chatVC = [[ChatViewController alloc] init];
chatVC.isGroupID = YES;
chatVC.isFromFirstAid = YES;
chatVC.isVideo = YES;
chatVC.chatID = sessionId;
chatVC.navTitle = title ?: @"应急就医群";
[self.navigationController pushViewController:chatVC animated:YES];
}
/// 多个工单选择弹窗
- (void)showOrderListPopup:(NSArray<XJParticipatedOrderModel *> *)models {
self.selectedOrderIndex = -1;
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIView *mask = [[UIView alloc] initWithFrame:keyWindow.bounds];
mask.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
mask.tag = 9001;
[keyWindow addSubview:mask];
CGFloat panelW = kScreenWidth - 46;
CGFloat panelH = 490;
CGFloat panelX = 23;
CGFloat panelY = (kScreenHeight - panelH) * 0.45;
UIView *panel = [[UIView alloc] initWithFrame:CGRectMake(panelX, panelY, panelW, panelH)];
panel.backgroundColor = KWhiteColor;
panel.layer.cornerRadius = 23;
panel.layer.masksToBounds = YES;
panel.tag = 9002;
[keyWindow addSubview:panel];
UILabel *titleLbl = [[UILabel alloc] init];
titleLbl.text = @"请选择正在应急的工单";
titleLbl.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
titleLbl.textColor = UIColorHex(0x252535);
[titleLbl sizeToFit];
titleLbl.top = 24;
titleLbl.centerX = panelW / 2;
[panel addSubview:titleLbl];
UIButton *closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(panelW - 20 - 24, 21, 24, 24)];
closeBtn.backgroundColor = UIColorHex(0xF1F5F9);
closeBtn.layer.cornerRadius = 12;
UILabel *xLbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 24, 24)];
xLbl.text = @""; xLbl.font = [UIFont systemFontOfSize:13];
xLbl.textColor = UIColorHex(0x77849E); xLbl.textAlignment = NSTextAlignmentCenter;
[closeBtn addSubview:xLbl];
[closeBtn addTarget:self action:@selector(dismissOrderPopup) forControlEvents:UIControlEventTouchUpInside];
[panel addSubview:closeBtn];
CGFloat sep1Y = titleLbl.bottom + 16;
UIView *sep1 = [[UIView alloc] initWithFrame:CGRectMake(0, sep1Y, panelW, 1)];
sep1.backgroundColor = UIColorHex(0xEAECFA);
[panel addSubview:sep1];
CGFloat btnH = 44;
UIButton *confirmBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, panelH - 12 - btnH, panelW - 40, btnH)];
confirmBtn.backgroundColor = UIColorHex(0x2EB8B2);
confirmBtn.layer.cornerRadius = 12;
[confirmBtn setTitle:@"确认选择" forState:UIControlStateNormal];
[confirmBtn setTitleColor:KWhiteColor forState:UIControlStateNormal];
confirmBtn.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
[confirmBtn addTarget:self action:@selector(onConfirmOrderSelection) forControlEvents:UIControlEventTouchUpInside];
[panel addSubview:confirmBtn];
CGFloat sep2Y = confirmBtn.top - 12;
UIView *sep2 = [[UIView alloc] initWithFrame:CGRectMake(0, sep2Y, panelW, 1)];
sep2.backgroundColor = UIColorHex(0xEAECFA);
[panel addSubview:sep2];
CGFloat tableY = sep1Y + 1, tableH = sep2Y - tableY;
self.orderPopupTable = [[UITableView alloc] initWithFrame:CGRectMake(0, tableY, panelW, tableH) style:UITableViewStylePlain];
self.orderPopupTable.delegate = self;
self.orderPopupTable.dataSource = self;
self.orderPopupTable.separatorStyle = UITableViewCellSeparatorStyleNone;
self.orderPopupTable.showsVerticalScrollIndicator = NO;
self.orderPopupTable.backgroundColor = KWhiteColor;
self.orderPopupTable.rowHeight = UITableViewAutomaticDimension;
self.orderPopupTable.estimatedRowHeight = 160;
if (@available(iOS 15.0, *)) { self.orderPopupTable.sectionHeaderTopPadding = 0; }
self.orderPopupTable.contentInset = UIEdgeInsetsZero;
__weak typeof(self) wk = self;
self.orderPopupTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
wk.orderPage = 1; NSMutableDictionary *p = [NSMutableDictionary dictionary];
p[@"pageNo"] = @(1); p[@"pageSize"] = @(10);
[[[XJPNetAPI alloc] init:wk tag:@"myParticipatedOrders" NeedToken:@""] getMyParticipatedOrders:p];
}];
self.orderPopupTable.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
wk.orderPage++; NSMutableDictionary *p = [NSMutableDictionary dictionary];
p[@"pageNo"] = @(wk.orderPage); p[@"pageSize"] = @(10);
[[[XJPNetAPI alloc] init:wk tag:@"myParticipatedOrders" NeedToken:@""] getMyParticipatedOrders:p];
}];
[panel addSubview:self.orderPopupTable];
panel.alpha = 0;
[UIView animateWithDuration:0.25 animations:^{ panel.alpha = 1; }];
}
- (void)dismissOrderPopup {
[[UIApplication.sharedApplication.keyWindow viewWithTag:9001] removeFromSuperview];
[[UIApplication.sharedApplication.keyWindow viewWithTag:9002] removeFromSuperview];
}
- (void)onConfirmOrderSelection {
if (self.selectedOrderIndex < 0 || self.selectedOrderIndex >= self.orderList.count) return;
XJParticipatedOrderModel *m = self.orderList[self.selectedOrderIndex];
[self dismissOrderPopup];
[self enterChatWithSessionId:m.sessionId title:m.salvageUserName];
}
- (void)addWhiteToBlackTransparentGradientToView:(UIView *)view {
@@ -524,18 +663,13 @@
#pragma mark: 急救员点击
- (void)callFirstAiderAction {
[self showMBProgressHUDWithString:@"急救发起中,请稍候..." autoHidden:false];
NSUserDefaults * user = [NSUserDefaults standardUserDefaults];
CGFloat longitude = [[user objectForKey:USERDEFAULLONG] floatValue];
CGFloat latitude = [[user objectForKey:USERDEFAULLATITUDE] floatValue];
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
[parmDic setObject:@(longitude) forKey:@"longitude"];
[parmDic setObject:@(latitude) forKey:@"latitude"];
[parmDic setObject:@"急救员" forKey:@"name"];
XJPNetAPI * sosApi = [[XJPNetAPI alloc] init:self tag:@"FirstAidGroupAPI" NeedToken:@""];
[sosApi getCreateGroupMagFirstAider:parmDic];
[self showMBProgressHUDWithString:@"加载中..." autoHidden:false];
self.orderPage = 1;
NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"pageNo"] = @(self.orderPage);
params[@"pageSize"] = @(10);
XJPNetAPI *api = [[XJPNetAPI alloc] init:self tag:@"myParticipatedOrders" NeedToken:@""];
[api getMyParticipatedOrders:params];
}
#pragma mark:应急点击
@@ -658,7 +792,11 @@
#pragma mark:网络请求
- (void)Failed:(NSString*)message tag:(NSString*)tag
{
if ([tag isEqualToString:@"isLiaisonUser"]) {
self.firstAiderBtn.hidden = NO;
[self layoutBottomButtons];
return;
}
[EasyTextView showErrorText:message];
[self hiddenAllMBProgressHUD];
@@ -759,6 +897,40 @@
chatVC.navTitle = @"应急就医群";
[self.navigationController pushViewController:chatVC animated:YES];
}
if ([tag isEqualToString:@"myParticipatedOrders"]) {
[self hiddenAllMBProgressHUD];
NSDictionary *dic = [response isKindOfClass:[NSDictionary class]] ? response : nil;
NSArray *records = dic[@"records"];
if (![records isKindOfClass:[NSArray class]] || records.count == 0) {
if (self.orderPage == 1) [EasyTextView showErrorText:@"暂无进行中的应急工单"];
return;
}
NSMutableArray *models = [NSMutableArray array];
for (NSDictionary *d in records) {
[models addObject:[XJParticipatedOrderModel modelWithDictionary:d]];
}
if (models.count == 1 && self.orderPage == 1 && [dic[@"total"] integerValue] == 1) {
XJParticipatedOrderModel *m = models.firstObject;
[self enterChatWithSessionId:m.sessionId title:m.salvageUserName];
return;
}
if (self.orderPage == 1) {
self.orderList = models;
[self showOrderListPopup:self.orderList];
} else {
[self.orderList addObjectsFromArray:models];
[self.orderPopupTable reloadData];
}
[self.orderPopupTable.mj_header endRefreshing];
[self.orderPopupTable.mj_footer endRefreshing];
if (records.count < 10) [self.orderPopupTable.mj_footer endRefreshingWithNoMoreData];
return;
}
if ([tag isEqualToString:@"isLiaisonUser"]) {
self.firstAiderBtn.hidden = ![response boolValue];
[self layoutBottomButtons];
return;
}
if ([tag isEqualToString:@"loginIMAPI"]) {
NSDictionary * pamrDic = response;
@@ -920,5 +1092,177 @@
}
*/
#pragma mark - 工单列表弹窗 TableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.orderList.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 0.01;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return [UIView new];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cid = @"OrderCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cid];
XJParticipatedOrderModel *m = self.orderList[indexPath.row];
BOOL selected = (indexPath.row == self.selectedOrderIndex);
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cid];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.backgroundColor = KWhiteColor;
UIView *container = [[UIView alloc] init];
container.tag = 200;
container.layer.cornerRadius = 8;
container.layer.borderWidth = 1;
[cell.contentView addSubview:container];
[container mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(cell.contentView).offset(12);
make.right.equalTo(cell.contentView).offset(-12);
make.bottom.equalTo(cell.contentView);
}];
UILabel *nameLbl = [[UILabel alloc] init];
nameLbl.tag = 201;
nameLbl.font = [UIFont systemFontOfSize:15 weight:UIFontWeightBold];
[container addSubview:nameLbl];
[nameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(container).offset(16);
}];
UIImageView *indicator = [[UIImageView alloc] init];
indicator.tag = 202;
indicator.contentMode = UIViewContentModeScaleAspectFit;
[container addSubview:indicator];
[indicator mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(container).offset(-16);
make.top.equalTo(container).offset(14);
make.size.mas_equalTo(CGSizeMake(18, 18));
}];
UIView *deptBg = [[UIView alloc] init];
deptBg.tag = 209;
deptBg.layer.cornerRadius = 4;
deptBg.layer.masksToBounds = YES;
[container addSubview:deptBg];
[deptBg mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(container).offset(16);
make.top.equalTo(nameLbl.mas_bottom).offset(8);
make.height.mas_equalTo(20);
}];
UILabel *deptLbl = [[UILabel alloc] init];
deptLbl.tag = 203;
deptLbl.font = [UIFont systemFontOfSize:11 weight:UIFontWeightBold];
deptLbl.textAlignment = NSTextAlignmentCenter;
[deptBg addSubview:deptLbl];
[deptLbl mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(deptBg).offset(8);
make.right.equalTo(deptBg).offset(-8);
make.top.equalTo(deptBg).offset(3);
make.bottom.equalTo(deptBg).offset(-3);
}];
UIView *line = [[UIView alloc] init];
line.tag = 204;
line.backgroundColor = UIColorHex(0xEAECFA);
[container addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(container).offset(16);
make.right.equalTo(container).offset(-16);
make.top.equalTo(deptLbl.mas_bottom).offset(12);
make.height.mas_equalTo(1);
}];
UIImageView *orgIcon = [[UIImageView alloc] init];
orgIcon.tag = 205;
orgIcon.contentMode = UIViewContentModeScaleAspectFit;
[container addSubview:orgIcon];
[orgIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(container).offset(16);
make.top.equalTo(line.mas_bottom).offset(12);
make.size.mas_equalTo(CGSizeMake(16, 16));
}];
UILabel *orgLbl = [[UILabel alloc] init];
orgLbl.tag = 206;
orgLbl.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
orgLbl.numberOfLines = 0;
[container addSubview:orgLbl];
[orgLbl mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(orgIcon.mas_right).offset(8);
make.top.equalTo(line.mas_bottom).offset(12);
make.right.equalTo(container).offset(-16);
}];
UIImageView *timeIcon = [[UIImageView alloc] init];
timeIcon.tag = 207;
timeIcon.contentMode = UIViewContentModeScaleAspectFit;
[container addSubview:timeIcon];
[timeIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(container).offset(16);
make.top.equalTo(orgLbl.mas_bottom).offset(15);
make.size.mas_equalTo(CGSizeMake(16, 16));
}];
UILabel *timeLbl = [[UILabel alloc] init];
timeLbl.tag = 208;
timeLbl.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
[container addSubview:timeLbl];
[timeLbl mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(timeIcon.mas_right).offset(8);
make.centerY.equalTo(timeIcon);
make.right.equalTo(container).offset(-16);
make.bottom.equalTo(container).offset(-16);
}];
}
UIView *container = [cell.contentView viewWithTag:200];
UILabel *nameLbl = [container viewWithTag:201];
UIImageView *indicator = [container viewWithTag:202];
UIView *deptBg = [container viewWithTag:209];
UILabel *deptLbl = [container viewWithTag:203];
UIImageView *orgIcon = [container viewWithTag:205];
UILabel *orgLbl = [container viewWithTag:206];
UIImageView *timeIcon = [container viewWithTag:207];
UILabel *timeLbl = [container viewWithTag:208];
if (selected) {
container.layer.borderColor = UIColorHex(0x2EB8B280).CGColor;
container.backgroundColor = UIColorHex(0x2EB8B20F);
deptLbl.textColor = UIColorHex(0x2EB8B2); deptBg.backgroundColor = UIColorHex(0x2EB8B21A);
orgLbl.textColor = UIColorHex(0x2EB8B2);
timeLbl.textColor = UIColorHex(0x2EB8B2);
} else {
container.layer.borderColor = UIColorHex(0xE6E6EA).CGColor;
container.backgroundColor = KWhiteColor;
deptLbl.textColor = UIColorHex(0x77849E); deptBg.backgroundColor = UIColorHex(0x77849E1A);
orgLbl.textColor = UIColorHex(0x77849E);
timeLbl.textColor = UIColorHex(0x77849E);
}
nameLbl.textColor = UIColorHex(0x252535);
nameLbl.text = m.salvageUserName ?: @"--";
deptLbl.text = [NSString stringWithFormat:@" %@ ", m.deptName ?: @""];
indicator.image = [UIImage imageNamed:selected ? @"order_selected" : @"order_unselected"];
orgIcon.image = [UIImage imageNamed:selected ? @"org_selected" : @"org_unselected"];
orgLbl.text = m.orgName ?: @"";
timeIcon.image = [UIImage imageNamed:selected ? @"time_selected" : @"time_unselected"];
timeLbl.text = m.createTime.length > 0 ? [NSString stringWithFormat:@"求助时间:%@", m.createTime] : @"";
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.selectedOrderIndex = indexPath.row;
[tableView reloadData];
}
@end
@@ -0,0 +1,24 @@
//
// XJParticipatedOrderModel.h
// XinjiangProject
//
// 急救员 - 我参与的应急工单
//
#import <Foundation/Foundation.h>
@interface XJParticipatedOrderModel : NSObject
@property (nonatomic, copy) NSString *orderId;
@property (nonatomic, copy) NSString *sessionId;
@property (nonatomic, copy) NSString *salvageUserName;
@property (nonatomic, copy) NSString *salvageUserSex;
@property (nonatomic, copy) NSString *salvageUserAvatar;
@property (nonatomic, assign) NSInteger salvageUserAge;
@property (nonatomic, copy) NSString *salvageUserMobile;
@property (nonatomic, copy) NSString *orgName;
@property (nonatomic, copy) NSString *deptName;
@property (nonatomic, copy) NSString *orderStatus;
@property (nonatomic, copy) NSString *createTime;
@end
@@ -0,0 +1,15 @@
//
// XJParticipatedOrderModel.m
// XinjiangProject
//
#import "XJParticipatedOrderModel.h"
@implementation XJParticipatedOrderModel
+ (NSDictionary *)modelCustomPropertyMapper {
return @{@"createTime": @"initTime"};
}
@end
@@ -50,7 +50,7 @@
@class TUIChatDataProvider;
@interface ChatViewController ()<V2TIMSimpleMsgListener,TUIChatBaseDataProviderDelegate,IMCustomDeleagte,TUIMessageCellDelegate,TUIBaseMessageControllerDelegate,TUICallObserver,V2TIMConversationListener,CLLocationManagerDelegate,UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
@interface ChatViewController ()<V2TIMSimpleMsgListener,TUIChatBaseDataProviderDelegate,IMCustomDeleagte,TUIMessageCellDelegate,TUIBaseMessageControllerDelegate,TUICallObserver,V2TIMConversationListener,V2TIMGroupListener,CLLocationManagerDelegate,UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) TUIC2CChatViewController *vc;
@property (nonatomic, strong) TUIGroupChatViewController * groupvc;
@@ -74,6 +74,7 @@
@property (nonatomic, strong) UITableView *memberTableView;
@property (nonatomic, strong) UILabel *memberTitleLabel;
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *memberList;
@property (nonatomic, strong) UIImageView *refreshIcon;
@end
@@ -99,6 +100,7 @@
[[V2TIMManager sharedInstance] addSimpleMsgListener:self];
[[TUICallEngine createInstance] addObserver:self];
[[V2TIMManager sharedInstance] addConversationListener:self];
[[V2TIMManager sharedInstance] addGroupListener:self];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShowAction:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHideAction:) name:UIKeyboardWillHideNotification object:nil];
@@ -378,10 +380,31 @@
}
- (UIView *)makeAddMemberFooterView:(CGFloat)panelW {
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, panelW, 20 + 49)];
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, panelW, 20 + 49 + 57)];
footer.backgroundColor = KWhiteColor;
UIButton *addBtn = [[UIButton alloc] initWithFrame:CGRectMake(11, 20, panelW - 22, 49)];
// 更新群成员 按钮
UIButton *refreshBtn = [[UIButton alloc] initWithFrame:CGRectMake(11, 12, panelW - 22, 49)];
refreshBtn.backgroundColor = KWhiteColor;
refreshBtn.layer.cornerRadius = 8;
refreshBtn.layer.borderWidth = 1;
refreshBtn.layer.borderColor = UIColorHex(0xCCCCCC).CGColor;
[refreshBtn setTitle:@" 更新群成员" forState:UIControlStateNormal];
[refreshBtn setTitleColor:UIColorHex(0x070809) forState:UIControlStateNormal];
refreshBtn.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
[refreshBtn addTarget:self action:@selector(refreshMemberList) forControlEvents:UIControlEventTouchUpInside];
[footer addSubview:refreshBtn];
// 刷新图标
self.refreshIcon = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 18, 18)];
self.refreshIcon.image = [UIImage imageNamed:@"yuanxunhuan"];
self.refreshIcon.contentMode = UIViewContentModeScaleAspectFit;
CGFloat rTitleW = [refreshBtn.titleLabel.text sizeWithAttributes:@{NSFontAttributeName: refreshBtn.titleLabel.font}].width;
CGFloat rIconX = (panelW - 22 - rTitleW) / 2;
self.refreshIcon.center = CGPointMake(rIconX, 49 / 2);
[refreshBtn addSubview:self.refreshIcon];
UIButton *addBtn = [[UIButton alloc] initWithFrame:CGRectMake(11, 12 + 49 + 8, panelW - 22, 49)];
addBtn.backgroundColor = [UIColorHex(0x2EB8B2) colorWithAlphaComponent:0.12];
addBtn.layer.cornerRadius = 8;
addBtn.layer.borderWidth = 1;
@@ -421,6 +444,15 @@
}];
}
- (void)refreshMemberList {
CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotation.toValue = @(M_PI * 2);
rotation.duration = 0.6;
rotation.repeatCount = HUGE_VALF;
[self.refreshIcon.layer addAnimation:rotation forKey:@"refreshRotation"];
[self loadGroupMembers];
}
- (void)loadGroupMembers {
self.memberList = [NSMutableArray array];
NSMutableDictionary *params = [NSMutableDictionary dictionary];
@@ -916,6 +948,7 @@
}
self.memberTitleLabel.text = [NSString stringWithFormat:@"群成员(%lu)", (unsigned long)self.memberList.count];
[self.memberTableView reloadData];
[self.refreshIcon.layer removeAnimationForKey:@"refreshRotation"];
}
}
@@ -1379,4 +1412,12 @@
return [super forwardingTargetForSelector:aSelector];
}
#pragma mark - V2TIMGroupListener
- (void)onMemberEnter:(NSString *)groupID memberList:(NSArray<V2TIMGroupMemberInfo *> *)memberList {
if ([groupID isEqualToString:self.chatID] && self.memberPanel) {
[self loadGroupMembers];
}
}
@end
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "firstAid_icon.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "order_selected.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "order_unselected.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "org_selected.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "org_unselected.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "time_selected.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yuanxunhuan-2.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "time_unselected.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB