Add kling (#200)
This commit is contained in:
1 parent
e12c9d96cc
commit
5f0ec79e83
43 files changed
+2718
No files matched your search
@@ -9,6 +9,9 @@
|
||||
<el-menu-item v-if="site?.features?.hailuo?.enabled" index="/hailuo" @click="$router.push('/hailuo')">
|
||||
{{ $t('common.nav.hailuo') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item v-if="site?.features?.kling?.enabled" index="/kling" @click="$router.push('/kling')">
|
||||
{{ $t('common.nav.kling') }}
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
<div class="config">
|
||||
<prompt-input class="mb-4" />
|
||||
<model-selector class="mb-4" />
|
||||
<mode-selector class="mb-4" />
|
||||
<ratio-selector class="mb-4" />
|
||||
<start-image class="mb-4" />
|
||||
<end-image class="mb-4" />
|
||||
<cfg-scale-selector class="mb-4" />
|
||||
<duration-selector class="mb-4" />
|
||||
<negative-prompt-input class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button
|
||||
v-if="config?.video_url !== undefined || config?.custom"
|
||||
type="primary"
|
||||
class="btn w-full"
|
||||
round
|
||||
@click="onGenerate"
|
||||
>
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('kling.button.extend') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('kling.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElButton } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import ModelSelector from './config/ModelSelector.vue';
|
||||
import ModeSelector from './config/ModeSelector.vue';
|
||||
import DurationSelector from './config/DurationSelector.vue';
|
||||
import RatioSelector from './config/RatioSelector.vue';
|
||||
import StartImage from './config/StartImage.vue';
|
||||
import EndImage from './config/EndImage.vue';
|
||||
import CfgScaleSelector from './config/CfgScaleSelector.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import NegativePromptInput from './config/NegativePromptInput.vue';
|
||||
export default defineComponent({
|
||||
name: 'PresetPanel',
|
||||
components: {
|
||||
ElButton,
|
||||
FontAwesomeIcon,
|
||||
PromptInput,
|
||||
NegativePromptInput,
|
||||
ModelSelector,
|
||||
ModeSelector,
|
||||
DurationSelector,
|
||||
RatioSelector,
|
||||
StartImage,
|
||||
CfgScaleSelector,
|
||||
EndImage
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
config() {
|
||||
return this.$store.state.kling?.config;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onGenerate() {
|
||||
this.$emit('generate');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: calc(100% - 40px);
|
||||
.config {
|
||||
width: 100%;
|
||||
height: calc(100% - 50px);
|
||||
flex: 1;
|
||||
}
|
||||
.actions {
|
||||
height: 50px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="panel detail">
|
||||
<task-detail />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskDetail from './task/Detail.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'DetailPanel',
|
||||
components: {
|
||||
TaskDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
job: 0
|
||||
};
|
||||
},
|
||||
computed: {}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,77 @@
|
||||
<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('kling.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>
|
||||
@@ -0,0 +1,143 @@
|
||||
<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">
|
||||
<!-- {{ tasks?.items }} -->
|
||||
<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('kling.message.noTasks') }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskPreview from './task/Preview.vue';
|
||||
import { ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RecentPanel',
|
||||
components: {
|
||||
TaskPreview,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem
|
||||
},
|
||||
emits: ['reach-top'],
|
||||
data() {
|
||||
return {
|
||||
job: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
tasks() {
|
||||
// reverse the order of the tasks.items
|
||||
return {
|
||||
...this.$store.state.kling?.tasks,
|
||||
items: this.$store.state.kling?.tasks?.items?.slice()
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onHandleScroll() {
|
||||
const el = this.$refs.panel as HTMLElement;
|
||||
console.log('reach-top reach-top reach-top');
|
||||
if (el.scrollTop === 0) {
|
||||
this.$emit('reach-top');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</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>
|
||||
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div>
|
||||
<vue-plyr :options="options" class="video">
|
||||
<video controls crossorigin playsinline>
|
||||
<source size="1080" :src="modelValue?.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 { 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,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
options: { quality: { default: '1080p' } }
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video {
|
||||
max-width: 100%;
|
||||
height: 450px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('kling.name.cfgScale') }}</span>
|
||||
<info-icon :content="$t('kling.description.cfgScale')" />
|
||||
</div>
|
||||
<div class="flex justify-end items-center">
|
||||
<el-input-number v-model="value" size="small" controls-position="right" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<el-slider v-model="value" :min="0" :max="1" :step="0.1" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSlider, ElInputNumber } from 'element-plus';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
import { KLING_DEFAULT_CFG_SCALE } from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CfgScaleSelector',
|
||||
components: {
|
||||
ElSlider,
|
||||
InfoIcon,
|
||||
ElInputNumber
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state?.kling?.config?.cfg_scale;
|
||||
},
|
||||
set(val) {
|
||||
console.debug('set cfg_scale', val);
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state?.kling?.config,
|
||||
cfg_scale: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = KLING_DEFAULT_CFG_SCALE;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('kling.name.duration') }}</h2>
|
||||
<el-select v-model="value" class="value" :placeholder="$t('kling.placeholder.select')">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSelect, ElOption } from 'element-plus';
|
||||
import { KLING_DEFAULT_DURATION } from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'DurationSelector',
|
||||
components: {
|
||||
ElSelect,
|
||||
ElOption
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
data() {
|
||||
return {
|
||||
options: [
|
||||
{
|
||||
value: 5,
|
||||
label: '5秒'
|
||||
},
|
||||
{
|
||||
value: 10,
|
||||
label: '10秒'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.kling?.config?.duration;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state.kling.config,
|
||||
duration: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = KLING_DEFAULT_DURATION;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('kling.name.endImage') }}</span>
|
||||
<info-icon :content="$t('kling.description.uploadEndImage')" />
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
:limit="5"
|
||||
class="upload-wrapper"
|
||||
:multiple="false"
|
||||
:action="uploadUrl"
|
||||
list-type="picture"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:on-success="onSuccess"
|
||||
:headers="headers"
|
||||
>
|
||||
<el-button round type="primary" size="small" class="btn btn-upload">
|
||||
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-1" />
|
||||
{{ $t('kling.button.uploadReferences') }}
|
||||
</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';
|
||||
|
||||
interface IData {
|
||||
fileList: UploadFiles;
|
||||
uploadUrl: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'EndImage',
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
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?.kling?.config?.start_image_url;
|
||||
},
|
||||
set(val: string) {
|
||||
// this.$store.commit('kling/setConfig', {
|
||||
// ...this.$store.state?.kling?.config,
|
||||
// start_image_url: val
|
||||
// });
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = undefined;
|
||||
}
|
||||
this.onSetEndImageUrl();
|
||||
},
|
||||
methods: {
|
||||
onExceed() {
|
||||
ElMessage.warning(this.$t('kling.message.uploadReferencesExceed'));
|
||||
},
|
||||
onError() {
|
||||
ElMessage.error(this.$t('kling.message.uploadReferencesError'));
|
||||
},
|
||||
onSetEndImageUrl() {
|
||||
const url = this.urls?.[0];
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state.kling?.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>
|
||||
|
||||
<style lang="scss">
|
||||
.upload-wrapper {
|
||||
height: auto;
|
||||
display: flex;
|
||||
.el-upload-list {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('kling.name.mode') }}</h2>
|
||||
<el-select v-model="value" class="value" :placeholder="$t('kling.placeholder.select')">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSelect, ElOption } from 'element-plus';
|
||||
import { KLING_DEFAULT_MODE } from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ModeSelector',
|
||||
components: {
|
||||
ElSelect,
|
||||
ElOption
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
data() {
|
||||
return {
|
||||
options: [
|
||||
{
|
||||
value: 'std',
|
||||
label: '标准'
|
||||
},
|
||||
{
|
||||
value: 'pro',
|
||||
label: '高速'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.kling?.config?.mode;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state.kling.config,
|
||||
mode: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = KLING_DEFAULT_MODE;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('pika.name.model') }}</h2>
|
||||
<el-select v-model="value" class="value" :placeholder="$t('pika.placeholder.select')">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSelect, ElOption } from 'element-plus';
|
||||
import { KLING_DEFAULT_MODEL } from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ModelSelector',
|
||||
components: {
|
||||
ElSelect,
|
||||
ElOption
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
data() {
|
||||
return {
|
||||
options: [
|
||||
{
|
||||
value: 'kling-v1',
|
||||
label: 'kling-v1'
|
||||
},
|
||||
{
|
||||
value: 'kling-v1-5',
|
||||
label: 'kling-v1-5'
|
||||
},
|
||||
{
|
||||
value: 'kling-v1-6',
|
||||
label: 'kling-v1-6'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.kling?.config?.model;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state.kling.config,
|
||||
model: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = KLING_DEFAULT_MODEL;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<div class="box">
|
||||
<h2 class="title font-bold">{{ $t('kling.name.negativePrompt') }}</h2>
|
||||
<info-icon :content="$t('kling.description.negativePrompt')" class="info" />
|
||||
</div>
|
||||
<el-input
|
||||
v-model="prompt"
|
||||
:rows="3"
|
||||
type="textarea"
|
||||
class="prompt"
|
||||
:placeholder="$t('kling.placeholder.negativePrompt')"
|
||||
:maxlength="200"
|
||||
show-word-limit
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElInput } from 'element-plus';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
|
||||
export const DEFAULT_NEGATIVE_PROMPT = '';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NegativePromptInput',
|
||||
components: {
|
||||
ElInput,
|
||||
InfoIcon
|
||||
},
|
||||
computed: {
|
||||
prompt: {
|
||||
get() {
|
||||
return this.$store.state.kling?.config?.negative_prompt;
|
||||
},
|
||||
set(val) {
|
||||
console.debug('set prompt', val);
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state.kling?.config,
|
||||
negative_prompt: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = DEFAULT_NEGATIVE_PROMPT;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between; // Add this line to move the icon to the right
|
||||
position: relative;
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
.info {
|
||||
margin-left: auto; // Ensure the icon stays on the right
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<div class="box">
|
||||
<h2 class="title font-bold">{{ $t('kling.name.prompt') }}</h2>
|
||||
<info-icon :content="$t('kling.description.prompt')" class="info" />
|
||||
</div>
|
||||
<el-input
|
||||
v-model="prompt"
|
||||
:rows="3"
|
||||
type="textarea"
|
||||
class="prompt"
|
||||
:placeholder="$t('kling.placeholder.prompt')"
|
||||
:maxlength="500"
|
||||
show-word-limit
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElInput } from 'element-plus';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
|
||||
export const DEFAULT_PROMPT = '';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PromptInput',
|
||||
components: {
|
||||
ElInput,
|
||||
InfoIcon
|
||||
},
|
||||
computed: {
|
||||
prompt: {
|
||||
get() {
|
||||
return this.$store.state.kling?.config?.prompt;
|
||||
},
|
||||
set(val) {
|
||||
console.debug('set prompt', val);
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state.kling?.config,
|
||||
prompt: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = DEFAULT_PROMPT;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between; // Add this line to move the icon to the right
|
||||
position: relative;
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
.info {
|
||||
margin-left: auto; // Ensure the icon stays on the right
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<div>
|
||||
<span class="text-sm font-bold mb-2 block">{{ $t('kling.name.ratio') }}</span>
|
||||
<div class="items">
|
||||
<div
|
||||
v-for="(option, optionKey) in options"
|
||||
:key="optionKey"
|
||||
:class="{ active: active === optionKey, item: true }"
|
||||
@click="value = option.value"
|
||||
>
|
||||
<div class="preview" :class="option.label">
|
||||
<div class="rect" :style="{ width: option.width + 'px', height: option.height + 'px' }"></div>
|
||||
</div>
|
||||
<p class="name">
|
||||
{{ option.label }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { KLING_DEFAULT_ASPECT_RATIO } from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RatioSelector',
|
||||
data() {
|
||||
return {
|
||||
options: [
|
||||
{
|
||||
value: '1:1',
|
||||
label: '1:1',
|
||||
width: 20,
|
||||
height: 20
|
||||
},
|
||||
{
|
||||
value: '16:9',
|
||||
label: '16:9',
|
||||
width: 25,
|
||||
height: 13
|
||||
},
|
||||
{
|
||||
value: '9:16',
|
||||
label: '9:16',
|
||||
width: 13,
|
||||
height: 25
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
active() {
|
||||
return this.options.findIndex((option) => option.value === this.value) || 0;
|
||||
},
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state?.kling?.config?.aspect_ratio;
|
||||
},
|
||||
set(val) {
|
||||
console.debug('set ratio', val);
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state?.kling?.config,
|
||||
aspect_ratio: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = KLING_DEFAULT_ASPECT_RATIO;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.items {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.item {
|
||||
width: 48px;
|
||||
height: 65px;
|
||||
border: 2px solid var(--el-border-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
|
||||
.preview {
|
||||
margin-top: 8px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.rect {
|
||||
border: 2px solid var(--el-border-color);
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--el-color-primary);
|
||||
.rect {
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('kling.name.startImage') }}</span>
|
||||
<info-icon :content="$t('kling.description.uploadStartImage')" />
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
:limit="5"
|
||||
class="upload-wrapper"
|
||||
:multiple="false"
|
||||
:action="uploadUrl"
|
||||
list-type="picture"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:on-success="onSuccess"
|
||||
:headers="headers"
|
||||
>
|
||||
<el-button round type="primary" size="small" class="btn btn-upload">
|
||||
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-1" />
|
||||
{{ $t('kling.button.uploadReferences') }}
|
||||
</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';
|
||||
|
||||
interface IData {
|
||||
fileList: UploadFiles;
|
||||
uploadUrl: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'StartImage',
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
InfoIcon,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
emits: ['change'],
|
||||
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?.kling?.config?.start_image_url;
|
||||
},
|
||||
set(val: string) {
|
||||
// this.$store.commit('kling/setConfig', {
|
||||
// ...this.$store.state?.kling?.config,
|
||||
// start_image_url: val
|
||||
// });
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = undefined;
|
||||
}
|
||||
this.onSetStartImageUrl();
|
||||
},
|
||||
methods: {
|
||||
onExceed() {
|
||||
ElMessage.warning(this.$t('kling.message.uploadReferencesExceed'));
|
||||
},
|
||||
onError() {
|
||||
ElMessage.error(this.$t('kling.message.uploadReferencesError'));
|
||||
},
|
||||
onSetStartImageUrl() {
|
||||
const url = this.urls?.[0];
|
||||
this.$store.commit('kling/setConfig', {
|
||||
...this.$store.state?.kling?.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>
|
||||
|
||||
<style lang="scss">
|
||||
.upload-wrapper {
|
||||
height: auto;
|
||||
display: flex;
|
||||
.el-upload-list {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,343 @@
|
||||
<template>
|
||||
<div class="preview">
|
||||
<div class="left">
|
||||
<el-image src="https://cdn.acedata.cloud/gtt64b.png" class="avatar" />
|
||||
</div>
|
||||
<div class="main">
|
||||
<div class="bot">
|
||||
{{ $t('kling.name.klingBot') }}
|
||||
<span class="datetime">
|
||||
{{ $dayjs.format('' + new Date(parseFloat(modelValue?.created_at || '') * 1000)) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
<p v-if="modelValue?.request?.prompt" class="prompt mt-2">
|
||||
{{ modelValue?.request?.prompt }}
|
||||
<span v-if="!modelValue?.response"> - ({{ $t('kling.status.pending') }}) </span>
|
||||
<span
|
||||
v-if="
|
||||
modelValue?.response?.state === 'submitted' ||
|
||||
modelValue?.response?.state === 'processing' ||
|
||||
modelValue?.response?.state === 'pending' ||
|
||||
modelValue?.response?.state === 'completed'
|
||||
"
|
||||
>
|
||||
- ({{ $t('kling.status.processing') }})
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Display success message -->
|
||||
<div v-if="modelValue?.response?.success === true" :class="{ content: true, failed: true }">
|
||||
<div class="image-wrapper">
|
||||
<VideoPlayer :model-value="modelValue?.response" />
|
||||
</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">
|
||||
<el-button
|
||||
type="info"
|
||||
size="small"
|
||||
class="btn-action"
|
||||
@click="onDownload($event, modelValue?.response.video_url)"
|
||||
>
|
||||
{{ $t('kling.button.download') }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-alert :closable="false" class="mt-2 success">
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('kling.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
<!-- Display error message -->
|
||||
<div v-if="modelValue?.response?.success === false" :class="{ content: true }">
|
||||
<el-alert :closable="false" class="failure">
|
||||
<template #template>
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('kling.name.failure') }}
|
||||
</template>
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('kling.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-circle-info" class="mr-1" />
|
||||
{{ $t('kling.name.failureReason') }}:
|
||||
{{ modelValue?.response?.error?.message }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.error?.message!" class="btn-copy" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('kling.name.traceId') }}:
|
||||
{{ modelValue?.response?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" class="btn-copy" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
<!-- Display error message -->
|
||||
<div
|
||||
v-if="
|
||||
!modelValue?.response ||
|
||||
modelValue?.response?.state === 'processing' ||
|
||||
modelValue?.response?.state === 'pending'
|
||||
"
|
||||
:class="{ content: true }"
|
||||
>
|
||||
<el-alert :closable="false" class="info">
|
||||
<template #template>
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('kling.name.failure') }}
|
||||
</template>
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('kling.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElImage, ElAlert, ElButton, ElTooltip } from 'element-plus';
|
||||
import { IKlingTask, IKlingGenerateResponse, IKlingVideo } from '@/models';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import VideoPlayer from '../VideoPlayer.vue';
|
||||
export default defineComponent({
|
||||
name: 'TaskPreview',
|
||||
components: {
|
||||
ElImage,
|
||||
CopyToClipboard,
|
||||
FontAwesomeIcon,
|
||||
ElAlert,
|
||||
VideoPlayer,
|
||||
ElTooltip,
|
||||
ElButton
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Object as () => IKlingTask | undefined,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
application() {
|
||||
return this.$store.state.kling?.application;
|
||||
},
|
||||
config() {
|
||||
return this.$store.state.kling?.config;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// onExtend(event: MouseEvent, response: IKlingGenerateResponse) {
|
||||
// event.stopPropagation();
|
||||
// // extend url here
|
||||
// console.debug('set config', response);
|
||||
// this.$store.commit('kling/setConfig', {
|
||||
// ...this.$store.state.kling?.config,
|
||||
// video_id: response.video_id,
|
||||
// prompt: response.prompt,
|
||||
// action: 'extend',
|
||||
// thumbnail_url: response.thumbnail_url,
|
||||
// video_url: response.video_url
|
||||
// });
|
||||
// },
|
||||
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');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$left-width: 70px;
|
||||
.preview {
|
||||
width: 100%;
|
||||
height: fit-content;
|
||||
text-align: left;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-bottom: 15px;
|
||||
.left {
|
||||
width: $left-width;
|
||||
.avatar {
|
||||
background-color: rgb(34, 34, 34);
|
||||
padding: 2px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin: 10px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
width: calc(100% - $left-width);
|
||||
padding: 10px 10px 0 10px;
|
||||
|
||||
.bot {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: rgb(46, 204, 113);
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
.datetime {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
color: var(--el-text-color-secondary);
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
.prompt {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: var(--el-text-color-regular);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
.el-alert {
|
||||
border-left-width: 2px;
|
||||
border-left-style: solid;
|
||||
&.failure {
|
||||
border-color: var(--el-color-danger);
|
||||
}
|
||||
&.success {
|
||||
border-color: var(--el-color-success);
|
||||
}
|
||||
&.info {
|
||||
border-color: var(--el-color-info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.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>
|
||||
Reference in new issue
Block a user