feat: T10 回归测试 Bug 修复与功能完善
修复 BUG-001 至 BUG-009 及 T10-1 至 T10-6 相关问题: - 打卡积分显示与累加逻辑优化 - 食谱计算器 Tab 选中样式修复 - 食物百科列表图片与简介展示修复 - 食物详情页数据加载修复 - AI营养师差异化回复优化 - 健康知识/营养知识名称统一 - 饮食指南/科普文章详情页内容展示修复 - 帖子营养统计数据展示修复 - 社区帖子类型中文命名统一 - 帖子详情标签中文显示修复 - 食谱营养AI填充功能完善 - 食谱收藏/点赞功能修复 新增: - ToolNutritionFillService 营养填充服务 - T10 回归测试用例 (Playwright) - 知识文章数据 SQL 脚本 涉及模块: - crmeb-common: VO/Request/Response 优化 - crmeb-service: 业务逻辑完善 - crmeb-front: API 接口扩展 - msh_single_uniapp: 前端页面修复 - tests/e2e: 回归测试用例
This commit is contained in:
@@ -105,7 +105,7 @@
|
||||
<view class="food-image-wrapper">
|
||||
<image
|
||||
class="food-image"
|
||||
:src="getFoodImage(item)"
|
||||
:src="getFoodImage(item) || defaultPlaceholder"
|
||||
mode="aspectFill"
|
||||
@error="onFoodImageError(item)"
|
||||
></image>
|
||||
@@ -126,11 +126,11 @@
|
||||
<view class="nutrition-list">
|
||||
<view
|
||||
class="nutrition-item"
|
||||
v-for="(nut, idx) in (item.nutrition || [])"
|
||||
v-for="(nut, idx) in (item.nutrition || item.nutrients || [])"
|
||||
:key="idx"
|
||||
>
|
||||
<text class="nutrition-label">{{ nut.label }}</text>
|
||||
<text class="nutrition-value" :class="nut.colorClass || 'green'">{{ nut.value }}</text>
|
||||
<text class="nutrition-label">{{ nut.label || '—' }}</text>
|
||||
<text class="nutrition-value" :class="nut.colorClass || 'green'">{{ nut.value != null ? nut.value : '—' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -320,8 +320,12 @@ export default {
|
||||
colorClass: n.colorClass || 'green'
|
||||
}));
|
||||
} else {
|
||||
// 后端列表仅返回扁平字段,无 nutrition/nutrients 数组,此处组装并始终展示主要项(空值显示 —)
|
||||
nutrition = [];
|
||||
const push = (label, val, unit) => { if (val != null && val !== '') nutrition.push({ label, value: String(val) + (unit || ''), colorClass: 'green' }); };
|
||||
const push = (label, val, unit) => {
|
||||
const value = (val != null && val !== '') ? String(val) + (unit || '') : '—';
|
||||
nutrition.push({ label, value, colorClass: 'green' });
|
||||
};
|
||||
push('能量', item.energy, 'kcal');
|
||||
push('蛋白质', item.protein, 'g');
|
||||
push('钾', item.potassium, 'mg');
|
||||
@@ -330,9 +334,14 @@ export default {
|
||||
push('钙', item.calcium, 'mg');
|
||||
}
|
||||
|
||||
// 后端详情接口仅接受 Long 类型 id;若列表返回的 id 为非数字(如名称),不传 id,避免详情页请求 400
|
||||
const rawId = item.id != null ? item.id : item.foodId;
|
||||
const numericId = (rawId !== undefined && rawId !== null && rawId !== '' && !isNaN(Number(rawId)))
|
||||
? (typeof rawId === 'number' ? rawId : Number(rawId))
|
||||
: undefined;
|
||||
return {
|
||||
...item,
|
||||
id: item.id != null ? item.id : item.foodId,
|
||||
id: numericId,
|
||||
image,
|
||||
imageUrl: image || undefined,
|
||||
category: item.category || '',
|
||||
|
||||
Reference in New Issue
Block a user