Browse Source

fix(frontend): 修复pages.json饮食分包位置错误 + 饮食模块config引用改为config.js

liaoxg 1 month ago
parent
commit
eae95396ab

+ 47 - 47
cfc-frontend/pages.json

@@ -1424,6 +1424,53 @@
           }
         }
       ]
+    },
+    {
+      "root": "pages/diet",
+      "pages": [
+        {
+          "path": "index",
+          "style": {
+            "navigationBarTitleText": "饮食"
+          }
+        },
+        {
+          "path": "preferences",
+          "style": {
+            "navigationBarTitleText": "饮食偏好调研"
+          }
+        },
+        {
+          "path": "food-query",
+          "style": {
+            "navigationBarTitleText": "食材查询"
+          }
+        },
+        {
+          "path": "meal-config",
+          "style": {
+            "navigationBarTitleText": "共餐配置"
+          }
+        },
+        {
+          "path": "recommendation",
+          "style": {
+            "navigationBarTitleText": "食谱推荐"
+          }
+        },
+        {
+          "path": "records",
+          "style": {
+            "navigationBarTitleText": "饮食记录"
+          }
+        },
+        {
+          "path": "record-detail",
+          "style": {
+            "navigationBarTitleText": "记录详情"
+          }
+        }
+      ]
     }
   ],
   "globalStyle": {
@@ -1465,53 +1512,6 @@
       }
     ]
   },
-  {
-    "root": "pages/diet",
-    "pages": [
-      {
-        "path": "index",
-        "style": {
-          "navigationBarTitleText": "饮食"
-        }
-      },
-      {
-        "path": "preferences",
-        "style": {
-          "navigationBarTitleText": "饮食偏好调研"
-        }
-      },
-      {
-        "path": "food-query",
-        "style": {
-          "navigationBarTitleText": "食材查询"
-        }
-      },
-      {
-        "path": "meal-config",
-        "style": {
-          "navigationBarTitleText": "共餐配置"
-        }
-      },
-      {
-        "path": "recommendation",
-        "style": {
-          "navigationBarTitleText": "食谱推荐"
-        }
-      },
-      {
-        "path": "records",
-        "style": {
-          "navigationBarTitleText": "饮食记录"
-        }
-      },
-      {
-        "path": "record-detail",
-        "style": {
-          "navigationBarTitleText": "记录详情"
-        }
-      }
-    ]
-  },
   "easycom": {
     "auto": "components/@dcloudio/uni-$2/components/uni-$1/uni-$1.vue",
     "pages": {

+ 2 - 3
cfc-frontend/pages/diet/food-query.vue

@@ -68,7 +68,7 @@
 </template>
 
 <script>
-import { request } from '@/config/index.js'
+import config from '@/config.js'
 
 export default {
   data() {
@@ -146,8 +146,7 @@ export default {
       this.filterType = type
     },
     getApiUrl: function(path) {
-      var config = require('@/config/index.js')
-      return config.baseUrl + path
+      return config.api(path)
     }
   }
 }

+ 2 - 2
cfc-frontend/pages/diet/meal-config.vue

@@ -54,6 +54,7 @@
 </template>
 
 <script>
+import config from '@/config.js'
 import { getMealConfig, saveMealConfig } from '@/utils/api.js'
 
 export default {
@@ -166,8 +167,7 @@ export default {
       })
     },
     getApiUrl: function(path) {
-      var config = require('@/config/index.js')
-      return config.baseUrl + path
+      return config.api(path)
     }
   }
 }