<script setup lang="ts">
import {ref} from 'vue';
import Login from "@/pages/login/modules/login.vue";
import Register from "@/pages/login/modules/register.vue";

const type = ref('login');

function switchType(val: string) {
    type.value = val;
}

</script>

<template>
    <div id="login">

        <div style="background-color:transparent;height:46px">
            <div id="header">
                <img id="icon" src="/src/assets/LOGO.png" alt="logo"/>

            </div>
        </div>


        <div id="content">
            <div id="placeholder"></div>
            <div class="login-container">
                <div class="title-container">
                    <h1 class="title margin-no">登录到</h1>
                    <h1 class="title">图书管理系统</h1>
                    <div class="sub-title">
                        <p class="tip">{{
                                type == 'register' ? '已有账号？' : '没有账号吗？'
                            }}</p>
                        <p class="tip clickTip" @click="switchType(type == 'register' ? 'login' : 'register')">
                            {{ type == 'register' ? '登录' : '注册新账号' }}
                        </p>
                    </div>
                </div>
            </div>
            <login v-if="type==='login'"/>

            <register v-else/>
        </div>
    </div>
</template>

<style scoped lang="less">
@import "../../index.less";

#login {
    height: 100vh;
    background-image: url("/loginBackground.jpg");
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    background-size: cover;
    background-color: white;
}

#header {
    backdrop-filter: blur(10px);
    position: relative;
    background-color: @blur-background-color;
    color: transparent;
    height: 46px;

    * {
        display: inline;
    }
}

#icon {
    margin-left: 9px;
    margin-top: 4px;
    width: 220px;
    //height: 30px;
}

#title {
    position: absolute;
    left: 41px;
    top: 3px;
    margin-left: 20px;
}

#content {
    width: 70vh;
    height: calc(100vh - 46px);
    backdrop-filter: blur(10px);
    background-color: @blur-background-color;
    margin-left: 5vh;
}

.form {
    margin-right: 10vh;
}

.login-container {
    margin-left: 100px;
}

.title {
    font-size: 36px;
    margin: 5px 0;
    padding-top: 8px;
    height: 35px;
}

.margin-no {
    margin: 0;
}

.tip {
    display: inline;
    font-size: 14px;
    margin-right: 8px;
    color: @don-t-highlight-font-color;
}

.clickTip {
    cursor: pointer;
    color: @font-color;
}

.sub-title {
    margin-top: 40px;
    margin-bottom: 60px;
    font-size: 14px;
    justify-content: center;
    align-items: center;
    height: 20px;
}

#placeholder {
    height: 150px;
}

</style>