feat: 集成 KieAI 服务,移除 models-integration 子项目
- 添加 Gemini 2.5 Flash 对话接口(流式+非流式) - 添加 NanoBanana 图像生成/编辑接口 - 添加 Sora2 视频生成接口(文生视频、图生视频、去水印) - 移除 models-integration 子项目(功能已迁移至主后端) - 新增测试文档和 Playwright E2E 配置 - 更新前端页面和 API 接口 - 更新后端配置和日志处理
This commit is contained in:
@@ -63,7 +63,7 @@
|
||||
<view class="post-image" v-if="item.image">
|
||||
<image :src="item.image" mode="aspectFill" lazy-load></image>
|
||||
<!-- 类型标签 -->
|
||||
<view class="meal-tag">{{ item.mealType }}</view>
|
||||
<view class="meal-tag">{{ getMealTypeLabel(item.mealType) }}</view>
|
||||
<!-- 视频标记 -->
|
||||
<view class="video-badge" v-if="item.hasVideo || item.videoUrl">
|
||||
<text class="badge-icon">🎬</text>
|
||||
@@ -73,7 +73,7 @@
|
||||
<!-- 内容区域 -->
|
||||
<view class="post-content">
|
||||
<!-- 无图片时显示类型标签 -->
|
||||
<view class="type-tag" v-if="!item.image">{{ item.mealType }}</view>
|
||||
<view class="type-tag" v-if="!item.image">{{ getMealTypeLabel(item.mealType) }}</view>
|
||||
|
||||
<!-- 标题 -->
|
||||
<view class="post-title">{{ item.title }}</view>
|
||||
@@ -426,6 +426,21 @@ export default {
|
||||
return String(count)
|
||||
},
|
||||
|
||||
// 帖子类型英文转中文显示(仅用于展示,保证 label 均为中文)
|
||||
getMealTypeLabel(mealType) {
|
||||
if (!mealType) return '分享'
|
||||
const map = {
|
||||
breakfast: '早餐',
|
||||
lunch: '午餐',
|
||||
dinner: '晚餐',
|
||||
snack: '加餐',
|
||||
share: '分享',
|
||||
checkin: '打卡'
|
||||
}
|
||||
const lower = String(mealType).toLowerCase()
|
||||
return map[lower] != null ? map[lower] : '分享'
|
||||
},
|
||||
|
||||
// 格式化标签显示
|
||||
formatTag(tag) {
|
||||
if (!tag) return ''
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 四大功能入口 -->
|
||||
<view class="function-grid">
|
||||
<!-- 四大功能入口(根据系统配置 eb_system_config.field01=1 时显示) -->
|
||||
<view class="function-grid" v-if="showFunctionEntries">
|
||||
<view class="function-item calculator" @tap="goToCalculator">
|
||||
<view class="function-content">
|
||||
<view class="function-text">
|
||||
@@ -64,7 +64,7 @@
|
||||
<view class="function-item nutrition-knowledge" @tap="goToNutritionKnowledge">
|
||||
<view class="function-content">
|
||||
<view class="function-text">
|
||||
<view class="function-title">营养知识</view>
|
||||
<view class="function-title">健康知识</view>
|
||||
<view class="function-desc">专业营养指导</view>
|
||||
</view>
|
||||
<view class="function-icon">
|
||||
@@ -156,7 +156,8 @@
|
||||
import {
|
||||
getRecommendedRecipes,
|
||||
getRecommendedKnowledge,
|
||||
getUserHealthStatus
|
||||
getUserHealthStatus,
|
||||
getHomeDisplayConfig
|
||||
} from '@/api/tool.js';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { toLogin, checkLogin } from '@/libs/login.js';
|
||||
@@ -177,6 +178,7 @@ import {
|
||||
hasProfile: false,
|
||||
profileStatus: '尚未完成健康档案'
|
||||
},
|
||||
showFunctionEntries: false,
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
@@ -198,16 +200,18 @@ import {
|
||||
async loadData() {
|
||||
this.loading = true;
|
||||
try {
|
||||
// 并行加载数据
|
||||
const [recipesRes, knowledgeRes, healthRes] = await Promise.all([
|
||||
// 并行加载数据(含首页展示配置:field01=1 时显示四大功能入口)
|
||||
const [recipesRes, knowledgeRes, healthRes, displayConfigRes] = await Promise.all([
|
||||
getRecommendedRecipes({ limit: 2 }).catch(() => ({ data: [] })),
|
||||
getRecommendedKnowledge({ limit: 2 }).catch(() => ({ data: [] })),
|
||||
getUserHealthStatus().catch(() => ({ data: { hasProfile: false, profileStatus: '尚未完成健康档案' } }))
|
||||
getUserHealthStatus().catch(() => ({ data: { hasProfile: false, profileStatus: '尚未完成健康档案' } })),
|
||||
getHomeDisplayConfig().catch(() => ({ data: { showFunctionEntries: false } }))
|
||||
]);
|
||||
|
||||
this.recipeList = recipesRes.data?.list || recipesRes.data || [];
|
||||
this.knowledgeList = knowledgeRes.data?.list || knowledgeRes.data || [];
|
||||
this.userHealthStatus = healthRes.data || { hasProfile: false, profileStatus: '尚未完成健康档案' };
|
||||
this.showFunctionEntries = !!(displayConfigRes.data && displayConfigRes.data.showFunctionEntries);
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
uni.showToast({
|
||||
@@ -226,9 +230,14 @@ import {
|
||||
},
|
||||
// 跳转到打卡页面
|
||||
handleCheckin() {
|
||||
if (!checkLogin()) {
|
||||
uni.showToast({ title: '请先登录', icon: 'none' });
|
||||
setTimeout(() => toLogin(), 500);
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/tool/checkin'
|
||||
})
|
||||
});
|
||||
},
|
||||
// 跳转到食谱计算器
|
||||
goToCalculator() {
|
||||
|
||||
Reference in New Issue
Block a user