|
|
@@ -0,0 +1,855 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
|
|
+ <title>亲子月挑战赛</title>
|
|
|
+ <script src="./bridge.js"></script>
|
|
|
+ <script src="./api.js"></script>
|
|
|
+ <script src="./js/multiavatar.min.js"></script>
|
|
|
+ <link href="./css/all.min.css" rel="stylesheet">
|
|
|
+ <style>
|
|
|
+ :root {
|
|
|
+ --kid-blue: #48dbfb;
|
|
|
+ --kid-blue-dark: #0abde3;
|
|
|
+ --kid-yellow: #feca57;
|
|
|
+ --kid-orange: #ff9f43;
|
|
|
+ --kid-red: #ff6b6b;
|
|
|
+ --kid-green: #1dd1a1;
|
|
|
+ --kid-bg: #f7f1e3;
|
|
|
+ --kid-text: #576574;
|
|
|
+ --footer-bg: #ff6b6b;
|
|
|
+ }
|
|
|
+
|
|
|
+ * {
|
|
|
+ box-sizing: border-box;
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ font-family: 'Varela Round', 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
|
|
+ -webkit-tap-highlight-color: transparent;
|
|
|
+ user-select: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ body {
|
|
|
+ background: var(--kid-bg);
|
|
|
+ background-image: radial-gradient(#dfe6e9 1px, transparent 1px);
|
|
|
+ background-size: 20px 20px;
|
|
|
+ width: 100%;
|
|
|
+ height: 100vh;
|
|
|
+ overflow: hidden;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 顶部 Header:高度减小,更紧凑 */
|
|
|
+ .header-area {
|
|
|
+ height: 250px; /* 原 290px -> 250px */
|
|
|
+ background: url('./bgkt.jpg') center/cover no-repeat;
|
|
|
+ padding: 15px 20px;
|
|
|
+ padding-top: max(20px, env(safe-area-inset-top));
|
|
|
+ color: white;
|
|
|
+ border-bottom-left-radius: 35px; border-bottom-right-radius: 35px;
|
|
|
+ position: relative; flex-shrink: 0;
|
|
|
+ z-index: 1;
|
|
|
+ box-shadow: 0 8px 0 rgba(0,0,0,0.05);
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ .header-area::after {
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ top: 0; left: 0; width: 100%; height: 100%;
|
|
|
+ background: linear-gradient(to bottom, rgba(72, 219, 251, 0.4) 0%, rgba(255,255,255,0.1) 100%);
|
|
|
+ border-bottom-left-radius: 35px; border-bottom-right-radius: 35px;
|
|
|
+ z-index: -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-bar {
|
|
|
+ display: flex; justify-content: space-between; align-items: center;
|
|
|
+ margin-top: 0px;
|
|
|
+ position: relative;
|
|
|
+ z-index: 20;
|
|
|
+ }
|
|
|
+
|
|
|
+ .icon-btn {
|
|
|
+ width: 32px; height: 32px; /* 略微缩小按钮 */
|
|
|
+ background: rgba(255,255,255,0.9);
|
|
|
+ border-radius: 50%; display: flex; align-items: center; justify-content: center;
|
|
|
+ cursor: pointer;
|
|
|
+ border: 2px solid white;
|
|
|
+ box-shadow: 0 3px 0 rgba(0,0,0,0.1);
|
|
|
+ color: var(--kid-blue-dark);
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ .icon-btn:active { transform: translateY(3px); box-shadow: none; }
|
|
|
+
|
|
|
+ .month-select {
|
|
|
+ font-size: 16px; font-weight: 800;
|
|
|
+ display: flex; align-items: center; gap: 6px; cursor: pointer;
|
|
|
+ text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
|
|
|
+ background: rgba(255,255,255,0.25); padding: 4px 12px; border-radius: 18px;
|
|
|
+ backdrop-filter: blur(5px);
|
|
|
+ border: 1px solid rgba(255,255,255,0.5);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 云朵动画保持不变 */
|
|
|
+ .cloud {
|
|
|
+ position: absolute;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 50%;
|
|
|
+ z-index: 0;
|
|
|
+ opacity: 0.9;
|
|
|
+ box-shadow: 0 5px 10px rgba(0,0,0,0.05);
|
|
|
+ pointer-events: none;
|
|
|
+ }
|
|
|
+ .c1 {
|
|
|
+ width: 70px; height: 70px; top: 15%; left: -10px;
|
|
|
+ box-shadow: 25px 8px 0 #fff, -20px 12px 0 #fff;
|
|
|
+ animation: floatCloudHeader1 8s infinite ease-in-out alternate;
|
|
|
+ }
|
|
|
+ .c2 {
|
|
|
+ width: 50px; height: 50px; top: 25%; right: 5%;
|
|
|
+ box-shadow: 15px 6px 0 #fff, -10px 8px 0 #fff;
|
|
|
+ animation: floatCloudHeader2 6s infinite ease-in-out alternate-reverse;
|
|
|
+ }
|
|
|
+ .c3 {
|
|
|
+ width: 40px; height: 40px; top: 40%; left: 40%;
|
|
|
+ opacity: 0.6;
|
|
|
+ box-shadow: 12px 5px 0 #fff, -8px 6px 0 #fff;
|
|
|
+ animation: floatCloudHeader3 10s infinite linear;
|
|
|
+ }
|
|
|
+ @keyframes floatCloudHeader1 { from { transform: translate(0, 0); } to { transform: translate(30px, 10px); } }
|
|
|
+ @keyframes floatCloudHeader2 { from { transform: translate(0, 0); } to { transform: translate(-25px, 15px); } }
|
|
|
+ @keyframes floatCloudHeader3 { 0% { transform: translateX(-20px); } 50% { transform: translateX(20px); } 100% { transform: translateX(-20px); } }
|
|
|
+
|
|
|
+ /* 领奖台容器:高度压缩 */
|
|
|
+ .podium-wrap {
|
|
|
+ height: 130px; /* 原 160px -> 130px */
|
|
|
+ display: flex; justify-content: center; align-items: flex-end;
|
|
|
+ margin-top: -145px; /* 上移调整 */
|
|
|
+ position: relative;
|
|
|
+ z-index: 10;
|
|
|
+ padding-bottom: 0px;
|
|
|
+ }
|
|
|
+ .p-col { display: flex; flex-direction: column; align-items: center; width: 30%; position: relative;}
|
|
|
+ .p-2 { z-index: 2; margin-right: -10px; }
|
|
|
+ .p-1 { z-index: 3; margin-bottom: 10px; }
|
|
|
+ .p-3 { z-index: 1; margin-left: -10px; }
|
|
|
+
|
|
|
+ /* 头像压缩 */
|
|
|
+ .p-img { width: 44px; height: 44px; border-radius: 50%; border: 3px solid white; background: #eee; margin-bottom: -12px; position: relative; z-index: 2; overflow: hidden; box-shadow: 0 3px 5px rgba(0,0,0,0.1);}
|
|
|
+ .p-1 .p-img { width: 60px; height: 60px; margin-bottom: -15px;}
|
|
|
+ .p-img img { width: 100%; height: 100%; object-fit: cover; }
|
|
|
+
|
|
|
+ .crown {
|
|
|
+ position: absolute; top: -24px; color: var(--kid-yellow); font-size: 28px;
|
|
|
+ filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.2));
|
|
|
+ animation: crownFloat 2s ease-in-out infinite;
|
|
|
+ z-index: 20;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 领奖台底座:高度压缩 */
|
|
|
+ .p-box {
|
|
|
+ width: 100%; text-align: center;
|
|
|
+ padding-top: 15px; padding-bottom: 5px;
|
|
|
+ border-radius: 12px 12px 0 0;
|
|
|
+ color: white;
|
|
|
+ box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
|
|
+ border: 2px solid rgba(255,255,255,0.6);
|
|
|
+ border-bottom: none;
|
|
|
+ }
|
|
|
+ /* 第一名高度 105 -> 85 */
|
|
|
+ .p-1 .p-box { height: 85px; background: var(--kid-yellow); padding-top: 20px; }
|
|
|
+ /* 第二名高度 85 -> 65 */
|
|
|
+ .p-2 .p-box { height: 65px; background: var(--kid-blue); }
|
|
|
+ /* 第三名高度 75 -> 55 */
|
|
|
+ .p-3 .p-box { height: 55px; background: var(--kid-orange); }
|
|
|
+
|
|
|
+ .p-name { font-size: 11px; margin-bottom: 2px; font-weight: bold; text-shadow: 1px 1px 0 rgba(0,0,0,0.1); white-space: nowrap; overflow: hidden; max-width: 60px; margin: 0 auto 2px auto; text-overflow: ellipsis;}
|
|
|
+ .p-score { font-size: 13px; font-weight: 900; background: rgba(0,0,0,0.1); display: inline-block; padding: 1px 6px; border-radius: 6px;}
|
|
|
+
|
|
|
+ /* 列表容器 */
|
|
|
+ .list-container {
|
|
|
+ flex: 1;
|
|
|
+ background: transparent;
|
|
|
+ margin-top: 5px;
|
|
|
+ display: flex; flex-direction: column;
|
|
|
+ overflow: hidden;
|
|
|
+ position: relative; z-index: 8;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 仪表盘卡片:极致压缩,变为条状 */
|
|
|
+ .dashboard-card {
|
|
|
+ margin: 0 15px 10px 15px;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 15px; /* 圆角减小 */
|
|
|
+ padding: 6px 12px; /* 内边距大幅减小 */
|
|
|
+ border: 2px solid var(--kid-blue); /* 边框减细 */
|
|
|
+ box-shadow: 0 3px 0 rgba(72, 219, 251, 0.3);
|
|
|
+ position: relative;
|
|
|
+ flex-shrink: 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 左侧标题区域 */
|
|
|
+ .dash-header {
|
|
|
+ display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
|
|
|
+ margin-bottom: 0; margin-right: 10px; width: 80px; flex-shrink: 0;
|
|
|
+ }
|
|
|
+ .dash-title { font-size: 11px; font-weight: 800; display: flex; align-items: center; gap: 4px; color: var(--kid-text); margin-bottom: 2px;}
|
|
|
+ .dash-icon { color: var(--kid-orange); font-size: 12px; }
|
|
|
+
|
|
|
+ .dash-badge {
|
|
|
+ background: var(--kid-blue); color: white;
|
|
|
+ font-size: 9px; font-weight: 800; padding: 2px 6px;
|
|
|
+ border-radius: 8px; width: fit-content;
|
|
|
+ }
|
|
|
+ .dash-badge.completed { background: var(--kid-green); }
|
|
|
+
|
|
|
+ /* 右侧进度条区域 */
|
|
|
+ .trophy-track-container {
|
|
|
+ position: relative; display: flex; justify-content: space-between; align-items: center;
|
|
|
+ flex: 1; padding: 0 5px;
|
|
|
+ }
|
|
|
+ .track-line-bg { position: absolute; top: 50%; left: 5px; right: 5px; height: 4px; background: #eee; border-radius: 4px; transform: translateY(-50%); z-index: 0; }
|
|
|
+ .track-line-active {
|
|
|
+ position: absolute; top: 50%; left: 5px; width: 25%; height: 4px;
|
|
|
+ background: linear-gradient(90deg, var(--kid-yellow), var(--kid-orange));
|
|
|
+ border-radius: 4px; transform: translateY(-50%); z-index: 0;
|
|
|
+ transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 图标压缩 */
|
|
|
+ .trophy-item {
|
|
|
+ position: relative; z-index: 1;
|
|
|
+ width: 20px; height: 20px; /* 缩小图标 */
|
|
|
+ background: #fff; border: 2px solid #eee; border-radius: 50%;
|
|
|
+ display: flex; justify-content: center; align-items: center;
|
|
|
+ color: #b2bec3; font-size: 9px; transition: all 0.4s;
|
|
|
+ }
|
|
|
+ .trophy-item.active { background: #fff; border-color: var(--kid-green); color: var(--kid-green); transform: scale(1.1); }
|
|
|
+ .trophy-item.final { width: 26px; height: 26px; font-size: 11px; border-color: var(--kid-yellow); }
|
|
|
+ .trophy-item.final.active { background: var(--kid-yellow); color: white; border-color: #fff; transform: scale(1.2); box-shadow: 0 0 0 2px var(--kid-yellow); animation: pulseTrophy 2s infinite; }
|
|
|
+
|
|
|
+ /* 滚动区域 */
|
|
|
+ .rank-scroll-area {
|
|
|
+ flex: 1;
|
|
|
+ background: white;
|
|
|
+ border-radius: 20px 20px 0 0;
|
|
|
+ padding: 0 15px 120px 15px;
|
|
|
+ overflow-y: auto;
|
|
|
+ -webkit-overflow-scrolling: touch;
|
|
|
+ box-shadow: 0 -4px 8px rgba(0,0,0,0.03);
|
|
|
+ }
|
|
|
+
|
|
|
+ .tabs {
|
|
|
+ display: flex; justify-content: center; gap: 10px;
|
|
|
+ position: sticky; top: 0; background: white; z-index: 9;
|
|
|
+ padding-top: 12px; padding-bottom: 8px;
|
|
|
+ }
|
|
|
+ .tab { padding: 5px 16px; border-radius: 15px; font-size: 12px; color: #b2bec3; background: #f1f2f6; cursor: pointer; transition: 0.2s; font-weight: bold; border: 2px solid transparent;}
|
|
|
+ .tab.active { background: var(--kid-blue); color: white; border-color: var(--kid-blue-dark); box-shadow: 0 2px 0 var(--kid-blue-dark); transform: translateY(-1px);}
|
|
|
+
|
|
|
+ .list-item { display: flex; align-items: center; padding: 10px 0; border-bottom: 2px dashed #f1f2f6; }
|
|
|
+ .rank { width: 25px; text-align: center; font-weight: 900; color: var(--kid-blue-dark); font-style: italic; font-size: 14px;}
|
|
|
+ .avatar { width: 36px; height: 36px; border-radius: 50%; margin: 0 10px; background: #eee; overflow: hidden; border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.1);}
|
|
|
+ .avatar img { width: 100%; height: 100%; object-fit: cover;}
|
|
|
+ .info { flex: 1; }
|
|
|
+ .name { font-size: 13px; color: var(--kid-text); font-weight: 800; }
|
|
|
+ .team { font-size: 10px; color: #a4b0be; display: flex; align-items: center; gap: 4px; background: #f1f2f6; display: inline-block; padding: 1px 5px; border-radius: 5px; margin-top: 2px;}
|
|
|
+ .score { font-size: 15px; font-weight: 900; color: var(--kid-orange); }
|
|
|
+
|
|
|
+ /* 底部我的排名 */
|
|
|
+ .my-rank-bar {
|
|
|
+ position: fixed; bottom: 0; left: 0; width: 100%;
|
|
|
+ background: var(--footer-bg); color: white;
|
|
|
+ display: flex; align-items: center;
|
|
|
+ padding: 0 15px;
|
|
|
+ padding-top: 8px;
|
|
|
+ padding-bottom: calc(8px + env(safe-area-inset-bottom));
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 20px 20px 0 0;
|
|
|
+ box-shadow: 0 -4px 15px rgba(255, 107, 107, 0.3); z-index: 99;
|
|
|
+ border-top: 3px solid rgba(255,255,255,0.2);
|
|
|
+ }
|
|
|
+ @supports (-webkit-touch-callout: none) {
|
|
|
+ .my-rank-bar { padding-top: 6px !important; padding-bottom: env(safe-area-inset-bottom) !important; }
|
|
|
+ }
|
|
|
+
|
|
|
+ .my-rank-bar .rank { font-size: 18px; color: white; text-shadow: 1px 1px 0 rgba(0,0,0,0.2); }
|
|
|
+ .my-rank-bar .avatar { width: 34px; height: 34px; border: 2px solid white; box-shadow: none; }
|
|
|
+ .my-rank-bar .name { font-size: 14px; color: white; }
|
|
|
+ .my-score { font-size: 18px; font-weight: 900; color: #fff !important; margin-left: auto; text-shadow: 1px 1px 0 rgba(0,0,0,0.2); }
|
|
|
+
|
|
|
+ .dropdown { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); width: 200px; background: white; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); display: none; flex-direction: column; overflow: hidden; z-index: 200; border: 3px solid var(--kid-blue); }
|
|
|
+ .dropdown.show { display: flex; animation: dropIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
|
|
|
+ .dd-item { padding: 12px; color: var(--kid-text); font-size: 14px; text-align: center; border-bottom: 2px dashed #f1f2f6; cursor: pointer; font-weight: bold;}
|
|
|
+ .dd-active { color: var(--kid-blue-dark); background: #e0f7fa; }
|
|
|
+
|
|
|
+ .modal-mask { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 999; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; backdrop-filter: blur(4px); }
|
|
|
+ .modal-mask.show { opacity: 1; pointer-events: auto; }
|
|
|
+ .modal-body { width: 85%; max-width: 300px; background: white; border-radius: 25px; padding: 20px; text-align: center; transform: scale(0.8); transition: transform 0.3s; border: 4px solid var(--kid-blue); box-shadow: 0 15px 30px rgba(0,0,0,0.2); }
|
|
|
+ .modal-mask.show .modal-body { transform: scale(1); }
|
|
|
+ .m-close { background: var(--kid-yellow); color: #fff; padding: 8px 20px; border-radius: 20px; border: none; font-weight: 900; cursor: pointer; margin-top: 15px; box-shadow: 0 3px 0 #f39c12; }
|
|
|
+ .m-close:active { transform: translateY(3px); box-shadow: none; }
|
|
|
+ .rule-box { text-align: left; background: #fff8e1; border: 2px dashed #ffeaa7; border-radius: 12px; padding: 12px; color: #d35400; font-size: 13px; line-height: 1.5; }
|
|
|
+
|
|
|
+ .demo-section { margin-top: 15px; border-top: 2px dashed #eee; padding-top: 10px; }
|
|
|
+ .demo-btn { background: #f1f2f6; border: none; padding: 5px 10px; border-radius: 10px; font-weight: bold; color: #576574; font-size: 12px;}
|
|
|
+
|
|
|
+ .loading-mask { position: fixed; inset: 0; background: rgba(255,255,255,0.6); display: none; align-items: center; justify-content: center; z-index: 300; color: var(--kid-blue-dark); font-weight: bold; backdrop-filter: blur(5px); }
|
|
|
+ .loading-spinner { border: 4px solid #eee; border-top-color: var(--kid-blue); border-radius: 50%; width: 32px; height: 32px; animation: spin 1s linear infinite; margin-right: 10px; }
|
|
|
+
|
|
|
+ @keyframes wiggle { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }
|
|
|
+ @keyframes dropIn { from{opacity:0; transform:translateX(-50%) translateY(-20px) scale(0.9);} to{opacity:1; transform:translateX(-50%) translateY(0) scale(1);} }
|
|
|
+ @keyframes pulseTrophy { 0% { box-shadow: 0 0 0 0 rgba(254, 202, 87, 0.7); } 100% { box-shadow: 0 0 0 10px rgba(254, 202, 87, 0); } }
|
|
|
+ @keyframes crownFloat { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-8px) rotate(5deg); } }
|
|
|
+ @keyframes spin { to { transform: rotate(360deg); } }
|
|
|
+
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+
|
|
|
+ <!-- 头部 -->
|
|
|
+ <div class="header-area">
|
|
|
+ <div class="cloud c1"></div>
|
|
|
+ <div class="cloud c2"></div>
|
|
|
+ <div class="cloud c3"></div>
|
|
|
+
|
|
|
+ <div class="nav-bar">
|
|
|
+ <div class="icon-btn" onclick="handleBack()"><i class="fa-solid fa-chevron-left" style="color:var(--kid-blue-dark)"></i></div>
|
|
|
+ <div class="month-select" onclick="toggleDropdown()">
|
|
|
+ <span id="currentMonthText">11月挑战赛</span> <i class="fa-solid fa-caret-down" style="margin-left:5px"></i>
|
|
|
+ </div>
|
|
|
+ <div class="icon-btn" onclick="openModal()"><i class="fa-solid fa-question" style="color:var(--kid-blue-dark)"></i></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 领奖台 (高度压缩) -->
|
|
|
+ <div class="podium-wrap" id="podiumWrap"></div>
|
|
|
+
|
|
|
+ <!-- 列表区 -->
|
|
|
+ <div class="list-container">
|
|
|
+
|
|
|
+ <!-- 仪表盘卡片 (高度减半,紧凑布局) -->
|
|
|
+ <div class="dashboard-card">
|
|
|
+ <!-- 左侧:文字和徽章 -->
|
|
|
+ <div class="dash-header">
|
|
|
+ <div class="dash-title">
|
|
|
+ <i class="fa-solid fa-map-marked-alt dash-icon"></i> 任务
|
|
|
+ </div>
|
|
|
+ <div class="dash-badge" id="dashBadge">1 / 4</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 右侧:细长的进度条 -->
|
|
|
+ <div class="trophy-track-container">
|
|
|
+ <div class="track-line-bg"></div>
|
|
|
+ <div class="track-line-active" id="progressLine"></div>
|
|
|
+ <div class="trophy-item active" id="t1"><i class="fa-solid fa-check"></i></div>
|
|
|
+ <div class="trophy-item" id="t2"><i class="fa-solid fa-lock"></i></div>
|
|
|
+ <div class="trophy-item" id="t3"><i class="fa-solid fa-lock"></i></div>
|
|
|
+ <div class="trophy-item final" id="t4"><i class="fa-solid fa-star"></i></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 滚动区域 -->
|
|
|
+ <div class="rank-scroll-area">
|
|
|
+ <div class="tabs">
|
|
|
+ <div class="tab active" onclick="switchTab('score', this)">✨ 积分榜</div>
|
|
|
+ <div class="tab" onclick="switchTab('venue', this)">🚩 场地榜</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div id="rankList"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="my-rank-bar">
|
|
|
+ <div class="rank" id="myRankNum">--</div>
|
|
|
+ <div class="avatar" id="myAvatar" style="border:2px solid #fff; overflow:hidden;"></div>
|
|
|
+ <div class="info"><div class="name" id="myName">我</div><div class="team" id="myTeam">正在加载...</div></div>
|
|
|
+ <div class="my-score" id="myScoreValue">--</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="dropdown" id="dropdown"></div>
|
|
|
+
|
|
|
+ <div class="modal-mask" id="infoModal">
|
|
|
+ <div class="modal-body">
|
|
|
+ <h3 style="color:var(--kid-blue-dark); margin-bottom:10px; font-size:18px;">📜 探险指南</h3>
|
|
|
+ <div id="ruleContent" class="rule-box">
|
|
|
+ <div class="rule-item"><i class="fa-solid fa-bullseye"></i><div><strong>怎么玩:</strong> 在公园找到打卡点,时间越短越厉害!</div></div>
|
|
|
+ <div class="rule-item"><i class="fa-solid fa-map-location-dot"></i><div><strong>比什么:</strong> 看看谁探索的公园最多。</div></div>
|
|
|
+ <div class="rule-item"><i class="fa-solid fa-star"></i><div><strong>拿奖杯:</strong> 完成4次挑战,点亮所有星星!</div></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="demo-section">
|
|
|
+ <div class="demo-label" style="font-size:11px;color:#aaa;margin-bottom:5px">测试小工具</div>
|
|
|
+ <div class="demo-controls" style="display:flex;justify-content:center;gap:8px">
|
|
|
+ <button class="demo-btn" onclick="demoProgress(1);closeModal()">1/4</button>
|
|
|
+ <button class="demo-btn" onclick="demoProgress(3);closeModal()">3/4</button>
|
|
|
+ <button class="demo-btn" onclick="demoProgress(4);closeModal()">通关</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <button class="m-close" onclick="closeModal()">明白啦!</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="loading-mask" id="loadingMask" style="display: none !important;">
|
|
|
+ <div class="loading-spinner"></div>
|
|
|
+ <div>准备出发...</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ // ------------------ JS 逻辑 (保持不变) ------------------
|
|
|
+ const dropdown = document.getElementById('dropdown');
|
|
|
+ const rankListEl = document.getElementById('rankList');
|
|
|
+ const trackLine = document.getElementById('progressLine');
|
|
|
+ const podiumWrap = document.getElementById('podiumWrap');
|
|
|
+ const ruleContent = document.getElementById('ruleContent');
|
|
|
+ const loadingMask = document.getElementById('loadingMask');
|
|
|
+ const state = {
|
|
|
+ activeTab: 'score',
|
|
|
+ scoreList: [],
|
|
|
+ scoreListRendered: null,
|
|
|
+ venueList: [],
|
|
|
+ venueListRendered: null,
|
|
|
+ months: [],
|
|
|
+ currentYM: null,
|
|
|
+ currentMonthData: null,
|
|
|
+ allMonthsData: null
|
|
|
+ };
|
|
|
+
|
|
|
+ const Logger = {
|
|
|
+ _isDev: false,
|
|
|
+ init: function(isDev) { this._isDev = isDev; },
|
|
|
+ log: function() { if (this._isDev) console.log.apply(console, arguments); },
|
|
|
+ warn: function() { if (this._isDev) console.warn.apply(console, arguments); },
|
|
|
+ error: function() { console.error.apply(console, arguments); }
|
|
|
+ };
|
|
|
+
|
|
|
+ function getQuery(name) {
|
|
|
+ const params = new URLSearchParams(window.location.search);
|
|
|
+ return params.get(name);
|
|
|
+ }
|
|
|
+
|
|
|
+ function getYearMonth() {
|
|
|
+ const now = new Date();
|
|
|
+ const year = parseInt(getQuery('year'), 10) || now.getFullYear();
|
|
|
+ const month = parseInt(getQuery('month'), 10) || (now.getMonth() + 1);
|
|
|
+ return { year: year, month: month };
|
|
|
+ }
|
|
|
+
|
|
|
+ function getRecentMonths(count) {
|
|
|
+ const ym = getYearMonth();
|
|
|
+ const list = [];
|
|
|
+ let y = ym.year;
|
|
|
+ let m = ym.month;
|
|
|
+ for (let i = 0; i < (count || 3); i++) {
|
|
|
+ list.push({ year: y, month: m });
|
|
|
+ m -= 1;
|
|
|
+ if (m === 0) { m = 12; y -= 1; }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleBack() {
|
|
|
+ if (window.Bridge && Bridge.toHome) Bridge.toHome();
|
|
|
+ else window.history.back();
|
|
|
+ }
|
|
|
+
|
|
|
+ function openModal() { document.getElementById('infoModal').classList.add('show'); }
|
|
|
+ function closeModal() { document.getElementById('infoModal').classList.remove('show'); }
|
|
|
+ function toggleDropdown() { dropdown.style.display = (dropdown.style.display === 'flex') ? 'none' : 'flex'; }
|
|
|
+
|
|
|
+ function setLoading(isLoading) {
|
|
|
+ rankListEl.style.opacity = isLoading ? '0.4' : '1';
|
|
|
+ loadingMask.classList.toggle('show', isLoading);
|
|
|
+ }
|
|
|
+
|
|
|
+ function buildAvatar(name, salt) {
|
|
|
+ const seedBase = name || 'user';
|
|
|
+ const seed = seedBase + (salt || '');
|
|
|
+ return multiavatar(seed);
|
|
|
+ }
|
|
|
+
|
|
|
+ function setProgress(real, target) {
|
|
|
+ const badge = document.getElementById('dashBadge');
|
|
|
+ const t1 = document.getElementById('t1');
|
|
|
+ const t2 = document.getElementById('t2');
|
|
|
+ const t3 = document.getElementById('t3');
|
|
|
+ const t4 = document.getElementById('t4');
|
|
|
+ const safeReal = Math.max(real || 0, 0);
|
|
|
+ const safeTarget = target && target > 0 ? target : 4;
|
|
|
+ const ratio = Math.min(safeReal / safeTarget, 1);
|
|
|
+ const percent = Math.max(0, Math.min(1, ratio)) * 100;
|
|
|
+ trackLine.style.width = percent + '%';
|
|
|
+ const textReal = safeReal >= safeTarget ? safeTarget : safeReal;
|
|
|
+ badge.innerText = safeReal >= safeTarget ? '成功' : `${textReal} / ${safeTarget}`;
|
|
|
+ badge.classList.toggle('completed', safeReal >= safeTarget);
|
|
|
+ function setIconActive(el, active) {
|
|
|
+ if (active) {
|
|
|
+ el.classList.add('active');
|
|
|
+ if (!el.classList.contains('final')) el.innerHTML = '<i class="fa-solid fa-check"></i>';
|
|
|
+ } else {
|
|
|
+ el.classList.remove('active');
|
|
|
+ if (!el.classList.contains('final')) el.innerHTML = '<i class="fa-solid fa-lock"></i>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setIconActive(t1, safeReal >= 1);
|
|
|
+ setIconActive(t2, safeReal >= 2);
|
|
|
+ setIconActive(t3, safeReal >= 3);
|
|
|
+ setIconActive(t4, safeReal >= safeTarget);
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderBadge(real, target) {
|
|
|
+ setProgress(real, target);
|
|
|
+ }
|
|
|
+
|
|
|
+ function findMonthProgress(year, month, currentMonthData, allMonthsData) {
|
|
|
+ const result = { realNum: 0, targetNum: 4 };
|
|
|
+ const pick = (arr) => {
|
|
|
+ if (!arr || !arr.length) return null;
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ if (Number(arr[i].month) === Number(month)) return arr[i];
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ };
|
|
|
+ const fromCurrent = currentMonthData && pick(currentMonthData.monthRs || []);
|
|
|
+ if (fromCurrent) return { realNum: fromCurrent.realNum || 0, targetNum: fromCurrent.targetNum || 4 };
|
|
|
+ if (allMonthsData && allMonthsData.length) {
|
|
|
+ for (let i = 0; i < allMonthsData.length; i++) {
|
|
|
+ const item = allMonthsData[i];
|
|
|
+ if (item.year && Number(item.year) !== Number(year)) continue;
|
|
|
+ const found = pick(item.monthRs || []);
|
|
|
+ if (found) return { realNum: found.realNum || 0, targetNum: found.targetNum || 4 };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderMonths(list) {
|
|
|
+ dropdown.innerHTML = '';
|
|
|
+ if (!list || list.length === 0) {
|
|
|
+ dropdown.innerHTML = '<div class="dd-item">暂无数据</div>';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ list.forEach((item, idx) => {
|
|
|
+ const title = `${item.month}月挑战赛`;
|
|
|
+ const div = document.createElement('div');
|
|
|
+ const isCurrent = state.currentYM && state.currentYM.year === item.year && state.currentYM.month === item.month;
|
|
|
+ div.className = 'dd-item' + (isCurrent ? ' dd-active' : '');
|
|
|
+ div.innerText = (idx === 0 && !isCurrent) ? `${title} (本月)` : title;
|
|
|
+ div.onclick = () => { selectMonth(item.year, item.month, title); };
|
|
|
+ dropdown.appendChild(div);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderPodium(list, tabType) {
|
|
|
+ const type = tabType || state.activeTab || 'score';
|
|
|
+ podiumWrap.innerHTML = '';
|
|
|
+
|
|
|
+ const podiumData = Array(3).fill(null);
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ list.slice(0, 3).forEach((item, index) => {
|
|
|
+ podiumData[index] = item;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ const p1 = podiumData[0];
|
|
|
+ const p2 = podiumData[1];
|
|
|
+ const p3 = podiumData[2];
|
|
|
+
|
|
|
+ const podiumItems = [
|
|
|
+ { person: p2, className: 'p-2' },
|
|
|
+ { person: p1, className: 'p-1' },
|
|
|
+ { person: p3, className: 'p-3' }
|
|
|
+ ];
|
|
|
+
|
|
|
+ podiumItems.forEach(itemConfig => {
|
|
|
+ const person = itemConfig.person;
|
|
|
+ const col = document.createElement('div');
|
|
|
+ col.className = 'p-col ' + itemConfig.className;
|
|
|
+
|
|
|
+ const name = person ? (person.nickName || person.name || person.userName) : '虚位以待';
|
|
|
+ const score = person ? (person.score != null ? person.score : (person.inRankNum != null ? person.inRankNum : '')) : '';
|
|
|
+ const avatarContent = person ? buildAvatar(name, person.rankNum) : '<div style="width:100%;height:100%;background:#eee;color:#aaa;display:flex;align-items:center;justify-content:center;font-weight:bold;font-size:20px;">?</div>';
|
|
|
+
|
|
|
+ const isActualFirst = (person === p1 && p1 !== null);
|
|
|
+
|
|
|
+ col.innerHTML = `
|
|
|
+ ${isActualFirst ? '<div class="crown"><i class="fa-solid fa-crown"></i></div>' : ''}
|
|
|
+ <div class="p-img">${avatarContent}</div>
|
|
|
+ <div class="p-box">
|
|
|
+ <div class="p-name">${name}</div>
|
|
|
+ <div class="p-score">${score}</div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ podiumWrap.appendChild(col);
|
|
|
+ });
|
|
|
+
|
|
|
+ const remaining = list && list.length > 3 ? list.slice(3) : [];
|
|
|
+ if (type === 'venue') {
|
|
|
+ state.venueListRendered = remaining;
|
|
|
+ } else {
|
|
|
+ state.scoreListRendered = remaining;
|
|
|
+ }
|
|
|
+ if (state.activeTab === type) renderRankList(remaining);
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderRankList(list) {
|
|
|
+ rankListEl.innerHTML = '';
|
|
|
+ if (!list || list.length === 0) {
|
|
|
+ rankListEl.innerHTML = '<div style="padding:40px; color:#b2bec3; text-align:center; font-weight:bold;">暂时没人上榜哦<br>快去挑战吧!</div>';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ list.forEach((item, idx) => {
|
|
|
+ const rankNum = item.rankNum || idx + 1;
|
|
|
+ const name = item.nickName || item.name || item.userName || item.teamName || '探险家';
|
|
|
+ const scoreVal = (item.score != null ? item.score : item.inRankNum);
|
|
|
+ const score = scoreVal != null ? scoreVal : '--';
|
|
|
+ const team = item.teamName || item.coiName || '';
|
|
|
+ const teamIcon = team ? '<i class="fa-solid fa-user-group"></i> ' : '<i class="fa-solid fa-user"></i> ';
|
|
|
+ const row = document.createElement('div');
|
|
|
+ row.className = 'list-item';
|
|
|
+ row.innerHTML = `
|
|
|
+ <div class="rank">${rankNum}</div>
|
|
|
+ <div class="avatar">${buildAvatar(name, rankNum)}</div>
|
|
|
+ <div class="info">
|
|
|
+ <div class="name">${name}</div>
|
|
|
+ <div class="team">${teamIcon}${team || '小小探险家'}</div>
|
|
|
+ </div>
|
|
|
+ <div class="score">${score}</div>
|
|
|
+ `;
|
|
|
+ rankListEl.appendChild(row);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderMyInfo(myRank, myScore, userInfo) {
|
|
|
+ const rankNumEl = document.getElementById('myRankNum');
|
|
|
+ const myScoreEl = document.getElementById('myScoreValue');
|
|
|
+ const myNameEl = document.getElementById('myName');
|
|
|
+ const myTeamEl = document.getElementById('myTeam');
|
|
|
+ const myAvatarEl = document.getElementById('myAvatar');
|
|
|
+ const rankVal = myRank && Number(myRank.rankNum);
|
|
|
+ const hasRank = rankVal > 0;
|
|
|
+ rankNumEl.innerText = hasRank ? rankVal : '-';
|
|
|
+ myScoreEl.innerText = hasRank && myScore && myScore.score != null ? myScore.score : '--';
|
|
|
+ const name = (userInfo && (userInfo.nickName || userInfo.userName)) || '我';
|
|
|
+ myNameEl.innerText = name;
|
|
|
+ myTeamEl.innerText = hasRank ? '继续冲刺!' : '加油!';
|
|
|
+ myAvatarEl.innerHTML = buildAvatar(name, 'me');
|
|
|
+ document.querySelector('.my-rank-bar').onclick = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderGuestState() {
|
|
|
+ const rankNumEl = document.getElementById('myRankNum');
|
|
|
+ const myScoreEl = document.getElementById('myScoreValue');
|
|
|
+ const myNameEl = document.getElementById('myName');
|
|
|
+ const myTeamEl = document.getElementById('myTeam');
|
|
|
+ const myAvatarEl = document.getElementById('myAvatar');
|
|
|
+ const myRankBar = document.querySelector('.my-rank-bar');
|
|
|
+
|
|
|
+ rankNumEl.innerText = '--';
|
|
|
+ myScoreEl.innerText = '';
|
|
|
+ myNameEl.innerText = '未登录';
|
|
|
+ myTeamEl.innerText = '点击登录探险';
|
|
|
+ myTeamEl.style.color = 'white';
|
|
|
+
|
|
|
+ const randomSeed = 'guest_' + Math.floor(Math.random() * 10000);
|
|
|
+ myAvatarEl.innerHTML = buildAvatar('Guest', randomSeed);
|
|
|
+
|
|
|
+ myRankBar.onclick = function() {
|
|
|
+ if (window.Bridge && Bridge.toLogin) {
|
|
|
+ Bridge.toLogin();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderRules(config) {
|
|
|
+ if (!config || !config.configJson) return;
|
|
|
+ try {
|
|
|
+ const parsed = JSON.parse(config.configJson);
|
|
|
+ const rules = parsed.popupRuleList || [];
|
|
|
+ if (rules.length > 0 && rules[0].data && rules[0].data.content) {
|
|
|
+ ruleContent.innerHTML = rules[0].data.content;
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ Logger.warn('[Rule] parse error', err);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function switchTab(type, tabElement) {
|
|
|
+ state.activeTab = type;
|
|
|
+ document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
|
|
|
+ if (tabElement) tabElement.classList.add('active');
|
|
|
+ const baseList = type === 'venue' ? state.venueList : state.scoreList;
|
|
|
+ renderPodium(baseList, type);
|
|
|
+ const rendered = type === 'venue' ? (state.venueListRendered || baseList.slice(3)) : (state.scoreListRendered || baseList.slice(3));
|
|
|
+ renderRankList(rendered);
|
|
|
+ }
|
|
|
+
|
|
|
+ function demoProgress(step) {
|
|
|
+ setProgress(step, 4);
|
|
|
+ }
|
|
|
+
|
|
|
+ async function loadMonthData(year, month) {
|
|
|
+ state.currentYM = { year: year, month: month };
|
|
|
+ document.getElementById('currentMonthText').innerText = `${month}月挑战赛`;
|
|
|
+ renderMonths(state.months);
|
|
|
+ setLoading(true);
|
|
|
+ try {
|
|
|
+ const monthRank = await API.request('MonthRankDetailQuery', { year: year, month: month, dispArrStr: 'grad,mapNum' });
|
|
|
+ const monthGrad = monthRank && monthRank.gradRs ? monthRank.gradRs : [];
|
|
|
+ const monthMap = monthRank && monthRank.mapNumRs ? monthRank.mapNumRs : [];
|
|
|
+ state.scoreList = monthGrad;
|
|
|
+ state.venueList = monthMap;
|
|
|
+ const prog = findMonthProgress(year, month, state.currentMonthData, state.allMonthsData);
|
|
|
+ renderBadge(prog.realNum, prog.targetNum);
|
|
|
+ renderPodium(state.activeTab === 'venue' ? state.venueList : state.scoreList, state.activeTab);
|
|
|
+ switchTab(state.activeTab, document.querySelector('.tab.active'));
|
|
|
+ } catch (err) {
|
|
|
+ Logger.error('[Month] 加载失败', err);
|
|
|
+ rankListEl.innerHTML = '<div style="padding:20px; color:#ff6b6b;">数据加载失败,请重试</div>';
|
|
|
+ } finally {
|
|
|
+ setLoading(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function selectMonth(year, month, title) {
|
|
|
+ dropdown.style.display = 'none';
|
|
|
+ loadMonthData(year, month);
|
|
|
+ }
|
|
|
+
|
|
|
+ async function initPage() {
|
|
|
+ if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
|
|
+ document.body.classList.add('platform-ios');
|
|
|
+ }
|
|
|
+
|
|
|
+ const ecId = getQuery('ecId') || '4';
|
|
|
+ const token = getQuery('token');
|
|
|
+ let baseUrl = getQuery('baseUrl') || undefined;
|
|
|
+ const env = (getQuery('env') || '').toLowerCase();
|
|
|
+ const useMock = env === 'mock';
|
|
|
+ Logger.init(useMock);
|
|
|
+ const ym = getYearMonth();
|
|
|
+
|
|
|
+ state.months = getRecentMonths(6);
|
|
|
+
|
|
|
+ if (!baseUrl && !useMock) baseUrl = 'https://colormaprun.com/api/card/';
|
|
|
+ if (window.Bridge && window.Bridge.onToken) Bridge.onToken(API.setToken);
|
|
|
+ API.init({ token: token || '', useMock: useMock, baseUrl: baseUrl });
|
|
|
+ const allowLogin = !useMock && token;
|
|
|
+
|
|
|
+ renderMonths(state.months);
|
|
|
+ setLoading(true);
|
|
|
+
|
|
|
+ async function safeCall(promiseFactory) {
|
|
|
+ try { return await promiseFactory(); }
|
|
|
+ catch (err) { Logger.warn('[Optional API] ignore error', err); return null; }
|
|
|
+ }
|
|
|
+
|
|
|
+ async function fetchMonthData(year, month) {
|
|
|
+ return await API.request('MonthRankDetailQuery', { year: year, month: month, dispArrStr: 'grad,mapNum' });
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ let targetYM = { year: ym.year, month: ym.month };
|
|
|
+ let monthRank = await fetchMonthData(targetYM.year, targetYM.month);
|
|
|
+
|
|
|
+ let monthGrad = monthRank && monthRank.gradRs ? monthRank.gradRs : [];
|
|
|
+ let monthMap = monthRank && monthRank.mapNumRs ? monthRank.mapNumRs : [];
|
|
|
+ let hasData = monthGrad.length > 0 || monthMap.length > 0;
|
|
|
+
|
|
|
+ if (!hasData) {
|
|
|
+ for (let i = 1; i < state.months.length; i++) {
|
|
|
+ const checkYM = state.months[i];
|
|
|
+ const checkRank = await fetchMonthData(checkYM.year, checkYM.month);
|
|
|
+ const checkGrad = checkRank && checkRank.gradRs ? checkRank.gradRs : [];
|
|
|
+ const checkMap = checkRank && checkRank.mapNumRs ? checkRank.mapNumRs : [];
|
|
|
+
|
|
|
+ if (checkGrad.length > 0 || checkMap.length > 0) {
|
|
|
+ targetYM = checkYM;
|
|
|
+ monthRank = checkRank;
|
|
|
+ monthGrad = checkGrad;
|
|
|
+ monthMap = checkMap;
|
|
|
+ hasData = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ state.currentYM = targetYM;
|
|
|
+ state.scoreList = monthGrad;
|
|
|
+ state.venueList = monthMap;
|
|
|
+
|
|
|
+ let base, currentMonth, allMonths, myRank, myScore, userInfo, cardConfig;
|
|
|
+ if (useMock || allowLogin) {
|
|
|
+ [base, currentMonth, allMonths, myRank, myScore, userInfo, cardConfig] = await Promise.all([
|
|
|
+ safeCall(() => API.getCardBase(ecId, 'rank')),
|
|
|
+ safeCall(() => API.request('CurrentMonthlyChallengeQuery', { ecId: ecId })),
|
|
|
+ safeCall(() => API.getMonthlyChallenge()),
|
|
|
+ safeCall(() => API.getUserCurrentRank(ecId)),
|
|
|
+ safeCall(() => API.getScore(ecId)),
|
|
|
+ safeCall(() => API.getUserInfo()),
|
|
|
+ safeCall(() => API.getCardConfig(ecId, 'rank'))
|
|
|
+ ]);
|
|
|
+ } else {
|
|
|
+ base = { ecName: `${targetYM.month}月挑战赛` };
|
|
|
+ currentMonth = { monthRs: [{ month: targetYM.month, realNum: 0, targetNum: 4 }] };
|
|
|
+ allMonths = [];
|
|
|
+ myRank = null;
|
|
|
+ myScore = null;
|
|
|
+ userInfo = null;
|
|
|
+ cardConfig = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ const selfRow = monthGrad.find && monthGrad.find(item => item.isSelf === 1);
|
|
|
+ if (!base && monthGrad.length) base = { ecName: `${targetYM.month}月挑战赛` };
|
|
|
+ state.currentMonthData = currentMonth || null;
|
|
|
+ state.allMonthsData = allMonths || null;
|
|
|
+
|
|
|
+ const prog = findMonthProgress(targetYM.year, targetYM.month, state.currentMonthData, state.allMonthsData);
|
|
|
+ document.getElementById('currentMonthText').innerText = `${targetYM.month}月挑战赛`;
|
|
|
+
|
|
|
+ renderMonths(state.months);
|
|
|
+ renderBadge(prog.realNum, prog.targetNum);
|
|
|
+ renderPodium(state.scoreList, 'score');
|
|
|
+ switchTab(state.activeTab, document.querySelector('.tab.active'));
|
|
|
+
|
|
|
+ if (!token && !useMock) {
|
|
|
+ renderGuestState();
|
|
|
+ } else {
|
|
|
+ let hasRenderedMyInfo = false;
|
|
|
+ if (allowLogin && myRank) {
|
|
|
+ const rankVal = Number(myRank.rankNum);
|
|
|
+ if (rankVal > 0) {
|
|
|
+ renderMyInfo({ rankNum: rankVal }, myScore, userInfo);
|
|
|
+ } else {
|
|
|
+ renderMyInfo({ rankNum: null }, null, userInfo);
|
|
|
+ }
|
|
|
+ hasRenderedMyInfo = true;
|
|
|
+ } else if (selfRow) {
|
|
|
+ renderMyInfo({ rankNum: selfRow.rankNum }, { score: selfRow.inRankNum || selfRow.score }, { nickName: selfRow.userName });
|
|
|
+ hasRenderedMyInfo = true;
|
|
|
+ }
|
|
|
+ if (!hasRenderedMyInfo) {
|
|
|
+ renderMyInfo(myRank, myScore, userInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ renderRules(cardConfig);
|
|
|
+ } finally {
|
|
|
+ setLoading(false);
|
|
|
+ loadingMask.classList.remove('show');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ document.addEventListener('click', (e) => {
|
|
|
+ if(!e.target.closest('.month-select') && !e.target.closest('.dropdown')) { dropdown.style.display = 'none'; }
|
|
|
+ });
|
|
|
+
|
|
|
+ document.addEventListener('DOMContentLoaded', initPage);
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|