|
9 | 9 | #import "TIoTShareDevicesVC.h" |
10 | 10 | #import "TIoTEquipmentTableViewCell.h" |
11 | 11 | #import "TIoTPanelVC.h" |
| 12 | +#import "TIoTWebVC.h" |
| 13 | +#import "TIoTAppEnvironment.h" |
12 | 14 |
|
13 | 15 | @interface TIoTShareDevicesVC ()<UITableViewDelegate,UITableViewDataSource> |
14 | 16 | @property (weak, nonatomic) IBOutlet UITableView *tableView; |
@@ -85,12 +87,78 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath |
85 | 87 | [HXYNotice addActivePushPost:devIds]; |
86 | 88 | } |
87 | 89 |
|
88 | | - TIoTPanelVC *vc = [[TIoTPanelVC alloc] init]; |
89 | | - vc.title = [NSString stringWithFormat:@"%@",self.dataArr[indexPath.row][@"AliasName"]]; |
90 | | - vc.productId = self.dataArr[indexPath.row][@"ProductId"]; |
91 | | - vc.deviceName = [NSString stringWithFormat:@"%@",self.dataArr[indexPath.row][@"DeviceName"]]; |
92 | | - vc.deviceDic = [self.dataArr[indexPath.row] mutableCopy]; |
93 | | - [self.navigationController pushViewController:vc animated:YES]; |
| 90 | +// TIoTPanelVC *vc = [[TIoTPanelVC alloc] init]; |
| 91 | +// vc.title = [NSString stringWithFormat:@"%@",self.dataArr[indexPath.row][@"AliasName"]]; |
| 92 | +// vc.productId = self.dataArr[indexPath.row][@"ProductId"]; |
| 93 | +// vc.deviceName = [NSString stringWithFormat:@"%@",self.dataArr[indexPath.row][@"DeviceName"]]; |
| 94 | +// vc.deviceDic = [self.dataArr[indexPath.row] mutableCopy]; |
| 95 | +// [self.navigationController pushViewController:vc animated:YES]; |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + NSString *productIDString = self.dataArr[indexPath.row][@"ProductId"] ?:@""; |
| 100 | + |
| 101 | + [[TIoTRequestObject shared] post:AppGetProductsConfig Param:@{@"ProductIds":@[productIDString]} success:^(id responseObject) { |
| 102 | + NSArray *data = responseObject[@"Data"]; |
| 103 | + if (data.count > 0) { |
| 104 | + NSDictionary *config = [NSString jsonToObject:data[0][@"Config"]]; |
| 105 | + |
| 106 | + TIoTProductConfigModel *configModel = [TIoTProductConfigModel yy_modelWithJSON:config]; |
| 107 | + if ([configModel.Panel.type isEqualToString:@"h5"]) { |
| 108 | + |
| 109 | + //h5自定义面板 |
| 110 | + NSDictionary *deviceDic = [self.dataArr[indexPath.row] copy]; |
| 111 | + NSString *deviceID = deviceDic[@"DeviceId"]; |
| 112 | + NSString *familyId = [TIoTCoreUserManage shared].familyId; |
| 113 | + NSString *roomID = [TIoTCoreUserManage shared].currentRoomId ? : @"0"; |
| 114 | + NSString *familyType = [NSString stringWithFormat:@"%ld",(long)[TIoTCoreUserManage shared].FamilyType]; |
| 115 | + |
| 116 | + __weak typeof(self) weadkSelf= self; |
| 117 | + |
| 118 | + [MBProgressHUD showLodingNoneEnabledInView:[UIApplication sharedApplication].keyWindow withMessage:@""]; |
| 119 | + [[TIoTRequestObject shared] post:AppGetTokenTicket Param:@{} success:^(id responseObject) { |
| 120 | + |
| 121 | + WCLog(@"AppGetTokenTicket responseObject%@", responseObject); |
| 122 | + NSString *ticket = responseObject[@"TokenTicket"]?:@""; |
| 123 | + NSString *requestID = responseObject[@"RequestId"]?:@""; |
| 124 | + NSString *platform = @"iOS"; |
| 125 | + TIoTWebVC *vc = [TIoTWebVC new]; |
| 126 | + NSString *bundleId = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; |
| 127 | + NSString *url = [NSString stringWithFormat:@"%@/?deviceId=%@&familyId=%@&appID=%@&roomId=%@&familyType=%@&lid=%@&quid=%@&platform=%@®ionId=%@&ticket=%@&uin=%@", [TIoTCoreAppEnvironment shareEnvironment].deviceDetailH5URL,deviceID,familyId,bundleId,roomID,familyType,requestID,requestID,platform,[TIoTCoreUserManage shared].userRegionId,ticket,TIoTAPPConfig.GlobalDebugUin]; |
| 128 | + if (deviceDic[@"FromUserID"]) { |
| 129 | + NSString *fromUserID = deviceDic[@"FromUserID"]; |
| 130 | + url = [NSString stringWithFormat:@"%@/?deviceId=%@&familyId=%@&isShareDevice=%@&appID=%@&roomId=%@&familyType=%@&lid=%@&quid=%@&platform=%@®ionId=%@&ticket=%@&uin=%@", [TIoTCoreAppEnvironment shareEnvironment].deviceDetailH5URL,deviceID,familyId,fromUserID,bundleId,roomID,familyType,requestID,requestID,platform,[TIoTCoreUserManage shared].userRegionId,ticket,TIoTAPPConfig.GlobalDebugUin];; |
| 131 | + } |
| 132 | + |
| 133 | + vc.urlPath = url; |
| 134 | + vc.needJudgeJump = YES; |
| 135 | + vc.needRefresh = YES; |
| 136 | + vc.deviceDic = [self.dataArr[indexPath.row] mutableCopy]; |
| 137 | + [weadkSelf.navigationController pushViewController:vc animated:YES]; |
| 138 | + [MBProgressHUD dismissInView:weadkSelf.view]; |
| 139 | + |
| 140 | + } failure:^(NSString *reason, NSError *error,NSDictionary *dic) { |
| 141 | + [MBProgressHUD dismissInView:weadkSelf.view]; |
| 142 | + }]; |
| 143 | + |
| 144 | + }else { |
| 145 | + |
| 146 | + //标准面板 |
| 147 | + TIoTPanelVC *vc = [[TIoTPanelVC alloc] init]; |
| 148 | + vc.title = [NSString stringWithFormat:@"%@",self.dataArr[indexPath.row][@"AliasName"]]; |
| 149 | + vc.productId = self.dataArr[indexPath.row][@"ProductId"]; |
| 150 | + vc.deviceName = [NSString stringWithFormat:@"%@",self.dataArr[indexPath.row][@"DeviceName"]]; |
| 151 | + vc.deviceDic = [self.dataArr[indexPath.row] mutableCopy]; |
| 152 | +// vc.isOwner = [self.currentFamilyRole integerValue] == 1; |
| 153 | + vc.configData = config; |
| 154 | + [self.navigationController pushViewController:vc animated:YES]; |
| 155 | + } |
| 156 | + |
| 157 | + |
| 158 | + } |
| 159 | + } failure:^(NSString *reason, NSError *error,NSDictionary *dic) { |
| 160 | + |
| 161 | + }]; |
94 | 162 |
|
95 | 163 | } |
96 | 164 |
|
|
0 commit comments