up
This commit is contained in:
@@ -201,7 +201,6 @@ const initDropzone = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function return_files() {
|
function return_files() {
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
@@ -209,36 +208,36 @@ function return_files() {
|
|||||||
// 加载初始已有文件(编辑场景)
|
// 加载初始已有文件(编辑场景)
|
||||||
function loadInitialFiles() {
|
function loadInitialFiles() {
|
||||||
if (!dropzoneInstance || !prop.initialFiles?.length) return;
|
if (!dropzoneInstance || !prop.initialFiles?.length) return;
|
||||||
|
|
||||||
|
|
||||||
prop.initialFiles.forEach((f) => {
|
prop.initialFiles.forEach((f) => {
|
||||||
// 构造 Dropzone 期望的 mock file 对象
|
// 构造 Dropzone 期望的 mock file 对象
|
||||||
console.log(f)
|
console.log(f);
|
||||||
// const mockFile = {
|
// 填充上传结果字段
|
||||||
// name: f.Name,
|
const url = `/api/files/get/${f.Sha256}`;
|
||||||
// size: f.Size,
|
const mockFile = {
|
||||||
// type: f.Mime,
|
name: f.Name,
|
||||||
// status: Dropzone.SUCCESS,
|
size: f.Size,
|
||||||
// accepted: true,
|
type: f.Mime,
|
||||||
// upload: { uuid: f.Sha256 },
|
status: Dropzone.SUCCESS,
|
||||||
// previewElement: null,
|
accepted: true,
|
||||||
// _removeLink: null,
|
upload: { uuid: f.Sha256 },
|
||||||
// };
|
previewElement: null,
|
||||||
// // 通知 Dropzone "这是一个已存在的文件,不要上传"
|
_removeLink: null,
|
||||||
// dropzoneInstance.emit("addedfile", mockFile);
|
};
|
||||||
// dropzoneInstance.emit("complete", mockFile);
|
// 通知 Dropzone "这是一个已存在的文件,不要上传"
|
||||||
// dropzoneInstance.files.push(mockFile);
|
dropzoneInstance.emit("addedfile", mockFile);
|
||||||
// // 填充上传结果字段
|
dropzoneInstance.emit("complete", mockFile);
|
||||||
// const url = `/api/files/get/${f.Sha256}`;
|
dropzoneInstance.files.push(mockFile);
|
||||||
// files.push({
|
|
||||||
// uuid: f.Sha256,
|
files.push({
|
||||||
// hash: f.Sha256,
|
uuid: f.Sha256,
|
||||||
// get_url: url,
|
hash: f.Sha256,
|
||||||
// download_url: `/api/files/download/${f.Sha256}`,
|
get_url: url,
|
||||||
// file_name: f.Name,
|
download_url: `/api/files/download/${f.Sha256}`,
|
||||||
// file_size: f.Size,
|
file_name: f.Name,
|
||||||
// is_upload: true,
|
file_size: f.Size,
|
||||||
// });
|
is_upload: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,22 +269,40 @@ defineExpose({
|
|||||||
<div class="dz-filename"><span data-dz-name></span></div>
|
<div class="dz-filename"><span data-dz-name></span></div>
|
||||||
<div class="dz-size"><span data-dz-size></span></div>
|
<div class="dz-size"><span data-dz-size></span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>
|
<div class="dz-progress">
|
||||||
|
<span class="dz-upload" data-dz-uploadprogress></span>
|
||||||
|
</div>
|
||||||
<div class="dz-success-mark" data-dz-successmark>
|
<div class="dz-success-mark" data-dz-successmark>
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="#22c55e" stroke="#22c55e" stroke-width="3">
|
<svg
|
||||||
<path d="M9 12l2 2l4 -4" stroke="none"/>
|
width="16"
|
||||||
|
height="16"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="#22c55e"
|
||||||
|
stroke="#22c55e"
|
||||||
|
stroke-width="3"
|
||||||
|
>
|
||||||
|
<path d="M9 12l2 2l4 -4" stroke="none" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="dz-error-mark" data-dz-errormark>
|
<div class="dz-error-mark" data-dz-errormark>
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="#ef4444" stroke="#ef4444" stroke-width="3">
|
<svg
|
||||||
<path d="M10 10l4 4m0 -4l-4 4" stroke="none"/>
|
width="16"
|
||||||
|
height="16"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="#ef4444"
|
||||||
|
stroke="#ef4444"
|
||||||
|
stroke-width="3"
|
||||||
|
>
|
||||||
|
<path d="M10 10l4 4m0 -4l-4 4" stroke="none" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="dz-error-message"><span data-dz-errormessage></span></div>
|
<div class="dz-error-message"><span data-dz-errormessage></span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-end text-sm text-gray-500">{{ files.length }}/{{ maxFiles }}</div>
|
<div class="text-end text-sm text-gray-500">
|
||||||
|
{{ files.length }}/{{ maxFiles }}
|
||||||
|
</div>
|
||||||
<div ref="dropzoneElement" class="dropzone mt-2"></div>
|
<div ref="dropzoneElement" class="dropzone mt-2"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user