整理文档并接入 H5 体验测试链路

This commit is contained in:
2026-03-27 15:36:27 +08:00
parent 0e025c3426
commit 0e0a724025
55 changed files with 4177 additions and 55 deletions

View File

@@ -0,0 +1,161 @@
{
"schemaVersion": "1",
"version": "2026.03.25",
"app": {
"id": "sample-classic-001",
"title": "顺序赛示例",
"locale": "zh-CN"
},
"map": {
"tiles": "../map/lxcb-001/tiles/",
"mapmeta": "../map/lxcb-001/tiles/meta.json",
"declination": 6.91,
"initialView": {
"zoom": 17
}
},
"playfield": {
"kind": "course",
"source": {
"type": "kml",
"url": "../kml/lxcb-001/10/c01.kml"
},
"CPRadius": 6,
"controlOverrides": {
"start-1": {
"title": "比赛开始",
"body": "从这里出发,先熟悉地图方向,再推进到第一个目标点。",
"autoPopup": true,
"once": true,
"priority": 1,
"contentExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
},
"clickTitle": "起点说明",
"clickBody": "点击起点可再次查看起跑说明与路线背景。",
"clickExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
},
"control-1": {
"title": "图书馆前广场",
"body": "这是第一检查点,完成后沿主路继续前进。",
"autoPopup": true,
"once": false,
"priority": 1,
"clickTitle": "图书馆前广场",
"clickBody": "这里是顺序赛的首个关键点位,适合确认路线方向。",
"contentExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
},
"clickExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
},
"control-2": {
"title": "教学楼南侧",
"body": "注意这里地形开阔,适合快速判断下一段方向。",
"autoPopup": false,
"once": true,
"priority": 1,
"clickTitle": "教学楼南侧",
"clickBody": "这个点配置成点击查看,经过时不会自动弹出。",
"clickExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
},
"control-3": {
"title": "湖边步道",
"body": "经过这里时可以观察水边和林带的边界关系。",
"autoPopup": true,
"once": false,
"priority": 1,
"clickTitle": "湖边步道",
"clickBody": "点击可查看更详细的路线观察建议。"
},
"finish-1": {
"title": "终点到达",
"body": "恭喜完成本次顺序赛,准备查看结果。",
"autoPopup": true,
"once": true,
"priority": 2,
"clickTitle": "终点说明",
"clickBody": "点击终点可再次查看本局结束说明。",
"clickExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
}
},
"metadata": {
"title": "顺序赛路线示例",
"code": "classic-001"
}
},
"game": {
"mode": "classic-sequential",
"rulesVersion": "1",
"session": {
"startManually": true,
"requiresStartPunch": true,
"requiresFinishPunch": true,
"autoFinishOnLastControl": false,
"maxDurationSec": 5400
},
"punch": {
"policy": "enter-confirm",
"radiusMeters": 5
},
"sequence": {
"skip": {
"enabled": true,
"radiusMeters": 30,
"requiresConfirm": true
}
},
"guidance": {
"showLegs": true,
"legAnimation": true,
"allowFocusSelection": false
},
"visibility": {
"revealFullPlayfieldAfterStartPunch": true
},
"finish": {
"finishControlAlwaysSelectable": false
},
"telemetry": {
"heartRate": {
"age": 30,
"restingHeartRateBpm": 62,
"userWeightKg": 65
}
},
"feedback": {
"audioProfile": "default",
"hapticsProfile": "default",
"uiEffectsProfile": "default"
}
},
"resources": {
"audioProfile": "default",
"contentProfile": "default",
"themeProfile": "default-race"
},
"debug": {
"allowModeSwitch": false,
"allowMockInput": false,
"allowSimulator": false
}
}

View File

