diff --git a/src/components/ColorInput/index.vue b/src/components/ColorInput/index.vue index abd083a1..63ff73cf 100644 --- a/src/components/ColorInput/index.vue +++ b/src/components/ColorInput/index.vue @@ -1,38 +1,18 @@ - + + + diff --git a/src/components/DiyEditor/components/mobile/MenuGrid/property.vue b/src/components/DiyEditor/components/mobile/MenuGrid/property.vue new file mode 100644 index 00000000..e09dd318 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuGrid/property.vue @@ -0,0 +1,96 @@ + + + + + + + 3个 + 4个 + + + + 菜单设置 + 拖动左侧的小圆点可以调整顺序 + + + + + + + + + + + 建议尺寸:44 * 44 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 添加菜单 + + + + + + + + + diff --git a/src/components/DiyEditor/components/mobile/MenuList/config.ts b/src/components/DiyEditor/components/mobile/MenuList/config.ts new file mode 100644 index 00000000..c42674f3 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuList/config.ts @@ -0,0 +1,47 @@ +import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util' +import { cloneDeep } from 'lodash-es' + +/** 列表导航属性 */ +export interface MenuListProperty { + // 导航菜单列表 + list: MenuListItemProperty[] + // 组件样式 + style: ComponentStyle +} +/** 列表导航项目属性 */ +export interface MenuListItemProperty { + // 图标链接 + iconUrl: string + // 标题 + title: string + // 标题颜色 + titleColor: string + // 副标题 + subtitle: string + // 副标题颜色 + subtitleColor: string + // 链接 + url: string +} + +export const EMPTY_MENU_LIST_ITEM_PROPERTY = { + title: '标题', + titleColor: '#333', + subtitle: '副标题', + subtitleColor: '#bbb' +} + +// 定义组件 +export const component = { + id: 'MenuList', + name: '列表导航', + icon: 'fa-solid:list', + property: { + list: [cloneDeep(EMPTY_MENU_LIST_ITEM_PROPERTY)], + style: { + bgType: 'color', + bgColor: '#fff', + marginBottom: 8 + } as ComponentStyle + } +} as DiyComponent diff --git a/src/components/DiyEditor/components/mobile/MenuList/index.vue b/src/components/DiyEditor/components/mobile/MenuList/index.vue new file mode 100644 index 00000000..9a56fd94 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuList/index.vue @@ -0,0 +1,31 @@ + + + + + + {{ item.title }} + + + {{ item.subtitle }} + + + + + + + + + diff --git a/src/components/DiyEditor/components/mobile/MenuList/property.vue b/src/components/DiyEditor/components/mobile/MenuList/property.vue new file mode 100644 index 00000000..270ca261 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuList/property.vue @@ -0,0 +1,75 @@ + + + 菜单设置 + 拖动左侧的小圆点可以调整顺序 + + + + + + + + + + + + + + 建议尺寸:44 * 44 + + + + + + + + + + + + + + + + + + 添加菜单 + + + + + + + + + diff --git a/src/components/DiyEditor/components/mobile/MenuSwiper/config.ts b/src/components/DiyEditor/components/mobile/MenuSwiper/config.ts new file mode 100644 index 00000000..fe5f4e87 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuSwiper/config.ts @@ -0,0 +1,66 @@ +import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util' +import { cloneDeep } from 'lodash-es' + +/** 菜单导航属性 */ +export interface MenuSwiperProperty { + // 布局: 图标+文字 | 图标 + layout: 'iconText' | 'icon' + // 行数 + row: number + // 列数 + column: number + // 导航菜单列表 + list: MenuSwiperItemProperty[] + // 组件样式 + style: ComponentStyle +} +/** 菜单导航项目属性 */ +export interface MenuSwiperItemProperty { + // 图标链接 + iconUrl: string + // 标题 + title: string + // 标题颜色 + titleColor: string + // 链接 + url: string + // 角标 + badge: { + // 是否显示 + show: boolean + // 角标文字 + text: string + // 角标文字颜色 + textColor: string + // 角标背景颜色 + bgColor: string + } +} + +export const EMPTY_MENU_SWIPER_ITEM_PROPERTY = { + title: '标题', + titleColor: '#333', + badge: { + show: false, + textColor: '#fff', + bgColor: '#FF6000' + } +} as MenuSwiperItemProperty + +// 定义组件 +export const component = { + id: 'MenuSwiper', + name: '菜单导航', + icon: 'bi:grid-3x2-gap', + property: { + layout: 'iconText', + row: 1, + column: 3, + list: [cloneDeep(EMPTY_MENU_SWIPER_ITEM_PROPERTY)], + style: { + bgType: 'color', + bgColor: '#fff', + marginBottom: 8 + } as ComponentStyle + } +} as DiyComponent diff --git a/src/components/DiyEditor/components/mobile/MenuSwiper/index.vue b/src/components/DiyEditor/components/mobile/MenuSwiper/index.vue new file mode 100644 index 00000000..6ae6439c --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuSwiper/index.vue @@ -0,0 +1,119 @@ + + + + + + + + + + {{ item.badge.text }} + + + + + + {{ item.title }} + + + + + + + + + + diff --git a/src/components/DiyEditor/components/mobile/MenuSwiper/property.vue b/src/components/DiyEditor/components/mobile/MenuSwiper/property.vue new file mode 100644 index 00000000..2175d57e --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuSwiper/property.vue @@ -0,0 +1,106 @@ + + + + + + + 图标+文字 + 仅图标 + + + + + 1行 + 2行 + + + + + 3列 + 4列 + 5列 + + + + 菜单设置 + 拖动左侧的小圆点可以调整顺序 + + + + + + + + + + + 建议尺寸:98 * 98 + + + + + + + + + + + + + + + + + + + + + + + + + + 添加菜单 + + + + + + + + + diff --git a/src/components/DiyEditor/util.ts b/src/components/DiyEditor/util.ts index 29b44cf6..5ae0a93f 100644 --- a/src/components/DiyEditor/util.ts +++ b/src/components/DiyEditor/util.ts @@ -100,16 +100,13 @@ export const PAGE_LIBS = [ { name: '基础组件', extended: true, - components: [ - 'SearchBar', - 'NoticeBar', - 'GridNavigation', - 'ListNavigation', - 'Divider', - 'TitleBar' - ] + components: ['SearchBar', 'NoticeBar', 'MenuSwiper', 'MenuGrid', 'MenuList'] + }, + { + name: '图文组件', + extended: true, + components: ['ImageBar', 'Carousel', 'TitleBar', 'VideoPlayer', 'Divider'] }, - { name: '图文组件', extended: true, components: ['ImageBar', 'Carousel', 'VideoPlayer'] }, { name: '商品组件', extended: true, components: ['ProductCard'] }, { name: '会员组件', diff --git a/src/components/InputWithColor/index.vue b/src/components/InputWithColor/index.vue new file mode 100644 index 00000000..2bc53172 --- /dev/null +++ b/src/components/InputWithColor/index.vue @@ -0,0 +1,59 @@ + + + + + + + + + + diff --git a/src/utils/color.ts b/src/utils/color.ts index 6888583a..13424e57 100644 --- a/src/utils/color.ts +++ b/src/utils/color.ts @@ -151,3 +151,24 @@ const subtractLight = (color: string, amount: number) => { const c = cc < 0 ? 0 : cc return c.toString(16).length > 1 ? c.toString(16) : `0${c.toString(16)}` } + +// 预设颜色 +export const PREDEFINE_COLORS = [ + '#ff4500', + '#ff8c00', + '#ffd700', + '#90ee90', + '#00ced1', + '#1e90ff', + '#c71585', + '#409EFF', + '#909399', + '#C0C4CC', + '#b7390b', + '#ff7800', + '#fad400', + '#5b8c5f', + '#00babd', + '#1f73c3', + '#711f57' +]