diff --git a/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/XJDNetAPI.h b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/XJDNetAPI.h index 1e83ff1..3676d65 100755 --- a/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/XJDNetAPI.h +++ b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/XJDNetAPI.h @@ -100,5 +100,15 @@ - (void)GetDoctorPhyscialIDCardSearch:(NSMutableDictionary *)parmDic; - (void)getHistoryReportById:(NSMutableDictionary *)parmDic; - (void)getSendVideoStart:(NSMutableDictionary *)pamraDic; +//版本更新 +- (void)GetAppVesionUpdata:(NSMutableDictionary *)parmDic; +#pragma mark - 应急求助 +- (void)getSOSDoctorRecordList:(NSMutableDictionary *)parmDic; +- (void)getSOSDoctorDetailInfo:(NSMutableDictionary *)parmDic; +- (void)getMyParticipatedOrders:(NSMutableDictionary *)parmDic; +- (void)getActualGroupMemberList:(NSMutableDictionary *)parmDic; +- (void)getSearchEmployee:(NSMutableDictionary *)parmDic; +- (void)getSearchExpert:(NSMutableDictionary *)parmDic; +- (void)postAddGroupUser:(NSMutableDictionary *)parmDic; @end diff --git a/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/XJDNetAPI.m b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/XJDNetAPI.m index 2f3f329..b6b28d3 100755 --- a/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/XJDNetAPI.m +++ b/DoctorXinjiang/DoctorXinjiang/Manager/NetworkingManager/XJDNetAPI.m @@ -323,11 +323,49 @@ } -//结束咨询 + - (void)getABMUpdate:(NSMutableDictionary *)parmDic { [httpRequest httpGetRequest:@"https://base.icdat.cn/latest" params:parmDic]; } +//版本更新 + +- (void)GetAppVesionUpdata:(NSMutableDictionary *)parmDic { + + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-system/version/getSysVersionDetailByPackageName",Http] params:parmDic]; + +} + +#pragma mark - 应急求助 + +- (void)getSOSDoctorRecordList:(NSMutableDictionary *)parmDic { + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/initUserOrderPage",Http] params:parmDic]; +} + +- (void)getSOSDoctorDetailInfo:(NSMutableDictionary *)parmDic { + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/orderInfo",Http] params:parmDic]; +} + +- (void)getMyParticipatedOrders:(NSMutableDictionary *)parmDic { + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/myParticipatedOrders",Http] params:parmDic]; +} + +- (void)getActualGroupMemberList:(NSMutableDictionary *)parmDic { + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/getActualGroupMemberList",Http] params:parmDic]; +} + +- (void)getSearchEmployee:(NSMutableDictionary *)parmDic { + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/searchEmployee",Http] params:parmDic]; +} + +- (void)getSearchExpert:(NSMutableDictionary *)parmDic { + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/searchExpert",Http] params:parmDic]; +} + +- (void)postAddGroupUser:(NSMutableDictionary *)parmDic { + [httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/addGroupUser",Http] params:parmDic]; +} + @end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/XJDHomePageViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/XJDHomePageViewController.m index c852599..bbc57f2 100644 --- a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/XJDHomePageViewController.m +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/controller/XJDHomePageViewController.m @@ -24,7 +24,12 @@ #import "XJDDoctorInfoModel.h" #import "PSAppInfo.h" #import "PSCheckVersion.h" -@interface XJDHomePageViewController () +#import "UPAppVesionModel.h" +#import "PSCheckVersionView.h" +#import "XJParticipatedOrderModel.h" + + +@interface XJDHomePageViewController () @property (nonatomic, strong) UIScrollView * mainScrollView; @@ -37,12 +42,33 @@ @property (nonatomic, strong) UIImageView * heardImage; @property (nonatomic, strong) UILabel * messageLabel; + @property (nonatomic, copy) NSString * smallGroup; + +@property (nonatomic, strong) PSCheckVersionView * checkVersionView; + +@property (nonatomic, strong) UIView * coverView; + +@property (nonatomic, strong) NSMutableArray *orderList; +@property (nonatomic, assign) NSInteger orderPage; +@property (nonatomic, strong) UITableView *orderPopupTable; +@property (nonatomic, assign) NSInteger selectedOrderIndex; + @end @implementation XJDHomePageViewController +- (UIView *)coverView { + + if (!_coverView) { + _coverView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; + _coverView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5f]; + } + return _coverView; +} + + - (void)viewDidLoad { [super viewDidLoad]; @@ -54,7 +80,6 @@ object:nil]; //前缀请求 - [self chageUrlService]; [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; [[TUICallEngine createInstance] addObserver:self]; @@ -62,10 +87,9 @@ self.StatusBarStyle = UIStatusBarStyleDefault; self.view.backgroundColor = CViewBgColor; self.navigationItem.title = @"健康专家库"; - + [self getUpDateinfo]; [self docotrUserInfo]; [self creatSmallHelpNumber]; - [PSCheckVersion checkVersionCompulsoryUpdate]; } @@ -76,84 +100,12 @@ } -#pragma mark:请求前缀 -- (void)chageUrlService { - - AFHTTPSessionManager *session=[AFHTTPSessionManager manager]; - // AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; - - session.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain", nil]; - //超时时间 - - session.requestSerializer.timeoutInterval= 30.f; - session.responseSerializer = [AFHTTPResponseSerializer serializer]; - - session.requestSerializer = [AFJSONRequestSerializer serializer]; - - session.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; - - NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; - - // 获取应用的版本号 - NSString * version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; - // 将版本号按照点(.)分割成数组 - NSArray * components = [version componentsSeparatedByString:@"."]; - - // 获取数组中的最后一个元素 - NSString * lastComponent = [components lastObject]; - // 如果需要将其转换为整数 - NSInteger lastNumber = [lastComponent integerValue]; - - [parmDic setObject:@(lastNumber) forKey:@"version"]; - [parmDic setObject:@"health.Employees.tools" forKey:@"pkg"]; - - - [session GET:@"https://base.icdat.cn/v2/url" parameters:parmDic headers:nil progress:^(NSProgress * _Nonnull downloadProgress) { - - } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { - - NSString * dataString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; - DLog(@"response\n%@\n",dataString); - NSData *requestData = [dataString dataUsingEncoding:NSUTF8StringEncoding]; - - id myResult = [NSJSONSerialization JSONObjectWithData:requestData options:NSJSONReadingMutableContainers error:nil]; - //判断是否为字典 - if ([myResult isKindOfClass:[NSDictionary class]]) { - - NSDictionary *response = (NSDictionary *)myResult; - if ([response.allKeys containsObject:@"result"]) { - NSDictionary * resultDic = [response objectForKey:@"result"]; - - if ([resultDic.allKeys containsObject:@"api"]) { - [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"api"] forKey:@"HTTPS"]; - [[NSUserDefaults standardUserDefaults] synchronize]; - } - if ([resultDic.allKeys containsObject:@"h5"]) { - [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"h5"] forKey:@"IntervenH5"]; - [[NSUserDefaults standardUserDefaults] synchronize]; - } - if ([resultDic.allKeys containsObject:@"h5Host"]) { - [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"h5Host"] forKey:@"H5DevHost"]; - [[NSUserDefaults standardUserDefaults] synchronize]; - } - if ([resultDic.allKeys containsObject:@"health"]) { - [[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"health"] forKey:@"BASEURL"]; - [[NSUserDefaults standardUserDefaults] synchronize]; - } - } - } - - } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - NSString * statusCode = [error.userInfo objectForKey:@"NSLocalizedDescription"]; - - }]; -} - - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - [self.mainScrollView.mj_header beginRefreshing]; + // TODO: 接口恢复后取消注释 + // [self.mainScrollView.mj_header beginRefreshing]; } - (void)createUI { @@ -242,14 +194,14 @@ UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftImg.right + kRealValue(15), kRealValue(28), kScreenWidth - kRealValue(65), 14)]; titleLabel.textColor = UIColorHex(#333333); titleLabel.font = BOLDSYSTEMFONT(14); - titleLabel.text = @"小助手"; + titleLabel.text = @"全科医生"; titleLabel.textAlignment = NSTextAlignmentLeft; [smallView addSubview:titleLabel]; UILabel * desLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftImg.right + kRealValue(15), titleLabel.bottom + kRealValue(10), kScreenWidth - kRealValue(65), 11)]; desLabel.textColor = UIColorHex(#666666); desLabel.font = SYSTEMFONT(11); - desLabel.text = @"联系小助手获取相关帮助和支持"; + desLabel.text = @"联系全科医生获取相关帮助和支持"; desLabel.textAlignment = NSTextAlignmentLeft; [smallView addSubview:desLabel]; @@ -271,6 +223,41 @@ // messageLabel.backgroundColor = UIColorHex(#21BEBD); // [smallView addSubview:messageLabel]; + + // 员工应急求助入口 + UIView * sosView = [[UIView alloc] initWithFrame:CGRectMake(kRealValue(15), smallView.bottom + kRealValue(10), kScreenWidth - kRealValue(30), 90)]; + sosView.backgroundColor = KWhiteColor; + sosView.layer.cornerRadius = 10.0; + sosView.layer.masksToBounds = YES; + UITapGestureRecognizer *sosTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sosEmergencyAction)]; + [sosView addGestureRecognizer:sosTap]; + [self.mainScrollView addSubview:sosView]; + + // 图标 40x40 上下居中 + UIImageView * sosIcon = [[UIImageView alloc] initWithFrame:CGRectMake(20, (90 - 40) / 2, 40, 40)]; + sosIcon.image = [UIImage imageNamed:@"home_sos_icon"]; + sosIcon.layer.cornerRadius = 20; + sosIcon.layer.masksToBounds = YES; + sosIcon.backgroundColor = UIColorHex(#21BEBD); + [sosView addSubview:sosIcon]; + + // 标题 + UILabel * sosTitle = [[UILabel alloc] initWithFrame:CGRectMake(sosIcon.right + 12, (90 - 14 - 6 - 12) / 2, sosView.width - sosIcon.right - 32, 14)]; + sosTitle.text = @"员工应急求助"; + sosTitle.textColor = UIColorHex(#262626); + sosTitle.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + [sosView addSubview:sosTitle]; + + // 副标题 + UILabel * sosSubTitle = [[UILabel alloc] initWithFrame:CGRectMake(sosIcon.right + 12, sosTitle.bottom + 10, sosView.width - sosIcon.right - 32, 12)]; + sosSubTitle.text = @"专家视频连线,守护员工健康"; + sosSubTitle.textColor = UIColorHex(#6A6A6A); + sosSubTitle.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; + [sosView addSubview:sosSubTitle]; + + // 设置 scrollView 可滚动范围 + self.mainScrollView.contentSize = CGSizeMake(kScreenWidth, sosView.bottom + 30); + MJWeakSelf self.mainScrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ // 进入刷新状态后会自动调用这个block @@ -317,6 +304,21 @@ } +#pragma mark:更新 +- (void)getUpDateinfo { + + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + // 获取应用的版本号 + [parmDic setObject:@"com.questionTools.DoctorXinjiang" forKey:@"packageName"]; + [parmDic setObject:@"2" forKey:@"androidOrIos"]; + + XJDNetAPI * homeRemakerApi = [[XJDNetAPI alloc] init:self tag:@"UPVERSION" NeedToken:@""]; + [homeRemakerApi GetAppVesionUpdata:parmDic]; + + +} + + - (void)creatSmallHelpNumber { XJDNetAPI * homeApi = [[XJDNetAPI alloc] init:self tag:@"SMALLAPI" NeedToken:@""]; @@ -452,7 +454,7 @@ chatVC.isVideo = false; chatVC.eableSendReport = YES; chatVC.eableMapTools = false; - chatVC.navTitle = @"小助手"; + chatVC.navTitle = @"全科医生"; chatVC.eablehaveHelathData = YES; chatVC.questionType = 1; chatVC.memberSex = @"2"; @@ -531,9 +533,110 @@ [self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"doctorNoImage"]]; } + 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(@"不需要更新"); + } + } + + 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) { + [EasyTextView showErrorText:@"暂无进行中的应急工单"]; + return; + } + NSMutableArray *models = [NSMutableArray array]; + for (NSDictionary *d in records) { + [models addObject:[XJParticipatedOrderModel modelWithDictionary:d]]; + } + if (models.count == 1 && [dic[@"total"] integerValue] == 1) { + XJParticipatedOrderModel *m = models.firstObject; + ChatViewController *chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.isFromFirstAid = YES; + chatVC.isVideo = YES; + chatVC.chatID = m.sessionId; + chatVC.navTitle = @"应急求助"; + [self.navigationController pushViewController:chatVC animated:YES]; + return; + } + self.orderList = models; + [self showOrderListPopup:self.orderList]; + } +} + +//是否需要更新 +- (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); + } + + - (void)topAction:(UIButton *)btn { @@ -583,7 +686,7 @@ if ([title isEqualToString:@"视频咨询"]) { leftImg.image = [UIImage imageNamed:@"home_VideoQustion"]; } - if ([title isEqualToString:@"小助手"]) { + if ([title isEqualToString:@"全科医生"]) { leftImg.image = [UIImage imageNamed:@"home_small"]; } leftImg.backgroundColor = [UIColor greenColor]; @@ -643,6 +746,7 @@ numLabel.layer.masksToBounds = true; numLabel.backgroundColor = UIColorHex(#21BEBD); numLabel.tag = NumberTag; + numLabel.hidden = YES; [replayBtn addSubview:numLabel]; //进行中 UIButton * qustionBtn = [[UIButton alloc] initWithFrame:CGRectMake(view.width/3 , linView.bottom ,view.width/3 , 45)]; @@ -663,6 +767,7 @@ jingxingLabel.layer.masksToBounds = true; jingxingLabel.backgroundColor = UIColorHex(#21BEBD); jingxingLabel.tag = NumberTag + 10; + jingxingLabel.hidden = YES; [qustionBtn addSubview:jingxingLabel]; //完成 @@ -683,6 +788,7 @@ wanchengLabel.layer.masksToBounds = true; wanchengLabel.backgroundColor = UIColorHex(#21BEBD); wanchengLabel.tag = NumberTag + 20; + wanchengLabel.hidden = YES; [wanchengBtn addSubview:wanchengLabel]; return view; @@ -750,25 +856,317 @@ } -//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。 +// 异地登录/账号被踢:弹提示回到登录页 - (void)onKickedOffline { - - [XJDCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; [ESCTUIManager outLoginTUISDK]; - KPostNotification(KNotificationLoginStateChange, @NO); - + [XJDCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + dispatch_async(dispatch_get_main_queue(), ^{ + [EasyTextView showErrorText:@"账号在其他设备登录,请重新登录"]; + KPostNotification(KNotificationLoginStateChange, @NO); + }); } +- (void)onConnectFailed:(int)code err:(NSString *)err { + [self loginImAccount]; +} +#pragma mark - ————— 应急求助 ————— -/* -#pragma mark - Navigation +- (void)sosEmergencyAction { + [self showMBProgressHUDWithString:@"加载中..." autoHidden:false]; -// 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. + NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; + [parmDic setObject:@(1) forKey:@"pageNo"]; + [parmDic setObject:@"10" forKey:@"pageSize"]; + XJDNetAPI * api = [[XJDNetAPI alloc] init:self tag:@"myParticipatedOrders" NeedToken:@""]; + [api getMyParticipatedOrders:parmDic]; +} + +#pragma mark - 工单列表弹窗 + +- (void)showOrderListPopup:(NSArray *)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 = @"\u2715"; 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); + [[[XJDNetAPI 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); + [[[XJDNetAPI 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]; + ChatViewController *chatVC = [[ChatViewController alloc] init]; + chatVC.isGroupID = YES; + chatVC.isFromFirstAid = YES; + chatVC.isVideo = YES; + chatVC.chatID = m.sessionId; + chatVC.navTitle = @"应急求助"; + [self.navigationController pushViewController:chatVC animated:YES]; +} + +#pragma mark - 工单列表 TableView + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + if (tableView == self.orderPopupTable) return self.orderList.count; + return 0; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + if (tableView == self.orderPopupTable) return 0.01; + return 0; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + if (tableView == self.orderPopupTable) return [UIView new]; + return nil; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *cid = @"OrderCell"; + if (tableView != self.orderPopupTable) return [UITableViewCell new]; + 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 { + if (tableView == self.orderPopupTable) { + self.selectedOrderIndex = indexPath.row; + [tableView reloadData]; + } } -*/ @end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/UPAppVesionModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/UPAppVesionModel.h new file mode 100644 index 0000000..4a7a377 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/UPAppVesionModel.h @@ -0,0 +1,16 @@ +// +// UPAppVesionModel.h +// DoctorXinjiang +// +// Created by Apple on 2025/12/25. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface UPAppVesionModel : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/UPAppVesionModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/UPAppVesionModel.m new file mode 100644 index 0000000..1000162 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/UPAppVesionModel.m @@ -0,0 +1,12 @@ +// +// UPAppVesionModel.m +// DoctorXinjiang +// +// Created by Apple on 2025/12/25. +// + +#import "UPAppVesionModel.h" + +@implementation UPAppVesionModel + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/XJParticipatedOrderModel.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/XJParticipatedOrderModel.h new file mode 100644 index 0000000..62c291f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/XJParticipatedOrderModel.h @@ -0,0 +1,24 @@ +// +// XJParticipatedOrderModel.h +// XinjiangProject +// +// 急救员 - 我参与的应急工单 +// + +#import + +@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 diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/XJParticipatedOrderModel.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/XJParticipatedOrderModel.m new file mode 100644 index 0000000..48b087f --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/model/XJParticipatedOrderModel.m @@ -0,0 +1,15 @@ +// +// XJParticipatedOrderModel.m +// XinjiangProject +// + +#import "XJParticipatedOrderModel.h" + +@implementation XJParticipatedOrderModel + ++ (NSDictionary *)modelCustomPropertyMapper { + return @{@"createTime": @"initTime"}; +} + + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailTitleView.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/XJDDetailTitleView.h similarity index 85% rename from DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailTitleView.h rename to DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/XJDDetailTitleView.h index af26fcf..151f645 100644 --- a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/DetailUserinfoView(咨询人信息)/DetailTitleView.h +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/BillDetailView(账单详情)/XJDDetailTitleView.h @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface DetailTitleView : UIView +@interface XJDDetailTitleView : UIView @property (nonatomic, copy) NSString * createTime; diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.h b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/XJDLifeManagerCell.h similarity index 67% rename from DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.h rename to DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/XJDLifeManagerCell.h index 1fdca8e..7cae448 100644 --- a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.h +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/XJDLifeManagerCell.h @@ -1,5 +1,5 @@ // -// SYLifeManagerCell.h +// XJDLifeManagerCell.h // shan // // Created by aDu on 2016/12/5. @@ -7,17 +7,17 @@ // #import -#import "YXToolsModel.h" +#import "XJDToolsModel.h" -@interface SYLifeManagerCell : UICollectionViewCell +@interface XJDLifeManagerCell : UICollectionViewCell @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UIButton *button; -@property (nonatomic, strong) YXToolsModel *model; +@property (nonatomic, strong) XJDToolsModel *model; @property (nonatomic, assign) BOOL inEditState; //是否处于编辑状态 -- (void)setModel:(YXToolsModel *)model indexPaht:(NSIndexPath *)indexPath exist:(BOOL)exist; +- (void)setModel:(XJDToolsModel *)model indexPaht:(NSIndexPath *)indexPath exist:(BOOL)exist; - (void)setDataAry:(NSMutableArray *)dataAry groupAry:(NSMutableArray *)groupAry indexPath:(NSIndexPath *)indexPath; diff --git a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.m b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/XJDLifeManagerCell.m similarity index 94% rename from DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.m rename to DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/XJDLifeManagerCell.m index 9d83456..92166b0 100644 --- a/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/MoveAddDelete/SYLifeManagerCell.m +++ b/DoctorXinjiang/DoctorXinjiang/Project/HomePage/view/HospitalSelected/XJDLifeManagerCell.m @@ -1,21 +1,21 @@ // -// SYLifeManagerCell.m +// XJDLifeManagerCell.m // shan // // Created by aDu on 2016/12/5. // Copyright © 2016年 DuKaiShun. All rights reserved. // -#import "SYLifeManagerCell.h" +#import "XJDLifeManagerCell.h" #import "Masonry.h" -@interface SYLifeManagerCell () +@interface XJDLifeManagerCell () @property (nonatomic, strong) UIImageView *imageView; @end -@implementation SYLifeManagerCell +@implementation XJDLifeManagerCell - (id)initWithFrame:(CGRect)frame { @@ -51,7 +51,7 @@ }]; } -- (void)setModel:(YXToolsModel *)model indexPaht:(NSIndexPath *)indexPath exist:(BOOL)exist +- (void)setModel:(XJDToolsModel *)model indexPaht:(NSIndexPath *)indexPath exist:(BOOL)exist { if (_model != model) { self.titleLabel.text = model.title; @@ -73,7 +73,7 @@ - (void)setDataAry:(NSMutableArray *)dataAry groupAry:(NSMutableArray *)groupAry indexPath:(NSIndexPath *)indexPath { - YXToolsModel *model; + XJDToolsModel *model; if (indexPath.section == 0) { model = dataAry[indexPath.row]; } else { diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.h index b033caa..657681b 100644 --- a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.h +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.h @@ -54,6 +54,12 @@ NS_ASSUME_NONNULL_BEGIN //咨询人男女 @property (nonatomic, copy) NSString * memberSex; +// 急救员入口标记 +@property (nonatomic, assign) BOOL isFromFirstAid; + +// 从急救员入口进入应急群聊 +- (void)enterChatWithSessionId:(NSString *)sessionId title:(NSString *)title; + @end NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.m index c864c8d..20cd5c3 100644 --- a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.m +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/ChatViewController.m @@ -19,6 +19,13 @@ #import #import #import "TUIGroupChatViewController.h" +#import +#import "TUICallingUserManager.h" +#import "TUICallingUserModel.h" +#import "XJParticipatedOrderModel.h" +#import "XJSelectContactViewController.h" +#import +#import //自定义map #define BussinessID_CustomMap @"TIMLocationElem" //自定义评论 @@ -31,7 +38,7 @@ @class TUIChatDataProvider; -@interface ChatViewController () +@interface ChatViewController () @property (nonatomic, strong) TUIC2CChatViewController * vc; @property (nonatomic, strong) TUIGroupChatViewController * groupvc; @@ -39,6 +46,18 @@ @property (nonatomic, assign) CGFloat starNumber; @property (nonatomic, strong) NSString * evlationConnte; +// 急救员相关 +@property (nonatomic, strong) UIView *memberPanel; +@property (nonatomic, strong) UIView *memberOverlay; +@property (nonatomic, strong) UITableView *memberTableView; +@property (nonatomic, strong) UILabel *memberTitleLabel; +@property (nonatomic, strong) NSMutableArray *memberList; +@property (nonatomic, strong) UIImageView *refreshIcon; +@property (nonatomic, strong) NSMutableArray *orderList; +@property (nonatomic, assign) NSInteger orderPage; +@property (nonatomic, strong) UITableView *orderPopupTable; +@property (nonatomic, assign) NSInteger selectedOrderIndex; + @end @implementation ChatViewController @@ -52,6 +71,8 @@ [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; [[TUICallEngine createInstance] addObserver:self]; + [[V2TIMManager sharedInstance] addConversationListener:self]; + [[V2TIMManager sharedInstance] addGroupListener:self]; // IMUserInfoModel * model = [XJDCommonUtils keyedUnarchiverWithKey:IMLoginUserInfo]; // [[TUICallEngine createInstance] init:[model.sdkAppId intValue] userId:model.userId userSig:model.userSig succ:^{ // @@ -78,16 +99,22 @@ // 显示翻译按钮 // TUIChatConfig.defaultConfig.enableTextTranslation = YES; //不显示视频和语音 - [TUIChatConfig defaultConfig].enableVideoCall = self.isVideo; // YES:开启,NO:关闭 - [TUIChatConfig defaultConfig].enableAudioCall = self.isVideo; // YES:开启,NO:关闭 + [TUIChatConfig defaultConfig].enableVideoCall = self.isVideo; + [TUIChatConfig defaultConfig].enableAudioCall = self.isFromFirstAid ? NO : self.isVideo; [TUIChatConfig defaultConfig].backgroudColor = UIColorHex(#EEEEEE); [TUIConfig defaultConfig].defaultAvatarImage = [UIImage imageNamed:@"heard_man"]; [TUIConfig defaultConfig].avatarType = TAvatarTypeRounded; - + TUIChatConfig.defaultConfig.enableTypingStatus = NO; //是否显示发送报告 - [TUIChatConfig defaultConfig].enableSendReportCall = self.eableSendReport; + [TUIChatConfig defaultConfig].enableSendReportCall = true; [TUIChatConfig defaultConfig].enableSendHealthDataCall = self.eablehaveHelathData; [TUIChatConfig defaultConfig].enableMapCall = self.eableMapTools; + + // 急救员入口隐藏结束咨询、档案、语音通话 + if (self.isFromFirstAid) { + [TUIChatConfig defaultConfig].enableEndConsultation = NO; + [TUIChatConfig defaultConfig].enableSendHealthDataCall = YES; + } TUIConfig *config = [TUIConfig defaultConfig]; config.avatarType = TAvatarTypeRounded; // 修改默认头像 @@ -140,8 +167,18 @@ // 把 TUIC2CChatViewController 添加到自己的 ViewController + // 右上角三个点(仅急救员入口显示) + if (self.isFromFirstAid) { + UIButton *moreBtn = [UIButton buttonWithType:UIButtonTypeSystem]; + [moreBtn setTitle:@"···" forState:UIControlStateNormal]; + moreBtn.titleLabel.font = [UIFont boldSystemFontOfSize:22]; + [moreBtn setTitleColor:KWhiteColor forState:UIControlStateNormal]; + [moreBtn addTarget:self action:@selector(moreAction) forControlEvents:UIControlEventTouchUpInside]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:moreBtn]; + } + if ([self.tfNew integerValue] == 1) { - + [ESCTUIManager sendGroupVideo:self.chatID withUserIdList:self.member]; } //主动发送一条消息 @@ -366,45 +403,6 @@ [self.navigationController pushViewController:currVC animated:YES]; } -#pragma mark:网络请求 -- (void)Failed:(NSString*)message tag:(NSString*)tag -{ - [self showMBProgressHUDOnlyWithString:message]; - [self hiddenAllMBProgressHUD]; - -} -- (void)Sucess:(id)response tag:(NSString*)tag -{ - if ([tag isEqualToString:@"ENDSOSAPI"]) - { - NSDictionary * parmDic = response; - if( self.isGroupID == false) { - - self.vc.inputController.view.hidden = YES; - }else - { - self.groupvc.inputController.view.hidden = YES; - } - - - } - - if ([tag isEqualToString:@"ENDPICTUREAPI"]) { - - if( self.isGroupID == false) { - - self.vc.inputController.view.hidden = YES; - }else - { - self.groupvc.inputController.view.hidden = YES; - } - - } - if ([tag isEqualToString:@"DoctorSource"]) { - - } -} - - (void)doctorSourceWithStarNumaber:(CGFloat)starNumer withContext:(NSString *)connet isKnow:(NSString *)isNiming{ // NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init]; @@ -524,7 +522,7 @@ } /* #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]. @@ -532,6 +530,639 @@ } */ +#pragma mark - ————— 急救员 ————— +- (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)callFirstAiderAction { + [self showMBProgressHUDWithString:@"加载中..." autoHidden:false]; + self.orderPage = 1; + NSMutableDictionary *params = [NSMutableDictionary dictionary]; + params[@"pageNo"] = @(self.orderPage); + params[@"pageSize"] = @(10); + XJDNetAPI *api = [[XJDNetAPI alloc] init:self tag:@"myParticipatedOrders" NeedToken:@""]; + [api getMyParticipatedOrders:params]; +} + +#pragma mark - 工单列表弹窗 + +- (void)showOrderListPopup:(NSArray *)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); + [[[XJDNetAPI 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); + [[[XJDNetAPI 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]; +} + +#pragma mark - 群成员侧滑面板 + +- (void)moreAction { + if (!self.isGroupID) return; + if (self.memberPanel) { [self hideMemberPanel]; return; } + + UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; + CGFloat panelW = kScreenWidth - 94; + + self.memberOverlay = [[UIView alloc] initWithFrame:keyWindow.bounds]; + self.memberOverlay.backgroundColor = RGBA(0, 0, 0, 0.4); + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideMemberPanel)]; + [self.memberOverlay addGestureRecognizer:tap]; + [keyWindow addSubview:self.memberOverlay]; + + self.memberPanel = [[UIView alloc] initWithFrame:CGRectMake(kScreenWidth, 0, panelW, kScreenHeight)]; + self.memberPanel.backgroundColor = KWhiteColor; + [keyWindow addSubview:self.memberPanel]; + + UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, panelW, kStatusBarHeight + 44)]; + headerView.backgroundColor = KWhiteColor; + [self.memberPanel addSubview:headerView]; + + self.memberTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, kStatusBarHeight, panelW - 56, 44)]; + self.memberTitleLabel.text = @"群成员"; + self.memberTitleLabel.textAlignment = NSTextAlignmentLeft; + self.memberTitleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; + self.memberTitleLabel.textColor = UIColorHex(0x070809); + [headerView addSubview:self.memberTitleLabel]; + + UIButton *closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(panelW - 44, kStatusBarHeight, 44, 44)]; + [closeBtn setTitle:@"✕" forState:UIControlStateNormal]; + [closeBtn setTitleColor:UIColorHex(0x070809) forState:UIControlStateNormal]; + [closeBtn addTarget:self action:@selector(hideMemberPanel) forControlEvents:UIControlEventTouchUpInside]; + [headerView addSubview:closeBtn]; + + UIView *headerLine = [[UIView alloc] initWithFrame:CGRectMake(12, headerView.bounds.size.height - 1, panelW - 12, 1)]; + headerLine.backgroundColor = UIColorHex(0xEAECF1); + [headerView addSubview:headerLine]; + + CGFloat tableY = kStatusBarHeight + 44; + self.memberTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, tableY, panelW, kScreenHeight - tableY) style:UITableViewStylePlain]; + self.memberTableView.delegate = self; + self.memberTableView.dataSource = self; + self.memberTableView.separatorStyle = UITableViewCellSeparatorStyleNone; + self.memberTableView.rowHeight = 68; + self.memberTableView.tableFooterView = [self makeAddMemberFooterView:panelW]; + [self.memberPanel addSubview:self.memberTableView]; + + [UIView animateWithDuration:0.25 animations:^{ + self.memberPanel.frame = CGRectMake(kScreenWidth - panelW, 0, panelW, kScreenHeight); + }]; + + [self loadGroupMembers]; +} + +- (UIView *)makeAddMemberFooterView:(CGFloat)panelW { + UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, panelW, 20 + 49 + 57)]; + footer.backgroundColor = KWhiteColor; + + 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; + addBtn.layer.borderColor = UIColorHex(0x2EB8B2).CGColor; + [addBtn addTarget:self action:@selector(addMemberAction) forControlEvents:UIControlEventTouchUpInside]; + + UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(0, (49 - 18) / 2, 18, 18)]; + icon.image = [UIImage imageNamed:@"firstAid_add_icon"]; + icon.contentMode = UIViewContentModeScaleAspectFit; + [addBtn addSubview:icon]; + + UILabel *btnTitle = [[UILabel alloc] init]; + btnTitle.text = @"添加成员"; + btnTitle.textColor = UIColorHex(0x2EB8B2); + btnTitle.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; + [btnTitle sizeToFit]; + CGFloat totalW = 18 + 6 + btnTitle.bounds.size.width; + icon.frame = CGRectMake((addBtn.bounds.size.width - totalW) / 2, (49 - 18) / 2, 18, 18); + btnTitle.frame = CGRectMake(icon.frame.origin.x + 18 + 6, (49 - btnTitle.bounds.size.height) / 2, btnTitle.bounds.size.width, btnTitle.bounds.size.height); + [addBtn addSubview:btnTitle]; + + [footer addSubview:addBtn]; + return footer; +} + +- (void)hideMemberPanel { + CGFloat panelW = kScreenWidth - 94; + [UIView animateWithDuration:0.25 animations:^{ + self.memberPanel.frame = CGRectMake(kScreenWidth, 0, panelW, kScreenHeight); + } completion:^(BOOL finished) { + [self.memberOverlay removeFromSuperview]; + [self.memberPanel removeFromSuperview]; + self.memberOverlay = nil; + self.memberPanel = nil; + self.memberTableView = nil; + self.memberList = nil; + }]; +} + +- (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 showMBProgressHUDWithString:@"加载中..." autoHidden:NO]; + self.memberList = [NSMutableArray array]; + NSMutableDictionary *params = [NSMutableDictionary dictionary]; + [params setObject:self.chatID forKey:@"sessionId"]; + XJDNetAPI *api = [[XJDNetAPI alloc] init:self tag:@"GROUPMEMBERLIST" NeedToken:@""]; + [api getActualGroupMemberList:params]; +} + +- (NSString *)memberTypeNameFromValue:(NSInteger)memberType { + switch (memberType) { + case -1: return @"发起人"; + case 0: return @"操作人员"; + case 1: return @"专业人员"; + case 2: return @"员工"; + default: return @""; + } +} + +- (void)addMemberAction { + [self hideMemberPanel]; + XJSelectContactViewController *selectVC = [[XJSelectContactViewController alloc] init]; + selectVC.chatID = self.chatID; + selectVC.groupId = self.chatID; + UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:selectVC]; + nav.modalPresentationStyle = UIModalPresentationFullScreen; + UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; + [keyWindow.rootViewController presentViewController:nav animated:YES completion:nil]; +} + +- (void)callMemberAction:(UIButton *)sender { + UITableViewCell *cell = (UITableViewCell *)sender.superview.superview; + NSIndexPath *indexPath = [self.memberTableView indexPathForCell:cell]; + if (!indexPath || indexPath.row >= self.memberList.count) return; + NSDictionary *member = self.memberList[indexPath.row]; + NSString *phone = member[@"phone"]; + if (phone.length == 0) { + [EasyTextView showErrorText:@"暂无手机号"]; + return; + } + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", phone]] options:nil completionHandler:nil]; +} + +- (void)loginImAccount { + XJDNetAPI *api = [[XJDNetAPI alloc] init:self tag:@"loginIMAPI" NeedToken:nil]; + [api GetIMLoginAccount:nil]; +} + +#pragma mark - V2TIMConversationListener + +- (void)onConversationChanged:(NSArray *)conversationList {} + +- (void)onKickedOffline { + [XJDCommonUtils keyedArchiverWithData:nil key:LoginUserInfo]; + [ESCTUIManager outLoginTUISDK]; + KPostNotification(KNotificationLoginStateChange, @NO); +} + +#pragma mark - V2TIMGroupListener + +- (void)onMemberEnter:(NSString *)groupID memberList:(NSArray *)memberList { + if ([groupID isEqualToString:self.chatID] && self.memberPanel) { + [self loadGroupMembers]; + } +} + +#pragma mark - ————— Network ————— + +- (void)Failed:(NSString*)message tag:(NSString*)tag +{ + if ([tag isEqualToString:@"myParticipatedOrders"]) { + [self hiddenAllMBProgressHUD]; + if (self.orderPage == 1) [EasyTextView showErrorText:message]; + return; + } + [self showMBProgressHUDOnlyWithString:message]; + [self hiddenAllMBProgressHUD]; +} +- (void)Sucess:(id)response tag:(NSString*)tag +{ + if ([tag isEqualToString:@"ENDSOSAPI"]) + { + NSDictionary * parmDic = response; + if( self.isGroupID == false) { + + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + + + } + + if ([tag isEqualToString:@"ENDPICTUREAPI"]) { + + if( self.isGroupID == false) { + + self.vc.inputController.view.hidden = YES; + }else + { + self.groupvc.inputController.view.hidden = YES; + } + + } + if ([tag isEqualToString:@"DoctorSource"]) { + + } + 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:@"GROUPMEMBERLIST"]) { + [self hiddenAllMBProgressHUD]; + [self.memberList removeAllObjects]; + NSArray *list = [response isKindOfClass:[NSDictionary class]] ? response[@"result"] : response; + if ([list isKindOfClass:[NSArray class]]) { + [self.memberList addObjectsFromArray:list]; + } + self.memberTitleLabel.text = [NSString stringWithFormat:@"群成员(%lu)", (unsigned long)self.memberList.count]; + [self.memberTableView reloadData]; + [self.refreshIcon.layer removeAnimationForKey:@"refreshRotation"]; + return; + } + if ([tag isEqualToString:@"loginIMAPI"]) { + [self hiddenAllMBProgressHUD]; + NSDictionary *pamrDic = response; + NSInteger sdkAppId = [[pamrDic objectForKey:@"sdkAppId"] intValue]; + NSString *userId = [pamrDic objectForKey:@"userId"]; + NSString *userSig = [pamrDic objectForKey:@"userSig"]; + [ESCTUIManager loginInitTUISDKAppidWith:sdkAppId UserID:userId userSig:userSig]; + [self callFirstAiderAction]; + return; + } +} + +#pragma mark - ————— UITableView ————— + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + if (tableView == self.memberTableView) return self.memberList.count; + if (tableView == self.orderPopupTable) return self.orderList.count; + return 0; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + if (tableView == self.memberTableView) return 68; + if (tableView == self.orderPopupTable) return 160; + return 44; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + if (tableView == self.memberTableView) return [self memberCellForRowAtIndexPath:indexPath]; + if (tableView == self.orderPopupTable) return [self orderCellForRowAtIndexPath:indexPath]; + return [UITableViewCell new]; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if (tableView == self.orderPopupTable) { + self.selectedOrderIndex = indexPath.row; + [tableView reloadData]; + } + [tableView deselectRowAtIndexPath:indexPath animated:YES]; +} + +#pragma mark - 群成员 Cell + +- (UITableViewCell *)memberCellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *cellId = @"MemberCell"; + NSDictionary *member = self.memberList[indexPath.row]; + CGFloat panelW = kScreenWidth - 94; + + UITableViewCell *cell = [self.memberTableView dequeueReusableCellWithIdentifier:cellId]; + if (!cell) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + UIImageView *avatar = [[UIImageView alloc] initWithFrame:CGRectMake(12, 11, 45, 45)]; + avatar.tag = 100; + avatar.layer.cornerRadius = 8; + avatar.layer.masksToBounds = YES; + [cell.contentView addSubview:avatar]; + + UILabel *nameLabel = [[UILabel alloc] init]; + nameLabel.tag = 101; + nameLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; + nameLabel.textColor = UIColorHex(0x070809); + [cell.contentView addSubview:nameLabel]; + + UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, 42, panelW - 132, 14)]; + titleLabel.tag = 102; + titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular]; + titleLabel.textColor = UIColorHex(0x808080); + [cell.contentView addSubview:titleLabel]; + + UIButton *phoneBtn = [[UIButton alloc] initWithFrame:CGRectMake(panelW - 47, 20, 32, 32)]; + phoneBtn.tag = 103; + [phoneBtn setImage:[UIImage imageNamed:@"firstAid_phone_icon"] forState:UIControlStateNormal]; + [phoneBtn addTarget:self action:@selector(callMemberAction:) forControlEvents:UIControlEventTouchUpInside]; + [cell.contentView addSubview:phoneBtn]; + + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(70, 67, panelW - 70, 1)]; + line.tag = 104; + line.backgroundColor = UIColorHex(0xEAECF1); + [cell.contentView addSubview:line]; + } + + UIImageView *avatar = [cell.contentView viewWithTag:100]; + UILabel *nameLabel = [cell.contentView viewWithTag:101]; + UILabel *titleLabel = [cell.contentView viewWithTag:102]; + + NSString *userName = member[@"userName"] ?: @""; + nameLabel.text = userName; + CGSize nameSize = [userName sizeWithAttributes:@{NSFontAttributeName: nameLabel.font}]; + nameLabel.frame = CGRectMake(70, 15, nameSize.width, 17); + + titleLabel.text = [self memberTypeNameFromValue:[member[@"memberType"] integerValue]]; + + NSString *avatarPath = member[@"avatar"]; + if (avatarPath.length > 0) { + NSString *fullUrl = [avatarPath hasPrefix:@"http"] ? avatarPath : [NSString stringWithFormat:@"%@%@", ResourceAddress, avatarPath]; + [avatar sd_setImageWithURL:[NSURL URLWithString:fullUrl] placeholderImage:[UIImage imageNamed:@"heard_man"]]; + } else { + avatar.image = [UIImage imageNamed:@"heard_man"]; + } + + return cell; +} + +#pragma mark - 工单 Cell + +- (UITableViewCell *)orderCellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *cid = @"OrderCell"; + XJParticipatedOrderModel *m = self.orderList[indexPath.row]; + BOOL selected = (indexPath.row == self.selectedOrderIndex); + CGFloat panelW = kScreenWidth - 46; + + UITableViewCell *cell = [self.orderPopupTable dequeueReusableCellWithIdentifier:cid]; + 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 *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(nameLbl.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]; + 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); + orgLbl.textColor = UIColorHex(0x2EB8B2); + timeLbl.textColor = UIColorHex(0x2EB8B2); + } else { + container.layer.borderColor = UIColorHex(0xE6E6EA).CGColor; + container.backgroundColor = KWhiteColor; + orgLbl.textColor = UIColorHex(0x77849E); + timeLbl.textColor = UIColorHex(0x77849E); + } + nameLbl.textColor = UIColorHex(0x252535); + + nameLbl.text = m.salvageUserName ?: @"--"; + 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; +} @end diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/XJSelectContactViewController.h b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/XJSelectContactViewController.h new file mode 100644 index 0000000..a5859a5 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/XJSelectContactViewController.h @@ -0,0 +1,17 @@ +// +// XJSelectContactViewController.h +// XinjiangProject +// + +#import "YXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XJSelectContactViewController : YXBaseViewController + +@property (nonatomic, copy) NSString *chatID; +@property (nonatomic, copy) NSString *groupId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/XJSelectContactViewController.m b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/XJSelectContactViewController.m new file mode 100644 index 0000000..bcb9bc7 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Project/TUIChat/XJSelectContactViewController.m @@ -0,0 +1,413 @@ +// +// XJSelectContactViewController.m +// XinjiangProject +// + +#import "XJSelectContactViewController.h" +#import "XJDNetAPI.h" +#import "TUICallingCommon.h" +#import "TUICallingUserManager.h" +#import "TUICallingUserModel.h" +#import "TUICallKit.h" +#import +#import + +typedef NS_ENUM(NSUInteger, XJContactTab) { + XJContactTabEmployee = 0, + XJContactTabExpert = 1, +}; + +@interface XJSelectContactViewController () + +@property (nonatomic, assign) XJContactTab currentTab; + +// 顶部切换 +@property (nonatomic, strong) UIView *tabBgView; +@property (nonatomic, strong) UILabel *employeeTabLabel; +@property (nonatomic, strong) UILabel *expertTabLabel; + +// 搜索 +@property (nonatomic, strong) UITextField *searchField; + +// 列表 +@property (nonatomic, strong) UITableView *tableView; +@property (nonatomic, strong) NSMutableArray *dataArray; + +// 选中集合 +@property (nonatomic, strong) NSMutableSet *selectedIds; + +// 底部 +@property (nonatomic, strong) UIView *bottomView; + +@end + +@implementation XJSelectContactViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.isHidenNaviBar = NO; + self.navigationItem.title = @"选择联系人"; + self.view.backgroundColor = CViewBgColor; + + self.currentTab = XJContactTabEmployee; + self.dataArray = [NSMutableArray array]; + self.selectedIds = [NSMutableSet set]; + + [self createTopView]; + [self createBottomView]; + [self createTableView]; + [self loadData]; +} + +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + + CGFloat safeBottom = 0; + if (@available(iOS 11.0, *)) { + safeBottom = self.view.safeAreaInsets.bottom; + } + CGFloat bottomH = 60 + safeBottom; + self.bottomView.frame = CGRectMake(0, self.view.bounds.size.height - bottomH, kScreenWidth, bottomH); + + CGFloat top = 94; + CGFloat tableBottom = self.bottomView.frame.origin.y - 15; + self.tableView.frame = CGRectMake(0, top, kScreenWidth, tableBottom - top); +} + +#pragma mark - 顶部区域 (高度94) + +- (void)createTopView { + UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 94)]; + container.backgroundColor = KWhiteColor; + [self.view addSubview:container]; + + // 搜索按钮(右侧) + UIButton *searchBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - 56, 6, 56, 32)]; + [searchBtn setTitle:@"搜索" forState:UIControlStateNormal]; + searchBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + [searchBtn setTitleColor:UIColorHex(0x2EB8B2) forState:UIControlStateNormal]; + [searchBtn addTarget:self action:@selector(didTapSearch) forControlEvents:UIControlEventTouchUpInside]; + [container addSubview:searchBtn]; + + // 搜索框 + UIView *searchBg = [[UIView alloc] initWithFrame:CGRectMake(15, 6, kScreenWidth - 15 - 56, 32)]; + searchBg.backgroundColor = UIColorHex(0xF6F6F6); + searchBg.layer.cornerRadius = 8; + searchBg.layer.masksToBounds = YES; + [container addSubview:searchBg]; + + UIImageView *searchIcon = [[UIImageView alloc] initWithFrame:CGRectMake(12, (32 - 14) / 2, 14, 14)]; + searchIcon.image = [UIImage imageNamed:@"searchLeftIcon"]; + searchIcon.contentMode = UIViewContentModeScaleAspectFit; + [searchBg addSubview:searchIcon]; + + self.searchField = [[UITextField alloc] initWithFrame:CGRectMake(34, 0, searchBg.bounds.size.width - 34, 32)]; + self.searchField.font = [UIFont systemFontOfSize:14]; + self.searchField.returnKeyType = UIReturnKeySearch; + self.searchField.placeholder = @"请输入姓名搜索"; + [self.searchField addTarget:self action:@selector(didTapSearch) forControlEvents:UIControlEventEditingDidEndOnExit]; + [searchBg addSubview:self.searchField]; + + // 切换标签(搜索框底部 + 10) + CGFloat tabY = 6 + 32 + 10; + self.tabBgView = [[UIView alloc] initWithFrame:CGRectMake(17, tabY, kScreenWidth - 34, 36)]; + self.tabBgView.backgroundColor = UIColorHex(0xE8EBF2); + self.tabBgView.layer.cornerRadius = 8; + self.tabBgView.layer.masksToBounds = YES; + [container addSubview:self.tabBgView]; + + CGFloat tabW = (self.tabBgView.bounds.size.width - 4) / 2; + CGFloat tabH = 32; + + UIView *employeeBg = [[UIView alloc] initWithFrame:CGRectMake(2, 2, tabW, tabH)]; + employeeBg.backgroundColor = KWhiteColor; + employeeBg.layer.cornerRadius = 8; + employeeBg.layer.masksToBounds = YES; + employeeBg.tag = 200; + [self.tabBgView addSubview:employeeBg]; + + self.employeeTabLabel = [[UILabel alloc] initWithFrame:employeeBg.bounds]; + self.employeeTabLabel.text = @"邀请员工"; + self.employeeTabLabel.textAlignment = NSTextAlignmentCenter; + self.employeeTabLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + self.employeeTabLabel.textColor = UIColorHex(0x2EB8B2); + self.employeeTabLabel.userInteractionEnabled = YES; + [employeeBg addSubview:self.employeeTabLabel]; + [employeeBg addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapEmployeeTab)]]; + + UIView *expertBg = [[UIView alloc] initWithFrame:CGRectMake(2 + tabW, 2, tabW, tabH)]; + expertBg.backgroundColor = UIColorHex(0xE8EBF2); + expertBg.layer.cornerRadius = 8; + expertBg.layer.masksToBounds = YES; + expertBg.tag = 201; + [self.tabBgView addSubview:expertBg]; + + self.expertTabLabel = [[UILabel alloc] initWithFrame:expertBg.bounds]; + self.expertTabLabel.text = @"邀请专家"; + self.expertTabLabel.textAlignment = NSTextAlignmentCenter; + self.expertTabLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular]; + self.expertTabLabel.textColor = UIColorHex(0x808080); + self.expertTabLabel.userInteractionEnabled = YES; + [expertBg addSubview:self.expertTabLabel]; + [expertBg addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapExpertTab)]]; + + // 头部分割线 + UIView *headerLine = [[UIView alloc] initWithFrame:CGRectMake(0, 93, kScreenWidth, 1)]; + headerLine.backgroundColor = UIColorHex(0xEAECF1); + [container addSubview:headerLine]; +} + +#pragma mark - 底部区域 + +- (void)createBottomView { + self.bottomView = [[UIView alloc] initWithFrame:CGRectZero]; + self.bottomView.backgroundColor = KWhiteColor; + [self.view addSubview:self.bottomView]; + + UIButton *confirmBtn = [[UIButton alloc] initWithFrame:CGRectMake(45, 8, kScreenWidth - 90, 44)]; + confirmBtn.backgroundColor = UIColorHex(0x2EB8B1); + confirmBtn.layer.cornerRadius = 12; + confirmBtn.layer.masksToBounds = YES; + [confirmBtn setTitle:@"确定" forState:UIControlStateNormal]; + [confirmBtn setTitleColor:UIColorHex(0xFFFFFF) forState:UIControlStateNormal]; + confirmBtn.titleLabel.font = [UIFont boldSystemFontOfSize:18]; + [confirmBtn addTarget:self action:@selector(didTapConfirm) forControlEvents:UIControlEventTouchUpInside]; + [self.bottomView addSubview:confirmBtn]; +} + +#pragma mark - 列表 + +- (void)createTableView { + self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + self.tableView.delegate = self; + self.tableView.dataSource = self; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + self.tableView.rowHeight = 70; + self.tableView.backgroundColor = CViewBgColor; + + LYEmptyView *emptyView = [LYEmptyView emptyViewWithImageStr:@"empty_placeholder" titleStr:@"暂无数据" detailStr:@""]; + emptyView.subViewMargin = 20.f; + emptyView.titleLabTextColor = CFontColor1; + emptyView.detailLabFont = [UIFont systemFontOfSize:17]; + self.tableView.ly_emptyView = emptyView; + + [self.view addSubview:self.tableView]; +} + +- (void)loadData { + [self showMBProgressHUDWithString:@"加载中..." autoHidden:NO]; + [self.dataArray removeAllObjects]; + [self.tableView reloadData]; + + NSMutableDictionary *params = [NSMutableDictionary dictionary]; + if (self.groupId.length > 0) { + [params setObject:self.groupId forKey:@"excludeSessionId"]; + } + NSString *keyword = self.searchField.text; + if (keyword.length > 0) { + [params setObject:keyword forKey:@"realname"]; + } + [params setObject:@(1) forKey:@"pageNo"]; + [params setObject:@(200) forKey:@"pageSize"]; + + NSString *tag = (self.currentTab == XJContactTabEmployee) ? @"SEARCH_EMPLOYEE" : @"SEARCH_EXPERT"; + XJDNetAPI *api = [[XJDNetAPI alloc] init:self tag:tag NeedToken:@""]; + + if (self.currentTab == XJContactTabEmployee) { + [api getSearchEmployee:params]; + } else { + [api getSearchExpert:params]; + } +} + +- (void)didTapSearch { + [self loadData]; +} + +- (void)didTapConfirm { + if (self.selectedIds.count == 0) { + [EasyTextView showErrorText:@"请先选择联系人"]; + return; + } + [self showMBProgressHUDWithString:@"邀请中..." autoHidden:NO]; + + NSMutableDictionary *params = [NSMutableDictionary dictionary]; + [params setObject:self.groupId forKey:@"groupId"]; + [params setObject:[self.selectedIds allObjects] forKey:@"memberList"]; + NSInteger memberType = (self.currentTab == XJContactTabEmployee) ? 1 : 0; + [params setObject:@(memberType) forKey:@"memberType"]; + + XJDNetAPI *api = [[XJDNetAPI alloc] init:self tag:@"ADDGROUPUSER" NeedToken:@""]; + [api postAddGroupUser:params]; +} + +#pragma mark - 切换 + +- (void)didTapEmployeeTab { + if (self.currentTab == XJContactTabEmployee) return; + self.currentTab = XJContactTabEmployee; + [self updateTabStyle]; + [self loadData]; +} + +- (void)didTapExpertTab { + if (self.currentTab == XJContactTabExpert) return; + self.currentTab = XJContactTabExpert; + [self updateTabStyle]; + [self loadData]; +} + +- (void)updateTabStyle { + UIView *employeeBg = [self.tabBgView viewWithTag:200]; + UIView *expertBg = [self.tabBgView viewWithTag:201]; + + if (self.currentTab == XJContactTabEmployee) { + employeeBg.backgroundColor = KWhiteColor; + self.employeeTabLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + self.employeeTabLabel.textColor = UIColorHex(0x2EB8B2); + expertBg.backgroundColor = UIColorHex(0xE8EBF2); + self.expertTabLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular]; + self.expertTabLabel.textColor = UIColorHex(0x808080); + } else { + expertBg.backgroundColor = KWhiteColor; + self.expertTabLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + self.expertTabLabel.textColor = UIColorHex(0x2EB8B2); + employeeBg.backgroundColor = UIColorHex(0xE8EBF2); + self.employeeTabLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular]; + self.employeeTabLabel.textColor = UIColorHex(0x808080); + } +} + +#pragma mark - UITableView + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.dataArray.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *cellId = @"SelectContactCell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + if (!cell) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.backgroundColor = KWhiteColor; + + UIImageView *avatar = [[UIImageView alloc] initWithFrame:CGRectMake(15, 12, 45, 45)]; + avatar.tag = 100; + avatar.layer.cornerRadius = 12; + avatar.layer.masksToBounds = YES; + [cell.contentView addSubview:avatar]; + + UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(72, 17, kScreenWidth - 72 - 51, 18)]; + nameLabel.tag = 101; + nameLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; + nameLabel.textColor = UIColorHex(0x000000); + [cell.contentView addSubview:nameLabel]; + + UILabel *deptLabel = [[UILabel alloc] initWithFrame:CGRectMake(72, 39, kScreenWidth - 72 - 51, 14)]; + deptLabel.tag = 102; + deptLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular]; + deptLabel.textColor = UIColorHex(0x808080); + [cell.contentView addSubview:deptLabel]; + + UIButton *checkBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - 36, (70 - 21) / 2, 21, 21)]; + checkBtn.tag = 103; + checkBtn.userInteractionEnabled = NO; + [cell.contentView addSubview:checkBtn]; + + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(72, 70 - 1, kScreenWidth - 72, 1)]; + line.tag = 104; + line.backgroundColor = UIColorHex(0xEAECF1); + [cell.contentView addSubview:line]; + } + + NSDictionary *contact = self.dataArray[indexPath.row]; + UIImageView *avatar = [cell.contentView viewWithTag:100]; + UILabel *nameLabel = [cell.contentView viewWithTag:101]; + UILabel *deptLabel = [cell.contentView viewWithTag:102]; + UIButton *checkBtn = [cell.contentView viewWithTag:103]; + + nameLabel.text = contact[@"realname"] ?: @""; + + if (self.currentTab == XJContactTabEmployee) { + deptLabel.text = [NSString stringWithFormat:@"%@-%@", contact[@"orgName"] ?: @"", contact[@"deptName"] ?: @""]; + } else { + deptLabel.text = contact[@"post_dictText"] ?: @""; + } + + NSString *avatarPath = contact[@"avatar"]; + if (avatarPath.length > 0) { + NSString *fullUrl = [avatarPath hasPrefix:@"http"] ? avatarPath : [NSString stringWithFormat:@"%@%@", ResourceAddress, avatarPath]; + [avatar sd_setImageWithURL:[NSURL URLWithString:fullUrl] placeholderImage:[UIImage imageNamed:@"heard_man"]]; + } else { + avatar.image = [UIImage imageNamed:@"heard_man"]; + } + + NSString *userId = contact[@"userId"] ?: @""; + BOOL selected = [self.selectedIds containsObject:userId]; + NSString *iconName = selected ? @"firstAid_checkbox_selected" : @"firstAid_checkbox_unselected"; + [checkBtn setImage:[UIImage imageNamed:iconName] forState:UIControlStateNormal]; + + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + + NSDictionary *contact = self.dataArray[indexPath.row]; + NSString *userId = contact[@"userId"] ?: @""; + if ([self.selectedIds containsObject:userId]) { + [self.selectedIds removeObject:userId]; + } else { + [self.selectedIds addObject:userId]; + } + [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone]; +} + +#pragma mark - Network + +- (void)Failed:(NSString *)message tag:(NSString *)tag { + [self hiddenAllMBProgressHUD]; + [EasyTextView showErrorText:message]; +} + +- (void)Sucess:(id)response tag:(NSString *)tag { + [self hiddenAllMBProgressHUD]; + if ([tag isEqualToString:@"SEARCH_EMPLOYEE"] || [tag isEqualToString:@"SEARCH_EXPERT"]) { + NSDictionary *dict = [response isKindOfClass:[NSDictionary class]] ? response : nil; + NSDictionary *result = dict[@"result"] ?: dict; + NSArray *records = result[@"records"]; + if ([records isKindOfClass:[NSArray class]]) { + [self.dataArray addObjectsFromArray:records]; + } + [self.tableView reloadData]; + } + if ([tag isEqualToString:@"ADDGROUPUSER"]) { + [EasyTextView showSuccessText:@"邀请成功"]; + NSArray *userIds = [self.selectedIds allObjects]; + if (userIds.count > 0) { + [[TUICallEngine createInstance] inviteUser:userIds params:nil succ:^(NSArray *userIdList) { + [[V2TIMManager sharedInstance] getUsersInfo:userIdList succ:^(NSArray *infoList) { + dispatch_async(dispatch_get_main_queue(), ^{ + id mgr = [[TUICallKit createInstance] valueForKey:@"callingViewManager"]; + id bgView = [mgr valueForKey:@"backgroundView"]; + for (V2TIMUserFullInfo *info in infoList) { + CallingUserModel *model = [TUICallingCommon covertUser:info]; + [TUICallingUserManager cacheUser:model]; + if (bgView && [bgView respondsToSelector:@selector(userAdd:)]) { + [bgView performSelector:@selector(userAdd:) withObject:model]; + } + } + }); + } fail:nil]; + } fail:nil]; + } + if (self.presentingViewController) { + [self dismissViewControllerAnimated:YES completion:nil]; + } else { + [self.navigationController popViewControllerAnimated:YES]; + } + } +} + +@end diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端 1.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端 1.png new file mode 100644 index 0000000..c53b9bc Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端 1.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端 2.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端 2.png new file mode 100644 index 0000000..c53b9bc Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端 2.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端.png new file mode 100644 index 0000000..c53b9bc Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/6、健康油我~专家端.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json index 6903cc1..ef42a33 100644 --- a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "图层 1@2x.png", + "filename" : "6、健康油我~专家端.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" @@ -13,7 +13,7 @@ "value" : "dark" } ], - "filename" : "图层 1@2x 1.png", + "filename" : "6、健康油我~专家端 1.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" @@ -25,7 +25,7 @@ "value" : "tinted" } ], - "filename" : "图层 1@2x 2.png", + "filename" : "6、健康油我~专家端 2.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x 1.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x 1.png deleted file mode 100644 index e99b952..0000000 Binary files a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x 1.png and /dev/null differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x 2.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x 2.png deleted file mode 100644 index e99b952..0000000 Binary files a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x 2.png and /dev/null differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x.png deleted file mode 100644 index e99b952..0000000 Binary files a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/AppIcon.appiconset/图层 1@2x.png and /dev/null differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/Contents.json new file mode 100644 index 0000000..db785aa --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "firstAid_checkbox_selected.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.imageset/Contents.json new file mode 100644 index 0000000..db785aa --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "firstAid_checkbox_selected.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.imageset/firstAid_checkbox_selected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.imageset/firstAid_checkbox_selected.png new file mode 100644 index 0000000..7af46ba Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.imageset/firstAid_checkbox_selected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.png new file mode 100644 index 0000000..7af46ba Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_selected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_unselected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_unselected.imageset/Contents.json new file mode 100644 index 0000000..02c7018 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_unselected.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "firstAid_checkbox_unselected.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_unselected.imageset/firstAid_checkbox_unselected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_unselected.imageset/firstAid_checkbox_unselected.png new file mode 100644 index 0000000..b187f7e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/firstAid_checkbox_unselected.imageset/firstAid_checkbox_unselected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_selected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_selected.imageset/Contents.json new file mode 100644 index 0000000..08cc431 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_selected.imageset/Contents.json @@ -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 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_selected.imageset/order_selected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_selected.imageset/order_selected.png new file mode 100644 index 0000000..41ce249 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_selected.imageset/order_selected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_unselected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_unselected.imageset/Contents.json new file mode 100644 index 0000000..73e4bdb --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_unselected.imageset/Contents.json @@ -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 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_unselected.imageset/order_unselected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_unselected.imageset/order_unselected.png new file mode 100644 index 0000000..7200ed5 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/order_unselected.imageset/order_unselected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_selected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_selected.imageset/Contents.json new file mode 100644 index 0000000..20fd5ec --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_selected.imageset/Contents.json @@ -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 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_selected.imageset/org_selected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_selected.imageset/org_selected.png new file mode 100644 index 0000000..21484fe Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_selected.imageset/org_selected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_unselected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_unselected.imageset/Contents.json new file mode 100644 index 0000000..6488e01 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_unselected.imageset/Contents.json @@ -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 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_unselected.imageset/org_unselected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_unselected.imageset/org_unselected.png new file mode 100644 index 0000000..fe267f9 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/org_unselected.imageset/org_unselected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_selected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_selected.imageset/Contents.json new file mode 100644 index 0000000..119b331 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_selected.imageset/Contents.json @@ -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 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_selected.imageset/time_selected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_selected.imageset/time_selected.png new file mode 100644 index 0000000..16ccab7 Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_selected.imageset/time_selected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_unselected.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_unselected.imageset/Contents.json new file mode 100644 index 0000000..27b7eb1 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_unselected.imageset/Contents.json @@ -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 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_unselected.imageset/time_unselected.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_unselected.imageset/time_unselected.png new file mode 100644 index 0000000..ff57d1c Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/Image/time_unselected.imageset/time_unselected.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_sos_icon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_sos_icon.imageset/Contents.json new file mode 100644 index 0000000..b8652f3 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_sos_icon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "home_sos_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_sos_icon.imageset/home_sos_icon@2x.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_sos_icon.imageset/home_sos_icon@2x.png new file mode 100644 index 0000000..4f5197e Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/home_sos_icon.imageset/home_sos_icon@2x.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginCenterIcon.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginCenterIcon.imageset/Contents.json new file mode 100644 index 0000000..a379911 --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginCenterIcon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "login.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginCenterIcon.imageset/login.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginCenterIcon.imageset/login.png new file mode 100644 index 0000000..a92d0fd Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/loginCenterIcon.imageset/login.png differ diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/yuanxunhuan.imageset/Contents.json b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/yuanxunhuan.imageset/Contents.json new file mode 100644 index 0000000..f48fc4b --- /dev/null +++ b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/yuanxunhuan.imageset/Contents.json @@ -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 + } +} diff --git a/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/yuanxunhuan.imageset/yuanxunhuan-2.png b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/yuanxunhuan.imageset/yuanxunhuan-2.png new file mode 100644 index 0000000..a05c0af Binary files /dev/null and b/DoctorXinjiang/DoctorXinjiang/Supporting Files/Assets.xcassets/yuanxunhuan.imageset/yuanxunhuan-2.png differ diff --git a/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell 2.m b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell 2.m new file mode 100644 index 0000000..931261b --- /dev/null +++ b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell 2.m @@ -0,0 +1,65 @@ +// +// MapMessageCustomCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/7. +// + +#import "MapMessageCustomCell.h" + +@implementation MapMessageCustomCell + +- (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 +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + self.container.layer.cornerRadius = 10; + self.container.backgroundColor = UIColor.whiteColor; + self.myTextLabel = [[UILabel alloc] init]; + self.myTextLabel.textAlignment = NSTextAlignmentLeft; + self.myTextLabel.font = [UIFont systemFontOfSize:14]; + self.myTextLabel.backgroundColor = UIColor.whiteColor; + [self.container addSubview:self.myTextLabel]; + self.mapImage = [[UIImageView alloc] init]; + [self.container addSubview:self.mapImage]; + + + + } + return self; +} + +// 根据 cellData 绘制 cell +- (void)fillWithData:(MapMessageCustomCellData *)data; +{ + [super fillWithData:data]; + self.myTextLabel.text = @" 位置"; + [self.mapImage sd_setImageWithURL:[NSURL URLWithString:data.MapPictureImg] placeholderImage:nil]; + +} +// 设置控件坐标 +- (void)layoutSubviews +{ + [super layoutSubviews]; + + self.myTextLabel.mm_right(0).mm_top(0).mm_left(0).mm_height(30).mm_width(245); + self.mapImage.mm_top(self.myTextLabel.mm_y + 30 ).mm_width(245).mm_height(140); + + + +} +@end + + diff --git a/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell.h b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell.h new file mode 100644 index 0000000..52180fd --- /dev/null +++ b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell.h @@ -0,0 +1,24 @@ +// +// MapMessageCustomCell.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/7. +// + +#import "TUIMessageCell.h" +#import "MapMessageCustomCellData.h" +#import +#import +NS_ASSUME_NONNULL_BEGIN + +@interface MapMessageCustomCell : TUIBubbleMessageCell + +@property UILabel * myTextLabel; // 展示文本 +@property UIImageView * mapImage; // +@property MapMessageCustomCellData * cellData; +- (void)fillWithData:(MapMessageCustomCellData *)data; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell.m b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell.m new file mode 100644 index 0000000..931261b --- /dev/null +++ b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCell.m @@ -0,0 +1,65 @@ +// +// MapMessageCustomCell.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/7. +// + +#import "MapMessageCustomCell.h" + +@implementation MapMessageCustomCell + +- (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 +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + self.container.layer.cornerRadius = 10; + self.container.backgroundColor = UIColor.whiteColor; + self.myTextLabel = [[UILabel alloc] init]; + self.myTextLabel.textAlignment = NSTextAlignmentLeft; + self.myTextLabel.font = [UIFont systemFontOfSize:14]; + self.myTextLabel.backgroundColor = UIColor.whiteColor; + [self.container addSubview:self.myTextLabel]; + self.mapImage = [[UIImageView alloc] init]; + [self.container addSubview:self.mapImage]; + + + + } + return self; +} + +// 根据 cellData 绘制 cell +- (void)fillWithData:(MapMessageCustomCellData *)data; +{ + [super fillWithData:data]; + self.myTextLabel.text = @" 位置"; + [self.mapImage sd_setImageWithURL:[NSURL URLWithString:data.MapPictureImg] placeholderImage:nil]; + +} +// 设置控件坐标 +- (void)layoutSubviews +{ + [super layoutSubviews]; + + self.myTextLabel.mm_right(0).mm_top(0).mm_left(0).mm_height(30).mm_width(245); + self.mapImage.mm_top(self.myTextLabel.mm_y + 30 ).mm_width(245).mm_height(140); + + + +} +@end + + diff --git a/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData 2.h b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData 2.h new file mode 100644 index 0000000..9847ea6 --- /dev/null +++ b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData 2.h @@ -0,0 +1,21 @@ +// +// MapMessageCustomCellData.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/7. +// + +#import "TUIMessageCellData.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MapMessageCustomCellData : TUIBubbleMessageCellData + +@property (nonatomic, copy) NSString *text; +@property (nonatomic, copy) NSString * MapPictureImg; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData 2.m b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData 2.m new file mode 100644 index 0000000..2cbf3a9 --- /dev/null +++ b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData 2.m @@ -0,0 +1,80 @@ +// +// MapMessageCustomCellData.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/7. +// + +#import "MapMessageCustomCellData.h" +#import "MapMessageCustomCell.h" +#import + +@implementation MapMessageCustomCellData + ++ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ +// NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.locationElem.desc options:NSJSONReadingAllowFragments error:nil]; + MapMessageCustomCellData *cellData = [[MapMessageCustomCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.text = message.locationElem.desc; + cellData.MapPictureImg = [self mapLocationImage:message.locationElem.longitude Withlation:message.locationElem.latitude]; + cellData.reuseId = @"MapMessageCustomCell"; + cellData.showAvatar = true; +// cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + return cellData; +} + + ++ (NSString *)mapLocationImage:(CGFloat)longLation Withlation:(CGFloat)lation { + // 0: self.longLation,self.lation + NSString * staciUrl = @"https://restapi.amap.com/v3/staticmap?key=9e4aac9a04b8296e9039adce3b472f28"; + NSString * mapKey = @"9e4aac9a04b8296e9039adce3b472f28"; + NSString * loctaionUrl = @"https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png"; + + NSString * needMdString = [NSString stringWithFormat:@"key=%@&location=%f,%f&markers=-1,%@,0:%f,%f&size=700*500&zoom=154985aa1abb49ce2daa20d032a374eb58",mapKey,longLation,lation,loctaionUrl,longLation,lation]; + + + NSString * mapUrl = [NSString stringWithFormat:@"%@&location=%f,%f&markers=-1,%@,0:%f,%f&size=700*500&zoom=15&sig=%@",staciUrl,longLation,lation,loctaionUrl,longLation,lation,[self md5:needMdString]]; + + return mapUrl; + + + +} +//md加密 ++ (NSString *)md5:(NSString *)str +{ + const char *cStr = [str UTF8String]; + unsigned char result[16]; + CC_MD5(cStr, strlen(cStr), result); // This is the md5 call + return [NSString stringWithFormat: + @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + result[0], result[1], result[2], result[3], + result[4], result[5], result[6], result[7], + result[8], result[9], result[10], result[11], + result[12], result[13], result[14], result[15] + ]; +} + + + +- (CGSize)contentSize +{ +// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; +// CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); +// // 加上气泡边距 +// size.height += 60; +// size.width += 20; +// return size; + + + CGFloat textMaxWidth = 245.f; + + CGSize size = CGSizeMake(textMaxWidth, 170); + return size; +} + + + + +@end diff --git a/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData.h b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData.h new file mode 100644 index 0000000..9847ea6 --- /dev/null +++ b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData.h @@ -0,0 +1,21 @@ +// +// MapMessageCustomCellData.h +// EscortProject +// +// Created by 仁康信息 on 2023/7/7. +// + +#import "TUIMessageCellData.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MapMessageCustomCellData : TUIBubbleMessageCellData + +@property (nonatomic, copy) NSString *text; +@property (nonatomic, copy) NSString * MapPictureImg; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData.m b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData.m new file mode 100644 index 0000000..2cbf3a9 --- /dev/null +++ b/DoctorXinjiang/Pods/TUIChat/MapMessageCustomCellData.m @@ -0,0 +1,80 @@ +// +// MapMessageCustomCellData.m +// EscortProject +// +// Created by 仁康信息 on 2023/7/7. +// + +#import "MapMessageCustomCellData.h" +#import "MapMessageCustomCell.h" +#import + +@implementation MapMessageCustomCellData + ++ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ +// NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.locationElem.desc options:NSJSONReadingAllowFragments error:nil]; + MapMessageCustomCellData *cellData = [[MapMessageCustomCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; + cellData.innerMessage = message; + cellData.msgID = message.msgID; + cellData.text = message.locationElem.desc; + cellData.MapPictureImg = [self mapLocationImage:message.locationElem.longitude Withlation:message.locationElem.latitude]; + cellData.reuseId = @"MapMessageCustomCell"; + cellData.showAvatar = true; +// cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; + return cellData; +} + + ++ (NSString *)mapLocationImage:(CGFloat)longLation Withlation:(CGFloat)lation { + // 0: self.longLation,self.lation + NSString * staciUrl = @"https://restapi.amap.com/v3/staticmap?key=9e4aac9a04b8296e9039adce3b472f28"; + NSString * mapKey = @"9e4aac9a04b8296e9039adce3b472f28"; + NSString * loctaionUrl = @"https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png"; + + NSString * needMdString = [NSString stringWithFormat:@"key=%@&location=%f,%f&markers=-1,%@,0:%f,%f&size=700*500&zoom=154985aa1abb49ce2daa20d032a374eb58",mapKey,longLation,lation,loctaionUrl,longLation,lation]; + + + NSString * mapUrl = [NSString stringWithFormat:@"%@&location=%f,%f&markers=-1,%@,0:%f,%f&size=700*500&zoom=15&sig=%@",staciUrl,longLation,lation,loctaionUrl,longLation,lation,[self md5:needMdString]]; + + return mapUrl; + + + +} +//md加密 ++ (NSString *)md5:(NSString *)str +{ + const char *cStr = [str UTF8String]; + unsigned char result[16]; + CC_MD5(cStr, strlen(cStr), result); // This is the md5 call + return [NSString stringWithFormat: + @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + result[0], result[1], result[2], result[3], + result[4], result[5], result[6], result[7], + result[8], result[9], result[10], result[11], + result[12], result[13], result[14], result[15] + ]; +} + + + +- (CGSize)contentSize +{ +// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; +// CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); +// // 加上气泡边距 +// size.height += 60; +// size.width += 20; +// return size; + + + CGFloat textMaxWidth = 245.f; + + CGSize size = CGSizeMake(textMaxWidth, 170); + return size; +} + + + + +@end