Hero issue fixes and visual changes
This commit is contained in:
@@ -8,12 +8,22 @@
|
||||
<form v-if="ready" class="card" @submit.prevent="save">
|
||||
<!-- HERO -->
|
||||
<template v-if="key === 'hero'">
|
||||
<div class="field"><label class="label">عنوان لودر ابتدای سایت</label><input v-model="form.loaderTitle" class="input" placeholder="هوشافزار منتک" /></div>
|
||||
<div class="field"><label class="label">برچسب بالای صفحه</label><input v-model="form.eyebrow" class="input" /></div>
|
||||
<div class="field"><label class="label">محل / سال تأسیس</label><input v-model="form.location" class="input" /></div>
|
||||
<div class="field"><label class="label">خط ۱ عنوان</label><input v-model="form.lines[0]" class="input" /></div>
|
||||
<div class="field"><label class="label">خط ۲ عنوان</label><input v-model="form.lines[1]" class="input" /></div>
|
||||
<div class="field"><label class="label">خط ۳ عنوان</label><input v-model="form.lines[2]" class="input" /></div>
|
||||
<div class="field"><label class="label">کلمهٔ برجسته (رنگی)</label><input v-model="form.highlightWord" class="input" /></div>
|
||||
<div class="field">
|
||||
<label class="label">خطوط عنوان اصلی</label>
|
||||
<div v-for="(_line, i) in form.lines" :key="i" class="row" style="gap: 0.5rem; margin-bottom: 0.5rem">
|
||||
<input v-model="form.lines[i]" class="input" :placeholder="`خط ${i + 1}`" />
|
||||
<button type="button" class="btn danger" @click="form.lines.splice(i, 1)">حذف</button>
|
||||
</div>
|
||||
<button type="button" class="btn ghost" @click="form.lines.push('')">+ افزودن خط</button>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">عبارتهای رنگی (هر خط یک عبارت — رنگ volt و فونت تاکید)</label>
|
||||
<textarea v-model="highlightWordsText" class="textarea" style="min-height: 90px" placeholder="هوشافزار منتک" />
|
||||
<p class="muted" style="margin-top: 0.35rem">هر عبارتی که داخل خطوط عنوان باشد، با رنگ متفاوت نمایش داده میشود.</p>
|
||||
</div>
|
||||
<div class="field"><label class="label">توضیح کوتاه</label><textarea v-model="form.body" class="textarea" /></div>
|
||||
<div class="field"><label class="label">متن دکمه</label><input v-model="form.cta" class="input" /></div>
|
||||
<div class="field"><label class="label">مختصات / موقعیت</label><input v-model="form.coords" class="input" /></div>
|
||||
@@ -168,6 +178,7 @@ const form = reactive<any>({});
|
||||
const marqueeText = ref("");
|
||||
const manifestoWordsText = ref("");
|
||||
const footerMarqueeText = ref("");
|
||||
const highlightWordsText = ref("");
|
||||
|
||||
function splitTags(v: string) {
|
||||
return v
|
||||
@@ -199,8 +210,15 @@ onMounted(async () => {
|
||||
Object.assign(form, structuredClone(data.data));
|
||||
|
||||
if (key === "hero") {
|
||||
form.lines = Array.isArray(form.lines) ? form.lines : ["", "", ""];
|
||||
while (form.lines.length < 3) form.lines.push("");
|
||||
form.lines = Array.isArray(form.lines) ? [...form.lines] : [""];
|
||||
if (!form.lines.length) form.lines.push("");
|
||||
form.loaderTitle = form.loaderTitle || "هوشافزار منتک";
|
||||
const words = Array.isArray(form.highlightWords) && form.highlightWords.length
|
||||
? form.highlightWords
|
||||
: form.highlightWord
|
||||
? [form.highlightWord]
|
||||
: [];
|
||||
highlightWordsText.value = words.join("\n");
|
||||
}
|
||||
if (key === "marquee") marqueeText.value = (form.items || []).join("\n");
|
||||
if (key === "manifesto") manifestoWordsText.value = wordsToText(form.words || []);
|
||||
@@ -211,7 +229,8 @@ onMounted(async () => {
|
||||
if (key === "process") form.steps = form.steps || [];
|
||||
if (key === "team") {
|
||||
form.members = (form.members || []).map((m: any) => ({ ...m, imageUrl: m.imageUrl || "" }));
|
||||
} if (key === "footer") {
|
||||
}
|
||||
if (key === "footer") {
|
||||
footerMarqueeText.value = (form.marquee || []).join("\n");
|
||||
}
|
||||
ready.value = true;
|
||||
@@ -222,6 +241,19 @@ function buildPayload() {
|
||||
if (key === "manifesto") {
|
||||
return { tag: form.tag, body: form.body, words: textToWords(manifestoWordsText.value) };
|
||||
}
|
||||
if (key === "hero") {
|
||||
const words = highlightWordsText.value
|
||||
.split("\n")
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
return {
|
||||
...form,
|
||||
lines: (form.lines || []).map((s: string) => String(s || "").trim()).filter(Boolean),
|
||||
highlightWords: words,
|
||||
highlightWord: words[0] || form.highlightWord || "",
|
||||
loaderTitle: form.loaderTitle || "هوشافزار منتک",
|
||||
};
|
||||
}
|
||||
if (key === "footer") {
|
||||
return {
|
||||
tag: form.tag,
|
||||
|
||||
Reference in New Issue
Block a user