You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.3 KiB

8 months ago
  1. <template>
  2. <div class="login-container">
  3. <div class="title1">管理后台</div>
  4. <div class="login-box">
  5. <div class="title2">欢迎登录</div>
  6. <div class="username">
  7. <el-input type="text" v-model="username" placeholder="请输入账号">
  8. <template #prefix>
  9. <img class="img" src="../assets/login/denglu.png" />
  10. </template>
  11. </el-input>
  12. </div>
  13. <div class="password">
  14. <el-input type="password" v-model="password" placeholder="请输入密码">
  15. <template #prefix>
  16. <img class="img" src="../assets/login/mima.png" />
  17. </template>
  18. </el-input>
  19. </div>
  20. <button @click="login">登录</button>
  21. </div>
  22. </div>
  23. </template>
  24. <script setup>
  25. import { ref } from 'vue';
  26. // 使用ref创建响应式数据
  27. const username = ref('');
  28. const password = ref('');
  29. // 定义登录函数
  30. const login = () => {
  31. // 这里可以添加实际的登录逻辑,比如发送API请求到后端验证
  32. console.log('用户名:', username.value);
  33. console.log('密码:', password.value);
  34. };
  35. </script>
  36. <style scoped>
  37. .title1 {
  38. font-size: 40px;
  39. color: #21d3ca;
  40. margin-bottom: 20px;
  41. }
  42. .title2 {
  43. font-size: 20px;
  44. color: #21d3ca;
  45. margin-bottom: 20px;
  46. }
  47. .username,
  48. .password {
  49. display: flex;
  50. align-items: center;
  51. margin-bottom: 20px;
  52. background-color: #e6e6e6;
  53. }
  54. :deep(.el-input__wrapper) {
  55. background-color: rgba(0, 0, 0, 0);
  56. }
  57. .img {
  58. width: 25px;
  59. height: 25px;
  60. }
  61. .login-container {
  62. display: flex;
  63. flex-direction: column;
  64. align-items: center;
  65. justify-content: center;
  66. height: 100vh;
  67. }
  68. .login-box {
  69. background-color: white;
  70. border-radius: 5px;
  71. box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  72. padding: 50px;
  73. text-align: center;
  74. height: 200px;
  75. width: 250px;
  76. }
  77. h1 {
  78. margin-bottom: 20px;
  79. }
  80. input {
  81. width: 100%;
  82. padding: 10px;
  83. margin-bottom: 10px;
  84. border: 1px solid #ccc;
  85. border-radius: 3px;
  86. }
  87. button {
  88. width: 100%;
  89. padding: 10px;
  90. background-color: #21d3ca;
  91. color: white;
  92. border: none;
  93. border-radius: 3px;
  94. cursor: pointer;
  95. }
  96. </style>