添加了七牛的SDK 并且上传头像
This commit is contained in:
2
Podfile
2
Podfile
@@ -22,6 +22,8 @@ target 'xplan-ios' do
|
|||||||
pod 'SZTextView'
|
pod 'SZTextView'
|
||||||
#轮播图
|
#轮播图
|
||||||
pod 'SDCycleScrollView'
|
pod 'SDCycleScrollView'
|
||||||
|
#上传图片
|
||||||
|
pod 'Qiniu'
|
||||||
#登录的
|
#登录的
|
||||||
pod 'mob_sharesdk'
|
pod 'mob_sharesdk'
|
||||||
pod 'mob_sharesdk/ShareSDKPlatforms/QQ'
|
pod 'mob_sharesdk/ShareSDKPlatforms/QQ'
|
||||||
|
10
Podfile.lock
10
Podfile.lock
@@ -15,6 +15,7 @@ PODS:
|
|||||||
- AFNetworking/UIKit (4.0.1):
|
- AFNetworking/UIKit (4.0.1):
|
||||||
- AFNetworking/NSURLSession
|
- AFNetworking/NSURLSession
|
||||||
- FFPopup (1.1.5)
|
- FFPopup (1.1.5)
|
||||||
|
- HappyDNS (0.3.17)
|
||||||
- Masonry (1.1.0)
|
- Masonry (1.1.0)
|
||||||
- MBProgressHUD (1.2.0)
|
- MBProgressHUD (1.2.0)
|
||||||
- MJExtension (3.3.0)
|
- MJExtension (3.3.0)
|
||||||
@@ -34,6 +35,8 @@ PODS:
|
|||||||
- MOBFoundation (>= 3.2.9)
|
- MOBFoundation (>= 3.2.9)
|
||||||
- MOBFoundation (3.2.27)
|
- MOBFoundation (3.2.27)
|
||||||
- NTESQuickPass (2.1.9)
|
- NTESQuickPass (2.1.9)
|
||||||
|
- Qiniu (8.3.2):
|
||||||
|
- HappyDNS (~> 0.3.17)
|
||||||
- ReactiveObjC (3.1.1)
|
- ReactiveObjC (3.1.1)
|
||||||
- SDCycleScrollView (1.82):
|
- SDCycleScrollView (1.82):
|
||||||
- SDWebImage (>= 5.0.0)
|
- SDWebImage (>= 5.0.0)
|
||||||
@@ -54,6 +57,7 @@ DEPENDENCIES:
|
|||||||
- mob_sharesdk/ShareSDKPlatforms/QQ
|
- mob_sharesdk/ShareSDKPlatforms/QQ
|
||||||
- mob_sharesdk/ShareSDKPlatforms/WeChat
|
- mob_sharesdk/ShareSDKPlatforms/WeChat
|
||||||
- NTESQuickPass (~> 2.1.6)
|
- NTESQuickPass (~> 2.1.6)
|
||||||
|
- Qiniu
|
||||||
- ReactiveObjC
|
- ReactiveObjC
|
||||||
- SDCycleScrollView
|
- SDCycleScrollView
|
||||||
- SDWebImage
|
- SDWebImage
|
||||||
@@ -64,12 +68,14 @@ SPEC REPOS:
|
|||||||
trunk:
|
trunk:
|
||||||
- AFNetworking
|
- AFNetworking
|
||||||
- FFPopup
|
- FFPopup
|
||||||
|
- HappyDNS
|
||||||
- Masonry
|
- Masonry
|
||||||
- MBProgressHUD
|
- MBProgressHUD
|
||||||
- MJExtension
|
- MJExtension
|
||||||
- mob_sharesdk
|
- mob_sharesdk
|
||||||
- MOBFoundation
|
- MOBFoundation
|
||||||
- NTESQuickPass
|
- NTESQuickPass
|
||||||
|
- Qiniu
|
||||||
- ReactiveObjC
|
- ReactiveObjC
|
||||||
- SDCycleScrollView
|
- SDCycleScrollView
|
||||||
- SDWebImage
|
- SDWebImage
|
||||||
@@ -79,18 +85,20 @@ SPEC REPOS:
|
|||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
|
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
|
||||||
FFPopup: a208dcee8db3e54ec4a88fcd6481f6f5d85b7a83
|
FFPopup: a208dcee8db3e54ec4a88fcd6481f6f5d85b7a83
|
||||||
|
HappyDNS: 848ef73e24f2b0e2752064223ce2dc0dd88900ea
|
||||||
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
|
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
|
||||||
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
|
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
|
||||||
MJExtension: 01704cca2b60a214c10761b6491eab74069d68a9
|
MJExtension: 01704cca2b60a214c10761b6491eab74069d68a9
|
||||||
mob_sharesdk: a60006891a079486ff3269ed326adfa05a967c01
|
mob_sharesdk: a60006891a079486ff3269ed326adfa05a967c01
|
||||||
MOBFoundation: efdc3ce6b843fbc10ae8c1c6122a02b0d845b39b
|
MOBFoundation: efdc3ce6b843fbc10ae8c1c6122a02b0d845b39b
|
||||||
NTESQuickPass: 8431dc52737c95883cd382c2ee75664d58f39377
|
NTESQuickPass: 8431dc52737c95883cd382c2ee75664d58f39377
|
||||||
|
Qiniu: 61f1e2fdfb35b37f98c8f03a718faf12652f9994
|
||||||
ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040
|
ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040
|
||||||
SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf
|
SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf
|
||||||
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
|
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
|
||||||
SZTextView: 094dc6acc9beec537685c545d6e3e0d4975174e1
|
SZTextView: 094dc6acc9beec537685c545d6e3e0d4975174e1
|
||||||
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
|
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
|
||||||
|
|
||||||
PODFILE CHECKSUM: a4cc983fad6d0cd9a7283a7dc7e989a39c24fc18
|
PODFILE CHECKSUM: ad9235b352788673e6e5cf8b0d1b7c840428a840
|
||||||
|
|
||||||
COCOAPODS: 1.10.1
|
COCOAPODS: 1.10.1
|
||||||
|
@@ -160,6 +160,7 @@
|
|||||||
E8B825CA26EA1231009E8E9F /* LoginVerifCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825C826EA1231009E8E9F /* LoginVerifCodeViewController.m */; };
|
E8B825CA26EA1231009E8E9F /* LoginVerifCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825C826EA1231009E8E9F /* LoginVerifCodeViewController.m */; };
|
||||||
E8B825CD26EA18C8009E8E9F /* ThemeColor.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825CC26EA18C8009E8E9F /* ThemeColor.m */; };
|
E8B825CD26EA18C8009E8E9F /* ThemeColor.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825CC26EA18C8009E8E9F /* ThemeColor.m */; };
|
||||||
E8B825D026EA3825009E8E9F /* LoginPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825CF26EA3825009E8E9F /* LoginPasswordViewController.m */; };
|
E8B825D026EA3825009E8E9F /* LoginPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825CF26EA3825009E8E9F /* LoginPasswordViewController.m */; };
|
||||||
|
E8B846BC26FD7C1200A777FE /* UploadImage.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B846BB26FD7C1200A777FE /* UploadImage.m */; };
|
||||||
E8CEA03D26EA3DE500644B44 /* LoginPasswordPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8CEA03C26EA3DE500644B44 /* LoginPasswordPresent.m */; };
|
E8CEA03D26EA3DE500644B44 /* LoginPasswordPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8CEA03C26EA3DE500644B44 /* LoginPasswordPresent.m */; };
|
||||||
E8E70D7726F2F15100F03460 /* XPMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E70D7626F2F15100F03460 /* XPMineViewController.m */; };
|
E8E70D7726F2F15100F03460 /* XPMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E70D7626F2F15100F03460 /* XPMineViewController.m */; };
|
||||||
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E70D7926F2F16600F03460 /* XPMinePresent.m */; };
|
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E70D7926F2F16600F03460 /* XPMinePresent.m */; };
|
||||||
@@ -477,6 +478,8 @@
|
|||||||
E8B825CC26EA18C8009E8E9F /* ThemeColor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ThemeColor.m; sourceTree = "<group>"; };
|
E8B825CC26EA18C8009E8E9F /* ThemeColor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ThemeColor.m; sourceTree = "<group>"; };
|
||||||
E8B825CE26EA3825009E8E9F /* LoginPasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordViewController.h; sourceTree = "<group>"; };
|
E8B825CE26EA3825009E8E9F /* LoginPasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordViewController.h; sourceTree = "<group>"; };
|
||||||
E8B825CF26EA3825009E8E9F /* LoginPasswordViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginPasswordViewController.m; sourceTree = "<group>"; };
|
E8B825CF26EA3825009E8E9F /* LoginPasswordViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginPasswordViewController.m; sourceTree = "<group>"; };
|
||||||
|
E8B846BA26FD7C1200A777FE /* UploadImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UploadImage.h; sourceTree = "<group>"; };
|
||||||
|
E8B846BB26FD7C1200A777FE /* UploadImage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UploadImage.m; sourceTree = "<group>"; };
|
||||||
E8CEA03B26EA3DE500644B44 /* LoginPasswordPresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordPresent.h; sourceTree = "<group>"; };
|
E8CEA03B26EA3DE500644B44 /* LoginPasswordPresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordPresent.h; sourceTree = "<group>"; };
|
||||||
E8CEA03C26EA3DE500644B44 /* LoginPasswordPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginPasswordPresent.m; sourceTree = "<group>"; };
|
E8CEA03C26EA3DE500644B44 /* LoginPasswordPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginPasswordPresent.m; sourceTree = "<group>"; };
|
||||||
E8CEA03E26EA3E0200644B44 /* LoginPasswordProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordProtocol.h; sourceTree = "<group>"; };
|
E8CEA03E26EA3E0200644B44 /* LoginPasswordProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordProtocol.h; sourceTree = "<group>"; };
|
||||||
@@ -910,6 +913,7 @@
|
|||||||
189DD5A726DFA09700AB55B1 /* Tool */ = {
|
189DD5A726DFA09700AB55B1 /* Tool */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
E8B846B926FD7BE600A777FE /* UploadImage */,
|
||||||
E8EEB8EA26FC2050007C6EBA /* SDPhotoBrowser */,
|
E8EEB8EA26FC2050007C6EBA /* SDPhotoBrowser */,
|
||||||
E81366E426F0A4820076364C /* NSString */,
|
E81366E426F0A4820076364C /* NSString */,
|
||||||
E82109AA26F1C86E00FC3319 /* CountDown */,
|
E82109AA26F1C86E00FC3319 /* CountDown */,
|
||||||
@@ -1200,6 +1204,15 @@
|
|||||||
path = Model;
|
path = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
E8B846B926FD7BE600A777FE /* UploadImage */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E8B846BA26FD7C1200A777FE /* UploadImage.h */,
|
||||||
|
E8B846BB26FD7C1200A777FE /* UploadImage.m */,
|
||||||
|
);
|
||||||
|
path = UploadImage;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
E8E70D6E26F2EB1200F03460 /* Mine */ = {
|
E8E70D6E26F2EB1200F03460 /* Mine */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -1642,6 +1655,7 @@
|
|||||||
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */,
|
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */,
|
||||||
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */,
|
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */,
|
||||||
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */,
|
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */,
|
||||||
|
E8B846BC26FD7C1200A777FE /* UploadImage.m in Sources */,
|
||||||
186A534D26FC6ED900D67B2C /* TTActionSheetView.m in Sources */,
|
186A534D26FC6ED900D67B2C /* TTActionSheetView.m in Sources */,
|
||||||
E88B5CC126FB407B00DA9178 /* XPMineUserInfoViewController.m in Sources */,
|
E88B5CC126FB407B00DA9178 /* XPMineUserInfoViewController.m in Sources */,
|
||||||
E824545926F5E65900BE8163 /* XPMineVerifIdentityView.m in Sources */,
|
E824545926F5E65900BE8163 /* XPMineVerifIdentityView.m in Sources */,
|
||||||
|
26
xplan-ios/Base/Tool/UploadImage/UploadImage.h
Normal file
26
xplan-ios/Base/Tool/UploadImage/UploadImage.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// UploadImage.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2021/9/24.
|
||||||
|
// 上传图片类
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface UploadImage : NSObject
|
||||||
|
/// 上传一个Image
|
||||||
|
/// @param image 图片
|
||||||
|
/// @param imageName 图片的名字
|
||||||
|
/// @param token token
|
||||||
|
/// @param success 成功
|
||||||
|
/// @param failure 失败
|
||||||
|
+ (void)uploadImage:(UIImage *)image
|
||||||
|
named:(NSString *)imageName
|
||||||
|
token:(NSString *)token
|
||||||
|
success:(void (^)(NSString *key, NSDictionary *resp))success
|
||||||
|
failure:(void (^)(NSNumber *resCode, NSString *message))failure;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
38
xplan-ios/Base/Tool/UploadImage/UploadImage.m
Normal file
38
xplan-ios/Base/Tool/UploadImage/UploadImage.m
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// UploadImage.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2021/9/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "UploadImage.h"
|
||||||
|
#import <Qiniu/QiniuSDK.h>
|
||||||
|
|
||||||
|
@implementation UploadImage
|
||||||
|
|
||||||
|
/// 上传一个Image
|
||||||
|
/// @param image 图片
|
||||||
|
/// @param imageName 图片的名字
|
||||||
|
/// @param token token
|
||||||
|
/// @param success 成功
|
||||||
|
/// @param failure 失败
|
||||||
|
+ (void)uploadImage:(UIImage *)image
|
||||||
|
named:(NSString *)imageName
|
||||||
|
token:(NSString *)token
|
||||||
|
success:(void (^)(NSString *key, NSDictionary *resp))success
|
||||||
|
failure:(void (^)(NSNumber *resCode, NSString *message))failure{
|
||||||
|
QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
|
||||||
|
builder.zone = [QNFixedZone zone2];
|
||||||
|
|
||||||
|
}];
|
||||||
|
QNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];
|
||||||
|
NSData *data = UIImageJPEGRepresentation(image, 0.5);
|
||||||
|
[upManager putData:data key:imageName token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
|
||||||
|
if (resp) {
|
||||||
|
success(key,resp);
|
||||||
|
}else{
|
||||||
|
failure(@(info.statusCode),info.error.localizedDescription);
|
||||||
|
}
|
||||||
|
} option:nil];
|
||||||
|
}
|
||||||
|
@end
|
@@ -2,6 +2,12 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||||
|
<string>“音游”需要您的同意,才可以存储相片到相册</string>
|
||||||
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
<string>“音游”需要您的同意,才可以访问相册并选择您需要上传的图片,然后展示在您的个人主页上,便于他人查看</string>
|
||||||
|
<key>NSCameraUsageDescription</key>
|
||||||
|
<string>“音游”需要您的同意,才可以访问进行拍照并上传您的图片,然后展示在您的个人主页上,便于他人查看</string>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
|
@@ -71,6 +71,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
password:(NSString *)password
|
password:(NSString *)password
|
||||||
status:(NSNumber *)status
|
status:(NSNumber *)status
|
||||||
uid:(NSString *)uid;
|
uid:(NSString *)uid;
|
||||||
|
/// 上传七牛获取token
|
||||||
|
/// @param complection 完成
|
||||||
|
+ (void)qiniuUpLoadImageWithComplection:(HttpRequestHelperCompletion)complection;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -72,4 +72,10 @@
|
|||||||
+ (void)openOrCloseParentModelWithComplection:(HttpRequestHelperCompletion)complection password:(NSString *)password status:(NSNumber *)status uid:(NSString *)uid {
|
+ (void)openOrCloseParentModelWithComplection:(HttpRequestHelperCompletion)complection password:(NSString *)password status:(NSNumber *)status uid:(NSString *)uid {
|
||||||
[self makeRequest:@"user/openOrClose" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, password,status,uid, nil];
|
[self makeRequest:@"user/openOrClose" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, password,status,uid, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 上传七牛获取token
|
||||||
|
/// @param complection 完成
|
||||||
|
+ (void)qiniuUpLoadImageWithComplection:(HttpRequestHelperCompletion)complection {
|
||||||
|
[self makeRequest:@"qiniu/upload/getUploadToken" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@@ -26,6 +26,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
nick:(NSString * _Nullable)nick
|
nick:(NSString * _Nullable)nick
|
||||||
birth:(NSString * _Nullable)birth
|
birth:(NSString * _Nullable)birth
|
||||||
userDesc:(NSString * _Nullable)userDesc;
|
userDesc:(NSString * _Nullable)userDesc;
|
||||||
|
|
||||||
|
/// 上传头像
|
||||||
|
/// @param avatar 头像
|
||||||
|
- (void)uploadAvatar:(UIImage *)avatar;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
#import "XPMineUserInfoEditPresenter.h"
|
#import "XPMineUserInfoEditPresenter.h"
|
||||||
///Api
|
///Api
|
||||||
#import "Api.h"
|
#import "Api+Mine.h"
|
||||||
///Tool
|
///Tool
|
||||||
#import "AccountInfoStorage.h"
|
#import "AccountInfoStorage.h"
|
||||||
|
#import "UploadImage.h"
|
||||||
///Model
|
///Model
|
||||||
#import "XPMineUserInfoEditModel.h"
|
#import "XPMineUserInfoEditModel.h"
|
||||||
#import "UserInfoModel.h"
|
#import "UserInfoModel.h"
|
||||||
@@ -105,6 +106,23 @@
|
|||||||
}] userInfo:dic];
|
}] userInfo:dic];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 上传头像
|
||||||
|
/// @param avatar 头像
|
||||||
|
- (void)uploadAvatar:(UIImage *)avatar {
|
||||||
|
[Api qiniuUpLoadImageWithComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
|
NSString *key = data.data[@"key"];
|
||||||
|
NSString *token = data.data[@"token"];
|
||||||
|
[UploadImage uploadImage:avatar named:key token:token success:^(NSString * _Nonnull key, NSDictionary * _Nonnull resp) {
|
||||||
|
NSString *url = resp[@"path"];
|
||||||
|
[[self getView] uploadImageSuccess:url];
|
||||||
|
} failure:^(NSNumber * _Nonnull resCode, NSString * _Nonnull message) {
|
||||||
|
[[self getView] showErrorToast:@"上传失败"];
|
||||||
|
}];
|
||||||
|
}]];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (XPMineUserInfoEditModel *)nickItem {
|
- (XPMineUserInfoEditModel *)nickItem {
|
||||||
if (!_nickItem) {
|
if (!_nickItem) {
|
||||||
|
@@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)complementUserInfoSuccess;
|
- (void)complementUserInfoSuccess;
|
||||||
///获取用户信息成功
|
///获取用户信息成功
|
||||||
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo;
|
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo;
|
||||||
|
/// 上传头像成功
|
||||||
|
- (void)uploadImageSuccess:(NSString *)url;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -199,7 +199,7 @@
|
|||||||
if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
|
if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
|
||||||
UIImageWriteToSavedPhotosAlbum(selectedPhoto, nil, nil, nil);
|
UIImageWriteToSavedPhotosAlbum(selectedPhoto, nil, nil, nil);
|
||||||
}
|
}
|
||||||
#warning to do 上传图片
|
[self.presenter uploadAvatar:selectedPhoto];
|
||||||
}
|
}
|
||||||
[picker dismissViewControllerAnimated:YES completion:^{}];
|
[picker dismissViewControllerAnimated:YES completion:^{}];
|
||||||
}
|
}
|
||||||
@@ -250,6 +250,10 @@
|
|||||||
self.userInfo = userInfo;
|
self.userInfo = userInfo;
|
||||||
[self.presenter getUserInfoEditDataSourceWithUserInfo:self.userInfo];
|
[self.presenter getUserInfoEditDataSourceWithUserInfo:self.userInfo];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)uploadImageSuccess:(NSString *)url {
|
||||||
|
[self.presenter complectionInfoWithAvatar:url nick:nil birth:nil userDesc:nil];
|
||||||
|
}
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (UITableView *)tableView {
|
- (UITableView *)tableView {
|
||||||
if (!_tableView) {
|
if (!_tableView) {
|
||||||
|
Reference in New Issue
Block a user