购物车实现 <Block实现回调>
效果图如下:
具体代码实现如下:
Model:
#import <Foundation/Foundation.h> @interface ShopCarModel : NSObject @property (nonatomic, copy) NSString * goodsName;
@property (nonatomic, copy) NSString * goodsPrice;
@property (nonatomic, copy) NSString * goodsImage;
@property (nonatomic, assign) NSInteger goodsCount;
@property (nonatomic, assign) BOOL isSelected; + (instancetype)modelWithDictionary: (NSDictionary *)dictionary; @end
#import "ShopCarModel.h" @implementation ShopCarModel + (instancetype)modelWithDictionary: (NSDictionary *)dictionary{ ShopCarModel *model = [[ShopCarModel alloc]init];
[model setValuesForKeysWithDictionary:dictionary];
return model;
} // 容错处理
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{ }
@end
Cell:
#import <UIKit/UIKit.h>
@class ShopCarModel; typedef void(^selectBlock)(NSIndexPath *indexPath); // 选择
typedef void(^deleteBlock)(NSIndexPath *indexPath); // 删除
typedef void(^addBlock)(NSIndexPath *indexPath); // 添加
typedef void(^subTractBlock)(NSIndexPath *indexPath); // 相减 @interface ShopCell : UITableViewCell @property (nonatomic,copy) selectBlock selectedBlock;
@property (nonatomic,copy) deleteBlock deleteBlock;
@property (nonatomic,copy) addBlock addBlock;
@property (nonatomic,copy) subTractBlock subTractBlock;
@property (nonatomic,strong) ShopCarModel *model;
@property (nonatomic,strong) NSIndexPath *indexPath; @end
#import "ShopCell.h"
#import "ShopCarModel.h" @interface ShopCell () @property (nonatomic,strong)UIImageView * GoodsImageView;
@property (nonatomic,strong)UILabel * goodsNameLable;
@property (nonatomic,strong)UILabel * goodsPriceLable;
@property (nonatomic,strong)UITextField * goodsCountTextfield;
@property (nonatomic,strong)UIButton * selectedButton;
@property (nonatomic,strong)UIButton * deletButton;
@property (nonatomic,strong)UIButton * subtractButton;
@property (nonatomic,strong)UIButton * addButton; @end @implementation ShopCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self createSubViews];
}
return self;
} - (void)createSubViews{ _selectedButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_selectedButton setImage:[UIImage imageNamed:@"radiobuttons_normal"] forState:UIControlStateNormal];
[_selectedButton setImage:[UIImage imageNamed:@"radiobuttons_pressed"] forState:UIControlStateSelected];
//原来选择框框太小经常点不到 就想了这个方法 放大按钮 不放大图片
[_selectedButton setImageEdgeInsets:UIEdgeInsetsMake(, , , )];
_selectedButton.frame = CGRectMake(, , , );
_selectedButton.tag = ;
[_selectedButton addTarget:self action:@selector(isselectButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:_selectedButton]; _GoodsImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_selectedButton.frame.origin.x + , , , )];
_GoodsImageView.layer.cornerRadius = ;
[self.contentView addSubview:_GoodsImageView]; _goodsNameLable = [[UILabel alloc]initWithFrame:CGRectMake(_GoodsImageView.frame.origin.x + , , [UIScreen mainScreen].bounds.size.width - - _GoodsImageView.frame.origin.x - - , )];
_goodsNameLable.textAlignment = NSTextAlignmentLeft;
_goodsNameLable.font = [UIFont systemFontOfSize:];
_goodsNameLable.textColor = [UIColor blackColor];
_goodsNameLable.numberOfLines = ;
[self.contentView addSubview:_goodsNameLable]; _goodsPriceLable = [[UILabel alloc]initWithFrame:CGRectMake(_goodsNameLable.frame.origin.x, ,[UIScreen mainScreen].bounds.size.width - - _GoodsImageView.frame.origin.x - - , )];
_goodsPriceLable.textAlignment = NSTextAlignmentLeft;
_goodsPriceLable.textColor = [UIColor redColor];
_goodsPriceLable.font = [UIFont systemFontOfSize:];
_goodsPriceLable.numberOfLines = ;
[self.contentView addSubview:_goodsPriceLable]; _deletButton = [UIButton buttonWithType:UIButtonTypeSystem];
_deletButton.frame = CGRectMake([UIScreen mainScreen].bounds.size.width - , , , );
[_deletButton setTitle:@"删除" forState:UIControlStateNormal];
[_deletButton setTitle:@"删除" forState:UIControlStateHighlighted];
[_deletButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
_deletButton.titleLabel.font = [UIFont systemFontOfSize:];
[_deletButton addTarget:self action:@selector(deletButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_deletButton.tag = ;
[self.contentView addSubview:_deletButton]; _subtractButton = [UIButton buttonWithType:UIButtonTypeSystem];
[_subtractButton setImage:[UIImage imageNamed:@"carSubtractSelect.png"] forState:UIControlStateNormal];
[_subtractButton setImage:[UIImage imageNamed:@"carSubtractNamol.png"] forState:UIControlStateSelected];
[_subtractButton setImage:[UIImage imageNamed:@"carSubtractNamol.png"] forState:UIControlStateHighlighted];
[_subtractButton setImageEdgeInsets:UIEdgeInsetsMake(, , , )];
_subtractButton.frame = CGRectMake([UIScreen mainScreen].bounds.size.width - , , , );
_subtractButton.titleLabel.font = [UIFont systemFontOfSize:];
_subtractButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[_subtractButton addTarget:self action:@selector(subStractButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_subtractButton.tag = ;
[self.contentView addSubview:_subtractButton]; _goodsCountTextfield = [[UITextField alloc]initWithFrame:CGRectMake(_subtractButton.frame.origin.x + , _subtractButton.frame.origin.y + , , )];
_goodsCountTextfield.borderStyle = ;
_goodsCountTextfield.textColor = [UIColor blackColor];
_goodsCountTextfield.textAlignment = NSTextAlignmentCenter;
_goodsCountTextfield.font = [UIFont systemFontOfSize:];
_goodsCountTextfield.enabled = NO;
[self.contentView addSubview:_goodsCountTextfield]; _addButton = [UIButton buttonWithType:UIButtonTypeSystem];
_addButton.frame = CGRectMake(_goodsCountTextfield.frame.origin.x + + , _goodsCountTextfield.frame.origin.y - , , );
[_addButton setImageEdgeInsets:UIEdgeInsetsMake(, , , )];
[_addButton setImage:[UIImage imageNamed:@"carAddSelect.png"] forState:UIControlStateNormal];
[_addButton setImage:[UIImage imageNamed:@"carAddNamol.png"] forState:UIControlStateSelected];
[_addButton setImage:[UIImage imageNamed:@"carAddNamol.png"] forState:UIControlStateHighlighted];
_addButton.titleLabel.font = [UIFont systemFontOfSize:];
_addButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[_addButton addTarget:self action:@selector(addButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_addButton.tag = ;
[self.contentView addSubview:_addButton];
} - (void)setModel:(ShopCarModel *)model{ _model = model;
_GoodsImageView.image = [UIImage imageNamed:_model.goodsImage];
_goodsNameLable.text = [NSString stringWithFormat:@"%@",_model.goodsName];
_goodsNameLable.text = _model.goodsName; // 修改label不同颜色显示
NSString * str = [NSString stringWithFormat:@"价格:¥%@",model.goodsPrice];
NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:str];
NSRange range = [[attributeStr string]rangeOfString:@"价格:"];
NSRange reviseRange = NSMakeRange(range.location, range.length);
[attributeStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:reviseRange];
[_goodsPriceLable setAttributedText:attributeStr]; // 判断最小值
if (model.goodsCount < ) {
_goodsCountTextfield.text = @"";
}else{
_goodsCountTextfield.text = [NSString stringWithFormat:@"%ld",(long)model.goodsCount];
}
// 选择的
if (model.isSelected) {
_selectedButton.selected = YES;
[_selectedButton setImage:[UIImage imageNamed:@"radiobuttons_pressed@2x.png"] forState:UIControlStateSelected];
}
// 未选的
else{
_selectedButton.selected = NO;
[_selectedButton setImage:[UIImage imageNamed:@"radiobuttons_normal@2x.png"] forState:UIControlStateNormal];
}
} #pragma private method - (void)isselectButtonClick: (UIButton *)button{ if (self.selectedBlock) {
self.selectedBlock(self.indexPath);
}
} - (void)deletButtonAction: (UIButton *)button{ if (self.deleteBlock) {
self.deleteBlock(self.indexPath);
}
} - (void)subStractButtonAction: (UIButton *)button{ if (self.subTractBlock) {
self.subTractBlock(self.indexPath);
}
} - (void)addButtonAction: (UIButton *)button{ if (self.addBlock) {
self.addBlock(self.indexPath);
} }
@end
Controller :
//
// ViewController.m
// ShopingCar
//
// Created by 思 彭 on 16/8/17.
// Copyright © 2016年 思 彭. All rights reserved.
// #import "ViewController.h"
#import "ZH_Button.h"
#import "ArrayDataSource.h"
#import "Masonry.h"
#import "ShopCarModel.h"
#import "ShopCell.h"
#import "DetailViewController.h" static NSString *const identifier = @"cell";
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
#define ScreenHeight [UIScreen mainScreen].bounds.size.height @interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
{
UIButton * allButton;
UILabel * moneyLable;
float priceNumber;
UIImageView * _backGrundImageView;
UIButton * balanceButton;
}
@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) NSMutableArray *dataArray;
@property (nonatomic,strong) ArrayDataSource *dataSource; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
self.title = @"我的购物车";
self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
[self loadData];
[self createTabelView];
[self createBottomView];
} #pragma mark - SetUI - (void)createTabelView{ self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(, , ScreenWidth, ScreenHeight - ) style:UITableViewStylePlain];
self.tableView.dataSource = self;
self.tableView.delegate = self;
self.tableView.rowHeight = ;
[self.view addSubview:self.tableView]; // 注册cell
[self.tableView registerClass:[ShopCell class] forCellReuseIdentifier:identifier];
self.tableView.tableFooterView = [[UIView alloc]init];
} - (void)createBottomView{ UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(, ScreenHeight - , ScreenWidth, )];
[self.view addSubview:bottomView]; //全选按钮
allButton = [UIButton buttonWithType:UIButtonTypeCustom];
allButton.frame = CGRectMake(, , , );
[allButton setImage:[UIImage imageNamed:@"radiobuttons_normal"] forState:UIControlStateNormal];
[allButton setImage:[UIImage imageNamed:@"radiobuttons_pressed"] forState:UIControlStateSelected];
allButton.titleLabel.font = [UIFont systemFontOfSize:];
allButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
[allButton addTarget:self action:@selector(allButtonClick:) forControlEvents:UIControlEventTouchUpInside];
allButton.selected = NO;
[bottomView addSubview:allButton]; UILabel * quanxuanLable = [[UILabel alloc]initWithFrame:CGRectMake(allButton.frame.origin.x + , allButton.frame.origin.y - , , )];
quanxuanLable.text = @"全选";
quanxuanLable.font = [UIFont systemFontOfSize:];
quanxuanLable.textAlignment = NSTextAlignmentLeft;
[bottomView addSubview:quanxuanLable]; moneyLable = [[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2.0 - , allButton.frame.origin.y, , )];
moneyLable.textColor = [UIColor redColor];
NSString * textStr = @"合计:¥0.00";
NSMutableAttributedString * attributedStr = [[NSMutableAttributedString alloc]initWithString:textStr];
NSRange range = [[attributedStr string]rangeOfString:@"合计:"];
NSRange lastRange = NSMakeRange(range.location, range.length);
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:lastRange];
[moneyLable setAttributedText:attributedStr];
moneyLable.font = [UIFont systemFontOfSize:];
moneyLable.textAlignment = NSTextAlignmentCenter;
[bottomView addSubview:moneyLable]; //结算按钮
balanceButton = [UIButton buttonWithType:UIButtonTypeSystem];
balanceButton.frame = CGRectMake(ScreenWidth - , , , );
balanceButton.backgroundColor = [UIColor redColor];
[balanceButton setTitle:@"结算" forState:UIControlStateNormal];
[balanceButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
balanceButton.titleLabel.font = [UIFont fontWithName:@"AmericanTypewriter-Bold" size:];
//字体祖后面加-Bold就是加粗 加-Oblique就是倾斜
[balanceButton addTarget:self action:@selector(balanceButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[bottomView addSubview:balanceButton]; _backGrundImageView = [[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2.0 - , self.view.frame.size.height/2.0 - , , )];
_backGrundImageView.image = [UIImage imageNamed:@"购物车空"];
_backGrundImageView.hidden = YES;
[bottomView addSubview:_backGrundImageView]; } #pragma mark - loadData - (void)loadData{ //设置购物车的模拟数据
for (int i = ; i < ; i++) {
NSMutableDictionary * dataDic = [[NSMutableDictionary alloc]init];
NSString * nameStr = [NSString stringWithFormat:@"商品名称%d",i];
NSString * priceStr = [NSString stringWithFormat:@"%.1f",199.0 + i];
[dataDic setValue:nameStr forKey:@"goodsName"];
[dataDic setValue:priceStr forKey:@"goodsPrice"];
[dataDic setValue:@"kiutCat.png" forKey:@"goodsImage"];
[dataDic setValue:@"" forKey:@"goodsCount"];
ShopCarModel * model = [ShopCarModel modelWithDictionary:dataDic];
[self.dataArray addObject:model];
}
[self.tableView reloadData]; } #pragma mark - UITableView DataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return self.dataArray.count;
} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ __weak typeof(self) weakSelf = self; ShopCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
cell.model = self.dataArray[indexPath.row];
cell.indexPath = indexPath; cell.deleteBlock = ^ (NSIndexPath *indexPath){ [weakSelf.dataArray removeObjectAtIndex:indexPath.row];
//重新计算价格
[weakSelf sumOfAllPrice];
// 带动画的删除该行
[weakSelf.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
};
cell.selectedBlock = ^ (NSIndexPath *indexPath){ ShopCarModel *model = weakSelf.dataArray[indexPath.row];
model.isSelected = !model.isSelected;
// 计算价钱 <记住要先选择再计算价钱>
[weakSelf sumOfAllPrice];
[weakSelf.tableView reloadData];
};
cell.addBlock = ^ (NSIndexPath *indexPath){
// 取得model
ShopCarModel *model = weakSelf.dataArray[indexPath.row];
if (model.goodsCount == ) {
NSLog(@"不能再多啦!!!");
[self showAlertView:@"不能再多啦!!!"];
[weakSelf sumOfAllPrice];
[weakSelf.tableView reloadData];
}
// 注意是 >= 1
if (model.goodsCount >= ) {
model.goodsCount++;
[weakSelf sumOfAllPrice];
[weakSelf.tableView reloadData];
}
};
cell.subTractBlock = ^ (NSIndexPath *indexPath){ // 取得model
ShopCarModel *model = weakSelf.dataArray[indexPath.row];
if (model.goodsCount == ) {
NSLog(@"不能再少啦!!!");
[self showAlertView:@"不能再少啦!!!"];
return ; // 让其不能再往下执行了
}
if (model.goodsCount < ) {
model.goodsCount = model.goodsCount - ;
[weakSelf sumOfAllPrice];
[weakSelf.tableView reloadData];
}
};
return cell;
} #pragma mark - UITableView Delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ DetailViewController *detailVc = [[DetailViewController alloc]init];
[self.navigationController pushViewController:detailVc animated:YES];
}
#pragma mark - private method - (void)showAlertView: (NSString *)messageStr{ UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提醒您哟!!!" message:messageStr delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alertView show]; }
// 全选 - (void)allButtonClick: (UIButton *)button{ // 取反
button.selected = !button.selected;
for (NSInteger i = ; i < self.dataArray.count; i++) { ShopCarModel *model = self.dataArray[i];
model.isSelected = button.selected;
}
//重新计算价钱
[self sumOfAllPrice];
[self.tableView reloadData];
} // 结算 - (void)balanceButtonClick: (UIButton *)button{ NSString *moneyStr = moneyLable.text;
// 分割字符串
NSArray *array = [moneyStr componentsSeparatedByString:@"合计:¥"];
NSString *message;
NSString *carStr;
if (array.count == && [[array objectAtIndex:]floatValue] < 0.00000001) {
message = @"请先选择商品哟!!!";
carStr = @"请先选择商品哟!!!";
}else{ message = @"去结算";
carStr = [NSString stringWithFormat:@"总计:%d元",[[array objectAtIndex:] intValue]];
}
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:carStr message:message delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alertView show];
} - (void)sumOfAllPrice{ for (NSInteger i = ; i < self.dataArray.count; i++) { ShopCarModel *model = self.dataArray[i];
if (model.isSelected) {
priceNumber = priceNumber + model.goodsCount * [model.goodsPrice floatValue];
}
}
NSString * moneyStr = [NSString stringWithFormat:@"合计:¥%0.2f",priceNumber];
NSMutableAttributedString * attributedStr = [[NSMutableAttributedString alloc]initWithString:moneyStr];
NSRange range = [[attributedStr string]rangeOfString:@"合计:"];
NSRange lastRange = NSMakeRange(range.location, range.length);
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:lastRange];
[moneyLable setAttributedText:attributedStr];
moneyLable.text = [NSString stringWithFormat:@"合计:¥%0.2f",priceNumber];
priceNumber = 0.0; } #pragma mark - 懒加载 - (NSMutableArray *)dataArray{ if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
} @end
刚开始有很多bug,不过应该,可能,大概解决了吧......<暂时没发现其他bug...嘿嘿嘿!!!>
最近有点闲,有点迷茫~~~~~~还是要加油,依旧要努力~~~~~~
购物车实现 <Block实现回调>的更多相关文章
- block学习二:使用Block替代回调
使用Block替代回调,分为三步进行:
- Swift 用Delegate和Block实现回调的Demo
一.有关回调 我们知道,执行函数的时候,一般都有return作为返回参数了,那有return了为什么还要回调呢? 回调是为了实现异步的返回,在某些特殊的情况下,比如你执行的函数是一个长时间运行的函数, ...
- 【转】block一点也不神秘————如何利用block进行回调
我们在开发中常常会用到函数回调,你可以用通知来替代回调,但是大多数时候回调是比通知方便的,所以何乐而不为呢?如果你不知道回调使用的场景,我们来假设一下: 1.我现在玩手机 2.突然手机没有电了 3.我 ...
- [置顶] block一点也不神秘————如何利用block进行回调
我们在开发中常常会用到函数回调,你可以用通知来替代回调,但是大多数时候回调是比通知方便的,所以何乐而不为呢?如果你不知道回调使用的场景,我们来假设一下: 1.我现在玩手机 2.突然手机没有电了 3.我 ...
- 如何结合场景利用block进行回调
我们在开发中常常会用到函数回调,你可以用通知来替代回调,但是大多数时候回调是比通知方便的,所以何乐而不为呢?如果你不知道回调使用的场景,我们来假设一下: 1.我现在玩手机 2.突然手机没有电了 3.我 ...
- block一点也不神秘————如何利用block进行回调
我们在开发中常常会用到函数回调,你可以用通知来替代回调,但是大多数时候回调是比通知方便的,所以何乐而不为呢?如果你不知道回调使用的场景,我们来假设一下: 1.我现在玩手机 2.突然手机没有电了 3.我 ...
- [Objective-C] Block实现回调和简单的学习思考
初识Block的时候,总觉得其很可怕,因为看不懂其运行原理,所以用起来总是觉得不安全.关于Block的语法,等我把手里的资料全部看完,整理好再发出来.这次先看看用Block怎么实现回调. 新博客:wo ...
- 关于block的回调使用-防止内存泄露问题
block 一般用于回调,比方请求数据我们把asi封装好,仅仅用block调数据就方便很多 获取到得数据假设要给之加入数据,切记不能够使用self.(这个数组) 或者_(这个数组) addObject ...
- Objective-C中的Block回调模式
在前面的博客中提到了Block的概念和使用方法,个人感觉Block最爽的用法莫过于在回调时用block.感觉比委托回调和目标方法回调用着要顺手,好不好用还得读者亲自用一下才知道.如果 读者之前用过SS ...
随机推荐
- Python 获得程序 exe 的版本号
Python 获得程序 exe 的版本号 python中需要安装 pywin32 包 # based on http://stackoverflow.com/questions/580924/pyth ...
- 如何在SpringBoot的 过滤器之中注入Bean对象
我建立一个全局拦截器,此拦截器主要用于拦截APP用户登录和请求API时候,必须加密,我把它命名为SecurityFilter,它继承了Filter,web应用启动的顺序是:listener->f ...
- windows安装mysql(5.7.26版本)压缩包
1.解压安装包,进入文件夹,并创建一个data文件夹! 2.修改 my-default.ini 文件 [mysql] default-character-set=utf8 [mysqld] port ...
- CSS基础学习 19.CSS hack
- 嵌入式linux修改日期时间
命令格式为: date -s 时间字符串 例如只修改系统的日期,不修改时间(时分秒) date -s 2012-08-02 或只修改时间不修改日期 date -s 10:08:00 当然也可以同时修改 ...
- Serializable(转)
最近在阅读JDK源码中的集合,看到很多集合类实现了Serializable接口,Cloneable接口.在阅读了很多关于Serializable接口的博客后,浅谈下我对Serializable接口的理 ...
- Finding Lane Lines on the Road
Finding Lane Lines on the Road The goals / steps of this project are the following: Make a pipeline ...
- 【Android-布局复用】 多个界面复用一个布局文件(二)
多个界面复用一个布局界面 ,如何找到复用布局文件中的控件的id? 举个栗子: 1. layout_common.xml 复用的布局文件,如何找到button 的id? <?xml versio ...
- 小程序列表倒计时 wxs 实现
效果 代码 js //拿到服务器时间 var serverLocalDate = data.serverLocalDate; //调用函数开始计时 this.serverLocalDate(serve ...
- bbs-admin-自定义admin(一)
自定义admin 概要:django-admin本质就是一个app,只是Django内部分装了,因此我们尝试自己设计一个简易版的admin 设计前知识补充: model._meta.app_label ...