feat(auth): 添加登录验证到食物记录相关功能

- 在食物拍照、语音记录和营养成分分析功能中添加登录验证
- 使用 ensureLoggedIn 方法确保用户已登录后再调用服务端接口
- 使用 pushIfAuthedElseLogin 方法处理需要登录的页面导航
- 添加新的营养图标资源
- 在路由常量中添加 FOOD_CAMERA 路由定义
- 更新 Memory Bank 任务文档,记录登录验证和路由常量管理的实现模式
This commit is contained in:
richarjiang
2025-10-16 17:45:52 +08:00
parent 339c748a0f
commit b75a8991ac
7 changed files with 241 additions and 11 deletions

View File

@@ -250,7 +250,7 @@ export function NutritionRadarCard({
style={styles.foodOptionItem}
onPress={() => {
triggerLightHaptic();
pushIfAuthedElseLogin(`/food/camera?mealType=${currentMealType}`);
router.push(`${ROUTES.FOOD_CAMERA}?mealType=${currentMealType}`);
}}
activeOpacity={0.7}
>
@@ -284,7 +284,7 @@ export function NutritionRadarCard({
style={styles.foodOptionItem}
onPress={() => {
triggerLightHaptic();
pushIfAuthedElseLogin(`${ROUTES.VOICE_RECORD}?mealType=${currentMealType}`);
router.push(`${ROUTES.VOICE_RECORD}?mealType=${currentMealType}`);
}}
activeOpacity={0.7}
>
@@ -301,13 +301,13 @@ export function NutritionRadarCard({
style={styles.foodOptionItem}
onPress={() => {
triggerLightHaptic();
pushIfAuthedElseLogin(`${ROUTES.NUTRITION_LABEL_ANALYSIS}?mealType=${currentMealType}`);
router.push(`${ROUTES.NUTRITION_LABEL_ANALYSIS}?mealType=${currentMealType}`);
}}
activeOpacity={0.7}
>
<View style={[styles.foodOptionIcon]}>
<Image
source={require('@/assets/images/icons/icon-recommend.png')}
source={require('@/assets/images/icons/icon-yingyang.png')}
style={styles.foodOptionImage}
/>
</View>