Files
DDCZ/启动服务器.sh
KQL b0d2e629d9 feat: 完善项目功能和部署脚本
- 修复页面跳转白屏闪烁问题
- 集成过渡岗位页面(岗位装配中心)
- 添加iframe全屏嵌入(教务系统、就业规划)
- 优化企业资源卡片hover分裂效果
- 添加Windows和macOS快捷部署脚本
- 更新.gitignore忽略测试文件和缓存

🤖 Generated with Claude Code
2025-12-04 16:03:31 +08:00

73 lines
1.8 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 设置脚本在遇到错误时不退出(允许自定义错误处理)
# set -e
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# 清屏
clear
echo ""
echo "${CYAN}========================================"
echo " 多多畅职大专生就业服务平台"
echo " 局域网服务器启动脚本 (macOS/Linux)"
echo "========================================${NC}"
echo ""
# 检查 Node.js 是否安装
if ! command -v node &> /dev/null; then
echo "${RED}[错误] 未检测到 Node.js${NC}"
echo ""
echo "请先安装 Node.js:"
echo "下载地址: ${BLUE}https://nodejs.org/${NC}"
echo ""
echo "或使用 Homebrew 安装:"
echo "${YELLOW}brew install node${NC}"
echo ""
exit 1
fi
# 显示 Node.js 版本
echo "${GREEN}[信息] 检测到 Node.js 版本:${NC}"
node --version
echo ""
# 检查 server.js 是否存在
if [ ! -f "server.js" ]; then
echo "${RED}[错误] 找不到 server.js 文件!${NC}"
echo "请确保在项目根目录运行此脚本。"
echo ""
echo "当前目录: ${YELLOW}$(pwd)${NC}"
echo ""
exit 1
fi
# 获取本机局域网IP
LOCAL_IP=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1)
echo "${GREEN}[启动] 正在启动局域网服务器...${NC}"
echo ""
echo "${CYAN}========================================"
echo "提示: 按 Ctrl+C 可停止服务器"
echo ""
echo "预计访问地址:"
echo "📍 本机: ${YELLOW}http://localhost:8080${NC}"
echo "📍 局域网: ${YELLOW}http://${LOCAL_IP}:8080${NC}"
echo "========================================${NC}"
echo ""
# 启动服务器
node server.js
# 如果服务器意外退出
echo ""
echo "${YELLOW}[提示] 服务器已停止运行${NC}"
echo ""