提交代码

This commit is contained in:
ldh
2026-11-19 16:42:26 +08:00
parent c5908eff03
commit 9d06abe41c
209 changed files with 158631 additions and 1311 deletions
+82
View File
@@ -0,0 +1,82 @@
/**
* 设备连接状态接口封装。
* 后端实现见 HardwareWeb/Controllers/DeviceController.cs:
* GET /api/devices/status -> { allConnected, devices, updatedAt }
* POST /api/devices/retry -> 同上
*/
export interface DeviceStatusItem {
key: string
name: string
connected: boolean
status: string
message: string | null
updatedAt: string
}
export interface DeviceStatus {
allConnected: boolean
devices: DeviceStatusItem[]
updatedAt: string
}
const API_BASE = (import.meta.env.VITE_API_BASE ?? '').replace(/\/$/, '')
const REQUEST_TIMEOUT = 30000
export class DeviceApiError extends Error {
readonly status: number
constructor(message: string, status = 0) {
super(message)
this.name = 'DeviceApiError'
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 DeviceApiError(detail, response.status)
}
return (await response.json()) as T
} catch (error) {
if (error instanceof DeviceApiError) throw error
if (error instanceof DOMException && error.name === 'AbortError') {
throw new DeviceApiError('设备服务响应超时')
}
throw new DeviceApiError(
error instanceof Error ? error.message : '无法连接设备服务',
)
} finally {
window.clearTimeout(timer)
}
}
export function getDeviceStatus(): Promise<DeviceStatus> {
return request<DeviceStatus>('/api/devices/status')
}
export function retryDevices(): Promise<DeviceStatus> {
return request<DeviceStatus>('/api/devices/retry', { method: 'POST' })
}
+197
View File
@@ -0,0 +1,197 @@
/**
* 扫描流程接口封装。
* 后端实现见 HardwareWeb/Controllers/ScanController.cs:
* POST /api/scan/start -> { scanId, totalPoints }
* POST /api/scan/abort -> { aborted }
* GET /api/scan/current -> ScanProgress
* GET /api/scan/latest -> ScanRun
* GET /api/scan/{scanId} -> ScanRun
*/
export interface ScanProgress {
scanId: string
phase: string
pointIndex: number
totalPoints: number
completedPoints: number
percent: number
message: string
stageX: number
stageY: number
stageMoving: boolean
updatedAt: string
}
export interface ScanSegment {
deviceIndex: number
serialNumber: string
wavelengthStart: number
wavelengthEnd: number
pointCount: number
}
export interface ScanElement {
symbol: string
name: string
intensityLevel: string
abundance: number
rawAbundance: number
verdict: string
maxIntensity: number
matchedWavelength: number
matchedLines: number
}
export interface ScanPointResult {
index: number
pixelX: number
pixelY: number
stageX: number
stageY: number
succeeded: boolean
error: string | null
wavelengths: number[]
spectrum: number[]
segments: ScanSegment[]
elements: ScanElement[]
temperature: number
electronDensity: number
acquiredAt: string
}
export interface ScanRun {
scanId: string
status: string
startedAt: string
finishedAt: string | null
error: string | null
totalPoints: number
completedPoints: number
imageWidth: number
imageHeight: number
imageMimeType: string | null
imageBase64: string | null
points: ScanPointResult[]
}
export interface ScanStartResult {
scanId: string
totalPoints: number
}
/** 历史列表中的一条扫描记录(不含图片与光谱数据)。 */
export interface ScanHistoryItem {
scanId: string
status: string
startedAt: string
finishedAt: string | null
totalPoints: number
completedPoints: number
error: string | null
}
const API_BASE = (import.meta.env.VITE_API_BASE ?? '').replace(/\/$/, '')
const DEFAULT_TIMEOUT = 15000
const START_TIMEOUT = 60000
const RESULT_TIMEOUT = 30000
export class ScanApiError extends Error {
readonly status: number
constructor(message: string, status = 0) {
super(message)
this.name = 'ScanApiError'
this.status = status
}
}
async function request<T>(
path: string,
init?: RequestInit,
timeout = DEFAULT_TIMEOUT,
): Promise<T> {
const controller = new AbortController()
const timer = window.setTimeout(() => controller.abort(), 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 ScanApiError(detail, response.status)
}
return (await response.json()) as T
} catch (error) {
if (error instanceof ScanApiError) throw error
if (error instanceof DOMException && error.name === 'AbortError') {
throw new ScanApiError('扫描服务响应超时')
}
throw new ScanApiError(
error instanceof Error ? error.message : '无法连接扫描服务',
)
} finally {
window.clearTimeout(timer)
}
}
/** 开始一次扫描(后台任务,立即返回)。 */
export function startScan(): Promise<ScanStartResult> {
return request<ScanStartResult>(
'/api/scan/start',
{ method: 'POST' },
START_TIMEOUT,
)
}
/** 中止当前扫描:停止流程、丢弃数据并回零。 */
export function abortScan(): Promise<{ aborted: boolean }> {
return request<{ aborted: boolean }>('/api/scan/abort', { method: 'POST' })
}
export function getCurrentScan(): Promise<ScanProgress> {
return request<ScanProgress>('/api/scan/current')
}
export function getScan(scanId: string): Promise<ScanRun> {
return request<ScanRun>(
`/api/scan/${encodeURIComponent(scanId)}`,
undefined,
RESULT_TIMEOUT,
)
}
export function getLatestScan(): Promise<ScanRun> {
return request<ScanRun>('/api/scan/latest', undefined, RESULT_TIMEOUT)
}
/** 历史扫描记录列表(按开始时间倒序)。 */
export function getScanHistory(limit = 100): Promise<ScanHistoryItem[]> {
return request<ScanHistoryItem[]>(`/api/scan/history?limit=${limit}`)
}
/** 删除一条历史扫描记录及其采样点。 */
export function deleteScan(scanId: string): Promise<{ deleted: boolean }> {
return request<{ deleted: boolean }>(
`/api/scan/${encodeURIComponent(scanId)}`,
{ method: 'DELETE' },
)
}
export function getStageHubUrl(): string {
return `${API_BASE}/stageHub`
}
@@ -9,6 +9,7 @@ const emit = defineEmits<{
close: []
'system-config': []
ruler: []
history: []
}>()
const firstButton = ref<HTMLButtonElement | null>(null)
@@ -115,6 +116,35 @@ onBeforeUnmount(() => {
<span class="function-card__label">标尺设定</span>
<span class="function-card__desc">配置标尺与校准参数</span>
</button>
<button
class="function-card"
type="button"
@click="emit('history')"
>
<span class="function-card__icon" aria-hidden="true">
<svg viewBox="0 0 64 64">
<circle
cx="32"
cy="32"
r="22"
fill="none"
stroke="currentColor"
stroke-width="3"
/>
<path
d="M32 19v14l9 5"
fill="none"
stroke="currentColor"
stroke-width="3"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</span>
<span class="function-card__label">查看历史</span>
<span class="function-card__desc">浏览历史检测记录</span>
</button>
</div>
<button class="panel-card__close" type="button" @click="close">
@@ -134,57 +164,111 @@ onBeforeUnmount(() => {
display: grid;
place-items: center;
padding: 24px;
background: rgba(18, 33, 54, 0.44);
backdrop-filter: blur(5px);
background: rgba(3, 8, 18, 0.68);
backdrop-filter: blur(8px);
}
.panel-card {
width: 820px;
position: relative;
width: 980px;
padding: 42px 46px 34px;
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);
overflow: hidden;
border: 1px solid rgba(130, 175, 255, 0.2);
border-radius: 26px;
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
box-shadow:
0 40px 90px rgba(0, 6, 20, 0.6),
0 0 50px rgba(48, 118, 255, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
text-align: center;
}
.panel-card::before {
content: '';
position: absolute;
top: 0;
right: 48px;
left: 48px;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
pointer-events: none;
}
.panel-card__header h2 {
color: #1f2937;
color: #eef5ff;
font-size: 32px;
font-weight: 600;
letter-spacing: 2px;
text-shadow: 0 0 26px rgba(80, 150, 255, 0.28);
}
.panel-card__header p {
margin-top: 12px;
color: #778394;
color: rgba(158, 190, 226, 0.7);
font-size: 19px;
letter-spacing: 1px;
}
.panel-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 24px;
margin-top: 32px;
}
.function-card {
--accent-1: #6fb0ff;
--accent-2: #2f6fd0;
--accent-glow: rgba(70, 140, 255, 0.28);
--accent-line: rgba(111, 176, 255, 0.5);
position: relative;
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
padding: 30px 24px 28px;
border: 2px solid var(--line);
border-radius: 18px;
background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.09);
border-radius: 20px;
background:
radial-gradient(135% 105% at 106% -6%, var(--accent-glow) 0%, transparent 52%),
linear-gradient(
158deg,
rgba(255, 255, 255, 0.08) 0%,
rgba(255, 255, 255, 0.02) 58%,
rgba(255, 255, 255, 0.045) 100%
);
box-shadow:
0 18px 40px rgba(1, 8, 24, 0.42),
inset 0 1px 0 rgba(255, 255, 255, 0.1);
transition:
transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
border-color 0.25s ease,
box-shadow 0.25s ease;
}
.function-card:nth-child(2) {
--accent-1: #5ce3d6;
--accent-2: #109c91;
--accent-glow: rgba(40, 200, 188, 0.24);
--accent-line: rgba(92, 227, 214, 0.5);
}
.function-card:nth-child(3) {
--accent-1: #ffd166;
--accent-2: #e08f00;
--accent-glow: rgba(255, 176, 32, 0.24);
--accent-line: rgba(255, 203, 92, 0.5);
}
.function-card:hover {
border-color: #b9d1f3;
box-shadow: 0 16px 34px rgba(47, 111, 208, 0.16);
transform: translateY(-3px);
border-color: var(--accent-line);
box-shadow:
0 26px 52px rgba(1, 8, 24, 0.55),
0 0 0 1px var(--accent-glow),
0 0 34px var(--accent-glow),
inset 0 1px 0 rgba(255, 255, 255, 0.14);
transform: translateY(-4px);
}
.function-card__icon {
@@ -192,26 +276,34 @@ onBeforeUnmount(() => {
place-items: center;
width: 88px;
height: 88px;
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);
border-radius: 24px;
background: linear-gradient(150deg, var(--accent-1) 0%, var(--accent-2) 100%);
box-shadow:
0 14px 28px var(--accent-glow),
inset 0 1px 0 rgba(255, 255, 255, 0.4);
color: #f4f9ff;
transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.function-card__icon svg {
width: 48px;
height: 48px;
filter: drop-shadow(0 2px 6px rgba(4, 16, 40, 0.35));
}
.function-card:hover .function-card__icon {
transform: scale(1.06);
}
.function-card__label {
color: #1f2937;
color: #f3f8ff;
font-size: 26px;
font-weight: 600;
letter-spacing: 2px;
}
.function-card__desc {
color: var(--muted);
color: rgba(158, 190, 226, 0.6);
font-size: 17px;
letter-spacing: 0.5px;
}
@@ -220,18 +312,19 @@ onBeforeUnmount(() => {
width: 180px;
height: 54px;
margin-top: 30px;
border: 2px solid var(--line-strong);
border: 1px solid rgba(130, 175, 255, 0.28);
border-radius: 12px;
color: var(--ink-soft);
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
font-size: 19px;
font-weight: 600;
letter-spacing: 3px;
background: #fff;
transition: background 0.2s ease;
transition: background 0.2s ease, border-color 0.2s ease;
}
.panel-card__close:hover {
background: var(--surface-soft);
border-color: rgba(150, 205, 255, 0.5);
background: rgba(30, 66, 128, 0.6);
}
.function-panel-enter-active,
@@ -11,7 +11,10 @@ const emit = defineEmits<{
success: []
}>()
const password = ref('')
/** 默认填入测试密码,开发与正式环境均生效;上线前需改回空字符串 */
const DEFAULT_PASSWORD = '123456'
const password = ref(DEFAULT_PASSWORD)
const error = ref('')
const submitting = ref(false)
const inputElement = ref<HTMLInputElement | null>(null)
@@ -51,7 +54,7 @@ watch(
() => props.open,
async (open) => {
if (open) {
password.value = ''
password.value = DEFAULT_PASSWORD
error.value = ''
window.addEventListener('keydown', onKeydown)
await nextTick()
@@ -142,17 +145,21 @@ onBeforeUnmount(() => {
display: grid;
place-items: center;
padding: 24px;
background: rgba(18, 33, 54, 0.44);
backdrop-filter: blur(5px);
background: rgba(3, 8, 18, 0.68);
backdrop-filter: blur(8px);
}
.auth-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);
border: 1px solid rgba(130, 175, 255, 0.2);
border-radius: 26px;
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
box-shadow:
0 40px 90px rgba(0, 6, 20, 0.6),
0 0 50px rgba(48, 118, 255, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
color-scheme: dark;
text-align: center;
}
@@ -162,10 +169,13 @@ onBeforeUnmount(() => {
width: 86px;
height: 86px;
margin: 0 auto 24px;
border: 1px solid rgba(120, 200, 255, 0.3);
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);
background: rgba(70, 140, 255, 0.14);
box-shadow:
0 0 32px rgba(70, 140, 255, 0.22),
inset 0 1px 0 rgba(255, 255, 255, 0.1);
color: #7fe0ff;
}
.auth-card__icon svg {
@@ -174,15 +184,16 @@ onBeforeUnmount(() => {
}
.auth-card h2 {
color: #1f2937;
color: #eef5ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 1px;
text-shadow: 0 0 24px rgba(80, 150, 255, 0.28);
}
.auth-card p {
margin-top: 14px;
color: #778394;
color: rgba(158, 190, 226, 0.7);
font-size: 19px;
letter-spacing: 0.5px;
}
@@ -195,9 +206,11 @@ onBeforeUnmount(() => {
width: 100%;
height: 62px;
padding: 0 22px;
border: 2px solid var(--line-strong);
border: 1px solid rgba(130, 175, 255, 0.22);
border-radius: 12px;
color: var(--ink);
background: rgba(6, 14, 28, 0.7);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
color: #e8f2ff;
font-family: inherit;
font-size: 22px;
letter-spacing: 2px;
@@ -205,18 +218,24 @@ onBeforeUnmount(() => {
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auth-card__input::placeholder {
color: rgba(158, 190, 226, 0.4);
}
.auth-card__input:focus {
border-color: var(--blue);
box-shadow: 0 0 0 4px rgba(47, 111, 208, 0.14);
border-color: rgba(120, 200, 255, 0.55);
box-shadow:
0 0 0 4px rgba(70, 140, 255, 0.15),
0 0 24px rgba(70, 140, 255, 0.12);
}
.auth-card__input:disabled {
background: #f4f6f9;
background: rgba(4, 10, 22, 0.8);
}
.auth-card__error {
margin-top: 12px;
color: var(--red);
color: #ff9d9d;
font-size: 17px;
letter-spacing: 0.5px;
}
@@ -234,33 +253,45 @@ onBeforeUnmount(() => {
font-size: 20px;
font-weight: 600;
letter-spacing: 3px;
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
background 0.2s ease,
border-color 0.2s ease;
}
.auth-card__button:disabled {
cursor: default;
opacity: 0.65;
opacity: 0.5;
}
.auth-card__button--ghost {
border: 2px solid var(--line-strong);
color: var(--ink-soft);
background: #fff;
border: 1px solid rgba(130, 175, 255, 0.28);
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
}
.auth-card__button--ghost:hover:not(:disabled) {
background: var(--surface-soft);
border-color: rgba(150, 205, 255, 0.5);
background: rgba(30, 66, 128, 0.6);
}
.auth-card__button--primary {
color: #fff;
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
box-shadow: 0 10px 22px rgba(47, 111, 208, 0.28);
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
box-shadow:
0 14px 30px rgba(240, 172, 11, 0.28),
0 0 26px rgba(255, 190, 60, 0.16),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
color: #241500;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
}
.auth-card__button--primary:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: 0 14px 28px rgba(47, 111, 208, 0.36);
box-shadow:
0 18px 38px rgba(240, 172, 11, 0.36),
0 0 34px rgba(255, 190, 60, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
transform: translateY(-2px);
}
.auth-modal-enter-active,
+43 -13
View File
@@ -128,14 +128,30 @@ onMounted(async () => {
<style scoped>
.camera-card {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
border: 1px solid #d8e0e9;
border-radius: 18px;
background: #fff;
box-shadow: var(--shadow-card);
border: 1px solid rgba(130, 175, 255, 0.16);
border-radius: 26px;
background: linear-gradient(160deg, rgba(20, 38, 70, 0.55) 0%, rgba(7, 14, 30, 0.75) 100%);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.5),
inset 0 1px 0 rgba(255, 255, 255, 0.07);
backdrop-filter: blur(16px);
}
.camera-card::before {
content: '';
position: absolute;
top: 0;
right: 40px;
left: 40px;
z-index: 2;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.6), transparent);
pointer-events: none;
}
.camera-card__header {
@@ -143,28 +159,41 @@ onMounted(async () => {
flex: none;
align-items: center;
justify-content: space-between;
height: 76px;
height: 80px;
padding: 0 28px;
background: linear-gradient(180deg, #3d80e2 0%, #2f6fd0 100%);
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(120deg, rgba(26, 58, 112, 0.85) 0%, rgba(10, 24, 52, 0.8) 100%);
}
.camera-card__header h2 {
color: #fff;
display: flex;
align-items: center;
gap: 12px;
color: #eef5ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 3px;
text-shadow: 0 1px 3px rgba(16, 49, 101, 0.22);
text-shadow: 0 0 22px rgba(80, 150, 255, 0.3);
}
.camera-card__header h2::before {
content: '';
width: 4px;
height: 26px;
border-radius: 4px;
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
}
.camera-card__status {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 5px 12px;
border: 1px solid rgba(255, 255, 255, 0.24);
padding: 5px 14px;
border: 1px solid rgba(130, 195, 255, 0.28);
border-radius: 30px;
background: rgba(255, 255, 255, 0.12);
color: rgba(255, 255, 255, 0.92);
background: rgba(16, 40, 80, 0.5);
color: rgba(216, 236, 255, 0.9);
font-size: 15px;
letter-spacing: 1px;
}
@@ -196,7 +225,8 @@ onMounted(async () => {
position: relative;
flex: 1;
overflow: hidden;
background: #080d14;
background: #04070e;
box-shadow: inset 0 0 50px rgba(0, 4, 14, 0.6);
}
.camera-card__image {
+146 -57
View File
@@ -6,6 +6,8 @@ withDefaults(
title: string
tone: 'blue' | 'orange' | 'green' | 'teal'
icon: 'detect' | 'metal' | 'soil' | 'water'
caption?: string
index?: string
}>(),
{},
)
@@ -25,108 +27,195 @@ defineEmits<{
<span class="module-button__icon">
<ModuleIcon :name="icon" />
</span>
<span class="module-button__label">{{ title }}</span>
<span v-if="index" class="module-button__index">{{ index }}</span>
<span class="module-button__body">
<span class="module-button__label">{{ title }}</span>
<span v-if="caption" class="module-button__caption">{{ caption }}</span>
</span>
<span class="module-button__bar" aria-hidden="true"></span>
</button>
</template>
<style scoped>
.module-button {
--tone-1: #6fb0ff;
--tone-2: #2f6fd0;
--tone-glow: rgba(70, 140, 255, 0.28);
--tone-line: rgba(111, 176, 255, 0.55);
position: relative;
display: block;
height: 252px;
overflow: hidden;
border-radius: 18px;
border: 1px solid rgba(255, 255, 255, 0.09);
border-radius: 20px;
text-align: left;
background:
radial-gradient(135% 105% at 106% -6%, var(--tone-glow) 0%, transparent 52%),
linear-gradient(
158deg,
rgba(255, 255, 255, 0.08) 0%,
rgba(255, 255, 255, 0.02) 58%,
rgba(255, 255, 255, 0.045) 100%
);
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;
0 18px 40px rgba(1, 8, 24, 0.42),
inset 0 1px 0 rgba(255, 255, 255, 0.1);
transition:
transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
border-color 0.3s ease,
box-shadow 0.3s 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%);
inset: -40% -70%;
background: linear-gradient(
115deg,
transparent 42%,
rgba(255, 255, 255, 0.14) 50%,
transparent 58%
);
transform: translateX(-62%);
transition: transform 0.85s ease;
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 {
border-color: var(--tone-line);
box-shadow:
0 26px 52px rgba(1, 8, 24, 0.55),
0 0 0 1px var(--tone-glow),
0 0 34px var(--tone-glow),
inset 0 1px 0 rgba(255, 255, 255, 0.14);
transform: translateY(-6px);
}
.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:hover::before {
transform: translateX(62%);
}
.module-button:active {
transform: translateY(-1px) scale(0.995);
transform: translateY(-2px) 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%);
--tone-1: #6fb0ff;
--tone-2: #2f6fd0;
--tone-glow: rgba(70, 140, 255, 0.28);
--tone-line: rgba(111, 176, 255, 0.55);
}
.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%);
--tone-1: #ffd166;
--tone-2: #e08f00;
--tone-glow: rgba(255, 176, 32, 0.24);
--tone-line: rgba(255, 203, 92, 0.5);
}
.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%);
--tone-1: #a4e56f;
--tone-2: #4f9a26;
--tone-glow: rgba(118, 200, 60, 0.22);
--tone-line: rgba(164, 229, 111, 0.5);
}
.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%);
--tone-1: #5ce3d6;
--tone-2: #109c91;
--tone-glow: rgba(40, 200, 188, 0.24);
--tone-line: rgba(92, 227, 214, 0.5);
}
.module-button__icon {
position: absolute;
top: 24px;
left: 24px;
top: 26px;
left: 28px;
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);
width: 86px;
height: 86px;
border-radius: 22px;
color: #f4f9ff;
background: linear-gradient(150deg, var(--tone-1) 0%, var(--tone-2) 100%);
box-shadow:
0 14px 28px var(--tone-glow),
inset 0 1px 0 rgba(255, 255, 255, 0.4);
transition:
transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
box-shadow 0.3s ease;
}
.module-button__icon :deep(svg) {
width: 52px;
height: 52px;
filter: drop-shadow(0 2px 6px rgba(4, 16, 40, 0.35));
}
.module-button:hover .module-button__icon {
box-shadow:
0 18px 34px var(--tone-glow),
inset 0 1px 0 rgba(255, 255, 255, 0.45);
transform: scale(1.06);
}
.module-button__index {
position: absolute;
top: 24px;
right: 28px;
color: rgba(255, 255, 255, 0.1);
font-size: 46px;
font-variant-numeric: tabular-nums;
font-weight: 700;
letter-spacing: 2px;
line-height: 1;
}
.module-button__body {
position: absolute;
right: 28px;
bottom: 32px;
left: 28px;
display: flex;
flex-direction: column;
gap: 8px;
}
.module-button__label {
position: absolute;
right: 18px;
bottom: 44px;
left: 18px;
color: #fff;
font-size: 31px;
color: #f3f8ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 4px;
text-align: center;
text-shadow: 0 2px 5px rgba(33, 49, 79, 0.24);
letter-spacing: 3px;
line-height: 1.25;
text-shadow: 0 2px 12px rgba(2, 10, 30, 0.45);
}
.module-button__caption {
color: var(--tone-1);
font-size: 12px;
font-weight: 600;
letter-spacing: 2.6px;
opacity: 0.85;
text-transform: uppercase;
}
.module-button__bar {
position: absolute;
bottom: 0;
left: 0;
width: 42%;
height: 3px;
border-radius: 0 3px 3px 0;
background: linear-gradient(90deg, var(--tone-1), transparent);
opacity: 0.55;
transition: width 0.4s ease, opacity 0.3s ease;
}
.module-button:hover .module-button__bar {
width: 100%;
opacity: 1;
}
</style>
+22 -2
View File
@@ -4,13 +4,17 @@ withDefaults(
title: string
subtitle?: string
variant?: 'default' | 'process' | 'result'
theme?: 'light' | 'dark'
}>(),
{ variant: 'default' },
{ variant: 'default', theme: 'light' },
)
</script>
<template>
<header class="page-header" :class="`page-header--${variant}`">
<header
class="page-header"
:class="[`page-header--${variant}`, { 'page-header--dark': theme === 'dark' }]"
>
<div class="page-header__side">
<slot name="left" />
</div>
@@ -47,6 +51,22 @@ withDefaults(
height: 118px;
}
.page-header--dark {
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(180deg, rgba(8, 16, 34, 0.94) 0%, rgba(8, 16, 34, 0.6) 100%);
box-shadow: 0 14px 40px rgba(0, 6, 20, 0.32);
backdrop-filter: blur(18px);
}
.page-header--dark .page-header__center h1 {
color: #eef5ff;
text-shadow: 0 0 28px rgba(80, 150, 255, 0.3);
}
.page-header--dark .page-header__center p {
color: rgba(158, 190, 226, 0.7);
}
.page-header__side {
display: flex;
align-items: center;
@@ -227,14 +227,16 @@ onMounted(() => {
height: 100%;
padding: 24px 24px 18px;
overflow: hidden;
border-radius: 20px;
border: 1px solid rgba(130, 180, 255, 0.2);
border-radius: 26px;
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%);
radial-gradient(ellipse 80% 60% at 82% 8%, rgba(106, 168, 255, 0.4), transparent 62%),
linear-gradient(150deg, #1f4fa8 0%, #173c86 48%, #0f2a5e 100%);
box-shadow:
0 18px 46px rgba(37, 89, 173, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.24);
0 24px 60px rgba(3, 12, 34, 0.55),
0 0 40px rgba(48, 118, 255, 0.18),
inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.principle::before {
@@ -291,8 +293,10 @@ onMounted(() => {
position: relative;
flex: 1;
overflow: hidden;
border-radius: 14px;
background: #255bb3;
border-radius: 16px;
border: 1px solid rgba(130, 180, 255, 0.16);
background: #0b1f45;
box-shadow: inset 0 0 40px rgba(3, 12, 34, 0.55);
touch-action: none;
cursor: grab;
user-select: none;
+42 -6
View File
@@ -1,11 +1,15 @@
<script setup lang="ts">
import { computed } from 'vue'
const props = defineProps<{
progress: number
label: string
note?: string
}>()
const props = withDefaults(
defineProps<{
progress: number
label: string
note?: string
theme?: 'light' | 'dark'
}>(),
{ theme: 'light' },
)
const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
</script>
@@ -14,6 +18,7 @@ const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
<div class="progress-strip">
<div
class="progress-strip__track"
:class="{ 'progress-strip__track--dark': theme === 'dark' }"
role="progressbar"
:aria-valuenow="Math.round(clamped)"
aria-valuemin="0"
@@ -29,7 +34,11 @@ const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
</span>
</div>
<span v-if="note" class="progress-strip__note">{{ note }}</span>
<span
v-if="note"
class="progress-strip__note"
:class="{ 'progress-strip__note--dark': theme === 'dark' }"
>{{ note }}</span>
</div>
</template>
@@ -89,4 +98,31 @@ const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
letter-spacing: 1px;
text-align: right;
}
.progress-strip__track--dark {
border-color: rgba(130, 175, 255, 0.18);
background: rgba(7, 16, 34, 0.75);
box-shadow: inset 0 2px 10px rgba(0, 4, 16, 0.6);
}
.progress-strip__track--dark .progress-strip__fill {
border-radius: 9px;
background:
linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 24%),
linear-gradient(180deg, #6fc6ff 0%, #3f86f0 55%, #2c63c9 100%);
box-shadow: 0 0 22px rgba(80, 170, 255, 0.45);
}
.progress-strip__track--dark .progress-strip__label {
color: rgba(170, 205, 240, 0.75);
}
.progress-strip__track--dark .progress-strip__label--on-fill {
color: #f2fbff;
text-shadow: 0 2px 8px rgba(4, 24, 60, 0.6);
}
.progress-strip__note--dark {
color: rgba(158, 190, 226, 0.72);
}
</style>
+31 -11
View File
@@ -201,19 +201,34 @@ const markers = [
<style scoped>
.scan-visual {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
padding: 10px 16px 16px;
overflow: hidden;
border: 1px solid #1e55a4;
border-radius: 18px;
border: 1px solid rgba(130, 175, 255, 0.18);
border-radius: 26px;
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%);
radial-gradient(ellipse 70% 55% at 50% 0%, rgba(70, 140, 255, 0.18), transparent 70%),
linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
box-shadow:
0 18px 44px rgba(31, 77, 147, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.22);
0 30px 70px rgba(0, 10, 32, 0.5),
0 0 40px rgba(48, 118, 255, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
}
.scan-visual::before {
content: '';
position: absolute;
top: 0;
right: 40px;
left: 40px;
z-index: 2;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
pointer-events: none;
}
.scan-visual__bar {
@@ -255,9 +270,12 @@ const markers = [
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);
border: 1px solid rgba(130, 195, 255, 0.26);
border-radius: 16px;
background:
radial-gradient(circle at 50% 42%, rgba(40, 90, 160, 0.32), transparent 68%),
rgba(4, 10, 22, 0.62);
box-shadow: inset 0 0 60px rgba(0, 4, 14, 0.7);
}
.scan-visual__stage svg {
@@ -280,7 +298,8 @@ const markers = [
z-index: 3;
width: 30px;
height: 30px;
border: 2px solid rgba(255, 255, 255, 0.9);
border: 2px solid rgba(150, 225, 255, 0.78);
filter: drop-shadow(0 0 6px rgba(90, 200, 255, 0.35));
}
.scan-visual__corner--tl {
@@ -318,7 +337,8 @@ const markers = [
width: 5px;
height: 54px;
border-radius: 4px;
background: rgba(255, 255, 255, 0.82);
background: rgba(150, 225, 255, 0.72);
box-shadow: 0 0 12px rgba(90, 200, 255, 0.4);
transform: translateY(-50%);
}
+281 -123
View File
@@ -1,100 +1,216 @@
<script setup lang="ts">
import { computed } from 'vue'
import type { ScanSegment } from '@/api/scan'
interface ChartLabel {
element: string
wavelength: number
}
const props = withDefaults(
defineProps<{
wavelengths?: number[]
spectrum?: number[]
segments?: ScanSegment[]
labels?: ChartLabel[]
statusText?: string
/** 紧凑模式:在较小的容器中放大字号,保证刻度与标注可读。 */
compact?: boolean
}>(),
{
wavelengths: () => [],
spectrum: () => [],
segments: () => [],
labels: () => [],
statusText: '',
compact: false,
},
)
const fontScale = computed(() => (props.compact ? 1.55 : 1))
const fs = (size: number) => Math.round(size * fontScale.value)
const width = 1360
const height = 720
const pad = { left: 112, right: 44, top: 74, bottom: 88 }
const MAX_POINTS = 900
const DEFAULT_RANGE = { min: 380, max: 700 }
const xMin = 380
const xMax = 700
const yMin = 0
const yMax = 36
const hasData = computed(
() =>
props.wavelengths.length > 1 &&
props.spectrum.length === props.wavelengths.length,
)
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 range = computed(() => {
if (!hasData.value) return DEFAULT_RANGE
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)
let min = Number.POSITIVE_INFINITY
let max = Number.NEGATIVE_INFINITY
for (const value of props.wavelengths) {
if (value < min) min = value
if (value > max) max = value
}
return Math.max(0.2, value)
}
if (!Number.isFinite(min) || !Number.isFinite(max) || max <= min) {
return DEFAULT_RANGE
}
const curve = computed(() => {
const count = 620
const points: Array<{ x: number; y: number }> = []
const margin = (max - min) * 0.01
return { min: min - margin, max: max + margin }
})
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)) })
const maxIntensity = computed(() => {
let max = 0
for (const value of props.spectrum) {
if (value > max) max = value
}
return max > 0 ? max : 1
})
/** 按桶取最大值降采样,保留谱峰形状。 */
const sampled = computed(() => {
if (!hasData.value) return []
const wavelengths = props.wavelengths
const spectrum = props.spectrum
const step = Math.max(1, Math.ceil(wavelengths.length / MAX_POINTS))
const points: Array<{ wavelength: number; intensity: number }> = []
for (let start = 0; start < wavelengths.length; start += step) {
const end = Math.min(start + step, wavelengths.length)
let best = start
for (let index = start + 1; index < end; index += 1) {
if (spectrum[index] > spectrum[best]) best = index
}
points.push({
wavelength: wavelengths[best],
intensity: spectrum[best],
})
}
return points
})
function toX(wavelength: number) {
const { min, max } = range.value
return (
pad.left +
((wavelength - min) / (max - min)) * (width - pad.left - pad.right)
)
}
function toY(intensity: number) {
const ratio = Math.max(0, intensity) / maxIntensity.value
return height - pad.bottom - ratio * (height - pad.top - pad.bottom)
}
const linePath = computed(() =>
curve.value
.map((point, index) => `${index === 0 ? 'M' : 'L'}${point.x.toFixed(2)} ${point.y.toFixed(2)}`)
sampled.value
.map(
(point, index) =>
`${index === 0 ? 'M' : 'L'}${toX(point.wavelength).toFixed(2)} ${toY(point.intensity).toFixed(2)}`,
)
.join(' '),
)
const areaPath = computed(() => {
if (sampled.value.length < 2) return ''
const first = sampled.value[0]
const last = sampled.value[sampled.value.length - 1]
const bottom = height - pad.bottom
return `${linePath.value} L${toX(xMax).toFixed(2)} ${bottom} L${toX(xMin).toFixed(2)} ${bottom} Z`
return `${linePath.value} L${toX(last.wavelength).toFixed(2)} ${bottom} L${toX(first.wavelength).toFixed(2)} ${bottom} Z`
})
const yTicks = [0, 10, 20, 30]
const xTicks = [400, 450, 500, 550, 600, 650]
function niceStep(rangeValue: number, count: number) {
const rough = rangeValue / Math.max(1, count)
if (!Number.isFinite(rough) || rough <= 0) return 1
const power = 10 ** Math.floor(Math.log10(rough))
const fraction = rough / power
const nice = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10
return nice * power
}
const xTicks = computed(() => {
const step = niceStep(range.value.max - range.value.min, 6)
const start = Math.ceil(range.value.min / step) * step
const ticks: number[] = []
for (let value = start; value <= range.value.max + step * 1e-6; value += step) {
ticks.push(Number(value.toFixed(6)))
}
return ticks
})
const yTicks = computed(() => {
const step = niceStep(maxIntensity.value, 4)
const ticks: number[] = []
for (let value = 0; value <= maxIntensity.value + step * 1e-6; value += step) {
ticks.push(value)
}
return ticks
})
function formatNumber(value: number) {
if (Math.abs(value) >= 100) return value.toFixed(0)
if (Math.abs(value) >= 10) return value.toFixed(0)
if (Math.abs(value) >= 1) return value.toFixed(1)
return value.toFixed(2)
}
function intensityAt(wavelength: number) {
const wavelengths = props.wavelengths
if (wavelengths.length === 0) return 0
let low = 0
let high = wavelengths.length - 1
while (low < high) {
const mid = (low + high) >> 1
if (wavelengths[mid] < wavelength) low = mid + 1
else high = mid
}
const index = low
const previous = Math.max(0, index - 1)
return Math.max(props.spectrum[previous] ?? 0, props.spectrum[index] ?? 0)
}
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 }
}),
props.labels
.filter(
(label) =>
label.wavelength >= range.value.min &&
label.wavelength <= range.value.max,
)
.map((label, index) => {
const x = toX(label.wavelength)
const y = toY(intensityAt(label.wavelength))
const lift = fs(48) + (index % 2) * fs(58)
const labelX = Math.min(
Math.max(x, pad.left + fs(44)),
width - pad.right - fs(44),
)
return {
...label,
x,
y,
labelX,
labelY: Math.max(pad.top + fs(26), y - lift),
}
}),
)
/** 拼接光谱的段边界,用虚线提示换段位置。 */
const boundaryXs = computed(() =>
props.segments
.slice(1)
.map((segment) => toX(segment.wavelengthStart))
.filter((x) => x > pad.left && x < width - pad.right),
)
</script>
@@ -105,7 +221,7 @@ const peakLabels = computed(() =>
:viewBox="`0 0 ${width} ${height}`"
preserveAspectRatio="xMidYMid meet"
role="img"
aria-label="光谱采集图表"
aria-label="光谱图表"
>
<defs>
<linearGradient id="spectrumStroke" x1="0" y1="0" x2="1" y2="0">
@@ -115,15 +231,15 @@ const peakLabels = computed(() =>
<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="0" stop-color="#4d8dff" stop-opacity="0.16" />
<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" />
<rect width="1360" height="720" fill="#050c1a" />
<rect width="1360" height="720" fill="url(#spectrumArea)" />
<g stroke="rgba(255,255,255,0.24)" stroke-width="1">
<g stroke="rgba(130, 175, 255, 0.16)" stroke-width="1">
<line
v-for="tick in yTicks"
:key="`grid-y-${tick}`"
@@ -131,7 +247,7 @@ const peakLabels = computed(() =>
:x2="width - pad.right"
:y1="toY(tick)"
:y2="toY(tick)"
stroke-dasharray="3 5"
stroke-dasharray="3 6"
/>
<line
v-for="tick in xTicks"
@@ -140,33 +256,33 @@ const peakLabels = computed(() =>
:x2="toX(tick)"
:y1="pad.top"
:y2="height - pad.bottom"
opacity="0.55"
opacity="0.6"
/>
</g>
<g fill="rgba(255,255,255,0.72)" font-size="21" text-anchor="end">
<g fill="rgba(158, 190, 226, 0.72)" :font-size="fs(21)" text-anchor="end">
<text
v-for="tick in yTicks"
:key="`label-y-${tick}`"
:x="pad.left - 20"
:y="toY(tick) + 7"
>
{{ tick }}
{{ formatNumber(tick) }}
</text>
</g>
<g fill="rgba(255,255,255,0.74)" font-size="19" text-anchor="middle">
<g fill="rgba(158, 190, 226, 0.72)" :font-size="fs(19)" text-anchor="middle">
<text
v-for="tick in xTicks"
:key="`label-x-${tick}`"
:x="toX(tick)"
:y="height - pad.bottom + 34"
>
{{ tick }}
{{ formatNumber(tick) }}
</text>
</g>
<g stroke="rgba(255,255,255,0.8)" stroke-width="1.6">
<g stroke="rgba(130, 195, 255, 0.4)" stroke-width="1.6">
<line :x1="pad.left" :x2="pad.left" :y1="pad.top" :y2="height - pad.bottom" />
<line
:x1="pad.left"
@@ -176,7 +292,7 @@ const peakLabels = computed(() =>
/>
</g>
<g fill="rgba(255,255,255,0.85)" font-size="22">
<g fill="rgba(158, 190, 226, 0.65)" :font-size="fs(22)">
<text x="24" y="58">a.u.</text>
<text
x="34"
@@ -190,53 +306,80 @@ const peakLabels = computed(() =>
<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-if="hasData">
<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>
<g v-for="label in peakLabels" :key="label.element">
<g v-if="hasData" stroke="rgba(255, 214, 120, 0.5)" stroke-width="1.2">
<line
v-for="x in boundaryXs"
:key="`boundary-${x}`"
:x1="x"
:x2="x"
:y1="pad.top"
:y2="height - pad.bottom"
stroke-dasharray="6 8"
/>
</g>
<g v-for="label in peakLabels" :key="`${label.element}-${label.wavelength}`">
<line
:x1="label.labelX"
:x2="label.x"
:y1="label.labelY + 33"
:y1="label.labelY + fs(33)"
:y2="label.y - 8"
stroke="rgba(255,255,255,0.62)"
stroke="rgba(150, 210, 255, 0.5)"
stroke-width="1.3"
stroke-dasharray="3 4"
/>
<circle :cx="label.x" :cy="label.y - 8" r="3.4" fill="#ffffff" opacity="0.92" />
<circle :cx="label.x" :cy="label.y - 8" r="3.4" fill="#bff3ff" />
<text
:x="label.labelX"
:y="label.labelY"
fill="#ffffff"
font-size="34"
fill="#eaf6ff"
:font-size="fs(34)"
font-weight="500"
text-anchor="middle"
filter="drop-shadow(0 0 8px rgba(110, 200, 255, 0.5))"
>
{{ label.element }}
</text>
<text
:x="label.labelX"
:y="label.labelY + 33"
fill="#ffffff"
font-size="24"
:y="label.labelY + fs(33)"
fill="rgba(180, 220, 255, 0.85)"
:font-size="fs(24)"
text-anchor="middle"
>
{{ label.wavelength }}
{{ label.wavelength.toFixed(2) }} nm
</text>
</g>
<text
v-if="!hasData && statusText"
:x="width / 2"
:y="height / 2"
fill="rgba(180, 210, 240, 0.8)"
:font-size="fs(36)"
font-weight="500"
text-anchor="middle"
>
{{ statusText }}
</text>
</svg>
<div class="spectrum-chart__status">
<div v-if="hasData && statusText" class="spectrum-chart__status">
<span class="spectrum-chart__pulse"></span>
光谱采集进行中
{{ statusText }}
</div>
</div>
</template>
@@ -246,14 +389,28 @@ const peakLabels = computed(() =>
position: relative;
height: 100%;
overflow: hidden;
border: 1px solid #1e55a4;
border-radius: 16px;
border: 1px solid rgba(130, 175, 255, 0.18);
border-radius: 26px;
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%);
radial-gradient(ellipse 70% 55% at 72% 8%, rgba(70, 140, 255, 0.16), transparent 68%),
linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(5, 12, 26, 0.88) 100%);
box-shadow:
0 18px 44px rgba(31, 77, 147, 0.24),
inset 0 1px 0 rgba(255, 255, 255, 0.18);
0 30px 70px rgba(0, 10, 32, 0.5),
0 0 40px rgba(48, 118, 255, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
}
.spectrum-chart::before {
content: '';
position: absolute;
top: 0;
right: 40px;
left: 40px;
z-index: 2;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
pointer-events: none;
}
.spectrum-chart__svg {
@@ -263,26 +420,27 @@ const peakLabels = computed(() =>
.spectrum-chart__status {
position: absolute;
top: 49%;
left: 50%;
right: 32px;
bottom: 26px;
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;
gap: 10px;
padding: 8px 16px;
border: 1px solid rgba(130, 195, 255, 0.26);
border-radius: 30px;
background: rgba(10, 26, 52, 0.6);
color: rgba(220, 238, 255, 0.92);
font-size: 18px;
letter-spacing: 1px;
backdrop-filter: blur(8px);
}
.spectrum-chart__pulse {
width: 10px;
height: 10px;
width: 9px;
height: 9px;
border-radius: 50%;
background: #8df6ff;
box-shadow: 0 0 14px rgba(141, 246, 255, 0.85);
box-shadow: 0 0 12px rgba(141, 246, 255, 0.85);
animation: chart-pulse 1.8s ease-in-out infinite;
}
+18 -2
View File
@@ -3,13 +3,14 @@ withDefaults(
defineProps<{
items: string[]
icon?: 'laser' | 'info'
theme?: 'light' | 'dark'
}>(),
{ icon: undefined },
{ icon: undefined, theme: 'light' },
)
</script>
<template>
<footer class="status-footer">
<footer class="status-footer" :class="{ 'status-footer--dark': theme === 'dark' }">
<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" />
@@ -71,4 +72,19 @@ withDefaults(
.status-footer__sep {
color: #c5cdd8;
}
.status-footer--dark {
border-top: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(180deg, rgba(8, 16, 34, 0.55) 0%, rgba(5, 10, 22, 0.94) 100%);
color: rgba(178, 202, 232, 0.72);
backdrop-filter: blur(14px);
}
.status-footer--dark .status-footer__icon {
color: rgba(120, 190, 255, 0.8);
}
.status-footer--dark .status-footer__sep {
color: rgba(120, 160, 210, 0.35);
}
</style>
+8 -2
View File
@@ -1,13 +1,19 @@
import { onBeforeUnmount, onMounted, ref } from 'vue'
/** 秒级倒计时,归零时只触发一次回调。 */
export function useCountdown(seconds: number, onComplete: () => void) {
/** 秒级倒计时,归零时只触发一次回调;enabled 为 false 时不启动计时。 */
export function useCountdown(
seconds: number,
onComplete: () => void,
enabled = true,
) {
const remaining = ref(seconds)
let timer: number | undefined
let finished = false
onMounted(() => {
if (!enabled) return
timer = window.setInterval(() => {
remaining.value = Math.max(0, remaining.value - 1)
+162
View File
@@ -0,0 +1,162 @@
import { onBeforeUnmount, ref } from 'vue'
import {
HubConnectionBuilder,
HubConnectionState,
LogLevel,
type HubConnection,
} from '@microsoft/signalr'
import {
getStageHubUrl,
type ScanProgress,
type ScanSegment,
} from '@/api/scan'
import type { DeviceStatus } from '@/api/device'
export interface StagePosition {
x: number
y: number
z: number
moving: boolean
updatedAt: string
}
export interface ScanSpectrum {
scanId: string
pointIndex: number
totalPoints: number
wavelengths: number[]
spectrum: number[]
segments: ScanSegment[]
}
export interface ScanFinished {
scanId: string
status: string
error: string | null
}
export type StageHubState = 'idle' | 'connecting' | 'connected' | 'offline'
/**
* 扫描实时通道(/stageHub)。
* 事件契约见 HardwareWeb/Services/StageBroadcastService.cs:
* StagePosition -> { x, y, z, moving, updatedAt }
* ScanProgress -> ScanProgress
* ScanSpectrum -> { scanId, pointIndex, wavelengths, spectrum, segments }
* ScanFinished -> { scanId, status, error }
* DeviceStatus -> DeviceStatus
*/
export function useStageHub() {
const state = ref<StageHubState>('idle')
const position = ref<StagePosition | null>(null)
const progress = ref<ScanProgress | null>(null)
const spectrum = ref<ScanSpectrum | null>(null)
const finished = ref<ScanFinished | null>(null)
const deviceStatus = ref<DeviceStatus | null>(null)
const errorMessage = ref('')
let connection: HubConnection | null = null
let stoppedByUser = false
async function connect() {
if (connection && connection.state !== HubConnectionState.Disconnected) {
return
}
stoppedByUser = false
state.value = 'connecting'
errorMessage.value = ''
const hub = new HubConnectionBuilder()
.withUrl(getStageHubUrl(), { withCredentials: false })
.withAutomaticReconnect({
nextRetryDelayInMilliseconds: (context) =>
Math.min(1000 * 2 ** context.previousRetryCount, 10000),
})
.configureLogging(LogLevel.Warning)
.build()
hub.on('StagePosition', (payload: StagePosition) => {
position.value = payload
})
hub.on('ScanProgress', (payload: ScanProgress) => {
progress.value = payload
})
hub.on('ScanSpectrum', (payload: ScanSpectrum) => {
spectrum.value = payload
})
hub.on('ScanFinished', (payload: ScanFinished) => {
finished.value = payload
})
hub.on('DeviceStatus', (payload: DeviceStatus) => {
deviceStatus.value = payload
})
hub.onreconnecting(() => {
state.value = 'connecting'
})
hub.onreconnected(async () => {
state.value = 'connected'
await syncSnapshot(hub)
})
hub.onclose(() => {
if (stoppedByUser) return
state.value = 'offline'
})
connection = hub
try {
await hub.start()
state.value = 'connected'
await syncSnapshot(hub)
} catch (error) {
state.value = 'offline'
errorMessage.value =
error instanceof Error ? error.message : '实时通道连接失败'
connection = null
await hub.stop().catch(() => undefined)
}
}
async function syncSnapshot(hub: HubConnection) {
try {
const current = await hub.invoke<ScanProgress>('GetScanProgress')
progress.value = current
} catch {
// 快照失败不影响实时事件
}
try {
const current = await hub.invoke<StagePosition | null>('GetStagePosition')
if (current) position.value = current
} catch {
// 位移台未连接时返回 null
}
}
async function disconnect() {
stoppedByUser = true
const hub = connection
connection = null
state.value = 'idle'
if (hub) {
await hub.stop().catch(() => undefined)
}
}
onBeforeUnmount(() => {
void disconnect()
})
return {
state,
position,
progress,
spectrum,
finished,
deviceStatus,
errorMessage,
connect,
disconnect,
}
}
+12
View File
@@ -35,6 +35,18 @@ const router = createRouter({
component: () => import('@/views/ResultView.vue'),
meta: { title: '检测完成' },
},
{
path: '/history',
name: 'history',
component: () => import('@/views/HistoryView.vue'),
meta: { title: '检测历史', requiresAdmin: true },
},
{
path: '/history/:scanId',
name: 'historyDetail',
component: () => import('@/views/ResultView.vue'),
meta: { title: '历史检测详情', requiresAdmin: true },
},
{
path: '/pay',
redirect: { name: 'sample' },
+841
View File
@@ -0,0 +1,841 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import AppStage from '@/components/AppStage.vue'
import PageHeader from '@/components/PageHeader.vue'
import { getScanHistory, deleteScan, type ScanHistoryItem } from '@/api/scan'
import { showToast } from '@/composables/useToast'
const router = useRouter()
const items = ref<ScanHistoryItem[]>([])
const loading = ref(true)
const error = ref('')
const deleteTarget = ref<ScanHistoryItem | null>(null)
const removing = ref(false)
function goHome() {
void router.replace({ name: 'home' })
}
function openDetail(item: ScanHistoryItem) {
void router.push({ name: 'historyDetail', params: { scanId: item.scanId } })
}
function askDelete(item: ScanHistoryItem) {
if (removing.value) return
deleteTarget.value = item
}
function cancelDelete() {
if (removing.value) return
deleteTarget.value = null
}
async function confirmDelete() {
const target = deleteTarget.value
if (!target || removing.value) return
removing.value = true
try {
await deleteScan(target.scanId)
items.value = items.value.filter((item) => item.scanId !== target.scanId)
deleteTarget.value = null
showToast('检测记录已删除')
} catch (err) {
showToast(err instanceof Error ? err.message : '删除检测记录失败')
} finally {
removing.value = false
}
}
async function load() {
loading.value = true
error.value = ''
try {
items.value = await getScanHistory()
} catch (err) {
error.value = err instanceof Error ? err.message : '读取历史记录失败'
showToast(error.value)
} finally {
loading.value = false
}
}
function statusLabel(status: string) {
switch (status) {
case 'Completed':
return '已完成'
case 'Failed':
return '失败'
case 'Aborted':
return '已中止'
default:
return '进行中'
}
}
function statusTone(status: string) {
switch (status) {
case 'Completed':
return 'is-completed'
case 'Failed':
return 'is-failed'
case 'Aborted':
return 'is-aborted'
default:
return ''
}
}
function formatTime(value: string | null) {
if (!value) return '—'
const date = new Date(value)
if (Number.isNaN(date.getTime())) return '—'
return date.toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-')
}
function formatDuration(item: ScanHistoryItem) {
if (!item.finishedAt) return '—'
const start = new Date(item.startedAt).getTime()
const end = new Date(item.finishedAt).getTime()
if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) return '—'
const seconds = Math.round((end - start) / 1000)
if (seconds < 60) return `${seconds} 秒`
const minutes = Math.floor(seconds / 60)
const rest = seconds % 60
return rest === 0 ? `${minutes} 分` : `${minutes} 分 ${rest} 秒`
}
onMounted(() => {
void load()
})
</script>
<template>
<AppStage>
<div class="history-bg" aria-hidden="true">
<span class="history-bg__orb history-bg__orb--blue"></span>
<span class="history-bg__orb history-bg__orb--cyan"></span>
<span class="history-bg__orb history-bg__orb--violet"></span>
</div>
<PageHeader
title="检测历史"
subtitle="查看已保存的扫描记录与检测结果"
theme="dark"
>
<template #left>
<button class="admin-back" type="button" @click="goHome">
返回
</button>
</template>
</PageHeader>
<main class="history-main">
<section class="history-card">
<header class="history-card__header">
<div class="history-card__heading">
<span class="history-card__eyebrow">Scan History</span>
<h2>检测记录</h2>
</div>
<div class="history-card__actions">
<span class="history-card__count">共 {{ items.length }} 条</span>
<button
class="history-refresh"
type="button"
:disabled="loading"
@click="load"
>
{{ loading ? '加载中...' : '刷新' }}
</button>
</div>
</header>
<div class="history-table">
<div class="history-table__head">
<span>检测时间</span>
<span>状态</span>
<span>采样点</span>
<span>耗时</span>
<span>记录编号</span>
<span>操作</span>
</div>
<div class="history-table__body">
<div
v-for="item in items"
:key="item.scanId"
class="history-row"
@click="openDetail(item)"
>
<span class="history-row__time">{{ formatTime(item.startedAt) }}</span>
<span>
<span class="history-status" :class="statusTone(item.status)">
{{ statusLabel(item.status) }}
</span>
</span>
<span class="history-row__points">
{{ item.completedPoints }} / {{ item.totalPoints }}
</span>
<span class="history-row__duration">{{ formatDuration(item) }}</span>
<span class="history-row__id" :title="item.scanId">{{ item.scanId }}</span>
<span class="history-row__actions">
<button
class="row-action row-action--view"
type="button"
@click.stop="openDetail(item)"
>
查看
</button>
<button
class="row-action row-action--danger"
type="button"
@click.stop="askDelete(item)"
>
删除
</button>
</span>
</div>
<div v-if="!items.length" class="history-empty">
<template v-if="error">
<p>{{ error }}</p>
<button class="history-empty__retry" type="button" @click="load">
重新加载
</button>
</template>
<p v-else-if="loading">正在读取历史记录...</p>
<p v-else>暂无历史检测记录</p>
</div>
</div>
</div>
<footer class="history-footer">
按开始时间倒序显示,最多 100 条记录 · 点击任意记录查看靶面图与光谱分析结果
</footer>
</section>
</main>
<Teleport to="body">
<Transition name="delete-modal">
<div v-if="deleteTarget" class="delete-backdrop" @click.self="cancelDelete">
<section
class="delete-card"
role="dialog"
aria-modal="true"
aria-label="删除检测记录"
>
<div class="delete-card__icon" aria-hidden="true">
<svg viewBox="0 0 64 64">
<path
d="M20 22h24M26 22v-4h12v4M24 22l2 28h12l2-28"
fill="none"
stroke="currentColor"
stroke-width="3"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M29 30v12M35 30v12"
fill="none"
stroke="currentColor"
stroke-width="3"
stroke-linecap="round"
/>
</svg>
</div>
<h2>删除检测记录</h2>
<p>
确定删除 <strong>{{ formatTime(deleteTarget.startedAt) }}</strong> 的检测记录吗?
</p>
<p class="delete-card__hint">
靶面图、光谱数据与元素分析结果将一并删除,删除后无法恢复。
</p>
<div class="delete-card__actions">
<button
class="delete-button delete-button--ghost"
type="button"
:disabled="removing"
@click="cancelDelete"
>
取消
</button>
<button
class="delete-button delete-button--danger"
type="button"
:disabled="removing"
@click="confirmDelete"
>
{{ removing ? '删除中...' : '删除' }}
</button>
</div>
</section>
</div>
</Transition>
</Teleport>
</AppStage>
</template>
<style scoped>
.history-bg {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
background:
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
}
.history-bg::before {
content: '';
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
background-size: 64px 64px;
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
}
.history-bg__orb {
position: absolute;
border-radius: 50%;
filter: blur(100px);
animation: history-orb-drift 16s ease-in-out infinite alternate;
}
.history-bg__orb--blue {
top: -340px;
left: -160px;
width: 760px;
height: 760px;
background: rgba(48, 118, 255, 0.3);
}
.history-bg__orb--cyan {
top: -200px;
right: -220px;
width: 640px;
height: 640px;
background: rgba(0, 214, 255, 0.18);
animation-delay: -5s;
}
.history-bg__orb--violet {
bottom: -360px;
left: 36%;
width: 700px;
height: 700px;
background: rgba(124, 92, 255, 0.18);
animation-delay: -10s;
}
@keyframes history-orb-drift {
from {
transform: translate3d(0, 0, 0) scale(1);
}
to {
transform: translate3d(42px, 30px, 0) scale(1.08);
}
}
.admin-back {
width: 132px;
height: 60px;
border: 1px solid rgba(130, 190, 255, 0.35);
border-radius: 12px;
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
font-size: 24px;
font-weight: 600;
letter-spacing: 3px;
backdrop-filter: blur(10px);
transition:
transform 0.2s ease,
border-color 0.2s ease,
background 0.2s ease;
}
.admin-back:hover {
border-color: rgba(150, 205, 255, 0.55);
background: rgba(30, 66, 128, 0.65);
transform: translateY(-1px);
}
.history-main {
position: absolute;
top: 176px;
right: 44px;
bottom: 40px;
left: 44px;
}
.history-card {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
border: 1px solid rgba(130, 175, 255, 0.18);
border-radius: 26px;
background: linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.5),
0 0 40px rgba(48, 118, 255, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
}
.history-card::before {
content: '';
position: absolute;
top: 0;
right: 40px;
left: 40px;
z-index: 2;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
pointer-events: none;
}
.history-card__header {
display: flex;
flex: none;
align-items: center;
justify-content: space-between;
height: 110px;
padding: 0 32px;
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(120deg, rgba(26, 58, 112, 0.24) 0%, transparent 70%);
}
.history-card__heading {
display: flex;
flex-direction: column;
gap: 6px;
}
.history-card__eyebrow {
color: #5aa2ff;
font-size: 12px;
font-weight: 600;
letter-spacing: 2.6px;
text-transform: uppercase;
}
.history-card__header h2 {
display: flex;
align-items: center;
gap: 12px;
color: #eaf3ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 3px;
}
.history-card__header h2::before {
content: '';
width: 4px;
height: 26px;
border-radius: 4px;
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
}
.history-card__actions {
display: flex;
align-items: center;
gap: 14px;
}
.history-card__count {
padding: 6px 16px;
border: 1px solid rgba(130, 195, 255, 0.28);
border-radius: 30px;
background: rgba(16, 40, 80, 0.5);
color: #9fe8ff;
font-size: 16px;
letter-spacing: 1px;
}
.history-refresh {
height: 48px;
padding: 0 24px;
border: 1px solid rgba(130, 175, 255, 0.28);
border-radius: 12px;
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
font-size: 18px;
font-weight: 600;
letter-spacing: 2px;
transition:
transform 0.2s ease,
border-color 0.2s ease,
background 0.2s ease;
}
.history-refresh:hover:not(:disabled) {
border-color: rgba(150, 205, 255, 0.5);
background: rgba(30, 66, 128, 0.6);
transform: translateY(-1px);
}
.history-refresh:disabled {
cursor: default;
opacity: 0.55;
}
.history-table {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
padding: 0 32px;
}
.history-table__head,
.history-row {
display: grid;
grid-template-columns: 320px 150px 150px 160px minmax(0, 1fr) 200px;
align-items: center;
gap: 20px;
padding: 0 22px;
}
.history-table__head {
flex: none;
height: 62px;
margin-top: 18px;
border: 1px solid rgba(130, 175, 255, 0.12);
border-radius: 14px;
background: rgba(255, 255, 255, 0.04);
color: rgba(158, 190, 226, 0.65);
font-size: 18px;
font-weight: 600;
letter-spacing: 1px;
}
.history-table__body {
flex: 1;
min-height: 0;
overflow-y: auto;
margin-right: -6px;
padding-right: 6px;
}
.history-table__body::-webkit-scrollbar {
width: 6px;
}
.history-table__body::-webkit-scrollbar-thumb {
border-radius: 3px;
background: rgba(130, 175, 255, 0.25);
}
.history-row {
width: 100%;
min-height: 78px;
border-bottom: 1px solid rgba(130, 175, 255, 0.08);
color: rgba(210, 228, 250, 0.82);
font-size: 19px;
text-align: left;
cursor: pointer;
transition: background 0.18s ease;
}
.history-row:hover {
background: rgba(70, 140, 255, 0.08);
}
.history-row__time {
color: rgba(226, 240, 255, 0.9);
font-variant-numeric: tabular-nums;
}
.history-row__points {
font-variant-numeric: tabular-nums;
}
.history-row__duration {
color: rgba(158, 190, 226, 0.7);
}
.history-row__id {
overflow: hidden;
color: rgba(158, 190, 226, 0.5);
font-size: 16px;
letter-spacing: 0.5px;
text-overflow: ellipsis;
white-space: nowrap;
}
.history-row__actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
}
.row-action {
height: 40px;
padding: 0 16px;
border: 1px solid rgba(120, 190, 255, 0.28);
border-radius: 10px;
background: rgba(70, 140, 255, 0.12);
color: #8fd0ff;
font-family: inherit;
font-size: 16px;
font-weight: 600;
letter-spacing: 1px;
cursor: pointer;
transition:
background 0.18s ease,
border-color 0.18s ease,
color 0.18s ease;
}
.row-action:hover {
border-color: rgba(150, 205, 255, 0.5);
background: rgba(70, 140, 255, 0.22);
}
.row-action--danger {
border-color: rgba(255, 120, 120, 0.28);
background: rgba(255, 84, 84, 0.1);
color: #ff9d9d;
}
.row-action--danger:hover {
border-color: rgba(255, 150, 150, 0.5);
background: rgba(255, 84, 84, 0.18);
}
.history-status {
display: inline-block;
min-width: 86px;
padding: 4px 12px;
border: 1px solid rgba(130, 195, 255, 0.28);
border-radius: 20px;
background: rgba(16, 40, 80, 0.5);
color: #9fe8ff;
font-size: 16px;
text-align: center;
}
.history-status.is-completed {
border-color: rgba(116, 244, 197, 0.32);
background: rgba(14, 60, 56, 0.45);
color: #8ff5e7;
}
.history-status.is-failed {
border-color: rgba(255, 120, 120, 0.32);
background: rgba(60, 20, 26, 0.45);
color: #ff9d9d;
}
.history-status.is-aborted {
border-color: rgba(255, 216, 106, 0.3);
background: rgba(60, 46, 12, 0.45);
color: #ffd98a;
}
.history-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 18px;
padding: 120px 0;
color: rgba(158, 190, 226, 0.55);
font-size: 20px;
letter-spacing: 1px;
text-align: center;
}
.history-empty__retry {
height: 46px;
padding: 0 26px;
border: 1px solid rgba(130, 175, 255, 0.28);
border-radius: 12px;
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
font-family: inherit;
font-size: 18px;
letter-spacing: 2px;
}
.history-empty__retry:hover {
border-color: rgba(150, 205, 255, 0.5);
}
.history-footer {
display: flex;
flex: none;
align-items: center;
height: 64px;
padding: 0 54px;
border-top: 1px solid rgba(130, 175, 255, 0.12);
background: rgba(8, 18, 38, 0.55);
color: rgba(158, 190, 226, 0.6);
font-size: 16px;
letter-spacing: 1px;
}
.delete-backdrop {
position: fixed;
inset: 0;
z-index: 70;
display: grid;
place-items: center;
padding: 24px;
background: rgba(3, 8, 18, 0.68);
backdrop-filter: blur(8px);
}
.delete-card {
width: 600px;
padding: 38px 44px 34px;
border: 1px solid rgba(130, 175, 255, 0.2);
border-radius: 26px;
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
box-shadow:
0 40px 90px rgba(0, 6, 20, 0.6),
0 0 50px rgba(48, 118, 255, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
color-scheme: dark;
text-align: center;
}
.delete-card__icon {
display: grid;
place-items: center;
width: 86px;
height: 86px;
margin: 0 auto 22px;
border: 1px solid rgba(255, 120, 120, 0.3);
border-radius: 50%;
background: rgba(255, 84, 84, 0.12);
box-shadow:
0 0 32px rgba(255, 84, 84, 0.18),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
color: #ff9d9d;
}
.delete-card__icon svg {
width: 44px;
height: 44px;
}
.delete-card h2 {
color: #eef5ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 2px;
text-shadow: 0 0 24px rgba(80, 150, 255, 0.28);
}
.delete-card p {
margin-top: 14px;
color: rgba(158, 190, 226, 0.72);
font-size: 19px;
line-height: 1.6;
letter-spacing: 0.5px;
}
.delete-card p strong {
color: #ffd166;
font-weight: 600;
}
.delete-card__hint {
font-size: 16px;
color: rgba(158, 190, 226, 0.55);
}
.delete-card__actions {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 28px;
}
.delete-button {
width: 180px;
height: 56px;
border-radius: 12px;
font-family: inherit;
font-size: 20px;
font-weight: 600;
letter-spacing: 3px;
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
background 0.2s ease,
border-color 0.2s ease;
}
.delete-button:disabled {
cursor: default;
opacity: 0.5;
}
.delete-button--ghost {
border: 1px solid rgba(130, 175, 255, 0.28);
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
}
.delete-button--ghost:hover:not(:disabled) {
border-color: rgba(150, 205, 255, 0.5);
background: rgba(30, 66, 128, 0.6);
}
.delete-button--danger {
background: linear-gradient(180deg, #ff8b84 0%, #e15b55 100%);
box-shadow:
0 14px 30px rgba(225, 91, 85, 0.28),
0 0 26px rgba(255, 110, 100, 0.16),
inset 0 1px 0 rgba(255, 255, 255, 0.4);
color: #2a0806;
}
.delete-button--danger:hover:not(:disabled) {
box-shadow:
0 18px 38px rgba(225, 91, 85, 0.36),
0 0 34px rgba(255, 110, 100, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.45);
transform: translateY(-2px);
}
.delete-modal-enter-active,
.delete-modal-leave-active {
transition: opacity 0.24s ease;
}
.delete-modal-enter-active .delete-card,
.delete-modal-leave-active .delete-card {
transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}
.delete-modal-enter-from,
.delete-modal-leave-to {
opacity: 0;
}
.delete-modal-enter-from .delete-card,
.delete-modal-leave-to .delete-card {
opacity: 0;
transform: translateY(16px) scale(0.97);
}
</style>
+518 -32
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { onBeforeUnmount, ref } from 'vue'
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import AdminFunctionPanel from '@/components/AdminFunctionPanel.vue'
import AdminPasswordModal from '@/components/AdminPasswordModal.vue'
@@ -7,6 +7,8 @@ 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 { getDeviceStatus, retryDevices, type DeviceStatus } from '@/api/device'
import { showToast } from '@/composables/useToast'
import logo from '@/assets/logo.png'
type ModuleTone = 'blue' | 'orange' | 'green' | 'teal'
@@ -15,23 +17,99 @@ type ModuleIconName = 'detect' | 'metal' | 'soil' | 'water'
interface HomeModule {
key: string
title: string
caption: 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' },
{
key: 'element',
title: '元素检测',
caption: 'Elemental Analysis',
tone: 'blue',
icon: 'detect',
},
{
key: 'metal',
title: '金属鉴别',
caption: 'Metal Identification',
tone: 'orange',
icon: 'metal',
},
{
key: 'soil',
title: '土壤与沉积物筛查',
caption: 'Soil & Sediment',
tone: 'green',
icon: 'soil',
},
{
key: 'water',
title: '水体液体分析',
caption: 'Water & Liquid',
tone: 'teal',
icon: 'water',
},
]
// 顶部装饰频谱条,仅用于视觉点缀
const spectrumBars = [22, 40, 64, 34, 52, 72, 44, 60, 30, 50, 66, 38, 56, 26]
const router = useRouter()
const modalOpen = ref(false)
const modalModule = ref('')
const adminModalOpen = ref(false)
const adminPanelOpen = ref(false)
// 设备连接状态:启动连接失败时在首页提示,并允许手动重试。
const deviceStatus = ref<DeviceStatus | null>(null)
const deviceRetrying = ref(false)
let deviceTimer: number | undefined
const failedDevices = computed(() =>
(deviceStatus.value?.devices ?? []).filter((item) => item.status === 'failed'),
)
const connectingDevices = computed(() =>
(deviceStatus.value?.devices ?? []).filter(
(item) => item.status === 'connecting',
),
)
const showDeviceBanner = computed(
() =>
failedDevices.value.length > 0 || connectingDevices.value.length > 0,
)
async function refreshDevices() {
try {
deviceStatus.value = await getDeviceStatus()
} catch {
// 后端未启动或不可达时保持静默,避免打扰首页演示
}
}
async function retryDeviceConnections() {
if (deviceRetrying.value) return
deviceRetrying.value = true
try {
deviceStatus.value = await retryDevices()
if (deviceStatus.value.allConnected) {
showToast('所有设备已连接')
} else {
showToast('仍有设备连接失败,请检查硬件连接')
}
} catch (error) {
showToast(
error instanceof Error ? error.message : '重试设备连接失败',
)
} finally {
deviceRetrying.value = false
}
}
// 隐藏入口:800ms 内连续点击 Logo 三次,打开管理员密码框。
const LOGO_CLICK_WINDOW = 800
let logoClickCount = 0
@@ -62,6 +140,43 @@ function onAdminSuccess() {
adminPanelOpen.value = true
}
// 隐藏入口:800ms 内连续点击标题中的“素”字三次,切换/退出浏览器全屏。
const FULLSCREEN_CLICK_WINDOW = 800
let fullscreenClickCount = 0
let fullscreenTimer: number | undefined
async function toggleFullscreen() {
try {
if (document.fullscreenElement) {
await document.exitFullscreen()
} else {
await document.documentElement.requestFullscreen()
}
} catch {
showToast('当前浏览器无法切换全屏')
}
}
function onTitleCharClick() {
if (fullscreenTimer !== undefined) {
window.clearTimeout(fullscreenTimer)
}
fullscreenClickCount += 1
if (fullscreenClickCount >= 3) {
fullscreenClickCount = 0
fullscreenTimer = undefined
void toggleFullscreen()
return
}
fullscreenTimer = window.setTimeout(() => {
fullscreenClickCount = 0
fullscreenTimer = undefined
}, FULLSCREEN_CLICK_WINDOW)
}
function openSystemConfig() {
adminPanelOpen.value = false
void router.push({ name: 'systemConfig' })
@@ -72,10 +187,30 @@ function openRulerSetting() {
void router.push({ name: 'ruler' })
}
function openHistory() {
adminPanelOpen.value = false
void router.push({ name: 'history' })
}
onMounted(() => {
void refreshDevices()
deviceTimer = window.setInterval(refreshDevices, 5000)
})
onBeforeUnmount(() => {
if (logoTimer !== undefined) {
window.clearTimeout(logoTimer)
}
if (fullscreenTimer !== undefined) {
window.clearTimeout(fullscreenTimer)
fullscreenTimer = undefined
}
if (deviceTimer !== undefined) {
window.clearInterval(deviceTimer)
deviceTimer = undefined
}
})
function openModule(module: HomeModule) {
@@ -92,30 +227,91 @@ function openModule(module: HomeModule) {
<template>
<AppStage>
<div class="home">
<div class="home-bg" aria-hidden="true">
<span class="home-bg__orb home-bg__orb--blue"></span>
<span class="home-bg__orb home-bg__orb--cyan"></span>
<span class="home-bg__orb home-bg__orb--violet"></span>
</div>
<header class="home-header">
<div class="brand">
<img :src="logo" alt="泽科技 LIBS 标识" @click="onLogoClick" />
<span>LIBS</span>
<span class="brand__mark" @click="onLogoClick">
<img :src="logo" alt="泽科技 LIBS 标识" />
</span>
<span class="brand__text">
<span class="brand__name">LIBS</span>
<span class="brand__sub">Laser Induced Breakdown Spectroscopy</span>
</span>
</div>
<div class="headline">
<h1>激光诱导击穿光谱 元素分析系统</h1>
<p>开放 · 共享 · 自助式元素检测平台</p>
<h1>
激光诱导击穿光谱
<em>元<span class="headline__hotspot" @click="onTitleCharClick">素</span>分析系统</em>
</h1>
<p>开放 <i>·</i> 共享 <i>·</i> 自助式元素检测平台</p>
</div>
<div class="spectrum-deco" aria-hidden="true">
<span
v-for="(height, index) in spectrumBars"
:key="index"
:style="{ height: `${height}px`, animationDelay: `${index * 0.09}s` }"
></span>
</div>
</header>
<div
v-if="showDeviceBanner"
class="device-banner"
:class="{ 'device-banner--error': failedDevices.length > 0 }"
>
<span class="device-banner__dot"></span>
<span class="device-banner__text">
<template v-if="failedDevices.length">
设备连接失败:{{ failedDevices.map((item) => item.name).join('、') }}
<small v-if="failedDevices[0].message">
({{ failedDevices[0].message }})
</small>
</template>
<template v-else>
正在连接设备:{{ connectingDevices.map((item) => item.name).join('、') }}
</template>
</span>
<button
v-if="failedDevices.length"
class="device-banner__retry"
type="button"
:disabled="deviceRetrying"
@click="retryDeviceConnections"
>
{{ deviceRetrying ? '重试中...' : '重试连接' }}
</button>
</div>
<main class="home-main">
<section class="modules-panel">
<div class="modules-panel__head">
<span class="modules-panel__eyebrow">Analysis Modules</span>
<h2>选择检测模式</h2>
</div>
<div class="modules-grid">
<ModuleButton
v-for="module in modules"
v-for="(module, index) in modules"
:key="module.key"
:title="module.title"
:caption="module.caption"
:index="String(index + 1).padStart(2, '0')"
:tone="module.tone"
:icon="module.icon"
@click="openModule(module)"
/>
</div>
<p class="modules-panel__foot">
点击卡片进入对应检测流程 · 更多场景持续扩展
</p>
</section>
<PrinciplePlayer class="home-player" />
@@ -139,6 +335,7 @@ function openModule(module: HomeModule) {
@close="adminPanelOpen = false"
@system-config="openSystemConfig"
@ruler="openRulerSetting"
@history="openHistory"
/>
</AppStage>
</template>
@@ -147,7 +344,74 @@ function openModule(module: HomeModule) {
.home {
position: absolute;
inset: 0;
background: #f0f2f5;
overflow: hidden;
background:
radial-gradient(1100px 640px at 10% -18%, rgba(48, 112, 255, 0.32), transparent 62%),
radial-gradient(860px 560px at 96% 2%, rgba(0, 209, 255, 0.16), transparent 60%),
radial-gradient(900px 680px at 62% 118%, rgba(122, 84, 255, 0.2), transparent 62%),
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
}
.home-bg {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.home-bg::before {
content: '';
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(130, 175, 255, 0.055) 1px, transparent 1px),
linear-gradient(90deg, rgba(130, 175, 255, 0.055) 1px, transparent 1px);
background-size: 64px 64px;
mask-image: radial-gradient(ellipse 75% 70% at 50% 30%, #000 20%, transparent 78%);
pointer-events: none;
}
.home-bg__orb {
position: absolute;
border-radius: 50%;
filter: blur(100px);
animation: orb-drift 16s ease-in-out infinite alternate;
}
.home-bg__orb--blue {
top: -340px;
left: -160px;
width: 780px;
height: 780px;
background: rgba(48, 118, 255, 0.34);
}
.home-bg__orb--cyan {
top: -220px;
right: -200px;
width: 660px;
height: 660px;
background: rgba(0, 214, 255, 0.2);
animation-delay: -5s;
}
.home-bg__orb--violet {
bottom: -360px;
left: 34%;
width: 720px;
height: 720px;
background: rgba(124, 92, 255, 0.22);
animation-delay: -10s;
}
@keyframes orb-drift {
from {
transform: translate3d(0, 0, 0) scale(1);
}
to {
transform: translate3d(42px, 30px, 0) scale(1.08);
}
}
.home-header {
@@ -157,32 +421,69 @@ function openModule(module: HomeModule) {
left: 0;
height: 180px;
padding: 24px 44px;
background: #f4f5f7;
}
.brand {
display: flex;
align-items: center;
gap: 14px;
gap: 16px;
}
.brand img {
width: 100px;
height: 100px;
.brand__mark {
display: grid;
place-items: center;
width: 92px;
height: 92px;
padding: 6px;
border-radius: 24px;
background: #fff;
box-shadow:
0 14px 34px rgba(0, 18, 52, 0.55),
0 0 0 1px rgba(255, 255, 255, 0.18);
cursor: pointer;
transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.brand__mark:hover {
transform: translateY(-2px);
box-shadow:
0 18px 40px rgba(0, 18, 52, 0.6),
0 0 26px rgba(90, 160, 255, 0.35);
}
.brand__mark img {
width: 100%;
height: 100%;
object-fit: contain;
mix-blend-mode: multiply;
}
.brand span {
color: #253243;
font-size: 32px;
.brand__text {
display: flex;
flex-direction: column;
gap: 3px;
}
.brand__name {
color: transparent;
background: linear-gradient(120deg, #eef6ff 0%, #9cc6ff 55%, #4d8bf0 100%);
-webkit-background-clip: text;
background-clip: text;
font-size: 40px;
font-weight: 700;
letter-spacing: 2px;
letter-spacing: 5px;
line-height: 1;
}
.brand__sub {
color: rgba(150, 182, 222, 0.6);
font-size: 11px;
letter-spacing: 2.2px;
text-transform: uppercase;
}
.headline {
position: absolute;
top: 40px;
top: 32px;
left: 50%;
text-align: center;
transform: translateX(-50%);
@@ -190,18 +491,140 @@ function openModule(module: HomeModule) {
}
.headline h1 {
color: #1f2937;
font-size: 44px;
color: #eef5ff;
font-size: 46px;
font-weight: 600;
letter-spacing: 6px;
letter-spacing: 7px;
line-height: 1.2;
text-shadow: 0 0 32px rgba(80, 150, 255, 0.32);
}
.headline h1 em {
color: transparent;
background: linear-gradient(100deg, #7fe0ff 0%, #5aa2ff 52%, #9b86ff 100%);
-webkit-background-clip: text;
background-clip: text;
font-style: normal;
filter: drop-shadow(0 0 18px rgba(90, 160, 255, 0.35));
}
.headline h1 em .headline__hotspot {
cursor: pointer;
user-select: none;
}
.headline p {
margin-top: 16px;
color: #4d5969;
font-size: 20px;
letter-spacing: 4px;
color: rgba(158, 190, 226, 0.72);
font-size: 18px;
letter-spacing: 5px;
}
.headline p i {
margin: 0 12px;
color: rgba(90, 160, 255, 0.85);
font-style: normal;
}
.spectrum-deco {
position: absolute;
top: 46px;
right: 44px;
display: flex;
align-items: flex-end;
gap: 5px;
height: 76px;
opacity: 0.5;
}
.spectrum-deco span {
width: 4px;
border-radius: 3px;
background: linear-gradient(180deg, rgba(130, 214, 255, 0.95), rgba(70, 130, 255, 0.15));
transform-origin: bottom center;
animation: bar-pulse 2.6s ease-in-out infinite alternate;
}
@keyframes bar-pulse {
from {
opacity: 0.45;
transform: scaleY(0.45);
}
to {
opacity: 0.95;
transform: scaleY(1);
}
}
.device-banner {
position: absolute;
top: 142px;
right: 44px;
left: 44px;
z-index: 5;
display: flex;
align-items: center;
gap: 12px;
height: 44px;
padding: 0 18px;
border: 1px solid rgba(255, 196, 80, 0.35);
border-radius: 12px;
background: linear-gradient(120deg, rgba(255, 180, 40, 0.16), rgba(255, 180, 40, 0.06));
color: #ffd98a;
font-size: 17px;
letter-spacing: 0.5px;
backdrop-filter: blur(12px);
}
.device-banner--error {
border-color: rgba(255, 107, 107, 0.4);
background: linear-gradient(120deg, rgba(255, 84, 84, 0.18), rgba(255, 84, 84, 0.06));
color: #ff9d9d;
}
.device-banner__dot {
flex: none;
width: 10px;
height: 10px;
border-radius: 50%;
background: currentColor;
box-shadow: 0 0 10px currentColor;
}
.device-banner__text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.device-banner__text small {
color: inherit;
opacity: 0.72;
}
.device-banner__retry {
flex: none;
height: 32px;
padding: 0 18px;
border: 1px solid rgba(255, 255, 255, 0.32);
border-radius: 8px;
background: rgba(255, 255, 255, 0.08);
color: inherit;
font-size: 16px;
cursor: pointer;
transition: background 0.2s ease;
}
.device-banner__retry:hover {
background: rgba(255, 255, 255, 0.16);
}
.device-banner__retry:disabled {
cursor: default;
opacity: 0.6;
}
.home-main {
@@ -216,12 +639,75 @@ function openModule(module: HomeModule) {
}
.modules-panel {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
gap: 30px;
padding: 34px;
overflow: hidden;
border: 1px solid rgba(140, 182, 255, 0.14);
border-radius: 26px;
background: linear-gradient(
155deg,
rgba(255, 255, 255, 0.07) 0%,
rgba(255, 255, 255, 0.025) 55%,
rgba(255, 255, 255, 0.05) 100%
);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.5),
inset 0 1px 0 rgba(255, 255, 255, 0.09);
backdrop-filter: blur(16px);
}
.modules-panel::before {
content: '';
position: absolute;
top: 0;
right: 40px;
left: 40px;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(120, 180, 255, 0.6), transparent);
}
.modules-panel__head {
display: flex;
flex-direction: column;
gap: 10px;
}
.modules-panel__eyebrow {
color: #5aa2ff;
font-size: 13px;
font-weight: 600;
letter-spacing: 3.4px;
text-transform: uppercase;
}
.modules-panel__head h2 {
display: flex;
align-items: center;
padding: 34px;
border-radius: 20px;
background: #fff;
box-shadow: var(--shadow-card);
gap: 12px;
color: #eaf3ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 3px;
}
.modules-panel__head h2::before {
content: '';
width: 4px;
height: 26px;
border-radius: 4px;
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
}
.modules-panel__foot {
color: rgba(140, 172, 208, 0.55);
font-size: 14px;
letter-spacing: 1.4px;
text-align: center;
}
.modules-grid {
File diff suppressed because it is too large Load Diff
+208 -51
View File
@@ -296,9 +296,19 @@ onBeforeUnmount(() => {
<template>
<AppStage>
<PageHeader title="标尺设定" subtitle="在相机画面中拖动画线,输入实际距离完成标定">
<div class="ruler-bg" aria-hidden="true">
<span class="ruler-bg__orb ruler-bg__orb--blue"></span>
<span class="ruler-bg__orb ruler-bg__orb--cyan"></span>
<span class="ruler-bg__orb ruler-bg__orb--violet"></span>
</div>
<PageHeader
title="标尺设定"
subtitle="在相机画面中拖动画线,输入实际距离完成标定"
theme="dark"
>
<template #left>
<button class="header-button header-button--outline" type="button" @click="goHome">
<button class="admin-back" type="button" @click="goHome">
返回
</button>
</template>
@@ -426,6 +436,95 @@ onBeforeUnmount(() => {
</template>
<style scoped>
.ruler-bg {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
background:
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
}
.ruler-bg::before {
content: '';
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
background-size: 64px 64px;
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
}
.ruler-bg__orb {
position: absolute;
border-radius: 50%;
filter: blur(100px);
animation: ruler-orb-drift 16s ease-in-out infinite alternate;
}
.ruler-bg__orb--blue {
top: -340px;
left: -160px;
width: 760px;
height: 760px;
background: rgba(48, 118, 255, 0.3);
}
.ruler-bg__orb--cyan {
top: -200px;
right: -220px;
width: 640px;
height: 640px;
background: rgba(0, 214, 255, 0.18);
animation-delay: -5s;
}
.ruler-bg__orb--violet {
bottom: -360px;
left: 36%;
width: 700px;
height: 700px;
background: rgba(124, 92, 255, 0.18);
animation-delay: -10s;
}
@keyframes ruler-orb-drift {
from {
transform: translate3d(0, 0, 0) scale(1);
}
to {
transform: translate3d(42px, 30px, 0) scale(1.08);
}
}
.admin-back {
width: 132px;
height: 60px;
border: 1px solid rgba(130, 190, 255, 0.35);
border-radius: 12px;
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
font-size: 24px;
font-weight: 600;
letter-spacing: 3px;
backdrop-filter: blur(10px);
transition:
transform 0.2s ease,
border-color 0.2s ease,
background 0.2s ease;
}
.admin-back:hover {
border-color: rgba(150, 205, 255, 0.55);
background: rgba(30, 66, 128, 0.65);
transform: translateY(-1px);
}
.ruler-main {
position: absolute;
top: 176px;
@@ -437,16 +536,33 @@ onBeforeUnmount(() => {
}
.ruler-card {
position: relative;
display: flex;
flex-direction: column;
width: 1400px;
max-width: 100%;
height: 100%;
overflow: hidden;
border: 1px solid #d8e0e9;
border-radius: 18px;
background: #fff;
box-shadow: var(--shadow-card);
border: 1px solid rgba(130, 175, 255, 0.18);
border-radius: 26px;
background: linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.5),
0 0 40px rgba(48, 118, 255, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
}
.ruler-card::before {
content: '';
position: absolute;
top: 0;
right: 40px;
left: 40px;
z-index: 2;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
pointer-events: none;
}
.ruler-card__header {
@@ -454,28 +570,41 @@ onBeforeUnmount(() => {
flex: none;
align-items: center;
justify-content: space-between;
height: 76px;
height: 80px;
padding: 0 28px;
background: linear-gradient(180deg, #3d80e2 0%, #2f6fd0 100%);
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(120deg, rgba(26, 58, 112, 0.85) 0%, rgba(10, 24, 52, 0.8) 100%);
}
.ruler-card__header h2 {
color: #fff;
display: flex;
align-items: center;
gap: 12px;
color: #eef5ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 3px;
text-shadow: 0 1px 3px rgba(16, 49, 101, 0.22);
text-shadow: 0 0 22px rgba(80, 150, 255, 0.3);
}
.ruler-card__header h2::before {
content: '';
width: 4px;
height: 26px;
border-radius: 4px;
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
}
.ruler-card__status {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 5px 12px;
border: 1px solid rgba(255, 255, 255, 0.24);
padding: 5px 14px;
border: 1px solid rgba(130, 195, 255, 0.28);
border-radius: 30px;
background: rgba(255, 255, 255, 0.12);
color: rgba(255, 255, 255, 0.92);
background: rgba(16, 40, 80, 0.5);
color: rgba(216, 236, 255, 0.9);
font-size: 15px;
letter-spacing: 1px;
}
@@ -497,7 +626,8 @@ onBeforeUnmount(() => {
flex: 1;
min-height: 0;
overflow: hidden;
background: #080d14;
background: #040810;
box-shadow: inset 0 0 50px rgba(0, 4, 14, 0.6);
}
.ruler-viewport__image {
@@ -530,7 +660,7 @@ onBeforeUnmount(() => {
position: absolute;
top: 50%;
left: 50%;
color: rgba(216, 228, 243, 0.7);
color: rgba(180, 210, 240, 0.7);
font-size: 20px;
letter-spacing: 2px;
transform: translate(-50%, -50%);
@@ -541,10 +671,11 @@ onBeforeUnmount(() => {
flex: none;
align-items: center;
gap: 12px;
height: 72px;
height: 78px;
padding: 0 30px;
border-top: 1px solid var(--line);
color: var(--muted);
border-top: 1px solid rgba(130, 175, 255, 0.12);
background: rgba(8, 18, 38, 0.55);
color: rgba(158, 190, 226, 0.68);
font-size: 18px;
letter-spacing: 0.5px;
}
@@ -554,9 +685,10 @@ onBeforeUnmount(() => {
place-items: center;
width: 28px;
height: 28px;
border: 1px solid rgba(120, 190, 255, 0.25);
border-radius: 50%;
background: var(--blue-soft);
color: var(--blue);
background: rgba(70, 140, 255, 0.16);
color: #8fd0ff;
font-size: 16px;
font-weight: 600;
}
@@ -565,7 +697,7 @@ onBeforeUnmount(() => {
width: 1px;
height: 22px;
margin: 0 8px;
background: var(--line-strong);
background: rgba(130, 175, 255, 0.2);
}
.distance-backdrop {
@@ -575,36 +707,41 @@ onBeforeUnmount(() => {
display: grid;
place-items: center;
padding: 24px;
background: rgba(18, 33, 54, 0.44);
backdrop-filter: blur(5px);
background: rgba(3, 8, 18, 0.68);
backdrop-filter: blur(8px);
}
.distance-card {
width: 600px;
padding: 38px 44px 34px;
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);
border: 1px solid rgba(130, 175, 255, 0.2);
border-radius: 26px;
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
box-shadow:
0 40px 90px rgba(0, 6, 20, 0.6),
0 0 50px rgba(48, 118, 255, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
color-scheme: dark;
text-align: center;
}
.distance-card h2 {
color: #1f2937;
color: #eef5ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 2px;
text-shadow: 0 0 24px rgba(80, 150, 255, 0.28);
}
.distance-card > p {
margin-top: 12px;
color: var(--muted);
color: rgba(158, 190, 226, 0.7);
font-size: 18px;
letter-spacing: 0.5px;
}
.distance-card > p strong {
color: var(--blue);
color: #7fe0ff;
font-weight: 600;
}
@@ -616,23 +753,26 @@ onBeforeUnmount(() => {
display: flex;
flex-direction: column;
gap: 10px;
text-align: left;
color: var(--ink-soft);
color: rgba(158, 190, 226, 0.72);
font-size: 18px;
text-align: left;
}
.distance-field__control {
display: flex;
align-items: center;
overflow: hidden;
border: 2px solid var(--line-strong);
border-radius: 10px;
border: 1px solid rgba(130, 175, 255, 0.22);
border-radius: 12px;
background: rgba(6, 14, 28, 0.7);
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.distance-field__control:focus-within {
border-color: var(--blue);
box-shadow: 0 0 0 4px rgba(47, 111, 208, 0.12);
border-color: rgba(120, 200, 255, 0.55);
box-shadow:
0 0 0 4px rgba(70, 140, 255, 0.15),
0 0 24px rgba(70, 140, 255, 0.12);
}
.distance-field input {
@@ -640,23 +780,28 @@ onBeforeUnmount(() => {
height: 58px;
padding: 0 18px;
border: 0;
color: var(--ink);
background: transparent;
color: #e8f2ff;
font-family: inherit;
font-size: 22px;
outline: none;
}
.distance-field input::placeholder {
color: rgba(158, 190, 226, 0.4);
}
.distance-field__unit {
flex: none;
padding: 0 20px;
color: var(--muted);
color: rgba(158, 190, 226, 0.6);
font-size: 19px;
letter-spacing: 1px;
}
.distance-error {
margin-top: 14px;
color: var(--red);
color: #ff9d9d;
font-size: 17px;
letter-spacing: 0.5px;
text-align: center;
@@ -676,33 +821,45 @@ onBeforeUnmount(() => {
font-size: 20px;
font-weight: 600;
letter-spacing: 3px;
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
background 0.2s ease,
border-color 0.2s ease;
}
.distance-button:disabled {
cursor: default;
opacity: 0.65;
opacity: 0.5;
}
.distance-button--ghost {
border: 2px solid var(--line-strong);
color: var(--ink-soft);
background: #fff;
border: 1px solid rgba(130, 175, 255, 0.28);
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
}
.distance-button--ghost:hover:not(:disabled) {
background: var(--surface-soft);
border-color: rgba(150, 205, 255, 0.5);
background: rgba(30, 66, 128, 0.6);
}
.distance-button--primary {
color: #fff;
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
box-shadow: 0 10px 22px rgba(47, 111, 208, 0.28);
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
box-shadow:
0 14px 30px rgba(240, 172, 11, 0.28),
0 0 26px rgba(255, 190, 60, 0.16),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
color: #241500;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
}
.distance-button--primary:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: 0 14px 28px rgba(47, 111, 208, 0.36);
box-shadow:
0 18px 38px rgba(240, 172, 11, 0.36),
0 0 34px rgba(255, 190, 60, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
transform: translateY(-2px);
}
.distance-modal-enter-active,
+267 -60
View File
@@ -38,6 +38,12 @@ const footerItems = computed(() => [
'环境温度 22℃',
])
const captureStatusText = computed(() => {
if (baselineReady.value) return '基准画面就绪'
if (capturingBaseline.value) return '正在采集基准画面'
return '等待相机画面'
})
function goHome() {
void router.push({ name: 'home' })
}
@@ -87,9 +93,15 @@ async function startDetection() {
<template>
<AppStage>
<PageHeader title="放置待测样品">
<div class="sample-bg" aria-hidden="true">
<span class="sample-bg__orb sample-bg__orb--blue"></span>
<span class="sample-bg__orb sample-bg__orb--cyan"></span>
<span class="sample-bg__orb sample-bg__orb--violet"></span>
</div>
<PageHeader title="放置待测样品" theme="dark">
<template #left>
<button class="header-button header-button--outline" type="button" @click="goHome">
<button class="sample-back" type="button" @click="goHome">
返回
</button>
</template>
@@ -101,7 +113,11 @@ async function startDetection() {
<aside class="guide-column">
<section class="guide-card">
<header class="guide-card__header">
<h2>样品放置操作指引</h2>
<div class="guide-card__heading">
<span class="guide-card__eyebrow">Operation Guide</span>
<h2>样品放置操作指引</h2>
</div>
<span class="guide-card__badge">Step 01</span>
</header>
<ol class="guide-steps">
@@ -142,6 +158,11 @@ async function startDetection() {
</section>
<div class="guide-actions">
<span class="capture-status" :class="{ 'is-ready': baselineReady }">
<i class="capture-status__dot"></i>
{{ captureStatusText }}
</span>
<button
class="action-button action-button--start"
type="button"
@@ -155,11 +176,100 @@ async function startDetection() {
</aside>
</main>
<StatusFooter :items="footerItems" />
<StatusFooter :items="footerItems" theme="dark" />
</AppStage>
</template>
<style scoped>
.sample-bg {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
background:
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
}
.sample-bg::before {
content: '';
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
background-size: 64px 64px;
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
}
.sample-bg__orb {
position: absolute;
border-radius: 50%;
filter: blur(100px);
animation: orb-drift 16s ease-in-out infinite alternate;
}
.sample-bg__orb--blue {
top: -340px;
left: -160px;
width: 760px;
height: 760px;
background: rgba(48, 118, 255, 0.3);
}
.sample-bg__orb--cyan {
top: -200px;
right: -220px;
width: 640px;
height: 640px;
background: rgba(0, 214, 255, 0.18);
animation-delay: -5s;
}
.sample-bg__orb--violet {
bottom: -360px;
left: 36%;
width: 700px;
height: 700px;
background: rgba(124, 92, 255, 0.18);
animation-delay: -10s;
}
@keyframes orb-drift {
from {
transform: translate3d(0, 0, 0) scale(1);
}
to {
transform: translate3d(42px, 30px, 0) scale(1.08);
}
}
.sample-back {
width: 132px;
height: 60px;
border: 1px solid rgba(130, 190, 255, 0.35);
border-radius: 12px;
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
font-size: 24px;
font-weight: 600;
letter-spacing: 3px;
backdrop-filter: blur(10px);
transition:
transform 0.2s ease,
border-color 0.2s ease,
background 0.2s ease;
}
.sample-back:hover {
border-color: rgba(150, 205, 255, 0.55);
background: rgba(30, 66, 128, 0.65);
transform: translateY(-1px);
}
.sample-main {
position: absolute;
top: 220px;
@@ -183,31 +293,79 @@ async function startDetection() {
}
.guide-card {
position: relative;
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);
border: 1px solid rgba(92, 227, 214, 0.2);
border-radius: 26px;
background: linear-gradient(
158deg,
rgba(30, 74, 108, 0.5) 0%,
rgba(10, 26, 52, 0.72) 60%,
rgba(12, 32, 60, 0.55) 100%
);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.5),
0 0 34px rgba(40, 200, 188, 0.08),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
}
.guide-card::before {
content: '';
position: absolute;
top: 0;
right: 40px;
left: 40px;
z-index: 2;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(92, 227, 214, 0.6), transparent);
pointer-events: none;
}
.guide-card__header {
display: flex;
flex: none;
align-items: center;
justify-content: space-between;
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);
padding: 0 32px;
border-bottom: 1px solid rgba(140, 200, 235, 0.12);
background: linear-gradient(120deg, rgba(36, 110, 128, 0.28) 0%, transparent 70%);
}
.guide-card__heading {
display: flex;
flex-direction: column;
gap: 6px;
}
.guide-card__eyebrow {
color: #5ce3d6;
font-size: 12px;
font-weight: 600;
letter-spacing: 2.6px;
text-transform: uppercase;
}
.guide-card__header h2 {
color: #fff;
font-size: 32px;
color: #effbff;
font-size: 30px;
font-weight: 600;
letter-spacing: 3px;
text-shadow: 0 1px 3px rgba(10, 94, 88, 0.2);
text-shadow: 0 0 24px rgba(60, 220, 205, 0.25);
}
.guide-card__badge {
padding: 7px 16px;
border: 1px solid rgba(92, 227, 214, 0.32);
border-radius: 30px;
background: rgba(20, 80, 90, 0.3);
color: #8ff5e7;
font-size: 14px;
letter-spacing: 2px;
}
.guide-steps {
@@ -222,8 +380,8 @@ async function startDetection() {
align-items: center;
gap: 22px;
min-height: 88px;
padding: 0 34px;
border-bottom: 1px solid rgba(255, 255, 255, 0.18);
padding: 0 32px;
border-bottom: 1px solid rgba(140, 200, 235, 0.1);
}
.guide-step:last-child {
@@ -236,20 +394,23 @@ async function startDetection() {
place-items: center;
width: 46px;
height: 46px;
border: 2px solid rgba(255, 255, 255, 0.9);
border: 1px solid rgba(92, 227, 214, 0.5);
border-radius: 50%;
color: #fff;
background: rgba(20, 80, 90, 0.35);
box-shadow:
0 0 18px rgba(40, 200, 188, 0.18),
inset 0 0 12px rgba(92, 227, 214, 0.12);
color: #9ff7ec;
font-size: 24px;
font-weight: 600;
}
.guide-step__title {
flex: 1;
color: #fff;
color: #e8f2ff;
font-size: 28px;
font-weight: 500;
letter-spacing: 1px;
text-shadow: 0 1px 3px rgba(10, 94, 88, 0.18);
}
.guide-step__icon {
@@ -258,7 +419,12 @@ async function startDetection() {
place-items: center;
width: 78px;
height: 78px;
padding: 2px;
padding: 4px;
}
.guide-step__icon :deep(.guide-icon) {
color: #8ff5e7;
filter: drop-shadow(0 0 10px rgba(92, 227, 214, 0.35));
}
.placement-requirements {
@@ -266,20 +432,20 @@ async function startDetection() {
flex: 1;
flex-direction: column;
min-height: 0;
margin: 0 24px 22px;
padding: 18px 22px;
margin: 16px 24px 22px;
padding: 16px 20px;
overflow: hidden;
border: 1px solid rgba(224, 154, 6, 0.45);
border-radius: 14px;
background: var(--orange-soft);
color: #5b4213;
border: 1px solid rgba(255, 196, 80, 0.28);
border-radius: 16px;
background: linear-gradient(155deg, rgba(255, 186, 60, 0.12) 0%, rgba(255, 150, 20, 0.04) 100%);
color: rgba(255, 228, 184, 0.9);
}
.placement-requirements h3 {
display: flex;
align-items: center;
gap: 10px;
color: #8a5b00;
color: #ffd98a;
font-size: 22px;
font-weight: 700;
letter-spacing: 1px;
@@ -292,8 +458,9 @@ async function startDetection() {
width: 28px;
height: 28px;
border-radius: 50%;
color: #fff;
background: var(--orange-dark);
background: linear-gradient(180deg, #ffd166 0%, #e08f00 100%);
box-shadow: 0 0 14px rgba(255, 190, 60, 0.35);
color: #2a1a00;
font-size: 19px;
font-weight: 700;
}
@@ -307,7 +474,7 @@ async function startDetection() {
.placement-requirements li {
display: flex;
gap: 9px;
color: #5b4213;
color: rgba(255, 228, 184, 0.82);
font-size: 18px;
line-height: 1.4;
}
@@ -320,8 +487,8 @@ async function startDetection() {
height: 21px;
margin-top: 2px;
border-radius: 50%;
background: rgba(224, 154, 6, 0.18);
color: #8a5b00;
background: rgba(255, 196, 80, 0.16);
color: #ffcf7a;
font-size: 13px;
font-weight: 700;
}
@@ -329,8 +496,8 @@ async function startDetection() {
.placement-requirements__warning {
margin-top: 10px;
padding-top: 10px;
border-top: 1px dashed rgba(138, 91, 0, 0.32);
color: var(--red);
border-top: 1px dashed rgba(255, 150, 120, 0.28);
color: #ff9d9d;
font-size: 18px;
font-weight: 600;
line-height: 1.4;
@@ -342,7 +509,7 @@ async function startDetection() {
gap: 10px;
margin-top: auto;
padding-top: 10px;
color: #5b4213;
color: rgba(255, 228, 184, 0.82);
font-size: 17px;
cursor: pointer;
user-select: none;
@@ -350,53 +517,93 @@ async function startDetection() {
.placement-confirm input {
flex: none;
width: 20px;
height: 20px;
accent-color: var(--teal-dark);
width: 22px;
height: 22px;
accent-color: #f0ac0b;
cursor: pointer;
}
.guide-actions {
display: grid;
flex: none;
grid-template-columns: 1fr;
gap: 20px;
grid-template-columns: minmax(0, 1fr) 320px;
align-items: center;
gap: 18px;
height: 78px;
}
.capture-status {
display: flex;
align-items: center;
gap: 12px;
height: 78px;
padding: 0 24px;
border: 1px solid rgba(130, 175, 255, 0.16);
border-radius: 14px;
background: rgba(10, 24, 48, 0.55);
color: rgba(178, 202, 232, 0.7);
font-size: 17px;
letter-spacing: 1px;
backdrop-filter: blur(12px);
}
.capture-status__dot {
flex: none;
width: 9px;
height: 9px;
border-radius: 50%;
background: #ffd86a;
box-shadow: 0 0 10px rgba(255, 216, 106, 0.8);
}
.capture-status.is-ready {
border-color: rgba(92, 227, 214, 0.3);
background: rgba(14, 46, 56, 0.5);
color: #8ff5e7;
}
.capture-status.is-ready .capture-status__dot {
background: #74f4c5;
box-shadow: 0 0 10px rgba(116, 244, 197, 0.9);
}
.action-button {
display: grid;
place-items: center;
height: 78px;
border-radius: 12px;
border-radius: 14px;
font-size: 30px;
font-weight: 600;
letter-spacing: 4px;
transition: transform 0.2s ease, box-shadow 0.2s ease;
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
filter 0.2s ease;
}
.action-button:hover {
transform: translateY(-1px);
.action-button--start {
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
box-shadow:
0 16px 34px rgba(240, 172, 11, 0.28),
0 0 28px rgba(255, 190, 60, 0.18),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
color: #241500;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
}
.action-button:not(:disabled):hover {
box-shadow:
0 20px 42px rgba(240, 172, 11, 0.36),
0 0 36px rgba(255, 190, 60, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
transform: translateY(-2px);
}
.action-button:disabled {
cursor: default;
opacity: 0.7;
filter: saturate(0.35);
opacity: 0.45;
box-shadow: none;
transform: none;
}
.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);
}
</style>
+416 -79
View File
@@ -7,6 +7,9 @@ import ScanVisual from '@/components/ScanVisual.vue'
import ProgressStrip from '@/components/ProgressStrip.vue'
import StatusFooter from '@/components/StatusFooter.vue'
import { analyzeSample, type SampleAnalysisResult } from '@/api/sample'
import { startScan } from '@/api/scan'
import { useStageHub } from '@/composables/useStageHub'
import { showToast } from '@/composables/useToast'
type AnalysisStatus = 'processing' | 'done' | 'error'
@@ -16,6 +19,9 @@ const status = ref<AnalysisStatus>('processing')
const result = ref<SampleAnalysisResult | null>(null)
const errorMessage = ref('')
const progress = ref(0)
const scanStarting = ref(false)
const { position: stagePosition, connect: connectStageHub } = useStageHub()
let progressTimer: number | undefined
@@ -29,6 +35,16 @@ const samplingPointCount = computed(
() => result.value?.samplingPointCount ?? '—',
)
const stageStatusText = computed(() => {
if (!stagePosition.value) return '未连接'
return stagePosition.value.moving ? '运动中' : '就绪'
})
const stageStatusTone = computed(() => {
if (!stagePosition.value) return 'is-off'
return stagePosition.value.moving ? 'is-moving' : 'is-ready'
})
const progressLabel = computed(() => {
if (status.value === 'done') return '靶样轮廓与采样点 100%'
if (status.value === 'error') return '图像分析失败'
@@ -101,12 +117,31 @@ function retry() {
void runAnalysis()
}
function goSpectrum() {
void router.replace({ name: 'spectrum' })
async function startScanning() {
if (scanStarting.value) return
if (!result.value) {
showToast('请等待靶样分析完成')
return
}
scanStarting.value = true
try {
const started = await startScan()
await router.push({
name: 'spectrum',
query: { scanId: started.scanId },
})
} catch (error) {
showToast(error instanceof Error ? error.message : '启动扫描失败')
} finally {
scanStarting.value = false
}
}
onMounted(() => {
void runAnalysis()
void connectStageHub()
})
onBeforeUnmount(stopProgress)
@@ -114,15 +149,21 @@ onBeforeUnmount(stopProgress)
<template>
<AppStage>
<PageHeader title="样品轮廓识别与激光点位规划" variant="process">
<div class="scan-bg" aria-hidden="true">
<span class="scan-bg__orb scan-bg__orb--blue"></span>
<span class="scan-bg__orb scan-bg__orb--cyan"></span>
<span class="scan-bg__orb scan-bg__orb--violet"></span>
</div>
<PageHeader title="样品轮廓识别与激光点位规划" variant="process" theme="dark">
<template #left>
<button class="header-button header-button--warn" type="button" @click="abortProcess">
<button class="scan-abort" type="button" @click="abortProcess">
中止流程
</button>
</template>
<template #right>
<button class="icon-close" type="button" aria-label="关闭并返回首页" @click="abortProcess">
<button class="scan-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>
@@ -167,7 +208,10 @@ onBeforeUnmount(stopProgress)
<aside class="params-card">
<header class="params-card__header">
<h2>采样点</h2>
<div class="params-card__heading">
<span class="params-card__eyebrow">Sampling Plan</span>
<h2>采样点</h2>
</div>
</header>
<div class="params-card__body">
@@ -177,43 +221,167 @@ onBeforeUnmount(stopProgress)
</div>
<div class="param-field">
<span class="param-field__label">脉冲能量</span>
<div class="param-field__value">120 <small>mJ</small></div>
<span class="param-field__label">当前位置</span>
<div class="param-field__value param-field__value--position">
<span>X {{ stagePosition ? stagePosition.x : '—' }}</span>
<span>Y {{ stagePosition ? stagePosition.y : '—' }}</span>
</div>
</div>
<div class="param-field">
<span class="param-field__label">积分时间</span>
<div class="param-field__value">10 <small>ms</small></div>
<span class="param-field__label">位移台状态</span>
<div
class="param-field__value param-field__value--status"
:class="stageStatusTone"
>
<i class="param-field__dot"></i>
{{ stageStatusText }}
</div>
</div>
</div>
<div class="param-field">
<span class="param-field__label">预扫描</span>
<div class="param-field__value">3 <small>次</small></div>
</div>
<div class="params-card__hint">
<span class="params-card__hint-mark">i</span>
<p>确认靶样轮廓与采样点分布符合要求后,点击“开始采集”进入光谱采集流程。</p>
</div>
</aside>
</main>
<div v-if="status !== 'error'" class="scan-progress">
<div class="scan-progress__strip">
<ProgressStrip :progress="progress" :label="progressLabel" :note="progressNote" />
<ProgressStrip
:progress="progress"
:label="progressLabel"
:note="progressNote"
theme="dark"
/>
</div>
<button
v-if="status === 'done'"
class="scan-next"
type="button"
@click="goSpectrum"
:disabled="scanStarting"
@click="startScanning"
>
开始采集光谱
{{ scanStarting ? '启动中...' : '开始采集' }}
</button>
</div>
<StatusFooter icon="info" :items="footerItems" />
<StatusFooter icon="info" :items="footerItems" theme="dark" />
</AppStage>
</template>
<style scoped>
.scan-bg {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
background:
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
}
.scan-bg::before {
content: '';
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
background-size: 64px 64px;
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
}
.scan-bg__orb {
position: absolute;
border-radius: 50%;
filter: blur(100px);
animation: scan-orb-drift 16s ease-in-out infinite alternate;
}
.scan-bg__orb--blue {
top: -340px;
left: -160px;
width: 760px;
height: 760px;
background: rgba(48, 118, 255, 0.3);
}
.scan-bg__orb--cyan {
top: -200px;
right: -220px;
width: 640px;
height: 640px;
background: rgba(0, 214, 255, 0.18);
animation-delay: -5s;
}
.scan-bg__orb--violet {
bottom: -360px;
left: 36%;
width: 700px;
height: 700px;
background: rgba(124, 92, 255, 0.18);
animation-delay: -10s;
}
@keyframes scan-orb-drift {
from {
transform: translate3d(0, 0, 0) scale(1);
}
to {
transform: translate3d(42px, 30px, 0) scale(1.08);
}
}
.scan-abort {
width: 300px;
height: 68px;
border: 1px solid rgba(255, 190, 60, 0.45);
border-radius: 14px;
background: linear-gradient(120deg, rgba(255, 186, 40, 0.18), rgba(255, 150, 20, 0.06));
color: #ffd98a;
font-size: 26px;
font-weight: 600;
letter-spacing: 3px;
backdrop-filter: blur(10px);
transition:
transform 0.2s ease,
border-color 0.2s ease,
background 0.2s ease;
}
.scan-abort:hover {
border-color: rgba(255, 205, 100, 0.65);
background: linear-gradient(120deg, rgba(255, 186, 40, 0.26), rgba(255, 150, 20, 0.1));
transform: translateY(-1px);
}
.scan-close {
display: grid;
place-items: center;
width: 52px;
height: 52px;
border-radius: 50%;
color: rgba(170, 200, 235, 0.8);
transition: color 0.2s ease, background 0.2s ease;
}
.scan-close:hover {
background: rgba(255, 255, 255, 0.08);
color: #eaf3ff;
}
.scan-close svg {
width: 26px;
height: 26px;
}
.scan-main {
position: absolute;
top: 142px;
@@ -233,16 +401,21 @@ onBeforeUnmount(stopProgress)
}
.result-card {
position: relative;
display: flex;
flex-direction: column;
width: 1120px;
max-width: 100%;
height: 100%;
overflow: hidden;
border: 1px solid #1e55a4;
border-radius: 18px;
background: #0b1220;
box-shadow: 0 18px 44px rgba(31, 77, 147, 0.28);
border: 1px solid rgba(130, 175, 255, 0.18);
border-radius: 26px;
background: linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.5),
0 0 40px rgba(48, 118, 255, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
justify-self: center;
}
@@ -251,25 +424,38 @@ onBeforeUnmount(stopProgress)
flex: none;
align-items: center;
justify-content: space-between;
height: 66px;
padding: 0 26px;
background: linear-gradient(180deg, #3d80e2 0%, #2f6fd0 100%);
height: 72px;
padding: 0 28px;
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(120deg, rgba(26, 58, 112, 0.85) 0%, rgba(10, 24, 52, 0.8) 100%);
}
.result-card__header h2 {
color: #fff;
display: flex;
align-items: center;
gap: 12px;
color: #eef5ff;
font-size: 28px;
font-weight: 600;
letter-spacing: 3px;
text-shadow: 0 1px 3px rgba(16, 49, 101, 0.22);
text-shadow: 0 0 22px rgba(80, 150, 255, 0.3);
}
.result-card__header h2::before {
content: '';
width: 4px;
height: 24px;
border-radius: 4px;
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
}
.result-card__count {
padding: 5px 14px;
border: 1px solid rgba(255, 255, 255, 0.3);
padding: 6px 16px;
border: 1px solid rgba(130, 195, 255, 0.3);
border-radius: 30px;
background: rgba(255, 255, 255, 0.12);
color: #fff;
background: rgba(16, 40, 80, 0.5);
color: #9fe8ff;
font-size: 17px;
letter-spacing: 1px;
}
@@ -280,6 +466,7 @@ onBeforeUnmount(stopProgress)
min-height: 0;
place-items: center;
padding: 10px;
background: #040810;
}
.result-card__image {
@@ -297,10 +484,14 @@ onBeforeUnmount(stopProgress)
max-width: 100%;
height: 100%;
padding: 40px;
border: 1px solid #d9e0e8;
border-radius: 18px;
background: #fff;
box-shadow: var(--shadow-card);
border: 1px solid rgba(255, 107, 107, 0.24);
border-radius: 26px;
background: linear-gradient(158deg, rgba(64, 22, 34, 0.4) 0%, rgba(8, 14, 28, 0.88) 70%);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.5),
0 0 40px rgba(255, 84, 84, 0.08),
inset 0 1px 0 rgba(255, 255, 255, 0.06);
backdrop-filter: blur(16px);
justify-self: center;
text-align: center;
}
@@ -311,9 +502,11 @@ onBeforeUnmount(stopProgress)
width: 96px;
height: 96px;
margin-bottom: 24px;
border: 1px solid rgba(255, 120, 120, 0.3);
border-radius: 50%;
color: var(--red);
background: #fdeeee;
background: rgba(255, 84, 84, 0.12);
box-shadow: 0 0 30px rgba(255, 84, 84, 0.18);
color: #ff9d9d;
}
.error-card__icon svg {
@@ -322,16 +515,17 @@ onBeforeUnmount(stopProgress)
}
.error-card h2 {
color: #1f2937;
color: #f3f8ff;
font-size: 32px;
font-weight: 600;
letter-spacing: 2px;
text-shadow: 0 0 24px rgba(255, 100, 100, 0.2);
}
.error-card p {
margin-top: 16px;
max-width: 760px;
color: var(--muted);
color: rgba(178, 202, 232, 0.72);
font-size: 20px;
line-height: 1.6;
}
@@ -349,64 +543,119 @@ onBeforeUnmount(stopProgress)
font-size: 21px;
font-weight: 600;
letter-spacing: 3px;
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
background 0.2s ease,
border-color 0.2s ease;
}
.error-button--ghost {
border: 2px solid var(--line-strong);
color: var(--ink-soft);
background: #fff;
border: 1px solid rgba(130, 175, 255, 0.3);
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
}
.error-button--ghost:hover {
background: var(--surface-soft);
border-color: rgba(150, 205, 255, 0.5);
background: rgba(30, 66, 128, 0.6);
}
.error-button--primary {
color: #fff;
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
box-shadow: 0 10px 22px rgba(47, 111, 208, 0.28);
background: linear-gradient(180deg, #6fc6ff 0%, #3f86f0 55%, #2c63c9 100%);
box-shadow:
0 12px 26px rgba(47, 111, 208, 0.35),
inset 0 1px 0 rgba(255, 255, 255, 0.4);
color: #04101f;
}
.error-button--primary:hover {
box-shadow:
0 16px 32px rgba(47, 111, 208, 0.45),
inset 0 1px 0 rgba(255, 255, 255, 0.45);
transform: translateY(-1px);
box-shadow: 0 14px 28px rgba(47, 111, 208, 0.36);
}
.params-card {
position: relative;
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);
border: 1px solid rgba(130, 175, 255, 0.16);
border-radius: 26px;
background: linear-gradient(
158deg,
rgba(255, 255, 255, 0.07) 0%,
rgba(255, 255, 255, 0.025) 58%,
rgba(255, 255, 255, 0.04) 100%
);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.45),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
}
.params-card::before {
content: '';
position: absolute;
top: 0;
right: 32px;
left: 32px;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(120, 180, 255, 0.55), transparent);
pointer-events: none;
}
.params-card__header {
display: flex;
flex: none;
align-items: center;
height: 64px;
padding: 0 22px;
border-bottom: 1px solid #e4e8ee;
background: #f3f4f6;
height: 96px;
padding: 0 26px;
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(120deg, rgba(30, 66, 128, 0.24) 0%, transparent 70%);
}
.params-card__heading {
display: flex;
flex-direction: column;
gap: 6px;
}
.params-card__eyebrow {
color: #5aa2ff;
font-size: 12px;
font-weight: 600;
letter-spacing: 2.6px;
text-transform: uppercase;
}
.params-card__header h2 {
color: #333b46;
font-size: 23px;
font-weight: 500;
letter-spacing: 1px;
display: flex;
align-items: center;
gap: 12px;
color: #eaf3ff;
font-size: 26px;
font-weight: 600;
letter-spacing: 2px;
}
.params-card__header h2::before {
content: '';
width: 4px;
height: 22px;
border-radius: 4px;
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
}
.params-card__body {
padding: 26px 22px;
padding: 28px 24px;
}
.param-field {
margin-bottom: 24px;
margin-bottom: 26px;
}
.param-field:last-child {
@@ -416,9 +665,9 @@ onBeforeUnmount(stopProgress)
.param-field__label {
display: block;
margin-bottom: 10px;
color: #46505e;
font-size: 22px;
letter-spacing: 0.5px;
color: rgba(158, 190, 226, 0.7);
font-size: 20px;
letter-spacing: 1px;
}
.param-field__value {
@@ -426,20 +675,90 @@ onBeforeUnmount(stopProgress)
align-items: center;
height: 62px;
padding: 0 18px;
border: 1px solid #d8dde6;
border-radius: 7px;
background: #fff;
color: #2e3641;
border: 1px solid rgba(130, 175, 255, 0.16);
border-radius: 12px;
background: rgba(8, 18, 38, 0.6);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
color: #e8f2ff;
font-size: 24px;
box-shadow: inset 0 1px 2px rgba(30, 45, 66, 0.03);
}
.param-field__value small {
margin-left: 8px;
color: #8d97a4;
color: rgba(158, 190, 226, 0.55);
font-size: 18px;
}
.param-field__value--position {
justify-content: space-between;
gap: 12px;
}
.param-field__value--status {
gap: 10px;
}
.param-field__dot {
flex: none;
width: 9px;
height: 9px;
border-radius: 50%;
background: #c9d4e4;
}
.param-field__value--status.is-ready {
color: #8ff5e7;
}
.param-field__value--status.is-ready .param-field__dot {
background: #74f4c5;
box-shadow: 0 0 10px rgba(116, 244, 197, 0.9);
}
.param-field__value--status.is-moving {
color: #ffd98a;
}
.param-field__value--status.is-moving .param-field__dot {
background: #ffd86a;
box-shadow: 0 0 10px rgba(255, 216, 106, 0.8);
}
.param-field__value--status.is-off {
color: rgba(255, 154, 145, 0.9);
}
.param-field__value--status.is-off .param-field__dot {
background: #ff9a91;
box-shadow: 0 0 10px rgba(255, 154, 145, 0.7);
}
.params-card__hint {
display: flex;
gap: 12px;
margin: auto 24px 26px;
padding: 16px 18px;
border: 1px solid rgba(130, 175, 255, 0.14);
border-radius: 14px;
background: rgba(8, 18, 38, 0.45);
color: rgba(158, 190, 226, 0.66);
font-size: 16px;
line-height: 1.6;
}
.params-card__hint-mark {
display: grid;
flex: none;
place-items: center;
width: 24px;
height: 24px;
border: 1px solid rgba(130, 195, 255, 0.35);
border-radius: 50%;
color: #8fc6ff;
font-size: 14px;
font-weight: 700;
}
.scan-progress {
position: absolute;
top: 900px;
@@ -460,18 +779,36 @@ onBeforeUnmount(stopProgress)
flex: none;
width: 280px;
height: 54px;
border-radius: 10px;
color: #fff;
border-radius: 12px;
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
box-shadow:
0 14px 30px rgba(240, 172, 11, 0.28),
0 0 26px rgba(255, 190, 60, 0.16),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
color: #241500;
font-size: 23px;
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;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
filter 0.2s ease;
}
.scan-next:hover {
transform: translateY(-1px);
box-shadow: 0 14px 28px rgba(47, 111, 208, 0.36);
.scan-next:not(:disabled):hover {
box-shadow:
0 18px 38px rgba(240, 172, 11, 0.36),
0 0 34px rgba(255, 190, 60, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
transform: translateY(-2px);
}
.scan-next:disabled {
cursor: default;
filter: saturate(0.35);
opacity: 0.45;
box-shadow: none;
transform: none;
}
</style>
+522 -70
View File
@@ -1,83 +1,322 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useRoute, 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'
import { abortScan, getCurrentScan, type ScanProgress } from '@/api/scan'
import { useStageHub } from '@/composables/useStageHub'
import { showToast } from '@/composables/useToast'
const router = useRouter()
const route = useRoute()
const { progress } = useTimedProgress(10000, () => {
void router.replace({ name: 'result' })
const queryScanId = computed(() => {
const raw = route.query.scanId
return typeof raw === 'string' ? raw : ''
})
const progressLabel = computed(() => `光谱采集 ${Math.round(progress.value)}%`)
const sampleIndex = computed(() =>
Math.min(5, Math.max(1, Math.ceil(progress.value / 20))),
const activeScanId = ref(queryScanId.value)
const fallbackProgress = ref<ScanProgress | null>(null)
const {
position,
progress: hubProgress,
spectrum: liveSpectrum,
finished,
connect,
} = useStageHub()
const progress = computed(() => hubProgress.value ?? fallbackProgress.value)
const phaseText = computed(() => mapPhase(progress.value?.phase))
const percent = computed(() => progress.value?.percent ?? 0)
const progressLabel = computed(() => `光谱采集 ${percent.value}%`)
const progressNote = computed(
() => progress.value?.message ?? '等待扫描开始',
)
function abortProcess() {
const chartWavelengths = computed(() => liveSpectrum.value?.wavelengths ?? [])
const chartSpectrum = computed(() => liveSpectrum.value?.spectrum ?? [])
const chartSegments = computed(() => liveSpectrum.value?.segments ?? [])
const chartStatus = computed(() => {
if (progress.value?.phase === 'Acquiring') return '正在采集光谱'
if (liveSpectrum.value) {
return `第 ${liveSpectrum.value.pointIndex + 1} 点光谱`
}
return '等待光谱数据'
})
const activeStep = computed(() => {
switch (progress.value?.phase) {
case 'Homing':
case 'Moving':
case 'Returning':
return 'move'
case 'Focusing':
return 'focus'
case 'Acquiring':
return 'acquire'
case 'Analyzing':
case 'Writing':
return 'analyze'
case 'Completed':
return 'done'
default:
return ''
}
})
const stepOrder = ['move', 'focus', 'acquire', 'analyze'] as const
function stepState(key: (typeof stepOrder)[number]) {
const active = activeStep.value
if (active === 'done') return 'done'
if (!active) return ''
const activeIndex = stepOrder.indexOf(active as (typeof stepOrder)[number])
const index = stepOrder.indexOf(key)
if (index < activeIndex) return 'done'
if (index === activeIndex) return 'active'
return ''
}
const footerItems = computed(() => [
position.value
? `X ${position.value.x} mm / Y ${position.value.y} mm`
: '位移台未连接',
phaseText.value,
progress.value
? `采样点 ${Math.min(progress.value.completedPoints, progress.value.totalPoints)} / ${progress.value.totalPoints}`
: '等待开始',
])
let pollTimer: number | undefined
let navigated = false
function mapPhase(phase?: string) {
switch (phase) {
case 'Idle':
return '准备中'
case 'Homing':
return '位移台回零'
case 'Moving':
return '位移台移动'
case 'Focusing':
return '对焦中'
case 'Acquiring':
return '收光中'
case 'Returning':
return '位移台回零'
case 'Analyzing':
return 'NIST 分析中'
case 'Writing':
return '写入数据库'
case 'Completed':
return '采集完成'
case 'Aborted':
return '已中止'
case 'Failed':
return '采集失败'
default:
return '等待开始'
}
}
function goResult(scanId: string) {
if (navigated) return
navigated = true
void router.replace({
name: 'result',
query: { scanId },
})
}
function goHomeWithToast(message?: string) {
if (navigated) return
navigated = true
if (message) showToast(message)
void router.replace({ name: 'home' })
}
async function abortProcess() {
try {
await abortScan()
} catch (error) {
showToast(error instanceof Error ? error.message : '中止扫描失败')
}
goHomeWithToast()
}
async function poll() {
try {
const current = await getCurrentScan()
fallbackProgress.value = current
if (!activeScanId.value && current.scanId) {
activeScanId.value = current.scanId
}
if (!activeScanId.value && current.phase === 'Idle') {
goHomeWithToast()
return
}
if (current.phase === 'Completed' && current.scanId) {
goResult(current.scanId)
return
}
if (current.phase === 'Aborted' || current.phase === 'Failed') {
goHomeWithToast(current.message || '扫描已结束')
}
} catch {
// 轮询失败时保留 SignalR 推送的状态
}
}
watch(finished, (value) => {
if (!value) return
if (value.status === 'Completed') {
goResult(value.scanId || activeScanId.value)
return
}
goHomeWithToast(value.error ?? '扫描已中止')
})
onMounted(() => {
void connect()
void poll()
pollTimer = window.setInterval(poll, 2000)
})
onBeforeUnmount(() => {
if (pollTimer !== undefined) {
window.clearInterval(pollTimer)
pollTimer = undefined
}
})
</script>
<template>
<AppStage>
<PageHeader title="光谱数据采集与分析" variant="process">
<div class="spectrum-bg" aria-hidden="true">
<span class="spectrum-bg__orb spectrum-bg__orb--blue"></span>
<span class="spectrum-bg__orb spectrum-bg__orb--cyan"></span>
<span class="spectrum-bg__orb spectrum-bg__orb--violet"></span>
</div>
<PageHeader title="光谱数据采集与分析" variant="process" theme="dark">
<template #left>
<button class="header-button header-button--warn" type="button" @click="abortProcess">
<button class="spectrum-abort" type="button" @click="abortProcess">
中止流程
</button>
</template>
</PageHeader>
<main class="spectrum-main">
<SpectrumChart class="spectrum-chart" />
<SpectrumChart
class="spectrum-chart"
:wavelengths="chartWavelengths"
:spectrum="chartSpectrum"
:segments="chartSegments"
:status-text="chartStatus"
/>
<aside class="analysis-card">
<header class="analysis-card__header">
<h2>分析步骤</h2>
<div class="analysis-card__heading">
<span class="analysis-card__eyebrow">Scan Steps</span>
<h2>扫描步骤</h2>
</div>
</header>
<div class="analysis-card__body">
<div class="analysis-step">
<div
class="analysis-step"
:class="{
'analysis-step--active': stepState('move') === 'active',
'analysis-step--done': stepState('move') === 'done',
}"
>
<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" />
<path d="M4 12h16M4 12l4-4M4 12l4 4M20 12l-4-4M20 12l-4 4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</span>
<span class="analysis-step__text">正在拟合峰值</span>
<span class="analysis-step__text">位移台移动</span>
<span class="analysis-step__chevron">›</span>
</div>
<div class="analysis-step">
<div
class="analysis-step"
:class="{
'analysis-step--active': stepState('focus') === 'active',
'analysis-step--done': stepState('focus') === 'done',
}"
>
<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" />
<circle cx="12" cy="12" r="7" fill="none" stroke="currentColor" stroke-width="1.6" />
<path d="M12 2v4M12 18v4M2 12h4M18 12h4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
</svg>
</span>
<span class="analysis-step__text">扣除连续背景</span>
<span class="analysis-step__text">单次对焦</span>
<span class="analysis-step__chevron">›</span>
</div>
<div class="analysis-step">
<div
class="analysis-step"
:class="{
'analysis-step--active': stepState('acquire') === 'active',
'analysis-step--done': stepState('acquire') === 'done',
}"
>
<span class="analysis-step__icon analysis-step__icon--blue">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M3 14l3-6 3 10 3-14 3 12 3-8 3 6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</span>
<span class="analysis-step__text">光谱仪收光</span>
<span class="analysis-step__chevron">›</span>
</div>
<div
class="analysis-step"
:class="{
'analysis-step--active': stepState('analyze') === 'active',
'analysis-step--done': stepState('analyze') === 'done',
}"
>
<span class="analysis-step__icon analysis-step__icon--amber">
<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__text">NIST 元素分析</span>
<span class="analysis-step__chevron">›</span>
</div>
<div class="analysis-card__track" aria-hidden="true">
<span></span>
<div class="analysis-position">
<span class="analysis-position__label">当前位置</span>
<span class="analysis-position__value">
X {{ position ? position.x : '—' }} / Y {{ position ? position.y : '—' }}
<small>mm</small>
</span>
</div>
<div class="analysis-hint">
<span class="analysis-hint__mark">i</span>
<p>扫描过程中请勿打开样品仓或触碰位移台,以免影响点位与光谱数据。</p>
</div>
</div>
</aside>
@@ -85,20 +324,107 @@ function abortProcess() {
<div class="spectrum-progress">
<ProgressStrip
:progress="progress"
:progress="percent"
:label="progressLabel"
:note="`第 ${sampleIndex} / 5 次采样`"
:note="progressNote"
theme="dark"
/>
</div>
<StatusFooter
icon="laser"
:items="['激光发射正常', '探测器积分完成', '数据保存中']"
/>
<StatusFooter icon="laser" :items="footerItems" theme="dark" />
</AppStage>
</template>
<style scoped>
.spectrum-bg {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
background:
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
}
.spectrum-bg::before {
content: '';
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
background-size: 64px 64px;
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
}
.spectrum-bg__orb {
position: absolute;
border-radius: 50%;
filter: blur(100px);
animation: spectrum-orb-drift 16s ease-in-out infinite alternate;
}
.spectrum-bg__orb--blue {
top: -340px;
left: -160px;
width: 760px;
height: 760px;
background: rgba(48, 118, 255, 0.3);
}
.spectrum-bg__orb--cyan {
top: -200px;
right: -220px;
width: 640px;
height: 640px;
background: rgba(0, 214, 255, 0.18);
animation-delay: -5s;
}
.spectrum-bg__orb--violet {
bottom: -360px;
left: 36%;
width: 700px;
height: 700px;
background: rgba(124, 92, 255, 0.18);
animation-delay: -10s;
}
@keyframes spectrum-orb-drift {
from {
transform: translate3d(0, 0, 0) scale(1);
}
to {
transform: translate3d(42px, 30px, 0) scale(1.08);
}
}
.spectrum-abort {
width: 300px;
height: 68px;
border: 1px solid rgba(255, 190, 60, 0.45);
border-radius: 14px;
background: linear-gradient(120deg, rgba(255, 186, 40, 0.18), rgba(255, 150, 20, 0.06));
color: #ffd98a;
font-size: 26px;
font-weight: 600;
letter-spacing: 3px;
backdrop-filter: blur(10px);
transition:
transform 0.2s ease,
border-color 0.2s ease,
background 0.2s ease;
}
.spectrum-abort:hover {
border-color: rgba(255, 205, 100, 0.65);
background: linear-gradient(120deg, rgba(255, 186, 40, 0.26), rgba(255, 150, 20, 0.1));
transform: translateY(-1px);
}
.spectrum-main {
position: absolute;
top: 142px;
@@ -115,36 +441,84 @@ function abortProcess() {
}
.analysis-card {
position: relative;
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);
border: 1px solid rgba(130, 175, 255, 0.16);
border-radius: 26px;
background: linear-gradient(
158deg,
rgba(255, 255, 255, 0.07) 0%,
rgba(255, 255, 255, 0.025) 58%,
rgba(255, 255, 255, 0.04) 100%
);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.45),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
}
.analysis-card::before {
content: '';
position: absolute;
top: 0;
right: 32px;
left: 32px;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(120, 180, 255, 0.55), transparent);
pointer-events: none;
}
.analysis-card__header {
display: flex;
flex: none;
align-items: center;
height: 64px;
padding: 0 22px;
border-bottom: 1px solid #e4e8ee;
background: #f3f4f6;
height: 96px;
padding: 0 26px;
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(120deg, rgba(30, 66, 128, 0.24) 0%, transparent 70%);
}
.analysis-card__heading {
display: flex;
flex-direction: column;
gap: 6px;
}
.analysis-card__eyebrow {
color: #5aa2ff;
font-size: 12px;
font-weight: 600;
letter-spacing: 2.6px;
text-transform: uppercase;
}
.analysis-card__header h2 {
color: #333b46;
font-size: 23px;
font-weight: 500;
letter-spacing: 1px;
display: flex;
align-items: center;
gap: 12px;
color: #eaf3ff;
font-size: 26px;
font-weight: 600;
letter-spacing: 2px;
}
.analysis-card__header h2::before {
content: '';
width: 4px;
height: 22px;
border-radius: 4px;
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
}
.analysis-card__body {
display: flex;
flex: 1;
padding: 16px 18px;
flex-direction: column;
padding: 18px;
}
.analysis-step {
@@ -152,17 +526,42 @@ function abortProcess() {
align-items: center;
gap: 16px;
height: 78px;
padding: 0 10px;
border-bottom: 1px solid #eef1f5;
padding: 0 14px;
border: 1px solid transparent;
border-radius: 14px;
opacity: 0.45;
transition:
opacity 0.2s ease,
background 0.2s ease,
border-color 0.2s ease,
box-shadow 0.2s ease;
}
.analysis-step + .analysis-step {
margin-top: 8px;
}
.analysis-step--active {
border-color: rgba(120, 200, 255, 0.35);
background: rgba(70, 140, 255, 0.14);
box-shadow:
0 0 24px rgba(70, 140, 255, 0.18),
inset 0 1px 0 rgba(255, 255, 255, 0.06);
opacity: 1;
}
.analysis-step--done {
opacity: 0.9;
}
.analysis-step__icon {
display: grid;
flex: none;
place-items: center;
width: 38px;
height: 38px;
border-radius: 50%;
width: 42px;
height: 42px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
}
.analysis-step__icon svg {
@@ -171,45 +570,98 @@ function abortProcess() {
}
.analysis-step__icon--blue {
color: #2f6fd0;
background: #eaf2ff;
border-color: rgba(120, 190, 255, 0.25);
background: rgba(70, 140, 255, 0.16);
color: #8fd0ff;
}
.analysis-step__icon--amber {
color: #d59400;
background: #fff4d6;
border-color: rgba(255, 205, 100, 0.22);
background: rgba(255, 180, 40, 0.14);
color: #ffd166;
}
.analysis-step__text {
flex: 1;
color: #3f4b5b;
color: rgba(200, 220, 245, 0.72);
font-size: 21px;
letter-spacing: 0.5px;
}
.analysis-step--active .analysis-step__text {
color: #f2f8ff;
}
.analysis-step--done .analysis-step__text {
color: rgba(220, 238, 255, 0.9);
}
.analysis-step__chevron {
color: #b2bcc8;
color: rgba(130, 175, 255, 0.35);
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-step--active .analysis-step__chevron {
color: #7fe0ff;
}
.analysis-card__track span {
position: absolute;
top: 18px;
left: 0;
width: 6px;
height: 54px;
border-radius: 6px;
background: #c9d3df;
.analysis-position {
display: flex;
flex-direction: column;
gap: 8px;
margin-top: 18px;
padding: 16px 18px;
border: 1px solid rgba(130, 175, 255, 0.14);
border-radius: 14px;
background: rgba(8, 18, 38, 0.55);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.analysis-position__label {
color: rgba(158, 190, 226, 0.7);
font-size: 16px;
letter-spacing: 1px;
}
.analysis-position__value {
color: #e8f2ff;
font-size: 26px;
font-weight: 600;
letter-spacing: 1px;
}
.analysis-position__value small {
margin-left: 6px;
color: rgba(158, 190, 226, 0.55);
font-size: 16px;
font-weight: 400;
}
.analysis-hint {
display: flex;
gap: 12px;
margin-top: auto;
padding: 16px 18px;
border: 1px solid rgba(130, 175, 255, 0.14);
border-radius: 14px;
background: rgba(8, 18, 38, 0.45);
color: rgba(158, 190, 226, 0.66);
font-size: 15px;
line-height: 1.6;
}
.analysis-hint__mark {
display: grid;
flex: none;
place-items: center;
width: 24px;
height: 24px;
border: 1px solid rgba(130, 195, 255, 0.35);
border-radius: 50%;
color: #8fc6ff;
font-size: 14px;
font-weight: 700;
}
.spectrum-progress {
+278 -83
View File
@@ -199,9 +199,19 @@ onMounted(() => {
<template>
<AppStage>
<PageHeader title="系统参数管理" subtitle="系统运行参数集中配置">
<div class="system-bg" aria-hidden="true">
<span class="system-bg__orb system-bg__orb--blue"></span>
<span class="system-bg__orb system-bg__orb--cyan"></span>
<span class="system-bg__orb system-bg__orb--violet"></span>
</div>
<PageHeader
title="系统参数管理"
subtitle="系统运行参数集中配置"
theme="dark"
>
<template #left>
<button class="header-button header-button--outline" type="button" @click="goHome">
<button class="admin-back" type="button" @click="goHome">
返回
</button>
</template>
@@ -377,6 +387,95 @@ onMounted(() => {
</template>
<style scoped>
.system-bg {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
background:
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
}
.system-bg::before {
content: '';
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
background-size: 64px 64px;
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
}
.system-bg__orb {
position: absolute;
border-radius: 50%;
filter: blur(100px);
animation: system-orb-drift 16s ease-in-out infinite alternate;
}
.system-bg__orb--blue {
top: -340px;
left: -160px;
width: 760px;
height: 760px;
background: rgba(48, 118, 255, 0.3);
}
.system-bg__orb--cyan {
top: -200px;
right: -220px;
width: 640px;
height: 640px;
background: rgba(0, 214, 255, 0.18);
animation-delay: -5s;
}
.system-bg__orb--violet {
bottom: -360px;
left: 36%;
width: 700px;
height: 700px;
background: rgba(124, 92, 255, 0.18);
animation-delay: -10s;
}
@keyframes system-orb-drift {
from {
transform: translate3d(0, 0, 0) scale(1);
}
to {
transform: translate3d(42px, 30px, 0) scale(1.08);
}
}
.admin-back {
width: 132px;
height: 60px;
border: 1px solid rgba(130, 190, 255, 0.35);
border-radius: 12px;
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
font-size: 24px;
font-weight: 600;
letter-spacing: 3px;
backdrop-filter: blur(10px);
transition:
transform 0.2s ease,
border-color 0.2s ease,
background 0.2s ease;
}
.admin-back:hover {
border-color: rgba(150, 205, 255, 0.55);
background: rgba(30, 66, 128, 0.65);
transform: translateY(-1px);
}
.system-main {
position: absolute;
top: 176px;
@@ -386,13 +485,32 @@ onMounted(() => {
}
.config-card {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
border-radius: var(--radius-lg);
background: #fff;
box-shadow: var(--shadow-card);
border: 1px solid rgba(130, 175, 255, 0.18);
border-radius: 26px;
background: linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
box-shadow:
0 30px 70px rgba(0, 10, 32, 0.5),
0 0 40px rgba(48, 118, 255, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
color-scheme: dark;
}
.config-card::before {
content: '';
position: absolute;
top: 0;
right: 40px;
left: 40px;
z-index: 2;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
pointer-events: none;
}
.config-toolbar {
@@ -402,7 +520,8 @@ onMounted(() => {
justify-content: space-between;
gap: 24px;
padding: 24px 30px;
border-bottom: 1px solid var(--line);
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
background: linear-gradient(120deg, rgba(26, 58, 112, 0.24) 0%, transparent 70%);
}
.config-search {
@@ -415,18 +534,26 @@ onMounted(() => {
width: 460px;
height: 54px;
padding: 0 20px;
border: 2px solid var(--line-strong);
border-radius: 10px;
color: var(--ink);
border: 1px solid rgba(130, 175, 255, 0.18);
border-radius: 12px;
background: rgba(8, 18, 38, 0.6);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
color: #e8f2ff;
font-family: inherit;
font-size: 19px;
outline: none;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.config-search__input::placeholder {
color: rgba(158, 190, 226, 0.42);
}
.config-search__input:focus {
border-color: var(--blue);
box-shadow: 0 0 0 4px rgba(47, 111, 208, 0.12);
border-color: rgba(120, 200, 255, 0.55);
box-shadow:
0 0 0 4px rgba(70, 140, 255, 0.14),
0 0 24px rgba(70, 140, 255, 0.1);
}
.config-toolbar__right {
@@ -438,40 +565,54 @@ onMounted(() => {
.toolbar-button {
height: 54px;
padding: 0 26px;
border-radius: 10px;
border: 2px solid var(--blue);
color: var(--blue);
border: 1px solid rgba(130, 175, 255, 0.28);
border-radius: 12px;
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
font-size: 19px;
font-weight: 600;
letter-spacing: 2px;
background: #fff;
transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
transition:
transform 0.2s ease,
background 0.2s ease,
border-color 0.2s ease,
box-shadow 0.2s ease;
}
.toolbar-button:hover {
background: var(--blue-soft);
border-color: rgba(150, 205, 255, 0.5);
background: rgba(30, 66, 128, 0.6);
transform: translateY(-1px);
}
.toolbar-button--ghost {
border-color: var(--line-strong);
color: var(--ink-soft);
border-color: rgba(130, 175, 255, 0.18);
background: rgba(10, 24, 48, 0.45);
color: rgba(178, 202, 232, 0.82);
}
.toolbar-button--ghost:hover {
background: var(--surface-soft);
border-color: rgba(150, 205, 255, 0.35);
background: rgba(20, 44, 86, 0.55);
}
.toolbar-button--primary {
border-color: transparent;
color: #fff;
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
box-shadow: 0 8px 18px rgba(47, 111, 208, 0.24);
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
box-shadow:
0 12px 26px rgba(240, 172, 11, 0.26),
0 0 24px rgba(255, 190, 60, 0.14),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
color: #241500;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
}
.toolbar-button--primary:hover {
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
box-shadow: 0 12px 24px rgba(47, 111, 208, 0.32);
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
box-shadow:
0 16px 34px rgba(240, 172, 11, 0.34),
0 0 32px rgba(255, 190, 60, 0.22),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.config-table {
@@ -495,9 +636,10 @@ onMounted(() => {
flex: none;
height: 62px;
margin-top: 18px;
border-radius: 12px;
background: var(--surface-soft);
color: var(--muted);
border: 1px solid rgba(130, 175, 255, 0.12);
border-radius: 14px;
background: rgba(255, 255, 255, 0.04);
color: rgba(158, 190, 226, 0.65);
font-size: 18px;
font-weight: 600;
letter-spacing: 1px;
@@ -507,22 +649,33 @@ onMounted(() => {
flex: 1;
min-height: 0;
overflow-y: auto;
margin-right: -6px;
padding-right: 6px;
}
.config-table__body::-webkit-scrollbar {
width: 6px;
}
.config-table__body::-webkit-scrollbar-thumb {
border-radius: 3px;
background: rgba(130, 175, 255, 0.25);
}
.config-row {
min-height: 72px;
border-bottom: 1px solid var(--line);
color: var(--ink-soft);
border-bottom: 1px solid rgba(130, 175, 255, 0.08);
color: rgba(210, 228, 250, 0.8);
font-size: 19px;
transition: background 0.18s ease;
}
.config-row:hover {
background: #f8fafc;
background: rgba(70, 140, 255, 0.08);
}
.col-name {
color: var(--ink);
color: #f2f8ff;
font-weight: 600;
}
@@ -542,47 +695,53 @@ onMounted(() => {
.row-button {
height: 42px;
padding: 0 18px;
border: 1px solid var(--line-strong);
border-radius: 8px;
color: var(--blue);
border: 1px solid rgba(120, 190, 255, 0.28);
border-radius: 10px;
background: rgba(70, 140, 255, 0.12);
color: #8fd0ff;
font-size: 17px;
font-weight: 600;
letter-spacing: 1px;
background: #fff;
transition: background 0.18s ease, border-color 0.18s ease;
transition:
background 0.18s ease,
border-color 0.18s ease,
color 0.18s ease;
}
.row-button:hover {
border-color: var(--blue);
background: var(--blue-soft);
border-color: rgba(150, 205, 255, 0.5);
background: rgba(70, 140, 255, 0.22);
}
.row-button--danger {
color: var(--red);
border-color: rgba(255, 120, 120, 0.28);
background: rgba(255, 84, 84, 0.1);
color: #ff9d9d;
}
.row-button--danger:hover {
border-color: var(--red);
background: #fdeeee;
border-color: rgba(255, 150, 150, 0.5);
background: rgba(255, 84, 84, 0.18);
}
.config-empty {
padding: 80px 0;
color: var(--muted-light);
color: rgba(158, 190, 226, 0.5);
font-size: 20px;
letter-spacing: 1px;
text-align: center;
}
.config-footer {
flex: none;
height: 64px;
display: flex;
flex: none;
align-items: center;
justify-content: flex-end;
height: 64px;
padding: 0 48px;
border-top: 1px solid var(--line);
color: var(--muted);
border-top: 1px solid rgba(130, 175, 255, 0.12);
background: rgba(8, 18, 38, 0.55);
color: rgba(158, 190, 226, 0.65);
font-size: 18px;
letter-spacing: 1px;
}
@@ -594,26 +753,31 @@ onMounted(() => {
display: grid;
place-items: center;
padding: 24px;
background: rgba(18, 33, 54, 0.44);
backdrop-filter: blur(5px);
background: rgba(3, 8, 18, 0.68);
backdrop-filter: blur(8px);
}
.form-card {
width: 760px;
padding: 36px 40px 34px;
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);
border: 1px solid rgba(130, 175, 255, 0.2);
border-radius: 26px;
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
box-shadow:
0 40px 90px rgba(0, 6, 20, 0.6),
0 0 50px rgba(48, 118, 255, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
color-scheme: dark;
}
.form-card h2,
.confirm-card h2 {
color: #1f2937;
color: #eef5ff;
font-size: 30px;
font-weight: 600;
letter-spacing: 1px;
text-align: center;
text-shadow: 0 0 24px rgba(80, 150, 255, 0.28);
}
.form-grid {
@@ -627,7 +791,7 @@ onMounted(() => {
display: flex;
flex-direction: column;
gap: 10px;
color: var(--ink-soft);
color: rgba(158, 190, 226, 0.72);
font-size: 18px;
letter-spacing: 0.5px;
}
@@ -637,7 +801,7 @@ onMounted(() => {
}
.form-field em {
color: var(--red);
color: #ff9d9d;
font-style: normal;
}
@@ -645,9 +809,11 @@ onMounted(() => {
.form-field textarea {
width: 100%;
padding: 14px 18px;
border: 2px solid var(--line-strong);
border-radius: 10px;
color: var(--ink);
border: 1px solid rgba(130, 175, 255, 0.18);
border-radius: 12px;
background: rgba(6, 14, 28, 0.7);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
color: #e8f2ff;
font-family: inherit;
font-size: 19px;
outline: none;
@@ -655,19 +821,26 @@ onMounted(() => {
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-field input::placeholder,
.form-field textarea::placeholder {
color: rgba(158, 190, 226, 0.4);
}
.form-field input {
height: 56px;
}
.form-field input:focus,
.form-field textarea:focus {
border-color: var(--blue);
box-shadow: 0 0 0 4px rgba(47, 111, 208, 0.12);
border-color: rgba(120, 200, 255, 0.55);
box-shadow:
0 0 0 4px rgba(70, 140, 255, 0.14),
0 0 24px rgba(70, 140, 255, 0.1);
}
.form-error {
margin-top: 16px;
color: var(--red);
color: #ff9d9d;
font-size: 17px;
letter-spacing: 0.5px;
text-align: center;
@@ -687,58 +860,80 @@ onMounted(() => {
font-size: 20px;
font-weight: 600;
letter-spacing: 3px;
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
background 0.2s ease,
border-color 0.2s ease;
}
.form-button:disabled {
cursor: default;
opacity: 0.65;
opacity: 0.5;
}
.form-button--ghost {
border: 2px solid var(--line-strong);
color: var(--ink-soft);
background: #fff;
border: 1px solid rgba(130, 175, 255, 0.28);
background: rgba(18, 40, 78, 0.5);
color: #bcd9ff;
}
.form-button--ghost:hover:not(:disabled) {
background: var(--surface-soft);
border-color: rgba(150, 205, 255, 0.5);
background: rgba(30, 66, 128, 0.6);
}
.form-button--primary {
color: #fff;
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
box-shadow: 0 10px 22px rgba(47, 111, 208, 0.28);
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
box-shadow:
0 14px 30px rgba(240, 172, 11, 0.28),
0 0 26px rgba(255, 190, 60, 0.16),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
color: #241500;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
}
.form-button--primary:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: 0 14px 28px rgba(47, 111, 208, 0.36);
box-shadow:
0 18px 38px rgba(240, 172, 11, 0.36),
0 0 34px rgba(255, 190, 60, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
transform: translateY(-2px);
}
.form-button--danger {
color: #fff;
background: linear-gradient(180deg, #ef6d66 0%, #e15b55 100%);
box-shadow: 0 10px 22px rgba(225, 91, 85, 0.26);
background: linear-gradient(180deg, #ff8b84 0%, #e15b55 100%);
box-shadow:
0 14px 30px rgba(225, 91, 85, 0.28),
0 0 26px rgba(255, 110, 100, 0.16),
inset 0 1px 0 rgba(255, 255, 255, 0.4);
color: #2a0806;
}
.form-button--danger:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: 0 14px 28px rgba(225, 91, 85, 0.34);
box-shadow:
0 18px 38px rgba(225, 91, 85, 0.36),
0 0 34px rgba(255, 110, 100, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.45);
transform: translateY(-2px);
}
.confirm-card {
width: 600px;
padding: 38px 44px 34px;
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);
border: 1px solid rgba(130, 175, 255, 0.2);
border-radius: 26px;
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
box-shadow:
0 40px 90px rgba(0, 6, 20, 0.6),
0 0 50px rgba(48, 118, 255, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
color-scheme: dark;
}
.confirm-card p {
margin-top: 18px;
color: var(--muted);
color: rgba(158, 190, 226, 0.7);
font-size: 19px;
letter-spacing: 0.5px;
text-align: center;
+5
View File
@@ -15,6 +15,11 @@ const proxy = {
changeOrigin: true,
ws: true,
},
'/stageHub': {
target: backend,
changeOrigin: true,
ws: true,
},
}
export default defineConfig({