Pārlūkot izejas kodu

fix(frontend): index/product/detail pages use API_BASE_URL for uploaded images

Convert relative image paths to absolute URLs via config.API_BASE_URL in index-home, package share, and body-detail pages.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Xiaogang Liao 1 mēnesi atpakaļ
vecāks
revīzija
2e87a99999

+ 5 - 1
cfc-frontend/pages/body-detail/dimension-detail.vue

@@ -59,7 +59,7 @@
           :key="p.id"
           @click="goProduct(p)"
         >
-          <image class="dd-prod-img" :src="p.coverImage || '/static/default-product.png'" mode="aspectFill"></image>
+          <image class="dd-prod-img" :src="getImageUrl(p.coverImage) || '/static/default-product.png'" mode="aspectFill"></image>
           <view class="dd-prod-info">
             <text class="dd-prod-name">{{ p.name }}</text>
             <text class="dd-prod-price">¥{{ p.price }}</text>
@@ -78,6 +78,7 @@
 
 <script>
 import { getDimensionHistory, getDimensionOverview, getProductsByDomain } from '@/utils/api'
+import config from '@/config.js'
 
 var SUGGESTIONS = {
   growth: [
@@ -326,6 +327,9 @@ export default {
       if (product && product.id) {
         uni.navigateTo({ url: '/pages/shop/detail?id=' + product.id })
       }
+    },
+    getImageUrl: function(path) {
+      return config.API_BASE_URL + path
     }
   }
 }

+ 5 - 1
cfc-frontend/pages/guide/packages/share.vue

@@ -2,7 +2,7 @@
   <view class="container">
     <!-- 任务模板信息卡片 -->
     <view class="package-card">
-      <image class="cover" :src="pkg.coverImage || '/static/default-cover.png'" mode="aspectFill" />
+      <image class="cover" :src="getImageUrl(pkg.coverImage) || '/static/default-cover.png'" mode="aspectFill" />
       <view class="package-info">
         <text class="name">{{ pkg.name }}</text>
         <text class="desc">{{ pkg.description }}</text>
@@ -50,6 +50,7 @@
 
 <script>
 import { getPackage } from '@/utils/api.js'
+import config from '@/config.js'
 
 export default {
   data() {
@@ -153,6 +154,9 @@ export default {
     },
     closePoster() {
       this.$refs.posterPopup.close()
+    },
+    getImageUrl: function(path) {
+      return config.API_BASE_URL + path
     }
   }
 }

+ 6 - 2
cfc-frontend/pages/index-home/index.vue

@@ -210,7 +210,7 @@
           class="product-card"
           @click="handleLogin()"
         >
-          <image class="product-cover" :src="item.coverImage || '/static/default-product.png'" mode="aspectFill" />
+          <image class="product-cover" :src="getImageUrl(item.coverImage) || '/static/default-product.png'" mode="aspectFill" />
           <view class="product-info">
             <text class="product-name">{{ item.name }}</text>
             <view class="product-price-row">
@@ -233,7 +233,7 @@
       </view>
       <view class="activity-list" v-else>
         <view class="activity-card" v-for="act in dimensionActivities" :key="act.id" @click="goActivityDetail(act)">
-          <image class="activity-cover" :src="act.coverImage || '/static/default-activity.png'" mode="aspectFill" />
+          <image class="activity-cover" :src="getImageUrl(act.coverImage) || '/static/default-activity.png'" mode="aspectFill" />
           <view class="activity-info">
             <text class="activity-name line-clamp-1">{{ act.title }}</text>
             <view class="activity-meta">
@@ -353,6 +353,7 @@ import CircleDetail from '../../components/CircleDetail.vue'
 import LoginGuideCard from '../../components/LoginGuideCard.vue'
 import FamilyChallengeCard from '../../components/FamilyChallengeCard.vue'
 import { acceptParentInvite, productList, getActivityList, getFeaturedArticles, getFamilyEnergySandbox, getVisibleFamilyMembers, getTodayTasksByCategory, getChildren, getEnergyOverview, getProductsByDomain, getChallengeList, getMyCircles, discoverCircles, joinGeneralCircle, leaveGeneralCircle } from '../../utils/api.js'
+import config from '@/config.js'
 
 var DIMENSIONS = [
   { code: 'body', name: '身', icon: '🌏', color: '#8D6E63', bgColor: 'rgba(141,110,99,0.15)', title: '主动健康', desc: '用最适合的方法,从根源调理家人体质,畅享高质量长寿生活' },
@@ -977,6 +978,9 @@ export default {
         })
       }, 500)
     },
+    getImageUrl: function(path) {
+      return config.API_BASE_URL + path
+    }
 
   }
 }