bootstrap+css进行页面布局
效果
用到了bootstrap中的表格css、圆形css、以及上一页下一页css。
布局页面,填充数据,实现js动态效果(比如点击下一页,上一页),逐步完善。
不仅仅要会使用bootstrap中的样式,也要能够灵活的运用css样式,两者结合,才能够融会贯通,活学活用。
1.表格部分
<div id="datalist">
<table class="table table-striped">
<thead>
<tr>
<th>项目</th>
<th>次数</th>
<th>奖金</th>
</tr>
</thead>
<tbody>
<empty name="list"><tr><td class="text-center" colspan="3">暂无数据</td></tr></empty>
<volist name="list" id="vo">
<tr>
<td>{sh:$vo.name}</td>
<td>{sh:$vo.bonus_count}</td>
<td>{sh:$vo.bonus_money}</td>
</tr>
</volist>
</tbody>
</table>
</div>
用到了bootstrap中的table、table-striped
然后自定义css
.table th {
color: #C4C4C4;
} .table tbody tr td+td+td {
color: #D3964F;
}
这样就实现了上面的表格样式了。
2.奖金
<div id="total" class="img-circle">
<div class="text-center money-txt">
<h3>奖金</h3>
<h2>¥{sh:$total_money}</h2>
</div>
</div>
用到了bootstrap中的img-circle、text-center、h3、h2。
然后自定义css
#total {
width: 140px;
height: 140px;
background-color: #EC6C00;
margin: auto;
} #total .money-txt {
color: white;
padding-top: 10px;
}
是的圆圈居中,黄色,字体白色,字居中显示等等。
bootstrap结合自己定义的css样式共同实现需要的页面布局。
bootstrap提供了一些基础布局,需要灵活使用。
3.选择月份
<div id="select-date">
<ul class="pager">
<li class="previous"><a onclick="lastMonth();"><span aria-hidden="true">←</span> </a></li>
<span class="date-txt"><strong>{sh:$s_year}.{sh:$s_month}</strong></span>
<input type="text" id="s_year" value="{sh:$s_year}" hidden="hidden">
<input type="text" id="s_month" value="{sh:$s_month}" hidden="hidden">
<li class="next"><a onclick="nextMonth();"><span aria-hidden="true">→</span></a></li>
</ul>
</div>
上下月份选择,用到了bootstrap中的pager、previous、next等等。
然后灵活的添加表单、click事件。实现动态效果。
js
<script type="text/javascript">
function lastMonth(){
var s_year = $('#s_year').val();
var s_month = $('#s_month').val();
window.location.href="{sh::U('User/bonus')}&s_year="+s_year+"&s_month="+s_month+"&type=last";
} function nextMonth(){
var s_year = $('#s_year').val();
var s_month = $('#s_month').val();
window.location.href="{sh::U('User/bonus')}&s_year="+s_year+"&s_month="+s_month+"&type=next";
}
</script>
4.php获取数据
public function bonus() {
if($type = $this->_request('type','trim')){
$s_year = $this->_request('s_year','trim');
$s_month = $this->_request('s_month','trim');
if($type == 'last'){ // 获取上一月
if($s_month==1){
$useYear = $s_year-1;
$useMonth = 12;
}else{
$useYear = $s_year;
$useMonth = $s_month-1;
}
} if($type == 'next'){ // 获取下一月
if($s_month==12){
$useYear = $s_year+1;
$useMonth = 1;
}else{
$useYear = $s_year;
$useMonth = $s_month+1;
}
}
}else{
// 获取当前年 月
$useYear = date('Y');
$useMonth = date('m');
}
$this->assign('s_year',$useYear);
$this->assign('s_month',$useMonth); $opener_id = $this->opener_id;
if(empty($opener_id)){
$this->error('数据有误');
}
$agent_id = $this->opener['agent_id']; //所属代理商id
$where['a.agent_id'] = $agent_id;
$where['a.year'] = $useYear;
$where['a.month'] = $useMonth;
// 获取当前拓展员当前月的奖金信息,以设置的获奖项目为基础
// 子查询获取当前代理商的全部奖金数据
$whereSub['a.opener_id'] = $opener_id;
$subQuery = M()->table('sh_opener_bonus a')->join('sh_incentive b on a.incentive_id = b.id')->where($whereSub)->field('a.id as bonus_id,b.id as incentive_id,b.money')->select(false); // 获取最终数据
$list = M()->table('sh_incentive a')->join('left join '.$subQuery.' b on a.id = b.incentive_id')->join('sh_incentive_item c on a.item_id = c.id')->where($where)->field('count(b.bonus_id) as bonus_count,sum( if( b.money > 0, b.money, 0)) as bonus_money,c.name')->group('a.id')->select();
$total_money = 0;
foreach ($list as $k => $v) {
$total_money += $v['bonus_money'];
}
$this->assign('total_money',$total_money);
$this->assign('list',$list);
$this->display();
}
bootstrap+css进行页面布局的更多相关文章
- html div+css做页面布局
http://blog.csdn.net/mercop/article/details/7882000 HTML CSS + DIV实现整体布局 1.技术目标: 开发符合W3C标准的Web页面 理解盒 ...
- css+div页面布局
div标签是html页面中用于分组的块元素,是专门用于元素布局的标签. 标签的级别: 1.行级标签:可设置大小,但一行只能容下一个行级标签(默认宽度==页面宽度,默认高度==填充高度) 2.块级标签: ...
- 01 DIV+CSS 固定页面布局
本文讲解使用DIV+CSS布局最基本的内容,读完本文你讲会使用DIV+CSS进行简单的页面布局. DIV+CSS布局中主要CSS属性介绍: Float: Float属性是DIV+CSS布局中最基本也是 ...
- css篇-页面布局-三栏布局
页面布局 题目:假设高度已知,请写出三栏布局,其中左栏.右栏宽度各为300px,中间自适应. 1)浮动 2)绝对定位 3)Flexbox 4)表格布局 5)网格布局(CSS3的Grid布局) 代码: ...
- html css 网络 页面布局 颜色 参考 拾取器网址
http://blog.163.com/wujinhongisme@126/blog/static/3613698020095115919389/ ========================== ...
- css后台页面布局技巧
目标: 实现左边侧边栏固定,右边内容区自适应 侧边栏内容较少时背景100%高度展示 侧边栏内容较多时可以滚动,且不让显示滚动条(显示太丑) 内容区较少时不出现滚动条,较多时可以滚动 code: < ...
- css页面布局总结
W3C标准:是万维网制定的一系列标准,包括结构化标准语言(html.xml),表现 标准语言(css),行为标准语言(DOM,ECMAScript<javascript>)组成.这个标准倡 ...
- 前端武器库系列之html后台管理页面布局
设计网页,让网页好看:网上找模板 搜 HTML模板 BootStrap 一.页面布局之主站页面 主站布局一般不占满页面,分为菜单栏.主页面.底部 上中下三部分.伪代码如下: <div class ...
- IT兄弟连 HTML5教程 DIV+CSS网页标准化布局 小结及习题
小结 DIV+CSS布局页面的优势:表现和内容相分离.代码简洁,提高页面浏览速度.易于维护和改版.提高搜索引擎对网页的索引效率.每个HTML元素都可以看作一个区块,类似于装了东西的盒子,称为盒子模式. ...
随机推荐
- Dagger2 中的 Scope
Dagger2 中虽然概念挺多的,但是大部分花时间都能理清.包括看人家的分析,Debug 代码下去也能懂.但是对于 scope 的用法以及实现原理还是有点难理解的.主要的问题也像简书上的文章所说: 自 ...
- Load事件
Load事件 在 窗体完全呈现之后 被 触发 如下伪代码: void ShowWindows { .....//显示父容器 .....//显示子容器 .....//显示控件 //至此,窗体完全呈现 ...
- lightoj1213推公式
很容易推出来的公式ans=n^(k-1)*k*sum 然后快速幂就好了 #include<map> #include<set> #include<cmath> #i ...
- JDBC相关总结
JDBC statement的相关总结 1.Statement.PreparedStatement和CallableStatement都是接口(interface). 2.Statement继承自Wr ...
- spring boot MongoDB的集成和使用
前言 上一章节,简单讲解了如何集成Spring-data-jpa.本章节,我们来看看如何集成NoSQL的Mongodb.mongodb是最早热门非关系数据库的之一,使用也比较普遍.最适合来存储一些非结 ...
- KMP算法--C#版
static void BuildTable(string subString, ref int[] next) { if (string.IsNullOrWhiteSpace(subString)) ...
- Oracle中的填充函数lpad和rpad的用法(转)
原文链接:http://blog.csdn.net/myzhanglt/article/details/7392999 今日学习遇到一个不熟悉的函数LPAD,查了一下文档,将其用法总结如下: Lpad ...
- 函数声明提升机制在浏览器中的bug
JavaScript 解释器中存在一种变量声明被提升(hoisting)的机制,也就是说变量(函数)的声明会被提升到作用域的最前面,即使写代码的时候是写在最后面,也还是会被提升至最前面. 但通过测试, ...
- jsp中解决乱码问题
解决中文乱码 a) 第一种: String name=new String(name.getBytes("ISO-8859-1"),"UTF-8"); b) 第 ...
- Android 之Navicat for SQLite 数据库介绍
Navicat for SQLite 是一套专为SQLite 设计的强大数据库管理及开发工具 Navicat for SQLite 是一套专为SQLite 设计的强大数据库管理及开发工具.它可以 ...