Update luma experience (#230)
This commit is contained in:
1 parent
1150762ce5
commit
465159c7e5
27 files changed
+404
-944
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user