support sms login

This commit is contained in:
Timi
2026-08-21 18:18:14 +08:00
parent 5f7247b8a6
commit 651b0e1f74
5 changed files with 448 additions and 213 deletions
+109
View File
@@ -0,0 +1,109 @@
<template>
<div class="login-page">
<section class="login-panel">
<div class="brand">
<div class="logo"><span>糕</span></div>
<h1>糕店客户管理</h1>
</div>
<t-segmented class="login-type" v-model="loginType" :options="loginTypeOptions" />
<password-login v-if="loginType === 'password'" class="form" />
<sms-login v-else class="form" />
</section>
</div>
</template>
<script setup lang="ts">
import PasswordLogin from "@/pages/user/component/PasswordLogin.vue";
import SmsLogin from "@/pages/user/component/SmsLogin.vue";
defineOptions({
name: "LoginIndex"
});
type LoginType = "password" | "sms";
const loginType = ref<LoginType>("password");
const loginTypeOptions = [
{ value: "password" as LoginType, label: "密码登录" },
{ value: "sms" as LoginType, label: "短信登录" }
];
</script>
<style scoped lang="less">
.login-page {
width: 100%;
padding: 4.5rem 1rem 1.5rem;
display: flex;
min-height: 100vh;
background: #F5F5F8;
align-items: flex-start;
justify-content: center;
.login-panel {
width: 100%;
padding: 1.5rem;
display: flex;
max-width: 28rem;
background: rgba(255, 255, 255, .94);
box-shadow: 0 .75rem 2rem rgba(15, 23, 42, .08);
border-radius: 1.4rem;
flex-direction: column;
.form {
margin: 0;
:deep(.t-form__label) {
width: 5.5rem;
}
}
.login-type {
width: fit-content;
margin: 1rem auto 0 auto;
}
}
.brand {
display: grid;
place-items: center;
h1 {
margin: .875rem 0 0;
color: #0f172a;
font-size: 1.5rem;
font-weight: 700;
}
}
.logo {
width: 5rem;
height: 5rem;
color: #FFF;
display: grid;
background: #0f766e;
box-shadow: 0 .75rem 1.5rem rgba(15, 118, 110, .22);
place-items: center;
border-radius: 1.25rem;
span {
font-size: 2rem;
font-weight: 800;
}
}
}
:global(html.theme-dark) {
.login-page {
background: #10161f;
.login-panel {
background: rgba(15, 23, 42, .88);
box-shadow: 0 .75rem 2rem rgba(2, 6, 23, .32);
}
.brand h1 {
color: #e2e8f0;
}
}
}
</style>