Commit 4eaad353 authored by Dazzle Wu's avatar Dazzle Wu

fix: 保存视频草稿画幅比例

parent 64034a27
import { DraftConfig, LangType } from '@/store/types/creation' import { DraftConfig, LangType, ScreenType } from '@/store/types/creation'
import { DriveType, TaskType } from '@/store/types/template' import { DriveType, TaskType } from '@/store/types/template'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
...@@ -7,6 +7,7 @@ function defaultDigitalCreation(): DraftConfig { ...@@ -7,6 +7,7 @@ function defaultDigitalCreation(): DraftConfig {
id: null, id: null,
coverUrl: null, coverUrl: null,
draftName: '', draftName: '',
pronunciationLanguage: LangType.CANTONESE,
taskType: TaskType.BASE_VIDEO, taskType: TaskType.BASE_VIDEO,
inputImageUrl: null, inputImageUrl: null,
driveType: DriveType.TEXT, driveType: DriveType.TEXT,
...@@ -17,6 +18,7 @@ function defaultDigitalCreation(): DraftConfig { ...@@ -17,6 +18,7 @@ function defaultDigitalCreation(): DraftConfig {
pitch: '5', pitch: '5',
inputAudioUrl: null, inputAudioUrl: null,
figureId: null, figureId: null,
pageLayout: ScreenType.PORTRAIT,
width: 720, width: 720,
height: 1280, height: 1280,
cameraId: null, cameraId: null,
...@@ -34,7 +36,6 @@ function defaultDigitalCreation(): DraftConfig { ...@@ -34,7 +36,6 @@ function defaultDigitalCreation(): DraftConfig {
logoUrl: null, logoUrl: null,
bgmUrl: null, bgmUrl: null,
materialUrl: null, materialUrl: null,
pronunciationLanguage: LangType.CANTONESE,
} }
} }
......
...@@ -72,6 +72,7 @@ export interface DraftConfig { ...@@ -72,6 +72,7 @@ export interface DraftConfig {
id: number | null id: number | null
coverUrl: string | null coverUrl: string | null
draftName: string draftName: string
pronunciationLanguage: LangType
taskType: TaskType taskType: TaskType
inputImageUrl: string | null inputImageUrl: string | null
driveType: DriveType driveType: DriveType
...@@ -82,6 +83,7 @@ export interface DraftConfig { ...@@ -82,6 +83,7 @@ export interface DraftConfig {
pitch: string pitch: string
inputAudioUrl: string | null inputAudioUrl: string | null
figureId: string | null figureId: string | null
pageLayout: ScreenType
width: number width: number
height: number height: number
cameraId: number | null cameraId: number | null
...@@ -99,8 +101,6 @@ export interface DraftConfig { ...@@ -99,8 +101,6 @@ export interface DraftConfig {
logoUrl: string | null logoUrl: string | null
bgmUrl: string | null bgmUrl: string | null
materialUrl: string | null materialUrl: string | null
pronunciationLanguage: LangType
pageLayout?: string
memberId?: number memberId?: number
modifiedTime?: string modifiedTime?: string
} }
......
...@@ -41,6 +41,7 @@ async function getDigitalTemplate(id: string) { ...@@ -41,6 +41,7 @@ async function getDigitalTemplate(id: string) {
id: null, id: null,
coverUrl: digitalTemplate.coverUrl, coverUrl: digitalTemplate.coverUrl,
draftName: '新建數字人視頻' + formatDateTime(new Date()), draftName: '新建數字人視頻' + formatDateTime(new Date()),
pronunciationLanguage: digitalTemplate.ttsParams?.person ? LangType.MANDARIN : LangType.CANTONESE,
taskType: digitalTemplate.taskType, taskType: digitalTemplate.taskType,
inputImageUrl: digitalTemplate.digitalHumanImageUrl, inputImageUrl: digitalTemplate.digitalHumanImageUrl,
driveType: digitalTemplate.driveType, driveType: digitalTemplate.driveType,
...@@ -51,6 +52,7 @@ async function getDigitalTemplate(id: string) { ...@@ -51,6 +52,7 @@ async function getDigitalTemplate(id: string) {
pitch: digitalTemplate.ttsParams?.pitch || digitalCreationStore.pitch, pitch: digitalTemplate.ttsParams?.pitch || digitalCreationStore.pitch,
inputAudioUrl: digitalTemplate.inputAudioUrl, inputAudioUrl: digitalTemplate.inputAudioUrl,
figureId: digitalTemplate.figureId, figureId: digitalTemplate.figureId,
pageLayout: digitalTemplate.videoParams?.pageLayout || digitalCreationStore.pageLayout,
width: width:
digitalTemplate.videoParams?.width || digitalTemplate.videoParams?.width ||
(digitalTemplate.videoParams?.pageLayout === ScreenType.LANDSCAPE ? 1280 : 720), (digitalTemplate.videoParams?.pageLayout === ScreenType.LANDSCAPE ? 1280 : 720),
...@@ -76,7 +78,6 @@ async function getDigitalTemplate(id: string) { ...@@ -76,7 +78,6 @@ async function getDigitalTemplate(id: string) {
logoUrl: digitalTemplate.logoParams?.logoUrl || null, logoUrl: digitalTemplate.logoParams?.logoUrl || null,
bgmUrl: digitalTemplate.bgmParams?.bgmUrl || null, bgmUrl: digitalTemplate.bgmParams?.bgmUrl || null,
materialUrl: digitalTemplate.materialUrl, materialUrl: digitalTemplate.materialUrl,
pronunciationLanguage: digitalTemplate.ttsParams?.person ? LangType.MANDARIN : LangType.CANTONESE,
} }
digitalCreationStore.updateDigitalCreation(draftConfig) digitalCreationStore.updateDigitalCreation(draftConfig)
audioSettingStore.setVoiceType(draftConfig.person ? VoiceType.MANDARIN_FEMALE : VoiceType.CANTONESE_FEMALE) audioSettingStore.setVoiceType(draftConfig.person ? VoiceType.MANDARIN_FEMALE : VoiceType.CANTONESE_FEMALE)
...@@ -97,6 +98,8 @@ async function getTaskConfig(id: string) { ...@@ -97,6 +98,8 @@ async function getTaskConfig(id: string) {
const draftConfig: DraftConfig = { const draftConfig: DraftConfig = {
id: null, id: null,
draftName: '新建數字人視頻' + formatDateTime(new Date()), draftName: '新建數字人視頻' + formatDateTime(new Date()),
pronunciationLanguage: res.data.person ? LangType.MANDARIN : LangType.CANTONESE,
pageLayout: res.data.pageLayout || digitalCreationStore.pageLayout,
width: res.data.width || (res.data.pageLayout === ScreenType.LANDSCAPE ? 1280 : 720), width: res.data.width || (res.data.pageLayout === ScreenType.LANDSCAPE ? 1280 : 720),
height: res.data.height || (res.data.pageLayout === ScreenType.LANDSCAPE ? 720 : 1280), height: res.data.height || (res.data.pageLayout === ScreenType.LANDSCAPE ? 720 : 1280),
w: res.data.w || (res.data.pageLayout === ScreenType.LANDSCAPE ? 607 : 1080), w: res.data.w || (res.data.pageLayout === ScreenType.LANDSCAPE ? 607 : 1080),
...@@ -125,7 +128,6 @@ async function getTaskConfig(id: string) { ...@@ -125,7 +128,6 @@ async function getTaskConfig(id: string) {
logoUrl: res.data.logoUrl || digitalCreationStore.logoUrl, logoUrl: res.data.logoUrl || digitalCreationStore.logoUrl,
bgmUrl: res.data.bgmUrl || digitalCreationStore.bgmUrl, bgmUrl: res.data.bgmUrl || digitalCreationStore.bgmUrl,
materialUrl: res.data.materialUrl || digitalCreationStore.materialUrl, materialUrl: res.data.materialUrl || digitalCreationStore.materialUrl,
pronunciationLanguage: res.data.person ? LangType.MANDARIN : LangType.CANTONESE,
} }
digitalCreationStore.updateDigitalCreation(draftConfig) digitalCreationStore.updateDigitalCreation(draftConfig)
audioSettingStore.setVoiceType(draftConfig.person ? VoiceType.MANDARIN_FEMALE : VoiceType.CANTONESE_FEMALE) audioSettingStore.setVoiceType(draftConfig.person ? VoiceType.MANDARIN_FEMALE : VoiceType.CANTONESE_FEMALE)
......
<script setup lang="ts"> <script setup lang="ts">
import { fetchDraftsList } from '@/apis/drafts' import { fetchDraftsList } from '@/apis/drafts'
import { ScreenType } from '@/store/types/creation'
import { TaskType } from '@/store/types/template' import { TaskType } from '@/store/types/template'
import { formatDateTime } from '@/utils/date-formatter' import { formatDateTime } from '@/utils/date-formatter'
import { Right } from '@icon-park/vue-next' import { Right } from '@icon-park/vue-next'
...@@ -12,6 +13,7 @@ interface CreationTemplateInfoItem { ...@@ -12,6 +13,7 @@ interface CreationTemplateInfoItem {
coverUrl: string coverUrl: string
modifiedTime: string modifiedTime: string
draftName: string draftName: string
pageLayout: ScreenType
} }
const router = useRouter() const router = useRouter()
...@@ -42,6 +44,7 @@ function getRecentCreationList() { ...@@ -42,6 +44,7 @@ function getRecentCreationList() {
modifiedTime: item.modifiedTime, modifiedTime: item.modifiedTime,
coverUrl: item.coverUrl, coverUrl: item.coverUrl,
taskType: item.taskType, taskType: item.taskType,
pageLayout: item.pageLayout,
})) }))
fetchCreationTemplateInfoListLoading.value = false fetchCreationTemplateInfoListLoading.value = false
...@@ -94,11 +97,14 @@ function handleToCreation(draftId: number) { ...@@ -94,11 +97,14 @@ function handleToCreation(draftId: number) {
class="mr-[10px] inline-block pb-[16px]" class="mr-[10px] inline-block pb-[16px]"
> >
<div <div
class="relative mb-[12px] h-[145px] w-[145px] cursor-pointer overflow-hidden rounded-[12px] bg-[#f3f4fb]" class="relative mb-[12px] flex h-[145px] w-[145px] cursor-pointer items-center justify-center overflow-hidden rounded-[12px] bg-[#f3f4fb]"
@click="handleToCreation(templateInfoItem.id)" @click="handleToCreation(templateInfoItem.id)"
> >
<img <img
class="z-1 relative h-full w-full object-contain transition-[scale] duration-300 ease-in-out hover:scale-110" class="z-1 relative object-cover transition-[scale] duration-300 ease-in-out hover:scale-110"
:class="
templateInfoItem.pageLayout === ScreenType.LANDSCAPE ? 'aspect-[16/9]' : 'aspect-[9/16] h-full'
"
:src="templateInfoItem.coverUrl" :src="templateInfoItem.coverUrl"
alt="cover" alt="cover"
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment