No Description

KXMainWebViewController.m 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. //
  2. // KXMainWebViewController.m
  3. // QBCS
  4. //
  5. // Created by kuxuan on 2017/7/10.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "KXMainWebViewController.h"
  9. #import "KXSelectTableViewCell.h"
  10. #import "KXLogginViewController.h"
  11. #import "KXNextStepViewController.h"
  12. @interface KXMainWebViewController ()<UITableViewDelegate,UITableViewDataSource,UIWebViewDelegate>
  13. {
  14. UIView *_selectView;
  15. BOOL _selected;
  16. }
  17. @property (nonatomic,strong)UITableView *selectTableView;
  18. @property (nonatomic,strong)NSArray *careerArray;
  19. @property (nonatomic,strong)NSArray *incomeArray;
  20. @property (nonatomic,copy)NSString *Id;
  21. @property (nonatomic,assign)BOOL agreeBool;
  22. @property (nonatomic,strong)UIView *backView;
  23. @property (nonatomic,strong)UIView *topView;
  24. @property (nonatomic,strong)NSArray *protocolArray;
  25. @end
  26. @implementation KXMainWebViewController
  27. - (void)viewDidLoad {
  28. [super viewDidLoad];
  29. // Do any additional setup after loading the view.
  30. self.name=@"申请";
  31. self.agreeBool=YES;
  32. [self setupUIview];
  33. [self createSelectView];
  34. [self addViews];
  35. }
  36. -(void)viewWillAppear:(BOOL)animated
  37. {
  38. [super viewWillAppear:animated];
  39. [self checkLog];
  40. }
  41. -(void)addViews{
  42. [self.view addSubview:self.backView];
  43. [self.view addSubview:self.topView];
  44. self.topView.hidden=YES;
  45. self.backView.hidden=YES;
  46. }
  47. -(void)setupUIview
  48. {
  49. UIScrollView *scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-64)];
  50. scrollView.showsVerticalScrollIndicator=NO;
  51. scrollView.showsHorizontalScrollIndicator=NO;
  52. scrollView.contentSize=CGSizeMake(SCREEN_WIDTH, 690);
  53. [self.view addSubview:scrollView];
  54. UIImageView *bannerIV=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"main_banner"]];
  55. bannerIV.frame=CGRectMake(0, 0, SCREEN_WIDTH, 90);
  56. [scrollView addSubview:bannerIV];
  57. UIView *whiteView=[[UIView alloc]initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 350)];
  58. whiteView.backgroundColor=[UIColor whiteColor];
  59. [scrollView addSubview:whiteView];
  60. NSArray *titleArray=@[@"真实姓名",@"年 龄",@"联系方式",@"贷款金额",@"贷款期限",@"职 业",@"月 收 入"];
  61. NSArray *placeholderArray=@[@"请输入真实姓名",@"请输入年龄",@"请输入联系方式",@"请输入贷款金额",@"请输入贷款期限(月)"];
  62. for (int i=0; i<7; i++) {
  63. UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(14, 50*i, 100, 50)];
  64. label.text=titleArray[i];
  65. label.textColor=[UIColor titleColor];
  66. label.font=FONT_SYS(16);
  67. [whiteView addSubview:label];
  68. UILabel *lineLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 50*(i+1), SCREEN_WIDTH, 1)];
  69. lineLabel.backgroundColor=[UIColor lineColor];
  70. [whiteView addSubview:lineLabel];
  71. }
  72. for (int i=0; i<5; i++) {
  73. UITextField *tf=[[UITextField alloc]initWithFrame:CGRectMake(120, 50*i, SCREEN_WIDTH-140, 50)];
  74. tf.tag=666+i;
  75. tf.textColor=[UIColor detailTitleColor];
  76. tf.placeholder=placeholderArray[i];
  77. tf.font=FONT_SYS(16);
  78. [whiteView addSubview:tf];
  79. }
  80. NSArray *buttonArray=@[@"请选择职业身份",@"请选择月收入"];
  81. for (int i=0; i<2; i++) {
  82. UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
  83. button.frame=CGRectMake(120, 50*i+250, SCREEN_WIDTH-140, 50);
  84. [button setTitle:buttonArray[i] forState:UIControlStateNormal];
  85. button.titleLabel.font=FONT_SYS(16);
  86. button.tag=8989+i;
  87. [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
  88. button.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
  89. [button setTitleColor:[UIColor titleColor] forState:UIControlStateNormal];
  90. [whiteView addSubview:button];
  91. }
  92. UIButton *agreeButton=[UIButton buttonWithType:UIButtonTypeCustom];
  93. agreeButton.frame=CGRectMake(0, 0, 16, 16);
  94. agreeButton.tag=2000;
  95. [agreeButton addTarget:self action:@selector(agreeAction:) forControlEvents:UIControlEventTouchUpInside];
  96. agreeButton.selected=YES;
  97. [agreeButton setImage:[UIImage imageNamed:@"disagree_protocol"] forState:UIControlStateNormal];
  98. [agreeButton setImage:[UIImage imageNamed:@"agree_protocol"] forState:UIControlStateSelected];
  99. UIView *protocolView=[[UIView alloc]init];
  100. protocolView.frame=CGRectMake(0, 0, 240, 20);
  101. for (int i=0; i<3; i++) {
  102. UIButton *button=[[UIButton alloc]init];
  103. button.titleLabel.font=[UIFont systemFontOfSize:12.0f];
  104. [button addTarget:self action:@selector(protocolAction:) forControlEvents:UIControlEventTouchUpInside];
  105. [button setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
  106. button.tag=1000+i;
  107. switch (i) {
  108. case 0:
  109. {
  110. [button setTitle:@"《委托授权协议》" forState:UIControlStateNormal];
  111. button.frame=CGRectMake(0, -3, 100, 20);
  112. }
  113. break;
  114. case 1:
  115. {
  116. [button setTitle:@"《借款协议》" forState:UIControlStateNormal];
  117. button.frame=CGRectMake(90, -3, 65, 20);
  118. }
  119. break;
  120. case 2:
  121. {
  122. [button setTitle:@"《平台服务协议》" forState:UIControlStateNormal];
  123. button.frame=CGRectMake(90+65, -3, 70, 20);
  124. }
  125. break;
  126. default:
  127. break;
  128. }
  129. [button sizeToFit];
  130. [protocolView addSubview:button];
  131. }
  132. // protocolView.backgroundColor=[UIColor redColor];
  133. UITextField *protocolText=[[UITextField alloc]init];
  134. protocolText.text=@"同意";
  135. protocolText.font = [UIFont systemFontOfSize:12.0];
  136. protocolText.textAlignment=NSTextAlignmentCenter;
  137. protocolText.leftView=agreeButton;
  138. protocolText.leftViewMode=UITextFieldViewModeAlways;
  139. protocolText.rightView=protocolView;
  140. protocolText.rightViewMode=UITextFieldViewModeAlways;
  141. [scrollView addSubview:protocolText];
  142. UIButton *next=[UIButton buttonWithType:UIButtonTypeCustom];
  143. next.frame=CGRectMake(14,480, SCREEN_WIDTH-28, 45);
  144. next.layer.cornerRadius=6;
  145. next.tag=999;
  146. next.layer.masksToBounds=YES;
  147. next.backgroundColor=[UIColor baseColor];
  148. next.titleLabel.font=FONT_SYS(16);
  149. [next setTitle:@"下一步" forState:UIControlStateNormal];
  150. [next setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  151. [next addTarget:self action:@selector(nextAction) forControlEvents:UIControlEventTouchUpInside];
  152. [scrollView addSubview:next];
  153. UILabel *littleLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 525, SCREEN_WIDTH, 30)];
  154. littleLabel.text=[NSString stringWithFormat:@"由%@出品为您提供高品质金融服务",KXCOMPANY];
  155. littleLabel.textColor=[UIColor detailTitleColor];
  156. littleLabel.textAlignment=NSTextAlignmentCenter;
  157. littleLabel.font=FONT_SYS(12);
  158. littleLabel.numberOfLines=0;
  159. [scrollView addSubview:littleLabel];
  160. [protocolText mas_makeConstraints:^(MASConstraintMaker *make) {
  161. make.width.mas_equalTo(240+16+45);//
  162. make.height.mas_equalTo(20);
  163. make.top.equalTo(whiteView.mas_bottom).offset(10);
  164. make.left.equalTo(scrollView.mas_left).offset(16);
  165. }];
  166. }
  167. -(void)agreeAction:(UIButton *)sender{
  168. self.agreeBool=!self.agreeBool;
  169. sender.selected=self.agreeBool;
  170. }
  171. -(void)protocolAction:(UIButton *)sender{
  172. self.backView.hidden=NO;
  173. self.topView.hidden=NO;
  174. long indexSender=sender.tag-1000;
  175. UILabel *titleLabel=[self.topView viewWithTag:764];
  176. titleLabel.text=sender.titleLabel.text;
  177. UIWebView *content=[self.topView viewWithTag:766];
  178. content.delegate=self;
  179. NSString *path = [[NSBundle mainBundle] bundlePath];
  180. NSURL *baseURL = [NSURL fileURLWithPath:path];
  181. NSString * htmlPath = [[NSBundle mainBundle] pathForResource:self.protocolArray[indexSender][@"html"]
  182. ofType:@"html"];
  183. // NSLog(@"--%@--%@--",self.protocolArray[indexSender][@"html"],htmlPath);
  184. NSString * htmlCont = [NSString stringWithContentsOfFile:htmlPath
  185. encoding:NSUTF8StringEncoding
  186. error:nil];
  187. [content loadHTMLString:htmlCont baseURL:baseURL];
  188. }
  189. -(void)buttonAction:(UIButton *)btn
  190. {
  191. switch (btn.tag) {
  192. case 8989:
  193. {
  194. _selected=YES;
  195. [self.selectTableView reloadData];
  196. }
  197. break;
  198. case 8990:
  199. {
  200. _selected=NO;
  201. [self.selectTableView reloadData];
  202. }
  203. break;
  204. default:
  205. break;
  206. }
  207. _selectView.hidden=NO;
  208. }
  209. -(void)checkLog
  210. {
  211. UITextField *nameTF=[self.view viewWithTag:666];
  212. UITextField *ageTF=[self.view viewWithTag:667];
  213. UITextField *cell_numTF=[self.view viewWithTag:668];
  214. UITextField *amountTF=[self.view viewWithTag:669];
  215. UITextField *termTF=[self.view viewWithTag:670];
  216. UIButton *careerBtn=[self.view viewWithTag:8989];
  217. UIButton *incomeBtn=[self.view viewWithTag:8990];
  218. UIButton *nextBtn=[self.view viewWithTag:999];
  219. NSString *urlString=[NSString stringWithFormat:@"%@/user/personalCenter",URL];
  220. [KXHTTP post:urlString params:nil success:^(id json) {
  221. if ([[json[@"user"] valueForKey:@"user_level_id"] isEqual:@(YES)]) {
  222. [nextBtn setTitle:@"审核中..." forState:UIControlStateNormal];
  223. nameTF.enabled=NO;
  224. ageTF.enabled=NO;
  225. cell_numTF.enabled=NO;
  226. amountTF.enabled=NO;
  227. termTF.enabled=NO;
  228. incomeBtn.enabled=NO;
  229. careerBtn.enabled=NO;
  230. NSString *urlSt=[NSString stringWithFormat:@"%@/user/getIosApplyById",URL];
  231. [KXHTTP post:urlSt params:@{@"id":[json[@"user"] valueForKey:@"id"]} success:^(id json) {
  232. nameTF.text=json[@"name"];
  233. ageTF.text=json[@"age"];
  234. cell_numTF.text=json[@"cell_num"];
  235. amountTF.text=json[@"amount"];
  236. termTF.text=json[@"term"];
  237. [incomeBtn setTitle:json[@"monthly_income"] forState:UIControlStateNormal];
  238. [careerBtn setTitle:json[@"occupation"] forState:UIControlStateNormal];
  239. } failure:^(NSError *error) {
  240. }];
  241. }else{
  242. [nextBtn setTitle:@"下一步" forState:UIControlStateNormal];
  243. nameTF.enabled=YES;
  244. ageTF.enabled=YES;
  245. cell_numTF.enabled=YES;
  246. incomeBtn.enabled=YES;
  247. careerBtn.enabled=YES;
  248. amountTF.enabled=YES;
  249. termTF.enabled=YES;
  250. nameTF.text=@"";
  251. ageTF.text=@"";
  252. amountTF.text=@"";
  253. termTF.text=@"";
  254. cell_numTF.text=@"";
  255. [incomeBtn setTitle:@"请选择月收入" forState:UIControlStateNormal];
  256. [careerBtn setTitle:@"请选择职业身份" forState:UIControlStateNormal];
  257. }
  258. } failure:^(NSError *error) {
  259. }];
  260. }
  261. -(void)nextAction
  262. {
  263. UITextField *nameTF=[self.view viewWithTag:666];
  264. UITextField *ageTF=[self.view viewWithTag:667];
  265. UITextField *cell_numTF=[self.view viewWithTag:668];
  266. UITextField *amountTF=[self.view viewWithTag:669];
  267. UITextField *termTF=[self.view viewWithTag:670];
  268. UIButton *careerBtn=[self.view viewWithTag:8989];
  269. UIButton *incomeBtn=[self.view viewWithTag:8990];
  270. UIButton *nextBtn=[self.view viewWithTag:999];
  271. if (!nameTF.text||!ageTF.text||!cell_numTF.text||!amountTF.text||!termTF.text||[careerBtn.titleLabel.text isEqualToString:@"请选择职业身份"]||[incomeBtn.titleLabel.text isEqualToString:@"请选择月收入"]) {
  272. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"请正确输入内容" preferredStyle:UIAlertControllerStyleAlert];
  273. [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  274. }]];
  275. [self presentViewController:alertController animated:YES completion:nil];
  276. return;
  277. }
  278. if ([nextBtn.titleLabel.text isEqualToString:@"审核中..."]) {
  279. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:[NSString stringWithFormat:@"%@正在为您审核,请耐心等待",KXCOMPANY_SERVICE] preferredStyle:UIAlertControllerStyleAlert];
  280. [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  281. }]];
  282. [self presentViewController:alertController animated:YES completion:nil];
  283. return;
  284. }
  285. NSString *urlString=[NSString stringWithFormat:@"%@/user/personalCenter",URL];
  286. [KXHTTP post:urlString params:nil success:^(id json) {
  287. NSString *username= [[NSUserDefaults standardUserDefaults]valueForKey:USER_NAME];
  288. if (!username) {
  289. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"请登录" preferredStyle:UIAlertControllerStyleAlert];
  290. [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  291. KXLogginViewController *loggin=[[KXLogginViewController alloc]init];
  292. [self.navigationController pushViewController:loggin animated:YES];
  293. [[NSUserDefaults standardUserDefaults]setObject:nil forKey:@"ISPOP"];
  294. [[NSUserDefaults standardUserDefaults]synchronize];
  295. }]];
  296. [self presentViewController:alertController animated:YES completion:nil];
  297. }
  298. else if (!self.agreeBool){//请勾选同意协议
  299. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"请勾选同意协议" preferredStyle:UIAlertControllerStyleAlert];
  300. [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  301. [[NSUserDefaults standardUserDefaults]setObject:nil forKey:@"ISPOP"];
  302. [[NSUserDefaults standardUserDefaults]synchronize];
  303. }]];
  304. [self presentViewController:alertController animated:YES completion:nil];
  305. nextBtn.enabled=YES;
  306. }else{
  307. KXNextStepViewController *next=[[KXNextStepViewController alloc]init];
  308. next.personName=nameTF.text;
  309. next.age=ageTF.text;
  310. next.cell=cell_numTF.text;
  311. next.amount=amountTF.text;
  312. next.term=termTF.text;
  313. next.occupation=careerBtn.titleLabel.text;
  314. next.income=incomeBtn.titleLabel.text;
  315. [self.navigationController pushViewController:next animated:YES];
  316. }
  317. } failure:^(NSError *error) {
  318. }];
  319. }
  320. -(void)createSelectView
  321. {
  322. _selectView=[[UIView alloc]initWithFrame:self.view.bounds];
  323. _selectView.hidden=YES;
  324. _selectView.backgroundColor=[UIColor colorWithWhite:0 alpha:0.5];
  325. [self.view addSubview:_selectView];
  326. self.selectTableView = [[UITableView alloc]initWithFrame:CGRectMake(0,SCREEN_HEIGHT-220-64-49, SCREEN_WIDTH, 220) style:UITableViewStylePlain];
  327. self.selectTableView.separatorStyle=UITableViewCellSeparatorStyleNone;
  328. [self.selectTableView registerClass:[KXSelectTableViewCell class] forCellReuseIdentifier:@"selected"];
  329. self.selectTableView.tableFooterView=[[UIView alloc]init];
  330. self.selectTableView.delegate = self;
  331. self.selectTableView.dataSource = self;
  332. [_selectView addSubview:self.selectTableView];
  333. }
  334. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  335. {
  336. if (_selected==YES) {
  337. return self.careerArray.count;
  338. }else{
  339. return self.incomeArray.count;
  340. }
  341. }
  342. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  343. {
  344. KXSelectTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"selected"];
  345. if (!cell) {
  346. cell=[[KXSelectTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"selected"];
  347. }
  348. if (_selected==YES) {
  349. cell.detailStr=self.careerArray[indexPath.row];
  350. }else{
  351. cell.detailStr=self.incomeArray[indexPath.row];
  352. }
  353. return cell;
  354. }
  355. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath
  356. {
  357. return 45;
  358. }
  359. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  360. {
  361. if (_selected==YES) {
  362. UIButton *button=[self.view viewWithTag:8989];
  363. [button setTitle:self.careerArray[indexPath.row] forState:UIControlStateNormal];
  364. }else{
  365. UIButton *button=[self.view viewWithTag:8990];
  366. [button setTitle:self.incomeArray[indexPath.row] forState:UIControlStateNormal];
  367. }
  368. _selectView.hidden=YES;
  369. }
  370. -(NSArray *)careerArray
  371. {
  372. if (!_careerArray) {
  373. _careerArray=@[@"上班族",@"个体户",@"企业主",@"自由职业"];
  374. }
  375. return _careerArray;
  376. }
  377. -(NSArray *)incomeArray
  378. {
  379. if (!_incomeArray) {
  380. _incomeArray=@[@"1000以下",@"1000-3000",@"3000-5000",@"5000-7000",@"7000-10000",@"1万-3万",@"3万-5万",@"5万以上"];
  381. }
  382. return _incomeArray;
  383. }
  384. -(void)closeTop{
  385. self.topView.hidden=YES;
  386. self.backView.hidden=YES;
  387. UIWebView *content=[self.topView viewWithTag:766];
  388. [content loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@""]]];
  389. }
  390. -(UIView *)topView{
  391. if (!_topView) {
  392. _topView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 300, 380)];
  393. _topView.center=self.view.center;
  394. _topView.backgroundColor=[UIColor whiteColor];
  395. UILabel *titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 300, 49.5)];
  396. titleLabel.textColor=[UIColor baseColor];
  397. titleLabel.textAlignment=NSTextAlignmentCenter;
  398. UIView *line1=[[UIView alloc]initWithFrame:CGRectMake(0, 49.5, 300, 0.5)];
  399. line1.backgroundColor=[UIColor baseColor];
  400. UIView *line2=[[UIView alloc]initWithFrame:CGRectMake(0, 330, 300, 0.5)];
  401. line2.backgroundColor=[UIColor baseColor];
  402. titleLabel.tag=764;
  403. // UIScrollView *contentScrollView=[[UIScrollView alloc]initWithFrame:];
  404. // contentScrollView.tag=765;
  405. UIWebView*content=[[UIWebView alloc]initWithFrame:CGRectMake(0, 50, 300, 280)];
  406. content.tag=766;
  407. UIButton *closeButton=[[UIButton alloc]initWithFrame:CGRectMake(0, 330.5, 300, 50)];
  408. content.backgroundColor=[UIColor whiteColor];
  409. [closeButton setTitle:@"关闭" forState:UIControlStateNormal];
  410. [closeButton setTitleColor:[UIColor baseColor] forState:UIControlStateNormal];
  411. [closeButton addTarget:self action:@selector(closeTop) forControlEvents:UIControlEventTouchUpInside];
  412. closeButton.tag=767;
  413. [_topView addSubview:titleLabel];
  414. // [contentScrollView addSubview:content];
  415. // [_topView addSubview:contentScrollView];
  416. [_topView addSubview:content];
  417. [_topView addSubview:closeButton];
  418. [_topView addSubview:line1];
  419. [_topView addSubview:line2];
  420. }
  421. return _topView;
  422. }
  423. -(UIView *)backView{
  424. if (!_backView) {
  425. _backView=[[UIView alloc]initWithFrame:self.view.bounds];
  426. _backView.backgroundColor=[UIColor KXColorWithHex:0x000000 alpha:0.3];
  427. }
  428. return _backView;
  429. }
  430. -(NSArray *)protocolArray{
  431. if (!_protocolArray) {
  432. NSMutableArray *arr=[NSMutableArray array];
  433. NSString*path=[[NSBundle mainBundle] pathForResource:@"protocolList" ofType:@"plist"];
  434. NSMutableArray *dataList=[NSMutableArray arrayWithContentsOfFile:path];
  435. for (NSDictionary *dic in dataList) {
  436. [arr addObject:dic];
  437. }
  438. _protocolArray=[NSArray arrayWithArray:arr];
  439. }
  440. return _protocolArray;
  441. }
  442. - (void)webViewDidFinishLoad:(UIWebView *)webView{
  443. NSString *company=[NSString stringWithFormat:@"document.getElementById('company').innerHTML='%@'",KXCOMPANY];
  444. [webView stringByEvaluatingJavaScriptFromString:company];
  445. NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
  446. NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
  447. NSString *appName=[NSString stringWithFormat:@"document.getElementById('appName').innerHTML='%@'",app_Name];
  448. [webView stringByEvaluatingJavaScriptFromString:appName];
  449. }
  450. - (void)didReceiveMemoryWarning {
  451. [super didReceiveMemoryWarning];
  452. // Dispose of any resources that can be recreated.
  453. }
  454. /*
  455. #pragma mark - Navigation
  456. // In a storyboard-based application, you will often want to do a little preparation before navigation
  457. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  458. // Get the new view controller using [segue destinationViewController].
  459. // Pass the selected object to the new view controller.
  460. }
  461. */
  462. @end