123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629 |
- //
- // BabyDetailInfoViewController.m
- // Artimenring
- //
- // Created by YangJianguo on 7/2/15.
- // Copyright (c) 2015 BaH Cy. All rights reserved.
- //
- #import "SKBabyDetailInfoViewController.h"
- #import "IQKeyboardManager.h"
- #import <UMMobClick/MobClick.h>
- #import "BabyDetailInfoHeaderView.h"
- #import "SKBabyQRCodeViewController.h"
- #import "SKScanImeiViewController.h"
- #import "SKRelationViewController.h"
- #import "PickerView.h"
- typedef NS_ENUM(NSInteger, EControllerType) {
- EControllerSexType = 0,
- EControllerBirthday = 1,
- EControllerGrade = 2,
- };
- @interface SKBabyDetailInfoViewController ()<UITableViewDataSource, UITableViewDelegate, RelationDelegate> {
- PickerView *mTimeView;
-
- UIImage* mSaveHeadImage;
-
- EControllerType controllerType;
-
- NSArray *sexTypeArray;
- NSArray *gradeArray;
-
- BabyDetailInfoHeaderView* mHeaderView;
- }
- @property (nonatomic, weak) IBOutlet UITableView *tableView;
- @end
- @implementation SKBabyDetailInfoViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
- sexTypeArray = @[NSLocalizedString(@"BDI.Boy", nil), NSLocalizedString(@"BDI.Girl", nil)];
- gradeArray = @[NSLocalizedString(@"BDI.Grade.00", nil),NSLocalizedString(@"BDI.Grade.01", nil),NSLocalizedString(@"BDI.Grade.02", nil),NSLocalizedString(@"BDI.Grade.03", nil),NSLocalizedString(@"BDI.Grade.11", nil),NSLocalizedString(@"BDI.Grade.12", nil),NSLocalizedString(@"BDI.Grade.13", nil),NSLocalizedString(@"BDI.Grade.14", nil),NSLocalizedString(@"BDI.Grade.15", nil),NSLocalizedString(@"BDI.Grade.16", nil)];
-
- [self setNavigationBarColor:0];
- [self.navigationController setNavigationBarHidden:NO];
- [self initTitle];
- [self initButton];
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- [IQKeyboardManager sharedManager].enable = NO;
- }
- - (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
- self.title = @"";
-
- [IQKeyboardManager sharedManager].enable = YES;
- }
- - (void)initTitle {
- if (self.opType == 1) {
- self.title = NSLocalizedString(@"BDI.Title", nil);
- } else if (self.opType == 2) {
- self.title = NSLocalizedString(@"BD.Title.2.1.0", nil);
- } else if (self.opType == 3) {
- self.title = NSLocalizedString(@"BD.Title.2.1.1", nil);
- }
- }
- - (void)initButton {
- if (self.from == 1) {
- self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"Clendar_L"] style: UIBarButtonItemStylePlain target:self action:@selector(onLeftBarAction)];
- }
-
- NSString* btnString = self.opType == 1 ? NSLocalizedString(@"STDL.Sure", nil) : NSLocalizedString(@"BD.NextStep", nil);
- self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:btnString style:UIBarButtonItemStylePlain target:self action:@selector(sureAction:)];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- if (section == 0)
- return 0;
- else if (section == 1)
- return 7;
- else if (section == 2)
- return self.opType == 1 ? 0 : 1;
- else
- return 0;
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return 3;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 64;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- if (section == 0)
- return 115;
- else if (section == 2)
- return 1;
- else
- return 0;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- @weakify(self);
- if (section == 0) {
- if (mHeaderView == nil) {
- mHeaderView = [EUtil getBundleView:@"BabyDetailInfoHeaderView"];
- }
- [mHeaderView setData:mSaveHeadImage HeadImageURL:self.childModel.avatar callName:self.childModel.name];
- mHeaderView.mXIBViewCallback = ^{
- if(self.childModel.role > ROLE_ADMIN) { //非管理员
- //@"非管理员不可以修改"
- [EasyTextView showInfoText:NSLocalizedString(@"BDI.No.Admin", nil)];
- return;
- }
- [weak_self showImagePickerSheet];
- };
- return mHeaderView;
- } else if (section == 2) {
- UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 1)];
- [view setBackgroundColor:[UIColor clearColor]];
- return view;
- } else {
- return nil;
- }
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *cellID = @"BabyDetailInfoCell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
- if(cell == nil) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID];
- }
- cell.accessoryView = nil;
-
- //@"未设置"
- NSString *notEdited = NSLocalizedString(@"BDI.No.Set", nil);
- if (indexPath.section == 1) {
- switch (indexPath.row) {
-
- case 0:
- //@"宝贝姓名"
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.Name", nil);
- if(self.childModel.name.length == 0)
- cell.detailTextLabel.text = notEdited;
- else if(self.childModel.name.length > 0)
- cell.detailTextLabel.text = self.childModel.name;
- if(self.childModel.role <= ROLE_ADMIN)
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- else
- cell.accessoryType = UITableViewCellAccessoryNone;
- break;
-
- case 1:
- //@"国家码"
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.NationCode", nil);
- cell.detailTextLabel.text = [NSString stringWithFormat:@"+%@", self.childModel.areaCode];
-
- if(self.childModel.role <= ROLE_ADMIN)
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- else
- cell.accessoryType = UITableViewCellAccessoryNone;
- break;
-
- case 2:
- //@"手机号"
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.Phone", nil);
- if(self.childModel.phoneNumber.length == 0)
- cell.detailTextLabel.text = notEdited;
- else if(self.childModel.phoneNumber.length > 0)
- cell.detailTextLabel.text = self.childModel.phoneNumber;
- if(self.childModel.role <= ROLE_ADMIN)
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- else
- cell.accessoryType = UITableViewCellAccessoryNone;
- break;
-
- case 3:
- //@"性别"
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.gender", nil);
- if(self.childModel.gender < 2) {
- cell.detailTextLabel.text = notEdited;
- } else {
- cell.detailTextLabel.text = [sexTypeArray objectAtIndex:(self.childModel.gender - 2)];
- }
- if(self.childModel.role <= ROLE_ADMIN)
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- else
- cell.accessoryType = UITableViewCellAccessoryNone;
- break;
-
- case 4:
- //@"生日"
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.Birthday", nil);
- if(self.childModel.birthday.length == 0)
- cell.detailTextLabel.text = notEdited;
- else {
- NSDate* date = [NSDate getDateFromString:@"yyyy-MM-dd" timeString:self.childModel.birthday];
- cell.detailTextLabel.text = [date getDateString];
- }
- if(self.childModel.role <= ROLE_ADMIN)
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- else
- cell.accessoryType = UITableViewCellAccessoryNone;
- break;
-
- case 5:
- //@"身高"
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.Height", nil);
- if(self.childModel.height <= 0)
- cell.detailTextLabel.text = notEdited;
- else
- //@"%@ 厘米"
- cell.detailTextLabel.text = [NSString stringWithFormat:NSLocalizedString(@"BDI.Centimeter", nil),self.childModel.height];
- if(self.childModel.role <= ROLE_ADMIN)
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- else
- cell.accessoryType = UITableViewCellAccessoryNone;
- break;
-
- case 6:
- //@"体重"
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.Weight", nil);
- if(self.childModel.weight <= 0)
- cell.detailTextLabel.text = notEdited;
- else
- cell.detailTextLabel.text = [NSString stringWithFormat:NSLocalizedString(@"BDI.Kilo", nil),self.childModel.weight];
- if(self.childModel.role <= ROLE_ADMIN)
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- else
- cell.accessoryType = UITableViewCellAccessoryNone;
- break;
-
- case 7:
- //@"年级";
- break;
-
- case 8: {
- //二维码
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.QRCode", nil);
- cell.detailTextLabel.text = @"";
- UIImageView* image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_qr_code"]];
- cell.accessoryView = image;
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- break;
- }
- default:
- break;
- }
- }
- else if (indexPath.section == 2) {
- switch (indexPath.row) {
- case 0:
- //@"称呼"
- cell.textLabel.text = NSLocalizedString(@"BDI.Baby.Appellation", nil);
- if(self.childModel.appellation.length <= 0)
- cell.detailTextLabel.text = notEdited;
- else
- cell.detailTextLabel.text = self.childModel.appellation;
- if(self.childModel.role <= ROLE_ADMIN)
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- else
- cell.accessoryType = UITableViewCellAccessoryNone;
- break;
- default:
- break;
- }
- }
- [cell.textLabel setNeedsLayout];
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
- if(self.childModel.role > ROLE_ADMIN) { //非管理员
- //@"非管理员不可以修改"
- //[EasyTextView showInfoText:NSLocalizedString(@"BDI.No.Admin", nil)];
- } else {
- UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
- if (indexPath.section == 1) {
- switch (indexPath.row) {
- case 0:
- //@"编辑宝贝姓名";
- [self editName];
- break;
- case 1:
- //@"编辑手机号";
- [self countryCodeActionEx];
- break;
- case 2:
- //@"编辑手机号";
- [self editPhone];
- break;
- case 3:
- //@"性别";
- [self editSex:cell.detailTextLabel.text];
- break;
- case 4:
- //@"生日";
- [self editBirthday:cell.detailTextLabel.text];
- break;
- case 5:
- //@"身高";
- [self editHeight];
- break;
- case 6:
- //@"体重";
- [self editWeight];
- break;
- case 7:
- //@"年级";
- [self editGrade:cell.detailTextLabel.text];
- break;
- case 8:
- [self showBabyQRCode];
- break;
- default:
- break;
- }
- } else if (indexPath.section == 2) {
- switch (indexPath.row) {
- case 0:
- [self editRelationName];
- break;
- }
- }
- }
- }
- - (void)createPickerView {
- if(mTimeView == nil) {
- mTimeView = [PickerView create];
- [mTimeView setMType:controllerType == EControllerBirthday ? 0:1];
- [mTimeView.mDatePicker setHidden: controllerType != EControllerBirthday];
- [mTimeView.mCustomPicker setHidden: controllerType == EControllerBirthday];
-
- if(controllerType == EControllerBirthday) {
- [mTimeView.mDatePicker setDatePickerMode:UIDatePickerModeDate];
- if (@available(iOS 13.4, *)) {
- [mTimeView.mDatePicker setPreferredDatePickerStyle:UIDatePickerStyleWheels];
- }
- [mTimeView.mDatePicker setMaximumDate:[NSDate date]];
- } else {
- mTimeView.mCustomPickerArray = [NSArray arrayWithArray:controllerType == EControllerSexType ? sexTypeArray : gradeArray];
- }
- }
- }
- - (void)modifyPickerView:(EControllerType)type value:(NSString*)value {
- controllerType = type;
-
- [self createPickerView];
-
- NSString* title = @"";
- if (controllerType == EControllerSexType) {
- title = NSLocalizedString(@"BDI.Baby.gender", nil);
- } else if (controllerType == EControllerBirthday) {
- title = NSLocalizedString(@"BDI.Baby.Birthday", nil);
- } else if (controllerType == EControllerGrade) {
- title = NSLocalizedString(@"BDI.Baby.Grade", nil);
- }
- [mTimeView show:title value:value];
-
- __weak typeof(self) _weakself = self;
- mTimeView.mDatePickerBtnClick = ^(NSInteger type, NSDate *date, NSInteger selectIndex) {
- mTimeView = nil;
- if (type != 0) {
- [_weakself onSureAction:date selectIndex:selectIndex];
- }
- };
- }
- - (void)onSureAction:(NSDate *)date selectIndex:(NSInteger)selectIndex {
- if(controllerType == EControllerSexType) {
- self.childModel.gender = selectIndex + 2;
- } else if(controllerType == EControllerGrade) {
-
- } else if(controllerType == EControllerBirthday) {
- NSString* birthday = [date getFormatString:@"yyyy-MM-dd"];
- self.childModel.birthday = birthday;
- }
- [self.tableView reloadData];
- }
- - (void)sureAction:(id)sender {
- if([self.childModel.name length] == 0) {
- //@"名字不能为空"
- [EasyTextView showInfoText:NSLocalizedString(@"BDI.Name.Nil", nil)];
- return;
- }
- if(![EUtil checkCharacter:self.childModel.name Min:1*2 Max:5*2]) {
- //@"名字不能超过1-5个汉字"
- [EasyTextView showInfoText:NSLocalizedString(@"NickName.Length", nil)];
- return;
- }
- if (![self.childModel.phoneNumber isValidateMobile]) {
- //@"请输入3~32位数字号码"
- [EasyTextView showInfoText:NSLocalizedString(@"Input.Correct.Mobile.Number", nil)];
- return;
- }
- // if(self.childModel.height <= 0) {
- // //@"身高不能为空"
- // [EasyTextView showInfoText:NSLocalizedString(@"BDI.Height.Nil", nil)];
- // return;
- // }
- if(self.childModel.height != 0 && (self.childModel.height < 10 || self.childModel.height > 300)) {
- //"身高超过合理范围"
- [EasyTextView showInfoText:NSLocalizedString(@"BDI.Height.Beyond", nil)];
- return;
- }
- //
- // if(self.childModel.weight <= 0) {
- // //@"体重不能为空"
- // [EasyTextView showInfoText:NSLocalizedString(@"BDI.Weight.Nil", nil)];
- // return;
- // }
-
- if(self.childModel.weight != 0 && (self.childModel.weight < 1 || self.childModel.weight > 300)) {
- //@"体重超过合理范围"
- [EasyTextView showInfoText:NSLocalizedString(@"BDI.Weight.Beyond", nil)];
- return;
- }
-
-
- if([self.childModel.appellation length] == 0) {
- [EasyTextView showInfoText:NSLocalizedString(@"FAV.Input.Relation", nil)];
- return;
- }
- if(![EUtil checkCharacter:self.childModel.appellation Min:1*2 Max:5*2]) {
- //@"名字不能超过1-5个汉字"
- [EasyTextView showInfoText:NSLocalizedString(@"Relation.Length", nil)];
- return;
- }
-
- if (self.opType == 1 || self.opType == 3) {
- [self updateChildRequest];
- } else {
- [self addChildRequest];
- }
- }
- - (void)addChildRequest {
- @weakify(self);
- NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
- param[@"avatar"] = self.childModel.avatar;
- param[@"name"] = self.childModel.name;
- param[@"appellation"] = self.childModel.appellation;
- param[@"areaCode"] = self.childModel.areaCode;
- param[@"phoneNumber"] = self.childModel.phoneNumber;
- param[@"birthday"] = self.childModel.birthday;
- param[@"gender"] = @(self.childModel.gender);
- param[@"height"] = @(self.childModel.height);
- param[@"weight"] = @(self.childModel.weight);
- [self ShowHUBWithText:NSLocalizedString(@"Request.Adding", nil)];
- [ERequest httpRequest:param httpURL:URL_CHILD_ADD httpMethod:@"POST" onSuccess:^(NSDictionary *result) {
- [weak_self HiddenHUB];
- if([ERequest isSuccessWithResult:result]) {
- weak_self.childModel.cid = result[@"data"][@"cid"];
- [weak_self showScanQRcode];
- } else{
- [EasyTextView showErrorText:result[@"message"]];
- }
- }onFailure:^(NSError *error) {
- [weak_self HiddenHUB];
- [EasyTextView showErrorText:NSLocalizedString(@"Network.Error", nil)];
- }];
- }
- - (void)updateChildRequest {
- @weakify(self);
- NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
- param[@"cid"] = self.childModel.cid;
- param[@"avatar"] = self.childModel.avatar;
- param[@"name"] = self.childModel.name;
- param[@"appellation"] = self.childModel.appellation;
- param[@"areaCode"] = self.childModel.areaCode;
- param[@"phoneNumber"] = self.childModel.phoneNumber;
- param[@"birthday"] = self.childModel.birthday;
- param[@"gender"] = @(self.childModel.gender);
- param[@"height"] = @(self.childModel.height);
- param[@"weight"] = @(self.childModel.weight);
- [self ShowHUBWithText:NSLocalizedString(@"Request.Modifing", nil)];
- [ERequest httpRequest:param httpURL:URL_CHILD_UPDATE httpMethod:@"POST" onSuccess:^(NSDictionary *result) {
- [weak_self HiddenHUB];
- if([ERequest isSuccessWithResult:result]) {
- if (weak_self.opType == 1) {
- [EasyTextView showSuccessText:NSLocalizedString(@"Request.Modify.Success", nil)];
- [EUtil postInformation:@"RELOAD_CHILDS_DEVICES"];
- [weak_self popViewControllerWithDelay:0.5];
- } else {
- [weak_self showScanQRcode];
- }
- } else{
- [EasyTextView showErrorText:result[@"message"]];
- }
- }onFailure:^(NSError *error) {
- [weak_self HiddenHUB];
- [EasyTextView showErrorText:NSLocalizedString(@"Network.Error", nil)];
- }];
- }
- - (void)editName {
- //@"输入宝贝姓名"
- NSString* holder = self.childModel.name.length > 0 ? self.childModel.name : NSLocalizedString(@"NickName.Length", nil);
- [self showTextFieldAlertView:NSLocalizedString(@"BDI.Baby.Name", nil) Message:nil PlaceHolder:holder isNumber:NO callback:^(BOOL isOK, NSString *text) {
- if (isOK) {
- self.childModel.name = text;
- [self.tableView reloadData];
- }
- }];
- }
- - (void)editRelationName {
- //@"输入宝贝姓名"
- NSString* holder = self.childModel.appellation.length > 0 ? self.childModel.appellation : NSLocalizedString(@"Relation.Length", nil);
- [self showTextFieldAlertView:NSLocalizedString(@"BDI.Baby.Appellation", nil) Message:nil PlaceHolder:holder isNumber:NO callback:^(BOOL isOK, NSString *text) {
- if (isOK) {
- self.childModel.appellation = text;
- [self.tableView reloadData];
- }
- }];
- }
- - (void)editPhone {
- //@"修改手表号码"; @"请输入3~32位数字号码"
- NSString* holder = self.childModel.phoneNumber.length > 0 ? self.childModel.phoneNumber : NSLocalizedString(@"Input.Correct.Mobile.Number", nil);
- [self showTextFieldAlertView:NSLocalizedString(@"BD.Baby.PhoneNumber", nil) Message:nil PlaceHolder:holder isNumber:YES callback:^(BOOL isOK, NSString *text) {
- if (isOK) {
- self.childModel.phoneNumber = text;
- [self.tableView reloadData];
- }
- }];
- }
- - (void)editSex:(NSString*)defaultVal {
- [self modifyPickerView:EControllerSexType value:defaultVal];
- }
- - (void)editBirthday:(NSString*)defaultVal {
- [self modifyPickerView:EControllerBirthday value:self.childModel.birthday];
- }
- - (void)editHeight {
- //@"输入宝贝身高"
- [self showTextFieldAlertView:NSLocalizedString(@"BDI.Baby.Height", nil) Message:nil PlaceHolder:[NSString stringWithFormat:NSLocalizedString(@"BDI.Centimeter", nil),self.childModel.height] isNumber:YES callback:^(BOOL isOK, NSString *text) {
- if (isOK) {
- self.childModel.height = [text intValue];
- [self.tableView reloadData];
- }
- }];
- }
- - (void)editWeight {
- [self showTextFieldAlertView:NSLocalizedString(@"BDI.Baby.Weight", nil) Message:nil PlaceHolder:[NSString stringWithFormat:NSLocalizedString(@"BDI.Kilo", nil),self.childModel.weight] isNumber:YES callback:^(BOOL isOK, NSString *text) {
- if (isOK) {
- self.childModel.weight = [text intValue];
- [self.tableView reloadData];
- }
- }];
- }
- - (void)editGrade:(NSString*)defaultVal {
- [self modifyPickerView:EControllerGrade value:defaultVal];
- }
- - (void)onCountryCodeCallback:(NSString*)code {
- self.childModel.areaCode = code;
- [self.tableView reloadData];
- }
- - (void)showBabyQRCode {
- [MobClick event:@"ClickBabyQRCode"];
- SKBabyQRCodeViewController *controller = [[self storyboard] instantiateViewControllerWithIdentifier:@"BabyQRCodeVC"];
- controller.cid = self.childModel.cid;
- [self pushViewController:controller animated:YES];
- }
- - (void)showRelation {
- SKRelationViewController *controller = [[self storyboard] instantiateViewControllerWithIdentifier:@"RelationVC"];
- controller.delegate = self;
- [self pushViewController:controller animated:YES];
- }
- - (void)showScanQRcode {
- BOOL isOk = [SystemAuthorization checkCamera:self];
- if (isOk) {
- SKScanImeiViewController *controller = [[self storyboard] instantiateViewControllerWithIdentifier:@"ScanImeiVC"];
- controller.childModel = self.childModel;
- controller.from = self.from;
- [controller setHidesBottomBarWhenPushed:YES];
- [self popAndPushViewController:controller animated:YES];
- }
- }
- - (void)onLeftBarAction {
- [[DataManager shared] showSKLoginViewController];
- }
- - (void)onRelationSelected:(NSInteger)index callname:(NSString *)callname {
- self.childModel.appellation = callname;
- [self.tableView reloadData];
- }
- - (void)onImagePickerCallback:(UIImage *)image data:(NSData *)data {
- [DataManager uploadResource:RESOURCE_HEADIMAGE fileData:data callback:^(BOOL isOK, NSString * _Nonnull url) {
- if (url.length > 0) {
- self.childModel.avatar = url;
- mSaveHeadImage = image;
- [mHeaderView.mHeadImage setImage:image];
- }
- }];
- }
- @end
|