跳板机管理web端
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.

107 lines
3.3 KiB

9 years ago
8 years ago
9 years ago
8 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
8 years ago
9 years ago
  1. <template>
  2. <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-position="left" label-width="0px" class="demo-ruleForm card-box loginform">
  3. <h3 class="title">系统登录</h3>
  4. <el-form-item prop="account">
  5. <el-input type="text" v-model="ruleForm2.account" auto-complete="off" placeholder="账号"></el-input>
  6. </el-form-item>
  7. <el-form-item prop="checkPass">
  8. <el-input type="password" v-model="ruleForm2.checkPass" auto-complete="off" placeholder="密码"></el-input>
  9. </el-form-item>
  10. <el-checkbox v-model="checked" checked style="margin:0px 0px 35px 0px;">记住密码</el-checkbox>
  11. <el-form-item style="width:100%;">
  12. <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit2" :loading="logining">登录</el-button>
  13. <!--<el-button @click.native.prevent="handleReset2">重置</el-button>-->
  14. </el-form-item>
  15. </el-form>
  16. </template>
  17. <script>
  18. import { requestLogin } from '../api/api';
  19. import NProgress from 'nprogress'
  20. export default {
  21. data() {
  22. return {
  23. logining: false,
  24. ruleForm2: {
  25. account: 'admin',
  26. checkPass: '123456'
  27. },
  28. rules2: {
  29. account: [
  30. { required: true, message: '请输入账号', trigger: 'blur' },
  31. //{ validator: validaePass }
  32. ],
  33. checkPass: [
  34. { required: true, message: '请输入密码', trigger: 'blur' },
  35. //{ validator: validaePass2 }
  36. ]
  37. },
  38. checked: true
  39. };
  40. },
  41. methods: {
  42. handleReset2() {
  43. this.$refs.ruleForm2.resetFields();
  44. },
  45. handleSubmit2(ev) {
  46. var _this = this;
  47. this.$refs.ruleForm2.validate((valid) => {
  48. if (valid) {
  49. //_this.$router.replace('/table');
  50. this.logining = true;
  51. NProgress.start();
  52. var loginParams = { username: this.ruleForm2.account, password: this.ruleForm2.checkPass };
  53. requestLogin(loginParams).then(data => {
  54. this.logining = false;
  55. NProgress.done();
  56. let { msg, code, user } = data;
  57. if (code !== 200) {
  58. this.$notify({
  59. title: '错误',
  60. message: msg,
  61. type: 'error'
  62. });
  63. } else {
  64. localStorage.setItem('user', JSON.stringify(user));
  65. if (this.$route.query.redirect) {
  66. this.$router.push({ path: this.$route.query.redirect });
  67. } else {
  68. this.$router.push({ path: '/table' });
  69. }
  70. }
  71. });
  72. } else {
  73. console.log('error submit!!');
  74. return false;
  75. }
  76. });
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped>
  82. .card-box {
  83. padding: 20px;
  84. /*box-shadow: 0 0px 8px 0 rgba(0, 0, 0, 0.06), 0 1px 0px 0 rgba(0, 0, 0, 0.02);*/
  85. -webkit-border-radius: 5px;
  86. border-radius: 5px;
  87. -moz-border-radius: 5px;
  88. background-clip: padding-box;
  89. margin-bottom: 20px;
  90. background-color: #F9FAFC;
  91. margin: 180px auto;
  92. width: 400px;
  93. border: 2px solid #8492A6;
  94. }
  95. .title {
  96. margin: 0px auto 40px auto;
  97. text-align: center;
  98. color: #505458;
  99. }
  100. .loginform {
  101. width: 350px;
  102. padding: 35px 35px 15px 35px;
  103. }
  104. </style>