v0.8.0
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@@ -38,11 +38,11 @@
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ns1-dj-ePW">
|
||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ns1-dj-ePW">
|
||||
<rect key="frame" x="68.5" y="289" width="238" height="88"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="客服热线: 400-0000-000" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fQZ-vC-DAg">
|
||||
<rect key="frame" x="44" y="25" width="151" height="17"/>
|
||||
<rect key="frame" x="43.5" y="25" width="151" height="17"/>
|
||||
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="12"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
||||
@@ -25,16 +25,27 @@
|
||||
@property(nonatomic,copy) NSString *xinCode;
|
||||
@property(nonatomic,strong) NSTimer*timer;
|
||||
@property(nonatomic) NSInteger time;
|
||||
@property(nonatomic,strong) UIButton *codeBtn;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation GiGaChangePhoneNumberVC
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (self.timer) {
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self addNavTitile:@"修改手机号"];
|
||||
_nextSteep = NO;
|
||||
_time = 60;
|
||||
|
||||
|
||||
// Do any additional setup after loading the view from its nib.
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.delegate = self;
|
||||
@@ -66,13 +77,23 @@
|
||||
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserChangeMobleCell" owner:self options:nil] lastObject];
|
||||
|
||||
}
|
||||
|
||||
[cell.codeSendBtn addTarget:self action:@selector(sendCodeBtnAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
self.codeBtn = cell.codeSendBtn;
|
||||
|
||||
|
||||
if (_nextSteep) {
|
||||
cell.numberTexFiled.userInteractionEnabled = YES;
|
||||
cell.numberTexFiled.text = @"";
|
||||
cell.numberTexFiled.placeholder = @"请输入新手机号";
|
||||
cell.codeTexFiled.text = @"";
|
||||
cell.codeTexFiled.placeholder = @"请输入新手机验证码";
|
||||
|
||||
|
||||
cell.oldBtn.backgroundColor = GIGARGB(227, 227, 227, 1);
|
||||
NSAttributedString *att = [GiGaHelper stringWithText:@"发送验证码" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(10) leterSpace:0];
|
||||
[cell.codeSendBtn setAttributedTitle:att forState:UIControlStateNormal];
|
||||
cell.codeSendBtn.backgroundColor = GIGARGB(181, 14, 14, 1);
|
||||
cell.codeSendBtn.userInteractionEnabled = YES;
|
||||
|
||||
NSAttributedString *atti1 = [GiGaHelper stringWithText:@"1.验证原号码" textColor:GIGARGB(165,165, 165, 1) textFont:GIGA_TEXTFONTMEDIUM(13) leterSpace:0];
|
||||
[cell.oldBtn setAttributedTitle:atti1 forState:UIControlStateNormal];
|
||||
@@ -122,10 +143,10 @@
|
||||
[nextBtn addTarget:self action:@selector(nextBtnAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
nextBtn.frame = CGRectMake((KMainW - 244)/2 , 5, 244, 41);
|
||||
if (_nextSteep) {
|
||||
NSAttributedString *attrititle = [GiGaHelper stringWithText:@"下一步" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(16) leterSpace:0];
|
||||
NSAttributedString *attrititle = [GiGaHelper stringWithText:@"完成" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(16) leterSpace:0];
|
||||
[nextBtn setAttributedTitle:attrititle forState:UIControlStateNormal];
|
||||
}else{
|
||||
NSAttributedString *attrititle = [GiGaHelper stringWithText:@"完成" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(16) leterSpace:0];
|
||||
NSAttributedString *attrititle = [GiGaHelper stringWithText:@"下一步" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(16) leterSpace:0];
|
||||
[nextBtn setAttributedTitle:attrititle forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
@@ -160,7 +181,7 @@
|
||||
#pragma mark 下一步 Or 完成
|
||||
-(void)nextBtnAction:(UIButton *)btn{
|
||||
|
||||
|
||||
|
||||
if (_nextSteep) {
|
||||
GILog(@"完成");
|
||||
|
||||
@@ -180,8 +201,7 @@
|
||||
}
|
||||
|
||||
[self verifyPhoneCode:cell.numberTexFiled.text code:cell.codeTexFiled.text btn:btn];
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
GILog(@"下一步");
|
||||
|
||||
@@ -195,6 +215,7 @@
|
||||
GiGaUser *user = [[GiGaUserManager shareUser] getCurrentUser];
|
||||
if (!user.mobile || [user.mobile isKindOfClass:[NSNull class]]) {
|
||||
GILog(@"手机号为空");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -207,8 +228,10 @@
|
||||
|
||||
GiGaUser *user = [[GiGaUserManager shareUser] getCurrentUser];
|
||||
NSString *oldphone = user.mobile;
|
||||
GIGaUserChangeMobleCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0
|
||||
inSection:0]];
|
||||
|
||||
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath: kApiChangePhone method:RequestPostMethod parms:@{@"oldMobile":oldphone,@"newMobile":xinNumber,@"oldVerifiedCode":self.oldCode,@"newVerifiedCode":self.xinCode}];
|
||||
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath: kApiChangePhone method:RequestPostMethod parms:@{@"oldMobile":oldphone,@"newMobile":xinNumber,@"oldVerifiedCode":self.oldCode,@"newVerifiedCode":cell.codeTexFiled.text}];
|
||||
[api requstDataWithResult:^(GiGaAPIResult *result) {
|
||||
btn.userInteractionEnabled = YES;
|
||||
[self.view hideToastActivity];
|
||||
@@ -226,18 +249,22 @@
|
||||
-(void)sendCodeBtnAction:(UIButton *)btn{
|
||||
|
||||
|
||||
|
||||
if (_nextSteep) {
|
||||
GIGaUserChangeMobleCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
|
||||
if (cell.numberTexFiled.text.length == 0) {
|
||||
GIGA_ShowToast(@"请输新手机号");
|
||||
return;
|
||||
}
|
||||
if (![GiGaHelper isPhoneNumber:cell.numberTexFiled.text]) {
|
||||
GIGA_ShowToast(@"请输入正确手机号");
|
||||
return;
|
||||
}
|
||||
|
||||
btn.userInteractionEnabled = NO;
|
||||
[self startTimer:btn];
|
||||
self.time = 60;
|
||||
self.xinCode = cell.codeTexFiled.text;
|
||||
[self sendCodeWith:cell.numberTexFiled.text];
|
||||
//发送新手机验证码
|
||||
[self sendCodeWith:cell.numberTexFiled.text
|
||||
codebtn:btn];
|
||||
|
||||
}else{
|
||||
|
||||
@@ -247,45 +274,72 @@
|
||||
return;
|
||||
}
|
||||
|
||||
btn.userInteractionEnabled = NO;
|
||||
[self startTimer:btn];
|
||||
[self sendCodeWith:user.mobile];
|
||||
//发送旧手机验证码
|
||||
[self sendCodeWith:user.mobile codebtn:btn];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//计时
|
||||
-(void)startTimer:(UIButton *)btn{
|
||||
-(void)startTimer{
|
||||
[self cancleTimerCount];
|
||||
self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(startTimercount) userInfo:nil repeats:YES];
|
||||
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode];
|
||||
|
||||
}
|
||||
|
||||
-(void)startTimercount{
|
||||
|
||||
GIGaUserChangeMobleCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0
|
||||
inSection:0]];
|
||||
cell.codeSendBtn.backgroundColor = [UIColor lightGrayColor];
|
||||
cell.codeSendBtn.userInteractionEnabled = NO;
|
||||
__weak typeof(cell) weakCell = cell;
|
||||
if (_time>0) {
|
||||
_timer = [NSTimer scheduledTimerWithTimeInterval:1 count:60 callback:^{
|
||||
NSString *timeStr=[NSString stringWithFormat:@"%lds",(long)self->_time];
|
||||
[btn setTitle:timeStr forState:UIControlStateNormal];
|
||||
self->_time--;
|
||||
weakify(self);
|
||||
weakSelf.time -- ;
|
||||
|
||||
NSString *timeStr=[NSString stringWithFormat:@"%lds",(long)weakSelf.time];
|
||||
NSAttributedString *att = [GiGaHelper stringWithText:timeStr textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(10) leterSpace:0];
|
||||
[weakCell.codeSendBtn setAttributedTitle:att forState:UIControlStateNormal];
|
||||
|
||||
if (weakSelf.time==0) {
|
||||
|
||||
if (self->_time==0) {
|
||||
[self codeBtnStateNormal];
|
||||
}
|
||||
[weakSelf codeBtnStateNormal];
|
||||
weakCell.codeSendBtn.userInteractionEnabled = YES;
|
||||
weakCell.codeSendBtn.backgroundColor = GIGARGB(181, 14, 14, 1);
|
||||
[self cancleTimerCount];
|
||||
|
||||
}];
|
||||
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
-(void)sendCodeWith:(NSString *)phone{
|
||||
-(void)cancleTimerCount{
|
||||
|
||||
if (self.timer) {
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)sendCodeWith:(NSString *)phone codebtn:(UIButton *)btn{
|
||||
NSString *utl = nil;
|
||||
if (_nextSteep) {
|
||||
utl= kApiChangeMobleCode;
|
||||
utl= kApiChangeMobleNewCode;
|
||||
}else{
|
||||
utl= kApiSendPhoneCode;
|
||||
utl= kApiChangeMobleOldCode;
|
||||
}
|
||||
|
||||
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:utl method:RequestPostMethod parms:@{@"mobile":phone}];
|
||||
[api requstDataWithResult:^(GiGaAPIResult *result) {
|
||||
|
||||
if (result.success) {
|
||||
|
||||
[self startTimer];
|
||||
GIGA_ShowToast(@"已发送");
|
||||
}else{
|
||||
[self codeBtnStateNormal];
|
||||
|
||||
GIGA_ShowToast(result.message);
|
||||
}
|
||||
}];
|
||||
@@ -293,12 +347,11 @@
|
||||
|
||||
-(void)codeBtnStateNormal{
|
||||
|
||||
NSAttributedString *att = [GiGaHelper stringWithText:@"发送验证码" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(10) leterSpace:0];
|
||||
[self.codeBtn setAttributedTitle:att forState:UIControlStateNormal];
|
||||
|
||||
if (self.timer) {
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
}
|
||||
self.time =60;
|
||||
self.codeBtn.userInteractionEnabled = YES;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -318,12 +371,14 @@
|
||||
[self finishBtn:btn wtihNewPhone:phonenumber];
|
||||
|
||||
}else{
|
||||
|
||||
btn.userInteractionEnabled = YES;
|
||||
[self.view hideToastActivity];
|
||||
self.nextSteep = YES;
|
||||
self.oldCode = code;
|
||||
[self codeBtnStateNormal];
|
||||
[self.tableView reloadData];
|
||||
[self codeBtnStateNormal];
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
@@ -334,10 +389,7 @@
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)dealloc{
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#import "GiGaFeedBackKindView.h"
|
||||
#import "GIGaUserFileHelper.h"
|
||||
#import "GiGaServerConfig.h"
|
||||
|
||||
@interface GiGaFeedBackViewController ()
|
||||
#import <Photos/Photos.h>
|
||||
@interface GiGaFeedBackViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
|
||||
@property(nonatomic,strong) NSMutableArray *imagesUrl;
|
||||
@property(nonatomic,copy) NSString *kinCode;
|
||||
@property(nonatomic,strong) UIButton *tijiaoBtn;
|
||||
@@ -58,9 +58,9 @@
|
||||
[footer addSubview:btn];
|
||||
self.tijiaoBtn = btn;
|
||||
self.tableView.tableFooterView = footer;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return 4;
|
||||
}
|
||||
@@ -96,16 +96,18 @@
|
||||
|
||||
__weak typeof(cell) weakCell = cell;
|
||||
cell.pickerBalock = ^{
|
||||
[[SJPhotoPicker shareSJPhotoPicker] showPhotoPickerToController:self pickedAssets:^(NSArray<PHAsset *> *assets) {
|
||||
|
||||
if ((weakCell.images.count + assets.count) > 6) {
|
||||
GIGA_ShowToast(@"最多六张");
|
||||
return ;
|
||||
}
|
||||
[weakCell.images addObjectsFromArray:assets];
|
||||
[weakCell.collectionView reloadData];
|
||||
|
||||
}];
|
||||
// [[SJPhotoPicker shareSJPhotoPicker] showPhotoPickerToController:self pickedAssets:^(NSArray<PHAsset *> *assets) {
|
||||
//
|
||||
// if ((weakCell.images.count + assets.count) > 6) {
|
||||
// GIGA_ShowToast(@"最多六张");
|
||||
// return ;
|
||||
// }
|
||||
// [weakCell.images addObjectsFromArray:assets];
|
||||
// [weakCell.collectionView reloadData];
|
||||
//
|
||||
//
|
||||
// }];
|
||||
[self showAcitonSheet];
|
||||
};
|
||||
|
||||
return cell;
|
||||
@@ -200,36 +202,29 @@
|
||||
|
||||
dic = @{@"type":self.kinCode,@"content":contencell.contentFiled.text,@"contact":qqcom
|
||||
};
|
||||
//图片非必选
|
||||
if (self.imagesUrl.count <= 0) {
|
||||
//未选择图片 设置空数组
|
||||
[self uploadFeedinfo:dic imgUrlList:self.imagesUrl];
|
||||
|
||||
}else{
|
||||
////获取图片链接
|
||||
[self uploadImags:dic];
|
||||
}
|
||||
|
||||
|
||||
[self uploadImags:dic];
|
||||
}
|
||||
|
||||
//先上传图片获取到 imageurls 再 提交内容信息
|
||||
//先上传图片获取到 imageurls
|
||||
-(void)uploadImags:(NSDictionary *)params{
|
||||
[self.imagesUrl removeAllObjects];
|
||||
|
||||
GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]];
|
||||
NSArray *names =cell.imageNames;
|
||||
if (names.count <= 0) {
|
||||
GIGA_ShowToast(@"请选择图片");
|
||||
//图片非必须传
|
||||
[self uploadFeedinfo:params imgUrlList:self.imagesUrl];
|
||||
GILog(@"未选择图片");
|
||||
return;
|
||||
}
|
||||
NSLog(@"names:%@",names);
|
||||
[self.view makeToastActivity:CSToastPositionCenter];
|
||||
//.串行队列同步执行:任务都在当前线程执行(同步),并且顺序执行(串行)
|
||||
//依次上传一次一张
|
||||
dispatch_queue_t queue = dispatch_queue_create("serialQueue", DISPATCH_QUEUE_SERIAL);
|
||||
|
||||
|
||||
|
||||
for (NSUInteger i= 0; i < names.count; i ++) {
|
||||
|
||||
dispatch_sync(queue, ^{
|
||||
@@ -248,9 +243,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 单张上传
|
||||
|
||||
-(void)uploadImage:(NSData *)imageData name:(NSString *)name info:(NSDictionary *)info totalCount:(NSInteger)count{
|
||||
[self.view makeToastActivity:CSToastPositionCenter];
|
||||
self.tijiaoBtn.userInteractionEnabled = NO;
|
||||
@@ -278,6 +271,7 @@
|
||||
[GiGaBaseAPiRequest userTokenTimeOutGologinFromVC:self];
|
||||
|
||||
}else{
|
||||
|
||||
GIGA_ShowToast(result.message);
|
||||
self.tijiaoBtn.userInteractionEnabled = YES;
|
||||
}
|
||||
@@ -322,6 +316,7 @@
|
||||
}
|
||||
//多张
|
||||
-(void)mutipuleUpload{
|
||||
|
||||
// [GiGaNetManager uploadImage:kUploadFeed imageNames:names parms:@{@"file":@"file"} responseBlock:^(NSDictionary *responseDict, NSDictionary *responseHeaderFields, NSError *error) {
|
||||
// [self.view hideToastActivity];
|
||||
// if (error) {
|
||||
@@ -352,6 +347,152 @@
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
-(void)showAcitonSheet{
|
||||
|
||||
[self jxt_showActionSheetWithTitle:@"选择图片" message:@"" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
|
||||
|
||||
alertMaker.addActionDefaultTitle(@"拍照");
|
||||
alertMaker.addActionDefaultTitle(@"相册");
|
||||
alertMaker.addActionCancelTitle(@"取消");
|
||||
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
|
||||
|
||||
if (buttonIndex == 0) {
|
||||
[self satartCamera];
|
||||
}else if (buttonIndex == 1){
|
||||
[self fromAlbums];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)fromAlbums{
|
||||
|
||||
GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]];
|
||||
[[SJPhotoPicker shareSJPhotoPicker] showPhotoPickerToController:self pickedAssets:^(NSArray<PHAsset *> *assets) {
|
||||
|
||||
if (assets.count == 0) {
|
||||
return ;
|
||||
}
|
||||
|
||||
for (NSInteger i= 0; i < assets.count; i++) {
|
||||
|
||||
|
||||
[cell.images addObject:assets[i]];
|
||||
if ((cell.images.count) == 6) {
|
||||
GIGA_ShowToast(@"最多六张");
|
||||
break;
|
||||
}
|
||||
}
|
||||
[cell.collectionView reloadData];
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void)satartCamera{
|
||||
|
||||
GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]];
|
||||
if ((cell.images.count + 1) > 6) {
|
||||
GIGA_ShowToast(@"最多六张");
|
||||
return ;
|
||||
}
|
||||
|
||||
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; imagePickerController.allowsEditing = YES;
|
||||
|
||||
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
|
||||
|
||||
//权限判断应用是否有使用相机的权限
|
||||
NSString *mediaType = AVMediaTypeVideo;//读取媒体类型
|
||||
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];//读取设备授权状态
|
||||
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied){
|
||||
NSString *errorStr = @"应用相机权限受限,请在设置中启用";
|
||||
[self jxt_showAlertWithTitle:@"" message:errorStr appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
|
||||
alertMaker.addActionCancelTitle(@"取消");
|
||||
alertMaker.addActionDefaultTitle(@"去开启");
|
||||
|
||||
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
|
||||
|
||||
if (buttonIndex == 1) {
|
||||
|
||||
NSString *urlStr = @"App-Prefs:root=Photos";
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr] options:@{} completionHandler:nil];
|
||||
} else {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
}
|
||||
}];
|
||||
return;
|
||||
}
|
||||
// 设置数据源
|
||||
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
|
||||
[self presentViewController:imagePickerController animated:YES completion:nil];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
|
||||
[picker dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<UIImagePickerControllerInfoKey,id> *)info
|
||||
{
|
||||
[picker dismissViewControllerAnimated:YES completion:nil];
|
||||
GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]];
|
||||
|
||||
UIImage*imge=[info objectForKey:UIImagePickerControllerEditedImage];
|
||||
// 保存相片到相机胶卷
|
||||
NSError *error = nil;
|
||||
//__block PHObjectPlaceholder *createdAsset = nil;
|
||||
NSMutableArray *imageIds = [NSMutableArray array];
|
||||
[[PHPhotoLibrary sharedPhotoLibrary] performChangesAndWait:^{
|
||||
PHAssetChangeRequest *req = [PHAssetChangeRequest creationRequestForAssetFromImage:imge];
|
||||
[imageIds addObject:req.placeholderForCreatedAsset.localIdentifier];
|
||||
|
||||
} error:&error];
|
||||
|
||||
if (error) {
|
||||
NSLog(@"%@",error.localizedDescription);
|
||||
|
||||
}else{
|
||||
|
||||
__block PHAsset *imageAsset = nil;
|
||||
PHFetchResult *result = [PHAsset fetchAssetsWithLocalIdentifiers:imageIds options:nil];
|
||||
[result enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
imageAsset = obj;
|
||||
*stop = YES;
|
||||
}];
|
||||
|
||||
if (imageAsset) {
|
||||
|
||||
[cell.images addObject:imageAsset];
|
||||
[cell.collectionView reloadData];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - < 获取相册里的所有图片的PHAsset对象 >
|
||||
- (NSArray *)getAllPhotosAssetInAblumCollection:(PHAssetCollection *)assetCollection ascending:(BOOL)ascending {
|
||||
// 存放所有图片对象
|
||||
NSMutableArray *assets = [NSMutableArray array];
|
||||
// 是否按创建时间排序
|
||||
PHFetchOptions *option = [[PHFetchOptions alloc] init]; option.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:ascending]]; option.predicate = [NSPredicate predicateWithFormat:@"mediaType == %ld", PHAssetMediaTypeImage];
|
||||
// 获取所有图片对象
|
||||
PHFetchResult *result = [PHAsset fetchAssetsInAssetCollection:assetCollection options:option];
|
||||
// 遍历
|
||||
[result enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
[assets addObject:asset];
|
||||
|
||||
}];
|
||||
return assets;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#import "GiGaNetManager.h"
|
||||
#import "GiGaServerConfig.h"
|
||||
#import "GiGaAPIResult.h"
|
||||
#import "JobModel.h"
|
||||
|
||||
@interface GiGaUserViewController ()<LYSDatePickerSelectDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
|
||||
@property (nonatomic,strong) GiGaUser *user;
|
||||
@@ -63,6 +64,7 @@
|
||||
}
|
||||
|
||||
-(void)creatTab{
|
||||
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
@@ -134,7 +136,7 @@
|
||||
|
||||
}
|
||||
[cell loadCellData:indexPath user:self.user];
|
||||
//0 女 1 男
|
||||
//2 女 1 男
|
||||
weakify(self);
|
||||
[cell userSelectSexAction:^(int sex) {
|
||||
weakSelf.user.sexCode = sex;
|
||||
@@ -166,8 +168,9 @@
|
||||
}];
|
||||
}];
|
||||
[cell setButtnImage:self.jobSpread with:self.jobArr];
|
||||
[cell userSelectjob:^(NSString *title) {
|
||||
self.user.occupationCode = title;
|
||||
[cell userSelectjob:^(JobModel *job) {
|
||||
self.user.occupationCode = job.dictCode;
|
||||
self.user.occupationName = job.dictLabel;
|
||||
|
||||
[UIView performWithoutAnimation:^{
|
||||
[tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:3 inSection:2]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
@@ -372,11 +375,12 @@
|
||||
GiGaBaseAPiRequest *api =[GiGaBaseAPiRequest initWithRequestPath:kApiOccuption method:RequestPostMethod parms:param];
|
||||
[api requstDataWithResult:^(GiGaAPIResult *result) {
|
||||
if (result.success) {
|
||||
// GILog(@"%@",result.dic);
|
||||
GILog(@"%@",result.dic);
|
||||
NSDictionary *dic = result.dic;
|
||||
NSArray *josA = dic[@"list"];
|
||||
for (NSDictionary *jobDic in josA ) {
|
||||
[self.jobArr addObject:jobDic[@"dictLabel"]];
|
||||
JobModel *mdel = [[JobModel alloc] initWithDictionary:jobDic error:nil];
|
||||
[self.jobArr addObject:mdel];
|
||||
}
|
||||
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:3] withRowAnimation:UITableViewRowAnimationNone];
|
||||
|
||||
@@ -395,7 +399,8 @@
|
||||
|
||||
-(void)showCameraAndPhotoAlert{
|
||||
|
||||
UIAlertController *alertSheet = [UIAlertController alertControllerWithTitle:@"选择头像" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; imagePickerController.allowsEditing = YES;
|
||||
UIAlertController *alertSheet = [UIAlertController alertControllerWithTitle:@"选择头像" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; imagePickerController.allowsEditing = YES;
|
||||
|
||||
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
|
||||
UIAlertAction *cameraAction = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
|
||||
@@ -87,7 +87,14 @@
|
||||
cell.timeLabe.text = [NSString stringWithFormat:@"%ld",(long)self.totalMinute];
|
||||
|
||||
if (self.exquisitePercent) {
|
||||
cell.rankLabe.text = [NSString stringWithFormat:@"本月超过%@用户",self.exquisitePercent];
|
||||
NSString *text = [NSString stringWithFormat:@"本月超过%@用户",self.exquisitePercent];
|
||||
NSString *percent = self.exquisitePercent;
|
||||
NSRange range = [text rangeOfString:percent];
|
||||
NSMutableAttributedString *atttri =[[NSMutableAttributedString alloc] initWithString:text];
|
||||
[atttri addAttributes:@{NSFontAttributeName:GIGA_TEXTFONTMEDIUM(16)} range:range];
|
||||
//cell.rankLabe.text = [NSString stringWithFormat:@"本月超过%@用户",self.exquisitePercent];
|
||||
cell.rankLabe.attributedText = atttri;
|
||||
|
||||
}
|
||||
|
||||
[cell.guizeBtn addTarget:self action:@selector(guizeShow) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#import "GIGaAboutUsVC.h"
|
||||
#import "GiGaFeedBackViewController.h"
|
||||
#import "GiGaWebViewController.h"
|
||||
#import "GiGaServerConfig.h"
|
||||
|
||||
@interface GiSysSettingsVC ()
|
||||
|
||||
@end
|
||||
@@ -80,9 +82,9 @@
|
||||
}else if (indexPath.row == 3){
|
||||
// AppVerionDescriptionVC *verVC =[[AppVerionDescriptionVC alloc] init];
|
||||
// [self.navigationController pushViewController:verVC animated:YES];
|
||||
|
||||
//版本说明
|
||||
GiGaWebViewController *webVC = [[GiGaWebViewController alloc] init];
|
||||
webVC.url = @"";
|
||||
webVC.url = kIMPRITNT;
|
||||
webVC.souceType = WebSourceTypeUrlLink;
|
||||
[self.navigationController pushViewController:webVC animated:YES];
|
||||
|
||||
@@ -149,6 +151,7 @@
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
//http://yts.s1.natapp.cc/mask/clearZear.html
|
||||
-(void)userlogOut{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user