Sfoglia il codice sorgente

fix(frontend): 推荐商品组件移除五维权重徽章展示

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
asus 1 mese fa
parent
commit
8b5e239852
1 ha cambiato i file con 1 aggiunte e 45 eliminazioni
  1. 1 45
      cfc-frontend/components/DimensionProducts.vue

+ 1 - 45
cfc-frontend/components/DimensionProducts.vue

@@ -11,9 +11,6 @@
       <view class="product-card" v-for="prod in displayProducts" :key="prod.id" @click="onProductClick(prod)">
         <image class="product-img" :src="getImageUrl(prod.coverImage) || '/static/default-product.png'" mode="aspectFill" />
         <text class="product-name line-clamp-2">{{ prod.name }}</text>
-        <view class="weight-badges" v-if="prod._badges && prod._badges.length">
-          <text class="weight-badge" v-for="badge in prod._badges" :key="badge.name" :style="{ background: badge.color + '20', color: badge.color }">{{ badge.name }}{{ badge.weight }}%</text>
-        </view>
         <view class="price-row">
           <text class="product-price" v-if="prod.priceLabel">{{ prod.priceLabel }}</text>
           <text class="product-price" v-else-if="prod.price">{{ formatPriceWithSymbol(prod.price) }}</text>
@@ -35,14 +32,6 @@
 import { getDimensionProducts, clickRepurchaseReminder } from '../utils/api.js'
 import config from '@/config.js'
 
-var DIMENSION_MAP = {
-  body: { name: '身', color: '#FF8C42' },
-  mind: { name: '心', color: '#FF6B9D' },
-  wisdom: { name: '智', color: '#6366F1' },
-  action: { name: '行', color: '#10B981' },
-  wealth: { name: '富', color: '#F59E0B' }
-}
-
 export default {
   props: {
     dimensionCode: { type: String, default: '' },
@@ -62,12 +51,7 @@ export default {
   },
   computed: {
     displayProducts: function() {
-      var list = this.products && this.products.length > 0 ? this.products : this.selfProducts
-      var self = this
-      return (list || []).map(function(item) {
-        item._badges = self.parseWeights(item.dimensionWeights)
-        return item
-      })
+      return this.products && this.products.length > 0 ? this.products : this.selfProducts
     },
     emptyText: function() {
       // 有 familyId(已登录且选中孩子)但推荐接口无数据
@@ -122,21 +106,6 @@ export default {
       if (price == null) return '免费'
       return '¥' + (Number(price) / 100).toFixed(2)
     },
-    parseWeights: function(str) {
-      if (!str) return []
-      try {
-        var obj = JSON.parse(str)
-        var result = []
-        for (var key in obj) {
-          if (obj[key] > 0 && DIMENSION_MAP[key]) {
-            result.push({ name: DIMENSION_MAP[key].name, color: DIMENSION_MAP[key].color, weight: obj[key] })
-          }
-        }
-        return result
-      } catch (e) {
-        return []
-      }
-    },
     getImageUrl: function(path) {
       return config.API_BASE_URL + path
     }
@@ -189,19 +158,6 @@ export default {
   color: #333;
   padding: 12rpx 16rpx 0;
 }
-.weight-badges {
-  display: flex;
-  flex-direction: row;
-  flex-wrap: wrap;
-  gap: 4rpx;
-  padding: 4rpx 16rpx 0;
-}
-.weight-badge {
-  font-size: 16rpx;
-  padding: 1rpx 8rpx;
-  border-radius: 6rpx;
-  font-weight: 500;
-}
 .price-row {
   display: flex;
   flex-direction: row;