1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <script setup lang="ts">
- import { ref, watch } from "vue";
- import { useMainStore } from "@/stores/main";
- import { required } from "@/utils";
- import { useI18n } from "vue-i18n";
- import router from "@/router";
- const { t } = useI18n();
- const valid = ref(true);
- const dialog = ref(false);
- const title = ref("");
- const zipFiles = ref();
- const Form = ref();
- const mainStore = useMainStore();
- watch(dialog, (newVal, oldVal) => {
- if (!newVal) {
- router.push("/main/progress");
- }
- });
- async function Submit() {
- setTimeout(() => {
- dialog.value = true;
- }, 2000);
- await (Form as any).value.validate();
- if (valid.value) {
- valid.value = false;
- await mainStore.uploadPlot(title.value, zipFiles.value[0]);
- // (Form as any).value.reset();
- }
- }
- </script>
- <template>
- <v-container fluid>
- <v-card class="ma-3 pa-3">
- <v-card-title primary-title>
- <h3 class="card-title mb-3">{{ t("makeVideo") }}</h3>
- </v-card-title>
- <v-card-text>
- <v-form v-model="valid" ref="Form">
- <v-text-field
- :label="$t('title')"
- v-model="title"
- :rules="required"
- prepend-icon="title"
- >
- </v-text-field>
- <v-file-input
- v-model="zipFiles"
- :rules="[(v) => v.length || 'select zip file.']"
- accept=".zip"
- :label="$t('fileInput')"
- prepend-icon="folder_zip"
- ></v-file-input>
- </v-form>
- </v-card-text>
- <v-card-actions>
- <v-spacer></v-spacer>
- <v-btn @click="Submit" :disabled="!valid">
- {{ t("send") }}
- </v-btn>
- </v-card-actions>
- </v-card>
- <template>
- <div class="text-center">
- <v-dialog v-model="dialog" width="auto">
- <v-card>
- <v-card-text>
- <section class="d-flex flex-column align-center">
- <v-icon
- style="font-size: 70px"
- icon="info"
- color="orange-darken-3"
- />
- <p class="mt-3">影片處理需要約 5-10 分鐘,敬請耐心等候</p>
- </section>
- </v-card-text>
- <v-card-actions>
- <v-btn color="primary" block @click="dialog = false">{{
- t("close")
- }}</v-btn>
- </v-card-actions>
- </v-card>
- </v-dialog>
- </div>
- </template>
- </v-container>
- </template>
|