添加项目文件。

This commit is contained in:
ldh
2026-11-13 09:51:38 +08:00
parent 35573a85eb
commit abb5d5d32f
123 changed files with 9453 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
<script setup lang="ts">
import { RouterView } from 'vue-router'
import ToastHost from '@/components/ToastHost.vue'
</script>
<template>
<RouterView v-slot="{ Component }">
<Transition name="page" mode="out-in">
<component :is="Component" />
</Transition>
</RouterView>
<ToastHost />
</template>
+78
View File
@@ -0,0 +1,78 @@
/**
* USB 相机接口封装。
* 后端实现见 HardwareWeb/Controllers/CameraController.cs:
* GET /api/camera/status -> { connected: boolean }
* POST /api/camera/connect -> { connected: boolean }
* POST /api/camera/disconnect -> { connected: boolean }
*/
export interface CameraStatus {
connected: boolean
}
const API_BASE = (import.meta.env.VITE_API_BASE ?? '').replace(/\/$/, '')
const REQUEST_TIMEOUT = 5000
export class CameraApiError extends Error {
readonly status: number
constructor(message: string, status = 0) {
super(message)
this.name = 'CameraApiError'
this.status = status
}
}
async function request<T>(path: string, init?: RequestInit): Promise<T> {
const controller = new AbortController()
const timer = window.setTimeout(() => controller.abort(), REQUEST_TIMEOUT)
try {
const response = await fetch(`${API_BASE}${path}`, {
...init,
cache: 'no-store',
signal: controller.signal,
headers: {
Accept: 'application/json',
...(init?.headers ?? {}),
},
})
if (!response.ok) {
let detail = `HTTP ${response.status}`
try {
const body = (await response.json()) as { message?: string; error?: string }
detail = body.message ?? body.error ?? detail
} catch {
// 响应不是 JSON 时保留状态码信息
}
throw new CameraApiError(detail, response.status)
}
return (await response.json()) as T
} catch (error) {
if (error instanceof CameraApiError) throw error
if (error instanceof DOMException && error.name === 'AbortError') {
throw new CameraApiError('相机服务响应超时')
}
throw new CameraApiError(error instanceof Error ? error.message : '无法连接相机服务')
} finally {
window.clearTimeout(timer)
}
}
export function getCameraStatus(): Promise<CameraStatus> {
return request<CameraStatus>('/api/camera/status')
}
export function connectCamera(): Promise<CameraStatus> {
return request<CameraStatus>('/api/camera/connect', { method: 'POST' })
}
export function disconnectCamera(): Promise<CameraStatus> {
return request<CameraStatus>('/api/camera/disconnect', { method: 'POST' })
}
export function getCameraHubUrl(): string {
return `${API_BASE}/cameraHub`
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

+36
View File
@@ -0,0 +1,36 @@
<script setup lang="ts">
import { useStageScale } from '@/composables/useStageScale'
const { scale } = useStageScale()
</script>
<template>
<div class="app-viewport">
<div class="app-stage" :style="{ transform: `scale(${scale})` }">
<slot />
</div>
</div>
</template>
<style scoped>
.app-viewport {
position: fixed;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
background:
radial-gradient(circle at 50% 12%, #f7f8fa 0%, #e6eaef 58%, #dfe4ea 100%);
}
.app-stage {
position: relative;
flex: none;
width: 1920px;
height: 1080px;
overflow: hidden;
background: var(--bg);
transform-origin: center center;
}
</style>
@@ -0,0 +1,294 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { connectCamera } from '@/api/camera'
import { useCameraStatus } from '@/composables/useCameraStatus'
import { useCameraStream } from '@/composables/useCameraStream'
import cameraPlaceholder from '@/assets/camera-placeholder.webp'
const { state: cameraState, refresh, startPolling } = useCameraStatus(5000, false)
const { state: streamState, frameUrl, isLive, connect } = useCameraStream()
const connectingCamera = ref(false)
const statusText = computed(() => {
if (isLive.value) return '实时画面'
if (
connectingCamera.value ||
streamState.value === 'connecting' ||
cameraState.value === 'checking'
) {
return '连接中'
}
if (cameraState.value === 'offline') return '相机服务离线'
if (cameraState.value === 'connected') return '等待画面'
return '预览画面'
})
const statusTone = computed<'on' | 'wait' | 'off'>(() => {
if (isLive.value) return 'on'
if (statusText.value === '连接中' || statusText.value === '等待画面') {
return 'wait'
}
return 'off'
})
onMounted(async () => {
await refresh()
const streamPromise = connect()
if (cameraState.value === 'disconnected') {
connectingCamera.value = true
try {
await connectCamera()
await refresh()
} catch {
// 没有相机或服务不可达时保留占位画面
} finally {
connectingCamera.value = false
}
}
startPolling()
await streamPromise
})
</script>
<template>
<section class="camera-card">
<header class="camera-card__header">
<h2>相机画面</h2>
<span class="camera-card__status" :class="`camera-card__status--${statusTone}`">
<i class="camera-card__dot"></i>
{{ statusText }}
</span>
</header>
<div class="camera-card__viewport">
<img
class="camera-card__image"
:src="frameUrl ?? cameraPlaceholder"
:alt="frameUrl ? '相机实时画面' : '相机预览画面'"
draggable="false"
/>
<template v-if="frameUrl">
<span class="crosshair crosshair--horizontal" aria-hidden="true"></span>
<span class="crosshair crosshair--vertical" aria-hidden="true"></span>
<div class="focus-box" aria-hidden="true">
<span class="focus-box__corner focus-box__corner--tl"></span>
<span class="focus-box__corner focus-box__corner--tr"></span>
<span class="focus-box__corner focus-box__corner--bl"></span>
<span class="focus-box__corner focus-box__corner--br"></span>
<span class="focus-box__tick focus-box__tick--left"></span>
<span class="focus-box__tick focus-box__tick--right"></span>
</div>
<span class="scan-line" aria-hidden="true"></span>
</template>
</div>
</section>
</template>
<style scoped>
.camera-card {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
border: 1px solid #d8e0e9;
border-radius: 18px;
background: #fff;
box-shadow: var(--shadow-card);
}
.camera-card__header {
display: flex;
flex: none;
align-items: center;
justify-content: space-between;
height: 76px;
padding: 0 28px;
background: linear-gradient(180deg, #3d80e2 0%, #2f6fd0 100%);
}
.camera-card__header h2 {
color: #fff;
font-size: 30px;
font-weight: 600;
letter-spacing: 3px;
text-shadow: 0 1px 3px rgba(16, 49, 101, 0.22);
}
.camera-card__status {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 5px 12px;
border: 1px solid rgba(255, 255, 255, 0.24);
border-radius: 30px;
background: rgba(255, 255, 255, 0.12);
color: rgba(255, 255, 255, 0.92);
font-size: 15px;
letter-spacing: 1px;
}
.camera-card__dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #c9d4e4;
}
.camera-card__status--on .camera-card__dot {
background: #74f4c5;
box-shadow: 0 0 9px rgba(116, 244, 197, 0.9);
animation: live-dot 1.8s ease-in-out infinite;
}
.camera-card__status--wait .camera-card__dot {
background: #ffd86a;
box-shadow: 0 0 8px rgba(255, 216, 106, 0.8);
}
.camera-card__status--off .camera-card__dot {
background: #ff9a91;
box-shadow: 0 0 8px rgba(255, 154, 145, 0.7);
}
.camera-card__viewport {
position: relative;
flex: 1;
overflow: hidden;
background: #080d14;
}
.camera-card__image {
width: 100%;
height: 100%;
object-fit: cover;
}
.crosshair {
position: absolute;
z-index: 1;
background: rgba(255, 255, 255, 0.55);
box-shadow: 0 0 6px rgba(255, 255, 255, 0.22);
pointer-events: none;
}
.crosshair--horizontal {
top: 50%;
right: 0;
left: 0;
height: 1px;
}
.crosshair--vertical {
top: 0;
bottom: 0;
left: 50%;
width: 1px;
}
.focus-box {
position: absolute;
top: 37%;
left: 34%;
z-index: 2;
width: 32%;
height: 31%;
}
.focus-box__corner {
position: absolute;
width: 34px;
height: 34px;
border: 3px solid #74f1df;
filter: drop-shadow(0 0 5px rgba(116, 241, 223, 0.4));
}
.focus-box__corner--tl {
top: 0;
left: 0;
border-right: 0;
border-bottom: 0;
}
.focus-box__corner--tr {
top: 0;
right: 0;
border-bottom: 0;
border-left: 0;
}
.focus-box__corner--bl {
bottom: 0;
left: 0;
border-top: 0;
border-right: 0;
}
.focus-box__corner--br {
right: 0;
bottom: 0;
border-top: 0;
border-left: 0;
}
.focus-box__tick {
position: absolute;
top: 50%;
width: 4px;
height: 30px;
background: rgba(116, 241, 223, 0.8);
transform: translateY(-50%);
}
.focus-box__tick--left {
left: -2px;
}
.focus-box__tick--right {
right: -2px;
}
.scan-line {
position: absolute;
right: 4%;
left: 4%;
z-index: 1;
height: 2px;
background: linear-gradient(90deg, transparent, rgba(145, 255, 235, 0.45), transparent);
animation: scan-line 4.5s ease-in-out infinite;
}
@keyframes live-dot {
0%,
100% {
opacity: 0.4;
}
50% {
opacity: 1;
}
}
@keyframes scan-line {
0%,
100% {
top: 20%;
opacity: 0;
}
12% {
opacity: 0.7;
}
55% {
top: 76%;
opacity: 0.45;
}
88% {
opacity: 0;
}
}
</style>
+55
View File
@@ -0,0 +1,55 @@
<script setup lang="ts">
defineProps<{
name: 'door' | 'tray' | 'focus'
}>()
</script>
<template>
<svg
class="guide-icon"
viewBox="0 0 64 64"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
>
<template v-if="name === 'door'">
<rect x="13" y="12" width="38" height="28" rx="3" stroke="currentColor" stroke-width="2.2" />
<path d="M19 18h26v16H19z" stroke="currentColor" stroke-width="1.8" />
<path d="M25 40v6h14v-6M20 52h24" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" />
<circle cx="41" cy="26" r="2.2" fill="currentColor" />
</template>
<template v-else-if="name === 'tray'">
<path
d="M16 31h32l-4 14H20l-4-14Z"
stroke="currentColor"
stroke-width="2.2"
stroke-linejoin="round"
/>
<path d="M20 31v-9h24v9M27 31v-5h10v5" stroke="currentColor" stroke-width="2" />
<path d="M31 14h8M36 10l5 4-5 4" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" />
<path d="M22 50h20" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" />
</template>
<template v-else>
<path
d="M18 25v-5a2 2 0 0 1 2-2h5M39 18h5a2 2 0 0 1 2 2v5M46 39v5a2 2 0 0 1-2 2h-5M25 46h-5a2 2 0 0 1-2-2v-5"
stroke="currentColor"
stroke-width="2.2"
stroke-linecap="round"
/>
<circle cx="32" cy="32" r="7" stroke="currentColor" stroke-width="2" />
<path d="M32 27v10M27 32h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
<path d="M21 12h22" stroke="currentColor" stroke-width="2" stroke-linecap="round" opacity="0.8" />
</template>
</svg>
</template>
<style scoped>
.guide-icon {
width: 100%;
height: 100%;
color: #fff;
filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.1));
}
</style>
@@ -0,0 +1,94 @@
<script setup lang="ts">
const bars = [
{ x: 96, height: 38 },
{ x: 116, height: 66 },
{ x: 136, height: 108 },
{ x: 156, height: 72 },
{ x: 176, height: 46 },
{ x: 220, height: 54 },
{ x: 244, height: 74 },
{ x: 286, height: 42 },
{ x: 320, height: 34 },
]
</script>
<template>
<div class="mini-spectrum">
<svg viewBox="0 0 360 150" preserveAspectRatio="none" aria-label="光谱缩略图">
<defs>
<linearGradient id="miniStroke" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#63ecff" />
<stop offset="0.55" stop-color="#a9b7ff" />
<stop offset="1" stop-color="#ff8bdc" />
</linearGradient>
<linearGradient id="miniFill" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#dff8ff" stop-opacity="0.35" />
<stop offset="1" stop-color="#7bd9ff" stop-opacity="0" />
</linearGradient>
</defs>
<rect width="360" height="150" fill="#2c67c4" />
<g stroke="rgba(255,255,255,0.26)" stroke-width="0.7">
<line x1="20" x2="350" y1="128" y2="128" />
<line x1="20" x2="20" y1="16" y2="128" />
<line x1="20" x2="350" y1="88" y2="88" stroke-dasharray="2 4" />
<line x1="20" x2="350" y1="48" y2="48" stroke-dasharray="2 4" />
</g>
<g fill="rgba(255,255,255,0.7)" font-size="8">
<text x="4" y="30">30</text>
<text x="4" y="70">20</text>
<text x="4" y="110">10</text>
<text x="12" y="144">0</text>
<text x="44" y="128">0</text>
<text x="96" y="128">100</text>
<text x="162" y="128">200</text>
<text x="228" y="128">300</text>
<text x="292" y="128">400</text>
</g>
<path
d="M22 120 L30 118 L38 121 L46 115 L54 119 L62 112 L70 118 L78 108 L86 114 L94 95 L100 102 L106 62 L112 97 L118 110 L124 92 L130 103 L136 50 L142 88 L148 106 L154 83 L160 110 L166 112 L172 92 L178 108 L184 102 L190 110 L196 93 L202 109 L208 98 L214 112 L220 76 L226 104 L232 112 L238 62 L244 90 L250 108 L256 98 L262 112 L268 92 L274 111 L280 105 L286 83 L292 110 L298 104 L304 114 L310 90 L316 110 L322 102 L328 112 L334 104 L340 112"
fill="none"
stroke="url(#miniStroke)"
stroke-width="1.7"
stroke-linejoin="round"
/>
<g fill="#ffb7e8">
<rect
v-for="bar in bars"
:key="bar.x"
:x="bar.x"
:y="128 - bar.height"
width="2.4"
:height="bar.height"
opacity="0.55"
/>
</g>
<path
d="M22 120 L100 102 L136 50 L168 112 L220 76 L238 62 L286 83 L340 112"
fill="none"
stroke="rgba(255,235,255,0.24)"
stroke-width="0.6"
/>
</svg>
</div>
</template>
<style scoped>
.mini-spectrum {
width: 360px;
height: 150px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.7);
border-radius: 3px;
background: #2c67c4;
}
.mini-spectrum svg {
width: 100%;
height: 100%;
}
</style>
@@ -0,0 +1,132 @@
<script setup lang="ts">
import ModuleIcon from '@/components/ModuleIcon.vue'
withDefaults(
defineProps<{
title: string
tone: 'blue' | 'orange' | 'green' | 'teal'
icon: 'detect' | 'metal' | 'soil' | 'water'
}>(),
{},
)
defineEmits<{
click: []
}>()
</script>
<template>
<button
class="module-button"
:class="`module-button--${tone}`"
type="button"
@click="$emit('click')"
>
<span class="module-button__icon">
<ModuleIcon :name="icon" />
</span>
<span class="module-button__label">{{ title }}</span>
</button>
</template>
<style scoped>
.module-button {
position: relative;
display: block;
height: 252px;
overflow: hidden;
border-radius: 18px;
text-align: left;
box-shadow:
0 16px 30px var(--module-shadow),
inset 0 2px 0 rgba(255, 255, 255, 0.55),
inset 0 -10px 24px rgba(0, 0, 0, 0.08);
transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
box-shadow 0.25s ease;
}
.module-button::before {
content: '';
position: absolute;
inset: 0;
background:
radial-gradient(ellipse 85% 65% at 18% 6%, rgba(255, 255, 255, 0.34) 0%, transparent 58%),
linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 36%);
pointer-events: none;
}
.module-button::after {
content: '';
position: absolute;
right: 18px;
bottom: 14px;
left: 18px;
height: 1px;
background: rgba(255, 255, 255, 0.2);
opacity: 0.8;
}
.module-button:hover {
transform: translateY(-4px);
box-shadow:
0 22px 38px var(--module-shadow-strong),
inset 0 2px 0 rgba(255, 255, 255, 0.6),
inset 0 -10px 24px rgba(0, 0, 0, 0.08);
}
.module-button:active {
transform: translateY(-1px) scale(0.995);
}
.module-button--blue {
--module-shadow: rgba(47, 111, 208, 0.26);
--module-shadow-strong: rgba(47, 111, 208, 0.38);
background: linear-gradient(145deg, #4b8ae8 0%, #3778d9 48%, #2f6fd0 100%);
}
.module-button--orange {
--module-shadow: rgba(238, 166, 11, 0.28);
--module-shadow-strong: rgba(238, 166, 11, 0.4);
background: linear-gradient(145deg, #ffc845 0%, #f8b526 50%, #eea50b 100%);
}
.module-button--green {
--module-shadow: rgba(107, 171, 49, 0.28);
--module-shadow-strong: rgba(107, 171, 49, 0.4);
background: linear-gradient(145deg, #91d258 0%, #7cc242 50%, #67ad2f 100%);
}
.module-button--teal {
--module-shadow: rgba(38, 174, 163, 0.28);
--module-shadow-strong: rgba(38, 174, 163, 0.4);
background: linear-gradient(145deg, #46cec2 0%, #2fb8ac 50%, #22a99e 100%);
}
.module-button__icon {
position: absolute;
top: 24px;
left: 24px;
display: grid;
place-items: center;
width: 92px;
height: 92px;
padding: 10px;
border: 1px solid rgba(255, 255, 255, 0.36);
border-radius: 16px;
background: rgba(255, 255, 255, 0.14);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.module-button__label {
position: absolute;
right: 18px;
bottom: 44px;
left: 18px;
color: #fff;
font-size: 31px;
font-weight: 600;
letter-spacing: 4px;
text-align: center;
text-shadow: 0 2px 5px rgba(33, 49, 79, 0.24);
}
</style>
@@ -0,0 +1,81 @@
<script setup lang="ts">
defineProps<{
name: 'detect' | 'metal' | 'soil' | 'water'
}>()
</script>
<template>
<svg
class="module-icon"
viewBox="0 0 64 64"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
>
<template v-if="name === 'detect'">
<path
d="M14 26V17a3 3 0 0 1 3-3h9M38 14h9a3 3 0 0 1 3 3v9M50 38v9a3 3 0 0 1-3 3h-9M26 50h-9a3 3 0 0 1-3-3v-9"
stroke="currentColor"
stroke-width="2.2"
stroke-linecap="round"
/>
<path
d="m32 21 2.7 6.3L41 30l-6.3 2.7L32 39l-2.7-6.3L23 30l6.3-2.7L32 21Z"
stroke="currentColor"
stroke-width="2"
stroke-linejoin="round"
/>
<circle cx="44.5" cy="20.5" r="2.4" fill="currentColor" />
</template>
<template v-else-if="name === 'metal'">
<path
d="M25 14h14v7l4.5 6.5V50a2 2 0 0 1-2 2h-19a2 2 0 0 1-2-2V27.5L25 21v-7Z"
stroke="currentColor"
stroke-width="2.2"
stroke-linejoin="round"
/>
<path d="M25 21h14M22.5 34h19" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
<path d="M30 28h4" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
</template>
<template v-else-if="name === 'soil'">
<rect
x="19"
y="12"
width="26"
height="40"
rx="3.5"
stroke="currentColor"
stroke-width="2.2"
/>
<path d="M32 21v15M24.5 28.5h15" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" />
<path d="M25 43h14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
</template>
<template v-else>
<path
d="M22 23h20v25a2 2 0 0 1-2 2H24a2 2 0 0 1-2-2V23Z"
stroke="currentColor"
stroke-width="2.2"
stroke-linejoin="round"
/>
<path d="m23 23 5.5-9h7L41 23" stroke="currentColor" stroke-width="2.2" stroke-linejoin="round" />
<path
d="M32 30c3.2 4.1 5 6.4 5 9.1a5 5 0 0 1-10 0c0-2.7 1.8-5 5-9.1Z"
stroke="currentColor"
stroke-width="2"
stroke-linejoin="round"
/>
</template>
</svg>
</template>
<style scoped>
.module-icon {
width: 100%;
height: 100%;
color: #fff;
filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.12));
}
</style>
@@ -0,0 +1,86 @@
<script setup lang="ts">
withDefaults(
defineProps<{
title: string
subtitle?: string
variant?: 'default' | 'process' | 'result'
}>(),
{ variant: 'default' },
)
</script>
<template>
<header class="page-header" :class="`page-header--${variant}`">
<div class="page-header__side">
<slot name="left" />
</div>
<div class="page-header__center">
<h1>{{ title }}</h1>
<p v-if="subtitle">{{ subtitle }}</p>
</div>
<div class="page-header__side page-header__side--right">
<slot name="right" />
</div>
</header>
</template>
<style scoped>
.page-header {
position: relative;
display: grid;
grid-template-columns: 340px 1fr 340px;
align-items: center;
height: 140px;
padding: 0 44px;
background: #fff;
box-shadow: 0 3px 14px rgba(28, 43, 66, 0.06);
z-index: 3;
}
.page-header--process {
height: 118px;
}
.page-header--result {
height: 118px;
}
.page-header__side {
display: flex;
align-items: center;
min-width: 0;
}
.page-header__side--right {
justify-content: flex-end;
}
.page-header__center {
text-align: center;
}
.page-header__center h1 {
font-size: 42px;
font-weight: 600;
letter-spacing: 3px;
color: #1f2937;
}
.page-header--process .page-header__center h1 {
font-size: 38px;
letter-spacing: 2px;
}
.page-header--result .page-header__center h1 {
font-size: 40px;
}
.page-header__center p {
margin-top: 10px;
font-size: 20px;
letter-spacing: 3px;
color: var(--muted);
}
</style>
@@ -0,0 +1,385 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
const slides = [
{ src: `${import.meta.env.BASE_URL}media/Principle.mp4`, label: '检测原理演示动画' },
{ src: `${import.meta.env.BASE_URL}media/Principle_old.mp4`, label: '检测原理演示动画(旧版)' },
]
const videoRefs = ref<(HTMLVideoElement | null)[]>([])
const activeIndex = ref(0)
const loaded = ref(slides.map(() => false))
const playing = ref(false)
const dragging = ref(false)
const dragOffset = ref(0)
const trackStyle = computed(() => ({
transform: `translate3d(calc(-${activeIndex.value * 100}% + ${dragOffset.value}px), 0, 0)`,
}))
let startX = 0
let startY = 0
let pointerId: number | null = null
let gestureActive = false
function setVideoRef(el: unknown, index: number) {
videoRefs.value[index] = el instanceof HTMLVideoElement ? el : null
}
function goTo(index: number) {
const total = slides.length
const next = ((index % total) + total) % total
if (next === activeIndex.value) return
const previous = videoRefs.value[activeIndex.value]
activeIndex.value = next
previous?.pause()
const video = videoRefs.value[next]
if (!video) return
video.currentTime = 0
void video.play().catch(() => {
playing.value = false
})
}
function togglePlay() {
const video = videoRefs.value[activeIndex.value]
if (!video) return
if (video.paused) {
void video.play().catch(() => undefined)
} else {
video.pause()
}
}
function onLoadedMetadata(index: number) {
loaded.value[index] = true
}
function onPlay(index: number) {
if (index === activeIndex.value) playing.value = true
}
function onPause(index: number) {
if (index === activeIndex.value) playing.value = false
}
function onPointerDown(event: PointerEvent) {
if (event.pointerType === 'mouse' && event.button !== 0) return
startX = event.clientX
startY = event.clientY
pointerId = event.pointerId
gestureActive = false
dragging.value = true
}
function onPointerMove(event: PointerEvent) {
if (!dragging.value || event.pointerId !== pointerId) return
const dx = event.clientX - startX
const dy = event.clientY - startY
if (!gestureActive) {
if (Math.abs(dx) < 10 && Math.abs(dy) < 10) return
if (Math.abs(dy) > Math.abs(dx)) {
endDrag(event)
return
}
gestureActive = true
try {
;(event.currentTarget as HTMLElement).setPointerCapture(event.pointerId)
} catch {
// 指针已失效时忽略,不影响滑动判定
}
}
dragOffset.value = dx
}
function onPointerUp(event: PointerEvent) {
if (event.pointerId !== pointerId) return
const offset = dragOffset.value
const swiped = gestureActive && Math.abs(offset) > 60
endDrag(event)
if (swiped) goTo(activeIndex.value + (offset < 0 ? 1 : -1))
}
function endDrag(event: PointerEvent) {
dragging.value = false
dragOffset.value = 0
gestureActive = false
pointerId = null
const target = event.currentTarget as HTMLElement
if (target.hasPointerCapture?.(event.pointerId)) {
target.releasePointerCapture(event.pointerId)
}
}
onMounted(() => {
const video = videoRefs.value[activeIndex.value]
if (!video) return
video.muted = true
void video.play().catch(() => {
playing.value = false
})
})
</script>
<template>
<section
class="principle"
@pointerdown="onPointerDown"
@pointermove="onPointerMove"
@pointerup="onPointerUp"
@pointercancel="endDrag"
>
<header class="principle__header">
<h2>检测原理演示区</h2>
<span class="principle__badge">
<span class="principle__dot"></span>
自动播放
</span>
</header>
<div class="principle__video">
<div class="principle__fallback" aria-hidden="true">
<svg viewBox="0 0 900 640" preserveAspectRatio="xMidYMid slice">
<defs>
<linearGradient id="principleSky" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#2f6fd0" />
<stop offset="1" stop-color="#1d55ae" />
</linearGradient>
<linearGradient id="principleBeam" x1="0" y1="1" x2="1" y2="0">
<stop offset="0" stop-color="#60f2ff" stop-opacity="0.2" />
<stop offset="1" stop-color="#fff6b7" />
</linearGradient>
<radialGradient id="principleStar">
<stop offset="0" stop-color="#fff9cf" />
<stop offset="0.35" stop-color="#ffc46b" stop-opacity="0.8" />
<stop offset="1" stop-color="#ff9c4f" stop-opacity="0" />
</radialGradient>
</defs>
<rect width="900" height="640" fill="url(#principleSky)" />
<circle cx="690" cy="250" r="110" fill="url(#principleStar)" />
<path d="M250 450 C420 420 560 330 690 250" stroke="url(#principleBeam)" stroke-width="4" fill="none" />
<g opacity="0.8">
<rect x="280" y="300" width="3" height="90" fill="#71f2ff" />
<rect x="292" y="270" width="3" height="120" fill="#65baff" />
<rect x="304" y="320" width="3" height="70" fill="#bfffe7" />
<rect x="316" y="250" width="4" height="140" fill="#ffd166" />
<rect x="330" y="290" width="3" height="100" fill="#ff9f6b" />
<rect x="342" y="330" width="3" height="60" fill="#80e8ff" />
<rect x="354" y="310" width="3" height="80" fill="#e6a8ff" />
</g>
</svg>
</div>
<div
class="principle__slider"
:class="{ 'is-dragging': dragging }"
:style="trackStyle"
>
<div v-for="(slide, index) in slides" :key="slide.src" class="principle__slide">
<video
:ref="(el) => setVideoRef(el, index)"
class="principle__media"
:class="{ 'is-ready': loaded[index] }"
:src="slide.src"
muted
loop
playsinline
preload="metadata"
:aria-label="slide.label"
@loadedmetadata="onLoadedMetadata(index)"
@play="onPlay(index)"
@pause="onPause(index)"
@error="loaded[index] = false"
></video>
</div>
</div>
<button
v-if="!playing"
class="principle__play"
type="button"
aria-label="播放原理动画"
@click="togglePlay"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="m9 6 9 6-9 6V6Z" fill="currentColor" />
</svg>
</button>
<span v-if="playing" class="principle__caption">原理动画播放中</span>
</div>
</section>
</template>
<style scoped>
.principle {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
padding: 24px 24px 18px;
overflow: hidden;
border-radius: 20px;
touch-action: none;
background:
radial-gradient(ellipse 80% 60% at 82% 8%, rgba(120, 174, 255, 0.35), transparent 62%),
linear-gradient(145deg, #3c7fdd 0%, #2f6fd0 48%, #2559ad 100%);
box-shadow:
0 18px 46px rgba(37, 89, 173, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.principle::before {
content: '';
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
background-size: 48px 48px;
mask-image: linear-gradient(180deg, #000, transparent 65%);
pointer-events: none;
}
.principle__header {
position: relative;
z-index: 1;
display: flex;
align-items: center;
justify-content: space-between;
height: 62px;
}
.principle__header h2 {
color: #fff;
font-size: 30px;
font-weight: 600;
letter-spacing: 3px;
text-shadow: 0 2px 5px rgba(18, 51, 103, 0.24);
}
.principle__badge {
display: inline-flex;
align-items: center;
gap: 9px;
padding: 6px 14px;
border: 1px solid rgba(255, 255, 255, 0.22);
border-radius: 30px;
background: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.86);
font-size: 15px;
letter-spacing: 1px;
}
.principle__dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: #86f3cd;
box-shadow: 0 0 9px rgba(134, 243, 205, 0.9);
}
.principle__video {
position: relative;
flex: 1;
overflow: hidden;
border-radius: 14px;
background: #255bb3;
touch-action: none;
cursor: grab;
user-select: none;
}
.principle__video:active {
cursor: grabbing;
}
.principle__fallback,
.principle__media {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
}
.principle__fallback svg {
width: 100%;
height: 100%;
}
.principle__slider {
position: absolute;
inset: 0;
display: flex;
transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.principle__slider.is-dragging {
transition: none;
}
.principle__slide {
position: relative;
flex: 0 0 100%;
height: 100%;
}
.principle__media {
object-fit: cover;
opacity: 0;
transition: opacity 0.4s ease;
}
.principle__media.is-ready {
opacity: 1;
}
.principle__play {
position: absolute;
top: 50%;
left: 50%;
display: grid;
place-items: center;
width: 86px;
height: 86px;
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 50%;
color: #fff;
background: rgba(15, 48, 104, 0.42);
box-shadow: 0 10px 30px rgba(8, 35, 79, 0.2);
backdrop-filter: blur(6px);
transform: translate(-50%, -50%);
transition: background 0.2s ease, transform 0.2s ease;
}
.principle__play:hover {
background: rgba(15, 48, 104, 0.58);
transform: translate(-50%, -50%) scale(1.05);
}
.principle__play svg {
width: 38px;
height: 38px;
margin-left: 4px;
}
.principle__caption {
position: absolute;
bottom: 26px;
left: 50%;
color: rgba(255, 255, 255, 0.92);
font-size: 22px;
letter-spacing: 4px;
text-shadow: 0 2px 8px rgba(7, 33, 78, 0.55);
transform: translateX(-50%);
white-space: nowrap;
}
</style>
@@ -0,0 +1,92 @@
<script setup lang="ts">
import { computed } from 'vue'
const props = defineProps<{
progress: number
label: string
note?: string
}>()
const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
</script>
<template>
<div class="progress-strip">
<div
class="progress-strip__track"
role="progressbar"
:aria-valuenow="Math.round(clamped)"
aria-valuemin="0"
aria-valuemax="100"
:aria-label="label"
>
<div class="progress-strip__fill" :style="{ width: `${clamped}%` }"></div>
<span
class="progress-strip__label"
:class="{ 'progress-strip__label--on-fill': clamped > 52 }"
>
{{ label }}
</span>
</div>
<span v-if="note" class="progress-strip__note">{{ note }}</span>
</div>
</template>
<style scoped>
.progress-strip {
display: flex;
align-items: center;
gap: 26px;
width: 100%;
}
.progress-strip__track {
position: relative;
flex: 1;
height: 52px;
overflow: hidden;
border: 1px solid #b8cce3;
border-radius: 8px;
background: #dce8f5;
box-shadow: inset 0 2px 6px rgba(43, 75, 116, 0.08);
}
.progress-strip__fill {
position: absolute;
top: 0;
bottom: 0;
left: 0;
border-radius: 7px;
background:
linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 22%),
linear-gradient(180deg, #4a89e2 0%, #2f6fd0 58%, #255db5 100%);
transition: width 0.12s linear;
}
.progress-strip__label {
position: absolute;
inset: 0;
display: grid;
place-items: center;
color: #245c9f;
font-size: 27px;
font-weight: 600;
letter-spacing: 3px;
transition: color 0.15s linear, text-shadow 0.15s linear;
}
.progress-strip__label--on-fill {
color: #fff;
text-shadow: 0 2px 5px rgba(17, 52, 100, 0.5);
}
.progress-strip__note {
flex: none;
min-width: 190px;
color: #334155;
font-size: 25px;
letter-spacing: 1px;
text-align: right;
}
</style>
+350
View File
@@ -0,0 +1,350 @@
<script setup lang="ts">
const points = [
{ x: 520, y: 250, label: '1', tone: '#57e6ff' },
{ x: 432, y: 302, label: 'P2', tone: '#91e34b' },
{ x: 658, y: 298, label: 'P3', tone: '#f7c94a' },
{ x: 718, y: 368, label: 'P4', tone: '#91e34b' },
{ x: 618, y: 478, label: 'P5', tone: '#91e34b' },
]
const markers = [
[410, 220],
[470, 170],
[560, 145],
[640, 160],
[700, 205],
[735, 260],
[748, 330],
[735, 405],
[700, 465],
[640, 515],
[560, 535],
[480, 520],
[410, 490],
[360, 450],
[330, 390],
[325, 325],
[350, 255],
[385, 200],
]
</script>
<template>
<section class="scan-visual">
<div class="scan-visual__bar" aria-hidden="true">
<span class="scan-visual__menu">
<span></span>
<span></span>
<span></span>
</span>
<span class="scan-visual__close">
<svg viewBox="0 0 24 24">
<path d="m6 6 12 12M18 6 6 18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
</svg>
</span>
</div>
<div class="scan-visual__stage">
<svg viewBox="0 0 1000 600" preserveAspectRatio="xMidYMid meet" role="img" aria-label="样品轮廓识别与点位规划动画">
<defs>
<pattern id="scanDots" width="34" height="34" patternUnits="userSpaceOnUse">
<circle cx="2" cy="2" r="1" fill="rgba(255,255,255,0.13)" />
</pattern>
<linearGradient id="scanBand" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#9df9ff" stop-opacity="0" />
<stop offset="0.5" stop-color="#9df9ff" stop-opacity="0.2" />
<stop offset="1" stop-color="#9df9ff" stop-opacity="0" />
</linearGradient>
<linearGradient id="contourStroke" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#ffeda5" />
<stop offset="0.48" stop-color="#f9da7a" />
<stop offset="0.52" stop-color="#9ff6db" />
<stop offset="1" stop-color="#79e6c0" />
</linearGradient>
</defs>
<rect width="1000" height="600" fill="url(#scanDots)" />
<g stroke="rgba(255,255,255,0.22)" stroke-width="1">
<line x1="500" y1="24" x2="500" y2="96" />
<line x1="500" y1="504" x2="500" y2="576" />
<line x1="34" y1="300" x2="86" y2="300" />
<line x1="914" y1="300" x2="966" y2="300" />
</g>
<g fill="none" stroke="rgba(255,255,255,0.8)" stroke-width="1.4">
<circle cx="500" cy="60" r="7" />
<path d="M500 48v24M488 60h24" />
<circle cx="500" cy="540" r="6" />
<path d="M500 530v20M490 540h20" />
</g>
<path
d="M500 95
C548 80 596 101 623 131
C663 114 707 138 721 177
C764 193 789 228 781 266
C812 301 810 344 785 375
C800 417 775 456 740 472
C720 511 676 536 636 525
C601 555 551 559 515 535
C471 555 421 540 396 510
C346 505 316 465 323 425
C286 395 286 345 311 310
C301 265 331 225 371 215
C386 170 431 145 471 155
C483 121 491 101 500 95 Z"
fill="rgba(255,255,255,0.035)"
stroke="url(#contourStroke)"
stroke-width="2.4"
stroke-linejoin="round"
/>
<path
class="scan-visual__dash"
d="M500 95
C548 80 596 101 623 131
C663 114 707 138 721 177
C764 193 789 228 781 266
C812 301 810 344 785 375
C800 417 775 456 740 472
C720 511 676 536 636 525
C601 555 551 559 515 535
C471 555 421 540 396 510
C346 505 316 465 323 425
C286 395 286 345 311 310
C301 265 331 225 371 215
C386 170 431 145 471 155
C483 121 491 101 500 95 Z"
fill="none"
stroke="rgba(108,246,220,0.75)"
stroke-width="1.2"
stroke-dasharray="7 13"
stroke-linecap="round"
/>
<g>
<circle
v-for="(marker, index) in markers"
:key="`marker-${index}`"
:cx="marker[0]"
:cy="marker[1]"
r="2.2"
fill="rgba(255,255,255,0.72)"
/>
</g>
<g>
<g v-for="point in points" :key="point.label">
<circle
:cx="point.x"
:cy="point.y"
r="16"
fill="none"
:stroke="point.tone"
stroke-width="1.4"
opacity="0.75"
class="scan-visual__point-halo"
/>
<circle :cx="point.x" :cy="point.y" r="8" :fill="point.tone" stroke="#fff" stroke-width="1.6" />
<text
:x="point.x + 22"
:y="point.y + 12"
fill="#ffffff"
font-size="28"
font-weight="500"
letter-spacing="1"
>
{{ point.label }}
</text>
</g>
</g>
<text
x="500"
y="350"
fill="#ffffff"
font-size="34"
font-weight="500"
letter-spacing="3"
text-anchor="middle"
opacity="0.95"
>
样品图片识别动画
</text>
<text
x="500"
y="392"
fill="rgba(255,255,255,0.62)"
font-size="18"
letter-spacing="5"
text-anchor="middle"
>
激光点位规划中
</text>
<rect class="scan-visual__band" x="-180" y="0" width="180" height="600" fill="url(#scanBand)">
<animate attributeName="x" values="-180;1010" dur="5.2s" repeatCount="indefinite" />
</rect>
</svg>
<span class="scan-visual__corner scan-visual__corner--tl" aria-hidden="true"></span>
<span class="scan-visual__corner scan-visual__corner--tr" aria-hidden="true"></span>
<span class="scan-visual__corner scan-visual__corner--bl" aria-hidden="true"></span>
<span class="scan-visual__corner scan-visual__corner--br" aria-hidden="true"></span>
<span class="scan-visual__rail scan-visual__rail--left" aria-hidden="true"></span>
<span class="scan-visual__rail scan-visual__rail--right" aria-hidden="true"></span>
</div>
</section>
</template>
<style scoped>
.scan-visual {
display: flex;
flex-direction: column;
height: 100%;
padding: 10px 16px 16px;
overflow: hidden;
border: 1px solid #1e55a4;
border-radius: 18px;
background:
radial-gradient(ellipse 70% 50% at 50% 0%, rgba(120, 180, 255, 0.22), transparent 70%),
linear-gradient(150deg, #3b7edd 0%, #2f6fd0 46%, #2559ac 100%);
box-shadow:
0 18px 44px rgba(31, 77, 147, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.scan-visual__bar {
display: flex;
flex: none;
align-items: center;
justify-content: space-between;
height: 52px;
padding: 0 8px;
color: rgba(255, 255, 255, 0.9);
}
.scan-visual__menu {
display: flex;
flex-direction: column;
gap: 5px;
}
.scan-visual__menu span {
width: 26px;
height: 2px;
border-radius: 2px;
background: currentColor;
}
.scan-visual__close {
display: grid;
place-items: center;
width: 34px;
height: 34px;
}
.scan-visual__close svg {
width: 24px;
height: 24px;
}
.scan-visual__stage {
position: relative;
flex: 1;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.58);
border-radius: 8px;
background: rgba(24, 72, 148, 0.16);
}
.scan-visual__stage svg {
width: 100%;
height: 100%;
}
.scan-visual__dash {
animation: contour-dash 6s linear infinite;
}
.scan-visual__point-halo {
animation: point-pulse 2.4s ease-in-out infinite;
transform-box: fill-box;
transform-origin: center;
}
.scan-visual__corner {
position: absolute;
z-index: 3;
width: 30px;
height: 30px;
border: 2px solid rgba(255, 255, 255, 0.9);
}
.scan-visual__corner--tl {
top: 8px;
left: 8px;
border-right: 0;
border-bottom: 0;
}
.scan-visual__corner--tr {
top: 8px;
right: 8px;
border-bottom: 0;
border-left: 0;
}
.scan-visual__corner--bl {
bottom: 8px;
left: 8px;
border-top: 0;
border-right: 0;
}
.scan-visual__corner--br {
right: 8px;
bottom: 8px;
border-top: 0;
border-left: 0;
}
.scan-visual__rail {
position: absolute;
top: 50%;
z-index: 3;
width: 5px;
height: 54px;
border-radius: 4px;
background: rgba(255, 255, 255, 0.82);
transform: translateY(-50%);
}
.scan-visual__rail--left {
left: 10px;
}
.scan-visual__rail--right {
right: 10px;
}
@keyframes contour-dash {
to {
stroke-dashoffset: -200;
}
}
@keyframes point-pulse {
0%,
100% {
opacity: 0.35;
transform: scale(0.85);
}
50% {
opacity: 0.9;
transform: scale(1.18);
}
}
</style>
@@ -0,0 +1,300 @@
<script setup lang="ts">
import { computed } from 'vue'
const width = 1360
const height = 720
const pad = { left: 112, right: 44, top: 74, bottom: 88 }
const xMin = 380
const xMax = 700
const yMin = 0
const yMax = 36
const peaks = [
{ center: 421, amplitude: 4.4, width: 2.2 },
{ center: 438.4, amplitude: 26.5, width: 2.0 },
{ center: 447.5, amplitude: 10.5, width: 2.6 },
{ center: 468, amplitude: 5.5, width: 2.2 },
{ center: 492, amplitude: 13.5, width: 2.4 },
{ center: 505, amplitude: 7.2, width: 2.0 },
{ center: 510.6, amplitude: 23.5, width: 2.5 },
{ center: 518.4, amplitude: 30.5, width: 2.1 },
{ center: 540, amplitude: 10.5, width: 2.4 },
{ center: 557, amplitude: 7.4, width: 2.1 },
{ center: 574, amplitude: 4.6, width: 2.0 },
{ center: 590, amplitude: 13.4, width: 2.2 },
{ center: 606, amplitude: 6.2, width: 2.1 },
{ center: 614.5, amplitude: 26.5, width: 2.4 },
{ center: 634, amplitude: 6.8, width: 2.2 },
{ center: 653, amplitude: 12.2, width: 2.3 },
{ center: 672, amplitude: 8.4, width: 2.2 },
{ center: 686, amplitude: 10.8, width: 2.0 },
]
const labels = [
{ center: 438.4, element: 'Fe', wavelength: '438.4 nm', lift: 56, dx: 0 },
{ center: 510.6, element: 'Cu', wavelength: '510.6 nm', lift: 100, dx: -94 },
{ center: 518.4, element: 'Mg', wavelength: '518.4 nm', lift: 54, dx: 96 },
{ center: 614.5, element: 'Si', wavelength: '614.5 nm', lift: 58, dx: 0 },
]
const toX = (lambda: number) =>
pad.left + ((lambda - xMin) / (xMax - xMin)) * (width - pad.left - pad.right)
const toY = (intensity: number) =>
height - pad.bottom - ((intensity - yMin) / (yMax - yMin)) * (height - pad.top - pad.bottom)
function intensityAt(lambda: number, index: number) {
let value = 0.72
value += 0.34 * Math.sin(index * 0.37)
value += 0.22 * Math.sin(index * 1.19 + 1.2)
value += 0.14 * Math.cos(index * 2.23)
value += 0.08 * Math.sin(index * 3.7)
for (const peak of peaks) {
const distance = (lambda - peak.center) / peak.width
value += peak.amplitude * Math.exp(-0.5 * distance * distance)
}
return Math.max(0.2, value)
}
const curve = computed(() => {
const count = 620
const points: Array<{ x: number; y: number }> = []
for (let index = 0; index < count; index += 1) {
const ratio = index / (count - 1)
const lambda = xMin + ratio * (xMax - xMin)
points.push({ x: toX(lambda), y: toY(intensityAt(lambda, index)) })
}
return points
})
const linePath = computed(() =>
curve.value
.map((point, index) => `${index === 0 ? 'M' : 'L'}${point.x.toFixed(2)} ${point.y.toFixed(2)}`)
.join(' '),
)
const areaPath = computed(() => {
const bottom = height - pad.bottom
return `${linePath.value} L${toX(xMax).toFixed(2)} ${bottom} L${toX(xMin).toFixed(2)} ${bottom} Z`
})
const yTicks = [0, 10, 20, 30]
const xTicks = [400, 450, 500, 550, 600, 650]
const peakLabels = computed(() =>
labels.map((label) => {
const peak = peaks.find((item) => item.center === label.center)
const peakValue = peak ? peak.amplitude + 1.4 : 10
const x = toX(label.center)
const y = toY(peakValue)
const labelY = Math.max(pad.top + 22, y - label.lift)
return { ...label, x, y, labelX: x + label.dx, labelY }
}),
)
</script>
<template>
<div class="spectrum-chart">
<svg
class="spectrum-chart__svg"
:viewBox="`0 0 ${width} ${height}`"
preserveAspectRatio="xMidYMid meet"
role="img"
aria-label="光谱采集图表"
>
<defs>
<linearGradient id="spectrumStroke" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#6bf2ff" />
<stop offset="0.42" stop-color="#8fe3ff" />
<stop offset="0.72" stop-color="#b49cff" />
<stop offset="1" stop-color="#ff8ad8" />
</linearGradient>
<linearGradient id="spectrumArea" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#a7d5ff" stop-opacity="0.22" />
<stop offset="1" stop-color="#2f6fd0" stop-opacity="0" />
</linearGradient>
</defs>
<rect width="1360" height="720" fill="#2f6fd0" />
<rect width="1360" height="720" fill="url(#spectrumArea)" opacity="0.35" />
<g stroke="rgba(255,255,255,0.24)" stroke-width="1">
<line
v-for="tick in yTicks"
:key="`grid-y-${tick}`"
:x1="pad.left"
:x2="width - pad.right"
:y1="toY(tick)"
:y2="toY(tick)"
stroke-dasharray="3 5"
/>
<line
v-for="tick in xTicks"
:key="`grid-x-${tick}`"
:x1="toX(tick)"
:x2="toX(tick)"
:y1="pad.top"
:y2="height - pad.bottom"
opacity="0.55"
/>
</g>
<g fill="rgba(255,255,255,0.72)" font-size="21" text-anchor="end">
<text
v-for="tick in yTicks"
:key="`label-y-${tick}`"
:x="pad.left - 20"
:y="toY(tick) + 7"
>
{{ tick }}
</text>
</g>
<g fill="rgba(255,255,255,0.74)" font-size="19" text-anchor="middle">
<text
v-for="tick in xTicks"
:key="`label-x-${tick}`"
:x="toX(tick)"
:y="height - pad.bottom + 34"
>
{{ tick }}
</text>
</g>
<g stroke="rgba(255,255,255,0.8)" stroke-width="1.6">
<line :x1="pad.left" :x2="pad.left" :y1="pad.top" :y2="height - pad.bottom" />
<line
:x1="pad.left"
:x2="width - pad.right"
:y1="height - pad.bottom"
:y2="height - pad.bottom"
/>
</g>
<g fill="rgba(255,255,255,0.85)" font-size="22">
<text x="24" y="58">a.u.</text>
<text
x="34"
y="380"
text-anchor="middle"
:transform="`rotate(-90 34 380)`"
>
强 度
</text>
<text x="500" :y="height - 24" text-anchor="middle">波长 nm</text>
<text :x="width - 70" :y="height - 24" text-anchor="end">波长 nm</text>
</g>
<path :d="areaPath" fill="url(#spectrumArea)" />
<path
:d="linePath"
fill="none"
stroke="url(#spectrumStroke)"
stroke-width="2.6"
stroke-linejoin="round"
stroke-linecap="round"
filter="drop-shadow(0 0 5px rgba(146, 228, 255, 0.45))"
/>
<g v-for="label in peakLabels" :key="label.element">
<line
:x1="label.labelX"
:x2="label.x"
:y1="label.labelY + 33"
:y2="label.y - 8"
stroke="rgba(255,255,255,0.62)"
stroke-width="1.3"
stroke-dasharray="3 4"
/>
<circle :cx="label.x" :cy="label.y - 8" r="3.4" fill="#ffffff" opacity="0.92" />
<text
:x="label.labelX"
:y="label.labelY"
fill="#ffffff"
font-size="34"
font-weight="500"
text-anchor="middle"
>
{{ label.element }}
</text>
<text
:x="label.labelX"
:y="label.labelY + 33"
fill="#ffffff"
font-size="24"
text-anchor="middle"
>
{{ label.wavelength }}
</text>
</g>
</svg>
<div class="spectrum-chart__status">
<span class="spectrum-chart__pulse"></span>
光谱采集进行中
</div>
</div>
</template>
<style scoped>
.spectrum-chart {
position: relative;
height: 100%;
overflow: hidden;
border: 1px solid #1e55a4;
border-radius: 16px;
background:
radial-gradient(ellipse 70% 55% at 72% 10%, rgba(119, 182, 255, 0.24), transparent 68%),
linear-gradient(150deg, #3b7edd 0%, #2f6fd0 48%, #2559ac 100%);
box-shadow:
0 18px 44px rgba(31, 77, 147, 0.24),
inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.spectrum-chart__svg {
width: 100%;
height: 100%;
}
.spectrum-chart__status {
position: absolute;
top: 49%;
left: 50%;
display: flex;
align-items: center;
gap: 14px;
color: #fff;
font-size: 36px;
font-weight: 500;
letter-spacing: 5px;
text-shadow: 0 3px 14px rgba(11, 48, 108, 0.5);
transform: translate(-50%, -50%);
white-space: nowrap;
}
.spectrum-chart__pulse {
width: 10px;
height: 10px;
border-radius: 50%;
background: #8df6ff;
box-shadow: 0 0 14px rgba(141, 246, 255, 0.85);
animation: chart-pulse 1.8s ease-in-out infinite;
}
@keyframes chart-pulse {
0%,
100% {
opacity: 0.35;
transform: scale(0.8);
}
50% {
opacity: 1;
transform: scale(1.15);
}
}
</style>
@@ -0,0 +1,74 @@
<script setup lang="ts">
withDefaults(
defineProps<{
items: string[]
icon?: 'laser' | 'info'
}>(),
{ icon: undefined },
)
</script>
<template>
<footer class="status-footer">
<span v-if="icon" class="status-footer__icon" aria-hidden="true">
<svg v-if="icon === 'laser'" viewBox="0 0 24 24">
<path d="M4 17.5h8.5l2-3H22" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
<path d="M4 17.5v2.2M9 17.5v2.2M14 17.5v2.2M19 17.5v2.2" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
<path d="m15 4 3 3M18 4l-3 3M12 7h3M13.5 5.5v3" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
</svg>
<svg v-else viewBox="0 0 24 24">
<circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="1.6" />
<path d="M12 10.5v5.5M12 7.5v.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
</svg>
</span>
<span class="status-footer__text">
<template v-for="(item, index) in items" :key="item">
<span>{{ item }}</span>
<span v-if="index < items.length - 1" class="status-footer__sep" aria-hidden="true">|</span>
</template>
</span>
</footer>
</template>
<style scoped>
.status-footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
display: flex;
align-items: center;
gap: 12px;
height: 62px;
padding: 0 42px;
border-top: 1px solid #dde3eb;
background: #fff;
color: #4d5968;
font-size: 20px;
letter-spacing: 0.5px;
}
.status-footer__icon {
display: grid;
place-items: center;
width: 24px;
height: 24px;
color: #7d8a99;
}
.status-footer__icon svg {
width: 22px;
height: 22px;
}
.status-footer__text {
display: flex;
align-items: center;
gap: 14px;
}
.status-footer__sep {
color: #c5cdd8;
}
</style>
+68
View File
@@ -0,0 +1,68 @@
<script setup lang="ts">
import { useToast } from '@/composables/useToast'
const { message, visible } = useToast()
</script>
<template>
<Teleport to="body">
<Transition name="toast">
<div v-if="visible" class="toast" role="status" aria-live="polite">
<span class="toast__icon" aria-hidden="true">
<svg viewBox="0 0 24 24">
<circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="1.6" />
<path d="M12 10.5v5.5M12 7.5v.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
</svg>
</span>
<span>{{ message }}</span>
</div>
</Transition>
</Teleport>
</template>
<style scoped>
.toast {
position: fixed;
bottom: 54px;
left: 50%;
z-index: 80;
display: flex;
align-items: center;
gap: 12px;
min-width: 280px;
max-width: 720px;
padding: 14px 28px;
border: 1px solid var(--line);
border-radius: 40px;
background: rgba(255, 255, 255, 0.98);
color: var(--ink);
font-size: 18px;
letter-spacing: 0.5px;
box-shadow: 0 16px 44px rgba(22, 39, 65, 0.18);
transform: translateX(-50%);
}
.toast__icon {
display: grid;
place-items: center;
width: 24px;
height: 24px;
color: var(--blue);
}
.toast__icon svg {
width: 22px;
height: 22px;
}
.toast-enter-active,
.toast-leave-active {
transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast-enter-from,
.toast-leave-to {
opacity: 0;
transform: translate(-50%, 10px);
}
</style>
@@ -0,0 +1,168 @@
<script setup lang="ts">
import { nextTick, onBeforeUnmount, ref, watch } from 'vue'
const props = defineProps<{
open: boolean
moduleName: string
}>()
const emit = defineEmits<{
close: []
}>()
const confirmButton = ref<HTMLButtonElement | null>(null)
function close() {
emit('close')
}
function onKeydown(event: KeyboardEvent) {
if (event.key === 'Escape') close()
}
watch(
() => props.open,
async (open) => {
if (open) {
window.addEventListener('keydown', onKeydown)
await nextTick()
confirmButton.value?.focus()
} else {
window.removeEventListener('keydown', onKeydown)
}
},
)
onBeforeUnmount(() => {
window.removeEventListener('keydown', onKeydown)
})
</script>
<template>
<Teleport to="body">
<Transition name="modal">
<div v-if="open" class="modal-backdrop" @click.self="close">
<section
class="modal-card"
role="dialog"
aria-modal="true"
:aria-label="`${moduleName}功能研发中`"
>
<div class="modal-card__icon" aria-hidden="true">
<svg viewBox="0 0 64 64">
<path
d="M39 9a11 11 0 0 0-13.4 13.4L11 37a5 5 0 0 0 7 7l14.6-14.6A11 11 0 0 0 46 16l-6.5 6.5-5-5L41 11Z"
fill="none"
stroke="currentColor"
stroke-width="3"
stroke-linejoin="round"
/>
<path d="m13 35 16 16" stroke="currentColor" stroke-width="3" stroke-linecap="round" />
</svg>
</div>
<h2>{{ moduleName }}功能研发中</h2>
<p>该模块正在研发中,敬请期待。</p>
<button ref="confirmButton" class="modal-card__button" type="button" @click="close">
我知道了
</button>
</section>
</div>
</Transition>
</Teleport>
</template>
<style scoped>
.modal-backdrop {
position: fixed;
inset: 0;
z-index: 60;
display: grid;
place-items: center;
padding: 24px;
background: rgba(18, 33, 54, 0.44);
backdrop-filter: blur(5px);
}
.modal-card {
width: 560px;
padding: 42px 44px 38px;
border: 1px solid rgba(255, 255, 255, 0.65);
border-radius: 24px;
background: #fff;
box-shadow: 0 30px 80px rgba(12, 30, 55, 0.3);
text-align: center;
}
.modal-card__icon {
display: grid;
place-items: center;
width: 86px;
height: 86px;
margin: 0 auto 24px;
border-radius: 50%;
color: var(--blue);
background: linear-gradient(145deg, #f1f7ff, #dfeaff);
box-shadow: inset 0 1px 0 #fff, 0 8px 22px rgba(47, 111, 208, 0.14);
}
.modal-card__icon svg {
width: 46px;
height: 46px;
}
.modal-card h2 {
color: #1f2937;
font-size: 30px;
font-weight: 600;
letter-spacing: 1px;
}
.modal-card p {
margin-top: 14px;
color: #778394;
font-size: 19px;
letter-spacing: 0.5px;
}
.modal-card__button {
width: 210px;
height: 56px;
margin-top: 30px;
border-radius: 12px;
color: #fff;
font-size: 20px;
font-weight: 600;
letter-spacing: 3px;
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
box-shadow: 0 10px 22px rgba(47, 111, 208, 0.28);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.modal-card__button:hover {
transform: translateY(-1px);
box-shadow: 0 14px 28px rgba(47, 111, 208, 0.36);
}
.modal-enter-active,
.modal-leave-active {
transition: opacity 0.24s ease;
}
.modal-enter-active .modal-card,
.modal-leave-active .modal-card {
transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}
.modal-enter-from,
.modal-leave-to {
opacity: 0;
}
.modal-enter-from .modal-card,
.modal-leave-to .modal-card {
opacity: 0;
transform: translateY(16px) scale(0.97);
}
</style>
@@ -0,0 +1,75 @@
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
import { getCameraStatus } from '@/api/camera'
export type CameraConnectionState = 'checking' | 'connected' | 'disconnected' | 'offline'
/**
* 轮询 /api/camera/status,供首页与支付页共用。
* 后端不可达时返回 offline,界面展示为“相机服务离线”,不会阻塞页面。
*/
export function useCameraStatus(pollInterval = 5000, autoStart = true) {
const state = ref<CameraConnectionState>('checking')
const connected = ref<boolean | null>(null)
const lastChecked = ref<Date | null>(null)
const errorMessage = ref('')
let timer: number | undefined
let inFlight = false
async function refresh() {
if (inFlight) return
inFlight = true
try {
const { connected: isConnected } = await getCameraStatus()
connected.value = isConnected
state.value = isConnected ? 'connected' : 'disconnected'
errorMessage.value = ''
} catch (error) {
connected.value = null
state.value = 'offline'
errorMessage.value = error instanceof Error ? error.message : '无法连接相机服务'
} finally {
inFlight = false
lastChecked.value = new Date()
}
}
function startPolling() {
stopPolling()
timer = window.setInterval(refresh, pollInterval)
}
function stopPolling() {
if (timer !== undefined) {
window.clearInterval(timer)
timer = undefined
}
}
function onVisibilityChange() {
if (document.visibilityState === 'visible') void refresh()
}
onMounted(() => {
if (!autoStart) return
void refresh()
startPolling()
document.addEventListener('visibilitychange', onVisibilityChange)
})
onBeforeUnmount(() => {
stopPolling()
document.removeEventListener('visibilitychange', onVisibilityChange)
})
return {
state,
connected,
lastChecked,
errorMessage,
isConnected: computed(() => state.value === 'connected'),
refresh,
startPolling,
stopPolling,
}
}
@@ -0,0 +1,150 @@
import { computed, onBeforeUnmount, ref } from 'vue'
import {
HubConnectionBuilder,
HubConnectionState,
LogLevel,
type HubConnection,
} from '@microsoft/signalr'
import { getCameraHubUrl } from '@/api/camera'
interface CameraFramePayload {
frameIndex: number
timestamp: string
imageBase64: string
/** 后端根据实际采集格式给出:image/jpeg、image/png 或 image/bmp */
mimeType?: string
width?: number
height?: number
capturedAt?: string
}
interface CameraStatusPayload {
isConnected: boolean
message?: string
deviceName?: string | null
framesReceived?: number
lastFrameAt?: string | null
}
export type StreamState = 'idle' | 'connecting' | 'connected' | 'offline'
/** 摄像头 MJPG 帧,base64 直出为 JPEG */
const FRAME_MIME = 'image/jpeg'
/** 限制前端刷新率,避免高帧率推流时占用过多主线程 */
const MIN_FRAME_INTERVAL = 70
/**
* 通过 SignalR(/cameraHub)接收相机实时帧。
* 事件契约见 HardwareWeb/Services/CameraBroadcastService.cs:
* CameraFrame -> { frameIndex, timestamp, imageBase64 }
* CameraStatus -> { isConnected, message }
*/
export function useCameraStream() {
const state = ref<StreamState>('idle')
const frameUrl = ref<string | null>(null)
const frameIndex = ref(0)
const errorMessage = ref('')
const hasFrame = ref(false)
let connection: HubConnection | null = null
let lastFrameAt = 0
let stoppedByUser = false
const isLive = computed(() => state.value === 'connected' && hasFrame.value)
function handleFrame(payload: CameraFramePayload) {
if (!payload?.imageBase64) return
const now = performance.now()
if (now - lastFrameAt < MIN_FRAME_INTERVAL) return
lastFrameAt = now
const mime =
payload.mimeType ??
(payload.imageBase64.startsWith('iVBOR')
? 'image/png'
: payload.imageBase64.startsWith('Qk')
? 'image/bmp'
: FRAME_MIME)
frameUrl.value = `data:${mime};base64,${payload.imageBase64}`
frameIndex.value = payload.frameIndex
hasFrame.value = true
state.value = 'connected'
}
function handleStatus(payload: CameraStatusPayload) {
if (payload.isConnected) {
state.value = 'connected'
errorMessage.value = ''
} else {
hasFrame.value = false
frameUrl.value = null
state.value = 'offline'
}
}
async function connect() {
if (connection && connection.state !== HubConnectionState.Disconnected) return
stoppedByUser = false
state.value = 'connecting'
errorMessage.value = ''
const hub = new HubConnectionBuilder()
.withUrl(getCameraHubUrl(), { withCredentials: false })
.withAutomaticReconnect({
nextRetryDelayInMilliseconds: (context) =>
Math.min(1000 * 2 ** context.previousRetryCount, 10000),
})
.configureLogging(LogLevel.Warning)
.build()
hub.on('CameraFrame', handleFrame)
hub.on('CameraStatus', handleStatus)
hub.onreconnecting(() => {
state.value = 'connecting'
})
hub.onreconnected(() => {
state.value = 'connected'
})
hub.onclose(() => {
if (stoppedByUser) return
state.value = 'offline'
hasFrame.value = false
})
connection = hub
try {
await hub.start()
state.value = 'connected'
} catch (error) {
state.value = 'offline'
errorMessage.value = error instanceof Error ? error.message : '实时画面连接失败'
connection = null
await hub.stop().catch(() => undefined)
}
}
async function disconnect() {
stoppedByUser = true
hasFrame.value = false
frameUrl.value = null
const hub = connection
connection = null
state.value = 'idle'
if (hub) await hub.stop().catch(() => undefined)
}
onBeforeUnmount(() => {
void disconnect()
})
return {
state,
frameUrl,
frameIndex,
errorMessage,
hasFrame,
isLive,
connect,
disconnect,
}
}
@@ -0,0 +1,31 @@
import { onBeforeUnmount, onMounted, ref } from 'vue'
/** 秒级倒计时,归零时只触发一次回调。 */
export function useCountdown(seconds: number, onComplete: () => void) {
const remaining = ref(seconds)
let timer: number | undefined
let finished = false
onMounted(() => {
timer = window.setInterval(() => {
remaining.value = Math.max(0, remaining.value - 1)
if (remaining.value === 0 && !finished) {
finished = true
window.clearInterval(timer)
timer = undefined
onComplete()
}
}, 1000)
})
onBeforeUnmount(() => {
if (timer !== undefined) {
window.clearInterval(timer)
timer = undefined
}
})
return { remaining }
}
@@ -0,0 +1,27 @@
import { onBeforeUnmount, onMounted, ref } from 'vue'
/**
* 设计稿为 1920 × 1080 的一体机大屏。
* 用 transform 整体缩放,可以在任意分辨率下保持设计比例与布局,不会出现错位。
*/
export function useStageScale(width = 1920, height = 1080) {
const scale = ref(1)
const update = () => {
const next = Math.min(window.innerWidth / width, window.innerHeight / height)
scale.value = Math.max(0.2, Math.round(next * 10000) / 10000)
}
onMounted(() => {
update()
window.addEventListener('resize', update, { passive: true })
window.addEventListener('orientationchange', update)
})
onBeforeUnmount(() => {
window.removeEventListener('resize', update)
window.removeEventListener('orientationchange', update)
})
return { scale, update }
}
@@ -0,0 +1,48 @@
import { onBeforeUnmount, onMounted, ref } from 'vue'
/**
* 平滑推进 0 → 100 的进度值,到达 100% 时只触发一次回调。
* 组件卸载(用户中止流程)时会自动取消,不会误跳转。
*/
export function useTimedProgress(durationMs: number, onComplete: () => void) {
const progress = ref(0)
let frame = 0
let startedAt = 0
let finished = false
const tick = (now: number) => {
if (!startedAt) startedAt = now
const elapsed = now - startedAt
progress.value = Math.min(100, (elapsed / durationMs) * 100)
if (progress.value >= 100) {
if (!finished) {
finished = true
onComplete()
}
return
}
frame = window.requestAnimationFrame(tick)
}
onMounted(() => {
if (durationMs <= 0) {
progress.value = 100
if (!finished) {
finished = true
onComplete()
}
return
}
frame = window.requestAnimationFrame(tick)
})
onBeforeUnmount(() => {
window.cancelAnimationFrame(frame)
})
return { progress }
}
+26
View File
@@ -0,0 +1,26 @@
import { readonly, ref } from 'vue'
const message = ref('')
const visible = ref(false)
let timer: number | undefined
export function showToast(text: string, duration = 2400) {
message.value = text
visible.value = true
if (timer !== undefined) {
window.clearTimeout(timer)
}
timer = window.setTimeout(() => {
visible.value = false
timer = undefined
}, duration)
}
export function useToast() {
return {
message: readonly(message),
visible: readonly(visible),
}
}
+16
View File
@@ -0,0 +1,16 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_API_BASE?: string
readonly VITE_HUB_URL?: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>
export default component
}
+6
View File
@@ -0,0 +1,6 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './styles/main.css'
createApp(App).use(router).mount('#app')
+52
View File
@@ -0,0 +1,52 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/HomeView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView,
meta: { title: '激光诱导击穿光谱 元素分析系统' },
},
{
path: '/sample',
name: 'sample',
component: () => import('@/views/SampleSetupView.vue'),
meta: { title: '放置待测样品' },
},
{
path: '/scan',
name: 'scan',
component: () => import('@/views/ScanPlanView.vue'),
meta: { title: '样品轮廓识别与激光点位规划' },
},
{
path: '/spectrum',
name: 'spectrum',
component: () => import('@/views/SpectrumView.vue'),
meta: { title: '光谱数据采集与分析' },
},
{
path: '/result',
name: 'result',
component: () => import('@/views/ResultView.vue'),
meta: { title: '检测完成' },
},
{
path: '/pay',
redirect: { name: 'sample' },
},
{
path: '/:pathMatch(.*)*',
redirect: { name: 'home' },
},
],
})
router.afterEach((to) => {
document.title = (to.meta.title as string | undefined) ?? 'LIBS Lab'
})
export default router
+190
View File
@@ -0,0 +1,190 @@
:root {
--bg: #f0f2f5;
--bg-deep: #e4e8ee;
--surface: #ffffff;
--surface-soft: #f7f8fa;
--ink: #1c2735;
--ink-soft: #3f4c5e;
--muted: #7c8797;
--muted-light: #a5afbc;
--line: #e2e7ee;
--line-strong: #cfd8e4;
--blue: #2f6fd0;
--blue-dark: #245bb5;
--blue-soft: #eaf2ff;
--teal: #2ab7ac;
--teal-dark: #1a9b91;
--green: #78bd3f;
--green-dark: #5aa02b;
--orange: #f5b51f;
--orange-dark: #e09a06;
--orange-soft: #fff3d5;
--red: #e15b55;
--radius-lg: 20px;
--radius-md: 14px;
--radius-sm: 9px;
--shadow-card: 0 10px 30px rgba(33, 53, 84, 0.08);
--shadow-card-strong: 0 18px 48px rgba(33, 53, 84, 0.12);
--font: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei",
"Noto Sans SC", sans-serif;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
html,
body,
#app {
width: 100%;
height: 100%;
margin: 0;
}
html {
background: #e5e9ee;
}
body {
overflow: hidden;
color: var(--ink);
font-family: var(--font);
font-size: 16px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
button {
margin: 0;
padding: 0;
border: 0;
color: inherit;
font: inherit;
background: none;
cursor: pointer;
}
button:focus-visible {
outline: 3px solid rgba(47, 111, 208, 0.4);
outline-offset: 3px;
}
img,
video,
svg {
display: block;
max-width: 100%;
}
h1,
h2,
h3,
p {
margin: 0;
}
ul,
ol {
margin: 0;
padding: 0;
list-style: none;
}
/* Shared header actions */
.header-button {
display: inline-flex;
align-items: center;
justify-content: center;
height: 64px;
border-radius: 10px;
font-size: 26px;
font-weight: 600;
letter-spacing: 3px;
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.header-button:hover {
transform: translateY(-1px);
}
.header-button--outline {
width: 132px;
border: 2px solid var(--blue);
color: var(--blue);
background: #fff;
}
.header-button--outline:hover {
background: var(--blue-soft);
}
.header-button--warn {
width: 300px;
height: 68px;
color: #fff;
background: linear-gradient(180deg, #ffc82f 0%, #f0ac0b 100%);
box-shadow:
0 10px 22px rgba(240, 172, 11, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.55);
text-shadow: 0 1px 2px rgba(160, 100, 0, 0.26);
}
.header-button--warn:hover {
box-shadow:
0 14px 28px rgba(240, 172, 11, 0.36),
inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.icon-close {
display: grid;
place-items: center;
width: 52px;
height: 52px;
border-radius: 50%;
color: #9aa5b3;
transition: color 0.2s ease, background 0.2s ease;
}
.icon-close:hover {
color: #4c5a6b;
background: #f0f3f7;
}
.icon-close svg {
width: 26px;
height: 26px;
}
.page-enter-active,
.page-leave-active {
transition: opacity 0.32s ease, transform 0.32s ease;
}
.page-enter-from {
opacity: 0;
transform: translateY(10px);
}
.page-leave-to {
opacity: 0;
transform: translateY(-6px);
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
}
}
+174
View File
@@ -0,0 +1,174 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import AppStage from '@/components/AppStage.vue'
import ModuleButton from '@/components/ModuleButton.vue'
import PrinciplePlayer from '@/components/PrinciplePlayer.vue'
import UnderDevelopmentModal from '@/components/UnderDevelopmentModal.vue'
import logo from '@/assets/logo.png'
type ModuleTone = 'blue' | 'orange' | 'green' | 'teal'
type ModuleIconName = 'detect' | 'metal' | 'soil' | 'water'
interface HomeModule {
key: string
title: string
tone: ModuleTone
icon: ModuleIconName
}
const modules: HomeModule[] = [
{ key: 'element', title: '元素检测', tone: 'blue', icon: 'detect' },
{ key: 'metal', title: '金属鉴别', tone: 'orange', icon: 'metal' },
{ key: 'soil', title: '土壤与沉积物筛查', tone: 'green', icon: 'soil' },
{ key: 'water', title: '水体液体分析', tone: 'teal', icon: 'water' },
]
const router = useRouter()
const modalOpen = ref(false)
const modalModule = ref('')
function openModule(module: HomeModule) {
if (module.key === 'element') {
void router.push({ name: 'sample' })
return
}
modalModule.value = module.title
modalOpen.value = true
}
</script>
<template>
<AppStage>
<div class="home">
<header class="home-header">
<div class="brand">
<img :src="logo" alt="泽科技 LIBS 标识" />
<span>LIBS</span>
</div>
<div class="headline">
<h1>激光诱导击穿光谱 元素分析系统</h1>
<p>开放 · 共享 · 自助式元素检测平台</p>
</div>
</header>
<main class="home-main">
<section class="modules-panel">
<div class="modules-grid">
<ModuleButton
v-for="module in modules"
:key="module.key"
:title="module.title"
:tone="module.tone"
:icon="module.icon"
@click="openModule(module)"
/>
</div>
</section>
<PrinciplePlayer class="home-player" />
</main>
</div>
<UnderDevelopmentModal
:open="modalOpen"
:module-name="modalModule"
@close="modalOpen = false"
/>
</AppStage>
</template>
<style scoped>
.home {
position: absolute;
inset: 0;
background: #f0f2f5;
}
.home-header {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 180px;
padding: 24px 44px;
background: #f4f5f7;
}
.brand {
display: flex;
align-items: center;
gap: 14px;
}
.brand img {
width: 100px;
height: 100px;
object-fit: contain;
mix-blend-mode: multiply;
}
.brand span {
color: #253243;
font-size: 32px;
font-weight: 700;
letter-spacing: 2px;
}
.headline {
position: absolute;
top: 40px;
left: 50%;
text-align: center;
transform: translateX(-50%);
white-space: nowrap;
}
.headline h1 {
color: #1f2937;
font-size: 44px;
font-weight: 600;
letter-spacing: 6px;
line-height: 1.2;
}
.headline p {
margin-top: 16px;
color: #4d5969;
font-size: 20px;
letter-spacing: 4px;
}
.home-main {
position: absolute;
top: 196px;
right: 44px;
bottom: 40px;
left: 44px;
display: grid;
grid-template-columns: 868px minmax(0, 1fr);
gap: 36px;
}
.modules-panel {
display: flex;
align-items: center;
padding: 34px;
border-radius: 20px;
background: #fff;
box-shadow: var(--shadow-card);
}
.modules-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 32px;
width: 100%;
}
.home-player {
min-width: 0;
}
</style>
+290
View File
@@ -0,0 +1,290 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'
import AppStage from '@/components/AppStage.vue'
import PageHeader from '@/components/PageHeader.vue'
import MiniSpectrum from '@/components/MiniSpectrum.vue'
import { useCountdown } from '@/composables/useCountdown'
import { showToast } from '@/composables/useToast'
import reportQr from '@/assets/report-qr.png'
const router = useRouter()
function goHome() {
void router.replace({ name: 'home' })
}
const { remaining } = useCountdown(60, goHome)
const rows = [
{ element: 'Fe', intensity: '高', content: '3.82%', verdict: '检出' },
{ element: 'Cu', intensity: '中', content: '1.27%', verdict: '检出' },
{ element: 'Mg', intensity: '中', content: '0.94%', verdict: '检出' },
{ element: 'Si', intensity: '低', content: '0.41%', verdict: '痕量' },
]
function exportReport() {
showToast('报告导出功能正在研发中')
}
</script>
<template>
<AppStage>
<PageHeader title="检测完成" variant="result" />
<main class="result-main">
<section class="result-card">
<h2 class="result-card__title">元素检测结果</h2>
<div class="result-summary">
<MiniSpectrum />
<div class="result-badge">合金成分分析完成</div>
</div>
<table class="result-table">
<thead>
<tr>
<th>元素</th>
<th>强度</th>
<th>含量</th>
<th>判定</th>
</tr>
</thead>
<tbody>
<tr v-for="row in rows" :key="row.element">
<td class="result-table__element">{{ row.element }}</td>
<td>{{ row.intensity }}</td>
<td>{{ row.content }}</td>
<td>{{ row.verdict }}</td>
</tr>
</tbody>
</table>
</section>
<aside class="report-card">
<h2 class="report-card__title">获取完整报告</h2>
<div class="report-card__qr">
<img :src="reportQr" alt="获取完整检测报告二维码" />
</div>
<p class="report-card__caption">扫码关注微信公众号获取更详细结果</p>
</aside>
</main>
<div class="result-actions">
<p class="result-actions__countdown">
当前界面还有 <strong>{{ remaining }}</strong>s 后自动关闭...
</p>
<div class="result-actions__buttons">
<button class="result-button result-button--close" type="button" @click="goHome">
关闭
</button>
<button class="result-button result-button--export" type="button" @click="exportReport">
导出报告
</button>
</div>
</div>
</AppStage>
</template>
<style scoped>
.result-main {
position: absolute;
top: 150px;
right: 44px;
left: 44px;
display: grid;
grid-template-columns: minmax(0, 1fr) 620px;
gap: 40px;
height: 730px;
}
.result-card {
display: flex;
flex-direction: column;
padding: 28px 38px 34px;
overflow: hidden;
border-radius: 20px;
background:
radial-gradient(ellipse 70% 50% at 60% 0%, rgba(131, 185, 255, 0.28), transparent 70%),
linear-gradient(150deg, #3c7fdf 0%, #2f6fd0 48%, #2559ad 100%);
box-shadow:
0 18px 44px rgba(31, 77, 147, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.result-card__title {
color: #fff;
font-size: 38px;
font-weight: 600;
letter-spacing: 4px;
text-align: center;
text-shadow: 0 2px 6px rgba(15, 47, 98, 0.22);
}
.result-summary {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 28px;
margin-top: 22px;
}
.result-badge {
display: flex;
align-items: center;
justify-content: center;
min-width: 300px;
height: 58px;
padding: 0 24px;
border: 1px solid #e4c98e;
border-radius: 10px;
background: linear-gradient(180deg, #faf0d8 0%, #f3e3bd 100%);
color: #5e4726;
font-size: 24px;
letter-spacing: 2px;
box-shadow: 0 6px 16px rgba(24, 55, 105, 0.14);
}
.result-table {
width: 100%;
margin-top: 22px;
border-collapse: collapse;
table-layout: fixed;
}
.result-table th {
height: 58px;
border: 1px solid rgba(255, 255, 255, 0.5);
background: rgba(37, 89, 173, 0.2);
color: #fff;
font-size: 27px;
font-weight: 500;
letter-spacing: 2px;
}
.result-table td {
height: 94px;
border: 1px solid rgba(255, 255, 255, 0.66);
background: rgba(255, 255, 255, 0.95);
color: #222b38;
font-size: 26px;
text-align: center;
}
.result-table__element {
font-weight: 600;
}
.report-card {
display: flex;
flex-direction: column;
align-items: center;
padding: 28px 34px 34px;
overflow: hidden;
border-radius: 20px;
background:
radial-gradient(ellipse 75% 55% at 28% 0%, rgba(255, 220, 170, 0.34), transparent 70%),
linear-gradient(150deg, #f7a44b 0%, #ee8a2f 52%, #e67720 100%);
box-shadow:
0 18px 44px rgba(190, 104, 27, 0.24),
inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.report-card__title {
color: #fff;
font-size: 38px;
font-weight: 600;
letter-spacing: 4px;
text-align: center;
text-shadow: 0 2px 5px rgba(139, 73, 14, 0.22);
}
.report-card__qr {
width: 336px;
height: 356px;
margin-top: 28px;
padding: 18px;
border-radius: 14px;
background: #fff;
box-shadow: 0 14px 30px rgba(129, 69, 13, 0.2);
}
.report-card__qr img {
width: 100%;
height: 100%;
object-fit: contain;
image-rendering: auto;
}
.report-card__caption {
max-width: 480px;
margin-top: 26px;
color: #fff;
font-size: 21px;
line-height: 1.6;
letter-spacing: 1px;
text-align: center;
text-shadow: 0 1px 3px rgba(139, 73, 14, 0.2);
}
.result-actions {
position: absolute;
right: 44px;
bottom: 48px;
left: 44px;
display: flex;
align-items: center;
justify-content: space-between;
}
.result-actions__countdown {
color: #303a48;
font-size: 27px;
letter-spacing: 1px;
}
.result-actions__countdown strong {
color: var(--orange-dark);
font-size: 32px;
font-weight: 700;
}
.result-actions__buttons {
display: flex;
gap: 22px;
}
.result-button {
display: grid;
place-items: center;
width: 208px;
height: 70px;
border-radius: 10px;
font-size: 29px;
font-weight: 600;
letter-spacing: 5px;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.result-button:hover {
transform: translateY(-1px);
}
.result-button--close {
color: #fff;
background: linear-gradient(180deg, #ffc42b 0%, #f1ab0c 100%);
box-shadow:
0 10px 22px rgba(225, 154, 6, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.55);
text-shadow: 0 1px 2px rgba(151, 94, 0, 0.24);
}
.result-button--export {
border: 1px solid #e2cb9f;
color: #755329;
background: linear-gradient(180deg, #fbf1dd 0%, #f1e0bd 100%);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
</style>
+228
View File
@@ -0,0 +1,228 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'
import AppStage from '@/components/AppStage.vue'
import PageHeader from '@/components/PageHeader.vue'
import CameraPreview from '@/components/CameraPreview.vue'
import GuideIcon from '@/components/GuideIcon.vue'
import StatusFooter from '@/components/StatusFooter.vue'
import { showToast } from '@/composables/useToast'
const router = useRouter()
const steps = [
{ title: '打开样品仓', icon: 'door' as const },
{ title: '放置待测样品', icon: 'tray' as const },
{ title: '调整聚焦位置', icon: 'focus' as const },
]
function goHome() {
void router.push({ name: 'home' })
}
function startDetection() {
void router.push({ name: 'scan' })
}
function previewFocus() {
showToast('预览对焦功能正在研发中')
}
</script>
<template>
<AppStage>
<PageHeader title="放置待测样品">
<template #left>
<button class="header-button header-button--outline" type="button" @click="goHome">
返回
</button>
</template>
</PageHeader>
<main class="sample-main">
<CameraPreview class="sample-camera" />
<aside class="guide-column">
<section class="guide-card">
<header class="guide-card__header">
<h2>样品放置操作指引</h2>
</header>
<ol class="guide-steps">
<li v-for="(step, index) in steps" :key="step.title" class="guide-step">
<span class="guide-step__number">{{ index + 1 }}</span>
<span class="guide-step__title">{{ step.title }}</span>
<span class="guide-step__icon">
<GuideIcon :name="step.icon" />
</span>
</li>
</ol>
</section>
<div class="guide-actions">
<button class="action-button action-button--start" type="button" @click="startDetection">
开始检测
</button>
<button class="action-button action-button--ghost" type="button" @click="previewFocus">
预览对焦
</button>
</div>
</aside>
</main>
<StatusFooter
:items="['样品仓已关闭', '激光安全等级 Class 1', '环境温度 22℃']"
/>
</AppStage>
</template>
<style scoped>
.sample-main {
position: absolute;
top: 220px;
right: 44px;
left: 44px;
display: grid;
grid-template-columns: minmax(0, 1fr) 620px;
gap: 34px;
height: 710px;
}
.sample-camera {
min-width: 0;
}
.guide-column {
display: flex;
flex-direction: column;
gap: 18px;
min-width: 0;
}
.guide-card {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
border-radius: 18px;
background: #2fb8ad;
box-shadow: 0 16px 34px rgba(31, 148, 139, 0.24);
}
.guide-card__header {
display: flex;
flex: none;
align-items: center;
height: 104px;
padding: 0 34px;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
}
.guide-card__header h2 {
color: #fff;
font-size: 32px;
font-weight: 600;
letter-spacing: 3px;
text-shadow: 0 1px 3px rgba(10, 94, 88, 0.2);
}
.guide-steps {
display: flex;
flex: 1;
flex-direction: column;
}
.guide-step {
display: flex;
flex: 1;
align-items: center;
gap: 22px;
min-height: 0;
padding: 0 34px;
border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.guide-step:last-child {
border-bottom: 0;
}
.guide-step__number {
display: grid;
flex: none;
place-items: center;
width: 46px;
height: 46px;
border: 2px solid rgba(255, 255, 255, 0.9);
border-radius: 50%;
color: #fff;
font-size: 24px;
font-weight: 600;
}
.guide-step__title {
flex: 1;
color: #fff;
font-size: 28px;
font-weight: 500;
letter-spacing: 1px;
text-shadow: 0 1px 3px rgba(10, 94, 88, 0.18);
}
.guide-step__icon {
display: grid;
flex: none;
place-items: center;
width: 78px;
height: 78px;
padding: 2px;
}
.guide-actions {
display: grid;
flex: none;
grid-template-columns: 1.16fr 0.84fr;
gap: 20px;
height: 78px;
}
.action-button {
display: grid;
place-items: center;
height: 78px;
border-radius: 12px;
font-size: 30px;
font-weight: 600;
letter-spacing: 4px;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.action-button:hover {
transform: translateY(-1px);
}
.action-button--start {
color: #fff;
background: linear-gradient(180deg, #ffc52c 0%, #f3ae0d 100%);
box-shadow:
0 12px 24px rgba(224, 154, 6, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.55);
text-shadow: 0 1px 2px rgba(151, 94, 0, 0.25);
}
.action-button--start:hover {
box-shadow:
0 16px 30px rgba(224, 154, 6, 0.36),
inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.action-button--ghost {
border: 2px solid #d3dbe6;
color: #253243;
background: #fff;
}
.action-button--ghost:hover {
border-color: #aebdcd;
background: #f8fafc;
}
</style>
+178
View File
@@ -0,0 +1,178 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import AppStage from '@/components/AppStage.vue'
import PageHeader from '@/components/PageHeader.vue'
import ScanVisual from '@/components/ScanVisual.vue'
import ProgressStrip from '@/components/ProgressStrip.vue'
import StatusFooter from '@/components/StatusFooter.vue'
import { useTimedProgress } from '@/composables/useTimedProgress'
const router = useRouter()
const { progress } = useTimedProgress(15000, () => {
void router.replace({ name: 'spectrum' })
})
const progressLabel = computed(() => `点位扫描 ${Math.round(progress.value)}%`)
function abortProcess() {
void router.replace({ name: 'home' })
}
</script>
<template>
<AppStage>
<PageHeader title="样品轮廓识别与激光点位规划" variant="process">
<template #left>
<button class="header-button header-button--warn" type="button" @click="abortProcess">
中止流程
</button>
</template>
<template #right>
<button class="icon-close" type="button" aria-label="关闭并返回首页" @click="abortProcess">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="m6 6 12 12M18 6 6 18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
</svg>
</button>
</template>
</PageHeader>
<main class="scan-main">
<ScanVisual class="scan-card" />
<aside class="params-card">
<header class="params-card__header">
<h2>采样点</h2>
</header>
<div class="params-card__body">
<div class="param-field">
<span class="param-field__label">采样点数</span>
<div class="param-field__value">5</div>
</div>
<div class="param-field">
<span class="param-field__label">脉冲能量</span>
<div class="param-field__value">120 <small>mJ</small></div>
</div>
<div class="param-field">
<span class="param-field__label">积分时间</span>
<div class="param-field__value">10 <small>ms</small></div>
</div>
<div class="param-field">
<span class="param-field__label">预扫描</span>
<div class="param-field__value">3 <small>次</small></div>
</div>
</div>
</aside>
</main>
<div class="scan-progress">
<ProgressStrip :progress="progress" :label="progressLabel" note="已规划 5 个采样点" />
</div>
<StatusFooter
icon="info"
:items="['轮廓提取完成', '点位校验通过', '等待采集光谱']"
/>
</AppStage>
</template>
<style scoped>
.scan-main {
position: absolute;
top: 142px;
right: 44px;
left: 44px;
display: grid;
grid-template-columns: minmax(0, 1fr) 342px;
gap: 20px;
height: 730px;
}
.scan-card {
width: 1120px;
max-width: 100%;
height: 100%;
justify-self: center;
}
.params-card {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
border: 1px solid #d9e0e8;
border-radius: 10px;
background: #fff;
box-shadow: 0 8px 24px rgba(33, 53, 84, 0.05);
}
.params-card__header {
display: flex;
flex: none;
align-items: center;
height: 64px;
padding: 0 22px;
border-bottom: 1px solid #e4e8ee;
background: #f3f4f6;
}
.params-card__header h2 {
color: #333b46;
font-size: 23px;
font-weight: 500;
letter-spacing: 1px;
}
.params-card__body {
padding: 26px 22px;
}
.param-field {
margin-bottom: 24px;
}
.param-field:last-child {
margin-bottom: 0;
}
.param-field__label {
display: block;
margin-bottom: 10px;
color: #46505e;
font-size: 22px;
letter-spacing: 0.5px;
}
.param-field__value {
display: flex;
align-items: center;
height: 62px;
padding: 0 18px;
border: 1px solid #d8dde6;
border-radius: 7px;
background: #fff;
color: #2e3641;
font-size: 24px;
box-shadow: inset 0 1px 2px rgba(30, 45, 66, 0.03);
}
.param-field__value small {
margin-left: 8px;
color: #8d97a4;
font-size: 18px;
}
.scan-progress {
position: absolute;
top: 900px;
right: 44px;
left: 44px;
height: 54px;
}
</style>
+222
View File
@@ -0,0 +1,222 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import AppStage from '@/components/AppStage.vue'
import PageHeader from '@/components/PageHeader.vue'
import SpectrumChart from '@/components/SpectrumChart.vue'
import ProgressStrip from '@/components/ProgressStrip.vue'
import StatusFooter from '@/components/StatusFooter.vue'
import { useTimedProgress } from '@/composables/useTimedProgress'
const router = useRouter()
const { progress } = useTimedProgress(10000, () => {
void router.replace({ name: 'result' })
})
const progressLabel = computed(() => `光谱采集 ${Math.round(progress.value)}%`)
const sampleIndex = computed(() =>
Math.min(5, Math.max(1, Math.ceil(progress.value / 20))),
)
function abortProcess() {
void router.replace({ name: 'home' })
}
</script>
<template>
<AppStage>
<PageHeader title="光谱数据采集与分析" variant="process">
<template #left>
<button class="header-button header-button--warn" type="button" @click="abortProcess">
中止流程
</button>
</template>
</PageHeader>
<main class="spectrum-main">
<SpectrumChart class="spectrum-chart" />
<aside class="analysis-card">
<header class="analysis-card__header">
<h2>分析步骤</h2>
</header>
<div class="analysis-card__body">
<div class="analysis-step">
<span class="analysis-step__icon analysis-step__icon--blue">
<svg viewBox="0 0 24 24" aria-hidden="true">
<circle cx="12" cy="12" r="8" fill="none" stroke="currentColor" stroke-width="1.6" />
<path d="M12 7v5l3.4 2" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
</svg>
</span>
<span class="analysis-step__text">正在拟合峰值</span>
<span class="analysis-step__chevron">›</span>
</div>
<div class="analysis-step">
<span class="analysis-step__icon analysis-step__icon--amber">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M5 15h14M7 15V8l5-3 5 3v7" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" />
<path d="M9 15v3h6v-3" fill="none" stroke="currentColor" stroke-width="1.6" />
</svg>
</span>
<span class="analysis-step__text">扣除连续背景</span>
<span class="analysis-step__chevron">›</span>
</div>
<div class="analysis-step">
<span class="analysis-step__icon analysis-step__icon--blue">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="6" y="4" width="12" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="1.6" />
<path d="M9 8h6M9 11h6M9 14h3" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
</svg>
</span>
<span class="analysis-step__text">计算元素浓度</span>
<span class="analysis-step__chevron">›</span>
</div>
<div class="analysis-card__track" aria-hidden="true">
<span></span>
</div>
</div>
</aside>
</main>
<div class="spectrum-progress">
<ProgressStrip
:progress="progress"
:label="progressLabel"
:note="`第 ${sampleIndex} / 5 次采样`"
/>
</div>
<StatusFooter
icon="laser"
:items="['激光发射正常', '探测器积分完成', '数据保存中']"
/>
</AppStage>
</template>
<style scoped>
.spectrum-main {
position: absolute;
top: 142px;
right: 44px;
left: 44px;
display: grid;
grid-template-columns: minmax(0, 1fr) 342px;
gap: 20px;
height: 730px;
}
.spectrum-chart {
min-width: 0;
}
.analysis-card {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
border: 1px solid #d9e0e8;
border-radius: 10px;
background: #fff;
box-shadow: 0 8px 24px rgba(33, 53, 84, 0.05);
}
.analysis-card__header {
display: flex;
flex: none;
align-items: center;
height: 64px;
padding: 0 22px;
border-bottom: 1px solid #e4e8ee;
background: #f3f4f6;
}
.analysis-card__header h2 {
color: #333b46;
font-size: 23px;
font-weight: 500;
letter-spacing: 1px;
}
.analysis-card__body {
flex: 1;
padding: 16px 18px;
}
.analysis-step {
display: flex;
align-items: center;
gap: 16px;
height: 78px;
padding: 0 10px;
border-bottom: 1px solid #eef1f5;
}
.analysis-step__icon {
display: grid;
flex: none;
place-items: center;
width: 38px;
height: 38px;
border-radius: 50%;
}
.analysis-step__icon svg {
width: 26px;
height: 26px;
}
.analysis-step__icon--blue {
color: #2f6fd0;
background: #eaf2ff;
}
.analysis-step__icon--amber {
color: #d59400;
background: #fff4d6;
}
.analysis-step__text {
flex: 1;
color: #3f4b5b;
font-size: 21px;
letter-spacing: 0.5px;
}
.analysis-step__chevron {
color: #b2bcc8;
font-size: 30px;
line-height: 1;
}
.analysis-card__track {
position: relative;
width: 6px;
height: 142px;
margin: 22px 0 0 auto;
border-radius: 6px;
background: #eef1f5;
}
.analysis-card__track span {
position: absolute;
top: 18px;
left: 0;
width: 6px;
height: 54px;
border-radius: 6px;
background: #c9d3df;
}
.spectrum-progress {
position: absolute;
top: 900px;
right: 44px;
left: 44px;
height: 54px;
}
</style>