<template>
    <div class="box">
        <div class="box-login">
            <div class="login-content-icon">
                <img src="../assets/images/login_icon.png" alt="">
            </div>
            <div class="login-input">
                <div class="login-input-item" :class="{'focus':activeInput == 'username'}">
                    <img src="../assets/images/icon_username.png" class="icon">
                    <input type="text" placeholder="username" @focus="activeInput = 'username'" autofocus @keyup.enter="$router.push('./index')">
                </div>
                <div class="login-input-item" :class="{'focus':activeInput == 'password'}">
                    <img src="../assets/images/icon_password.png" class="icon">
                    <input type="password" placeholder="password" @focus="activeInput = 'password'" @keyup.enter="$router.push('./index')">
                </div>
                <router-link to="./home" class="login-btn">Login</router-link>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'login',
        data() {
            return {
                activeInput: 'username'
            }
        }
    }
</script>

<style lang="less" scoped>
    .box {
        width: 100%;
        height: 100%;
        background: url("../assets/images/login_back.png");
        display: flex;
        justify-content: center;
        align-items: center;

        .box-login {
            width: 676px;
            height: 640px;
            background: rgba(0, 18, 46, .61);
            border-radius: 2px;

            .login-content-icon {
                width: 100%;
            }

            .login-input {
                margin: 116px 118px;

                .login-input-item {
                    border: 1px solid rgba(0, 0, 0, 0);
                    border-radius: 2px;
                    background-color: rgb(0, 18, 46);
                    width: 440px;
                    height: 70px;
                    padding: 10px;
                    box-sizing: border-box;
                    margin-bottom: 55px;
                    color: #fff;

                    .icon {
                        vertical-align: text-bottom;
                        margin: 0 10px;
                    }

                    input {
                        background: none;
                        height: 50px;
                        padding-left: 10px;
                        border: none;
                        color: #fff;
                        font-size: 24px;

                        &::-webkit-input-placeholder {
                            color: rgba(255, 255, 255, .3);
                        }
                    }

                    &.focus {
                        border: 1px solid rgb(0, 104, 177);
                    }
                }

                .login-btn {
                    display: block;
                    line-height: 64px;
                    text-align: center;
                    border-radius: 4px;
                    background-color: rgb(0, 104, 177);
                    width: 440px;
                    height: 64px;
                    font-size: 20px;
                    color: #fff;
                    cursor: pointer;

                    &:hover {
                        opacity: .9;
                        text-decoration: none;
                    }
                }
            }
        }
    }
</style>
