feat(image): 优化图片上传和预览功能
- 修改图片上传接口,支持用户 ID 和 Markdown ID 参数 - 实现在线预览功能,支持多种文件类型 - 优化图片插入到 Markdown 编辑器的逻辑 - 更新数据库配置和连接字符串
This commit is contained in:
@@ -527,14 +527,16 @@ const editNote = async (file) => {
|
||||
|
||||
// 图片上传
|
||||
const handleImageUpload=async (files) => {
|
||||
const promise = await uploadImage(files);
|
||||
const promise = await uploadImage(files[0]);
|
||||
if (promise.code !== 200) {
|
||||
ElMessage.error(promise.msg);
|
||||
return;
|
||||
}
|
||||
const url = promise.data;
|
||||
imageUrls.value.push(url);
|
||||
vditor.value.insertValue(`![${files[0].name}](${url})`);
|
||||
const url = promise.data.url;
|
||||
// 修正IP地址并正确拼接
|
||||
const baseUrl = "http://127.0.0.1:8084";
|
||||
imageUrls.value.push(baseUrl + url);
|
||||
vditor.value.insertValue(`![${files[0].name}](${baseUrl + url})`);
|
||||
}
|
||||
|
||||
const debouncedSave = (value) => {
|
||||
|
||||
Reference in New Issue
Block a user