feat(image-tools): 文字模板扩至47套,新增小红书/抖音/B站/公众号/视频号/封面图7大分类
- text-tpls.ts:TextTpl 加 cat 分类字段,新增6平台×5套=30套品牌风模板 (小红书#FF2442/抖音#25F4EE#FE2C55/B站#00AEEC#FB7299/公众号深蓝红金/ 视频号#07C160/封面图高冲击),原17套归「通用」;导出 TPL_CATS + filterTpls() - 上传前模板墙 + 编辑器侧栏模板区各加分类标签条(全部/通用/小红书/抖音/ B站/公众号/视频号/封面图),一次只看一个平台;chip title 带 [分类] 前缀 - zh/en/描述文案同步 47套·7类 - 实测:墙47套8标签;分类计数17/5/5/5/5/5/5;点小红书模板→选图→ 自动插入2行白字粉描边;侧栏切抖音→5套;截图验收无溢出错位
This commit is contained in:
1 parent
4410d6f055
commit
704fabb9cb
6 files changed
+181
-29
No files matched your search
@@ -3,7 +3,7 @@
|
||||
// 图层类型:image(底图) / paint(画笔涂改层) / text(文字层) / fill(色块擦除层)
|
||||
import { useStorage } from '@vueuse/core';
|
||||
import { licenseHeaders } from '@/tools/license/license';
|
||||
import { TEXT_TPLS, tplStyle, type TextTpl } from './text-tpls';
|
||||
import { TEXT_TPLS, TPL_CATS, tplStyle, filterTpls, type TextTpl } from './text-tpls';
|
||||
|
||||
const props = defineProps<{ file: File; autoTpl?: TextTpl | null }>();
|
||||
const emit = defineEmits<{ (e: 'error', msg: string): void; (e: 'applied'): void }>();
|
||||
@@ -64,6 +64,8 @@ const brushColor = useStorage('image-tools:psx-color', '#d03050');
|
||||
const tolerance = useStorage('image-tools:psx-tol', 28);
|
||||
const newText = useStorage('image-tools:psx-text', '新文字');
|
||||
const fontSize = useStorage('image-tools:psx-font-v2', 100); // 默认 100 号(v2 key 避免旧 36 缓存)
|
||||
const tplCat = ref('全部'); // 模板分类标签
|
||||
const sideTpls = computed(() => filterTpls(tplCat.value));
|
||||
const fontColor = useStorage('image-tools:psx-fontcolor', '#ffffff');
|
||||
const fontBold = useStorage('image-tools:psx-bold', true);
|
||||
|
||||
@@ -1991,14 +1993,23 @@ onBeforeUnmount(() => {
|
||||
<div v-if="docW" class="psx-sec psx-tpl-sec">
|
||||
<div class="psx-sec-t">
|
||||
✨ 文字模板
|
||||
<span class="psx-tip">点击即插入套用</span>
|
||||
<span class="psx-tip">{{ TEXT_TPLS.length }} 套 · 点击即插入</span>
|
||||
</div>
|
||||
<div class="psx-tpl-cats">
|
||||
<button
|
||||
v-for="c in ['全部', ...TPL_CATS]"
|
||||
:key="c"
|
||||
class="psx-tpl-cat"
|
||||
:class="{ on: tplCat === c }"
|
||||
@click="tplCat = c"
|
||||
>{{ c }}</button>
|
||||
</div>
|
||||
<div class="psx-tpl-grid">
|
||||
<button
|
||||
v-for="t in TEXT_TPLS"
|
||||
v-for="t in sideTpls"
|
||||
:key="t.id"
|
||||
class="psx-tpl"
|
||||
:title="`${t.name}:${t.parts.join(' / ')} — ${activeLayer?.type === 'text' ? '应用样式到当前文字' : '插入整组文案'}`"
|
||||
:title="`[${t.cat}] ${t.name}:${t.parts.join(' / ')} — ${activeLayer?.type === 'text' ? '应用样式到当前文字' : '插入整组文案'}`"
|
||||
@click="applyTpl(t)"
|
||||
>
|
||||
<span class="psx-tpl-txt" :style="tplStyle(t)">{{ t.parts[0] }}</span>
|
||||
@@ -2262,6 +2273,38 @@ onBeforeUnmount(() => {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
&-tpl-cats {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
&-tpl-cat {
|
||||
border: 1px solid rgba(128, 128, 128, 0.32);
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
border-radius: 999px;
|
||||
font-size: 10.5px;
|
||||
line-height: 1;
|
||||
padding: 4px 8px;
|
||||
cursor: pointer;
|
||||
opacity: 0.75;
|
||||
transition: all 0.12s;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
border-color: #2563eb;
|
||||
}
|
||||
|
||||
&.on {
|
||||
background: #2563eb;
|
||||
border-color: #2563eb;
|
||||
color: #fff;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&-tpl-txt {
|
||||
font-size: 11.5px;
|
||||
line-height: 1.12;
|
||||
|
||||
Reference in new issue
Block a user