🎨 refactor(ui): modernize setup page

- Refactored system initialization page using TailwindCSS 3 and SemiUI components
- Changed layout from step navigation to single page display for all configurations
- Modified top area from vertical to more compact horizontal layout
- Updated gradient color scheme from blue/purple to orange/pink
- Fixed form field name duplication issues and optimized Form implementation
- Changed usage mode selection from three-column grid to vertical layout
- Replaced usage mode card icons from settings to more appropriate Layers icon
- Added specific prompts for different database types (SQLite/MySQL/PostgreSQL)
- Removed configuration summary section while keeping the initialization button
- Fixed useSetupCheck issue by using SetupCheck as a direct component for proper redirection
This commit is contained in:
Apple\Apple
2025-06-04 08:15:48 +08:00
parent 933327baf7
commit ce88b75f61
6 changed files with 474 additions and 183 deletions

View File

@@ -1,32 +0,0 @@
import { useContext, useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { StatusContext } from '../context/Status';
/**
* 自定义Hook检查系统setup状态并进行重定向
* @param {Object} options - 配置选项
* @param {boolean} options.autoRedirect - 是否自动重定向默认true
* @param {string} options.setupPath - setup页面路径默认'/setup'
* @returns {Object} 返回setup状态信息
*/
export function useSetupCheck(options = {}) {
const { autoRedirect = true, setupPath = '/setup' } = options;
const [statusState] = useContext(StatusContext);
const location = useLocation();
const isSetupComplete = statusState?.status?.setup !== false;
const needsSetup = !isSetupComplete && location.pathname !== setupPath;
useEffect(() => {
if (autoRedirect && needsSetup) {
window.location.href = setupPath;
}
}, [autoRedirect, needsSetup, setupPath]);
return {
isSetupComplete,
needsSetup,
statusState,
currentPath: location.pathname
};
}

View File

@@ -13,7 +13,7 @@ export function useTokenKeys(id) {
if (fetchedKeys.length === 0) {
showError('当前没有可用的启用令牌,请确认是否有令牌处于启用状态!');
setTimeout(() => {
window.location.href = '/token';
window.location.href = '/console/token';
}, 1500); // 延迟 1.5 秒后跳转
}
setKeys(fetchedKeys);