kjpdLogin.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div id="kjpdLogin">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="5" class="info"> </el-col>
  6. <el-col :span="13" class="login">
  7. <el-col :span="24" class="title">
  8. 管理登录
  9. </el-col>
  10. <el-col :span="24" class="form">
  11. <el-form ref="form" :model="form" :rules="rules" label-width="140px">
  12. <el-form-item label="房间号" prop="room_id">
  13. <el-input v-model="form.room_id" placeholder="房间号"></el-input>
  14. </el-form-item>
  15. <el-form-item label="登录密码" prop="passwd">
  16. <el-input v-model="form.passwd" placeholder="请输入登录密码" show-password></el-input>
  17. </el-form-item>
  18. <el-col :span="24" class="btn">
  19. <el-button type="primary" @click="onSubmit">登录</el-button>
  20. </el-col>
  21. </el-form>
  22. </el-col>
  23. </el-col>
  24. <el-col :span="5" class="info"> </el-col>
  25. </el-col>
  26. </el-row>
  27. </div>
  28. </template>
  29. <script>
  30. import { mapState, createNamespacedHelpers } from 'vuex';
  31. const { mapActions: channel } = createNamespacedHelpers('channel');
  32. export default {
  33. name: 'kjpdLogin',
  34. props: {},
  35. components: {},
  36. data: function() {
  37. return {
  38. form: {},
  39. rules: {
  40. room_id: [{ required: true, message: '请输入房间号', trigger: 'blur' }],
  41. passwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
  42. },
  43. };
  44. },
  45. created() {},
  46. methods: {
  47. ...channel({ toLogin: 'login' }),
  48. async onSubmit() {
  49. let data = this.form;
  50. const res = await this.toLogin({ user: data });
  51. if (res.uid) {
  52. console.log(res);
  53. // this.$router.push({ path: '/kjpdCenter/index', query: { num: '1' } });
  54. }
  55. },
  56. },
  57. computed: {
  58. ...mapState(['user']),
  59. pageTitle() {
  60. return `${this.$route.meta.title}`;
  61. },
  62. },
  63. metaInfo() {
  64. return { title: this.$route.meta.title };
  65. },
  66. };
  67. </script>
  68. <style lang="less" scoped>
  69. .info {
  70. height: 800px;
  71. }
  72. .login {
  73. padding: 15px 0;
  74. .title {
  75. text-align: center;
  76. font-size: 40px;
  77. padding: 40px 0;
  78. }
  79. .form {
  80. .btn {
  81. text-align: center;
  82. }
  83. }
  84. }
  85. </style>