ranklist.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. <script src="https://cdn.tailwindcss.com"></script>
  7. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
  8. <script>
  9. tailwind.config = {
  10. theme: {
  11. extend: {
  12. colors: {
  13. primary: '#3372ac',
  14. },
  15. animation: {
  16. marquee: 'marquee 25s linear infinite',
  17. },
  18. keyframes: {
  19. marquee: {
  20. '0%': { transform: 'translateX(100%)' },
  21. '100%': { transform: 'translateX(-100%)' },
  22. }
  23. }
  24. }
  25. }
  26. }
  27. </script>
  28. <style>
  29. @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;800&display=swap');
  30. body { font-family: 'Nunito', sans-serif; }
  31. .no-scrollbar::-webkit-scrollbar { display: none; }
  32. .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
  33. .snap-mandatory { scroll-behavior: smooth; }
  34. .fade-in-up { animation: fadeInUp 0.4s ease-out forwards; opacity: 0; transform: translateY(10px); }
  35. @keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }
  36. .dropdown-enter { opacity: 0; transform: translateY(-10px) scale(0.95); }
  37. .dropdown-enter-active { opacity: 1; transform: translateY(0) scale(1); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
  38. </style>
  39. </head>
  40. <body class="bg-slate-50 relative pb-24" onclick="closeDropdownOnClickOutside(event)">
  41. <!-- 1. 顶部 Header -->
  42. <div class="relative w-full h-[260px]">
  43. <img src="https://orienteering.beswell.com/card/nanning/cardtop1122-2.jpg"
  44. class="w-full h-full object-cover shadow-md" alt="Header BG">
  45. <div class="absolute inset-0 bg-gradient-to-b from-primary/60 via-transparent to-black/30"></div>
  46. <div class="absolute top-0 w-full pt-10 px-5 flex justify-between items-center z-10 text-white">
  47. <button class="bg-black/20 backdrop-blur-sm p-2 rounded-full w-9 h-9 flex items-center justify-center active:scale-90 transition">
  48. <i class="fas fa-chevron-left"></i>
  49. </button>
  50. <h1 class="text-lg font-bold tracking-wider shadow-sm">实时赛况</h1>
  51. <button onclick="openInfoModal()" class="bg-black/20 backdrop-blur-sm px-3 py-1.5 rounded-full text-xs font-semibold flex items-center gap-1 active:scale-90 transition">
  52. <i class="fas fa-question-circle"></i> 说明
  53. </button>
  54. </div>
  55. <!-- 底部公告跑马灯 -->
  56. <div class="absolute bottom-[35px] w-full z-10 px-4">
  57. <div class="bg-black/40 backdrop-blur-md rounded-full py-1.5 px-3 flex items-center gap-2 overflow-hidden border border-white/10 shadow-lg">
  58. <i class="fas fa-bullhorn text-yellow-300 text-xs shrink-0"></i>
  59. <div class="flex-1 overflow-hidden relative h-4">
  60. <div class="absolute whitespace-nowrap text-[10px] text-white animate-marquee leading-4">
  61. 当前总题目: 1500道 | 总里程: 5024km | 总打点数: 8900个 | 距离比赛结束还有 1天 5小时 | 加油!冲鸭!
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <!-- 2. 个人信息卡 -->
  68. <div class="px-4 -mt-8 relative z-20">
  69. <div class="bg-white rounded-xl shadow-lg p-4 flex justify-between items-center border border-white/50">
  70. <div class="flex items-center gap-3">
  71. <div class="relative">
  72. <img src="https://i.pravatar.cc/100?img=12" class="w-12 h-12 rounded-full border-2 border-slate-100">
  73. <div class="absolute -bottom-1 -right-1 bg-primary text-white text-[8px] px-1.5 py-0.5 rounded-full border border-white">Lv.3</div>
  74. </div>
  75. <div>
  76. <!-- 昵称 & 编辑按钮 -->
  77. <h2 class="font-bold text-gray-800 text-sm flex items-center gap-1">
  78. <span id="profileName">奔跑的蜗牛</span>
  79. <button onclick="openEditModal()" class="text-xs text-primary/60 p-1 hover:text-primary transition-colors"><i class="fas fa-pen"></i></button>
  80. </h2>
  81. <!-- 战队 -->
  82. <p class="text-xs text-gray-500 mt-0.5 flex items-center gap-1">
  83. <i class="fas fa-user-friends text-blue-300 text-[10px]"></i>
  84. <span id="profileTeam">飞虎队</span>
  85. </p>
  86. </div>
  87. </div>
  88. <div class="text-center pl-4 border-l border-gray-100">
  89. <div id="userScore" class="text-2xl font-black text-primary font-mono leading-none">120</div>
  90. <div class="text-[10px] text-gray-400 mt-1">当前积分</div>
  91. </div>
  92. </div>
  93. </div>
  94. <!-- 3. 排行榜 Tabs -->
  95. <div class="mt-6 px-4">
  96. <!-- 主榜单切换:轻量化分段控制器风格 -->
  97. <div class="bg-slate-100 p-1 rounded-full flex gap-1 mb-4 relative shadow-inner">
  98. <button onclick="switchMainTab('team')" id="tab-team"
  99. class="flex-1 py-2 rounded-full text-sm font-bold text-center transition-all duration-300 bg-white text-primary shadow-sm">
  100. 团队榜
  101. </button>
  102. <button onclick="switchMainTab('individual')" id="tab-ind"
  103. class="flex-1 py-2 rounded-full text-sm font-bold text-center transition-all duration-300 text-gray-500 hover:text-gray-700">
  104. 个人榜
  105. </button>
  106. </div>
  107. <!-- 维度切换 -->
  108. <div class="flex gap-2 justify-center pt-4 overflow-x-auto no-scrollbar pb-2" id="metric-tabs">
  109. <button onclick="switchMetric('score')" id="metric-score" class="metric-btn bg-primary text-white px-3 py-1 rounded-full text-xs shadow-md shadow-blue-100 font-bold shrink-0 relative overflow-visible">
  110. 积分
  111. <span id="prize-badge" class="absolute -top-2 -right-2 bg-red-500 text-white text-[9px] px-1.5 py-0.5 rounded-full shadow-sm border border-white z-10 leading-none">奖</span>
  112. </button>
  113. <button onclick="switchMetric('mileage')" id="metric-mileage" class="metric-btn bg-white text-gray-500 border border-gray-200 px-3 py-1 rounded-full text-xs font-bold shrink-0 active:bg-gray-50 transition-colors">里程</button>
  114. <button onclick="switchMetric('accuracy')" id="metric-accuracy" class="metric-btn bg-white text-gray-500 border border-gray-200 px-3 py-1 rounded-full text-xs font-bold shrink-0 active:bg-gray-50 transition-colors">答题正确率</button>
  115. <button onclick="switchMetric('count')" id="metric-count" class="metric-btn bg-white text-gray-500 border border-gray-200 px-3 py-1 rounded-full text-xs font-bold shrink-0 active:bg-gray-50 transition-colors">打点数</button>
  116. <button onclick="switchMetric('lap')" id="metric-lap" class="metric-btn bg-white text-gray-500 border border-gray-200 px-3 py-1 rounded-full text-xs font-bold shrink-0 active:bg-gray-50 transition-colors">单圈用时</button>
  117. </div>
  118. </div>
  119. <!-- 4. 排行榜列表容器 -->
  120. <!-- 修改点:space-y-2 (间距变小), 内层渲染 logic 变 p-2 -->
  121. <div id="leaderboard-container" class="px-4 mt-1 space-y-2 mb-24 min-h-[300px]"></div>
  122. <!-- 5. 底部悬浮栏 -->
  123. <div class="fixed bottom-0 w-full bg-white border-t border-gray-100 shadow-[0_-5px_20px_rgba(0,0,0,0.05)] px-4 py-3 flex items-center z-40 safe-area-bottom">
  124. <button onclick="openDrawer()" class="w-full bg-gradient-to-r from-orange-500 to-red-600 text-white py-3 rounded-full font-bold shadow-lg shadow-orange-100 transform active:scale-[0.98] transition flex items-center justify-center gap-2 text-base">
  125. <i class="fas fa-flag-checkered animate-pulse"></i> 进入比赛
  126. </button>
  127. </div>
  128. <!-- ================= 模态框区域 ================= -->
  129. <!-- A. 编辑个人资料模态框 -->
  130. <div id="editProfileModal" class="fixed inset-0 z-[60] hidden flex items-center justify-center">
  131. <div class="absolute inset-0 bg-slate-900/60 backdrop-blur-sm" onclick="closeEditModal()"></div>
  132. <div class="bg-white w-[85%] rounded-2xl p-6 relative z-10 shadow-2xl animate-[fadeInUp_0.3s_ease-out]">
  133. <h3 class="font-bold text-lg mb-6 text-gray-800 text-center">修改报名信息</h3>
  134. <div class="space-y-5">
  135. <div>
  136. <label class="block text-sm font-bold text-gray-500 mb-2">我的昵称</label>
  137. <input type="text" id="editNameInput" value="奔跑的蜗牛"
  138. class="w-full bg-slate-50 border border-gray-200 rounded-lg px-4 py-2.5 text-sm font-bold text-gray-800 focus:outline-none focus:ring-1 focus:ring-primary focus:bg-white transition-colors">
  139. </div>
  140. <div>
  141. <label class="block text-sm font-bold text-gray-500 mb-2">所属战队</label>
  142. <div class="relative group">
  143. <button type="button" id="dropdownBtn" onclick="toggleDropdown(event)"
  144. class="w-full bg-slate-50 border border-gray-200 rounded-lg px-4 py-2.5 text-sm font-bold text-left flex items-center justify-between focus:outline-none focus:ring-1 focus:ring-primary transition-all">
  145. <span id="selectedTeamText" class="text-gray-800 flex items-center gap-2">
  146. <i class="fas fa-user-friends text-primary"></i> 飞虎队
  147. </span>
  148. <i class="fas fa-chevron-circle-down text-gray-400 transition-transform duration-300" id="dropdownArrow"></i>
  149. </button>
  150. <div id="dropdownMenu" class="hidden absolute top-[110%] left-0 w-full bg-white rounded-xl shadow-2xl border border-gray-100 overflow-hidden z-50 dropdown-enter max-h-48 overflow-y-auto">
  151. <ul class="text-sm text-gray-700">
  152. <li onclick="selectOption('飞虎队')" class="px-4 py-3 hover:bg-blue-50 cursor-pointer flex items-center justify-between border-b border-gray-50"><span class="font-bold flex items-center gap-2"><i class="fas fa-user-friends text-blue-200"></i> 飞虎队</span></li>
  153. <li onclick="selectOption('火箭队')" class="px-4 py-3 hover:bg-blue-50 cursor-pointer flex items-center justify-between border-b border-gray-50"><span class="font-bold flex items-center gap-2"><i class="fas fa-user-friends text-blue-200"></i> 火箭队</span></li>
  154. <li onclick="selectOption('摸鱼队')" class="px-4 py-3 hover:bg-blue-50 cursor-pointer flex items-center justify-between border-b border-gray-50"><span class="font-bold flex items-center gap-2"><i class="fas fa-user-friends text-blue-200"></i> 摸鱼队</span></li>
  155. <li onclick="selectOption('汪汪队')" class="px-4 py-3 hover:bg-blue-50 cursor-pointer flex items-center justify-between"><span class="font-bold flex items-center gap-2"><i class="fas fa-user-friends text-blue-200"></i> 汪汪队</span></li>
  156. </ul>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. <div class="flex gap-3 mt-8">
  162. <button onclick="closeEditModal()" class="flex-1 py-2.5 rounded-full border border-gray-200 text-gray-500 font-bold text-sm">取消</button>
  163. <button onclick="saveProfile()" class="flex-1 py-2.5 rounded-full bg-primary text-white font-bold text-sm shadow-lg shadow-blue-200">保存修改</button>
  164. </div>
  165. </div>
  166. </div>
  167. <!-- B. 说明模态框 -->
  168. <div id="infoModal" class="fixed inset-0 z-50 hidden transition-opacity duration-300">
  169. <div class="absolute inset-0 bg-slate-900/70 backdrop-blur-sm" onclick="closeInfoModal()"></div>
  170. <div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-[90%] bg-white rounded-3xl p-6 shadow-2xl">
  171. <button onclick="closeInfoModal()" class="absolute -top-12 right-0 text-white/80 hover:text-white w-10 h-10 border border-white/30 rounded-full flex items-center justify-center">
  172. <i class="fas fa-times text-lg"></i>
  173. </button>
  174. <h3 class="text-center font-bold text-xl mb-4 text-primary border-b border-gray-100 pb-3">
  175. <i class="fas fa-book-open mr-2"></i>比赛规则说明
  176. </h3>
  177. <div id="modalSlider" class="overflow-x-auto flex snap-x snap-mandatory no-scrollbar space-x-4 pb-2" onscroll="updateDots()">
  178. <div class="snap-center shrink-0 w-full bg-blue-50 rounded-2xl p-5 text-center border border-blue-100">
  179. <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-3"><i class="fas fa-map-marker-alt text-xl text-primary"></i></div>
  180. <h4 class="font-bold text-base text-gray-800 mb-1">1. 定向寻宝</h4>
  181. <p class="text-gray-600 text-xs leading-relaxed">比赛设置12个隐藏打卡点。</p>
  182. </div>
  183. <div class="snap-center shrink-0 w-full bg-blue-50 rounded-2xl p-5 text-center border border-blue-100">
  184. <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-3"><i class="fas fa-mobile-alt text-xl text-primary"></i></div>
  185. <h4 class="font-bold text-base text-gray-800 mb-1">2. 扫码打卡</h4>
  186. <p class="text-gray-600 text-xs leading-relaxed">到达点位后,使用APP扫描二维码。</p>
  187. </div>
  188. <div class="snap-center shrink-0 w-full bg-blue-50 rounded-2xl p-5 text-center border border-blue-100">
  189. <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-3"><i class="fas fa-medal text-xl text-primary"></i></div>
  190. <h4 class="font-bold text-base text-gray-800 mb-1">3. 完赛奖励</h4>
  191. <p class="text-gray-600 text-xs leading-relaxed">前50名有精美礼品!加油!</p>
  192. </div>
  193. </div>
  194. <div class="flex justify-center gap-2 mt-4" id="dotsContainer">
  195. <div class="dot w-6 h-1.5 rounded-full bg-primary transition-all duration-300"></div>
  196. <div class="dot w-1.5 h-1.5 rounded-full bg-gray-300 transition-all duration-300"></div>
  197. <div class="dot w-1.5 h-1.5 rounded-full bg-gray-300 transition-all duration-300"></div>
  198. </div>
  199. </div>
  200. </div>
  201. <!-- C. 上滑抽屉 -->
  202. <div id="drawer-backdrop" class="fixed inset-0 bg-black/50 z-50 hidden transition-opacity" onclick="closeDrawer()"></div>
  203. <div id="drawer" class="fixed bottom-0 left-0 w-full bg-white rounded-t-3xl p-6 z-50 transform translate-y-full transition-transform duration-300 ease-out safe-area-bottom">
  204. <div class="w-12 h-1.5 bg-gray-200 rounded-full mx-auto mb-6"></div>
  205. <h3 class="font-bold text-lg mb-5 text-gray-800">前往比赛场地</h3>
  206. <div class="space-y-6">
  207. <div>
  208. <button onclick="triggerJump('兴隆山校区')" class="w-full border-2 border-primary bg-blue-50 text-primary py-4 rounded-xl font-bold text-sm flex items-center justify-between px-6 shadow-sm active:scale-[0.98] transition-transform">
  209. <div class="flex items-center gap-3">
  210. <i class="fas fa-map-marked-alt text-2xl"></i>
  211. <div class="text-left">
  212. <div class="text-base font-bold">兴隆山校区</div>
  213. <div class="text-[10px] opacity-70 font-normal">当前比赛区域</div>
  214. </div>
  215. </div>
  216. <i class="fas fa-chevron-right text-lg"></i>
  217. </button>
  218. </div>
  219. <div>
  220. <label class="text-xs text-gray-400 font-bold uppercase mb-2 block pl-1">选择导航</label>
  221. <div class="bg-gray-50 rounded-2xl p-2 flex flex-col gap-2 border border-gray-100">
  222. <button onclick="triggerJump('高德地图')" class="flex items-center gap-4 w-full bg-white p-3 rounded-xl border border-gray-100 shadow-sm active:bg-gray-50 active:scale-[0.99] transition-transform">
  223. <img src="./gd.png" class="w-8 h-8 object-contain">
  224. <div class="text-left">
  225. <div class="font-bold text-gray-800 text-sm">高德地图</div>
  226. <div class="text-[10px] text-gray-400">推荐路线</div>
  227. </div>
  228. <i class="fas fa-location-arrow ml-auto text-primary"></i>
  229. </button>
  230. <button onclick="triggerJump('百度地图')" class="flex items-center gap-4 w-full bg-white p-3 rounded-xl border border-gray-100 shadow-sm active:bg-gray-50 active:scale-[0.99] transition-transform">
  231. <img src="./bd.png" class="w-8 h-8 object-contain">
  232. <div class="text-left">
  233. <div class="font-bold text-gray-800 text-sm">百度地图</div>
  234. <div class="text-[10px] text-gray-400">备选方案</div>
  235. </div>
  236. <i class="fas fa-location-arrow ml-auto text-primary"></i>
  237. </button>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. <script src="js/uni-compat.js"></script>
  243. <script src="js/define.js"></script>
  244. <script src="js/api.js"></script>
  245. <script src="js/tools.js"></script>
  246. <script src="js/cardfunc.js"></script>
  247. <script src="js/logic-ranklist.js"></script>
  248. <script>
  249. // UI Logic that doesn't need state
  250. const slider = document.getElementById('modalSlider');
  251. const dots = document.querySelectorAll('.dot');
  252. function updateDots() {
  253. const index = Math.round(slider.scrollLeft / slider.offsetWidth);
  254. dots.forEach((dot, i) => {
  255. dot.className = (i === index) ? 'dot w-6 h-1.5 rounded-full bg-primary transition-all duration-300' : 'dot w-1.5 h-1.5 rounded-full bg-gray-300 transition-all duration-300';
  256. });
  257. }
  258. </script>
  259. </body>
  260. </html>