|
|
@@ -73,11 +73,11 @@
|
|
|
<view class="heatmap-legend">
|
|
|
<text class="legend-label">低</text>
|
|
|
<view class="legend-bar">
|
|
|
- <view class="legend-step" style="background:#FFE0E0"></view>
|
|
|
- <view class="legend-step" style="background:#FFB0B0"></view>
|
|
|
- <view class="legend-step" style="background:#FFD9A0"></view>
|
|
|
- <view class="legend-step" style="background:#C8E6C9"></view>
|
|
|
- <view class="legend-step" style="background:#81C784"></view>
|
|
|
+ <view class="legend-step legend-step-1"></view>
|
|
|
+ <view class="legend-step legend-step-2"></view>
|
|
|
+ <view class="legend-step legend-step-3"></view>
|
|
|
+ <view class="legend-step legend-step-4"></view>
|
|
|
+ <view class="legend-step legend-step-5"></view>
|
|
|
</view>
|
|
|
<text class="legend-label">高</text>
|
|
|
</view>
|
|
|
@@ -123,6 +123,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { BrandColors } from '../../utils/brand-colors.js'
|
|
|
import config from '../../config'
|
|
|
import PsychCrisisBanner from '@/pages/mind-detail/components/PsychCrisisBanner.vue'
|
|
|
import { parseDate } from '../../utils/format.js'
|
|
|
@@ -137,11 +138,11 @@ export default {
|
|
|
trend: null,
|
|
|
weekdays: ['日', '一', '二', '三', '四', '五', '六'],
|
|
|
weatherConfig: {
|
|
|
- sunny: { icon: '\u2600\uFE0F', label: '心情很好', color: '#FFB347' },
|
|
|
- cloudy: { icon: '\u26C5', label: '一般般', color: '#A0A0A0' },
|
|
|
- rainy: { icon: '\uD83C\uDF27\uFE0F', label: '有点难过', color: '#6B9BD2' },
|
|
|
- stormy: { icon: '\u26A1', label: '很烦躁', color: '#8B5CF6' },
|
|
|
- rainbow: { icon: '\uD83C\uDF08', label: '特别开心', color: '#FF6B9D' }
|
|
|
+ sunny: { icon: '\u2600\uFE0F', label: '心情很好', color: BrandColors.weatherSunny },
|
|
|
+ cloudy: { icon: '\u26C5', label: '一般般', color: BrandColors.emotionDisgust },
|
|
|
+ rainy: { icon: '\uD83C\uDF27\uFE0F', label: '有点难过', color: BrandColors.emotionSadness },
|
|
|
+ stormy: { icon: '\u26A1', label: '很烦躁', color: BrandColors.violet },
|
|
|
+ rainbow: { icon: '\uD83C\uDF08', label: '特别开心', color: BrandColors.mind }
|
|
|
},
|
|
|
// Plutchik 情绪中文映射 + 成长页词表(旧数据兼容)
|
|
|
emotionTypeLabels: {
|
|
|
@@ -242,7 +243,7 @@ export default {
|
|
|
if (total === 0) return []
|
|
|
|
|
|
return Object.keys(dist).map(w => {
|
|
|
- const cfg = this.weatherConfig[w] || { icon: '?', label: w, color: '#ccc' }
|
|
|
+ const cfg = this.weatherConfig[w] || { icon: '?', label: w, color: BrandColors.textGhost }
|
|
|
return {
|
|
|
weather: w,
|
|
|
icon: cfg.icon,
|
|
|
@@ -378,7 +379,7 @@ export default {
|
|
|
var plotH = canvasHeight - padding.top - padding.bottom
|
|
|
|
|
|
// Draw axes
|
|
|
- ctx.setStrokeStyle('#E0E0E0')
|
|
|
+ ctx.setStrokeStyle(BrandColors.hairline)
|
|
|
ctx.setLineWidth(1 * dpr)
|
|
|
ctx.beginPath()
|
|
|
ctx.moveTo(padding.left, padding.top)
|
|
|
@@ -388,13 +389,13 @@ export default {
|
|
|
|
|
|
// Draw Y axis labels
|
|
|
ctx.setFontSize(10 * dpr)
|
|
|
- ctx.setFillStyle('#999')
|
|
|
+ ctx.setFillStyle(BrandColors.textMuted)
|
|
|
ctx.setTextAlign('right')
|
|
|
for (var yVal = 2; yVal <= 10; yVal += 2) {
|
|
|
var yPos = padding.top + plotH - (yVal / 10) * plotH
|
|
|
ctx.fillText(yVal + '', padding.left - 6 * dpr, yPos + 3 * dpr)
|
|
|
// Grid line
|
|
|
- ctx.setStrokeStyle('#F0F0F0')
|
|
|
+ ctx.setStrokeStyle(BrandColors.fill)
|
|
|
ctx.setLineWidth(1 * dpr)
|
|
|
ctx.beginPath()
|
|
|
ctx.moveTo(padding.left, yPos)
|
|
|
@@ -408,7 +409,7 @@ export default {
|
|
|
avg += data[si].moodScore
|
|
|
}
|
|
|
avg /= count
|
|
|
- var lineColor = avg >= 5 ? '#10B981' : '#FF6B9D'
|
|
|
+ var lineColor = avg >= 5 ? BrandColors.success : BrandColors.mind
|
|
|
|
|
|
// Draw data points and lines
|
|
|
ctx.setStrokeStyle(lineColor)
|
|
|
@@ -436,7 +437,7 @@ export default {
|
|
|
|
|
|
// Draw X axis labels (dates)
|
|
|
ctx.setFontSize(9 * dpr)
|
|
|
- ctx.setFillStyle('#999')
|
|
|
+ ctx.setFillStyle(BrandColors.textMuted)
|
|
|
ctx.setTextAlign('center')
|
|
|
var step = Math.max(1, Math.floor(count / 6))
|
|
|
for (var di = 0; di < count; di += step) {
|
|
|
@@ -497,7 +498,7 @@ export default {
|
|
|
ctx.fillText('低落', padding.left + plotW * 0.25, padding.top + plotH * 0.8)
|
|
|
|
|
|
// Axes
|
|
|
- ctx.setStrokeStyle('#E0E0E0')
|
|
|
+ ctx.setStrokeStyle(BrandColors.hairline)
|
|
|
ctx.setLineWidth(1 * dpr)
|
|
|
ctx.beginPath()
|
|
|
ctx.moveTo(padding.left, padding.top + plotH / 2)
|
|
|
@@ -510,7 +511,7 @@ export default {
|
|
|
|
|
|
// Axis labels
|
|
|
ctx.setFontSize(9 * dpr)
|
|
|
- ctx.setFillStyle('#999')
|
|
|
+ ctx.setFillStyle(BrandColors.textMuted)
|
|
|
ctx.setTextAlign('center')
|
|
|
ctx.fillText('效价 →', padding.left + plotW / 2, padding.top + plotH + 18 * dpr)
|
|
|
ctx.save()
|
|
|
@@ -529,11 +530,11 @@ export default {
|
|
|
// Color based on valence
|
|
|
var color
|
|
|
if (pt.valence >= 7) {
|
|
|
- color = '#10B981'
|
|
|
+ color = BrandColors.success
|
|
|
} else if (pt.valence >= 5) {
|
|
|
- color = '#FFD93D'
|
|
|
+ color = BrandColors.emotionJoy
|
|
|
} else {
|
|
|
- color = '#FF6B9D'
|
|
|
+ color = BrandColors.mind
|
|
|
}
|
|
|
|
|
|
ctx.beginPath()
|
|
|
@@ -552,8 +553,22 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+// ===== 情绪趋势页专属色阶(热力图绿阶 + 画布近白;单页专用,约定见 uni.scss §14)=====
|
|
|
+$c-et-heat-1: #FFE0E0; // 热力档 1(最浅红)
|
|
|
+$c-et-heat-2: #FFB0B0; // 热力档 2(浅红)
|
|
|
+$c-et-heat-3: #FFD9A0; // 热力档 3(浅橙)
|
|
|
+$c-et-heat-4: #C8E6C9; // 热力档 4(浅绿)
|
|
|
+$c-et-heat-5: #81C784; // 热力档 5(中绿)
|
|
|
+$c-canvas-bg: #FCFCFC; // 画布近白
|
|
|
+
|
|
|
+.legend-step-1 { background: $c-et-heat-1; }
|
|
|
+.legend-step-2 { background: $c-et-heat-2; }
|
|
|
+.legend-step-3 { background: $c-et-heat-3; }
|
|
|
+.legend-step-4 { background: $c-et-heat-4; }
|
|
|
+.legend-step-5 { background: $c-et-heat-5; }
|
|
|
+
|
|
|
// ===== 页面级局部调色板(单页专有色阶;同值才映射全局令牌,约定见 uni.scss §14) =====
|
|
|
-$c-canvas-bg: #FCFCFC; // 图表画布近白底
|
|
|
+$c-canvas-bg: $c-canvas-bg; // 图表画布近白底
|
|
|
|
|
|
.trend-container {
|
|
|
min-height: 100vh;
|