hookehuyr

fix(路由): 将reLaunch替换为redirectTo和navigateTo以改进导航体验

修改多处导航方法,从reLaunch改为更合适的redirectTo或navigateTo
移除测试环境下的硬编码openid
1 <!-- 1 <!--
2 * @Date: 2025-08-27 17:44:10 2 * @Date: 2025-08-27 17:44:10
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-09-09 11:04:34 4 + * @LastEditTime: 2025-09-12 23:03:26
5 * @FilePath: /lls_program/src/components/BottomNav.vue 5 * @FilePath: /lls_program/src/components/BottomNav.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -50,7 +50,7 @@ const isActive = (path) => { ...@@ -50,7 +50,7 @@ const isActive = (path) => {
50 }; 50 };
51 51
52 const navigate = (path) => { 52 const navigate = (path) => {
53 - Taro.reLaunch({ url: path }); 53 + Taro.redirectTo({ url: path });
54 }; 54 };
55 </script> 55 </script>
56 56
......
...@@ -115,7 +115,7 @@ const navigateTo = async (url) => { ...@@ -115,7 +115,7 @@ const navigateTo = async (url) => {
115 // } 115 // }
116 // } 116 // }
117 117
118 - Taro.reLaunch({ 118 + Taro.redirectTo({
119 url 119 url
120 }) 120 })
121 } 121 }
......
...@@ -99,7 +99,7 @@ const handleGoBack = () => { ...@@ -99,7 +99,7 @@ const handleGoBack = () => {
99 delta: 1 99 delta: 1
100 }).catch(() => { 100 }).catch(() => {
101 // 如果无法返回,则跳转到首页 101 // 如果无法返回,则跳转到首页
102 - Taro.reLaunch({ 102 + Taro.redirectTo({
103 url: '/pages/Dashboard/index' 103 url: '/pages/Dashboard/index'
104 }) 104 })
105 }) 105 })
......
...@@ -366,7 +366,7 @@ useLoad(async () => { ...@@ -366,7 +366,7 @@ useLoad(async () => {
366 // 如果用户没有加入家庭,跳转到欢迎页面 366 // 如果用户没有加入家庭,跳转到欢迎页面
367 if (!hasFamily) { 367 if (!hasFamily) {
368 console.warn('用户未加入家庭,跳转到欢迎页面'); 368 console.warn('用户未加入家庭,跳转到欢迎页面');
369 - await Taro.reLaunch({ 369 + await Taro.navigateTo({
370 url: '/pages/Welcome/index' 370 url: '/pages/Welcome/index'
371 }) 371 })
372 return 372 return
......
1 /* 1 /*
2 * @Date: 2025-01-25 10:00:00 2 * @Date: 2025-01-25 10:00:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-09-12 22:56:27 4 + * @LastEditTime: 2025-09-12 23:02:36
5 * @FilePath: /lls_program/src/utils/authRedirect.js 5 * @FilePath: /lls_program/src/utils/authRedirect.js
6 * @Description: 授权重定向处理工具函数 6 * @Description: 授权重定向处理工具函数
7 */ 7 */
...@@ -107,7 +107,7 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index ...@@ -107,7 +107,7 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index
107 107
108 // 如果用户没有加入家庭,跳转到欢迎页面 108 // 如果用户没有加入家庭,跳转到欢迎页面
109 if (!hasFamily) { 109 if (!hasFamily) {
110 - await Taro.reLaunch({ 110 + await Taro.redirectTo({
111 url: '/pages/Welcome/index' 111 url: '/pages/Welcome/index'
112 }) 112 })
113 return 113 return
...@@ -121,9 +121,9 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index ...@@ -121,9 +121,9 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index
121 return 121 return
122 } 122 }
123 123
124 - // 如果目标是首页,使用 reLaunch 124 + // 如果目标是首页,使用 redirectTo
125 if (targetRoute === 'pages/Dashboard/index') { 125 if (targetRoute === 'pages/Dashboard/index') {
126 - await Taro.reLaunch({ 126 + await Taro.redirectTo({
127 url: '/pages/Dashboard/index' 127 url: '/pages/Dashboard/index'
128 }) 128 })
129 } else { 129 } else {
...@@ -138,11 +138,11 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index ...@@ -138,11 +138,11 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index
138 try { 138 try {
139 const hasFamily = await checkUserHasFamily() 139 const hasFamily = await checkUserHasFamily()
140 if (hasFamily) { 140 if (hasFamily) {
141 - await Taro.reLaunch({ 141 + await Taro.redirectTo({
142 url: '/pages/Dashboard/index' 142 url: '/pages/Dashboard/index'
143 }) 143 })
144 } else { 144 } else {
145 - await Taro.reLaunch({ 145 + await Taro.redirectTo({
146 url: '/pages/Welcome/index' 146 url: '/pages/Welcome/index'
147 }) 147 })
148 } 148 }
...@@ -264,12 +264,12 @@ export const silentAuth = async (onSuccess, onError) => { ...@@ -264,12 +264,12 @@ export const silentAuth = async (onSuccess, onError) => {
264 264
265 // 测试环境下传递openid,正式环境不传递 265 // 测试环境下传递openid,正式环境不传递
266 if (process.env.NODE_ENV === 'development') { 266 if (process.env.NODE_ENV === 'development') {
267 - requestData.openid = 'h-008'; 267 + // requestData.openid = 'h-008';
268 // requestData.openid = 'h-009'; 268 // requestData.openid = 'h-009';
269 // requestData.openid = 'h-010'; 269 // requestData.openid = 'h-010';
270 // requestData.openid = 'h-011'; 270 // requestData.openid = 'h-011';
271 // requestData.openid = 'h-012'; 271 // requestData.openid = 'h-012';
272 - // requestData.openid = 'h-013'; 272 + requestData.openid = 'h-013';
273 // requestData.openid = 'oWbdFvkD5VtloC50wSNR9IWiU2q8'; 273 // requestData.openid = 'oWbdFvkD5VtloC50wSNR9IWiU2q8';
274 // requestData.openid = 'oex8h5QZnZJto3ttvO6swSvylAQo'; 274 // requestData.openid = 'oex8h5QZnZJto3ttvO6swSvylAQo';
275 } 275 }
...@@ -309,7 +309,7 @@ export const silentAuth = async (onSuccess, onError) => { ...@@ -309,7 +309,7 @@ export const silentAuth = async (onSuccess, onError) => {
309 309
310 // 如果用户没有加入家庭,跳转到欢迎页面 310 // 如果用户没有加入家庭,跳转到欢迎页面
311 if (!hasFamily) { 311 if (!hasFamily) {
312 - await Taro.reLaunch({ 312 + await Taro.redirectTo({
313 url: '/pages/Welcome/index' 313 url: '/pages/Welcome/index'
314 }) 314 })
315 315
......