update preset

This commit is contained in:
AceDataCloud committed 2023-10-08 02:25:19 +08:00
1 parent e43d40d76e
commit ac78a5ea6f
12 files changed
+353 -50

No files matched your search

@@ -0,0 +1,65 @@
<template>
<div class="field">
<h2 class="title">高级模式</h2>
<el-switch v-model="value" class="ml-2" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSwitch } from 'element-plus';
const DEFAULT_ADVANCED = false;
export default defineComponent({
name: 'AdvancedSelector',
components: {
ElSwitch
},
props: {
modelValue: {
type: Boolean,
default: false
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue
};
},
watch: {
modelValue(val) {
if (val !== this.value) {
this.value = val;
}
},
value(val) {
this.$emit('update:modelValue', val);
}
},
mounted() {
if (this.value === undefined) {
this.value = DEFAULT_ADVANCED;
}
this.$emit('update:modelValue', this.value);
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin-bottom: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
+31 -33
View File
@@ -1,27 +1,16 @@
<template>
<div class="model-selector">
<el-dropdown trigger="click" @command="onCommandChange">
<el-button>
<font-awesome-icon class="icon" icon="fa-regular fa-" />
<span>
{{ value.displayName }}
</span>
<font-awesome-icon icon="fa-solid fa-chevron-down" />
</el-button>
<template #dropdown>
<el-dropdown-menu class="menu">
<el-dropdown-item
v-for="(channel, channelIndex) in options"
:key="channelIndex"
:command="channel"
class="option"
>
<font-awesome-icon :icon="channel.icon" />
{{ channel.displayName }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<div class="channel-selector">
<el-button
v-for="(option, optionKey) in options"
:key="optionKey"
:class="{ button: true, active: option.name === value.name }"
@click="onSelect(option)"
>
<font-awesome-icon :class="{ icon: true, [option.name]: true }" :icon="option.icon" />
<span>
{{ option.displayName }}
</span>
</el-button>
</div>
</template>
@@ -39,9 +28,7 @@ import {
export default defineComponent({
name: 'ModelSelector',
components: {
ElDropdown,
ElButton,
ElDropdownItem,
FontAwesomeIcon
},
props: {
@@ -50,7 +37,7 @@ export default defineComponent({
required: true
}
},
emits: ['update:modelValue'],
emits: ['update:modelValue', 'select'],
data() {
return {
value: this.modelValue,
@@ -64,22 +51,30 @@ export default defineComponent({
}
}
},
mounted() {
this.$emit('update:modelValue', this.value);
this.$emit('select', this.value);
},
methods: {
onCommandChange(command: IMidjourneyChannel) {
this.value = command;
this.$emit('update:modelValue', command);
onSelect(option: IMidjourneyChannel) {
this.value = option;
this.$emit('update:modelValue', option);
this.$emit('select', option);
}
}
});
</script>
<style lang="scss" scoped>
.model-selector {
.channel-selector {
background-color: #ececf1;
padding: 7px 6px;
border-radius: 15px;
margin-bottom: 5px;
.group {
width: 372px;
margin-left: auto;
margin-right: auto;
.button {
padding: 20px 30px;
color: black;
border: none;
@@ -96,10 +91,13 @@ export default defineComponent({
.icon {
display: inline-block;
margin-right: 5px;
&.base {
&.turbo {
color: #ff9900;
}
&.plus {
&.fast {
color: #2dc49c;
}
&.relax {
color: #ce65e6;
}
}
+3 -2
View File
@@ -7,6 +7,7 @@
fit="fill"
class="image"
/>
<p v-if="modelValue?.progress !== undefined">{{ modelValue?.progress }}%</p>
</div>
</template>
@@ -43,8 +44,8 @@ export default defineComponent({
width: 100%;
text-align: center;
.image {
width: 200px;
height: 200px;
width: 300px;
height: 300px;
}
}
</style>
+19 -6
View File
@@ -1,10 +1,14 @@
<template>
<div class="panel">
<model-selector v-model="preset.model" class="block" />
<ratio-selector v-model="preset.ratio" class="block" />
<version-selector v-model="preset.version" class="block" />
<stylize-selector v-model="preset.stylize" class="block" />
<chaos-selector v-model="preset.chaos" class="block" />
<model-selector v-if="false" v-model="preset.model" class="mb-4" />
<ratio-selector v-model="preset.ratio" class="mb-4" />
<quality-selector v-model="preset.quality" class="mb-4" />
<version-selector v-model="preset.version" class="mb-4" />
<advanced-selector v-model="preset.advanced" class="mb-4" />
<stylize-selector v-if="preset.advanced" v-model="preset.stylize" class="mb-4" />
<wired-selector v-if="preset.advanced" v-model="preset.wired" class="mb-4" />
<chaos-selector v-if="preset.advanced" v-model="preset.chaos" class="mb-4" />
<raw-selector v-if="preset.advanced" v-model="preset.raw" class="mb-4" />
</div>
</template>
@@ -15,14 +19,23 @@ import VersionSelector from './VersionSelector.vue';
import StylizeSelector from './StylizeSelector.vue';
import ChaosSelector from './ChaosSelector.vue';
import ModelSelector from './ModelSelector.vue';
import QualitySelector from './QualitySelector.vue';
import WiredSelector from './WiredSelector.vue';
import RawSelector from './RawSelector.vue';
import AdvancedSelector from './AdvancedSelector.vue';
export default defineComponent({
name: 'PresetPanel',
components: {
ModelSelector,
QualitySelector,
RatioSelector,
VersionSelector,
StylizeSelector,
ChaosSelector
ChaosSelector,
WiredSelector,
RawSelector,
AdvancedSelector
},
props: {
modelValue: {
@@ -0,0 +1,85 @@
<template>
<div class="field">
<h2 class="title">画质</h2>
<el-radio-group v-model="value">
<el-radio-button v-for="item in options" :key="item.value" :label="item.value">
{{ item.label }}
</el-radio-button>
</el-radio-group>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElRadioButton, ElRadioGroup } from 'element-plus';
export const DEFAULT_QUALITY = '.5';
export default defineComponent({
name: 'QualitySelector',
components: {
ElRadioButton,
ElRadioGroup
},
props: {
modelValue: {
type: String,
default: undefined
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue,
active: 0,
options: [
{
label: '低',
value: '.25'
},
{
label: '中',
value: '.5'
},
{
label: '高',
value: '1'
}
]
};
},
watch: {
modelValue(val) {
if (val !== this.value) {
this.value = val;
}
},
value(val) {
this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_QUALITY;
}
this.$emit('update:modelValue', this.value);
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin-bottom: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
+65
View File
@@ -0,0 +1,65 @@
<template>
<div class="field">
<h2 class="title">原生</h2>
<el-switch v-model="value" class="ml-2" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSwitch } from 'element-plus';
const DEFAULT_RAW = false;
export default defineComponent({
name: 'RawSelector',
components: {
ElSwitch
},
props: {
modelValue: {
type: Boolean,
default: false
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue
};
},
watch: {
modelValue(val) {
if (val !== this.value) {
this.value = val;
}
},
value(val) {
this.$emit('update:modelValue', val);
}
},
mounted() {
if (this.value === undefined) {
this.value = DEFAULT_RAW;
}
this.$emit('update:modelValue', this.value);
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin-bottom: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
@@ -1,7 +1,7 @@
<template>
<div class="field">
<h2 class="title">版本</h2>
<el-select v-model="value" class="value" placeholder="Select" size="small">
<el-select v-model="value" class="value" placeholder="Select">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
@@ -0,0 +1,64 @@
<template>
<div class="field">
<h2 class="title">怪异度</h2>
<el-slider v-model="value" :min="0" :max="1000" :step="1" class="value" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider } from 'element-plus';
const DEFAULT_WIRED = 0;
export default defineComponent({
name: 'WiredSelector',
components: {
ElSlider
},
props: {
modelValue: {
type: String,
default: undefined
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue
};
},
watch: {
modelValue(val) {
if (val !== this.value) {
this.value = val;
}
},
value(val) {
this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_WIRED;
}
this.$emit('update:modelValue', this.value);
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin-bottom: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>