初始化版本
This commit is contained in:
348
assets/script.js
Normal file
348
assets/script.js
Normal file
@@ -0,0 +1,348 @@
|
||||
// 外部脚本文件:轻量的菜单高亮逻辑与占位
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// 菜单点击激活态
|
||||
const links = Array.from(document.querySelectorAll('.menu__link'));
|
||||
links.forEach(link => {
|
||||
link.addEventListener('click', () => {
|
||||
links.forEach(l => l.classList.remove('is-active'));
|
||||
link.classList.add('is-active');
|
||||
});
|
||||
});
|
||||
|
||||
// ===== 视频逻辑 =====
|
||||
const player = document.getElementById('player');
|
||||
const videoWrap = document.getElementById('videoWrap');
|
||||
const videoPanel = document.getElementById('video');
|
||||
const includeLocalToggle = document.getElementById('includeLocalToggle');
|
||||
// 底部工具栏与标题已移除,无需获取相关元素
|
||||
|
||||
if (!player || !videoWrap) return; // 仅在视频区存在时执行
|
||||
|
||||
let playlist = [];
|
||||
let index = 0;
|
||||
let includeLocal = includeLocalToggle ? includeLocalToggle.checked : false;
|
||||
const BUFFER_SIZE = 3; // 预缓存条数
|
||||
|
||||
const loadVideo = (i, autoPlay = false) => {
|
||||
if (!playlist.length) return;
|
||||
index = (i + playlist.length) % playlist.length;
|
||||
const item = playlist[index];
|
||||
player.src = item.url;
|
||||
// 已移除标题展示,无需设置文本
|
||||
player.load();
|
||||
if (videoPanel) videoPanel.style.setProperty('--progress', '0');
|
||||
if (autoPlay) {
|
||||
player.play().catch(() => {});
|
||||
}
|
||||
};
|
||||
|
||||
// 按需拉取一条或多条新视频
|
||||
const fetchOne = async (n = 1) => {
|
||||
try {
|
||||
const url = `api/videos.php?count=${n}&include_local=${includeLocal ? 1 : 0}&local_count=${n}`;
|
||||
const res = await fetch(url);
|
||||
const data = await res.json();
|
||||
const items = Array.isArray(data.list) ? data.list : [];
|
||||
if (items.length) {
|
||||
const existing = new Set(playlist.map(i => i.url));
|
||||
const append = items.filter(it => it && it.url && !existing.has(it.url));
|
||||
playlist = playlist.concat(append);
|
||||
}
|
||||
} catch (e) {
|
||||
// 忽略错误
|
||||
}
|
||||
};
|
||||
|
||||
const ensureBuffer = async () => {
|
||||
const ahead = playlist.length - index - 1;
|
||||
if (ahead < BUFFER_SIZE) {
|
||||
await fetchOne(BUFFER_SIZE - ahead);
|
||||
}
|
||||
};
|
||||
|
||||
const next = async () => {
|
||||
await ensureBuffer();
|
||||
if (index + 1 < playlist.length) {
|
||||
loadVideo(index + 1, true);
|
||||
} else if (!playlist.length) {
|
||||
// 仍无数据,尝试拉取
|
||||
await fetchOne(BUFFER_SIZE + 1);
|
||||
if (playlist.length) loadVideo(0, true);
|
||||
}
|
||||
};
|
||||
const prev = async () => {
|
||||
if (index - 1 >= 0) {
|
||||
loadVideo(index - 1, true);
|
||||
}
|
||||
};
|
||||
|
||||
// 鼠标移入显示并播放,移出隐藏并暂停
|
||||
const showVideo = () => {
|
||||
player.classList.add('visible');
|
||||
player.play().catch(() => {});
|
||||
// 用户首次交互后取消静音(可选)
|
||||
if (player.muted) player.muted = false;
|
||||
};
|
||||
const hideVideo = () => {
|
||||
player.pause();
|
||||
player.classList.remove('visible');
|
||||
// 可选:player.currentTime = 0; // 回到开头
|
||||
};
|
||||
videoWrap.addEventListener('mouseenter', showVideo);
|
||||
videoWrap.addEventListener('mouseleave', hideVideo);
|
||||
|
||||
// 页面加载时若鼠标已在视频区域,立即显示
|
||||
if (videoWrap.matches(':hover')) showVideo();
|
||||
|
||||
// 单击下一条,双击上一条(去抖处理)
|
||||
// 按最新需求:不再点击视频进入投稿,而是点击菜单栏“视频”进入投稿
|
||||
let clickTimer = null;
|
||||
videoWrap.addEventListener('click', () => {
|
||||
if (clickTimer) return;
|
||||
clickTimer = setTimeout(() => {
|
||||
clickTimer = null;
|
||||
next();
|
||||
}, 250);
|
||||
});
|
||||
videoWrap.addEventListener('dblclick', () => {
|
||||
if (clickTimer) {
|
||||
clearTimeout(clickTimer);
|
||||
clickTimer = null;
|
||||
}
|
||||
prev();
|
||||
});
|
||||
|
||||
// 自动保存:播放到一半时保存(每个视频仅保存一次)
|
||||
const savedURLs = new Set();
|
||||
const trySaveOnHalf = async () => {
|
||||
const item = playlist[index];
|
||||
if (!item) return;
|
||||
// 本地视频不入库(URL非http/https时跳过保存)
|
||||
if (!/^https?:\/\//i.test(item.url || '')) return;
|
||||
const d = player.duration;
|
||||
const t = player.currentTime;
|
||||
if (!isFinite(d) || d <= 0) return; // 元数据未就绪
|
||||
const reachedHalf = t / d >= 0.5;
|
||||
if (!reachedHalf || savedURLs.has(item.url)) return;
|
||||
try {
|
||||
const res = await fetch('api/save_video.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url: item.url, title: item.title || '' }),
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data && data.success) {
|
||||
savedURLs.add(item.url);
|
||||
}
|
||||
} catch (e) {
|
||||
// 忽略保存错误,不影响播放
|
||||
}
|
||||
};
|
||||
player.addEventListener('timeupdate', trySaveOnHalf);
|
||||
player.addEventListener('timeupdate', () => {
|
||||
const d = player.duration;
|
||||
const t = player.currentTime;
|
||||
if (!isFinite(d) || d <= 0) return;
|
||||
const p = Math.max(0, Math.min(1, t / d));
|
||||
if (videoPanel) videoPanel.style.setProperty('--progress', String(p * 360));
|
||||
});
|
||||
|
||||
// 播放结束自动下一条
|
||||
player.addEventListener('ended', () => { next(); });
|
||||
|
||||
// 从后端接口获取视频列表
|
||||
// 初始化:先拉取首条并填充缓存
|
||||
(async () => {
|
||||
await fetchOne(BUFFER_SIZE + 1);
|
||||
if (!playlist.length) {
|
||||
// 无视频可用
|
||||
return;
|
||||
}
|
||||
loadVideo(0, false);
|
||||
// 启动缓冲确保后续播放连续
|
||||
await ensureBuffer();
|
||||
})();
|
||||
|
||||
// 切换本地视频开关:重置播放列表并重新拉取
|
||||
if (includeLocalToggle) {
|
||||
includeLocalToggle.addEventListener('change', async () => {
|
||||
includeLocal = includeLocalToggle.checked;
|
||||
// 重置播放列表
|
||||
playlist = [];
|
||||
index = 0;
|
||||
await fetchOne(BUFFER_SIZE + 1);
|
||||
if (playlist.length) {
|
||||
loadVideo(0, false);
|
||||
await ensureBuffer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ===== 讨论区气泡逻辑 =====
|
||||
const discussionWrap = document.getElementById('discussionWrap');
|
||||
if (discussionWrap) {
|
||||
const fetchAvatar = async () => {
|
||||
try {
|
||||
const r = await fetch('api/head.php');
|
||||
const j = await r.json();
|
||||
return j.url || '';
|
||||
} catch { return ''; }
|
||||
};
|
||||
const fetchText = async () => {
|
||||
try {
|
||||
const r = await fetch('api/text.php'); // 随机来源
|
||||
const j = await r.json();
|
||||
return { text: j.text || '', source: j.source || '' };
|
||||
} catch { return { text: '', source: '' }; }
|
||||
};
|
||||
|
||||
const createBubble = (avatarUrl, text, side = Math.random() < 0.5 ? 'left' : 'right') => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'bubble' + (side === 'right' ? ' right' : '');
|
||||
|
||||
const img = document.createElement('img');
|
||||
img.className = 'avatar';
|
||||
img.src = avatarUrl || 'https://images.unsplash.com/photo-1547425260-76bcadfb4f9b?w=200&h=200&fit=crop';
|
||||
img.alt = '头像';
|
||||
|
||||
const textEl = document.createElement('div');
|
||||
textEl.className = 'bubble__text';
|
||||
textEl.textContent = text || '...';
|
||||
|
||||
item.appendChild(img);
|
||||
item.appendChild(textEl);
|
||||
discussionWrap.appendChild(item);
|
||||
// 滚动到底部
|
||||
discussionWrap.scrollTop = discussionWrap.scrollHeight;
|
||||
|
||||
// 控制条数最多50条
|
||||
const nodes = discussionWrap.querySelectorAll('.bubble');
|
||||
if (nodes.length > 50) {
|
||||
for (let i = 0; i < nodes.length - 50; i++) {
|
||||
discussionWrap.removeChild(nodes[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const savedAvatars = new Set();
|
||||
const savedTexts = new Set();
|
||||
|
||||
const spawn = async () => {
|
||||
const [avatar, textResp] = await Promise.all([fetchAvatar(), fetchText()]);
|
||||
const text = textResp.text;
|
||||
const source = textResp.source;
|
||||
createBubble(avatar, text);
|
||||
// 保存到本地,避免重复
|
||||
try {
|
||||
// 仅保存远程头像(http/https),本地相对路径跳过
|
||||
if (avatar && /^https?:\/\//i.test(avatar) && !savedAvatars.has(avatar)) {
|
||||
savedAvatars.add(avatar);
|
||||
await fetch('api/save_avatar.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url: avatar })
|
||||
});
|
||||
}
|
||||
} catch {}
|
||||
try {
|
||||
const key = text.trim();
|
||||
if (key && !savedTexts.has(key)) {
|
||||
savedTexts.add(key);
|
||||
await fetch('api/save_text.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ text: key, source })
|
||||
});
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
// 立即生成一个,然后每5秒生成一次(可在此处调整间隔)
|
||||
spawn();
|
||||
setInterval(spawn, 5000);
|
||||
}
|
||||
|
||||
// ===== 图片区逻辑(淡进淡出,10s刷新,自动保存不清理) =====
|
||||
const pictureWrap = document.getElementById('pictureWrap');
|
||||
const pictureImg = document.getElementById('pictureImg');
|
||||
const galleryPanel = document.getElementById('gallery');
|
||||
if (pictureWrap && pictureImg) {
|
||||
const sources = ['heisi', 'wapmeinvpic', 'baisi', 'meinvpic'];
|
||||
const savedPics = new Set();
|
||||
|
||||
const fetchPicture = async () => {
|
||||
const type = sources[Math.floor(Math.random() * sources.length)];
|
||||
try {
|
||||
const r = await fetch(`api/picture.php?type=${encodeURIComponent(type)}`);
|
||||
const j = await r.json();
|
||||
return { url: j.url || '', source: j.source || type };
|
||||
} catch {
|
||||
return { url: '', source: type };
|
||||
}
|
||||
};
|
||||
|
||||
const showPicture = async () => {
|
||||
// 先淡出
|
||||
pictureImg.classList.remove('visible');
|
||||
const { url, source } = await fetchPicture();
|
||||
if (!url) return; // 拉取失败时跳过本次
|
||||
// 等图片加载完成后再淡入
|
||||
await new Promise(resolve => {
|
||||
pictureImg.onload = () => { resolve(); };
|
||||
pictureImg.onerror = () => { resolve(); };
|
||||
pictureImg.src = url;
|
||||
});
|
||||
// 加载完成但不再自动显示,仅悬停时显示
|
||||
|
||||
// 自动保存(避免重复),后端不做清理
|
||||
try {
|
||||
// 仅保存远程图片(http/https),本地相对路径跳过
|
||||
if (/^https?:\/\//i.test(url) && !savedPics.has(url)) {
|
||||
savedPics.add(url);
|
||||
await fetch('api/save_picture.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url })
|
||||
});
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
// 悬停显隐
|
||||
const showPic = () => pictureImg.classList.add('visible');
|
||||
const hidePic = () => pictureImg.classList.remove('visible');
|
||||
pictureWrap.addEventListener('mouseenter', showPic);
|
||||
pictureWrap.addEventListener('mouseleave', hidePic);
|
||||
|
||||
// 页面加载时若鼠标已在图片区域,立即显示
|
||||
if (pictureWrap.matches(':hover')) showPic();
|
||||
|
||||
let picIntervalMs = 10000;
|
||||
let picLastSwap = Date.now();
|
||||
const updatePicProgress = () => {
|
||||
const elapsed = Date.now() - picLastSwap;
|
||||
const p = Math.max(0, Math.min(1, elapsed / picIntervalMs));
|
||||
if (galleryPanel) galleryPanel.style.setProperty('--pic-progress', String(p * 360));
|
||||
requestAnimationFrame(updatePicProgress);
|
||||
};
|
||||
requestAnimationFrame(updatePicProgress);
|
||||
|
||||
(async () => {
|
||||
const { url } = await fetchPicture();
|
||||
if (url) {
|
||||
pictureImg.src = url;
|
||||
picLastSwap = Date.now();
|
||||
if (galleryPanel) galleryPanel.style.setProperty('--pic-progress', '0');
|
||||
if (pictureWrap.matches(':hover')) showPic();
|
||||
}
|
||||
})();
|
||||
setInterval(async () => {
|
||||
const { url } = await fetchPicture();
|
||||
if (url) {
|
||||
pictureImg.src = url;
|
||||
picLastSwap = Date.now();
|
||||
if (galleryPanel) galleryPanel.style.setProperty('--pic-progress', '0');
|
||||
if (pictureWrap.matches(':hover')) showPic();
|
||||
}
|
||||
}, picIntervalMs);
|
||||
}
|
||||
});
|
||||
440
assets/style.css
Normal file
440
assets/style.css
Normal file
@@ -0,0 +1,440 @@
|
||||
/* 外部样式文件:从 index.php 迁移而来 */
|
||||
:root {
|
||||
--red: #e32626;
|
||||
--border: 2px solid var(--red);
|
||||
--gap: 32px;
|
||||
--page-max: 1200px;
|
||||
--radius: 6px;
|
||||
--shadow: 0 6px 14px rgba(226, 38, 38, 0.08);
|
||||
--shadow-hover: 0 8px 20px rgba(226, 38, 38, 0.12);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
||||
'Helvetica Neue', Arial, 'Noto Sans', 'PingFang SC', 'Microsoft YaHei',
|
||||
sans-serif;
|
||||
color: #333;
|
||||
background:
|
||||
radial-gradient(1200px 400px at 10% -20%, #fff5f5 0%, transparent 40%),
|
||||
linear-gradient(#ffffff, #ffffff);
|
||||
}
|
||||
|
||||
.page {
|
||||
max-width: var(--page-max);
|
||||
padding: 16px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* 顶部菜单条 */
|
||||
.menu {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
border: var(--border);
|
||||
background: #fff;
|
||||
min-height: 60px;
|
||||
padding: 10px 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: var(--gap);
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 10px 24px rgba(226, 38, 38, 0.08);
|
||||
}
|
||||
|
||||
.menu__logo {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: var(--red);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.menu__nav {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.menu__link {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: var(--red);
|
||||
padding: 8px 14px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--red);
|
||||
background: #fff;
|
||||
transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.menu__link:hover,
|
||||
.menu__link:focus-visible {
|
||||
background: #fff1f1;
|
||||
outline: none;
|
||||
box-shadow: 0 6px 14px rgba(226, 38, 38, 0.15);
|
||||
}
|
||||
|
||||
.menu__link.is-active {
|
||||
background: var(--red);
|
||||
color: #fff;
|
||||
border-color: var(--red);
|
||||
box-shadow: 0 6px 14px rgba(226, 38, 38, 0.18);
|
||||
}
|
||||
|
||||
/* 三列区域 */
|
||||
.content {
|
||||
display: grid;
|
||||
grid-template-columns: clamp(180px, 22%, 240px) 1fr clamp(220px, 26%, 300px);
|
||||
gap: var(--gap);
|
||||
}
|
||||
|
||||
.panel {
|
||||
border: var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: #fff;
|
||||
min-height: 380px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
color: var(--red);
|
||||
text-align: center;
|
||||
box-shadow: var(--shadow);
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
.panel:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-hover);
|
||||
}
|
||||
|
||||
/* 讨论区固定高度并使用内部滚动,不让页面无限增长 */
|
||||
#discussion.panel {
|
||||
align-items: stretch;
|
||||
justify-content: flex-start;
|
||||
height: 380px; /* 与其他面板保持一致高度 */
|
||||
}
|
||||
|
||||
.panel:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 14px 28px rgba(226, 38, 38, 0.1);
|
||||
}
|
||||
|
||||
/* 响应式:窄屏改为纵向排列 */
|
||||
@media (max-width: 992px) {
|
||||
.content { grid-template-columns: 1fr; }
|
||||
.panel { min-height: 220px; }
|
||||
#discussion.panel { height: 240px; }
|
||||
}
|
||||
|
||||
/* ===== 视频区域样式 ===== */
|
||||
.video-wrap {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 4px; /* 边距缩小,减少白边 */
|
||||
}
|
||||
|
||||
#video.panel { position: relative; }
|
||||
#video.panel::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
padding: 2px;
|
||||
border-radius: var(--radius);
|
||||
background: conic-gradient(
|
||||
var(--red) 0deg,
|
||||
var(--red) calc(var(--progress, 0) * 1deg),
|
||||
rgba(226, 38, 38, 0.18) calc(var(--progress, 0) * 1deg),
|
||||
rgba(226, 38, 38, 0.18) 360deg
|
||||
);
|
||||
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
||||
-webkit-mask-composite: xor;
|
||||
mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
||||
mask-composite: exclude;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 视频面板固定高度,独立于图片面板的高度变化 */
|
||||
#video.panel { align-items: stretch; justify-content: flex-start; height: 380px; overflow: hidden; }
|
||||
|
||||
/* 菜单栏中的“包含本地”控件样式 */
|
||||
.menu__controls {
|
||||
background: #f6f6f6;
|
||||
border: 1px solid var(--red);
|
||||
color: var(--red);
|
||||
padding: 6px 12px;
|
||||
border-radius: 999px;
|
||||
font-size: 13px;
|
||||
box-shadow: 0 6px 14px rgba(226, 38, 38, 0.08);
|
||||
user-select: none;
|
||||
}
|
||||
.menu__controls input[type="checkbox"] { vertical-align: middle; margin-right: 6px; }
|
||||
|
||||
video#player {
|
||||
width: 100%;
|
||||
flex: 1 1 auto;
|
||||
height: 100%; /* 使视频充满可用高度,被“框”包裹 */
|
||||
display: block;
|
||||
border-radius: 6px; /* 圆角减小,进一步减少四角的白边显著程度 */
|
||||
background: #000;
|
||||
object-fit: contain; /* 保持原视频比例 */
|
||||
opacity: 0;
|
||||
transition: opacity 0.8s ease-in-out;
|
||||
}
|
||||
video#player.visible { opacity: 1; }
|
||||
|
||||
/* 顶部提示气泡已移除 */
|
||||
|
||||
/* 工具栏与按钮已移除,根据用户需求隐藏相关样式占位 */
|
||||
|
||||
/* ===== 讨论区样式 ===== */
|
||||
.discussion-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--red) #fff1f1; /* 滑块红 / 轨道浅红 */
|
||||
}
|
||||
/* Webkit 内核滚动条 */
|
||||
.discussion-wrap::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
.discussion-wrap::-webkit-scrollbar-track {
|
||||
background: #fff1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.discussion-wrap::-webkit-scrollbar-thumb {
|
||||
background: var(--red);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.discussion-wrap::-webkit-scrollbar-thumb:hover {
|
||||
background: #c53030;
|
||||
}
|
||||
|
||||
.bubble {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
max-width: 92%;
|
||||
animation: fadeIn 0.25s ease;
|
||||
}
|
||||
.bubble.right { flex-direction: row-reverse; margin-left: auto; }
|
||||
|
||||
.avatar {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
flex: 0 0 36px;
|
||||
object-fit: cover;
|
||||
border: 2px solid var(--red);
|
||||
}
|
||||
|
||||
.bubble__text {
|
||||
background: #fff1f1;
|
||||
border: 1px solid var(--red);
|
||||
color: #a81515;
|
||||
padding: 8px 12px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 6px 14px rgba(226, 38, 38, 0.08);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
/* ===== 图片区域样式 ===== */
|
||||
#gallery.panel { align-items: stretch; justify-content: flex-start; position: relative; }
|
||||
#gallery.panel::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
padding: 2px;
|
||||
border-radius: var(--radius);
|
||||
background: conic-gradient(
|
||||
var(--red) 0deg,
|
||||
var(--red) calc(var(--pic-progress, 0) * 1deg),
|
||||
rgba(226, 38, 38, 0.18) calc(var(--pic-progress, 0) * 1deg),
|
||||
rgba(226, 38, 38, 0.18) 360deg
|
||||
);
|
||||
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
||||
-webkit-mask-composite: xor;
|
||||
mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
||||
mask-composite: exclude;
|
||||
pointer-events: none;
|
||||
}
|
||||
.picture-wrap {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 4px; /* 同步减少图片区的白边 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#pictureImg {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 6px; /* 圆角减小以减少角部白边 */
|
||||
box-shadow: 0 10px 22px rgba(226, 38, 38, 0.08);
|
||||
opacity: 0;
|
||||
transition: opacity 0.8s ease-in-out;
|
||||
}
|
||||
#pictureImg.visible { opacity: 1; }
|
||||
|
||||
@media (max-width: 992px) {
|
||||
#gallery.panel { height: 240px; }
|
||||
#video.panel { height: 240px; }
|
||||
}
|
||||
|
||||
/* 移除对视频框悬停效果的覆盖,恢复默认面板的上浮动画 */
|
||||
|
||||
/* ===== 投稿(上传)页面通用样式 ===== */
|
||||
.upload-container {
|
||||
max-width: 980px;
|
||||
margin: 24px auto;
|
||||
padding: 0 16px;
|
||||
}
|
||||
.upload-container h1 {
|
||||
font-size: 20px;
|
||||
color: var(--red);
|
||||
margin: 0 0 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.upload-title {
|
||||
margin: 0 0 16px;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.upload-grid.two {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.upload-grid.video {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 360px;
|
||||
gap: 16px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
.upload-grid.two { grid-template-columns: 1fr; }
|
||||
.upload-grid.video { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
.card {
|
||||
border: var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 16px;
|
||||
background: #fff;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.dropzone {
|
||||
border: 2px dashed var(--red);
|
||||
border-radius: var(--radius);
|
||||
padding: 16px;
|
||||
text-align: center;
|
||||
background: #fff1f1;
|
||||
color: var(--red);
|
||||
cursor: pointer;
|
||||
box-shadow: var(--shadow);
|
||||
transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
.dropzone.dragging,
|
||||
.dropzone:hover { background: #ffeaea; border-color: #c11; box-shadow: var(--shadow-hover); }
|
||||
|
||||
.field { display: flex; flex-direction: column; gap: 8px; }
|
||||
.field input[type="text"] {
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--red);
|
||||
border-radius: var(--radius);
|
||||
font-size: 14px;
|
||||
transition: border-color .2s ease;
|
||||
}
|
||||
.field input[type="text"]:focus {
|
||||
border-color: #c53030;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.preview-img {
|
||||
width: 100%;
|
||||
height: 280px;
|
||||
object-fit: contain;
|
||||
border: 1px solid var(--red);
|
||||
border-radius: var(--radius);
|
||||
background: #fafafa;
|
||||
}
|
||||
.video-preview {
|
||||
width: 100%;
|
||||
height: 220px;
|
||||
object-fit: contain;
|
||||
border-radius: var(--radius);
|
||||
background: #000;
|
||||
}
|
||||
.meta {
|
||||
font-size: 12px;
|
||||
color: var(--red);
|
||||
margin-top: 8px;
|
||||
}
|
||||
.errors { color: var(--red); font-size: 13px; min-height: 18px; }
|
||||
.tips { color: var(--red); opacity: .8; font-size: 13px; }
|
||||
|
||||
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(135deg, var(--red) 0%, #c53030 100%);
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 10px 18px;
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: opacity .25s ease, transform .2s ease;
|
||||
}
|
||||
.btn:hover {
|
||||
opacity: .92;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.btn[disabled] {
|
||||
opacity: .5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: var(--red);
|
||||
padding: 8px 14px;
|
||||
border-radius: var(--radius);
|
||||
border: 1px solid var(--red);
|
||||
background: #fff;
|
||||
font-size: 14px;
|
||||
transition: background .25s ease, transform .2s ease;
|
||||
}
|
||||
.btn-ghost:hover {
|
||||
background: #fff1f1;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.hidden-input { position: absolute; left: -9999px; }
|
||||
Reference in New Issue
Block a user