remove: 移除前端服务状态检测和前端服务端口配置功能
This commit is contained in:
@@ -16,7 +16,6 @@ const initDefaultSettings = async () => {
|
|||||||
{ settingKey: 'session_timeout', settingValue: JSON.stringify(30), settingType: 'number', category: 'general', description: '会话超时时间(分钟)', isEditable: true },
|
{ settingKey: 'session_timeout', settingValue: JSON.stringify(30), settingType: 'number', category: 'general', description: '会话超时时间(分钟)', isEditable: true },
|
||||||
{ settingKey: 'max_login_attempts', settingValue: JSON.stringify(5), settingType: 'number', category: 'general', description: '最大登录尝试次数', isEditable: true },
|
{ settingKey: 'max_login_attempts', settingValue: JSON.stringify(5), settingType: 'number', category: 'general', description: '最大登录尝试次数', isEditable: true },
|
||||||
{ settingKey: 'maintenance_mode', settingValue: JSON.stringify(false), settingType: 'boolean', category: 'general', description: '维护模式', isEditable: true },
|
{ settingKey: 'maintenance_mode', settingValue: JSON.stringify(false), settingType: 'boolean', category: 'general', description: '维护模式', isEditable: true },
|
||||||
{ settingKey: 'frontend_port', settingValue: JSON.stringify(3000), settingType: 'number', category: 'general', description: '前端服务端口(修改后需重启前端服务)', isEditable: true },
|
|
||||||
|
|
||||||
// 外观设置
|
// 外观设置
|
||||||
{ settingKey: 'primary_color', settingValue: JSON.stringify('#667eea'), settingType: 'string', category: 'appearance', description: '主题主色调', isEditable: true },
|
{ settingKey: 'primary_color', settingValue: JSON.stringify('#667eea'), settingType: 'string', category: 'appearance', description: '主题主色调', isEditable: true },
|
||||||
@@ -595,16 +594,5 @@ router.post('/frontend/restart', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取前端服务状态
|
|
||||||
router.get('/frontend/status', async (req, res) => {
|
|
||||||
try {
|
|
||||||
const { getStatus } = require('../../scripts/frontend-manager');
|
|
||||||
const status = await getStatus();
|
|
||||||
res.json(status);
|
|
||||||
} catch (error) {
|
|
||||||
res.status(500).json({ error: error.message });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
module.exports.initDefaultSettings = initDefaultSettings;
|
module.exports.initDefaultSettings = initDefaultSettings;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ const defaultSettings = [
|
|||||||
{ settingKey: 'session_timeout', settingValue: JSON.stringify(30), settingType: 'number', category: 'general', description: '会话超时时间(分钟)', isEditable: true },
|
{ settingKey: 'session_timeout', settingValue: JSON.stringify(30), settingType: 'number', category: 'general', description: '会话超时时间(分钟)', isEditable: true },
|
||||||
{ settingKey: 'max_login_attempts', settingValue: JSON.stringify(5), settingType: 'number', category: 'general', description: '最大登录尝试次数', isEditable: true },
|
{ settingKey: 'max_login_attempts', settingValue: JSON.stringify(5), settingType: 'number', category: 'general', description: '最大登录尝试次数', isEditable: true },
|
||||||
{ settingKey: 'maintenance_mode', settingValue: JSON.stringify(false), settingType: 'boolean', category: 'general', description: '维护模式', isEditable: true },
|
{ settingKey: 'maintenance_mode', settingValue: JSON.stringify(false), settingType: 'boolean', category: 'general', description: '维护模式', isEditable: true },
|
||||||
{ settingKey: 'frontend_port', settingValue: JSON.stringify(3000), settingType: 'number', category: 'general', description: '前端服务端口(修改后需重启前端服务)', isEditable: true },
|
|
||||||
|
|
||||||
// 外观设置
|
// 外观设置
|
||||||
{ settingKey: 'primary_color', settingValue: JSON.stringify('#667eea'), settingType: 'string', category: 'appearance', description: '主题主色调', isEditable: true },
|
{ settingKey: 'primary_color', settingValue: JSON.stringify('#667eea'), settingType: 'string', category: 'appearance', description: '主题主色调', isEditable: true },
|
||||||
|
|||||||
@@ -13,25 +13,14 @@ const SystemSettings = () => {
|
|||||||
const [settings, setSettings] = useState({});
|
const [settings, setSettings] = useState({});
|
||||||
const [activeTab, setActiveTab] = useState('general');
|
const [activeTab, setActiveTab] = useState('general');
|
||||||
const [systemInfo, setSystemInfo] = useState(null);
|
const [systemInfo, setSystemInfo] = useState(null);
|
||||||
const [frontendStatus, setFrontendStatus] = useState(null);
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const { reloadConfig } = useConfig();
|
const { reloadConfig } = useConfig();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchSettings();
|
fetchSettings();
|
||||||
fetchSystemInfo();
|
fetchSystemInfo();
|
||||||
fetchFrontendStatus();
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const fetchFrontendStatus = async () => {
|
|
||||||
try {
|
|
||||||
const response = await axios.get('/api/system-settings/frontend/status');
|
|
||||||
setFrontendStatus(response.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取前端服务状态失败:', error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchSettings = async () => {
|
const fetchSettings = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
@@ -340,28 +329,9 @@ const SystemSettings = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const renderGeneralSettings = () => {
|
const renderGeneralSettings = () => {
|
||||||
const generalKeys = ['site_name', 'site_logo', 'timezone', 'date_format', 'session_timeout', 'max_login_attempts', 'maintenance_mode', 'frontend_port'];
|
const generalKeys = ['site_name', 'site_logo', 'timezone', 'date_format', 'session_timeout', 'max_login_attempts', 'maintenance_mode'];
|
||||||
return (
|
return (
|
||||||
<Card title="全局配置" bordered={false}>
|
<Card title="全局配置" bordered={false}>
|
||||||
{frontendStatus && (
|
|
||||||
<Alert
|
|
||||||
message={frontendStatus.isProduction ? "前端服务状态(生产环境)" : "前端服务状态(开发环境)"}
|
|
||||||
description={
|
|
||||||
<div>
|
|
||||||
<p>当前端口:<strong>{frontendStatus.port}</strong></p>
|
|
||||||
<p>运行状态:{frontendStatus.isRunning ? <Tag color="success">运行中</Tag> : <Tag color="error">未运行</Tag>}</p>
|
|
||||||
{frontendStatus.portInUse && <p style={{ color: '#ff4d4f' }}>警告:端口被其他程序占用</p>}
|
|
||||||
{frontendStatus.isProduction && (
|
|
||||||
<p style={{ color: '#1890ff' }}>提示:生产环境由 Nginx 或其他服务器托管,如需修改端口请更新服务器配置</p>
|
|
||||||
)}
|
|
||||||
<p>访问地址:<a href={frontendStatus.url} target="_blank" rel="noopener noreferrer">{frontendStatus.url}</a></p>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
type={frontendStatus.isRunning ? 'success' : 'warning'}
|
|
||||||
showIcon
|
|
||||||
style={{ marginBottom: 24 }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Form form={form} layout="vertical" onFinish={handleSaveSettings}>
|
<Form form={form} layout="vertical" onFinish={handleSaveSettings}>
|
||||||
{generalKeys.map(key => {
|
{generalKeys.map(key => {
|
||||||
// 确保时区和日期格式使用select类型
|
// 确保时区和日期格式使用select类型
|
||||||
|
|||||||
Reference in New Issue
Block a user