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