Jelajahi Sumber

refactor(routes): 重构页面路由结构和路径配置

- 统一将页面入口文件重命名为 index.vue
- 调整健康数据相关页面路径至 details 子目录
- 更新 TabBar 组件中的页面跳转路径
- 修改 pages.json 中的页面路径配置
- 调整个人信息相关页面路径至 infos 子目录
- 移除 tsconfig.json 中的 extends 配置并添加详细编译选项
- 从 package-lock.json 中移除多个包的 dev 属性标记
mcbaiyun 2 bulan lalu
induk
melakukan
d51f1a7ecf

+ 0 - 16
package-lock.json

@@ -3473,7 +3473,6 @@
       "version": "2.5.1",
       "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz",
       "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==",
-      "dev": true,
       "hasInstallScript": true,
       "license": "MIT",
       "optional": true,
@@ -3513,7 +3512,6 @@
       "cpu": [
         "arm64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3534,7 +3532,6 @@
       "cpu": [
         "arm64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3555,7 +3552,6 @@
       "cpu": [
         "x64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3576,7 +3572,6 @@
       "cpu": [
         "x64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3597,7 +3592,6 @@
       "cpu": [
         "arm"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3618,7 +3612,6 @@
       "cpu": [
         "arm"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3639,7 +3632,6 @@
       "cpu": [
         "arm64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3660,7 +3652,6 @@
       "cpu": [
         "arm64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3681,7 +3672,6 @@
       "cpu": [
         "x64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3702,7 +3692,6 @@
       "cpu": [
         "x64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3723,7 +3712,6 @@
       "cpu": [
         "arm64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3744,7 +3732,6 @@
       "cpu": [
         "ia32"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -3765,7 +3752,6 @@
       "cpu": [
         "x64"
       ],
-      "dev": true,
       "license": "MIT",
       "optional": true,
       "os": [
@@ -5635,7 +5621,6 @@
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
       "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==",
-      "dev": true,
       "license": "Apache-2.0",
       "optional": true,
       "bin": {
@@ -8350,7 +8335,6 @@
       "version": "7.1.1",
       "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
       "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
-      "dev": true,
       "license": "MIT",
       "optional": true
     },

+ 2 - 2
src/components/TabBar.vue

@@ -27,12 +27,12 @@ const onTabClick = (index: number) => {
       break
     case 1: // 健康数据
       uni.switchTab({
-        url: '/pages/health/health'
+        url: '/pages/health/index'
       })
       break
     case 2: // 个人中心
       uni.switchTab({
-        url: '/pages/profile/profile'
+        url: '/pages/profile/index'
       })
       break
   }

+ 12 - 12
src/pages.json

@@ -7,49 +7,49 @@
 			}
 		},
 		{
-			"path": "pages/login/login",
+			"path": "pages/login/index",
 			"style": {
 				"navigationBarTitleText": "登录"
 			}
 		},
 		{
-			"path": "pages/health/health",
+			"path": "pages/health/index",
 			"style": {
 				"navigationBarTitleText": "健康数据"
 			}
 		},
 		{
-			"path": "pages/health/height",
+			"path": "pages/health/details/height",
 			"style": { "navigationBarTitleText": "身高" }
 		},
 		{
-			"path": "pages/health/weight",
+			"path": "pages/health/details/weight",
 			"style": { "navigationBarTitleText": "体重" }
 		},
 		{
-			"path": "pages/health/bmi",
+			"path": "pages/health/details/bmi",
 			"style": { "navigationBarTitleText": "BMI" }
 		},
 		{
-			"path": "pages/health/blood-pressure",
+			"path": "pages/health/details/blood-pressure",
 			"style": { "navigationBarTitleText": "血压" }
 		},
 		{
-			"path": "pages/health/blood-glucose",
+			"path": "pages/health/details/blood-glucose",
 			"style": { "navigationBarTitleText": "血糖" }
 		},
 		{
-			"path": "pages/health/heart-rate",
+			"path": "pages/health/details/heart-rate",
 			"style": { "navigationBarTitleText": "心率" }
 		},
 		{
-			"path": "pages/profile/profile",
+			"path": "pages/profile/index",
 			"style": {
 				"navigationBarTitleText": "个人中心"
 			}
 		},
 		{
-			"path": "pages/profile/baseinfo",
+			"path": "pages/profile/infos/baseinfo",
 			"style": {
 				"navigationBarTitleText": "完善信息"
 			}
@@ -77,11 +77,11 @@
 				"text": "慢病首页"
 			},
 			{
-				"pagePath": "pages/health/health",
+				"pagePath": "pages/health/index",
 				"text": "健康数据"
 			},
 			{
-				"pagePath": "pages/profile/profile",
+				"pagePath": "pages/profile/index",
 				"text": "个人中心"
 			}
 		]

+ 0 - 0
src/pages/health/blood-glucose.vue → src/pages/health/details/blood-glucose.vue


+ 0 - 0
src/pages/health/blood-pressure.vue → src/pages/health/details/blood-pressure.vue


+ 0 - 0
src/pages/health/bmi.vue → src/pages/health/details/bmi.vue


+ 0 - 0
src/pages/health/heart-rate.vue → src/pages/health/details/heart-rate.vue


+ 0 - 0
src/pages/health/height.vue → src/pages/health/details/height.vue


+ 0 - 0
src/pages/health/weight.vue → src/pages/health/details/weight.vue


+ 1 - 1
src/pages/health/health.vue → src/pages/health/index.vue

@@ -52,7 +52,7 @@ import TabBar from '@/components/TabBar.vue'
 const title = ref('健康数据')
 
 const openDetail = (type: string) => {
-  uni.navigateTo({ url: `/pages/health/${type}` })
+  uni.navigateTo({ url: `/pages/health/details/${type}` })
 }
 </script>
 

+ 1 - 1
src/pages/login/login.vue → src/pages/login/index.vue

@@ -72,7 +72,7 @@ async function onSelectRole(role: number) {
     uni.showToast({ title: '登录成功', icon: 'success' })
     // 跳转到个人信息页面
     setTimeout(() => {
-      uni.switchTab({ url: '/pages/profile/profile' })
+      uni.switchTab({ url: '/pages/profile/index' })
     }, 1500)
   } catch (err) {
     console.error('Login error:', err)

+ 4 - 4
src/pages/profile/profile.vue → src/pages/profile/index.vue

@@ -104,7 +104,7 @@ const fetchUserInfo = async () => {
       uni.removeStorageSync('token')
       uni.removeStorageSync('role')
       user.value = {}
-      uni.reLaunch({ url: '/pages/login/login' })
+      uni.reLaunch({ url: '/pages/login/index' })
       return
     }
     if (resp && resp.code === 200 && resp.data) {
@@ -113,7 +113,7 @@ const fetchUserInfo = async () => {
       uni.setStorageSync('user_info', resp.data)
       // 检查 nickname 和 avatar
       if (!resp.data.nickname || !resp.data.avatar) {
-        uni.navigateTo({ url: '/pages/profile/baseinfo' })
+        uni.navigateTo({ url: '/pages/profile/infos/baseinfo' })
       }
     }
   } catch (err) {
@@ -127,7 +127,7 @@ onShow(() => {
   const token = uni.getStorageSync('token')
   if (!token) {
     // 使用 uni.reLaunch 替代 navigateTo,确保页面栈被清空
-    uni.reLaunch({ url: '/pages/login/login' })
+    uni.reLaunch({ url: '/pages/login/index' })
   } else {
     fetchUserInfo()
   }
@@ -137,7 +137,7 @@ const onMenuClick = (type: string) => {
   console.log('Menu clicked:', type)
   if (type === 'baseinfo') {
     // 跳转到修改个人信息页面
-    uni.navigateTo({ url: '/pages/profile/baseinfo' })
+    uni.navigateTo({ url: '/pages/profile/infos/baseinfo' })
     return
   }
   uni.showToast({

+ 1 - 1
src/pages/profile/baseinfo.vue → src/pages/profile/infos/baseinfo.vue

@@ -109,7 +109,7 @@ const fetchUserInfo = async () => {
     if (response.statusCode === 401) {
       // 未授权,跳转登录
       uni.removeStorageSync('token')
-      uni.reLaunch({ url: '/pages/login/login' })
+      uni.reLaunch({ url: '/pages/login/index' })
       return
     }
     const resp = response.data as any

+ 13 - 1
tsconfig.json

@@ -1,6 +1,18 @@
 {
-  "extends": "@vue/tsconfig/tsconfig.json",
   "compilerOptions": {
+    "module": "ESNext",
+    "moduleResolution": "Node",
+    "resolveJsonModule": true,
+    "useDefineForClassFields": true,
+    "jsx": "preserve",
+    "noImplicitThis": true,
+    "strict": true,
+    "isolatedModules": true,
+    "verbatimModuleSyntax": true,
+    "target": "ESNext",
+    "esModuleInterop": true,
+    "forceConsistentCasingInFileNames": true,
+    "skipLibCheck": true,
     "sourceMap": true,
     "baseUrl": ".",
     "paths": {