您现在的位置是: 网站首页 >Flask >Flask搭建微电影视频网站 Flask

【Flask微电影】10.搭建后台页面-会员管理、评论管理

admin2018年11月3日 19:06 Flask | Html | Python 1723人已围观

Flask搭建微电影视频网站简介 利用Flask搭建微电影视频网站 Github地址:https://github.com/xyliurui/FlaskMovie

## 搭建后台会员管理页面 ### 添加user_list.html会员列表页面 ```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> &nbsp; <a class="label label-info">解冻</a> &nbsp; <a class="label label-warning">冻结</a> &nbsp; <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](/media/blog/images/2018/11/BLOG_20181103_190948_25.png "博客图集BLOG_20181103_190948_25.png") ### 添加user_view.html会员详情页面 ```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](/media/blog/images/2018/11/BLOG_20181103_190959_78.png "博客图集BLOG_20181103_190959_78.png") ### 添加会员管理视图 ```python @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添加会员链接和激活 ```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评论列表页面 ```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> &nbsp; 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](/media/blog/images/2018/11/BLOG_20181103_191033_16.png "博客图集BLOG_20181103_191033_16.png") ### 添加评论管理视图 ```python @admin.route("/comment/list/") def comment_list(): return render_template('admin/comment_list.html') ``` ### 修改base.html添加评论链接和激活 ```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> ```

很赞哦! (0)

文章交流

  • emoji
0人参与,0条评论

当前用户

未登录,点击   登录

站点信息

  • 建站时间:网站已运行2285天
  • 系统信息:Linux
  • 后台程序:Python: 3.8.10
  • 网站框架:Django: 3.2.6
  • 文章统计:257 篇
  • 文章评论:63 条
  • 腾讯分析网站概况-腾讯分析
  • 百度统计网站概况-百度统计
  • 公众号:微信扫描二维码,关注我们
  • QQ群:QQ加群,下载网站的学习源码
返回
顶部
标题 换行 登录
网站