JXSiDaiWebView.m 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. //
  2. // JXSiDaiWebView.m
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/6/4.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. // CYWebCustomerServiceVC
  8. #import "JXSiDaiWebView.h"
  9. #import "JXsiDaiTopView.h"
  10. #import "JXSiDaiCell.h"
  11. #import "JXChatViewC.h"
  12. #import "JXSiDaiIntroView.h"
  13. #import "MJPhotoBrowser.h"
  14. #import "MJPhoto.h"
  15. @interface JXSiDaiWebView ()<UITableViewDataSource,UITableViewDelegate,UIGestureRecognizerDelegate>
  16. @property (nonatomic,weak) UITableView *tableVIew ;
  17. @end
  18. @implementation JXSiDaiWebView
  19. -(void)click{
  20. [g_navigation dismissViewController:self animated:YES];
  21. }
  22. - (void)defineNavBarSiDaiaaaa:(NSString *)title andRinghtBtnImg:(NSString *)image
  23. {
  24. UIView *navView = [[UIView alloc] init];
  25. [self.view addSubview:navView];
  26. navView.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH,JX_SCREEN_TOP);
  27. UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  28. backBtn.frame = CGRectMake(0,JX_SCREEN_HEIGHT>812?44:20,44, 44);
  29. [backBtn setImage:[UIImage imageNamed:@"photo_title_back_black"] forState:0];
  30. backBtn.tag = 1001;
  31. [backBtn addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
  32. [navView addSubview:backBtn];
  33. UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  34. rightBtn.frame = CGRectMake(100,(JX_SCREEN_HEIGHT>812?44:20), JX_SCREEN_WIDTH-200, 44);
  35. [rightBtn setTitle:title forState:UIControlStateNormal];
  36. [rightBtn setTitleColor:kRGBColor51 forState:UIControlStateNormal];
  37. rightBtn.layer.cornerRadius=5;
  38. rightBtn.layer.masksToBounds=YES;
  39. [navView addSubview:rightBtn];
  40. self.rightBtn=rightBtn;
  41. }
  42. - (void)viewDidLoad {
  43. [super viewDidLoad];
  44. _dataArr=[NSMutableArray array];
  45. [self defineNavBarSiDaiaaaa:@"私带" andRinghtBtnImg:@"sidaiDD"];
  46. UIScrollView *imageScrollView =[[UIScrollView alloc]init];
  47. if (@available(iOS 11.0, *)) {
  48. imageScrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  49. } else {
  50. // Fallback on earlier versionsÔ
  51. }
  52. imageScrollView.userInteractionEnabled=YES;
  53. imageScrollView.delegate=self;
  54. imageScrollView.backgroundColor=kRGBColor(145, 29, 19);
  55. [self.view addSubview:imageScrollView];
  56. [imageScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.top.mas_equalTo(JX_SCREEN_TOP);
  58. make.left.mas_equalTo(0);
  59. make.right.mas_equalTo(0);
  60. make.bottom.mas_equalTo(0);
  61. }];
  62. UIImageView *imageBackV=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sidaiback2"]];
  63. imageBackV.userInteractionEnabled=YES;
  64. [imageScrollView addSubview:imageBackV];
  65. CGFloat imageYW = CGImageGetWidth(imageBackV.image.CGImage);
  66. // iamgeView的H = imageView的宽 / (原始图片的宽 / 原始图片的高)---根据宽高比得出imageView的宽
  67. CGFloat imageH = JX_SCREEN_WIDTH / (imageYW / CGImageGetHeight(imageBackV.image.CGImage));
  68. imageBackV.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, imageH+700);
  69. //xiaohaiRight
  70. JXsiDaiTopView *topVi=[[JXsiDaiTopView alloc]init];
  71. topVi.userInteractionEnabled=YES;
  72. topVi.backgroundColor=[UIColor clearColor];
  73. [imageBackV addSubview:topVi];
  74. [topVi mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.top.mas_equalTo(JX_SCREEN_HEIGHT/2.8);
  76. make.left.and.right.mas_equalTo(0);
  77. make.height.mas_equalTo(250);
  78. }];
  79. JXSiDaiIntroView *topIntro=[[JXSiDaiIntroView alloc]init];
  80. topIntro.userInteractionEnabled=YES;
  81. topIntro.backgroundColor=[UIColor clearColor];
  82. [imageBackV addSubview:topIntro];
  83. [topIntro mas_makeConstraints:^(MASConstraintMaker *make) {
  84. make.top.mas_equalTo(topVi.mas_bottom).mas_offset(0);
  85. make.left.mas_equalTo(0);
  86. make.right.mas_equalTo(0);
  87. make.height.mas_equalTo(240);
  88. }];
  89. //
  90. UIImageView *rightIMG=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"xiaohaiRight"]];
  91. rightIMG.userInteractionEnabled=YES;
  92. rightIMG.contentMode=UIViewContentModeScaleAspectFill;
  93. [imageBackV addSubview:rightIMG];
  94. [rightIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.top.mas_equalTo(topIntro.mas_bottom).mas_offset(-100);
  96. make.right.mas_equalTo(0);
  97. make.height.mas_equalTo(150);
  98. make.width.mas_equalTo(150);
  99. }];
  100. UITableView *tableVIew = [[UITableView alloc]init];
  101. tableVIew.backgroundColor=[UIColor clearColor];
  102. tableVIew.scrollEnabled=NO;
  103. tableVIew.separatorStyle=UITableViewCellSeparatorStyleNone;
  104. [imageBackV addSubview:tableVIew];
  105. tableVIew.sectionHeaderHeight=0;
  106. self.tableVIew=tableVIew;
  107. tableVIew.delegate=self;
  108. tableVIew.dataSource=self;
  109. tableVIew.tableFooterView=[UIView new];
  110. [tableVIew mas_makeConstraints:^(MASConstraintMaker *make) {
  111. make.top.mas_equalTo(rightIMG.mas_bottom).mas_offset(10);
  112. make.left.and.right.mas_equalTo(0);
  113. make.bottom.mas_equalTo(0);
  114. }];
  115. [_dataArr addObjectsFromArray:_sdaiArr];
  116. imageScrollView.contentSize=CGSizeMake(0, imageH+700);
  117. // long time = (long)[[NSDate date] timeIntervalSince1970];
  118. // time = (time *1000 + g_server.timeDifference);
  119. // NSString *salt = [NSString stringWithFormat:@"%ld", time];
  120. // NSString *jid_room=[[NSUserDefaults standardUserDefaults] objectForKey:@"jid_roomJid"];
  121. // [g_server getact_act_act_SilkPlanallByJidlist:salt jid:jid_room andToView:self];
  122. }
  123. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  124. return 589;
  125. }
  126. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  127. return _dataArr.count;
  128. }
  129. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  130. JXSiDaiCell *cell=[JXSiDaiCell cellWithTableView:tableView];
  131. NSDictionary *dict=_dataArr[indexPath.row];
  132. cell.dictData=dict;
  133. cell.yuyueblock = ^(UIButton *btn) {
  134. NSString *menberShipAccout = [NSString stringWithFormat:@"%@",dict[@"membershipAccount"]];
  135. JXChatViewC *vc = [[JXChatViewC alloc] init]; //10000656 10000
  136. JXUserObject *user = [[JXUserObject sharedInstance] getUserById:menberShipAccout];
  137. vc.chatPerson = user;
  138. [g_navigation pushViewController:vc animated:YES];
  139. };
  140. id traget = self.navigationController.interactivePopGestureRecognizer.delegate;
  141. UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];
  142. [cell.teacherDetaiL addGestureRecognizer:pan];
  143. UISwipeGestureRecognizer * swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)];
  144. swipeLeft.direction = UISwipeGestureRecognizerDirectionUp;
  145. [cell.teacherDetaiL addGestureRecognizer:swipeLeft];
  146. UISwipeGestureRecognizer * swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)];
  147. swipeLeft.direction = UISwipeGestureRecognizerDirectionUp;
  148. [cell.teacherDetaiL addGestureRecognizer:swipeLeft];
  149. [pan requireGestureRecognizerToFail:swipeLeft];
  150. [pan requireGestureRecognizerToFail:swipeRight];
  151. return cell;
  152. }
  153. -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
  154. }
  155. - (void)swipeAction:(UITapGestureRecognizer *)gesture {
  156. //获得当前手势触发的在UITableView中的坐标
  157. CGPoint location = [gesture locationInView:_tableVIew];
  158. //获得当前坐标对应的indexPath
  159. NSIndexPath *indexPath = [_tableVIew indexPathForRowAtPoint:location];
  160. if (indexPath) {
  161. //通过indexpath获得对应的Cell
  162. UITableViewCell *cell = [_tableVIew cellForRowAtIndexPath:indexPath];
  163. //获得添加到cell.contentView中的UILabel
  164. //---------------------------------------------
  165. UILabel *label = nil;
  166. for (UIView *view in cell.contentView.subviews) {
  167. //for ( UIView *view in _perCardView.subviews)->自定义view
  168. if ([view isKindOfClass:[UILabel class]]) {
  169. label = (UILabel *)view;
  170. //lable = (UILel *)[自定义view viewWithTag:2];
  171. break;
  172. }
  173. }
  174. //获得当前手势点击在UILabe中的坐标
  175. CGPoint p = [gesture locationInView:label];
  176. //CGPoint p = [gesture locationInView:自定义view];
  177. //看看手势点的坐标是不是在UILabel中
  178. if (CGRectContainsPoint(label.frame, p)) {
  179. NSLog(@"label text : %@", label.text);
  180. }
  181. }
  182. }
  183. /*
  184. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  185. if([aDownload.action isEqualToString:act_SilkPlanallByJidlist]){ // act_UserGet
  186. [_dataArr addObjectsFromArray:dict[@"data"]];
  187. [_tableVIew reloadData];
  188. }
  189. }
  190. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  191. return show_error;
  192. }
  193. */
  194. @end