Commit dcbf94c6 authored by Achilles's avatar Achilles

add upgrade fun.

parent 2c319d5c
This diff is collapsed.
#import "AppDelegate.h"
#import "VankeFloorListBoard_iPhone.h"
#import "VankeLoginBoard_iPhone.h"
#import "VankeMainBoard_iPhone.h"
#import "VankeAppBoard_iPhone.h"
#import "VankeVersionAPI.h"
#import "GEToast.h"
@interface AppDelegate ()
@property (strong, nonatomic) NSString *newVersionUrl;//Ipa下载地址
@end
#pragma mark -
......@@ -47,15 +54,82 @@
// bee.ui.config.cacheAsyncLoad = YES;
// bee.ui.config.cacheAsyncSave = YES;
[self checkNewVersion];
[BeeUINavigationBar setTitleColor:[UIColor whiteColor]];
self.window.rootViewController = [BeeUIStack stackWithFirstBoardClass:[VankeAppBoard_iPhone class]];
// self.window.rootViewController = [BeeUIStack stackWithFirstBoardClass:[AppBoard_iPhone class]];
}
- (void)unload
{
}
-(void) checkNewVersion {
[VankeVersionAPI cancel];
VankeVersionAPI *api = [VankeVersionAPI api];
@weakify(api);
@weakify(self);
api.whenSucceed = ^{
@normalize(api);
@normalize(self);
if (api.succeed) {
[GEToast hideProgress];
if (nil == api.serverResp) {
api.failed = YES;
} else {
VersionResponse *resp = (VersionResponse*) api.serverResp;
[self performSelector:@selector(tryToUpdate:) withObject:resp];
}
}
};
api.whenFailed = ^{
@normalize(api);
@normalize(self);
[GEToast hideProgress];
};
[GEToast showProgress:self.window];
[api send];
}
-(void) tryToUpdate: (VersionResponse*) resp {
VersionNumber *newVersion = [resp newVersion];
if (nil == newVersion) {
INFO(@"没有新版本");
} else {
INFO(@"发现新版本: %@", [newVersion toString]);
self.newVersionUrl = resp.data.url;
NSString *msg = [NSString stringWithFormat:@"发现新版本: %@, 请前往下载!", [newVersion toString]];
if ([resp isForceUpdate]) {
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"新版本告知" message: msg delegate:self cancelButtonTitle:nil otherButtonTitles: @"去下载", nil];
alertV.tag = 1001;
[alertV show];
} else {
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"新版本告知" message: msg delegate:self cancelButtonTitle:@"下次再说"otherButtonTitles: @"去下载", nil];
alertV.tag = 1002;
[alertV show];
}
}
}
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag == 1001) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.newVersionUrl]];
} else if (alertView.tag == 1002) {
if (buttonIndex == 1) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.newVersionUrl]];
} else {
// TODO
}
}
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
......
......@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>1.0.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
......
//
// VankeNoticeListAPI.h
// vanke
//
// Created by xiaomi on 15/10/8.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "Bee.h"
#import "VankeBaseAPI.h"
#import "VankeResponse.h"
@class NoticeListResponse;
/*
* 查询项目列表
* http://.../wanke-server/rest/project/queryprojectsby?classificationEquals={classificationEquals}&nameLike={nameLike}&salesDateEquals={salesDateEquals}& passengerDateEquals={passengerDateEquals}&trafficDateEquals={trafficDateEquals}
*/
@interface VankeNoticeListAPI : VankeBaseAPI
// 发布日期大于等于
@property (nonatomic, strong) NSString *publishTimeBegin;
@end
// 公告信息
@interface Notice : BeeActiveObject
// 标识
@property (nonatomic, strong) NSString *noticeId;
// 标题
@property (nonatomic, strong) NSString *title;
// 发布人
@property (nonatomic, strong) NSString *publisher;
// 发布时间
@property (nonatomic, strong) NSString *publishTime;
// 优先级
@property (nonatomic, strong) NSString *priority;
// 内容
@property (nonatomic, strong) NSString *content;
// 附件
@property (nonatomic, strong) NSString *attachment;
// 是否已读
@property (nonatomic, assign) BOOL readed;
-(NSString*) getAttachmentUrl;
@end
@interface NoticeListResponse : VankeResponse
@property (nonatomic, strong) NSArray *data;
-(int) total;
@end
\ No newline at end of file
//
// VankeNoticeListAPI.m
// vanke
//
// Created by xiaomi on 15/10/8.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeNoticeListAPI.h"
#import "VankeConfig.h"
#import "VankeUtil.h"
@implementation VankeNoticeListAPI
@synthesize publishTimeBegin;
-(void) route:(BeeMessage *)msg {
if (self.sending)
{
if (![self checkToQuery]) {
return;
}
[self http_get:@"/project/queryprojectsby"].PARAM(@"publishTimeBegin", self.publishTimeBegin).TIMEOUT(10);
}
else if (self.succeed)
{
NSLog(@"response: %@", self.responseString);
// self.serverResp = [NoticeListResponse objectFromDictionary: self.responseJSONDictionary];
NoticeListResponse *resp = [[NoticeListResponse alloc] init];
NSMutableArray *ary = [[NSMutableArray alloc] initWithCapacity:10];
for (int i = 0; i < 10; ++i) {
Notice *obj = [[Notice alloc]init];
obj.noticeId = [NSString stringWithFormat:@"%d", i];
obj.title = [NSString stringWithFormat:@"重要通知%d", i];
obj.publishTime = @"2015-11-15";
obj.publisher = @"张三";
if (i % 3 == 0) {
obj.priority = @"低";
} else if (i % 3 == 1) {
obj.priority = @"中";
} else if (i % 3 == 2) {
obj.priority = @"高";
}
obj.content = @"销售录入对账单...";
obj.attachment = @"a.png";
[ary addObject:obj];
}
resp.data = ary;
self.serverResp = resp;
if ( nil == self.serverResp )
{
self.failed = YES;
return;
}
} else if (self.failed) {
NSLog(@"response: %@", self.responseString);
self.serverResp = [NoticeListResponse objectFromDictionary: self.responseJSONDictionary];
}
}
-(BOOL) checkToQuery {
// if ([VankeUtil isBlankString:self.publishTimeBegin]) {
// [self setClientError: @"发布日期不能为空"];
// return NO;
// }
return YES;
}
@end
#pragma Notice
@implementation Notice
@synthesize noticeId;
@synthesize title;
@synthesize publisher;
@synthesize publishTime;
@synthesize priority;
@synthesize content;
@synthesize attachment;
-(NSString*) getAttachmentUrl {
if ([VankeUtil isBlankString:self.attachment]) {
return nil;
} else {
return [NSString stringWithFormat:@"%@/%@", VANKE_SERVER_MEDIA_BASE_URL, self.attachment];
}
}
@end
#pragma NoticeListResponse
@implementation NoticeListResponse
@synthesize data;
CONVERT_PROPERTY_CLASS(data, Notice)
-(int) total {
return nil == data ? 0 :[data count];
}
@end
//
// VankeVersionAPI.h
// vanke
//
// Created by xiaomi on 15/11/12.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeBaseAPI.h"
#import "VankeUtil.h"
@class VersionInfo;
@class VersionResponse;
@interface VankeVersionAPI : VankeBaseAPI
@end
// 版本信息
@interface VersionInfo: BeeActiveObject
// 版本标识
@property (nonatomic, strong) NSString *uuid;
// 版本类型
@property (nonatomic, strong) NSString *type;
// 版本号
@property (nonatomic, strong) NSString *version;
// 版本下载 url
@property (nonatomic, strong) NSString *url;
// 是否强制下载
@property (nonatomic, strong) NSString *forceUpdate;
@end
// 响应
@interface VersionResponse : VankeResponse
@property (nonatomic, strong) VersionInfo *data;
/**
* 最新版本
*
* @return 如果没有更新版本,则返回nil
*/
-(VersionNumber*) newVersion;
/**
* 是否强制更新
*
* @return 是否强制更新
*/
-(BOOL) isForceUpdate;
@end
//
// VankeVersionAPI.m
// vanke
//
// Created by xiaomi on 15/11/12.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeVersionAPI.h"
@implementation VankeVersionAPI
-(void) route:(BeeMessage *)msg {
if (self.sending)
{
[self http_get:@"/ipapk"].PARAM(@"type", @"ipa").TIMEOUT(10);
}
else if (self.succeed)
{
NSLog(@"response: %@", self.responseString);
self.serverResp = [VersionResponse objectFromDictionary: self.responseJSONDictionary];
if ( nil == self.serverResp )
{
self.failed = YES;
return;
}
}
}
@end
#pragma VersionInfo
@implementation VersionInfo
@synthesize uuid;
@synthesize type;
@synthesize version;
@synthesize url;
@synthesize forceUpdate;
@end
#pragma VersionResponse
@implementation VersionResponse
@synthesize data;
-(VersionNumber*) newVersion {
if (![self isOk]) {
return nil;
}
VersionNumber *localVersion = [VankeUtil getCurrentVersion];
VersionNumber *svrVersion = [VersionNumber initWithVersion:data.version];
if ([svrVersion compareTo:localVersion] > 0) {
return svrVersion;
} else {
return nil;
}
}
-(BOOL) isForceUpdate {
return nil != data && [@"1" eq: data.forceUpdate];
}
@end
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
//
// Copyright (c) 2014-2015, Geek Zoo Studio
// http://www.bee-framework.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
#if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
#import "Bee_UIStyle.h"
#import "Bee_UICapability.h"
#pragma mark -
@interface UITextField(BeeUIStyle)
@end
#endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
//
// Copyright (c) 2014-2015, Geek Zoo Studio
// http://www.bee-framework.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
#if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
#import "UITextField+BeeUIStyle.h"
#import "UIImage+BeeExtension.h"
#import "UIColor+BeeExtension.h"
#import "UIFont+BeeExtension.h"
#import "Bee_UIStyleParser.h"
#pragma mark -
@implementation UITextField(BeeUIStyle)
+ (BOOL)supportForUIStyling
{
return YES;
}
#pragma mark -
- (void)applyInputContent:(NSMutableDictionary *)properties
{
self.font = [properties parseFontWithDefaultValue:[UIFont systemFontOfSize:12.0f]];
self.textColor = [properties parseColorWithKeys:@[@"color", @"text-color"] defaultValue:[UIColor blackColor]];
self.textAlignment = [properties parseTextAlignmentWithKeys:@[@"text-align"] defaultValue:UITextAlignmentLeft];
}
- (void)applyInputKeyboard:(NSMutableDictionary *)properties
{
self.returnKeyType = [properties parseReturnKeyTypeWithKeys:@[@"return", @"input-return", @"return-key", @"input-return-key"] defaultValue:UIReturnKeyDefault];
self.keyboardType = [properties parseKeyboardTypeWithKeys:@[@"keyboard", @"input-keyboard"] defaultValue:UIKeyboardTypeDefault];
}
- (void)applyInputValue:(NSMutableDictionary *)properties
{
self.text = [properties parseTextWithKeys:@[@"text"] defaultValue:self.text];
self.placeholder = [properties parseTextWithKeys:@[@"placeholder", @"input-placeholder"] defaultValue:self.placeholder];
self.enabled = [properties parseBoolWithKeys:@[@"disabled"] defaultValue:NO] ? NO : YES;
self.userInteractionEnabled = [properties parseBoolWithKeys:@[@"readonly"] defaultValue:NO] ? NO : YES;
NSInteger maxLength = [properties parseIntegerWithKeys:@[@"maxlength", @"input-max-length"] defaultValue:0];
if ( [self respondsToSelector:@selector(setMaxLength:)] )
{
[(BeeUITextField *)self setMaxLength:maxLength];
}
}
#pragma mark -
- (void)applyInputCorrection:(NSMutableDictionary *)properties
{
self.autocapitalizationType = [properties parseAutocapitalizationTypeWithKeys:@[@"capital", @"input-capitalization"] defaultValue:UITextAutocapitalizationTypeNone];
self.autocorrectionType = [properties parseAutocorrectionTypeWithKeys:@[@"correction", @"input-correction"] defaultValue:UITextAutocorrectionTypeDefault];
self.clearButtonMode = [properties parseTextFieldViewModeWithKeys:@[@"clear", @"input-clear"] defaultValue:UITextFieldViewModeWhileEditing];
}
- (void)applyInputAppearance:(NSMutableDictionary *)properties
{
self.secureTextEntry = [properties parseBoolWithKeys:@[@"secure", @"input-secure"] defaultValue:NO];
self.borderStyle = [properties parseTextBorderStyleWithKeys:@[@"border-style", @"input-border", @"input-border-style"] defaultValue:UITextBorderStyleNone];
}
#pragma mark -
- (void)applyUIStyling:(NSDictionary *)properties
{
NSMutableDictionary * propertiesCopy = [NSMutableDictionary dictionaryWithDictionary:properties];
[self applyInputContent:propertiesCopy];
[self applyInputKeyboard:propertiesCopy];
[self applyInputValue:propertiesCopy];
[self applyInputCorrection:propertiesCopy];
[self applyInputAppearance:propertiesCopy];
[super applyUIStyling:propertiesCopy];
}
@end
#endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
//
// Copyright (c) 2014-2015, Geek Zoo Studio
// http://www.bee-framework.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
#if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
#import "Bee_UIStyle.h"
#import "Bee_UICapability.h"
#pragma mark -
@interface UISearchBar(BeeUIStyle)
@end
#endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
//
// Copyright (c) 2014-2015, Geek Zoo Studio
// http://www.bee-framework.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
#if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
#import "UISearchBar+BeeUIStyle.h"
#import "UIImage+BeeExtension.h"
#import "UIColor+BeeExtension.h"
#import "UIFont+BeeExtension.h"
#import "Bee_UIStyleParser.h"
#pragma mark -
@implementation UISearchBar(BeeUIStyle)
+ (BOOL)supportForUIStyling
{
return YES;
}
#pragma mark -
- (void)applyInputContent:(NSMutableDictionary *)properties
{
// self.font = [properties parseFontWithDefaultValue:[UIFont systemFontOfSize:12.0f]];
// self.textColor = [properties parseColorWithKeys:@[@"color", @"text-color"] defaultValue:[UIColor blackColor]];
// self.textAlignment = [properties parseTextAlignmentWithKeys:@[@"text-align"] defaultValue:UITextAlignmentLeft];
}
- (void)applyInputKeyboard:(NSMutableDictionary *)properties
{
// self.returnKeyType = [properties parseReturnKeyTypeWithKeys:@[@"return", @"input-return", @"return-key", @"input-return-key"] defaultValue:UIReturnKeyDefault];
// self.keyboardType = [properties parseKeyboardTypeWithKeys:@[@"keyboard", @"input-keyboard"] defaultValue:UIKeyboardTypeDefault];
}
- (void)applyInputValue:(NSMutableDictionary *)properties
{
// self.text = [properties parseTextWithKeys:@[@"text"] defaultValue:self.text];
self.placeholder = [properties parseTextWithKeys:@[@"placeholder", @"input-placeholder"] defaultValue:self.placeholder];
// self.enabled = [properties parseBoolWithKeys:@[@"disabled"] defaultValue:NO] ? NO : YES;
// self.userInteractionEnabled = [properties parseBoolWithKeys:@[@"readonly"] defaultValue:NO] ? NO : YES;
//
// NSInteger maxLength = [properties parseIntegerWithKeys:@[@"maxlength", @"input-max-length"] defaultValue:0];
//
// if ( [self respondsToSelector:@selector(setMaxLength:)] )
// {
// [(BeeUITextField *)self setMaxLength:maxLength];
// }
}
#pragma mark -
- (void)applyInputCorrection:(NSMutableDictionary *)properties
{
// self.autocapitalizationType = [properties parseAutocapitalizationTypeWithKeys:@[@"capital", @"input-capitalization"] defaultValue:UITextAutocapitalizationTypeNone];
// self.autocorrectionType = [properties parseAutocorrectionTypeWithKeys:@[@"correction", @"input-correction"] defaultValue:UITextAutocorrectionTypeDefault];
// self.clearButtonMode = [properties parseTextFieldViewModeWithKeys:@[@"clear", @"input-clear"] defaultValue:UITextFieldViewModeWhileEditing];
}
- (void)applyInputAppearance:(NSMutableDictionary *)properties
{
// self.secureTextEntry = [properties parseBoolWithKeys:@[@"secure", @"input-secure"] defaultValue:NO];
// self.borderStyle = [properties parseTextBorderStyleWithKeys:@[@"border-style", @"input-border", @"input-border-style"] defaultValue:UITextBorderStyleNone];
}
#pragma mark -
- (void)applyUIStyling:(NSDictionary *)properties
{
NSMutableDictionary * propertiesCopy = [NSMutableDictionary dictionaryWithDictionary:properties];
[self applyInputContent:propertiesCopy];
[self applyInputKeyboard:propertiesCopy];
[self applyInputValue:propertiesCopy];
[self applyInputCorrection:propertiesCopy];
[self applyInputAppearance:propertiesCopy];
[super applyUIStyling:propertiesCopy];
}
@end
#endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
......@@ -39,6 +39,9 @@
#pragma mark -
@interface BeeUISearchBar : UISearchBar
AS_SIGNAL( SEARCH ) // 点击搜索按钮
@end
#endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
......@@ -34,9 +34,84 @@
#import "Bee_UISearchBar.h"
#import "UIView+BeeUISignal.h"
@interface BeeUISearchBar () <UISearchBarDelegate>
@end
#pragma mark -
@implementation BeeUISearchBar
{
BOOL _inited;
}
DEF_SIGNAL( SEARCH )
- (id)init
{
self = [super initWithFrame:CGRectZero];
if ( self )
{
[self initSelf];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if ( self )
{
[self initSelf];
}
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if ( self )
{
[self initSelf];
}
return self;
}
- (void)initSelf
{
if ( NO == _inited )
{
self.delegate = self;
_inited = YES;
[self performLoad];
}
}
#pragma UISearchBarDelegate
-(BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
return YES;
}
-(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
}
-(BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar {
return YES;
}
-(void)searchBarTextDidEndEditing:(UISearchBar *)searchBar {
}
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
}
-(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[self sendUISignal:BeeUISearchBar.SEARCH];
}
@end
#endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
......@@ -98,7 +98,9 @@ DEF_SINGLETON( BeeUITemplateParserXML );
[self map:@"pager" toClass:NSClassFromString(@"BeeUIPageControl")];
[self map:@"web" toClass:NSClassFromString(@"BeeUIWebView")];
[self map:@"progress" toClass:NSClassFromString(@"BeeUIProgressView")];
[self map:@"searchbar" toClass:NSClassFromString(@"BeeUISearchBar")];
[self map:@"segment" toClass:NSClassFromString(@"BeeUISegmentedControl")];
[self loadResource:RESOURCE_NAME];
}
......
//
// VankeNoticeListModel.h
// vanke
//
// Created by xiaomi on 15/10/8.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "Bee.h"
@interface VankeNoticeListModel : BeeStreamViewModel
// 发布时间大于
@property (nonatomic, strong) NSString *publishTimeBegin;
// 是否已读
@property (nonatomic, assign) BOOL readed;
// 公告列表
@property (nonatomic, strong) NSMutableArray *notices;
@end
//
// VankeNoticeListModel.m
// vanke
//
// Created by xiaomi on 15/10/8.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeNoticeListModel.h"
#import "VankeNoticeListAPI.h"
#undef PER_PAGE
#define PER_PAGE (30)
@implementation VankeNoticeListModel
@synthesize publishTimeBegin = _publishTimeBegin;
@synthesize notices = _notices;
@synthesize readed = _readed;
- (void)load
{
self.autoSave = YES;
self.autoLoad = YES;
self.notices = [NSMutableArray array];
}
- (void)unload
{
self.publishTimeBegin = nil;
self.notices = nil;
}
#pragma mark - cache
- (void)loadCache
{
[self.notices removeAllObjects];
[self.notices addUniqueObjectsFromArray:[Notice readObjectForKey:self.publishTimeBegin]
compare:^NSComparisonResult(id left, id right) {
return [((Notice*)left).noticeId compare:((Notice*)right).noticeId];
}];
}
- (void)saveCache
{
[Notice saveObject:self.notices forKey:self.publishTimeBegin];
}
- (void)clearCache
{
[self.notices removeAllObjects];
[Notice removeObjectForKey:self.publishTimeBegin];
}
#pragma mark - paging query
- (void)firstPage
{
[self gotoPage:1];
}
- (void)nextPage
{
if ( self.notices.count )
{
[self gotoPage:(self.notices.count / PER_PAGE + 1)];
}
}
- (void)gotoPage:(NSUInteger)page {
[VankeNoticeListAPI cancel];
VankeNoticeListAPI *api = [VankeNoticeListAPI api];
@weakify(api);
@weakify(self);
api.publishTimeBegin = self.publishTimeBegin;
api.whenUpdate = ^
{
@normalize(api);
@normalize(self);
if ( api.sending )
{
[self sendUISignal:self.RELOADING];
}
else
{
if ( api.succeed )
{
NoticeListResponse *resp = (NoticeListResponse*) api.serverResp;
if ( nil == resp || nil == resp.data )
{
api.failed = YES;
}
else
{
if ( page <= 1 )
{
[self.notices removeAllObjects];
[self.notices addObjectsFromArray:resp.data];
}
else
{
[self.notices addObjectsFromArray:resp.data];
[self.notices unique:^NSComparisonResult(id left, id right) {
return [((Notice *)left).noticeId compare:((Notice *)right).noticeId];
}];
}
self.more = (self.notices.count >= [resp total]) ? NO : YES;
self.loaded = YES;
[self saveCache];
}
}
[self sendUISignal:self.RELOADED];
}
};
[api send];
}
@end
......@@ -31,7 +31,7 @@
@implementation VankeWeatherModel
-(void) removeAll {
WeekWeather.DB.EMPTY();
DayWeather.DB.EMPTY();
self.weather = nil;
}
......@@ -44,7 +44,7 @@
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *currentDateStr = [dateFormatter stringFromDate:[NSDate date]];
self.weather = [WeekWeather.DB.WHERE(@"city", city, @"date", currentDateStr).GET_RECORDS() lastObject];
self.weather = [DayWeather.DB.WHERE(@"city", city, @"date", currentDateStr).GET_RECORDS() lastObject];
return _weather != nil;
}
......@@ -59,7 +59,7 @@
}
// delete first
WeekWeather.DB.WHERE(@"city", _weather.city, @"date", _weather.date).DELETE();
DayWeather.DB.WHERE(@"city", _weather.city, @"date", _weather.date).DELETE();
// insert new
_weather.SAVE();
......
......@@ -11,6 +11,8 @@
#import "Bee.h"
@class VersionNumber;
@interface VankeUtil : NSObject
AS_SINGLETON( VankeUtil )
......@@ -40,6 +42,47 @@ AS_SINGLETON( VankeUtil )
+ (NSString *)getHexStringForColor:(UIColor*)color;
+ (void)drawDashedBorderAroundView:(UIView *) v cornerRadius: (CGFloat) cornerRadius borderWidth: (CGFloat) borderWidth borderColor: (UIColor*) borderColor;
/**
* 当前版本
*
* @return 当前版本
*/
+ (VersionNumber*) getCurrentVersion;
@end
// 版本号
@interface VersionNumber: NSObject
@property (nonatomic, assign) NSInteger major; // 主版本
@property (nonatomic, assign) NSInteger minor; // 小版本
@property (nonatomic, assign) NSInteger build; // 编译版本号
/**
* 构造函数
*
* @param version 版本号字符串,格式:major.minor.build,如: 1.0.1
*/
+(instancetype) initWithVersion: (NSString*) version;
/**
* 版本号比较
*
* @param version 版本号
*
* @return 0:相等 1: 大于传入版本 -1: 小于传入版本
*/
-(int) compareTo: (VersionNumber*) version;
/**
* 输出版本号字符串
*
* @return 版本号字符串,格式:major.minor.build,如: 1.0.1
*/
-(NSString*) toString;
@end
......
......@@ -10,6 +10,62 @@
#import <CocoaSecurity.h>
#import "VankeUtil.h"
#pragma Version
@implementation VersionNumber
@synthesize major = _major;
@synthesize minor = _minor;
@synthesize build = _build;
+(instancetype) initWithVersion: (NSString*) version {
VersionNumber *instance = [VersionNumber alloc];
instance.major = 0;
instance.minor = 0;
instance.build = 0;
NSArray *ary = [version componentsSeparatedByString:@"."];
if (nil != ary) {
NSInteger len = [ary count];
if (len > 0) {
instance.major = [[ary objectAtIndex:0] intValue];
}
if (len > 1) {
instance.minor = [[ary objectAtIndex:1] intValue];
}
if (len > 2) {
instance.build = [[ary objectAtIndex:2] intValue];
}
}
return instance;
}
-(int) compareTo: (VersionNumber*) version {
if (nil == version) {
return 1;
}
NSInteger diff = _major - version.major;
if (diff != 0) {
return diff;
}
diff = _minor - version.minor;
if (diff != 0) {
return diff;
}
return _build - version.build;
}
-(NSString*) toString {
return [NSString stringWithFormat:@"%ld.%ld.%ld", _major, _minor, _build];
}
@end
@implementation VankeUtil
DEF_SINGLETON(VankeUtil)
......@@ -129,5 +185,57 @@ DEF_SINGLETON(VankeUtil)
return numberValue;
}
+ (void)drawDashedBorderAroundView:(UIView *) v cornerRadius: (CGFloat) cornerRadius borderWidth: (CGFloat) borderWidth borderColor: (UIColor*) borderColor {
//border definitions
// CGFloat cornerRadius = 5;
// CGFloat borderWidth = 1;
NSInteger dashPattern1 = 8;
NSInteger dashPattern2 = 8;
// UIColor *lineColor = [UIColor grayColor];
//drawing
CGRect frame = v.bounds;
CAShapeLayer *_shapeLayer = [CAShapeLayer layer];
//creating a path
CGMutablePathRef path = CGPathCreateMutable();
//drawing a border around a view
CGPathMoveToPoint(path, NULL, 0, frame.size.height - cornerRadius);
CGPathAddLineToPoint(path, NULL, 0, cornerRadius);
CGPathAddArc(path, NULL, cornerRadius, cornerRadius, cornerRadius, M_PI, -M_PI_2, NO);
CGPathAddLineToPoint(path, NULL, frame.size.width - cornerRadius, 0);
CGPathAddArc(path, NULL, frame.size.width - cornerRadius, cornerRadius, cornerRadius, -M_PI_2, 0, NO);
CGPathAddLineToPoint(path, NULL, frame.size.width, frame.size.height - cornerRadius);
CGPathAddArc(path, NULL, frame.size.width - cornerRadius, frame.size.height - cornerRadius, cornerRadius, 0, M_PI_2, NO);
CGPathAddLineToPoint(path, NULL, cornerRadius, frame.size.height);
CGPathAddArc(path, NULL, cornerRadius, frame.size.height - cornerRadius, cornerRadius, M_PI_2, M_PI, NO);
//path is set as the _shapeLayer object's path
_shapeLayer.path = path;
CGPathRelease(path);
_shapeLayer.backgroundColor = [[UIColor clearColor] CGColor];
_shapeLayer.frame = frame;
_shapeLayer.masksToBounds = NO;
[_shapeLayer setValue:[NSNumber numberWithBool:NO] forKey:@"isCircle"];
_shapeLayer.fillColor = [[UIColor clearColor] CGColor];
_shapeLayer.strokeColor = [borderColor CGColor];
_shapeLayer.lineWidth = borderWidth;
_shapeLayer.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:dashPattern1], [NSNumber numberWithInt:dashPattern2], nil];
_shapeLayer.lineCap = kCALineCapRound;
//_shapeLayer is added as a sublayer of the view, the border is visible
[v.layer addSublayer:_shapeLayer];
v.layer.cornerRadius = cornerRadius;
}
+ (VersionNumber*) getCurrentVersion {
NSString *path = [[NSBundle mainBundle]pathForResource:@"Info" ofType:@"plist"];
NSDictionary* content =[NSDictionary dictionaryWithContentsOfFile:path];
NSString *version = [content valueForKey:@"CFBundleVersion"];
return [VersionNumber initWithVersion:version];
}
@end
vanke/view_iPhone/resource/img/AnnounceTitleBG.png

