index.html 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. <style>
  8. @import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600&display=swap');
  9. body, html {
  10. font-family: 'Fredoka', sans-serif;
  11. width: 100%;
  12. height: 100%;
  13. margin: 0;
  14. padding: 0;
  15. background-color: transparent; /* 确保倒角外部透明 */
  16. }
  17. </style>
  18. </head>
  19. <body class="flex items-center justify-center overflow-hidden">
  20. <!-- 卡片容器
  21. 1. h-full w-full: 占满屏幕
  22. 2. rounded-[30px]: 强制圆角
  23. 3. overflow-hidden: 裁剪图片确保圆角生效
  24. 4. 无背景色设置(或设为white),确保外部是透的
  25. -->
  26. <div class="relative w-full h-full bg-white overflow-hidden rounded-[30px] shadow-2xl">
  27. <!-- 1. 背景层 -->
  28. <img src="https://orienteering.beswell.com/card/nanning/nncardrg.jpg"
  29. alt="活动背景"
  30. class="absolute inset-0 w-full h-full object-cover">
  31. <!-- 遮罩层 -->
  32. <div class="absolute inset-0 bg-gradient-to-t from-black/80 via-transparent to-black/20"></div>
  33. <!-- 2. 倒计时区域
  34. 使用 vw 单位实现等比例缩放
  35. -->
  36. <div class="absolute top-[5%] right-[5%] bg-black/40 backdrop-blur-md rounded-full border border-white/20 shadow-lg z-10"
  37. style="padding: 1.5vw 3vw;">
  38. <div class="flex items-center gap-[1vw] text-white leading-none font-medium" id="timer-container">
  39. <span class="opacity-90" style="font-size: 3.5vw;">距开始</span>
  40. <span class="font-bold text-yellow-300 tabular-nums" style="font-size: 4.5vw;">
  41. <span id="days">02</span>天<span id="hours">14</span>时
  42. </span>
  43. </div>
  44. </div>
  45. <!-- 3. 进入按钮
  46. 使用 vw 单位控制宽度、字体、圆角和边距,实现完全响应式
  47. -->
  48. <div class="absolute bottom-[8%] left-0 w-full flex justify-center z-10 px-[6vw]">
  49. <button id="action-btn"
  50. class="w-full bg-gradient-to-r from-orange-500 to-red-600 text-white font-bold shadow-xl border border-white/20 active:scale-95 transition-transform tracking-wide flex items-center justify-center gap-[2vw]"
  51. style="font-size: 5vw; padding: 3.5vw 0; border-radius: 9999px;">
  52. 开始报名 <i class="fas fa-chevron-right opacity-80" style="font-size: 4vw;"></i>
  53. </button>
  54. </div>
  55. </div>
  56. <!-- FontAwesome for the arrow icon -->
  57. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
  58. <script>
  59. // 模拟状态 logic (0:未开始, 1:进行中, 2:已结束)
  60. let status = 0;
  61. const btn = document.getElementById('action-btn');
  62. const timerContainer = document.getElementById('timer-container');
  63. if(status === 0) {
  64. btn.innerHTML = '开始报名 <i class="fas fa-chevron-right opacity-80" style="font-size: 4vw;"></i>';
  65. } else if (status === 1) {
  66. btn.innerHTML = '进入比赛 <i class="fas fa-flag-checkered opacity-80" style="font-size: 4vw;"></i>';
  67. // 保持 proportional styling
  68. btn.className = "w-full bg-gradient-to-r from-green-400 to-emerald-600 text-white font-bold shadow-xl border border-white/20 active:scale-95 transition-transform tracking-wide flex items-center justify-center gap-[2vw]";
  69. timerContainer.innerHTML = '<span class="opacity-90" style="font-size: 3.5vw;">距结束</span><span class="font-bold text-yellow-300 tabular-nums" style="font-size: 4.5vw;">01天 05时</span>';
  70. } else {
  71. btn.innerHTML = '查看数据';
  72. btn.className = "w-full bg-slate-600 text-white font-bold shadow-xl active:scale-95 transition-transform tracking-wide flex items-center justify-center gap-[2vw]";
  73. timerContainer.parentElement.className = "absolute top-[5%] right-[5%] bg-gray-800/80 backdrop-blur-md rounded-full";
  74. timerContainer.parentElement.style.padding = "1.5vw 3vw";
  75. timerContainer.innerHTML = '<span class="text-gray-200 font-bold" style="font-size: 4vw;">已结束</span>';
  76. }
  77. </script>
  78. </body>
  79. </html>