login.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,
  6. width=device-width,initial-scale=1.0">
  7. <title>调查</title>
  8. <!-- import CSS -->
  9. <link rel="stylesheet" href="static/index.css">
  10. </head>
  11. <style>
  12. body {
  13. margin: 0;
  14. padding: 40px 0 0;
  15. height: calc(100vh - 40px);
  16. background: linear-gradient(0deg, #CEF0FF, #FFFFFF);
  17. }
  18. #app {
  19. display: none;
  20. }
  21. .logo-img {
  22. width: 150px;
  23. margin: 0 auto;
  24. }
  25. .el-form {
  26. padding: 35px;
  27. }
  28. .el-input__inner {
  29. height: 48px;
  30. padding-left: 42px;
  31. border: 1px solid #EFF0F2;
  32. border-radius: 5px;
  33. }
  34. .el-form-item img {
  35. position: absolute;
  36. top: 8px;
  37. left: 6px;
  38. }
  39. .el-button--primary {
  40. margin-top: 29px;
  41. height: 48px;
  42. font-size: 18px;
  43. width: 100%;
  44. background-color: #3780CD;
  45. }
  46. .tpl_title {
  47. font-size: 18px;
  48. margin-bottom: 20px;
  49. }
  50. .el-form-item__label {
  51. float: none;
  52. }
  53. .imgcode .el-input{
  54. width: 62%;
  55. /* background: #b4bccc; */
  56. }
  57. .imgcode .el-input__inner{
  58. padding-left: 6px!important;
  59. }
  60. .imgcode img{
  61. position: absolute;
  62. right: 10px!important;
  63. left: auto;
  64. }
  65. </style>
  66. <body>
  67. <div id="app">
  68. <div class='logo-img'><img src="static/logo.png" alt=""></div>
  69. <el-form>
  70. <el-form-item>
  71. <el-input v-model='form.username' clearable placeholder="请输入账号"></el-input>
  72. <img src="static/username.png" alt="">
  73. </el-form-item>
  74. <el-form-item>
  75. <el-input v-model='form.password' type='password' clearable placeholder="请输入密码"></el-input>
  76. <img src="static/pwd.png" alt="">
  77. </el-form-item>
  78. <el-form-item class="imgcode">
  79. <img @click="getCode" :src="code" alt="">
  80. <el-input type="text" v-model="form.imgcode" placeholder="请输入验证码"></el-input>
  81. </el-form-item>
  82. <el-form-item>
  83. <el-button type='primary' @click='login'>登录</el-button>
  84. </el-form-item>
  85. </el-form>
  86. </div>
  87. </body>
  88. <!-- import Vue before Element -->
  89. <script src="static/jquery.min.js"></script>
  90. <script src="static/vue.js"></script>
  91. <!-- import JavaScript -->
  92. <script src="static/index.js"></script>
  93. <script>
  94. new Vue({
  95. el: '#app',
  96. data: function () {
  97. return {
  98. form: {
  99. },
  100. code: ""
  101. }
  102. },
  103. methods: {
  104. login() {
  105. $.ajax({
  106. url: '/api/account/login',
  107. method: 'post',
  108. data: this.form,
  109. success: res => {
  110. if (res.code == '1000') {
  111. this.$message.error(res.message);
  112. } else {
  113. var search = window.location.search.split('?')[1].split('&');
  114. let id = search[0].split('=')[1]
  115. if (window.location.search.split('?')[1].indexOf("type") != -1) {
  116. let type = search[1].split('=')[1]
  117. // 跳转到问卷页面
  118. window.location.href = "/survey/answer.html?id=" + id + "&type=" + type
  119. } else {
  120. window.location.href = "/survey/message.html?id=" + id
  121. }
  122. }
  123. }
  124. })
  125. },
  126. getCode() {
  127. $.ajax({
  128. url: "/api/account/imgcode",
  129. method: "get",
  130. data: {},
  131. success: res => {
  132. this.code = res.data.imgcode
  133. this.form.imgcode_id = res.data.imgcode_id
  134. }
  135. })
  136. },
  137. },
  138. created() {
  139. this.getCode()
  140. },
  141. mounted() {
  142. document.getElementById('app').style.display = 'block'
  143. }
  144. })
  145. </script>
  146. </html>