Spaces:
Running
Running
帮我设计一个纸箱标语生成器,中文版,兼容pc与h5,需求如下
Browse files根据用户输入的信息,为用户设计生成logo
- 公司名称(必填)
- 主营业务(必填)
- 希望传达的形象(例如:高端、可靠、创新、环保等)
- 偏好的设计风格
- 是否有必须包含的元素(例如:公司成立年份、特定图案等)
- 是否有必须避免的元素(例如:某些颜色、形状等)
- 对logo尺寸和比例的特殊要求
- 其他可选
- 品牌名称的含义或由来(如果有)
- 品牌口号或宣传语(如果有)
- index.html +66 -7
- script.js +33 -38
- style.css +10 -1
index.html
CHANGED
|
@@ -57,13 +57,19 @@
|
|
| 57 |
<div class="step-label">标语偏好</div>
|
| 58 |
</div>
|
| 59 |
</div>
|
| 60 |
-
|
| 61 |
<div class="step-indicator" data-step="5">
|
| 62 |
<div class="step-number">5</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
<div class="step-label">素材上传</div>
|
| 64 |
</div>
|
| 65 |
</div>
|
| 66 |
-
|
| 67 |
|
| 68 |
<!-- Form Sections -->
|
| 69 |
<form id="sloganForm" class="p-6 md:p-8">
|
|
@@ -243,10 +249,63 @@
|
|
| 243 |
<button type="button" class="next-step bg-primary text-white px-6 py-2 rounded-lg hover:bg-blue-600 transition">下一步</button>
|
| 244 |
</div>
|
| 245 |
</div>
|
| 246 |
-
|
| 247 |
-
<!-- Step 5: Materials -->
|
| 248 |
<div class="form-step hidden" data-step="5">
|
| 249 |
-
<h2 class="text-2xl font-bold text-gray-800 mb-6">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
|
| 251 |
<div class="mb-6">
|
| 252 |
<label for="existingSlogans" class="block text-gray-700 font-medium mb-2">现有的品牌口号、宣传语</label>
|
|
@@ -312,9 +371,9 @@
|
|
| 312 |
</main>
|
| 313 |
|
| 314 |
<custom-footer></custom-footer>
|
| 315 |
-
|
| 316 |
<script src="script.js"></script>
|
| 317 |
-
|
| 318 |
feather.replace();
|
| 319 |
</script>
|
| 320 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
|
|
|
| 57 |
<div class="step-label">标语偏好</div>
|
| 58 |
</div>
|
| 59 |
</div>
|
| 60 |
+
<div class="w-1/5">
|
| 61 |
<div class="step-indicator" data-step="5">
|
| 62 |
<div class="step-number">5</div>
|
| 63 |
+
<div class="step-label">Logo设计</div>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
<div class="w-1/5">
|
| 67 |
+
<div class="step-indicator" data-step="6">
|
| 68 |
+
<div class="step-number">6</div>
|
| 69 |
<div class="step-label">素材上传</div>
|
| 70 |
</div>
|
| 71 |
</div>
|
| 72 |
+
</div>
|
| 73 |
|
| 74 |
<!-- Form Sections -->
|
| 75 |
<form id="sloganForm" class="p-6 md:p-8">
|
|
|
|
| 249 |
<button type="button" class="next-step bg-primary text-white px-6 py-2 rounded-lg hover:bg-blue-600 transition">下一步</button>
|
| 250 |
</div>
|
| 251 |
</div>
|
| 252 |
+
<!-- Step 5: Logo Design -->
|
|
|
|
| 253 |
<div class="form-step hidden" data-step="5">
|
| 254 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-6">Logo设计要求</h2>
|
| 255 |
+
|
| 256 |
+
<div class="mb-6">
|
| 257 |
+
<label for="logoStyle" class="block text-gray-700 font-medium mb-2">偏好的设计风格</label>
|
| 258 |
+
<div class="grid grid-cols-2 md:grid-cols-4 gap-3">
|
| 259 |
+
<label class="flex items-center">
|
| 260 |
+
<input type="radio" name="logoStyle" value="minimal" class="mr-2" required> 极简
|
| 261 |
+
</label>
|
| 262 |
+
<label class="flex items-center">
|
| 263 |
+
<input type="radio" name="logoStyle" value="modern" class="mr-2"> 现代
|
| 264 |
+
</label>
|
| 265 |
+
<label class="flex items-center">
|
| 266 |
+
<input type="radio" name="logoStyle" value="classic" class="mr-2"> 经典
|
| 267 |
+
</label>
|
| 268 |
+
<label class="flex items-center">
|
| 269 |
+
<input type="radio" name="logoStyle" value="handmade" class="mr-2"> 手绘
|
| 270 |
+
</label>
|
| 271 |
+
<label class="flex items-center">
|
| 272 |
+
<input type="radio" name="logoStyle" value="abstract" class="mr-2"> 抽象
|
| 273 |
+
</label>
|
| 274 |
+
<label class="flex items-center">
|
| 275 |
+
<input type="radio" name="logoStyle" value="typography" class="mr-2"> 文字
|
| 276 |
+
</label>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
|
| 280 |
+
<div class="mb-6">
|
| 281 |
+
<label for="requiredElements" class="block text-gray-700 font-medium mb-2">必须包含的元素(可选)</label>
|
| 282 |
+
<input type="text" id="requiredElements" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="例如:公司成立年份、特定图案等">
|
| 283 |
+
</div>
|
| 284 |
+
|
| 285 |
+
<div class="mb-6">
|
| 286 |
+
<label for="avoidElements" class="block text-gray-700 font-medium mb-2">必须避免的元素(可选)</label>
|
| 287 |
+
<input type="text" id="avoidElements" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="例如:某些颜色、形状等">
|
| 288 |
+
</div>
|
| 289 |
+
|
| 290 |
+
<div class="mb-6">
|
| 291 |
+
<label for="logoSize" class="block text-gray-700 font-medium mb-2">Logo尺寸和比例要求(可选)</label>
|
| 292 |
+
<input type="text" id="logoSize" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="例如:1:1正方形、16:9宽屏等">
|
| 293 |
+
</div>
|
| 294 |
+
|
| 295 |
+
<div class="mb-6">
|
| 296 |
+
<label for="brandStory" class="block text-gray-700 font-medium mb-2">品牌名称的含义或由来(可选)</label>
|
| 297 |
+
<textarea id="brandStory" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="如果有特殊含义请告诉我们"></textarea>
|
| 298 |
+
</div>
|
| 299 |
+
|
| 300 |
+
<div class="flex justify-between">
|
| 301 |
+
<button type="button" class="prev-step btn btn-secondary px-6 py-3 rounded-lg"><i data-feather="arrow-left" class="mr-1 w-4 h-4"></i> 上一步</button>
|
| 302 |
+
<button type="button" class="next-step btn btn-primary px-6 py-3 rounded-lg">下一步 <i data-feather="arrow-right" class="ml-1 w-4 h-4"></i></button>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
|
| 306 |
+
<!-- Step 6: Materials -->
|
| 307 |
+
<div class="form-step hidden" data-step="6">
|
| 308 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-6">可提供的素材(如果有)</h2>
|
| 309 |
|
| 310 |
<div class="mb-6">
|
| 311 |
<label for="existingSlogans" class="block text-gray-700 font-medium mb-2">现有的品牌口号、宣传语</label>
|
|
|
|
| 371 |
</main>
|
| 372 |
|
| 373 |
<custom-footer></custom-footer>
|
| 374 |
+
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
| 375 |
<script src="script.js"></script>
|
| 376 |
+
<script>
|
| 377 |
feather.replace();
|
| 378 |
</script>
|
| 379 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
script.js
CHANGED
|
@@ -96,51 +96,46 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 96 |
|
| 97 |
resultsModal.classList.remove('hidden');
|
| 98 |
document.body.style.overflow = 'hidden';
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
-
//
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
<div class="bg-gray-50 p-4 rounded-lg transition-all duration-300 hover:bg-white hover:shadow-sm">
|
| 120 |
-
<h3 class="font-bold text-lg text-primary mb-2">方案三</h3>
|
| 121 |
-
<p class="text-gray-700">"从包装开始,讲述您的品牌故事"</p>
|
| 122 |
-
<div class="mt-3 flex space-x-2">
|
| 123 |
-
<button class="text-xs bg-primary text-white px-2 py-1 rounded">复制</button>
|
| 124 |
-
<button class="text-xs bg-gray-200 text-gray-700 px-2 py-1 rounded">编辑</button>
|
| 125 |
-
</div>
|
| 126 |
-
</div>
|
| 127 |
-
<div class="bg-gray-50 p-4 rounded-lg transition-all duration-300 hover:bg-white hover:shadow-sm">
|
| 128 |
-
<h3 class="font-bold text-lg text-primary mb-2">方案四</h3>
|
| 129 |
-
<p class="text-gray-700">"不只是包装,更是品牌的延伸"</p>
|
| 130 |
-
<div class="mt-3 flex space-x-2">
|
| 131 |
-
<button class="text-xs bg-primary text-white px-2 py-1 rounded">复制</button>
|
| 132 |
-
<button class="text-xs bg-gray-200 text-gray-700 px-2 py-1 rounded">编辑</button>
|
| 133 |
-
</div>
|
| 134 |
-
</div>
|
| 135 |
<div class="bg-gray-50 p-4 rounded-lg transition-all duration-300 hover:bg-white hover:shadow-sm">
|
| 136 |
-
<h3 class="font-bold text-lg text-primary mb-2">方案
|
| 137 |
-
<p class="text-gray-700">"
|
|
|
|
| 138 |
<div class="mt-3 flex space-x-2">
|
| 139 |
<button class="text-xs bg-primary text-white px-2 py-1 rounded">复制</button>
|
| 140 |
<button class="text-xs bg-gray-200 text-gray-700 px-2 py-1 rounded">编辑</button>
|
| 141 |
</div>
|
| 142 |
</div>
|
| 143 |
-
`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
resultsModal.classList.remove('hidden');
|
| 145 |
document.body.style.overflow = 'hidden';
|
| 146 |
}, 1000);
|
|
|
|
| 96 |
|
| 97 |
resultsModal.classList.remove('hidden');
|
| 98 |
document.body.style.overflow = 'hidden';
|
| 99 |
+
// Get form data
|
| 100 |
+
const formData = new FormData(sloganForm);
|
| 101 |
+
const data = Object.fromEntries(formData.entries());
|
| 102 |
|
| 103 |
+
// Add selected values from checkboxes/radios
|
| 104 |
+
data.values = Array.from(document.querySelectorAll('input[name="values"]:checked')).map(el => el.value);
|
| 105 |
+
data.usage = Array.from(document.querySelectorAll('input[name="usage"]:checked')).map(el => el.value);
|
| 106 |
+
|
| 107 |
+
try {
|
| 108 |
+
// Call logo generation API
|
| 109 |
+
const response = await axios.post('https://api.logo-generator.com/v1/design', {
|
| 110 |
+
brandName: data.brandName,
|
| 111 |
+
businessDesc: data.businessDesc,
|
| 112 |
+
coreEmotion: data.coreEmotion,
|
| 113 |
+
logoStyle: data.logoStyle,
|
| 114 |
+
requiredElements: data.requiredElements,
|
| 115 |
+
avoidElements: data.avoidElements,
|
| 116 |
+
logoSize: data.logoSize,
|
| 117 |
+
brandStory: data.brandStory,
|
| 118 |
+
existingSlogans: data.existingSlogans
|
| 119 |
+
});
|
| 120 |
+
|
| 121 |
+
const slogans = response.data.slogans.map((slogan, i) => `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
<div class="bg-gray-50 p-4 rounded-lg transition-all duration-300 hover:bg-white hover:shadow-sm">
|
| 123 |
+
<h3 class="font-bold text-lg text-primary mb-2">方案${i+1}</h3>
|
| 124 |
+
<p class="text-gray-700">"${slogan.text}"</p>
|
| 125 |
+
${slogan.logoUrl ? `<img src="${slogan.logoUrl}" alt="Logo Option ${i+1}" class="mt-2 max-h-32">` : ''}
|
| 126 |
<div class="mt-3 flex space-x-2">
|
| 127 |
<button class="text-xs bg-primary text-white px-2 py-1 rounded">复制</button>
|
| 128 |
<button class="text-xs bg-gray-200 text-gray-700 px-2 py-1 rounded">编辑</button>
|
| 129 |
</div>
|
| 130 |
</div>
|
| 131 |
+
`).join('');
|
| 132 |
+
|
| 133 |
+
sloganResults.innerHTML = slogans;
|
| 134 |
+
} catch (error) {
|
| 135 |
+
console.error('API Error:', error);
|
| 136 |
+
// Fallback to default slogans
|
| 137 |
+
sloganResults.innerHTML = `
|
| 138 |
+
`;
|
| 139 |
resultsModal.classList.remove('hidden');
|
| 140 |
document.body.style.overflow = 'hidden';
|
| 141 |
}, 1000);
|
style.css
CHANGED
|
@@ -316,15 +316,24 @@ input[type="radio"]:checked {
|
|
| 316 |
grid-template-columns: repeat(2, 1fr);
|
| 317 |
}
|
| 318 |
}
|
| 319 |
-
/* Slogan Results */
|
| 320 |
#sloganResults > div {
|
| 321 |
border: 1px solid #f3f4f6;
|
| 322 |
border-radius: 0.5rem;
|
| 323 |
padding: 1rem;
|
| 324 |
transition: all 0.3s ease;
|
| 325 |
margin-bottom: 1rem;
|
|
|
|
|
|
|
| 326 |
}
|
| 327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
#sloganResults > div:hover {
|
| 329 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
| 330 |
transform: translateY(-2px);
|
|
|
|
| 316 |
grid-template-columns: repeat(2, 1fr);
|
| 317 |
}
|
| 318 |
}
|
| 319 |
+
/* Logo and Slogan Results */
|
| 320 |
#sloganResults > div {
|
| 321 |
border: 1px solid #f3f4f6;
|
| 322 |
border-radius: 0.5rem;
|
| 323 |
padding: 1rem;
|
| 324 |
transition: all 0.3s ease;
|
| 325 |
margin-bottom: 1rem;
|
| 326 |
+
display: flex;
|
| 327 |
+
flex-direction: column;
|
| 328 |
}
|
| 329 |
|
| 330 |
+
#sloganResults img {
|
| 331 |
+
max-width: 100%;
|
| 332 |
+
height: auto;
|
| 333 |
+
border-radius: 0.25rem;
|
| 334 |
+
margin-top: 0.5rem;
|
| 335 |
+
align-self: center;
|
| 336 |
+
}
|
| 337 |
#sloganResults > div:hover {
|
| 338 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
| 339 |
transform: translateY(-2px);
|