|
@@ -34,10 +34,10 @@
|
|
|
<view class="main-score-item" v-for="item in mainScores" :key="item.key">
|
|
<view class="main-score-item" v-for="item in mainScores" :key="item.key">
|
|
|
<view class="score-ring-wrap">
|
|
<view class="score-ring-wrap">
|
|
|
<svg width="140" height="140" viewBox="0 0 120 120">
|
|
<svg width="140" height="140" viewBox="0 0 120 120">
|
|
|
- <circle cx="60" cy="60" r="50" fill="none" stroke="#EEEEEE" stroke-width="8"/>
|
|
|
|
|
|
|
+ <circle cx="60" cy="60" r="50" fill="none" :stroke="svgTrack" stroke-width="8"/>
|
|
|
<circle cx="60" cy="60" r="50" fill="none" v-bind:stroke="item.color" stroke-width="8" v-bind:stroke-dasharray="item.circumference" v-bind:stroke-dashoffset="item.offset" stroke-linecap="round" transform="rotate(-90 60 60)"/>
|
|
<circle cx="60" cy="60" r="50" fill="none" v-bind:stroke="item.color" stroke-width="8" v-bind:stroke-dasharray="item.circumference" v-bind:stroke-dashoffset="item.offset" stroke-linecap="round" transform="rotate(-90 60 60)"/>
|
|
|
- <text x="60" y="52" text-anchor="middle" font-size="32" font-weight="bold" fill="#333">{{ item.score }}</text>
|
|
|
|
|
- <text x="60" y="72" text-anchor="middle" font-size="14" fill="#999">分</text>
|
|
|
|
|
|
|
+ <text x="60" y="52" text-anchor="middle" font-size="32" font-weight="bold" :fill="svgInk">{{ item.score }}</text>
|
|
|
|
|
+ <text x="60" y="72" text-anchor="middle" font-size="14" :fill="svgMuted">分</text>
|
|
|
</svg>
|
|
</svg>
|
|
|
</view>
|
|
</view>
|
|
|
<text class="main-score-label">{{ item.label }}</text>
|
|
<text class="main-score-label">{{ item.label }}</text>
|
|
@@ -181,6 +181,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import { BrandColors } from '../../utils/brand-colors.js'
|
|
|
import config from '@/config.js'
|
|
import config from '@/config.js'
|
|
|
import { getDeficiencyAnalysis } from '@/utils/api.js'
|
|
import { getDeficiencyAnalysis } from '@/utils/api.js'
|
|
|
import { parseDate } from '@/utils/format.js'
|
|
import { parseDate } from '@/utils/format.js'
|
|
@@ -223,7 +224,10 @@ export default {
|
|
|
indicators: [],
|
|
indicators: [],
|
|
|
deficiencyRecords: [],
|
|
deficiencyRecords: [],
|
|
|
foods: [],
|
|
foods: [],
|
|
|
- loading: false
|
|
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ svgTrack: BrandColors.hairline2,
|
|
|
|
|
+ svgInk: BrandColors.textStrong,
|
|
|
|
|
+ svgMuted: BrandColors.textMuted
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -277,10 +281,10 @@ export default {
|
|
|
var items = []
|
|
var items = []
|
|
|
var r = this.report
|
|
var r = this.report
|
|
|
var pairs = [
|
|
var pairs = [
|
|
|
- {key:'overall', label:'综合评分', score: r.overallScore, color:'#F97316'},
|
|
|
|
|
- {key:'gut', label:'肠道健康', score: r.gutHealthScore, color:'#4CAF50'},
|
|
|
|
|
- {key:'chronic', label:'慢病控制', score: r.chronicDiseaseScore, color:'#FF9800'},
|
|
|
|
|
- {key:'nutrition', label:'营养均衡', score: r.nutritionScore, color:'#2196F3'}
|
|
|
|
|
|
|
+ {key:'overall', label:'综合评分', score: r.overallScore, color:BrandColors.primary},
|
|
|
|
|
+ {key:'gut', label:'肠道健康', score: r.gutHealthScore, color:BrandColors.matGreen},
|
|
|
|
|
+ {key:'chronic', label:'慢病控制', score: r.chronicDiseaseScore, color:BrandColors.matOrange},
|
|
|
|
|
+ {key:'nutrition', label:'营养均衡', score: r.nutritionScore, color:BrandColors.matBlue}
|
|
|
]
|
|
]
|
|
|
var circ = Math.round(2 * Math.PI * 50)
|
|
var circ = Math.round(2 * Math.PI * 50)
|
|
|
for (var i = 0; i < pairs.length; i++) {
|
|
for (var i = 0; i < pairs.length; i++) {
|
|
@@ -310,9 +314,9 @@ export default {
|
|
|
var p = pairs[i]
|
|
var p = pairs[i]
|
|
|
if (p.score != null) {
|
|
if (p.score != null) {
|
|
|
var s = p.score
|
|
var s = p.score
|
|
|
- var color = '#4CAF50'
|
|
|
|
|
- if (s < 30) { color = '#F44336' }
|
|
|
|
|
- else if (s < 60) { color = '#FFC107' }
|
|
|
|
|
|
|
+ var color = BrandColors.matGreen
|
|
|
|
|
+ if (s < 30) { color = BrandColors.matRed }
|
|
|
|
|
+ else if (s < 60) { color = BrandColors.amber }
|
|
|
items.push({key: p.key, label: p.label, score: s, color: color})
|
|
items.push({key: p.key, label: p.label, score: s, color: color})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -427,9 +431,9 @@ export default {
|
|
|
return '未分类'
|
|
return '未分类'
|
|
|
},
|
|
},
|
|
|
getSeverityColor: function(severity) {
|
|
getSeverityColor: function(severity) {
|
|
|
- if (severity >= 0.7) return '#EF4444'
|
|
|
|
|
- if (severity >= 0.3) return '#F59E0B'
|
|
|
|
|
- return '#10B981'
|
|
|
|
|
|
|
+ if (severity >= 0.7) return BrandColors.danger
|
|
|
|
|
+ if (severity >= 0.3) return BrandColors.wealth
|
|
|
|
|
+ return BrandColors.success
|
|
|
},
|
|
},
|
|
|
drawRadarChart: function() {
|
|
drawRadarChart: function() {
|
|
|
var dims = this.radarDimensions
|
|
var dims = this.radarDimensions
|
|
@@ -445,7 +449,7 @@ export default {
|
|
|
|
|
|
|
|
for (var level = 1; level <= 5; level++) {
|
|
for (var level = 1; level <= 5; level++) {
|
|
|
var r = maxR * (level / 5)
|
|
var r = maxR * (level / 5)
|
|
|
- ctx.setStrokeStyle('#E5E7EB')
|
|
|
|
|
|
|
+ ctx.setStrokeStyle(BrandColors.gray200)
|
|
|
ctx.setLineWidth(1)
|
|
ctx.setLineWidth(1)
|
|
|
ctx.beginPath()
|
|
ctx.beginPath()
|
|
|
for (var j = 0; j < n; j++) {
|
|
for (var j = 0; j < n; j++) {
|
|
@@ -464,7 +468,7 @@ export default {
|
|
|
ctx.beginPath()
|
|
ctx.beginPath()
|
|
|
ctx.moveTo(cx, cy)
|
|
ctx.moveTo(cx, cy)
|
|
|
ctx.lineTo(cx + maxR * Math.cos(a2), cy + maxR * Math.sin(a2))
|
|
ctx.lineTo(cx + maxR * Math.cos(a2), cy + maxR * Math.sin(a2))
|
|
|
- ctx.setStrokeStyle('#E5E7EB')
|
|
|
|
|
|
|
+ ctx.setStrokeStyle(BrandColors.gray200)
|
|
|
ctx.setLineWidth(1)
|
|
ctx.setLineWidth(1)
|
|
|
ctx.stroke()
|
|
ctx.stroke()
|
|
|
}
|
|
}
|
|
@@ -482,7 +486,7 @@ export default {
|
|
|
ctx.closePath()
|
|
ctx.closePath()
|
|
|
ctx.setFillStyle('rgba(249, 115, 22, 0.2)')
|
|
ctx.setFillStyle('rgba(249, 115, 22, 0.2)')
|
|
|
ctx.fill()
|
|
ctx.fill()
|
|
|
- ctx.setStrokeStyle('#F97316')
|
|
|
|
|
|
|
+ ctx.setStrokeStyle(BrandColors.primary)
|
|
|
ctx.setLineWidth(2)
|
|
ctx.setLineWidth(2)
|
|
|
ctx.stroke()
|
|
ctx.stroke()
|
|
|
|
|
|
|
@@ -491,7 +495,7 @@ export default {
|
|
|
var lx = cx + (maxR + 20) * Math.cos(angle3)
|
|
var lx = cx + (maxR + 20) * Math.cos(angle3)
|
|
|
var ly = cy + (maxR + 20) * Math.sin(angle3)
|
|
var ly = cy + (maxR + 20) * Math.sin(angle3)
|
|
|
ctx.setFontSize(11)
|
|
ctx.setFontSize(11)
|
|
|
- ctx.setFillStyle('#6B7280')
|
|
|
|
|
|
|
+ ctx.setFillStyle(BrandColors.textSlate)
|
|
|
ctx.setTextAlign('center')
|
|
ctx.setTextAlign('center')
|
|
|
ctx.setTextBaseline('middle')
|
|
ctx.setTextBaseline('middle')
|
|
|
ctx.fillText(dims[q].label + ' ' + (dims[q].value || '--'), lx, ly)
|
|
ctx.fillText(dims[q].label + ' ' + (dims[q].value || '--'), lx, ly)
|