room-create.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>创建房间 - LineFunQueue</title>
  7. <!-- Tailwind CSS -->
  8. <script src="https://cdn.tailwindcss.com"></script>
  9. <!-- FontAwesome -->
  10. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  11. <!-- 自定义样式 -->
  12. <link rel="stylesheet" href="../css/custom.css">
  13. <style>
  14. .app-content {
  15. padding-bottom: 60px; /* 为底部导航栏留出空间 */
  16. }
  17. /* 开关样式 */
  18. .switch {
  19. position: relative;
  20. display: inline-block;
  21. width: 44px;
  22. height: 24px;
  23. }
  24. .switch input {
  25. opacity: 0;
  26. width: 0;
  27. height: 0;
  28. }
  29. .slider {
  30. position: absolute;
  31. cursor: pointer;
  32. top: 0;
  33. left: 0;
  34. right: 0;
  35. bottom: 0;
  36. background-color: #ccc;
  37. transition: .4s;
  38. }
  39. .slider:before {
  40. position: absolute;
  41. content: "";
  42. height: 18px;
  43. width: 18px;
  44. left: 3px;
  45. bottom: 3px;
  46. background-color: white;
  47. transition: .4s;
  48. }
  49. input:checked + .slider {
  50. background-color: var(--color-primary);
  51. }
  52. input:checked + .slider:before {
  53. transform: translateX(20px);
  54. }
  55. .slider.round {
  56. border-radius: 24px;
  57. }
  58. .slider.round:before {
  59. border-radius: 50%;
  60. }
  61. </style>
  62. </head>
  63. <body>
  64. <div class="iphone-frame">
  65. <!-- 引入状态栏 -->
  66. <iframe src="../components/status-bar.html" frameborder="0" scrolling="no" style="width:100%; height:44px; overflow:hidden;"></iframe>
  67. <!-- 导航栏 -->
  68. <div class="app-navbar">
  69. <div class="left-button" onclick="history.back()">
  70. <i class="fas fa-chevron-left mr-1"></i> 返回
  71. </div>
  72. <div class="title">创建房间</div>
  73. </div>
  74. <!-- 内容区域 -->
  75. <div class="app-content">
  76. <!-- 游戏信息 -->
  77. <div class="p-3 bg-white flex items-center">
  78. <div class="w-14 h-14 rounded-lg overflow-hidden mr-3">
  79. <img src="https://images.unsplash.com/photo-1582845512747-e42001c95638?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=64&h=64&q=80" class="w-full h-full object-cover" alt="海龟汤">
  80. </div>
  81. <div>
  82. <h3 class="font-bold text-base">海龟汤</h3>
  83. <div class="text-xs text-gray-500">
  84. <span class="mr-2"><i class="fas fa-user-friends mr-1"></i> 3-10人</span>
  85. <span><i class="far fa-clock mr-1"></i> 30-60分钟</span>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- 房间设置 -->
  90. <div class="p-3">
  91. <h3 class="font-medium text-base mb-3">房间设置</h3>
  92. <!-- 房间名称 -->
  93. <div class="mb-3">
  94. <label class="block text-sm text-gray-700 mb-1">房间名称</label>
  95. <input type="text" class="app-input" placeholder="给房间起个名字...">
  96. </div>
  97. <!-- 最大人数 -->
  98. <div class="mb-3">
  99. <label class="block text-sm text-gray-700 mb-1">最大人数</label>
  100. <div class="flex items-center justify-between">
  101. <input type="range" min="3" max="10" value="6" class="w-4/5">
  102. <span class="text-primary font-medium">6人</span>
  103. </div>
  104. </div>
  105. <!-- 房间公开性 -->
  106. <div class="mb-3">
  107. <label class="block text-sm text-gray-700 mb-1">房间可见性</label>
  108. <div class="flex items-center">
  109. <label class="inline-flex items-center mr-4">
  110. <input type="radio" name="room-visibility" checked class="form-radio text-primary">
  111. <span class="ml-2 text-sm">仅限邀请</span>
  112. </label>
  113. <label class="inline-flex items-center">
  114. <input type="radio" name="room-visibility" class="form-radio text-primary">
  115. <span class="ml-2 text-sm">公开房间</span>
  116. </label>
  117. </div>
  118. </div>
  119. </div>
  120. <!-- 创建按钮 -->
  121. <div class="p-3 mb-3">
  122. <button id="createBtn" class="app-button primary w-full flex justify-center items-center">
  123. <i class="fas fa-play-circle mr-1"></i> 创建并开始
  124. </button>
  125. </div>
  126. </div>
  127. <!-- 引入底部导航栏 -->
  128. <iframe src="../components/nav-bar.html" frameborder="0" scrolling="no" style="width:100%; height:50px; overflow:hidden; position:fixed; bottom:0;"></iframe>
  129. </div>
  130. <script>
  131. document.addEventListener("DOMContentLoaded", function() {
  132. // 创建房间并跳转
  133. const createBtn = document.getElementById('createBtn');
  134. createBtn.addEventListener('click', function() {
  135. // 保存创建的房间信息到本地存储(模拟)
  136. const roomData = {
  137. id: 'ABC123',
  138. name: document.querySelector('.app-input').value || '欢乐海龟汤',
  139. gameType: '海龟汤',
  140. maxPlayers: 6,
  141. currentPlayers: 1,
  142. isHost: true,
  143. status: 'waiting'
  144. };
  145. localStorage.setItem('currentRoom', JSON.stringify(roomData));
  146. // 跳转到等待房间,并在底部导航切换到"我的房间"
  147. window.location.href = 'room-waiting-host.html';
  148. });
  149. });
  150. </script>
  151. </body>
  152. </html>