|
|
@@ -102,6 +102,16 @@
|
|
|
<!-- 食材列表 -->
|
|
|
<view class="food-list" v-if="currentView === 'personal'">
|
|
|
<view class="food-card" v-for="(item, idx) in filteredFoods" :key="getFoodKey(item, idx)">
|
|
|
+ <!-- 健康问卷个性化调整提示条:blocked 红 / warning 黄 / boost 绿(normal/空不渲染) -->
|
|
|
+ <view v-if="item.adjustment === 'blocked'" class="health-adjust-bar">
|
|
|
+ <text class="health-adjust-text health-adjust-blocked">⚠ 健康问卷不建议:{{ item.adjustmentReason }}</text>
|
|
|
+ </view>
|
|
|
+ <view v-else-if="item.adjustment === 'warning'" class="health-adjust-bar">
|
|
|
+ <text class="health-adjust-text health-adjust-warning">注意:{{ item.adjustmentReason }}</text>
|
|
|
+ </view>
|
|
|
+ <view v-else-if="item.adjustment === 'boost'" class="health-adjust-bar">
|
|
|
+ <text class="health-adjust-text health-adjust-boost">✓ 符合饮食习惯偏好</text>
|
|
|
+ </view>
|
|
|
<view class="food-left">
|
|
|
<view class="ingredient-badge" :class="item.scoreClass">
|
|
|
<text class="ingredient-badge-text">{{ idx + 1 }}</text>
|
|
|
@@ -354,14 +364,24 @@ export default {
|
|
|
}
|
|
|
|
|
|
// 排序(戒备模式默认升序,见 setFilter)
|
|
|
- if (self.sortType === 'asc') {
|
|
|
- result = result.slice().sort(function(a, b) {
|
|
|
- return (a.score || 0) - (b.score || 0)
|
|
|
+ var sortFn = self.sortType === 'asc'
|
|
|
+ ? function(a, b) { return (a.score || 0) - (b.score || 0) }
|
|
|
+ : function(a, b) { return (b.score || 0) - (a.score || 0) }
|
|
|
+
|
|
|
+ // 健康问卷个性化调整(B3):suitable Tab 中 blocked 项整体排到列表末尾(保持可见不置顶;组内各按既有分值序)
|
|
|
+ if (self.filterType === 'suitable') {
|
|
|
+ var nonBlocked = []
|
|
|
+ var blocked = []
|
|
|
+ result.forEach(function(f) {
|
|
|
+ if (f.adjustment === 'blocked') {
|
|
|
+ blocked.push(f)
|
|
|
+ } else {
|
|
|
+ nonBlocked.push(f)
|
|
|
+ }
|
|
|
})
|
|
|
+ result = nonBlocked.slice().sort(sortFn).concat(blocked.slice().sort(sortFn))
|
|
|
} else {
|
|
|
- result = result.slice().sort(function(a, b) {
|
|
|
- return (b.score || 0) - (a.score || 0)
|
|
|
- })
|
|
|
+ result = result.slice().sort(sortFn)
|
|
|
}
|
|
|
|
|
|
return result
|
|
|
@@ -1165,11 +1185,36 @@ export default {
|
|
|
padding: 18rpx 20rpx;
|
|
|
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
|
|
display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
width: 100%;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
+/* 健康问卷个性化调整提示条(blocked 红 / warning 黄 / boost 绿;normal/空不渲染) */
|
|
|
+.health-adjust-bar {
|
|
|
+ width: 100%;
|
|
|
+ margin-bottom: 12rpx;
|
|
|
+}
|
|
|
+.health-adjust-text {
|
|
|
+ display: block;
|
|
|
+ padding: 8rpx 16rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ font-size: calc(22rpx * var(--font-scale, 1));
|
|
|
+ line-height: 1.4;
|
|
|
+}
|
|
|
+.health-adjust-blocked {
|
|
|
+ background: $fortune-0-tint;
|
|
|
+ color: $mat-red;
|
|
|
+}
|
|
|
+.health-adjust-warning {
|
|
|
+ background: rgba(245, 158, 11, 0.14);
|
|
|
+ color: #b45309;
|
|
|
+}
|
|
|
+.health-adjust-boost {
|
|
|
+ background: $mat-green-tint;
|
|
|
+ color: $mat-green;
|
|
|
+}
|
|
|
.food-left {
|
|
|
display: flex;
|
|
|
align-items: center;
|