feat(experiments): 发布完整截图教程与分组规则说明

- 操作指南改为带目录和图片放大的二级教程页面,完整覆盖实验生命周期
- 用隔离演示数据拍摄14张实际组件截图,生成编号箭头标注与共享内容README
- 标明稳定分组算法与比例区间,修正比例输入提交时的回显同步
- 同步路由、项目目录和教程资源一致性校验脚本
This commit is contained in:
湛兮
2026-10-27 16:13:49 +08:00
parent df7b9a0cb3
commit c406f8c127
36 changed files with 1523 additions and 88 deletions
+267
View File
@@ -0,0 +1,267 @@
<script setup lang="ts">
/** 实验图文教程二级页:与仓库README共用内容源,截图标注只来自隔离演示。 */
import { useRouter } from "vue-router";
import guide from "../../../docs/experiments/guide.json";
const router = useRouter();
const images = guide.steps.flatMap(step =>
(step.images ?? []).map(image => `/guides/experiments/${image}.svg`)
);
/** 在当前二级页内滚动,不修改hash路由,也不触发任何实验写操作。 */
function jump(id: string) {
document
.getElementById(`guide-${id}`)
?.scrollIntoView({ behavior: "smooth", block: "start" });
}
</script>
<template>
<div class="experiment-guide">
<header class="guide-heading">
<div>
<el-tag type="info">从零开始 · 图文教程</el-tag>
<h1>{{ guide.title }}</h1>
<p>{{ guide.intro }}</p>
</div>
<el-button @click="router.push('/digital/experiments')"
>返回测试方案</el-button
>
</header>
<el-alert
title="截图使用实际页面组件与隔离演示数据。红色编号对应下方操作;演示接入与统计状态不代表你的线上类型已经验收。点击图片可放大查看。"
type="info"
:closable="false"
/>
<div class="guide-layout">
<nav class="guide-toc" aria-label="教程目录">
<strong>本页目录</strong
><button
v-for="step in guide.steps"
:key="step.id"
type="button"
@click="jump(step.id)"
>
{{ step.title }}
</button>
</nav>
<article>
<section
v-for="step in guide.steps"
:id="`guide-${step.id}`"
:key="step.id"
class="guide-section"
>
<h2>{{ step.title }}</h2>
<p class="guide-lead">{{ step.lead }}</p>
<figure v-for="image in step.images ?? []" :key="image">
<el-image
:src="`/guides/experiments/${image}.svg`"
:alt="`${step.title},带红色箭头与编号的演示截图`"
:preview-src-list="images"
:initial-index="
images.indexOf(`/guides/experiments/${image}.svg`)
"
preview-teleported
lazy
fit="contain"
><template #error
><div class="image-error">
教程图片加载失败,请刷新重试。
</div></template
></el-image
>
<figcaption>隔离演示截图 · 点击放大 · 编号对应下方操作</figcaption>
<ol class="guide-callouts">
<li v-for="note in guide.captions[image]" :key="note">
{{ note }}
</li>
</ol>
</figure>
<ul>
<li v-for="line in step.bullets" :key="line">{{ line }}</li>
</ul>
<pre v-if="'code' in step"><code>{{ step.code }}</code></pre>
</section>
<footer class="guide-footer">
<p>
教程更新:{{
guide.updated
}}。开始操作前,请确认当前环境与目标账号。
</p>
<el-button @click="router.push('/digital/experiment-types')"
>去实验类型</el-button
><el-button
type="primary"
@click="router.push('/digital/experiments')"
>去测试方案</el-button
><el-button @click="router.push('/digital/experiment-users')"
>去用户管理</el-button
>
</footer>
</article>
</div>
</div>
</template>
<style scoped>
.experiment-guide {
max-width: 1440px;
margin: 0 auto;
}
.guide-heading {
display: flex;
gap: 24px;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 24px;
}
.guide-heading h1 {
margin: 12px 0;
font-size: 28px;
}
.guide-heading p {
max-width: 800px;
line-height: 1.8;
color: var(--el-text-color-secondary);
}
.guide-layout {
display: grid;
grid-template-columns: 220px minmax(0, 1fr);
gap: 32px;
margin-top: 24px;
}
.guide-toc {
position: sticky;
top: 96px;
display: flex;
flex-direction: column;
gap: 6px;
align-self: start;
max-height: calc(100vh - 130px);
padding: 16px;
overflow-y: auto;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-lighter);
border-radius: 8px;
}
.guide-toc strong {
padding: 4px 8px 12px;
}
.guide-toc button {
padding: 8px;
font: inherit;
font-size: 13px;
color: var(--el-text-color-regular);
text-align: left;
cursor: pointer;
background: transparent;
border: 0;
border-radius: 4px;
}
.guide-toc button:hover {
color: var(--el-color-primary);
background: var(--el-fill-color-light);
}
.guide-toc button:focus-visible {
outline: 2px solid var(--el-color-primary);
outline-offset: 2px;
}
.guide-section {
padding: 24px;
margin-bottom: 24px;
scroll-margin-top: 100px;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-lighter);
border-radius: 8px;
}
.guide-section h2 {
margin: 0 0 12px;
font-size: 21px;
}
.guide-lead {
line-height: 1.8;
}
.guide-section figure {
margin: 20px 0;
}
.guide-section .el-image {
display: block;
width: 100%;
min-height: 100px;
border: 1px solid var(--el-border-color-lighter);
border-radius: 6px;
}
.guide-section figcaption {
margin-top: 8px;
font-size: 12px;
color: var(--el-text-color-secondary);
text-align: center;
}
.guide-section ul {
padding-left: 22px;
line-height: 1.9;
}
.guide-section li {
margin-bottom: 12px;
overflow-wrap: anywhere;
}
.guide-section pre {
padding: 16px;
overflow-x: auto;
font-size: 12px;
line-height: 1.8;
white-space: pre-wrap;
background: var(--el-fill-color-light);
border-radius: 6px;
}
.image-error {
padding: 24px;
color: var(--el-text-color-secondary);
text-align: center;
}
.guide-footer {
padding: 20px 0 32px;
line-height: 1.8;
}
.guide-footer p {
color: var(--el-text-color-secondary);
}
@media (width <= 900px) {
.guide-layout {
grid-template-columns: 1fr;
gap: 16px;
}
.guide-toc {
position: static;
max-height: 220px;
}
.guide-heading {
flex-direction: column;
}
.guide-section {
padding: 16px;
}
}
</style>