|
@@ -6,7 +6,8 @@ import { useI18n } from "vue-i18n";
|
|
|
import { wsUrl } from "@/env";
|
|
|
import type { VideoCreate } from "@/interfaces";
|
|
|
import type { VideoUploaded } from "@/interfaces";
|
|
|
-
|
|
|
+import router from "@/router";
|
|
|
+import Dialog from "@/components/Dialog.vue";
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
const mainStore = useMainStore();
|
|
@@ -167,19 +168,16 @@ const getImageUrl = (imgFolder: string, name: string) => {
|
|
|
.href;
|
|
|
};
|
|
|
|
|
|
-// watch(dialog, (newVal, oldVal) => {
|
|
|
-// if (!newVal.show) {
|
|
|
-// setTimeout(() => {
|
|
|
-// router.push("/main/progress");
|
|
|
-// }, 1000);
|
|
|
-// }
|
|
|
-// });
|
|
|
+watch(dialog, (newVal, oldVal) => {
|
|
|
+ if (!newVal.show && newVal.state === "error") {
|
|
|
+ return;
|
|
|
+ } else if (!newVal.show && newVal.state === "success") {
|
|
|
+ router.push("/main/progress");
|
|
|
+ }
|
|
|
+});
|
|
|
|
|
|
async function Submit() {
|
|
|
WS.send("subscribe");
|
|
|
- // setTimeout(() => {
|
|
|
- // dialog.show = true;
|
|
|
- // }, 2000);
|
|
|
await (Form as any).value.validate();
|
|
|
if (valid.value) {
|
|
|
valid.value = false;
|
|
@@ -192,13 +190,17 @@ async function Submit() {
|
|
|
|
|
|
const ret:VideoUploaded = await mainStore.uploadPlot(video_data, zipFiles.value[0]);
|
|
|
if (ret.accepted) {
|
|
|
- dialog.msg = t("acceptZipMessage")
|
|
|
+ dialog.msg = t("acceptZipMessage");
|
|
|
+ dialog.state = "success";
|
|
|
+ dialog.show = true;
|
|
|
}
|
|
|
else {
|
|
|
- dialog.msg = ret.error_message!
|
|
|
+ dialog.msg = ret.error_message!;
|
|
|
+ dialog.state = "error";
|
|
|
+ dialog.show = true;
|
|
|
}
|
|
|
valid.value = true;
|
|
|
- (Form as any).value.reset();
|
|
|
+ // (Form as any).value.reset();
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -384,7 +386,7 @@ async function Submit() {
|
|
|
</v-card-text>
|
|
|
</v-card>
|
|
|
|
|
|
- <!-- <template>
|
|
|
+ <template>
|
|
|
<div class="text-center">
|
|
|
<Dialog
|
|
|
:msg="dialog.msg"
|
|
@@ -393,7 +395,7 @@ async function Submit() {
|
|
|
@close="dialog.show = false"
|
|
|
></Dialog>
|
|
|
</div>
|
|
|
- </template> -->
|
|
|
+ </template>
|
|
|
</v-container>
|
|
|
</template>
|
|
|
|