|
|
@@ -19,7 +19,7 @@ import { ref } from 'vue'
|
|
|
import { onShow } from '@dcloudio/uni-app'
|
|
|
import CustomNav from '@/components/custom-nav.vue'
|
|
|
import TabBar from '@/components/tab-bar.vue'
|
|
|
-import { isLoggedIn as checkLogin, getRole, roleToString, ensurePatientRedirect } from '@/composables/useAuth'
|
|
|
+import { isLoggedIn as checkLogin, getRole, roleToString } from '@/composables/useAuth'
|
|
|
|
|
|
const isLoggedIn = ref<boolean>(checkLogin())
|
|
|
const roleDisplay = ref<string>('')
|
|
|
@@ -42,8 +42,15 @@ onShow(() => {
|
|
|
const r = getRole()
|
|
|
roleDisplay.value = roleToString(r)
|
|
|
|
|
|
- // 仅当角色为患者(3)时,发起跳转
|
|
|
- ensurePatientRedirect()
|
|
|
+ // 仅当角色为患者(3)时,发起跳转到患者端健康页(该页在患者端为 Tab)
|
|
|
+ // 未登录或非患者则留在公共健康页
|
|
|
+ // TODO: 后续可支持医生/家属等其他角色的专属页面
|
|
|
+ if (r === 3) {
|
|
|
+ // patient health 在患者端 tab 中,使用 switchTab
|
|
|
+ console.log('[health/index] redirecting to patient health tab, logged=', logged, 'role=', r)
|
|
|
+ uni.switchTab({ url: '/pages/patient/health/index' })
|
|
|
+ return
|
|
|
+ }
|
|
|
} catch (err) {
|
|
|
console.error('检查登录态时出错:', err)
|
|
|
isLoggedIn.value = false
|