feat(login): 优化首次用户注册流程和表单处理
- 修复首次用户注册成功后未正确设置 isFirstUser 状态的问题 - 调整表单 name 和 onFinish 逻辑以区分首次用户注册和普通注册 - 更新按钮文本以明确不同场景下的操作 refactor(uninstall): 增强卸载脚本功能性和健壮性 - 新增 --dry-run 预览模式和 --skip-uploads 选项 - 改进 PM2 服务检测和清理逻辑 - 优化数据库配置读取和文件路径处理 - 增加更多清理项(Vite 缓存、临时文件等) - 完善错误处理和用户提示信息
This commit is contained in:
+27
-1
@@ -1618,7 +1618,13 @@ function generateNginxConfig() {
|
||||
}
|
||||
|
||||
const isWindows = process.platform === 'win32';
|
||||
const frontendPath = path.join(__dirname, 'frontend', 'dist').replace(/\\/g, '/');
|
||||
|
||||
let frontendPath;
|
||||
if (isWindows) {
|
||||
frontendPath = path.join(__dirname, 'frontend', 'dist').replace(/\\/g, '/');
|
||||
} else {
|
||||
frontendPath = '/var/www/idc';
|
||||
}
|
||||
|
||||
const nginxConfig = `# IDC设备管理系统 - Nginx配置
|
||||
# 生成时间: ${new Date().toISOString()}
|
||||
@@ -1720,6 +1726,26 @@ function autoConfigureNginx() {
|
||||
|
||||
const root = isRootUser();
|
||||
const sudoPrefix = root ? '' : 'sudo ';
|
||||
|
||||
// 复制前端构建产物到 /var/www/idc(Nginx 可访问的目录)
|
||||
const wwwDir = '/var/www/idc';
|
||||
const distDir = path.join(__dirname, 'frontend', 'dist');
|
||||
|
||||
if (fs.existsSync(distDir)) {
|
||||
log.info(`复制前端文件到 ${wwwDir}...`);
|
||||
runCommand(`${sudoPrefix}mkdir -p ${wwwDir}`, { silent: true });
|
||||
const copyResult = runCommand(`${sudoPrefix}cp -r ${distDir}/* ${wwwDir}/`, { silent: true });
|
||||
if (copyResult.success) {
|
||||
runCommand(`${sudoPrefix}chmod -R 755 ${wwwDir}`, { silent: true });
|
||||
log.success('前端文件部署完成');
|
||||
} else {
|
||||
log.warning('前端文件复制失败,Nginx 可能无法访问前端页面');
|
||||
}
|
||||
} else {
|
||||
log.warning(`前端构建产物不存在: ${distDir}`);
|
||||
log.info('请先完成前端构建后再配置 Nginx');
|
||||
}
|
||||
|
||||
const configSource = path.join(__dirname, 'deploy', 'nginx-idc.conf');
|
||||
|
||||
if (!fs.existsSync(configSource)) {
|
||||
|
||||
Reference in New Issue
Block a user