Login登录管理系统

当前位置:   article > 正文

Vue+element-Ui登录界面_element登录模板

element登录模板

效果图片

 代码块


  1. <template>
  2. <div class="main">
  3. <div class="backImg"></div>
  4. <div class="login">
  5. <div class="title">
  6. <span>Login管理系统</span>
  7. </div>
  8. <div class="list">
  9. <el-input
  10. prefix-icon="el-icon-user"
  11. placeholder="请输入账号"
  12. v-model="dataFrom.username"
  13. ></el-input>
  14. </div>
  15. <div class="list">
  16. <el-input
  17. prefix-icon="el-icon-unlock"
  18. placeholder="请输入密码"
  19. show-password
  20. v-model="dataFrom.password"
  21. ></el-input>
  22. </div>
  23. <div class="list">
  24. <el-input
  25. prefix-icon="el-icon-document-checked"
  26. placeholder="请输入验证码"
  27. v-model="dataFrom.code"
  28. ></el-input>
  29. <div class="getCode">
  30. <span @click="getCode">{{ dataFrom.code }}</span>
  31. </div>
  32. </div>
  33. <div class="btn">
  34. <button @click="loginClick">登录</button>
  35. </div>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. dataFrom: {
  44. username: "xq",
  45. password: "xq123",
  46. code: "",
  47. },
  48. };
  49. },
  50. mounted() {
  51. this.getCode();
  52. },
  53. methods: {
  54. loginClick() {
  55. if (
  56. this.dataFrom.username == "xq" &&
  57. this.dataFrom.password == "xq123" &&
  58. this.dataFrom.code == this.dataFrom.code
  59. ) {
  60. localStorage.setItem("username", this.dataFrom.username);
  61. localStorage.setItem("password", this.dataFrom.password);
  62. localStorage.setItem("code", this.dataFrom.code);
  63. this.$router.push("./home");
  64. }
  65. },
  66. getCode() {
  67. var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  68. var arr = str.split("");
  69. var oldStr = "";
  70. for (var i = 0; i < 4; i++) {
  71. var n = Math.floor(Math.random() * arr.length);
  72. oldStr += arr[n];
  73. }
  74. this.dataFrom.code = oldStr.substring(oldStr.length - 4);
  75. },
  76. },
  77. };
  78. </script>
  79. <style scoped>
  80. .backImg {
  81. background: url("https://img-blog.csdnimg.cn/2ebd84257f154cb8848aab94dd663bb4.png");
  82. background-size: 100% 100%;
  83. position: fixed;
  84. width: 100%;
  85. height: 100%;
  86. left: 0;
  87. top: 0;
  88. }
  89. .login {
  90. position: absolute;
  91. top: 50%;
  92. left: 50%;
  93. transform: translate(-50%, -50%);
  94. border: 1px solid #ccc;
  95. background: #fff;
  96. width: 20%;
  97. padding: 20px 20px 25px 20px;
  98. }
  99. .login .title {
  100. text-align: center;
  101. padding-bottom: 5px;
  102. }
  103. .login .title span {
  104. font-size: 30px;
  105. color: #000;
  106. }
  107. .login .list {
  108. display: flex;
  109. align-items: center;
  110. padding: 8px 0;
  111. }
  112. .login .list input {
  113. border-radius: 3px;
  114. border: none;
  115. outline: none;
  116. color: #999;
  117. border: 1px solid #bdbdbd;
  118. font-size: 14px;
  119. line-height: 35px;
  120. padding: 0 10px;
  121. display: block;
  122. box-sizing: border-box;
  123. flex: 7;
  124. }
  125. .login .list .getCode span {
  126. font-size: 20px;
  127. background: #f5f7fa;
  128. color: #777;
  129. border-radius: 4px;
  130. line-height: 38px;
  131. border: 1px solid #ccc;
  132. display: inline-block;
  133. margin-left: 10px;
  134. width: 80px;
  135. text-align: center;
  136. user-select: none;
  137. cursor: pointer;
  138. }
  139. .btn {
  140. display: flex;
  141. justify-content: flex-end;
  142. padding-top: 5px;
  143. }
  144. .btn button {
  145. font-size: 13px;
  146. color: #fff;
  147. background: #46b5ff;
  148. outline: none;
  149. border: none;
  150. line-height: 35px;
  151. padding: 0 20px;
  152. display: inline-block;
  153. flex: 1;
  154. cursor: pointer;
  155. }
  156. </style>

