update style

This commit is contained in:
AceDataCloud committed 2023-10-07 02:15:10 +08:00
1 parent a4923acd46
commit ab976d3834
8 files changed
+523 -59

No files matched your search

@@ -0,0 +1,64 @@
<template>
<div class="field">
<h2 class="title">变异度</h2>
<el-slider v-model="value" :min="0" :max="100" :step="1" class="value" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider } from 'element-plus';
const DEFAULT_CHAOS = 0;
export default defineComponent({
name: 'ChaosSelector',
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_CHAOS;
}
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>
+116
View File
@@ -0,0 +1,116 @@
<template>
<div>
<h2 class="title">模型</h2>
<div class="items">
<div
v-for="(option, optionKey) in options"
:key="optionKey"
:class="{ active: active === optionKey, item: true }"
@click="
active = optionKey;
value = option.value;
"
>
<el-image :src="option.image" fit="cover" class="image" />
<p class="name">
{{ option.label }}
</p>
</div>
</div>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElImage } from 'element-plus';
export default defineComponent({
name: 'ModelSelector',
components: {
ElImage
},
props: {
modelValue: {
type: String,
default: undefined
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue,
active: 0,
options: [
{
value: 'MJ',
label: '通用',
image: 'https://cdn.zhishuyun.com/2023-10-06-174633.png'
},
{
value: 'NIJI',
label: '动漫',
image: 'https://cdn.zhishuyun.com/2023-10-06-174008.png'
}
]
};
},
watch: {
modelValue(val) {
if (val !== this.value) {
this.value = val;
}
},
value(val) {
this.$emit('update:modelValue', val);
}
},
mounted() {
this.$emit('update:modelValue', this.value);
}
});
</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: 115px;
height: 60px;
border: 2px solid #eee;
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
border-radius: 5px;
position: relative;
.image {
width: 100%;
height: 100%;
}
.name {
display: block;
font-size: 18px;
color: white;
position: absolute;
top: 12px;
text-align: center;
}
&.active {
border-color: var(--el-color-primary);
.rect {
border-color: var(--el-color-primary);
}
}
}
}
</style>
+33 -14
View File
@@ -1,32 +1,51 @@
<template>
<ratio-selector />
<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" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import RatioSelector from './RatioSelecor.vue';
import RatioSelector from './RatioSelector.vue';
import VersionSelector from './VersionSelector.vue';
import StylizeSelector from './StylizeSelector.vue';
import ChaosSelector from './ChaosSelector.vue';
import ModelSelector from './ModelSelector.vue';
export default defineComponent({
name: 'PresetPanel',
components: {
RatioSelector
ModelSelector,
RatioSelector,
VersionSelector,
StylizeSelector,
ChaosSelector
},
data() {
return {
options: [
{
value: '1:1',
label: '1:1'
}
]
preset: {
ratio: undefined,
version: undefined,
stylize: undefined,
chaos: undefined
}
};
}
});
</script>
<style lang="scss">
.item {
width: 60px;
height: 100px;
<style lang="scss" scoped>
.panel {
border-right: 1px solid var(--el-border-color);
height: 100%;
padding: 10px;
background-color: var(--el-bg-color);
.block {
margin-bottom: 15px;
}
}
</style>
@@ -1,44 +0,0 @@
<template>
<div>
<div v-for="(option, optionKey) in options" :key="optionKey" class="item">
<div class="preview" :class="option.label">
<div class="rect"></div>
</div>
<p>
{{ option.label }}
</p>
</div>
</div>
</template>
<script>
import { defineComponent } from 'vue';
export default defineComponent({
name: 'RatioSelector',
data() {
return {
options: [
{
value: '1:1',
label: '1:1'
}
]
};
}
});
</script>
<style lang="scss">
.item {
width: 30px;
height: 50px;
border: 2px solid red;
.preview {
width: 30px;
height: 30px;
border: 1px solid blue;
}
}
</style>
+147
View File
@@ -0,0 +1,147 @@
<template>
<div>
<h2 class="title">图片比例</h2>
<div class="items">
<div
v-for="(option, optionKey) in options"
:key="optionKey"
:class="{ active: active === optionKey, item: true }"
@click="
active = optionKey;
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';
const DEFAULT_RATIO = '1:1';
export default defineComponent({
name: 'RatioSelector',
props: {
modelValue: {
type: String,
default: undefined
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue,
active: 0,
options: [
{
value: '1:1',
label: '1:1',
width: 15,
height: 15
},
{
value: '4:3',
label: '4:3',
width: 16,
height: 12
},
{
value: '3:4',
label: '3:4',
width: 12,
height: 16
},
{
value: '16:9',
label: '16:9',
width: 16,
height: 9
},
{
value: '9:16',
label: '9:16',
width: 9,
height: 16
}
]
};
},
watch: {
modelValue(val) {
if (val !== this.value) {
this.value = val;
}
},
value(val) {
this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_RATIO;
}
this.$emit('update:modelValue', this.value);
}
});
</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: 40px;
height: 60px;
border: 2px solid #eee;
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
border-radius: 5px;
.preview {
width: 30px;
height: 30px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
.rect {
border: 2px solid #eee;
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,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_STYLIZE = 100;
export default defineComponent({
name: 'StylizeSelector',
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_STYLIZE;
}
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>
@@ -0,0 +1,98 @@
<template>
<div class="field">
<h2 class="title">版本</h2>
<el-select v-model="value" class="value" placeholder="Select" size="small">
<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';
const DEFAULT_VERSION = '5.2';
export default defineComponent({
name: 'VersionSelector',
components: {
ElSelect,
ElOption
},
props: {
modelValue: {
type: String,
default: undefined
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue,
active: 0,
options: [
{
value: '5.2',
label: '5.2'
},
{
value: '5.1',
label: '5.1'
},
{
value: '5.0',
label: '5'
},
{
value: '4',
label: '4'
},
{
value: '3',
label: '3'
},
{
value: '2',
label: '2'
},
{
value: '1',
label: '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_VERSION;
}
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 -1
View File
@@ -26,7 +26,7 @@ export default defineComponent({
display: flex;
flex-direction: row;
.presets {
width: 300px;
width: 260px;
height: 100%;
background-color: var(--el-bg-color-page);
}