123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797 |
- <script setup lang="ts">
- import { ref, reactive, watch, computed } 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 anchor = ref(0);
- let templateId = ref(0);
- let selectAnchor = ref("angela");
- let selectTemplate = ref("style1");
- // props
- let dialog = reactive({
- msg: "",
- state: "info",
- show: false,
- });
- const anchorList = reactive([
- {
- anchor_id: "african2",
- name: "African",
- },
- {
- anchor_id: "blonde1",
- name: "Blonde-1",
- },
- {
- anchor_id: "blonde2",
- name: "Blonde-2",
- },
- {
- anchor_id: "blonde3",
- name: "Blonde-3",
- },
- {
- anchor_id: "victoria",
- name: "Victoria",
- },
- {
- anchor_id: "odelia-1",
- name: "Odelia-1",
- },
- {
- anchor_id: "odelia-2",
- name: "Odelia-2",
- },
- {
- anchor_id: "odelia-3",
- name: "Odelia-3",
- },
- {
- anchor_id: "hannah-1",
- name: "Hannah-1",
- },
- {
- anchor_id: "hannah-2",
- name: "Hannah-2",
- },
- {
- anchor_id: "nelly",
- name: "Nelly",
- },
- {
- anchor_id: "teresa2",
- name: "Teresa-2",
- },
- {
- anchor_id: "zoya1",
- name: "Zoya-1",
- },
- {
- anchor_id: "zoya2",
- name: "Zoya-2",
- },
- {
- anchor_id: "aima",
- name: "Aima",
- },
- {
- anchor_id: "alitia",
- name: "Alitia",
- },
- {
- anchor_id: "cora",
- name: "Cora",
- },
- // {
- // anchor_id: "elara",
- // name: "Elara",
- // },
- // {
- // anchor_id: "sporty",
- // name: "Sporty",
- // },
- // {
- // anchor_id: "angela",
- // name: "Angela",
- // },
- // {
- // anchor_id: "jocelyn",
- // name: "Jocelyn",
- // },
- // {
- // anchor_id: "summer",
- // name: "Summer",
- // },
- // {
- // anchor_id: "peggy",
- // name: "Peggy",
- // },
- // {
- // anchor_id: "角色1",
- // name: "友量主播-01",
- // },
- // {
- // anchor_id: "角色2",
- // name: "友量主播-02",
- // },
- // {
- // anchor_id: "itri-1",
- // name: "ITRI-1",
- // },
- // {
- // anchor_id: "itri-2",
- // name: "ITRI-2",
- // },
- // {
- // anchor_id: "itri-3",
- // name: "ITRI-3",
- // },
- // {
- // anchor_id: "syscom",
- // name: "James Liu",
- // },
- // {
- // anchor_id: "星展1",
- // name: "星展",
- // },
- ]);
- const templateList = reactive([
- {
- template_id: "style13",
- img: "鏡面-13",
- },
- {
- template_id: "style12",
- img: "鏡面-12",
- },
- {
- template_id: "style11",
- img: "鏡面-11",
- },
- {
- template_id: "style10",
- img: "鏡面-10",
- },
- {
- template_id: "style9",
- img: "鏡面-09",
- },
- {
- template_id: "style8",
- img: "鏡面-08",
- },
- {
- template_id: "style5",
- img: "鏡面-05",
- },
- {
- template_id: "style4",
- img: "鏡面-04",
- },
- {
- template_id: "style3",
- img: "鏡面-03",
- },
- {
- template_id: "style2",
- img: "鏡面-02",
- },
- {
- template_id: "style1",
- img: "鏡面-01",
- },
- // {
- // template_id: "ITRI_1",
- // img: "ITRI背景-1",
- // },
- // {
- // template_id: "ITRI_2",
- // img: "ITRI背景-2",
- // },
- // {
- // template_id: "ITRI_3",
- // img: "ITRI背景-3",
- // },
- // {
- // template_id: "ITRI_4",
- // img: "ITRI背景-4",
- // },
- // {
- // template_id: "ITRI_5",
- // img: "ITRI背景-5",
- // },
- // {
- // template_id: "ITRI_6",
- // img: "ITRI背景-6",
- // },
- // {
- // template_id: "ITRI_7",
- // img: "ITRI背景-7",
- // },
- // {
- // template_id: "ITRI_8",
- // img: "ITRI背景-8",
- // },
- // {
- // template_id: "ITRI_9",
- // img: "ITRI背景-9",
- // },
- // {
- // template_id: "ITRI_10",
- // img: "ITRI背景-10",
- // },
- {
- template_id: "syscom",
- img: "syscom",
- },
- {
- template_id: "凌群2",
- img: "syscom-2",
- },
- // {
- // template_id: "星展1",
- // img: "星展",
- // },
- ]);
- let anchorLang = ref("中文");
- let items = reactive([
- { lang: "中文", id: 0 },
- { lang: "英文", id: 1 },
- ]);
- // 取得圖片路徑
- const getImageUrl = (imgFolder: string, name: string) => {
- return new URL(`../../assets/img/${imgFolder}/${name}.webp`, import.meta.url)
- .href;
- };
- watch(dialog, (newVal) => {
- if (!newVal.show && newVal.state === "error") {
- return;
- } else if (!newVal.show && newVal.state === "success") {
- router.push("/main/progress");
- }
- });
- watch(anchor, (newVal) => {
- selectAnchor.value = anchorList[newVal].anchor_id;
- console.log("selectAnchor", selectAnchor.value);
- });
- watch(templateId, (newVal) => {
- selectTemplate.value = templateList[newVal].template_id;
- });
- 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();
- }
- }
- </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('videoTitle')"
- 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>
- <div class="mb-5 ms-10">
- <router-link to="/main/generate-zip"
- >還沒有準備好 ZIP 檔案?請點此製作素材</router-link
- >
- </div>
- <!-- <v-select
- v-model="anchorLang"
- :items="items"
- item-title="lang"
- item-value="id"
- prepend-icon="language"
- label="選擇語言"
- ></v-select> -->
- </v-form>
- <v-expansion-panels class="anchor-list">
- <v-expansion-panel title="選擇主播">
- <v-expansion-panel-text class="p-0">
- <v-item-group mandatory v-model="anchor">
- <v-container fluid>
- <ul>
- <li v-for="n in anchorList" :key="n.anchor_id">
- <v-item v-slot="{ isSelected, toggle }">
- <v-card
- :color="isSelected ? 'primary' : ''"
- class="d-flex flex-column align-center"
- dark
- @click="toggle"
- :title="n.name"
- >
- <v-scroll-y-transition>
- <!-- <div v-if="n.anchor_id !== 0" class="img-disabled">
- <img
- :src="getImageUrl('anchor', n.name)"
- alt=""
- />
- <p>Coming Soon</p>
- </div> -->
- <img :src="getImageUrl('anchor', n.name)" alt="" />
- </v-scroll-y-transition>
- </v-card>
- </v-item>
- </li>
- </ul>
- </v-container>
- </v-item-group>
- </v-expansion-panel-text>
- </v-expansion-panel>
- </v-expansion-panels>
- <v-expansion-panels class="template-list mt-6">
- <v-expansion-panel title="選擇模板">
- <v-expansion-panel-text class="p-0">
- <v-sheet class="mx-auto">
- <v-slide-group
- v-model="templateId"
- selected-class="bg-primary"
- show-arrows
- >
- <v-slide-group-item
- v-for="n in templateList"
- :key="n.template_id"
- v-slot="{ isSelected, toggle, selectedClass }"
- >
- <v-card
- color="grey-lighten-1"
- :class="['ma-4', selectedClass]"
- @click="toggle"
- >
- <span
- class="choose-btn"
- :class="{ 'active-color': isSelected }"
- >
- <v-icon icon="done" color="white" />
- </span>
- <img :src="getImageUrl('template', n.img)" alt="" />
- <!-- <div :class="{ 'img-disabled': n.template_id !== 0 }">
- <img :src="getImageUrl('template', n.img)" alt="" />
- <p v-if="n.template_id !== 0">Coming Soon</p>
- </div> -->
- </v-card>
- </v-slide-group-item>
- </v-slide-group>
- </v-sheet>
- </v-expansion-panel-text>
- </v-expansion-panel>
- </v-expansion-panels>
- </v-card-text>
- <v-card-actions>
- <v-spacer></v-spacer>
- <v-btn @click="submit" :disabled="!valid" variant="outlined">
- {{ t("send") }}
- </v-btn>
- </v-card-actions>
- </v-card>
- <v-card class="ma-3 pa-3 mt-8">
- <v-card-title primary-title>
- <h3 class="text-center">使用教學</h3>
- </v-card-title>
- <v-card-text>
- <!-- <v-container>
- <v-row no-gutters class="step-list">
- <v-col cols="12" sm="3">
- <v-sheet class="ma-2 pa-2">
- <h4>1. 取得快速製作模板</h4>
- <p class="excerpt">請點擊下方按鈕取得模板範例</p>
- <div class="mb-5">
- <a :href="'/example/影片範例.zip'" class="link-btn" download
- >點我下載</a
- >
- </div>
- </v-sheet>
- </v-col>
- <v-col cols="12" sm="3">
- <v-sheet class="ma-2 pa-2"> </v-sheet>
- </v-col>
- <v-col cols="12" sm="3">
- <v-sheet class="ma-2 pa-2"> </v-sheet>
- </v-col>
- <v-col cols="12" sm="3">
- <v-sheet class="ma-2 pa-2"> </v-sheet>
- </v-col>
- <v-col cols="12" sm="3">
- <v-sheet class="ma-2 pa-2"> </v-sheet>
- </v-col>
- </v-row>
- </v-container> -->
- <ul class="mt-5 step-list">
- <li>
- <h4>1. 取得快速製作模板</h4>
- <p class="excerpt">請點擊下方按鈕取得模板範例</p>
- <div class="mb-5">
- <a :href="'/example/影片範例_0719.zip'" class="link-btn" download
- >點我下載</a
- >
- </div>
- </li>
- <li>
- <h4>2. 準備影片內容</h4>
- <p class="excerpt text-center">
- 範例的資料夾內,有 "素材資料夾" 跟 "EXCEL 檔" <br />
- (您也可以自行創建資料夾)
- </p>
- <img src="@/assets/img/step/step-01.png" alt="" class="mb-4" />
- <p class="excerpt">素材資料夾裡面放照片或影片</p>
- <img src="@/assets/img/step/step-02.png" alt="" />
- <small class="d-block ms-4 mb-6"
- >包含內容:圖片/影片(.jpg/.mp4)</small
- >
- <p class="mt-15 text-h5">影片內容要放哪些好?</p>
- <p class="mt-3 mb-15 text-h5">
- 請參考
- <router-link to="/main/knowledge-graph" class="font-weight-bold"
- >熱搜關聯分析</router-link
- >
- </p>
- <p class="mb-5 pt-5 text-h6 excerpt">
- EXCEL 檔整理成這個格式-大標、字幕、素材、發音
- </p>
- <img src="@/assets/img/step/step-03.png" alt="" />
- <div class="point-content">
- <div class="base">
- <h5>基礎應用:</h5>
- <ul>
- <li>
- 1. 字幕之間的斷句請使用符號【\】進行換行 (建議每 10
- 個字就要 使用往左邊倒的斜線\換行)
- </li>
- <li>2. 大標字數勿超過中文 15 字、英文 30 字</li>
- <li>3. 發音請留空白</li>
- </ul>
- </div>
- <div class="advanced">
- <h5>進階應用:發音</h5>
- <p>發音欄為修正聲音用。 尤其中文一字多音,特別會需要修正發音</p>
- <p class="my-5">
- 寫法如下:<br />
- <strong>{"一":"1","二":"2"}</strong>
- </p>
- <p class="mb-5">
- 解說:<br />
- <strong
- >{"字幕寫法"對應"正確發音","字幕寫法"對應"正確發音"}</strong
- >
- <br />
- 使用破音字方法撰寫
- </p>
- <p>範例圖:</p>
- <img class="my-5" src="@/assets/img/step/example.jpg" alt="" />
- <p class="mb-5">
- 「重」塑品牌形象 & 成「為」品牌經營的特點<br />
- 「重」本應發音"從"但系統唸成"眾" &
- 「為」本應發音"維"但系統唸成"味"
- <br />
- 就要寫成{"重":"從","為":"位"}
- </p>
- <strong>注意**符號一律使用英文小寫</strong>
- </div>
- </div>
- <!-- <ul class="point-list">
- <li>
- 1. 字幕之間的斷句請使用符號【\】進行換行
- <br />
- (建議 10 個字內,若超過請使用換行符號)
- </li>
- <li>2. 大標字數勿超過中文 15 字、英文 30 字</li>
- <li>3. 音檔請留空白</li>
- </ul> -->
- <p class="mt-5 excerpt">以下為顯示效果:</p>
- <img src="@/assets/img/step/step-04.png" alt="" />
- <p class="mt-5 excerpt">
- 接下來同時選素材資料夾跟 EXCEL 檔,壓縮成 ZIP 檔
- </p>
- <img src="@/assets/img/step/step-05.png" alt="" class="my-5" />
- </li>
- <li>
- <h4>3. 上傳 ZIP 資料夾至 AI Spokesgirl 平台</h4>
- <p class="excerpt">影片檔名請寫上影片名稱</p>
- <img src="@/assets/img/step/step-06.png" alt="" />
- <h4 class="my-5 caption">
- 點選“送出”之後需等待一段影片製作的時間 <br />
- 請您耐心等候,待製作完畢可於影片清單查看
- </h4>
- </li>
- </ul>
- </v-card-text>
- </v-card>
- <template>
- <div class="text-center">
- <Dialog
- :msg="dialog.msg"
- :state="dialog.state"
- :dialog="dialog.show"
- @close="dialog.show = false"
- ></Dialog>
- </div>
- </template>
- </v-container>
- </template>
- <style lang="scss" scoped>
- a {
- letter-spacing: 1px;
- }
- .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: 200px;
- }
- .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>
|