添加了Tornado相关的文档和代码
|
|
@ -7,30 +7,108 @@
|
|||
由于之前已经详细的讲解了如何创建Django项目以及项目的相关配置,因此我们略过这部分内容,唯一需要说明的是,从上面对投票应用需求的描述中我们可以分析出三个业务实体:学科、老师和用户。学科和老师之间通常是一对多关联关系(一个学科有多个老师,一个老师通常只属于一个学科),用户因为要给老师投票,所以跟老师之间是多对多关联关系(一个用户可以给多个老师投票,一个老师也可以收到多个用户的投票)。首先修改应用下的models.py文件来定义数据模型,先给出学科和老师的模型。
|
||||
|
||||
```Python
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Subject(models.Model):
|
||||
"""学科"""
|
||||
no = models.AutoField(primary_key=True, verbose_name='编号')
|
||||
name = models.CharField(max_length=31, verbose_name='名称')
|
||||
intro = models.CharField(max_length=511, verbose_name='介绍')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
db_table = 'tb_subject'
|
||||
verbose_name_plural = '学科'
|
||||
|
||||
|
||||
class Teacher(models.Model):
|
||||
"""老师"""
|
||||
no = models.AutoField(primary_key=True, verbose_name='编号')
|
||||
name = models.CharField(max_length=15, verbose_name='姓名')
|
||||
gender = models.BooleanField(default=True, choices=((True, '男'), (False, '女')), verbose_name='性别')
|
||||
birth = models.DateField(null=True, verbose_name='出生日期')
|
||||
intro = models.CharField(max_length=511, default='', verbose_name='')
|
||||
good_count = models.IntegerField(default=0, verbose_name='好评数')
|
||||
bad_count = models.IntegerField(default=0, verbose_name='差评数')
|
||||
photo = models.CharField(max_length=255, verbose_name='照片')
|
||||
subject = models.ForeignKey(to=Subject, on_delete=models.PROTECT, db_column='sno', verbose_name='所属学科')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
db_table = 'tb_teacher'
|
||||
verbose_name_plural = '老师'
|
||||
```
|
||||
|
||||
模型定义完成后,可以通过“生成迁移”和“执行迁移”来完成关系型数据库中二维表的创建,当然这需要提前启动数据库服务器并创建好对应的数据库,同时我们在项目中已经安装了PyMySQL而且完成了相应的配置,这些内容此处不再赘述。
|
||||
|
||||
```Shell
|
||||
(venv)$ python manage.py makemigrations demo
|
||||
(venv)$ python manage.py makemigrations vote
|
||||
...
|
||||
(venv)$ python manage.py migrate
|
||||
...
|
||||
```
|
||||
|
||||
完成模型迁移之后,我们可以通过下面的SQL语句来添加学科和老师的数据。
|
||||
> 注意:为了给vote应用生成迁移,需要先修改Django项目的配置文件settings.py,在INSTALLED_APPS中添加vote应用。
|
||||
|
||||
完成模型迁移之后,我们可以通过下面的SQL语句来添加学科和老师测试的数据。
|
||||
|
||||
```SQL
|
||||
INSERT INTO `tb_subject` (`no`,`name`,`intro`)
|
||||
VALUES
|
||||
(1, 'Python全栈+人工智能', 'Python是一种面向对象的解释型计算机程序设计语言,由荷兰人Guido van Rossum于1989年发明,第一个公开发行版发行于1991年。'),
|
||||
(2, 'JavaEE+分布式服务', 'Java是一门面向对象编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。'),
|
||||
(3, 'HTML5大前端', 'HTML5 将成为 HTML、XHTML 以及 HTML DOM 的新标准。'),
|
||||
(4, '全栈软件测试', '在规定的条件下对程序进行操作,以发现程序错误,衡量软件质量,并对其是否能满足设计要求进行评估的过程'),
|
||||
(5, '全链路UI/UE', '全链路要求设计师关注整个业务链中的每一个环节,将设计的价值融入每一个和用户的接触点中,让整个业务的用户体验质量得到几何级数的增长。');
|
||||
|
||||
INSERT INTO `tb_teacher` (`no`,`name`,`gender`,`birth`,`intro`,`good_count`,`bad_count`,`photo`,`sno`)
|
||||
VALUES
|
||||
(1, '骆昊', 1, '1980-11-28', '10年以上软硬件产品设计、研发、架构和管理经验,2003年毕业于四川大学,四川大学Java技术俱乐部创始人,四川省优秀大学毕业生,在四川省网络通信技术重点实验室工作期间,参与了2项国家自然科学基金项目、1项中国科学院中长期研究项目和多项四川省科技攻关项目,在国际会议和国内顶级期刊上发表多篇论文(1篇被SCI收录,3篇被EI收录),大规模网络性能测量系统DMC-TS的设计者和开发者,perf-TTCN语言的发明者。国内最大程序员社区CSDN的博客专家,在Github上参与和维护了多个高质量开源项目,精通C/C++、Java、Python、R、Swift、JavaScript等编程语言,擅长OOAD、系统架构、算法设计、协议分析和网络测量,主持和参与过电子政务系统、KPI考核系统、P2P借贷平台等产品的研发,一直践行“用知识创造快乐”的教学理念,善于总结,乐于分享。', 0, 0, 'images/luohao.png', 1),
|
||||
(2, '王海飞', 1, '1993-05-24', '5年以上Python开发经验,先后参与了O2O商城、CRM系统、CMS平台、ERP系统等项目的设计与研发,曾在全国最大最专业的汽车领域相关服务网站担任Python高级研发工程师、项目经理等职务,擅长基于Python、Java、PHP等开发语言的企业级应用开发,全程参与了多个企业级应用从需求到上线所涉及的各种工作,精通Django、Flask等框架,熟悉基于微服务的企业级项目开发,拥有丰富的项目实战经验。善于用浅显易懂的方式在课堂上传授知识点,在授课过程中经常穿插企业开发的实际案例并分析其中的重点和难点,通过这种互动性极强的教学模式帮助学员找到解决问题的办法并提升学员的综合素质。', 0, 0, 'images/wangdachui.png', 1),
|
||||
(3, '余婷', 0, '1992-03-12', '5年以上移动互联网项目开发经验和教学经验,曾担任上市游戏公司高级软件研发工程师和移动端(iOS)技术负责人,参了多个企业级应用和游戏类应用的移动端开发和后台服务器开发,拥有丰富的开发经验和项目管理经验,以个人开发者和协作开发者的身份在苹果的AppStore上发布过多款App。精通Python、C、Objective-C、Swift等开发语言,熟悉iOS原生App开发、RESTful接口设计以及基于Cocos2d-x的游戏开发。授课条理清晰、细致入微,性格活泼开朗、有较强的亲和力,教学过程注重理论和实践的结合,在学员中有良好的口碑。', 0, 0, 'images/yuting.png', 1),
|
||||
(4, '肖世荣', 1, '1977-07-02', '10年以上互联网和移动互联网产品设计、研发、技术架构和项目管理经验,曾在中国移动、symbio、ajinga.com、万达信息等公司担任架构师、项目经理、技术总监等职务,长期为苹果、保时捷、耐克、沃尔玛等国际客户以及国内的政府机构提供信息化服务,主导的项目曾获得“世界科技先锋”称号,个人作品“许愿吧”曾在腾讯应用市场生活类App排名前3,拥有百万级用户群体,运营的公众号“卵石坊”是国内知名的智能穿戴设备平台。精通Python、C++、Java、Ruby、JavaScript等开发语言,主导和参与了20多个企业级项目(含国家级重大项目和互联网创新项目),涉及的领域包括政务、社交、电信、卫生和金融,有极为丰富的项目实战经验。授课深入浅出、条理清晰,善于调动学员的学习热情并帮助学员理清思路和方法。', 0, 0, 'images/xiaoshirong.png', 1),
|
||||
(5, '张无忌', 1, '1987-07-07', '出生起便在冰火岛过着原始生活,踏入中土后因中玄冥神掌命危而带病习医,忍受寒毒煎熬七年最后因福缘际会练成“九阳神功”更在之后又练成了“乾坤大挪移”等盖世武功,几乎无敌于天下。 生性随和,宅心仁厚,精通医术和药理。20岁时便凭着盖世神功当上明教教主,率领百万教众及武林群雄反抗蒙古政权元朝的高压统治,最后推翻了元朝。由于擅长乾坤大挪移神功,上课遇到问题就转移话题,属于拉不出屎怪地球没有引力的类型。', 0, 0, 'images/zhangwuji.png', 5),
|
||||
(6, '韦一笑', 1, '1975-12-15', '外号“青翼蝠王”,为明教四大护教法王之一。 身披青条子白色长袍,轻功十分了得。由于在修炼至阴至寒的“寒冰绵掌”时出了差错,经脉中郁积了至寒阴毒,只要运上内力,寒毒就会发作,如果不吸人血解毒,全身血脉就会凝结成冰,后得张无忌相助,以其高明医术配以“九阳神功”,终将寒毒驱去,摆脱了吸吮人血这一命运。由于轻功绝顶,学生一问问题就跑了。', 0, 0, 'images/weiyixiao.png', 3);
|
||||
```
|
||||
|
||||
当然也可以直接使用Django提供的后台管理应用来添加学科和老师信息,这需要先注册模型类和模型管理类。
|
||||
|
||||
```SQL
|
||||
from django.contrib import admin
|
||||
from django.contrib.admin import ModelAdmin
|
||||
|
||||
from vote.models import Teacher, Subject
|
||||
|
||||
|
||||
class SubjectModelAdmin(ModelAdmin):
|
||||
"""学科模型管理"""
|
||||
list_display = ('no', 'name')
|
||||
ordering = ('no', )
|
||||
|
||||
|
||||
class TeacherModelAdmin(ModelAdmin):
|
||||
"""老师模型管理"""
|
||||
list_display = ('no', 'name', 'gender', 'birth', 'good_count', 'bad_count', 'subject')
|
||||
ordering = ('no', )
|
||||
search_fields = ('name', )
|
||||
|
||||
|
||||
admin.site.register(Subject, SubjectModelAdmin)
|
||||
admin.site.register(Teacher, TeacherModelAdmin)
|
||||
```
|
||||
|
||||
接下来,我们就可以修改views.py文件,通过编写视图函数先实现“学科介绍”页面。
|
||||
|
||||
```Python
|
||||
def show_subjects(request):
|
||||
ctx = {'subjects_list': Subject.objects.all()}
|
||||
return render(request, 'subject.html', ctx)
|
||||
"""查看所有学科"""
|
||||
subjects = Subject.objects.all()
|
||||
return render(request, 'subject.html', {'subjects': subjects})
|
||||
```
|
||||
|
||||
至此,我们还需要一个模板页,模板的配置以及模板页中模板语言的用法在之前已经进行过简要的介绍,如果不熟悉可以看看下面的代码,相信这并不是一件困难的事情。
|
||||
|
|
@ -41,131 +119,91 @@ def show_subjects(request):
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>学科信息</title>
|
||||
<style>
|
||||
body {
|
||||
width: 960px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.sub {
|
||||
margin: 20px 10px;
|
||||
}
|
||||
</style>
|
||||
<style>/* 此处略去了层叠样式表的选择器 */</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>学科信息</h1>
|
||||
<h1>所有学科</h1>
|
||||
<hr>
|
||||
{% for subject in subjects_list %}
|
||||
<dl class="sub">
|
||||
<dt><a href="/subjects/{{ subject.no }}">{{ subject.name }}</a></dt>
|
||||
<div id="container">
|
||||
{% for subject in subjects %}
|
||||
<dl>
|
||||
<dt>
|
||||
<a href="/teachers?sno={{ subject.no }}">
|
||||
{{ subject.name }}
|
||||
</a>
|
||||
</dt>
|
||||
<dd>{{ subject.intro }}</dd>
|
||||
</dl>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
启动服务器,运行效果如下图所示。
|
||||
|
||||

|
||||
|
||||
### 加载静态资源
|
||||
|
||||
在上面的模板中,我们为每个学科添加了一个超链接,点击超链接可以查看该学科的讲师信息,为此我们得修改项目的urls.py文件配置一个新的URL。
|
||||
在上面的模板中,我们为每个学科添加了一个超链接,点击超链接可以查看该学科的讲师信息,为此需要再编写一个视图函数来处理查看指定学科老师信息。
|
||||
|
||||
```Python
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
from demo import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.show_subjects),
|
||||
path('subjects/<int:no>', views.show_teachers),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
def show_teachers(request):
|
||||
"""查看指定学科的老师"""
|
||||
try:
|
||||
sno = int(request.GET['sno'])
|
||||
subject = Subject.objects.get(no=sno)
|
||||
teachers = Teacher.objects.filter(subject__no=sno)
|
||||
context = {'subject': subject, 'teachers': teachers}
|
||||
return render(request, 'teacher.html', context)
|
||||
except (KeyError, ValueError, Subject.DoesNotExist):
|
||||
return redirect('/')
|
||||
```
|
||||
|
||||
Django 2.x在配置URL时可以使用如上面所示的占位符语法,而且可以指定占位符的类型,因为在查询学科讲师信息时,需要传入该学科的编号作为条件,而学科编号在定义模型时设定为`AutoField`,其本质就是`int`类型。相较于Django 1.x中使用正则表达式的命名捕获组来从URL中获取数据(如果对Django 1.x并没有什么概念,这句话可以暂时忽略不计),这种更加优雅的写法可以让我们在视图函数中直接获得学科编号,代码如下所示。
|
||||
|
||||
```Python
|
||||
def show_teachers(request, no):
|
||||
teachers = Teacher.objects.filter(subject__no=no)
|
||||
ctx = {'teachers_list': teachers}
|
||||
return render(request, 'demo/teacher.html', ctx)
|
||||
```
|
||||
|
||||
接下来我们可以定制“老师详情”的模板页。
|
||||
显示老师信息的模板页。
|
||||
|
||||
```HTML
|
||||
<!DOCTYPE html>
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>讲师信息</title>
|
||||
<style>
|
||||
.container {
|
||||
width: 960px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.basic {
|
||||
width: 60%;
|
||||
float: left;
|
||||
}
|
||||
.potrait {
|
||||
width: 40%;
|
||||
float: left;
|
||||
text-align: right;
|
||||
}
|
||||
hr {
|
||||
clear: both;
|
||||
}
|
||||
.button {
|
||||
display: inline-block;
|
||||
width: 80px;
|
||||
height: 30px;
|
||||
background-color: red;
|
||||
color: white;
|
||||
font: 16px/30px Arial;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
<title>老师信息</title>
|
||||
<style>/* 此处略去了层叠样式表的选择器 */</style>
|
||||
</head>
|
||||
<body>
|
||||
{% for x in teachers_list %}
|
||||
<div class="container">
|
||||
<div class="basic">
|
||||
<h1>{{ x.name }}老师</h1>
|
||||
<p><strong>讲师简介</strong></p>
|
||||
<p>{{ x.intro }}</p>
|
||||
<p><strong>教学理念</strong></p>
|
||||
<p>{{ x.motto }}</p>
|
||||
<a href="/good/{{ x.no }}" class="button">好评({{ x.gcount }})</a>
|
||||
<a href="/bad/{{ x.no }}" class="button">差评({{ x.bcount }})</a>
|
||||
</div>
|
||||
<div class="potrait">
|
||||
{% if x.photo %}
|
||||
<img src="{% static x.photo %}">
|
||||
{% endif %}
|
||||
</div>
|
||||
<h1>{{ subject.name }}的老师信息</h1>
|
||||
<hr>
|
||||
{% if teachers %}
|
||||
<div id="container">
|
||||
{% for teacher in teachers %}
|
||||
<div class="teacher">
|
||||
<div class="photo">
|
||||
<img src="{% static teacher.photo %}" height="140" alt="">
|
||||
</div>
|
||||
<div class="info">
|
||||
<div>
|
||||
<span><strong>姓名:{{ teacher.name }}</strong></span>
|
||||
<span>性别:{{ teacher.gender | yesno:'男,女' }}</span>
|
||||
<span>出生日期:{{ teacher.birth }}</span>
|
||||
</div>
|
||||
<div class="intro">{{ teacher.intro }}</div>
|
||||
<div class="comment">
|
||||
<a href="">好评({{ teacher.good_count }})</a>
|
||||
<a href="">差评({{ teacher.bad_count }})</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<h2>暂时没有该学科的老师信息</h2>
|
||||
{% endif %}
|
||||
<div class="back">
|
||||
<a href="/"><< 返回学科</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
请注意上面的模板页面,我们在第2行和`<img>`标签中使用了加载静态资源的模板指令,通过加载静态资源的指令我们可以显示老师的头像。当然,我们还得创建放置静态资源的文件夹并在项目的配置文件中指明静态资源文件夹的所在以及静态资源的URL。
|
||||
### 加载静态资源
|
||||
|
||||
```Shell
|
||||
(venv)$ mkdir static
|
||||
(venv)$ cd static
|
||||
(venv)$ mkdir css js images
|
||||
```
|
||||
|
||||
首先在项目根目录下创建static文件,再进入static目录,创建css、js和images三个文件夹,分别用来放置层叠样式表、JavaScript文件和图片资源。
|
||||
在上面的模板页面中,我们使用了`<img>`标签来加载老师的照片,其中使用了引用静态资源的模板指令`{% static %}`,要使用该指令,首先要使用`{% load static %}`指令来加载静态资源,我们将这段代码放在了页码开始的位置。在上面的项目中,我们将静态资源置于名为static的文件夹中,在该文件夹下又创建了三个文件夹:css、js和images,分别用来保存外部层叠样式表、外部JavaScript文件和图片资源。为了能够找到保存静态资源的文件夹,我们还需要修改Django项目的配置文件settings.py,如下所示:
|
||||
|
||||
```Python
|
||||
# 此处省略上面的代码
|
||||
|
|
@ -176,135 +214,89 @@ STATIC_URL = '/static/'
|
|||
# 此处省略下面的代码
|
||||
```
|
||||
|
||||
接下来运行项目查看结果。
|
||||
|
||||

|
||||
|
||||
### Ajax请求
|
||||
|
||||
接下来就可以实现“好评”和“差评”的功能了,很明显如果能够在不刷新页面的情况下实现这两个功能会带来更好的用户体验,因此我们考虑使用[Ajax](https://zh.wikipedia.org/wiki/AJAX)来实现“好评”和“差评”。
|
||||
|
||||
首先修改项目的urls.py文件,为“好评”和“差评”功能映射对应的URL,跟上面一样我们在URL中使用了占位符语法来绑定老师的编号。
|
||||
接下来修改urls.py文件,配置用户请求的URL和视图函数的对应关系。
|
||||
|
||||
```Python
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
from demo import views
|
||||
from vote import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.login),
|
||||
path('subjects/', views.show_subjects),
|
||||
path('subjects/<int:no>/', views.show_teachers),
|
||||
path('good/<int:no>/', views.make_comment),
|
||||
path('bad/<int:no>/', views.make_comment),
|
||||
path('', views.show_subjects),
|
||||
path('teachers/', views.show_teachers),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
```
|
||||
|
||||
设计视图函数`make_comment`来支持“好评”和“差评”功能,可以通过`json`模块的`dumps`函数实现将字典转成JSON字符串并作为`HttpResponse`返回给浏览器的内容。在创建`HttpResponse`对象时,可以通过`content_type`参数来指定响应的[MIME类型](http://www.w3school.com.cn/media/media_mimeref.asp)为JSON且使用UTF-8编码(避免JSON字符串中的中文出现乱码)。
|
||||
启动服务器运行项目,效果如下图所示。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### Ajax请求
|
||||
|
||||
接下来就可以实现“好评”和“差评”的功能了,很明显如果能够在不刷新页面的情况下实现这两个功能会带来更好的用户体验,因此我们考虑使用[Ajax](https://zh.wikipedia.org/wiki/AJAX)技术来实现“好评”和“差评”,Ajax技术我们在之前的章节中已经介绍过了,此处不再赘述。
|
||||
|
||||
首先修改项目的urls.py文件,为“好评”和“差评”功能映射对应的URL。
|
||||
|
||||
```Python
|
||||
def make_comment(request, no):
|
||||
ctx = {'code': 200}
|
||||
try:
|
||||
teacher = Teacher.objects.get(pk=no)
|
||||
if request.path.startswith('/good'):
|
||||
teacher.good_count += 1
|
||||
ctx['result'] = f'好评({teacher.gcount})'
|
||||
else:
|
||||
teacher.bad_count += 1
|
||||
ctx['result'] = f'差评({teacher.bcount})'
|
||||
teacher.save()
|
||||
except Teacher.DoesNotExist:
|
||||
ctx['code'] = 404
|
||||
return HttpResponse(json.dumps(ctx),
|
||||
content_type='application/json; charset=utf-8')
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
from vote import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.show_subjects),
|
||||
path('teachers/', views.show_teachers),
|
||||
path('praise/', views.prise_or_criticize),
|
||||
path('criticize/', views.prise_or_criticize),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
```
|
||||
|
||||
修改模板页引入jQuery库来实现事件处理、Ajax请求和DOM操作。
|
||||
设计视图函数`praise_or_criticize`来支持“好评”和“差评”功能,该视图函数通过Django封装的JsonResponse类将字典序列化成JSON字符串作为返回给浏览器的响应内容。
|
||||
|
||||
```Python
|
||||
def praise_or_criticize(request):
|
||||
"""好评"""
|
||||
try:
|
||||
tno = int(request.GET['tno'])
|
||||
teacher = Teacher.objects.get(no=tno)
|
||||
if request.path.startswith('/prise'):
|
||||
teacher.good_count += 1
|
||||
else:
|
||||
teacher.bad_count += 1
|
||||
teacher.save()
|
||||
data = {'code': 200, 'hint': '操作成功'}
|
||||
except (KeyError, ValueError, Teacher.DoseNotExist):
|
||||
data = {'code': 404, 'hint': '操作失败'}
|
||||
return JsonResponse(data)
|
||||
```
|
||||
|
||||
修改显示老师信息的模板页,引入jQuery库来实现事件处理、Ajax请求和DOM操作。
|
||||
|
||||
```HTML
|
||||
<!DOCTYPE html>
|
||||
{% load staticfiles %}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>讲师信息</title>
|
||||
<style>
|
||||
.container {
|
||||
width: 960px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.basic {
|
||||
width: 60%;
|
||||
float: left;
|
||||
}
|
||||
.potrait {
|
||||
width: 40%;
|
||||
float: left;
|
||||
text-align: right;
|
||||
}
|
||||
hr {
|
||||
clear: both;
|
||||
}
|
||||
.button {
|
||||
display: inline-block;
|
||||
width: 80px;
|
||||
height: 30px;
|
||||
background-color: red;
|
||||
color: white;
|
||||
font: 16px/30px Arial;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{% for x in teachers_list %}
|
||||
<div class="container">
|
||||
<div class="basic">
|
||||
<h1>{{ x.name }}老师</h1>
|
||||
<p><strong>讲师简介</strong></p>
|
||||
<p>{{ x.intro }}</p>
|
||||
<p><strong>教学理念</strong></p>
|
||||
<p>{{ x.motto }}</p>
|
||||
<a href="/good/{{ x.no }}" class="button">好评({{ x.gcount }})</a>
|
||||
<a href="/bad/{{ x.no }}" class="button">差评({{ x.bcount }})</a>
|
||||
</div>
|
||||
<div class="potrait">
|
||||
{% if x.photo %}
|
||||
<img src="{% static x.photo %}">
|
||||
{% endif %}
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<script src="{% static 'js/jquery.min.js' %}"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$('.basic .button').on('click', function(evt) {
|
||||
$(() => {
|
||||
$('.comment>a').on('click', (evt) => {
|
||||
evt.preventDefault();
|
||||
var $a = $(evt.target);
|
||||
var url = $a.attr('href');
|
||||
$.ajax({
|
||||
'url': url,
|
||||
'type': 'get',
|
||||
'dataType': 'json',
|
||||
'success': function(json) {
|
||||
let a = $(evt.target)
|
||||
let span = a.next()
|
||||
$.getJSON(a.attr('href'), (json) => {
|
||||
if (json.code == 200) {
|
||||
$a.text(json.result);
|
||||
span.text(parseInt(span.text()) + 1)
|
||||
} else {
|
||||
alert(json.hint)
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### 小结
|
||||
|
||||
到此,这个小项目的核心功能已然完成,在下一个章节中我们会增加用户登录和注册的功能,稍后我们还会限定登录后的用户才能进行投票操作,而且每个用户只能投出3票。
|
||||
到此为止,这个投票项目的核心功能已然完成,在下一个章节中我们要求用户必须登录才能投票,没有账号的用户可以通过注册功能注册一个账号。
|
||||
|
|
@ -1,5 +1,13 @@
|
|||
## Django实战(04) - 表单的应用
|
||||
|
||||
我们继续来完成上一章节中的项目,实现“用户注册”和“用户登录”的功能。Django框架中提供了对表单的封装,而且提供了多种不同的使用方式。
|
||||
我们继续来完成上一章节中的项目,实现“用户注册”和“用户登录”的功能,并限制只有登录的用户才能为老师投票。Django框架中提供了对表单的封装,而且提供了多种不同的使用方式。
|
||||
|
||||
首先添加用户模型。
|
||||
|
||||
```Python
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 168 KiB |
|
After Width: | Height: | Size: 347 KiB |
|
|
@ -0,0 +1,140 @@
|
|||
## 预备知识
|
||||
|
||||
### 并发编程
|
||||
|
||||
所谓并发编程就是让程序中有多个部分能够并发或同时执行,并发编程带来的好处不言而喻,其中最为关键的两点是提升了执行效率和改善了用户体验。下面简单阐述一下Python中实现并发编程的三种方式:
|
||||
|
||||
1. 多线程:Python中通过`threading`模块的`Thread`类并辅以`Lock`、`Condition`、`Event`、`Semaphore`和`Barrier`等类来支持多线程编程。Python解释器通过GIL(全局解释器锁)来防止多个线程同时执行本地字节码,这个锁对于CPython(Python解释器的官方实现)是必须的,因为CPython的内存管理并不是线程安全的。因为GIL的存在,Python的多线程并不能利用CPU的多核特性。
|
||||
|
||||
2. 多进程:使用多进程可以有效的解决GIL的问题,Python中的`multiprocessing`模块提供了`Process`类来实现多进程,其他的辅助类跟`threading`模块中的类类似,由于进程间的内存是相互隔离的(操作系统对进程的保护),进程间通信(共享数据)必须使用管道、套接字等方式,这一点从编程的角度来讲是比较麻烦的,为此,Python的`multiprocessing`模块提供了一个名为`Queue`的类,它基于管道和锁机制提供了多个进程共享的队列。
|
||||
|
||||
```Python
|
||||
"""
|
||||
用下面的命令运行程序并查看执行时间,例如:
|
||||
time python3 example06.py
|
||||
real 0m20.657s
|
||||
user 1m17.749s
|
||||
sys 0m0.158s
|
||||
使用多进程后实际执行时间为20.657秒,而用户时间1分17.749秒约为实际执行时间的4倍
|
||||
这就证明我们的程序通过多进程使用了CPU的多核特性,而且这台计算机配置了4核的CPU
|
||||
"""
|
||||
import concurrent.futures
|
||||
import math
|
||||
|
||||
PRIMES = [
|
||||
1116281,
|
||||
1297337,
|
||||
104395303,
|
||||
472882027,
|
||||
533000389,
|
||||
817504243,
|
||||
982451653,
|
||||
112272535095293,
|
||||
112582705942171,
|
||||
112272535095293,
|
||||
115280095190773,
|
||||
115797848077099,
|
||||
1099726899285419
|
||||
] * 5
|
||||
|
||||
|
||||
def is_prime(num):
|
||||
"""判断素数"""
|
||||
assert num > 0
|
||||
for i in range(2, int(math.sqrt(num)) + 1):
|
||||
if num % i == 0:
|
||||
return False
|
||||
return num != 1
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
with concurrent.futures.ProcessPoolExecutor() as executor:
|
||||
for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
|
||||
print('%d is prime: %s' % (number, prime))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
```
|
||||
|
||||
3. 异步编程(异步I/O):所谓异步编程是通过调度程序从任务队列中挑选任务,调度程序以交叉的形式执行这些任务,我们并不能保证任务将以某种顺序去执行,因为执行顺序取决于队列中的一项任务是否愿意将CPU处理时间让位给另一项任务。异步编程通常通过多任务协作处理的方式来实现,由于执行时间和顺序的不确定,因此需要通过钩子函数(回调函数)或者`Future`对象来获取任务执行的结果。目前我们使用的Python 3通过`asyncio`模块以及`await`和`async`关键字(Python 3.5中引入,Python 3.7中正式成为关键字)提供了对异步I/O的支持。
|
||||
|
||||
```Python
|
||||
import asyncio
|
||||
|
||||
|
||||
async def fetch(host):
|
||||
"""从指定的站点抓取信息(协程函数)"""
|
||||
print(f'Start fetching {host}\n')
|
||||
# 跟服务器建立连接
|
||||
reader, writer = await asyncio.open_connection(host, 80)
|
||||
# 构造请求行和请求头
|
||||
writer.write(b'GET / HTTP/1.1\r\n')
|
||||
writer.write(f'Host: {host}\r\n'.encode())
|
||||
writer.write(b'\r\n')
|
||||
# 清空缓存区(发送请求)
|
||||
await writer.drain()
|
||||
# 接收服务器的响应(读取响应行和响应头)
|
||||
line = await reader.readline()
|
||||
while line != b'\r\n':
|
||||
print(line.decode().rstrip())
|
||||
line = await reader.readline()
|
||||
print('\n')
|
||||
writer.close()
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
urls = ('www.sohu.com', 'www.douban.com', 'www.163.com')
|
||||
# 获取系统默认的事件循环
|
||||
loop = asyncio.get_event_loop()
|
||||
# 用生成式语法构造一个包含多个协程对象的列表
|
||||
tasks = [fetch(url) for url in urls]
|
||||
# 通过asyncio模块的wait函数将协程列表包装成Task(Future子类)并等待其执行完成
|
||||
# 通过事件循环的run_until_complete方法运行任务直到Future完成并返回它的结果
|
||||
loop.run_until_complete(asyncio.wait(tasks))
|
||||
loop.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
```
|
||||
|
||||
> 说明:目前大多数网站都要求基于HTTPS通信,因此上面例子中的网络请求不一定能收到正常的响应,也就是说响应状态码不一定是200,有可能是3xx或者4xx。当然我们这里的重点不在于获得网站响应的内容,而是帮助大家理解`asyncio`模块以及`async`和`await`两个关键字的使用。
|
||||
|
||||
我们对三种方式的使用场景做一个简单的总结。
|
||||
|
||||
以下情况需要使用多线程:
|
||||
|
||||
1. 程序需要维护许多共享的状态(尤其是可变状态),Python中的列表、字典、集合都是线程安全的,所以使用线程而不是进程维护共享状态的代价相对较小。
|
||||
2. 程序会花费大量时间在I/O操作上,没有太多并行计算的需求且不需占用太多的内存。
|
||||
|
||||
以下情况需要使用多进程:
|
||||
|
||||
1. 程序执行计算密集型任务(如:字节码操作、数据处理、科学计算)。
|
||||
2. 程序的输入可以并行的分成块,并且可以将运算结果合并。
|
||||
3. 程序在内存使用方面没有任何限制且不强依赖于I/O操作(如:读写文件、套接字等)。
|
||||
|
||||
最后,如果程序不需要真正的并发性或并行性,而是更多的依赖于异步处理和回调时,异步I/O就是一种很好的选择。另一方面,当程序中有大量的等待与休眠时,也应该考虑使用异步I/O。
|
||||
|
||||
> 扩展:关于进程,还需要做一些补充说明。首先,为了控制进程的执行,操作系统内核必须有能力挂起正在CPU上运行的进程,并恢复以前挂起的某个进程使之继续执行,这种行为被称为进程切换(也叫调度)。进程切换是比较耗费资源的操作,因为在进行切换时首先要保存当前进程的上下文(内核再次唤醒该进程时所需要的状态,包括:程序计数器、状态寄存器、数据栈等),然后还要恢复准备执行的进程的上下文。正在执行的进程由于期待的某些事件未发生,如请求系统资源失败、等待某个操作完成、新数据尚未到达等原因会主动由运行状态变为阻塞状态,当进程进入阻塞状态,是不占用CPU资源的。这些知识对于理解到底选择哪种方式进行并发编程也是很重要的。
|
||||
|
||||
### I/O模式和事件驱动
|
||||
|
||||
对于一次I/O操作(以读操作为例),数据会先被拷贝到操作系统内核的缓冲区中,然后从操作系统内核的缓冲区拷贝到应用程序的缓冲区(这种方式称为标准I/O或缓存I/O,大多数文件系统的默认I/O都是这种方式),最后交给进程。所以说,当一个读操作发生时(写操作与之类似),它会经历两个阶段:(1)等待数据准备就绪;(2)将数据从内核拷贝到进程中。
|
||||
|
||||
由于存在这两个阶段,因此产生了以下几种I/O模式:
|
||||
|
||||
1. 阻塞 I/O(blocking I/O):进程发起读操作,如果内核数据尚未就绪,进程会阻塞等待数据直到内核数据就绪并拷贝到进程的内存中。
|
||||
2. 非阻塞 I/O(non-blocking I/O):进程发起读操作,如果内核数据尚未就绪,进程不阻塞而是收到内核返回的错误信息,进程收到错误信息可以再次发起读操作,一旦内核数据准备就绪,就立即将数据拷贝到了用户内存中,然后返回。
|
||||
3. 多路I/O复用( I/O multiplexing):监听多个I/O对象,当I/O对象有变化(数据就绪)的时候就通知用户进程。多路I/O复用的优势并不在于单个I/O操作能处理得更快,而是在于能处理更多的I/O操作。
|
||||
4. 异步 I/O(asynchronous I/O):进程发起读操作后就可以去做别的事情了,内核收到异步读操作后会立即返回,所以用户进程不阻塞,当内核数据准备就绪时,内核发送一个信号给用户进程,告诉它读操作完成了。
|
||||
|
||||
通常,我们编写一个处理用户请求的服务器程序时,有以下三种方式可供选择:
|
||||
|
||||
1. 每收到一个请求,创建一个新的进程,来处理该请求;
|
||||
2. 每收到一个请求,创建一个新的线程,来处理该请求;
|
||||
3. 每收到一个请求,放入一个事件列表,让主进程通过非阻塞I/O方式来处理请求
|
||||
|
||||
第1种方式实现比较简单,但由于创建进程开销比较大,会导致服务器性能比较差;第2种方式,由于要涉及到线程的同步,有可能会面临竞争、死锁等问题;第3种方式,就是所谓事件驱动的方式,它利用了多路I/O复用和异步I/O的优点,虽然代码逻辑比前面两种都复杂,但能达到最好的性能,这也是目前大多数网络服务器采用的方式。
|
||||
|
|
@ -0,0 +1,377 @@
|
|||
## Tornado入门
|
||||
|
||||
### Tornado概述
|
||||
|
||||
Python的Web框架种类繁多(比Python语言的关键字还要多),但在众多优秀的Web框架中,Tornado框架最适合用来开发需要处理长连接和应对高并发的Web应用。Tornado框架在设计之初就考虑到性能问题,通过对非阻塞I/O和epoll(Linux 2.5.44内核引入的一种多路I/O复用方式,旨在实现高性能网络服务,在BSD和macOS中是kqueue)的运用,Tornado可以处理大量的并发连接,更轻松的应对C10K(万级并发)问题,是非常理想的实时通信Web框架。
|
||||
|
||||
> 扩展:基于线程的Web服务器产品(如:Apache)会维护一个线程池来处理用户请求,当用户请求到达时就为该请求分配一个线程,如果线程池中没有空闲线程了,那么可以通过创建新的线程来应付新的请求,但前提是系统尚有空闲的内存空间,显然这种方式很容易将服务器的空闲内存耗尽(大多数Linux发行版本中,默认的线程栈大小为8M)。想象一下,如果我们要开发一个社交类应用,这类应用中,通常需要显示实时更新的消息、对象状态的变化和各种类型的通知,那也就意味着客户端需要保持请求连接来接收服务器的各种响应,在这种情况下,服务器上的工作线程很容易被耗尽,这也就意味着新的请求很有可能无法得到响应。
|
||||
|
||||
Tornado框架源于FriendFeed网站,在FriendFeed网站被Facebook收购之后得以开源,正式发布的日期是2009年9月10日。Tornado能让你能够快速开发高速的Web应用,如果你想编写一个可扩展的社交应用、实时分析引擎,或RESTful API,那么Tornado框架就是很好的选择。Tornado其实不仅仅是一个Web开发的框架,它还是一个高性能的事件驱动网络访问引擎,内置了高性能的HTTP服务器和客户端(支持同步和异步请求),同时还对WebSocket提供了完美的支持。
|
||||
|
||||
了解和学习Tornado最好的资料就是它的官方文档,在[tornadoweb.org](http://www.tornadoweb.org)上面有很多不错的例子,你也可以在Github上找到Tornado的源代码和历史版本。
|
||||
|
||||
### 5分钟上手Tornado
|
||||
|
||||
1. 创建并激活虚拟环境。
|
||||
|
||||
```Shell
|
||||
mkdir hello-tornado
|
||||
cd hello-tornado
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
2. 安装Tornado。
|
||||
|
||||
```Shell
|
||||
pip install tornado
|
||||
```
|
||||
|
||||
3. 编写Web应用。
|
||||
|
||||
```Python
|
||||
"""
|
||||
example01.py
|
||||
"""
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
|
||||
def get(self):
|
||||
self.write('<h1>Hello, world!</h1>')
|
||||
|
||||
|
||||
def main():
|
||||
app = tornado.web.Application(handlers=[(r'/', MainHandler), ])
|
||||
app.listen(8888)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
```
|
||||
|
||||
4. 运行并访问应用。
|
||||
|
||||
```Shell
|
||||
python example01.py
|
||||
```
|
||||
|
||||

|
||||
|
||||
在上面的例子中,代码example01.py通过定义一个继承自`RequestHandler`的类(`MainHandler`)来处理用户请求,当请求到达时,Tornado会实例化这个类(创建`MainHandler`对象),并调用与HTTP请求方法(GET、POST等)对应的方法,显然上面的`MainHandler`只能处理GET请求,在收到GET请求时,它会将一段HTML的内容写入到HTTP响应中。`main`函数的第1行代码创建了Tornado框架中`Application`类的实例,它代表了我们的Web应用,而创建该实例最为重要的参数就是`handlers`,该参数告知`Application`对象,当收到一个请求时应该通过哪个类的对象来处理这个请求。在上面的例子中,当通过HTTP的GET请求访问站点根路径时,就会调用`MainHandler`的`get`方法。 `main`函数的第2行代码通过`Application`对象的`listen`方法指定了监听HTTP请求的端口。`main`函数的第3行代码用于获取Tornado框架的`IOLoop`实例并启动它,该实例代表一个条件触发的I/O循环,用于持续的接收来自于客户端的请求。
|
||||
|
||||
> 扩展:在Python 3中,`IOLoop`实例的本质就是`asyncio`的事件循环,该事件循环在非Windows系统中就是`SelectorEventLoop`对象,它基于`selectors`模块(高级I/O复用模块),会使用当前操作系统最高效的I/O复用选择器,例如在Linux环境下它使用`EpollSelector`,而在macOS和BSD环境下它使用的是`KqueueSelector`;在Python 2中,`IOLoop`直接使用`select`模块(低级I/O复用模块)的`epoll`或`kqueue`函数,如果这两种方式都不可用,则调用`select`函数实现多路I/O复用。当然,如果要支持高并发,你的系统最好能够支持epoll或者kqueue这两种多路I/O复用方式中的一种。
|
||||
|
||||
如果希望通过命令行参数来指定Web应用的监听端口,可以对上面的代码稍作修改。
|
||||
|
||||
```Python
|
||||
"""
|
||||
example01.py
|
||||
"""
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
|
||||
from tornado.options import define, options, parse_command_line
|
||||
|
||||
|
||||
# 定义默认端口
|
||||
define('port', default=8000, type=int)
|
||||
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
|
||||
def get(self):
|
||||
self.write('<h1>Hello, world!</h1>')
|
||||
|
||||
|
||||
def main():
|
||||
# python example01.py --port=8000
|
||||
parse_command_line()
|
||||
app = tornado.web.Application(handlers=[(r'/', MainHandler), ])
|
||||
app.listen(options.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
```
|
||||
|
||||
在启动Web应用时,如果没有指定端口,将使用`define`函数中设置的默认端口8000,如果要指定端口,可以使用下面的方式来启动Web应用。
|
||||
|
||||
```Shell
|
||||
python example01.py --port=8000
|
||||
```
|
||||
|
||||
### 路由解析
|
||||
|
||||
上面我们曾经提到过创建`Application`实例时需要指定`handlers`参数,这个参数非常重要,它应该是一个元组的列表,元组中的第一个元素是正则表达式,它用于匹配用户请求的资源路径;第二个元素是`RequestHandler`的子类。在刚才的例子中,我们只在`handlers`列表中放置了一个元组,事实上我们可以放置多个元组来匹配不同的请求(资源路径),而且可以使用正则表达式的捕获组来获取匹配的内容并将其作为参数传入到`get`、`post`这些方法中。
|
||||
|
||||
```Python
|
||||
"""
|
||||
example02.py
|
||||
"""
|
||||
import os
|
||||
import random
|
||||
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
|
||||
from tornado.options import define, options, parse_command_line
|
||||
|
||||
|
||||
# 定义默认端口
|
||||
define('port', default=8000, type=int)
|
||||
|
||||
|
||||
class SayingHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self):
|
||||
sayings = [
|
||||
'世上没有绝望的处境,只有对处境绝望的人',
|
||||
'人生的道路在态度的岔口一分为二,从此通向成功或失败',
|
||||
'所谓措手不及,不是说没有时间准备,而是有时间的时候没有准备',
|
||||
'那些你认为不靠谱的人生里,充满你没有勇气做的事',
|
||||
'在自己喜欢的时间里,按照自己喜欢的方式,去做自己喜欢做的事,这便是自由',
|
||||
'有些人不属于自己,但是遇见了也弥足珍贵'
|
||||
]
|
||||
# 渲染index.html模板页
|
||||
self.render('index.html', message=random.choice(sayings))
|
||||
|
||||
|
||||
class WeatherHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self, city):
|
||||
# Tornado框架会自动处理百分号编码的问题
|
||||
weathers = {
|
||||
'北京': {'temperature': '-4~4', 'pollution': '195 中度污染'},
|
||||
'成都': {'temperature': '3~9', 'pollution': '53 良'},
|
||||
'深圳': {'temperature': '20~25', 'pollution': '25 优'},
|
||||
'广州': {'temperature': '18~23', 'pollution': '56 良'},
|
||||
'上海': {'temperature': '6~8', 'pollution': '65 良'}
|
||||
}
|
||||
if city in weathers:
|
||||
self.render('weather.html', city=city, weather=weathers[city])
|
||||
else:
|
||||
self.render('index.html', message=f'没有{city}的天气信息')
|
||||
|
||||
|
||||
class ErrorHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self):
|
||||
# 重定向到指定的路径
|
||||
self.redirect('/saying')
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
parse_command_line()
|
||||
app = tornado.web.Application(
|
||||
# handlers是按列表中的顺序依次进行匹配的
|
||||
handlers=[
|
||||
(r'/saying/?', SayingHandler),
|
||||
(r'/weather/([^/]{2,})/?', WeatherHandler),
|
||||
(r'/.+', ErrorHandler),
|
||||
],
|
||||
# 通过template_path参数设置模板页的路径
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates')
|
||||
)
|
||||
app.listen(options.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
```
|
||||
|
||||
模板页index.html。
|
||||
|
||||
```HTML
|
||||
<!-- index.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Tornado基础</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>{{message}}</h1>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
模板页weather.html。
|
||||
|
||||
```HTML
|
||||
<!-- weather.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Tornado基础</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>{{city}}</h1>
|
||||
<hr>
|
||||
<h2>温度:{{weather['temperature']}}摄氏度</h2>
|
||||
<h2>污染指数:{{weather['pollution']}}</h2>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
Tornado的模板语法与其他的Web框架中使用的模板语法并没有什么实质性的区别,而且目前的Web应用开发更倡导使用前端渲染的方式来减轻服务器的负担,所以这里我们并不对模板语法和后端渲染进行深入的讲解。
|
||||
|
||||
### 请求处理器
|
||||
|
||||
通过上面的代码可以看出,`RequestHandler`是处理用户请求的核心类,通过重写`get`、`post`、`put`、`delete`等方法可以处理不同类型的HTTP请求,除了这些方法之外,`RequestHandler`还实现了很多重要的方法,下面是部分方法的列表:
|
||||
|
||||
1. `get_argument` / `get_arguments` / `get_body_argument` / `get_body_arguments` / `get_query_arugment` / `get_query_arguments`:获取请求参数。
|
||||
2. `set_status` / `send_error` / `set_header` / `add_header` / `clear_header` / `clear`:操作状态码和响应头。
|
||||
3. `write` / `flush` / `finish` / `write_error`:和输出相关的方法。
|
||||
4. `render` / `render_string`:渲染模板。
|
||||
5. `redirect`:请求重定向。
|
||||
6. `get_cookie` / `set_cookie` / `get_secure_cookie` / `set_secure_cookie` / `create_signed_value` / `clear_cookie` / `clear_all_cookies`:操作Cookie。
|
||||
|
||||
我们用上面讲到的这些方法来完成下面的需求,访问页面时,如果Cookie中没有读取到用户信息则要求用户填写个人信息,如果从Cookie中读取到用户信息则直接显示用户信息。
|
||||
|
||||
```Python
|
||||
"""
|
||||
example03.py
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
|
||||
from tornado.options import define, options, parse_command_line
|
||||
|
||||
|
||||
# 定义默认端口
|
||||
define('port', default=8000, type=int)
|
||||
|
||||
users = {}
|
||||
|
||||
|
||||
class User(object):
|
||||
"""用户"""
|
||||
|
||||
def __init__(self, nickname, gender, birthday):
|
||||
self.nickname = nickname
|
||||
self.gender = gender
|
||||
self.birthday = birthday
|
||||
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self):
|
||||
# 从Cookie中读取用户昵称
|
||||
nickname = self.get_cookie('nickname')
|
||||
if nickname in users:
|
||||
self.render('userinfo.html', user=users[nickname])
|
||||
else:
|
||||
self.render('userform.html', hint='请填写个人信息')
|
||||
|
||||
|
||||
class UserHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def post(self):
|
||||
# 从表单参数中读取用户昵称、性别和生日信息
|
||||
nickname = self.get_body_argument('nickname').strip()
|
||||
gender = self.get_body_argument('gender')
|
||||
birthday = self.get_body_argument('birthday')
|
||||
# 检查用户昵称是否有效
|
||||
if not re.fullmatch(r'\w{6,20}', nickname):
|
||||
self.render('userform.html', hint='请输入有效的昵称')
|
||||
elif nickname in users:
|
||||
self.render('userform.html', hint='昵称已经被使用过')
|
||||
else:
|
||||
users[nickname] = User(nickname, gender, birthday)
|
||||
# 将用户昵称写入Cookie并设置有效期为7天
|
||||
self.set_cookie('nickname', nickname, expires_days=7)
|
||||
self.render('userinfo.html', user=users[nickname])
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
parse_command_line()
|
||||
app = tornado.web.Application(
|
||||
handlers=[
|
||||
(r'/', MainHandler), (r'/register', UserHandler)
|
||||
],
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates')
|
||||
)
|
||||
app.listen(options.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
```
|
||||
|
||||
模板页userform.html。
|
||||
|
||||
```HTML
|
||||
<!-- userform.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tornado基础</title>
|
||||
<style>
|
||||
.em { color: red; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>填写用户信息</h1>
|
||||
<hr>
|
||||
<p class="em">{{hint}}</p>
|
||||
<form action="/register" method="post">
|
||||
<p>
|
||||
<label>昵称:</label>
|
||||
<input type="text" name="nickname">
|
||||
(字母数字下划线,6-20个字符)
|
||||
</p>
|
||||
<p>
|
||||
<label>性别:</label>
|
||||
<input type="radio" name="gender" value="男" checked>男
|
||||
<input type="radio" name="gender" value="女">女
|
||||
</p>
|
||||
<p>
|
||||
<label>生日:</label>
|
||||
<input type="date" name="birthday" value="1990-01-01">
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="确定">
|
||||
</p>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
模板页userinfo.html。
|
||||
|
||||
```HTML
|
||||
<!-- userinfo.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tornado基础</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>用户信息</h1>
|
||||
<hr>
|
||||
<h2>昵称:{{user.nickname}}</h2>
|
||||
<h2>性别:{{user.gender}}</h2>
|
||||
<h2>出生日期:{{user.birthday}}</h2>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
## 异步化
|
||||
|
||||
在前面的例子中,我们并没有对`RequestHandler`中的`get`或`post`方法进行异步处理,这就意味着,一旦在`get`或`post`方法中出现了耗时间的操作,不仅仅是当前请求被阻塞,按照Tornado框架的工作模式,其他的请求也会被阻塞,所以我们需要对耗时间的操作进行异步化处理。
|
||||
|
||||
在Tornado稍早一些的版本中,可以用装饰器实现请求方法的异步化或协程化来解决这个问题。
|
||||
|
||||
- 给`RequestHandler`的请求处理函数添加`@tornado.web.asynchronous`装饰器,如下所示:
|
||||
|
||||
```Python
|
||||
class AsyncReqHandler(RequestHandler):
|
||||
|
||||
@tornado.web.asynchronous
|
||||
def get(self):
|
||||
http = httpclient.AsyncHTTPClient()
|
||||
http.fetch("http://example.com/", self._on_download)
|
||||
|
||||
def _on_download(self, response):
|
||||
do_something_with_response(response)
|
||||
self.render("template.html")
|
||||
```
|
||||
|
||||
- 给`RequestHandler`的请求处理函数添加`@tornado.gen.coroutine`装饰器,如下所示:
|
||||
|
||||
```Python
|
||||
class GenAsyncHandler(RequestHandler):
|
||||
|
||||
@tornado.gen.coroutine
|
||||
def get(self):
|
||||
http_client = AsyncHTTPClient()
|
||||
response = yield http_client.fetch("http://example.com")
|
||||
do_something_with_response(response)
|
||||
self.render("template.html")
|
||||
```
|
||||
|
||||
- 使用`@return_future`装饰器,如下所示:
|
||||
|
||||
```Python
|
||||
@return_future
|
||||
def future_func(arg1, arg2, callback):
|
||||
# Do stuff (possibly asynchronous)
|
||||
callback(result)
|
||||
|
||||
async def caller():
|
||||
await future_func(arg1, arg2)
|
||||
```
|
||||
|
||||
在Tornado 5.x版本中,这几个装饰器都被标记为**deprcated**(过时),我们可以通过Python 3.5中引入的`async`和`await`(在Python 3.7中已经成为正式的关键字)来达到同样的效果。当然,要实现异步化还得靠其他的支持异步操作的三方库来支持,如果请求处理函数中用到了不支持异步操作的三方库,就需要靠自己写包装类来支持异步化。
|
||||
|
||||
下面的代码演示了在读写数据库时如何实现请求处理的异步化。我们用到的数据库建表语句如下所示:
|
||||
|
||||
```SQL
|
||||
create database hrs default charset utf8;
|
||||
|
||||
use hrs;
|
||||
|
||||
/* 创建部门表 */
|
||||
create table tb_dept
|
||||
(
|
||||
dno int not null comment '部门编号',
|
||||
dname varchar(10) not null comment '部门名称',
|
||||
dloc varchar(20) not null comment '部门所在地',
|
||||
primary key (dno)
|
||||
);
|
||||
|
||||
insert into tb_dept values
|
||||
(10, '会计部', '北京'),
|
||||
(20, '研发部', '成都'),
|
||||
(30, '销售部', '重庆'),
|
||||
(40, '运维部', '深圳');
|
||||
```
|
||||
|
||||
我们通过下面的代码实现了查询和新增部门两个操作。
|
||||
|
||||
```Python
|
||||
import json
|
||||
|
||||
import aiomysql
|
||||
import tornado
|
||||
import tornado.web
|
||||
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.options import define, parse_command_line, options
|
||||
|
||||
define('port', default=8000, type=int)
|
||||
|
||||
|
||||
async def connect_mysql():
|
||||
return await aiomysql.connect(
|
||||
host='120.77.222.217',
|
||||
port=3306,
|
||||
db='hrs',
|
||||
user='root',
|
||||
password='123456',
|
||||
)
|
||||
|
||||
|
||||
class HomeHandler(tornado.web.RequestHandler):
|
||||
|
||||
async def get(self, no):
|
||||
async with self.settings['mysql'].cursor(aiomysql.DictCursor) as cursor:
|
||||
await cursor.execute("select * from tb_dept where dno=%s", (no, ))
|
||||
if cursor.rowcount == 0:
|
||||
self.finish(json.dumps({
|
||||
'code': 20001,
|
||||
'mesg': f'没有编号为{no}的部门'
|
||||
}))
|
||||
return
|
||||
row = await cursor.fetchone()
|
||||
self.finish(json.dumps(row))
|
||||
|
||||
async def post(self, *args, **kwargs):
|
||||
no = self.get_argument('no')
|
||||
name = self.get_argument('name')
|
||||
loc = self.get_argument('loc')
|
||||
conn = self.settings['mysql']
|
||||
try:
|
||||
async with conn.cursor() as cursor:
|
||||
await cursor.execute('insert into tb_dept values (%s, %s, %s)',
|
||||
(no, name, loc))
|
||||
await conn.commit()
|
||||
except aiomysql.MySQLError:
|
||||
self.finish(json.dumps({
|
||||
'code': 20002,
|
||||
'mesg': '添加部门失败请确认部门信息'
|
||||
}))
|
||||
else:
|
||||
self.set_status(201)
|
||||
self.finish()
|
||||
|
||||
|
||||
def make_app(config):
|
||||
return tornado.web.Application(
|
||||
handlers=[(r'/api/depts/(.*)', HomeHandler), ],
|
||||
**config
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
parse_command_line()
|
||||
app = make_app({
|
||||
'debug': True,
|
||||
'mysql': IOLoop.current().run_sync(connect_mysql)
|
||||
})
|
||||
app.listen(options.port)
|
||||
IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
```
|
||||
|
||||
上面的代码中,我们用到了`aiomysql`这个三方库,它基于`pymysql`封装,实现了对MySQL操作的异步化。操作Redis可以使用`aioredis`,访问MongoDB可以使用`motor`,这些都是支持异步操作的三方库。
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
## WebSocket的应用
|
||||
|
||||
Tornado的异步特性使其非常适合处理高并发的业务,同时也适合那些需要在客户端和服务器之间维持长连接的业务。传统的基于HTTP协议的Web应用,服务器和客户端(浏览器)的通信只能由客户端发起,这种单向请求注定了如果服务器有连续的状态变化,客户端(浏览器)是很难得知的。事实上,今天的很多Web应用都需要服务器主动向客户端(浏览器)发送数据,我们将这种通信方式称之为“推送”。过去很长一段时间,程序员都是用定时轮询(Polling)或长轮询(Long Polling)等方式来实现“推送”,但是这些都不是真正意义上的“推送”,而且浪费资源且效率低下。在HTML5时代,可以通过一种名为WebSocket的技术在服务器和客户端(浏览器)之间维持传输数据的长连接,这种方式可以实现真正的“推送”服务。
|
||||
|
||||
### WebSocket简介
|
||||
|
||||
WebSocket 协议在2008年诞生,2011年成为国际标准([RFC 6455](https://tools.ietf.org/html/rfc6455)),现在的浏览器都能够支持它,它可以实现浏览器和服务器之间的全双工通信。我们之前学习或了解过Python的Socket编程,通过Socket编程,可以基于TCP或UDP进行数据传输;而WebSocket与之类似,只不过它是基于HTTP来实现通信握手,使用TCP来进行数据传输。WebSocket的出现打破了HTTP请求和响应只能一对一通信的模式,也改变了服务器只能被动接受客户端请求的状况。目前有很多Web应用是需要服务器主动向客户端发送信息的,例如股票信息的网站可能需要向浏览器发送股票涨停通知,社交网站可能需要向用户发送好友上线提醒或聊天信息。
|
||||
|
||||

|
||||
|
||||
WebSocket的特点如下所示:
|
||||
|
||||
1. 建立在TCP协议之上,服务器端的实现比较容易。
|
||||
2. 与HTTP协议有着良好的兼容性,默认端口是80(WS)和443(WSS),通信握手阶段采用HTTP协议,能通过各种 HTTP 代理服务器(不容易被防火墙阻拦)。
|
||||
3. 数据格式比较轻量,性能开销小,通信高效。
|
||||
4. 可以发送文本,也可以发送二进制数据。
|
||||
5. 没有同源策略的限制,客户端(浏览器)可以与任意服务器通信。
|
||||
|
||||

|
||||
|
||||
### WebSocket服务器端编程
|
||||
|
||||
Tornado框架中有一个`tornado.websocket.WebSocketHandler`类专门用于处理来自WebSocket的请求,通过继承该类并重写`open`、`on_message`、`on_close` 等方法来处理WebSocket通信,下面我们对`WebSocketHandler`的核心方法做一个简单的介绍。
|
||||
|
||||
1. `open(*args, **kwargs)`方法:建立新的WebSocket连接后,Tornado框架会调用该方法,该方法的参数与`RequestHandler`的`get`方法的参数类似,这也就意味着在`open`方法中可以执行获取请求参数、读取Cookie信息这样的操作。
|
||||
|
||||
2. `on_message(message)`方法:建立WebSocket之后,当收到来自客户端的消息时,Tornado框架会调用该方法,这样就可以对收到的消息进行对应的处理,必须重写这个方法。
|
||||
|
||||
3. `on_close()`方法:当WebSocket被关闭时,Tornado框架会调用该方法,在该方法中可以通过`close_code`和`close_reason`了解关闭的原因。
|
||||
|
||||
4. `write_message(message, binary=False)`方法:将指定的消息通过WebSocket发送给客户端,可以传递utf-8字符序列或者字节序列,如果message是一个字典,将会执行JSON序列化。正常情况下,该方法会返回一个`Future`对象;如果WebSocket被关闭了,将引发`WebSocketClosedError`。
|
||||
|
||||
5. `set_nodelay(value)`方法:默认情况下,因为TCP的Nagle算法会导致短小的消息被延迟发送,在考虑到交互性的情况下就要通过将该方法的参数设置为`True`来避免延迟。
|
||||
|
||||
6. `close(code=None, reason=None)`方法:主动关闭WebSocket,可以指定状态码(详见[RFC 6455 7.4.1节](https://tools.ietf.org/html/rfc6455#section-7.4.1))和原因。
|
||||
|
||||
### WebSocket客户端编程
|
||||
|
||||
1. 创建WebSocket对象。
|
||||
|
||||
```JavaScript
|
||||
var webSocket = new WebSocket('ws://localhost:8000/ws');
|
||||
```
|
||||
|
||||
>说明:webSocket对象的readyState属性表示该对象当前状态,取值为CONNECTING-正在连接,OPEN-连接成功可以通信,CLOSING-正在关闭,CLOSED-已经关闭。
|
||||
|
||||
2. 编写回调函数。
|
||||
|
||||
```JavaScript
|
||||
webSocket.onopen = function(evt) { webSocket.send('...'); };
|
||||
webSocket.onmessage = function(evt) { console.log(evt.data); };
|
||||
webSocket.onclose = function(evt) {};
|
||||
webSocket.onerror = function(evt) {};
|
||||
```
|
||||
|
||||
> 说明:如果要绑定多个事件回调函数,可以用addEventListener方法。另外,通过事件对象的data属性获得的数据可能是字符串,也有可能是二进制数据,可以通过webSocket对象的binaryType属性(blob、arraybuffer)或者通过typeof、instanceof运算符检查类型进行判定。
|
||||
|
||||
### 项目:Web聊天室
|
||||
|
||||
```Python
|
||||
"""
|
||||
handlers.py - 用户登录和聊天的处理器
|
||||
"""
|
||||
import tornado.web
|
||||
import tornado.websocket
|
||||
|
||||
nicknames = set()
|
||||
connections = {}
|
||||
|
||||
|
||||
class LoginHandler(tornado.web.RequestHandler):
|
||||
|
||||
def get(self):
|
||||
self.render('login.html', hint='')
|
||||
|
||||
def post(self):
|
||||
nickname = self.get_argument('nickname')
|
||||
if nickname in nicknames:
|
||||
self.render('login.html', hint='昵称已被使用,请更换昵称')
|
||||
self.set_secure_cookie('nickname', nickname)
|
||||
self.render('chat.html')
|
||||
|
||||
|
||||
class ChatHandler(tornado.websocket.WebSocketHandler):
|
||||
|
||||
def open(self):
|
||||
nickname = self.get_secure_cookie('nickname').decode()
|
||||
nicknames.add(nickname)
|
||||
for conn in connections.values():
|
||||
conn.write_message(f'~~~{nickname}进入了聊天室~~~')
|
||||
connections[nickname] = self
|
||||
|
||||
def on_message(self, message):
|
||||
nickname = self.get_secure_cookie('nickname').decode()
|
||||
for conn in connections.values():
|
||||
if conn is not self:
|
||||
conn.write_message(f'{nickname}说:{message}')
|
||||
|
||||
def on_close(self):
|
||||
nickname = self.get_secure_cookie('nickname').decode()
|
||||
del connections[nickname]
|
||||
nicknames.remove(nickname)
|
||||
for conn in connections.values():
|
||||
conn.write_message(f'~~~{nickname}离开了聊天室~~~')
|
||||
|
||||
```
|
||||
|
||||
```Python
|
||||
"""
|
||||
run_chat_server.py - 聊天服务器
|
||||
"""
|
||||
import os
|
||||
|
||||
import tornado.web
|
||||
import tornado.ioloop
|
||||
|
||||
from handlers import LoginHandler, ChatHandler
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = tornado.web.Application(
|
||||
handlers=[(r'/login', LoginHandler), (r'/chat', ChatHandler)],
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates'),
|
||||
static_path=os.path.join(os.path.dirname(__file__), 'static'),
|
||||
cookie_secret='MWM2MzEyOWFlOWRiOWM2MGMzZThhYTk0ZDNlMDA0OTU=',
|
||||
)
|
||||
app.listen(8888)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
```
|
||||
|
||||
```HTML
|
||||
<!-- login.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Tornado聊天室</title>
|
||||
<style>
|
||||
.hint { color: red; font-size: 0.8em; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div id="container">
|
||||
<h1>进入聊天室</h1>
|
||||
<hr>
|
||||
<p class="hint">{{hint}}</p>
|
||||
<form method="post" action="/login">
|
||||
<label>昵称:</label>
|
||||
<input type="text" placeholder="请输入你的昵称" name="nickname">
|
||||
<button type="submit">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```HTML
|
||||
<!-- chat.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tornado聊天室</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>聊天室</h1>
|
||||
<hr>
|
||||
<div>
|
||||
<textarea id="contents" rows="20" cols="120" readonly></textarea>
|
||||
</div>
|
||||
<div class="send">
|
||||
<input type="text" id="content" size="50">
|
||||
<input type="button" id="send" value="发送">
|
||||
</div>
|
||||
<p>
|
||||
<a id="quit" href="javascript:void(0);">退出聊天室</a>
|
||||
</p>
|
||||
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
// 将内容追加到指定的文本区
|
||||
function appendContent($ta, message) {
|
||||
var contents = $ta.val();
|
||||
contents += '\n' + message;
|
||||
$ta.val(contents);
|
||||
$ta[0].scrollTop = $ta[0].scrollHeight;
|
||||
}
|
||||
// 通过WebSocket发送消息
|
||||
function sendMessage() {
|
||||
message = $('#content').val().trim();
|
||||
if (message.length > 0) {
|
||||
ws.send(message);
|
||||
appendContent($('#contents'), '我说:' + message);
|
||||
$('#content').val('');
|
||||
}
|
||||
}
|
||||
// 创建WebSocket对象
|
||||
var ws= new WebSocket('ws://localhost:8888/chat');
|
||||
// 连接建立后执行的回调函数
|
||||
ws.onopen = function(evt) {
|
||||
$('#contents').val('~~~欢迎您进入聊天室~~~');
|
||||
};
|
||||
// 收到消息后执行的回调函数
|
||||
ws.onmessage = function(evt) {
|
||||
appendContent($('#contents'), evt.data);
|
||||
};
|
||||
// 为发送按钮绑定点击事件回调函数
|
||||
$('#send').on('click', sendMessage);
|
||||
// 为文本框绑定按下回车事件回调函数
|
||||
$('#content').on('keypress', function(evt) {
|
||||
keycode = evt.keyCode || evt.which;
|
||||
if (keycode == 13) {
|
||||
sendMessage();
|
||||
}
|
||||
});
|
||||
// 为退出聊天室超链接绑定点击事件回调函数
|
||||
$('#quit').on('click', function(evt) {
|
||||
ws.close();
|
||||
location.href = '/login';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
## 项目实战
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
"""
|
||||
handlers.py - 用户登录和聊天的处理器
|
||||
"""
|
||||
import tornado.web
|
||||
import tornado.websocket
|
||||
|
||||
nicknames = set()
|
||||
connections = {}
|
||||
|
||||
|
||||
class LoginHandler(tornado.web.RequestHandler):
|
||||
|
||||
def get(self):
|
||||
self.render('login.html', hint='')
|
||||
|
||||
def post(self):
|
||||
nickname = self.get_argument('nickname')
|
||||
if nickname in nicknames:
|
||||
self.render('login.html', hint='昵称已被使用,请更换昵称')
|
||||
self.set_secure_cookie('nickname', nickname)
|
||||
self.render('chat.html')
|
||||
|
||||
|
||||
class ChatHandler(tornado.websocket.WebSocketHandler):
|
||||
|
||||
def open(self):
|
||||
nickname = self.get_secure_cookie('nickname').decode()
|
||||
nicknames.add(nickname)
|
||||
for conn in connections.values():
|
||||
conn.write_message(f'~~~{nickname}进入了聊天室~~~')
|
||||
connections[nickname] = self
|
||||
|
||||
def on_message(self, message):
|
||||
nickname = self.get_secure_cookie('nickname').decode()
|
||||
for conn in connections.values():
|
||||
if conn is not self:
|
||||
conn.write_message(f'{nickname}说:{message}')
|
||||
|
||||
def on_close(self):
|
||||
nickname = self.get_secure_cookie('nickname').decode()
|
||||
del connections[nickname]
|
||||
nicknames.remove(nickname)
|
||||
for conn in connections.values():
|
||||
conn.write_message(f'~~~{nickname}离开了聊天室~~~')
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
"""
|
||||
chat_server.py - 聊天服务器
|
||||
"""
|
||||
import os
|
||||
|
||||
import tornado.web
|
||||
import tornado.ioloop
|
||||
|
||||
from chat_handlers import LoginHandler, ChatHandler
|
||||
|
||||
|
||||
def main():
|
||||
app = tornado.web.Application(
|
||||
handlers=[(r'/login', LoginHandler), (r'/chat', ChatHandler)],
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates'),
|
||||
static_path=os.path.join(os.path.dirname(__file__), 'static'),
|
||||
cookie_secret='MWM2MzEyOWFlOWRiOWM2MGMzZThhYTk0ZDNlMDA0OTU=',
|
||||
)
|
||||
app.listen(8888)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
"""
|
||||
example01.py - 五分钟上手Tornado
|
||||
"""
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
|
||||
from tornado.options import define, options, parse_command_line
|
||||
|
||||
# 定义默认端口
|
||||
define('port', default=8000, type=int)
|
||||
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self):
|
||||
# 向客户端(浏览器)写入内容
|
||||
self.write('<h1>Hello, world!</h1>')
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
# 解析命令行参数,例如:
|
||||
# python example01.py --port 8888
|
||||
parse_command_line()
|
||||
# 创建了Tornado框架中Application类的实例并指定handlers参数
|
||||
# Application实例代表了我们的Web应用,handlers代表了路由解析
|
||||
app = tornado.web.Application(handlers=[(r'/', MainHandler), ])
|
||||
# 指定了监听HTTP请求的TCP端口(默认8000,也可以通过命令行参数指定)
|
||||
app.listen(options.port)
|
||||
# 获取Tornado框架的IOLoop实例并启动它(默认启动asyncio的事件循环)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
"""
|
||||
example02.py - 路由解析
|
||||
"""
|
||||
import os
|
||||
import random
|
||||
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
|
||||
from tornado.options import define, options, parse_command_line
|
||||
|
||||
|
||||
# 定义默认端口
|
||||
define('port', default=8000, type=int)
|
||||
|
||||
|
||||
class SayingHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self):
|
||||
sayings = [
|
||||
'世上没有绝望的处境,只有对处境绝望的人',
|
||||
'人生的道路在态度的岔口一分为二,从此通向成功或失败',
|
||||
'所谓措手不及,不是说没有时间准备,而是有时间的时候没有准备',
|
||||
'那些你认为不靠谱的人生里,充满你没有勇气做的事',
|
||||
'在自己喜欢的时间里,按照自己喜欢的方式,去做自己喜欢做的事,这便是自由',
|
||||
'有些人不属于自己,但是遇见了也弥足珍贵'
|
||||
]
|
||||
# 渲染index.html模板页
|
||||
self.render('index.html', message=random.choice(sayings))
|
||||
|
||||
|
||||
class WeatherHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self, city):
|
||||
# Tornado框架会自动处理百分号编码的问题
|
||||
weathers = {
|
||||
'北京': {'temperature': '-4~4', 'pollution': '195 中度污染'},
|
||||
'成都': {'temperature': '3~9', 'pollution': '53 良'},
|
||||
'深圳': {'temperature': '20~25', 'pollution': '25 优'},
|
||||
'广州': {'temperature': '18~23', 'pollution': '56 良'},
|
||||
'上海': {'temperature': '6~8', 'pollution': '65 良'}
|
||||
}
|
||||
if city in weathers:
|
||||
self.render('weather.html', city=city, weather=weathers[city])
|
||||
else:
|
||||
self.render('index.html', message=f'没有{city}的天气信息')
|
||||
|
||||
|
||||
class ErrorHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self):
|
||||
# 重定向到指定的路径
|
||||
self.redirect('/saying')
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
parse_command_line()
|
||||
app = tornado.web.Application(
|
||||
# handlers是按列表中的顺序依次进行匹配的
|
||||
handlers=[
|
||||
(r'/saying/?', SayingHandler),
|
||||
(r'/weather/([^/]{2,})/?', WeatherHandler),
|
||||
(r'/.+', ErrorHandler),
|
||||
],
|
||||
# 通过template_path参数设置模板页的路径
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates')
|
||||
)
|
||||
app.listen(options.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
"""
|
||||
example03.py - RequestHandler解析
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
|
||||
from tornado.options import define, options, parse_command_line
|
||||
|
||||
|
||||
# 定义默认端口
|
||||
define('port', default=8000, type=int)
|
||||
|
||||
users = {}
|
||||
|
||||
|
||||
class User(object):
|
||||
"""用户"""
|
||||
|
||||
def __init__(self, nickname, gender, birthday):
|
||||
self.nickname = nickname
|
||||
self.gender = gender
|
||||
self.birthday = birthday
|
||||
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self):
|
||||
# 从Cookie中读取用户昵称
|
||||
nickname = self.get_cookie('nickname')
|
||||
if nickname in users:
|
||||
self.render('userinfo.html', user=users[nickname])
|
||||
else:
|
||||
self.render('userform.html', hint='请填写个人信息')
|
||||
|
||||
|
||||
class UserHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def post(self):
|
||||
# 从表单参数中读取用户昵称、性别和生日信息
|
||||
nickname = self.get_body_argument('nickname').strip()
|
||||
gender = self.get_body_argument('gender')
|
||||
birthday = self.get_body_argument('birthday')
|
||||
# 检查用户昵称是否有效
|
||||
if not re.fullmatch(r'\w{6,20}', nickname):
|
||||
self.render('userform.html', hint='请输入有效的昵称')
|
||||
elif nickname in users:
|
||||
self.render('userform.html', hint='昵称已经被使用过')
|
||||
else:
|
||||
users[nickname] = User(nickname, gender, birthday)
|
||||
# 将用户昵称写入Cookie并设置有效期为7天
|
||||
self.set_cookie('nickname', nickname, expires_days=7)
|
||||
self.render('userinfo.html', user=users[nickname])
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
parse_command_line()
|
||||
app = tornado.web.Application(
|
||||
handlers=[
|
||||
(r'/', MainHandler),
|
||||
(r'/register', UserHandler),
|
||||
],
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates'),
|
||||
)
|
||||
app.listen(options.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
"""
|
||||
example04.py - 同步请求的例子
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
|
||||
import requests
|
||||
import tornado.gen
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
import tornado.websocket
|
||||
import tornado.httpclient
|
||||
from tornado.options import define, options, parse_command_line
|
||||
|
||||
define('port', default=8888, type=int)
|
||||
|
||||
REQ_URL = 'http://api.tianapi.com/guonei/'
|
||||
API_KEY = '772a81a51ae5c780251b1f98ea431b84'
|
||||
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
def get(self):
|
||||
resp = requests.get(f'{REQ_URL}?key={API_KEY}')
|
||||
newslist = json.loads(resp.text)['newslist']
|
||||
self.render('news.html', newslist=newslist)
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
parse_command_line()
|
||||
app = tornado.web.Application(
|
||||
handlers=[(r'/', MainHandler), ],
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates'),
|
||||
)
|
||||
app.listen(options.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
"""
|
||||
example05.py - 异步请求的例子
|
||||
"""
|
||||
import aiohttp
|
||||
import json
|
||||
import os
|
||||
|
||||
import tornado.gen
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
import tornado.websocket
|
||||
import tornado.httpclient
|
||||
from tornado.options import define, options, parse_command_line
|
||||
|
||||
define('port', default=8888, type=int)
|
||||
|
||||
REQ_URL = 'http://api.tianapi.com/guonei/'
|
||||
API_KEY = '772a81a51ae5c780251b1f98ea431b84'
|
||||
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
"""自定义请求处理器"""
|
||||
|
||||
async def get(self):
|
||||
async with aiohttp.ClientSession() as session:
|
||||
resp = await session.get(f'{REQ_URL}?key={API_KEY}')
|
||||
json_str = await resp.text()
|
||||
print(json_str)
|
||||
newslist = json.loads(json_str)['newslist']
|
||||
self.render('news.html', newslist=newslist)
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
parse_command_line()
|
||||
app = tornado.web.Application(
|
||||
handlers=[(r'/', MainHandler), ],
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates'),
|
||||
)
|
||||
app.listen(options.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
"""
|
||||
example06.py - 异步操作MySQL
|
||||
"""
|
||||
import json
|
||||
|
||||
import aiomysql
|
||||
import tornado
|
||||
import tornado.web
|
||||
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.options import define, parse_command_line, options
|
||||
|
||||
define('port', default=8888, type=int)
|
||||
|
||||
|
||||
async def connect_mysql():
|
||||
return await aiomysql.connect(
|
||||
host='120.77.222.217',
|
||||
port=3306,
|
||||
db='hrs',
|
||||
charset='utf8',
|
||||
use_unicode=True,
|
||||
user='root',
|
||||
password='123456',
|
||||
)
|
||||
|
||||
|
||||
class HomeHandler(tornado.web.RequestHandler):
|
||||
|
||||
async def get(self, no):
|
||||
async with self.settings['mysql'].cursor(aiomysql.DictCursor) as cursor:
|
||||
await cursor.execute("select * from tb_dept where dno=%s", (no, ))
|
||||
if cursor.rowcount == 0:
|
||||
self.finish(json.dumps({
|
||||
'code': 20001,
|
||||
'mesg': f'没有编号为{no}的部门'
|
||||
}))
|
||||
return
|
||||
row = await cursor.fetchone()
|
||||
self.finish(json.dumps(row))
|
||||
|
||||
async def post(self, *args, **kwargs):
|
||||
no = self.get_argument('no')
|
||||
name = self.get_argument('name')
|
||||
loc = self.get_argument('loc')
|
||||
conn = self.settings['mysql']
|
||||
try:
|
||||
async with conn.cursor() as cursor:
|
||||
await cursor.execute('insert into tb_dept values (%s, %s, %s)',
|
||||
(no, name, loc))
|
||||
await conn.commit()
|
||||
except aiomysql.MySQLError:
|
||||
self.finish(json.dumps({
|
||||
'code': 20002,
|
||||
'mesg': '添加部门失败请确认部门信息'
|
||||
}))
|
||||
else:
|
||||
self.set_status(201)
|
||||
self.finish()
|
||||
|
||||
|
||||
def make_app(config):
|
||||
return tornado.web.Application(
|
||||
handlers=[(r'/api/depts/(.*)', HomeHandler), ],
|
||||
**config
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
parse_command_line()
|
||||
app = make_app({
|
||||
'debug': True,
|
||||
'mysql': IOLoop.current().run_sync(connect_mysql)
|
||||
})
|
||||
app.listen(options.port)
|
||||
IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
"""
|
||||
example07.py - 将非异步的三方库封装为异步调用
|
||||
"""
|
||||
import asyncio
|
||||
import concurrent
|
||||
import json
|
||||
|
||||
import tornado
|
||||
import tornado.web
|
||||
import pymysql
|
||||
|
||||
from pymysql import connect
|
||||
from pymysql.cursors import DictCursor
|
||||
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.options import define, parse_command_line, options
|
||||
from tornado.platform.asyncio import AnyThreadEventLoopPolicy
|
||||
|
||||
define('port', default=8888, type=int)
|
||||
|
||||
|
||||
def get_mysql_connection():
|
||||
return connect(
|
||||
host='120.77.222.217',
|
||||
port=3306,
|
||||
db='hrs',
|
||||
charset='utf8',
|
||||
use_unicode=True,
|
||||
user='root',
|
||||
password='123456',
|
||||
)
|
||||
|
||||
|
||||
class HomeHandler(tornado.web.RequestHandler):
|
||||
executor = concurrent.futures.ThreadPoolExecutor(max_workers=10)
|
||||
|
||||
async def get(self, no):
|
||||
return await self._get(no)
|
||||
|
||||
@tornado.concurrent.run_on_executor
|
||||
def _get(self, no):
|
||||
con = get_mysql_connection()
|
||||
try:
|
||||
with con.cursor(DictCursor) as cursor:
|
||||
cursor.execute("select * from tb_dept where dno=%s", (no, ))
|
||||
if cursor.rowcount == 0:
|
||||
self.finish(json.dumps({
|
||||
'code': 20001,
|
||||
'mesg': f'没有编号为{no}的部门'
|
||||
}))
|
||||
return
|
||||
row = cursor.fetchone()
|
||||
self.finish(json.dumps(row))
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
async def post(self, *args, **kwargs):
|
||||
return await self._post(*args, **kwargs)
|
||||
|
||||
@tornado.concurrent.run_on_executor
|
||||
def _post(self, *args, **kwargs):
|
||||
no = self.get_argument('no')
|
||||
name = self.get_argument('name')
|
||||
loc = self.get_argument('loc')
|
||||
conn = get_mysql_connection()
|
||||
try:
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute('insert into tb_dept values (%s, %s, %s)',
|
||||
(no, name, loc))
|
||||
conn.commit()
|
||||
except pymysql.MySQLError:
|
||||
self.finish(json.dumps({
|
||||
'code': 20002,
|
||||
'mesg': '添加部门失败请确认部门信息'
|
||||
}))
|
||||
else:
|
||||
self.set_status(201)
|
||||
self.finish()
|
||||
|
||||
|
||||
def main():
|
||||
asyncio.set_event_loop_policy(AnyThreadEventLoopPolicy())
|
||||
parse_command_line()
|
||||
app = tornado.web.Application(
|
||||
handlers=[(r'/api/depts/(.*)', HomeHandler), ]
|
||||
)
|
||||
app.listen(options.port)
|
||||
IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
import asyncio
|
||||
import re
|
||||
|
||||
import aiohttp
|
||||
|
||||
PATTERN = re.compile(r'\<title\>(?P<title>.*)\<\/title\>')
|
||||
|
||||
|
||||
async def show_title(url):
|
||||
async with aiohttp.ClientSession() as session:
|
||||
resp = await session.get(url, ssl=False)
|
||||
html = await resp.text()
|
||||
print(PATTERN.search(html).group('title'))
|
||||
|
||||
|
||||
def main():
|
||||
urls = ('https://www.python.org/',
|
||||
'https://git-scm.com/',
|
||||
'https://www.jd.com/',
|
||||
'https://www.taobao.com/',
|
||||
'https://www.douban.com/')
|
||||
# asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||
# 获取事件循环()
|
||||
loop = asyncio.get_event_loop()
|
||||
tasks = [show_title(url) for url in urls]
|
||||
loop.run_until_complete(asyncio.wait(tasks))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
import asyncio
|
||||
|
||||
|
||||
async def fetch(host):
|
||||
"""从指定的站点抓取信息(协程函数)"""
|
||||
print(f'Start fetching {host}\n')
|
||||
# 跟服务器建立连接
|
||||
reader, writer = await asyncio.open_connection(host, 80)
|
||||
# 构造请求行和请求头
|
||||
writer.write(b'GET / HTTP/1.1\r\n')
|
||||
writer.write(f'Host: {host}\r\n'.encode())
|
||||
writer.write(b'\r\n')
|
||||
# 清空缓存区(发送请求)
|
||||
await writer.drain()
|
||||
# 接收服务器的响应(读取响应行和响应头)
|
||||
line = await reader.readline()
|
||||
while line != b'\r\n':
|
||||
print(line.decode().rstrip())
|
||||
line = await reader.readline()
|
||||
print('\n')
|
||||
writer.close()
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
urls = ('www.sohu.com', 'www.douban.com', 'www.163.com')
|
||||
# 获取系统默认的事件循环
|
||||
loop = asyncio.get_event_loop()
|
||||
# 用生成式语法构造一个包含多个协程对象的列表
|
||||
tasks = [fetch(url) for url in urls]
|
||||
# 通过asyncio模块的wait函数将协程列表包装成Task(Future子类)并等待其执行完成
|
||||
# 通过事件循环的run_until_complete方法运行任务直到Future完成并返回它的结果
|
||||
futures = asyncio.wait(tasks)
|
||||
print(futures, type(futures))
|
||||
loop.run_until_complete(futures)
|
||||
loop.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
"""
|
||||
协程(coroutine)- 可以在需要时进行切换的相互协作的子程序
|
||||
"""
|
||||
import asyncio
|
||||
|
||||
from example_of_multiprocess import is_prime
|
||||
|
||||
|
||||
def num_generator(m, n):
|
||||
"""指定范围的数字生成器"""
|
||||
for num in range(m, n + 1):
|
||||
print(f'generate number: {num}')
|
||||
yield num
|
||||
|
||||
|
||||
async def prime_filter(m, n):
|
||||
"""素数过滤器"""
|
||||
primes = []
|
||||
for i in num_generator(m, n):
|
||||
if is_prime(i):
|
||||
print('Prime =>', i)
|
||||
primes.append(i)
|
||||
|
||||
await asyncio.sleep(0.001)
|
||||
return tuple(primes)
|
||||
|
||||
|
||||
async def square_mapper(m, n):
|
||||
"""平方映射器"""
|
||||
squares = []
|
||||
for i in num_generator(m, n):
|
||||
print('Square =>', i * i)
|
||||
squares.append(i * i)
|
||||
|
||||
await asyncio.sleep(0.001)
|
||||
return squares
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
loop = asyncio.get_event_loop()
|
||||
start, end = 1, 100
|
||||
futures = asyncio.gather(prime_filter(start, end), square_mapper(start, end))
|
||||
futures.add_done_callback(lambda x: print(x.result()))
|
||||
loop.run_until_complete(futures)
|
||||
loop.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
"""
|
||||
用下面的命令运行程序并查看执行时间,例如:
|
||||
time python3 example05.py
|
||||
real 0m20.657s
|
||||
user 1m17.749s
|
||||
sys 0m0.158s
|
||||
使用多进程后实际执行时间为20.657秒,而用户时间1分17.749秒约为实际执行时间的4倍
|
||||
这就证明我们的程序通过多进程使用了CPU的多核特性,而且这台计算机配置了4核的CPU
|
||||
"""
|
||||
import concurrent.futures
|
||||
import math
|
||||
|
||||
PRIMES = [
|
||||
1116281,
|
||||
1297337,
|
||||
104395303,
|
||||
472882027,
|
||||
533000389,
|
||||
817504243,
|
||||
982451653,
|
||||
112272535095293,
|
||||
112582705942171,
|
||||
112272535095293,
|
||||
115280095190773,
|
||||
115797848077099,
|
||||
1099726899285419
|
||||
] * 5
|
||||
|
||||
|
||||
def is_prime(num):
|
||||
"""判断素数"""
|
||||
assert num > 0
|
||||
if num % 2 == 0:
|
||||
return False
|
||||
for i in range(3, int(math.sqrt(num)) + 1, 2):
|
||||
if num % i == 0:
|
||||
return False
|
||||
return num != 1
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
with concurrent.futures.ProcessPoolExecutor() as executor:
|
||||
for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
|
||||
print('%d is prime: %s' % (number, prime))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
aiohttp==3.5.4
|
||||
aiomysql==0.0.20
|
||||
asn1crypto==0.24.0
|
||||
async-timeout==3.0.1
|
||||
attrs==19.1.0
|
||||
certifi==2019.3.9
|
||||
cffi==1.12.2
|
||||
chardet==3.0.4
|
||||
cryptography==2.6.1
|
||||
idna==2.8
|
||||
multidict==4.5.2
|
||||
pycparser==2.19
|
||||
PyMySQL==0.9.2
|
||||
requests==2.21.0
|
||||
six==1.12.0
|
||||
tornado==5.1.1
|
||||
urllib3==1.24.1
|
||||
yarl==1.3.0
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<!-- chat.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tornado聊天室</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>聊天室</h1>
|
||||
<hr>
|
||||
<div>
|
||||
<textarea id="contents" rows="20" cols="120" readonly></textarea>
|
||||
</div>
|
||||
<div class="send">
|
||||
<input type="text" id="content" size="50">
|
||||
<input type="button" id="send" value="发送">
|
||||
</div>
|
||||
<p>
|
||||
<a id="quit" href="javascript:void(0);">退出聊天室</a>
|
||||
</p>
|
||||
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
// 将内容追加到指定的文本区
|
||||
function appendContent($ta, message) {
|
||||
var contents = $ta.val();
|
||||
contents += '\n' + message;
|
||||
$ta.val(contents);
|
||||
$ta[0].scrollTop = $ta[0].scrollHeight;
|
||||
}
|
||||
// 通过WebSocket发送消息
|
||||
function sendMessage() {
|
||||
message = $('#content').val().trim();
|
||||
if (message.length > 0) {
|
||||
ws.send(message);
|
||||
appendContent($('#contents'), '我说:' + message);
|
||||
$('#content').val('');
|
||||
}
|
||||
}
|
||||
// 创建WebSocket对象
|
||||
var ws= new WebSocket('ws://localhost:8888/chat');
|
||||
// 连接建立后执行的回调函数
|
||||
ws.onopen = function(evt) {
|
||||
$('#contents').val('~~~欢迎您进入聊天室~~~');
|
||||
};
|
||||
// 收到消息后执行的回调函数
|
||||
ws.onmessage = function(evt) {
|
||||
appendContent($('#contents'), evt.data);
|
||||
};
|
||||
// 为发送按钮绑定点击事件回调函数
|
||||
$('#send').on('click', sendMessage);
|
||||
// 为文本框绑定按下回车事件回调函数
|
||||
$('#content').on('keypress', function(evt) {
|
||||
keycode = evt.keyCode || evt.which;
|
||||
if (keycode == 13) {
|
||||
sendMessage();
|
||||
}
|
||||
});
|
||||
// 为退出聊天室超链接绑定点击事件回调函数
|
||||
$('#quit').on('click', function(evt) {
|
||||
ws.close();
|
||||
location.href = '/login';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!-- login.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Tornado聊天室</title>
|
||||
<style>
|
||||
.hint { color: red; font-size: 0.8em; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div id="container">
|
||||
<h1>进入聊天室</h1>
|
||||
<hr>
|
||||
<p class="hint">{{hint}}</p>
|
||||
<form method="post" action="/login">
|
||||
<label>昵称:</label>
|
||||
<input type="text" placeholder="请输入你的昵称" name="nickname">
|
||||
<button type="submit">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>新闻列表</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>新闻列表</h1>
|
||||
<hr>
|
||||
{% for news in newslist %}
|
||||
<div>
|
||||
<img src="{{news['picUrl']}}" alt="">
|
||||
<p>{{news['title']}}</p>
|
||||
</div>
|
||||
{% end %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
/**
|
||||
* admin.css
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
fixed-layout 固定头部和边栏布局
|
||||
*/
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.admin-icon-yellow {
|
||||
color: #ffbe40;
|
||||
}
|
||||
|
||||
.admin-header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1500;
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-header-list a:hover :after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
.admin-main {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
padding-top: 51px;
|
||||
background: #f3f3f3;
|
||||
}
|
||||
|
||||
.admin-menu {
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
bottom: 30px;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.admin-sidebar {
|
||||
width: 260px;
|
||||
min-height: 100%;
|
||||
float: left;
|
||||
border-right: 1px solid #cecece;
|
||||
}
|
||||
|
||||
.admin-sidebar.am-active {
|
||||
z-index: 1600;
|
||||
}
|
||||
|
||||
.admin-sidebar-list {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-sidebar-list li a {
|
||||
color: #5c5c5c;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.admin-sidebar-list li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.admin-sidebar-sub {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
box-shadow: 0 16px 8px -15px #e2e2e2 inset;
|
||||
background: #ececec;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.admin-sidebar-sub li:first-child {
|
||||
border-top: 1px solid #dedede;
|
||||
}
|
||||
|
||||
.admin-sidebar-panel {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.admin-content {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-webkit-flex-direction: column;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.admin-content,
|
||||
.admin-sidebar {
|
||||
height: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.admin-content-body {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 0 auto;
|
||||
-ms-flex: 1 0 auto;
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
|
||||
.admin-content-footer {
|
||||
font-size: 85%;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.admin-content-list {
|
||||
border: 1px solid #e9ecf1;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.admin-content-list li {
|
||||
border: 1px solid #e9ecf1;
|
||||
border-width: 0 1px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
.admin-content-list li:first-child {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.admin-content-list li:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.admin-content-table a {
|
||||
color: #535353;
|
||||
}
|
||||
.admin-content-file {
|
||||
margin-bottom: 0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.admin-content-file p {
|
||||
margin: 0 0 5px 0;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.admin-content-file li {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.admin-content-file li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.admin-content-file li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.admin-content-file li .am-progress {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.admin-content-file li .am-progress-bar {
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
.admin-content-task {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-content-task li {
|
||||
padding: 5px 0;
|
||||
border-color: #eee;
|
||||
}
|
||||
|
||||
.admin-content-task li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.admin-content-task li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.admin-task-meta {
|
||||
font-size: 1.2rem;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.admin-task-bd {
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.admin-content-comment {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-content-comment .am-comment-bd {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.admin-content-pagination {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.admin-content-pagination li a {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 641px) {
|
||||
.admin-sidebar {
|
||||
display: block;
|
||||
position: static;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.admin-offcanvas-bar {
|
||||
position: static;
|
||||
width: auto;
|
||||
background: none;
|
||||
-webkit-transform: translate3d(0, 0, 0);
|
||||
-ms-transform: translate3d(0, 0, 0);
|
||||
transform: translate3d(0, 0, 0);
|
||||
overflow-y: visible;
|
||||
min-height: 100%;
|
||||
}
|
||||
.admin-offcanvas-bar:after {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.admin-sidebar {
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.admin-offcanvas-bar {
|
||||
background: #f3f3f3;
|
||||
}
|
||||
|
||||
.admin-offcanvas-bar:after {
|
||||
background: #BABABA;
|
||||
}
|
||||
|
||||
.admin-sidebar-list a:hover, .admin-sidebar-list a:active{
|
||||
-webkit-transition: background-color .3s ease;
|
||||
-moz-transition: background-color .3s ease;
|
||||
-ms-transition: background-color .3s ease;
|
||||
-o-transition: background-color .3s ease;
|
||||
transition: background-color .3s ease;
|
||||
background: #E4E4E4;
|
||||
}
|
||||
|
||||
.admin-content-list li {
|
||||
padding: 10px;
|
||||
border-width: 1px 0;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.admin-content-list li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.admin-content-list li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.admin-form-text {
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* user.html css
|
||||
*/
|
||||
.user-info {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.user-info .am-progress {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.user-info p {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.user-info-order {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
/*
|
||||
* errorLog.html css
|
||||
*/
|
||||
|
||||
.error-log .am-pre-scrollable {
|
||||
max-height: 40rem;
|
||||
}
|
||||
|
||||
/*
|
||||
* table.html css
|
||||
*/
|
||||
|
||||
.table-main {
|
||||
font-size: 1.4rem;
|
||||
padding: .5rem;
|
||||
}
|
||||
|
||||
.table-main button {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.table-check {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.table-id {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.table-select {
|
||||
margin-top: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
gallery.html css
|
||||
*/
|
||||
|
||||
.gallery-list li {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.gallery-list a {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.gallery-list a:hover {
|
||||
color: #3bb4f2;
|
||||
}
|
||||
|
||||
.gallery-title {
|
||||
margin-top: 6px;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.gallery-desc {
|
||||
font-size: 1.2rem;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/*
|
||||
404.html css
|
||||
*/
|
||||
|
||||
.page-404 {
|
||||
background: #fff;
|
||||
border: none;
|
||||
width: 200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
/*!
|
||||
* FullCalendar v0.0.0 Print Stylesheet
|
||||
* Docs & License: http://fullcalendar.io/
|
||||
* (c) 2016 Adam Shaw
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include this stylesheet on your page to get a more printer-friendly calendar.
|
||||
* When including this stylesheet, use the media='print' attribute of the <link> tag.
|
||||
* Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
|
||||
*/
|
||||
|
||||
.fc {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
|
||||
/* Global Event Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-event {
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
.fc-event .fc-resizer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Table & Day-Row Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc th,
|
||||
.fc td,
|
||||
.fc hr,
|
||||
.fc thead,
|
||||
.fc tbody,
|
||||
.fc-row {
|
||||
border-color: #ccc !important;
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
/* kill the overlaid, absolutely-positioned components */
|
||||
/* common... */
|
||||
.fc-bg,
|
||||
.fc-bgevent-skeleton,
|
||||
.fc-highlight-skeleton,
|
||||
.fc-helper-skeleton,
|
||||
/* for timegrid. within cells within table skeletons... */
|
||||
.fc-bgevent-container,
|
||||
.fc-business-container,
|
||||
.fc-highlight-container,
|
||||
.fc-helper-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* don't force a min-height on rows (for DayGrid) */
|
||||
.fc tbody .fc-row {
|
||||
height: auto !important; /* undo height that JS set in distributeHeight */
|
||||
min-height: 0 !important; /* undo the min-height from each view's specific stylesheet */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton {
|
||||
position: static; /* undo .fc-rigid */
|
||||
padding-bottom: 0 !important; /* use a more border-friendly method for this... */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td { /* only works in newer browsers */
|
||||
padding-bottom: 1em; /* ...gives space within the skeleton. also ensures min height in a way */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton table {
|
||||
/* provides a min-height for the row, but only effective for IE, which exaggerates this value,
|
||||
making it look more like 3em. for other browers, it will already be this tall */
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
|
||||
/* Undo month-view event limiting. Display all events and hide the "more" links
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-more-cell,
|
||||
.fc-more {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.fc tr.fc-limited {
|
||||
display: table-row !important;
|
||||
}
|
||||
|
||||
.fc td.fc-limited {
|
||||
display: table-cell !important;
|
||||
}
|
||||
|
||||
.fc-popover {
|
||||
display: none; /* never display the "more.." popover in print mode */
|
||||
}
|
||||
|
||||
|
||||
/* TimeGrid Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* undo the min-height 100% trick used to fill the container's height */
|
||||
.fc-time-grid {
|
||||
min-height: 0 !important;
|
||||
}
|
||||
|
||||
/* don't display the side axis at all ("all-day" and time cells) */
|
||||
.fc-agenda-view .fc-axis {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* don't display the horizontal lines */
|
||||
.fc-slats,
|
||||
.fc-time-grid hr { /* this hr is used when height is underused and needs to be filled */
|
||||
display: none !important; /* important overrides inline declaration */
|
||||
}
|
||||
|
||||
/* let the container that holds the events be naturally positioned and create real height */
|
||||
.fc-time-grid .fc-content-skeleton {
|
||||
position: static;
|
||||
}
|
||||
|
||||
/* in case there are no events, we still want some height */
|
||||
.fc-time-grid .fc-content-skeleton table {
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
/* kill the horizontal spacing made by the event container. event margins will be done below */
|
||||
.fc-time-grid .fc-event-container {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
/* TimeGrid *Event* Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* naturally position events, vertically stacking them */
|
||||
.fc-time-grid .fc-event {
|
||||
position: static !important;
|
||||
margin: 3px 2px !important;
|
||||
}
|
||||
|
||||
/* for events that continue to a future day, give the bottom border back */
|
||||
.fc-time-grid .fc-event.fc-not-end {
|
||||
border-bottom-width: 1px !important;
|
||||
}
|
||||
|
||||
/* indicate the event continues via "..." text */
|
||||
.fc-time-grid .fc-event.fc-not-end:after {
|
||||
content: "...";
|
||||
}
|
||||
|
||||
/* for events that are continuations from previous days, give the top border back */
|
||||
.fc-time-grid .fc-event.fc-not-start {
|
||||
border-top-width: 1px !important;
|
||||
}
|
||||
|
||||
/* indicate the event is a continuation via "..." text */
|
||||
.fc-time-grid .fc-event.fc-not-start:before {
|
||||
content: "...";
|
||||
}
|
||||
|
||||
/* time */
|
||||
|
||||
/* undo a previous declaration and let the time text span to a second line */
|
||||
.fc-time-grid .fc-event .fc-time {
|
||||
white-space: normal !important;
|
||||
}
|
||||
|
||||
/* hide the the time that is normally displayed... */
|
||||
.fc-time-grid .fc-event .fc-time span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ...replace it with a more verbose version (includes AM/PM) stored in an html attribute */
|
||||
.fc-time-grid .fc-event .fc-time:after {
|
||||
content: attr(data-full);
|
||||
}
|
||||
|
||||
|
||||
/* Vertical Scroller & Containers
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* kill the scrollbars and allow natural height */
|
||||
.fc-scroller,
|
||||
.fc-day-grid-container, /* these divs might be assigned height, which we need to cleared */
|
||||
.fc-time-grid-container { /* */
|
||||
overflow: visible !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* kill the horizontal border/padding used to compensate for scrollbars */
|
||||
.fc-row {
|
||||
border: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
/* Button Controls
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-button-group,
|
||||
.fc button {
|
||||
display: none; /* don't display any button-related controls */
|
||||
}
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp"/>
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI"/>
|
||||
<script src="../js/echarts.min.js"></script>
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css"/>
|
||||
<link rel="stylesheet" href="../css/amazeui.datatables.min.css"/>
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body data-type="widgets">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 头部 -->
|
||||
<header>
|
||||
<!-- logo -->
|
||||
<div class="am-fl tpl-header-logo">
|
||||
<a href="javascript:;"><img src="../img/logo.png" alt=""></a>
|
||||
</div>
|
||||
<!-- 右侧内容 -->
|
||||
<div class="tpl-header-fluid">
|
||||
<!-- 侧边切换 -->
|
||||
<div class="am-fl tpl-header-switch-button am-icon-list">
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
<div class="am-fl tpl-header-search">
|
||||
<form class="tpl-header-search-form" action="javascript:;">
|
||||
<button class="tpl-header-search-btn am-icon-search"></button>
|
||||
<input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
|
||||
</form>
|
||||
</div>
|
||||
<!-- 其它功能-->
|
||||
<div class="am-fr tpl-header-navbar">
|
||||
<ul>
|
||||
<!-- 欢迎语 -->
|
||||
<li class="am-text-sm tpl-header-navbar-welcome">
|
||||
<a href="javascript:;">欢迎你, <span>Amaze UI</span> </a>
|
||||
</li>
|
||||
|
||||
<!-- 新邮件 -->
|
||||
<li class="am-dropdown tpl-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-envelope"></i>
|
||||
<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
3小时前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-success"></i>
|
||||
<span>夕风色</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> Amaze UI 的诞生,依托于 GitHub 及其他技术社区上一些优秀的资源;Amaze UI
|
||||
的成长,则离不开用户的支持。
|
||||
</div>
|
||||
<div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user02.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
5天前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-warning"></i>
|
||||
<span>禁言小张</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> 为了能最准确的传达所描述的问题, 建议你在反馈时附上演示,方便我们理解。</div>
|
||||
<div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<i class="am-icon-circle-o"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 新提示 -->
|
||||
<li class="am-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-bell"></i>
|
||||
<span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-line-chart"></i>
|
||||
<span> 有6笔新的销售订单</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
12分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-star"></i>
|
||||
<span> 有3个来自人事部的消息</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
30分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-folder-o"></i>
|
||||
<span> 上午开会记录存档</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
1天前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<i class="am-icon-bell"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 退出 -->
|
||||
<li class="am-text-sm">
|
||||
<a href="javascript:;">
|
||||
<span class="am-icon-sign-out"></span> 退出
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边导航栏 -->
|
||||
<div class="left-sidebar">
|
||||
<!-- 用户信息 -->
|
||||
<div class="tpl-sidebar-user-panel">
|
||||
<div class="tpl-user-panel-slide-toggleable">
|
||||
<div class="tpl-user-panel-profile-picture">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<span class="user-panel-logged-in-text">
|
||||
<i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
|
||||
禁言小张
|
||||
</span>
|
||||
<a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 菜单 -->
|
||||
<ul class="sidebar-nav">
|
||||
<li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/">
|
||||
<i class="am-icon-home sidebar-nav-link-logo"></i> 首页
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/tables.html">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 表格
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/calendar.html">
|
||||
<i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/form.html">
|
||||
<i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/chart.html">
|
||||
<i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="javascript:;" class="sidebar-nav-sub-title">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
|
||||
<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
|
||||
</a>
|
||||
<ul class="sidebar-nav sidebar-nav-sub">
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list-img.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/signup">
|
||||
<i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
|
||||
<span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/login">
|
||||
<i class="am-icon-key sidebar-nav-link-logo"></i> 登录
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/page404" class="active">
|
||||
<i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<div class="tpl-content-wrapper">
|
||||
<div class="row-content am-cf">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-body">
|
||||
<div class="tpl-page-state">
|
||||
<div class="tpl-page-state-title am-text-center tpl-error-title">404</div>
|
||||
<div class="tpl-error-title-info">Page Not Found</div>
|
||||
<div class="tpl-page-state-content tpl-error-content">
|
||||
|
||||
<p>对不起,没有找到您所需要的页面,可能是URL不确定,或者页面已被移除。</p>
|
||||
<a href="/" class="am-btn am-btn-secondary am-radius tpl-error-btn">Back Home</a></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/amazeui.datatables.min.js"></script>
|
||||
<script src="../js/dataTables.responsive.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,453 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css" />
|
||||
<link rel="stylesheet" href="../css/fullcalendar.min.css" />
|
||||
<link rel="stylesheet" href="../css/fullcalendar.print.css" media='print' />
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body data-type="widgets">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 头部 -->
|
||||
<header>
|
||||
<!-- logo -->
|
||||
<div class="am-fl tpl-header-logo">
|
||||
<a href="javascript:;"><img src="../img/logo.png" alt=""></a>
|
||||
</div>
|
||||
<!-- 右侧内容 -->
|
||||
<div class="tpl-header-fluid">
|
||||
<!-- 侧边切换 -->
|
||||
<div class="am-fl tpl-header-switch-button am-icon-list">
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
<div class="am-fl tpl-header-search">
|
||||
<form class="tpl-header-search-form" action="javascript:;">
|
||||
<button class="tpl-header-search-btn am-icon-search"></button>
|
||||
<input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
|
||||
</form>
|
||||
</div>
|
||||
<!-- 其它功能-->
|
||||
<div class="am-fr tpl-header-navbar">
|
||||
<ul>
|
||||
<!-- 欢迎语 -->
|
||||
<li class="am-text-sm tpl-header-navbar-welcome">
|
||||
<a href="javascript:;">欢迎你, <span>Amaze UI</span> </a>
|
||||
</li>
|
||||
|
||||
<!-- 新邮件 -->
|
||||
<li class="am-dropdown tpl-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-envelope"></i>
|
||||
<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
3小时前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-success"></i>
|
||||
<span>夕风色</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> Amaze UI 的诞生,依托于 GitHub 及其他技术社区上一些优秀的资源;Amaze UI 的成长,则离不开用户的支持。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user02.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
5天前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-warning"></i>
|
||||
<span>禁言小张</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> 为了能最准确的传达所描述的问题, 建议你在反馈时附上演示,方便我们理解。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<i class="am-icon-circle-o"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 新提示 -->
|
||||
<li class="am-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-bell"></i>
|
||||
<span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
|
||||
</a>
|
||||
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-line-chart"></i>
|
||||
<span> 有6笔新的销售订单</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
12分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-star"></i>
|
||||
<span> 有3个来自人事部的消息</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
30分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-folder-o"></i>
|
||||
<span> 上午开会记录存档</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
1天前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<i class="am-icon-bell"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 退出 -->
|
||||
<li class="am-text-sm">
|
||||
<a href="javascript:;">
|
||||
<span class="am-icon-sign-out"></span> 退出
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边导航栏 -->
|
||||
<div class="left-sidebar">
|
||||
<!-- 用户信息 -->
|
||||
<div class="tpl-sidebar-user-panel">
|
||||
<div class="tpl-user-panel-slide-toggleable">
|
||||
<div class="tpl-user-panel-profile-picture">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<span class="user-panel-logged-in-text">
|
||||
<i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
|
||||
禁言小张
|
||||
</span>
|
||||
<a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 菜单 -->
|
||||
<ul class="sidebar-nav">
|
||||
<li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/">
|
||||
<i class="am-icon-home sidebar-nav-link-logo"></i> 首页
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/tables.html">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 表格
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/calendar.html" class="active">
|
||||
<i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/form.html">
|
||||
<i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/chart.html">
|
||||
<i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="javascript:;" class="sidebar-nav-sub-title">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
|
||||
<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
|
||||
</a>
|
||||
<ul class="sidebar-nav sidebar-nav-sub">
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list-img.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/signup">
|
||||
<i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
|
||||
<span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/login">
|
||||
<i class="am-icon-key sidebar-nav-link-logo"></i> 登录
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/page404">
|
||||
<i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<div class="tpl-content-wrapper">
|
||||
<div class="row-content am-cf">
|
||||
<div class="tpl-calendar-box">
|
||||
<div id="calendar"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 弹出层 -->
|
||||
|
||||
<div class="am-modal am-modal-no-btn" id="calendar-edit-box">
|
||||
<div class="am-modal-dialog tpl-model-dialog">
|
||||
<div class="am-modal-hd">
|
||||
<a href="javascript: void(0)" class="am-close edit-box-close am-close-spin" data-am-modal-close>×</a>
|
||||
</div>
|
||||
<div class="am-modal-bd tpl-am-model-bd am-cf">
|
||||
|
||||
<form class="am-form tpl-form-border-form">
|
||||
<div class="am-form-group am-u-sm-12">
|
||||
<label for="user-name" class="am-u-sm-12 am-form-label am-text-left">标题 <span class="tpl-form-line-small-title">Title</span></label>
|
||||
<div class="am-u-sm-12">
|
||||
<input type="text" class="tpl-form-input am-margin-top-xs calendar-edit-box-title" id="user-name" placeholder="" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/moment.js"></script>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/fullcalendar.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var editBox = $('#calendar-edit-box');
|
||||
|
||||
$('.edit-box-close').on('click', function() {
|
||||
$('#calendar').fullCalendar('unselect');
|
||||
})
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
},
|
||||
|
||||
monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
||||
monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
||||
dayNames: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
||||
dayNamesShort: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
||||
today: ["今天"],
|
||||
firstDay: 1,
|
||||
buttonText: {
|
||||
today: '本月',
|
||||
month: '月',
|
||||
week: '周',
|
||||
day: '日',
|
||||
prev: '上一月',
|
||||
next: '下一月'
|
||||
},
|
||||
defaultDate: '2016-09-12',
|
||||
lang: 'zh-cn',
|
||||
navLinks: true, // can click day/week names to navigate views
|
||||
selectable: true,
|
||||
selectHelper: true,
|
||||
select: function(start, end) {
|
||||
var title = prompt('填写你的记录的:');
|
||||
var eventData;
|
||||
if (title) {
|
||||
eventData = {
|
||||
title: title,
|
||||
start: start,
|
||||
end: end
|
||||
};
|
||||
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
|
||||
}
|
||||
$('#calendar').fullCalendar('unselect');
|
||||
|
||||
|
||||
|
||||
},
|
||||
editable: true,
|
||||
eventLimit: true, // allow "more" link when too many events
|
||||
eventClick: function(event, jsEvent, view) {
|
||||
|
||||
// event.source.events[0].title = '222223333'
|
||||
// 修改数据
|
||||
// 标题
|
||||
$('.calendar-edit-box-title').val(event.title)
|
||||
|
||||
|
||||
|
||||
// 弹出框
|
||||
editBox.modal();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
events: [{
|
||||
id: 1,
|
||||
title: '给她抱抱 叫她包包 喂她吃饱 给她买包',
|
||||
start: '2016-09-01',
|
||||
end: '2016-09-10'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '给她抱抱',
|
||||
start: '2016-09-07',
|
||||
end: '2016-09-10'
|
||||
}, {
|
||||
id: 3,
|
||||
title: '叫她包包',
|
||||
start: '2016-09-09',
|
||||
end: '2016-09-10'
|
||||
}, {
|
||||
id: 4,
|
||||
title: '喂她吃饱',
|
||||
start: '2016-09-16',
|
||||
end: '2016-09-10'
|
||||
}, {
|
||||
id: 5,
|
||||
title: '喂她吃饱',
|
||||
start: '2016-09-11',
|
||||
end: '2016-09-13'
|
||||
}, {
|
||||
id: 6,
|
||||
title: '喂她吃饱',
|
||||
start: '2016-09-12',
|
||||
end: '2016-09-12'
|
||||
}, {
|
||||
id: 7,
|
||||
title: '喂她吃饱',
|
||||
start: '2016-09-12',
|
||||
end: '2016-09-12'
|
||||
}, {
|
||||
id: 8,
|
||||
title: '喂她吃饱',
|
||||
start: '2016-09-12',
|
||||
end: '2016-09-12'
|
||||
}, {
|
||||
id: 9,
|
||||
title: '喂她吃饱',
|
||||
start: '2016-09-12',
|
||||
end: '2016-09-12'
|
||||
}, {
|
||||
id: 10,
|
||||
title: '喂她吃饱',
|
||||
start: '2016-09-12',
|
||||
end: '2016-09-12'
|
||||
}, {
|
||||
id: 11,
|
||||
title: 'Birthday Party',
|
||||
start: '2016-09-13',
|
||||
end: '2016-09-12'
|
||||
}, {
|
||||
id: 12,
|
||||
title: 'Click for Google',
|
||||
start: '2016-09-28',
|
||||
end: '2016-09-12'
|
||||
}]
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,341 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
|
||||
<script src="../js/echarts.min.js"></script>
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css" />
|
||||
<link rel="stylesheet" href="../css/amazeui.datatables.min.css" />
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
</head>
|
||||
<body data-type="chart">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 头部 -->
|
||||
<header>
|
||||
<!-- logo -->
|
||||
<div class="am-fl tpl-header-logo">
|
||||
<a href="javascript:;"><img src="../img/logo.png" alt=""></a>
|
||||
</div>
|
||||
<!-- 右侧内容 -->
|
||||
<div class="tpl-header-fluid">
|
||||
<!-- 侧边切换 -->
|
||||
<div class="am-fl tpl-header-switch-button am-icon-list">
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
<div class="am-fl tpl-header-search">
|
||||
<form class="tpl-header-search-form" action="javascript:;">
|
||||
<button class="tpl-header-search-btn am-icon-search"></button>
|
||||
<input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
|
||||
</form>
|
||||
</div>
|
||||
<!-- 其它功能-->
|
||||
<div class="am-fr tpl-header-navbar">
|
||||
<ul>
|
||||
<!-- 欢迎语 -->
|
||||
<li class="am-text-sm tpl-header-navbar-welcome">
|
||||
<a href="javascript:;">欢迎你, <span>Amaze UI</span> </a>
|
||||
</li>
|
||||
|
||||
<!-- 新邮件 -->
|
||||
<li class="am-dropdown tpl-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-envelope"></i>
|
||||
<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
3小时前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-success"></i>
|
||||
<span>夕风色</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> Amaze UI 的诞生,依托于 GitHub 及其他技术社区上一些优秀的资源;Amaze UI 的成长,则离不开用户的支持。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user02.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
5天前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-warning"></i>
|
||||
<span>禁言小张</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> 为了能最准确的传达所描述的问题, 建议你在反馈时附上演示,方便我们理解。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<i class="am-icon-circle-o"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 新提示 -->
|
||||
<li class="am-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-bell"></i>
|
||||
<span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
|
||||
</a>
|
||||
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-line-chart"></i>
|
||||
<span> 有6笔新的销售订单</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
12分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-star"></i>
|
||||
<span> 有3个来自人事部的消息</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
30分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-folder-o"></i>
|
||||
<span> 上午开会记录存档</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
1天前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<i class="am-icon-bell"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 退出 -->
|
||||
<li class="am-text-sm">
|
||||
<a href="javascript:;">
|
||||
<span class="am-icon-sign-out"></span> 退出
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边导航栏 -->
|
||||
<div class="left-sidebar">
|
||||
<!-- 用户信息 -->
|
||||
<div class="tpl-sidebar-user-panel">
|
||||
<div class="tpl-user-panel-slide-toggleable">
|
||||
<div class="tpl-user-panel-profile-picture">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<span class="user-panel-logged-in-text">
|
||||
<i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
|
||||
禁言小张
|
||||
</span>
|
||||
<a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 菜单 -->
|
||||
<ul class="sidebar-nav">
|
||||
<li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/">
|
||||
<i class="am-icon-home sidebar-nav-link-logo"></i> 首页
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/tables.html">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 表格
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/calendar.html">
|
||||
<i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/form.html">
|
||||
<i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/chart.html" class="active">
|
||||
<i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="javascript:;" class="sidebar-nav-sub-title">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
|
||||
<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
|
||||
</a>
|
||||
<ul class="sidebar-nav sidebar-nav-sub">
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list-img.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/signup">
|
||||
<i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
|
||||
<span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/login">
|
||||
<i class="am-icon-key sidebar-nav-link-logo"></i> 登录
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/page404">
|
||||
<i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<div class="tpl-content-wrapper">
|
||||
|
||||
<div class="container-fluid am-cf">
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
|
||||
<div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 图表 <small>Amaze UI</small></div>
|
||||
<p class="page-header-description">图表组件使用的是 <a href="http://echarts.baidu.com">百度图表echarts</a>。</p>
|
||||
</div>
|
||||
<div class="am-u-lg-3 tpl-index-settings-button">
|
||||
<button type="button" class="page-header-button"><span class="am-icon-paint-brush"></span> 设置</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row-content am-cf">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">折线</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
<div style="height: 400px" class="" id="tpl-echarts-A">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">雷达</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
<div style="height: 400px" id="tpl-echarts-B">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">折线柱图</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
<div style="height: 400px" id="tpl-echarts-C">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/amazeui.datatables.min.js"></script>
|
||||
<script src="../js/dataTables.responsive.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
<!-- 说明:通过WebSocket获取服务器推送数据的代码在app.js中 -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,619 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
|
||||
<script src="../js/echarts.min.js"></script>
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css" />
|
||||
<link rel="stylesheet" href="../css/amazeui.datatables.min.css" />
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body data-type="widgets">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 头部 -->
|
||||
<header>
|
||||
<!-- logo -->
|
||||
<div class="am-fl tpl-header-logo">
|
||||
<a href="javascript:;"><img src="../img/logo.png" alt=""></a>
|
||||
</div>
|
||||
<!-- 右侧内容 -->
|
||||
<div class="tpl-header-fluid">
|
||||
<!-- 侧边切换 -->
|
||||
<div class="am-fl tpl-header-switch-button am-icon-list">
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
<div class="am-fl tpl-header-search">
|
||||
<form class="tpl-header-search-form" action="javascript:;">
|
||||
<button class="tpl-header-search-btn am-icon-search"></button>
|
||||
<input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
|
||||
</form>
|
||||
</div>
|
||||
<!-- 其它功能-->
|
||||
<div class="am-fr tpl-header-navbar">
|
||||
<ul>
|
||||
<!-- 欢迎语 -->
|
||||
<li class="am-text-sm tpl-header-navbar-welcome">
|
||||
<a href="javascript:;">欢迎你, <span>Amaze UI</span> </a>
|
||||
</li>
|
||||
|
||||
<!-- 新邮件 -->
|
||||
<li class="am-dropdown tpl-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-envelope"></i>
|
||||
<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
3小时前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-success"></i>
|
||||
<span>夕风色</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> Amaze UI 的诞生,依托于 GitHub 及其他技术社区上一些优秀的资源;Amaze UI 的成长,则离不开用户的支持。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user02.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
5天前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-warning"></i>
|
||||
<span>禁言小张</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> 为了能最准确的传达所描述的问题, 建议你在反馈时附上演示,方便我们理解。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<i class="am-icon-circle-o"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 新提示 -->
|
||||
<li class="am-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-bell"></i>
|
||||
<span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
|
||||
</a>
|
||||
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-line-chart"></i>
|
||||
<span> 有6笔新的销售订单</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
12分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-star"></i>
|
||||
<span> 有3个来自人事部的消息</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
30分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-folder-o"></i>
|
||||
<span> 上午开会记录存档</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
1天前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<i class="am-icon-bell"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 退出 -->
|
||||
<li class="am-text-sm">
|
||||
<a href="javascript:;">
|
||||
<span class="am-icon-sign-out"></span> 退出
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边导航栏 -->
|
||||
<div class="left-sidebar">
|
||||
<!-- 用户信息 -->
|
||||
<div class="tpl-sidebar-user-panel">
|
||||
<div class="tpl-user-panel-slide-toggleable">
|
||||
<div class="tpl-user-panel-profile-picture">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<span class="user-panel-logged-in-text">
|
||||
<i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
|
||||
禁言小张
|
||||
</span>
|
||||
<a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 菜单 -->
|
||||
<ul class="sidebar-nav">
|
||||
<li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/">
|
||||
<i class="am-icon-home sidebar-nav-link-logo"></i> 首页
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/tables.html">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 表格
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/calendar.html">
|
||||
<i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/form.html" class="active">
|
||||
<i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/chart.html">
|
||||
<i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="javascript:;" class="sidebar-nav-sub-title">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
|
||||
<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
|
||||
</a>
|
||||
<ul class="sidebar-nav sidebar-nav-sub">
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list-img.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/signup">
|
||||
<i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
|
||||
<span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/login">
|
||||
<i class="am-icon-key sidebar-nav-link-logo"></i> 登录
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/page404">
|
||||
<i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<div class="tpl-content-wrapper">
|
||||
|
||||
<div class="container-fluid am-cf">
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
|
||||
<div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 表单 <small>Amaze UI</small></div>
|
||||
<p class="page-header-description">Amaze UI 有许多不同的表格可用。</p>
|
||||
</div>
|
||||
<div class="am-u-lg-3 tpl-index-settings-button">
|
||||
<button type="button" class="page-header-button"><span class="am-icon-paint-brush"></span> 设置</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row-content am-cf">
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">线条表单</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
|
||||
<form class="am-form tpl-form-line-form">
|
||||
<div class="am-form-group">
|
||||
<label for="user-name" class="am-u-sm-3 am-form-label">标题 <span class="tpl-form-line-small-title">Title</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<input type="text" class="tpl-form-input" id="user-name" placeholder="请输入标题文字">
|
||||
<small>请填写标题文字10-20字左右。</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-email" class="am-u-sm-3 am-form-label">发布时间 <span class="tpl-form-line-small-title">Time</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<input type="text" class="am-form-field tpl-form-no-bg" placeholder="发布时间" data-am-datepicker="" readonly="">
|
||||
<small>发布时间为必填</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-phone" class="am-u-sm-3 am-form-label">作者 <span class="tpl-form-line-small-title">Author</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<select data-am-selected="{searchBox: 1}" style="display: none;">
|
||||
<option value="a">-The.CC</option>
|
||||
<option value="b">夕风色</option>
|
||||
<option value="o">Orange</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-u-sm-3 am-form-label">SEO关键字 <span class="tpl-form-line-small-title">SEO</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<input type="text" placeholder="输入SEO关键字">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-weibo" class="am-u-sm-3 am-form-label">封面图 <span class="tpl-form-line-small-title">Images</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<div class="am-form-group am-form-file">
|
||||
<div class="tpl-form-file-img">
|
||||
<img src="../img/a5.png" alt="">
|
||||
</div>
|
||||
<button type="button" class="am-btn am-btn-danger am-btn-sm">
|
||||
<i class="am-icon-cloud-upload"></i> 添加封面图片</button>
|
||||
<input id="doc-form-file" type="file" multiple="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-weibo" class="am-u-sm-3 am-form-label">添加分类 <span class="tpl-form-line-small-title">Type</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<input type="text" id="user-weibo" placeholder="请添加分类用点号隔开">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-intro" class="am-u-sm-3 am-form-label">隐藏文章</label>
|
||||
<div class="am-u-sm-9">
|
||||
<div class="tpl-switch">
|
||||
<input type="checkbox" class="ios-switch bigswitch tpl-switch-btn" checked="">
|
||||
<div class="tpl-switch-btn-view">
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-intro" class="am-u-sm-3 am-form-label">文章内容</label>
|
||||
<div class="am-u-sm-9">
|
||||
<textarea class="" rows="10" id="user-intro" placeholder="请输入文章内容"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<div class="am-u-sm-9 am-u-sm-push-3">
|
||||
<button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">边框表单</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
|
||||
<form class="am-form tpl-form-border-form tpl-form-border-br">
|
||||
<div class="am-form-group">
|
||||
<label for="user-name" class="am-u-sm-3 am-form-label">标题 <span class="tpl-form-line-small-title">Title</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<input type="text" class="tpl-form-input" id="user-name" placeholder="请输入标题文字">
|
||||
<small>请填写标题文字10-20字左右。</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-email" class="am-u-sm-3 am-form-label">发布时间 <span class="tpl-form-line-small-title">Time</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<input type="text" class="am-form-field tpl-form-no-bg" placeholder="发布时间" data-am-datepicker="" readonly="">
|
||||
<small>发布时间为必填</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-phone" class="am-u-sm-3 am-form-label">作者 <span class="tpl-form-line-small-title">Author</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<select data-am-selected="{searchBox: 1}" style="display: none;">
|
||||
<option value="a">-The.CC</option>
|
||||
<option value="b">夕风色</option>
|
||||
<option value="o">Orange</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-u-sm-3 am-form-label">SEO关键字 <span class="tpl-form-line-small-title">SEO</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<input type="text" placeholder="输入SEO关键字">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-weibo" class="am-u-sm-3 am-form-label">封面图 <span class="tpl-form-line-small-title">Images</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<div class="am-form-group am-form-file">
|
||||
<div class="tpl-form-file-img">
|
||||
<img src="../img/a5.png" alt="">
|
||||
</div>
|
||||
<button type="button" class="am-btn am-btn-danger am-btn-sm">
|
||||
<i class="am-icon-cloud-upload"></i> 添加封面图片</button>
|
||||
<input id="doc-form-file" type="file" multiple="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-weibo" class="am-u-sm-3 am-form-label">添加分类 <span class="tpl-form-line-small-title">Type</span></label>
|
||||
<div class="am-u-sm-9">
|
||||
<input type="text" id="user-weibo" placeholder="请添加分类用点号隔开">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-intro" class="am-u-sm-3 am-form-label">隐藏文章</label>
|
||||
<div class="am-u-sm-9">
|
||||
<div class="tpl-switch">
|
||||
<input type="checkbox" class="ios-switch bigswitch tpl-switch-btn" checked="">
|
||||
<div class="tpl-switch-btn-view">
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-intro" class="am-u-sm-3 am-form-label">文章内容</label>
|
||||
<div class="am-u-sm-9">
|
||||
<textarea class="" rows="10" id="user-intro" placeholder="请输入文章内容"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<div class="am-u-sm-9 am-u-sm-push-3">
|
||||
<button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">换行边框</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
|
||||
<form class="am-form tpl-form-border-form">
|
||||
<div class="am-form-group">
|
||||
<label for="user-name" class="am-u-sm-12 am-form-label am-text-left">标题 <span class="tpl-form-line-small-title">Title</span></label>
|
||||
<div class="am-u-sm-12">
|
||||
<input type="text" class="tpl-form-input am-margin-top-xs" id="user-name" placeholder="请输入标题文字">
|
||||
<small>请填写标题文字10-20字左右。</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-email" class="am-u-sm-12 am-form-label am-text-left">发布时间 <span class="tpl-form-line-small-title">Time</span></label>
|
||||
<div class="am-u-sm-12">
|
||||
<input type="text" class="am-form-field tpl-form-no-bg am-margin-top-xs" placeholder="发布时间" data-am-datepicker="" readonly="">
|
||||
<small>发布时间为必填</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-phone" class="am-u-sm-12 am-form-label am-text-left">作者 <span class="tpl-form-line-small-title">Author</span></label>
|
||||
<div class="am-u-sm-12 am-margin-top-xs">
|
||||
<select data-am-selected="{searchBox: 1}" style="display: none;">
|
||||
<option value="a">-The.CC</option>
|
||||
<option value="b">夕风色</option>
|
||||
<option value="o">Orange</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-u-sm-12 am-form-label am-text-left">SEO关键字 <span class="tpl-form-line-small-title">SEO</span></label>
|
||||
<div class="am-u-sm-12">
|
||||
<input type="text" class="am-margin-top-xs" placeholder="输入SEO关键字">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-weibo" class="am-u-sm-12 am-form-label am-text-left">封面图 <span class="tpl-form-line-small-title">Images</span></label>
|
||||
<div class="am-u-sm-12 am-margin-top-xs">
|
||||
<div class="am-form-group am-form-file">
|
||||
<div class="tpl-form-file-img">
|
||||
<img src="../img/a5.png" alt="">
|
||||
</div>
|
||||
<button type="button" class="am-btn am-btn-danger am-btn-sm ">
|
||||
<i class="am-icon-cloud-upload"></i> 添加封面图片</button>
|
||||
<input id="doc-form-file" type="file" multiple="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-weibo" class="am-u-sm-12 am-form-label am-text-left">添加分类 <span class="tpl-form-line-small-title">Type</span></label>
|
||||
<div class="am-u-sm-12">
|
||||
<input type="text" id="user-weibo" class="am-margin-top-xs" placeholder="请添加分类用点号隔开">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-intro" class="am-u-sm-12 am-form-label am-text-left">隐藏文章</label>
|
||||
<div class="am-u-sm-12">
|
||||
<div class="tpl-switch">
|
||||
<input type="checkbox" class="ios-switch bigswitch tpl-switch-btn am-margin-top-xs" checked="">
|
||||
<div class="tpl-switch-btn-view">
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label for="user-intro" class="am-u-sm-12 am-form-label am-text-left">文章内容</label>
|
||||
<div class="am-u-sm-12 am-margin-top-xs">
|
||||
<textarea class="" rows="10" id="user-intro" placeholder="请输入文章内容"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<div class="am-u-sm-12 am-u-sm-push-12">
|
||||
<button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/amazeui.datatables.min.js"></script>
|
||||
<script src="../js/dataTables.responsive.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css" />
|
||||
<link rel="stylesheet" href="../css/amazeui.datatables.min.css" />
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
</head>
|
||||
<body data-type="login">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tpl-login">
|
||||
<div class="tpl-login-content">
|
||||
<div class="tpl-login-logo"></div>
|
||||
<form class="am-form tpl-form-line-form">
|
||||
<div class="am-form-group">
|
||||
<input type="text" class="tpl-form-input" id="user-name" placeholder="请输入账号">
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<input type="password" class="tpl-form-input" id="user-name" placeholder="请输入密码">
|
||||
</div>
|
||||
<div class="am-form-group tpl-login-remember-me">
|
||||
<input id="remember-me" type="checkbox">
|
||||
<label for="remember-me">记住密码</label>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<button type="button" class="am-btn am-btn-primary am-btn-block tpl-btn-bg-color-success tpl-login-btn">提交</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp"/>
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI"/>
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css"/>
|
||||
<link rel="stylesheet" href="../css/amazeui.datatables.min.css"/>
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
</head>
|
||||
<body data-type="login">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tpl-login">
|
||||
<div class="tpl-login-content">
|
||||
<div class="tpl-login-title">注册用户</div>
|
||||
<span class="tpl-login-content-info">创建一个新的用户</span>
|
||||
<form class="am-form tpl-form-line-form">
|
||||
<div class="am-form-group">
|
||||
<input type="text" class="tpl-form-input" id="user-name" placeholder="邮箱">
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<input type="text" class="tpl-form-input" id="user-name" placeholder="用户名">
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<input type="password" class="tpl-form-input" id="user-name" placeholder="请输入密码">
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<input type="password" class="tpl-form-input" id="user-name" placeholder="再次输入密码">
|
||||
</div>
|
||||
<div class="am-form-group tpl-login-remember-me">
|
||||
<input id="remember-me" type="checkbox">
|
||||
<label for="remember-me">我已阅读并同意 <a href="javascript:;">《用户注册协议》</a></label>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<button type="button"
|
||||
class="am-btn am-btn-primary am-btn-block tpl-btn-bg-color-success tpl-login-btn">提交
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,469 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css" />
|
||||
<link rel="stylesheet" href="../css/amazeui.datatables.min.css" />
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body data-type="widgets">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 头部 -->
|
||||
<header>
|
||||
<!-- logo -->
|
||||
<div class="am-fl tpl-header-logo">
|
||||
<a href="javascript:;"><img src="../img/logo.png" alt=""></a>
|
||||
</div>
|
||||
<!-- 右侧内容 -->
|
||||
<div class="tpl-header-fluid">
|
||||
<!-- 侧边切换 -->
|
||||
<div class="am-fl tpl-header-switch-button am-icon-list">
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
<div class="am-fl tpl-header-search">
|
||||
<form class="tpl-header-search-form" action="javascript:;">
|
||||
<button class="tpl-header-search-btn am-icon-search"></button>
|
||||
<input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
|
||||
</form>
|
||||
</div>
|
||||
<!-- 其它功能-->
|
||||
<div class="am-fr tpl-header-navbar">
|
||||
<ul>
|
||||
<!-- 欢迎语 -->
|
||||
<li class="am-text-sm tpl-header-navbar-welcome">
|
||||
<a href="javascript:;">欢迎你, <span>Amaze UI</span> </a>
|
||||
</li>
|
||||
|
||||
<!-- 新邮件 -->
|
||||
<li class="am-dropdown tpl-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-envelope"></i>
|
||||
<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
3小时前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-success"></i>
|
||||
<span>夕风色</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> Amaze UI 的诞生,依托于 GitHub 及其他技术社区上一些优秀的资源;Amaze UI 的成长,则离不开用户的支持。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user02.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
5天前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-warning"></i>
|
||||
<span>禁言小张</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> 为了能最准确的传达所描述的问题, 建议你在反馈时附上演示,方便我们理解。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<i class="am-icon-circle-o"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 新提示 -->
|
||||
<li class="am-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-bell"></i>
|
||||
<span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
|
||||
</a>
|
||||
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-line-chart"></i>
|
||||
<span> 有6笔新的销售订单</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
12分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-star"></i>
|
||||
<span> 有3个来自人事部的消息</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
30分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-folder-o"></i>
|
||||
<span> 上午开会记录存档</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
1天前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<i class="am-icon-bell"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 退出 -->
|
||||
<li class="am-text-sm">
|
||||
<a href="javascript:;">
|
||||
<span class="am-icon-sign-out"></span> 退出
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边导航栏 -->
|
||||
<div class="left-sidebar">
|
||||
<!-- 用户信息 -->
|
||||
<div class="tpl-sidebar-user-panel">
|
||||
<div class="tpl-user-panel-slide-toggleable">
|
||||
<div class="tpl-user-panel-profile-picture">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<span class="user-panel-logged-in-text">
|
||||
<i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
|
||||
禁言小张
|
||||
</span>
|
||||
<a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 菜单 -->
|
||||
<ul class="sidebar-nav">
|
||||
<li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/">
|
||||
<i class="am-icon-home sidebar-nav-link-logo"></i> 首页
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/tables.html">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 表格
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/calendar.html">
|
||||
<i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/form.html">
|
||||
<i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/chart.html">
|
||||
<i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="javascript:;" class="sidebar-nav-sub-title active">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
|
||||
<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico sidebar-nav-sub-ico-rotate"></span>
|
||||
</a>
|
||||
<ul class="sidebar-nav sidebar-nav-sub" style="display: block;">
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list-img.html" class="sub-active">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/signup">
|
||||
<i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
|
||||
<span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/login">
|
||||
<i class="am-icon-key sidebar-nav-link-logo"></i> 登录
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/page404">
|
||||
<i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 内容区域 -->
|
||||
<div class="tpl-content-wrapper">
|
||||
<div class="row-content am-cf">
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-cf">文章列表</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
|
||||
<div class="am-form-group">
|
||||
<div class="am-btn-toolbar">
|
||||
<div class="am-btn-group am-btn-group-xs">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
|
||||
<div class="am-form-group tpl-table-list-select">
|
||||
<select data-am-selected="{btnSize: 'sm'}">
|
||||
<option value="option1">所有类别</option>
|
||||
<option value="option2">IT业界</option>
|
||||
<option value="option3">数码产品</option>
|
||||
<option value="option3">笔记本电脑</option>
|
||||
<option value="option3">平板电脑</option>
|
||||
<option value="option3">只能手机</option>
|
||||
<option value="option3">超极本</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
|
||||
<div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
|
||||
<input type="text" class="am-form-field ">
|
||||
<span class="am-input-group-btn">
|
||||
<button class="am-btn am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="button"></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-u-sm-12">
|
||||
<table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章缩略图</th>
|
||||
<th>文章标题</th>
|
||||
<th>作者</th>
|
||||
<th>时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX">
|
||||
<td>
|
||||
<img src="../img/k.jpg" class="tpl-table-line-img" alt="">
|
||||
</td>
|
||||
<td class="am-text-middle">Amaze UI 模式窗口</td>
|
||||
<td class="am-text-middle">张鹏飞</td>
|
||||
<td class="am-text-middle">2016-09-26</td>
|
||||
<td class="am-text-middle">
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>
|
||||
<img src="../img/k.jpg" class="tpl-table-line-img" alt="">
|
||||
</td>
|
||||
<td class="am-text-middle">有适配微信小程序的计划吗</td>
|
||||
<td class="am-text-middle">天纵之人</td>
|
||||
<td class="am-text-middle">2016-09-26</td>
|
||||
<td class="am-text-middle">
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gradeX">
|
||||
<td>
|
||||
<img src="../img/k.jpg" class="tpl-table-line-img" alt="">
|
||||
</td>
|
||||
<td class="am-text-middle">请问有没有amazeui 分享插件</td>
|
||||
<td class="am-text-middle">王宽师</td>
|
||||
<td class="am-text-middle">2016-09-26</td>
|
||||
<td class="am-text-middle">
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>
|
||||
<img src="../img/k.jpg" class="tpl-table-line-img" alt="">
|
||||
</td>
|
||||
<td class="am-text-middle">关于input输入框的问题</td>
|
||||
<td class="am-text-middle">着迷</td>
|
||||
<td class="am-text-middle">2016-09-26</td>
|
||||
<td class="am-text-middle">
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>
|
||||
<img src="../img/k.jpg" class="tpl-table-line-img" alt="">
|
||||
</td>
|
||||
<td class="am-text-middle">有没有发现官网上的下载包不好用</td>
|
||||
<td class="am-text-middle">醉里挑灯看键</td>
|
||||
<td class="am-text-middle">2016-09-26</td>
|
||||
<td class="am-text-middle">
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="even gradeC">
|
||||
<td>
|
||||
<img src="../img/k.jpg" class="tpl-table-line-img" alt="">
|
||||
</td>
|
||||
<td class="am-text-middle">我建议WEB版本文件引入问题</td>
|
||||
<td class="am-text-middle">罢了</td>
|
||||
<td class="am-text-middle">2016-09-26</td>
|
||||
<td class="am-text-middle">
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- more data -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="am-u-lg-12 am-cf">
|
||||
|
||||
<div class="am-fr">
|
||||
<ul class="am-pagination tpl-pagination">
|
||||
<li class="am-disabled"><a href="#">«</a></li>
|
||||
<li class="am-active"><a href="#">1</a></li>
|
||||
<li><a href="#">2</a></li>
|
||||
<li><a href="#">3</a></li>
|
||||
<li><a href="#">4</a></li>
|
||||
<li><a href="#">5</a></li>
|
||||
<li><a href="#">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,461 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp"/>
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI"/>
|
||||
<script src="../js/echarts.min.js"></script>
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css"/>
|
||||
<link rel="stylesheet" href="../css/amazeui.datatables.min.css"/>
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body data-type="widgets">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 头部 -->
|
||||
<header>
|
||||
<!-- logo -->
|
||||
<div class="am-fl tpl-header-logo">
|
||||
<a href="javascript:;"><img src="../img/logo.png" alt=""></a>
|
||||
</div>
|
||||
<!-- 右侧内容 -->
|
||||
<div class="tpl-header-fluid">
|
||||
<!-- 侧边切换 -->
|
||||
<div class="am-fl tpl-header-switch-button am-icon-list">
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
<div class="am-fl tpl-header-search">
|
||||
<form class="tpl-header-search-form" action="javascript:;">
|
||||
<button class="tpl-header-search-btn am-icon-search"></button>
|
||||
<input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
|
||||
</form>
|
||||
</div>
|
||||
<!-- 其它功能-->
|
||||
<div class="am-fr tpl-header-navbar">
|
||||
<ul>
|
||||
<!-- 欢迎语 -->
|
||||
<li class="am-text-sm tpl-header-navbar-welcome">
|
||||
<a href="javascript:;">欢迎你, <span>Amaze UI</span> </a>
|
||||
</li>
|
||||
|
||||
<!-- 新邮件 -->
|
||||
<li class="am-dropdown tpl-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-envelope"></i>
|
||||
<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
3小时前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-success"></i>
|
||||
<span>夕风色</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> Amaze UI 的诞生,依托于 GitHub 及其他技术社区上一些优秀的资源;Amaze UI
|
||||
的成长,则离不开用户的支持。
|
||||
</div>
|
||||
<div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user02.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
5天前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-warning"></i>
|
||||
<span>禁言小张</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> 为了能最准确的传达所描述的问题, 建议你在反馈时附上演示,方便我们理解。</div>
|
||||
<div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<i class="am-icon-circle-o"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 新提示 -->
|
||||
<li class="am-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-bell"></i>
|
||||
<span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
|
||||
</a>
|
||||
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-line-chart"></i>
|
||||
<span> 有6笔新的销售订单</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
12分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-star"></i>
|
||||
<span> 有3个来自人事部的消息</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
30分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-folder-o"></i>
|
||||
<span> 上午开会记录存档</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
1天前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<i class="am-icon-bell"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 退出 -->
|
||||
<li class="am-text-sm">
|
||||
<a href="javascript:;">
|
||||
<span class="am-icon-sign-out"></span> 退出
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边导航栏 -->
|
||||
<div class="left-sidebar">
|
||||
<!-- 用户信息 -->
|
||||
<div class="tpl-sidebar-user-panel">
|
||||
<div class="tpl-user-panel-slide-toggleable">
|
||||
<div class="tpl-user-panel-profile-picture">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<span class="user-panel-logged-in-text"><i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
|
||||
禁言小张
|
||||
</span>
|
||||
<a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 菜单 -->
|
||||
<ul class="sidebar-nav">
|
||||
<li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/">
|
||||
<i class="am-icon-home sidebar-nav-link-logo"></i> 首页
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/tables.html">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 表格
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/calendar.html">
|
||||
<i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/form.html">
|
||||
<i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/chart.html">
|
||||
<i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="javascript:;" class="sidebar-nav-sub-title active">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
|
||||
<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico sidebar-nav-sub-ico-rotate"></span>
|
||||
</a>
|
||||
<ul class="sidebar-nav sidebar-nav-sub" style="display: block;">
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list.html" class="sub-active">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list-img.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/signup">
|
||||
<i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
|
||||
<span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/login">
|
||||
<i class="am-icon-key sidebar-nav-link-logo"></i> 登录
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/page404">
|
||||
<i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 内容区域 -->
|
||||
<div class="tpl-content-wrapper">
|
||||
<div class="row-content am-cf">
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-cf">文章列表</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
|
||||
<div class="am-form-group">
|
||||
<div class="am-btn-toolbar">
|
||||
<div class="am-btn-group am-btn-group-xs">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-success"><span
|
||||
class="am-icon-plus"></span> 新增
|
||||
</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-secondary"><span
|
||||
class="am-icon-save"></span> 保存
|
||||
</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-warning"><span
|
||||
class="am-icon-archive"></span> 审核
|
||||
</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-danger"><span
|
||||
class="am-icon-trash-o"></span> 删除
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
|
||||
<div class="am-form-group tpl-table-list-select">
|
||||
<select data-am-selected="{btnSize: 'sm'}">
|
||||
<option value="option1">所有类别</option>
|
||||
<option value="option2">IT业界</option>
|
||||
<option value="option3">数码产品</option>
|
||||
<option value="option3">笔记本电脑</option>
|
||||
<option value="option3">平板电脑</option>
|
||||
<option value="option3">只能手机</option>
|
||||
<option value="option3">超极本</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
|
||||
<div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
|
||||
<input type="text" class="am-form-field ">
|
||||
<span class="am-input-group-btn">
|
||||
<button class="am-btn am-btn-default am-btn-success tpl-table-list-field am-icon-search"
|
||||
type="button"></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-u-sm-12">
|
||||
<table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black "
|
||||
id="example-r">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章标题</th>
|
||||
<th>作者</th>
|
||||
<th>时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX">
|
||||
<td>Amaze UI 模式窗口</td>
|
||||
<td>张鹏飞</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有适配微信小程序的计划吗</td>
|
||||
<td>天纵之人</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gradeX">
|
||||
<td>请问有没有amazeui 分享插件</td>
|
||||
<td>王宽师</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>关于input输入框的问题</td>
|
||||
<td>着迷</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有没有发现官网上的下载包不好用</td>
|
||||
<td>醉里挑灯看键</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="even gradeC">
|
||||
<td>我建议WEB版本文件引入问题</td>
|
||||
<td>罢了</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- more data -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="am-u-lg-12 am-cf">
|
||||
|
||||
<div class="am-fr">
|
||||
<ul class="am-pagination tpl-pagination">
|
||||
<li class="am-disabled"><a href="#">«</a></li>
|
||||
<li class="am-active"><a href="#">1</a></li>
|
||||
<li><a href="#">2</a></li>
|
||||
<li><a href="#">3</a></li>
|
||||
<li><a href="#">4</a></li>
|
||||
<li><a href="#">5</a></li>
|
||||
<li><a href="#">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/amazeui.datatables.min.js"></script>
|
||||
<script src="../js/dataTables.responsive.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,834 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Amaze UI Admin index Examples</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp">
|
||||
<link rel="icon" type="image/png" href="../i/favicon.png">
|
||||
<link rel="apple-touch-icon-precomposed" href="../i/app-icon72x72@2x.png">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI">
|
||||
<script src="../js/echarts.min.js"></script>
|
||||
<link rel="stylesheet" href="../css/amazeui.min.css">
|
||||
<link rel="stylesheet" href="../css/amazeui.datatables.min.css">
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<script src="../js/jquery.min.js"></script>
|
||||
</head>
|
||||
<body data-type="widgets">
|
||||
<script src="../js/theme.js"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 头部 -->
|
||||
<header>
|
||||
<!-- logo -->
|
||||
<div class="am-fl tpl-header-logo">
|
||||
<a href="javascript:;"><img src="../img/logo.png" alt=""></a>
|
||||
</div>
|
||||
<!-- 右侧内容 -->
|
||||
<div class="tpl-header-fluid">
|
||||
<!-- 侧边切换 -->
|
||||
<div class="am-fl tpl-header-switch-button am-icon-list">
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
<div class="am-fl tpl-header-search">
|
||||
<form class="tpl-header-search-form" action="javascript:;">
|
||||
<button class="tpl-header-search-btn am-icon-search"></button>
|
||||
<input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
|
||||
</form>
|
||||
</div>
|
||||
<!-- 其它功能-->
|
||||
<div class="am-fr tpl-header-navbar">
|
||||
<ul>
|
||||
<!-- 欢迎语 -->
|
||||
<li class="am-text-sm tpl-header-navbar-welcome">
|
||||
<a href="javascript:;">欢迎你, <span>Amaze UI</span> </a>
|
||||
</li>
|
||||
<!-- 新邮件 -->
|
||||
<li class="am-dropdown tpl-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-envelope"></i>
|
||||
<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
3小时前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-success"></i>
|
||||
<span>夕风色</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> Amaze UI 的诞生,依托于 GitHub 及其他技术社区上一些优秀的资源;Amaze UI
|
||||
的成长,则离不开用户的支持。
|
||||
</div>
|
||||
<div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="../img/user02.png" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
5天前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-warning"></i>
|
||||
<span>禁言小张</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> 为了能最准确的传达所描述的问题, 建议你在反馈时附上演示,方便我们理解。</div>
|
||||
<div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<i class="am-icon-circle-o"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 新提示 -->
|
||||
<li class="am-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-bell"></i>
|
||||
<span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
|
||||
</a>
|
||||
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-line-chart"></i>
|
||||
<span> 有6笔新的销售订单</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
12分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-star"></i>
|
||||
<span> 有3个来自人事部的消息</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
30分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-folder-o"></i>
|
||||
<span> 上午开会记录存档</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
1天前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<i class="am-icon-bell"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 退出 -->
|
||||
<li class="am-text-sm">
|
||||
<a href="javascript:;">
|
||||
<span class="am-icon-sign-out"></span> 退出
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边导航栏 -->
|
||||
<div class="left-sidebar">
|
||||
<!-- 用户信息 -->
|
||||
<div class="tpl-sidebar-user-panel">
|
||||
<div class="tpl-user-panel-slide-toggleable">
|
||||
<div class="tpl-user-panel-profile-picture">
|
||||
<img src="../img/user04.png" alt="">
|
||||
</div>
|
||||
<span class="user-panel-logged-in-text">
|
||||
<i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
|
||||
禁言小张
|
||||
</span>
|
||||
<a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 菜单 -->
|
||||
<ul class="sidebar-nav">
|
||||
<li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/">
|
||||
<i class="am-icon-home sidebar-nav-link-logo"></i> 首页
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/tables.html" class="active">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 表格
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/calendar.html">
|
||||
<i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/form.html">
|
||||
<i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/chart.html">
|
||||
<i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="javascript:;" class="sidebar-nav-sub-title">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
|
||||
<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
|
||||
</a>
|
||||
<ul class="sidebar-nav sidebar-nav-sub">
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="../html/table-list-img.html">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/signup">
|
||||
<i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
|
||||
<span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/login">
|
||||
<i class="am-icon-key sidebar-nav-link-logo"></i> 登录
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/page404">
|
||||
<i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 内容区域 -->
|
||||
<div class="tpl-content-wrapper">
|
||||
<div class="container-fluid am-cf">
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
|
||||
<div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 表格
|
||||
<small>Amaze UI</small>
|
||||
</div>
|
||||
<p class="page-header-description">Amaze UI 有许多不同的表格可用。</p>
|
||||
</div>
|
||||
<div class="am-u-lg-3 tpl-index-settings-button">
|
||||
<button type="button" class="page-header-button"><span class="am-icon-paint-brush"></span> 设置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-content am-cf">
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-6">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">滚动条表格</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body widget-body-lg am-fr">
|
||||
<div class="am-scrollable-horizontal ">
|
||||
<table width="100%" class="am-table am-table-compact am-text-nowrap tpl-table-black "
|
||||
id="example-r">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>工号</th>
|
||||
<th>姓名</th>
|
||||
<th>职位</th>
|
||||
<th>月薪</th>
|
||||
<th>自我介绍</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="emp-data-row">
|
||||
<tr v-for="emp in emps">
|
||||
<td>{{ emp.no }}</td>
|
||||
<td>{{ emp.name }}</td>
|
||||
<td>{{ emp.job }}</td>
|
||||
<td>{{ emp.sal }}</td>
|
||||
<td>{{ emp.intro }}</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-6">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">自适应表格</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body widget-body-lg am-fr">
|
||||
<table width="100%" class="am-table am-table-compact tpl-table-black " id="example-r">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章标题</th>
|
||||
<th>作者</th>
|
||||
<th>时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX">
|
||||
<td>Amaze UI 模式窗口</td>
|
||||
<td>张鹏飞</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有适配微信小程序的计划吗</td>
|
||||
<td>天纵之人</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gradeX">
|
||||
<td>请问有没有amazeui 分享插件</td>
|
||||
<td>王宽师</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>关于input输入框的问题</td>
|
||||
<td>着迷</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有没有发现官网上的下载包不好用</td>
|
||||
<td>醉里挑灯看键</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="even gradeC">
|
||||
<td>我建议WEB版本文件引入问题</td>
|
||||
<td>罢了</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-6">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">基本边框</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body widget-body-lg am-fr">
|
||||
|
||||
<table width="100%" class="am-table am-table-compact am-table-bordered tpl-table-black "
|
||||
id="example-r">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章标题</th>
|
||||
<th>作者</th>
|
||||
<th>时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX">
|
||||
<td>Amaze UI 模式窗口</td>
|
||||
<td>张鹏飞</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有适配微信小程序的计划吗</td>
|
||||
<td>天纵之人</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gradeX">
|
||||
<td>请问有没有amazeui 分享插件</td>
|
||||
<td>王宽师</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>关于input输入框的问题</td>
|
||||
<td>着迷</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有没有发现官网上的下载包不好用</td>
|
||||
<td>醉里挑灯看键</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="even gradeC">
|
||||
<td>我建议WEB版本文件引入问题</td>
|
||||
<td>罢了</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- more data -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-6">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">圆角斑马线边框</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body widget-body-lg am-fr">
|
||||
|
||||
<table width="100%"
|
||||
class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black "
|
||||
id="example-r">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章标题</th>
|
||||
<th>作者</th>
|
||||
<th>时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX">
|
||||
<td>Amaze UI 模式窗口</td>
|
||||
<td>张鹏飞</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有适配微信小程序的计划吗</td>
|
||||
<td>天纵之人</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gradeX">
|
||||
<td>请问有没有amazeui 分享插件</td>
|
||||
<td>王宽师</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>关于input输入框的问题</td>
|
||||
<td>着迷</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有没有发现官网上的下载包不好用</td>
|
||||
<td>醉里挑灯看键</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="even gradeC">
|
||||
<td>我建议WEB版本文件引入问题</td>
|
||||
<td>罢了</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- more data -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">斑马线</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body widget-body-lg am-fr">
|
||||
|
||||
<table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black "
|
||||
id="example-r">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章标题</th>
|
||||
<th>作者</th>
|
||||
<th>时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX">
|
||||
<td>Amaze UI 模式窗口</td>
|
||||
<td>张鹏飞</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有适配微信小程序的计划吗</td>
|
||||
<td>天纵之人</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gradeX">
|
||||
<td>请问有没有amazeui 分享插件</td>
|
||||
<td>王宽师</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>关于input输入框的问题</td>
|
||||
<td>着迷</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>有没有发现官网上的下载包不好用</td>
|
||||
<td>醉里挑灯看键</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="even gradeC">
|
||||
<td>我建议WEB版本文件引入问题</td>
|
||||
<td>罢了</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- more data -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/amazeui.min.js"></script>
|
||||
<script src="../js/amazeui.datatables.min.js"></script>
|
||||
<script src="../js/dataTables.responsive.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
<script src="https://cdn.bootcss.com/vue/2.6.9/vue.min.js"></script>
|
||||
<script>
|
||||
fetch('/api/emps')
|
||||
.then(resp => resp.json())
|
||||
.then(function(data) {
|
||||
var app = new Vue({
|
||||
'el': '#emp-data-row',
|
||||
data: {
|
||||
emps: data
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 3.3 MiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
|
@ -0,0 +1,370 @@
|
|||
$(function() {
|
||||
// 读取body data-type 判断是哪个页面然后执行相应页面方法,方法在下面。
|
||||
var dataType = $('body').attr('data-type');
|
||||
console.log(dataType);
|
||||
for (key in pageData) {
|
||||
if (key == dataType) {
|
||||
pageData[key]();
|
||||
}
|
||||
}
|
||||
// // 判断用户是否已有自己选择的模板风格
|
||||
// if(storageLoad('SelcetColor')){
|
||||
// $('body').attr('class',storageLoad('SelcetColor').Color)
|
||||
// }else{
|
||||
// storageSave(saveSelectColor);
|
||||
// $('body').attr('class','theme-black')
|
||||
// }
|
||||
|
||||
autoLeftNav();
|
||||
$(window).resize(function() {
|
||||
autoLeftNav();
|
||||
console.log($(window).width())
|
||||
});
|
||||
|
||||
// if(storageLoad('SelcetColor')){
|
||||
|
||||
// }else{
|
||||
// storageSave(saveSelectColor);
|
||||
// }
|
||||
})
|
||||
|
||||
|
||||
// 页面数据
|
||||
var pageData = {
|
||||
// ===============================================
|
||||
// 首页
|
||||
// ===============================================
|
||||
'index': function indexData() {
|
||||
$('#example-r').DataTable({
|
||||
|
||||
bInfo: false, //页脚信息
|
||||
dom: 'ti'
|
||||
});
|
||||
|
||||
|
||||
// ==========================
|
||||
// 百度图表A http://echarts.baidu.com/
|
||||
// ==========================
|
||||
|
||||
var echartsA = echarts.init(document.getElementById('tpl-echarts'));
|
||||
option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
grid: {
|
||||
top: '3%',
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value'
|
||||
}],
|
||||
textStyle: {
|
||||
color: '#838FA1'
|
||||
},
|
||||
series: [{
|
||||
name: '邮件营销',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
areaStyle: { normal: {} },
|
||||
data: [120, 132, 101, 134, 90],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#1cabdb',
|
||||
borderColor: '#1cabdb',
|
||||
borderWidth: '2',
|
||||
borderType: 'solid',
|
||||
opacity: '1'
|
||||
},
|
||||
emphasis: {
|
||||
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
echartsA.setOption(option);
|
||||
},
|
||||
// ===============================================
|
||||
// 图表页
|
||||
// ===============================================
|
||||
'chart': function chartData() {
|
||||
// ==========================
|
||||
// 百度图表A http://echarts.baidu.com/
|
||||
// ==========================
|
||||
|
||||
var echartsC = echarts.init(document.getElementById('tpl-echarts-C'));
|
||||
|
||||
|
||||
optionC = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
|
||||
legend: {
|
||||
data: ['蒸发量', '降水量', '平均温度']
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
name: '水量',
|
||||
min: 0,
|
||||
max: 250,
|
||||
interval: 50,
|
||||
axisLabel: {
|
||||
formatter: '{value} ml'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
name: '温度',
|
||||
min: 0,
|
||||
max: 25,
|
||||
interval: 5,
|
||||
axisLabel: {
|
||||
formatter: '{value} °C'
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [{
|
||||
name: '蒸发量',
|
||||
type: 'bar',
|
||||
data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
|
||||
},
|
||||
{
|
||||
name: '降水量',
|
||||
type: 'bar',
|
||||
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
|
||||
},
|
||||
{
|
||||
name: '平均温度',
|
||||
type: 'line',
|
||||
yAxisIndex: 1,
|
||||
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
echartsC.setOption(optionC);
|
||||
|
||||
var echartsB = echarts.init(document.getElementById('tpl-echarts-B'));
|
||||
optionB = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
x: 'center',
|
||||
data: ['某软件', '某主食手机', '某水果手机', '降水量', '蒸发量']
|
||||
},
|
||||
radar: [{
|
||||
indicator: [
|
||||
{ text: '品牌', max: 100 },
|
||||
{ text: '内容', max: 100 },
|
||||
{ text: '可用性', max: 100 },
|
||||
{ text: '功能', max: 100 }
|
||||
],
|
||||
center: ['25%', '40%'],
|
||||
radius: 80
|
||||
},
|
||||
{
|
||||
indicator: [
|
||||
{ text: '外观', max: 100 },
|
||||
{ text: '拍照', max: 100 },
|
||||
{ text: '系统', max: 100 },
|
||||
{ text: '性能', max: 100 },
|
||||
{ text: '屏幕', max: 100 }
|
||||
],
|
||||
radius: 80,
|
||||
center: ['50%', '60%'],
|
||||
},
|
||||
{
|
||||
indicator: (function() {
|
||||
var res = [];
|
||||
for (var i = 1; i <= 12; i++) {
|
||||
res.push({ text: i + '月', max: 100 });
|
||||
}
|
||||
return res;
|
||||
})(),
|
||||
center: ['75%', '40%'],
|
||||
radius: 80
|
||||
}
|
||||
],
|
||||
series: [{
|
||||
type: 'radar',
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
itemStyle: { normal: { areaStyle: { type: 'default' } } },
|
||||
data: [{
|
||||
value: [60, 73, 85, 40],
|
||||
name: '某软件'
|
||||
}]
|
||||
},
|
||||
{
|
||||
type: 'radar',
|
||||
radarIndex: 1,
|
||||
data: [{
|
||||
value: [85, 90, 90, 95, 95],
|
||||
name: '某主食手机'
|
||||
},
|
||||
{
|
||||
value: [95, 80, 95, 90, 93],
|
||||
name: '某水果手机'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'radar',
|
||||
radarIndex: 2,
|
||||
itemStyle: { normal: { areaStyle: { type: 'default' } } },
|
||||
data: [{
|
||||
name: '降水量',
|
||||
value: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 18.8, 6.0, 2.3],
|
||||
},
|
||||
{
|
||||
name: '蒸发量',
|
||||
value: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 35.6, 62.2, 32.6, 20.0, 6.4, 3.3]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
echartsB.setOption(optionB);
|
||||
var echartsA = echarts.init(document.getElementById('tpl-echarts-A'));
|
||||
option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
},
|
||||
legend: {
|
||||
data: ['邮件', '媒体', '资源']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
boundaryGap: true,
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
}],
|
||||
|
||||
yAxis: [{
|
||||
type: 'value'
|
||||
}],
|
||||
series: [
|
||||
{
|
||||
name: '邮件',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
areaStyle: { normal: {} },
|
||||
data: [120, 132, 101, 134, 90, 230, 210],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#59aea2'
|
||||
},
|
||||
emphasis: {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '媒体',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
areaStyle: { normal: {} },
|
||||
data: [220, 182, 191, 234, 290, 330, 310],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#e7505a'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '资源',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
areaStyle: { normal: {} },
|
||||
data: [150, 232, 201, 154, 190, 330, 410],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#32c5d2'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 通过WebSocket获取数据并刷新图表
|
||||
var ws = new WebSocket('ws://localhost:8888/ws/charts');
|
||||
ws.onmessage = function(evt) {
|
||||
var array = JSON.parse(evt.data);
|
||||
for (var i = 0; i < array.length; ++i) {
|
||||
option.series[i].data = array[i];
|
||||
}
|
||||
echartsA.setOption(option);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 风格切换
|
||||
|
||||
$('.tpl-skiner-toggle').on('click', function() {
|
||||
$('.tpl-skiner').toggleClass('active');
|
||||
})
|
||||
|
||||
$('.tpl-skiner-content-bar').find('span').on('click', function() {
|
||||
$('body').attr('class', $(this).attr('data-color'))
|
||||
saveSelectColor.Color = $(this).attr('data-color');
|
||||
// 保存选择项
|
||||
storageSave(saveSelectColor);
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
// 侧边菜单开关
|
||||
|
||||
|
||||
function autoLeftNav() {
|
||||
$('.tpl-header-switch-button').on('click', function() {
|
||||
if ($('.left-sidebar').is('.active')) {
|
||||
if ($(window).width() > 1024) {
|
||||
$('.tpl-content-wrapper').removeClass('active');
|
||||
}
|
||||
$('.left-sidebar').removeClass('active');
|
||||
} else {
|
||||
|
||||
$('.left-sidebar').addClass('active');
|
||||
if ($(window).width() > 1024) {
|
||||
$('.tpl-content-wrapper').addClass('active');
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if ($(window).width() < 1024) {
|
||||
$('.left-sidebar').addClass('active');
|
||||
} else {
|
||||
$('.left-sidebar').removeClass('active');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 侧边菜单
|
||||
$('.sidebar-nav-sub-title').on('click', function() {
|
||||
$(this).siblings('.sidebar-nav-sub').slideToggle(80)
|
||||
.end()
|
||||
.find('.sidebar-nav-sub-ico').toggleClass('sidebar-nav-sub-ico-rotate');
|
||||
})
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
var saveSelectColor = {
|
||||
'Name': 'SelcetColor',
|
||||
'Color': 'theme-black'
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 判断用户是否已有自己选择的模板风格
|
||||
if (storageLoad('SelcetColor')) {
|
||||
$('body').attr('class', storageLoad('SelcetColor').Color)
|
||||
} else {
|
||||
storageSave(saveSelectColor);
|
||||
$('body').attr('class', 'theme-black')
|
||||
}
|
||||
|
||||
|
||||
// 本地缓存
|
||||
function storageSave(objectData) {
|
||||
localStorage.setItem(objectData.Name, JSON.stringify(objectData));
|
||||
}
|
||||
|
||||
function storageLoad(objectName) {
|
||||
if (localStorage.getItem(objectName)) {
|
||||
return JSON.parse(localStorage.getItem(objectName))
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
"""
|
||||
backend_server.py - 后台服务器
|
||||
"""
|
||||
import asyncio
|
||||
import os
|
||||
import threading
|
||||
|
||||
import aiomysql
|
||||
import tornado.web
|
||||
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.platform.asyncio import AnyThreadEventLoopPolicy
|
||||
|
||||
from service.handlers.handlers_for_charts import send_data
|
||||
from service.handlers.handlers_for_nav import IndexHandler
|
||||
from service.handlers.handlers_for_tables import EmpHandler
|
||||
from service.handlers.handlers_for_charts import ChartHandler
|
||||
|
||||
|
||||
async def connect_mysql():
|
||||
return await aiomysql.connect(
|
||||
host='120.77.222.217',
|
||||
port=3306,
|
||||
db='hrs',
|
||||
charset='utf8',
|
||||
use_unicode=True,
|
||||
user='root',
|
||||
password='123456',
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
# Tornado 5开始使用线程必须指定事件循环的策略否则无法启动线程
|
||||
asyncio.set_event_loop_policy(AnyThreadEventLoopPolicy())
|
||||
# 启动通过WebSocket长连接发送数据的线程
|
||||
threading.Thread(target=send_data, daemon=True, args=(5, )).start()
|
||||
app = tornado.web.Application(
|
||||
handlers=[
|
||||
(r'/', IndexHandler),
|
||||
(r'/api/emps', EmpHandler),
|
||||
(r'/ws/charts', ChartHandler),
|
||||
],
|
||||
template_path=os.path.join(os.path.dirname(__file__), 'templates'),
|
||||
static_path=os.path.join(os.path.dirname(__file__), 'assets'),
|
||||
cookie_secret='MWM2MzEyOWFlOWRiOWM2MGMzZThhYTk0ZDNlMDA0OTU=',
|
||||
mysql=IOLoop.current().run_sync(connect_mysql),
|
||||
debug=True
|
||||
)
|
||||
app.listen(8888)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
aiomysql==0.0.20
|
||||
asn1crypto==0.24.0
|
||||
cffi==1.12.2
|
||||
cryptography==2.6.1
|
||||
pycparser==2.19
|
||||
PyMySQL==0.9.2
|
||||
six==1.12.0
|
||||
tornado==5.1.1
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import json
|
||||
import random
|
||||
import time
|
||||
|
||||
import tornado.websocket
|
||||
|
||||
clients_set = set()
|
||||
|
||||
|
||||
class ChartHandler(tornado.websocket.WebSocketHandler):
|
||||
|
||||
def open(self):
|
||||
clients_set.add(self)
|
||||
|
||||
def on_close(self):
|
||||
clients_set.remove(self)
|
||||
|
||||
|
||||
def gen_mock_data(num_of_series, num_of_sample):
|
||||
data = []
|
||||
for _ in range(num_of_series):
|
||||
series = []
|
||||
for _ in range(num_of_sample):
|
||||
series.append(random.randint(50, 500))
|
||||
data.append(series)
|
||||
return data
|
||||
|
||||
|
||||
def send_data(delay):
|
||||
while True:
|
||||
for ws_client in clients_set:
|
||||
data = gen_mock_data(3, 7)
|
||||
ws_client.write_message(json.dumps(data).encode())
|
||||
time.sleep(delay)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import tornado
|
||||
|
||||
|
||||
class IndexHandler(tornado.web.RequestHandler):
|
||||
|
||||
async def get(self, *args, **kwargs):
|
||||
return await self.render('index.html')
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import json
|
||||
|
||||
import aiomysql
|
||||
import tornado
|
||||
|
||||
|
||||
class EmpHandler(tornado.web.RequestHandler):
|
||||
|
||||
async def get(self, *args, **kwargs):
|
||||
async with self.settings['mysql'].cursor(aiomysql.DictCursor) as cursor:
|
||||
await cursor.execute("select eno as no, ename as name, job, sal, intro from tb_emp")
|
||||
emps = list(await cursor.fetchall())
|
||||
self.finish(json.dumps(emps))
|
||||
|
|
@ -0,0 +1,511 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>后台数据监控项目</title>
|
||||
<meta name="description" content="这是一个 index 页面">
|
||||
<meta name="keywords" content="index">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="icon" type="image/png" href="{{ static_url('i/favicon.png') }}">
|
||||
<link rel="apple-touch-icon-precomposed" href="{{ static_url('i/app-icon72x72@2x.png') }}">
|
||||
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
|
||||
<script src="{{ static_url('js/echarts.min.js') }}"></script>
|
||||
<link rel="stylesheet" href="{{ static_url('css/amazeui.min.css') }}" />
|
||||
<link rel="stylesheet" href="{{ static_url('css/amazeui.datatables.min.css') }}" />
|
||||
<link rel="stylesheet" href="{{ static_url('css/app.css') }}">
|
||||
<script src="{{ static_url('js/jquery.min.js') }}"></script>
|
||||
</head>
|
||||
<body data-type="index">
|
||||
<script src="{{ static_url('js/theme.js') }}"></script>
|
||||
<div class="am-g tpl-g">
|
||||
<!-- 头部 -->
|
||||
<header>
|
||||
<!-- logo -->
|
||||
<div class="am-fl tpl-header-logo">
|
||||
<a href="javascript:;"><img src="{{ static_url('img/logo.png') }}" alt=""></a>
|
||||
</div>
|
||||
<!-- 右侧内容 -->
|
||||
<div class="tpl-header-fluid">
|
||||
<!-- 侧边切换 -->
|
||||
<div class="am-fl tpl-header-switch-button am-icon-list">
|
||||
<span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
<div class="am-fl tpl-header-search">
|
||||
<form class="tpl-header-search-form" action="javascript:;">
|
||||
<button class="tpl-header-search-btn am-icon-search"></button>
|
||||
<input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
|
||||
</form>
|
||||
</div>
|
||||
<!-- 其它功能-->
|
||||
<div class="am-fr tpl-header-navbar">
|
||||
<ul>
|
||||
<!-- 欢迎语 -->
|
||||
<li class="am-text-sm tpl-header-navbar-welcome">
|
||||
<a href="javascript:;">欢迎你, <span>Amaze UI</span> </a>
|
||||
</li>
|
||||
|
||||
<!-- 新邮件 -->
|
||||
<li class="am-dropdown tpl-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-envelope"></i>
|
||||
<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
|
||||
</a>
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="{{ static_url('img/user04.png') }}" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
3小时前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-success"></i>
|
||||
<span>夕风色</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> Amaze UI 的诞生,依托于 GitHub 及其他技术社区上一些优秀的资源;Amaze UI 的成长,则离不开用户的支持。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<div class="menu-messages-ico">
|
||||
<img src="{{ static_url('img/user02.png') }}" alt="">
|
||||
</div>
|
||||
<div class="menu-messages-time">
|
||||
5天前
|
||||
</div>
|
||||
<div class="menu-messages-content">
|
||||
<div class="menu-messages-content-title">
|
||||
<i class="am-icon-circle-o am-text-warning"></i>
|
||||
<span>禁言小张</span>
|
||||
</div>
|
||||
<div class="am-text-truncate"> 为了能最准确的传达所描述的问题, 建议你在反馈时附上演示,方便我们理解。 </div>
|
||||
<div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-messages">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
|
||||
<i class="am-icon-circle-o"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 新提示 -->
|
||||
<li class="am-dropdown" data-am-dropdown>
|
||||
<a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
|
||||
<i class="am-icon-bell"></i>
|
||||
<span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
|
||||
</a>
|
||||
|
||||
<!-- 弹出列表 -->
|
||||
<ul class="am-dropdown-content tpl-dropdown-content">
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-line-chart"></i>
|
||||
<span> 有6笔新的销售订单</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
12分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-star"></i>
|
||||
<span> 有3个来自人事部的消息</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
30分钟前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<div class="tpl-dropdown-menu-notifications-title">
|
||||
<i class="am-icon-folder-o"></i>
|
||||
<span> 上午开会记录存档</span>
|
||||
</div>
|
||||
<div class="tpl-dropdown-menu-notifications-time">
|
||||
1天前
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="tpl-dropdown-menu-notifications">
|
||||
<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
|
||||
<i class="am-icon-bell"></i> 进入列表…
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- 退出 -->
|
||||
<li class="am-text-sm">
|
||||
<a href="javascript:;">
|
||||
<span class="am-icon-sign-out"></span> 退出
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<!-- 风格切换 -->
|
||||
<div class="tpl-skiner">
|
||||
<div class="tpl-skiner-toggle am-icon-cog">
|
||||
</div>
|
||||
<div class="tpl-skiner-content">
|
||||
<div class="tpl-skiner-content-title">
|
||||
选择主题
|
||||
</div>
|
||||
<div class="tpl-skiner-content-bar">
|
||||
<span class="skiner-color skiner-white" data-color="theme-white"></span>
|
||||
<span class="skiner-color skiner-black" data-color="theme-black"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边导航栏 -->
|
||||
<div class="left-sidebar">
|
||||
<!-- 用户信息 -->
|
||||
<div class="tpl-sidebar-user-panel">
|
||||
<div class="tpl-user-panel-slide-toggleable">
|
||||
<div class="tpl-user-panel-profile-picture">
|
||||
<img src="{{ static_url('img/user04.png') }}" alt="">
|
||||
</div>
|
||||
<span class="user-panel-logged-in-text">
|
||||
<i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
|
||||
禁言小张
|
||||
</span>
|
||||
<a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 菜单 -->
|
||||
<ul class="sidebar-nav">
|
||||
<li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="/" class="active">
|
||||
<i class="am-icon-home sidebar-nav-link-logo"></i> 首页
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/tables.html') }}">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 表格
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/calendar.html') }}">
|
||||
<i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/form.html') }}">
|
||||
<i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/chart.html') }}">
|
||||
<i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="javascript:;" class="sidebar-nav-sub-title">
|
||||
<i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
|
||||
<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
|
||||
</a>
|
||||
<ul class="sidebar-nav sidebar-nav-sub">
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/table-list.html') }}">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/table-list-img.html') }}">
|
||||
<span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/sign-up.html') }}">
|
||||
<i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
|
||||
<span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/login.html') }}">
|
||||
<i class="am-icon-key sidebar-nav-link-logo"></i> 登录
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-nav-link">
|
||||
<a href="{{ static_url('html/404.html') }}">
|
||||
<i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<div class="tpl-content-wrapper">
|
||||
<div class="container-fluid am-cf">
|
||||
<div class="row">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
|
||||
<div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 部件首页 <small>Amaze UI</small></div>
|
||||
<p class="page-header-description">Amaze UI 含近 20 个 CSS 组件、20 余 JS 组件,更有多个包含不同主题的 Web 组件。</p>
|
||||
</div>
|
||||
<div class="am-u-lg-3 tpl-index-settings-button">
|
||||
<button type="button" class="page-header-button"><span class="am-icon-paint-brush"></span> 设置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-content am-cf">
|
||||
<div class="row am-cf">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-4">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">月度财务收支计划</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body am-fr">
|
||||
<div class="am-fl">
|
||||
<div class="widget-fluctuation-period-text">
|
||||
¥61746.45
|
||||
<button class="widget-fluctuation-tpl-btn">
|
||||
<i class="am-icon-calendar"></i>
|
||||
更多月份
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-fr am-cf">
|
||||
<div class="widget-fluctuation-description-amount text-success" am-cf>
|
||||
+¥30420.56
|
||||
|
||||
</div>
|
||||
<div class="widget-fluctuation-description-text am-text-right">
|
||||
8月份收入
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="am-u-sm-12 am-u-md-6 am-u-lg-4">
|
||||
<div class="widget widget-primary am-cf">
|
||||
<div class="widget-statistic-header">
|
||||
本季度利润
|
||||
</div>
|
||||
<div class="widget-statistic-body">
|
||||
<div class="widget-statistic-value">
|
||||
¥27,294
|
||||
</div>
|
||||
<div class="widget-statistic-description">
|
||||
本季度比去年多收入 <strong>2593元</strong> 人民币
|
||||
</div>
|
||||
<span class="widget-statistic-icon am-icon-credit-card-alt"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-u-sm-12 am-u-md-6 am-u-lg-4">
|
||||
<div class="widget widget-purple am-cf">
|
||||
<div class="widget-statistic-header">
|
||||
本季度利润
|
||||
</div>
|
||||
<div class="widget-statistic-body">
|
||||
<div class="widget-statistic-value">
|
||||
¥27,294
|
||||
</div>
|
||||
<div class="widget-statistic-description">
|
||||
本季度比去年多收入 <strong>2593元</strong> 人民币
|
||||
</div>
|
||||
<span class="widget-statistic-icon am-icon-support"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row am-cf">
|
||||
<div class="am-u-sm-12 am-u-md-8">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">月度财务收支计划</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body-md widget-body tpl-amendment-echarts am-fr" id="tpl-echarts">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-4">
|
||||
<div class="widget am-cf">
|
||||
<div class="widget-head am-cf">
|
||||
<div class="widget-title am-fl">专用服务器负载</div>
|
||||
<div class="widget-function am-fr">
|
||||
<a href="javascript:;" class="am-icon-cog"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body widget-body-md am-fr">
|
||||
<div class="am-progress-title">CPU Load <span class="am-fr am-progress-title-more">28% / 100%</span></div>
|
||||
<div class="am-progress">
|
||||
<div class="am-progress-bar" style="width: 15%"></div>
|
||||
</div>
|
||||
<div class="am-progress-title">CPU Load <span class="am-fr am-progress-title-more">28% / 100%</span></div>
|
||||
<div class="am-progress">
|
||||
<div class="am-progress-bar am-progress-bar-warning" style="width: 75%"></div>
|
||||
</div>
|
||||
<div class="am-progress-title">CPU Load <span class="am-fr am-progress-title-more">28% / 100%</span></div>
|
||||
<div class="am-progress">
|
||||
<div class="am-progress-bar am-progress-bar-danger" style="width: 35%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row am-cf">
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-4 widget-margin-bottom-lg ">
|
||||
<div class="tpl-user-card am-text-center widget-body-lg">
|
||||
<div class="tpl-user-card-title">
|
||||
禁言小张
|
||||
</div>
|
||||
<div class="achievement-subheading">
|
||||
月度最佳员工
|
||||
</div>
|
||||
<img class="achievement-image" src="{{ static_url('img/user07.png') }}" alt="">
|
||||
<div class="achievement-description">
|
||||
禁言小张在
|
||||
<strong>30天内</strong> 禁言了
|
||||
<strong>200多</strong>人。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12 am-u-lg-8 widget-margin-bottom-lg">
|
||||
<div class="widget am-cf widget-body-lg">
|
||||
<div class="widget-body am-fr">
|
||||
<div class="am-scrollable-horizontal ">
|
||||
<table width="100%" class="am-table am-table-compact am-text-nowrap tpl-table-black " id="example-r">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章标题</th>
|
||||
<th>作者</th>
|
||||
<th>时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX">
|
||||
<td>新加坡大数据初创公司 Latize 获 150 万美元风险融资</td>
|
||||
<td>张鹏飞</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>自拍的“政治角色”:观众背对希拉里自拍合影表示“支持”</td>
|
||||
<td>天纵之人</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gradeX">
|
||||
<td>关于创新管理,我想和你当面聊聊。</td>
|
||||
<td>王宽师</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>究竟是趋势带动投资,还是投资引领趋势?</td>
|
||||
<td>着迷</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even gradeC">
|
||||
<td>Docker领域再添一员,网易云发布“蜂巢”,加入云计算之争</td>
|
||||
<td>醉里挑灯看键</td>
|
||||
<td>2016-09-26</td>
|
||||
<td>
|
||||
<div class="tpl-table-black-operation">
|
||||
<a href="javascript:;">
|
||||
<i class="am-icon-pencil"></i> 编辑
|
||||
</a>
|
||||
<a href="javascript:;" class="tpl-table-black-operation-del">
|
||||
<i class="am-icon-trash"></i> 删除
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{{ static_url('js/amazeui.min.js') }}"></script>
|
||||
<script src="{{ static_url('js/amazeui.datatables.min.js') }}"></script>
|
||||
<script src="{{ static_url('js/dataTables.responsive.min.js') }}"></script>
|
||||
<script src="{{ static_url('js/app.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 204 KiB |