Commit 41a8146f authored by Sandy's avatar Sandy

店铺设置完成 接口调通 (修改头像未完成)

parent 8a12ec72
......@@ -48,6 +48,9 @@
191AEE811CBCEE6B00F5E535 /* JavenOperator.m in Sources */ = {isa = PBXBuildFile; fileRef = 191AEE7D1CBCEE6B00F5E535 /* JavenOperator.m */; };
191AEE841CBCEE8C00F5E535 /* JavenHotTagsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 191AEE831CBCEE8C00F5E535 /* JavenHotTagsModel.m */; };
191AEE881CBCF8E000F5E535 /* CommoditySearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 191AEE861CBCF8E000F5E535 /* CommoditySearchViewController.m */; };
192860FF1CBF708C00FA6E85 /* MBProgressHUD+Javen.m in Sources */ = {isa = PBXBuildFile; fileRef = 192860FE1CBF708C00FA6E85 /* MBProgressHUD+Javen.m */; };
192861041CBF825100FA6E85 /* JavenOwner.m in Sources */ = {isa = PBXBuildFile; fileRef = 192861011CBF825100FA6E85 /* JavenOwner.m */; };
192861051CBF825100FA6E85 /* JavenShop.m in Sources */ = {isa = PBXBuildFile; fileRef = 192861031CBF825100FA6E85 /* JavenShop.m */; };
1929F16D1C9FCB62000E9B26 /* NSDictionary+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929F16C1C9FCB62000E9B26 /* NSDictionary+Category.m */; };
1929F16F1C9FCFA6000E9B26 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1929F16E1C9FCFA6000E9B26 /* Assets.xcassets */; };
1929F17C1CA0DD77000E9B26 /* HomeTopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929F17B1CA0DD77000E9B26 /* HomeTopView.m */; };
......@@ -131,6 +134,7 @@
19ADD38A1CA4E4BD00EE6E5A /* AddCommodityHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 19ADD3891CA4E4BD00EE6E5A /* AddCommodityHeaderView.m */; };
19ADD38E1CA4EC1000EE6E5A /* AddCommodityHeaderCollectionReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 19ADD38C1CA4EC1000EE6E5A /* AddCommodityHeaderCollectionReusableView.m */; };
19ADD38F1CA4EC1000EE6E5A /* AddCommodityHeaderCollectionReusableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 19ADD38D1CA4EC1000EE6E5A /* AddCommodityHeaderCollectionReusableView.xib */; };
19DC6AFC1CBF867E0064A9FD /* JavenShopModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 19DC6AFB1CBF867E0064A9FD /* JavenShopModel.m */; };
19DCCB591C9A9EB30072C3BF /* IBTAudioController.m in Sources */ = {isa = PBXBuildFile; fileRef = 19DCCB0C1C9A9EB30072C3BF /* IBTAudioController.m */; };
19DCCB5A1C9A9EB30072C3BF /* IBTAudioRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 19DCCB0E1C9A9EB30072C3BF /* IBTAudioRecorder.m */; };
19DCCB5B1C9A9EB30072C3BF /* IBTAudioServicesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 19DCCB101C9A9EB30072C3BF /* IBTAudioServicesManager.m */; };
......@@ -305,6 +309,12 @@
191AEE831CBCEE8C00F5E535 /* JavenHotTagsModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavenHotTagsModel.m; sourceTree = "<group>"; };
191AEE851CBCF8E000F5E535 /* CommoditySearchViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommoditySearchViewController.h; sourceTree = "<group>"; };
191AEE861CBCF8E000F5E535 /* CommoditySearchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommoditySearchViewController.m; sourceTree = "<group>"; };
192860FD1CBF708C00FA6E85 /* MBProgressHUD+Javen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MBProgressHUD+Javen.h"; sourceTree = "<group>"; };
192860FE1CBF708C00FA6E85 /* MBProgressHUD+Javen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MBProgressHUD+Javen.m"; sourceTree = "<group>"; };
192861001CBF825100FA6E85 /* JavenOwner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavenOwner.h; sourceTree = "<group>"; };
192861011CBF825100FA6E85 /* JavenOwner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavenOwner.m; sourceTree = "<group>"; };
192861021CBF825100FA6E85 /* JavenShop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavenShop.h; sourceTree = "<group>"; };
192861031CBF825100FA6E85 /* JavenShop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavenShop.m; sourceTree = "<group>"; };
1929F16B1C9FCB62000E9B26 /* NSDictionary+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Category.h"; sourceTree = "<group>"; };
1929F16C1C9FCB62000E9B26 /* NSDictionary+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Category.m"; sourceTree = "<group>"; };
1929F16E1C9FCFA6000E9B26 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
......@@ -447,6 +457,8 @@
19ADD38B1CA4EC1000EE6E5A /* AddCommodityHeaderCollectionReusableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddCommodityHeaderCollectionReusableView.h; sourceTree = "<group>"; };
19ADD38C1CA4EC1000EE6E5A /* AddCommodityHeaderCollectionReusableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddCommodityHeaderCollectionReusableView.m; sourceTree = "<group>"; };
19ADD38D1CA4EC1000EE6E5A /* AddCommodityHeaderCollectionReusableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AddCommodityHeaderCollectionReusableView.xib; sourceTree = "<group>"; };
19DC6AFA1CBF867E0064A9FD /* JavenShopModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavenShopModel.h; sourceTree = "<group>"; };
19DC6AFB1CBF867E0064A9FD /* JavenShopModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavenShopModel.m; sourceTree = "<group>"; };
19DCCACD1C9A9AD60072C3BF /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
19DCCB0B1C9A9EB30072C3BF /* IBTAudioController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IBTAudioController.h; sourceTree = "<group>"; };
19DCCB0C1C9A9EB30072C3BF /* IBTAudioController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IBTAudioController.m; sourceTree = "<group>"; };
......@@ -792,6 +804,10 @@
191AEE7B1CBCEE6B00F5E535 /* JavenLastModifyInfo.m */,
191AEE7C1CBCEE6B00F5E535 /* JavenOperator.h */,
191AEE7D1CBCEE6B00F5E535 /* JavenOperator.m */,
192861001CBF825100FA6E85 /* JavenOwner.h */,
192861011CBF825100FA6E85 /* JavenOwner.m */,
192861021CBF825100FA6E85 /* JavenShop.h */,
192861031CBF825100FA6E85 /* JavenShop.m */,
);
path = ModelsFiles;
sourceTree = "<group>";
......@@ -1182,6 +1198,8 @@
19DCCA861C9A95E70072C3BF /* Model */ = {
isa = PBXGroup;
children = (
19DC6AFA1CBF867E0064A9FD /* JavenShopModel.h */,
19DC6AFB1CBF867E0064A9FD /* JavenShopModel.m */,
1900A3441CB6305100B2B7C4 /* Commodity */,
1900A3451CB6305100B2B7C4 /* CommodityManagement */,
1900A3461CB6305100B2B7C4 /* Order */,
......@@ -1458,6 +1476,8 @@
197975411CAA23BC00407E3F /* UITableView+Category.m */,
199B4D721CABE4B300451E0E /* NSString+Category.h */,
199B4D731CABE4B300451E0E /* NSString+Category.m */,
192860FD1CBF708C00FA6E85 /* MBProgressHUD+Javen.h */,
192860FE1CBF708C00FA6E85 /* MBProgressHUD+Javen.m */,
);
path = Categories;
sourceTree = "<group>";
......@@ -1799,7 +1819,9 @@
19DCCB641C9A9EB30072C3BF /* IBTTableViewUserInfo.m in Sources */,
19DCCBD91C9AA0450072C3BF /* IBTTextFieldCell.m in Sources */,
19DCCB741C9A9EB30072C3BF /* IBTUISearchBar.m in Sources */,
192861041CBF825100FA6E85 /* JavenOwner.m in Sources */,
19DCCBDB1C9AA0450072C3BF /* GXFButtonAndLineView.m in Sources */,
19DC6AFC1CBF867E0064A9FD /* JavenShopModel.m in Sources */,
1929F1841CA0EA64000E9B26 /* MoneyView.m in Sources */,
191AEE111CBB818600F5E535 /* UserInfoCreateInfo.m in Sources */,
19ADD3801CA4D38B00EE6E5A /* SortView.m in Sources */,
......@@ -1816,6 +1838,8 @@
19DCCBD01C9AA0450072C3BF /* UIImage+WaterMark.m in Sources */,
19DCCB761C9A9EB30072C3BF /* IBTUIView.m in Sources */,
191AEE191CBB83EF00F5E535 /* UserInfo.m in Sources */,
192860FF1CBF708C00FA6E85 /* MBProgressHUD+Javen.m in Sources */,
192861051CBF825100FA6E85 /* JavenShop.m in Sources */,
191AEE161CBB818600F5E535 /* UserInfoShop.m in Sources */,
19DCCB691C9A9EB30072C3BF /* IBTObject.m in Sources */,
19DCCBDD1C9AA0450072C3BF /* IBTFileManager.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "btn_commodity_manager.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_commodity_manager@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "btn_share_shop.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_share_shop@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "btn_shop_qrcode.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_shop_qrcode@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Checkmark.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Checkmark@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Checkmark@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
//
// JavenShopModel.h
//
// Created by Z on 16/4/14
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class JavenOwner, JavenLastModifyInfo, JavenCreateInfo;
@interface JavenShopModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) BOOL days7Refund;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, strong) JavenOwner *owner;
@property (nonatomic, assign) id upper;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *path;
@property (nonatomic, strong) JavenLastModifyInfo *lastModifyInfo;
@property (nonatomic, assign) id contact;
@property (nonatomic, assign) double version;
@property (nonatomic, assign) double favorited;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) NSArray *roles;
@property (nonatomic, assign) id upperOrgPath;
@property (nonatomic, assign) double grade;
@property (nonatomic, assign) id siteDomain;
@property (nonatomic, strong) NSString *pictures;
@property (nonatomic, strong) JavenCreateInfo *createInfo;
@property (nonatomic, assign) double order;
@property (nonatomic, copy) NSString *internalBaseClassDescription;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (instancetype)updateWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
This diff is collapsed.
......@@ -7,14 +7,22 @@
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger,ActionType)
{
ActionTypeDelete = 10001,
ActionTypeOnline,
ActionTypeOffline
};
@interface CommodityMutipleSelectBottomView : UIView
@property (weak, nonatomic) IBOutlet UIButton *buttonSelectAll;
@property (weak, nonatomic) IBOutlet UIButton *buttonDelete;
@property (weak, nonatomic) IBOutlet UIButton *buttonPutOnShelf;
@property (weak, nonatomic) IBOutlet UIButton *buttonPutOffShelf;
@property (weak, nonatomic) IBOutlet UIButton *buttonPutOnShelf;
- (void)selectAll;
- (void)deselectAll;
- (void)addTarget:(id)target delete:(SEL)deletAction online:(SEL)onlineAction offline:(SEL)offlineAction;
@end
......@@ -14,7 +14,11 @@
@end
@implementation CommodityMutipleSelectBottomView
- (void)awakeFromNib {
self.buttonDelete.tag = ActionTypeDelete;
self.buttonPutOnShelf.tag = ActionTypeOnline;
self.buttonPutOffShelf.tag = ActionTypeOffline;
}
- (void)selectAll {
[self.buttonSelectAll setImage:[UIImage imageNamed:@"mutipleselect"] forState:UIControlStateNormal];
......@@ -22,6 +26,14 @@
- (void)deselectAll {
[self.buttonSelectAll setImage:[UIImage imageNamed:@"mutipleDeselect"] forState:UIControlStateNormal];
}
- (void)addTarget:(id)target delete:(SEL)deletAction online:(SEL)onlineAction offline:(SEL)offlineAction
{
[self.buttonDelete addTarget:target action:deletAction forControlEvents:UIControlEventTouchUpInside];
[self.buttonPutOnShelf addTarget:target action:onlineAction forControlEvents:UIControlEventTouchUpInside];
[self.buttonPutOffShelf addTarget:target action:offlineAction forControlEvents:UIControlEventTouchUpInside];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
......
......@@ -122,8 +122,8 @@
</variation>
<connections>
<outlet property="buttonDelete" destination="QZW-mi-oUQ" id="QkC-Os-mZt"/>
<outlet property="buttonPutOffShelf" destination="5Md-Ga-YFh" id="HtN-0S-ZGt"/>
<outlet property="buttonPutOnShelf" destination="k9d-7S-PR5" id="Wlk-iX-4dW"/>
<outlet property="buttonPutOffShelf" destination="k9d-7S-PR5" id="eis-Jq-2Dp"/>
<outlet property="buttonPutOnShelf" destination="5Md-Ga-YFh" id="sGP-e9-G4I"/>
<outlet property="buttonSelectAll" destination="kJF-jD-kCU" id="kA0-eB-Qe3"/>
</connections>
<point key="canvasLocation" x="-242" y="58.5"/>
......
......@@ -47,8 +47,13 @@
self.direction = @"desc";
[self setUpNavigationbar];
[self setUpViews];
[self setUpData];
[self setUpSearchBar];
[self setUpData];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// [self resetReloadData];
}
- (void)setUpSearchBar {
......@@ -92,6 +97,11 @@
[self.view addSubview:self.topView];
[self.view addSubview:self.sorView];
//设置现在默认选中的排序方式
[self.sorView defaultSelectISLeft:YES row:0];
self.topView.isLeft = YES;
self.topView.row = 0;
WS(weakSelf)
self.sorView.leftTableSelect = ^(NSInteger row){
[weakSelf leftSelectCodtition:row];
......@@ -304,10 +314,6 @@
return _topView;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//[self.navigationController setNavigationBarHidden:NO];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -9,9 +9,10 @@
#import "HomeViewController.h"
#import "HomeTopView.h"
#import "HomeCollectionViewController.h"
#import "JavenShopModel.h"
@interface HomeViewController ()
@property (nonatomic, strong) JavenShopModel *shopModel;
@end
@implementation HomeViewController
......@@ -24,8 +25,27 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES];
[self setUpdata];
}
- (void)setUpdata {
WS(weakSelf)
[[HTTPCilent shareCilent] GET:[NSString stringWithFormat:@"shop/get/%@", [UserInfo shareInstance].shop.uuid] parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
if (weakSelf.shopModel) {
[weakSelf.shopModel updateWithDictionary:responseObject[@"shop"]];
}else{
weakSelf.shopModel = [JavenShopModel modelObjectWithDictionary:responseObject[@"shop"]];
}
CLog(@"%p",weakSelf.shopModel);
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)setUpView {
HomeTopView *viewHomeTop = [HomeTopView viewWithNibName:@"HomeTopView"];
[self.view addSubview:viewHomeTop];
......
......@@ -13,5 +13,7 @@
@property (nonatomic, strong) CommodityManagementSortView *sorView;
@property (nonatomic, strong) NSMutableArray *arrCellData;
@property (nonatomic, assign) BOOL isLeft;//判断排序判断选中了左边还是右边
@property (nonatomic, assign) NSInteger row;//判断排序判断选中了哪一行
@property (nonatomic, assign) NSInteger row;//判断排序判断选中了哪一行
@property (nonatomic, copy) NSString *condition;
@end
......@@ -10,6 +10,9 @@
#import "CommodityTableViewCell.h"
#import "UITableView+Category.h"
#import "CommodityMutipleSelectBottomView.h"
#import "NSDate+FormatterAdditions.h"
#import "MBProgressHUD+Javen.h"
#define kPageSize @999
#define kCellId @"CommodityTableViewCell.h"
......@@ -19,19 +22,27 @@
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, copy) NSString *field; //排序的字段
@property (nonatomic, copy) NSString *direction; //排序的顺序 升序或降序
@property (nonatomic, copy) NSString *condition;
@property (nonatomic, strong) NSMutableArray *deleteArr;
@property (nonatomic, strong) NSMutableDictionary *dicSelectIds;
@end
@implementation ManagementViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.condition = @"shop online only";
self.field = @"";
self.direction = @"desc";
self.navigationItem.title = @"批量管理";
[self setUpViews];
// Do any additional setup after loading the view.
}
- (void)setUpViews
{
[self.view addSubview:self.sorView];
[self.sorView defaultSelectISLeft:self.isLeft row:self.row];
WS(weakSelf)
......@@ -54,11 +65,18 @@
_bottomView = [CommodityMutipleSelectBottomView viewWithNibName:@"CommodityMutipleSelectBottomView"];
_bottomView.frame = CGRectMake(0, kHeight - 64 - 70, kWidth, 70 + 64);
[_bottomView addTarget:self delete:@selector(multipleACtion:) online:@selector(multipleACtion:) offline:@selector(multipleACtion:)];
[self.view addSubview:_bottomView];
[_bottomView.buttonSelectAll addTarget:self action:@selector(selectAll:) forControlEvents:UIControlEventTouchUpInside];
// Do any additional setup after loading the view.
}
- (NSMutableDictionary *)dicSelectIds {
if (!_dicSelectIds) {
_dicSelectIds = [NSMutableDictionary dictionary];
}
return _dicSelectIds;
}
- (void)leftSelectCodtition:(NSInteger)row {
......@@ -123,6 +141,7 @@
//改变排序条件之后重新请求数据
- (void)resetReloadData {
[self.sorView defaultSelectISLeft:YES row:0];
[self.arrCellData removeAllObjects];
[self setUpData];
......@@ -167,17 +186,24 @@
- (void)selectAll:(UIButton *)btn {//tag 等于1表示全选
if (btn.tag == 0) {
[self.bottomView selectAll];
for (int i = 0; i < 10; i ++) {
for (int i = 0; i < self.arrCellData.count; i ++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0];
[self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionTop];
CommotityListModel *model = self.arrCellData[indexPath.row];
[self.dicSelectIds setValue:@"" forKey: model.uuid];
}
btn.tag = 1;
}else{
[self.bottomView deselectAll];
for (int i = 0; i < 10; i ++) {
for (int i = 0; i < self.arrCellData.count; i ++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
CommotityListModel *model = self.arrCellData[indexPath.row];
[self.dicSelectIds removeObjectForKey:model.uuid];
}
btn.tag = 0;
......@@ -213,6 +239,84 @@
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CommotityListModel *model = self.arrCellData[indexPath.row];
[self.dicSelectIds setValue:@"" forKey: model.uuid];
CLog(@"%@",self.dicSelectIds.allKeys);
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
CommotityListModel *model = self.arrCellData[indexPath.row];
[self.dicSelectIds removeObjectForKey:model.uuid];
CLog(@"%@",self.dicSelectIds.allKeys);
}
#pragma mark =========== 删除、上架、下架 ===========
- (void)multipleACtion:(UIButton *)btn
{
NSString *questUrl;
switch (btn.tag) {
case ActionTypeDelete:
{
questUrl = @"shop/removeGoods";
CLog(@"delete");
}
break;
case ActionTypeOnline:
{
questUrl = @"shop/onlineGoods";
CLog(@"online");
}
break;
case ActionTypeOffline:
{
questUrl = @"shop/offlineGoods";
CLog(@"offline");
}
break;
default:
break;
}
NSArray *arrGoodsUuid = self.dicSelectIds.allKeys;
NSDictionary *params = @{@"operCtx" : @{@"time" : [[NSDate date] timeStampNumber],
@"domain" : [UserInfo shareInstance].domain,
@"operator" : @{@"id" : [UserInfo shareInstance].uuid,
@"fullName" : [UserInfo shareInstance].name}},
@"shopUuid" : [UserInfo shareInstance].shop.uuid,
@"listGoodsUuid" : arrGoodsUuid};
WS(weakSelf)
[[HTTPCilent shareCilent] POST:questUrl parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:weakSelf.view];
[self.view addSubview:hud];
if ([responseObject[@"code"] isEqualToNumber:@0]) {
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.tintColor = kSysWhite;
hud.customView = imageView;
hud.mode = MBProgressHUDModeCustomView;
hud.labelText = @"操作成功!";
[weakSelf.dicSelectIds removeAllObjects];
[weakSelf resetReloadData];
}else{
hud.mode = MBProgressHUDModeText;
hud.labelText = @"未知错误!";
}
[hud show:YES];
[hud hide:YES afterDelay:0.7];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
#pragma mark =========== lazyloading ===========
......
......@@ -15,6 +15,10 @@
@interface StoreManagermentViewController ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
@property (nonatomic, strong) SelectPhotoView *photoView;
@property (nonatomic, strong) CoverShadowView *shadowView;
@property (nonatomic, strong) JavenShopModel *shopModel;
@property (weak, nonatomic) IBOutlet UILabel *labelName;
@property (weak, nonatomic) IBOutlet UILabel *labelDescription;
@end
@implementation StoreManagermentViewController
......@@ -27,6 +31,28 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self setUpdata];
}
- (void)setUpdata {
WS(weakSelf)
[[HTTPCilent shareCilent] GET:[NSString stringWithFormat:@"shop/get/%@", [UserInfo shareInstance].shop.uuid] parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
if (weakSelf.shopModel) {
[weakSelf.shopModel updateWithDictionary:responseObject[@"shop"]];
}else{
weakSelf.shopModel = [JavenShopModel modelObjectWithDictionary:responseObject[@"shop"]];
}
CLog(@"%p",weakSelf.shopModel);
weakSelf.labelName.text = weakSelf.shopModel.name;
weakSelf.labelDescription.text = weakSelf.shopModel.internalBaseClassDescription;
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (SelectPhotoView *)photoView {
......@@ -113,11 +139,13 @@
- (IBAction)shopName:(id)sender {
StoreNameViewController *nameVC = [[StoreNameViewController alloc] initWithNibName:@"StoreNameViewController" bundle:nil];
nameVC.isShowNavigationBar = YES;
nameVC.shopModel = self.shopModel;
[self.navigationController pushViewController:nameVC animated:YES];
}
- (IBAction)shopIntroduction:(id)sender {
introductionViewController *introVC = [[introductionViewController alloc] initWithNibName:@"introductionViewController" bundle:nil];
introVC.isShowNavigationBar = YES;
introVC.shopModel = self.shopModel;
[self.navigationController pushViewController:introVC animated:YES];
}
- (IBAction)shopLV:(id)sender {
......
......@@ -7,7 +7,7 @@
//
#import "IBTUIViewController.h"
#import "JavenShopModel.h"
@interface StoreNameViewController : IBTUIViewController
@property (nonatomic, strong) JavenShopModel *shopModel;
@end
......@@ -9,6 +9,7 @@
#import "StoreNameViewController.h"
@interface StoreNameViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textFieldName;
@end
......@@ -21,6 +22,52 @@
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
- (IBAction)saveName:(id)sender {
[self.view endEditing:YES];
UserInfo *user = [UserInfo shareInstance];
self.shopModel.name = self.textFieldName.text;
[JavenShopModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{
return @{@"operatorIdentifier":@"id"};
}];
NSDictionary *dicShop = [self.shopModel dictionaryRepresentation];
NSDictionary *params = @{@"operCtx" : @{@"time" : [[NSDate date] timeStampNumber],
@"domain" : user.domain,
@"operator" : @{@"id" : user.uuid,
@"fullName" : user.name}},
@"shop" : dicShop};
WS(weakSelf)
MBProgressHUD *hud = [MBProgressHUD Javen_showMessage:@"修改中" onView:self.view];
[[HTTPCilent shareCilent] POST:@"shop/save" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber:@0]) {
[hud hide:YES];
[MBProgressHUD Javen_showSuccess:@"修改成功!" onView:weakSelf.view delay:0.7 complete:^{
[weakSelf popAction];
}];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -7,6 +7,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="StoreNameViewController">
<connections>
<outlet property="textFieldName" destination="deL-BR-euJ" id="OIx-Pb-9nH"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......@@ -56,6 +57,9 @@
<exclude reference="t3f-bF-Bfe"/>
</mask>
</variation>
<connections>
<action selector="saveName:" destination="-1" eventType="touchUpInside" id="mS1-h5-lZX"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.94901960784313721" green="0.94901960784313721" blue="0.94901960784313721" alpha="1" colorSpace="calibratedRGB"/>
......
......@@ -7,7 +7,7 @@
//
#import "IBTUIViewController.h"
#import "JavenShopModel.h"
@interface introductionViewController : IBTUIViewController
@property (nonatomic, strong) JavenShopModel *shopModel;
@end
......@@ -9,6 +9,7 @@
#import "introductionViewController.h"
@interface introductionViewController ()
@property (weak, nonatomic) IBOutlet UITextView *textViewInstroduction;
@end
......@@ -18,6 +19,39 @@
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (IBAction)safeIntroductionAction:(id)sender {
[self.view endEditing:YES];
UserInfo *user = [UserInfo shareInstance];
self.shopModel.internalBaseClassDescription = self.textViewInstroduction.text;
[JavenShopModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{
return @{@"operatorIdentifier":@"id"};
}];
NSDictionary *dicShop = [self.shopModel dictionaryRepresentation];
NSDictionary *params = @{@"operCtx" : @{@"time" : [[NSDate date] timeStampNumber],
@"domain" : user.domain,
@"operator" : @{@"id" : user.uuid,
@"fullName" : user.name}},
@"shop" : dicShop};
MBProgressHUD *hud = [MBProgressHUD Javen_showMessage:@"修改中" onView:self.view];
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"shop/save" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber:@0]) {
[hud hide:YES];
[MBProgressHUD Javen_showSuccess:@"修改成功!" onView:weakSelf.view delay:0.7 complete:^{
[weakSelf popAction];
}];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -7,6 +7,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="introductionViewController">
<connections>
<outlet property="textViewInstroduction" destination="JdS-U6-Nfk" id="IFA-3I-sIo"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......@@ -54,6 +55,9 @@
<exclude reference="PUr-Us-CDz"/>
</mask>
</variation>
<connections>
<action selector="safeIntroductionAction:" destination="-1" eventType="touchUpInside" id="vWj-n3-Pn5"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
......
......@@ -65,10 +65,10 @@
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="1" placeholder="请输入密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mu2-3E-jKv">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mu2-3E-jKv">
<rect key="frame" x="70" y="65" width="273" height="22"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<textInputTraits key="textInputTraits"/>
<textInputTraits key="textInputTraits" secureTextEntry="YES"/>
</textField>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......
......@@ -43,29 +43,29 @@
//本地已有密码时登录
- (void)defaultLoginAction {
// if ([[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]) {
//
// NSDictionary *paramers = @{@"domain":kDomain,
// @"loginName":[[NSUserDefaults standardUserDefaults] objectForKey:@"userName"] ,
// @"password":[[NSUserDefaults standardUserDefaults] objectForKey:@"passWord"],
// @"rememberMe":@"true"};
// [MBProgressHUD showHUDAddedTo:self.view animated:YES];
// WS(weakSelf)
// [[HTTPCilent shareCilent] POST:@"app/resellerLogin" parameters:paramers success:^(NSURLSessionDataTask *task, id responseObject) {
// UserInfo *info = [UserInfo shareInstance];
// [info UserInfoWithDictionary:responseObject[@"reseller"]];
//
//
// [MBProgressHUD hideHUDForView:self.view animated:YES];
// BaseViewController *baseVC = [[BaseViewController alloc] init];
// baseVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
// [weakSelf presentViewController:baseVC animated:YES completion:nil];
// } failure:^(NSURLSessionDataTask *task, NSError *error) {
//
// }];
//
//
// }
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]) {
NSDictionary *paramers = @{@"domain":kDomain,
@"loginName":[[NSUserDefaults standardUserDefaults] objectForKey:@"userName"] ,
@"password":[[NSUserDefaults standardUserDefaults] objectForKey:@"passWord"],
@"rememberMe":@"true"};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"app/resellerLogin" parameters:paramers success:^(NSURLSessionDataTask *task, id responseObject) {
UserInfo *info = [UserInfo shareInstance];
[info UserInfoWithDictionary:responseObject[@"reseller"]];
[MBProgressHUD hideHUDForView:self.view animated:YES];
BaseViewController *baseVC = [[BaseViewController alloc] init];
baseVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[weakSelf presentViewController:baseVC animated:YES completion:nil];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
}
......
......@@ -21,13 +21,13 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tdr-oJ-D2D">
<rect key="frame" x="0.0" y="0.0" width="375" height="502"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="login_top" translatesAutoresizingMaskIntoConstraints="NO" id="gIO-Jz-jhA">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="login_top" translatesAutoresizingMaskIntoConstraints="NO" id="gIO-Jz-jhA">
<rect key="frame" x="71" y="94" width="234" height="136"/>
<constraints>
<constraint firstAttribute="width" constant="234" id="jkq-tN-k4O"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Drd-sW-LYv">
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Drd-sW-LYv">
<rect key="frame" x="32" y="274" width="311" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="300" id="1bQ-Cb-7AQ"/>
......@@ -46,7 +46,7 @@
<action selector="rigistAction:" destination="-1" eventType="touchUpInside" id="Qaf-df-5Yo"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Te4-Rx-W0K">
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Te4-Rx-W0K">
<rect key="frame" x="32" y="348" width="311" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="300" id="do6-tj-oIb"/>
......
......@@ -20,12 +20,14 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"登 录";
// Do any additional setup after loading the view from its nib.
self.phoneNumberTextFiled.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"];
// Do any additional setup after loading the view from its nib.
}
- (IBAction)toLoginAction:(UIButton *)sender {
NSDictionary *paramers = @{@"domain":kDomain,
@"loginName":self.phoneNumberTextFiled.text ,
@"password":[self.passwordTextFiled.text MD5String],
......
//
// MBProgressHUD+Javen.h
// ALand
//
// Created by Z on 16/4/14.
// Copyright © 2016年 Z. All rights reserved.
//
#import <MBProgressHUD/MBProgressHUD.h>
typedef void (^succeBlock)(void);
@interface MBProgressHUD (Javen)
@property (nonatomic, copy) succeBlock success;
+ (void)showSuccess:(NSString *)success;
+ (void)showSuccess:(NSString *)success toView:(UIView *)view;
+ (void)showError:(NSString *)error;
+ (void)showError:(NSString *)error toView:(UIView *)view;
/**
* 显示错误信息
*
* @param message 信息内容
*
* @return 直接返回一个MBProgressHUD,需要手动关闭
*/
+ (MBProgressHUD *)showMessage:(NSString *)message;
+ (MBProgressHUD *)showMessage:(NSString *)message toView:(UIView *)view;
+ (void)hideHUD;
+ (void)hideHUDForView:(UIView *)view;
+ (MBProgressHUD *)Javen_showMessage:(NSString *)message onView:(UIView *)view;
+ (MBProgressHUD *)Javen_showSuccess:(NSString *)success onView:(UIView *)view delay:(NSTimeInterval)time complete:(void (^)(void))complete;
@end
//
// MBProgressHUD+Javen.m
// ALand
//
// Created by Z on 16/4/14.
// Copyright © 2016年 Z. All rights reserved.
//
#import "MBProgressHUD+Javen.h"
@implementation MBProgressHUD (Javen)
/**
* 显示信息
*
* @param text 信息内容
* @param icon 图标
* @param view 显示的视图
*/
+ (void)show:(NSString *)text icon:(NSString *)icon view:(UIView *)view
{
if (view == nil) view = [[UIApplication sharedApplication].windows lastObject];
// 快速显示一个提示信息
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.labelText = text;
// 设置图片
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"MBProgressHUD.bundle/%@", icon]]];
// 再设置模式
hud.mode = MBProgressHUDModeCustomView;
// 隐藏时候从父控件中移除
hud.removeFromSuperViewOnHide = YES;
// 1秒之后再消失
[hud hide:YES afterDelay:0.7];
}
/**
* 显示成功信息
*
* @param success 信息内容
*/
+ (void)showSuccess:(NSString *)success
{
[self showSuccess:success toView:nil];
}
/**
* 显示成功信息
*
* @param success 信息内容
* @param view 显示信息的视图
*/
+ (void)showSuccess:(NSString *)success toView:(UIView *)view
{
[self show:success icon:@"success.png" view:view];
}
/**
* 显示错误信息
*
*/
+ (void)showError:(NSString *)error
{
[self showError:error toView:nil];
}
/**
* 显示错误信息
*
* @param error 错误信息内容
* @param view 需要显示信息的视图
*/
+ (void)showError:(NSString *)error toView:(UIView *)view{
[self show:error icon:@"error.png" view:view];
}
/**
* 显示错误信息
*
* @param message 信息内容
*
* @return 直接返回一个MBProgressHUD,需要手动关闭
*/
+ (MBProgressHUD *)showMessage:(NSString *)message
{
return [self showMessage:message toView:nil];
}
/**
* 显示一些信息
*
* @param message 信息内容
* @param view 需要显示信息的视图
*
* @return 直接返回一个MBProgressHUD,需要手动关闭
*/
+ (MBProgressHUD *)showMessage:(NSString *)message toView:(UIView *)view {
if (view == nil) view = [[UIApplication sharedApplication].windows lastObject];
// 快速显示一个提示信息
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.labelText = message;
// 隐藏时候从父控件中移除
hud.removeFromSuperViewOnHide = YES;
// YES代表需要蒙版效果
hud.dimBackground = YES;
return hud;
}
/**
* 手动关闭MBProgressHUD
*/
+ (void)hideHUD
{
[self hideHUDForView:nil];
}
/**
* 手动关闭MBProgressHUD
*
* @param view 显示MBProgressHUD的视图
*/
+ (void)hideHUDForView:(UIView *)view
{
if (view == nil) view = [[UIApplication sharedApplication].windows lastObject];
[self hideHUDForView:view animated:YES];
}
+ (MBProgressHUD *)Javen_showMessage:(NSString *)message onView:(UIView *)view
{
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view];
[view addSubview:hud];
hud.labelText = @"修改中";
[hud show:YES];
return hud;
}
+ (MBProgressHUD *)Javen_showSuccess:(NSString *)success onView:(UIView *)view delay:(NSTimeInterval)time complete:(void (^)(void))complete
{
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view];
[view addSubview:hud];
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.tintColor = kSysWhite;
hud.customView = imageView;
hud.mode = MBProgressHUDModeCustomView;
hud.labelText = @"修改成功!";
[hud show:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self hideHUD];
complete();
});
return hud;
}
@end
......@@ -9,6 +9,7 @@
#import "HTTPCilent.h"
#import "AFHTTPSessionManager.h"
#import "NSDictionary+Category.h"
#import "MBProgressHUD+Javen.h"
@interface HTTPCilent ()
@property (nonatomic, strong) AFHTTPSessionManager *manager;
@end
......@@ -30,6 +31,7 @@
_manager.responseSerializer = [AFJSONResponseSerializer serializer];
_manager.requestSerializer = [AFJSONRequestSerializer serializer];
[_manager.requestSerializer setValue:@"application/json;charset=utf-8" forHTTPHeaderField: @"Content-Type"];
_manager.requestSerializer.timeoutInterval = 10.0f;
}
return _manager;
}
......@@ -43,6 +45,7 @@
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSDictionary *dic = responseObject;
CLog(@"POST success!-------->%@", [dic JSONString]);
success(task, responseObject);
......@@ -50,6 +53,11 @@
CLog(@"POST请求失败!----->%@", [error localizedDescription]);
failure(task, error);
[MBProgressHUD showMessage:@"网络错误,请检查网络!"];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUD];
});
}];
}
......
//
// JavenOwner.h
//
// Created by Z on 16/4/14
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenOwner : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenOwner.m
//
// Created by Z on 16/4/14
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenOwner.h"
NSString *const kJavenOwnerName = @"name";
NSString *const kJavenOwnerUuid = @"uuid";
NSString *const kJavenOwnerCode = @"code";
@interface JavenOwner ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenOwner
@synthesize name = _name;
@synthesize uuid = _uuid;
@synthesize code = _code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.name = [self objectOrNilForKey:kJavenOwnerName fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kJavenOwnerUuid fromDictionary:dict];
self.code = [self objectOrNilForKey:kJavenOwnerCode fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kJavenOwnerName];
[mutableDict setValue:self.uuid forKey:kJavenOwnerUuid];
[mutableDict setValue:self.code forKey:kJavenOwnerCode];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.name = [aDecoder decodeObjectForKey:kJavenOwnerName];
self.uuid = [aDecoder decodeObjectForKey:kJavenOwnerUuid];
self.code = [aDecoder decodeObjectForKey:kJavenOwnerCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kJavenOwnerName];
[aCoder encodeObject:_uuid forKey:kJavenOwnerUuid];
[aCoder encodeObject:_code forKey:kJavenOwnerCode];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenOwner *copy = [[JavenOwner alloc] init];
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
}
return copy;
}
@end
//
// JavenShop.h
//
// Created by Z on 16/4/14
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class JavenOwner, JavenLastModifyInfo, JavenCreateInfo;
@interface JavenShop : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) BOOL days7Refund;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, strong) JavenOwner *owner;
@property (nonatomic, assign) id upper;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *path;
@property (nonatomic, strong) JavenLastModifyInfo *lastModifyInfo;
@property (nonatomic, assign) id contact;
@property (nonatomic, assign) double version;
@property (nonatomic, assign) double favorited;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) NSArray *roles;
@property (nonatomic, assign) id upperOrgPath;
@property (nonatomic, assign) double grade;
@property (nonatomic, assign) id siteDomain;
@property (nonatomic, strong) NSString *pictures;
@property (nonatomic, strong) JavenCreateInfo *createInfo;
@property (nonatomic, assign) double order;
@property (nonatomic, assign) id shopDescription;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
This diff is collapsed.
......@@ -7,7 +7,7 @@
//
#import "UserInfoBaseClass.h"
#import "JavenShopModel.h"
@interface UserInfo : UserInfoBaseClass
+ (UserInfo *)shareInstance;
@end
......@@ -17,4 +17,5 @@
#import "UIButton+Category.h"
#import "HTTPCilent.h"
#import "MJExtension.h"
#import "MBProgressHUD+Javen.h"
#endif /* IMPHeader_h */
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