diff --git a/components/aigc/RatioSelector.vue b/components/aigc/RatioSelector.vue
new file mode 100644
index 0000000..311d544
--- /dev/null
+++ b/components/aigc/RatioSelector.vue
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+ {{ ratio.ratio }}
+
+
+ {{ ratio?.label || getRatio(ratio.ratio).w > getRatio(ratio.ratio).h ? '横向' : '纵向' }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/aigc/drawing/OptionBlock.vue b/components/aigc/drawing/OptionBlock.vue
index 2c4f40b..931b92c 100644
--- a/components/aigc/drawing/OptionBlock.vue
+++ b/components/aigc/drawing/OptionBlock.vue
@@ -22,7 +22,7 @@ const props = defineProps({
{{ label }}
-
+
diff --git a/package.json b/package.json
index 8ed7019..2218cdc 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,8 @@
"nuxt": "^3.10.3",
"radix-vue": "^1.4.9",
"vue": "^3.4.19",
- "vue-router": "^4.3.0"
+ "vue-router": "^4.3.0",
+ "yup": "^1.4.0"
},
"devDependencies": {
"@pinia-plugin-persistedstate/nuxt": "^1.2.0",
diff --git a/pages/aigc/drawing/index.vue b/pages/aigc/drawing/index.vue
index 74f8211..70e2747 100644
--- a/pages/aigc/drawing/index.vue
+++ b/pages/aigc/drawing/index.vue
@@ -6,6 +6,9 @@ import OptionBlock from "~/components/aigc/drawing/OptionBlock.vue";
import ResultBlock from "~/components/aigc/drawing/ResultBlock.vue";
import {useLoginState} from "~/composables/useLoginState";
import ModalAuthentication from "~/components/ModalAuthentication.vue";
+import {type InferType, number, object, string} from "yup";
+import type {FormSubmitEvent} from "#ui/types";
+import RatioSelector from "~/components/aigc/RatioSelector.vue";
useHead({
title: '绘画 | XSH AI'
@@ -17,7 +20,7 @@ const loginState = useLoginState()
const leftSection = ref(null)
const leftHandler = ref(null)
-const handle_mousedown = (e: MouseEvent, min: number = 240, max: number = 400) => {
+const handle_stick_mousedown = (e: MouseEvent, min: number = 240, max: number = 400) => {
const handler = leftHandler.value
if (handler) {
const startX = e.clientX
@@ -42,6 +45,84 @@ const handle_mousedown = (e: MouseEvent, min: number = 240, max: number = 400) =
}
}
+const defaultRatios = [
+ {
+ ratio: '4:3',
+ label: '横向',
+ value: '1024:768',
+ },
+ {
+ ratio: '3:4',
+ label: '竖向',
+ value: '768:1024',
+ },
+ {
+ ratio: '16:9',
+ label: '横向',
+ value: '1920:1080',
+ },
+ {
+ ratio: '9:16',
+ label: '竖向',
+ value: '1080:1920',
+ },
+ {
+ ratio: '1:1',
+ label: '方形',
+ value: '1024:1024',
+ },
+ {
+ ratio: '3:2',
+ label: '横向',
+ value: '960:640',
+ },
+ {
+ ratio: '2:3',
+ label: '竖向',
+ value: '640:960',
+ },
+ {
+ ratio: '16:10',
+ label: '横向',
+ value: '1920:1200',
+ },
+ {
+ ratio: '10:16',
+ label: '竖向',
+ value: '1200:1920',
+ },
+ {
+ ratio: '21:9',
+ label: '横向',
+ value: '2560:1080',
+ },
+ {
+ ratio: '9:21',
+ label: '竖向',
+ value: '1080:2560',
+ },
+]
+
+const defaultFormSchema = object({
+ prompts: string().required('请输入提示词'),
+ negative_prompts: string().required('请输入负面提示词'),
+ resolution: string().required('请选择分辨率'),
+ style: number().required('请选择风格')
+})
+
+type DefaultFormSchema = InferType
+
+const defaultFormState = reactive({
+ prompts: '',
+ negative_prompts: '',
+ resolution: '1024:768',
+ style: 100
+})
+
+const onDefaultFormSubmit = (event: FormSubmitEvent) => {
+ console.log(event)
+}
+
const images = [
image1,
image2,
@@ -49,11 +130,6 @@ const images = [
'https://w.wallhaven.cc/full/jx/wallhaven-jxl31y.png',
'https://w.wallhaven.cc/full/6d/wallhaven-6d7xmx.jpg',
]
-const images2 = [
- image1,
- image2,
- image3,
-]
@@ -64,22 +140,46 @@ const images2 = [
+ @mousedown.prevent="handle_stick_mousedown">
+ class="w-[1px] h-full bg-neutral-300 dark:bg-neutral-700 group-hover:bg-indigo-300 dark:group-hover:bg-indigo-700 group-hover:w-[3px] transition-all group-hover:delay-500 translate-x-1">
-
-
-
- 按钮A
- 按钮B
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -91,7 +191,7 @@ const images2 = [
size="xs">登录
-