@@ -0,0 +1,198 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, viewport-fit=cover"
/>
<title>CMR 内容体验测试页</title>
<style>
:root {
color-scheme: light;
--bg: #f4f8f5;
--fg: #173127;
--muted: #5e6f65;
--accent: #1f7a5a;
--accent-soft: #dcefe6;
--card: rgba(255, 255, 255, 0.9);
--border: rgba(23, 49, 39, 0.08);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
background:
radial-gradient(circle at top left, rgba(31, 122, 90, 0.14), transparent 32%),
linear-gradient(180deg, #eef6f1 0%, var(--bg) 100%);
color: var(--fg);
}
.page {
min-height: 100vh;
padding: 28px 18px 32px;
}
.card {
max-width: 720px;
margin: 0 auto;
background: var(--card);
border: 1px solid var(--border);
border-radius: 24px;
padding: 24px;
box-shadow: 0 18px 42px rgba(24, 49, 39, 0.12);
backdrop-filter: blur(10px);
}
.eyebrow {
margin: 0 0 8px;
color: var(--muted);
font-size: 12px;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1 {
margin: 0 0 12px;
font-size: 28px;
line-height: 1.2;
}
.lead {
margin: 0 0 18px;
color: var(--muted);
font-size: 15px;
line-height: 1.7;
}
.context {
margin: 18px 0 0;
padding: 14px 16px;
border-radius: 16px;
background: var(--accent-soft);
}
.context pre {
margin: 0;
white-space: pre-wrap;
word-break: break-word;
font-size: 12px;
line-height: 1.6;
}
.actions {
display: grid;
gap: 12px;
margin-top: 22px;
}
button {
appearance: none;
border: 0;
border-radius: 16px;
padding: 14px 18px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
}
.btn-primary {
background: var(--accent);
color: #fff;
}
.btn-secondary {
background: rgba(23, 49, 39, 0.08);
color: var(--fg);
}
</style>
</head>
<body>
<main class="page">
<section class="card">
<p class="eyebrow">content-v1 test</p>
<h1 id="title">内容体验测试页</h1>
<p class="lead" id="desc">
这个页面用于验证小程序内容 H5 容器、上下文传参和关闭/回退链路。
</p>
<div class="actions">
<button class="btn-primary" id="closeBtn">关闭并返回小程序</button>
<button class="btn-secondary" id="fallbackBtn">模拟失败并回退原生卡片</button>
</div>
<div class="context">
<pre id="contextView">loading...</pre>
</div>
</section>
</main>
<script>
function getQueryParam(key) {
const params = new URLSearchParams(window.location.search);
return params.get(key) || "";
}
function parseContext() {
const raw = getQueryParam("cmrContext");
if (!raw) {
return {};
}
try {
return JSON.parse(raw);
} catch (error) {
return { parseError: String(error), raw };
}
}
function postToMiniProgram(action, payload) {
const message = { action, payload: payload || {} };
if (
window.wx &&
window.wx.miniProgram &&
typeof window.wx.miniProgram.postMessage === "function"
) {
window.wx.miniProgram.postMessage({ data: message });
} else if (
window.parent &&
typeof window.parent.postMessage === "function"
) {
window.parent.postMessage(message, "*");
}
}
const context = parseContext();
const titleEl = document.getElementById("title");
const descEl = document.getElementById("desc");
const contextViewEl = document.getElementById("contextView");
if (context.title) {
titleEl.textContent = context.title;
}
if (context.body) {
descEl.textContent = context.body;
}
contextViewEl.textContent = JSON.stringify(
{
bridge: getQueryParam("cmrBridge"),
kind: getQueryParam("cmrKind"),
context,
},
null,
2
);
document.getElementById("closeBtn").addEventListener("click", function () {
postToMiniProgram("close");
});
document.getElementById("fallbackBtn").addEventListener("click", function () {
postToMiniProgram("fallback");
});
</script>
</body>
</html>

177
event/score-o.json Normal file
View File

@@ -0,0 +1,177 @@
{
"schemaVersion": "1",
"version": "2026.03.25",
"app": {
"id": "sample-score-o-001",
"title": "积分赛示例",
"locale": "zh-CN"
},
"map": {
"tiles": "../map/lxcb-001/tiles/",
"mapmeta": "../map/lxcb-001/tiles/meta.json",
"declination": 6.91,
"initialView": {
"zoom": 17
}
},
"playfield": {
"kind": "control-set",
"source": {
"type": "kml",
"url": "../kml/lxcb-001/10/c01.kml"
},
"CPRadius": 6,
"controlOverrides": {
"start-1": {
"title": "比赛开始",
"body": "从这里触发,先熟悉地图方向。",
"autoPopup": true,
"once": true,
"priority": 1,
"contentExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
},
"clickTitle": "积分赛起点",
"clickBody": "点击起点可查看自由打点规则与终点说明。",
"clickExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
},
"control-1": {
"score": 10,
"clickTitle": "1号点",
"clickBody": "这是一个基础积分点,适合作为开局热身。",
"clickExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
},
"control-2": {
"score": 20,
"autoPopup": false,
"once": true,
"priority": 1,
"clickTitle": "2号点",
"clickBody": "这个点配置成点击查看,经过时不会自动弹。",
"clickExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
},
"control-3": {
"score": 30,
"title": "湖边步道",
"body": "这里适合短暂停留观察周边地形。",
"autoPopup": true,
"once": false,
"priority": 1,
"clickTitle": "湖边步道",
"clickBody": "点击可查看这一区域的补充说明。",
"contentExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
},
"control-4": {
"score": 40
},
"control-5": {
"score": 50
},
"control-6": {
"score": 60,
"title": "悬崖边",
"body": "这里很危险啊。",
"autoPopup": true,
"once": true,
"priority": 2,
"clickTitle": "悬崖边",
"clickBody": "点击查看地形风险提示。"
},
"control-7": {
"score": 70
},
"control-8": {
"score": 80
},
"finish-1": {
"title": "比赛结束",
"body": "恭喜完成本次路线,准备查看结果。",
"autoPopup": true,
"once": true,
"priority": 2,
"clickTitle": "终点说明",
"clickBody": "点击终点可再次查看结束与结算提示。",
"clickExperience": {
"type": "h5",
"url": "https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html",
"bridge": "content-v1"
}
}
},
"metadata": {
"title": "积分赛控制点示例2 起终点 + 8 积分点)",
"code": "score-o-001"
}
},
"game": {
"mode": "score-o",
"rulesVersion": "1",
"session": {
"startManually": true,
"requiresStartPunch": true,
"requiresFinishPunch": false,
"autoFinishOnLastControl": false,
"maxDurationSec": 5400
},
"punch": {
"policy": "enter-confirm",
"radiusMeters": 5,
"requiresFocusSelection": false
},
"scoring": {
"type": "score",
"defaultControlScore": 10
},
"guidance": {
"showLegs": false,
"legAnimation": false,
"allowFocusSelection": true
},
"visibility": {
"revealFullPlayfieldAfterStartPunch": true
},
"finish": {
"finishControlAlwaysSelectable": true
},
"telemetry": {
"heartRate": {
"age": 30,
"restingHeartRateBpm": 62,
"userWeightKg": 65
}
},
"feedback": {
"audioProfile": "default",
"hapticsProfile": "default",
"uiEffectsProfile": "default"
}
},
"resources": {
"audioProfile": "default",
"contentProfile": "default",
"themeProfile": "default-race"
},
"debug": {
"allowModeSwitch": false,
"allowMockInput": false,
"allowSimulator": false
}
}