From 5cfd98e57bcd99c0c97888236e6f683efe4741cc Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Thu, 06 Nov 2025 17:36:53 +0800
Subject: [PATCH] feat: 跳登录的时候关闭其他页面

---
 src/pages/user/index.vue                      |    2 +-
 src/utils/request/interceptors.js             |    2 +-
 src/components/WebViewPlus.vue                |    2 +-
 src/subPackages/userDetail/password/index.vue |   20 ++++++++++----------
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/components/WebViewPlus.vue b/src/components/WebViewPlus.vue
index 6e7da46..1d54046 100644
--- a/src/components/WebViewPlus.vue
+++ b/src/components/WebViewPlus.vue
@@ -22,7 +22,7 @@
 function messageFun(e) {
   if (e.data.type === "WEB_INVOKE_APPSERVICE") {
     if (e.data.data.arg.type === "tokenExpired") {
-      return uni.redirectTo({
+      return uni.reLaunch({
         url: "/pages/login/index",
       });
     }
diff --git a/src/pages/user/index.vue b/src/pages/user/index.vue
index 45a56c0..74cdcf8 100644
--- a/src/pages/user/index.vue
+++ b/src/pages/user/index.vue
@@ -71,7 +71,7 @@
 
   function logOut() {
     userStore.setUserInfo(null)
-    uni.redirectTo({
+    uni.reLaunch({
       url: '/pages/login/index'
     })
   }
diff --git a/src/subPackages/userDetail/password/index.vue b/src/subPackages/userDetail/password/index.vue
index 2f9543e..ea627e3 100644
--- a/src/subPackages/userDetail/password/index.vue
+++ b/src/subPackages/userDetail/password/index.vue
@@ -13,7 +13,7 @@
 					<div class="rowTitle">新密码</div>
 					<u-input input-align="right" v-model="passwordForm.newPassword" placeholder="请输入"
 						class="input-item" />
-				
+
 				</div>
 				<div class="orderRow">
 					<div class="rowTitle">确认密码</div>
@@ -53,7 +53,7 @@
 	const validatePasswordNoChinese = (password) => {
 	  const chineseRegex = /[\u4e00-\u9fa5]/;
 	  if (chineseRegex.test(password)) {
-	  
+
 		uni.showToast({
 			title: '密码不能包含中文字符',
 			icon: 'none',
@@ -66,7 +66,7 @@
 	// 校验密码复杂度(长度≥6位,包含字母和数字)
 	const validatePasswordStrength = (password) => {
 	  if (password.length < 6) {
-	 
+
 		uni.showToast({
 			title: '密码长度不能少于6位',
 			icon: 'none',
@@ -95,7 +95,7 @@
 	const submit = () => {
 // 原始密码校验
     if (!passwordForm.value.oldPassword) {
-   
+
 	  uni.showToast({
 	  	title: '请输入原始密码',
 	  	icon: 'none',
@@ -107,7 +107,7 @@
     if (!validatePasswordNoChinese(passwordForm.value.newPassword)) return;
     // 新密码校验
     if (!passwordForm.value.newPassword) {
- 
+
 	  uni.showToast({
 	  	title: '请输入新密码',
 	  	icon: 'none',
@@ -125,7 +125,7 @@
 	  });
       return;
     }
-   
+
     // 复杂度校验
     if (!validatePasswordStrength(passwordForm.value.newPassword)) return;
 		updatePassword(md5(passwordForm.value.oldPassword),
@@ -139,7 +139,7 @@
 				});
 				clearForm();
 				userStore.setUserInfo(null)
-				uni.redirectTo({
+				uni.reLaunch({
 					url: '/pages/login/index'
 				})
 
@@ -186,7 +186,7 @@
 		height: 96rpx;
 		border-bottom: 2rpx solid #f5f5f5;
 		color: #7b7b7b;
-		
+
 
 			.rowTitle {
 				font-family: Source Han Sans CN, Source Han Sans CN;
@@ -219,9 +219,9 @@
 	.u-button:first-child{
 		margin-right: 30rpx;
 	}
-	
+
 	.custom-style {
 		width: 276rpx;
 		height: 76rpx;
 	}
-</style>
\ No newline at end of file
+</style>
diff --git a/src/utils/request/interceptors.js b/src/utils/request/interceptors.js
index 3c906f0..3c889ae 100644
--- a/src/utils/request/interceptors.js
+++ b/src/utils/request/interceptors.js
@@ -82,7 +82,7 @@
     if (response.statusCode === 401) {
       const pages = getCurrentPages()
       const currentPage = pages[pages.length - 1]
-      uni.redirectTo({
+      uni.reLaunch({
         url: `/pages/login/index?redirect=/${currentPage.route}`
       })
     }

--
Gitblit v1.9.3