Skip to content

Commit bab4378

Browse files
ccharlesrenoldcodefarmer
authored andcommitted
添加分享设备h5自定义面板显示
Change-Id: Id900df86c3ab6117faed03ced747e3c49416bdb2
1 parent 3b1535d commit bab4378

File tree

1 file changed

+74
-6
lines changed

1 file changed

+74
-6
lines changed

Source/LinkApp/Classes/Module/Mine/Controller/TIoTShareDevicesVC.m

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#import "TIoTShareDevicesVC.h"
1010
#import "TIoTEquipmentTableViewCell.h"
1111
#import "TIoTPanelVC.h"
12+
#import "TIoTWebVC.h"
13+
#import "TIoTAppEnvironment.h"
1214

1315
@interface TIoTShareDevicesVC ()<UITableViewDelegate,UITableViewDataSource>
1416
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@@ -85,12 +87,78 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
8587
[HXYNotice addActivePushPost:devIds];
8688
}
8789

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=%@&regionId=%@&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=%@&regionId=%@&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+
}];
94162

95163
}
96164

0 commit comments

Comments
 (0)