hookehuyr

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

修改多处导航方法,从reLaunch改为更合适的redirectTo或navigateTo
移除测试环境下的硬编码openid
<!--
* @Date: 2025-08-27 17:44:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-09 11:04:34
* @LastEditTime: 2025-09-12 23:03:26
* @FilePath: /lls_program/src/components/BottomNav.vue
* @Description: 文件描述
-->
......@@ -50,7 +50,7 @@ const isActive = (path) => {
};
const navigate = (path) => {
Taro.reLaunch({ url: path });
Taro.redirectTo({ url: path });
};
</script>
......
......@@ -115,7 +115,7 @@ const navigateTo = async (url) => {
// }
// }
Taro.reLaunch({
Taro.redirectTo({
url
})
}
......
......@@ -99,7 +99,7 @@ const handleGoBack = () => {
delta: 1
}).catch(() => {
// 如果无法返回,则跳转到首页
Taro.reLaunch({
Taro.redirectTo({
url: '/pages/Dashboard/index'
})
})
......
......@@ -366,7 +366,7 @@ useLoad(async () => {
// 如果用户没有加入家庭,跳转到欢迎页面
if (!hasFamily) {
console.warn('用户未加入家庭,跳转到欢迎页面');
await Taro.reLaunch({
await Taro.navigateTo({
url: '/pages/Welcome/index'
})
return
......
/*
* @Date: 2025-01-25 10:00:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-12 22:56:27
* @LastEditTime: 2025-09-12 23:02:36
* @FilePath: /lls_program/src/utils/authRedirect.js
* @Description: 授权重定向处理工具函数
*/
......@@ -107,7 +107,7 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index
// 如果用户没有加入家庭,跳转到欢迎页面
if (!hasFamily) {
await Taro.reLaunch({
await Taro.redirectTo({
url: '/pages/Welcome/index'
})
return
......@@ -121,9 +121,9 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index
return
}
// 如果目标是首页,使用 reLaunch
// 如果目标是首页,使用 redirectTo
if (targetRoute === 'pages/Dashboard/index') {
await Taro.reLaunch({
await Taro.redirectTo({
url: '/pages/Dashboard/index'
})
} else {
......@@ -138,11 +138,11 @@ export const returnToOriginalPage = async (defaultPath = '/pages/Dashboard/index
try {
const hasFamily = await checkUserHasFamily()
if (hasFamily) {
await Taro.reLaunch({
await Taro.redirectTo({
url: '/pages/Dashboard/index'
})
} else {
await Taro.reLaunch({
await Taro.redirectTo({
url: '/pages/Welcome/index'
})
}
......@@ -264,12 +264,12 @@ export const silentAuth = async (onSuccess, onError) => {
// 测试环境下传递openid,正式环境不传递
if (process.env.NODE_ENV === 'development') {
requestData.openid = 'h-008';
// requestData.openid = 'h-008';
// requestData.openid = 'h-009';
// requestData.openid = 'h-010';
// requestData.openid = 'h-011';
// requestData.openid = 'h-012';
// requestData.openid = 'h-013';
requestData.openid = 'h-013';
// requestData.openid = 'oWbdFvkD5VtloC50wSNR9IWiU2q8';
// requestData.openid = 'oex8h5QZnZJto3ttvO6swSvylAQo';
}
......@@ -309,7 +309,7 @@ export const silentAuth = async (onSuccess, onError) => {
// 如果用户没有加入家庭,跳转到欢迎页面
if (!hasFamily) {
await Taro.reLaunch({
await Taro.redirectTo({
url: '/pages/Welcome/index'
})
......