login-3.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div id="login-2">
  3. <el-row>
  4. <el-col :span="24" class="main" :style="{ 'background-image': `url('${backimage}')` }">
  5. <div class="w_1200">
  6. <el-col :span="24" class="info">
  7. <el-col :span="24" class="info_1"> 欢迎登陆 </el-col>
  8. <el-col :span="24" class="info_2">
  9. <el-form :model="form" :rules="rules" ref="form">
  10. <el-form-item prop="account">
  11. <el-input placeholder="请输入账号" v-model="form.account">
  12. <el-button slot="prepend" icon="el-icon-user-solid"></el-button>
  13. </el-input>
  14. </el-form-item>
  15. <el-form-item prop="password">
  16. <el-input placeholder="密码" v-model="form.password" type="password">
  17. <el-button slot="prepend" icon="el-icon-user-solid"></el-button>
  18. </el-input>
  19. </el-form-item>
  20. <el-form-item class="btn">
  21. <el-button type="primary" @click="toLogin('form')">登录</el-button>
  22. </el-form-item>
  23. </el-form>
  24. <el-col :span="24" class="info_3"> 输入任意用户名和密码即可 </el-col>
  25. </el-col>
  26. </el-col>
  27. </div>
  28. </el-col>
  29. </el-row>
  30. </div>
  31. </template>
  32. <script>
  33. import { mapState, createNamespacedHelpers } from 'vuex';
  34. export default {
  35. name: 'login-2',
  36. props: {},
  37. components: {},
  38. data: function () {
  39. return {
  40. // 背景图片
  41. backimage: require('@/assets/login/login_3_1.png'),
  42. form: {},
  43. rules: {
  44. account: [{ required: true, message: '账号不能为空', trigger: 'blur' }],
  45. password: [{ required: true, message: '密码不能为空', trigger: 'blur' }],
  46. code: [{ required: true, message: '验证码不能为空', trigger: 'blur' }],
  47. },
  48. };
  49. },
  50. created() {},
  51. methods: {
  52. toLogin(formName) {
  53. this.$refs[formName].validate(async (valid) => {
  54. if (valid) {
  55. this.$emit('toLogin', { data: this.form, formName: formName });
  56. } else {
  57. console.log('error submit!!');
  58. return false;
  59. }
  60. });
  61. },
  62. toRegister() {
  63. this.$emit('toRegister');
  64. },
  65. toCode() {
  66. this.$emit('toCode');
  67. },
  68. },
  69. computed: {
  70. ...mapState(['user']),
  71. },
  72. metaInfo() {
  73. return { title: this.$route.meta.title };
  74. },
  75. watch: {
  76. test: {
  77. deep: true,
  78. immediate: true,
  79. handler(val) {},
  80. },
  81. },
  82. };
  83. </script>
  84. <style lang="less" scoped>
  85. .main {
  86. background-size: 100% 100%;
  87. height: 100vh;
  88. background-repeat: no-repeat;
  89. overflow: hidden;
  90. .info {
  91. width: 300px;
  92. border-radius: 5px;
  93. background: #fff;
  94. font-size: 14px;
  95. margin: 20% 0 0 70%;
  96. .info_1 {
  97. border-bottom: 1px solid #e8eaec;
  98. padding: 14px 16px;
  99. line-height: 1;
  100. }
  101. .info_2 {
  102. padding: 16px;
  103. .btn {
  104. margin: 5% 0 0 0;
  105. text-align: center;
  106. button {
  107. width: 100%;
  108. }
  109. }
  110. .info_3 {
  111. font-size: 10px;
  112. text-align: center;
  113. color: #c3c3c3;
  114. margin: 16px 0 0 0;
  115. }
  116. }
  117. }
  118. }
  119. .el-input-group__append button.el-button,
  120. .el-input-group__append div.el-select .el-input__inner,
  121. .el-input-group__append div.el-select:hover .el-input__inner,
  122. .el-input-group__prepend button.el-button,
  123. .el-input-group__prepend div.el-select .el-input__inner,
  124. .el-input-group__prepend div.el-select:hover .el-input__inner {
  125. border-color: transparent;
  126. background-color: transparent;
  127. color: inherit;
  128. border-top: 0;
  129. border-bottom: 0;
  130. width: 15px;
  131. padding: 0 13px;
  132. }
  133. </style>