优化更新

This commit is contained in:
2026-09-13 18:12:07 +08:00
parent 7f758cc6e9
commit d7a081e8b7
92 changed files with 2429 additions and 1117 deletions
@@ -29,7 +29,7 @@
| 变量 | 默认值 | 说明 |
|:----|:----|:----|
| `DJANGO_UPLOAD_DIR` | `{项目根目录}/public/uploads` | 上传文件存储目录 |
| `DJANGO_FILE_URL` | `http://file.django.elevue` | 文件访问域名 |
| `DJANGO_FILE_URL` | `http://file.django.naivevue` | 文件访问域名 |
| `DJANGO_TEMP_PATH` | `{DJANGO_UPLOAD_DIR}/temp` | 临时文件目录 |
## 上传接口
@@ -66,7 +66,7 @@ file: <文件>
"fileSize": 306995,
"fileName": "2025030614302512345.jpg",
"filePath": "/temp/20250306/2025030614302512345.jpg",
"fileUrl": "http://file.django.elevue/temp/20250306/2025030614302512345.jpg"
"fileUrl": "http://file.django.naivevue/temp/20250306/2025030614302512345.jpg"
},
"ok": true
}
@@ -118,7 +118,7 @@ public/uploads/
上传成功后返回的 `fileUrl` 是拼接了 `DJANGO_FILE_URL` 前缀的完整 URL:
```
http://file.django.elevue/temp/20250306/2025030614302512345.jpg
http://file.django.naivevue/temp/20250306/2025030614302512345.jpg
```
Service 层的 `get_file_url()` 会自动为文件字段补此前缀。
@@ -129,14 +129,14 @@ Service 层的 `get_file_url()` 会自动为文件字段补此前缀。
```vue
<template>
<el-upload
<n-upload
:action="uploadUrl"
:headers="headers"
:on-success="handleSuccess"
:before-upload="beforeUpload"
@finish="handleSuccess"
@before-upload="beforeUpload"
>
<el-button type="primary">上传文件</el-button>
</el-upload>
<n-button type="primary">上传文件</n-button>
</n-upload>
</template>
<script setup>