跳转到内容

模板:生物联赛倒计时:修订间差异

来自osm&bio
Magezeya留言 | 贡献
无编辑摘要
Magezeya留言 | 贡献
无编辑摘要
 
(未显示同一用户的7个中间版本)
第1行: 第1行:
<includeonly>
<includeonly>
<div style="border: 2px solid #4CAF50; border-radius: 10px; padding: 20px; margin: 15px 0; background: linear-gradient(135deg, #f5fdf5 0%, #e8f5e8 100%); box-shadow: 0 4px 8px rgba(0,0,0,0.05); text-align: center; font-family: 'Arial', sans-serif;">
<div class="biology-countdown">
   <div style="font-size: 22px; color: #2E7D32; font-weight: bold; margin-bottom: 15px;">
   <div class="countdown-header">
     全国生物联赛倒计时
    <div class="dna-icon">🧬</div>
     <h3>全国中学生生物学联赛倒计时</h3>
   </div>
   </div>
   <div style="font-size: 28px; color: #1B5E20; font-weight: bold; padding: 10px; background-color: #fff; border-radius: 8px; display: inline-block; min-width: 200px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
 
    {{#if: {{#time: Y-m-d}} <= 2025-05-11 | {{Countdown|2025-05-11|text=天}} |
   <div class="countdown-content">
     {{#if: {{#time: Y-m-d}} <= 2026-05-10 | {{Countdown|2026-05-10|text=天}} |
    <div class="countdown-text">
    {{#if: {{#time: Y-m-d}} <= 2027-05-09 | {{Countdown|2027-05-09|text=天}} |
      距离{{#if: {{{text|}}} | {{{text}}} | 全国奥林匹克生物学联赛}}还有
    {{#if: {{#time: Y-m-d}} <= 2028-05-14 | {{Countdown|2028-05-14|text=天}} |
     </div>
    {{#if: {{#time: Y-m-d}} <= 2029-05-13 | {{Countdown|2029-05-13|text=天}} |
   
    {{#if: {{#time: Y-m-d}} <= 2030-05-12 | {{Countdown|2030-05-12|text=天}} |
    <div class="countdown-timer">
    {{#if: {{#time: Y-m-d}} <= 2031-05-11 | {{Countdown|2031-05-11|text=天}} |
      <!-- 确定下一个联赛日期并计算倒计时 -->
    {{#if: {{#time: Y-m-d}} <= 2032-05-09 | {{Countdown|2032-05-09|text=天}} |
      {{#ifexpr: {{#time:U}} < {{#time:U|2025-05-11}} |
    {{#if: {{#time: Y-m-d}} <= 2033-05-08 | {{Countdown|2033-05-08|text=天}} |
        <!-- 使用2025年日期 -->
    {{#if: {{#time: Y-m-d}} <= 2034-05-14 | {{Countdown|2034-05-14|text=天}} |
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
    {{#if: {{#time: Y-m-d}} <= 2035-05-13 | {{Countdown|2035-05-13|text=天}} |
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
    {{#if: {{#time: Y-m-d}} <= 2036-05-11 | {{Countdown|2036-05-11|text=天}} |
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
    {{#if: {{#time: Y-m-d}} <= 2037-05-10 | {{Countdown|2037-05-10|text=天}} |
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
    {{#if: {{#time: Y-m-d}} <= 2038-05-09 | {{Countdown|2038-05-09|text=天}} |
          | second = <span class="countdown-number">{{#expr: {{#time:U|2025-05-11}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
    {{#if: {{#time: Y-m-d}} <= 2039-05-08 | {{Countdown|2039-05-08|text=天}} |
        }}
    {{#if: {{#time: Y-m-d}} <= 2040-05-13 | {{Countdown|2040-05-13|text=天}} |
      | {{#ifexpr: {{#time:U}} < {{#time:U|2026-05-10}} |
    {{#if: {{#time: Y-m-d}} <= 2041-05-12 | {{Countdown|2041-05-12|text=天}} |
        <!-- 使用2026年日期 -->
    {{#if: {{#time: Y-m-d}} <= 2042-05-11 | {{Countdown|2042-05-11|text=天}} |
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
    {{#if: {{#time: Y-m-d}} <= 2043-05-10 | {{Countdown|2043-05-10|text=天}} |
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
    {{#if: {{#time: Y-m-d}} <= 2044-05-08 | {{Countdown|2044-05-08|text=天}} |
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
    {{#if: {{#time: Y-m-d}} <= 2045-05-14 | {{Countdown|2045-05-14|text=天}} |
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
    {{#if: {{#time: Y-m-d}} <= 2046-05-13 | {{Countdown|2046-05-13|text=天}} |
          | second = <span class="countdown-number">{{#expr: {{#time:U|2026-05-10}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
    {{#if: {{#time: Y-m-d}} <= 2047-05-12 | {{Countdown|2047-05-12|text=天}} |
        }}
    {{#if: {{#time: Y-m-d}} <= 2048-05-10 | {{Countdown|2048-05-10|text=天}} |
      | {{#ifexpr: {{#time:U}} < {{#time:U|2027-05-09}} |
    {{#if: {{#time: Y-m-d}} <= 2049-05-09 | {{Countdown|2049-05-09|text=天}} |
        <!-- 使用2027年日期 -->
    {{#if: {{#time: Y-m-d}} <= 2050-05-08 | {{Countdown|2050-05-08|text=天}} | 2050年后日期待定
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
    }}}}}}}}}}}}}}}}}}}}}}}}}}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2027-05-09}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2028-05-14}} |
        <!-- 使用2028年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2028-05-14}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2029-05-13}} |
        <!-- 使用2029年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2029-05-13}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2030-05-12}} |
        <!-- 使用2030年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2030-05-12}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2031-05-11}} |
        <!-- 使用2031年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2031-05-11}} - {{#time:U}}}}</span><span class="countdown-unit">极</span>
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2032-05-09}} |
        <!-- 使用2032年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2032-05-09}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2033-05-08}} |
        <!-- 使用2033年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2033-05-08}} - {{#time:U}}}}</span><span极 class="countdown-unit">秒</span>
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2034-05-14}} |
        <!-- 使用2034年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2034-05-14}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2035-05-13}} |
        <!-- 使用2035年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:极U|2035-05-13}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
        }}
      |
        <!-- 如果所有日期都已过去,显示2035年日期 -->
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/86400)}}</span><span class="countdown-unit">天</span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
          | second = <span class="countdown-number">{{#expr: {{#time:U|2035-05-13}} - {{#time:U}}}}</span><span class="countdown-unit">秒</span>
        }}
      }}}}}}}}}}}}
    </div>
   
    <div class="countdown-date">
      下一届联赛日期:
      {{#ifexpr: {{#time:U}} < {{#time:U|2025-05-11}} | 2025-05-11 |
        {{#ifexpr: {{#time:U}} < {{#time:U|2026-05-10}} | 2026-05-10 |
          {{#ifexpr: {{#time:U}} < {{#time:U|2027-05-09}} | 2027-05-09 |
            {{#ifexpr: {{#time:U}} < {{#time:U|2028-05-14}} | 2028-05-14 |
              {{#ifexpr: {{#time:U}} < {{#time:U|2029-05-13}} | 2029-05-13 |
                {{#ifexpr: {{#time:U}} < {{#time:U|2030-05-12}} | 2030-05-12 |
                  {{#ifexpr: {{#time:U}} < {{#time:U|2031-05-11}} | 2031-05-11 |
                    {{#ifexpr: {{#time:U}} < {{#time:U|2032-05-09}} | 2032-05-09 |
                      {{#ifexpr: {{#time:U}} < {{#time:U|2033-05-08}} | 2033-05-08 |
                        {{#ifexpr: {{#time:U}} < {{#time:U|2034-05-14}} | 2034-05-14 |
                          {{#ifexpr: {{#time:U}} < {{#time:U|2035-05-13}} | 2035-05-13 | 2035-05-13
                          }}
                        }}
                      }}
                    }}
                  }}
                }}
              }}
            }}
          }}
        }}
      }}
    </div>
   </div>
   </div>
   <div style="font-size: 16px; color: #558B2F; margin-top: 10px;">
 
     {{#if: {{#time: Y-m-d}} <= 2025-05-11 | 2025年全国生物联赛将于5月11日举行 |
   <div class="countdown-footer">
    {{#if: {{#time: Y-m-d}} <= 2026-05-10 | 2026年全国生物联赛将于5月10日举行 |
     <small>全国中学生生物学竞赛委员会</small>
    {{#if: {{#time: Y-m-d}} <= 2027-05-09 | 2027年全国生物联赛将于5月9日举行 |
    {{#if: {{#time: Y-m-d}} <= 2028-05-14 | 2028年全国生物联赛将于5月14日举行 |
    {{#if: {{#time: Y-m-d}} <= 2029-05-13 | 2029年全国生物联赛将于5月13日举行 |
    {{#if: {{#time: Y-m-d}} <= 2030-05-12 | 2030年全国生物联赛将于5月12日举行 |
    {{#if: {{#time: Y-m-d}} <= 2031-05-11 | 2031年全国生物联赛将于5月11日举行 |
    {{#if: {{#time: Y-m-d}} <= 2032-05-09 | 2032年全国生物联赛将于5月9日举行 |
    {{#if: {{#time: Y-m-d}} <= 2033-05-08 | 2033年全国生物联赛将于5月8日举行 |
    {{#if: {{#time: Y-m-d}} <= 2034-05-14 | 2034年全国生物联赛将于5月14日举行 |
    {{#if: {{#time: Y-m-d}} <= 2035-05-13 | 2035年全国生物联赛将于5月13日举行 |
    {{#if: {{#time: Y-m-d}} <= 2036-05-11 | 2036年全国生物联赛将于5月11日举行 |
    {{#if: {{#time: Y-m-d}} <= 2037-05-10 | 2037年全国生物联赛将于5月10日举行 |
    {{#if: {{#time: Y-m-d}} <= 2038-05-09 | 2038年全国生物联赛将于5月9日举行 |
    {{#if: {{#time: Y-m-d}} <= 2039-05-08 | 2039年全国生物联赛将于5月8日举行 |
    {{#if: {{#time: Y-m-d}} <= 2040-05-13 | 2040年全国生物联赛将于5月13日举行 |
    {{#if: {{#time: Y-m-d}} <= 2041-05-12 | 2041年全国生物联赛将于5月12日举行 |
    {{#if: {{#time: Y-m-d}} <= 2042-05-11 | 2042年全国生物联赛将于5月11日举行 |
    {{#if: {{#time: Y-m-d}} <= 2043-05-10 | 2043年全国生物联赛将于5月10日举行 |
    {{#if: {{#time: Y-m-d}} <= 2044-05-08 | 2044年全国生物联赛将于5月8日举行 |
    {{#if: {{#time: Y-m-d}} <= 2045-05-14 | 2045年全国生物联赛将于5月14日举行 |
    {{#if: {{#time: Y-m-d}} <= 2046-05-13 | 2046年全国生物联赛将于5月13日举行 |
    {{#if: {{#time: Y-m-d}} <= 2047-05-12 | 2047年全国生物联赛将于5月12日举行 |
    {{#if: {{#time: Y-m-d}} <= 2048-05-10 | 2048年全国生物联赛将于5月10日举行 |
    {{#if: {{#time: Y-m-d}} <= 2049-05-09 | 2049年全国生物联赛将于5月9日举行 |
    {{#if: {{#time: Y-m-d}} <= 2050-05-08 | 2050年全国生物联赛将于5月8日举行 | 2050年后日期待定
    }}}}}}}}}}}}}}}}}}}}}}}}}}}
   </div>
   </div>
</div>
</div>
<style>
.biology-countdown {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #81c784;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  max-width: 400px;
  margin: 10px auto;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.biology-countdown::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90极deg, #4caf50, #8bc34a, #cddc39);
}
.countdown-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}
.dna-icon {
  font-size: 28px;
  margin-right: 10px;
}
.countdown-header h3 {
  margin: 0;
  color: #2e7d32;
  font-size: 18px;
  font-weight: 600;
}
.countdown-content {
  margin: 15px 0;
}
.countdown-text {
  color: #388e3c;
  font-size: 16px;
  margin-bottom: 10px;
}
.countdown-timer {
  display: flex;
  justify-content: center;
  align-items: baseline;
  margin: 15px 0;
}
.countdown-number {
  font-size: 36px;
  font-weight: bold;
  color: #d32f2f;
  margin: 0 5px;
  animation: pulse 2s infinite;
}
.countdown-unit {
  font-size: 18px;
  color: #555;
  margin-left: 5px;
}
.countdown-date {
  color: #689f38;
  font-size: 14px;
  margin-top: 10px;
  font-style: italic;
}
.countdown-footer {
  border-top: 1px solid #a5d6a7;
  padding-top: 10px;
  margin-top: 15px;
}
.countdown-footer small {
  color: #78909c;
  font-size: 12px;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
@media (max-width: 480px) {
  .biology-countdown {
    padding: 15px;
    margin: 10px;
  }
 
  .countdown-number {
    font-size: 28px;
  }
 
  .countdown-header h3 {
    font-size: 16px;
  }
}
</style>
</includeonly>
</includeonly>
<noinclude>
{{documentation}}
</noinclude>

2025年8月22日 (五) 12:22的最新版本


模板文档  [[{{fullurl:local p = {}

-- 预定义的联赛日期表(2025-2035年五月的第二个星期日) local olympiadDates = {

   "2025-05-11",
   "2026-05-10",
   "2027-05-09",
   "2028-05-14",
   "2029-05-13",
   "2030-05-12",
   "2031-05-11",
   "2032-05-09",
   "2033-05-08",
   "2034-05-14",
   "2035-05-13"

}

function p.getNextDate()

   local currentTime = os.time()
   
   for i, dateStr in ipairs(olympiadDates) do
       local datePattern = "(%d+)-(%d+)-(%d+)"
       local year, month, day = dateStr:match(datePattern)
       local olympiadTime = os.time({year = year, month = month, day = day})
       
       if olympiadTime > currentTime then
           return dateStr
       end
   end
   
   -- 如果所有日期都已过去,返回最后一个日期
   return olympiadDates[#olympiadDates]

end

return p|action=edit}} 创建]] [刷新]