-
区块: {{ selectedUploadfile?.uploadInfo?.chunkLength }} x 256.0 KiB
+
+ 区块: {{ selectedUploadfile?.uploadInfo?.chunkLength }} x {{ filesize(selectedUploadfile?.uploadInfo?.ChunkSize as number) }}
+
hash: {{ selectedUploadfile?.hash }}
已完成: {{ selectedUploadfileChunk?.filter((r) => r.status === 'success')?.length || 0 }}
已丢弃: {{ selectedUploadfileChunk?.filter((r) => r.status === 'error')?.length || 0 }}
diff --git a/front/components/Home/File/FileUploadSpeedInfoView.vue b/front/components/Home/File/FileUploadSpeedInfoView.vue
new file mode 100644
index 0000000..cd07931
--- /dev/null
+++ b/front/components/Home/File/FileUploadSpeedInfoView.vue
@@ -0,0 +1,8 @@
+
+
+
上传速度如何计算
+
+ 上传速度根据当前秒上传了 文件区块的数量 * 每个文件区块的大小 估算而来,可能与真实上传速度有一定的误差,仅供参考
+
+
+
diff --git a/front/components/Result/FileShareResult.vue b/front/components/Result/FileShareResult.vue
index b89ab2c..8290adb 100644
--- a/front/components/Result/FileShareResult.vue
+++ b/front/components/Result/FileShareResult.vue
@@ -1,152 +1,215 @@
-
-
上传成功
-
-
-
-
-
-
-
信息
-
-
-
下载次数
-
{{ data?.download_nums }}
+
+
上传成功
+
+
+
-
-
过期时间
-
- {{
- dayjs(data?.expire_at * 1000).format("YYYY-MM-DD HH:mm:ss")
- }}
-
-
-
-
-
提取码
-
-
-
-
链接
-
-
-
{
- copy(url);
- toast.success('复制成功');
- }
- "
- >
-
-
+
+
+
信息
+
+
+
下载次数
+
{{ selectedFileShare?.download_nums }}
+
+
+
过期时间
+
+ {{ dayjs((selectedFileShare?.expire_at || 0) * 1000).format('YYYY-MM-DD HH:mm:ss') }}
+
+
+
+
+
提取码
+
{
+ copy(selectedFileShare?.pickup_code as string)
+ toast.success('复制成功')
+ }
+ "
+ >
+
+
+
+
+
+
+
+
+
链接
+
+
+ {
+ copy(getShareUrl(selectedFileShare?.id as string))
+ toast.success('复制成功')
+ }
+ "
+ >
+
+
+ {
+ showDrawer({
+ render: ({ ...rest }) =>
+ h(QrCoreDrawer, {
+ ...rest,
+ data: getShareUrl(selectedFileShare?.id as string),
+ }),
+ })
+ }
+ "
+ >
+
+
+
+
+
{
- showDrawer({
- render: ({ ...rest }) =>
- h(QrCoreDrawer, {
- ...rest,
- data: url,
- }),
- });
- }
- "
+ class="w-40 hover:bg-primary/90"
+ @click="
+ () => {
+ emit('change', 'input')
+ }
+ "
>
-
+ 返回首页
-
-
-
{
- emit('change', 'input');
- }
- "
- >
- 确定
-
-
diff --git a/front/composables/useMyAppShare.ts b/front/composables/useMyAppShare.ts
index cecc599..3f0a5ce 100644
--- a/front/composables/useMyAppShare.ts
+++ b/front/composables/useMyAppShare.ts
@@ -1,3 +1,4 @@
+import { times } from 'lodash-es'
import { toast } from 'vue-sonner'
declare const window: any
let shareIdTokenMap: WeakMap<{ share_id: string }, string>
@@ -65,7 +66,7 @@ const createShare = async (data: any) => {
}
const createFileShare = async (data: {
- file_id: string
+ files: { id: string; name: string }[]
config: {
download_nums: number
expire_time: number
@@ -75,15 +76,19 @@ const createFileShare = async (data: {
password?: string
notify_email?: string
}
- file_name: string
}) => {
- const { file_id, config, file_name } = data || {}
- return await createShare({
- type: 'file',
- data: file_id,
- config,
- file_name,
- })
+ const { files, config } = data || {}
+ return await Promise.all(
+ times(files.length, async (i) => {
+ const { id, name } = files[i]
+ return await createShare({
+ type: 'file',
+ data: id,
+ config,
+ file_name: name,
+ })
+ })
+ )
}
const createTextShare = async (data: { text: string; config: any }) => {
diff --git a/front/lib/getFileChunk.ts b/front/lib/getFileChunk.ts
new file mode 100644
index 0000000..0edeeea
--- /dev/null
+++ b/front/lib/getFileChunk.ts
@@ -0,0 +1,11 @@
+const getFileChunk = (file: File, start: number, chunk_size: number): Promise
=> {
+ const fileReader = new FileReader()
+ return new Promise((resolve, reject) => {
+ const chunk = file.slice(start, start + chunk_size)
+ fileReader.onload = (e) => resolve(e.target?.result as ArrayBuffer)
+ fileReader.onerror = reject
+ fileReader.readAsArrayBuffer(chunk)
+ })
+}
+
+export default getFileChunk