registration.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Aisky-CowdungCart</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  8. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  9. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  10. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  11. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  12. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  13. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  14. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  15. <script src="../static/js/registration.js"></script>
  16. <link rel="stylesheet" href="../static/css/registration.css">
  17. <script>
  18. function Registration(){
  19. var firstname = $("input[name='firstname']").val();
  20. var lastname = $("input[name='lastname']").val();
  21. var email = $("input[name='email']").val();
  22. var phone = $("input[name='phone']").val();
  23. var username = $("input[name='username']").val();
  24. var password = $("input[name='password']").val();
  25. var confirmpwd = $("input[name='confirmpwd']").val();
  26. var data = {"firstname":firstname, "lastname":lastname, "email":email, "phone":phone, "username":username, "password":password};
  27. $.ajax({
  28. url: "/login",
  29. type: "post",
  30. data: data,
  31. dataType: "json",
  32. success: function(res){
  33. if(res.access_token){
  34. console.log("test");
  35. localStorage.setItem('Hello', res.access_token);
  36. window.location.href='/';
  37. };
  38. },
  39. });
  40. };
  41. </script>
  42. </head>
  43. <body>
  44. <div class="container">
  45. <div class="row">
  46. <div class="col-2"></div>
  47. <div class="col">
  48. <img src="../static/img/logo_new.png" class="img-fluid">
  49. <h1 class="text-center">Registration</h1>
  50. <!--<form method="post" action="/register">-->
  51. <div class="form">
  52. <div class="wrong-info"><span id="firstname-span"></span></div>
  53. <div class="form-inline">
  54. <label for="first">First Name</label>
  55. <input type="text" class="form-control" id="first" name="firstname">
  56. </div>
  57. <div class="wrong-info"><span id="lastname-span"></span></div>
  58. <div class="form-inline">
  59. <label for="last">Last Name</label>
  60. <input type="text" class="form-control" id="last" name="lastname">
  61. </div>
  62. <div class="wrong-info"><span id="email-span"></span></div>
  63. <div class="form-inline">
  64. <label for="email">Email</label>
  65. <input type="email" class="form-control" id="email" name="email">
  66. </div>
  67. <div class="wrong-info"><span id="phone-span"></span></div>
  68. <div class="form-inline">
  69. <label for="phone">Phone</label>
  70. <input type="number" class="form-control" id="phone" name="phone">
  71. </div>
  72. <div class="wrong-info"><span id="username-span"></span></div>
  73. <div class="form-inline">
  74. <label for="usr">User Name</label>
  75. <input type="text" class="form-control" id="usr" name="username">
  76. </div>
  77. <div class="wrong-info"><span id="password-span"></span></div>
  78. <div class="form-inline">
  79. <label for="pwd">Password</label>
  80. <input type="password" class="form-control" id="pwd" name="password">
  81. </div>
  82. <div class="wrong-info"><span></span></div>
  83. <div class="form-inline">
  84. <label for="cpwd">Confirm Password</label>
  85. <input type="password" class="form-control" id="cpwd" name="confirmpwd">
  86. </div>
  87. </div>
  88. <div class="text-center">
  89. <input type="submit" class="btn btn-info" value="Register" onclick="Registration()" style="margin-right:70px;">
  90. <input type="button" class="btn btn-info" value="Cancel" onclick="Login()">
  91. </div>
  92. <!--</form>-->
  93. </div>
  94. <div class="col-2"></div>
  95. </div>
  96. </div>
  97. </body>
  98. </html>