Update luma experience (#230)
This commit is contained in:
1 parent
1150762ce5
commit
465159c7e5
27 files changed
+404
-944
No files matched your search
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "patch",
|
||||
"comment": "fix luma style",
|
||||
"packageName": "@acedatacloud/nexior",
|
||||
"email": "cqc@cuiqingcai.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
||||
@@ -101,7 +101,6 @@
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-promise": "^5.0.0",
|
||||
"eslint-plugin-unused-imports": "^4.1.4",
|
||||
"eslint-plugin-vue": "^8.5.0",
|
||||
"husky": "^7.0.2",
|
||||
"postcss": "^8.4.32",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="video">
|
||||
<vue-plyr :options="options">
|
||||
<video controls crossorigin="anonymous" playsinline>
|
||||
<source size="1080" :src="modelValue?.video_url" type="video/mp4" />
|
||||
<source size="1080" :src="src" type="video/mp4" />
|
||||
</video>
|
||||
</vue-plyr>
|
||||
</div>
|
||||
@@ -13,15 +13,14 @@ import { defineComponent } from 'vue';
|
||||
// @ts-ignore
|
||||
import VuePlyr from '@skjnldsv/vue-plyr';
|
||||
// @ts-ignore
|
||||
import { IKlingVideo } from '@/models';
|
||||
import '@skjnldsv/vue-plyr/dist/vue-plyr.css';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'VideoPlayer',
|
||||
components: { VuePlyr },
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Object as () => IKlingVideo | undefined,
|
||||
src: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div v-if="tasks?.items === undefined">
|
||||
<bot-placeholder />
|
||||
</div>
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="h-full w-full overflow-y-auto">
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="tasks h-full w-full overflow-y-auto">
|
||||
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" />
|
||||
</div>
|
||||
<div v-if="tasks?.items?.length === 0">
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<!-- Display success message -->
|
||||
<div v-if="modelValue?.response?.success === true" :class="{ content: true, failed: true }">
|
||||
<div class="flex justify-start items-center gap-4">
|
||||
<div class="flex justify-start items-center gap-4 w-full overflow-x-auto">
|
||||
<image-wrapper
|
||||
v-for="(image, imageIndex) in images"
|
||||
:key="imageIndex"
|
||||
|
||||
@@ -1,44 +1,27 @@
|
||||
<template>
|
||||
<div ref="panel" class="panel recent" @scroll="onHandleScroll">
|
||||
<div v-if="tasks?.items === undefined" class="tasks">
|
||||
<div v-for="_ in 3" :key="_" class="task placeholder">
|
||||
<div class="left">
|
||||
<el-skeleton animated>
|
||||
<template #template>
|
||||
<el-skeleton-item variant="image" class="avatar" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
<div class="main">
|
||||
<el-skeleton animated>
|
||||
<template #template>
|
||||
<el-skeleton-item variant="p" class="title" />
|
||||
<el-skeleton-item variant="image" class="icon" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="tasks">
|
||||
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" class="preview" />
|
||||
</div>
|
||||
<p v-if="tasks?.items?.length === 0" class="description">
|
||||
{{ $t('hailuo.message.noTasks') }}
|
||||
</p>
|
||||
<div v-if="tasks?.items === undefined">
|
||||
<bot-placeholder />
|
||||
</div>
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="tasks w-full h-full overflow-y-auto">
|
||||
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" />
|
||||
</div>
|
||||
<div v-if="tasks?.items?.length === 0">
|
||||
<no-tasks />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskPreview from './task/Preview.vue';
|
||||
import { ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
import BotPlaceholder from '@/components/common/BotPlaceholder.vue';
|
||||
import NoTasks from '@/components/common/NoTasks.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RecentPanel',
|
||||
components: {
|
||||
TaskPreview,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem
|
||||
BotPlaceholder,
|
||||
NoTasks
|
||||
},
|
||||
emits: ['reach-top'],
|
||||
data() {
|
||||
@@ -66,76 +49,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
&.recent {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
overflow-y: auto;
|
||||
flex-direction: column;
|
||||
.preview {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.description {
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
.tasks {
|
||||
width: 100%;
|
||||
.task {
|
||||
margin-bottom: 15px;
|
||||
width: 100%;
|
||||
height: fit-content;
|
||||
text-align: left;
|
||||
|
||||
&.placeholder {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.left {
|
||||
width: 70px;
|
||||
padding: 10px;
|
||||
|
||||
.avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.main {
|
||||
width: calc(100% - 70px);
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
height: 200px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: block;
|
||||
width: 200px;
|
||||
height: 20px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.operations {
|
||||
height: fit-content !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -21,8 +21,8 @@
|
||||
</div>
|
||||
<!-- Display success message -->
|
||||
<div v-if="modelValue?.response?.success === true" :class="{ content: true, failed: true }">
|
||||
<div class="mb-4">
|
||||
<video-player :model-value="video" />
|
||||
<div v-if="video?.video_url" class="mb-4">
|
||||
<video-player :src="video?.video_url" />
|
||||
</div>
|
||||
<div v-if="video" :class="{ operations: true, 'mt-2': true }">
|
||||
<el-tooltip
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
</div>
|
||||
<!-- Display success message -->
|
||||
<div v-if="modelValue?.response?.success === true" :class="{ content: true, failed: true }">
|
||||
<div class="mb-4">
|
||||
<video-player :model-value="modelValue?.response" />
|
||||
<div v-if="modelValue?.response.video_url" class="mb-4">
|
||||
<video-player :src="modelValue?.response.video_url" />
|
||||
</div>
|
||||
<div v-if="modelValue?.response.success" :class="{ operations: true, 'mt-2': true }">
|
||||
<el-tooltip class="box-item" effect="dark" :content="$t('kling.message.downloadVideo')" placement="top-start">
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<prompt-input class="mb-4" />
|
||||
<custom-selector v-if="!config?.video_id" class="mb-4" />
|
||||
<upload-video v-if="config?.custom" class="mb-4" />
|
||||
<start-image-url-input v-if="!(config?.video_id || config?.video_url) && !config?.custom" class="mb-4" />
|
||||
<end-image-url-input class="mb-4" />
|
||||
<start-image-input v-if="!(config?.video_id || config?.video_url) && !config?.custom" class="mb-4" />
|
||||
<end-image-input class="mb-4" />
|
||||
<enhancement-selector class="mb-4" />
|
||||
<loop-selector class="mb-4" />
|
||||
<div class="actions">
|
||||
@@ -36,18 +36,19 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import EnhancementSelector from './config/EnhancementSelector.vue';
|
||||
import CustomSelector from './config/CustomSelector.vue';
|
||||
import LoopSelector from './config/LoopSelector.vue';
|
||||
import EndImageUrlInput from './config/EndImageUrlInput.vue';
|
||||
import StartImageUrlInput from './config/StartImageUrlInput.vue';
|
||||
import EndImageInput from './config/EndImageInput.vue';
|
||||
import StartImageInput from './config/StartImageInput.vue';
|
||||
// @ts-ignore
|
||||
import UploadVideo from './config/UploadVideo.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import ExtendFromInput from './config/ExtendFromInput.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PresetPanel',
|
||||
components: {
|
||||
LoopSelector,
|
||||
StartImageUrlInput,
|
||||
EndImageUrlInput,
|
||||
StartImageInput,
|
||||
EndImageInput,
|
||||
EnhancementSelector,
|
||||
ElButton,
|
||||
FontAwesomeIcon,
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card v-show="operating">
|
||||
<content-input class="mb-4" />
|
||||
<prompt-input class="mb-4" />
|
||||
<preset-selector class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('luma.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<div>
|
||||
<el-button type="primary" class="btn btn-operate" @click="operating = !operating">+</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElButton, ElCard } from 'element-plus';
|
||||
import PresetSelector from './config/PresetSelector2.vue';
|
||||
import ContentInput from './config/ContentInput.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'OperationPanel',
|
||||
components: {
|
||||
ElButton,
|
||||
ElCard,
|
||||
PresetSelector,
|
||||
ContentInput,
|
||||
PromptInput,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
emits: ['generate'],
|
||||
data() {
|
||||
return {
|
||||
operating: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onGenerate() {
|
||||
this.$emit('generate');
|
||||
this.operating = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
width: 580px;
|
||||
height: fit-content;
|
||||
overflow-y: scroll;
|
||||
position: absolute;
|
||||
bottom: 70px;
|
||||
left: calc(50% - 300px);
|
||||
@media (max-width: 767px) {
|
||||
width: 100%;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-operate {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
font-size: 24px;
|
||||
line-height: 40px;
|
||||
padding: 0;
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@@ -1,44 +1,27 @@
|
||||
<template>
|
||||
<div ref="panel" class="panel recent" @scroll="onHandleScroll">
|
||||
<div v-if="tasks?.items === undefined" class="tasks">
|
||||
<div v-for="_ in 3" :key="_" class="task placeholder">
|
||||
<div class="left">
|
||||
<el-skeleton animated>
|
||||
<template #template>
|
||||
<el-skeleton-item variant="image" class="avatar" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
<div class="main">
|
||||
<el-skeleton animated>
|
||||
<template #template>
|
||||
<el-skeleton-item variant="p" class="title" />
|
||||
<el-skeleton-item variant="image" class="icon" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="tasks">
|
||||
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" class="preview" />
|
||||
</div>
|
||||
<p v-if="tasks?.items?.length === 0" class="description">
|
||||
{{ $t('luma.message.noTasks') }}
|
||||
</p>
|
||||
<div v-if="tasks?.items === undefined">
|
||||
<bot-placeholder />
|
||||
</div>
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="tasks w-full h-full overflow-y-auto">
|
||||
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" />
|
||||
</div>
|
||||
<div v-if="tasks?.items?.length === 0">
|
||||
<no-tasks />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskPreview from './task/Preview.vue';
|
||||
import { ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
import BotPlaceholder from '../common/BotPlaceholder.vue';
|
||||
import NoTasks from '@/components/common/NoTasks.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RecentPanel',
|
||||
components: {
|
||||
BotPlaceholder,
|
||||
TaskPreview,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem
|
||||
NoTasks
|
||||
},
|
||||
emits: ['reach-top'],
|
||||
data() {
|
||||
@@ -66,76 +49,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
&.recent {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
overflow-y: auto;
|
||||
flex-direction: column;
|
||||
.preview {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.description {
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
.tasks {
|
||||
width: 100%;
|
||||
.task {
|
||||
margin-bottom: 15px;
|
||||
width: 100%;
|
||||
height: fit-content;
|
||||
text-align: left;
|
||||
|
||||
&.placeholder {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.left {
|
||||
width: 70px;
|
||||
padding: 10px;
|
||||
|
||||
.avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.main {
|
||||
width: calc(100% - 70px);
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
height: 200px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: block;
|
||||
width: 200px;
|
||||
height: 20px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.operations {
|
||||
height: fit-content !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,40 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<vue-plyr :options="options" class="video">
|
||||
<video controls crossorigin playsinline :data-poster="modelValue?.response?.thumbnail_url">
|
||||
<source size="1080" :src="modelValue?.response?.video_url" type="video/mp4" />
|
||||
</video>
|
||||
</vue-plyr>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
// @ts-ignore
|
||||
import VuePlyr from '@skjnldsv/vue-plyr';
|
||||
// @ts-ignore
|
||||
import { ILumaTask } from '@/models';
|
||||
import '@skjnldsv/vue-plyr/dist/vue-plyr.css';
|
||||
export default defineComponent({
|
||||
name: 'VideoPlayer',
|
||||
components: { VuePlyr },
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Object as () => ILumaTask | undefined,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
options: { quality: { default: '1080p' } }
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video {
|
||||
max-width: 100%;
|
||||
height: 450px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,14 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('luma.name.custom') }}</h2>
|
||||
<el-switch v-model="value" class="value" />
|
||||
<info-icon :content="$t('luma.description.custom')" class="info" />
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('luma.name.custom') }}</span>
|
||||
<info-icon :content="$t('luma.description.custom')" />
|
||||
</div>
|
||||
<div class="flex justify-end items-center">
|
||||
<el-switch v-model="value" class="value" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -11,6 +17,7 @@ import { defineComponent } from 'vue';
|
||||
import { ElSwitch } from 'element-plus';
|
||||
import { LUMA_DEFAULT_CUSTOM } from '@/constants';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CustomSelector',
|
||||
components: {
|
||||
@@ -38,21 +45,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
margin-left: 60px; // Adjust this value as needed
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('luma.name.endImageUrl') }}</span>
|
||||
<info-icon :content="$t('luma.description.endImageUrl')" />
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
:limit="5"
|
||||
class="upload-wrapper"
|
||||
:multiple="false"
|
||||
:action="uploadUrl"
|
||||
list-type="picture"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:on-success="onSuccess"
|
||||
:headers="headers"
|
||||
>
|
||||
<template #file="{ file }">
|
||||
<image-preview
|
||||
:url="file.url || file.response?.file_url"
|
||||
:name="file.name"
|
||||
:percentage="file.percentage"
|
||||
@remove="fileList.splice(fileList.indexOf(file), 1)"
|
||||
/>
|
||||
</template>
|
||||
<el-button round type="primary" size="small" class="btn btn-upload">
|
||||
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-1" />
|
||||
{{ $t('luma.button.uploadEndImageUrl') }}
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElUpload, ElButton, UploadFiles, UploadFile, ElMessage } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { getBaseUrlPlatform } from '@/utils';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
import ImagePreview from '@/components/common/ImagePreview.vue';
|
||||
|
||||
interface IData {
|
||||
fileList: UploadFiles;
|
||||
uploadUrl: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'EndImage',
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
ImagePreview,
|
||||
InfoIcon,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
fileList: [],
|
||||
uploadUrl: getBaseUrlPlatform() + '/api/v1/files/'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
headers() {
|
||||
return {
|
||||
Authorization: `Bearer ${this.$store.state.token.access}`
|
||||
};
|
||||
},
|
||||
urls() {
|
||||
// @ts-ignore
|
||||
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
|
||||
},
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state?.luma?.config?.start_image_url;
|
||||
},
|
||||
set() {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = undefined;
|
||||
}
|
||||
this.onSetEndImageUrl();
|
||||
},
|
||||
methods: {
|
||||
onExceed() {
|
||||
ElMessage.warning(this.$t('luma.message.uploadReferencesExceed'));
|
||||
},
|
||||
onError() {
|
||||
ElMessage.error(this.$t('luma.message.uploadReferencesError'));
|
||||
},
|
||||
onSetEndImageUrl() {
|
||||
const url = this.urls?.[0];
|
||||
this.$store.commit('luma/setConfig', {
|
||||
...this.$store.state.luma?.config,
|
||||
end_image_url: url
|
||||
});
|
||||
},
|
||||
async onSuccess() {
|
||||
this.onSetEndImageUrl();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.btn.btn-upload {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,123 +0,0 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('luma.name.endImageUrl') }}</h2>
|
||||
<div class="upload-wrapper">
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
name="file"
|
||||
class="value"
|
||||
:show-file-list="true"
|
||||
:limit="1"
|
||||
:multiple="false"
|
||||
:action="uploadUrl"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:on-success="onSuccess"
|
||||
:headers="headers"
|
||||
>
|
||||
<el-button size="small" type="primary" round>{{ $t('luma.button.uploadEndImageUrl') }}</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
<info-icon :content="$t('luma.description.endImageUrl')" class="info" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElButton, ElUpload, ElMessage, UploadFiles } from 'element-plus';
|
||||
import { getBaseUrlPlatform } from '@/utils';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
export const DEFAULT_CONTENT = '';
|
||||
|
||||
interface IData {
|
||||
fileList: UploadFiles;
|
||||
uploadUrl: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ContentInput',
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
InfoIcon
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
fileList: [],
|
||||
uploadUrl: getBaseUrlPlatform() + '/api/v1/files/'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
headers() {
|
||||
return {
|
||||
Authorization: `Bearer ${this.$store.state.token.access}`
|
||||
};
|
||||
},
|
||||
urls(): string[] {
|
||||
// @ts-ignore
|
||||
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
|
||||
},
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.luma?.config?.end_image_url;
|
||||
},
|
||||
set() {
|
||||
const url = this.urls?.[0];
|
||||
this.$store.commit('luma/setConfig', {
|
||||
...this.$store.state.luma?.config,
|
||||
end_image_url: url
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = undefined;
|
||||
}
|
||||
this.onSetEndImageUrl();
|
||||
},
|
||||
methods: {
|
||||
onExceed() {
|
||||
ElMessage.warning(this.$t('luma.message.uploadEndImageExceed'));
|
||||
},
|
||||
onError() {
|
||||
ElMessage.error(this.$t('luma.message.uploadEndImageError'));
|
||||
},
|
||||
onSetEndImageUrl() {
|
||||
const url = this.urls?.[0];
|
||||
this.$store.commit('luma/setConfig', {
|
||||
...this.$store.state.luma?.config,
|
||||
end_image_url: url
|
||||
});
|
||||
},
|
||||
async onSuccess() {
|
||||
this.onSetEndImageUrl();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between; // Distribute space evenly
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
margin-left: 60px; // Adjust this value as needed
|
||||
}
|
||||
.upload-wrapper {
|
||||
transform: translate(-26px, 5px); // Move left and down
|
||||
}
|
||||
.info {
|
||||
margin-left: auto; // Pushes the info icon to the right
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,14 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('luma.name.enhancement') }}</h2>
|
||||
<el-switch v-model="value" class="value" />
|
||||
<info-icon :content="$t('luma.description.enhancement')" class="info" />
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('luma.name.enhancement') }}</span>
|
||||
<info-icon :content="$t('luma.description.enhancement')" />
|
||||
</div>
|
||||
<div class="flex justify-end items-center">
|
||||
<el-switch v-model="value" class="value" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -38,21 +44,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
margin-left: 60px; // Adjust this value as needed
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,16 +1,10 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<div class="box">
|
||||
<h2 class="title font-bold">{{ $t('luma.name.extend') }}</h2>
|
||||
<div class="relative">
|
||||
<div class="flex mb-2">
|
||||
<span class="text-sm font-bold">{{ $t('luma.name.extend') }}</span>
|
||||
</div>
|
||||
<div class="task">
|
||||
<div>
|
||||
<vue-plyr :options="options" class="video">
|
||||
<video controls crossorigin playsinline :data-poster="config?.thumbnail_url">
|
||||
<source size="1080" :src="config?.video_url" type="video/mp4" />
|
||||
</video>
|
||||
</vue-plyr>
|
||||
</div>
|
||||
<div>
|
||||
<video-player v-if="config?.video_url" :src="config?.video_url" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -18,14 +12,12 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
// @ts-ignore
|
||||
import VuePlyr from '@skjnldsv/vue-plyr';
|
||||
// @ts-ignore
|
||||
import { ILumaTask } from '@/models';
|
||||
import '@skjnldsv/vue-plyr/dist/vue-plyr.css';
|
||||
import VideoPlayer from '@/components/common/VideoPlayer.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ExtendFromInput',
|
||||
components: { VuePlyr },
|
||||
components: { VideoPlayer },
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Object as () => ILumaTask | undefined,
|
||||
@@ -44,23 +36,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.input-wrapper {
|
||||
width: 150px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,14 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('luma.name.loop') }}</h2>
|
||||
<el-switch v-model="value" class="value" />
|
||||
<info-icon :content="$t('luma.description.loop')" class="info" />
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('luma.name.loop') }}</span>
|
||||
<info-icon :content="$t('luma.description.loop')" />
|
||||
</div>
|
||||
<div class="flex justify-end items-center">
|
||||
<el-switch v-model="value" class="value" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -11,6 +17,7 @@ import { defineComponent } from 'vue';
|
||||
import { ElSwitch } from 'element-plus';
|
||||
import { LUMA_DEFAULT_LOOP } from '@/constants';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'LoopSelector',
|
||||
components: {
|
||||
@@ -38,21 +45,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
margin-left: 60px; // Adjust this value as needed
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('luma.name.startImageUrl') }}</span>
|
||||
<info-icon :content="$t('luma.description.startImageUrl')" />
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
:limit="5"
|
||||
class="upload-wrapper"
|
||||
:multiple="false"
|
||||
:action="uploadUrl"
|
||||
list-type="picture"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:on-success="onSuccess"
|
||||
:headers="headers"
|
||||
>
|
||||
<template #file="{ file }">
|
||||
<image-preview
|
||||
:url="file.url || file.response?.file_url"
|
||||
:name="file.name"
|
||||
:percentage="file.percentage"
|
||||
@remove="fileList.splice(fileList.indexOf(file), 1)"
|
||||
/>
|
||||
</template>
|
||||
<el-button round type="primary" size="small" class="btn btn-upload">
|
||||
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-1" />
|
||||
{{ $t('luma.button.uploadStartImageUrl') }}
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElUpload, ElButton, UploadFiles, UploadFile, ElMessage } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { getBaseUrlPlatform } from '@/utils';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
import ImagePreview from '@/components/common/ImagePreview.vue';
|
||||
|
||||
interface IData {
|
||||
fileList: UploadFiles;
|
||||
uploadUrl: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'StartImage',
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
ImagePreview,
|
||||
InfoIcon,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
fileList: [],
|
||||
uploadUrl: getBaseUrlPlatform() + '/api/v1/files/'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
headers() {
|
||||
return {
|
||||
Authorization: `Bearer ${this.$store.state.token.access}`
|
||||
};
|
||||
},
|
||||
urls() {
|
||||
// @ts-ignore
|
||||
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
|
||||
},
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state?.luma?.config?.start_image_url;
|
||||
},
|
||||
set() {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = undefined;
|
||||
}
|
||||
this.onSetStartImageUrl();
|
||||
},
|
||||
methods: {
|
||||
onExceed() {
|
||||
ElMessage.warning(this.$t('luma.message.uploadReferencesExceed'));
|
||||
},
|
||||
onError() {
|
||||
ElMessage.error(this.$t('luma.message.uploadReferencesError'));
|
||||
},
|
||||
onSetStartImageUrl() {
|
||||
const url = this.urls?.[0];
|
||||
this.$store.commit('luma/setConfig', {
|
||||
...this.$store.state.luma?.config,
|
||||
start_image_url: url
|
||||
});
|
||||
},
|
||||
async onSuccess() {
|
||||
this.onSetStartImageUrl();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.btn.btn-upload {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,127 +0,0 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('luma.name.startImageUrl') }}</h2>
|
||||
<div class="upload-wrapper">
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
name="file"
|
||||
class="value"
|
||||
:show-file-list="true"
|
||||
:limit="1"
|
||||
:multiple="false"
|
||||
:action="uploadUrl"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:on-remove="onRemove"
|
||||
:on-success="onSuccess"
|
||||
:headers="headers"
|
||||
>
|
||||
<el-button size="small" type="primary" round>{{ $t('luma.button.uploadStartImageUrl') }}</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
<info-icon :content="$t('luma.description.startImageUrl')" class="info" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElButton, ElUpload, ElMessage, UploadFiles } from 'element-plus';
|
||||
import { getBaseUrlPlatform } from '@/utils';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
export const DEFAULT_CONTENT = '';
|
||||
|
||||
interface IData {
|
||||
fileList: UploadFiles;
|
||||
uploadUrl: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'StartImageUrlInput',
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
InfoIcon
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
fileList: [],
|
||||
uploadUrl: getBaseUrlPlatform() + '/api/v1/files/'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
headers() {
|
||||
return {
|
||||
Authorization: `Bearer ${this.$store.state.token.access}`
|
||||
};
|
||||
},
|
||||
urls(): string[] {
|
||||
// @ts-ignore
|
||||
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
|
||||
},
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.luma?.config?.start_image_url;
|
||||
},
|
||||
set(val: string) {
|
||||
const url = this.urls?.[0];
|
||||
this.$store.commit('luma/setConfig', {
|
||||
...this.$store.state.luma?.config,
|
||||
start_image_url: url
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = undefined;
|
||||
}
|
||||
this.onSetStartImageUrl();
|
||||
},
|
||||
methods: {
|
||||
onExceed() {
|
||||
ElMessage.warning(this.$t('luma.message.uploadStartImageExceed'));
|
||||
},
|
||||
onError() {
|
||||
ElMessage.error(this.$t('luma.message.uploadStartImageError'));
|
||||
},
|
||||
async onRemove() {
|
||||
ElMessage.error(this.$t('luma.message.uploadStartImageError'));
|
||||
},
|
||||
onSetStartImageUrl() {
|
||||
const url = this.urls?.[0];
|
||||
this.$store.commit('luma/setConfig', {
|
||||
...this.$store.state.luma?.config,
|
||||
start_image_url: url
|
||||
});
|
||||
},
|
||||
async onSuccess() {
|
||||
this.onSetStartImageUrl();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between; // Distribute space evenly
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
margin-left: 60px; // Adjust this value as needed
|
||||
}
|
||||
.upload-wrapper {
|
||||
transform: translate(-26px, 5px); // Move left and down
|
||||
}
|
||||
.info {
|
||||
margin-left: auto; // Pushes the info icon to the right
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,26 +1,39 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('luma.name.videoUrl') }}</h2>
|
||||
<div class="upload-wrapper">
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
accept=".mp4"
|
||||
name="file"
|
||||
class="value"
|
||||
:show-file-list="true"
|
||||
:limit="1"
|
||||
:multiple="false"
|
||||
:action="uploadUrl"
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:on-success="onSuccess"
|
||||
:headers="headers"
|
||||
>
|
||||
<el-button size="small" type="primary" round>{{ $t('luma.button.uploadVideoUrl') }}</el-button>
|
||||
</el-upload>
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('luma.name.videoUrl') }}</span>
|
||||
<info-icon :content="$t('luma.description.videoUrl')" />
|
||||
</div>
|
||||
</div>
|
||||
<info-icon :content="$t('luma.description.videoUrl')" class="info" />
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
accept=".mp4"
|
||||
name="file"
|
||||
class="value"
|
||||
:show-file-list="true"
|
||||
:limit="1"
|
||||
:multiple="false"
|
||||
:action="uploadUrl"
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:on-success="onSuccess"
|
||||
:headers="headers"
|
||||
>
|
||||
<template #file="{ file }">
|
||||
<file-preview
|
||||
:url="file.url || file.response?.file_url"
|
||||
:name="file.name"
|
||||
:percentage="file.percentage"
|
||||
@remove="fileList.splice(fileList.indexOf(file), 1)"
|
||||
/>
|
||||
</template>
|
||||
<el-button round type="primary" size="small" class="btn btn-upload">
|
||||
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-1" />
|
||||
{{ $t('luma.button.uploadVideoUrl') }}
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -29,6 +42,9 @@ import { defineComponent } from 'vue';
|
||||
import { ElButton, ElUpload, ElMessage, UploadFiles } from 'element-plus';
|
||||
import { getBaseUrlPlatform } from '@/utils';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
import FilePreview from '@/components/common/FilePreview.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
export const DEFAULT_CONTENT = '';
|
||||
|
||||
interface IData {
|
||||
@@ -41,7 +57,9 @@ export default defineComponent({
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
InfoIcon
|
||||
InfoIcon,
|
||||
FilePreview,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
@@ -115,25 +133,14 @@ export default defineComponent({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between; // Distribute space evenly
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
margin-left: 60px; // Adjust this value as needed
|
||||
}
|
||||
.upload-wrapper {
|
||||
transform: translate(-26px, 5px); // Move left and down
|
||||
}
|
||||
.info {
|
||||
margin-left: auto; // Pushes the info icon to the right
|
||||
}
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.btn.btn-upload {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="bot">
|
||||
{{ $t('luma.name.lumaBot') }}
|
||||
<span class="datetime">
|
||||
{{ $dayjs.format('' + new Date(parseFloat(modelValue?.created_at || '') * 1000)) }}
|
||||
{{ $dayjs.format('' + new Date(parseFloat((modelValue?.created_at || '').toString()) * 1000)) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
@@ -21,12 +21,12 @@
|
||||
</div>
|
||||
<!-- Display success message -->
|
||||
<div v-if="modelValue?.response?.success === true" :class="{ content: true, failed: true }">
|
||||
<div class="image-wrapper">
|
||||
<VideoPlayer :model-value="modelValue" />
|
||||
<div v-if="modelValue.response.video_url" class="mb-4">
|
||||
<video-player :src="modelValue.response.video_url" />
|
||||
</div>
|
||||
<div v-if="modelValue?.response && !config?.custom" :class="{ operations: true, 'mt-2': true }">
|
||||
<div v-if="modelValue?.response && !config?.custom" :class="{ operations: true, 'mt-2': true, 'mb-4': true }">
|
||||
<el-tooltip class="box-item" effect="dark" :content="$t('luma.message.extendVideo')" placement="top-start">
|
||||
<el-button type="info" size="small" class="btn-action" @click="onExtend($event, modelValue?.response)">
|
||||
<el-button type="info" size="small" class="btn-action" @click.stop="onExtend($event, modelValue?.response)">
|
||||
{{ $t('luma.button.extend') }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
@@ -35,18 +35,18 @@
|
||||
type="info"
|
||||
size="small"
|
||||
class="btn-action"
|
||||
@click="onDownload($event, modelValue?.response?.video_url)"
|
||||
@click.stop="onDownload($event, modelValue?.response?.video_url)"
|
||||
>
|
||||
{{ $t('luma.button.download') }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-alert :closable="false" class="mt-2 success">
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('luma.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
@@ -60,23 +60,23 @@
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('luma.name.failure') }}
|
||||
</template>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('luma.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-circle-info" class="mr-1" />
|
||||
{{ $t('luma.name.failureReason') }}:
|
||||
{{ modelValue?.response?.error?.message }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.error?.message!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.response?.error?.message!" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('luma.name.traceId') }}:
|
||||
{{ modelValue?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
@@ -98,7 +98,7 @@
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('luma.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
@@ -112,7 +112,8 @@ import { ElImage, ElAlert, ElButton, ElTooltip } from 'element-plus';
|
||||
import { ILumaTask, ILumaGenerateResponse } from '@/models';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import VideoPlayer from '../VideoPlayer.vue';
|
||||
import VideoPlayer from '@/components/common/VideoPlayer.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TaskPreview',
|
||||
components: {
|
||||
@@ -143,7 +144,6 @@ export default defineComponent({
|
||||
},
|
||||
methods: {
|
||||
onExtend(event: MouseEvent, response: ILumaGenerateResponse) {
|
||||
event.stopPropagation();
|
||||
// extend url here
|
||||
console.debug('set config', response);
|
||||
this.$store.commit('luma/setConfig', {
|
||||
@@ -156,32 +156,8 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
onDownload(event: MouseEvent, video_url: string) {
|
||||
event.stopPropagation();
|
||||
console.log('on download');
|
||||
// download url here
|
||||
window.open(video_url, '_blank');
|
||||
},
|
||||
onReload(event: Event) {
|
||||
const target = event.target as HTMLImageElement;
|
||||
// append a random url query to existing url query, to force reload the image
|
||||
// extract exiting url query
|
||||
const url = new URL(target.src);
|
||||
// extract `retry` query
|
||||
const retry = url.searchParams.get('retry');
|
||||
if (!retry) {
|
||||
// if no retry query, set it as random string
|
||||
url.searchParams.set('retry', '1');
|
||||
} else if (parseInt(retry) < 2) {
|
||||
// if retry < 3, increase it by 1
|
||||
url.searchParams.set('retry', (parseInt(retry) + 1).toString());
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// set the new url
|
||||
target.src = url.toString();
|
||||
},
|
||||
onOpenVideo(url: string) {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -251,94 +227,6 @@ $left-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.image-wrapper {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
min-height: 50px;
|
||||
min-width: 100px;
|
||||
.image {
|
||||
max-height: 400px;
|
||||
max-width: 500px;
|
||||
display: block;
|
||||
width: fit-content;
|
||||
}
|
||||
.btn-raw {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
}
|
||||
.play-icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 48px;
|
||||
color: white;
|
||||
z-index: 500;
|
||||
pointer-events: none; /* Ensure the icon doesn't interfere with hover */
|
||||
}
|
||||
&:hover {
|
||||
.image {
|
||||
filter: brightness(0.6);
|
||||
}
|
||||
.btn-raw {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.play-icon {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.operations {
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 14px;
|
||||
overflow-y: scroll;
|
||||
|
||||
&.full {
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
.btn-action {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.preview {
|
||||
.image.error {
|
||||
background: var(--el-bg-color-page);
|
||||
.image-slot {
|
||||
font-size: 14px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
.failure {
|
||||
background: var(--el-fill-color-light);
|
||||
width: 100%;
|
||||
.el-alert__content {
|
||||
p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -80,7 +80,7 @@
|
||||
"description": "要生成的 QR 码的高级设置"
|
||||
},
|
||||
"name.custom": {
|
||||
"message": "自定义视频扩展",
|
||||
"message": "上传视频扩展",
|
||||
"description": "自定义扩展视频"
|
||||
},
|
||||
"name.extend": {
|
||||
|
||||
@@ -16,7 +16,7 @@ import ConfigPanel from '@/components/kling/ConfigPanel.vue';
|
||||
import { klingOperator } from '@/operators';
|
||||
import { IKlingGenerateRequest, Status } from '@/models';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ERROR_CODE_DUPLICATION, ERROR_CODE_USED_UP } from '@/constants';
|
||||
import { ERROR_CODE_USED_UP } from '@/constants';
|
||||
import RecentPanel from '@/components/kling/RecentPanel.vue';
|
||||
import { IKlingTask } from '@/models';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<config-panel @generate="onGenerate" />
|
||||
</template>
|
||||
<template #result>
|
||||
<recent-panel class="panel recent" @reach-top="onReachTop" />
|
||||
<recent-panel @reach-top="onReachTop" />
|
||||
</template>
|
||||
</layout>
|
||||
</template>
|
||||
@@ -13,10 +13,10 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import Layout from '@/layouts/Luma.vue';
|
||||
import ConfigPanel from '@/components/luma/ConfigPanel.vue';
|
||||
import { applicationOperator, lumaOperator } from '@/operators';
|
||||
import { IApplicationDetailResponse, ILumaGenerateRequest, Status } from '@/models';
|
||||
import { lumaOperator } from '@/operators';
|
||||
import { ILumaGenerateRequest, Status } from '@/models';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ERROR_CODE_DUPLICATION, ERROR_CODE_USED_UP } from '@/constants';
|
||||
import { ERROR_CODE_USED_UP } from '@/constants';
|
||||
import RecentPanel from '@/components/luma/RecentPanel.vue';
|
||||
import { ILumaTask } from '@/models';
|
||||
|
||||
@@ -47,27 +47,15 @@ export default defineComponent({
|
||||
loading() {
|
||||
return this.$store.state.luma?.status?.getApplications === Status.Request;
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.luma.service;
|
||||
},
|
||||
credential() {
|
||||
return this.$store.state.luma.credential;
|
||||
},
|
||||
config() {
|
||||
return this.$store.state.luma.config;
|
||||
},
|
||||
initializing() {
|
||||
return this.$store.state.luma.status.getApplications === Status.Request;
|
||||
},
|
||||
needApply() {
|
||||
return this.$store.state.luma.status.getApplications === Status.Success && !this.application;
|
||||
},
|
||||
application() {
|
||||
return this.$store.state.luma.application;
|
||||
},
|
||||
applications() {
|
||||
return this.$store.state.luma.applications;
|
||||
},
|
||||
tasks() {
|
||||
return this.$store.state.luma.tasks;
|
||||
}
|
||||
@@ -117,26 +105,9 @@ export default defineComponent({
|
||||
console.debug('end onGetApplication');
|
||||
await this.onGetTasks();
|
||||
},
|
||||
onApply() {
|
||||
applicationOperator
|
||||
.create({
|
||||
// @ts-ignore
|
||||
application: this.application
|
||||
})
|
||||
.then(({ data: data }: { data: IApplicationDetailResponse }) => {
|
||||
this.application = data;
|
||||
ElMessage.success(this.$t('application.message.applySuccessfully'));
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error?.response?.data?.code === ERROR_CODE_DUPLICATION) {
|
||||
ElMessage.error(this.$t('application.message.alreadyApplied'));
|
||||
}
|
||||
});
|
||||
},
|
||||
async onScrollDown() {
|
||||
setTimeout(() => {
|
||||
// scroll to bottom for `.recent`
|
||||
const el = document.querySelector('.recent');
|
||||
const el = document.querySelector('.tasks');
|
||||
if (el) {
|
||||
el.scrollTop = el.scrollHeight;
|
||||
}
|
||||
@@ -173,9 +144,6 @@ export default defineComponent({
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage.success(this.$t('luma.message.startTaskSuccess'));
|
||||
this.$store.commit('luma/setConfig', {
|
||||
config: undefined
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
const response = error?.response?.data;
|
||||
@@ -195,27 +163,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.status {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.panel {
|
||||
&.detail {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
&.recent {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
justify-content: initial;
|
||||
}
|
||||
&.operation {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -55,9 +55,6 @@ export default defineComponent({
|
||||
tasks() {
|
||||
return this.$store.state.midjourney.tasks;
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.midjourney.service;
|
||||
},
|
||||
credential() {
|
||||
return this.$store.state.midjourney.credential;
|
||||
},
|
||||
@@ -67,18 +64,9 @@ export default defineComponent({
|
||||
loading() {
|
||||
return this.$store.state.midjourney.status.getApplications === Status.Request;
|
||||
},
|
||||
initializing() {
|
||||
return this.$store.state.midjourney.status.getApplications === Status.Request;
|
||||
},
|
||||
needApply() {
|
||||
return this.$store.state.midjourney.status.getApplications === Status.Success && !this.application;
|
||||
},
|
||||
application() {
|
||||
return this.$store.state.midjourney.application;
|
||||
},
|
||||
applications() {
|
||||
return this.$store.state.midjourney.applications;
|
||||
},
|
||||
finalPrompt(): string {
|
||||
let content = '';
|
||||
if (this.config.references && this.config.references?.length > 0) {
|
||||
@@ -181,7 +169,6 @@ export default defineComponent({
|
||||
},
|
||||
methods: {
|
||||
async onReachTop() {
|
||||
console.debug('ddasdasdreached top');
|
||||
await this.onGetTasks({
|
||||
createdAtMax: this.tasks?.items?.[0]?.created_at
|
||||
});
|
||||
@@ -248,11 +235,9 @@ export default defineComponent({
|
||||
await this.onStartTask(request);
|
||||
},
|
||||
async onScrollDown() {
|
||||
await this.$nextTick(); // 确保 DOM 更新完成后再执行滚动操作
|
||||
await this.$nextTick();
|
||||
setTimeout(() => {
|
||||
// scroll to bottom for `.tasks`
|
||||
const el = document.querySelector('.tasks');
|
||||
|
||||
if (el) {
|
||||
el.scrollTop = el.scrollHeight;
|
||||
}
|
||||
|
||||
@@ -2578,11 +2578,6 @@ eslint-plugin-promise@^5.0.0:
|
||||
resolved "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-5.2.0.tgz"
|
||||
integrity sha512-SftLb1pUG01QYq2A/hGAWfDRXqYD82zE7j7TopDOyNdU+7SvvoXREls/+PRTY17vUXzXnZA/zfnyKgRH6x4JJw==
|
||||
|
||||
eslint-plugin-unused-imports@^4.1.4:
|
||||
version "4.1.4"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-4.1.4.tgz#62ddc7446ccbf9aa7b6f1f0b00a980423cda2738"
|
||||
integrity sha512-YptD6IzQjDardkl0POxnnRBhU1OEePMV0nd6siHaRBbd+lyh6NAhFEobiznKU7kTsSsDeSD62Pe7kAM1b7dAZQ==
|
||||
|
||||
eslint-plugin-vue@^8.5.0:
|
||||
version "8.5.0"
|
||||
resolved "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-8.5.0.tgz"
|
||||
|
||||
Reference in new issue
Block a user