feat: tips

This commit is contained in:
2026-04-21 16:44:27 +08:00
parent ec632554e2
commit 4394158d30

View File

@@ -12,7 +12,7 @@
:keyboard="false" :keyboard="false"
> >
<div class="image-clip-dialog-box"> <div class="image-clip-dialog-box">
<div class="header"> <div class="header" :class="{ 'is-product': data.isProduct }">
<div class="title">{{ data.title }}</div> <div class="title">{{ data.title }}</div>
<div class="right"> <div class="right">
<div class="submit" v-if="!data.isPreview" @click="onSubmit"> <div class="submit" v-if="!data.isPreview" @click="onSubmit">
@@ -21,7 +21,9 @@
<button @click="onCancel">Cancel</button> <button @click="onCancel">Cancel</button>
</div> </div>
</div> </div>
<div class="content"> <div class="content" :class="{ 'is-product': data.isProduct }">
<div class="crop-wrapper">
<div v-if="data.isProduct" class="tips">{{ tips }}</div>
<image-clip <image-clip
ref="imageClipRef" ref="imageClipRef"
v-bind="$attrs" v-bind="$attrs"
@@ -31,6 +33,7 @@
:type="type" :type="type"
@change="(v) => (data.preview_url = v)" @change="(v) => (data.preview_url = v)"
/> />
</div>
<div <div
class="preview" class="preview"
:class="{ :class="{
@@ -55,16 +58,31 @@
</template> </template>
<script setup> <script setup>
import { ref } from "vue" import { ref, computed } from "vue"
import ImageClip from "./image-clip.vue" import ImageClip from "./image-clip.vue"
defineProps({ const props = defineProps({
type: { type: {
type: String, type: String,
default: () => false default: () => false
} }
}) })
const tips = computed(() => {
if (props.type === "cover") {
return "Align crown to top, mid-thigh to bottom for best results."
}
if (props.type === "mainProductImage") {
return "Align crown to top, foot base to bottom for best results."
}
if (props.type === "sketch") {
return "Align crown to top, foot base to bottom for best results."
}
if (props.type === "apparel") {
return "Trim whitespace and center your apparel sketch."
}
})
const data = reactive({ const data = reactive({
url: "", url: "",
title: "Crop Image", title: "Crop Image",
@@ -126,6 +144,9 @@ defineExpose({
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 5rem; margin-bottom: 5rem;
&.is-product {
margin-bottom: 2.4rem;
}
> .title { > .title {
font-family: pingfang_heavy; font-family: pingfang_heavy;
font-size: 2.4rem; font-size: 2.4rem;
@@ -154,6 +175,15 @@ defineExpose({
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
&.is-product {
column-gap: 18.6rem;
}
.tips {
text-align: center;
color: #585858;
font-size: 1.4rem;
font-weight: 400;
}
> .image-clip { > .image-clip {
flex: 1; flex: 1;
&.is-product { &.is-product {