mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-02 15:50:54 +08:00
Compare commits
2 Commits
fc5779225e
...
c8c30ca2e1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8c30ca2e1 | ||
|
|
d8d1e25972 |
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
## 提示
|
## 提示
|
||||||
|
|
||||||
该仓库使用vben5开发,采用分包目录结构, 具体开发路径为: `根目录/apps/web-antd`
|
该仓库使用vben5开发,采用分包目录结构, 实际开发路径为: `根目录/apps/web-antd`
|
||||||
|
|
||||||
前端已同时兼容 **Furion 规范化 API 响应** 和 **ABP 风格响应**,可通过 `apps/web-antd/.env` 中的 `VITE_GLOB_API_STYLE` 配置响应风格:`auto`(默认)、`furion`、`abp`。
|
前端已同时兼容 **Furion 规范化 API 响应** 和 **ABP 风格响应**,可通过 `apps/web-antd/.env` 中的 `VITE_GLOB_API_STYLE` 配置响应风格:`auto`(默认)、`furion`、`abp`。
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
````json
|
````json
|
||||||
{
|
{
|
||||||
"statusCode": 200,
|
"statusCode": 200,
|
||||||
"data": {"name": "大橙子","age": 20},
|
"data": {"name": "du白","age": 20},
|
||||||
"succeeded": true,
|
"succeeded": true,
|
||||||
"errors": null,
|
"errors": null,
|
||||||
"extras": null,
|
"extras": null,
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
````json
|
````json
|
||||||
// 成功响应
|
// 成功响应
|
||||||
{ "name": "大橙子","age": 20}
|
{ "name": "du白","age": 20}
|
||||||
````
|
````
|
||||||
````json
|
````json
|
||||||
// 异常响应
|
// 异常响应
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
安装依赖
|
安装依赖
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd yiabp-mini
|
cd Yi.Vben5.Vue3
|
||||||
|
|
||||||
pnpm install
|
pnpm install
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -296,7 +296,8 @@ function createRequestClient(baseURL: string) {
|
|||||||
// ABP 风格:HTTP 200 即成功,直接返回数据
|
// ABP 风格:HTTP 200 即成功,直接返回数据
|
||||||
if (shouldUseAbpStyle(axiosResponseData)) {
|
if (shouldUseAbpStyle(axiosResponseData)) {
|
||||||
// 防御性检查:200 + { error } 仍视为错误
|
// 防御性检查:200 + { error } 仍视为错误
|
||||||
const abpError = axiosResponseData?.error;
|
const abpError = (axiosResponseData as { error?: { message?: string } })
|
||||||
|
?.error;
|
||||||
if (abpError && typeof abpError.message === 'string') {
|
if (abpError && typeof abpError.message === 'string') {
|
||||||
const errorMsg = abpError.message;
|
const errorMsg = abpError.message;
|
||||||
message.error(errorMsg);
|
message.error(errorMsg);
|
||||||
|
|||||||
Reference in New Issue
Block a user