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:
@@ -214,7 +214,7 @@
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="bottom-bar">
|
||||
<view class="action-btn-small" @click="toggleLike">
|
||||
<text class="action-icon-small" :class="{ active: isLiked }">❤️</text>
|
||||
<text class="action-icon-small" :class="{ active: isLiked }">{{ isLiked ? '❤️' : '🤍' }}</text>
|
||||
</view>
|
||||
<view class="action-btn-small" @click="toggleFavorite">
|
||||
<text class="action-icon-small" :class="{ active: isFavorite }">⭐</text>
|
||||
@@ -227,7 +227,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getRecipeDetail, toggleRecipeFavorite } from '@/api/tool.js';
|
||||
import { getRecipeDetail, toggleRecipeFavorite, fillRecipeNutrition } from '@/api/tool.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -321,9 +321,41 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// T09: AI 回填食谱营养
|
||||
async fillNutritionFromAI(recipeId) {
|
||||
try {
|
||||
uni.showLoading({ title: 'AI分析中...' })
|
||||
const res = await fillRecipeNutrition(recipeId)
|
||||
const data = res.data || res
|
||||
if (data) {
|
||||
// 更新营养数据
|
||||
this.nutritionData = {
|
||||
main: [
|
||||
{ value: String(data.energyKcal || '--'), label: '热量(kcal)' },
|
||||
{ value: (data.proteinG || '--') + 'g', label: '蛋白质' },
|
||||
{ value: '--', label: '脂肪' },
|
||||
{ value: '--', label: '碳水' }
|
||||
],
|
||||
minor: [
|
||||
{ value: data.sodiumMg ? data.sodiumMg + 'mg' : '--', label: '钠' },
|
||||
{ value: data.potassiumMg ? data.potassiumMg + 'mg' : '--', label: '钾' },
|
||||
{ value: data.phosphorusMg ? data.phosphorusMg + 'mg' : '--', label: '磷' }
|
||||
]
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('AI营养回填失败', e)
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
},
|
||||
|
||||
applyDefaultData() {
|
||||
this.recipeData = { ...this.defaultRecipeData }
|
||||
this.nutritionData = JSON.parse(JSON.stringify(this.defaultNutritionData))
|
||||
|
||||
// T09: 若无营养数据,调用 AI 回填
|
||||
this.fillNutritionFromAI(id)
|
||||
this.mealPlan = JSON.parse(JSON.stringify(this.defaultMealPlan))
|
||||
this.warningList = [...this.defaultWarningList]
|
||||
},
|
||||
@@ -382,6 +414,9 @@ export default {
|
||||
}
|
||||
} else {
|
||||
this.nutritionData = JSON.parse(JSON.stringify(this.defaultNutritionData))
|
||||
|
||||
// T09: 若无营养数据,调用 AI 回填
|
||||
this.fillNutritionFromAI(id)
|
||||
}
|
||||
|
||||
// 解析三餐配餐:
|
||||
|
||||
Reference in New Issue
Block a user