Sfoglia il codice sorgente

fix(frontend): resolve subpackage path conflict in pages.json

- Split pages/home into two separate directories:
  - pages/index-home/index.vue (main package TabBar home page)
  - pages/home-pages/ (subpackage for parent-index, child-index, member-home-detail)
- Update all navigation URLs to use correct paths
- Fix /pages/home-index/index -> /pages/index-home/index across 19 files
liaoxg 3 mesi fa
parent
commit
60ab20c931

+ 1 - 1
cfc-frontend/App.vue

@@ -52,7 +52,7 @@ export default {
             this.saveLoginInfo(res.data)
             console.log('openid自动登录成功')
             // 刷新页面到登录态
-            uni.switchTab({ url: '/pages/home/index' })
+            uni.switchTab({ url: '/pages/index-home/index' })
             return
           }
         }

+ 2 - 2
cfc-frontend/custom-tab-bar/index.vue

@@ -44,7 +44,7 @@ export default {
     return {
       currentIndex: 0,
       normalTabs: [
-        { text: '行', pagePath: '/pages/home/index', icon: '/static/tab-action.png', selectedIcon: '/static/tab-action-active.png' },
+        { text: '行', pagePath: '/pages/index-home/index', icon: '/static/tab-action.png', selectedIcon: '/static/tab-action-active.png' },
         { text: '身', pagePath: '/pages/body/index', icon: '/static/tab-body.png', selectedIcon: '/static/tab-body-active.png' },
         { text: '智', pagePath: '/pages/wisdom/index', icon: '/static/tab-wisdom.png', selectedIcon: '/static/tab-wisdom-active.png' },
         { text: '心', pagePath: '/pages/mind/index', icon: '/static/tab-mind.png', selectedIcon: '/static/tab-mind-active.png' },
@@ -92,7 +92,7 @@ export default {
     switchTab(item, index) {
       this.currentIndex = index
       // 原生TabBar页使用switchTab,非Tab页使用redirectTo(比reLaunch轻量)
-      const nativeTabPages = ['/pages/home/index', '/pages/body/index', '/pages/wisdom/index', '/pages/mind/index', '/pages/profile/profile']
+      const nativeTabPages = ['/pages/index-home/index', '/pages/body/index', '/pages/wisdom/index', '/pages/mind/index', '/pages/profile/profile']
       if (nativeTabPages.includes(item.pagePath)) {
         uni.switchTab({ url: item.pagePath })
       } else {

+ 23 - 23
cfc-frontend/pages.json

@@ -1,7 +1,7 @@
 {
   "pages": [
     {
-      "path": "pages/home/index",
+      "path": "pages/index-home/index",
       "style": {
         "navigationBarTitleText": "首页"
       }
@@ -149,26 +149,26 @@
       "pages": [
         {
           "path": "market/index",
-              "style": {
-                "navigationBarTitleText": "任务模板市场"
-              }
-            },
-            {
-              "path": "market/detail",
-              "style": {
-                "navigationBarTitleText": "任务模板详情"
-              }
-            },
-            {
-              "path": "child-detail",
-              "style": {
-                "navigationBarTitleText": "孩子详情"
-              }
-            }
-          ]
-        },
-        {
-          "root": "pages/child",
+          "style": {
+            "navigationBarTitleText": "任务模板市场"
+          }
+        },
+        {
+          "path": "market/detail",
+          "style": {
+            "navigationBarTitleText": "任务模板详情"
+          }
+        },
+        {
+          "path": "child-detail",
+          "style": {
+            "navigationBarTitleText": "孩子详情"
+          }
+        }
+      ]
+    },
+    {
+      "root": "pages/child",
       "pages": [
         {
           "path": "tasks",
@@ -1254,7 +1254,7 @@
       ]
     },
     {
-      "root": "pages/home",
+      "root": "pages/home-pages",
       "pages": [
         {
           "path": "parent-index",
@@ -1333,7 +1333,7 @@
     "backgroundColor": "#FFFFFF",
     "list": [
       {
-        "pagePath": "pages/home/index",
+        "pagePath": "pages/index-home/index",
         "text": "行",
         "iconPath": "static/tab-action.png",
         "selectedIconPath": "static/tab-action-active.png"

+ 1 - 1
cfc-frontend/pages/action/index.vue

@@ -406,7 +406,7 @@ export default {
         return
       }
       if (item.page) {
-        var nativeTabs = ['/pages/tasks/tasks', '/pages/home/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/profile/profile']
+        var nativeTabs = ['/pages/tasks/tasks', '/pages/index-home/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/profile/profile']
         if (nativeTabs.indexOf(item.page) !== -1) {
           uni.switchTab({ url: item.page })
         } else {

+ 1 - 1
cfc-frontend/pages/child/rewards.vue

@@ -125,7 +125,7 @@ export default {
         if (result.data) {
           this.$store.commit('switchBackToParent')
           uni.showToast({ title: '已切换回家长模式', icon: 'success' })
-          uni.reLaunch({ url: '/pages/home/parent-index' })
+          uni.reLaunch({ url: '/pages/home-pages/parent-index' })
         }
       } catch (e) { 
         uni.showToast({ title: '切换失败', icon: 'none' }) 

+ 1 - 1
cfc-frontend/pages/child/tasks.vue

@@ -358,7 +358,7 @@ export default {
         if (result.data) {
           this.$store.commit('switchBackToParent')
           uni.showToast({ title: '已切换回家长模式', icon: 'success' })
-          uni.reLaunch({ url: '/pages/home/parent-index' })
+          uni.reLaunch({ url: '/pages/home-pages/parent-index' })
         }
       } catch (_) {
         uni.showToast({ title: '切换失败', icon: 'none' })

+ 1 - 1
cfc-frontend/pages/guide/bind/invite.vue

@@ -207,7 +207,7 @@ export default {
       return `${d.getMonth() + 1}-${d.getDate()}`
     },
     goHome() {
-      uni.switchTab({ url: '/pages/home/parent-index' })
+      uni.switchTab({ url: '/pages/home-pages/parent-index' })
     }
   }
 }

+ 2 - 2
cfc-frontend/pages/home/child-index.vue → cfc-frontend/pages/home-pages/child-index.vue

@@ -475,7 +475,7 @@ export default {
         const userInfo = uni.getStorageSync('userInfo')
         const role = uni.getStorageSync('currentRole') || 'child'
         if (role !== 'child') {
-          uni.switchTab({ url: '/pages/home/index' })
+          uni.switchTab({ url: '/pages/index-home/index' })
           return
         }
         this.nickname = (userInfo && userInfo.nickname) ? userInfo.nickname : '小朋友'
@@ -652,7 +652,7 @@ export default {
         content: '确定要切换回家长模式吗?',
         success: function(res) {
           if (res.confirm) {
-            uni.switchTab({ url: '/pages/home/index' })
+            uni.switchTab({ url: '/pages/index-home/index' })
           }
         }
       })

+ 0 - 0
cfc-frontend/pages/home/member-home-detail.vue → cfc-frontend/pages/home-pages/member-home-detail.vue


+ 1 - 1
cfc-frontend/pages/home/parent-index.vue → cfc-frontend/pages/home-pages/parent-index.vue

@@ -561,7 +561,7 @@ export default {
     }
     const currentRole = uni.getStorageSync('currentRole') || 'parent'
     if (currentRole === 'child') {
-      uni.reLaunch({ url: '/pages/home/child-index' })
+      uni.reLaunch({ url: '/pages/home-pages/child-index' })
       return
     }
     if (uni.getStorageSync('token')) {

+ 4 - 4
cfc-frontend/pages/home/index.vue → cfc-frontend/pages/index-home/index.vue

@@ -387,8 +387,8 @@ export default {
       }
       // 登录用户:跳转到 home 分包页面,不再静态渲染组件
       var targetUrl = this.currentRole === 'child'
-        ? '/pages/home/child-index'
-        : '/pages/home/parent-index'
+        ? '/pages/home-pages/child-index'
+        : '/pages/home-pages/parent-index'
       uni.redirectTo({ url: targetUrl })
     },
     isLoggedIn() {
@@ -509,7 +509,7 @@ export default {
       uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + id })
     },
     handleLogin() {
-      uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/home/index') })
+      uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index-home/index') })
     },
     async handleParentInvite(code) {
       // 延迟显示,等待登录完成
@@ -540,7 +540,7 @@ export default {
                   uni.showToast({ title: '加入成功', icon: 'success' })
                   // 刷新页面
                   setTimeout(() => {
-                    uni.switchTab({ url: '/pages/home/index' })
+                    uni.switchTab({ url: '/pages/index-home/index' })
                   }, 1500)
                 }
               } catch (e) {

+ 1 - 1
cfc-frontend/pages/invite/join.vue

@@ -312,7 +312,7 @@ export default {
       this.acceptLoading = false
     },
     goHome() {
-      uni.reLaunch({ url: '/pages/home/index' })
+      uni.reLaunch({ url: '/pages/index-home/index' })
     },
     async bindRef() {
       if (!this.refCode) {

+ 2 - 2
cfc-frontend/pages/login/login.vue

@@ -234,14 +234,14 @@ export default {
         const redirect = this.redirectUrl
         this.redirectUrl = ''
         // 注意: redirectTo 不支持跳转 tabBar 页面,必须用 switchTab
-        var tabBarPages = ['/pages/home/index', '/pages/body/index', '/pages/wisdom/index', '/pages/mind/index', '/pages/profile/profile']
+        var tabBarPages = ['/pages/index-home/index', '/pages/body/index', '/pages/wisdom/index', '/pages/mind/index', '/pages/profile/profile']
         if (tabBarPages.indexOf(redirect) !== -1) {
           uni.switchTab({ url: redirect })
         } else {
           uni.redirectTo({ url: redirect })
         }
       } else {
-        uni.switchTab({ url: '/pages/home/index' })
+        uni.switchTab({ url: '/pages/index-home/index' })
       }
     }
   }

+ 1 - 1
cfc-frontend/pages/parent/market/detail.vue

@@ -120,7 +120,7 @@ export default {
               if (pages.length > 1) {
                 uni.navigateBack()
               } else {
-                uni.switchTab({ url: '/pages/home/index' })
+                uni.switchTab({ url: '/pages/index-home/index' })
               }
             }, 1500)
           } catch (e) {

+ 1 - 1
cfc-frontend/pages/profile-extra/family-members.vue

@@ -298,7 +298,7 @@ export default {
           })
           uni.showToast({ title: '已切换到' + (member.nickname || '该成员'), icon: 'success' })
           setTimeout(function() {
-            uni.reLaunch({ url: '/pages/home/index' })
+            uni.reLaunch({ url: '/pages/index-home/index' })
           }, 1000)
         } else {
           uni.showToast({ title: res.message || '切换失败', icon: 'none' })

+ 1 - 1
cfc-frontend/pages/profile/components/ProfileHeader.vue

@@ -126,7 +126,7 @@ export default {
                 this.isSwitchedChild = false
                 this.role = 'parent'
                 uni.showToast({ title: '已退出切换', icon: 'success' })
-                uni.reLaunch({ url: '/pages/home/index' })
+                uni.reLaunch({ url: '/pages/index-home/index' })
               } else {
                 uni.showToast({ title: '密码错误', icon: 'none' })
               }

+ 1 - 1
cfc-frontend/pages/profile/components/ProfileMenu.vue

@@ -242,7 +242,7 @@ export default {
         success: (res) => {
           if (res.confirm) {
             this.$store.commit('logout')
-            uni.reLaunch({ url: '/pages/home/index' })
+            uni.reLaunch({ url: '/pages/index-home/index' })
           }
         }
       })

+ 1 - 1
cfc-frontend/pages/register-child/index.vue

@@ -66,7 +66,7 @@ export default {
       // Here you would typically POST the data to your backend
       uni.showToast({ title: '注册完成!', icon: 'success' });
       // Navigate to child dashboard or home
-      uni.redirectTo({ url: '/pages/home/index' });
+      uni.redirectTo({ url: '/pages/index-home/index' });
     }
   }
 }

+ 1 - 1
cfc-frontend/pages/teacher/index.vue

@@ -16,7 +16,7 @@
 export default {
   methods: {
     goToHome() {
-      uni.switchTab({ url: '/pages/home/index' })
+      uni.switchTab({ url: '/pages/index-home/index' })
     }
   }
 }

+ 1 - 1
cfc-frontend/pages/teacher/teacher-home.vue

@@ -190,7 +190,7 @@ export default {
           uni.setStorageSync('isSwitchedChild', false)
           uni.setStorageSync('isSwitchedTeacher', false)
           uni.$emit('switchRole')
-          uni.reLaunch({ url: '/pages/home/index' })
+          uni.reLaunch({ url: '/pages/index-home/index' })
         }
       } catch (e) {
         uni.showToast({ title: e.message || '切换失败', icon: 'none' })

+ 1 - 1
cfc-frontend/pages/teacher/teacher-profile.vue

@@ -109,7 +109,7 @@ export default {
           uni.setStorageSync('isSwitchedChild', false)
           uni.setStorageSync('isSwitchedTeacher', false)
           uni.$emit('switchRole')
-          uni.reLaunch({ url: '/pages/home/index' })
+          uni.reLaunch({ url: '/pages/index-home/index' })
         }
       } catch (e) {
         uni.showToast({ title: e.message || '切换失败', icon: 'none' })

+ 3 - 3
cfc-frontend/pages/user-edit/user-edit.vue

@@ -535,7 +535,7 @@ export default {
 				uni.showToast({ title: '提交成功,请等待审核' })
 				setTimeout(() => {
 					uni.switchTab({
-						url: '/pages/home/parent-index'
+						url: '/pages/home-pages/parent-index'
 					})
 				}, 1500)
 			} catch (e) {
@@ -650,9 +650,9 @@ export default {
 			}
 			const role = this.form.role || 'parent'
 			if (role === 'parent') {
-				uni.switchTab({ url: '/pages/home/parent-index' })
+				uni.switchTab({ url: '/pages/home-pages/parent-index' })
 			} else if (role === 'child') {
-				uni.switchTab({ url: '/pages/home/child-index' })
+				uni.switchTab({ url: '/pages/home-pages/child-index' })
 			} else if (role === 'teacher') {
 				uni.switchTab({ url: '/pages/teacher/index' })
 			}

+ 1 - 1
cfc-frontend/pages/wealth/index.vue

@@ -403,7 +403,7 @@ export default {
                 }
                 uni.showToast({ title: '已退出切换', icon: 'success' })
                 setTimeout(function() {
-                  uni.reLaunch({ url: '/pages/home/index' })
+                  uni.reLaunch({ url: '/pages/index-home/index' })
                 }, 1000)
               } else {
                 uni.showToast({ title: '密码错误', icon: 'none' })

+ 2 - 2
cfc-frontend/pages/wisdom/index.vue

@@ -405,7 +405,7 @@ export default {
         return
       }
       if (item.page) {
-        var nativeTabs = ['/pages/tasks/tasks', '/pages/home/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/wisdom/index', '/pages/profile/profile']
+        var nativeTabs = ['/pages/tasks/tasks', '/pages/index-home/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/wisdom/index', '/pages/profile/profile']
         if (nativeTabs.indexOf(item.page) !== -1) {
           uni.switchTab({ url: item.page })
         } else {
@@ -433,7 +433,7 @@ export default {
       uni.navigateTo({ url: '/pages/assessment/apply' })
     },
     goHome: function() {
-      uni.switchTab({ url: '/pages/home/index' })
+      uni.switchTab({ url: '/pages/index-home/index' })
     },
     onTaskClick: function(task) {},
     goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },

+ 1 - 1
cfc-frontend/pages/wisdom/wisdom_temp/index.vue

@@ -165,7 +165,7 @@ export default {
         return
       }
       if (item.page) {
-        var nativeTabs = ['/pages/tasks/tasks', '/pages/home/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/wisdom/index', '/pages/profile/profile']
+        var nativeTabs = ['/pages/tasks/tasks', '/pages/index-home/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/wisdom/index', '/pages/profile/profile']
         if (nativeTabs.indexOf(item.page) !== -1) {
           uni.switchTab({ url: item.page })
         } else {

+ 1 - 1
cfc-frontend/pages/wishes/index.vue

@@ -373,7 +373,7 @@ export default {
       try {
         currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role')
         if (currentRole !== 'child') {
-          uni.reLaunch({ url: '/pages/home/index' })
+          uni.reLaunch({ url: '/pages/index-home/index' })
           return
         }