OrbitVC.m 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // OrbitVC.m
  3. // jiaPeiC
  4. //
  5. // Created by apple on 16/9/12.
  6. // Copyright © 2016年 JCZ. All rights reserved.
  7. //
  8. #import "OrbitVC.h"
  9. #import <WebKit/WebKit.h>
  10. @implementation OrbitVC
  11. - (void)viewDidLoad {
  12. [super viewDidLoad];
  13. self.title = @"轨迹回放";
  14. self.view.backgroundColor = backGroundColor;
  15. [self configNavBar];
  16. [self getStudentTrack];
  17. }
  18. - (void)didReceiveMemoryWarning {
  19. [super didReceiveMemoryWarning];
  20. }
  21. -(void)creatWebViewWithUrlStr:(NSString *)urlStr
  22. {
  23. WKWebView *view = [[WKWebView alloc] initWithFrame:kFrame];
  24. view.y += kNavOffSet;
  25. view.height = kSize.height - kNavOffSet;
  26. [self.view addSubview: view];
  27. NSURLRequest *request = nil;
  28. request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@api/orderTrack?classId=%@&stuOutId=%@",urlStr,_classId,_stuOutId]]];
  29. // NSLog(@"%@",request);
  30. if (![Util connectedToNetWork]) {
  31. showMsgUnconnect();
  32. return;
  33. }
  34. [LoadingView showHUD];
  35. [view loadRequest:request];
  36. }
  37. - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
  38. RemoveHUD();
  39. }
  40. - (void)getStudentTrack {
  41. [LoadingView showHUD];
  42. if (![Util connectedToNetWork]) {
  43. showMsgUnconnect();
  44. return;
  45. }
  46. NSMutableArray *arr=[NSMutableArray array];
  47. [arr addPro:@"dqbh" Value:defUser.userDict[@"cityId"]];
  48. NSString* method = @"getStudentTrack";
  49. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) {
  50. RemoveHUD();
  51. if (!root) {
  52. ShowMsgFailed();
  53. return;
  54. }
  55. if ([root[@"code"] isEqualToString:@"1"]) {
  56. ShowMsg(root[@"body"]);
  57. return;
  58. }
  59. NSString * str = root[@"body"];
  60. [self creatWebViewWithUrlStr:str];
  61. }];
  62. }
  63. @end