Просмотр исходного кода

fix(diet): 修复最终审查发现 - progressPercent/loading死代码/样式细节

iwt 2 месяцев назад
Родитель
Сommit
905e0d80e3
1 измененных файлов с 6 добавлено и 9 удалено
  1. 6 9
      cfc-frontend/pages/diet/preferences.vue

+ 6 - 9
cfc-frontend/pages/diet/preferences.vue

@@ -93,6 +93,7 @@
             <slider class="slider" min="0" max="5" :value="spiceLevel" @change="spiceLevel = $event.detail.value" show-value />
             <text class="slider-label">特辣</text>
           </view>
+          <text class="spice-level-label">当前:{{ spiceLevelLabels[spiceLevel] }}</text>
         </view>
 
         <!-- 口味 -->
@@ -253,7 +254,7 @@ export default {
       customField: null,
       // UI 状态
       submitting: false,
-      loading: true
+      spiceLevelLabels: ['不辣', '微辣', '中辣', '偏辣', '很辣', '特辣']
     }
   },
   computed: {
@@ -275,10 +276,7 @@ export default {
     },
     // 进度条百分比
     progressPercent: function() {
-      var total = 3
-      var done = this.currentStep - 1
-      if (this.currentStep === 3) done = 3
-      return Math.round((done / total) * 100)
+      return Math.round((this.currentStep / 3) * 100)
     },
     isLastStep: function() { return this.currentStep === 3 }
   },
@@ -290,7 +288,6 @@ export default {
     loadPreferences: function() {
       var self = this
       getDietPreferences({ memberId: self.familyMemberId }).then(function(res) {
-        self.loading = false
         if (res) {
           self.allergies = res.allergies || []
           self.absoluteAvoid = res.absoluteAvoid || []
@@ -304,7 +301,6 @@ export default {
           self.goalConfirmed = res.goalConfirmed || 0
         }
       }).catch(function() {
-        self.loading = false
       })
     },
     // ——— chip 选中态(模板用内联 indexOf,方法供 toggle 用) ———
@@ -400,7 +396,7 @@ export default {
   border-radius: 6rpx; transition: width 0.3s ease;
 }
 .progress-labels { display: flex; justify-content: space-between; margin-top: 12rpx; }
-.progress-label { font-size: 22rpx; color: #C2A78A; }
+.progress-label { font-size: 22rpx; color: #C2A78A; flex: 1; text-align: center; }
 .progress-label-active { color: #FF8C42; font-weight: 600; }
 
 /* ===== 内容 ===== */
@@ -434,7 +430,7 @@ export default {
 .custom-add {
   padding: 14rpx 0; font-size: 26rpx; color: #FF8C42; font-weight: 500;
 }
-.custom-row { display: flex; align-items: center; margin-top: 8rpx; }
+.custom-row { display: flex; align-items: center; margin-top: 8rpx; margin-bottom: 12rpx; }
 .custom-input {
   flex: 1; border: 2rpx solid #FFD9B8; border-radius: 999rpx;
   padding: 14rpx 24rpx; font-size: 26rpx; background: #FFF9F2;
@@ -448,6 +444,7 @@ export default {
 .slider-row { display: flex; align-items: center; }
 .slider-label { font-size: 24rpx; color: #A08B72; width: 72rpx; }
 .slider { flex: 1; }
+.spice-level-label { font-size: 24rpx; color: #FF8C42; text-align: center; margin-top: 8rpx; display: block; }
 
 /* ===== 底栏 ===== */
 .footer-bar {