diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 498f3bc3..940a2224 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,6 +1,6 @@
# 变更记录(CHANGELOG)
-> 状态:有效(持续追加) · 更新:2026-11-30 · 版本:v3.17
+> 状态:有效(持续追加) · 更新:2026-12-01 · 版本:v3.18
对现状仍有影响的功能与修复记录,按日期倒序。改造、迁移、优化等一次性过程不在此记录。
@@ -8,6 +8,16 @@
**记录规则**:每条写“范围、变更、影响、回滚、关联”五项;回滚优先 `git revert <提交>`,提交含多项改动时按文件还原(`git checkout <提交>^ -- <文件>`),不整仓 reset。本文不作为规则依据。
+## 2026-12-01
+
+### 修复个人登录回跳旧版用户中心地址
+
+- **范围** 个人登录回跳、旧版用户中心入口与个人设置。
+- **变更** 第三方账号绑定成功或回调缺少授权码时统一返回 `/user/center`,由该入口在登录后进入用户中心首个可见页面。`/console/personal` 保留为旧个人设置链接,登录后转到 `/user-center/settings`。旧链接跳转保留查询参数和片段标识。
+- **影响** 个人账号可从旧链接进入用户中心,页面可见性继续由用户中心配置决定,控制台管理页面继续使用原有权限守卫。
+- **回滚** 按差异还原 `src/App.jsx`、`src/pages/UserCenter/index.jsx`、`src/components/auth/OAuth2Callback.jsx` 和本条目。
+- **关联** `docs/ui/USER_CENTER_SPEC.md` 第 1 节。
+
## 2026-11-30
### 权限重构验收手册移除 E2、T 账号验收项
diff --git a/src/App.jsx b/src/App.jsx
index b47e3d6f..0b3709ed 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -6,12 +6,7 @@ import {
} from './helpers/miniProgram';
import Loading from './components/common/ui/Loading';
import { CenterRouteLoading } from './components/layout/components/CenterSidebarLoading';
-import {
- AuthRedirect,
- PrivateRoute,
- AdminRoute,
- RootRoute,
-} from './helpers/auth';
+import { AuthRedirect, PrivateRoute, RootRoute } from './helpers/auth';
import { PermRoute, ConsoleRoute, ConsoleIndexRoute } from './authz';
import NotFound from './pages/NotFound';
import Forbidden from './pages/Forbidden';
@@ -76,9 +71,6 @@ const Task = lazy(() => import('./pages/Task'));
const ModelPage = lazy(() => import('./pages/Model'));
const Playground = lazy(() => import('./pages/Playground'));
const MonitorCenter = lazy(() => import('./pages/MonitorCenter'));
-const PersonalSetting = lazy(
- () => import('./components/settings/PersonalSetting'),
-);
const Setup = lazy(() => import('./pages/Setup'));
const Analytics = lazy(() => import('./pages/Analytics'));
const SmartRouter = lazy(() => import('./pages/SmartRouter'));
@@ -145,20 +137,10 @@ const PricingLegacyRedirect = () => {
);
};
-// 密钥管理旧路径 /key-management → /user-center/key-management,同样保留 query/hash
-// (如创作台 ?from=creation_studio 埋点来源、旧书签与登录回跳带参)
-const KeyManagementLegacyRedirect = () => {
- const location = useLocation();
- return (
-
- );
+// 用户中心旧地址保留登录回跳、分享链接及书签中的参数。
+const UserCenterLegacyRedirect = ({ to }) => {
+ const { search, hash } = useLocation();
+ return ;
};
function App() {
@@ -726,16 +708,6 @@ function App() {
}
/>
-
- } key={location.pathname}>
-
-
-
- }
- />
- {/* 密钥管理归入用户中心路径;旧地址保留为重定向(旧链接、登录回跳、书签) */}
+
+
+
+ }
+ />
+
+
+
+ }
+ />
}
+ element={
+
+ }
/>
{
if (message === 'bind') {
showSuccess(t('绑定成功!'));
- navigate('/console/personal');
+ navigate('/user/center', { replace: true });
return;
}
@@ -74,7 +74,7 @@ const OAuth2Callback = (props) => {
// 参数缺失直接返回
if (!code) {
showError(t('未获取到授权码'));
- navigate('/console/personal');
+ navigate('/user/center', { replace: true });
return;
}
diff --git a/src/pages/UserCenter/index.jsx b/src/pages/UserCenter/index.jsx
index 35df645f..b5e10469 100644
--- a/src/pages/UserCenter/index.jsx
+++ b/src/pages/UserCenter/index.jsx
@@ -137,8 +137,9 @@ const UserCenter = ({ keyManagementMode = false }) => {
userGroup,
firstRoute,
} = useUserCenterRoutes();
+ const { pathname, search, hash } = useLocation();
// 仅用于页面外壳的样式标识(看板与子页面底色不同),不参与路由判断
- const ucRoute = useLocation().pathname.split('/')[2] || 'dashboard';
+ const ucRoute = pathname.split('/')[2] || 'dashboard';
// 跑马灯公告是否存在(用于动态计算顶部间距)
const { visible: hasMarquee } = useMarquee();
@@ -177,7 +178,12 @@ const UserCenter = ({ keyManagementMode = false }) => {
}
+ element={
+
+ }
/>
({ pathname: '/user-center/service-dashboard' }),
+ useLocation: () => location,
useNavigate: () => () => {},
},
'react-i18next': { useTranslation: () => ({ t: (value) => value }) },
@@ -151,6 +152,11 @@ for (const [name, userCenter, group, visible] of [
}
test('service dashboard can be the only enabled default route without a redirect loop', () => {
+ location = {
+ pathname: '/user-center',
+ search: '?from=bookmark',
+ hash: '#top',
+ };
config = JSON.stringify({
userCenter: {
...Object.fromEntries(
@@ -164,7 +170,14 @@ test('service dashboard can be the only enabled default route without a redirect
});
const nodes = descendants(UserCenter({}));
const route = nodes.find((node) => node.props.path === '/');
- assert.equal(route.props.element.props.to, '/user-center/service-dashboard');
+ assert.deepEqual(
+ { ...route.props.element.props.to },
+ {
+ pathname: '/user-center/service-dashboard',
+ search: location.search,
+ hash: location.hash,
+ },
+ );
const service = nodes.find((node) => node.props.path === 'service-dashboard');
assert.ok(
descendants(service.props.element).some(