Files
SpectraElement/Hardware-Vue/src/views/ResultView.vue
T
2026-11-13 09:51:38 +08:00

291 lines
6.7 KiB
Vue

<script setup lang="ts">
import { useRouter } from 'vue-router'
import AppStage from '@/components/AppStage.vue'
import PageHeader from '@/components/PageHeader.vue'
import MiniSpectrum from '@/components/MiniSpectrum.vue'
import { useCountdown } from '@/composables/useCountdown'
import { showToast } from '@/composables/useToast'
import reportQr from '@/assets/report-qr.png'
const router = useRouter()
function goHome() {
void router.replace({ name: 'home' })
}
const { remaining } = useCountdown(60, goHome)
const rows = [
{ element: 'Fe', intensity: '高', content: '3.82%', verdict: '检出' },
{ element: 'Cu', intensity: '中', content: '1.27%', verdict: '检出' },
{ element: 'Mg', intensity: '中', content: '0.94%', verdict: '检出' },
{ element: 'Si', intensity: '低', content: '0.41%', verdict: '痕量' },
]
function exportReport() {
showToast('报告导出功能正在研发中')
}
</script>
<template>
<AppStage>
<PageHeader title="检测完成" variant="result" />
<main class="result-main">
<section class="result-card">
<h2 class="result-card__title">元素检测结果</h2>
<div class="result-summary">
<MiniSpectrum />
<div class="result-badge">合金成分分析完成</div>
</div>
<table class="result-table">
<thead>
<tr>
<th>元素</th>
<th>强度</th>
<th>含量</th>
<th>判定</th>
</tr>
</thead>
<tbody>
<tr v-for="row in rows" :key="row.element">
<td class="result-table__element">{{ row.element }}</td>
<td>{{ row.intensity }}</td>
<td>{{ row.content }}</td>
<td>{{ row.verdict }}</td>
</tr>
</tbody>
</table>
</section>
<aside class="report-card">
<h2 class="report-card__title">获取完整报告</h2>
<div class="report-card__qr">
<img :src="reportQr" alt="获取完整检测报告二维码" />
</div>
<p class="report-card__caption">扫码关注微信公众号获取更详细结果</p>
</aside>
</main>
<div class="result-actions">
<p class="result-actions__countdown">
当前界面还有 <strong>{{ remaining }}</strong>s 后自动关闭...
</p>
<div class="result-actions__buttons">
<button class="result-button result-button--close" type="button" @click="goHome">
关闭
</button>
<button class="result-button result-button--export" type="button" @click="exportReport">
导出报告
</button>
</div>
</div>
</AppStage>
</template>
<style scoped>
.result-main {
position: absolute;
top: 150px;
right: 44px;
left: 44px;
display: grid;
grid-template-columns: minmax(0, 1fr) 620px;
gap: 40px;
height: 730px;
}
.result-card {
display: flex;
flex-direction: column;
padding: 28px 38px 34px;
overflow: hidden;
border-radius: 20px;
background:
radial-gradient(ellipse 70% 50% at 60% 0%, rgba(131, 185, 255, 0.28), transparent 70%),
linear-gradient(150deg, #3c7fdf 0%, #2f6fd0 48%, #2559ad 100%);
box-shadow:
0 18px 44px rgba(31, 77, 147, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.result-card__title {
color: #fff;
font-size: 38px;
font-weight: 600;
letter-spacing: 4px;
text-align: center;
text-shadow: 0 2px 6px rgba(15, 47, 98, 0.22);
}
.result-summary {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 28px;
margin-top: 22px;
}
.result-badge {
display: flex;
align-items: center;
justify-content: center;
min-width: 300px;
height: 58px;
padding: 0 24px;
border: 1px solid #e4c98e;
border-radius: 10px;
background: linear-gradient(180deg, #faf0d8 0%, #f3e3bd 100%);
color: #5e4726;
font-size: 24px;
letter-spacing: 2px;
box-shadow: 0 6px 16px rgba(24, 55, 105, 0.14);
}
.result-table {
width: 100%;
margin-top: 22px;
border-collapse: collapse;
table-layout: fixed;
}
.result-table th {
height: 58px;
border: 1px solid rgba(255, 255, 255, 0.5);
background: rgba(37, 89, 173, 0.2);
color: #fff;
font-size: 27px;
font-weight: 500;
letter-spacing: 2px;
}
.result-table td {
height: 94px;
border: 1px solid rgba(255, 255, 255, 0.66);
background: rgba(255, 255, 255, 0.95);
color: #222b38;
font-size: 26px;
text-align: center;
}
.result-table__element {
font-weight: 600;
}
.report-card {
display: flex;
flex-direction: column;
align-items: center;
padding: 28px 34px 34px;
overflow: hidden;
border-radius: 20px;
background:
radial-gradient(ellipse 75% 55% at 28% 0%, rgba(255, 220, 170, 0.34), transparent 70%),
linear-gradient(150deg, #f7a44b 0%, #ee8a2f 52%, #e67720 100%);
box-shadow:
0 18px 44px rgba(190, 104, 27, 0.24),
inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.report-card__title {
color: #fff;
font-size: 38px;
font-weight: 600;
letter-spacing: 4px;
text-align: center;
text-shadow: 0 2px 5px rgba(139, 73, 14, 0.22);
}
.report-card__qr {
width: 336px;
height: 356px;
margin-top: 28px;
padding: 18px;
border-radius: 14px;
background: #fff;
box-shadow: 0 14px 30px rgba(129, 69, 13, 0.2);
}
.report-card__qr img {
width: 100%;
height: 100%;
object-fit: contain;
image-rendering: auto;
}
.report-card__caption {
max-width: 480px;
margin-top: 26px;
color: #fff;
font-size: 21px;
line-height: 1.6;
letter-spacing: 1px;
text-align: center;
text-shadow: 0 1px 3px rgba(139, 73, 14, 0.2);
}
.result-actions {
position: absolute;
right: 44px;
bottom: 48px;
left: 44px;
display: flex;
align-items: center;
justify-content: space-between;
}
.result-actions__countdown {
color: #303a48;
font-size: 27px;
letter-spacing: 1px;
}
.result-actions__countdown strong {
color: var(--orange-dark);
font-size: 32px;
font-weight: 700;
}
.result-actions__buttons {
display: flex;
gap: 22px;
}
.result-button {
display: grid;
place-items: center;
width: 208px;
height: 70px;
border-radius: 10px;
font-size: 29px;
font-weight: 600;
letter-spacing: 5px;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.result-button:hover {
transform: translateY(-1px);
}
.result-button--close {
color: #fff;
background: linear-gradient(180deg, #ffc42b 0%, #f1ab0c 100%);
box-shadow:
0 10px 22px rgba(225, 154, 6, 0.26),
inset 0 1px 0 rgba(255, 255, 255, 0.55);
text-shadow: 0 1px 2px rgba(151, 94, 0, 0.24);
}
.result-button--export {
border: 1px solid #e2cb9f;
color: #755329;
background: linear-gradient(180deg, #fbf1dd 0%, #f1e0bd 100%);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
</style>