统一样式

This commit is contained in:
史悦
2025-09-11 13:17:27 +08:00
parent 483ab26505
commit adbd205b7e
7 changed files with 942 additions and 283 deletions

View File

@@ -4,77 +4,12 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>加入房间 - 打飞机对战</title>
<!-- 引入通用样式 -->
<link rel="stylesheet" href="common-styles.css">
<style>
/* 基础CSS变量 */
:root {
/* 主色调 - 深空科技蓝 */
--primary-color: #6366f1;
--primary-light: #8b5cf6;
--primary-dark: #4f46e5;
/* 辅助色 - 科技青色 */
--secondary-color: #40e0d0;
--secondary-light: #26d0ce;
/* 强调色 - 橙色 */
--accent-color: #f59e0b;
--accent-light: #fbbf24;
/* 危险色 - 红色 */
--danger-color: #ff4757;
--danger-light: #ff6b6b;
/* 成功色 - 绿色 */
--success-color: #4ade80;
--success-light: #6ee7b7;
/* 背景色系 - 深色渐变 */
--bg-primary: #0f1419;
--bg-secondary: #1a1d29;
--bg-tertiary: #252837;
--bg-elevated: #2d3142;
/* 渐变背景 */
--gradient-bg: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 30%, #16213e 70%, #0f3460 100%);
/* 边框色系 */
--border-primary: #3d4159;
--border-secondary: #4a5073;
--border-highlight: #6366f1;
--border-accent: rgba(64, 224, 208, 0.3);
/* 文字色系 */
--text-primary: #ffffff;
--text-secondary: #b4b7c9;
--text-tertiary: #9ca3af;
--text-disabled: #6b7280;
/* 触摸目标尺寸 */
--touch-target-min: 44px;
--safe-area-padding: 20px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Microsoft YaHei UI", sans-serif;
background: var(--gradient-bg);
color: var(--text-primary);
min-height: 100vh;
display: flex;
flex-direction: column;
overflow-x: hidden;
touch-action: manipulation;
-webkit-user-select: none;
user-select: none;
}
/* 加入房间列表页面特定样式 */
.safe-area {
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
@@ -82,51 +17,6 @@
padding-bottom: env(safe-area-inset-bottom);
}
.app-container {
flex: 1;
display: flex;
flex-direction: column;
padding: var(--safe-area-padding);
max-width: 400px;
margin: 0 auto;
width: 100%;
}
/* 头部导航 */
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 0;
margin-bottom: 20px;
}
.back-btn {
width: 40px;
height: 40px;
border: none;
background: rgba(99, 102, 241, 0.15);
border-radius: 12px;
color: var(--primary-color);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
font-size: 18px;
}
.back-btn:active {
transform: scale(0.95);
background: rgba(99, 102, 241, 0.25);
}
.page-title {
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
}
.placeholder {
width: 40px;
}
@@ -478,6 +368,9 @@
</section>
</div>
<!-- 引入导航功能 -->
<script src="navigation.js"></script>
<script>
// 房间数据模拟
const mockRooms = [
@@ -506,8 +399,17 @@
// 返回上一页
function goBack() {
console.log('返回上一页');
vibrate();
// 实际项目中这里应该调用路由返回
if (typeof window.vibrate === 'function') {
window.vibrate();
} else {
vibrate();
}
// 使用导航功能返回入口页面
if (typeof navigateTo === 'function') {
navigateTo('entry');
} else {
window.location.href = '01_入口页面.html';
}
}
// 搜索房间
@@ -525,7 +427,11 @@
}
console.log('搜索房间:', roomNumber);
vibrate();
if (typeof window.vibrate === 'function') {
window.vibrate();
} else {
vibrate();
}
showLoading();
// 模拟搜索延迟
@@ -543,16 +449,23 @@
// 加入房间
function joinRoom(roomId) {
console.log('加入房间:', roomId);
vibrate();
if (confirm('确定要加入房间 ' + roomId + ' 吗?')) {
showToast('正在加入房间...');
// 实际项目中这里应该调用加入房间的API
setTimeout(() => {
showToast('加入成功!');
// 跳转到房间等待页面
}, 1500);
if (typeof window.vibrate === 'function') {
window.vibrate();
} else {
vibrate();
}
showToast('正在加入房间...');
// 实际项目中这里应该调用加入房间的API
setTimeout(() => {
showToast('加入成功!');
// 跳转到房间等待页面
if (typeof navigateTo === 'function') {
navigateTo('roomWaiting');
} else {
window.location.href = '02_房间等待[房主].html';
}
}, 1500);
}
// 观战房间