uniapp登录界面

  1. <template>
  2. <view class="main">
  3. <view class="backImg"></view>
  4. <view class="login">
  5. <view class="loginTitle">
  6. <text>XuQian后台登录</text>
  7. </view>
  8. <view class="list">
  9. <uni-icons type="person" size="17"></uni-icons>
  10. <input placeholder="请输入账号" v-model="dataFrom.username"></input>
  11. </view>
  12. <view class="list">
  13. <uni-icons type="locked" size="17"></uni-icons>
  14. <input placeholder="请输入密码" password v-model="dataFrom.password"></input>
  15. </view>
  16. <view class="getCode">
  17. <view class="codeInput">
  18. <uni-icons type="notification" size="17"></uni-icons>
  19. <input placeholder="请输入验证码" v-model="dataFrom.code"></input>
  20. </view>
  21. <view class="codeText" @click="getCode">
  22. <text>{{ dataFrom.code }}</text>
  23. </view>
  24. </view>
  25. <view class="password">
  26. <checkbox-group>
  27. <checkbox />
  28. </checkbox-group>
  29. <text>记住密码</text>
  30. </view>
  31. <view class="loginBtn">
  32. <text>登入</text>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. dataFrom: {
  42. username: "xq",
  43. password: "xq123456789",
  44. code: ''
  45. }
  46. }
  47. },
  48. mounted() {
  49. this.getCode()
  50. },
  51. methods: {
  52. getCode() {
  53. var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  54. var arr = str.split("");
  55. var oldStr = "";
  56. for (var i = 0; i < 5; i++) {
  57. var n = Math.floor(Math.random() * arr.length);
  58. oldStr += arr[n];
  59. }
  60. this.dataFrom.code = oldStr.substring(oldStr.length - 5);
  61. },
  62. }
  63. };
  64. </script>
  65. <style scoped>
  66. uni-checkbox-group {
  67. font-size: 0;
  68. }
  69. /deep/.uni-checkbox-input {
  70. width: 32rpx;
  71. height: 32rpx;
  72. }
  73. /deep/.uni-checkbox-input.uni-checkbox-input-checked::before {
  74. font-size: 15px;
  75. }
  76. .backImg {
  77. background: #1E9FFF;
  78. position: fixed;
  79. width: 100%;
  80. height: 100%;
  81. left: 0;
  82. top: 0;
  83. }
  84. .login {
  85. position: absolute;
  86. top: 50%;
  87. left: 50%;
  88. transform: translate(-50%, -50%);
  89. width: 360px;
  90. background-color: #fff;
  91. border: 1px solid #fff;
  92. border-radius: 6rpx;
  93. padding: 28rpx 40rpx;
  94. box-sizing: border-box;
  95. box-shadow: 0 0 8px #eeeeee;
  96. letter-spacing: 2rpx;
  97. }
  98. .login uni-icons {
  99. color: #d2d2d2;
  100. }
  101. .login .loginTitle {
  102. text-align: center;
  103. margin-bottom: 20rpx;
  104. padding: 28rpx 0;
  105. }
  106. .login .loginTitle text {
  107. color: #1E9FFF;
  108. font-size: 50rpx;
  109. font-weight: bold;
  110. }
  111. .login .list {
  112. display: flex;
  113. align-items: center;
  114. border: 1px solid #dddddd;
  115. padding: 0 15rpx;
  116. margin-bottom: 30rpx;
  117. border-radius: 10rpx;
  118. }
  119. .login input {
  120. border: none;
  121. outline: none;
  122. font-size: 28rpx;
  123. color: rgb(51, 51, 51);
  124. line-height: 70rpx;
  125. height: 70rpx;
  126. display: block;
  127. box-sizing: border-box;
  128. flex: 7;
  129. border: none;
  130. padding: 0 15rpx;
  131. }
  132. .login .password {
  133. margin-bottom: 30rpx;
  134. display: flex;
  135. align-items: center;
  136. }
  137. .login .password text {
  138. font-size: 28rpx;
  139. color: #989898;
  140. display: inline-block;
  141. padding-left: 10rpx;
  142. line-height: 32rpx;
  143. }
  144. .login .getCode {
  145. display: flex;
  146. justify-content: space-between;
  147. }
  148. .login .codeInput {
  149. display: flex;
  150. align-items: center;
  151. border: 1px solid #dddddd;
  152. padding: 0 15rpx;
  153. margin-bottom: 30rpx;
  154. border-radius: 10rpx;
  155. }
  156. .login .codeText text {
  157. font-size: 40rpx;
  158. background: #f5f7fa;
  159. color: #777;
  160. border-radius: 8rpx;
  161. line-height: 70rpx;
  162. border: 1px solid #e6e6e6;
  163. display: inline-block;
  164. width: 95px;
  165. text-align: center;
  166. user-select: none;
  167. cursor: pointer;
  168. }
  169. .login .loginBtn {
  170. padding-bottom: 30rpx;
  171. }
  172. .login .loginBtn text {
  173. background-color: #1E9FFF;
  174. line-height: 76rpx;
  175. color: #fff;
  176. text-align: center;
  177. font-size: 25rpx;
  178. border-radius: 4rpx;
  179. display: block;
  180. }
  181. </style>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/732869
推荐阅读
相关标签