123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727 |
- //
- // JXMyFeedVc.m
- // shiku_im
- //
- // Created by 123 on 2020/5/23.
- // Copyright © 2020 Reese. All rights reserved.
- //
- #define insert_photo_tag -100000
- #import "JXMyFeedVc.h"
- #import "JXMyFeedCell.h"
- #import "addMsgVC.h"
- #import "RITLPhotosViewController.h"
- #import "GWLPhotoLibrayController.h"
- #import "UIView+LK.h"
- #import "JXFeedShowView.h"
- #import "JXCameraVC.h"
- #import "JXMediaObject.h"
- #import "addMsgVC.h"
- #import "AppDelegate.h"
- #import "JXImageView.h"
- #import "JXServer.h"
- #import "JXConnection.h"
- #import "ImageResize.h"
- #import "UIFactory.h"
- #import "JXTableView.h"
- #import "QBImagePickerController.h"
- #import "SBJsonWriter.h"
- #import "recordVideoViewController.h"
- #import "JXTextView.h"
- #import "JXMediaObject.h"
- #import "LXActionSheet.h"
- #import "myMediaVC.h"
- #import "JXLocationVC.h"
- #import "JXMapData.h"
- #import "WhoCanSeeViewController.h"
- #import "JXSelFriendVC.h"
- #import "JXSelectFriendsVC.h"
- #import "RITLPhotosViewController.h"
- #import "RITLPhotosDataManager.h"
- #import "JXMyFile.h"
- #import "UIImageView+FileType.h"
- #import "JXFileDetailViewController.h"
- #import "JXShareFileObject.h"
- #import "webpageVC.h"
- #import "JXSelectorVC.h"
- #ifdef Meeting_Version
- #ifdef Live_Version
- #import "JXSmallVideoViewController.h"
- #endif
- #endif
- #import "JXActionSheetVC.h"
- #import "JXCameraVC.h"
- #import "QCheckBox.h"
- #import "JXSelectCoverVC.h"
- @interface JXMyFeedVc ()<UITableViewDelegate,UITableViewDataSource,VisibelDelegate,RITLPhotosViewControllerDelegate,JXSelectorVCDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate, JXActionSheetVCDelegate, JXCameraVCDelegate,JXSelectCoverVCDelegate,JXImageViewPanDelegate,JXActionSheetVCDelegate,UITextViewDelegate>
-
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (nonatomic,strong) NSMutableArray *dataArr;
- @property (nonatomic,strong) JXMyModel *strURL;
- @property (nonatomic, strong) NSMutableArray* imageViewArray;
- @property (nonatomic, assign) CGPoint startPoint;
- @property (nonatomic, assign) CGPoint oraginPoint;
- @property (nonatomic, assign) CGPoint newPoint;
- @property (nonatomic, assign) CGPoint lastPoint;
- @property (nonatomic, assign) NSTimeInterval intoBorderTime;
- @property (nonatomic, assign) NSTimeInterval stayBorderTime;
- @property (nonatomic, assign) BOOL inBorder;
- @property (nonatomic, assign) BOOL isUpdateImage;
-
- @property (nonatomic, strong) NSMutableDictionary *gifDataDic;
- @property (weak, nonatomic) IBOutlet UILabel *placeholdL;
- @property (weak, nonatomic) IBOutlet UITextView *textView;
- @property (weak, nonatomic) IBOutlet UILabel *addIMGLb;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *textViewH;
- @property (nonatomic,strong) UIImagePickerController *picker;
- @property (nonatomic,weak) JXFeedShowView *feedShowView;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *topViewH;
- @end
- @implementation JXMyFeedVc
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self.navigationController setNavigationBarHidden:NO];
- // [self defineNavBar:@"排行榜" andRinghtBtnImg:@""];
- }
- - (IBAction)goBack:(id)sender {
- [g_navigation dismissViewController:self animated:NO];
- }
- - (void)touchAtlasButtonReturnCover:(UIImage *)img{
-
-
- }
- - (void)selectImage:(UIImage *)img toView:(JXSelectCoverVC *)view{
-
- }
- - (void) selector:(JXSelectorVC*)selector selectorAction:(NSInteger)selectIndex{
-
-
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.topViewH.constant=JX_SCREEN_HEIGHT>=812?88:64;
- //self.view.backgroundColor=kRGBColor246;
- _dataArr=[NSMutableArray array];
- _images = [NSMutableArray array];
- _tableView.tableFooterView=[UIView new];
- _picker=[UIImagePickerController new];
- _textView.delegate=self;
- CGFloat imagesHH=0;
- imagesHH=JX_SCREEN_HEIGHT>=812?90:10;
- svImages = [[UIScrollView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_addIMGLb.frame)+imagesHH, JX_SCREEN_WIDTH,80)];
- svImages.pagingEnabled = YES;
- svImages.delegate = self;
- svImages.showsVerticalScrollIndicator = NO;
- svImages.showsHorizontalScrollIndicator = NO;
- svImages.backgroundColor = [UIColor whiteColor];
- svImages.userInteractionEnabled = YES;
- [self.view addSubview:svImages];
- [self showImages];
-
- self.textView.delegate=self;
- self.textViewH.constant=JX_SCREEN_HEIGHT>=812?200:140;
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardAction:) name:UIKeyboardWillShowNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardAction:) name:UIKeyboardWillHideNotification object:nil];
- [self loadData];
-
-
- JXFeedShowView *show=[JXFeedShowView XIBJXFeedShowView];
- show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.4];
- show.frame=[UIScreen mainScreen].bounds;
- [[UIApplication sharedApplication].keyWindow addSubview:show];
- self.feedShowView=show;
- show.hidden=YES;
- [show.konwBtn22 addTarget:self action:@selector(goBckBtn) forControlEvents:UIControlEventTouchUpInside];
-
- }
-
- - (void)goBckBtn{
- [_feedShowView removeFromSuperview];
- [g_navigation dismissViewController:self animated:YES];
- }
-
- - (void)textViewDidChange:(UITextView *)textView{
-
- if (textView.text.length>0) {
- self.placeholdL.hidden=YES;
- }else{
-
- self.placeholdL.hidden=NO;
- }
-
-
- }
- /**
- * 加载最新数据
- */
- - (void)loadData{
-
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
-
- [SVProgressHUD show];
-
- [g_server getact_usermyfeedbacktypes:salt andType:@"" andToView:self];
- // [g_server getact_act_usermyfeedSubmit:salt andType:@"1" andToView:self];
- }
- -(void)showImages{
- int i;
- [g_factory removeAllChild:svImages];
-
- NSInteger n = [_images count];
- _sendBtn.enabled = n > 1 || _remark.text.length > 0;
- svImages.contentSize = CGSizeMake((n+1) * 80, svImages.frame.size.height);
- for(i=0;i<n&&i<9;i++){
- JXImageView* iv = [[JXImageView alloc]initWithFrame:CGRectMake(i*78+15, 10, 63,63)];
- iv.delegate = self;
- iv.panDelegate = self;
- iv.userInteractionEnabled = YES;
- iv.layer.cornerRadius = 6;
- iv.layer.masksToBounds = YES;
- iv.animationType = JXImageView_Animation_Line;
- iv.tag = i;
- [iv addLongPressGesture];
- [iv addTapGesture];
- iv.image = [_images objectAtIndex:i];
- [svImages addSubview:iv];
- // [iv release];
- }
- _imageViewArray = [NSMutableArray arrayWithArray:svImages.subviews];
- UIButton* btn = [self createButton:nil icon:@"add_picture" action:@selector(actionImage:) parent:svImages];
- btn.frame = CGRectMake(i*78+15, 10, 63, 63);
- btn.tag = insert_photo_tag;
-
-
- }
- -(UIButton*)createButton:(NSString*)title icon:(NSString*)icon action:(SEL)action parent:(UIView*)parent{
- UIButton* btn = [UIFactory createButtonWithImage:icon
- highlight:nil
- target:self
- selector:action];
- btn.titleEdgeInsets = UIEdgeInsetsMake(45, -60, 0, 0);
- [btn setTitle:title forState:UIControlStateNormal];
- [btn setTitleColor:HEXCOLOR(0x999999) forState:UIControlStateNormal];
- btn.titleLabel.font = g_factory.font10;
- [parent addSubview:btn];
- return btn;
- }
- - (void)tapImageView:(JXImageView *)imageView{
- [self actionImage:imageView];
- }
- -(void)actionImage:(JXImageView*)sender{
- _photoIndex = sender.tag;
-
- if(_photoIndex==insert_photo_tag&&[_images count]>8){
- [g_App showAlert:Localized(@"addMsgVC_SelNinePhoto")];
- return;
- }else if(_photoIndex==insert_photo_tag){
-
- JXActionSheetVC *actionVC = [[JXActionSheetVC alloc] initWithImages:@[] names:@[Localized(@"JX_ChoosePhoto"),Localized(@"JX_TakePhoto")]];
- actionVC.delegate = self;
- actionVC.tag = 111;
- [self presentViewController:actionVC animated:NO completion:nil];
-
- return;
- }
- LXActionSheet* _menu = [[LXActionSheet alloc]
- initWithTitle:nil delegate:self
- cancelButtonTitle:Localized(@"JX_Cencal")
- destructiveButtonTitle:Localized(@"JX_Update")
- otherButtonTitles:@[Localized(@"JX_Delete")]];
- [g_window addSubview:_menu];
- // [_menu release];
- }
-
- - (void)didClickOnButtonIndex:(LXActionSheet*)sender buttonIndex:(int)buttonIndex{
- if(buttonIndex<0)
- return;
- _nSelMenu = buttonIndex;
- [self doOutputMenu];
- }
- -(void)doOutputMenu{
- if(_nSelMenu==0){
-
- self.isUpdateImage = YES;
- [self pickImages:NO];
- }
- if(_nSelMenu==1){
-
- [_images removeObjectAtIndex:_photoIndex];
- [self showImages];
- }
- }
- -(void)pickImages:(BOOL)Multi{
- RITLPhotosViewController *photoController = RITLPhotosViewController.photosViewController;
- if (!self.isUpdateImage) {
- photoController.configuration.maxCount = 9 - _images.count;//最大的选择数目
- }else {
- photoController.configuration.maxCount = 1;//最大的选择数目
- }
- photoController.configuration.containVideo = NO;//选择类型,目前只选择图片不选择视频
-
- photoController.photo_delegate = self;
- photoController.thumbnailSize = CGSizeMake(320, 320);//缩略图的尺寸
- // photoController.defaultIdentifers = self.saveAssetIds;//记录已经选择过的资源
-
- [self presentViewController:photoController animated:true completion:^{}];
-
- }
-
- - (void)displayImages:(NSArray *)images {
- for (UIImageView *imageView in self.imageViewArray) {
- [imageView removeFromSuperview];
- }
-
- if (self.isUpdateImage) {
- _images[_photoIndex] = images.firstObject;
- }else {
- [_images addObjectsFromArray:images.mutableCopy];
- }
- self.gifDataDic = nil;
- self.gifDataDic = [NSMutableDictionary dictionary];
- for (int i = 0; i < images.count; i++) {
- UIImage *image = images[i];
- if (image.images.count > 0) {
- //NSDictionary *dic = [infos objectAtIndex:i];
- //NSData *data = [dic objectForKey:@"gifData"];
- //[self.gifDataDic setValue:data forKey:[NSString stringWithFormat:@"%d",i]];
- }
- }
- [self showImages];
-
- }
- - (void)actionSheet:(JXActionSheetVC *)actionSheet didButtonWithIndex:(NSInteger)index{
-
- // __weak typeof (self)weakSelf = self;
- // GWLPhotoLibrayController *photoSelector = [GWLPhotoLibrayController photoLibrayControllerWithBlock:^(NSArray *images) {
- // [weakSelf displayImages:images];
- // }];
- // photoSelector.maxCount = 10;
- // photoSelector.multiAlbumSelect = YES;
- // [self presentViewController:photoSelector animated:YES completion:nil];
-
- if (index == 0) {
-
- RITLPhotosViewController *photoController = RITLPhotosViewController.photosViewController;
- if (!self.isUpdateImage) {
- photoController.configuration.maxCount = 9 - _images.count;//最大的选择数目
- }else {
- photoController.configuration.maxCount = 1;//最大的选择数目
- }
- photoController.configuration.containVideo = NO;//选择类型,目前只选择图片不选择视频
-
- photoController.photo_delegate = self;
- photoController.thumbnailSize = CGSizeMake(320, 320);//缩略图的尺寸
- // photoController.defaultIdentifers = self.saveAssetIds;//记录已经选择过的资源
-
- [self presentViewController:photoController animated:YES completion:nil];
- self.maxImageCount = self.maxImageCount - (int)[_images count];
- self.isUpdateImage = NO;
- [self pickImages:YES];
-
- }else {
-
- JXCameraVC *vc = [JXCameraVC alloc];
- vc.cameraDelegate = self;
- vc.isVideo = NO;
- vc = [vc init];
- [self presentViewController:vc animated:YES completion:nil];
-
- //将sourceType设为UIImagePickerControllerSourceTypeCamera代表拍照或拍视频
- // _picker.sourceType=UIImagePickerControllerSourceTypeCamera;
- //
- // //设置拍摄照片
- //
- // _picker.cameraCaptureMode=UIImagePickerControllerCameraCaptureModePhoto;
- //
- // //设置使用手机的后置摄像头(默认使用后置摄像头)
- //
- // _picker.cameraDevice=UIImagePickerControllerCameraDeviceRear;
- //
- // //设置使用手机的前置摄像头。
- //
- // //picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
- //
- // //设置拍摄的照片允许编辑
- //
- // _picker.allowsEditing=YES;
- //
- //
- // //显示picker视图控制器
- //
- // [self presentViewController:_picker animated:YES completion:nil];
-
- }
-
-
- }
- - (void)cameraVC:(JXCameraVC *)vc didFinishWithImage:(UIImage *)image {
- [_images addObject:image];
- [self showImages];
- }
- - (void)cameraVC:(JXCameraVC *)vc didFinishWithVideoPath:(NSString *)filePath timeLen:(NSInteger)timeLen {
-
- [_images removeAllObjects];
-
- JXMediaObject* media = [[JXMediaObject alloc] init];
- media.userId = MY_USER_ID;
- media.fileName = filePath;
- media.isVideo = [NSNumber numberWithBool:YES];
- media.timeLen = [NSNumber numberWithInteger:timeLen];
- media.createTime = [NSDate date];
- // media.photoPath = filePath.absoluteString;
-
- [media insert];
- NSString* file = media.fileName;
- UIImage *image = [FileInfo getFirstImageFromVideo:file];
- // videoFile = [file copy];
- // // file = [NSString stringWithFormat:@"%@.jpg",[file stringByDeletingPathExtension]];
- // // [_images addObject:[UIImage imageWithContentsOfFile:file]];
- // [_images addObject:image];
- //
- // JXSelectCoverVC *Vc = [[JXSelectCoverVC alloc] initWithVideo:videoFile];
- // Vc.delegate = self;
- // [g_navigation pushViewController:Vc animated:YES];
- //
- // [self showVideos];
-
- }
- #pragma mark - 发送原图
- - (void)photosViewController:(UIViewController *)viewController images:(NSArray<UIImage *> *)images infos:(NSArray<NSDictionary *> *)infos {
- if (self.isUpdateImage) {
- _images[_photoIndex] = images.firstObject;
- }else {
- [_images addObjectsFromArray:images.mutableCopy];
- }
- self.gifDataDic = nil;
- self.gifDataDic = [NSMutableDictionary dictionary];
- for (int i = 0; i < images.count; i++) {
- UIImage *image = images[i];
- if (image.images.count > 0) {
- NSDictionary *dic = [infos objectAtIndex:i];
- NSData *data = [dic objectForKey:@"gifData"];
- [self.gifDataDic setValue:data forKey:[NSString stringWithFormat:@"%d",i]];
- }
- }
- [self showImages];
- }
- #pragma mark - 发送缩略图
- - (void)photosViewController:(UIViewController *)viewController thumbnailImages:(NSArray *)thumbnailImages infos:(NSArray<NSDictionary *> *)infos {
- if (self.isUpdateImage) {
- _images[_photoIndex] = thumbnailImages.firstObject;
- }else {
- [_images addObjectsFromArray:thumbnailImages.mutableCopy];
- }
-
- [self showImages];
- }
- - (void)getTouchWhenMove:(JXImageView *)imageView withTouch:(NSSet *)touch withEvent:(UIEvent *)event withLongPressGes:(UILongPressGestureRecognizer *)lpGes{
- UITouch *mytouch = touch.allObjects.lastObject;
- CGPoint inWindow = [mytouch locationInView:nil];
- if ((inWindow.x > JX_SCREEN_WIDTH - 30 && inWindow.x < JX_SCREEN_WIDTH && svImages.contentOffset.x == 0) || (inWindow.x < 30 && svImages.contentOffset.x > 0)) {
- if (_inBorder) {
- _stayBorderTime = mytouch.timestamp - _intoBorderTime;
- if (_stayBorderTime > 0.3) {
- [self changeWhenPan:imageView gesture:lpGes];
- }
- }else{
- _inBorder = YES;
- _intoBorderTime = mytouch.timestamp;
- }
- }else{
- _inBorder = NO;
- _intoBorderTime = 0;
- }
- }
- - (void)changeWhenPan:(JXImageView *)sender gesture:(UILongPressGestureRecognizer *)sender2{
- BOOL isBorderStart = NO;
- if (sender2.state == UIGestureRecognizerStateBegan) {
- [svImages setScrollEnabled:NO];
- sender.alpha = 0.5;
- self.startPoint = [sender2 locationInView:svImages];
- CGPoint inWindow = [sender2 locationInView:nil];
- if ((inWindow.x > JX_SCREEN_WIDTH - 30 && inWindow.x < JX_SCREEN_WIDTH && svImages.contentOffset.x == 0) || (inWindow.x < 30 && svImages.contentOffset.x > 0)) {
- isBorderStart = YES;
- }else{
- isBorderStart = NO;
- }
- self.oraginPoint = sender.center;
- _lastPoint = _oraginPoint;
- [self.view bringSubviewToFront:svImages];
- [svImages bringSubviewToFront:sender];
- }else if (sender2.state == UIGestureRecognizerStateChanged) {
- self.newPoint = [sender2 locationInView:svImages];
- CGFloat xChange = _newPoint.x - _startPoint.x;
- CGFloat yChange = _newPoint.y - _startPoint.y;
- sender.center = CGPointMake(_oraginPoint.x + xChange, _oraginPoint.y + yChange);
- CGPoint inWindow = [sender2 locationInView:nil];
- if (isBorderStart) {
- if ((inWindow.x < JX_SCREEN_WIDTH - 30 && svImages.contentOffset.x == 0) && (inWindow.x > 30 && svImages.contentOffset.x > 0)){
- isBorderStart = NO;
- }
- }
- if (inWindow.x < 30 && svImages.contentOffset.x > 0 && !isBorderStart && _stayBorderTime > 0.3) {
- for (int num = 0; num <_imageViewArray.count; num++) {
- JXImageView *imgView = _imageViewArray[num];
- if (imgView.tag != num) {
- [_imageViewArray exchangeObjectAtIndex:num withObjectAtIndex:imgView.tag];
- }
- }
- [UIView animateWithDuration:0.3 animations:^{
- [svImages setContentOffset:CGPointMake(0, 0)];
- }];
- _stayBorderTime = 0;
- _inBorder = NO;
- NSInteger index = sender.tag;
- for (NSInteger i = index - 1; i > -1; i--) {
- JXImageView *imgView = _imageViewArray[i];
- [_images exchangeObjectAtIndex:imgView.tag withObjectAtIndex:imgView.tag + 1];
- [UIView animateWithDuration:0.5 animations:^{
- imgView.tag = imgView.tag + 1;
- CGPoint center = imgView.center;
- imgView.center = _lastPoint;
- _lastPoint = center;
- }];
- }
- sender.tag = 0;
- }else if (inWindow.x > g_window.frame.size.width - 30 && _newPoint.x < svImages.contentSize.width && !isBorderStart && _stayBorderTime > 0.3) {
- for (int num = 0; num <_imageViewArray.count; num++) {
- JXImageView *imgView = _imageViewArray[num];
- if (imgView.tag != num) {
- [_imageViewArray exchangeObjectAtIndex:num withObjectAtIndex:imgView.tag];
- }
- }
- [UIView animateWithDuration:0.3 animations:^{
- [svImages setContentOffset:CGPointMake(svImages.contentSize.width - JX_SCREEN_WIDTH, 0)];
- }];
- _stayBorderTime = 0;
- _inBorder = NO;
- NSInteger index = sender.tag;
- for (NSInteger i = index + 1; i < _imageViewArray.count; i++) {
- JXImageView *imgView = _imageViewArray[i];
- [_images exchangeObjectAtIndex:imgView.tag withObjectAtIndex:imgView.tag - 1];
- [UIView animateWithDuration:0.5 animations:^{
- imgView.tag = imgView.tag - 1;
- CGPoint center = imgView.center;
- imgView.center = _lastPoint;
- _lastPoint = center;
- }];
- }
- sender.tag = _imageViewArray.count - 1;
- }else{
- for (int num = 0; num <_imageViewArray.count; num++) {
- JXImageView *imgView = _imageViewArray[num];
- if (imgView.tag != num) {
- [_imageViewArray exchangeObjectAtIndex:num withObjectAtIndex:imgView.tag];
- }
- }
- for (NSInteger i = 0;i < _imageViewArray.count; i++) {
- JXImageView * imgView = _imageViewArray[i];
- if (CGRectContainsPoint(imgView.frame, _newPoint)) {
- if (imgView == sender) {
- continue;
- }
- [UIView animateWithDuration:0.3 animations:^{
- CGPoint point = imgView.center;
- imgView.center = _lastPoint;
- _lastPoint = point;
- }];
- [_images exchangeObjectAtIndex:imgView.tag withObjectAtIndex:sender.tag];
- NSInteger l = imgView.tag;
- imgView.tag = sender.tag;
- sender.tag = l;
- }
- }
- if (!CGRectContainsPoint(svImages.bounds, _newPoint)) {
- [sender2 setState:UIGestureRecognizerStateEnded];
- }
- }
-
- }else if(sender2.state == UIGestureRecognizerStateEnded) {
- sender.alpha = 1;
- [UIView animateWithDuration:0.3 animations:^{
- sender.center = _lastPoint;
- }];
- [svImages setScrollEnabled:YES];
- }
- }
-
- /**
- * 提交
- */
- - (IBAction)tijiaoBtn:(id)sender {
-
- if (_strURL.name.length==0) {
- [SVProgressHUD showWithStatus:@"请选择您的反馈类型"];
- [SVProgressHUD dismissWithDelay:1.0];
- return;
- }
-
- [SVProgressHUD show];
-
- if(_images.count){
- [g_server uploadFile:_images audio:@"" video:@"" file:@"fileFile" type:2+1 validTime:@"-1" timeLen:0 toView:self gifDic:self.gifDataDic];
- }else{
-
-
- JXMyModel *model=_strURL;
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- [g_server getMyFeedSubmit:salt type:model.id desc:_textView.text img:@"" targetUserId:g_server.myself.userId andToView:self];
- }
-
- }
- #pragma mark --- 请求成功
- -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
- [SVProgressHUD dismiss];
-
- //NSLog(@"dict: %@ --- arry: %@",dict ,array1 );
-
- if([aDownload.action isEqualToString:act_usermyfeedbacktypes])
- {
- _dataArr=[JXMyModel mj_objectArrayWithKeyValuesArray:array1];
- [_tableView reloadData];
- [_tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionTop];
-
- }
- else if([aDownload.action isEqualToString:act_feedbacksubmit])
- {
-
-
- _feedShowView.hidden=NO;
-
- }
- else if([aDownload.action isEqualToString:act_UploadFile]) //上传图片
- {
-
-
- NSDictionary *dataD;
- NSMutableArray *array = [NSMutableArray arrayWithArray:[dict objectForKey:@"images"]];
- dataD = dict;
- NSMutableString *stringM=[NSMutableString string];
- [array enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
-
- [stringM appendFormat:@",%@",obj[@"tUrl"]];
- }];
- [stringM deleteCharactersInRange:NSMakeRange(0,1)];
-
- // [g_server addMessage:@"text" type:3 data:dataD flag:3 visible:_visible lookArray:@[] coor:_coor location:nil remindArray:@[] lable:[UILabel new] isAllowComment:YES toView:self];
-
- JXMyModel *model=_strURL;
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
-
- [g_server getMyFeedSubmit:salt type:model.id desc:_textView.text img:[stringM copy] targetUserId:g_server.myself.userId andToView:self];
-
- }
-
-
-
- }
- - (NSString *)getNumberFromStr:(NSString *)str
- {
- NSCharacterSet *nonDigitCharacterSet = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
- return[[str componentsSeparatedByCharactersInSet:nonDigitCharacterSet] componentsJoinedByString:@""];
- }
- -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
- [SVProgressHUD dismiss];
- NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
- if([errorCode isEqualToString:@"权限验证失败"])
- {
- if ([aDownload.action isEqualToString:act_GetBalanceRedTimes])
- {
-
- }else{
-
- }
- }
-
- return [errorCode intValue];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-
- return _dataArr.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- JXMyFeedCell *cell=[JXMyFeedCell cellWithTableView:tableView];
- JXMyModel *nameStr=_dataArr[indexPath.row];
-
- _strURL=[_dataArr firstObject];
-
- cell.model=nameStr;
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
-
- JXMyModel *nameStr=_dataArr[indexPath.row];
- _strURL=nameStr;
- }
- -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
- [self.view endEditing:YES];
- }
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
- [self.view endEditing:YES];
- }
- // 键盘监听事件
- - (void)keyboardAction:(NSNotification*)sender{
- // 通过通知对象获取键盘frame: [value CGRectValue]
- NSDictionary *useInfo = [sender userInfo];
- NSValue *value = [useInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
-
-
- if([sender.name isEqualToString:UIKeyboardWillShowNotification]){
- int aa = [value CGRectValue].size.height;
- self.view.xmg_y=-120;
- }else{
- self.view.xmg_y=0;
- //self.view.frame = CGRectMake(0, 44, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT-JX_SCREEN_TOP-44);
- }
- }
-
- @end
|