feat(UI): 为多个页面添加页面过渡动画效果

为router.php、admin/addapp.php、app.php、error_pages/404.html、error_pages/500.html、admin/login.php、developer/login.php、developer/profile.php和developer/dashboard.php添加fadeIn动画效果,提升用户体验
This commit is contained in:
2025-07-12 17:35:18 +08:00
parent da631ff924
commit 05e49f959a
9 changed files with 168 additions and 9 deletions

View File

@@ -112,10 +112,26 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_app'])) {
backdrop-filter: blur(10px);
background-color: rgba(255, 255, 255, 0.5);
}
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
</style>
</head>
<body>
<body class="page-transition">
<?php if (isset($error)): ?>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.body.classList.add('page-transition');
});
</script>
<div style='color: red; padding: 10px; background-color: #ffeeee; border-radius: 5px; margin-bottom: 20px;'>
<?php echo htmlspecialchars($error); ?>
</div>

View File

@@ -42,11 +42,27 @@ if (!isset($_SESSION['admin'])) {
backdrop-filter: blur(10px);
background-color: rgba(255, 255, 255, 0.5);
}
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
</style>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
</head>
<body>
<body class="page-transition">
<!-- 导航栏 -->
<script>
document.addEventListener('DOMContentLoaded', function() {
document.body.classList.add('page-transition');
});
</script>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<div class="container">
<a href="../index.php"><img src="/favicon.jpeg" alt="Logo" style="height: 30px; margin-right: 10px; border-radius: var(--border-radius);"></a>

18
app.php
View File

@@ -149,10 +149,26 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rating'])) {
backdrop-filter: blur(10px);
background-color: rgba(255, 255, 255, 0.5);
}
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
</style>
</head>
<body>
<body class="page-transition">
<!-- 导航栏 -->
<script>
document.addEventListener('DOMContentLoaded', function() {
document.body.classList.add('page-transition');
});
</script>
<nav class="navbar navbar-expand-lg navbar-light blur-bg">
<div class="container">
<a href="index.php"><img src="/favicon.jpeg" alt="Logo" style="height: 30px; margin-right: 10px; border-radius: var(--border-radius);"></a>

View File

@@ -61,6 +61,19 @@ if (!($conn instanceof mysqli)) {
margin: 0;
padding: 20px;
}
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.dashboard-container {
max-width: 1200px;
margin: 0 auto;
@@ -131,7 +144,7 @@ if (!($conn instanceof mysqli)) {
}
</style>
</head>
<body>
<body class="page-transition">
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-light blur-bg">
<div class="container">
@@ -211,5 +224,10 @@ if (!($conn instanceof mysqli)) {
</div>
<!-- Bootstrap JS and Popper -->
<script src="/js/bootstrap.bundle.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.body.classList.add('page-transition');
});
</script>
</body>
</html>

View File

@@ -92,9 +92,22 @@ if (!($conn instanceof mysqli)) {
background-color: #f4f4f4;
padding: 20px 0;
}
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
</head>
<body>
<body class="page-transition">
<div class="container mt-5 col-md-4">
<h2>开发者登录</h2>
<?php if (isset($success)): ?>
@@ -119,5 +132,10 @@ if (!($conn instanceof mysqli)) {
</div>
</div>
<script src="/js/bootstrap.bundle.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.body.classList.add('page-transition');
});
</script>
</body>
</html>

View File

@@ -104,6 +104,19 @@ if (!($conn instanceof mysqli)) {
margin: 0;
padding: 20px;
}
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.profile-container {
max-width: 800px;
margin: 0 auto;
@@ -126,7 +139,7 @@ if (!($conn instanceof mysqli)) {
}
</style>
</head>
<body>
<body class="page-transition">
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-light blur-bg">
<div class="container">
@@ -182,6 +195,11 @@ if (!($conn instanceof mysqli)) {
</div>
<button type="submit" class="btn btn-primary">保存更改</button>
</form>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.body.classList.add('page-transition');
});
</script>
</body>
</html>

View File

@@ -30,14 +30,32 @@
font-size: 1.2rem;
margin: 1rem 0;
}
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
</head>
<body>
<body class="page-transition">
<div class="error-container">
<h1>404</h1>
<h2>页面未找到</h2>
<p>您请求的页面不存在或已被移动。</p>
<a href="/" class="btn btn-primary mt-3">返回首页</a>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.body.classList.add('page-transition');
});
</script>
</body>
</html>

View File

@@ -30,9 +30,22 @@
font-size: 1.2rem;
margin: 1rem 0;
}
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
</head>
<body>
<body class="page-transition">
<div class="error-container">
<h1>500</h1>
<h2>服务器内部错误</h2>
@@ -40,5 +53,10 @@
<p>我们的技术团队已收到通知,正在处理此问题。</p>
<a href="/" class="btn btn-primary mt-3">返回首页</a>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.body.classList.add('page-transition');
});
</script>
</body>
</html>

View File

@@ -30,6 +30,27 @@
// 为内容添加顶部内边距
echo '<div style="padding-top: 70px;">';
echo '<style>
.page-transition {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>';
echo '<body class="page-transition">';
echo '<script>
document.addEventListener(\'DOMContentLoaded\', function() {
document.body.classList.add(\'page-transition\');
});
</script>';
if (preg_match('/^\/api/', $_SERVER['REQUEST_URI'])) {
include 'api.php';
exit;