增加换肤功能
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXChangeIntroduceViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXChangeIntroduceViewController : QXBaseViewController
|
||||
@property (nonatomic,strong)NSString*introduce;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
136
QXLive/Mine(音域)/Controller/编辑/QXChangeIntroduceViewController.m
Normal file
136
QXLive/Mine(音域)/Controller/编辑/QXChangeIntroduceViewController.m
Normal file
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// QXChangeIntroduceViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import "QXChangeIntroduceViewController.h"
|
||||
#import "QXTextView.h"
|
||||
#import "QXSearchCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXChangeIntroduceViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)QXTextView *textView;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSString *tag_id;
|
||||
@end
|
||||
|
||||
@implementation QXChangeIntroduceViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"修改简介");
|
||||
UIButton *btn = [[UIButton alloc] init];
|
||||
[btn setTitle:QXText(@"保存") forState:(UIControlStateNormal)];
|
||||
btn.titleLabel.font = [UIFont systemFontOfSize:14.f];
|
||||
[btn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)];
|
||||
[btn addTarget:self action:@selector(saveAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
|
||||
}
|
||||
- (void)initSubViews{
|
||||
self.tag_id = @"";
|
||||
self.textView = [[QXTextView alloc] initWithFrame:CGRectMake(16, NavContentHeight+12, SCREEN_WIDTH-32, 180)];
|
||||
if (self.introduce.length > 0) {
|
||||
self.textView.placehoulder = QXText(@"介绍喜好、个性,让大家认识你");
|
||||
self.textView.text = self.introduce;
|
||||
}else{
|
||||
self.textView.placehoulder = QXText(@"介绍喜好、个性,让大家认识你");
|
||||
}
|
||||
[self.textView becomeFirstResponder];
|
||||
self.textView.backgroundColor = UIColor.whiteColor;
|
||||
[self.textView addRoundedCornersWithRadius:7];
|
||||
self.textView.font = [UIFont systemFontOfSize:13];
|
||||
[self.view addSubview:self.textView];
|
||||
[self.view addSubview:self.collectionView];
|
||||
}
|
||||
-(void)getData{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork getUserTagListSuccessBlock:^(NSArray<QXUserTag *> * _Nonnull users) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:users];
|
||||
[weakSelf.collectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
- (void)saveAction{
|
||||
[self.view endEditing:YES];
|
||||
NSString *introduce = self.textView.text;
|
||||
QXLOG(@"修改简介%@",introduce);
|
||||
MJWeakSelf
|
||||
[QXMineNetwork editUserInfoWithNickname:@""
|
||||
birthday:@""
|
||||
sex:@""
|
||||
avatar:@""
|
||||
images:@""
|
||||
profile:introduce
|
||||
tag_id:self.tag_id
|
||||
successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXSearchCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[QXSearchCell cellIdentifier] forIndexPath:indexPath];
|
||||
cell.cellType = QXSearchCellTypeChangeIntroduce;
|
||||
cell.userTag = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXUserTag *model = self.dataArray[indexPath.row];
|
||||
model.isSelected = !model.isSelected;
|
||||
if (model.isSelected) {
|
||||
if (self.tag_id.length == 0) {
|
||||
self.tag_id = model.id;
|
||||
}else{
|
||||
self.tag_id = [self.tag_id stringByAppendingFormat:@",%@",model.id];
|
||||
}
|
||||
}
|
||||
[collectionView reloadData];
|
||||
}
|
||||
-(UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
|
||||
flowLayout.minimumLineSpacing = 12;
|
||||
flowLayout.minimumInteritemSpacing = 12;
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
flowLayout.itemSize = CGSizeMake((SCREEN_WIDTH-16*2-12*3)/4, 22);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.textView.bottom+12, SCREEN_WIDTH, SCREEN_HEIGHT-self.textView.bottom-12) collectionViewLayout:flowLayout];
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[QXSearchCell class] forCellWithReuseIdentifier:[QXSearchCell cellIdentifier]];
|
||||
_collectionView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXChangeNickViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXChangeNicknameViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// QXChangeNickViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import "QXChangeNicknameViewController.h"
|
||||
#import <ImSDK_Plus/ImSDK_Plus.h>
|
||||
#import "QXMineNetwork.h"
|
||||
@interface QXChangeNicknameViewController ()
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UITextField *textField;
|
||||
@property (nonatomic,strong)UIButton *deleteBtn;
|
||||
@end
|
||||
|
||||
@implementation QXChangeNicknameViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"修改昵称");
|
||||
UIButton *btn = [[UIButton alloc] init];
|
||||
[btn setTitle:QXText(@"保存") forState:(UIControlStateNormal)];
|
||||
btn.titleLabel.font = [UIFont systemFontOfSize:14.f];
|
||||
[btn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)];
|
||||
[btn addTarget:self action:@selector(saveAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
|
||||
}
|
||||
|
||||
- (void)initSubViews{
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(16, NavContentHeight+12, SCREEN_WIDTH-32, 44)];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bgView addRoundedCornersWithRadius:7];
|
||||
[self.view addSubview:self.bgView];
|
||||
|
||||
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(12, 0, self.bgView.width-24-44, 44)];
|
||||
self.textField.placeholder = QXText(@"请输入昵称");
|
||||
self.textField.font = [UIFont systemFontOfSize:14];
|
||||
self.textField.textColor = QXConfig.textColor;
|
||||
[self.bgView addSubview:self.textField];
|
||||
|
||||
self.deleteBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-44, 0, 44, 44)];
|
||||
[self.deleteBtn setImage:[UIImage imageNamed:@"Plus Circle"] forState:(UIControlStateNormal)];
|
||||
[self.deleteBtn addTarget:self action:@selector(deleteAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.deleteBtn];
|
||||
}
|
||||
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
-(void)deleteAction{
|
||||
self.textField.text = @"";
|
||||
}
|
||||
-(void)saveAction{
|
||||
[self.view endEditing:YES];
|
||||
__block NSString *nickName = self.textField.text;
|
||||
__block NSString *avatar = [QXGlobal shareGlobal].loginModel.avatar;
|
||||
QXLOG(@"修改昵称%@",nickName);
|
||||
MJWeakSelf
|
||||
[QXMineNetwork editUserInfoWithNickname:nickName
|
||||
birthday:@""
|
||||
sex:@""
|
||||
avatar:@""
|
||||
images:@""
|
||||
profile:@""
|
||||
tag_id:@""
|
||||
successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
/// 更新存储信息
|
||||
[QXGlobal shareGlobal].loginModel.nickname = nickName;
|
||||
[[QXGlobal shareGlobal] updateUserInfoWithMolde:[QXGlobal shareGlobal].loginModel];
|
||||
|
||||
/// 同步修改腾讯个人信息
|
||||
V2TIMUserFullInfo *info = [[V2TIMUserFullInfo alloc] init];
|
||||
info.faceURL = avatar;
|
||||
info.nickName = nickName;
|
||||
[[V2TIMManager sharedInstance] setSelfInfo:info succ:^{
|
||||
QXLOG(@"腾讯IM同步个人信息成功");
|
||||
} fail:^(int code, NSString * _Nullable desc) {
|
||||
QXLOG(@"腾讯IM同步个人信息失败");
|
||||
}];
|
||||
showToast(QXText(@"修改成功"));
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
16
QXLive/Mine(音域)/Controller/编辑/QXUserInfoEidtViewController.h
Normal file
16
QXLive/Mine(音域)/Controller/编辑/QXUserInfoEidtViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXUserInfoEidtViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/9.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXUserInfoEidtViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
252
QXLive/Mine(音域)/Controller/编辑/QXUserInfoEidtViewController.m
Normal file
252
QXLive/Mine(音域)/Controller/编辑/QXUserInfoEidtViewController.m
Normal file
@@ -0,0 +1,252 @@
|
||||
//
|
||||
// QXUserInfoEidtViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/9.
|
||||
//
|
||||
|
||||
#import "QXUserInfoEidtViewController.h"
|
||||
#import "QXUserInfoEditCell.h"
|
||||
#import "QXUserInfoEditFooterView.h"
|
||||
#import "QXUserInfoEditHeaderView.h"
|
||||
#import "QXChangeNicknameViewController.h"
|
||||
#import "QXChangeIntroduceViewController.h"
|
||||
#import "BRDatePickerView.h"
|
||||
#import "BRTextPickerView.h"
|
||||
#import "NSDate+BRPickerView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXUserInfoEidtViewController ()<UITableViewDelegate,UITableViewDataSource,QXUserInfoEditHeaderViewDelegate,QXUserInfoImageCellDelegate>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)QXUserInfoEditFooterView *tableFooterView;
|
||||
@property (nonatomic,strong)QXUserInfoEditHeaderView *tableHeaderView;
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)NSMutableDictionary *valueDict;
|
||||
@property (nonatomic,strong)UILabel* titleLabel;
|
||||
@property (nonatomic,strong)UIButton* backBtn;
|
||||
@property (nonatomic,strong)NSMutableArray* imgsArray;
|
||||
@property (nonatomic,strong)QXUserHomeModel * userModel;
|
||||
@end
|
||||
|
||||
@implementation QXUserInfoEidtViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
[self getUserInfo];
|
||||
}
|
||||
|
||||
- (void)initSubViews{
|
||||
|
||||
// [self.view addSubview:self.bgView];
|
||||
self.dataArray = [NSMutableArray arrayWithArray:@[
|
||||
QXText(@"昵称"),QXText(@"性别"),QXText(@"出生日期"),QXText(@"简介")
|
||||
]];
|
||||
self.valueDict = [NSMutableDictionary dictionaryWithDictionary:@{
|
||||
QXText(@"昵称"):[QXGlobal shareGlobal].loginModel.nickname?[QXGlobal shareGlobal].loginModel.nickname:@"",
|
||||
QXText(@"性别"):[QXGlobal shareGlobal].loginModel.sex.integerValue== 1?QXText(@"男"):QXText(@"女"),
|
||||
QXText(@"出生日期"):[QXGlobal shareGlobal].loginModel.birthday?[QXGlobal shareGlobal].loginModel.birthday:@"",
|
||||
QXText(@"简介"):[QXGlobal shareGlobal].loginModel.profile?[QXGlobal shareGlobal].loginModel.profile:@"",
|
||||
}];
|
||||
self.tableView.tableHeaderView = self.tableHeaderView;
|
||||
self.tableView.tableFooterView = self.tableFooterView;
|
||||
[self.view addSubview:self.tableView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, kSafeAreaTop, SCREEN_WIDTH-140, 40)];
|
||||
self.titleLabel.text = QXText(@"编辑资料");
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
|
||||
self.titleLabel.textColor = RGB16(0x333333);
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self.view addSubview:self.titleLabel];
|
||||
|
||||
self.backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, kSafeAreaTop, 40, 40)];
|
||||
[self.backBtn setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)];
|
||||
[self.backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.view addSubview:self.backBtn];
|
||||
}
|
||||
|
||||
-(void)getUserInfo{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork userHomePageWithUserId:[QXGlobal shareGlobal].loginModel.user_id successBlock:^(QXUserHomeModel * _Nonnull userModel) {
|
||||
weakSelf.userModel = userModel;
|
||||
weakSelf.valueDict = [NSMutableDictionary dictionaryWithDictionary:@{
|
||||
QXText(@"昵称"):userModel.nickname?userModel.nickname:@"",
|
||||
QXText(@"性别"):userModel.sex.integerValue== 1?QXText(@"男"):QXText(@"女"),
|
||||
QXText(@"出生日期"):userModel.birthday?userModel.birthday:@"",
|
||||
QXText(@"简介"):userModel.profile?userModel.profile:@"",
|
||||
}];
|
||||
NSArray *imgs;
|
||||
if (userModel.home_bgimages.length > 0) {
|
||||
imgs = [userModel.home_bgimages componentsSeparatedByString:@","];
|
||||
}
|
||||
[weakSelf.imgsArray removeAllObjects];
|
||||
if (imgs != nil) {
|
||||
[weakSelf.imgsArray addObjectsFromArray:imgs];
|
||||
}
|
||||
weakSelf.tableHeaderView.imgs = weakSelf.imgsArray;
|
||||
weakSelf.tableFooterView.imgs = weakSelf.imgsArray;
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXUserInfoEditCell *cell = [QXUserInfoEditCell cellWithTableView:tableView];
|
||||
NSString *title = self.dataArray[indexPath.row];
|
||||
cell.titleLabel.text = title;
|
||||
cell.textField.text = self.valueDict[title];
|
||||
return cell;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
NSString *title = self.dataArray[indexPath.row];
|
||||
if ([title isEqualToString:QXText(@"昵称")]) {
|
||||
QXChangeNicknameViewController *vc = [[QXChangeNicknameViewController alloc] init];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}else if ([title isEqualToString:QXText(@"简介")]){
|
||||
QXChangeIntroduceViewController *vc= [[QXChangeIntroduceViewController alloc] init];
|
||||
vc.introduce = self.userModel.profile;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}else if ([title isEqualToString:QXText(@"出生日期")]){
|
||||
BRDatePickerView *piker = [[BRDatePickerView alloc] initWithPickerMode:(BRDatePickerModeYMD)];
|
||||
NSDate *minDate = [NSDate br_setYear:1900 month:1 day:1];
|
||||
piker.minDate = minDate;
|
||||
piker.maxDate = [NSDate date];
|
||||
piker.selectValue = [QXGlobal shareGlobal].loginModel.birthday;
|
||||
piker.isAutoSelect = NO;
|
||||
MJWeakSelf
|
||||
piker.resultBlock = ^(NSDate * _Nullable selectDate, NSString * _Nullable selectValue) {
|
||||
[weakSelf editBirthday:selectValue];
|
||||
};
|
||||
[piker show];
|
||||
}else if ([title isEqualToString:QXText(@"性别")]){
|
||||
MJWeakSelf
|
||||
// BRTextPickerView *piker = [[BRTextPickerView alloc] initWithPickerMode:BRTextPickerComponentSingle];
|
||||
// piker.dataSourceArr = @[QXText(@"男"),QXText(@"女")];
|
||||
// piker.singleResultBlock = ^(BRTextModel * _Nullable model, NSInteger index) {
|
||||
// if (index == 1) {
|
||||
// [weakSelf editSex:@"2"];
|
||||
// }else{
|
||||
// [weakSelf editSex:@"1"];
|
||||
// }
|
||||
// };
|
||||
// [piker show];
|
||||
}
|
||||
}
|
||||
-(void)didClickDelete:(NSString *)imageUrl index:(NSInteger)index{
|
||||
[self.imgsArray removeObjectAtIndex:index];
|
||||
[self uploadImageWithUlrList:self.imgsArray];
|
||||
}
|
||||
-(void)didUploadFinishedWithImageUrlList:(NSArray *)urlList{
|
||||
[self.imgsArray addObjectsFromArray:urlList];
|
||||
[self uploadImageWithUlrList:self.imgsArray];
|
||||
}
|
||||
|
||||
-(void)uploadImageWithUlrList:(NSArray*)urlList{
|
||||
MJWeakSelf
|
||||
NSString *images = @"";
|
||||
if (urlList.count > 0) {
|
||||
images = [urlList componentsJoinedByString:@","];
|
||||
}
|
||||
[QXMineNetwork editUserHomeBgWithImages:images successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf getUserInfo];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)editBirthday:(NSString*)birthday{
|
||||
MJWeakSelf
|
||||
__block NSString *saveBirthday = birthday;
|
||||
[QXMineNetwork editUserInfoWithNickname:@""
|
||||
birthday:birthday
|
||||
sex:@""
|
||||
avatar:@""
|
||||
images:@""
|
||||
profile:@""
|
||||
tag_id:@""
|
||||
successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(QXText(@"修改成功"));
|
||||
[weakSelf getUserInfo];
|
||||
[QXGlobal shareGlobal].loginModel.birthday = saveBirthday;
|
||||
[[QXGlobal shareGlobal] updateUserInfoWithMolde:[QXGlobal shareGlobal].loginModel];
|
||||
[weakSelf.valueDict setObject:saveBirthday forKey:QXText(@"出生日期")];
|
||||
[weakSelf.tableView reloadRow:2 inSection:0 withRowAnimation:(UITableViewRowAnimationAutomatic)];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)editSex:(NSString*)sex{
|
||||
MJWeakSelf
|
||||
__block NSString *saveSex = sex;
|
||||
[QXMineNetwork editUserInfoWithNickname:@""
|
||||
birthday:@""
|
||||
sex:sex
|
||||
avatar:@""
|
||||
images:@""
|
||||
profile:@""
|
||||
tag_id:@""
|
||||
successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(QXText(@"修改成功"));
|
||||
[weakSelf getUserInfo];
|
||||
[QXGlobal shareGlobal].loginModel.sex = saveSex;
|
||||
[[QXGlobal shareGlobal] updateUserInfoWithMolde:[QXGlobal shareGlobal].loginModel];
|
||||
[weakSelf.valueDict setObject:saveSex.integerValue== 1?QXText(@"男"):QXText(@"女") forKey:QXText(@"性别")];
|
||||
[weakSelf.tableView reloadRow:1 inSection:0 withRowAnimation:(UITableViewRowAnimationAutomatic)];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStylePlain];
|
||||
self.tableView.backgroundColor = [UIColor whiteColor];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
self.tableView.rowHeight = 48;
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
-(UIView *)bgView{
|
||||
if (!_bgView) {
|
||||
_bgView = [[UIView alloc] initWithFrame:CGRectMake(0, self.tableHeaderView.height, SCREEN_WIDTH,SCREEN_HEIGHT-self.tableHeaderView.height )];
|
||||
_bgView.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
-(QXUserInfoEditHeaderView *)tableHeaderView{
|
||||
if (!_tableHeaderView) {
|
||||
_tableHeaderView = [[QXUserInfoEditHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 263+kSafeAreaTop)];
|
||||
}
|
||||
return _tableHeaderView;
|
||||
}
|
||||
-(QXUserInfoEditFooterView *)tableFooterView{
|
||||
if (!_tableFooterView) {
|
||||
CGFloat itemWidth = (SCREEN_WIDTH-16*2-20*2)/3;
|
||||
_tableFooterView = [[QXUserInfoEditFooterView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, itemWidth*2+20+40)];
|
||||
_tableFooterView.delegate = self;
|
||||
}
|
||||
return _tableFooterView;
|
||||
}
|
||||
-(NSMutableArray *)imgsArray{
|
||||
if (!_imgsArray) {
|
||||
_imgsArray = [NSMutableArray array];
|
||||
}
|
||||
return _imgsArray;
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user