fix(mp): auth storage 明文回退 + 首页医护跳转防重入
- auth store restore() 增加 storageGet() 回退:_es_ 加密键为空时 尝试明文键(兼容 MCP 注入等场景),修复 inject_auth 后功能表面化 - Index 首页医护 reLaunch 添加 redirectingRef 防重入, 避免 DevTools 中重复 reLaunch 导致卡死
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { View, Text, Swiper, SwiperItem, Image } from '@tarojs/components';
|
||||
import { useState } from 'react';
|
||||
import { useState, useRef } from 'react';
|
||||
import Taro, { useDidShow, useDidHide } from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
import { useAuthStore } from '../../stores/auth';
|
||||
@@ -347,12 +347,15 @@ export default function Index() {
|
||||
// 医护人员访问患者首页时,自动跳转到医生端
|
||||
// 不渲染 HomeDashboard,避免触发患者首页的 API 请求(并发叠加问题)
|
||||
const shouldRedirect = !!(user && isMedicalStaff());
|
||||
const redirectingRef = useRef(false);
|
||||
|
||||
useDidShow(() => {
|
||||
if (shouldRedirect) {
|
||||
if (shouldRedirect && !redirectingRef.current) {
|
||||
redirectingRef.current = true;
|
||||
Taro.reLaunch({
|
||||
url: '/pages/pkg-doctor-core/index',
|
||||
fail: () => {
|
||||
redirectingRef.current = false;
|
||||
console.warn('跳转医生端失败,停留患者首页');
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user