123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <template>
- <div id="login">
- <el-row>
- <el-col :span="24">
- <div class="bg">
- <div class="main">
- <div class="left">
- <span>直播管理平台</span>
- </div>
- <div class="right">
- <el-col :span="24" class="title">
- <span>用户登录</span>
- </el-col>
- <el-col :span="24" class="form">
- <el-form :model="form" :rules="rules" ref="form" class="demo-ruleForm">
- <el-form-item prop="roomid" class="roomid">
- <span slot="label"><el-image :src="image.roomid"></el-image></span>
- <el-input v-model="form.roomid" placeholder="请输入房间号"></el-input>
- </el-form-item>
- <el-form-item prop="phone">
- <span slot="label"><el-image :src="image.phone"></el-image></span>
- <el-input v-model="form.phone" placeholder="请输入手机号" maxlength="11"></el-input>
- </el-form-item>
- <el-form-item prop="passwd">
- <span slot="label"><el-image :src="image.password"></el-image></span>
- <el-input v-model="form.passwd" placeholder="请输入密码" show-password></el-input>
- </el-form-item>
- <el-col :span="24" style="text-align:center;">
- <el-button type="primary" @click="resetForm('form')">重置</el-button>
- <el-button type="success" @click="submitForm('form')">登录</el-button>
- </el-col>
- </el-form>
- </el-col>
- </div>
- </div>
- </div>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: login } = createNamespacedHelpers('login');
- export default {
- name: 'login',
- props: {},
- components: {},
- data: function() {
- return {
- form: {},
- rules: {
- roomid: [{ required: false, message: '请输入房间号', trigger: 'blur' }],
- phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
- passwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
- },
- image: {
- roomid: require('@/assets/roomid.png'),
- phone: require('@/assets/user.png'),
- password: require('@/assets/password.png'),
- },
- };
- },
- created() {},
- methods: {
- ...login({ toLogin: 'login' }),
- submitForm(formName) {
- this.$refs[formName].validate(async valid => {
- if (valid) {
- let res = await this.toLogin({ user: this.form });
- if (res.id) {
- this.$router.push('/');
- }
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- resetForm(formName) {
- this.$refs[formName].resetFields();
- },
- },
- computed: {
- ...mapState(['user']),
- pageTitle() {
- return `${this.$route.meta.title}`;
- },
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- };
- </script>
- <style lang="less" scoped>
- .bg {
- width: 100%;
- height: 100vh;
- background-image: url('../assets/bg3.jpg');
- background-size: 100% 100%;
- background-position: center center;
- }
- .main {
- position: absolute;
- top: 30%;
- left: 30%;
- width: 660px;
- height: 370px;
- }
- .main .left {
- float: left;
- width: 330px;
- height: 370px;
- text-align: center;
- background: #0000004f;
- }
- .main .left span {
- font-size: 25px;
- color: #fff;
- font-weight: bold;
- font-family: cursive;
- padding: 36% 0;
- display: inline-block;
- line-height: 40px;
- }
- .main .right {
- float: left;
- width: 330px;
- height: 370px;
- background: #ffffff5f;
- .title {
- text-align: center;
- padding: 20px 0;
- margin: 0 0 20px 0;
- border-bottom: 1px solid #ccc;
- span {
- font-size: 20px;
- color: #0635ab;
- font-weight: bold;
- }
- }
- .form {
- padding: 0 10px;
- }
- }
- /deep/.el-input {
- width: 80%;
- }
- /deep/.el-image {
- top: 5px;
- }
- /deep/.roomid .el-form-item__label {
- padding: 0 13px 0 10px;
- }
- </style>
|