Skip to content

Commit

Permalink
Interface optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
lixinyang123 committed Jan 6, 2023
1 parent e787d5a commit be41749
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions CoreHome.Admin/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,39 @@

<img id="user" src="@OssService.GetAvatar()" />

<div id="signCarousel" class="carousel slide pl-4 pr-4" data-ride="carousel" data-interval="false">
<div id="loginCarousel" class="carousel slide pl-4 pr-4" data-ride="carousel" data-interval="false">
<div class="carousel-inner">

<div class="carousel-item">
<h4>Signin with Password</h4>
<h4>Login with Password</h4>
<form method="post" asp-controller="home" asp-action="VerifyPassword">
<div class="form-group pt-2">
<input name="pwd" type="password" class="form-control" placeholder="Enter the password to signin" />
<input name="pwd" type="password" class="form-control" placeholder="Enter the password to login" />
</div>
<button type="submit" class="btn btn-dark" onclick="changeSigninFunc(0)">Submit</button>
<button type="submit" class="btn btn-dark" onclick="changeLoginFunc(0)">Submit</button>
</form>
</div>

<div class="carousel-item">
<h4>Signin with verification code</h4>
<h4>Login with verification code</h4>
<form method="post" asp-controller="home" asp-action="VerifyPassword">
<button id="btn_sign" class="btn btn-dark mt-2" onclick="signIn()">Get verification code</button>
<button id="btn_login" class="btn btn-dark mt-2" onclick="login()">Get verification code</button>
<div class="form-group mt-3">
<input name="pwd" type="password" class="form-control" placeholder="Enter the verification code to signin" />
<input name="pwd" type="password" class="form-control" placeholder="Enter the verification code to login" />
</div>
<button type="submit" class="btn btn-dark" onclick="changeSigninFunc(1)">Submit</button>
<button type="submit" class="btn btn-dark" onclick="changeLoginFunc(1)">Submit</button>
</form>
</div>

</div>

<a class="carousel-control-prev" href="#signCarousel" role="button" data-slide="prev">
<a class="carousel-control-prev" href="#loginCarousel" role="button" data-slide="prev">
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="black" class="bi bi-chevron-compact-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M9.224 1.553a.5.5 0 0 1 .223.67L6.56 8l2.888 5.776a.5.5 0 1 1-.894.448l-3-6a.5.5 0 0 1 0-.448l3-6a.5.5 0 0 1 .67-.223z" />
</svg>
</a>

<a class="carousel-control-next" href="#signCarousel" role="button" data-slide="next">
<a class="carousel-control-next" href="#loginCarousel" role="button" data-slide="next">
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="black" class="bi bi-chevron-compact-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6.776 1.553a.5.5 0 0 1 .671.223l3 6a.5.5 0 0 1 0 .448l-3 6a.5.5 0 1 1-.894-.448L9.44 8 6.553 2.224a.5.5 0 0 1 .223-.671z" />
</svg>
Expand Down
10 changes: 5 additions & 5 deletions CoreHome.Admin/wwwroot/js/home/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let timeOut = 60;

function signIn() {
function login() {
getPassword();
showTime();
}
Expand All @@ -18,11 +18,11 @@ function getPassword() {
}

function showTime() {
document.querySelector("#btn_sign").setAttribute("disabled", "");
document.querySelector("#btn_sign").innerText = `Get verification code again${timeOut}s`;
document.querySelector("#btn_login").setAttribute("disabled", "");
document.querySelector("#btn_login").innerText = `Get verification code again (${timeOut}s)`;
timeOut--;
if (timeOut < 0) {
let btn = document.querySelector("#btn_sign");
let btn = document.querySelector("#btn_login");
btn.innerText = "Get verification code again";
btn.removeAttribute("disabled");
timeOut = 60;
Expand All @@ -31,7 +31,7 @@ function showTime() {
setTimeout(showTime, 1000);
}

function changeSigninFunc(index) {
function changeLoginFunc(index) {
window.localStorage.setItem("SigninFunc", index);
}

Expand Down

0 comments on commit be41749

Please sign in to comment.