qwb0614

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
  187 随笔 :: 0 文章 :: 0 评论 :: 2048 阅读
复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>欢迎注册</title>
  <link href="css/register.css" rel="stylesheet">
</head>
<body>

<div class="form-div" id="form-div">
  <div class="reg-content">
    <h1>欢迎注册</h1>
    <span>已有帐号?</span> <a href="index2.jsp">登录</a>
  </div>
  <form id="reg-form" action="" method="post">

    <table>

      <tr>
        <td>用户名</td>
        <td class="inputs">
          <input name="username" type="text" id="username" v-model="user.username">

        </td>

      </tr>
      <tr>
        <td>密码</td>
        <td class="inputs">
          <input name="password" type="password" id="password" v-model="user.password">
        </td>
      </tr>

      <tr>
        <td>验证码</td>
        <td class="inputs">
          <input name="checkCode" type="text" id="checkCode" v-model="user.checkcode" >
          <img id="checkCodeImg" src="/Login/user/checkCode" >

          <a href="" id="changeImg" >看不清?</a>
          <br>
        </td>
      </tr>

    </table>

    <div class="buttons">
      <input value="注 册" type="button" id="reg_btn" @click="submitForm">
    </div>
    <br class="clear">
  </form>

</div>
<script src="js/axios-0.18.0.js"></script>

<script src="js/vue.js"></script>
<script src="element-ui/lib/index.js"></script>
<link rel="stylesheet" href="element-ui/lib/theme-chalk/index.css">


<script>

  document.getElementById("changeImg").onclick = function () {
    document.getElementById("checkCodeImg").src = "/Login/user/checkCode?"+new Date().getMilliseconds();

  }
  document.getElementById("checkCodeImg").onclick = function () {
    document.getElementById("checkCodeImg").src = "/Login/user/checkCode?"+new Date().getMilliseconds();
  }
</script>


<script>
  new Vue({
    el:"#form-div",
    data(){
      return {
        user:{
          username:"",
          password:"",
          checkcode:""
        },

      }
    },

    methods:{
      submitForm(){
        console.log(this.user);
        // 发送ajax请求,添加
        var _this=this;
        axios({
          method:"post",
          url:"http://localhost:8080/Login/user/register",
          data:_this.user
        }).then(function (resp)
        {

          if(resp.data == "success") {
            location.href = "index.html";
          }
        else if(resp.data == "error")
          _this.$message.error('账号已存在');
        else
            _this.$message.error('验证码错误');
        })

      }
    }


  })
</script>



</body>
</html>
复制代码

注册界面的搭建

posted on   嘎嘎鸭1  阅读(14)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示