美文网首页Flask微电影网站开发
【Flask微电影】11.搭建后台页面-收藏管理、日志管理

【Flask微电影】11.搭建后台页面-收藏管理、日志管理

作者: 吾星喵 | 来源:发表于2018-11-03 19:16 被阅读21次

    个人博客,欢迎查看:https://blog.starmeow.cn/

    Github地址:https://github.com/xyliurui/FlaskMovie

    搭建后台收藏管理页面

    添加collect_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>
                                </tr>
                                {% for i in range(5) %}
                                <tr>
                                    <td>1</td>
                                    <td>环太平洋</td>
                                    <td>张小明</td>
                                    <td>2017-06-01</td>
                                    <td>
                                        <a class="label label-success">编辑</a>
                                        &nbsp;
                                        <a class="label label-danger">删除</a>
                                    </td>
                                </tr>
                                {% endfor %}
                                </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-7").addClass('active');
                $("#g-7-1").addClass('active');
            })
        </script>
    {% endblock %}
    
    image.png

    添加收藏管理视图

    @admin.route("/collect/list/")
    def collect_list():
        return render_template('admin/collect_list.html')
    

    修改base.html添加收藏管理链接和激活

    <li class="treeview" id="g-7">
        <a href="#">
            <i class="fa fa-heart" aria-hidden="true"></i>
            <span>收藏管理</span>
            <span class="label label-primary pull-right">1</span>
        </a>
        <ul class="treeview-menu">
            <li id="g-7-1">
                <a href="{{ url_for('admin.collect_list') }}">
                    <i class="fa fa-circle-o"></i> 收藏列表
                </a>
            </li>
        </ul>
    </li>
    

    搭建后台日志管理页面

    添加logs_operate_log.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>操作IP</th>
                                </tr>
                                <tr>
                                    <td>1</td>
                                    <td>admin</td>
                                    <td>2017-06-01</td>
                                    <td>添加一个标签:科幻</td>
                                    <td>192.168.4.1</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-8").addClass('active');
                $("#g-8-1").addClass('active');
            })
        </script>
    {% endblock %}
    
    image.png

    添加logs_admin_log.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>登录IP</th>
                                </tr>
                                <tr>
                                    <td>1</td>
                                    <td>admin</td>
                                    <td>2017-06-01</td>
                                    <td>192.168.4.1</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-8").addClass('active');
                $("#g-8-2").addClass('active');
            })
        </script>
    {% endblock %}
    
    image.png

    添加logs_user_log.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>登录IP</th>
                                </tr>
                                <tr>
                                    <td>1</td>
                                    <td>张小明</td>
                                    <td>2017-06-01</td>
                                    <td>192.168.4.1</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-8").addClass('active');
                $("#g-8-3").addClass('active');
            })
        </script>
    {% endblock %}
    
    image.png

    添加日志管理视图

    @admin.route("/logs/operate_log/")
    def logs_operate_log():
        return render_template('admin/logs_operate_log.html')
    
    
    @admin.route("/logs/admin_log/")
    def logs_admin_log():
        return render_template('admin/logs_admin_log.html')
    
    
    @admin.route("/logs/user_log/")
    def logs_user_log():
        return render_template('admin/logs_user_log.html')
    

    修改base.html添加日志管理链接和激活

    <li class="treeview" id="g-8">
        <a href="#">
            <i class="fa fa-file-text" aria-hidden="true"></i>
            <span>日志管理</span>
            <span class="label label-primary pull-right">3</span>
        </a>
        <ul class="treeview-menu">
            <li id="g-8-1">
                <a href="{{ url_for('admin.logs_operate_log') }}">
                    <i class="fa fa-circle-o"></i> 操作日志列表
                </a>
            </li>
            <li id="g-8-2">
                <a href="{{ url_for('admin.logs_admin_log') }}">
                    <i class="fa fa-circle-o"></i> 管理员登录日志列表
                </a>
            </li>
            <li id="g-8-3">
                <a href="{{ url_for('admin.logs_user_log') }}">
                    <i class="fa fa-circle-o"></i> 会员登录日志列表
                </a>
            </li>
        </ul>
    </li>
    

    相关文章

      网友评论

        本文标题:【Flask微电影】11.搭建后台页面-收藏管理、日志管理

        本文链接:https://www.haomeiwen.com/subject/vyflxqtx.html