From 0e1801e129d7620d2fd9f8cfb45ac6a9ec0244ba Mon Sep 17 00:00:00 2001 From: zhult13 Date: Thu, 10 Nov 2022 16:03:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=87=BA=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++- pom.xml | 2 +- zlt-web/README.md | 35 +++++++++++++------ .../main/frontend/src/services/login/api.ts | 4 +-- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3d1d61d8..8c1ec546 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Downloads Downloads Downloads + Downloads star @@ -97,7 +98,8 @@ central-platform -- 父项目,公共依赖 │ ├─zlt-uaa -- spring-security认证中心[8000] │ ├─zlt-register -- 注册中心Nacos[8848] │ ├─zlt-web -- 前端一级工程 -│ │ ├─back-web -- 后台前端[8066] +│ │ ├─layui-web -- layui前端[8066] +│ │ ├─react-web -- react前端[8066] │ ├─zlt-transaction -- 事务一级工程 │ │ ├─txlcn-tm -- tx-lcn事务管理器[7970] │ ├─zlt-demo -- demo一级工程 diff --git a/pom.xml b/pom.xml index ea7e5e73..a52c79e5 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ 8 2021.1 2.5.14 - 2020.0.5 + 2020.0.6 4.4 2.0.1 0.9.1 diff --git a/zlt-web/README.md b/zlt-web/README.md index 99690b27..481bd3aa 100644 --- a/zlt-web/README.md +++ b/zlt-web/README.md @@ -33,6 +33,9 @@ #### 2.1.2. 方式二:静态服务器运行 把 `layui-web\src\main\resources\static` 下的内容复制到类似 `Nginx` 之类的静态服务器运行。 +#### 2.1.3. 后端接口地址修改 +修改 `layui-web\src\main\resources\static\module\apiUrl.js` 中的地址。 +   ### 2.2. react-web **以下 3 种运行方式,选一种运行即可。** @@ -50,12 +53,33 @@ npm install 运行成功后,浏览器访问:http://localhost:8066 +##### 2.2.1.3. 后端接口地址修改 +修改 `react-web\src\main\frontend\config\proxy.ts` 中的地址。 +   #### 2.2.2. 方式二:静态服务器运行 +##### 2.2.2.1. 源码编译 运行 `frontend\build.bat` 文件或者执行 `npm run build` 命令进行编译。 编译成功后,把 `react-web\src\main\frontend\dist` 下的内容复制到类似 `Nginx` 之类的静态服务器运行。 +##### 2.2.2.2. 后端接口地址修改 +通过反向代理,例如 `Nginx` 的配置如下: +```json +location ~ ^/api-* { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Real-Port $remote_port; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://127.0.0.1:9900; +} + +location / { + root /usr/share/nginx/html; + index index.html; + expires 7d; +} +``` +   #### 2.2.3. 方式三:使用Java运行 模块已集成Maven插件`frontend-maven-plugin`用于编译前端代码 @@ -71,17 +95,6 @@ java -jar zlt-web-5.4.0.jar 或者直接在IDE中运行 `react-web\src\main\java\ui\ReactUiBootApplication.java` > 运行前必需先使用 maven 对 react-web 工程进行编译或打包。 -  -## 三、后端接口地址修改 -两个前端默认请求的后端接口地址默认都是:http://127.0.0.1:9900/ - -### 3.1. layui-web -修改 `layui-web\src\main\resources\static\module\apiUrl.js` 中的地址。 - -  -### 3.2. react-web -修改 `react-web\src\main\frontend\config\proxy.ts` 中的地址。 -   ## 四、More 开发参考 diff --git a/zlt-web/react-web/src/main/frontend/src/services/login/api.ts b/zlt-web/react-web/src/main/frontend/src/services/login/api.ts index b100a191..139b020e 100644 --- a/zlt-web/react-web/src/main/frontend/src/services/login/api.ts +++ b/zlt-web/react-web/src/main/frontend/src/services/login/api.ts @@ -26,8 +26,8 @@ export async function fetchMenuData(options?: { [key: string]: any }) { /** 退出登录接口 POST /api/login/outLogin */ export async function outLogin(options?: { [key: string]: any }) { - return request>('/api/login/outLogin', { - method: 'POST', + return request>('/api-uaa/oauth/remove/token', { + method: 'GET', ...(options || {}), }); }