feat(manager): 组件面板改为图标+文字双列布局

- config.js 21 个面板条目新增 icon 字段(element-plus 图标)
- 面板 item 渲染 el-icon + 名称,替换死的 img 占位
- 面板容器改 grid 两列,卡片式样式含 hover 高亮
This commit is contained in:
pikachu1995@126.com
2026-10-12 14:59:47 +08:00
parent ebbf42cb76
commit a804120fa2
3 changed files with 84 additions and 10 deletions

View File

@@ -13,6 +13,7 @@ export const modelData = [
{ {
type: "flexOne", type: "flexOne",
name: "图片", name: "图片",
icon: "Picture",
group: "base", group: "base",
// drawer: true, // drawer: true,
notAdd: true, notAdd: true,
@@ -33,6 +34,7 @@ export const modelData = [
{ {
type: "carousel", type: "carousel",
name: "轮播图", name: "轮播图",
icon: "PictureFilled",
group: "base", group: "base",
img: "md-image", img: "md-image",
// onlyImg: true, // onlyImg: true,
@@ -101,6 +103,7 @@ export const modelData = [
{ {
type: "title", type: "title",
name: "标题栏", name: "标题栏",
icon: "Collection",
group: "tools", group: "tools",
img: "md-image", img: "md-image",
// notTitle:true, // notTitle:true,
@@ -370,6 +373,7 @@ export const modelData = [
{ {
type: "textPicture", type: "textPicture",
name: "文字图片", name: "文字图片",
icon: "Document",
group: "base", group: "base",
drawer: true, drawer: true,
notAdd: true, notAdd: true,
@@ -416,6 +420,7 @@ export const modelData = [
{ {
type: "tpl_ad_list", type: "tpl_ad_list",
name: "广告魔方", name: "广告魔方",
icon: "Grid",
group: "base", group: "base",
img: "md-image", img: "md-image",
options: { options: {
@@ -431,6 +436,7 @@ export const modelData = [
{ {
type: "menu", type: "menu",
name: "宫格导航", name: "宫格导航",
icon: "Menu",
group: "base", group: "base",
img: "md-image", img: "md-image",
close: true, close: true,
@@ -482,6 +488,7 @@ export const modelData = [
{ {
type: "search", type: "search",
name: "搜索", name: "搜索",
icon: "Search",
group: "base", group: "base",
img: "md-image", img: "md-image",
notAdd: true, notAdd: true,
@@ -498,6 +505,7 @@ export const modelData = [
{ {
type: "goods", type: "goods",
name: "商品分类", name: "商品分类",
icon: "Goods",
group: "base", group: "base",
img: "md-image", img: "md-image",
notAdd: true, notAdd: true,
@@ -565,6 +573,7 @@ export const modelData = [
{ {
type: "notice", type: "notice",
name: "公告", name: "公告",
icon: "Bell",
group: "base", group: "base",
img: "md-image", img: "md-image",
notAdd: false, notAdd: false,
@@ -591,6 +600,7 @@ export const modelData = [
type: "promotionDetail", type: "promotionDetail",
promotionsType: "PINTUAN", promotionsType: "PINTUAN",
name: "拼团活动", name: "拼团活动",
icon: "UserFilled",
subBkColor: "#e1212b", subBkColor: "#e1212b",
subName: "惊喜折扣", subName: "惊喜折扣",
subColor: "#fff", subColor: "#fff",
@@ -608,6 +618,7 @@ export const modelData = [
type: "promotionDetail", type: "promotionDetail",
promotionsType: "LIVE", promotionsType: "LIVE",
name: "直播活动", name: "直播活动",
icon: "VideoPlay",
subBkColor: "#e1212b", subBkColor: "#e1212b",
subName: "优惠好价", subName: "优惠好价",
subColor: "#fff", subColor: "#fff",
@@ -625,6 +636,7 @@ export const modelData = [
type: "promotionDetail", type: "promotionDetail",
promotionsType: "SECKILL", promotionsType: "SECKILL",
name: "秒杀活动", name: "秒杀活动",
icon: "Timer",
subBkColor: "#e1212b", subBkColor: "#e1212b",
subName: "x点场", subName: "x点场",
subColor: "#fff", subColor: "#fff",
@@ -642,6 +654,7 @@ export const modelData = [
type: "promotionDetail", type: "promotionDetail",
promotionsType: "KANJIA", promotionsType: "KANJIA",
name: "砍价活动", name: "砍价活动",
icon: "Scissor",
subBkColor: "#e1212b", subBkColor: "#e1212b",
subName: "超值好物", subName: "超值好物",
subColor: "#fff", subColor: "#fff",
@@ -653,6 +666,7 @@ export const modelData = [
{ {
type: "video", type: "video",
name: "视频", name: "视频",
icon: "VideoCamera",
group: "base", group: "base",
img: "md-image", img: "md-image",
notAdd: true, notAdd: true,
@@ -694,6 +708,7 @@ export const modelData = [
{ {
type: "blank", type: "blank",
name: "辅助空白", name: "辅助空白",
icon: "Crop",
group: "tools", group: "tools",
img: "md-image", img: "md-image",
options: { options: {
@@ -706,6 +721,7 @@ export const modelData = [
{ {
type: "line", type: "line",
name: "辅助线", name: "辅助线",
icon: "Minus",
group: "tools", group: "tools",
img: "md-image", img: "md-image",
options: { options: {
@@ -720,6 +736,7 @@ export const modelData = [
{ {
type: "richText", type: "richText",
name: "富文本", name: "富文本",
icon: "EditPen",
group: "tools", group: "tools",
img: "md-image", img: "md-image",
options: { options: {
@@ -733,6 +750,7 @@ export const modelData = [
{ {
type: "integral", type: "integral",
name: "积分商城", name: "积分商城",
icon: "Coin",
group: "marketing", group: "marketing",
img: "md-image", img: "md-image",
options: { options: {
@@ -746,6 +764,7 @@ export const modelData = [
{ {
type: "coupon", type: "coupon",
name: "优惠券", name: "优惠券",
icon: "Ticket",
group: "marketing", group: "marketing",
img: "md-image", img: "md-image",
options: { options: {
@@ -759,6 +778,7 @@ export const modelData = [
{ {
type: "article", type: "article",
name: "文章列表", name: "文章列表",
icon: "Tickets",
group: "base", group: "base",
img: "md-image", img: "md-image",
options: { options: {
@@ -772,6 +792,7 @@ export const modelData = [
{ {
type: "shop", type: "shop",
name: "店铺列表", name: "店铺列表",
icon: "Shop",
group: "base", group: "base",
img: "md-image", img: "md-image",
options: { options: {

View File

@@ -21,7 +21,9 @@
> >
<template #item="{ element: model }"> <template #item="{ element: model }">
<li class="model-item"> <li class="model-item">
<img src alt /> <el-icon v-if="model.icon" :size="22">
<component :is="model.icon" />
</el-icon>
<span>{{ model.name }}</span> <span>{{ model.name }}</span>
</li> </li>
</template> </template>
@@ -85,7 +87,30 @@
</div> </div>
</template> </template>
<script> <script>
import { CircleClose } from "@element-plus/icons-vue"; import {
CircleClose,
Picture,
PictureFilled,
Document,
Grid,
Menu,
Search,
Goods,
Bell,
VideoCamera,
VideoPlay,
Tickets,
Shop,
UserFilled,
Timer,
Scissor,
Coin,
Ticket,
Collection,
Crop,
Minus,
EditPen,
} from "@element-plus/icons-vue";
import templates from "./template/index"; import templates from "./template/index";
import Draggable from "vuedraggable"; import Draggable from "vuedraggable";
import { modelData } from "./config"; import { modelData } from "./config";
@@ -97,6 +122,27 @@ export default {
Draggable, Draggable,
decorate, decorate,
CircleClose, CircleClose,
Picture,
PictureFilled,
Document,
Grid,
Menu,
Search,
Goods,
Bell,
VideoCamera,
VideoPlay,
Tickets,
Shop,
UserFilled,
Timer,
Scissor,
Coin,
Ticket,
Collection,
Crop,
Minus,
EditPen,
}, },
data() { data() {
return { return {

View File

@@ -4,9 +4,10 @@
flex: 1.5; flex: 1.5;
min-width: 250px; min-width: 250px;
.model-view-menu-item { .model-view-menu-item {
display: flex; display: grid;
align-items: center; grid-template-columns: 1fr 1fr;
flex-wrap: wrap; gap: 10px;
padding: 0 5px;
} }
.model-group-title { .model-group-title {
font-size: 13px; font-size: 13px;
@@ -25,17 +26,23 @@
flex: 6; flex: 6;
} }
.model-item { .model-item {
line-height: 1.75; line-height: 1.5;
font-size: 13px; font-size: 12px;
margin: 0 5px 10px 5px;
border: 1px solid #ededed; border: 1px solid #ededed;
background: #f6f6f9; background: #f6f6f9;
width: 70px; border-radius: 6px;
height: 70px; height: 64px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
gap: 4px;
color: #606266;
cursor: grab;
&:hover {
border-color: #409eff;
color: #409eff;
}
} }
} }
.model-view-content { .model-view-content {