<template>
    <div class="login-container">
        <div class="title1">管理后台</div>
        <div class="login-box">
            <div class="title2">欢迎登录</div>
            <div class="username">
                <el-input type="text" v-model="username" placeholder="请输入账号">
                    <template #prefix>
                        <img class="img" src="../assets/login/denglu.png" />
                    </template>
                </el-input>
            </div>
            <div class="password">
                <el-input type="password" v-model="password" placeholder="请输入密码">
                    <template #prefix>
                        <img class="img" src="../assets/login/mima.png" />
                    </template>
                </el-input>
            </div>
            <button @click="login">登录</button>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue';

// 使用ref创建响应式数据
const username = ref('');
const password = ref('');

// 定义登录函数
const login = () => {
    // 这里可以添加实际的登录逻辑，比如发送API请求到后端验证
    console.log('用户名:', username.value);
    console.log('密码:', password.value);
};
</script>

<style scoped>
.title1 {
    font-size: 40px;
    color: #21d3ca;
    margin-bottom: 20px;
}

.title2 {
    font-size: 20px;
    color: #21d3ca;
    margin-bottom: 20px;
}

.username,
.password {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    background-color: #e6e6e6;
}

:deep(.el-input__wrapper) {
    background-color: rgba(0, 0, 0, 0);
}

.img {
    width: 25px;
    height: 25px;
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-box {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 50px;
    text-align: center;
    height: 200px;
    width: 250px;
}

h1 {
    margin-bottom: 20px;
}

input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

button {
    width: 100%;
    padding: 10px;
    background-color: #21d3ca;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
</style>