Commit c3c59baa authored by AvatarC's avatar AvatarC

Merge branch 'develop' of https://git.oschina.net/gomoretech/RedstarIOS into develop_avatar

parents 4c4dd48e 04e044ce
This diff is collapsed.
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "no_select_box@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "no_select_box@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "select_box@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "select_box@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "选中@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "选中@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "形状-49@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "形状-49@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "x@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "x@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -130,6 +130,7 @@
#define kResultTitleBackColor [UIColor colorWithRed:238 / 255.0 green:238 / 255.0 blue:244 / 255.0 alpha:1.0]
#define kSelectStoreColor [UIColor colorWithRed:111 / 255.0 green:120 / 255.0 blue:216 / 255.0 alpha:1.0]
#define kCommentViewHeight 300
#define kCommentWithStarViewHeight 325
......
......@@ -31,7 +31,6 @@
// 口碑排名列表
#define kRankingListURL @"redstar-server/rest/praise/ranking"
// 提交评论
#define kAddCommentURL @"redstar-server/rest/comment/submit"
......@@ -105,4 +104,12 @@
// 口碑取消点赞
#define kPicturePraiseCancelLikeURL @"redstar-server/rest/legendpraise/cancel_like/"
/**
* 口碑排名(新)
*/
// 获取口碑列表
#define kQueryShortPraiseURL @"redstar-server/rest/praise/query_short?userUuid="
#endif /* Url_h */
......@@ -21,4 +21,15 @@
}
return self;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -21,4 +21,15 @@
}
return self;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -7,10 +7,14 @@
//
#import <UIKit/UIKit.h>
#import "ZanButton.h"
@interface OnLineTableViewCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *selectLabel;
@property (nonatomic, strong) UIButton *storeBtn;
@property (nonatomic, strong) UIButton *averageBtn;
@end
......@@ -28,7 +28,6 @@
- (void)setup
{
self.titleLabel.textColor = kOnLineCellTitleColor;
self.selectLabel.textColor = kOnLineCellDetailColor;
}
......@@ -56,6 +55,9 @@
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:titleBottom];
// 高度
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
[self.contentView addConstraint:titleHeight];
}
return _titleLabel;
......@@ -66,6 +68,7 @@
{
if (!_selectLabel) {
_selectLabel = [[UILabel alloc] init];
_selectLabel.textColor = kOnLineCellDetailColor;
_selectLabel.textAlignment = NSTextAlignmentRight;
_selectLabel.translatesAutoresizingMaskIntoConstraints = NO;
_selectLabel.font = [UIFont systemFontOfSize:15.0];
......@@ -80,9 +83,9 @@
[self.contentView addConstraint:selectRight];
// 右边
NSLayoutConstraint *selectWidth = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
[self.contentView addConstraint:selectWidth];
// NSLayoutConstraint *selectWidth = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
// [self.contentView addConstraint:selectWidth];
//
// 高度
NSLayoutConstraint *selectBottom = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:selectBottom];
......@@ -90,4 +93,78 @@
return _selectLabel;
}
- (UIButton *)storeBtn
{
if (!_storeBtn) {
_storeBtn = [[UIButton alloc] init];
_storeBtn.tag = 323228;
[_storeBtn setTitleColor:kOnLineCellTitleColor forState:UIControlStateNormal];
_storeBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_storeBtn setTitle:@"商场得分" forState:UIControlStateNormal];
_storeBtn.selected = YES;
[_storeBtn setImage:[UIImage imageNamed:@"select_box"] forState:UIControlStateNormal];
[_storeBtn setImage:[UIImage imageNamed:@"no_select_box"] forState:UIControlStateSelected];
_storeBtn.titleLabel.font = [UIFont systemFontOfSize:15.0f];
_storeBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 20);
_storeBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
_storeBtn.imageView.contentMode = UIViewContentModeRight;
_storeBtn.titleLabel.contentMode = UIViewContentModeLeft;
[self.contentView addSubview:_storeBtn];
// 顶端
NSLayoutConstraint *selectTop = [NSLayoutConstraint constraintWithItem:_storeBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:selectTop];
// 左边
NSLayoutConstraint *selectRight = [NSLayoutConstraint constraintWithItem:_storeBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-122];
[self.contentView addConstraint:selectRight];
// 右边
NSLayoutConstraint *selectWidth = [NSLayoutConstraint constraintWithItem:_storeBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[self.contentView addConstraint:selectWidth];
// 高度
NSLayoutConstraint *selectBottom = [NSLayoutConstraint constraintWithItem:_storeBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:selectBottom];
}
return _storeBtn;
}
- (UIButton *)averageBtn
{
if (!_averageBtn) {
_averageBtn = [[UIButton alloc] init];
_averageBtn.tag = 323229;
[_averageBtn setTitleColor:kOnLineCellTitleColor forState:UIControlStateNormal];
_averageBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_averageBtn setTitle:@"区域平均分" forState:UIControlStateNormal];
[_averageBtn setImage:[UIImage imageNamed:@"select_box"] forState:UIControlStateNormal];
[_averageBtn setImage:[UIImage imageNamed:@"no_select_box"] forState:UIControlStateSelected];
_averageBtn.titleLabel.font = [UIFont systemFontOfSize:15.0f];
_averageBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 20);
_averageBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
_averageBtn.imageView.contentMode = UIViewContentModeRight;
_averageBtn.titleLabel.contentMode = UIViewContentModeLeft;
[self.contentView addSubview:_averageBtn];
// 顶端
NSLayoutConstraint *selectTop = [NSLayoutConstraint constraintWithItem:_averageBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:selectTop];
// 左边
NSLayoutConstraint *selectRight = [NSLayoutConstraint constraintWithItem:_averageBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-18];
[self.contentView addConstraint:selectRight];
// 右边
NSLayoutConstraint *selectWidth = [NSLayoutConstraint constraintWithItem:_averageBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:95];
[self.contentView addConstraint:selectWidth];
// 高度
NSLayoutConstraint *selectBottom = [NSLayoutConstraint constraintWithItem:_averageBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:selectBottom];
}
return _averageBtn;
}
@end
//
// CheckBoxButton.h
// redstar
//
// Created by admin on 15/12/16.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CheckBoxButton : UIButton
@end
//
// CheckBoxButton.m
// redstar
//
// Created by admin on 15/12/16.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "CheckBoxButton.h"
@implementation CheckBoxButton
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
CGFloat w = self.frame.size.width;
CGFloat h = self.frame.size.height;
return CGRectMake(32, 0, w - 22, h);
}
- (CGRect)imageRectForContentRect:(CGRect)contentRect;
{
CGFloat h = self.frame.size.height;
return CGRectMake(0, (h - 22) / 2, 22, 22);
}
@end
......@@ -7,10 +7,11 @@
//
#import <UIKit/UIKit.h>
#import "CheckBoxButton.h"
#import "AreaModel.h"
@interface SelectAreaTableCell : UITableViewCell
@property (nonatomic, strong) UIImageView *checkBoxImageView;
@property (nonatomic, strong) CheckBoxButton *checkBoxButton;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) AreaModel *areaModel;
@end
......@@ -10,8 +10,66 @@
@implementation SelectAreaTableCell
- (void)awakeFromNib {
// Initialization code
- (CheckBoxButton *)checkBoxButton
{
if (!_checkBoxButton) {
_checkBoxButton = [[CheckBoxButton alloc] init];
[_checkBoxButton setTitleColor:kLightBlack forState:UIControlStateNormal];
// [_checkBoxButton setTitleColor:kSelectStoreColor forState:UIControlStateSelected];
_checkBoxButton.titleLabel.font = [UIFont systemFontOfSize:17.0];
_checkBoxButton.translatesAutoresizingMaskIntoConstraints = NO;
[_checkBoxButton setImage:[UIImage imageNamed:@"uncheck_box"] forState:UIControlStateNormal];
[_checkBoxButton setImage:[UIImage imageNamed:@"check_box"] forState:UIControlStateSelected];
_checkBoxButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 20);
_checkBoxButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
_checkBoxButton.imageView.contentMode = UIViewContentModeRight;
_checkBoxButton.titleLabel.contentMode = UIViewContentModeLeft;
[self.contentView addSubview:_checkBoxButton];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:8];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:34];
[self.contentView addConstraint:titleHeight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-8];
[self.contentView addConstraint:titleBottom];
}
return _checkBoxButton;
}
- (UIImageView *)iconImageView
{
if (!_iconImageView) {
_iconImageView = [[UIImageView alloc] init];
_iconImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_iconImageView];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_iconImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:23];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleWidth = [NSLayoutConstraint constraintWithItem:_iconImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:13];
[self.contentView addConstraint:titleWidth];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_iconImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_iconImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:8];
[self.contentView addConstraint:titleBottom];
}
return _iconImageView;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
......@@ -7,7 +7,12 @@
//
#import <UIKit/UIKit.h>
#import "CheckBoxButton.h"
#import "ProvinceModel.h"
@interface SelectProvinceTableCell : UITableViewCell
@property (nonatomic, strong) CheckBoxButton *checkBoxButton;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) ProvinceModel *provinceModel;
@end
......@@ -10,14 +10,75 @@
@implementation SelectProvinceTableCell
- (void)awakeFromNib {
// Initialization code
- (CheckBoxButton *)checkBoxButton
{
if (!_checkBoxButton) {
_checkBoxButton = [[CheckBoxButton alloc] init];
[_checkBoxButton setTitleColor:kLightBlack forState:UIControlStateNormal];
[_checkBoxButton setTitleColor:kSelectStoreColor forState:UIControlStateSelected];
_checkBoxButton.titleLabel.font = [UIFont systemFontOfSize:17.0];
_checkBoxButton.translatesAutoresizingMaskIntoConstraints = NO;
[_checkBoxButton setImage:[UIImage imageNamed:@"uncheck_box"] forState:UIControlStateNormal];
[_checkBoxButton setImage:[UIImage imageNamed:@"check_box"] forState:UIControlStateSelected];
_checkBoxButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 20);
_checkBoxButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
_checkBoxButton.imageView.contentMode = UIViewContentModeRight;
_checkBoxButton.titleLabel.contentMode = UIViewContentModeLeft;
[_checkBoxButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:_checkBoxButton];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:8];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:50];
[self.contentView addConstraint:titleLeft];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:titleHeight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-8];
[self.contentView addConstraint:titleBottom];
}
return _checkBoxButton;
}
- (void)click:(CheckBoxButton *)sender
{
sender.selected = !sender.selected;
}
- (UIImageView *)iconImageView
{
if (!_iconImageView) {
_iconImageView = [[UIImageView alloc] init];
_iconImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_iconImageView];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_iconImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:23];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleWidth = [NSLayoutConstraint constraintWithItem:_iconImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:11];
[self.contentView addConstraint:titleWidth];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_iconImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_iconImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:7.5];
[self.contentView addConstraint:titleBottom];
}
return _iconImageView;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -7,7 +7,13 @@
//
#import <UIKit/UIKit.h>
#import "CheckBoxButton.h"
#import "StoreModel.h"
@interface SelectStoreTableCell : UITableViewCell
//@property (nonatomic, strong) UIButton *storeButton1;
//@property (nonatomic, strong) UIButton *storeButton2;
@property (nonatomic, strong) CheckBoxButton *checkBoxButton;
@property (nonatomic, strong) StoreModel *storeModel;
@end
......@@ -9,11 +9,105 @@
#import "SelectStoreTableCell.h"
@implementation SelectStoreTableCell
//- (UIButton *)storeButton1
//{
// if (!_storeButton1) {
// _storeButton1 = [[UIButton alloc] init];
// _storeButton1.translatesAutoresizingMaskIntoConstraints = NO;
// _storeButton1.backgroundColor = [UIColor lightGrayColor];
// [self.contentView addSubview:_storeButton1];
//
// // 顶端
// NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_storeButton1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
// [self.contentView addConstraint:titleTop];
//
// // 右边
// NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_storeButton1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:-5];
// [self.contentView addConstraint:titleRight];
//
// // 左边
// NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_storeButton1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
// [self.contentView addConstraint:titleLeft];
//
// // 高度
// NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_storeButton1 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
// [self.contentView addConstraint:titleHeight];
//
// // 高度
// NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_storeButton1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5];
// [self.contentView addConstraint:titleBottom];
// }
// return _storeButton1;
//}
//
//- (UIButton *)storeButton2
//{
// if (!_storeButton2) {
// _storeButton2 = [[UIButton alloc] init];
// _storeButton2.translatesAutoresizingMaskIntoConstraints = NO;
// _storeButton2.backgroundColor = [UIColor lightGrayColor];
// [self.contentView addSubview:_storeButton2];
//
// // 顶端
// NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_storeButton2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
// [self.contentView addConstraint:titleTop];
//
// // 右边
// NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_storeButton2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
// [self.contentView addConstraint:titleRight];
//
// // 左边
// NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_storeButton2 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:5];
// [self.contentView addConstraint:titleLeft];
//
// // 高度
// NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_storeButton2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
// [self.contentView addConstraint:titleHeight];
// }
// return _storeButton2;
//}
- (void)awakeFromNib {
// Initialization code
- (CheckBoxButton *)checkBoxButton
{
if (!_checkBoxButton) {
_checkBoxButton = [[CheckBoxButton alloc] init];
[_checkBoxButton setTitleColor:kLightBlack forState:UIControlStateNormal];
[_checkBoxButton setTitleColor:kSelectStoreColor forState:UIControlStateSelected];
_checkBoxButton.titleLabel.font = [UIFont systemFontOfSize:17.0];
_checkBoxButton.translatesAutoresizingMaskIntoConstraints = NO;
[_checkBoxButton setImage:[UIImage imageNamed:@"uncheck_box"] forState:UIControlStateNormal];
[_checkBoxButton setImage:[UIImage imageNamed:@"check_box"] forState:UIControlStateSelected];
_checkBoxButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 20);
_checkBoxButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
_checkBoxButton.imageView.contentMode = UIViewContentModeRight;
_checkBoxButton.titleLabel.contentMode = UIViewContentModeLeft;
[_checkBoxButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:_checkBoxButton];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:8];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:80];
[self.contentView addConstraint:titleLeft];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:titleHeight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_checkBoxButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-8];
[self.contentView addConstraint:titleBottom];
}
return _checkBoxButton;
}
- (void)click:(CheckBoxButton *)sender
{
sender.selected = !sender.selected;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
......@@ -12,6 +12,8 @@
@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong) NSArray *provinceArray;
@property (nonatomic, assign) BOOL isChoose;
- (id)initWithName:(NSString *)name children:(NSArray *)children;
+ (id)dataObjectWithName:(NSString *)name children:(NSArray *)children;
......
......@@ -23,4 +23,16 @@
{
return [[self alloc] initWithName:name children:children];
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -11,6 +11,7 @@
@interface ProvinceModel : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong) NSArray *storeArray;
@property (nonatomic, assign) BOOL isChoose;
- (id)initWithName:(NSString *)name children:(NSArray *)children;
+ (id)dataObjectWithName:(NSString *)name children:(NSArray *)children;
......
......@@ -23,5 +23,15 @@
{
return [[self alloc] initWithName:name children:children];
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -10,6 +10,7 @@
@interface StoreModel : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) BOOL isChoose;
- (id)initWithName:(NSString *)name;
+ (id)dataObjectWithName:(NSString *)name;
......
......@@ -22,4 +22,16 @@
{
return [[self alloc] initWithName:name];
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
//
// SelectStoreHeadView.h
// redstar
//
// Created by admin on 15/12/16.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SelectStoreHeadView : UIView
@property (nonatomic, strong) UITextField *searchTextFiled; // 搜索框
@end
//
// SelectStoreHeadView.m
// redstar
//
// Created by admin on 15/12/16.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "SelectStoreHeadView.h"
@implementation SelectStoreHeadView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.searchTextFiled.placeholder = @"请输入问题关键字";
self.layer.borderColor = kSeparateLineCGColor;
self.layer.borderWidth = 0.5;
}
return self;
}
#pragma mark - Lazy Loading
- (UITextField *)searchTextFiled
{
if (!_searchTextFiled) {
_searchTextFiled = [[UITextField alloc] init];
_searchTextFiled.font = [UIFont systemFontOfSize:14.0];
_searchTextFiled.backgroundColor = [UIColor whiteColor];
_searchTextFiled.translatesAutoresizingMaskIntoConstraints = NO;
_searchTextFiled.layer.cornerRadius = 4.0;
_searchTextFiled.layer.borderWidth = 1.0;
_searchTextFiled.layer.borderColor = kPasswordBorderColor;
UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"search_icon"]];
imageV.width += 20;
imageV.contentMode = UIViewContentModeCenter;
_searchTextFiled.leftView = imageV;
_searchTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *imageR = [[UIButton alloc] init];
imageR.frame = CGRectMake(0, 0, 28, 28);
[imageR setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];
[imageR addTarget:self action:@selector(searchClick:) forControlEvents:UIControlEventTouchUpInside];
imageR.contentMode = UIViewContentModeCenter;
imageR.width += 10;
_searchTextFiled.rightView = imageR;
_searchTextFiled.rightViewMode = UITextFieldViewModeAlways;
[self addSubview:_searchTextFiled];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_searchTextFiled attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:8];
[self addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_searchTextFiled attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_searchTextFiled attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_searchTextFiled attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-8];
[self addConstraint:titleBottom];
}
return _searchTextFiled;
}
- (void)searchClick:(UIButton *)sender
{
self.searchTextFiled.text = @"";
}
@end
......@@ -8,14 +8,27 @@
#import "SelectStoreViewController.h"
#import <RATreeView.h>
#import "SelectAreaTableCell.h"
#define kSelectAreaTableCell @"selectAreaTableCell"
#import "SelectProvinceTableCell.h"
#define kSelectProvinceTableCell @"selectProvinceTableCell"
#import "SelectStoreTableCell.h"
#define kSelectStoreTableCell @"selectStoreTableCell"
#import "AreaModel.h"
#import "ProvinceModel.h"
#import "StoreModel.h"
#import "SelectStoreHeadView.h"
#import "CheckBoxButton.h"
@interface SelectStoreViewController () <RATreeViewDelegate, RATreeViewDataSource>
@property (nonatomic, strong) RATreeView *treeView;
@property (nonatomic, strong) NSMutableArray *allAreaData;
@property (nonatomic, strong) SelectStoreHeadView *headerView;
@end
@implementation SelectStoreViewController
......@@ -89,16 +102,37 @@
AreaModel *jinghu = [AreaModel dataObjectWithName:@"京沪西南"
children:[NSArray arrayWithObjects:computer1, computer2, computer3, nil]];
self.allAreaData = [NSMutableArray arrayWithObjects:huadong ,huabei, jinghu, nil];
self.allAreaData = [NSMutableArray arrayWithObjects:huadong ,huabei, jinghu,nil];
}
- (void)areaClick:(CheckBoxButton *)sender
{
sender.selected = !sender.selected;
SelectAreaTableCell *cell = (SelectAreaTableCell *)sender.superview.superview;
NSArray *provinceArray = cell.areaModel.provinceArray;
if (sender.selected) {
for (ProvinceModel *proVin in provinceArray) {
proVin.isChoose = YES;
}
[sender setTitleColor:kLightBlack forState:UIControlStateNormal];
} else {
for (ProvinceModel *proVin in provinceArray) {
proVin.isChoose = NO;
}
[sender setTitleColor:kSelectStoreColor forState:UIControlStateNormal];
}
[_treeView reloadRows];
}
#pragma mark - RAtreeView Delegate/DataSource
- (NSInteger)treeView:(RATreeView *)treeView numberOfChildrenOfItem:(id)item
{
NSInteger level = [treeView levelForCellForItem:item];
NSLog(@"11level = %ld", level);
if (level == -1) {
return [self.allAreaData count];
} else if (level == 0) {
......@@ -116,7 +150,6 @@
- (id)treeView:(RATreeView *)treeView child:(NSInteger)index ofItem:(id)item
{
NSInteger level = [treeView levelForCellForItem:item];
NSLog(@"22level = %ld", level);
if (level == -1) {
return [self.allAreaData objectAtIndex:index];
} else if (level == 0) {
......@@ -133,56 +166,41 @@ NSLog(@"22level = %ld", level);
- (UITableViewCell *)treeView:(RATreeView *)treeView cellForItem:(id)item
{
NSInteger level = [self.treeView levelForCellForItem:item];
NSLog(@"33level = %ld", level);
if (level == 0) {
AreaModel *data = item;
NSInteger numberOfChildren = [data.provinceArray count];
NSString *detailText = [NSString localizedStringWithFormat:@"Number of children %@ level = %ld", [@(numberOfChildren) stringValue], level];
UITableViewCell *cell = [self.treeView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class])];
cell.contentView.backgroundColor = [UIColor brownColor];
cell.textLabel.text = data.name;
cell.detailTextLabel.text = detailText;
SelectAreaTableCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kSelectAreaTableCell];
cell.areaModel = data;
[cell.checkBoxButton setTitle:data.name forState:UIControlStateNormal];
[cell.checkBoxButton addTarget:self action:@selector(areaClick:) forControlEvents:UIControlEventTouchUpInside];
cell.iconImageView.image = [UIImage imageNamed:@"arrow_down"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else if (level == 1) {
ProvinceModel *data = item;
NSInteger numberOfChildren = [data.storeArray count];
NSString *detailText = [NSString localizedStringWithFormat:@"Number of children %@ level = %ld", [@(numberOfChildren) stringValue], level];
UITableViewCell *cell = [self.treeView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class])];
cell.contentView.backgroundColor = [UIColor yellowColor];
cell.textLabel.text = data.name;
cell.detailTextLabel.text = detailText;
SelectProvinceTableCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kSelectProvinceTableCell];
cell.provinceModel = data;
if (data.isChoose) {
cell.checkBoxButton.selected = YES;
} else {
cell.checkBoxButton.selected = NO;
}
[cell.checkBoxButton setTitle:data.name forState:UIControlStateNormal];
cell.iconImageView.image = [UIImage imageNamed:@"grey-trilateral_down"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
StoreModel *data = item;
NSInteger numberOfChildren = 0;
NSString *detailText = [NSString localizedStringWithFormat:@"Number of children %@ level = %ld", [@(numberOfChildren) stringValue], level];
UITableViewCell *cell = [self.treeView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class])];
cell.contentView.backgroundColor = [UIColor orangeColor];
cell.textLabel.text = data.name;
cell.detailTextLabel.text = detailText;
SelectStoreTableCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kSelectStoreTableCell];
cell.storeModel = data;
[cell.checkBoxButton setTitle:data.name forState:UIControlStateNormal];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
}
- (CGFloat)treeView:(RATreeView *)treeView heightForRowForItem:(id)item
{
return 44;
}
- (BOOL)treeView:(RATreeView *)treeView canEditRowForItem:(id)item
{
......@@ -196,11 +214,25 @@ NSLog(@"22level = %ld", level);
if (!_treeView) {
_treeView = [[RATreeView alloc] initWithFrame:self.view.bounds];
_treeView.treeFooterView = [UIView new];
_treeView.rowHeight = UITableViewAutomaticDimension;
_treeView.estimatedRowHeight = 150.0;
_treeView.treeHeaderView = self.headerView;
[_treeView registerClass:[SelectAreaTableCell class] forCellReuseIdentifier:kSelectAreaTableCell];
[_treeView registerClass:[SelectProvinceTableCell class] forCellReuseIdentifier:kSelectProvinceTableCell];
[_treeView registerClass:[SelectStoreTableCell class] forCellReuseIdentifier:kSelectStoreTableCell];
[self.view addSubview:_treeView];
}
return _treeView;
}
- (SelectStoreHeadView *)headerView
{
if (!_headerView) {
_headerView = [[SelectStoreHeadView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 50)];
}
return _headerView;
}
/*
#pragma mark - Navigation
......
......@@ -13,4 +13,16 @@
if([key isEqualToString:@"description"])
self.descriptionText = value;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -9,5 +9,15 @@
#import "PictureDetailModel.h"
@implementation PictureDetailModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -9,5 +9,15 @@
#import "PictureListModel.h"
@implementation PictureListModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -9,5 +9,15 @@
#import "CommentModel.h"
@implementation CommentModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -9,5 +9,15 @@
#import "QuestionDetailModel.h"
@implementation QuestionDetailModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -51,6 +51,6 @@
@property (nonatomic, strong) NSString *principal_code;
@property (nonatomic, strong) NSString *store_code;
@property (nonatomic, strong) NSString *store_uuid;
@property (nonatomic, strong) NSString *store_name;
//@property (nonatomic, strong) NSString *store_name;
@end
......@@ -7,7 +7,19 @@
//
#import "QuestionModel.h"
#include <objc/runtime.h>
@implementation QuestionModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
@interface SearchToolBar : UIView <UITextFieldDelegate>
@interface SearchToolBar : UIView
@property (nonatomic, strong) UITextField *searchTextFiled; // 搜索框
@property (nonatomic, strong) UIButton *queryButton; // 快速查询按钮
......
......@@ -45,7 +45,6 @@
{
if (!_searchTextFiled) {
_searchTextFiled = [[UITextField alloc] init];
_searchTextFiled.delegate = self;
_searchTextFiled.font = [UIFont systemFontOfSize:14.0];
_searchTextFiled.backgroundColor = [UIColor whiteColor];
_searchTextFiled.translatesAutoresizingMaskIntoConstraints = NO;
......@@ -109,12 +108,6 @@
return _queryButton;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if ([textField resignFirstResponder]) {
return YES;
}
return NO;
}
@end
......@@ -27,7 +27,7 @@
#define kQuestionListCell @"questionListTableViewCell"
#define kThumbTag 745645
@interface QuestionViewController () <UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate, ScopeTableViewDelegate, GroupTableViewDelegate, CategoryTableViewDelegate, StateTableViewDelegate, TimeTableViewDelegate>
@interface QuestionViewController () <UITextFieldDelegate,UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate, ScopeTableViewDelegate, GroupTableViewDelegate, CategoryTableViewDelegate, StateTableViewDelegate, TimeTableViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *allQuestionArray;
......@@ -54,7 +54,7 @@
@property (nonatomic, assign) NSInteger stateRow;
@property (nonatomic, assign) NSInteger timeRow;
@property (nonatomic, strong) NSLayoutConstraint *searchBottom;
@end
@implementation QuestionViewController
......@@ -404,7 +404,21 @@
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"content CONTAINS %@ || title CONTAINS %@", self.searchBar.searchTextFiled.text, self.searchBar.searchTextFiled.text];
NSArray *arrayPre=[_allQuestionArray filteredArrayUsingPredicate:predicate];
_allQuestionArray = [NSMutableArray arrayWithArray:arrayPre];
[self.tableView reloadData];
if (_allQuestionArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
self.noDataView.backgroundColor = [UIColor whiteColor];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
self.searchBar.backgroundColor = kSectionBackGroundColor;
[self.tableView reloadData];
}
}
// 重置按钮
......@@ -774,7 +788,7 @@
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-50];
[self.view addConstraint:tableBottom];
}
return _tableView;
......@@ -784,6 +798,7 @@
{
if (!_searchBar) {
_searchBar = [[SearchToolBar alloc] init];
_searchBar.searchTextFiled.delegate = self;
_searchBar.translatesAutoresizingMaskIntoConstraints = NO;
[_searchBar.queryButton addTarget:self action:@selector(searchBarClick:) forControlEvents:UIControlEventTouchUpInside];
[self.view insertSubview:_searchBar aboveSubview:_tableView];
......@@ -799,8 +814,8 @@
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_searchBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_searchBar attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
self.searchBottom = [NSLayoutConstraint constraintWithItem:_searchBar attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:self.searchBottom];
}
return _searchBar;
}
......@@ -829,12 +844,37 @@
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (![self.searchBar.searchTextFiled isExclusiveTouch]) {
[self.searchBar.searchTextFiled resignFirstResponder];
}
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if ([self.searchBar.searchTextFiled resignFirstResponder]) {
return YES;
}
return NO;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
self.searchBottom.constant = -256;
[UIView animateWithDuration:0.23 animations:^{
[self.searchBar layoutIfNeeded];
}];
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
self.searchBottom.constant = 0;
[UIView animateWithDuration:0.23 animations:^{
[self.searchBar layoutIfNeeded];
}];
}
/*
#pragma mark - Navigation
......
......@@ -66,7 +66,7 @@
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image;
NSLog(@"taskList = %@", taskList.state);
if ([taskList.state isEqualToString:@"initial"]) {
if ([taskList.state isEqualToString:@"submitted"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:未处理"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
......@@ -104,8 +104,8 @@
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor;
self.alreadyLabel.textColor = kNavigationBarColor;
self.allLabel.textColor = kNavigationBarColor;
} else if ([taskList.state isEqualToString:@"expired"]){
NSString *str = [NSString stringWithFormat:@"巡检进度:已过期"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
......@@ -114,16 +114,7 @@
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressOverDueColor;
self.allLabel.textColor = kProgressOverDueColor;
} else if ([taskList.state isEqualToString:@"submitted"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:已提交"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor;
} else {
}
}
......
......@@ -9,5 +9,15 @@
#import "TaskListModel.h"
@implementation TaskListModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -212,7 +212,6 @@
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
NSLog(@"urlllll = %@", url);
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{
@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"],
......@@ -220,7 +219,6 @@
@"pageNumber":@(0),
@"pageSize":@(10)
};
NSLog(@"parametersssssss = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
......@@ -440,7 +438,7 @@
} else if (_selectRow == 1) {
_screenView.textView.text = @"";
[parameters setObject:@"initial" forKey:@"state"];
[parameters setObject:@"submitted" forKey:@"state"];
} else if (_selectRow == 2) {
_screenView.textView.text = @"";
[parameters setObject:@"processing" forKey:@"state"];
......
......@@ -85,7 +85,7 @@
}
if ([taskDetail.state isEqualToString:@"initial"]) {
if ([taskDetail.state isEqualToString:@"submitted"]) {
if (taskDetail.reportCount == 0 || taskDetail.questionCount == 0) {
self.progressLabel.text = @"0%";
} else {
......
......@@ -21,4 +21,16 @@
}
return self;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -22,4 +22,16 @@
}
return self;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
//
// RankScreenTableViewCell.h
// redstar
//
// Created by admin on 15/12/16.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RankScreenTableViewCell : UITableViewCell
@property (nonatomic, strong) UILabel *queryLabel;
@property (nonatomic, strong) UIButton *screenButton;
@end
//
// RankScreenTableViewCell.m
// redstar
//
// Created by admin on 15/12/16.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankScreenTableViewCell.h"
@implementation RankScreenTableViewCell
- (UILabel *)queryLabel
{
if (!_queryLabel) {
_queryLabel = [[UILabel alloc] init];
_queryLabel.translatesAutoresizingMaskIntoConstraints = NO;
_queryLabel.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:_queryLabel];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_queryLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_queryLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_queryLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.screenButton attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_queryLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:55];
[self.contentView addConstraint:contentHeight];
NSLayoutConstraint *contentBottom = [NSLayoutConstraint constraintWithItem:_queryLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:contentBottom];
}
return _queryLabel;
}
- (UIButton *)screenButton
{
if (!_screenButton) {
_screenButton = [[UIButton alloc] init];
_screenButton.translatesAutoresizingMaskIntoConstraints = NO;
_screenButton.titleLabel.font = [UIFont systemFontOfSize:17.0];
[_screenButton setTitle:@"确定" forState:UIControlStateNormal];
[_screenButton setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
_screenButton.layer.borderWidth = 1.0;
_screenButton.layer.borderColor = kNavigationBarCGColor;
_screenButton.layer.cornerRadius = 4.0;
[self.contentView addSubview:_screenButton];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_screenButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:10];
[self.contentView addConstraint:contentTop];
NSLayoutConstraint *contentWidth = [NSLayoutConstraint constraintWithItem:_screenButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:120];
[self.contentView addConstraint:contentWidth];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_screenButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_screenButton attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35];
[self.contentView addConstraint:contentHeight];
}
return _screenButton;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -21,4 +21,15 @@
}
return self;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -28,4 +28,6 @@
+ (instancetype)rankListModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
@property (nonatomic, assign) int index;
@end
......@@ -21,5 +21,15 @@
}
return self;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end
......@@ -21,5 +21,5 @@
@property (nonatomic, strong) UIButton *pushButton;
+ (instancetype)headViewWithTableView:(UITableView *)tableView section:(NSInteger)section;
+ (instancetype)headViewWithTableView:(UITableView *)tableView section:(NSInteger)section index:(int)index;
@end
......@@ -27,19 +27,19 @@
@end
@implementation RankListHeaderView
+ (instancetype)headViewWithTableView:(UITableView *)tableView section:(NSInteger)section
+ (instancetype)headViewWithTableView:(UITableView *)tableView section:(NSInteger)section index:(int)index
{
static NSString *headIdentifier = @"header";
RankListHeaderView *headView = (RankListHeaderView *)[tableView dequeueReusableCellWithIdentifier:headIdentifier];
if (headView == nil) {
headView = [[RankListHeaderView alloc] initWithReuseIdentifier:headIdentifier section:(NSInteger)section];
headView = [[RankListHeaderView alloc] initWithReuseIdentifier:headIdentifier section:(NSInteger)section index:index];
}
return headView;
}
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier section:(NSInteger)section
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier section:(NSInteger)section index:(int)index
{
if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
......@@ -71,9 +71,8 @@
[self addSubview:scoreLabel];
_scoreLabel = scoreLabel;
if (section < 3) {
UIImageView *gradeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", (int)section + 1]]];
if (index < 3) {
UIImageView *gradeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", index]]];
[self addSubview:gradeImageView];
_gradeImageView = gradeImageView;
......@@ -83,7 +82,7 @@
gradeLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:gradeLabel];
NSString *rankStr = [NSString stringWithFormat:@"第 %d 名", (int)section + 1];
NSString *rankStr = [NSString stringWithFormat:@"第 %d 名", index];
NSMutableAttributedString *rankAttr = [[NSMutableAttributedString alloc] initWithString:rankStr];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,1)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kGradeNumberTextColor} range:NSMakeRange(1,rankStr.length - 2)];
......@@ -150,7 +149,7 @@
{
[super layoutSubviews];
_bgView.frame = self.bounds;
_bgButton.frame = CGRectMake(30, 0, 0.3 * kScreenWidth, self.bounds.size.height);
_bgButton.frame = CGRectMake(30, 0, 0.35 * kScreenWidth, self.bounds.size.height);
_arrowImageView.frame = CGRectMake(20, (self.frame.size.height - 11) / 2, 9, 10);
_scoreLabel.frame = CGRectMake(0.4 * kScreenWidth, 0, 0.25 * kScreenWidth, 50);
if (_section < 3) {
......
//
// RankListTableHeaderView.h
// redstar
//
// Created by admin on 15/12/15.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RankListTableHeaderView : UIView
@property (nonatomic, strong) UILabel *praiseLabel;
@property (nonatomic, strong) UILabel *limitsLabel;
@property (nonatomic, strong) UILabel *statisticsLabel;
@end
//
// RankListTableHeaderView.m
// redstar
//
// Created by admin on 15/12/15.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankListTableHeaderView.h"
@implementation RankListTableHeaderView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// RankPickView.h
// redstar
//
// Created by admin on 15/12/17.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RankPickView : UIView
@property (nonatomic, strong) UIPickerView *pickerView;
@property (nonatomic, strong) UIButton *okButton;
@end
//
// RankPickView.m
// redstar
//
// Created by admin on 15/12/17.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankPickView.h"
@implementation RankPickView
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (void)setup{
self.pickerView = [[UIPickerView alloc] init];
_pickerView.frame = CGRectMake(0, 30, kScreenWidth, 120);
[self addSubview:_pickerView];
self.okButton = [[UIButton alloc] init];
_okButton.frame = CGRectMake(kScreenWidth - 60, 0, 60, 30);
[_okButton setTitle:@"完成" forState:UIControlStateNormal];
[_okButton setTitleColor:kLightBlack forState:UIControlStateNormal];
_okButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
[self addSubview:_okButton];
}
@end
......@@ -9,12 +9,7 @@
#import <UIKit/UIKit.h>
#import "DateButton.h"
@interface RankingListViewController : UIViewController
@property (nonatomic, strong) UILabel *pointLabel1; // 月度排名
@property (nonatomic, strong) UILabel *pointLabel2; // 参与商场数量
@property (nonatomic, strong) DateButton *dateButton; // 年月日
@property (nonatomic, strong) UILabel *shoppingCountLabel; // 商场数
@property (nonatomic, strong) UIView *lineView; // 分割线
@interface RankingListViewController : UIViewController
@end
......@@ -23,6 +23,7 @@
// 商场
UILabel *shoppingLabel = [[UILabel alloc] init];
shoppingLabel.text = @"商场名称";
shoppingLabel.backgroundColor = [UIColor clearColor];
shoppingLabel.textAlignment = NSTextAlignmentCenter;
shoppingLabel.textColor = kRankHeadTitleTextColor;
shoppingLabel.font = [UIFont systemFontOfSize:17.0];
......@@ -32,6 +33,8 @@
// 总分
UILabel *scoreLabel = [[UILabel alloc] init];
scoreLabel.text = @"总分";
scoreLabel.backgroundColor = [UIColor clearColor];
scoreLabel.textAlignment = NSTextAlignmentCenter;
scoreLabel.textColor = kRankHeadTitleTextColor;
scoreLabel.font = [UIFont systemFontOfSize:17.0];
......@@ -41,6 +44,7 @@
// 排名
UILabel *gradeLabel = [[UILabel alloc] init];
gradeLabel.text = @"排名";
gradeLabel.backgroundColor = [UIColor clearColor];
gradeLabel.textAlignment = NSTextAlignmentCenter;
gradeLabel.textColor = kRankHeadTitleTextColor;
gradeLabel.font = [UIFont systemFontOfSize:17.0];
......@@ -48,7 +52,7 @@
[self.contentView addSubview:gradeLabel];
//
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:shoppingLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:shoppingLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:3];
[self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:shoppingLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
......@@ -64,7 +68,7 @@
[self.contentView addConstraint:shoppingWidth];
//
NSLayoutConstraint *scoreTop = [NSLayoutConstraint constraintWithItem:scoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
NSLayoutConstraint *scoreTop = [NSLayoutConstraint constraintWithItem:scoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:3];
[self.contentView addConstraint:scoreTop];
NSLayoutConstraint *scoreRight = [NSLayoutConstraint constraintWithItem:scoreLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:gradeLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
......@@ -77,7 +81,7 @@
[self.contentView addConstraint:scoreBottom];
//
NSLayoutConstraint *gradeTop = [NSLayoutConstraint constraintWithItem:gradeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
NSLayoutConstraint *gradeTop = [NSLayoutConstraint constraintWithItem:gradeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:3];
[self.contentView addConstraint:gradeTop];
NSLayoutConstraint *gradeRight = [NSLayoutConstraint constraintWithItem:gradeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
......
......@@ -226,6 +226,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
__block HomeViewController *weakSelf = self;
[httpCilent1 getRankingListWithParameters:parameters1 completion:^(id response, NSError *error) {
NSLog(@"刷新!! = 口碑排名response = %@", response);
if ([(NSArray *)response[@"data"] count] == 0) {
return;
}
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -298,6 +301,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response);
NSLog(@"error = %@", error);
if ([(NSArray *)response[@"data"] count] == 0) {
return;
}
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -310,7 +316,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
_allRankListArray = (NSMutableArray *)[self sortRankListWithRankListArray:tgArray];
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
......
......@@ -113,5 +113,10 @@ typedef void (^completionBlock) (id response, NSError *error);
// 口碑取消点赞
- (void)cancelLikePicturePraiseWithCompletion:(completionBlock)completion;
/**
* 口碑排名(新)
*/
// 获取口碑列表
- (void)queryShortPraiseWithCompletion:(completionBlock)completion;
@end
......@@ -397,4 +397,14 @@
}];
}
// 获取口碑列表
- (void)queryShortPraiseWithCompletion:(completionBlock)completion
{
[self getParameters:nil completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
@end
......@@ -14,6 +14,7 @@
#import "Constant.h"
#import "Url.h"
#include <objc/runtime.h>
#endif /* redstar_pch */
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