英雄管理系统

该博客介绍了英雄管理系统的实现,包括HTML页面(add.html, edit.html, index.html, login.html)和JavaScript部分。讨论了数据库连接(如果不存在则创建)、Model的创建用于增删改查,以及接口编写,如英雄列表查询、详情查询、编辑、删除和新增。还提到了接口逻辑思维图以及用户注册和登录功能。" 113671520,10293425,Python实现朴素贝叶斯文本分类,"['Python', '机器学习', '文本处理', '分类算法', '朴素贝叶斯']
摘要由CSDN通过智能技术生成

CSS内容

add.html

<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="./lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />

    <!--
        HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries
      -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .wrap {
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: url('images/bg03.jpg') center bottom no-repeat;
            overflow: auto;
        }

        .navbar-brand {
            padding: 10px 15px;
        }

        .page-title {
            font-size: 16px;
            font-weight: bold;
        }

        .file-input {
            outline: none;
            display: inline-block;
            margin-top: 5px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-horizontal {
            margin-top: 10px;
        }

        .logout {
            font-weight: 900;
            font-size: 20px;
            color: #ff0000;
            text-decoration: none;
        }

        .logout:hover {
            text-decoration: none;
            color: yellowgreen;
        }

        .preview {
            width: 100px;
            height: 100px;
        }
    </style>
</head>

<body>
<div class="wrap">
    <nav class="navbar  navbar-inverse navbar-static-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#mymenu">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#"><img src="images/logo.png"></a>
            </div>
        </div>
    </nav>

    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading clearfix">
                        <div class="row">
                            <div class="col-md-6 page-title">新增英雄</div>
                            <div class="col-md-6 text-right">当前位置:首页 &gt; 新增英雄</div>
                        </div>
                    </div>
                    <div class="panel-body">
                        <form action="#" method="" class="form-horizontal">
                            <div class="form-group">
                                <label for="heroName" class="col-sm-2 control-label">姓名</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="heroName" name="name" placeholder="请输入姓名" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="skillName" class="col-sm-2 control-label">技能</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="skillName" name="skill" placeholder="请输入技能" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="heroIcon" class="col-sm-2 control-label">头像</label>
                                <div class="col-sm-10">
                                    <input type="file" class="file-input" id="heroIcon" name="icon" />
                                    <img src="" class="preview" alt="" />
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button type="submit" class="btn btn-success btn-add">
                                        新 增
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

</html>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="./lib/bootstrap/js/jquery-1.12.4.js"></script>
<!--
  Include all compiled plugins (below), or include individual files as needed
-->
<script src="./lib/bootstrap/js/bootstrap.min.js"></script>
<script>
    $(function () {
        $('#heroIcon').on('change', function () {
            var dataFile=URL.createObjectURL(this.files[0]);
            $('.preview').attr('src',dataFile);
            // console.log(dataFile)
        });
        $('.btn-add').on('click', function (e) {
            e.preventDefault();
            var fromData = new FormData($('form')[0]);
            $.ajax({
                type: 'post',
                url: 'http://localhost:4399/hero/add',
                data: fromData,
                contentType:false,
                processData:false,
                success: function (res) {
                    // console.log(r)
                    console.log(res)
                    if(res.code==201){
                        alert(res.msg);
                        window.location.href='./index.html';
                        return;
                    }
                    alert(res.msg)
                }
            })
        })


    })


</script>

edit.html

<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="./lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />

    <!--
        HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries
      -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .wrap {
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: url('images/bg03.jpg') center bottom no-repeat;
            overflow: auto;
        }

        .navbar-brand {
            padding: 10px 15px;
        }

        .page-title {
            font-size: 16px
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值