login.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div id="login">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <top></top>
  7. </el-col>
  8. <el-col :span="24" class="menu">
  9. <div class="w_1200">
  10. <menus></menus>
  11. </div>
  12. </el-col>
  13. <el-col :span="24" class="main">
  14. <div class="w_1200">
  15. <el-col :span="24" class="info">
  16. <el-col :span="24" class="top">
  17. 登录
  18. </el-col>
  19. <el-col :span="24" class="form">
  20. <el-form :model="form" :rules="rules" ref="form" label-width="100px" class="demo-ruleForm">
  21. <el-form-item label="手机号" prop="phone">
  22. <el-input v-model="form.phone" placeholder="请输入手机号" maxlength="11"></el-input>
  23. </el-form-item>
  24. <el-form-item label="密码" prop="passwd">
  25. <el-input v-model="form.passwd" placeholder="请输入密码" show-password></el-input>
  26. </el-form-item>
  27. <el-col :span="24" style="text-align:center;">
  28. <el-button type="primary" @click="submitForm('form')">登录</el-button>
  29. <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
  30. </el-col>
  31. </el-form>
  32. </el-col>
  33. </el-col>
  34. </div>
  35. </el-col>
  36. <el-col :span="24" class="foot">
  37. <div class="w_1200">
  38. <foot></foot>
  39. </div>
  40. </el-col>
  41. </el-col>
  42. </el-row>
  43. </div>
  44. </template>
  45. <script>
  46. import top from '@/layout/common/top.vue';
  47. import menus from '@/layout/common/menus.vue';
  48. import foot from '@/layout/common/foot.vue';
  49. import { mapState, createNamespacedHelpers } from 'vuex';
  50. export default {
  51. name: 'login',
  52. props: {},
  53. components: {
  54. top,
  55. menus,
  56. foot,
  57. },
  58. data: function() {
  59. return {
  60. form: {},
  61. rules: {
  62. phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
  63. passwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
  64. },
  65. };
  66. },
  67. created() {},
  68. methods: {
  69. submitForm(formName) {
  70. this.$refs[formName].validate(valid => {
  71. if (valid) {
  72. alert('submit!');
  73. } else {
  74. console.log('error submit!!');
  75. return false;
  76. }
  77. });
  78. },
  79. },
  80. computed: {
  81. ...mapState(['user']),
  82. pageTitle() {
  83. return `${this.$route.meta.title}`;
  84. },
  85. },
  86. metaInfo() {
  87. return { title: this.$route.meta.title };
  88. },
  89. };
  90. </script>
  91. <style lang="less" scoped>
  92. .w_1200 {
  93. width: 1200px;
  94. margin: 0 auto;
  95. }
  96. .style {
  97. .menu {
  98. height: 70px;
  99. margin: 0 0 10px 0;
  100. }
  101. .main {
  102. min-height: 600px;
  103. margin: 0 0 10px 0;
  104. .info {
  105. min-height: 600px;
  106. background: #fff;
  107. padding: 0 20px;
  108. .top {
  109. text-align: center;
  110. padding: 50px 0;
  111. font-size: 40px;
  112. }
  113. .form {
  114. padding: 0 0 20px 0;
  115. }
  116. }
  117. }
  118. .foot {
  119. height: 135px;
  120. }
  121. }
  122. </style>