fix: 修复关注按钮相关问题
- 食谱详情页: 修复 applyDefaultData 中未定义变量 id 的问题 - 帖子详情页: 优化 toggleFollow 方法,提前校验 author.id,兼容多种后端字段 - 为帖子详情页已关注状态添加灰色样式
This commit is contained in:
@@ -50,8 +50,8 @@
|
||||
<text class="team-role">专业营养师</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="follow-btn" @click="toggleFollow">
|
||||
<text>+ 关注</text>
|
||||
<view class="follow-btn" :class="{ followed: isFollowing }" @click="toggleFollow">
|
||||
<text>{{ isFollowing ? '已关注' : '+ 关注' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -353,9 +353,9 @@ export default {
|
||||
applyDefaultData() {
|
||||
this.recipeData = { ...this.defaultRecipeData }
|
||||
this.nutritionData = JSON.parse(JSON.stringify(this.defaultNutritionData))
|
||||
|
||||
// T09: 若无营养数据,调用 AI 回填
|
||||
this.fillNutritionFromAI(id)
|
||||
if (this.recipeId) {
|
||||
this.fillNutritionFromAI(this.recipeId)
|
||||
}
|
||||
this.mealPlan = JSON.parse(JSON.stringify(this.defaultMealPlan))
|
||||
this.warningList = [...this.defaultWarningList]
|
||||
},
|
||||
@@ -715,6 +715,10 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.follow-btn.followed {
|
||||
background: linear-gradient(180deg, #9fa5c0 0%, #8a90a8 100%);
|
||||
}
|
||||
|
||||
/* 介绍卡片 */
|
||||
.intro-card {
|
||||
background: #ffffff;
|
||||
|
||||
Reference in New Issue
Block a user