端口修改
This commit is contained in:
@@ -55,17 +55,17 @@ pnpm build
|
||||
```nginx
|
||||
# Platform 主应用(单点登录入口)
|
||||
location / {
|
||||
proxy_pass http://localhost:5001/;
|
||||
proxy_pass http://localhost:7001/;
|
||||
}
|
||||
|
||||
# Workcase 工单服务
|
||||
location /workcase/ {
|
||||
proxy_pass http://localhost:5003/;
|
||||
proxy_pass http://localhost:7003/;
|
||||
}
|
||||
|
||||
# Bidding 招标服务
|
||||
location /bidding/ {
|
||||
proxy_pass http://localhost:5002/;
|
||||
proxy_pass http://localhost:7002/;
|
||||
}
|
||||
|
||||
# 后端 API 统一入口
|
||||
@@ -221,12 +221,12 @@ addDynamicRoutes(workcaseViews)
|
||||
- 修改 `devConfig.sso` 为绝对URL
|
||||
```typescript
|
||||
sso: {
|
||||
platformUrl: 'http://localhost:5001',
|
||||
workcaseUrl: 'http://localhost:5003',
|
||||
biddingUrl: 'http://localhost:5002'
|
||||
platformUrl: 'http://localhost:7001',
|
||||
workcaseUrl: 'http://localhost:7003',
|
||||
biddingUrl: 'http://localhost:7002'
|
||||
}
|
||||
```
|
||||
- 直接访问 http://localhost:5001, http://localhost:5003
|
||||
- 直接访问 http://localhost:7001, http://localhost:7003
|
||||
|
||||
## 常见问题
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ pnpm run dev
|
||||
# 方式3: 手动启动(需要两个终端)
|
||||
# 终端1 - 启动 shared
|
||||
cd packages/shared
|
||||
pnpm run dev # http://localhost:5000
|
||||
pnpm run dev # http://localhost:7000
|
||||
|
||||
# 终端2 - 启动 platform
|
||||
cd packages/platform
|
||||
pnpm run dev # http://localhost:5001
|
||||
pnpm run dev # http://localhost:7001
|
||||
```
|
||||
|
||||
### 3. 构建生产版本
|
||||
@@ -110,7 +110,7 @@ export default defineConfig({
|
||||
})
|
||||
],
|
||||
server: {
|
||||
port: 5000,
|
||||
port: 7000,
|
||||
strictPort: true, // 关键:锁定端口,避免漂移
|
||||
host: true,
|
||||
cors: true
|
||||
@@ -131,7 +131,7 @@ export default defineConfig({
|
||||
shared: {
|
||||
type: 'module', // 关键:必须指定 ES module 类型
|
||||
name: 'shared',
|
||||
entry: 'http://localhost:5000/remoteEntry.js'
|
||||
entry: 'http://localhost:7000/remoteEntry.js'
|
||||
}
|
||||
},
|
||||
shared: {
|
||||
@@ -230,4 +230,4 @@ const result = await authAPI.login(params)
|
||||
2. **启动顺序**: 必须先启动 `shared` 服务(5000端口),再启动其他应用
|
||||
3. **端口占用**: 确保 5000-5003 端口未被占用,shared 使用 strictPort 模式
|
||||
4. **Node 版本**: 建议使用 Node.js 18+
|
||||
5. **Module Federation**: remoteEntry.js 路径为 `http://localhost:5000/remoteEntry.js`(不是 /assets/)
|
||||
5. **Module Federation**: remoteEntry.js 路径为 `http://localhost:7000/remoteEntry.js`(不是 /assets/)
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"@shared/components": "http://localhost:5000/shared/components.js",
|
||||
"@shared/utils": "http://localhost:5000/shared/utils.js",
|
||||
"@shared/api": "http://localhost:5000/shared/api.js",
|
||||
"@shared/composables": "http://localhost:5000/shared/composables.js",
|
||||
"@shared/types": "http://localhost:5000/shared/types.js"
|
||||
"@shared/components": "http://localhost:7000/shared/components.js",
|
||||
"@shared/utils": "http://localhost:7000/shared/utils.js",
|
||||
"@shared/api": "http://localhost:7000/shared/api.js",
|
||||
"@shared/composables": "http://localhost:7000/shared/composables.js",
|
||||
"@shared/types": "http://localhost:7000/shared/types.js"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- 预加载关键模块 -->
|
||||
<link rel="modulepreload" href="http://localhost:5000/shared/components.js">
|
||||
<link rel="modulepreload" href="http://localhost:5000/shared/utils.js">
|
||||
<link rel="modulepreload" href="http://localhost:7000/shared/components.js">
|
||||
<link rel="modulepreload" href="http://localhost:7000/shared/utils.js">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -34,7 +34,7 @@ export default defineConfig(({ mode }) => ({
|
||||
},
|
||||
|
||||
server: {
|
||||
port: 5002,
|
||||
port: 7002,
|
||||
host: true,
|
||||
cors: true,
|
||||
open: '/bidding/', // 开发时自动打开到 /bidding/ 路径
|
||||
@@ -46,7 +46,7 @@ export default defineConfig(({ mode }) => ({
|
||||
},
|
||||
// 代理共享模块请求到 shared 服务
|
||||
'/shared': {
|
||||
target: 'http://localhost:5000',
|
||||
target: 'http://localhost:7000',
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite --port 5001 --host",
|
||||
"dev": "vite --host",
|
||||
"build": "vue-tsc && vite build",
|
||||
"preview": "vite preview --port 5001"
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.5.13",
|
||||
|
||||
@@ -25,14 +25,14 @@ const menuItems: MenuItem[] = [
|
||||
key: 'bidding',
|
||||
label: '招标助手',
|
||||
icon: 'Document',
|
||||
iframeUrl: 'http://localhost:5002',
|
||||
iframeUrl: 'http://localhost:7002',
|
||||
type: 'iframe'
|
||||
},
|
||||
{
|
||||
key: 'service',
|
||||
label: '泰豪小电',
|
||||
icon: 'Service',
|
||||
iframeUrl: 'http://localhost:5003',
|
||||
iframeUrl: 'http://localhost:7003',
|
||||
type: 'iframe'
|
||||
},
|
||||
{
|
||||
@@ -100,12 +100,12 @@ interface MenuItem {
|
||||
|
||||
### 1. 招标助手 (Bidding)
|
||||
- **端口**:5002
|
||||
- **URL**:http://localhost:5002
|
||||
- **URL**:http://localhost:7002
|
||||
- **说明**:招投标业务管理系统
|
||||
|
||||
### 2. 泰豪小电 (Service)
|
||||
- **端口**:5003
|
||||
- **URL**:http://localhost:5003
|
||||
- **URL**:http://localhost:7003
|
||||
- **说明**:智能客服工单管理系统
|
||||
|
||||
### 3. 智能体编排 (Workflow)
|
||||
@@ -165,7 +165,7 @@ interface MenuItem {
|
||||
# nginx 配置
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
# 或者
|
||||
add_header Content-Security-Policy "frame-ancestors 'self' http://localhost:5001";
|
||||
add_header Content-Security-Policy "frame-ancestors 'self' http://localhost:7001";
|
||||
```
|
||||
|
||||
2. **端口配置**:确保对应服务已启动
|
||||
@@ -188,7 +188,7 @@ interface MenuItem {
|
||||
key: 'new-app',
|
||||
label: '新应用',
|
||||
icon: 'Plus',
|
||||
iframeUrl: 'http://localhost:5004',
|
||||
iframeUrl: 'http://localhost:7004',
|
||||
type: 'iframe'
|
||||
}
|
||||
```
|
||||
|
||||
@@ -25,14 +25,14 @@ const menuItems: MenuItem[] = [
|
||||
key: 'bidding',
|
||||
label: '招标助手',
|
||||
icon: 'Document',
|
||||
iframeUrl: 'http://localhost:5002',
|
||||
iframeUrl: 'http://localhost:7002',
|
||||
type: 'iframe'
|
||||
},
|
||||
{
|
||||
key: 'service',
|
||||
label: '泰豪小电',
|
||||
icon: 'Service',
|
||||
iframeUrl: 'http://localhost:5003',
|
||||
iframeUrl: 'http://localhost:7003',
|
||||
type: 'iframe'
|
||||
},
|
||||
{
|
||||
@@ -100,12 +100,12 @@ interface MenuItem {
|
||||
|
||||
### 1. 招标助手 (Bidding)
|
||||
- **端口**:5002
|
||||
- **URL**:http://localhost:5002
|
||||
- **URL**:http://localhost:7002
|
||||
- **说明**:招投标业务管理系统
|
||||
|
||||
### 2. 泰豪小电 (Service)
|
||||
- **端口**:5003
|
||||
- **URL**:http://localhost:5003
|
||||
- **URL**:http://localhost:7003
|
||||
- **说明**:智能客服工单管理系统
|
||||
|
||||
### 3. 智能体编排 (Workflow)
|
||||
@@ -165,7 +165,7 @@ interface MenuItem {
|
||||
# nginx 配置
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
# 或者
|
||||
add_header Content-Security-Policy "frame-ancestors 'self' http://localhost:5001";
|
||||
add_header Content-Security-Policy "frame-ancestors 'self' http://localhost:7001";
|
||||
```
|
||||
|
||||
2. **端口配置**:确保对应服务已启动
|
||||
@@ -188,7 +188,7 @@ interface MenuItem {
|
||||
key: 'new-app',
|
||||
label: '新应用',
|
||||
icon: 'Plus',
|
||||
iframeUrl: 'http://localhost:5004',
|
||||
iframeUrl: 'http://localhost:7004',
|
||||
type: 'iframe'
|
||||
}
|
||||
```
|
||||
|
||||
@@ -26,7 +26,7 @@ export default defineConfig({
|
||||
shared: {
|
||||
type: 'module',
|
||||
name: 'shared',
|
||||
entry: 'http://localhost:5000/remoteEntry.js'
|
||||
entry: 'http://localhost:7000/remoteEntry.js'
|
||||
}
|
||||
},
|
||||
shared: {
|
||||
@@ -51,7 +51,7 @@ export default defineConfig({
|
||||
},
|
||||
|
||||
server: {
|
||||
port: 5001,
|
||||
port: 7001,
|
||||
host: true,
|
||||
cors: true,
|
||||
open: '/', // 开发时自动打开到根路径
|
||||
|
||||
@@ -100,7 +100,7 @@ const devConfig: AppRuntimeConfig = {
|
||||
|
||||
// 单点登录配置
|
||||
// 推荐:开发环境也通过nginx访问(http://localhost)
|
||||
// 备选:直接访问各服务端口(platformUrl: 'http://localhost:5001')
|
||||
// 备选:直接访问各服务端口(platformUrl: 'http://localhost:7001')
|
||||
sso: {
|
||||
platformUrl: '/', // 通过nginx访问platform
|
||||
workcaseUrl: '/workcase', // 通过nginx访问workcase
|
||||
|
||||
@@ -100,7 +100,7 @@ export default defineConfig({
|
||||
},
|
||||
|
||||
server: {
|
||||
port: 5000,
|
||||
port: 7000,
|
||||
strictPort: true,
|
||||
host: true,
|
||||
cors: true,
|
||||
@@ -112,7 +112,7 @@ export default defineConfig({
|
||||
},
|
||||
|
||||
preview: {
|
||||
port: 5000,
|
||||
port: 7000,
|
||||
host: true,
|
||||
cors: true,
|
||||
headers: {
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
entryGlobalName: "shared",
|
||||
name: "shared",
|
||||
type: "module",
|
||||
entry: "http://localhost:5000/remoteEntry.js",
|
||||
entry: "http://localhost:7000/remoteEntry.js",
|
||||
shareScope: "default",
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite --port 5003 --host",
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc && vite build",
|
||||
"preview": "vite preview --port 5003"
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.5.13",
|
||||
|
||||
@@ -19,7 +19,7 @@ export const API_BASE_URL = (import.meta as any).env?.VITE_API_BASE_URL || '/api
|
||||
* Platform URL(单点登录入口)
|
||||
* 开发环境:
|
||||
* - 通过nginx访问时使用 '/'(推荐)
|
||||
* - 直接访问各服务时使用 'http://localhost:5001'
|
||||
* - 直接访问各服务时使用 'http://localhost:7001'
|
||||
* 生产环境:统一使用 '/'
|
||||
*/
|
||||
export const PLATFORM_URL = (import.meta as any).env?.VITE_PLATFORM_URL || '/'
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
const goToMainSystem = () => {
|
||||
window.location.href = 'http://localhost:5002'
|
||||
window.location.href = 'http://localhost:7002'
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export default defineConfig(({ mode }) => ({
|
||||
shared: {
|
||||
type: 'module',
|
||||
name: 'shared',
|
||||
entry: 'http://localhost:5000/remoteEntry.js'
|
||||
entry: 'http://localhost:7000/remoteEntry.js'
|
||||
}
|
||||
},
|
||||
shared: {
|
||||
@@ -51,7 +51,7 @@ export default defineConfig(({ mode }) => ({
|
||||
},
|
||||
|
||||
server: {
|
||||
port: 5003,
|
||||
port: 7003,
|
||||
host: true,
|
||||
cors: true,
|
||||
open: '/workcase/', // 开发时自动打开到 /workcase/ 路径
|
||||
@@ -63,7 +63,7 @@ export default defineConfig(({ mode }) => ({
|
||||
},
|
||||
// 代理共享模块请求到 shared 服务
|
||||
'/shared': {
|
||||
target: 'http://localhost:5000',
|
||||
target: 'http://localhost:7000',
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ echo Urban Lifeline Web - 启动所有服务
|
||||
echo ====================================
|
||||
echo.
|
||||
echo 端口分配:
|
||||
echo Shared: http://localhost:5000
|
||||
echo Platform: http://localhost:5001
|
||||
echo Bidding: http://localhost:5002
|
||||
echo Workcase: http://localhost:5003
|
||||
echo Shared: http://localhost:7000
|
||||
echo Platform: http://localhost:7001
|
||||
echo Bidding: http://localhost:7002
|
||||
echo Workcase: http://localhost:7003
|
||||
echo.
|
||||
echo 按 Ctrl+C 停止所有服务
|
||||
echo ====================================
|
||||
|
||||
Reference in New Issue
Block a user