|
@@ -1,73 +1,13 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, reactive, watch, computed } from "vue";
|
|
|
+import { ref, reactive } from "vue";
|
|
|
import { useMainStore } from "@/stores/main";
|
|
|
import { required } from "@/utils";
|
|
|
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();
|
|
|
-const WS = mainStore.videosWebSocket;
|
|
|
const valid = ref(true);
|
|
|
-const title = ref("");
|
|
|
-const zipFiles = ref();
|
|
|
const Form = ref();
|
|
|
-let selectAnchor = ref("angela");
|
|
|
-let selectTemplate = ref("style1");
|
|
|
-
|
|
|
-// props
|
|
|
-let dialog = reactive({
|
|
|
- msg: "",
|
|
|
- state: "info",
|
|
|
- show: false,
|
|
|
-});
|
|
|
-
|
|
|
-watch(dialog, (newVal) => {
|
|
|
- if (!newVal.show && newVal.state === "error") {
|
|
|
- return;
|
|
|
- } else if (!newVal.show && newVal.state === "success") {
|
|
|
- router.push("/main/progress");
|
|
|
- }
|
|
|
-});
|
|
|
-
|
|
|
-async function Submit() {
|
|
|
- WS.send("subscribe");
|
|
|
- await (Form as any).value.validate();
|
|
|
- if (valid.value) {
|
|
|
- valid.value = false;
|
|
|
-
|
|
|
- const video_data: VideoCreate = {
|
|
|
- title: title.value,
|
|
|
- anchor: selectAnchor.value,
|
|
|
- style: selectTemplate.value,
|
|
|
- lang: "zh",
|
|
|
- };
|
|
|
-
|
|
|
- const ret: VideoUploaded = await mainStore.uploadPlot(
|
|
|
- video_data,
|
|
|
- zipFiles.value[0]
|
|
|
- );
|
|
|
-
|
|
|
- if (ret.accepted) {
|
|
|
- dialog.msg = t("acceptZipMessage");
|
|
|
- dialog.state = "success";
|
|
|
- dialog.show = true;
|
|
|
- } else {
|
|
|
- dialog.msg = ret.error_message!;
|
|
|
- dialog.state = "error";
|
|
|
- dialog.show = true;
|
|
|
- }
|
|
|
-
|
|
|
- valid.value = true;
|
|
|
-
|
|
|
- // (Form as any).value.reset();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
let paragraphList = reactive([""]);
|
|
|
|
|
|
// 新增段落
|
|
@@ -82,14 +22,11 @@ const zipFile = ref(); // 儲存 ZIP 檔案
|
|
|
async function generateZip() {
|
|
|
zipFile.value = null;
|
|
|
loading.value = true;
|
|
|
- const response: any = await mainStore.generateZip(model.value, paragraphList);
|
|
|
|
|
|
+ const response: any = await mainStore.generateZip(model.value, paragraphList);
|
|
|
zipFile.value = new Blob([response[0].data], { type: "application/zip" });
|
|
|
|
|
|
loading.value = false;
|
|
|
-
|
|
|
- console.log("response", response);
|
|
|
- console.log("zipFile.value", zipFile.value);
|
|
|
}
|
|
|
|
|
|
// ZIP 檔案下載
|
|
@@ -194,196 +131,4 @@ function downloadZipFile() {
|
|
|
</v-container>
|
|
|
</template>
|
|
|
|
|
|
-<style lang="scss">
|
|
|
-.anchor-list {
|
|
|
- ul {
|
|
|
- display: grid;
|
|
|
- grid-template-columns: repeat(auto-fit, minmax(185px, max-content));
|
|
|
- grid-gap: 20px;
|
|
|
- justify-content: center;
|
|
|
- padding: initial;
|
|
|
- li {
|
|
|
- list-style-type: none;
|
|
|
- }
|
|
|
- }
|
|
|
- img {
|
|
|
- width: 190px;
|
|
|
- height: 155px;
|
|
|
- object-fit: cover;
|
|
|
- }
|
|
|
-
|
|
|
- .v-card--variant-elevated {
|
|
|
- box-shadow: 0px 2px 5px 1px
|
|
|
- var(--v-shadow-key-umbra-opacity, rgba(0, 0, 0, 0.2)),
|
|
|
- 0px 1px 1px 0px var(--v-shadow-key-penumbra-opacity, rgba(0, 0, 0, 0.14)),
|
|
|
- 0px 1px 3px 0px var(--v-shadow-key-penumbra-opacity, rgba(0, 0, 0, 0.12));
|
|
|
- }
|
|
|
-
|
|
|
- .v-card-item {
|
|
|
- padding: 0;
|
|
|
- text-align: center;
|
|
|
- .v-card-title {
|
|
|
- font-size: 18px;
|
|
|
- }
|
|
|
- }
|
|
|
- .bg-success {
|
|
|
- background: linear-gradient(
|
|
|
- -225deg,
|
|
|
- rgb(234, 84, 19) 35%,
|
|
|
- rgb(178, 69, 146) 100%
|
|
|
- ) !important;
|
|
|
- }
|
|
|
- .v-expansion-panel-text__wrapper {
|
|
|
- padding: 0 !important;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.anchor-list,
|
|
|
-.template-list {
|
|
|
- padding-left: 40px;
|
|
|
- .v-expansion-panel-title {
|
|
|
- height: 55px;
|
|
|
- min-height: 0;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.template-list {
|
|
|
- img {
|
|
|
- width: 100%;
|
|
|
- height: 180px;
|
|
|
- }
|
|
|
- .choose-btn {
|
|
|
- padding: 5px;
|
|
|
- position: absolute;
|
|
|
- right: 8px;
|
|
|
- bottom: 13px;
|
|
|
- background: #ccc;
|
|
|
- border-radius: 100px;
|
|
|
- }
|
|
|
- .active-color {
|
|
|
- background: #ea5413;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.step-list {
|
|
|
- list-style: none;
|
|
|
- img {
|
|
|
- width: 100%;
|
|
|
- max-width: 1000px;
|
|
|
- }
|
|
|
- li {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
- font-size: 16px;
|
|
|
- p {
|
|
|
- line-height: 32px;
|
|
|
- }
|
|
|
- h4 {
|
|
|
- margin: 20px auto;
|
|
|
- color: #ea5413;
|
|
|
- font-weight: bold;
|
|
|
- text-align: center;
|
|
|
- line-height: 34px;
|
|
|
- font-size: 20px;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .link-btn {
|
|
|
- display: inline-block;
|
|
|
- padding: 12px 20px;
|
|
|
- margin-top: 25px;
|
|
|
- border-radius: 100px;
|
|
|
- text-decoration: none;
|
|
|
- color: #fff;
|
|
|
- background: #ea5413;
|
|
|
- transition: all 0.3s;
|
|
|
- &:hover {
|
|
|
- opacity: 0.8;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .point-list {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: baseline;
|
|
|
- margin-left: 40px;
|
|
|
- }
|
|
|
-
|
|
|
- .point-content {
|
|
|
- .base,
|
|
|
- .advanced {
|
|
|
- padding: 40px;
|
|
|
- margin-top: 50px;
|
|
|
- max-width: 1000px;
|
|
|
- letter-spacing: 1px;
|
|
|
- border-radius: 5px;
|
|
|
- }
|
|
|
-
|
|
|
- .base {
|
|
|
- border: 4px solid #ea5413;
|
|
|
- }
|
|
|
-
|
|
|
- .advanced {
|
|
|
- border: 4px dashed #ea5413;
|
|
|
- }
|
|
|
-
|
|
|
- ul {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: flex-start;
|
|
|
-
|
|
|
- li {
|
|
|
- margin: 5px 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- h5 {
|
|
|
- margin-bottom: 20px;
|
|
|
- text-align: center;
|
|
|
- font-size: 1.25rem;
|
|
|
- }
|
|
|
-
|
|
|
- hr {
|
|
|
- margin: 30px;
|
|
|
- border-color: #f2f2f2;
|
|
|
- opacity: 0.3;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .excerpt::before {
|
|
|
- content: "";
|
|
|
- font-weight: bold;
|
|
|
- display: inline-block;
|
|
|
- border: 5px solid #ea5413;
|
|
|
- border-radius: 20px;
|
|
|
- margin-right: 10px;
|
|
|
- margin-bottom: 2px;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.img-disabled {
|
|
|
- position: relative;
|
|
|
- z-index: 999;
|
|
|
- background-color: #ccc;
|
|
|
- margin-bottom: -5px;
|
|
|
- img {
|
|
|
- opacity: 0.7;
|
|
|
- }
|
|
|
- p {
|
|
|
- position: absolute;
|
|
|
- top: 50%;
|
|
|
- left: 50%;
|
|
|
- color: #fff;
|
|
|
- transform: translate(-50%, -50%);
|
|
|
- font-size: 16px;
|
|
|
- text-align: center;
|
|
|
- letter-spacing: 1px;
|
|
|
- text-shadow: 2px 2px 6px #000;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.v-card--disabled > :not(.v-card__loader) {
|
|
|
- opacity: 1 !important;
|
|
|
-}
|
|
|
-</style>
|
|
|
+<style lang="scss"></style>
|