File tree Expand file tree Collapse file tree 4 files changed +30
-15
lines changed
react-web/src/main/frontend/src/services/login Expand file tree Collapse file tree 4 files changed +30
-15
lines changed Original file line number Diff line number Diff line change 6
6
<img src =" https://img.shields.io/badge/Spring%20Cloud-2020.0.5-blue " alt =" Downloads " />
7
7
<img src =" https://img.shields.io/badge/Spring%20Cloud%20Alibaba-2021.1-blue " alt =" Downloads " />
8
8
<img src =" https://img.shields.io/badge/Elasticsearch-7.x-brightgreen " alt =" Downloads " />
9
+ <img src =" https://img.shields.io/badge/Ant%20Design-pro-9cf " alt =" Downloads " />
9
10
<a target =" _blank " href =' https://gitee.com/zlt2000/microservices-platform ' >
10
11
<img src='https://gitee.com/zlt2000/microservices-platform/badge/star.svg' alt='star'/>
11
12
</a >
@@ -97,7 +98,8 @@ central-platform -- 父项目,公共依赖
97
98
│ ├─zlt - uaa -- spring-security认证中心[8000]
98
99
│ ├─zlt - register -- 注册中心Nacos[8848]
99
100
│ ├─zlt - web -- 前端一级工程
100
- │ │ ├─back - web -- 后台前端[8066]
101
+ │ │ ├─layui - web -- layui前端[8066]
102
+ │ │ ├─react - web -- react前端[8066]
101
103
│ ├─zlt - transaction -- 事务一级工程
102
104
│ │ ├─txlcn - tm -- tx-lcn事务管理器[7970]
103
105
│ ├─zlt - demo -- demo一级工程
Original file line number Diff line number Diff line change 15
15
<java .version>8</java .version>
16
16
<spring-cloud-alibaba-dependencies .version>2021.1</spring-cloud-alibaba-dependencies .version>
17
17
<spring-boot-dependencies .version>2.5.14</spring-boot-dependencies .version>
18
- <spring-cloud-dependencies .version>2020.0.5 </spring-cloud-dependencies .version>
18
+ <spring-cloud-dependencies .version>2020.0.6 </spring-cloud-dependencies .version>
19
19
<commons-collections4 .version>4.4</commons-collections4 .version>
20
20
<swagger .butler.version>2.0.1</swagger .butler.version>
21
21
<jjwt .version>0.9.1</jjwt .version>
Original file line number Diff line number Diff line change 33
33
#### 2.1.2. 方式二:静态服务器运行
34
34
把 ` layui-web\src\main\resources\static ` 下的内容复制到类似 ` Nginx ` 之类的静态服务器运行。
35
35
36
+ #### 2.1.3. 后端接口地址修改
37
+ 修改 ` layui-web\src\main\resources\static\module\apiUrl.js ` 中的地址。
38
+
36
39
  ;
37
40
### 2.2. react-web
38
41
** 以下 3 种运行方式,选一种运行即可。**
@@ -50,12 +53,33 @@ npm install
50
53
51
54
运行成功后,浏览器访问:http://localhost:8066
52
55
56
+ ##### 2.2.1.3. 后端接口地址修改
57
+ 修改 ` react-web\src\main\frontend\config\proxy.ts ` 中的地址。
58
+
53
59
  ;
54
60
#### 2.2.2. 方式二:静态服务器运行
61
+ ##### 2.2.2.1. 源码编译
55
62
运行 ` frontend\build.bat ` 文件或者执行 ` npm run build ` 命令进行编译。
56
63
57
64
编译成功后,把 ` react-web\src\main\frontend\dist ` 下的内容复制到类似 ` Nginx ` 之类的静态服务器运行。
58
65
66
+ ##### 2.2.2.2. 后端接口地址修改
67
+ 通过反向代理,例如 ` Nginx ` 的配置如下:
68
+ ``` json
69
+ location ~ ^/api-* {
70
+ proxy_set_header X-Real-IP $remote_addr;
71
+ proxy_set_header X-Real-Port $remote_port;
72
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
73
+ proxy_pass http://127.0.0.1:9900;
74
+ }
75
+
76
+ location / {
77
+ root /usr/share/nginx/html;
78
+ index index.html;
79
+ expires 7d;
80
+ }
81
+ ```
82
+
59
83
  ;
60
84
#### 2.2.3. 方式三:使用Java运行
61
85
模块已集成Maven插件` frontend-maven-plugin ` 用于编译前端代码
@@ -71,17 +95,6 @@ java -jar zlt-web-5.4.0.jar
71
95
或者直接在IDE中运行 ` react-web\src\main\java\ui\ReactUiBootApplication.java `
72
96
> 运行前必需先使用 maven 对 react-web 工程进行编译或打包。
73
97
74
-   ;
75
- ## 三、后端接口地址修改
76
- 两个前端默认请求的后端接口地址默认都是:http://127.0.0.1:9900/
77
-
78
- ### 3.1. layui-web
79
- 修改 ` layui-web\src\main\resources\static\module\apiUrl.js ` 中的地址。
80
-
81
-   ;
82
- ### 3.2. react-web
83
- 修改 ` react-web\src\main\frontend\config\proxy.ts ` 中的地址。
84
-
85
98
  ;
86
99
## 四、More
87
100
开发参考
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ export async function fetchMenuData(options?: { [key: string]: any }) {
26
26
27
27
/** 退出登录接口 POST /api/login/outLogin */
28
28
export async function outLogin ( options ?: { [ key : string ] : any } ) {
29
- return request < Record < string , any > > ( '/api/login/outLogin ' , {
30
- method : 'POST ' ,
29
+ return request < Record < string , any > > ( '/api-uaa/oauth/remove/token ' , {
30
+ method : 'GET ' ,
31
31
...( options || { } ) ,
32
32
} ) ;
33
33
}
You can’t perform that action at this time.
0 commit comments