ow
This commit is contained in:
1 parent
4f57b65451
commit
eae4296980
6 files changed
+722
-259
No files matched your search
@@ -4,10 +4,11 @@
|
||||
<Toolbar :path-stack="pathStack" :root-path="rootPath" :loading="loading" @go-top="onGoTop" @go-back="onGoBack"
|
||||
@refresh="onReSearch" @search="onSearchByName" @breadcrumb-click="onBreadcrumbClick" />
|
||||
|
||||
<OperatorStation :selected-items="keys" :upload-url="uploadUrl" :headers="headers" :can-create="canCreate"
|
||||
:can-amend="canAmend" :can-delete="canDelete" :can-view="canView" :resolve-file-path="resolveUploadFilePath"
|
||||
@create-folder="onCreate" @upload-start="onUploadStart" @upload-progress="onUploadProgress"
|
||||
@upload-success="onUploadSuccess" @upload-error="onUploadError" @download="onDownloadSelected"
|
||||
<OperatorStation ref="operatorStationRef" :selected-items="keys" :upload-url="uploadUrl" :headers="headers"
|
||||
:can-create="canCreate" :can-amend="canAmend" :can-delete="canDelete" :can-view="canView"
|
||||
:resolve-file-path="resolveUploadFilePath" multiple @create-folder="onCreate" @upload-start="onUploadStart"
|
||||
@upload-progress="onUploadProgress" @upload-success="onUploadSuccess" @upload-complete="onUploadComplete"
|
||||
@upload-interrupted="onUploadInterrupted" @upload-error="onUploadError" @download="onDownloadSelected"
|
||||
@share="onShareSelected" @publish="onPublishSelected" @view-preview="onViewPreviewSelected"
|
||||
@play-video="onUrlVideoPlayItem" @play-audio="onPlayAudioItem" @pause-audio="onPauseAudio"
|
||||
@continue-audio="onContinueAudio" @preview="onPreviewSelected" @rename="onAmendSelected" @move="onMoveSelected"
|
||||
@@ -39,6 +40,16 @@
|
||||
:fullscreen="width < 640" @ok="handleSelectPublishVideo">
|
||||
<PublishVideoEnquiry ref="publishVideoEnquiry"></PublishVideoEnquiry>
|
||||
</dragModal>
|
||||
|
||||
<!-- 上传中断:问用户要不要从断点续传 -->
|
||||
<a-modal v-model:open="showResumeModal" title="上传中断" :mask-closable="false" :closable="false" ok-text="继续上传"
|
||||
cancel-text="放弃" @ok="onResumeUpload" @cancel="onDiscardUpload">
|
||||
<p>「{{ interruptedInfo.fileName }}」已上传 {{ interruptedInfo.uploaded }}/{{ interruptedInfo.total }} 片。</p>
|
||||
<p>网络似乎中断了,是否从断点继续上传?</p>
|
||||
<p style="color: #8a919f; font-size: 12px">
|
||||
提示:刷新页面会丢失已上传的分片,那之后只能重新选择文件从头上传。
|
||||
</p>
|
||||
</a-modal>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
@@ -297,16 +308,62 @@ const onUploadProgress = (payload: { text?: string }) => {
|
||||
spinTip.value = payload?.text || "上传中...";
|
||||
};
|
||||
|
||||
const onUploadSuccess = (payload: { total?: number }) => {
|
||||
const total = payload?.total ?? 1;
|
||||
let sec = 2500;
|
||||
if (total > 25) sec = total * 100;
|
||||
/** 单个文件传完:这里不刷新,等一批都传完再统一刷,避免选了多个文件反复刷列表 */
|
||||
const onUploadSuccess = () => {
|
||||
spinTip.value = "上传完成,等待服务端处理...";
|
||||
};
|
||||
|
||||
/** 一批文件全部传完:给后端留点时间合并分片,文件越多等得越久 */
|
||||
const onUploadComplete = (payload: { count?: number }) => {
|
||||
const count = payload?.count ?? 1;
|
||||
const sec = 2500 + (count - 1) * 1000;
|
||||
spinTip.value = "加载中...";
|
||||
setTimeout(() => {
|
||||
onReSearch();
|
||||
loading.value = false;
|
||||
}, sec);
|
||||
};
|
||||
|
||||
/** 中断时的断点信息,弹窗里展示用 */
|
||||
const interruptedInfo = ref<{ fileName: string; uploaded: number; total: number }>({
|
||||
fileName: "",
|
||||
uploaded: 0,
|
||||
total: 0,
|
||||
});
|
||||
const showResumeModal = ref<boolean>(false);
|
||||
const operatorStationRef = ref<any>(null);
|
||||
|
||||
/** 上传中断:断点还在内存里,弹窗问用户要不要接着传 */
|
||||
const onUploadInterrupted = (payload: {
|
||||
fileName?: string;
|
||||
uploaded?: number;
|
||||
total?: number;
|
||||
}) => {
|
||||
interruptedInfo.value = {
|
||||
fileName: payload?.fileName || "",
|
||||
uploaded: payload?.uploaded ?? 0,
|
||||
total: payload?.total ?? 0,
|
||||
};
|
||||
loading.value = false;
|
||||
spinTip.value = "加载中...";
|
||||
showResumeModal.value = true;
|
||||
};
|
||||
|
||||
/** 继续上传:从断点那一批接着发 */
|
||||
const onResumeUpload = () => {
|
||||
showResumeModal.value = false;
|
||||
loading.value = true;
|
||||
spinTip.value = "继续上传中...";
|
||||
operatorStationRef.value?.resumeUpload();
|
||||
};
|
||||
|
||||
/** 放弃:清掉断点,已传的分片留在服务器上不会被合并 */
|
||||
const onDiscardUpload = () => {
|
||||
showResumeModal.value = false;
|
||||
operatorStationRef.value?.discardUpload();
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
const onUploadError = () => {
|
||||
loading.value = false;
|
||||
spinTip.value = "加载中...";
|
||||
@@ -829,86 +886,113 @@ const handleSelectShare = async () => {
|
||||
};
|
||||
|
||||
const handleSelectPublishPhoto = async () => {
|
||||
if (publishPhotoEnquiry.value) {
|
||||
if (publishPhotoEnquiry.value.keys.length > 0) {
|
||||
let data: PublishData;
|
||||
for (let i = 0; i < keys.value.length; i++) {
|
||||
data = new PublishData();
|
||||
data.FileId = keys.value[i].FileId;
|
||||
data.PublishName = publishPhotoEnquiry.value.keys[0].PublishName;
|
||||
try {
|
||||
loading.value = true;
|
||||
if (publishPhotoEnquiry.value) {
|
||||
if (publishPhotoEnquiry.value.keys.length > 0) {
|
||||
let data: PublishData;
|
||||
for (let i = 0; i < keys.value.length; i++) {
|
||||
data = new PublishData();
|
||||
data.FileId = keys.value[i].FileId;
|
||||
data.PublishName = publishPhotoEnquiry.value.keys[0].PublishName;
|
||||
|
||||
await publishPhotoService.InsertPublishPhotoDetail(data);
|
||||
await publishPhotoService.InsertPublishPhotoDetail(data);
|
||||
}
|
||||
showModalPublishPhoto.value = false;
|
||||
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "作品发布成功",
|
||||
placement: "topRight",
|
||||
});
|
||||
} else {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "请选择一条记录",
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
showModalPublishPhoto.value = false;
|
||||
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "作品发布成功",
|
||||
placement: "topRight",
|
||||
});
|
||||
} else {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "请选择一条记录",
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
finally {
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const handleSelectPublishAudio = async () => {
|
||||
if (publishAudioEnquiry.value) {
|
||||
if (publishAudioEnquiry.value.keys.length > 0) {
|
||||
let data: PublishData;
|
||||
for (let i = 0; i < keys.value.length; i++) {
|
||||
data = new PublishData();
|
||||
data.FileId = keys.value[i].FileId;
|
||||
data.PublishName = publishAudioEnquiry.value.keys[0].PublishName;
|
||||
try {
|
||||
loading.value = true;
|
||||
if (publishAudioEnquiry.value) {
|
||||
if (publishAudioEnquiry.value.keys.length > 0) {
|
||||
let data: PublishData;
|
||||
for (let i = 0; i < keys.value.length; i++) {
|
||||
data = new PublishData();
|
||||
data.FileId = keys.value[i].FileId;
|
||||
data.PublishName = publishAudioEnquiry.value.keys[0].PublishName;
|
||||
|
||||
await publishAudioService.InsertPublishAudioDetail(data);
|
||||
await publishAudioService.InsertPublishAudioDetail(data);
|
||||
}
|
||||
showModalPublishAudio.value = false;
|
||||
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "专辑发布成功",
|
||||
placement: "topRight",
|
||||
});
|
||||
} else {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "请选择一条记录",
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
showModalPublishAudio.value = false;
|
||||
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "专辑发布成功",
|
||||
placement: "topRight",
|
||||
});
|
||||
} else {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "请选择一条记录",
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
finally {
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const handleSelectPublishVideo = async () => {
|
||||
if (publishVideoEnquiry.value) {
|
||||
if (publishVideoEnquiry.value.keys.length > 0) {
|
||||
let data: PublishData;
|
||||
for (let i = 0; i < keys.value.length; i++) {
|
||||
data = new PublishData();
|
||||
data.FileId = keys.value[i].FileId;
|
||||
data.PublishName = publishVideoEnquiry.value.keys[0].PublishName;
|
||||
try {
|
||||
loading.value = true;
|
||||
|
||||
await publishVideoService.InsertPublishVideoDetail(data);
|
||||
if (publishVideoEnquiry.value) {
|
||||
if (publishVideoEnquiry.value.keys.length > 0) {
|
||||
let data: PublishData;
|
||||
for (let i = 0; i < keys.value.length; i++) {
|
||||
data = new PublishData();
|
||||
data.FileId = keys.value[i].FileId;
|
||||
data.PublishName = publishVideoEnquiry.value.keys[0].PublishName;
|
||||
|
||||
await publishVideoService.InsertPublishVideoDetail(data);
|
||||
}
|
||||
showModalPublishVideo.value = false;
|
||||
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "专辑发布成功",
|
||||
placement: "topRight",
|
||||
});
|
||||
} else {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "请选择一条记录",
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
showModalPublishVideo.value = false;
|
||||
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "专辑发布成功",
|
||||
placement: "topRight",
|
||||
});
|
||||
} else {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "请选择一条记录",
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user