HmV1.m 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055
  1. //
  2. // HmV1.m
  3. // jiaPei
  4. //
  5. // Created by apple on 15/11/13.
  6. // Copyright (c) 2015年 JCZ. All rights reserved.
  7. //
  8. #import "HmV1.h"
  9. #import "AdvertisingColumn.h"
  10. #import "STButton.h"
  11. #import "ExamVC.h"
  12. #import "StatisVC.h"
  13. #import "ScoreRankVC.h"
  14. #import "TRListVC.h"
  15. #import "TRDetailVC.h"
  16. #import "StrongVC.h"
  17. #import "VowBar.h"
  18. #import "TopicesVC.h"
  19. #import "ADView.h"
  20. #import "ExerciseVC.h"
  21. #import "ListVC.h"
  22. #import "ExamVC.h"
  23. #import "StatisVC.h"
  24. #import "MyGradeVC.h"
  25. #import "RQMultiButtons.h"
  26. #import "RQWebViewViewController.h"
  27. //#import "VipLessonViewController.h"
  28. #import "OliveappLivenessDetectionViewController.h"
  29. #import "OliveappCameraPreviewController.h"
  30. #import "OliveappDetectedFrame.h"
  31. #import "OliveappBase64Helper.h"
  32. @interface HmV1 ()<UIAlertViewDelegate, RQMultiButtonsDelegate, OliveappLivenessResultDelegate, FaceDetectorsDelegate>
  33. @property (nonatomic, readwrite, strong) RQMultiButtons *multibuttons;
  34. @end
  35. @implementation HmV1
  36. {
  37. /**错题数标签
  38. */
  39. UILabel *faultLbl;
  40. AdvertisingColumn *adView;
  41. VowBar *vowItem;//许愿UI
  42. //视频
  43. UIView *videoCoverView;
  44. UIView *videoView;
  45. UIButton *getVideoBtn;
  46. NSArray *videoArray;
  47. CLLocationCoordinate2D myLocation;
  48. }
  49. - (void)viewDidLoad {
  50. [super viewDidLoad];
  51. [self myInit];
  52. }
  53. -(void)viewWillAppear:(BOOL)animated{
  54. [super viewWillAppear:animated];
  55. [self getFaultCntNew];
  56. }
  57. - (void)didReceiveMemoryWarning
  58. {
  59. [super didReceiveMemoryWarning];
  60. }
  61. -(void)myInit
  62. {
  63. self.view.height = self.viewH;
  64. [self.view setBackgroundColor:[UIColor whiteColor]];
  65. [self configNavigationBar];
  66. scroll = self.zzScrollV;
  67. [self.view addSubview:scroll];
  68. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateAD:) name:@"updateAD" object:nil];
  69. adView = [[AdvertisingColumn alloc]initWithFrame:CGRectMake(0, 0, kSize.width, kSize.width*9/32.0)];
  70. //广告
  71. NSMutableArray *newAD = [NSMutableArray array];
  72. if (_subject == 1){
  73. for (NSDictionary *dic in myDelegate.adArray) {
  74. if ([dic[@"LOCATION"] isEqualToString:@"3"]) {
  75. [newAD addObject:dic];
  76. }
  77. }
  78. }else{
  79. for (NSDictionary *dic in myDelegate.adArray) {
  80. if ([dic[@"LOCATION"] isEqualToString:@"6"]) {
  81. [newAD addObject:dic];
  82. }
  83. }
  84. }
  85. [adView setImgArray:newAD];
  86. adView.supVC = self;
  87. [scroll addSubview:adView];
  88. CGFloat btn_w = kSize.width/3;
  89. CGFloat btn_H = btn_w*2/3;
  90. NSMutableArray* btnArr = [NSMutableArray array];
  91. STButton* btn;
  92. {
  93. UIView* line0 = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(adView.frame)+btn_H, kSize.width, 1)];
  94. [line0 setBackgroundColor:KlineColor];
  95. [scroll addSubview:line0];
  96. line0 = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(line0.frame)+btn_H, kSize.width, 10)];
  97. [line0 setBackgroundColor:KlineColor];
  98. [scroll addSubview:line0];
  99. line0 = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(line0.frame)+btn_H, kSize.width, 1)];
  100. [line0 setBackgroundColor:KlineColor];
  101. [scroll addSubview:line0];
  102. line0 = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(line0.frame)+btn_H, kSize.width, 10)];
  103. [line0 setBackgroundColor:KlineColor];
  104. [scroll addSubview:line0];
  105. }
  106. btn= [[STButton alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(adView.frame), btn_w, btn_H)];
  107. [btnArr addObject:btn];
  108. btn = [[STButton alloc] initWithFrame:CGRectMake(btn_w*2, CGRectGetMaxY(adView.frame), btn_w, btn_H)];
  109. [btnArr addObject:btn];
  110. btn = [[STButton alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(btn.frame)+1, btn_w, btn_H)];
  111. [btnArr addObject:btn];
  112. btn = [[STButton alloc] initWithFrame:CGRectMake(btn_w*2, btn.frame.origin.y, btn_w, btn_H)];
  113. [btnArr addObject:btn];
  114. //middle1
  115. CGPoint center = CGPointMake(kSize.width/2, btn_H+1/2+CGRectGetMaxY(adView.frame));
  116. btn = [[STButton alloc] initWithFrame:CGRectMake(0, 0, btn_w, btn_w)];
  117. btn.center = center;
  118. btn.clipsToBounds = YES;
  119. btn.layer.cornerRadius = btn_w/2;
  120. [btnArr addObject:btn];
  121. UIImageView* iv = [[UIImageView alloc] initWithFrame:btn.frame];
  122. CGPoint center2 = CGPointMake(iv.width/2, iv.height/2+btn_w/2*0.3);
  123. UILabel* lblx = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, btn_w, btn_w/2)];
  124. lblx.center = center2;
  125. [RACObserve(defUser, car_type) subscribeNext:^(id _Nullable x) {
  126. [iv setImage:[UIImage imageNamed:RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN? @"exCircle.png" : ([defUser.car_type isEqualToString:@"2"]? @"examCircle.png" : @"exCircle.png")]];
  127. [lblx setText:RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN? @"练习/考试" : ([defUser.car_type isEqualToString:@"2"]? @"结业考核" : @"练习/考试")];
  128. }];
  129. [lblx setFont:[UIFont scaleSize:NormalFont]];
  130. [lblx setTextAlignment:NSTextAlignmentCenter];
  131. [iv addSubview:lblx];
  132. [scroll addSubview:iv];
  133. UIButton *bjmsBtn = btnArr[btnArr.count-2];
  134. btn= [[STButton alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(bjmsBtn.frame) + 10, btn_w, btn_H)];
  135. [btnArr addObject:btn];
  136. btn = [[STButton alloc] initWithFrame:CGRectMake(btn_w*2, btn.y, btn_w, btn_H)];
  137. [btnArr addObject:btn];
  138. btn = [[STButton alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(btn.frame) + 1, btn_w, btn_H)];
  139. [btnArr addObject:btn];
  140. btn = [[STButton alloc] initWithFrame:CGRectMake(btn_w*2, btn.y, btn_w, btn_H)];
  141. [btnArr addObject:btn];
  142. //middle2
  143. CGPoint center3 = CGPointMake(kSize.width/2, btn.y-1/2);
  144. btn = [[STButton alloc] initWithFrame:CGRectMake(0, 0, btn_w, btn_w)];
  145. btn.center = center3;
  146. btn.clipsToBounds = YES;
  147. btn.layer.cornerRadius = btn_w/2;
  148. [btnArr addObject:btn];
  149. iv = [[UIImageView alloc] initWithFrame:btn.frame];
  150. [iv setImage:[UIImage imageNamed:@"远程教育.png"]];
  151. CGPoint center4 = CGPointMake(iv.width/2, iv.height/2+btn_w/2*0.3);
  152. lblx = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, btn_w, btn_w/2)];
  153. lblx.center = center4;
  154. [lblx setText:@"远程教育"];
  155. [lblx setFont:[UIFont scaleSize:NormalFont]];
  156. [lblx setTextAlignment:NSTextAlignmentCenter];
  157. [iv addSubview:lblx];
  158. [scroll addSubview:iv];
  159. UIButton *qhlxBtn = btnArr[btnArr.count-2];
  160. CGFloat fiveBtn_Y = CGRectGetMaxY(qhlxBtn.frame) +10;
  161. btn_w = kSize.width/5;
  162. btn_H = 80;
  163. for (int i=0; i<5; i++) {
  164. btn= [[STButton alloc] initWithFrame:CGRectMake(btn_w*i, fiveBtn_Y, btn_w, btn_H)];
  165. [btnArr addObject:btn];
  166. }
  167. CGFloat lblW = 25;
  168. faultLbl = [[UILabel alloc] initWithFrame:CGRectMake(btn_w/2, lblW/2*1/10, lblW + 5, lblW/2)];
  169. [faultLbl setTextAlignment:NSTextAlignmentCenter];
  170. [faultLbl setTextColor:[UIColor whiteColor]];
  171. [faultLbl.layer setCornerRadius:6];
  172. [faultLbl setFont:[UIFont scaleSize:10]];
  173. [faultLbl.layer setMasksToBounds:YES];
  174. //错题按钮的tag和index是13,
  175. [btnArr[13] addSubview:faultLbl];
  176. @weakify(btn);
  177. [RACObserve(defUser, car_type) subscribeNext:^(id _Nullable x) {
  178. @strongify(btn);
  179. NSArray* titles = RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN? @[ @"随机练习",@"章节练习",@"背题模式",@"排除的题",@"",
  180. @"我的成绩",@"练习统计",@"强化练习",@"排行榜 ",@"",
  181. @"交通法规",@"考试技巧",@"未做题",@"我的错题",@"我的收藏"] :
  182. @[[defUser.car_type isEqualToString:@"2"]? @"随机/顺序" : @"随机练习",@"章节练习",@"背题模式",@"排除的题",@"",
  183. @"我的成绩",@"练习统计",@"强化练习",@"排行榜 ",@"",
  184. @"交通法规",@"考试技巧",@"未做题",@"我的错题",@"我的收藏"];
  185. NSArray* images = @[@"subject1_random_excercise_icon.png",
  186. @"menu_new_normal_ico_f.png",
  187. @"subject4_title_press.png",
  188. @"subject1_remove_excercise_icon.png",
  189. @"NULL.png",@"subject1_simulate_result_icon.png",
  190. @"subject1_statistical_excercise_icon.png",
  191. @"subject1_special_excercise_icon.png",
  192. @"subject1_rating_board_icon.png",
  193. @"NULL.png",
  194. @"drawer_img06.png",@"drawer_img04.png",
  195. @"question_undo_icon.png"/*未做题*/,
  196. @"question_add_error_press_icon.png",
  197. @"favoritestar_checked_icon",
  198. @"",@""];
  199. for (int i =0; i<btnArr.count; i++) {
  200. btn = btnArr[i];
  201. [btn setImage:[UIImage imageNamed:images[i]] withTitle:titles[i] Font:NormalFont forState:UIControlStateNormal];
  202. [btn setTag:i];
  203. [scroll addSubview:btn];
  204. [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  205. }
  206. }];
  207. //远程视频
  208. videoCoverView = [[UIView alloc] initWithFrame:CGRectMake(0, [[scroll subviews] lastObject].bottom + 10, kFrame.size.width, 70)];
  209. videoCoverView.backgroundColor = [UIColor whiteColor];
  210. [scroll addSubview:videoCoverView];
  211. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, kSize.width - 20, 30)];
  212. [label setText:@"教学视频" Font:FontTitle TextColor:kTitleColor];
  213. [videoCoverView addSubview:label];
  214. [label addViewWithRect:CGRectMake(10, 29.5, kSize.width - 20, .5)];
  215. getVideoBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, 30, kSize.width - 20, 40)];
  216. [getVideoBtn setTitle:@"正在获取视频教学资源,请稍后..." textColor:subTitleColor font:Font17 fotState:UIControlStateNormal];
  217. // getVideoBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  218. [getVideoBtn addTarget:self action:@selector(getVideos) forControlEvents:UIControlEventTouchUpInside];
  219. [videoCoverView addSubview:getVideoBtn];
  220. getVideoBtn.userInteractionEnabled = NO;
  221. // label = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, kSize.width - 20, 40)];
  222. // [label setText:@"正在获取视频教学资源,请稍后..." Font:Font17 TextColor:subTitleColor Alignment:NSTextAlignmentCenter];
  223. // label.tag = 1;
  224. // [videoCoverView addSubview:label];
  225. [videoCoverView addViewWithRect:CGRectMake(0, videoCoverView.y - 10, kSize.width, 10) Color:KlineColor];
  226. [videoCoverView addViewWithRect:CGRectMake(0, videoCoverView.y + videoCoverView.height, kSize.width, 10) Color:KlineColor];
  227. //加一项许愿
  228. if (_subject == 1)
  229. {
  230. vowItem = [[VowBar alloc] initWithFrame:CGRectMake(0, [[scroll subviews] lastObject].bottom + 20, kFrame.size.width, VAWBAR_H) title:@"科目一"];
  231. }else {
  232. vowItem = [[VowBar alloc] initWithFrame:CGRectMake(0, [[scroll subviews] lastObject].bottom + 10, kFrame.size.width, VAWBAR_H) title:@"科目四"];
  233. }
  234. vowItem.countLabel.text = @"点击参与讨论>>";
  235. [vowItem.topicBtn addTarget:self action:@selector(vowClick:) forControlEvents:UIControlEventTouchUpInside];
  236. vowItem.topicBtn.tag = 11;
  237. [vowItem.vomBtn addTarget:self action:@selector(vowClick:) forControlEvents:UIControlEventTouchUpInside];
  238. vowItem.vomBtn.tag = 12;
  239. // [scroll addSubview:vowItem];
  240. [scroll setContentSize:CGSizeMake(0, CGRectGetMaxY(vowItem.frame) + SCRV_BottomH)];
  241. [self getVideos];
  242. }
  243. - (void)updateAD:(NSNotification *)notifica
  244. {
  245. NSMutableArray *newAD = [NSMutableArray array];
  246. if (_subject == 1){
  247. for (NSDictionary *dic in myDelegate.adArray) {
  248. if ([dic[@"LOCATION"] isEqualToString:@"3"]) {
  249. [newAD addObject:dic];
  250. }
  251. }
  252. }else{
  253. for (NSDictionary *dic in myDelegate.adArray) {
  254. if ([dic[@"LOCATION"] isEqualToString:@"6"]) {
  255. [newAD addObject:dic];
  256. }
  257. }
  258. }
  259. [adView setImgArray:newAD];
  260. [[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateAD" object:nil];
  261. }
  262. -(void)vowClick:(UIButton *)btn
  263. {
  264. TopicesVC* vc = [[TopicesVC alloc] init];
  265. vc.type = @"1";
  266. if (btn.tag == 11)
  267. {
  268. if (_subject == 1)
  269. {
  270. vc.groupId = @"4";
  271. }
  272. else
  273. {
  274. vc.groupId = @"7";
  275. }
  276. }
  277. else
  278. {
  279. vc.groupId = @"9";
  280. }
  281. [self navPushHideTabbarToVC:vc];
  282. }
  283. -(void)btnClick:(STButton*)sender
  284. {
  285. int tag = (int)sender.tag;
  286. if (10 == tag) {
  287. TRListVC* vc = [[TRListVC alloc] init];
  288. NSArray* arr = @[@"2016《机动车驾驶证申领和使用规定》",
  289. @"中华人民共和国道路交通安全法",
  290. @"道路交通安全违法行为处理程序规定",
  291. @"道路交通事故处理程序规定",
  292. @"酒驾新规"];
  293. [vc setModels:arr];
  294. [vc setTitle:@"交通法规"];
  295. [self navPushHideTabbarToVC:vc];
  296. }
  297. if (11 == tag) {
  298. TRListVC* vc = [[TRListVC alloc] init];
  299. NSArray* arr = @[@"科目一考试技巧记忆口诀",
  300. @"科目一考试应试必备技巧",
  301. @"科目一到科目四,超牛的驾考经验技巧,科科必过!",
  302. @"理论考试知识汇总",
  303. @"【科目一】交规巧记十三条!",
  304. @"3分钟,快速掌握考试车内提示灯如何操作",
  305. @"日期类题目最头痛,来看看我们总结的快速学习方法!",
  306. @"帮您快速巧记交规秘诀,看完想不过都难!",
  307. @"交规理论考试十大“给力”攻略"];
  308. [vc setModels:arr];
  309. [vc setTitle:@"考试技巧"];
  310. [self navPushHideTabbarToVC:vc];
  311. }
  312. switch (sender.tag) {
  313. case 0:{//随机练习
  314. if (RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN) {
  315. [myDelegate setType:@"2"];
  316. [self gotoExerVC];
  317. } else {
  318. if ([defUser.car_type isEqualToString:@"2"]) {
  319. if (_multibuttons) {
  320. _multibuttons = nil;
  321. }
  322. STButton *btn = [self.view viewWithTag:4];
  323. _multibuttons = [[ RQMultiButtons alloc] initWithPoint:btn.center radius:140 inView:self.view];
  324. _multibuttons.bubbleRadius = 40;
  325. _multibuttons.delegate = self;
  326. [_multibuttons addCustomButtonWithIcon:[UIImage imageNamed:@"subject1_random_excercise_icon.png"] title:@"随机练习"
  327. backgroundColor:UIColor.whiteColor
  328. andButtonId:103];
  329. [_multibuttons addCustomButtonWithIcon:[UIImage imageNamed:@"exCircle.png"] title:@"顺序练习"
  330. backgroundColor:[UIColor colorWithRed:0.0 green:164.0/255.0 blue:120.0/255.0 alpha:1.0]
  331. andButtonId:104];
  332. [_multibuttons show];
  333. } else {
  334. [myDelegate setType:@"2"];
  335. [self gotoExerVC];
  336. }
  337. }
  338. }
  339. break;
  340. case 1://专项练习
  341. [myDelegate setType:@"3"];
  342. [self gotoListVC];
  343. break;
  344. case 2://背题模式
  345. [myDelegate setType:@"8"];
  346. [self gotoExerVC];
  347. break;
  348. case 3://排除的题
  349. [myDelegate setType:@"6"];
  350. [self gotoExerVC];
  351. break;
  352. case 4: {
  353. //顺序练习
  354. if (RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN) {
  355. if (_multibuttons) {
  356. _multibuttons = nil;
  357. }
  358. _multibuttons = [[RQMultiButtons alloc] initWithPoint:sender.center radius:140 inView:self.view];
  359. _multibuttons.bubbleRadius = 40;
  360. _multibuttons.delegate = self;
  361. [_multibuttons addCustomButtonWithIcon:[UIImage imageNamed:@"exCircle.png"] title:@"顺序练习"
  362. backgroundColor:[UIColor colorWithRed:0.0 green:164.0/255.0 blue:120.0/255.0 alpha:1.0]
  363. andButtonId:100];
  364. [_multibuttons addCustomButtonWithIcon:[UIImage imageNamed:@"examCircle.png"] title:@"模拟考试"
  365. backgroundColor:[UIColor colorWithRed:0.0 green:164.0/255.0 blue:120.0/255.0 alpha:1.0]
  366. andButtonId:101];
  367. // [_multibuttons addCustomButtonWithIcon:[UIImage imageNamed:@"examCircle.png"] title:@"VIP课程"
  368. // backgroundColor:[UIColor colorWithRed:0.0 green:164.0/255.0 blue:120.0/255.0 alpha:1.0]
  369. // andButtonId:102];
  370. [_multibuttons show];
  371. } else {
  372. if ([defUser.car_type isEqualToString:@"2"]) {
  373. // [myDelegate setType:@"1"];
  374. // [self gotoExerVC];
  375. //结业考核
  376. // [myDelegate setType:@"9"];
  377. // [self gotoExamVC];
  378. // return;
  379. if (!myDelegate.isLogin) {
  380. ShowMsg(@"请登录后再操作!");
  381. [self userLoginAction];
  382. }else {
  383. [MBProgressHUD showMessage:@"正在获取当前位置..." toView:self.view];
  384. [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation *location) {
  385. [MBProgressHUD hideHUDForView:self.view animated:YES];
  386. if (success) {
  387. self->myLocation = location.coordinate;
  388. [self takePhoto];
  389. }
  390. }];
  391. }
  392. } else {
  393. if (_multibuttons) {
  394. _multibuttons = nil;
  395. }
  396. _multibuttons = [[RQMultiButtons alloc] initWithPoint:sender.center radius:140 inView:self.view];
  397. _multibuttons.bubbleRadius = 40;
  398. _multibuttons.delegate = self;
  399. [_multibuttons addCustomButtonWithIcon:[UIImage imageNamed:@"exCircle.png"] title:@"顺序练习"
  400. backgroundColor:[UIColor colorWithRed:0.0 green:164.0/255.0 blue:120.0/255.0 alpha:1.0]
  401. andButtonId:100];
  402. [_multibuttons addCustomButtonWithIcon:[UIImage imageNamed:@"examCircle.png"] title:@"模拟考试"
  403. backgroundColor:[UIColor colorWithRed:0.0 green:164.0/255.0 blue:120.0/255.0 alpha:1.0]
  404. andButtonId:101];
  405. // [_multibuttons addCustomButtonWithIcon:[UIImage imageNamed:@"examCircle.png"] title:@"VIP课程"
  406. // backgroundColor:[UIColor colorWithRed:0.0 green:164.0/255.0 blue:120.0/255.0 alpha:1.0]
  407. // andButtonId:102];
  408. [_multibuttons show];
  409. }
  410. }
  411. break;
  412. }
  413. case 5://我的成绩
  414. [self gotoMyGradeVC];
  415. break;
  416. case 6://练习统计
  417. [self gotoStaticVC];
  418. break;
  419. case 7://强化练习
  420. [myDelegate setType:@"5"];
  421. [self gotoStrongVC];
  422. break;
  423. case 8://排行榜
  424. [self gotoScoreRank];
  425. break;
  426. case 9: {
  427. if (!myDelegate.isLogin) {
  428. ShowMsg(@"请登录后再操作!");
  429. [self userLoginAction];
  430. }else {
  431. [Tools confirmImeiWithLogType:@"5" successBlock:^{
  432. [self postCheckEduStu];
  433. }];
  434. }
  435. break;
  436. }
  437. case 12://未做题练习
  438. [myDelegate setType:@"10"];
  439. [self gotoExerVC];
  440. break;
  441. case 13://错题练习
  442. [myDelegate setType:@"4"];
  443. [self gotoExerVC];
  444. break;
  445. case 14://我的收藏
  446. [myDelegate setType:@"7"];
  447. [self gotoExerVC];
  448. break;
  449. default:
  450. break;
  451. }
  452. if (tag == 20) {
  453. // DownLoadVC *downLoadVC = [[DownLoadVC alloc] init];
  454. // downLoadVC.subject = _subject;
  455. // [self navPushHideTabbarToVC:downLoadVC];
  456. // VideoDownLoadListVC *downLoadVC = [[VideoDownLoadListVC alloc] init];
  457. // downLoadVC.videoListSegControlIndex = _subject - 1;
  458. // [self navPushHideTabbarToVC:downLoadVC];
  459. }
  460. if (tag > 20 && tag < 27) {
  461. // VideoPlayVC *vc = [[VideoPlayVC alloc] init];
  462. // if (videoArray.count > 5) {
  463. // vc.dataDic = videoArray[tag - 21];
  464. // }
  465. // vc.subject = _subject;
  466. // [self navPushHideTabbarToVC:vc];
  467. // LeeVideoVC *vc = [[LeeVideoVC alloc]init];
  468. // if (videoArray.count > 5) {
  469. // vc.dataDic = videoArray[tag - 21];
  470. // }
  471. // vc.subject = _subject;
  472. // vc.goDownLoadBlock = ^{
  473. // DownLoadVC *downLoadVC = [[DownLoadVC alloc] init];
  474. // downLoadVC.subject = _subject;
  475. // [self navPushHideTabbarToVC:downLoadVC];
  476. // };
  477. // vc.modalPresentationStyle = UIModalPresentationFullScreen;
  478. // [self presentViewController:vc animated:YES completion:nil];
  479. // VideoPlayViewController *vc = [[VideoPlayViewController alloc] init];
  480. // if (videoArray.count > 3) {
  481. // NSDictionary *dic = videoArray[sender.tag - 21];
  482. // RQDownloadModel *downloadModel = [[RQDownloadModel alloc] init];
  483. // downloadModel.videoId = dic[@"id"];
  484. // downloadModel.subject = dic[@"subject"];
  485. // downloadModel.title = dic[@"title"];
  486. // downloadModel.urlString = dic[@"videoPath"];
  487. // downloadModel.imageUrl = dic[@"image"];
  488. // downloadModel.content = dic[@"content"];
  489. // vc.currentModel = downloadModel;
  490. // }
  491. // [self navPushHideTabbarToVC:vc];
  492. }
  493. }
  494. - (void)rqMultiButtons:(RQMultiButtons *)multiButtons tappedButtonWithType:(RQMultiButtonsType)buttonType {
  495. switch (buttonType) {
  496. case 100:
  497. case 104:
  498. //顺序练习
  499. [myDelegate setType:@"1"];
  500. [self gotoExerVC];
  501. break;
  502. case 101:
  503. //模拟考试
  504. [myDelegate setType:@"9"];
  505. [self gotoExamVC];
  506. break;
  507. case 102:
  508. //VIP课程
  509. [self gotoVipVC];
  510. break;
  511. case 103:
  512. //随机练习
  513. [myDelegate setType:@"2"];
  514. [self gotoExerVC];
  515. break;
  516. default:
  517. break;
  518. }
  519. }
  520. //VIP课程
  521. - (void)gotoVipVC {
  522. // VipLessonViewController* vc = [VipLessonViewController suspendCenterPageVC];
  523. // [self navPushHideTabbarToVC:vc];
  524. }
  525. -(void)gotoExerVC
  526. {
  527. ExerciseVC* vc = [[ExerciseVC alloc] init];
  528. [self navPushHideTabbarToVC:vc];
  529. }
  530. -(void)gotoListVC
  531. {
  532. ListVC* vc = [[ListVC alloc] init];
  533. [self navPushHideTabbarToVC:vc];
  534. }
  535. -(void)gotoExamVC
  536. {
  537. ExamVC* vc = [[ExamVC alloc] init];
  538. [self navPushHideTabbarToVC:vc];
  539. }
  540. -(void)gotoStaticVC
  541. {
  542. StatisVC* vc = [[StatisVC alloc] init];
  543. [self navPushHideTabbarToVC:vc];
  544. }
  545. -(void)gotoMyGradeVC
  546. {
  547. MyGradeVC* vc = [[MyGradeVC alloc] init];
  548. [self navPushHideTabbarToVC:vc];
  549. }
  550. -(void)gotoScoreRank {
  551. ScoreRankVC* vc = [[ScoreRankVC alloc] init];
  552. [self navPushHideTabbarToVC:vc];
  553. }
  554. -(void)gotoStrongVC
  555. {
  556. StrongVC *vc = [[StrongVC alloc] init];
  557. [self navPushHideTabbarToVC:vc];
  558. }
  559. -(void)setSubject:(int)subject{
  560. _subject = subject;
  561. }
  562. - (void)userLoginAction {
  563. LoginViewController* vc = [[LoginViewController alloc] init];
  564. vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
  565. vc.modalPresentationStyle = UIModalPresentationFullScreen;
  566. [self.parentViewController presentViewController:vc animated:YES completion:nil];
  567. }
  568. #pragma mark - 获取错题数新_NOW
  569. -(void)getFaultCntNew
  570. {
  571. NSInteger faultCnt = RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN? [DB_Que_Helper queryMarkQuestionWithMarkType:@"1"] : ([defUser.car_type isEqualToString:@"2"]? [DB_Que_Helper queryGZPZ_EXAM_CYRYMarkQuestionWithMarkType:@"1"] : [DB_Que_Helper queryMarkQuestionWithMarkType:@"1"]);
  572. if (faultCnt > 0)
  573. {
  574. [faultLbl setText:[NSString stringWithFormat:@"%d",(int)faultCnt]];
  575. [faultLbl setBackgroundColor:[UIColor redColor]];
  576. }else{
  577. [faultLbl setText:@""];
  578. [faultLbl setBackgroundColor:[UIColor clearColor]];
  579. }
  580. }
  581. #pragma mark 之前非常麻烦的获取错题数 尽量弃用
  582. /**获取错题数 同步完用的
  583. */
  584. -(void)getFaultCnt
  585. {
  586. if (myDelegate.faultArray.count > 2) {
  587. NSInteger faultCnt = 0;
  588. if (_subject == 1) {
  589. faultCnt = [myDelegate.faultArray[0] integerValue];
  590. }
  591. if (_subject == 4) {
  592. faultCnt = [myDelegate.faultArray[1] integerValue];
  593. }
  594. if ([defUser.car_type isEqualToString:@"1"] || [defUser.car_type isEqualToString:@"2"] || [defUser.car_type isEqualToString:@"3"] || [defUser.car_type isEqualToString:@"4"] || [defUser.car_type isEqualToString:@"5"] || [defUser.car_type isEqualToString:@"6"])
  595. {
  596. faultCnt = [myDelegate.faultArray[2] integerValue];
  597. }
  598. if (faultCnt > 0)
  599. {
  600. [faultLbl setText:[NSString stringWithFormat:@"%d",(int)faultCnt]];
  601. [faultLbl setBackgroundColor:[UIColor redColor]];
  602. }else{
  603. [faultLbl setText:@""];
  604. [faultLbl setBackgroundColor:[UIColor clearColor]];
  605. }
  606. }else{
  607. [self performSelector:@selector(waitFault) withObject:nil afterDelay:2];
  608. [self waitFault];
  609. }
  610. }
  611. -(void)waitFault
  612. {
  613. static NSInteger i = 0;
  614. i++;
  615. if (i > 5) {
  616. i = 0;
  617. return;
  618. }
  619. [self getFaultCnt];
  620. }
  621. //在同步完错题后 之后的同步 用这个查询
  622. -(void)getFault
  623. {
  624. //因为科四也要加载 所以会执行两次
  625. NSString* sql = [NSString stringWithFormat:@"state = 1 and subject = %d",_subject];
  626. if ([defUser.car_type isEqualToString:@"1"] || [defUser.car_type isEqualToString:@"2"] || [defUser.car_type isEqualToString:@"3"] || [defUser.car_type isEqualToString:@"4"] || [defUser.car_type isEqualToString:@"5"] || [defUser.car_type isEqualToString:@"6"])
  627. {
  628. sql = [NSString stringWithFormat:@"state = 1"];
  629. }
  630. NSInteger faultCnt = [DB_Que_Helper countForQuery:sql];
  631. if (faultCnt > 0)
  632. {
  633. [faultLbl setText:[NSString stringWithFormat:@"%d",(int)faultCnt]];
  634. [faultLbl setBackgroundColor:[UIColor redColor]];
  635. }else{
  636. [faultLbl setText:@""];
  637. [faultLbl setBackgroundColor:[UIColor clearColor]];
  638. }
  639. }
  640. #pragma mark 获取视频资源
  641. -(void)getVideos
  642. {
  643. if (![Util connectedToNetWork]) {
  644. showMsgUnconnect();
  645. return;
  646. }
  647. NSMutableArray *aArray=[NSMutableArray array];
  648. [aArray addPro:@"chapterId" Value:[NSString stringWithFormat:@"%d",_subject]];
  649. [aArray addPro:@"subject" Value:[NSString stringWithFormat:@"%d",_subject]];
  650. [aArray addPro:@"isPage" Value:@"0"];
  651. [aArray addPro:@"pageSize" Value:@"0"];
  652. [aArray addPro:@"currentPage" Value:@"0"];
  653. NSString* method = @"getVideos";
  654. [jiaPeiManager requestAnythingWithURL:method array:aArray data:nil completion:^(NSDictionary *root) {
  655. //NSLog(@"获取视频aArray-->%@------------------root-->%@",aArray,root);
  656. if (!root) {
  657. //加载视频模块
  658. [getVideoBtn setTitle:@"视频获取失败,点击重试" forState:UIControlStateNormal];
  659. getVideoBtn.userInteractionEnabled = YES;
  660. return ;
  661. }
  662. if ([root[@"code"] isEqualToString:@"1"]) {
  663. ShowMsg(root[@"body"]);
  664. [getVideoBtn setTitle:@"视频获取失败,点击重试" forState:UIControlStateNormal];
  665. getVideoBtn.userInteractionEnabled = YES;
  666. return;
  667. }
  668. getVideoBtn.userInteractionEnabled = NO;
  669. [getVideoBtn setTitle:@"" forState:UIControlStateNormal];
  670. if ([root[@"body"] count] > 5) {
  671. videoArray = root[@"body"];
  672. [self initVideoView];
  673. }
  674. }];
  675. }
  676. - (void)postCheckEduStu {
  677. if (![Util connectedToNetWork]) {
  678. showMsgUnconnect();
  679. return;
  680. }
  681. NSMutableArray *aArray=[NSMutableArray array];
  682. [aArray addPro:@"idcard" Value:[NSString stringWithFormat:@"%@",defUser.userDict[@"loginCode"]]];
  683. [aArray addPro:@"pxcx" Value:[NSString stringWithFormat:@"%@",defUser.userDict[@"car_type"]]];
  684. [aArray addPro:@"outid" Value:[NSString stringWithFormat:@"%@",defUser.userDict[@"outId"]]];
  685. NSString* method = @"checkEduStu";
  686. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  687. [jiaPeiManager requestAnythingWithURL:method array:aArray data:nil completion:^(NSDictionary *root) {
  688. [MBProgressHUD hideHUDForView:self.view];
  689. if (!root) {
  690. ShowMsgFailed();
  691. return ;
  692. }
  693. if ([root[@"code"] isEqualToString:@"0"]) {
  694. //远程教育
  695. SCLAlertView *alert = [[SCLAlertView alloc] initWithNewWindowWidth:kScreenWidth - 32];
  696. alert.customViewColor = defGreen;
  697. alert.showAnimationType = SCLAlertViewShowAnimationFadeIn;
  698. alert.viewText.textAlignment = NSTextAlignmentLeft;
  699. UITextView *view = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - 64, kScreenHeight * 0.5)];
  700. view.font = [UIFont systemFontOfSize:15];
  701. view.editable = NO;
  702. [alert addButton:@"确定" actionBlock:^(void) {
  703. RQWebViewViewController *vc = [[RQWebViewViewController alloc] init];
  704. vc.webType = WebTypeEDU;
  705. if (root[@"data"][@"url"] && ![root[@"data"][@"url"] isEqualToString:@""]) {
  706. vc.url = [NSString stringWithFormat:@"%@", root[@"data"][@"url"]];
  707. }else {
  708. vc.url = [NSString stringWithFormat:@"http://lncx.anjia365.com/h5/xzz/#/login?state=1&userName=%@&pwd=%@&area=2101&type=cx&pxcx=%@",defUser.userDict[@"loginCode"],defUser.userDict[@"password"],defUser.userDict[@"car_type"]];
  709. }
  710. NSLog(@"%@",vc.url);
  711. [self navPushHideTabbarToVC:vc];
  712. }];
  713. NSMutableString *content = [NSMutableString string];
  714. NSArray *strArr = root[@"data"][@"precautions"];
  715. [strArr.rac_sequence.signal subscribeNext:^(NSString *str) {
  716. if (strArr.count > 1) {
  717. [content appendFormat:@"%d.%@\n\n",(int)[strArr indexOfObject:str] + 1,str];
  718. }else {
  719. [content appendFormat:@"%@\n\n",str];
  720. }
  721. } completed:^{
  722. dispatch_main_async_safe(^{
  723. if (content.length == 0) {
  724. content.string = @"1.训练已学习过的课件,学时不累加;\n\n2.每个科目的课件全部都学习完后可以重置,重置后的课件学习时可以再次累加学时;\n\n3.科目一科目四,混合训练时会产生多段培训记录;\n\n4.如果训练过程异常退出,30分钟内重新登录训练的,继续学习同一个科目将继续累加学时,继续学习不同科目上一段将做为异常记录上报;\n\n5.如果训练过程异常退出,超过30分钟内重新登录训练的, 上一段将做为异常记录上报;\n\n";
  725. }
  726. view.text = content.mutableCopy;
  727. CGFloat textHeight = [view.text heightForWid:view.width Font:15];
  728. view.height = (textHeight > kScreenHeight/2)? kScreenHeight/2 : textHeight;
  729. [alert addCustomView:view];
  730. [alert showInfo:@"温馨提示" subTitle:@"" closeButtonTitle:@"取消" duration:0.0f];
  731. })
  732. }];
  733. } else {
  734. ShowMsg(root[@"msg"]);
  735. return ;
  736. }
  737. }];
  738. }
  739. -(void)initVideoView
  740. {
  741. //290*260 290*180 290*70 h = 265
  742. videoView = [[UIView alloc] initWithFrame:videoCoverView.frame];
  743. videoView.backgroundColor = [UIColor whiteColor];
  744. //重置页面展示形式
  745. CGFloat w = (kSize.width - 30)/2.0;
  746. videoView.height = w*78/29.0 + 40;
  747. [scroll addSubview:videoView];
  748. [scroll setContentSize:CGSizeMake(0, videoView.bottom + (10+VAWBAR_H) + SCRV_BottomH)];
  749. vowItem.y = videoView.bottom + 20;
  750. [vowItem addViewWithRect:CGRectMake(0, vowItem.y - 20, kSize.width, 10) Color:KlineColor];
  751. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, kSize.width/2.0 - 10, 40)];
  752. [label setText:@"教学视频" Font:FontTitle TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
  753. [videoView addSubview:label];
  754. label = [[UILabel alloc] initWithFrame:CGRectMake(kSize.width/2.0, 0, kSize.width/2.0 - 10, 40)];
  755. [label setText:[NSString stringWithFormat:@"共%d个视频>",(int)videoArray.count] Font:Font17 TextColor:contentTextColor Alignment:NSTextAlignmentRight];
  756. [videoView addSubview:label];
  757. UIButton *moreVideoBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, kSize.width, 40)];
  758. [moreVideoBtn target:self tag:20];//tag 20开始
  759. [videoView addSubview:moreVideoBtn];
  760. CGFloat bdH = w*26/29.0;
  761. CGFloat photoH = w*18/29.0;
  762. CGFloat labelH = w*7/29.0;
  763. NSInteger videoNum = videoArray.count;
  764. if (videoNum > 6) {
  765. videoNum = 6;
  766. }
  767. for (int i = 0; i < videoNum; i ++) {
  768. int row = i/2;
  769. int clumn = i%2;
  770. NSDictionary *dic = videoArray[i];
  771. //照片
  772. UIImageView *videoImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10 + clumn*(w + 10), 40 + row*bdH, w, photoH)];
  773. NSString *str = dic[@"image"];
  774. if (!str) {
  775. str = @"";
  776. }
  777. [videoImageView sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"NOIMG.png"]];
  778. [videoView addSubview:videoImageView];
  779. //时长
  780. label = [[UILabel alloc] initWithFrame:CGRectMake(10 + clumn*(w + 10), row*bdH + photoH + 15, w - 10, 25)];
  781. label.backgroundColor = windowBlockColor;
  782. int seconds = [dic[@"times"] intValue];
  783. NSString *min = [NSString stringWithFormat:@"%d",seconds/60];
  784. NSString *sec = [NSString stringWithFormat:@"%d",seconds%60];
  785. if (seconds/60 < 10) {
  786. min = [NSString stringWithFormat:@"0%@",min];
  787. }
  788. if (seconds%60 < 10) {
  789. sec = [NSString stringWithFormat:@"0%@",sec];
  790. }
  791. [label setText:[NSString stringWithFormat:@"%@:%@",min,sec] Font:NormalFont TextColor:[UIColor whiteColor] Alignment:NSTextAlignmentRight];
  792. [videoView addSubview:label];
  793. //title
  794. label = [[UILabel alloc] initWithFrame:CGRectMake(10 + clumn*(w + 10), 40 + row*bdH + photoH, w, labelH)];
  795. [label setText:dic[@"title"] Font:FontTitle TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
  796. [videoView addSubview:label];
  797. //btn
  798. UIButton *playBtn = [[UIButton alloc] initWithFrame:CGRectMake(10 + clumn*(w + 10), 40 + row*bdH, w, bdH)];
  799. playBtn.backgroundColor = [UIColor clearColor];
  800. [playBtn target:self tag:21 + i];//21开始
  801. [videoView addSubview:playBtn];
  802. }
  803. }
  804. -(void)dealloc
  805. {
  806. //这个方法 只有在页面消失的时候才会调用 在本项目中只有关闭软件才会调用这个方法。所以不作处理也没有任何问题的 这样只是更严谨
  807. [[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateAD" object:nil];
  808. }
  809. // 人脸比对
  810. - (void)takePhoto {
  811. UIStoryboard * board = [UIStoryboard storyboardWithName:@"LivenessDetection" bundle:nil];
  812. OliveappLivenessDetectionViewController * livenessDetectionViewController;
  813. livenessDetectionViewController = (OliveappLivenessDetectionViewController *)[ board instantiateViewControllerWithIdentifier:@"LivenessDetectionStoryboard"];
  814. livenessDetectionViewController.modalPresentationStyle = 0;
  815. livenessDetectionViewController.faceDelegate = self;
  816. OliveappSessionManagerConfig* config = [OliveappSessionManagerConfig new];
  817. // config.timeoutMs = 100000;
  818. [config usePredefinedConfig: 4]; // 这里配置检测步骤
  819. livenessDetectionViewController.cusConfig = config;
  820. NSError *error;
  821. BOOL isSuccess = [livenessDetectionViewController setConfigLivenessDetection:self withError: &error];
  822. if (isSuccess){
  823. [self presentViewController:livenessDetectionViewController animated:YES completion:nil];
  824. }
  825. }
  826. - (void)onLivenessSuccess:(OliveappDetectedFrame *)detectedFrame{
  827. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  828. [self dismissViewControllerAnimated:YES completion:nil];
  829. });
  830. }
  831. - (void)onLivenessFail:(int)sessionState withDetectedFrame:(OliveappDetectedFrame *)detectedFrame{
  832. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  833. [self dismissViewControllerAnimated:YES completion:nil];
  834. UIAlertController *actionsheet = [UIAlertController alertControllerWithTitle:@"提示" message:@"获取人脸失败,是否重新进行人脸比对" preferredStyle:UIAlertControllerStyleAlert];
  835. UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"是" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  836. [self takePhoto];
  837. }];
  838. UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"否" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  839. }];
  840. [actionsheet addAction:action1];
  841. [actionsheet addAction:action2];
  842. [self presentViewController:actionsheet animated:YES completion:nil];
  843. });
  844. }
  845. - (void)onLivenessCancel{
  846. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  847. [self dismissViewControllerAnimated:YES completion:nil];
  848. });
  849. }
  850. - (void)sendFaceImage:(UIImage *)faceImage {
  851. UIImage *normalImage = [UIImage fixOrientation:faceImage];
  852. NSData *imgData = UIImageJPEGRepresentation(normalImage, .2f);
  853. NSString *backString = [NSString stringWithFormat:@"%@",[OliveappBase64Helper encode:imgData]];
  854. [self face2faceJykhWithPhotoStr:backString ResultBlock:^(BOOL success) {
  855. if (success) {
  856. //模拟考试
  857. [myDelegate setType:@"9"];
  858. [self gotoExamVC];
  859. }
  860. }];
  861. }
  862. - (void)sendFaceImageError {
  863. }
  864. - (void)face2faceJykhWithPhotoStr:(NSString *)photoStr ResultBlock:(void (^)(BOOL success))resultBlock {
  865. if (![Util connectedToNetWork]) {
  866. showMsgUnconnect();
  867. resultBlock(NO);
  868. return;
  869. }
  870. if (myLocation.longitude == 0.0) {
  871. UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"位置获取失败" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
  872. [alert show];
  873. resultBlock(NO);
  874. return;
  875. }
  876. NSMutableArray *arr=[NSMutableArray array];
  877. [arr addPro:@"stunum" Value:defUser.userDict[@"stuNum"]];
  878. [arr addPro:@"dqbh" Value:defUser.userDict[@"city"]];
  879. [arr addPro:@"outId" Value:defUser.userDict[@"outId"]];
  880. [arr addPro:@"lng" Value:[NSString stringWithFormat:@"%f",myLocation.longitude]];
  881. [arr addPro:@"lat" Value:[NSString stringWithFormat:@"%f",myLocation.latitude]];
  882. [arr addPro:@"photo" Value:photoStr];
  883. NSString *method = @"face2faceJykh";
  884. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  885. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
  886. [MBProgressHUD hideHUDForView:self.view];
  887. if (!root) {
  888. ShowMsg(@"操作失败,请重试!");
  889. [Tools playAudioWithString:@"操作失败,请重试!"];
  890. resultBlock(NO);
  891. return;
  892. }
  893. resultBlock([root[@"code"] integerValue] == 0);
  894. [Tools playAudioWithString:root[@"msg"]];
  895. ShowMsg(root[@"msg"]);
  896. }];
  897. }
  898. @end