Skip to content

Commit 31de35d

Browse files
committed
doc: 增加动画特效
1 parent 2c0b1ff commit 31de35d

File tree

7 files changed

+81
-25
lines changed

7 files changed

+81
-25
lines changed

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

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,53 +23,77 @@
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+
3344
}
34-
<div class="logo-container">
35-
<h1 class="blazor-text">BootstrapBlazor</h1>
36-
</div>
3745
</div>
3846
@if (!isEmailEntered)
3947
{
40-
<h2>登录</h2>
48+
<h3>登录</h3>
4149
<p class="subtitle">使用你的 BootstrapBlazor 帐户。</p>
42-
<BootstrapInput type="email" class="input" placeholder="电子邮件或电话号码" @bind-Value="email" />
50+
<BootstrapInput type="email" class="input" placeholder="电子邮件或电话号码" @bind-Value="email"></BootstrapInput>
4351
<div class="error" hidden="@(!showEmailError)">请输入有效的电子邮件地址或电话号码</div>
4452
<Button class="button" Color="Color.Primary" OnClick="OnEmailSubmit">下一步</Button>
4553
<div class="links">
46-
<a href="#">忘记用户名?</a>
54+
<a href="#" @onclick:preventDefault>忘记用户名?</a>
4755
</div>
4856
<div class="small">
4957
不熟悉 BootstrapBlazor?<a href="/">去看文档</a>
5058
</div>
5159
}
52-
else
60+
else if (!isAuth)
5361
{
54-
<h2>输入你的密码</h2>
62+
<h3>输入你的密码</h3>
5563
<p class="email-display">@email</p>
56-
<BootstrapInput type="password" class="input" placeholder="密码" @bind-Value="password" />
64+
<BootstrapInput type="password" class="input" placeholder="密码" @bind-Value="password"></BootstrapInput>
5765
<div class="links">
58-
<a href="#">忘记了密码?</a>
66+
<a href="#" @onclick:preventDefault>忘记了密码?</a>
5967
</div>
60-
<Button class="button" Color="Color.Primary">下一步</Button>
68+
<Button class="button" Color="Color.Primary" OnClick="OnPasswordSubmit">下一步</Button>
6169
<div class="links">
62-
<a href="#">其他登录方法</a>
70+
<a href="#" @onclick:preventDefault>其他登录方法</a>
6371
</div>
6472
}
73+
else
74+
{
75+
<h3>欢迎加入 BootstrapBlazor</h3>
76+
<div class="email-display2">@email</div>
77+
<div class="login-video-wrap">
78+
<video class="login-video" autoplay="autoplay" playsinline="playsinline" disablepictureinpicture="">
79+
<source src="samples/login5/loading1.mp4" type="video/mp4; codecs=av01.0.05M.08">
80+
<source src="samples/login5/loading.mov" type="video/quicktime; codecs=hvc1.1.6.H120.b0">
81+
<source src="samples/login5/loading.webm" type="video/webm; codecs=vp9">
82+
<source src="samples/login5/loading.mp4" type="video/mp4; codecs=avc1.42E01E">
83+
<img src="samples/login5/loading.png" alt="" role="presentation">
84+
</video>
85+
</div>
86+
<Button class="button" Color="Color.Primary" OnClick="OnEnterSubmit">进入</Button>
87+
}
6588
</div>
6689
</div>
6790
</div>
6891

6992
@code {
70-
private bool isEmailEntered = false;
71-
private string email = "";
72-
private string password = "";
93+
private bool isEmailEntered = true;
94+
private bool isAuth = true;
95+
private string email = "[email protected]";
96+
private string password = "123456";
7397
private bool showEmailError = false;
7498

7599
private void OnEmailSubmit()
@@ -85,6 +109,18 @@
85109
}
86110
}
87111

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

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

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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,26 @@
123123
margin-bottom: 10px;
124124
}
125125

126+
.email-display2 {
127+
margin-bottom: 10px;
128+
text-align: center;
129+
}
130+
131+
.email-display2:after {
132+
content: "";
133+
border: 1px solid var(--bs-border-color);
134+
border-radius: 20px;
135+
padding: .5rem;
136+
}
137+
138+
.login-video-wrap {
139+
text-align: center;
140+
}
141+
142+
.login-video {
143+
width: 192px;
144+
}
145+
126146
.error {
127147
color: red;
128148
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)