1.6 KB

vanke/view_iPhone/resource/img/AnnounceTitleBG@2x.png

3.49 KB

vanke/view_iPhone/resource/img/PriorityTagGreen.png

671 Bytes

vanke/view_iPhone/resource/img/PriorityTagGreen@2x.png

1.34 KB

vanke/view_iPhone/resource/img/PriorityTagGrey.png

607 Bytes

vanke/view_iPhone/resource/img/PriorityTagGrey@2x.png

1.24 KB

vanke/view_iPhone/resource/img/PriorityTagOrange.png

665 Bytes

vanke/view_iPhone/resource/img/PriorityTagOrange@2x.png

1.31 KB

vanke/view_iPhone/resource/img/PriorityTagRed.png

667 Bytes

vanke/view_iPhone/resource/img/PriorityTagRed@2x.png

1.29 KB

vanke/view_iPhone/resource/img/right_arrow.png

257 Bytes

......@@ -27,3 +27,5 @@ AS_NOTIFICATION( HIDE_MENU )
- (void)hideMenu;
@end
......@@ -121,7 +121,7 @@ ON_NOTIFICATION3( VankeLoginBoard_iPhone, SUCC_LOGIN, notification )
[UIView commitAnimations];
// 打开默认页面
[_router open:@"home" animated:NO];
[_router open:@"home" animated:YES];
BeeUIBoard *curBoard = _router.currentBoard;
if (nil != curBoard && [curBoard isKindOfClass:[VankeMainBoard_iPhone class]]) {
[((VankeMainBoard_iPhone*) curBoard).summaryModel reload];
......@@ -204,4 +204,4 @@ ON_SIGNAL3( VankeMainTabBoard_iPhone, me, signal )
_login = nil;
}
@end
@end
\ No newline at end of file
......@@ -16,6 +16,7 @@
//
#import "VankeAffairsBoard_iPhone.h"
#import "VankeNoticeListBoard_iPhone.h"
#pragma mark -
......@@ -82,15 +83,9 @@ ON_DID_DISAPPEAR( signal )
{
}
ON_SIGNAL3(VankeAffairsBoard_iPhone, btnNotice, signal) {
// VankeServiceBoardCell_iPhone *cell = (VankeServiceBoardCell_iPhone *)signal.sourceCell;
// if ([@"当前客流" eq:[cell name]]) {
// [[VankeAppBoard_iPhone sharedInstance] hideMenu];
// [self showListView: CELL_TYPE_PASSENGER];
// } else {
// [GEToast showWithText:@"正在研发中..." bottomOffset:50.0f duration:1.0f];
// }
INFO(@"button notice pressed.");
ON_SIGNAL3(VankeAffairsBoard_iPhone, btnNotice, signal) {
VankeNoticeListBoard_iPhone * board = [VankeNoticeListBoard_iPhone board];
[self.stack pushBoard:board animated:YES];
}
ON_SIGNAL3(VankeAffairsBoard_iPhone, btnBill, signal) {
......
......@@ -10,7 +10,8 @@
AS_MODEL( VankeProjectListModel, model );
AS_OUTLET( BeeUIScrollView, list );
AS_OUTLET( BeeUITextField, txtQuery);
//AS_OUTLET( BeeUITextField, txtQuery);
AS_OUTLET( BeeUISearchBar, searchBar);
@property (assign, nonatomic) CellType listType;
......
......@@ -11,7 +11,7 @@
#import "VankeFloorListBoardCell_iPhone.h"
#import "VankePassengerDetailBoard_iPhone.h"
@interface VankeFloorListBoard_iPhone ()
@interface VankeFloorListBoard_iPhone () <UISearchBarDelegate>
@end
#pragma mark -
......@@ -31,7 +31,9 @@ SUPPORT_AUTOMATIC_LAYOUT(YES)
DEF_MODEL( VankeProjectListModel, model );
DEF_OUTLET( BeeUIScrollView, list );
DEF_OUTLET( BeeUITextField, txtQuery);
//DEF_OUTLET( BeeUITextField, txtQuery);
//DEF_OUTLET( BeeUIView, searchView);
DEF_OUTLET( BeeUISearchBar, searchBar);
+ (id)boardWithType: (CellType) type {
VankeFloorListBoard_iPhone *board = [super board];
......@@ -58,7 +60,12 @@ ON_CREATE_VIEWS( signal )
self.navigationBarShown = YES;
self.title = _projectCategory;
[self addLeftIconToTextField:_txtQuery icon:@"search"];
// [self addLeftIconToTextField:_txtQuery icon:@"search"];
// self.searchBar = [[UITextField alloc] initWithFrame:_searchView.frame];
// _searchBar.placeholder = @"请输入楼盘名称";
// _searchBar.keyboardType = UIKeyboardTypeDefault;
// _searchBar.delegate = self;
// [_searchView addSubview:_searchBar];
self.allowedSwipeToBack = YES;
......@@ -131,8 +138,7 @@ ON_CREATE_VIEWS( signal )
self.model.classificationEquals = _projectCategory;
self.model.nameLike = _projectNameLike;
self.model.salesDateEquals = _salesDate;
$(self.txtQuery).DATA(_projectNameLike);
_searchBar.text = _projectNameLike;
}
ON_DELETE_VIEWS( signal )
......@@ -141,6 +147,7 @@ ON_DELETE_VIEWS( signal )
ON_LAYOUT_VIEWS( signal )
{
// _searchBar.frame = _searchView.frame;
}
ON_WILL_APPEAR( signal )
......@@ -169,16 +176,16 @@ ON_DID_DISAPPEAR( signal )
{
}
ON_SIGNAL3( VankeFloorListBoard_iPhone, txtQuery, signal )
#pragma mark VankeFloorListBoard_iPhone
ON_SIGNAL3( VankeFloorListBoard_iPhone, searchBar, signal )
{
if ([signal is:BeeUITextField.RETURN]) {
NSString *nameLike = [VankeUtil trim:$(self.txtQuery).data];
self.model.nameLike = nameLike;
[self.model firstPage];
}
NSString *nameLike = [VankeUtil trim:_searchBar.text];
self.model.nameLike = nameLike;
[self.model firstPage];
}
#pragma mark -
#pragma mark VankeFloorListBoardCell_iPhone
ON_SIGNAL3( VankeFloorListBoardCell_iPhone, mask, signal )
{
......@@ -197,10 +204,9 @@ ON_SIGNAL3( VankeFloorListBoardCell_iPhone, mask, signal )
board.theme = self.theme;
[self.stack pushBoard:board animated:YES];
}
}
#pragma mark -
#pragma mark model
ON_SIGNAL3( VankeProjectListModel, RELOADING, signal )
{
......@@ -218,12 +224,13 @@ ON_SIGNAL3( VankeProjectListModel, RELOADED, signal )
[self.list reloadData];
}
-(void) addLeftIconToTextField: (BeeUITextField*) textField icon: (NSString*) icon {
UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:icon]];
img.frame = CGRectMake(0, 0, 35, 25);
img.contentMode = UIViewContentModeCenter;
textField.leftView = img;
textField.leftViewMode = UITextFieldViewModeAlways;
#pragma UISearchBarDelegate
-(void) searchBarSearchButtonClicked:(UISearchBar *)searchBar {
NSString *nameLike = [VankeUtil trim:_searchBar.text];
self.model.nameLike = nameLike;
[self.model firstPage];
}
@end
......@@ -4,13 +4,7 @@
<linear class="wrapper">
<image class="bg" />
<list id="list"/>
<linear orientation="v" class="head-wrapper">
<image class="bg" />
<linear orientation="h" class="search-wrapper">
<input id="txtQuery" placeholder="请输入楼盘名称" />
</linear>
</linear>
<searchbar id="searchBar" class="search-wrapper" />
</linear>
<style type="text/css">
......@@ -40,37 +34,14 @@
height: 100%;
}
.head-wrapper {
height: 48px;
.search-wrapper {
height: 45px;
width: 100%;
position: absolute;
left: 0px;
top: 64px;
}
.head-wrapper > .bg {
background-color: #fafafa;
placeholder: "请输入楼盘名称";
}
.search-wrapper {
height: 100%;
width: 100%;
v-align: center;
padding-left: 5px;
padding-right: 5px;
}
#txtQuery {
width: 100%;
height: 40px;
background-color: white;
border-width: 1px;
border-radius: 5px;
border-color: gray;
shadow-offset: 5px;
shadow-radius: 2px;
shadow-color: gray;
input-return-key: search;
}
</style>
</style>
</template>
......@@ -189,11 +189,10 @@ ON_SIGNAL3(VankeProjectSummaryModel, RELOADED, signal) {
if (self.communityDashBoard == nil) {
self.communityDashBoard = [VankeServiceDashBoard_iPhone communityDashBarod];
self.communityDashBoard.frame = CGRectMake(0, 0, 0, frame.size.height);
}
if (self.currDashBoard != nil) {
self.currDashBoard.frame = CGRectMake(0, 0, 0, frame.size.height);
self.currDashBoard.frame = CGRectMake(0, 0, 0, 0);
[self.currDashBoard removeFromSuperview];
}
......@@ -222,11 +221,10 @@ ON_SIGNAL3(VankeProjectSummaryModel, RELOADED, signal) {
if (self.centerDashBoard == nil) {
self.centerDashBoard = [VankeServiceDashBoard_iPhone centerDashBarod];
self.centerDashBoard.frame = CGRectMake(0, 0, 0, frame.size.height);
}
if (self.currDashBoard != nil) {
self.currDashBoard.frame = CGRectMake(0, 0, 0, frame.size.height);
self.currDashBoard.frame = CGRectMake(0, 0, 0, 0);
[self.currDashBoard removeFromSuperview];
}
......@@ -256,11 +254,10 @@ ON_SIGNAL3(VankeProjectSummaryModel, RELOADED, signal) {
if (self.squreDashBoard == nil) {
self.squreDashBoard = [VankeServiceDashBoard_iPhone squreDashBarod];
// self.squreDashBoard.frame = CGRectMake(frame.size.height/2, frame.size.height/2, frame.size.width, 0);
}
if (self.currDashBoard != nil) {
self.currDashBoard.frame = CGRectMake(0, 0, 0, frame.size.height);
self.currDashBoard.frame = CGRectMake(0, 0, 0, 0);
[self.currDashBoard removeFromSuperview];
}
......
......@@ -101,7 +101,7 @@
image-mode: center;
width: auto;
height: auto;
margin-top: 18px;
margin-top: 13px;
margin-right: 5px;
}
......@@ -117,7 +117,7 @@
width: auto;
height: auto;
color: white;
font-size: 30px;
font-size: 25px;
font-weight: bold;
line-num: 1;
fit-width: true;
......@@ -129,7 +129,7 @@
height: auto;
color: #fbd6d7;
font-size: 12px;
margin-top: 15px;
margin-top: 10px;
margin-left: 5px;
line-num: 1;
fit-width: true;
......
......@@ -48,9 +48,9 @@ DEF_OUTLET( VankeServiceBoardCell_iPhone, complaint );
{
self.salesInfo.imgRightBg.backgroundColor = [UIColor colorWithRed:237/255.0 green:27/255.0 blue:35/255.0 alpha:1];
[self.passenger loadDefaults:@"people.png" title:@"当前客流" bgColor:[UIColor colorWithRed:0 green:195/255.0 blue:230/255.0 alpha:1] unit:@"人" defValue:[NSNumber numberWithInt:0]];
[self.traffic loadDefaults:@"car.png" title:@"当前车流" bgColor:[UIColor colorWithRed:79/255.0 green:143/255.0 blue:248/255.0 alpha:1] unit:@"次" defValue:[NSNumber numberWithInt:0]];
[self.energy loadDefaults:@"energy.png" title:@"能耗" bgColor:[UIColor colorWithRed:149/255.0 green:200/255.0 blue:8/255.0 alpha:1] unit:@"单位" defValue:[NSNumber numberWithInt:0]];
[self.complaint loadDefaults:@"complaint.png" title:@"投诉" bgColor:[UIColor colorWithRed:252/255.0 green:67/255.0 blue:62/255.0 alpha:1] unit:@"次" defValue:[NSNumber numberWithInt:0]];
[self.traffic loadDefaults:@"car.png" title:@"租售比" bgColor:[UIColor colorWithRed:79/255.0 green:143/255.0 blue:248/255.0 alpha:1] unit:@"%" defValue:[NSNumber numberWithInt:0]];
[self.energy loadDefaults:@"energy.png" title:@"坪效" bgColor:[UIColor colorWithRed:149/255.0 green:200/255.0 blue:8/255.0 alpha:1] unit:@"元" defValue:[NSNumber numberWithInt:0]];
[self.complaint loadDefaults:@"complaint.png" title:@"客单价" bgColor:[UIColor colorWithRed:252/255.0 green:67/255.0 blue:62/255.0 alpha:1] unit:@"元" defValue:[NSNumber numberWithInt:0]];
}
- (void)unload
......@@ -66,9 +66,9 @@ DEF_OUTLET( VankeServiceBoardCell_iPhone, complaint );
if (nil != summary) {
[self.salesInfo setData:summary.salesAmount];
[self.passenger setData:summary.passengerFlowVolume];
[self.traffic setData:summary.trafficVolume];
[self.energy setData:[NSNumber numberWithInt:0]];
[self.complaint setData:[NSNumber numberWithInt:0]];
[self.traffic setData:[NSNumber numberWithFloat:15.16]];
[self.energy setData:[NSNumber numberWithInt:789]];
[self.complaint setData:[NSNumber numberWithInt:103]];
}
}
......
......@@ -155,7 +155,7 @@
image-mode: center;
width: 20px;
height: auto;
margin-top: 18px;
margin-top: 13px;
margin-right: 5px;
}
......@@ -171,7 +171,7 @@
width: auto;
height: auto;
color: white;
font-size: 30px;
font-size: 25px;
font-weight: bold;
line-num: 1;
fit-width: true;
......@@ -183,7 +183,7 @@
height: auto;
color: #fbd6d7;
font-size: 12px;
margin-top: 15px;
margin-top: 10px;
margin-left: 5px;
line-num: 1;
fit-width: true;
......
......@@ -41,6 +41,7 @@ DEF_MODEL(VankeWeatherModel, model)
if (!force) {
if([_model loadCache:curCity]) {
[self refreshUI];
return;
}
}
......
......@@ -12,7 +12,7 @@
<image id="imgWeatherIcon" />
<label id="lblCityName">上海</label>
<image id="imgPosIcon" src="location_icon.png" />
</linear/>
</linear>
</linear>
<linear class="sec-row" orientation="h">
......
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
// Powered by BeeFramework
//
//
// VankeNoticeBoard_iPhone.h
// vanke
//
// Created by xiaomi on 15/11/8.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "Bee.h"
#import "VankeNoticeListAPI.h"
#import "VankeBaseBoard.h"
#pragma mark -
@interface VankeNoticeBoard_iPhone : VankeBaseBoard
@property (strong, nonatomic) Notice* data;
AS_OUTLET( BeeUIView, viewAtts )
@end
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
// Powered by BeeFramework
//
//
// VankeNoticeBoard_iPhone.m
// vanke
//
// Created by xiaomi on 15/11/8.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeNoticeBoard_iPhone.h"
#import "VankeUtil.h"
#pragma mark -
@interface VankeNoticeBoard_iPhone()
{
BOOL addBordered;
}
@end
@implementation VankeNoticeBoard_iPhone
@synthesize data = _data;
SUPPORT_AUTOMATIC_LAYOUT( YES )
SUPPORT_RESOURCE_LOADING( YES )
DEF_OUTLET( BeeUIView, viewAtts )
- (void)load
{
}
- (void)unload
{
}
#pragma mark - Signal
ON_CREATE_VIEWS( signal )
{
[UIApplication sharedApplication].statusBarHidden = NO;
self.navigationBarShown = YES;
self.title = @"公告";
self.allowedSwipeToBack = YES;
addBordered = NO;
}
ON_DELETE_VIEWS( signal )
{
}
ON_LAYOUT_VIEWS( signal )
{
if (!addBordered) {
[VankeUtil drawDashedBorderAroundView:self.viewAtts cornerRadius:5 borderWidth:1 borderColor:[UIColor grayColor]];
addBordered = YES;
}
}
ON_WILL_APPEAR( signal )
{
}
ON_DID_APPEAR( signal )
{
}
ON_WILL_DISAPPEAR( signal )
{
}
ON_DID_DISAPPEAR( signal )
{
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<ui namespace="VankeNoticeBoard_iPhone">
<linear orientation="v" class="wrapper">
<image class="bg" />
<linear orientation="h" class="title-wrapper">
<image class="bg" />
<label id="lblTitle" class="title">通知标题</title>
</linear>
<linear orientation="h" class="row lbl-row">
<label class="label">发布人</label>
<label class="label">发布日期</label>
</linear>
<linear orientation="h" class="row">
<label id="lblPublisher" class="value">张三</label>
<label id="lblPublishTime" class="value">2014-03-01</label>
</linear>
<linear orientation="v" class="row lbl-row">
<label class="label">内容</label>
</linear>
<linear orientation="v" class="row multi-row">
<label id="lblContent" class="value">这里是重要通知</label>
</linear>
<linear orientation="v" class="row lbl-row">
<label class="label">附件</label>
</linear>
<view id="viewAtts" class="att-wrapper"></view>
</linear>
<style type="text/css">
.wrapper {
width: 100%;
height: 100%;
}
.wrapper > .bg {
position: absolute;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
background-color: #fafafa;
}
.title-wrapper {
width: 100%;
height: 50px;
align: center;
v-align: center;
margin-top: 80px;
margin-bottom: 10px;
}
.title-wrapper > .bg {
position: absolute;
top: 5px;
left: 0px;
image-src: url(AnnounceTitleBG.png);
image-mode: fit;
}
.title-wrapper .title {
width: 100%;
height: auto;
text-align: center;
color: white;
font-weight: bold;
font-size: 17px;
}
.row {
width: 100%;
height: 30px;
padding-left: 20px;
padding-right: 20px;
}
.lbl-row {
margin-top: 10px;
}
.row .label,
.row .value {
height: 100%;
width: 50%;
}
.row .label {
font-size: 15px;
color: rgb(71,143,241);
}
.row .value {
font-size: 15px;
color: gray;
}
.multi-row {
height: auto;
width: 100%;
}
.multi-row .value {
height: auto;
width: 100%;
line-num: 5;
}
.att-wrapper {
height: 120px;
width: 100%;
padding: 0px 20px 0px 20px;
/*border-width: 1px;
border-radius: 5px;
border-color: gray;*/
background-color: white;
}
</style>
</ui>
#import "Bee.h"
#import "VankeNoticeListAPI.h"
#pragma mark -
@interface VankeNoticeListBoardCell_iPhone : BeeUICell
AS_OUTLET( BeeUIImageView, imgPriority )
AS_OUTLET( BeeUILabel, lblPriority )
AS_OUTLET( BeeUILabel, lblTitle )
AS_OUTLET( BeeUILabel, lblPublisher )
AS_OUTLET( BeeUILabel, lblPublishTime )
@end
#import "VankeNoticeListBoardCell_iPhone.h"
#import "VankeUtil.h"
#pragma mark -
@implementation VankeNoticeListBoardCell_iPhone
SUPPORT_RESOURCE_LOADING(YES)
SUPPORT_AUTOMATIC_LAYOUT(YES)
DEF_OUTLET( BeeUIImageView, imgPriority )
DEF_OUTLET( BeeUILabel, lblPriority )
DEF_OUTLET( BeeUILabel, lblTitle )
DEF_OUTLET( BeeUILabel, lblPublisher )
DEF_OUTLET( BeeUILabel, lblPublishTime )
- (BOOL)dataWillChange:(id)newData
{
return newData != self.data;
}
- (void)dataDidChanged
{
Notice *obj = self.data;
if (nil == obj) {
return;
}
$(self.lblTitle).DATA(obj.title);
[self setPriority:obj.priority];
$(self.lblPublisher).DATA([NSString stringWithFormat:@"发布人: %@", obj.publisher]);
$(self.lblPublishTime).DATA([NSString stringWithFormat:@"发布时间: %@", obj.publishTime]);
}
-(void) setPriority: (NSString*) priority {
$(self.imgPriority).REMOVE_CLASS(@"low");
$(self.imgPriority).REMOVE_CLASS(@"medium");
$(self.imgPriority).REMOVE_CLASS(@"high");
if ([priority eq:@"低"]) {
$(self.imgPriority).ADD_CLASS(@"low");
} else if ([priority eq:@"中"]) {
$(self.imgPriority).ADD_CLASS(@"medium");
} else if ([priority eq:@"高"]) {
$(self.imgPriority).ADD_CLASS(@"high");
}
$(self.lblPriority).DATA(priority);
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<ui namespace="VankeNoticeListBoardCell_iPhone">
<linear orientation="h" class="wrapper">
<button id="mask" class="mask"/>
<linear orientation="v" class="flag-wrapper">
<image id="imgPriority" class="flag" />
<label id="lblPriority" class="desc" />
</linear>
<linear orientation="v" class="content-wrapper">
<linear orientation="h" class="title-wrapper">
<label id="lblTitle" class="title" />
</linear>
<linear orientation="h" class="publish-wrapper">
<label id="lblPublisher" class="publisher" />
<label id="lblPublishTime" class="publish-time" />
</linear>
</linear>
<linear orientation="v" class="indicator-wrapper">
<image class="indicator" />
</linear>
</linear>
<style type="text/css">
.wrapper {
width: 100%;
height: 100%;
padding-bottom: 1px;
}
.mask {
width: 100%;
height: 100%;
position: absolute;
left: 0px;
top: 0px;
background-color: white;
}
.flag-wrapper {
width: 50px;
height: 100%;
position: absolute;
left: 0px;
top: 0px;
align: center;
}
.flag-wrapper .flag {
}
.flag-wrapper .desc {
color: white;
width: 100%;
text-align: center;
}
.low {
image-src: url(PriorityTagGreen.png);
}
.medium {
image-src: url(PriorityTagOrange.png);
}
.high {
image-src: url(PriorityTagRed.png);
}
.content-wrapper {
width: 100%;
height: 100%;
padding: 10px 40px 0px 50px;
}
.content-wrapper .title-wrapper,
.content-wrapper .publish-wrapper {
width: 100%;
height: 50%;
}
.publisher, .publish-time {
width: auto;
height: auto;
color: gray;
}
.publish-time {
float: right;
}
.indicator-wrapper {
width: 30px;
height: 100%;
position: absolute;
right: 0px;
top: 0px;
v-align: center;
}
.indicator-wrapper .indicator {
image-src: url(right_arrow.png);
width: auto;
height: auto;
}
</style>
</ui>
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
// Powered by BeeFramework
//
//
// VankeNoticeListBoard_iPhone.h
// vanke
//
// Created by xiaomi on 15/11/8.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "Bee.h"
#import "VankeBaseBoard.h"
#import "VankeNoticeListModel.h"
#pragma mark -
@interface VankeNoticeListBoard_iPhone : VankeBaseBoard
AS_MODEL( VankeNoticeListModel, model )
AS_OUTLET( BeeUISegmentedControl, segment )
AS_OUTLET( BeeUIScrollView, list );
@end
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
// Powered by BeeFramework
//
//
// VankeNoticeListBoard_iPhone.m
// vanke
//
// Created by xiaomi on 15/11/8.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeNoticeListBoard_iPhone.h"
#import "GEToast.h"
#import "VankeUtil.h"
#import "PullLoader.h"
#import "FootLoader.h"
#import "NoDataCell_iPhoneCell.h"
#import "VankeNoticeBoard_iPhone.h"
#import "VankeNoticeListBoardCell_iPhone.h"
#define SEGMENT_UNREAD 0
#define SEGMENT_READED 1
#pragma mark -
@interface VankeNoticeListBoard_iPhone()
{
//<#@private var#>
}
@end
@implementation VankeNoticeListBoard_iPhone
SUPPORT_AUTOMATIC_LAYOUT( YES )
SUPPORT_RESOURCE_LOADING( YES )
DEF_MODEL( VankeNoticeListModel, model )
DEF_OUTLET( BeeUISegmentedControl, segment )
DEF_OUTLET( BeeUIScrollView, list )
- (void)load
{
self.model = [VankeNoticeListModel modelWithObserver:self];
}
- (void)unload
{
self.model = nil;
}
#pragma mark - Signal
ON_CREATE_VIEWS( signal )
{
[UIApplication sharedApplication].statusBarHidden = NO;
self.navigationBarShown = YES;
self.title = @"公告";
self.allowedSwipeToBack = YES;
[self.segment addTitle:@"未读" tag: SEGMENT_UNREAD];
[self.segment addTitle:@"已读" tag: SEGMENT_READED];
self.segment.tintColor = [UIColor whiteColor];
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],NSForegroundColorAttributeName, nil];
[self.segment setTitleTextAttributes:dic forState:UIControlStateSelected];
NSDictionary *dic2 = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],NSForegroundColorAttributeName, nil];
[self.segment setTitleTextAttributes:dic2 forState:UIControlStateNormal];
self.segment.selectedTag = SEGMENT_UNREAD;
self.list.headerClass = [PullLoader class];
self.list.headerShown = YES;
self.list.footerClass = [FootLoader class];
self.list.footerShown = YES;
self.list.lineCount = 1;
self.list.animationDuration = 0.2f;
self.list.baseInsets = bee.ui.config.baseInsets;
self.list.whenReloading = ^
{
self.list.total = self.model.notices.count;
if (self.model.loaded && self.list.total <= 0) {
self.list.total = 1;
BeeUIScrollItem * item = self.list.items[0];
item.size = CGSizeMake( self.list.width, 50);
item.order = 0;
item.rule = BeeUIScrollLayoutRule_Fall;
item.clazz = [NoDataCell_iPhoneCell class];
item.data = @"没有数据,请稍后重试!";
} else {
for ( BeeUIScrollItem * item in self.list.items )
{
item.size = CGSizeMake( self.list.width, 80 );
item.order = 0;
item.rule = BeeUIScrollLayoutRule_Fall;
item.clazz = [VankeNoticeListBoardCell_iPhone class];
item.data = [self.model.notices safeObjectAtIndex:item.index];
}
}
};
self.list.whenReloaded = ^
{
};
self.list.whenAnimated = ^
{
};
self.list.whenScrolling = ^
{
};
self.list.whenStop = ^
{
};
self.list.whenHeaderRefresh = ^
{
[self.model firstPage];
};
self.list.whenFooterRefresh = ^
{
[self.model nextPage];
};
self.model.publishTimeBegin = @"";
}
ON_DELETE_VIEWS( signal )
{
}
ON_LAYOUT_VIEWS( signal )
{
}
ON_WILL_APPEAR( signal )
{
self.navigationBarShown = YES;
if ( NO == self.model.loaded )
{
[self.model firstPage];
}
[BeeUIRouter sharedInstance].view.pannable = YES;
}
ON_DID_APPEAR( signal )
{
}
ON_WILL_DISAPPEAR( signal )
{
[BeeUIRouter sharedInstance].view.pannable = NO;
}
ON_DID_DISAPPEAR( signal )
{
}
ON_SIGNAL3( BeeUINavigationBar, LEFT_TOUCHED, signal )
{
}
ON_SIGNAL3( BeeUINavigationBar, RIGHT_TOUCHED, signal )
{
}
#pragma UISegmentedControl
ON_SIGNAL3( VankeNoticeListBoard_iPhone, segment, signal )
{
NSLog(@"Seg.selectedSegmentTag:%d",self.segment.selectedTag);
}
#pragma mark VankeNoticeListBoardCell_iPhone
ON_SIGNAL3( VankeNoticeListBoardCell_iPhone, mask, signal )
{
VankeNoticeBoard_iPhone *board = [VankeNoticeBoard_iPhone board];
board.data = signal.sourceCell.data;
[self.stack pushBoard:board animated:YES];
}
#pragma mark model
ON_SIGNAL3( VankeNoticeListModel, RELOADING, signal )
{
[GEToast showProgress:self.view];
self.list.headerLoading = YES;
self.list.footerLoading = YES;
}
ON_SIGNAL3( VankeNoticeListModel, RELOADED, signal )
{
[GEToast hideProgress];
self.list.headerLoading = NO;
self.list.footerLoading = NO;
self.list.footerMore = self.model.more;
[self.list reloadData];
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<ui namespace="VankeNoticeListBoard_iPhone">
<linear orientation="v" class="wrapper">
<image class="bg" />
<list id="list"/>
<linear orientation="v" class="segment-wrapper">
<image class="bg" />
<segment id="segment" />
</linear/>
</linear>
<style type="text/css">
.wrapper {
width: 100%;
height: 100%;
}
.bg {
position: absolute;
width: 100%;
height: 100%;
background-color: #fafafa;
}
.segment-wrapper {
height: 45px;
width: 100%;
position: absolute;
left: 0px;
top: 64px;
}
#segment {
height: 100%;
width: 100%;
}
#list {
position: absolute;
left: 0px;
top: 45px;
width: 100%;
height: 100%;
}
</style>
</ui>
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