AI 生成: 一个仿 aptv.pro 的视频站点,使用 Python Flask 构建,包含视频列表、分类、搜索和视频播放页面。

This commit is contained in:
eeuse
2026-09-28 22:34:54 +08:00
commit b0ecaa4122
9 changed files with 673 additions and 0 deletions
+293
View File
@@ -0,0 +1,293 @@
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
--bg: #0f1115;
--bg-soft: #171a21;
--card: #1c2029;
--text: #eaeaea;
--muted: #9aa3b2;
--accent: #ff5c39;
--accent-2: #ff8a5c;
--radius: 10px;
}
body {
background: var(--bg);
color: var(--text);
font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif;
line-height: 1.6;
min-height: 100vh;
display: flex;
flex-direction: column;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* Header */
.header {
background: rgba(15, 17, 21, .92);
backdrop-filter: blur(8px);
border-bottom: 1px solid #232733;
position: sticky;
top: 0;
z-index: 50;
}
.header-inner {
display: flex;
align-items: center;
justify-content: space-between;
height: 64px;
gap: 16px;
}
.logo {
font-size: 22px;
font-weight: 800;
color: var(--text);
text-decoration: none;
letter-spacing: .5px;
}
.logo span { color: var(--accent); }
.search-form {
display: flex;
gap: 8px;
}
.search-form input {
background: var(--bg-soft);
border: 1px solid #2a2f3b;
color: var(--text);
padding: 8px 14px;
border-radius: var(--radius);
outline: none;
width: 220px;
transition: border-color .2s;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
background: var(--accent);
color: #fff;
border: none;
padding: 8px 16px;
border-radius: var(--radius);
cursor: pointer;
font-weight: 600;
transition: background .2s;
}
.search-form button:hover { background: var(--accent-2); }
/* Main */
main.container {
flex: 1;
padding-top: 24px;
padding-bottom: 40px;
}
/* Categories */
.categories {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 24px;
}
.cat {
color: var(--muted);
text-decoration: none;
padding: 6px 14px;
border-radius: 999px;
background: var(--bg-soft);
border: 1px solid #2a2f3b;
font-size: 14px;
transition: all .2s;
}
.cat:hover { color: var(--text); border-color: var(--accent); }
.cat.active {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}
.result-tip { color: var(--muted); margin-bottom: 16px; font-size: 14px; }
/* Grid */
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 20px;
}
.card {
background: var(--card);
border-radius: var(--radius);
overflow: hidden;
text-decoration: none;
color: var(--text);
transition: transform .2s, box-shadow .2s;
display: block;
}
.card:hover {
transform: translateY(-4px);
box-shadow: 0 10px 24px rgba(0,0,0,.5);
}
.cover {
position: relative;
aspect-ratio: 5 / 7;
overflow: hidden;
background: #222;
}
.cover img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
transition: transform .3s;
}
.card:hover .cover img { transform: scale(1.05); }
.rating {
position: absolute;
top: 8px;
right: 8px;
background: rgba(0,0,0,.7);
color: #ffd166;
font-size: 12px;
font-weight: 700;
padding: 2px 8px;
border-radius: 6px;
}
.card-body { padding: 10px 12px 14px; }
.card-title {
font-size: 15px;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.card-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
/* Empty */
.empty {
text-align: center;
padding: 80px 20px;
color: var(--muted);
}
.empty h2 { color: var(--text); margin-bottom: 10px; }
.empty a { color: var(--accent); text-decoration: none; }
/* Detail */
.detail { display: flex; flex-direction: column; gap: 24px; }
.player-wrap {
background: #000;
border-radius: var(--radius);
overflow: hidden;
aspect-ratio: 16 / 9;
}
.player { width: 100%; height: 100%; display: block; background: #000; }
.detail-info {
display: flex;
gap: 24px;
background: var(--card);
padding: 20px;
border-radius: var(--radius);
}
.detail-cover {
flex: 0 0 160px;
border-radius: var(--radius);
overflow: hidden;
}
.detail-cover img { width: 100%; display: block; }
.detail-text { flex: 1; }
.detail-text h1 { font-size: 26px; margin-bottom: 12px; }
.detail-meta {
display: flex;
gap: 14px;
align-items: center;
color: var(--muted);
font-size: 14px;
margin-bottom: 14px;
flex-wrap: wrap;
}
.tag {
background: var(--accent);
color: #fff;
padding: 2px 10px;
border-radius: 6px;
font-size: 12px;
}
.score { color: #ffd166; font-weight: 700; }
.detail-desc { color: #c9d1dc; margin-bottom: 18px; }
.back-btn {
display: inline-block;
color: var(--text);
text-decoration: none;
background: var(--bg-soft);
border: 1px solid #2a2f3b;
padding: 8px 16px;
border-radius: var(--radius);
font-size: 14px;
transition: all .2s;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }
.section-title {
font-size: 18px;
margin-bottom: 14px;
padding-left: 10px;
border-left: 3px solid var(--accent);
}
/* Footer */
.footer {
border-top: 1px solid #232733;
padding: 20px 0;
color: var(--muted);
font-size: 13px;
text-align: center;
}
/* Responsive */
@media (max-width: 640px) {
.header-inner { flex-wrap: wrap; height: auto; padding: 12px 0; }
.search-form { width: 100%; }
.search-form input { flex: 1; width: auto; }
.grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.detail-info { flex-direction: column; }
.detail-cover { flex: none; max-width: 180px; }
.detail-text h1 { font-size: 20px; }
}
+30
View File
@@ -0,0 +1,30 @@
// 前端交互脚本
(function () {
'use strict';
// 卡片点击时添加轻微反馈
document.addEventListener('click', function (e) {
const card = e.target.closest('.card');
if (!card) return;
card.style.transform = 'scale(0.98)';
setTimeout(function () { card.style.transform = ''; }, 150);
});
// 搜索框自动聚焦(当 URL 带 q 参数时)
const params = new URLSearchParams(window.location.search);
if (params.get('q')) {
const input = document.querySelector('.search-form input');
if (input) {
input.focus();
input.setSelectionRange(input.value.length, input.value.length);
}
}
// 视频播放错误提示
const player = document.querySelector('.player');
if (player) {
player.addEventListener('error', function () {
console.warn('视频加载失败,请检查视频源。');
});
}
})();