first commit
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
<!--
|
||||
* 诊断报告 — 对齐 C端.html #sub-device-diagnosis (~line 5276)
|
||||
* 健康评分 + 8维度指标 + 优化建议 + 历史记录
|
||||
-->
|
||||
<template>
|
||||
<view class="sub-page">
|
||||
<nav-bar title="诊断报告" :show-back="true" @back="closeSub()" />
|
||||
|
||||
<scroll-view scroll-y class="page-content">
|
||||
<!-- 诊断日期 + 综合健康评分 -->
|
||||
<view class="score-card">
|
||||
<view class="sc-header">
|
||||
<text class="sc-label">诊断日期</text>
|
||||
<text class="sc-date">{{ data.date }}</text>
|
||||
</view>
|
||||
<view class="sc-hero">
|
||||
<text class="sc-title">综合健康评分</text>
|
||||
<text class="sc-score">{{ data.score }}</text>
|
||||
<text class="sc-badge" :class="data.badge">{{ data.level }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 8维度诊断指标 -->
|
||||
<view class="card">
|
||||
<text class="card-title">8维度诊断指标</text>
|
||||
<view class="info-row" v-for="dim in data.dimensions" :key="dim.name">
|
||||
<text class="ir-label">{{ dim.name }}</text>
|
||||
<text class="ir-val" :style="{ color: dim.color }">{{ dim.value }} → {{ dim.level }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 优化建议 -->
|
||||
<view class="card" v-if="data.suggestions.length">
|
||||
<text class="card-title">优化建议</text>
|
||||
<view v-for="(s, i) in data.suggestions" :key="i" class="suggest-item">
|
||||
<text class="suggest-title">{{ s.title }}</text>
|
||||
<text class="suggest-body">{{ s.body }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 历史诊断记录 -->
|
||||
<view class="card">
|
||||
<text class="card-title">历史诊断记录</text>
|
||||
<view class="list-group">
|
||||
<view v-for="(h, i) in data.history" :key="i" class="list-item">
|
||||
<view class="li-body">
|
||||
<text class="li-title">{{ h.date }} 诊断报告</text>
|
||||
<text class="li-sub">综合评分 {{ h.score }} · {{ h.level }}</text>
|
||||
</view>
|
||||
<text class="badge-item" :class="h.level === '优秀' ? 'badge-good' : h.level === '良好' ? 'badge-good' : h.level === '一般' ? 'badge-warn' : 'badge-bad'">{{ h.level }}</text>
|
||||
</view>
|
||||
<view v-if="!data.history.length" class="list-empty">
|
||||
<text class="empty-text">暂无历史诊断记录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import request from '@/utils/request'
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { closeSub, parseSubParams } from '@/composables/useNavigation'
|
||||
|
||||
const data = ref({
|
||||
date: '--', score: '--', level: '--', badge: 'b-s',
|
||||
dimensions: [], suggestions: [], history: [],
|
||||
})
|
||||
|
||||
onLoad(async (options) => {
|
||||
const params = parseSubParams(options)
|
||||
if (!params.id) return
|
||||
try {
|
||||
const res = await request.get('/c/devices/' + params.id + '/diagnosis', { showLoading: false })
|
||||
if (res.data) data.value = res.data
|
||||
} catch (e) {
|
||||
console.error('获取诊断报告失败', e)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sub-page { min-height: 100vh; background: #F2F4F8; }
|
||||
.page-content { height: calc(100vh - 88rpx); padding: 24rpx; }
|
||||
|
||||
// 评分卡片
|
||||
.score-card {
|
||||
background: #fff; border-radius: 14rpx; padding: 24rpx; margin-bottom: 24rpx;
|
||||
box-shadow: 0 1px 3px rgba(15,18,38,.04);
|
||||
}
|
||||
.sc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16rpx; }
|
||||
.sc-label { font-size: 26rpx; font-weight: 600; color: #0F1226; }
|
||||
.sc-date { font-size: 24rpx; color: #8B91A1; }
|
||||
.sc-hero {
|
||||
background: linear-gradient(135deg, #E6FAF5, #F0FBF8);
|
||||
border-radius: 10px; padding: 24rpx; text-align: center;
|
||||
}
|
||||
.sc-title { font-size: 22rpx; color: #8B91A1; display: block; }
|
||||
.sc-score { font-size: 64rpx; font-weight: 800; color: #00C4A7; display: block; margin: 8rpx 0; font-family: 'DIN Alternate', -apple-system, sans-serif; }
|
||||
.sc-badge { display: inline-block; padding: 4rpx 16rpx; border-radius: 8rpx; font-size: 22rpx; font-weight: 500;
|
||||
&.b-s { background: #E6FAF5; color: #00C4A7; }
|
||||
&.b-w { background: #FFF7E6; color: #FF8800; }
|
||||
&.b-d { background: #FFF1F0; color: #FF4D4F; }
|
||||
}
|
||||
|
||||
// 卡片
|
||||
.card { background: #fff; border-radius: 14rpx; padding: 24rpx; margin-bottom: 24rpx; box-shadow: 0 1px 3px rgba(15,18,38,.04); }
|
||||
.card-title { font-size: 28rpx; font-weight: 600; color: #0F1226; display: block; margin-bottom: 16rpx; }
|
||||
|
||||
// Info rows
|
||||
.info-row { display: flex; justify-content: space-between; padding: 14rpx 0; border-bottom: 0.5px solid #F3F5F9; &:last-child { border-bottom: none; } }
|
||||
.ir-label { font-size: 26rpx; color: #5A6072; }
|
||||
.ir-val { font-size: 26rpx; font-weight: 500; }
|
||||
|
||||
// 建议
|
||||
.suggest-item {
|
||||
background: #FFF7E6; border-left: 6rpx solid #FF8800; border-radius: 10px;
|
||||
padding: 20rpx; margin-bottom: 16rpx;
|
||||
&:last-child { margin-bottom: 0; }
|
||||
}
|
||||
.suggest-title { font-size: 24rpx; font-weight: 600; color: #FF8800; display: block; }
|
||||
.suggest-body { font-size: 22rpx; color: #8B91A1; display: block; margin-top: 8rpx; }
|
||||
|
||||
// 列表
|
||||
.list-group { }
|
||||
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 20rpx 0; border-bottom: 0.5px solid #F3F5F9; &:last-child { border-bottom: none; } }
|
||||
.li-title { font-size: 26rpx; color: #0F1226; font-weight: 500; display: block; }
|
||||
.li-sub { font-size: 22rpx; color: #8B91A1; display: block; margin-top: 4rpx; }
|
||||
.badge-item { padding: 4rpx 16rpx; border-radius: 8rpx; font-size: 20rpx; font-weight: 500;
|
||||
&.badge-good { background: #E6FAF5; color: #00C4A7; }
|
||||
&.badge-warn { background: #FFF7E6; color: #FF8800; }
|
||||
&.badge-bad { background: #FFF1F0; color: #FF4D4F; }
|
||||
}
|
||||
.list-empty { padding: 60rpx 0; text-align: center; }
|
||||
.empty-text { font-size: 24rpx; color: #BCC2CE; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user