feat(image): 优化图片上传和预览功能

- 修改图片上传接口,支持用户 ID 和 Markdown ID 参数
- 实现在线预览功能,支持多种文件类型
- 优化图片插入到 Markdown 编辑器的逻辑
- 更新数据库配置和连接字符串
This commit is contained in:
2025-08-01 17:21:16 +08:00
parent 7a7247a851
commit 2bb265d23f
13 changed files with 91 additions and 30 deletions

View File

@@ -29,10 +29,12 @@ export const deleteImages = (list) => {
})
}
// 上传图片
export const uploadImage = (file) => {
export const uploadImage = (file, userId, markdownId) => {
const formData = new FormData()
if (file) formData.append('file', file)
return axiosApi.post('/api/images?markdownId', formData, {
if (userId) formData.append('userId', userId)
if (markdownId) formData.append('markdownId', markdownId)
return axiosApi.post('/api/images', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}