10、Flask构建弹幕微电影网站-搭建后台页面-会员管理、评论
2019-04-13 本文已影响0人
攻城狮笔记
【百度云搜索,搜各种资料:http://www.81ad.cn】
Flask 构建微电影视频网站
已上线演示地址: http://movie.tbquan.cn
搭建后台会员管理页面
添加user_list.html会员列表页面
{% extends 'admin/base.html' %}
{% block content %}
<section class="content-header">
<h1>微电影管理系统</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> 会员管理</a></li>
<li class="active">会员列表</li>
</ol>
</section>
<section class="content" id="showcontent">
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header">
<h3 class="box-title">会员列表</h3>
<div class="box-tools">
<div class="input-group input-group-sm" style="width: 150px;">
<input type="text" name="table_search" class="form-control pull-right"
placeholder="请输入关键字...">
<div class="input-group-btn">
<button type="submit" class="btn btn-default"><i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tbody>
<tr>
<th>编号</th>
<th>昵称</th>
<th>邮箱</th>
<th>手机</th>
<th>头像</th>
<th>状态</th>
<th>注册时间</th>
<th>操作事项</th>
</tr>
<tr>
<td>1</td>
<td>拓荒者</td>
<td>1780316635@qq.com</td>
<td>13700632835</td>
<td>
<img data-src="holder.js/50x50" class="img-responsive center-block" alt="">
</td>
<td>正常/冻结</td>
<td>2017-06-01 12:00:00</td>
<td>
<a class="label label-success" href="{{ url_for('admin.user_view') }}">查看</a>
<a class="label label-info">解冻</a>
<a class="label label-warning">冻结</a>
<a class="label label-danger">删除</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer clearfix">
<ul class="pagination pagination-sm no-margin pull-right">
<li><a href="#">首页</a></li>
<li><a href="#">上一页</a></li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">下一页</a></li>
<li><a href="#">尾页</a></li>
</ul>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
{% block js %}
<script>
// 激活菜单栏
$(document).ready(function () {
$("#g-5").addClass('active');
$("#g-5-1").addClass('active');
})
</script>
{% endblock %}
BLOG_20181103_190948_25
添加user_view.html会员详情页面
{% extends 'admin/base.html' %}
{% block css %}
<style>
.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
vertical-align:middle;
text-align:left;
}
.td_bd{
font-weight:bold;
}
</style>
{% endblock %}
{% block content %}
<section class="content-header">
<h1>微电影管理系统</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> 会员管理</a></li>
<li class="active">查看会员</li>
</ol>
</section>
<section class="content" id="showcontent">
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header">
<h3 class="box-title">会员详情</h3>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tbody>
<tr>
<td class="td_bd">编号:</td>
<td>1</td>
</tr>
<tr>
<td class="td_bd">昵称:</td>
<td>拓荒者</td>
</tr>
<tr>
<td class="td_bd">邮箱:</td>
<td>1780316635@qq.com</td>
</tr>
<tr>
<td class="td_bd">手机:</td>
<td>13700632835</td>
</tr>
<tr>
<td class="td_bd">头像:</td>
<td>
<img data-src="holder.js/100x100" class="img-responsive" alt="">
</td>
</tr>
<tr>
<td class="td_bd">注册时间:</td>
<td>
2017-01-01 12:00:00
</td>
</tr>
<tr>
<td class="td_bd">唯一标志符:</td>
<td>
xxxxxx
</td>
</tr>
<tr>
<td class="td_bd">个性简介:</td>
<td>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
{% block js %}
<script>
// 激活菜单栏
$(document).ready(function () {
$("#g-5").addClass('active');
$("#g-5-1").addClass('active');
})
</script>
{% endblock %}
BLOG_20181103_190959_78
添加会员管理视图
@admin.route("/user/list/")
def user_list():
return render_template('admin/user_list.html')
@admin.route("/user/view/")
def user_view():
return render_template('admin/user_view.html')
修改base.html添加会员链接和激活
<li class="treeview" id="g-5">
<a href="#">
<i class="fa fa-users" aria-hidden="true"></i>
<span>会员管理</span>
<span class="label label-primary pull-right">1</span>
</a>
<ul class="treeview-menu">
<li id="g-5-1">
<a href="{{ url_for('admin.user_list') }}">
<i class="fa fa-circle-o"></i> 会员列表
</a>
</li>
</ul>
</li>
搭建后台评论管理页面
添加comment_list.html评论列表页面
{% extends 'admin/base.html' %}
{% block css %}
{% endblock %}
{% block content %}
<section class="content-header">
<h1>微电影管理系统</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> 评论管理</a></li>
<li class="active">评论列表</li>
</ol>
</section>
<section class="content" id="showcontent">
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">评论列表</h3>
<div class="box-tools">
<div class="input-group input-group-sm" style="width: 150px;">
<input type="text" name="table_search" class="form-control pull-right"
placeholder="请输入关键字...">
<div class="input-group-btn">
<button type="submit" class="btn btn-default"><i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
<div class="box-body box-comments">
{% for i in range(5) %}
<div class="box-comment">
<img class="img-circle img-sm"
src="{{ url_for('static',filename='admin/dist/img/user3-128x128.jpg') }}" alt="User Image">
<div class="comment-text">
<span class="username">
小美
<span class="text-muted pull-right">
<i class="fa fa-calendar" aria-hidden="true"></i>
2017-01-01 12:00:00
</span>
</span>
关于电影<a>《环太平洋》</a>的评论:xxx
<br><a class="label label-danger pull-right">删除</a>
</div>
</div>
{% endfor %}
</div>
<div class="box-footer clearfix">
<ul class="pagination pagination-sm no-margin pull-right">
<li><a href="#">首页</a></li>
<li><a href="#">上一页</a></li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">下一页</a></li>
<li><a href="#">尾页</a></li>
</ul>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
{% block js %}
<script>
// 激活菜单栏
$(document).ready(function () {
$("#g-6").addClass('active');
$("#g-6-1").addClass('active');
})
</script>
{% endblock %}
BLOG_20181103_191033_16
添加评论管理视图
@admin.route("/comment/list/")
def comment_list():
return render_template('admin/comment_list.html')
修改base.html添加评论链接和激活
<li class="treeview" id="g-6">
<a href="#">
<i class="fa fa-comments" aria-hidden="true"></i>
<span>评论管理</span>
<span class="label label-primary pull-right">1</span>
</a>
<ul class="treeview-menu">
<li id="g-6-1">
<a href="{{ url_for('admin.comment_list') }}">
<i class="fa fa-circle-o"></i> 评论列表
</a>
</li>
</ul>
</li>