Commit a1a3a0df authored by Achilles's avatar Achilles

提交个性密码等界面。

parent 3d0d5c10
......@@ -207,7 +207,6 @@
C19ADE4A1BC82ADB00206213 /* nav_orange_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = C19ADE441BC82ADB00206213 /* nav_orange_bg.png */; };
C19ADE521BC837C200206213 /* VankeBaseBoard.m in Sources */ = {isa = PBXBuildFile; fileRef = C19ADE511BC837C200206213 /* VankeBaseBoard.m */; };
C19ADE601BCABBC100206213 /* VankeAppBoard_iPhone.m in Sources */ = {isa = PBXBuildFile; fileRef = C19ADE5E1BCABBC100206213 /* VankeAppBoard_iPhone.m */; };
C19ADE641BCBE8C000206213 /* VankeSettingsBoard_iPhone.m in Sources */ = {isa = PBXBuildFile; fileRef = C19ADE631BCBE8C000206213 /* VankeSettingsBoard_iPhone.m */; };
C19BBBE21BBE85D000831290 /* VankeLoginBoard_iPhone.m in Sources */ = {isa = PBXBuildFile; fileRef = C19BBBE01BBE85D000831290 /* VankeLoginBoard_iPhone.m */; };
C19BBBE31BBE85D000831290 /* VankeLoginBoard_iPhone.xml in Resources */ = {isa = PBXBuildFile; fileRef = C19BBBE11BBE85D000831290 /* VankeLoginBoard_iPhone.xml */; };
C19BBBF91BBE85F500831290 /* VankeMainBoard_iPhone.m in Sources */ = {isa = PBXBuildFile; fileRef = C19BBBE51BBE85F500831290 /* VankeMainBoard_iPhone.m */; };
......@@ -986,8 +985,6 @@
C19ADE511BC837C200206213 /* VankeBaseBoard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VankeBaseBoard.m; path = common/VankeBaseBoard.m; sourceTree = "<group>"; };
C19ADE5D1BCABBC100206213 /* VankeAppBoard_iPhone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VankeAppBoard_iPhone.h; sourceTree = "<group>"; };
C19ADE5E1BCABBC100206213 /* VankeAppBoard_iPhone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VankeAppBoard_iPhone.m; sourceTree = "<group>"; };
C19ADE621BCBE8C000206213 /* VankeSettingsBoard_iPhone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VankeSettingsBoard_iPhone.h; path = view_iPhone/templates/settings/VankeSettingsBoard_iPhone.h; sourceTree = "<group>"; };
C19ADE631BCBE8C000206213 /* VankeSettingsBoard_iPhone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VankeSettingsBoard_iPhone.m; path = view_iPhone/templates/settings/VankeSettingsBoard_iPhone.m; sourceTree = "<group>"; };
C19BBBDF1BBE85D000831290 /* VankeLoginBoard_iPhone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VankeLoginBoard_iPhone.h; path = login/VankeLoginBoard_iPhone.h; sourceTree = "<group>"; };
C19BBBE01BBE85D000831290 /* VankeLoginBoard_iPhone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VankeLoginBoard_iPhone.m; path = login/VankeLoginBoard_iPhone.m; sourceTree = "<group>"; };
C19BBBE11BBE85D000831290 /* VankeLoginBoard_iPhone.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = VankeLoginBoard_iPhone.xml; path = login/VankeLoginBoard_iPhone.xml; sourceTree = "<group>"; };
......@@ -2307,8 +2304,6 @@
C10F16181BF77CA00065F18C /* ICRModifyPwdViewController.m */,
C10F16191BF77CA00065F18C /* ICRSystemViewController.h */,
C10F161A1BF77CA00065F18C /* ICRSystemViewController.m */,
C19ADE621BCBE8C000206213 /* VankeSettingsBoard_iPhone.h */,
C19ADE631BCBE8C000206213 /* VankeSettingsBoard_iPhone.m */,
);
name = settings;
path = ../..;
......@@ -4621,7 +4616,6 @@
C1D599191BB44B2100D297FE /* UITextField+XMLParser.m in Sources */,
C1D599521BB44B2100D297FE /* Bee_Network.m in Sources */,
C1D5991B1BB44B2100D297FE /* UIView+XMLParser.m in Sources */,
C19ADE641BCBE8C000206213 /* VankeSettingsBoard_iPhone.m in Sources */,
C12804DA1BC12A67001ECBAA /* VankeWeatherController.m in Sources */,
C1D599211BB44B2100D297FE /* Bee_FileCache.mm in Sources */,
C10F18761BF8F33B0065F18C /* VankeSettlementListAPI.m in Sources */,
......
......@@ -12,7 +12,7 @@
#pragma mark -
@interface VankeBaseAPI : BeeAPI
@interface VankeBaseAPI : BeeRoutine
// 服务器返回结果
@property (nonatomic, strong) VankeResponse *serverResp;
......
......@@ -12,9 +12,9 @@
#import "VankeMainBoard_iPhone.h"
#import "VankeLoginBoard_iPhone.h"
#import "VankeAffairsBoard_iPhone.h"
#import "VankeSettingsBoard_iPhone.h"
#import "VankeMainTabBoard_iPhone.h"
#import "ICRSystemViewController.h"
#import "ICRModifyPwdViewController.h"
#pragma mark -
......@@ -67,6 +67,7 @@ ON_CREATE_VIEWS( signal )
[self createAndShowLoginWindow];
[self observeNotification:VankeLoginBoard_iPhone.SUCC_LOGIN];
[self observeNotification:ICRSystemViewController.SUCC_LOGOUT];
[self observeNotification:ICRModifyPwdViewController.SUCC_LOGOUT];
[self observeNotification:VankeAppBoard_iPhone.HIDE_MENU];
}
......@@ -129,11 +130,12 @@ ON_NOTIFICATION3( VankeLoginBoard_iPhone, SUCC_LOGIN, notification )
ON_NOTIFICATION3( ICRSystemViewController, SUCC_LOGOUT, notification )
{
[self createAndShowLoginWindow];
_router.view.alpha = 0.0f;
[_tabbar selectHome];
[_router open:@"home" animated:NO];
[self doLogout];
}
ON_NOTIFICATION3( ICRModifyPwdViewController, SUCC_LOGOUT, notification )
{
[self doLogout];
}
ON_NOTIFICATION3( VankeAppBoard_iPhone, HIDE_MENU, notification )
......@@ -201,4 +203,15 @@ ON_SIGNAL3( VankeMainTabBoard_iPhone, me, signal )
_login = nil;
}
/**
* 退出登录
*/
-(void) doLogout {
[self createAndShowLoginWindow];
_router.view.alpha = 0.0f;
[_tabbar selectHome];
[_router open:@"home" animated:NO];
}
@end
\ No newline at end of file
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
// Powered by BeeFramework
//
......@@ -17,10 +17,13 @@
#import "VankeNoticeBoard_iPhone.h"
#import "VankeUtil.h"
#import "VankeBaseAPI.h"
#import "GEToast.h"
#import "VankeCommonModel.h"
#pragma mark -
@interface VankeNoticeBoard_iPhone()
@interface VankeNoticeBoard_iPhone ()
{
BOOL addBordered;
}
......@@ -96,6 +99,43 @@ ON_LOAD_DATAS( signal ) {
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[_data.content dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
_lblContent.attributedText = attrStr;
[self performSelector:@selector(commitReadState)];
}
/**
* 提交已读状态
*/
-(void) commitReadState {
VankeBaseAPI *api = [VankeBaseAPI api];
@weakify(api);
User *curUser = [[VankeCommonModel sharedInstance] currentUser];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *curTime = [dateFormatter stringFromDate:[NSDate date]];
NSString *url = [NSString stringWithFormat:@"/affiche/read/%@", _data.uuid];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
curTime, @"read_time",
curUser.uuid, @"user_uuid",
nil];
[api http_post:url].BODY(dict).TIMEOUT(10);
api.whenSucceed = ^{
@normalize(api);
[GEToast hideProgress];
NSLog(@"response: %@", api.responseString);
};
api.whenFailed = ^{
@normalize(api);
[GEToast hideProgress];
NSLog(@"response: %@", api.responseString);
};
[GEToast showProgress:self.view];
[api send];
}
@end
......@@ -15,6 +15,7 @@
#import "ICRHelpAndFeedBackViewController.h"
#import "ICRPlaceholderTextView.h"
#import "ICRAppMacro.h"
#import "VankeUtil.h"
@interface ICRHelpAndFeedBackViewController ()
......@@ -27,6 +28,8 @@
ON_CREATE_VIEWS( signal )
{
self.initialized = NO;
self.title = [IBTCommon localizableString:@"Feedback"];
self.view.backgroundColor = [VankeUtil colorWithHexString:@"#f6f6f6"];
}
ON_LAYOUT_VIEWS( signal )
......@@ -55,9 +58,6 @@ ON_LAYOUT_VIEWS( signal )
#pragma mark - Private Method
- (void)setupSubviews {
self.title = [IBTCommon localizableString:@"Feedback"];
UILabel *label = [[UILabel alloc] initWithFrame:(CGRect){
.origin.x = LABEL_LEFT_PANDING,
.origin.y = LABEL_LEFT_PANDING,
......@@ -102,7 +102,7 @@ ON_LAYOUT_VIEWS( signal )
color:ICR_ORANGE_BTN_COLOR target:self action:@selector(onSubmit:)];
button.frame = (CGRect){
.origin.x = LABEL_LEFT_PANDING,
.origin.y = self.view.height - SUBMIT_BUTTON_HEIGHT * 2,
.origin.y = contentView.bottom + 20.0f,
.size.width = self.view.width - LABEL_LEFT_PANDING * 2,
.size.height = SUBMIT_BUTTON_HEIGHT
};
......
......@@ -10,4 +10,7 @@
@interface ICRModifyPwdViewController : ICRBaseViewController
// 成功登出通知
AS_NOTIFICATION( SUCC_LOGOUT )
@end
......@@ -7,15 +7,19 @@
//
#import "IBTUIKit.h"
#import "VankeUtil.h"
#import "GEToast.h"
#import "IBTConstants.h"
#import "VankeBaseAPI.h"
#import "VankeCommonModel.h"
typedef NS_ENUM(NSUInteger, _InputTextTag) {
typedef NS_ENUM (NSUInteger, _InputTextTag) {
kInputOldPwd = 0,
kInputNewPwd,
kInputConfirmPwd,
};
typedef NS_ENUM(NSInteger, ChangePWDError) {
typedef NS_ENUM (NSInteger, ChangePWDError) {
kNoError = 0,
kOldPwdNotMatch,
kNewPwdIsEqualToOld,
......@@ -75,9 +79,13 @@ UITextFieldDelegate
@implementation ICRModifyPwdViewController
DEF_NOTIFICATION( SUCC_LOGOUT )
ON_CREATE_VIEWS( signal )
{
self.title = [IBTCommon localizableString:@"Change Password"];
self.view.backgroundColor = [VankeUtil colorWithHexString:@"#f6f6f6"];
}
ON_WILL_APPEAR( signal )
......@@ -87,8 +95,6 @@ ON_WILL_APPEAR( signal )
ON_DID_APPEAR( signal )
{
[self setupSubviews];
[self addTextFieldObserver];
}
ON_WILL_DISAPPEAR( signal )
......@@ -101,6 +107,14 @@ ON_DID_DISAPPEAR( signal )
{
}
ON_LAYOUT_VIEWS( signal )
{
if (nil == self.m_tableView) {
[self setupSubviews];
[self addTextFieldObserver];
}
}
//- (void)viewDidLoad {
// [super viewDidLoad];
// // Do any additional setup after loading the view.
......@@ -109,20 +123,20 @@ ON_DID_DISAPPEAR( signal )
//
//- (void)viewWillAppear:(BOOL)animated {
// [super viewWillAppear:animated];
//
//
// [self updateSubmitButtonForSending:NO];
//}
//
//- (void)viewDidAppear:(BOOL)animated {
// [super viewDidAppear:animated];
//
//
// [self addTextFieldObserver];
//}
//
//- (void)viewWillDisappear:(BOOL)animated {
//
//
// [self removeTextFieldObserver];
//
//
// [super viewWillDisappear:animated];
//}
......@@ -132,50 +146,100 @@ ON_DID_DISAPPEAR( signal )
}
#pragma mark - Action
#define ALERT_TAG 100
- (void)onSubmitAction:(id)sender {
[self updateSubmitButtonForSending:YES];
VankeBaseAPI *api = [VankeBaseAPI api];
@weakify(api);
@weakify(self);
User *curUser = [[VankeCommonModel sharedInstance] currentUser];
Enterpirse *curEnt = [[VankeCommonModel sharedInstance] currentEnt];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *curTime = [dateFormatter stringFromDate:[NSDate date]];
NSString *url = [NSString stringWithFormat:@"/user/change_password/%@", curUser.uuid];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
curTime, @"time",
curUser.code, @"operatorId",
curUser.name, @"operatorName",
curEnt.uuid, @"enterprise",
_m_oldPwdTextF.text, @"oldPassword",
_m_newPwdTextF.text, @"newPassword",
nil];
[api http_post:url].BODY(dict).TIMEOUT(10);
api.whenSucceed = ^{
@normalize(api);
[GEToast hideProgress];
NSLog(@"response: %@", api.responseString);
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@""
message:@"操作成功,请重新登录!"
delegate:self
cancelButtonTitle:@"确定"
otherButtonTitles:nil];
alert.tag = ALERT_TAG;
[alert show];
};
api.whenFailed = ^{
@normalize(api);
@normalize(self);
[GEToast hideProgress];
NSLog(@"response: %@", api.responseString);
[self updateSubmitButtonForSending:NO];
[GEToast showWithText:nil == api.errorDesc ? @"网络异常" : api.errorDesc bottomOffset:60.0f duration:2.0f];
};
[GEToast showProgress:self.view];
[api send];
}
#pragma marks -- UIAlertViewDelegate --
// ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
//
// __weak typeof(self)weakSelf = self;
// [httpCtrl doChangePassword:[_m_nsOldPassword uppercaseMD5String]
// newPassword:[_m_nsNewPassword uppercaseMD5String]
// success:^(id data) {
// __strong __typeof(weakSelf)strongSelf = weakSelf;
// [[ICRUserUtil sharedInstance] updatePassword:_m_nsNewPassword];
// [strongSelf updateSubmitButtonForSending:NO];
// [self.navigationController popViewControllerAnimated:YES];
// }
// failure:^(id data) {
// __strong __typeof(weakSelf)strongSelf = weakSelf;
// m_eLocalError = kCustomError;
// [strongSelf showTopMessage:data];
// [strongSelf updateSubmitButtonForSending:NO];
// }];
//根据被点击按钮的索引处理点击事件
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag == ALERT_TAG) {
[[VankeCommonModel sharedInstance] removeLoginInfo];
[self postNotification:self.SUCC_LOGOUT];
[self.stack popBoardAnimated:NO];
}
}
#pragma mark - Private Method
- (void)setupSubviews {
self.title = [IBTCommon localizableString:@"Change Password"];
self.m_tableView = [[IBTTableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
CGRect rect = self.view.bounds;
rect.origin.y = 30.0f;
self.m_tableView = [[IBTTableView alloc] initWithFrame:rect style:UITableViewStyleGrouped];
_m_tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[_m_tableView registerClass:[IBTTextFieldCell class] forCellReuseIdentifier:ChangePwdCellID];
_m_tableView.dataSource = self;
[self.view addSubview:_m_tableView];
UIButton *btn = nil;
UIView *tableFooter = [_m_tableView buttonViewWithTitle:[IBTCommon localizableString:@"Submit"]
color:ICR_ORANGE_BTN_COLOR
topGap:32
topGap:30
pointer:&btn
target:self
action:@selector(onSubmitAction:)];
[btn.layer setCornerRadius:5.0]; //设置矩形四个圆角半径
_m_tableView.tableFooterView = tableFooter;
self.m_submitBtn = btn;
_m_submitBtn.enabled = NO;
_m_submitBtn.userInteractionEnabled = NO;
[self.view addSubview:_m_tableView];
}
- (void)showLocalInfoWithErrror:(ChangePWDError)newError {
if (m_eLocalError == newError) {
return;
......@@ -185,15 +249,16 @@ ON_DID_DISAPPEAR( signal )
[self showTopMessage:[IBTCommon localizableString:ChangePWDErrorDescription[ m_eLocalError ]]];
}
- (void)updateSubmitButtonForSending:(BOOL)isSending {
_m_submitBtn.enabled = m_bIsNewPwdLegal && m_bIsConfirmPwdLegal;
_m_submitBtn.enabled = ![VankeUtil isBlankString:_m_oldPwdTextF.text] && m_bIsNewPwdLegal && m_bIsConfirmPwdLegal;
if (_m_submitBtn.enabled) {
[self showLocalInfoWithErrror:kNoError];
}
_m_submitBtn.userInteractionEnabled = !isSending;
[_m_submitBtn setTitle:[IBTCommon localizableString:isSending ? @"Submiting..." :@"Submit"]
[_m_submitBtn setTitle:[IBTCommon localizableString:isSending ? @"Submiting..." : @"Submit"]
forState:UIControlStateNormal];
}
......@@ -383,7 +448,7 @@ ON_DID_DISAPPEAR( signal )
object:nil];
}
- (void)inputTextEditChanged:(NSNotification *)obj{
- (void)inputTextEditChanged:(NSNotification *)obj {
UITextField *textField = obj.object;
......
......@@ -106,14 +106,14 @@ ON_DID_APPEAR( signal )
[secInfo addCell:cellInfo];
// Setting
cellInfo =
[IBTTableViewCellInfo normalCellForSel:@selector(onShowSettingView:) target:self
title:[IBTCommon localizableString:@"Setting"]
rightValue:nil
accessoryType:UITableViewCellAccessoryDisclosureIndicator];
[cellInfo addUserInfoValue:titleColor forKey:CInfoTitleColorKey];
cellInfo.fCellHeight = fCellHeight;
[secInfo addCell:cellInfo];
// cellInfo =
// [IBTTableViewCellInfo normalCellForSel:@selector(onShowSettingView:) target:self
// title:[IBTCommon localizableString:@"Setting"]
// rightValue:nil
// accessoryType:UITableViewCellAccessoryDisclosureIndicator];
// [cellInfo addUserInfoValue:titleColor forKey:CInfoTitleColorKey];
// cellInfo.fCellHeight = fCellHeight;
// [secInfo addCell:cellInfo];
// Help & Feedback
cellInfo =
......
//
// VankeSettingsBoard_iPhone.h
// vanke
//
// Created by xiaomi on 15/8/3.
// Copyright (c) 2015年 Reese. All rights reserved.
//
#import "Bee.h"
@interface VankeSettingsBoard_iPhone : BeeUIBoard<UITableViewDataSource,UITableViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIActionSheetDelegate>
// 成功登出通知
AS_NOTIFICATION( SUCC_LOGOUT )
@end
//
// VankeSettingsBoard_iPhone.m
// vanke
//
// Created by xiaomi on 15/8/3.
// Copyright (c) 2015年 Reese. All rights reserved.
//
#import "VankeSettingsBoard_iPhone.h"
#import "GEToast.h"
#import "AppDelegate.h"
#import "VankeCommonModel.h"
#define TAG_ACTION_SHEET_EXIT 0
@interface VankeSettingsBoard_iPhone()
@property UITableView *tableView;
@end
@implementation VankeSettingsBoard_iPhone
DEF_NOTIFICATION( SUCC_LOGOUT )
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
#pragma mark - Signal
ON_CREATE_VIEWS( signal )
{
self.navigationBarShown = YES;
self.navigationBarTitle = @"我";
UIColor *color = [UIColor colorWithRed:237/255.0 green:27/255.0 blue:35/255.0 alpha:1.0];
if ( IOS7_OR_LATER ) {
self.navigationController.navigationBar.barTintColor = color;
} else {
self.navigationController.navigationBar.tintColor = color;
}
UIView *topPlaceholder = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
[self.view addSubview:topPlaceholder];
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 20, self.width, self.height)];
_tableView.delegate = self;
_tableView.dataSource = self;
[self.view addSubview:_tableView];
[_tableView reloadData];
[self RELAYOUT];
}
ON_DELETE_VIEWS( signal )
{
}
ON_LAYOUT_VIEWS( signal )
{
}
ON_WILL_APPEAR( signal )
{
self.navigationBarShown = YES;
}
ON_DID_APPEAR( signal )
{
}
ON_WILL_DISAPPEAR( signal )
{
}
ON_DID_DISAPPEAR( signal )
{
}
#pragma mark ===tableview===
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
switch (section) {
case 0:
return 2;
break;
case 1:
return 3;
break;
case 2:
return 1;
break;
default:
return 0;
break;
}
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * identifier=@"infoCell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
if (indexPath.section == 2) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
} else {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
}
}
[cell.detailTextLabel setNumberOfLines:6];
[cell.detailTextLabel setText:@""];
[cell.detailTextLabel setFont:[UIFont systemFontOfSize:12]];
[cell setAccessoryType:UITableViewCellAccessoryNone];
VankeCommonModel *userModel = [VankeCommonModel sharedInstance];
User *user = [userModel currentUser];
Enterpirse *ent = [userModel currentEnt];
switch (indexPath.section) {
case 0:
switch (indexPath.row) {
case 0:
if (nil != user) {
[cell.textLabel setText:@"当前用户"];
[cell.detailTextLabel setText:user.name];
}
break;
case 1:
if (nil != ent) {
[cell.textLabel setText:@"所属企业"];
[cell.detailTextLabel setText:ent.name];
}
break;
default:
break;
}
break;
case 1:
switch (indexPath.row) {
case 0:
[cell.textLabel setText:@"当前版本"];
[cell.detailTextLabel setText:@"1.0.1"];
break;
case 1:
[cell.textLabel setText:@"关于万科"];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
break;
case 2:
[cell.textLabel setText:@"修改密码"];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
break;
default:
break;
}
break;
case 2:
[cell.textLabel setText:@"退出登录"];
[cell.textLabel setTextColor:[UIColor colorWithRed:237/255.0 green:27/255.0 blue:35/255.0 alpha:1.0]];
[cell.textLabel setTextAlignment:NSTextAlignmentCenter];
[cell setAccessoryType:UITableViewCellAccessoryNone];
break;
default:
break;
}
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.section) {
case 0:
break;
case 1:
switch (indexPath.row) {
case 2:
// 修改密码
break;
default:
break;
}
break;
case 2:
[self confirmToLogout];
break;
default:
break;
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// if (indexPath.section==0 && indexPath.row==0) {
// return 80;
// }else
return 45;
}
-(void) confirmToLogout {
UIActionSheet *as=[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"退出登录" otherButtonTitles:@"退出应用", nil ];
as.tag = TAG_ACTION_SHEET_EXIT;
[as showInView:self.view];
}
-(void) doLogout {
// 删除当前用户
VankeCommonModel *userModel = [VankeCommonModel sharedInstance];
[userModel removeLoginInfo];
[self postNotification:self.SUCC_LOGOUT];
}
- (void)exitApplication {
AppDelegate *app = [UIApplication sharedApplication].delegate;
UIWindow *window = app.window;
[UIView animateWithDuration:1.0f animations:^{
window.alpha = 0;
window.frame = CGRectMake(0, window.bounds.size.width, 0, 0);
} completion:^(BOOL finished) {
exit(0);
}];
//exit(0);
}
#pragma mark ----------ActionSheet 按钮点击-------------
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (actionSheet.tag == TAG_ACTION_SHEET_EXIT) {
if (buttonIndex == 0) {
[self doLogout];
} else if (buttonIndex == 1) {
[self exitApplication];
}
}
}
-(void) processGenderSelection: (UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
if (section > 0) {
return 20;
} else {
return 40;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 1;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *view=[[UIView alloc] initWithFrame:CGRectZero];
return view;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIView *view=[[UIView alloc] initWithFrame:CGRectZero];
return view;
}
@end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment