Skip to content

Commit 235f38a

Browse files
authored
doc(LoginTemplate): add animation for temple5 (#6434)
* doc: 增加动画特效 * doc: 增加动画样式 * refactor: 样式格式化
1 parent 2c0b1ff commit 235f38a

File tree

7 files changed

+90
-25
lines changed

7 files changed

+90
-25
lines changed

src/BootstrapBlazor.Server/Components/Samples/Tutorials/LoginAndRegister/Template5.razor

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,53 +23,80 @@
2323
<div class="login-container">
2424
<div class="login-box animate-fade-in">
2525
<div class="header-row">
26-
@if (isEmailEntered)
26+
@if (!isAuth)
2727
{
28-
<button @onclick="GoBack" aria-label="返回" class="back-button">
29-
<span>
30-
<i class="fa-solid fa-arrow-left"></i>
31-
</span>
32-
</button>
28+
if (isEmailEntered)
29+
{
30+
<button @onclick="GoBack" aria-label="返回" class="back-button">
31+
<span>
32+
<i class="fa-solid fa-arrow-left"></i>
33+
</span>
34+
</button>
35+
}
36+
37+
<div class="logo-container">
38+
<h1 class="blazor-text">BootstrapBlazor</h1>
39+
</div>
40+
}
41+
else
42+
{
43+
<div class="logo-container">
44+
<h1 class="blazor-text">BootstrapBlazor</h1>
45+
</div>
3346
}
34-
<div class="logo-container">
35-
<h1 class="blazor-text">BootstrapBlazor</h1>
36-
</div>
3747
</div>
3848
@if (!isEmailEntered)
3949
{
40-
<h2>登录</h2>
50+
<h3>登录</h3>
4151
<p class="subtitle">使用你的 BootstrapBlazor 帐户。</p>
42-
<BootstrapInput type="email" class="input" placeholder="电子邮件或电话号码" @bind-Value="email" />
52+
<BootstrapInput type="email" class="input" placeholder="电子邮件或电话号码" @bind-Value="email"></BootstrapInput>
4353
<div class="error" hidden="@(!showEmailError)">请输入有效的电子邮件地址或电话号码</div>
4454
<Button class="button" Color="Color.Primary" OnClick="OnEmailSubmit">下一步</Button>
4555
<div class="links">
46-
<a href="#">忘记用户名?</a>
56+
<a href="#" @onclick:preventDefault>忘记用户名?</a>
4757
</div>
4858
<div class="small">
4959
不熟悉 BootstrapBlazor?<a href="/">去看文档</a>
5060
</div>
5161
}
52-
else
62+
else if (!isAuth)
5363
{
54-
<h2>输入你的密码</h2>
64+
<h3>输入你的密码</h3>
5565
<p class="email-display">@email</p>
56-
<BootstrapInput type="password" class="input" placeholder="密码" @bind-Value="password" />
66+
<BootstrapInput type="password" class="input" placeholder="密码" @bind-Value="password"></BootstrapInput>
5767
<div class="links">
58-
<a href="#">忘记了密码?</a>
68+
<a href="#" @onclick:preventDefault>忘记了密码?</a>
5969
</div>
60-
<Button class="button" Color="Color.Primary">下一步</Button>
70+
<Button class="button" Color="Color.Primary" OnClick="OnPasswordSubmit">下一步</Button>
6171
<div class="links">
62-
<a href="#">其他登录方法</a>
72+
<a href="#" @onclick:preventDefault>其他登录方法</a>
73+
</div>
74+
}
75+
else
76+
{
77+
<div class="email-display2"><span>@email</span></div>
78+
<h5 class="text-center mt-3 mb-0">欢迎,您已成功登录</h5>
79+
<div class="login-video-wrap">
80+
<video class="login-video" autoplay="autoplay" playsinline="playsinline" disablepictureinpicture="">
81+
<source src="samples/login5/loading1.mp4" type="video/mp4; codecs=av01.0.05M.08">
82+
<source src="samples/login5/loading.mov" type="video/quicktime; codecs=hvc1.1.6.H120.b0">
83+
<source src="samples/login5/loading.webm" type="video/webm; codecs=vp9">
84+
<source src="samples/login5/loading.mp4" type="video/mp4; codecs=avc1.42E01E">
85+
<img src="samples/login5/loading.png" alt="" role="presentation">
86+
</video>
6387
</div>
88+
<p class="text-center text-muted" style="font-size: 0.75rem;">此登录高仿微软登录 UI</p>
89+
<Button class="button" Color="Color.Primary" OnClick="OnEnterSubmit">进入</Button>
6490
}
6591
</div>
6692
</div>
6793
</div>
6894

6995
@code {
7096
private bool isEmailEntered = false;
71-
private string email = "";
72-
private string password = "";
97+
private bool isAuth = false;
98+
private string email = "[email protected]";
99+
private string password = "123456";
73100
private bool showEmailError = false;
74101

75102
private void OnEmailSubmit()
@@ -85,6 +112,18 @@
85112
}
86113
}
87114

115+
private void OnPasswordSubmit()
116+
{
117+
// 数据库检查密码逻辑可以在这里实现
118+
// 演示代码一律通过
119+
isAuth = true;
120+
}
121+
122+
private void OnEnterSubmit()
123+
{
124+
125+
}
126+
88127
private void GoBack()
89128
{
90129
isEmailEntered = false;

src/BootstrapBlazor.Server/Components/Samples/Tutorials/LoginAndRegister/Template5.razor.css

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
background: white;
1919
padding: 40px;
2020
border-radius: 10px;
21-
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
21+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
2222
width: auto;
2323
font-family: "Segoe UI", sans-serif;
2424
text-align: left;
@@ -59,21 +59,21 @@
5959

6060
.blazor-text {
6161
font-family: Arial, sans-serif;
62-
font-size: 1.8rem;
62+
font-size: 1.8rem;
6363
font-weight: bold;
6464
text-align: center;
6565
background: linear-gradient(to right, #8e44ad, #e84393);
6666
-webkit-background-clip: text;
6767
-webkit-text-fill-color: transparent;
68-
margin: 0;
68+
margin: 0;
6969
}
7070

7171
.logo-container {
7272
flex: 1;
7373
display: flex;
7474
justify-content: center;
75-
margin-left: 40px;
76-
margin-right: 40px;
75+
margin-left: 40px;
76+
margin-right: 40px;
7777
}
7878

7979
.logo {
@@ -123,6 +123,32 @@
123123
margin-bottom: 10px;
124124
}
125125

126+
.email-display2 {
127+
margin-bottom: 10px;
128+
text-align: center;
129+
}
130+
131+
.email-display2 > span {
132+
position: relative;
133+
padding: 0.5rem 1rem;
134+
}
135+
136+
.email-display2 > span:after {
137+
content: "";
138+
position: absolute;
139+
inset: 0;
140+
border: 1px solid var(--bs-border-color);
141+
border-radius: 20px;
142+
}
143+
144+
.login-video-wrap {
145+
text-align: center;
146+
}
147+
148+
.login-video {
149+
width: 192px;
150+
}
151+
126152
.error {
127153
color: red;
128154
font-size: 13px;
61.2 KB
Binary file not shown.
143 KB
Binary file not shown.
9.88 KB
Loading
125 KB
Binary file not shown.
66.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)